commit-gnuradio
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Commit-gnuradio] r10958 - in gnuradio/trunk/grc/src: gui platforms/gui


From: jblum
Subject: [Commit-gnuradio] r10958 - in gnuradio/trunk/grc/src: gui platforms/gui
Date: Tue, 5 May 2009 12:35:39 -0600 (MDT)

Author: jblum
Date: 2009-05-05 12:35:39 -0600 (Tue, 05 May 2009)
New Revision: 10958

Modified:
   gnuradio/trunk/grc/src/gui/ActionHandler.py
   gnuradio/trunk/grc/src/platforms/gui/FlowGraph.py
Log:
speed up for flow graphs with many blocks:
separated highlighting update logic so update does not have to be called on 
selection.



Modified: gnuradio/trunk/grc/src/gui/ActionHandler.py
===================================================================
--- gnuradio/trunk/grc/src/gui/ActionHandler.py 2009-05-05 18:22:34 UTC (rev 
10957)
+++ gnuradio/trunk/grc/src/gui/ActionHandler.py 2009-05-05 18:35:39 UTC (rev 
10958)
@@ -150,10 +150,9 @@
                # Selections
                ##################################################
                elif state == Actions.ELEMENT_SELECT:
-                       self.get_flow_graph().update()
+                       pass #do nothing, update routines below
                elif state == Actions.NOTHING_SELECT:
                        self.get_flow_graph().unselect()
-                       self.get_flow_graph().update()
                ##################################################
                # Enable/Disable
                ##################################################
@@ -345,6 +344,7 @@
                
Actions.get_action_from_name(Actions.FLOW_GRAPH_SAVE).set_sensitive(not 
self.get_page().get_saved())
                self.main_window.update()
                #draw the flow graph
+               self.get_flow_graph().update_highlighting()
                self.get_flow_graph().queue_draw()
 
        def update_exec_stop(self):

Modified: gnuradio/trunk/grc/src/platforms/gui/FlowGraph.py
===================================================================
--- gnuradio/trunk/grc/src/platforms/gui/FlowGraph.py   2009-05-05 18:22:34 UTC 
(rev 10957)
+++ gnuradio/trunk/grc/src/platforms/gui/FlowGraph.py   2009-05-05 18:35:39 UTC 
(rev 10958)
@@ -275,21 +275,27 @@
                for selected_element in self.get_selected_connections() + 
self.get_selected_blocks():
                        selected_element.draw(gc, window)
 
+       def update_highlighting(self):
+               """
+               Update highlighting so only the selected are highlighted.
+               """
+               selected_elements = self.get_selected_elements()
+               for element in self.get_elements():
+                       element.set_highlighted(element in selected_elements)
+
        def update(self):
                """
                Removed deleted elements from the selected elements list.
-               Update highlighting so only the selected is highlighted.
                Call update on all elements.
                """
                selected_elements = self.get_selected_elements()
+               elements = self.get_elements()
                #remove deleted elements
                for selected in selected_elements:
-                       if selected not in self.get_elements():
-                               selected_elements.remove(selected)
-               #set highlight and update all
-               for element in self.get_elements():
-                       element.set_highlighted(element in selected_elements)
-                       element.update()
+                       if selected in elements: continue
+                       selected_elements.remove(selected)
+               #update all
+               for element in elements: element.update()
 
        
##########################################################################
        ## Get Selected





reply via email to

[Prev in Thread] Current Thread [Next in Thread]