2008-02-15 Benny Malengier <benny.malengier@gramps-project.org>

* src/DisplayTabs/_SourceEmbedList.py:
	* src/DisplayTabs/_PersonRefEmbedList.py:
	* src/DisplayTabs/_RepoEmbedList.py:
	* src/DisplayTabs/__init__.py:
	* src/DisplayTabs/_AddrEmbedList.py:
	* src/DisplayTabs/_WebEmbedList.py:
	* src/DisplayTabs/_NameEmbedList.py:
	* src/DisplayTabs/_EventEmbedList.py:
	* src/DisplayTabs/_EmbeddedList.py:
	* src/DisplayTabs/_GalleryTab.py:
	* src/DisplayTabs/_BackRefList.py:
	* src/DisplayTabs/_NoteTab.py:
	* src/DisplayTabs/_LocationEmbedList.py:
	* src/DisplayTabs/_ButtonTab.py:
	* src/DisplayTabs/_DataEmbedList.py:
	* src/DisplayTabs/_AttrEmbedList.py:
	* src/DisplayTabs/_LdsEmbedList.py:
	* src/DisplayTabs/_GrampsTab.py:
	* src/Editors/_EditPrimary.py:
	* src/Editors/_EditPlace.py:
	* src/Editors/_EditSecondary.py:
	* src/Editors/_EditSourceRef.py:
	* src/Editors/_EditReference.py:
	* src/Editors/_EditRepoRef.py:
	* src/Editors/_EditNote.py:
	* src/Editors/_EditMediaRef.py:
	* src/Editors/_EditEventRef.py:
	* src/Editors/_EditName.py:
	* src/Editors/_EditFamily.py:
	Add mnemonics for all tabs, eg ALT+S and INSERT to move to sources and
	insert a new source.
	* src/DisplayTabs/_TextTab.py:
	* src/DisplayTabs/Makefile.am:
	* po/POTFILES.in:
	Remove unused TextTab



svn: r10040
This commit is contained in:
Benny Malengier 2008-02-15 22:38:47 +00:00
parent 749261804d
commit 15e789467b
33 changed files with 109 additions and 144 deletions

View File

@ -1,3 +1,40 @@
2008-02-15 Benny Malengier <benny.malengier@gramps-project.org>
* src/DisplayTabs/_SourceEmbedList.py:
* src/DisplayTabs/_PersonRefEmbedList.py:
* src/DisplayTabs/_RepoEmbedList.py:
* src/DisplayTabs/__init__.py:
* src/DisplayTabs/_AddrEmbedList.py:
* src/DisplayTabs/_WebEmbedList.py:
* src/DisplayTabs/_NameEmbedList.py:
* src/DisplayTabs/_EventEmbedList.py:
* src/DisplayTabs/_EmbeddedList.py:
* src/DisplayTabs/_GalleryTab.py:
* src/DisplayTabs/_BackRefList.py:
* src/DisplayTabs/_NoteTab.py:
* src/DisplayTabs/_LocationEmbedList.py:
* src/DisplayTabs/_ButtonTab.py:
* src/DisplayTabs/_DataEmbedList.py:
* src/DisplayTabs/_AttrEmbedList.py:
* src/DisplayTabs/_LdsEmbedList.py:
* src/DisplayTabs/_GrampsTab.py:
* src/Editors/_EditPrimary.py:
* src/Editors/_EditPlace.py:
* src/Editors/_EditSecondary.py:
* src/Editors/_EditSourceRef.py:
* src/Editors/_EditReference.py:
* src/Editors/_EditRepoRef.py:
* src/Editors/_EditNote.py:
* src/Editors/_EditMediaRef.py:
* src/Editors/_EditEventRef.py:
* src/Editors/_EditName.py:
* src/Editors/_EditFamily.py:
Add mnemonics for all tabs, eg ALT+S and INSERT to move to sources and
insert a new source.
* src/DisplayTabs/_TextTab.py:
* src/DisplayTabs/Makefile.am:
* po/POTFILES.in:
Remove unused TextTab
2008-02-15 Douglas S. Blank <dblank@cs.brynmawr.edu>
* src/ViewManager.py (ViewManager.__build_main_window):pass self to DS
* src/DisplayState.py (DisplayState): added vm param

View File

