]> git.neil.brown.name Git - plato.git/commitdiff
plato: allow window list to be refreshed.
authorNeilBrown <neilb@suse.de>
Mon, 16 Dec 2013 02:24:49 +0000 (13:24 +1100)
committerNeilBrown <neilb@suse.de>
Mon, 16 Dec 2013 02:24:49 +0000 (13:24 +1100)
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.

plato/window_group.py

index fb55295d4932751a96d2520fdbb274337cc78056..7f908d717aec5984e57c941648e8025f701142e4 100644 (file)
@@ -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