* src/DataViews/_PersonView.py: view specific key mapping support
* src/ViewManager.py: remember last View * src/Config/GrampsConfigKeys.py: LAST_VIEW key * src/PageView.py: key binding support * data/gramps.schemas.in: LAST_VIEW key svn: r6510
This commit is contained in:
parent
cd700b9019
commit
cacb294975
@ -1,4 +1,9 @@
|
||||
2006-05-01 Don Allingham <don@gramps-project.org>
|
||||
* src/DataViews/_PersonView.py: view specific key mapping support
|
||||
* src/ViewManager.py: remember last View
|
||||
* src/Config/GrampsConfigKeys.py: LAST_VIEW key
|
||||
* src/PageView.py: key binding support
|
||||
* data/gramps.schemas.in: LAST_VIEW key
|
||||
* src/Editors/_EditPersonRef.py (EditPersonRef._select_person): fix
|
||||
call to SelectPerson
|
||||
* src/DataViews/_PersonView.py (PersonView.define_actions): add
|
||||
|
@ -15,6 +15,18 @@
|
||||
</locale>
|
||||
</schema>
|
||||
|
||||
<schema>
|
||||
<key>/schemas/apps/gramps/preferences/last-view</key>
|
||||
<applyto>/apps/gramps/preferences/last-view</applyto>
|
||||
<owner>gramps</owner>
|
||||
<type>int</type>
|
||||
<default>0</default>
|
||||
<locale name="C">
|
||||
<short>Last view displayed</short>
|
||||
<long>Indicates the last view displayed. This view will be displayed when the system is restarted.</long>
|
||||
</locale>
|
||||
</schema>
|
||||
|
||||
<schema>
|
||||
<key>/schemas/apps/gramps/preferences/family-siblings</key>
|
||||
<applyto>/apps/gramps/preferences/family-siblings</applyto>
|
||||
|
@ -1,53 +1,28 @@
|
||||
#
|
||||
# Gramps - a GTK+/GNOME based genealogy program
|
||||
#
|
||||
# Copyright (C) 2006 Donald N. Allingham
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#
|
||||
|
||||
FAMILY_DETAILS = ('preferences','family-details', 0)
|
||||
LAST_VIEW = ('preferences','last-view', 1)
|
||||
FAMILY_SIBLINGS = ('preferences','family-siblings', 0)
|
||||
AUTOLOAD = ('behavior','autoload', 0)
|
||||
SPELLCHECK = ('behavior','spellcheck', 0)
|
||||
BETAWARN = ('behavior','betawarn', 0)
|
||||
FAMILY_WARN = ('behavior','family-warn', 0)
|
||||
WELCOME = ('behavior','welcome', 1)
|
||||
DATE_FORMAT = ('preferences','date-format', 1)
|
||||
DONT_ASK = ('interface','dont-ask', 0)
|
||||
DEFAULTVIEW = ('interface','defaultview', 1)
|
||||
HEIGHT = ('interface','height', 1)
|
||||
WIDTH = ('interface','width', 1)
|
||||
FAMILYVIEW = ('interface','familyview', 1)
|
||||
FILTER = ('interface','filter', 0)
|
||||
FPREFIX = ('preferences','fprefix', 2)
|
||||
EPREFIX = ('preferences','eprefix', 2)
|
||||
RPREFIX = ('preferences','rprefix', 2)
|
||||
IPREFIX = ('preferences','iprefix', 2)
|
||||
OPREFIX = ('preferences','oprefix', 2)
|
||||
PPREFIX = ('preferences','pprefix', 2)
|
||||
SPREFIX = ('preferences','sprefix', 2)
|
||||
RPREFIX = ('preferences','rprefix', 2)
|
||||
GOUTPUT_PREFERENCE = ('preferences','goutput-preference', 2)
|
||||
OUTPUT_PREFERENCE = ('preferences','output-preference', 2)
|
||||
PAPER_PREFERENCE = ('preferences','paper-preference', 2)
|
||||
RECENT_FILE = ('paths','recent-file', 2)
|
||||
RECENT_IMPORT_DIR = ('paths','recent-import-dir', 2)
|
||||
RECENT_EXPORT_DIR = ('paths','recent-export-dir', 2)
|
||||
MAKE_REFERENCE = ('behavior','make-reference', 0)
|
||||
MEDIA_GLOBAL = ('behavior','media-global', 0)
|
||||
MEDIA_LOCAL = ('behavior','media-local', 0)
|
||||
NAME_FORMAT = ('preferences','name-format', 1)
|
||||
REPORT_DIRECTORY = ('paths','report-directory', 2)
|
||||
RESEARCHER_ADDR = ('researcher','researcher-addr', 2)
|
||||
@ -58,12 +33,10 @@ RESEARCHER_NAME = ('researcher','researcher-name', 2)
|
||||
RESEARCHER_PHONE = ('researcher','researcher-phone', 2)
|
||||
RESEARCHER_POSTAL = ('researcher','researcher-postal', 2)
|
||||
RESEARCHER_STATE = ('researcher','researcher-state', 2)
|
||||
SHOW_CALENDAR = ('behavior','show-calendar', 0)
|
||||
STARTUP = ('behavior','startup', 1)
|
||||
SIZE_CHECKED = ('interface','size-checked', 0)
|
||||
STATUSBAR = ('interface','statusbar', 1)
|
||||
SURNAME_GUESSING = ('behavior','surname-guessing', 1)
|
||||
TOOLBAR = ('interface','toolbar', 1)
|
||||
TOOLBAR_ON = ('interface','toolbar-on', 0)
|
||||
USE_LDS = ('behavior','use-lds', 0)
|
||||
USE_TIPS = ('behavior','use-tips', 0)
|
||||
@ -74,35 +47,30 @@ WEBSITE_DIRECTORY = ('paths','website-directory', 2)
|
||||
|
||||
default_value = {
|
||||
FAMILY_DETAILS : True,
|
||||
LAST_VIEW : 0,
|
||||
FAMILY_SIBLINGS : True,
|
||||
AUTOLOAD : False,
|
||||
SPELLCHECK : False,
|
||||
BETAWARN : False,
|
||||
FAMILY_WARN : False,
|
||||
WELCOME : 100,
|
||||
DATE_FORMAT : 0,
|
||||
DONT_ASK : False,
|
||||
DEFAULTVIEW : 0,
|
||||
HEIGHT : 500,
|
||||
WIDTH : 775,
|
||||
FAMILYVIEW : 0,
|
||||
FILTER : False,
|
||||
FPREFIX : 'F%04d',
|
||||
EPREFIX : 'E%04d',
|
||||
RPREFIX : 'E%04d',
|
||||
IPREFIX : 'I%04d',
|
||||
OPREFIX : 'O%04d',
|
||||
PPREFIX : 'P%04d',
|
||||
SPREFIX : 'S%04d',
|
||||
RPREFIX : 'R%04d',
|
||||
GOUTPUT_PREFERENCE : 'No default format',
|
||||
OUTPUT_PREFERENCE : 'No default format',
|
||||
PAPER_PREFERENCE : 'Letter',
|
||||
RECENT_FILE : '',
|
||||
RECENT_IMPORT_DIR : '',
|
||||
RECENT_EXPORT_DIR : '',
|
||||
MAKE_REFERENCE : True,
|
||||
MEDIA_GLOBAL : True,
|
||||
MEDIA_LOCAL : True,
|
||||
NAME_FORMAT : 0,
|
||||
REPORT_DIRECTORY : './',
|
||||
RESEARCHER_ADDR : '',
|
||||
@ -113,12 +81,10 @@ default_value = {
|
||||
RESEARCHER_PHONE : '',
|
||||
RESEARCHER_POSTAL : '',
|
||||
RESEARCHER_STATE : '',
|
||||
SHOW_CALENDAR : False,
|
||||
STARTUP : 0,
|
||||
SIZE_CHECKED : False,
|
||||
STATUSBAR : 1,
|
||||
SURNAME_GUESSING : 0,
|
||||
TOOLBAR : -1,
|
||||
TOOLBAR_ON : True,
|
||||
USE_LDS : False,
|
||||
USE_TIPS : False,
|
||||
|
@ -87,6 +87,12 @@ class PersonView(PageView.PersonNavView):
|
||||
dbstate.connect('database-changed',self.change_db)
|
||||
dbstate.connect('active-changed',self.goto_active_person)
|
||||
self.handle_col = PeopleModel.COLUMN_INT_ID
|
||||
self.model = None
|
||||
|
||||
self.func_list = {
|
||||
'F2' : self.key_goto_home_person,
|
||||
'F3' : self.key_edit_selected_person,
|
||||
}
|
||||
|
||||
def change_page(self):
|
||||
pass
|
||||
@ -313,18 +319,19 @@ class PersonView(PageView.PersonNavView):
|
||||
# select the active person in the person view
|
||||
p = self.dbstate.active
|
||||
try:
|
||||
path = self.model.on_get_path(p.get_handle())
|
||||
group_name = p.get_primary_name().get_group_name()
|
||||
top_name = self.dbstate.db.get_name_group_mapping(group_name)
|
||||
top_path = self.model.on_get_path(top_name)
|
||||
self.tree.expand_row(top_path,0)
|
||||
if self.model:
|
||||
path = self.model.on_get_path(p.get_handle())
|
||||
group_name = p.get_primary_name().get_group_name()
|
||||
top_name = self.dbstate.db.get_name_group_mapping(group_name)
|
||||
top_path = self.model.on_get_path(top_name)
|
||||
self.tree.expand_row(top_path,0)
|
||||
|
||||
current = self.model.on_get_iter(path)
|
||||
selected = self.selection.path_is_selected(path)
|
||||
if current != p.get_handle() or not selected:
|
||||
self.selection.unselect_all()
|
||||
self.selection.select_path(path)
|
||||
self.tree.scroll_to_cell(path,None,1,0.5,0)
|
||||
current = self.model.on_get_iter(path)
|
||||
selected = self.selection.path_is_selected(path)
|
||||
if current != p.get_handle() or not selected:
|
||||
self.selection.unselect_all()
|
||||
self.selection.select_path(path)
|
||||
self.tree.scroll_to_cell(path,None,1,0.5,0)
|
||||
except KeyError:
|
||||
self.selection.unselect_all()
|
||||
self.uistate.push_message(_("Active person not visible"))
|
||||
@ -681,3 +688,11 @@ class PersonView(PageView.PersonNavView):
|
||||
menu.popup(None,None,None,event.button,event.time)
|
||||
return True
|
||||
return False
|
||||
|
||||
def key_goto_home_person(self):
|
||||
self.home(None)
|
||||
self.uistate.push_message(_("Go to default person"))
|
||||
|
||||
def key_edit_selected_person(self):
|
||||
self.edit(None)
|
||||
self.uistate.push_message(_("Edit selected person"))
|
||||
|
@ -74,6 +74,10 @@ class PageView:
|
||||
self.active = False
|
||||
self.handle_col = 0
|
||||
self.selection = None
|
||||
self.func_list = {}
|
||||
|
||||
def call_function(self, key):
|
||||
self.func_list.get(key)()
|
||||
|
||||
def set_active(self):
|
||||
self.active = True
|
||||
|
@ -185,7 +185,6 @@ class ViewManager:
|
||||
self.active_page = None
|
||||
self.views = []
|
||||
self.pages = []
|
||||
self.keypress_function = {}
|
||||
self.file_loaded = False
|
||||
self._build_main_window()
|
||||
self._connect_signals()
|
||||
@ -339,16 +338,16 @@ class ViewManager:
|
||||
('ReportsMenu', None, _('_Reports')),
|
||||
('ToolsMenu', None, _('_Tools')),
|
||||
('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),
|
||||
('F2', None, 'F2', "F2", None, self.keypress),
|
||||
('F3', None, 'F3', "F3", None, self.keypress),
|
||||
('F4', None, 'F4', "F4", None, self.keypress),
|
||||
('F5', None, 'F5', "F5", None, self.keypress),
|
||||
('F6', None, 'F6', "F6", None, self.keypress),
|
||||
('F7', None, 'F7', "F7", None, self.keypress),
|
||||
('F8', None, 'F9', "F8", None, self.keypress),
|
||||
('F9', None, 'F9', "F9", None, self.keypress),
|
||||
('F11', None, 'F11', "F11", None, self.keypress),
|
||||
('F12', None, 'F12', "F12", None, self.keypress),
|
||||
]
|
||||
|
||||
self._file_toggle_action_list = [
|
||||
@ -374,17 +373,15 @@ class ViewManager:
|
||||
|
||||
def keypress(self, action):
|
||||
name = action.get_name()
|
||||
func = self.keypress_function.get(name)
|
||||
if func:
|
||||
func()
|
||||
else:
|
||||
try:
|
||||
self.active_page.call_function(name)
|
||||
except:
|
||||
self.uistate.push_message(_("Key %s is not bound") % name)
|
||||
|
||||
def init_interface(self):
|
||||
self._init_lists()
|
||||
|
||||
self.create_pages()
|
||||
self.change_page(None, None)
|
||||
if not self.file_loaded:
|
||||
self.actiongroup.set_visible(False)
|
||||
self.fileactions.set_sensitive(False)
|
||||
@ -572,14 +569,19 @@ class ViewManager:
|
||||
self.bbox.pack_start(button, False)
|
||||
self.buttons.append(button)
|
||||
|
||||
self.active_page = self.pages[0]
|
||||
self.buttons[0].set_active(True)
|
||||
current = Config.get(Config.LAST_VIEW)
|
||||
if current > len(self.pages):
|
||||
current = 0
|
||||
|
||||
self.active_page = self.pages[current]
|
||||
self.buttons[current].set_active(True)
|
||||
self.active_page.set_active()
|
||||
self.notebook.set_current_page(current)
|
||||
|
||||
def change_page(self, obj, page, num=-1):
|
||||
if num == -1:
|
||||
num = self.notebook.get_current_page()
|
||||
|
||||
|
||||
for ix in range(len(self.buttons)):
|
||||
if ix != num and self.buttons[ix].get_active():
|
||||
self.buttons[ix].set_active(False)
|
||||
@ -599,6 +601,9 @@ class ViewManager:
|
||||
if len(self.pages) > 0:
|
||||
self.active_page = self.pages[num]
|
||||
self.active_page.set_active()
|
||||
Config.set(Config.LAST_VIEW,num)
|
||||
Config.sync()
|
||||
print "Saved as",Config.get(Config.LAST_VIEW)
|
||||
|
||||
old_nav = self._navigation_type[self.prev_nav]
|
||||
if old_nav[0] != None:
|
||||
|
Loading…
Reference in New Issue
Block a user