Reduce number of calls to queue_draw().

portnov [2008-08-27 13:41:17]
Reduce number of calls to queue_draw().
Filename
qwerty.py
diff --git a/qwerty.py b/qwerty.py
index c4110cd..cea8aca 100755
--- a/qwerty.py
+++ b/qwerty.py
@@ -195,7 +195,7 @@ class SuperButton(gtk.DrawingArea):
         self.running = False
         self.desc = None
         self.cls = None
-        self.queue_draw()
+#         self.queue_draw()

 class SectionButton(SuperButton):
     def draw_button(self,cr):
@@ -671,6 +671,12 @@ class GUI(object):
     def on_section(self,widget,event=None):
         self.show_section(widget.key, self.translate_mods(event))

+    def refresh(self):
+        for b in self.sbuttons:
+            b.queue_draw()
+        for b in self.buttons.values():
+            b.queue_draw()
+
     def show_section(self,k,mods):
         global sections
         global defsection
@@ -690,9 +696,6 @@ class GUI(object):

         self.sbuttons[id].active = True

-        for b in self.sbuttons:
-            b.queue_draw()
-
         for b in self.buttons:
             btn = self.buttons[b]
             btn.clear()
@@ -710,7 +713,7 @@ class GUI(object):
             if hasattr(K,'cls'):
               if K.cls in self.by_class:
                   btn.mark_running(K.cls)
-            btn.queue_draw()
+        self.refresh()

 parse_config()
ViewGit