2006-04-27 Don Allingham <don@gramps-project.org>

* src/ViewManager.py: support for keypress events
	* src/gramps.py: fix gnome init



svn: r6464
This commit is contained in:
Don Allingham 2006-04-27 17:03:23 +00:00
parent 8ca6f4ab30
commit 2713516e97
3 changed files with 49 additions and 15 deletions

View File

@ -1,3 +1,7 @@
2006-04-27 Don Allingham <don@gramps-project.org>
* src/ViewManager.py: support for keypress events
* src/gramps.py: fix gnome init
2006-04-26 Alex Roitman <shura@gramps-project.org>
* src/plugins/PatchNames.py (PatchNames.on_ok_clicked): Properly
call update.

View File

@ -161,6 +161,16 @@ uidefault = '''<ui>
<separator/>
<placeholder name="CommonEdit"/>
</toolbar>
<accelerator action="F2"/>
<accelerator action="F3"/>
<accelerator action="F4"/>
<accelerator action="F5"/>
<accelerator action="F6"/>
<accelerator action="F7"/>
<accelerator action="F8"/>
<accelerator action="F9"/>
<accelerator action="F11"/>
<accelerator action="F12"/>
</ui>
'''
@ -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()

View File

@ -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