X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=grc%2Fsrc%2Fgui%2FActionHandler.py;h=91dd0fb454e89fb038ef53bd245bf5e34bf4f2b7;hb=88470f93a4d2e9e6d7e5d39dac52115de0e5d1ca;hp=cb31b3756e32bdc923eeb241eda39db82e26d709;hpb=715009be8e02990af5497edb251cce7839123a06;p=debian%2Fgnuradio diff --git a/grc/src/gui/ActionHandler.py b/grc/src/gui/ActionHandler.py index cb31b375..91dd0fb4 100644 --- a/grc/src/gui/ActionHandler.py +++ b/grc/src/gui/ActionHandler.py @@ -32,7 +32,7 @@ from .. utils import ParseXML import random from .. platforms.gui.Platform import Platform from MainWindow import MainWindow -from Dialogs import PreferencesDialog, AboutDialog +from Dialogs import AboutDialog from FileDialogs import OpenFlowGraphFileDialog, SaveFlowGraphFileDialog, SaveImageFileDialog gobject.threads_init() @@ -53,9 +53,6 @@ class ActionHandler: """ self.clipboard = None platform = Platform(platform) - #setup icon using icon theme - try: gtk.window_set_default_icon(gtk.IconTheme().load_icon('gnuradio-grc', 256, 0)) - except: pass for action in Actions.get_all_actions(): action.connect('activate', self._handle_actions) #setup the main window self.main_window = MainWindow(self.handle_states, platform) @@ -75,11 +72,15 @@ class ActionHandler: def _handle_key_press(self, widget, event): """ - Handle key presses from the keyboard. - Translate key combos into actions. + Handle key presses from the keyboard and translate key combos into actions. + This key press handler is called before the gtk accelerators kick in. + This handler ensures that key presses without a mod mask, + only pass to the accelerators if the flow graph is in focus. + This function also handles keys that accelerators refuse to handle: left/right, + and keys that are not registered with an accelerator: +/-. @return false to let the accelerators handle the key action """ - if self.get_focus_flag() and self.get_flow_graph().is_selected(): + if self.get_focus_flag(): try: self.handle_states({ 'Left': Actions.BLOCK_ROTATE_LEFT, @@ -93,9 +94,9 @@ class ActionHandler: 'KP_Subtract': Actions.PORT_CONTROLLER_DEC, }[gtk.gdk.keyval_name(event.keyval)]) return True - #focus + selection: always return false for accelerator to handle + #focus: always return false for accelerator to handle except: return False - #no focus + selection: only allow accelerator to handle when a mod is used + #no focus: only allow accelerator to handle when a mod is used return not event.state def _quit(self, window, event): @@ -137,9 +138,9 @@ class ActionHandler: Actions.APPLICATION_QUIT, Actions.FLOW_GRAPH_NEW, Actions.FLOW_GRAPH_OPEN, Actions.FLOW_GRAPH_SAVE_AS, Actions.FLOW_GRAPH_CLOSE, Actions.ABOUT_WINDOW_DISPLAY, - Actions.PREFS_WINDOW_DISPLAY, Actions.FLOW_GRAPH_SCREEN_CAPTURE, + Actions.FLOW_GRAPH_SCREEN_CAPTURE, ): Actions.get_action_from_name(action).set_sensitive(True) - if not self.init_file_paths and Preferences.restore_files(): + if not self.init_file_paths: self.init_file_paths = Preferences.files_open() if not self.init_file_paths: self.init_file_paths = [''] for file_path in self.init_file_paths: @@ -236,9 +237,6 @@ class ActionHandler: ################################################## # Window stuff ################################################## - elif state == Actions.PREFS_WINDOW_DISPLAY: - PreferencesDialog() - self.get_flow_graph().update() elif state == Actions.ABOUT_WINDOW_DISPLAY: AboutDialog() ##################################################