@ -157,7 +157,6 @@ src/DisplayTabs/_NameEmbedList.py
#src/DisplayTabs/_NameModel.py
src/DisplayTabs/_NoteBackRefList.py
src/DisplayTabs/_NoteTab.py
src/DisplayTabs/_TextTab.py
src/DisplayTabs/_PersonEventEmbedList.py
src/DisplayTabs/_PersonRefEmbedList.py
src/DisplayTabs/_PersonRefModel.py

View File

@ -31,7 +31,6 @@ pkgdata_PYTHON = \
_NoteBackRefList.py \
_NoteTab.py \
_NoteModel.py \
_TextTab.py \
_PersonBackRefList.py \
_PersonEventEmbedList.py \
_PersonRefEmbedList.py \

View File

@ -67,7 +67,7 @@ class AddrEmbedList(EmbeddedList):
def __init__(self, dbstate, uistate, track, data):
self.data = data
EmbeddedList.__init__(self, dbstate, uistate, track,
_('Addresses'), AddressModel)
_('_Addresses'), AddressModel)
def get_icon_name(self):
"""

View File

@ -56,7 +56,7 @@ class AttrEmbedList(EmbeddedList):
def __init__(self, dbstate, uistate, track, data):
self.data = data
EmbeddedList.__init__(self, dbstate, uistate, track,
_('Attributes'), AttrModel)
_('_Attributes'), AttrModel)
def get_editor(self):
from Editors import EditAttribute

View File

@ -61,7 +61,7 @@ class BackRefList(EmbeddedList):
def __init__(self, dbstate, uistate, track, obj, refmodel, callback=None):
self.obj = obj
EmbeddedList.__init__(self, dbstate, uistate, track,
_('References'), refmodel)
_('_References'), refmodel)
self._callback = callback
self.model.connect('row-inserted', self.update_label)

View File

@ -179,7 +179,7 @@ class ButtonTab(GrampsTab):
the Edit button handler is called
"""
if event.type == gtk.gdk.KEY_PRESS:
print 'key pressed', event.keyval, event.state, gtk.gdk.MOD1_MASK, _RIGHT
#print 'key pressed', event.keyval, event.state, _ADD
if event.keyval in (_RETURN, _KP_ENTER):
try:
self.edit_button_clicked(obj)
@ -205,6 +205,9 @@ class ButtonTab(GrampsTab):
event.state in (gtk.gdk.MOD1_MASK,
gtk.gdk.MOD1_MASK | gtk.gdk.MOD2_MASK):
self.next_page()
else:
return
return True
def add_button_clicked(self, obj):
"""

View File

@ -54,7 +54,7 @@ class DataEmbedList(EmbeddedList):
self.obj = obj
EmbeddedList.__init__(self, dbstate, uistate, track,
_('Data'), DataModel)
_('_Data'), DataModel)
def build_columns(self):
EmbeddedList.build_columns(self)

View File

@ -67,7 +67,6 @@ class EmbeddedList(ButtonTab):
"""
ButtonTab.__init__(self, dbstate, uistate, track, name, share, move, jump)
self.changed = False
self.build_model = build_model
@ -448,3 +447,4 @@ class EmbeddedList(ButtonTab):
#model and tree are reset, allow _selection_changed again, and force it
self.dirty_selection = False
self._selection_changed()

View File

@ -68,7 +68,7 @@ class EventEmbedList(EmbeddedList):
def __init__(self, dbstate, uistate, track, obj):
self.obj = obj
EmbeddedList.__init__(self, dbstate, uistate, track,
_('Events'), EventRefModel, True)
_('_Events'), EventRefModel, True)
def get_ref_editor(self):
from Editors import EditFamilyEventRef

View File

@ -73,7 +73,7 @@ class GalleryTab(ButtonTab):
def __init__(self, dbstate, uistate, track, media_list, update=None):
self.iconlist = gtk.IconView()
ButtonTab.__init__(self, dbstate, uistate, track, _('Gallery'), True)
ButtonTab.__init__(self, dbstate, uistate, track, _('_Gallery'), True)
self.media_list = media_list
self.update = update

View File

