]> git.gag.com Git - debian/gnuradio/commitdiff
speed up for flow graphs with many blocks:
authorjblum <jblum@221aa14e-8319-0410-a670-987f0aec2ac5>
Tue, 5 May 2009 18:35:39 +0000 (18:35 +0000)
committerjblum <jblum@221aa14e-8319-0410-a670-987f0aec2ac5>
Tue, 5 May 2009 18:35:39 +0000 (18:35 +0000)
separated highlighting update logic so update does not have to be called on selection.

git-svn-id: http://gnuradio.org/svn/gnuradio/trunk@10958 221aa14e-8319-0410-a670-987f0aec2ac5

grc/src/gui/ActionHandler.py
grc/src/platforms/gui/FlowGraph.py

index da0909a647eb7c4697989edd6e91da936536210c..dffba62a3042a2f91090ee409f4eaece46410186 100644 (file)
@@ -150,10 +150,9 @@ class ActionHandler:
                # 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 @@ class ActionHandler:
                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):
index 37157ac7cc93606a5a1dea7b143b98684a9a7706..11942eb2e34029bcc50db1173152ca07a4efd319 100644 (file)
@@ -275,21 +275,27 @@ class FlowGraph(Element):
                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