diff options
-rw-r--r-- | grc/gui/ActionHandler.py | 3 | ||||
-rw-r--r-- | grc/gui/FlowGraph.py | 17 | ||||
-rw-r--r-- | grc/gui/MainWindow.py | 9 |
3 files changed, 29 insertions, 0 deletions
diff --git a/grc/gui/ActionHandler.py b/grc/gui/ActionHandler.py index dcc3c846eb..60fa07050d 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 31017a9923..44d46b9bc4 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 a2853bdd38..75d9dce433 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. |