[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.
- [Commit-gnuradio] [gnuradio] branch master updated (99e0c0a -> 5af1200), git, 2014/08/26
- [Commit-gnuradio] [gnuradio] 10/10: Merge remote-tracking branch 'gnuradio-wg-grc/master_grcwg', git, 2014/08/26
- [Commit-gnuradio] [gnuradio] 04/10: grc: moving xml pi into nested data, git, 2014/08/26
- [Commit-gnuradio] [gnuradio] 09/10: Merge branch 'maint', git, 2014/08/26
- [Commit-gnuradio] [gnuradio] 07/10: grc: Small fixes to make menu items consistent., git, 2014/08/26
- [Commit-gnuradio] [gnuradio] 03/10: grc: adding version information to flowgraph files using XML processing instructions, git, 2014/08/26
- [Commit-gnuradio] [gnuradio] 08/10: grc: clean-up toolbar, git, 2014/08/26
- [Commit-gnuradio] [gnuradio] 06/10: grc: added save_reports action., git, 2014/08/26
- [Commit-gnuradio] [gnuradio] 01/10: grc: Reloading blocks forces reload for all open flow graphs.,
git <=
- [Commit-gnuradio] [gnuradio] 05/10: grc: Generator warning for flowgraphs with a throttle and an external source/sink, git, 2014/08/26
- [Commit-gnuradio] [gnuradio] 02/10: grc: Reload marks page as modified only if an error occured during import (i.e. ports no longer exist), git, 2014/08/26