diff options
author | Johnathan Corgan <johnathan@corganlabs.com> | 2014-08-20 10:34:08 -0700 |
---|---|---|
committer | Johnathan Corgan <johnathan@corganlabs.com> | 2014-08-20 10:34:08 -0700 |
commit | 9e9699b4c1e76d6d699d7c199775f3d8e134d5e5 (patch) | |
tree | 4989c9dc49800642ae57ed72c9670ad72c79c843 /grc/gui/ActionHandler.py | |
parent | 84ce73af3dca41b8acec6d59fca65901e1fe0045 (diff) | |
parent | 00709699b217bc6b6b866ffad6d9a8c1e9497ae8 (diff) |
Merge remote-tracking branch 'gnuradio-wg-grc/grc_snap_blocks_to_grid'
Diffstat (limited to 'grc/gui/ActionHandler.py')
-rw-r--r-- | grc/gui/ActionHandler.py | 35 |
1 files changed, 19 insertions, 16 deletions
diff --git a/grc/gui/ActionHandler.py b/grc/gui/ActionHandler.py index 18b7c9aee0..dcc3c846eb 100644 --- a/grc/gui/ActionHandler.py +++ b/grc/gui/ActionHandler.py @@ -118,7 +118,7 @@ class ActionHandler: Actions.TYPES_WINDOW_DISPLAY, Actions.TOGGLE_BLOCKS_WINDOW, Actions.TOGGLE_REPORTS_WINDOW, Actions.TOGGLE_HIDE_DISABLED_BLOCKS, Actions.TOOLS_RUN_FDESIGN, Actions.TOGGLE_SCROLL_LOCK, Actions.CLEAR_REPORTS, - Actions.TOGGLE_AUTO_HIDE_PORT_LABELS + Actions.TOGGLE_AUTO_HIDE_PORT_LABELS, Actions.TOGGLE_SNAP_TO_GRID ): action.set_sensitive(True) if ParseXML.xml_failures: Messages.send_xml_errors_if_any(ParseXML.xml_failures) @@ -134,10 +134,13 @@ class ActionHandler: if not self.get_page(): self.main_window.new_page() #ensure that at least a blank page exists self.main_window.btwin.search_entry.hide() - Actions.TOGGLE_REPORTS_WINDOW.set_active(Preferences.reports_window_visibility()) - Actions.TOGGLE_BLOCKS_WINDOW.set_active(Preferences.blocks_window_visibility()) - Actions.TOGGLE_SCROLL_LOCK.set_active(Preferences.scroll_lock()) - Actions.TOGGLE_AUTO_HIDE_PORT_LABELS.set_active(Preferences.auto_hide_port_labels()) + for action in ( + Actions.TOGGLE_REPORTS_WINDOW, + Actions.TOGGLE_BLOCKS_WINDOW, + Actions.TOGGLE_AUTO_HIDE_PORT_LABELS, + Actions.TOGGLE_SCROLL_LOCK, + Actions.TOGGLE_SNAP_TO_GRID + ): action.load_from_preferences() elif action == Actions.APPLICATION_QUIT: if self.main_window.close_pages(): gtk.main_quit() @@ -363,31 +366,32 @@ class ActionHandler: elif action == Actions.ERRORS_WINDOW_DISPLAY: Dialogs.ErrorsDialog(self.get_flow_graph()) elif action == Actions.TOGGLE_REPORTS_WINDOW: - visible = action.get_active() - if visible: + if action.get_active(): self.main_window.reports_scrolled_window.show() else: self.main_window.reports_scrolled_window.hide() - Preferences.reports_window_visibility(visible) + action.save_to_preferences() elif action == Actions.TOGGLE_BLOCKS_WINDOW: - visible = action.get_active() - if visible: + if action.get_active(): self.main_window.btwin.show() else: self.main_window.btwin.hide() - Preferences.blocks_window_visibility(visible) + action.save_to_preferences() elif action == Actions.TOGGLE_SCROLL_LOCK: - visible = action.get_active() - self.main_window.text_display.scroll_lock = visible - if visible: + active = action.get_active() + self.main_window.text_display.scroll_lock = active + if active: self.main_window.text_display.scroll_to_end() + action.save_to_preferences() elif action == Actions.CLEAR_REPORTS: self.main_window.text_display.clear() elif action == Actions.TOGGLE_HIDE_DISABLED_BLOCKS: Actions.NOTHING_SELECT() elif action == Actions.TOGGLE_AUTO_HIDE_PORT_LABELS: - Preferences.auto_hide_port_labels(action.get_active()) + action.save_to_preferences() self.main_window.get_flow_graph().create_shapes() + elif action == Actions.TOGGLE_SNAP_TO_GRID: + action.save_to_preferences() ################################################## # Param Modifications ################################################## @@ -497,7 +501,6 @@ class ActionHandler: self.main_window.btwin.search_entry.show() self.main_window.btwin.search_entry.grab_focus() 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) |