@ -150,11 +150,16 @@ class GrampsTab(gtk.HBox):
"""
if event.type == gtk.gdk.KEY_PRESS:
if event.keyval in (_LEFT,) and \
event.state in (gtk.gdk.MOD1_MASK,):
event.state in (gtk.gdk.MOD1_MASK,
gtk.gdk.MOD1_MASK | gtk.gdk.MOD2_MASK):
self.prev_page()
elif event.keyval in (_RIGHT,) and \
event.state in (gtk.gdk.MOD1_MASK,):
event.state in (gtk.gdk.MOD1_MASK,
gtk.gdk.MOD1_MASK | gtk.gdk.MOD2_MASK):
self.next_page()
else:
return
return True
def add_db_signal_callback(self, add_db_signal):
"""
@ -186,6 +191,7 @@ class GrampsTab(gtk.HBox):
else:
self.tab_image.hide()
self.label.set_text(self.tab_name)
self.label.set_use_underline(True)
def build_interface(self):
"""

View File

@ -58,7 +58,7 @@ class LdsEmbedList(EmbeddedList):
def __init__(self, dbstate, uistate, track, data):
self.data = data
EmbeddedList.__init__(self, dbstate, uistate, track,
_('LDS'), LdsModel)
_('_LDS'), LdsModel)
def get_editor(self):
from Editors import EditLdsOrd

View File

@ -59,7 +59,7 @@ class LocationEmbedList(EmbeddedList):
def __init__(self, dbstate, uistate, track, data):
self.data = data
EmbeddedList.__init__(self, dbstate, uistate, track,
_('Alternate Locations'), LocationModel)
_('Alternate _Locations'), LocationModel)
def get_data(self):
return self.data

View File

@ -66,7 +66,7 @@ class NameEmbedList(EmbeddedList):
self.callback = callback
EmbeddedList.__init__(self, dbstate, uistate, track,
_('Names'), NameModel)
_('_Names'), NameModel)
def get_data(self):
return self.data

View File

@ -78,7 +78,7 @@ class NoteTab(EmbeddedList):
self.callertitle = callertitle
self.notetype = notetype
EmbeddedList.__init__(self, dbstate, uistate, track,
_("Notes"), NoteModel, share=True, move=True)
_("_Notes"), NoteModel, share=True, move=True)
def connect_db_signals(self):
#connect external remove/change of object to rebuild of grampstab

View File

@ -57,7 +57,7 @@ class PersonRefEmbedList(EmbeddedList):
def __init__(self, dbstate, uistate, track, data):
self.data = data
EmbeddedList.__init__(self, dbstate, uistate, track,
_('Associations'), PersonRefModel)
_('Ass_ociations'), PersonRefModel)
def get_ref_editor(self):
from Editors import EditPersonRef

View File

@ -66,7 +66,7 @@ class RepoEmbedList(EmbeddedList):
def __init__(self, dbstate, uistate, track, obj):
self.obj = obj
EmbeddedList.__init__(self, dbstate, uistate, track,
_('Repositories'), RepoRefModel, True)
_('_Repositories'), RepoRefModel, True)
def get_icon_name(self):
return 'gramps-repository'

View File

@ -66,7 +66,7 @@ class SourceEmbedList(EmbeddedList):
def __init__(self, dbstate, uistate, track, obj):
self.obj = obj
EmbeddedList.__init__(self, dbstate, uistate, track,
_('Sources'), SourceRefModel, True)
_('_Sources'), SourceRefModel, True)
def get_icon_name(self):
return 'gramps-source'

View File

@ -1,112 +0,0 @@
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2000-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
#
# $Id$
#-------------------------------------------------------------------------
#
# Python classes
#
#-------------------------------------------------------------------------
from gettext import gettext as _
#-------------------------------------------------------------------------
#
# GTK libraries
#
#-------------------------------------------------------------------------
import gtk
#-------------------------------------------------------------------------
#
# GRAMPS classes
#
#-------------------------------------------------------------------------
import Spell
from _GrampsTab import GrampsTab
#-------------------------------------------------------------------------
#
# NoteTab
#
#-------------------------------------------------------------------------
class TextTab(GrampsTab):
def __init__(self, dbstate, uistate, track, obj, title=_('Text')):
self.obj = obj
self.original = self.obj.get_text()
GrampsTab.__init__(self, dbstate, uistate, track, title)
self.show_all()
def _update_label(self, *obj):
cc = self.buf.get_char_count()
if cc == 0 and not self.empty:
self.empty = True
self._set_label()
elif cc != 0 and self.empty:
self.empty = False
self._set_label()
def is_empty(self):
"""
Indicates if the tab contains any data. This is used to determine
how the label should be displayed.
"""
return self.buf.get_char_count() == 0
def build_interface(self):
vbox = gtk.VBox()
self.text_view = gtk.TextView()
self.spellcheck = Spell.Spell(self.text_view)
scroll = gtk.ScrolledWindow()
scroll.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
scroll.add(self.text_view)
scroll.connect('focus-out-event', self.update)
vbox.pack_start(scroll, True)
vbox.set_spacing(6)
vbox.set_border_width(6)
self.pack_start(vbox, True)
self.buf = self.text_view.get_buffer()
if self.obj.get_text():
self.empty = False
self.buf.insert_at_cursor(self.obj.get_text())
else:
self.empty = True
self.buf.connect('changed', self.update)
self.rebuild()
def update(self, obj):
start = self.buf.get_start_iter()
stop = self.buf.get_end_iter()
text = unicode(self.buf.get_text(start, stop))
self.obj.set_text(text)
self._update_label(obj)
return False
def rebuild(self):
self._set_label()
def cancel(self):
self.obj.set_text(self.original)

View File

@ -58,7 +58,7 @@ class WebEmbedList(EmbeddedList):
def __init__(self, dbstate, uistate, track, data):
self.data = data
EmbeddedList.__init__(self, dbstate, uistate, track,
_('Internet'), WebModel, jump=True)
_('_Internet'), WebModel, jump=True)
def get_icon_name(self):
return 'gramps-url'

View File

@ -50,7 +50,6 @@ from _MediaBackRefList import MediaBackRefList
from _NameEmbedList import NameEmbedList
from _NoteBackRefList import NoteBackRefList
from _NoteTab import NoteTab
from _TextTab import TextTab
from _PersonEventEmbedList import PersonEventEmbedList
from _PersonRefEmbedList import PersonRefEmbedList
from _PersonBackRefList import PersonBackRefList

View File

@ -91,7 +91,7 @@ class EditEventRef(EditReference):
#recreate start page as GrampsTab
notebook.remove_page(0)
self.primtab = RefTab(self.dbstate, self.uistate, self.track,
_('General'), tblref)
_('_General'), tblref)
def _init_event(self):
self.commit_event = self.db.commit_personal_event

View File

@ -111,7 +111,7 @@ class ChildEmbedList(EmbeddedList):
"""
self.family = family
EmbeddedList.__init__(self, dbstate, uistate, track,
_('Children'), ChildModel, True, True)
_('_Children'), ChildModel, True, True)
def get_popup_menu_items(self):
return [

View File

@ -90,7 +90,7 @@ class EditMediaRef(EditReference):
#recreate start page as GrampsTab
notebook.remove_page(0)
self.primtab = RefTab(self.dbstate, self.uistate, self.track,
_('General'), tblref)
_('_General'), tblref)
def draw_preview(self):
"""
@ -447,8 +447,8 @@ class EditMediaRef(EditReference):
self.source.get_note_list(),
notetype=NoteType.MEDIA))
self._setup_notebook_tabs( notebook_src)
self._setup_notebook_tabs( notebook_ref)
self._setup_notebook_tabs(notebook_src)
self._setup_notebook_tabs(notebook_ref)
def save(self,*obj):
#first save primary object

View File

@ -120,7 +120,7 @@ class EditName(EditSecondary):
#recreate start page as GrampsTab
notebook.remove_page(0)
self.gennam = GeneralNameTab(self.dbstate, self.uistate, self.track,
_('General'), tblgnam)
_('_General'), tblgnam)
self.original_group_as = self.obj.get_group_as()
self.original_group_set = not (self.original_group_as == '')

View File

@ -198,7 +198,7 @@ class EditNote(EditPrimary):
#recreate start page as GrampsTab
notebook.remove_page(0)
self.ntab = NoteTab(self.dbstate, self.uistate, self.track,
_('Note'), vboxnote)
_('_Note'), vboxnote)
self.build_interface()

View File

@ -88,7 +88,7 @@ class MainLocTab(GrampsTab):
eventbox.add(widget)
self.pack_start(eventbox)
self._set_label(show_image=False)
widget.connect('key_press_event', self.key_pressed)
eventbox.connect('key_press_event', self.key_pressed)
self.show_all()
def is_empty(self):
@ -125,7 +125,7 @@ class EditPlace(EditPrimary):
#recreate start page as GrampsTab
notebook.remove_page(0)
self.mloc = MainLocTab(self.dbstate, self.uistate, self.track,
_('Location'), tblmloc)
_('_Location'), tblmloc)
def get_menu_title(self):
if self.obj and self.obj.get_handle():

View File

@ -103,6 +103,17 @@ class EditPrimary(ManagedWindow.ManagedWindow):
page_no)
child.set_parent_notebook(notebook)
notebook.connect('key-press-event', self.key_pressed, notebook)
def key_pressed(self, obj, event, notebook):
"""
Handles the key being pressed on the notebook, pass to key press of
current page.
"""
pag = notebook.get_current_page()
if not pag == -1:
notebook.get_nth_page(pag).key_pressed(obj, event)
def _switch_page_on_dnd(self, widget, context, x, y, time, notebook,
page_no):
if notebook.get_current_page() != page_no:
@ -111,6 +122,7 @@ class EditPrimary(ManagedWindow.ManagedWindow):
def _add_tab(self, notebook, page):
notebook.insert_page(page, page.get_tab_widget())
page.add_db_signal_callback(self._add_db_signal)
page.label.set_use_underline(True)
return page
def _cleanup_on_exit(self):

View File

@ -141,6 +141,16 @@ class EditReference(ManagedWindow.ManagedWindow):
notebook,
page_no)
child.set_parent_notebook(notebook)
notebook.connect('key-press-event', self.key_pressed, notebook)
def key_pressed(self, obj, event, notebook):
"""
Handles the key being pressed on the notebook, pass to key press of
current page.
"""
pag = notebook.get_current_page()
if not pag == -1:
notebook.get_nth_page(pag).key_pressed(obj, event)
def _switch_page_on_dnd(self, widget, context, x, y, time, notebook, page_no):
if notebook.get_current_page() != page_no:
@ -149,6 +159,7 @@ class EditReference(ManagedWindow.ManagedWindow):
def _add_tab(self,notebook,page):
notebook.insert_page(page, page.get_tab_widget())
page.add_db_signal_callback(self._add_db_signal)
page.label.set_use_underline(True)
return page
def _add_db_signal(self, name, callback):

View File

@ -85,7 +85,7 @@ class EditRepoRef(EditReference):
#recreate start page as GrampsTab
notebook.remove_page(0)
self.primtab = RefTab(self.dbstate, self.uistate, self.track,
_('General'), tblref)
_('_General'), tblref)
def _connect_signals(self):
self.define_ok_button(self.top.get_widget('ok'),self.ok_clicked)

View File

@ -93,6 +93,16 @@ class EditSecondary(ManagedWindow.ManagedWindow):
notebook,
page_no)
child.set_parent_notebook(notebook)
notebook.connect('key-press-event', self.key_pressed, notebook)
def key_pressed(self, obj, event, notebook):
"""
Handles the key being pressed on the notebook, pass to key press of
current page.
"""
pag = notebook.get_current_page()
if not pag == -1:
notebook.get_nth_page(pag).key_pressed(obj, event)
def _switch_page_on_dnd(self, widget, context, x, y, time, notebook, page_no):
if notebook.get_current_page() != page_no:
@ -101,6 +111,7 @@ class EditSecondary(ManagedWindow.ManagedWindow):
def _add_tab(self,notebook,page):
notebook.insert_page(page, page.get_tab_widget())
page.add_db_signal_callback(self._add_db_signal)
page.label.set_use_underline(True)
return page
def _cleanup_on_exit(self):

View File

@ -43,7 +43,7 @@ import const
import gen.lib
from DisplayTabs import \
NoteTab,TextTab,GalleryTab,SourceBackRefList,DataEmbedList,RepoEmbedList
NoteTab,GalleryTab,SourceBackRefList,DataEmbedList,RepoEmbedList
from GrampsWidgets import *
from _EditReference import RefTab, EditReference