From 2713516e9749d5651415c30ae766c25ac77c2ebc Mon Sep 17 00:00:00 2001 From: Don Allingham Date: Thu, 27 Apr 2006 17:03:23 +0000 Subject: [PATCH] 2006-04-27 Don Allingham * src/ViewManager.py: support for keypress events * src/gramps.py: fix gnome init svn: r6464 --- gramps2/ChangeLog | 4 ++++ gramps2/src/ViewManager.py | 31 ++++++++++++++++++++++++++++++- gramps2/src/gramps.py | 29 +++++++++++++++-------------- 3 files changed, 49 insertions(+), 15 deletions(-) diff --git a/gramps2/ChangeLog b/gramps2/ChangeLog index e7eec65f7..6a14410a1 100644 --- a/gramps2/ChangeLog +++ b/gramps2/ChangeLog @@ -1,3 +1,7 @@ +2006-04-27 Don Allingham + * src/ViewManager.py: support for keypress events + * src/gramps.py: fix gnome init + 2006-04-26 Alex Roitman * src/plugins/PatchNames.py (PatchNames.on_ok_clicked): Properly call update. diff --git a/gramps2/src/ViewManager.py b/gramps2/src/ViewManager.py index 2954c718a..43a7b7eea 100644 --- a/gramps2/src/ViewManager.py +++ b/gramps2/src/ViewManager.py @@ -161,6 +161,16 @@ uidefault = ''' + + + + + + + + + + ''' @@ -174,6 +184,7 @@ class ViewManager: self.active_page = None self.views = [] self.pages = [] + self.keypress_function = {} self.file_loaded = False self._build_main_window() self._connect_signals() @@ -325,7 +336,17 @@ class ViewManager: ('BookMenu', None, '_Bookmarks'), ('ReportsMenu', None, '_Reports'), ('ToolsMenu', None, '_Tools'), - ('WindowsMenu', None, '_Windows'), + ('WindowsMenu', None, '_Windows'), + ('F2', None, None, "F2", None, self.keypress), + ('F3', None, None, "F3", None, self.keypress), + ('F4', None, None, "F4", None, self.keypress), + ('F5', None, None, "F5", None, self.keypress), + ('F6', None, None, "F6", None, self.keypress), + ('F7', None, None, "F7", None, self.keypress), + ('F8', None, None, "F8", None, self.keypress), + ('F9', None, None, "F9", None, self.keypress), + ('F11', None, None, "F11", None, self.keypress), + ('F12', None, None, "F12", None, self.keypress), ] self._file_toggle_action_list = [ @@ -349,6 +370,14 @@ class ViewManager: PageView.NAVIGATION_PERSON: (None, None), } + def keypress(self, action): + name = action.get_name() + func = self.keypress_function.get(name) + if func: + func() + else: + self.uistate.push_message(_("Key %s is not bound") % name) + def init_interface(self): self._init_lists() diff --git a/gramps2/src/gramps.py b/gramps2/src/gramps.py index 5676719a9..2b2f31c83 100644 --- a/gramps2/src/gramps.py +++ b/gramps2/src/gramps.py @@ -26,6 +26,7 @@ import sys import os import locale +import const import signal import gettext import exceptions @@ -144,23 +145,23 @@ def setup_logging(): def run(): setup_logging() - - try: + + try: import gnome - self.program = gnome.program_init('gramps',const.version, - gnome.libgnome_module_info_get(), - args, const.popt_table) - - self.program.set_property('app-libdir', - '%s/lib' % const.prefixdir) - self.program.set_property('app-datadir', - '%s/share/gramps' % const.prefixdir) - self.program.set_property('app-sysconfdir', - '%s/etc' % const.prefixdir) - self.program.set_property('app-prefix', const.prefixdir) + program = gnome.program_init('gramps',const.version, + gnome.libgnome_module_info_get(), + args, const.popt_table) + + program.set_property('app-libdir', + '%s/lib' % const.prefixdir) + program.set_property('app-datadir', + '%s/share/gramps' % const.prefixdir) + program.set_property('app-sysconfdir', + '%s/etc' % const.prefixdir) + program.set_property('app-prefix', const.prefixdir) except: pass - + try: import StartupDialog