2008-02-24 Raphael Ackermann <raphael.ackermann@gmail.com>

* Editors/_EditRepository.py
	* Editors/_EditFamily.py
	* DisplayTabs/_SourceEmbedList.py
	* DisplayTabs/_PersonRefEmbedList.py
	* DisplayTabs/_RepoEmbedList.py
	* DisplayTabs/_AddrEmbedList.py
	* DisplayTabs/_WebEmbedList.py
	* DisplayTabs/_NameEmbedList.py
	* DisplayTabs/_EventEmbedList.py
	* DisplayTabs/_EmbeddedList.py
	* DisplayTabs/_NoteTab.py
	* DisplayTabs/_LocationEmbedList.py
	* DisplayTabs/_ButtonTab.py
	* DisplayTabs/_DataEmbedList.py
	* DisplayTabs/_AttrEmbedList.py
	* DisplayTabs/_LdsEmbedList.py
	* DisplayTabs/_GrampsTab.py
	add Up and Down buttons to the tabs. Added individual tooltips for buttons
	0001807: Missing buttons MoveUp, MoveDown on a Events list in a person...

svn: r10108
This commit is contained in:
Raphael Ackermann 2008-02-24 18:58:45 +00:00
parent f6f9fbafdc
commit 20426f36e3
18 changed files with 193 additions and 66 deletions

View File

@ -1,3 +1,24 @@
2008-02-24 Raphael Ackermann <raphael.ackermann@gmail.com>
* Editors/_EditRepository.py
* Editors/_EditFamily.py
* DisplayTabs/_SourceEmbedList.py
* DisplayTabs/_PersonRefEmbedList.py
* DisplayTabs/_RepoEmbedList.py
* DisplayTabs/_AddrEmbedList.py
* DisplayTabs/_WebEmbedList.py
* DisplayTabs/_NameEmbedList.py
* DisplayTabs/_EventEmbedList.py
* DisplayTabs/_EmbeddedList.py
* DisplayTabs/_NoteTab.py
* DisplayTabs/_LocationEmbedList.py
* DisplayTabs/_ButtonTab.py
* DisplayTabs/_DataEmbedList.py
* DisplayTabs/_AttrEmbedList.py
* DisplayTabs/_LdsEmbedList.py
* DisplayTabs/_GrampsTab.py
add Up and Down buttons to the tabs. Added individual tooltips for buttons
0001807: Missing buttons MoveUp, MoveDown on a Events list in a person...
2008-02-22 Gary Burton <gary.burton@zen.co.uk>
* src/Editors/_EditPerson.py: Fixed crash on clicking OK to save name
change. Bug #1783
@ -16,7 +37,7 @@
* src/glade/gramps.glade: changed tooltip from "close" to "delete"
Gramplets are either undeleted before exit, or they go away
2008-02-22 Raphael Ackermann <raphael.ackermann@gmail.com>
2008-02-24 Raphael Ackermann <raphael.ackermann@gmail.com>
* various (294 files)
pep8 doc fixes & pylint fixes

View File

