diff options
Diffstat (limited to 'grc')
-rw-r--r-- | grc/base/Platform.py | 4 | ||||
-rw-r--r-- | grc/gui/ActionHandler.py | 6 | ||||
-rw-r--r-- | grc/gui/Actions.py | 5 | ||||
-rw-r--r-- | grc/gui/Bars.py | 2 | ||||
-rw-r--r-- | grc/gui/BlockTreeWindow.py | 5 | ||||
-rw-r--r-- | grc/gui/MainWindow.py | 3 |
6 files changed, 24 insertions, 1 deletions
diff --git a/grc/base/Platform.py b/grc/base/Platform.py index 94d0077ea..d4b09088b 100644 --- a/grc/base/Platform.py +++ b/grc/base/Platform.py @@ -61,6 +61,10 @@ class Platform(_Element): #create a dummy flow graph for the blocks self._flow_graph = _Element(self) #search for *.xml files in the given search path + + self.loadblocks(); + + def loadblocks(self): xml_files = list() for block_path in self._block_paths: if os.path.isfile(block_path): xml_files.append(block_path) diff --git a/grc/gui/ActionHandler.py b/grc/gui/ActionHandler.py index 476c82b4f..5600edc06 100644 --- a/grc/gui/ActionHandler.py +++ b/grc/gui/ActionHandler.py @@ -53,6 +53,7 @@ class ActionHandler: self.clipboard = None for action in Actions.get_all_actions(): action.connect('activate', self._handle_action) #setup the main window + self.platform = platform; self.main_window = MainWindow(platform) self.main_window.connect('delete-event', self._quit) self.main_window.connect('key-press-event', self._handle_key_press) @@ -302,6 +303,10 @@ class ActionHandler: except: print "could not kill process: %d"%self.get_page().get_proc().pid elif action == Actions.PAGE_CHANGE: #pass and run the global actions pass + elif action == Actions.RELOAD_BLOCKS: + self.platform.loadblocks() + self.main_window.btwin.clear(); + self.platform.load_block_tree(self.main_window.btwin); else: print '!!! Action "%s" not handled !!!'%action ################################################## # Global Actions for all States @@ -319,6 +324,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.RELOAD_BLOCKS.set_sensitive(True) #set the exec and stop buttons self.update_exec_stop() #saved status diff --git a/grc/gui/Actions.py b/grc/gui/Actions.py index 4d196477e..4185de048 100644 --- a/grc/gui/Actions.py +++ b/grc/gui/Actions.py @@ -273,3 +273,8 @@ BLOCK_INC_TYPE = Action( BLOCK_DEC_TYPE = Action( keypresses=(gtk.keysyms.Up, NO_MODS_MASK), ) +RELOAD_BLOCKS = Action( + label='Reload _Blocks', + tooltip='Reload Blocks', + stock_id=gtk.STOCK_REFRESH +) diff --git a/grc/gui/Bars.py b/grc/gui/Bars.py index 8fd167869..0cdbdbb12 100644 --- a/grc/gui/Bars.py +++ b/grc/gui/Bars.py @@ -49,6 +49,8 @@ TOOLBAR_LIST = ( None, Actions.BLOCK_ENABLE, Actions.BLOCK_DISABLE, + None, + Actions.RELOAD_BLOCKS, ) ##The list of actions and categories for the menu bar. diff --git a/grc/gui/BlockTreeWindow.py b/grc/gui/BlockTreeWindow.py index 0175c8bec..62afb6205 100644 --- a/grc/gui/BlockTreeWindow.py +++ b/grc/gui/BlockTreeWindow.py @@ -90,6 +90,11 @@ class BlockTreeWindow(gtk.VBox): #initialize self._update_add_button() + def clear(self): + self.treestore.clear(); + self._categories = {tuple(): None} + + ############################################################ ## Block Tree Methods ############################################################ diff --git a/grc/gui/MainWindow.py b/grc/gui/MainWindow.py index 2f761df1f..429bd9e86 100644 --- a/grc/gui/MainWindow.py +++ b/grc/gui/MainWindow.py @@ -93,7 +93,8 @@ class MainWindow(gtk.Window): #flow_graph_box.pack_start(self.scrolled_window) self.flow_graph_vpaned.pack1(self.notebook) self.hpaned.pack1(self.flow_graph_vpaned) - self.hpaned.pack2(BlockTreeWindow(platform, self.get_flow_graph), False) #dont allow resize + self.btwin = BlockTreeWindow(platform, self.get_flow_graph); + self.hpaned.pack2(self.btwin, False) #dont allow resize #create the reports window self.text_display = TextDisplay() #house the reports in a scrolled window |