summaryrefslogtreecommitdiff
path: root/grc
diff options
context:
space:
mode:
Diffstat (limited to 'grc')
-rw-r--r--grc/base/Block.py1
-rw-r--r--grc/gui/ActionHandler.py6
-rw-r--r--grc/gui/Actions.py5
-rw-r--r--grc/gui/Bars.py1
-rw-r--r--grc/gui/FlowGraph.py1
-rw-r--r--grc/gui/MainWindow.py2
-rw-r--r--grc/python/block.dtd3
-rw-r--r--grc/python/convert_hier.py1
8 files changed, 19 insertions, 1 deletions
diff --git a/grc/base/Block.py b/grc/base/Block.py
index fe7ad3c2f..a20be9db9 100644
--- a/grc/base/Block.py
+++ b/grc/base/Block.py
@@ -67,6 +67,7 @@ class Block(Element):
self._name = n.find('name')
self._key = n.find('key')
self._category = n.find('category') or ''
+ self._grc_source = n.find('grc_source') or ''
self._block_wrapper_path = n.find('block_wrapper_path')
#create the param objects
self._params = list()
diff --git a/grc/gui/ActionHandler.py b/grc/gui/ActionHandler.py
index 5600edc06..d1491db0b 100644
--- a/grc/gui/ActionHandler.py
+++ b/grc/gui/ActionHandler.py
@@ -307,6 +307,11 @@ class ActionHandler:
self.platform.loadblocks()
self.main_window.btwin.clear();
self.platform.load_block_tree(self.main_window.btwin);
+ elif action == Actions.OPEN_HIER:
+ bn = [];
+ for b in self.get_flow_graph().get_selected_blocks():
+ if b._grc_source:
+ self.main_window.new_page(b._grc_source, show=True);
else: print '!!! Action "%s" not handled !!!'%action
##################################################
# Global Actions for all States
@@ -324,6 +329,7 @@ class ActionHandler:
#update enable/disable
Actions.BLOCK_ENABLE.set_sensitive(bool(self.get_flow_graph().get_selected_blocks()))
Actions.BLOCK_DISABLE.set_sensitive(bool(self.get_flow_graph().get_selected_blocks()))
+ Actions.OPEN_HIER.set_sensitive(bool(self.get_flow_graph().get_selected_blocks()))
Actions.RELOAD_BLOCKS.set_sensitive(True)
#set the exec and stop buttons
self.update_exec_stop()
diff --git a/grc/gui/Actions.py b/grc/gui/Actions.py
index 4185de048..03aa43057 100644
--- a/grc/gui/Actions.py
+++ b/grc/gui/Actions.py
@@ -278,3 +278,8 @@ RELOAD_BLOCKS = Action(
tooltip='Reload Blocks',
stock_id=gtk.STOCK_REFRESH
)
+OPEN_HIER = Action(
+ label='Open H_ier',
+ tooltip='Open the source of the selected hierarchical block',
+ stock_id=gtk.STOCK_JUMP_TO,
+)
diff --git a/grc/gui/Bars.py b/grc/gui/Bars.py
index 0cdbdbb12..d95d23f1f 100644
--- a/grc/gui/Bars.py
+++ b/grc/gui/Bars.py
@@ -51,6 +51,7 @@ TOOLBAR_LIST = (
Actions.BLOCK_DISABLE,
None,
Actions.RELOAD_BLOCKS,
+ Actions.OPEN_HIER,
)
##The list of actions and categories for the menu bar.
diff --git a/grc/gui/FlowGraph.py b/grc/gui/FlowGraph.py
index 9f3326ada..0f69d4878 100644
--- a/grc/gui/FlowGraph.py
+++ b/grc/gui/FlowGraph.py
@@ -63,6 +63,7 @@ class FlowGraph(Element):
Actions.BLOCK_ENABLE,
Actions.BLOCK_DISABLE,
Actions.BLOCK_PARAM_MODIFY,
+ Actions.OPEN_HIER,
]: self._context_menu.append(action.create_menu_item())
###########################################################################
diff --git a/grc/gui/MainWindow.py b/grc/gui/MainWindow.py
index 429bd9e86..37a100c94 100644
--- a/grc/gui/MainWindow.py
+++ b/grc/gui/MainWindow.py
@@ -170,6 +170,8 @@ class MainWindow(gtk.Window):
try: #try to load from file
if file_path: Messages.send_start_load(file_path)
flow_graph = self._platform.get_new_flow_graph()
+ flow_graph.grc_file_path = file_path;
+ #print flow_graph
page = NotebookPage(
self,
flow_graph=flow_graph,
diff --git a/grc/python/block.dtd b/grc/python/block.dtd
index 41a744d07..292ea06cb 100644
--- a/grc/python/block.dtd
+++ b/grc/python/block.dtd
@@ -25,7 +25,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
Top level element.
A block contains a name, ...parameters list, and list of IO ports.
-->
-<!ELEMENT block (name, key, category?, throttle?, import*, var_make?, make, callback*, param*, check*, sink*, source*, doc?)>
+<!ELEMENT block (name, key, category?, throttle?, import*, var_make?, make, callback*, param*, check*, sink*, source*, doc?, grc_source?)>
<!--
Sub level elements.
-->
@@ -40,6 +40,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
<!ELEMENT category (#PCDATA)>
<!ELEMENT import (#PCDATA)>
<!ELEMENT doc (#PCDATA)>
+<!ELEMENT grc_source (#PCDATA)>
<!ELEMENT name (#PCDATA)>
<!ELEMENT key (#PCDATA)>
<!ELEMENT check (#PCDATA)>
diff --git a/grc/python/convert_hier.py b/grc/python/convert_hier.py
index c6ca5b769..f4d082d59 100644
--- a/grc/python/convert_hier.py
+++ b/grc/python/convert_hier.py
@@ -73,6 +73,7 @@ def convert_hier(flow_graph, python_file):
block_n['source'].append(source_n)
#doc data
block_n['doc'] = "%s\n%s\n%s"%(block_author, block_desc, python_file)
+ block_n['grc_source'] = "%s"%(flow_graph.grc_file_path)
#write the block_n to file
xml_file = python_file + '.xml'
ParseXML.to_file({'block': block_n}, xml_file)