From: NeilBrown Date: Mon, 16 Dec 2013 02:24:49 +0000 (+1100) Subject: plato: allow window list to be refreshed. X-Git-Url: http://git.neil.brown.name/?a=commitdiff_plain;h=306f056f817859ecf134ee133ea5d7fd113184f6;p=plato.git plato: allow window list to be refreshed. 1/ this shouldn't be needed 2/ it is not yet enough as when windows disappear we don't notice that the command is no longer active. --- diff --git a/plato/window_group.py b/plato/window_group.py index fb55295..7f908d7 100644 --- a/plato/window_group.py +++ b/plato/window_group.py @@ -32,6 +32,20 @@ class Wwrap: os.kill(self.w.pid, 15) return + +class win_refresh: + def __init__(self, winlist): + self.format='cmd' + self.embedded = lambda:None + self.winlist = winlist + + def get_name(self): + return "Windows" + def buttons(self): + return ["Refresh"] + def press(self, ind): + self.winlist.get_list() + class WindowType: def __init__(self, win, name): self.owner = win @@ -42,6 +56,7 @@ class WindowType: self.ignore = [] self.list = winlist(add_handle = self.add) self.current = {} + self.my_refresh = win_refresh(self.list) gobject.io_add_watch(self.list.fd, gobject.IO_IN, self.list.events) self.list.on_change(self.change, self.add, self.delete) @@ -50,6 +65,9 @@ class WindowType: self.ignore.append(line) def get_task(self, ind): + if ind == 0: + return self.my_refresh + ind -= 1 w = self.list.winfo if ind >= len(w): return None