@ -21,7 +21,7 @@
# $Id$
"""
Address List display tab
Address List display tab.
"""
#-------------------------------------------------------------------------
@ -39,8 +39,8 @@ from gettext import gettext as _
import gen.lib
import Errors
from DdTargets import DdTargets
from _AddressModel import AddressModel
from _EmbeddedList import EmbeddedList
from DisplayTabs._AddressModel import AddressModel
from DisplayTabs._EmbeddedList import EmbeddedList
#-------------------------------------------------------------------------
#
@ -49,13 +49,22 @@ from _EmbeddedList import EmbeddedList
#-------------------------------------------------------------------------
class AddrEmbedList(EmbeddedList):
"""
Address List display tab for edit dialogs. Derives from the EmbeddedList
class.
Address List display tab for edit dialogs.
Derives from the EmbeddedList class.
"""
_HANDLE_COL = 5
_DND_TYPE = DdTargets.ADDRESS
_MSG = {
'add' : _('Create and add a new address'),
'del' : _('Remove the existing address'),
'edit' : _('Edit the selected address'),
'up' : _('Move the selected address upwards'),
'down' : _('Move the selected address downwards'),
}
_column_names = [
(_('Date'), 0, 150),
(_('Address'), 1, 225),
@ -66,8 +75,8 @@ class AddrEmbedList(EmbeddedList):
def __init__(self, dbstate, uistate, track, data):
self.data = data
EmbeddedList.__init__(self, dbstate, uistate, track,
_('_Addresses'), AddressModel)
EmbeddedList.__init__(self, dbstate, uistate, track, _('_Addresses'),
AddressModel, move_buttons=True)
def get_icon_name(self):
"""
@ -89,7 +98,7 @@ class AddrEmbedList(EmbeddedList):
def add_button_clicked(self, obj):
"""
Called with the Add button is clicked. Creates a new Address instance
Called when the Add button is clicked. Creates a new Address instance
and calls the EditAddress editor with the new address. If the window
already exists (Errors.WindowActiveError), we ignore it. This prevents
the dialog from coming up twice on the same object.

View File

@ -35,8 +35,8 @@ from gettext import gettext as _
import gen.lib
import Errors
from DdTargets import DdTargets
from _AttrModel import AttrModel
from _EmbeddedList import EmbeddedList
from DisplayTabs._AttrModel import AttrModel
from DisplayTabs._EmbeddedList import EmbeddedList
#-------------------------------------------------------------------------
#
@ -48,6 +48,14 @@ class AttrEmbedList(EmbeddedList):
_HANDLE_COL = 2
_DND_TYPE = DdTargets.ATTRIBUTE
_MSG = {
'add' : _('Create and add a new attribute'),
'del' : _('Remove the existing attribute'),
'edit' : _('Edit the selected attribute'),
'up' : _('Move the selected attribute upwards'),
'down' : _('Move the selected attribute downwards'),
}
_column_names = [
(_('Type'), 0, 250),
(_('Value'), 1, 200),
@ -55,8 +63,8 @@ class AttrEmbedList(EmbeddedList):
def __init__(self, dbstate, uistate, track, data):
self.data = data
EmbeddedList.__init__(self, dbstate, uistate, track,
_('_Attributes'), AttrModel)
EmbeddedList.__init__(self, dbstate, uistate, track, _('_Attributes'),
AttrModel, move_buttons=True)
def get_editor(self):
from Editors import EditAttribute

View File

@ -76,7 +76,8 @@ class ButtonTab(GrampsTab):
def __init__(self, dbstate, uistate, track, name, share_button=False,
move_buttons=False, jump_button=False):
"""
Similar to the base class, except after Build
Similar to the base class, except after Build.
@param dbstate: The database state. Contains a reference to
the database, along with other state information. The GrampsTab
uses this to access the database and to pass to and created
@ -103,8 +104,10 @@ class ButtonTab(GrampsTab):
def create_buttons(self, share_button, move_buttons, jump_button):
"""
Create a button box consisting of three buttons, one for Add,
one for Edit, and one for Delete. This button box is then appended
hbox (self).
one for Edit, and one for Delete.
Add buttons for Share, Move and Jump depending on parameters. This
button box is then appended hbox (self).
"""
self.add_btn = SimpleButton(gtk.STOCK_ADD, self.add_button_clicked)
self.edit_btn = SimpleButton(gtk.STOCK_EDIT, self.edit_button_clicked)

View File

@ -32,8 +32,8 @@ from gettext import gettext as _
# GRAMPS classes
#
#-------------------------------------------------------------------------
from _DataModel import DataModel
from _EmbeddedList import EmbeddedList
from DisplayTabs._DataModel import DataModel
from DisplayTabs._EmbeddedList import EmbeddedList
#-------------------------------------------------------------------------
#
@ -45,6 +45,14 @@ class DataEmbedList(EmbeddedList):
_HANDLE_COL = 0
_DND_TYPE = None
_MSG = {
'add' : _('Create and add a new data entry'),
'del' : _('Remove the existing data entry'),
'edit' : _('Edit the selected data entry'),
'up' : _('Move the selected data entry upwards'),
'down' : _('Move the selected data entry downwards'),
}
_column_names = [
(_('Key'), 0, 150),
(_('Value'), 1, 250),
@ -53,8 +61,8 @@ class DataEmbedList(EmbeddedList):
def __init__(self, dbstate, uistate, track, obj):
self.obj = obj
EmbeddedList.__init__(self, dbstate, uistate, track,
_('_Data'), DataModel)
EmbeddedList.__init__(self, dbstate, uistate, track, _('_Data'),
DataModel, move_buttons=True)
def build_columns(self):
EmbeddedList.build_columns(self)

View File

@ -41,7 +41,7 @@ import pango
# GRAMPS classes
#
#-------------------------------------------------------------------------
from _ButtonTab import ButtonTab
from DisplayTabs._ButtonTab import ButtonTab
#-------------------------------------------------------------------------
#
@ -50,9 +50,9 @@ from _ButtonTab import ButtonTab
#-------------------------------------------------------------------------
class EmbeddedList(ButtonTab):
"""
This class provides the base class for all the list tabs. It
maintains a gtk.TreeView, including the selection and button
sensitivity.
This class provides the base class for all the list tabs.
It maintains a gtk.TreeView, including the selection and button sensitivity.
"""
_HANDLE_COL = -1
@ -60,12 +60,12 @@ class EmbeddedList(ButtonTab):
_DND_EXTRA = None
def __init__(self, dbstate, uistate, track, name, build_model,
share=False, move=False, jump=False):
share_button=False, move_buttons=False, jump_button=False):
"""
Create a new list, using the passed build_model to
populate the list.
Create a new list, using the passed build_model to populate the list.
"""
ButtonTab.__init__(self, dbstate, uistate, track, name, share, move, jump)
ButtonTab.__init__(self, dbstate, uistate, track, name, share_button,
move_buttons, jump_button)
self.changed = False
self.build_model = build_model
@ -262,7 +262,7 @@ class EmbeddedList(ButtonTab):
self.changed = True
self.rebuild()
def _move_up(self, row_from, obj,selmethod=None):
def _move_up(self, row_from, obj, selmethod=None):
"""
Move the item a position up in the EmbeddedList.
Eg: 0,1,2,3 needs to become 0,2,1,3, here row_from = 2

View File

@ -54,6 +54,8 @@ class EventEmbedList(EmbeddedList):
'del' : _('Remove the selected event'),
'edit' : _('Edit the selected event'),
'share' : _('Share an existing event'),
'up' : _('Move the selected event upwards'),
'down' : _('Move the selected event downwards'),
}
_column_names = [
@ -67,8 +69,9 @@ class EventEmbedList(EmbeddedList):
def __init__(self, dbstate, uistate, track, obj):
self.obj = obj
EmbeddedList.__init__(self, dbstate, uistate, track,
_('_Events'), EventRefModel, True)
EmbeddedList.__init__(self, dbstate, uistate, track, _('_Events'),
EventRefModel, share_button=True,
move_buttons=True)
def get_ref_editor(self):
from Editors import EditFamilyEventRef

View File

@ -39,9 +39,10 @@ _RIGHT = gtk.gdk.keyval_from_name("Right")
class GrampsTab(gtk.HBox):
"""
This class provides the base level class for 'tabs', which are used to
fill in notebook tabs for GRAMPS edit dialogs. Each tab returns a
gtk container widget which can be inserted into a gtk.Notebook by the
instantiating object.
fill in notebook tabs for GRAMPS edit dialogs.
Each tab returns a gtk container widget which can be inserted into a
gtk.Notebook by the instantiating object.
All tab classes should inherit from GrampsTab
"""

View File

@ -47,6 +47,14 @@ class LdsEmbedList(EmbeddedList):
_HANDLE_COL = 5
# _DND_TYPE = DdTargets.ADDRESS
_MSG = {
'add' : _('Create and add a new LDS ordinance'),
'del' : _('Remove the existing LDS ordinance'),
'edit' : _('Edit the selected LDS ordinance'),
'up' : _('Move the selected LDS ordinance upwards'),
'down' : _('Move the selected LDS ordinance downwards'),
}
_column_names = [
(_('Type'), 0, 150),
(_('Date'), 1, 150),
@ -57,8 +65,8 @@ class LdsEmbedList(EmbeddedList):
def __init__(self, dbstate, uistate, track, data):
self.data = data
EmbeddedList.__init__(self, dbstate, uistate, track,
_('_LDS'), LdsModel)
EmbeddedList.__init__(self, dbstate, uistate, track, _('_LDS'),
LdsModel, move_buttons=True)
def get_editor(self):
from Editors import EditLdsOrd

View File

@ -59,7 +59,8 @@ 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,
move_buttons=True)
def get_data(self):
return self.data

View File

@ -42,8 +42,8 @@ from gettext import gettext as _
import gen.lib
import Errors
from DdTargets import DdTargets
from _NameModel import NameModel
from _EmbeddedList import EmbeddedList
from DisplayTabs._NameModel import NameModel
from DisplayTabs._EmbeddedList import EmbeddedList
#-------------------------------------------------------------------------
#
@ -55,6 +55,14 @@ class NameEmbedList(EmbeddedList):
_HANDLE_COL = 2
_DND_TYPE = DdTargets.NAME
_MSG = {
'add' : _('Create and add a new name'),
'del' : _('Remove the existing name'),
'edit' : _('Edit the selected name'),
'up' : _('Move the selected name upwards'),
'down' : _('Move the selected name downwards'),
}
_column_names = [
(_('Name'), 0, 250),
(_('Type'), 1, 100),
@ -65,8 +73,8 @@ class NameEmbedList(EmbeddedList):
self.person = person
self.callback = callback
EmbeddedList.__init__(self, dbstate, uistate, track,
_('_Names'), NameModel)
EmbeddedList.__init__(self, dbstate, uistate, track, _('_Names'),
NameModel, move_buttons=True)
def get_data(self):
return self.data

View File

@ -50,6 +50,11 @@ from DdTargets import DdTargets
#
#-------------------------------------------------------------------------
class NoteTab(EmbeddedList):
"""
Note List display tab for edit dialogs.
Derives from the EmbeddedList class.
"""
_HANDLE_COL = 2
_DND_TYPE = DdTargets.NOTE_LINK
@ -74,7 +79,8 @@ class NoteTab(EmbeddedList):
self.callertitle = callertitle
self.notetype = notetype
EmbeddedList.__init__(self, dbstate, uistate, track,
_("_Notes"), NoteModel, share=True, move=True)
_("_Notes"), NoteModel, share_button=True,
move_buttons=True)
def connect_db_signals(self):
#connect external remove/change of object to rebuild of grampstab
@ -89,12 +95,26 @@ class NoteTab(EmbeddedList):
return []
def get_data(self):
"""
Return the data associated with display tab
"""
return self.data
def column_order(self):
"""
Return the column order of the columns in the display tab.
"""
return ((1, 0), (1, 1))
def add_button_clicked(self, obj):
"""
Create a new Note instance and call the EditNote editor with the new
note.
Called when the Add button is clicked.
If the window already exists (Errors.WindowActiveError), we ignore it.
This prevents the dialog from coming up twice on the same object.
"""
note = gen.lib.Note()
if self.notetype :
note.set_type(self.notetype)
@ -107,11 +127,22 @@ class NoteTab(EmbeddedList):
pass
def add_callback(self, name):
"""
Called to update the screen when a new note is added
"""
self.get_data().append(name)
self.changed = True
self.rebuild()
def edit_button_clicked(self, obj):
"""
Get the selected Note instance and call the EditNote editor with the
note.
Called when the Edit button is clicked.
If the window already exists (Errors.WindowActiveError), we ignore it.
This prevents the dialog from coming up twice on the same object.
"""
handle = self.get_selected()
if handle:
note = self.dbstate.db.get_note_from_handle(handle)
@ -133,6 +164,9 @@ class NoteTab(EmbeddedList):
self.add_callback(note.handle)
def get_icon_name(self):
"""
Return the stock-id icon name associated with the display tab
"""
return 'gramps-notes'
def note_delete(self, del_note_handle_list):
@ -140,7 +174,7 @@ class NoteTab(EmbeddedList):
Outside of this tab note objects have been deleted. Check if tab
and object must be changed.
Note: delete of object will cause reference on database to be removed,
so this method need not do this
so this method need not do this
"""
rebuild = False
for handle in del_note_handle_list :
@ -155,7 +189,6 @@ class NoteTab(EmbeddedList):
Outside of this tab note objects have been updated. Check if tab
and object must be updated.
"""
ref_handles = self.data
for handle in upd_note_handle_list :
if handle in self.data:
self.rebuild()

View File

@ -48,6 +48,14 @@ class PersonRefEmbedList(EmbeddedList):
_HANDLE_COL = 3
_DND_TYPE = DdTargets.PERSONREF
_MSG = {
'add' : _('Create and add a new association'),
'del' : _('Remove the existing association'),
'edit' : _('Edit the selected association'),
'up' : _('Move the selected association upwards'),
'down' : _('Move the selected association downwards'),
}
_column_names = [
(_('Name'), 0, 250),
(_('ID'), 1, 100),
@ -57,7 +65,8 @@ class PersonRefEmbedList(EmbeddedList):
def __init__(self, dbstate, uistate, track, data):
self.data = data
EmbeddedList.__init__(self, dbstate, uistate, track,
_('_Associations'), PersonRefModel)
_('_Associations'), PersonRefModel,
move_buttons=True)
def get_ref_editor(self):
from Editors import EditPersonRef

View File

@ -54,6 +54,8 @@ class RepoEmbedList(EmbeddedList):
'del' : _('Remove the existing repository'),
'edit' : _('Edit the selected repository'),
'share' : _('Add an existing repository'),
'up' : _('Move the selected repository upwards'),
'down' : _('Move the selected repository downwards'),
}
_column_names = [
@ -66,7 +68,8 @@ class RepoEmbedList(EmbeddedList):
def __init__(self, dbstate, uistate, track, obj):
self.obj = obj
EmbeddedList.__init__(self, dbstate, uistate, track,
_('_Repositories'), RepoRefModel, True)
_('_Repositories'), RepoRefModel,
share_button=True, move_buttons=True)
def get_icon_name(self):
return 'gramps-repository'

View File

@ -54,6 +54,8 @@ class SourceEmbedList(EmbeddedList):
'del' : _('Remove the existing source'),
'edit' : _('Edit the selected source'),
'share' : _('Add an existing source'),
'up' : _('Move the selected source upwards'),
'down' : _('Move the selected source downwards'),
}
_column_names = [
@ -65,8 +67,9 @@ class SourceEmbedList(EmbeddedList):
def __init__(self, dbstate, uistate, track, obj):
self.obj = obj
EmbeddedList.__init__(self, dbstate, uistate, track,
_('_Sources'), SourceRefModel, True)
EmbeddedList.__init__(self, dbstate, uistate, track, _('_Sources'),
SourceRefModel, share_button=True,
move_buttons=True)
def get_icon_name(self):
return 'gramps-source'

View File

@ -49,6 +49,15 @@ class WebEmbedList(EmbeddedList):
_HANDLE_COL = 3
_DND_TYPE = DdTargets.URL
_MSG = {
'add' : _('Create and add a new web address'),
'del' : _('Remove the existing web address'),
'edit' : _('Edit the selected web address'),
'up' : _('Move the selected web address upwards'),
'down' : _('Move the selected web address downwards'),
'jump' : _('Jump to the selected web address'),
}
_column_names = [
(_('Type') , 0, 100),
(_('Path') , 1, 200),
@ -57,8 +66,8 @@ class WebEmbedList(EmbeddedList):
def __init__(self, dbstate, uistate, track, data):
self.data = data
EmbeddedList.__init__(self, dbstate, uistate, track,
_('_Internet'), WebModel, jump=True)
EmbeddedList.__init__(self, dbstate, uistate, track, _('_Internet'),
WebModel, move_buttons=True, jump_button=True)
def get_icon_name(self):
return 'gramps-url'

View File

@ -114,8 +114,8 @@ class ChildEmbedList(EmbeddedList):
Create the object, storing the passed family value
"""
self.family = family
EmbeddedList.__init__(self, dbstate, uistate, track,
_('_Children'), ChildModel, True, True)
EmbeddedList.__init__(self, dbstate, uistate, track, _('_Children'),
ChildModel, share_button=True, move_buttons=True)
def get_popup_menu_items(self):
return [

View File

@ -109,25 +109,25 @@ class EditRepository(EditPrimary):
notebook = gtk.Notebook()
self.addr_tab = self._add_tab(
notebook,
AddrEmbedList(self.dbstate, self.uistate, self.track,
self.obj.get_address_list()))
notebook,
AddrEmbedList(self.dbstate, self.uistate, self.track,
self.obj.get_address_list()))
self.url_tab = self._add_tab(
notebook,
WebEmbedList(self.dbstate, self.uistate, self.track,
self.obj.get_url_list()))
notebook,
WebEmbedList(self.dbstate, self.uistate, self.track,
self.obj.get_url_list()))
self.note_tab = self._add_tab(
notebook,
NoteTab(self.dbstate, self.uistate, self.track,
self.obj.get_note_list(), self.get_menu_title(),
notetype=gen.lib.NoteType.REPO))
notebook,
NoteTab(self.dbstate, self.uistate, self.track,
self.obj.get_note_list(), self.get_menu_title(),
notetype=gen.lib.NoteType.REPO))
self.backref_tab = self._add_tab(
notebook,
SourceBackRefList(self.dbstate, self.uistate, self.track,
self.db.find_backlink_handles(self.obj.handle)))
notebook,
SourceBackRefList(self.dbstate, self.uistate, self.track,
self.db.find_backlink_handles(self.obj.handle)))
self._setup_notebook_tabs( notebook)
notebook.show_all()