commit-gnuradio
[Top][All Lists]
Advanced

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

[Commit-gnuradio] [gnuradio] 01/10: grc: Reloading blocks forces reload


From: git
Subject: [Commit-gnuradio] [gnuradio] 01/10: grc: Reloading blocks forces reload for all open flow graphs.
Date: Tue, 26 Aug 2014 19:40:07 +0000 (UTC)

This is an automated email from the git hooks/post-receive script.

jcorgan pushed a commit to branch master
in repository gnuradio.

commit 7f93764ed17c4ad741c41d62e3acdbfd1a485d10
Author: Seth Hitefield <address@hidden>
Date:   Fri Aug 22 16:33:52 2014 -0400

    grc: Reloading blocks forces reload for all open flow graphs.
---
 grc/gui/ActionHandler.py |  3 +++
 grc/gui/FlowGraph.py     | 17 +++++++++++++++++
 grc/gui/MainWindow.py    |  9 +++++++++
 3 files changed, 29 insertions(+)

diff --git a/grc/gui/ActionHandler.py b/grc/gui/ActionHandler.py
index dcc3c84..60fa070 100644
--- a/grc/gui/ActionHandler.py
+++ b/grc/gui/ActionHandler.py
@@ -496,6 +496,9 @@ class ActionHandler:
             self.platform.load_block_tree(self.main_window.btwin)
             
Actions.XML_PARSER_ERRORS_DISPLAY.set_sensitive(bool(ParseXML.xml_failures))
             Messages.send_xml_errors_if_any(ParseXML.xml_failures)
+            # Force a redraw of the graph, by getting the current state and 
re-importing it
+            self.main_window.update_pages()
+            
         elif action == Actions.FIND_BLOCKS:
             self.main_window.btwin.show()
             self.main_window.btwin.search_entry.show()
diff --git a/grc/gui/FlowGraph.py b/grc/gui/FlowGraph.py
index 31017a9..44d46b9 100644
--- a/grc/gui/FlowGraph.py
+++ b/grc/gui/FlowGraph.py
@@ -348,6 +348,23 @@ class FlowGraph(Element):
         self.create_labels()
         self.create_shapes()
 
+    def reload(self):
+        """
+        Reload flow-graph (with updated blocks)
+
+        Args:
+            page: the page to reload (None means current)
+        Returns:
+            False if some error occurred during import
+        """
+        success = False
+        data = self.export_data()
+        if data:
+            self.unselect()
+            success = self.import_data(data)
+            self.update()
+        return success
+
     ##########################################################################
     ## Get Selected
     ##########################################################################
diff --git a/grc/gui/MainWindow.py b/grc/gui/MainWindow.py
index a2853bd..75d9dce 100644
--- a/grc/gui/MainWindow.py
+++ b/grc/gui/MainWindow.py
@@ -282,6 +282,15 @@ class MainWindow(gtk.Window):
         #show/hide notebook tabs
         self.notebook.set_show_tabs(len(self._get_pages()) > 1)
 
+    def update_pages(self):
+        """
+        Forces a reload of all the pages in this notebook.
+        """
+        for page in self._get_pages():
+            success = page.get_flow_graph().reload()
+            if success:  # Only set saved if errors occurred during import
+                page.set_saved(False)
+
     def get_page(self):
         """
         Get the selected page.



reply via email to

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