2007-06-25 Don Allingham <don@gramps-project.org>

* src/DisplayTabs/_AddrEmbedList.py: pylint
	* src/DisplayTabs/_AddressModel.py: pylint
	* src/DisplayTabs/_WebModel.py: pylint



svn: r8670
This commit is contained in:
Don Allingham 2007-06-26 03:43:01 +00:00
parent 88f21179fe
commit ef7a215d1b
4 changed files with 63 additions and 13 deletions

View File

@ -1,3 +1,8 @@
2007-06-25 Don Allingham <don@gramps-project.org>
* src/DisplayTabs/_AddrEmbedList.py: pylint
* src/DisplayTabs/_AddressModel.py: pylint
* src/DisplayTabs/_WebModel.py: pylint
2007-06-25 Alex Roitman <shura@gramps-project.org>
* src/GrampsDb/_GrampsBSDDB.py (commit_base): Rename method.
* src/GrampsDb/_GrampsDBDir.py (commit_base): Rename method.

View File

@ -20,6 +20,10 @@
# $Id$
"""
Address List display tab
"""
#-------------------------------------------------------------------------
#
# Python classes
@ -44,6 +48,10 @@ from _EmbeddedList import EmbeddedList
#
#-------------------------------------------------------------------------
class AddrEmbedList(EmbeddedList):
"""
Address List display tab for edit dialogs. Derives from the EmbeddedList
class.
"""
_HANDLE_COL = 5
_DND_TYPE = DdTargets.ADDRESS
@ -62,15 +70,30 @@ class AddrEmbedList(EmbeddedList):
_('Addresses'), AddressModel)
def get_icon_name(self):
"""
Returns the stock-id icon name associated with the display tab
"""
return 'gramps-address'
def get_data(self):
"""
Returns the data associated with display tab
"""
return self.data
def column_order(self):
"""
Returns the column order of the columns in the display tab.
"""
return ((1, 0), (1, 1), (1, 2), (1, 3), (1, 4))
def add_button_clicked(self, obj):
"""
Called with 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.
"""
addr = RelLib.Address()
try:
from Editors import EditAddress
@ -78,13 +101,22 @@ class AddrEmbedList(EmbeddedList):
EditAddress(self.dbstate, self.uistate, self.track,
addr, self.add_callback)
except Errors.WindowActiveError:
pass
return
def add_callback(self, name):
"""
Called to update the screen when a new address is added
"""
self.get_data().append(name)
self.rebuild()
def edit_button_clicked(self, obj):
"""
Called with the Edit button is clicked. Gets the selected Address instance
and calls the EditAddress editor with the address. If the window
already exists (Errors.WindowActiveError), we ignore it. This prevents
the dialog from coming up twice on the same object.
"""
addr = self.get_selected()
if addr:
try:
@ -93,7 +125,10 @@ class AddrEmbedList(EmbeddedList):
EditAddress(self.dbstate, self.uistate, self.track,
addr, self.edit_callback)
except Errors.WindowActiveError:
pass
return
def edit_callback(self, name):
"""
Called to update the screen when the address changes
"""
self.rebuild()

View File

@ -20,6 +20,10 @@
# $Id$
"""
The TreeModel for the Address list in the Address Tab.
"""
#-------------------------------------------------------------------------
#
# GTK libraries
@ -40,10 +44,16 @@ import DateHandler
#
#-------------------------------------------------------------------------
class AddressModel(gtk.ListStore):
"""
AddressModel derives from the ListStore, defining te items in the list
"""
def __init__(self, obj_list, db):
def __init__(self, obj_list, dbase):
"""
AddressModel derives from the ListStore, defining te items in the list
"""
gtk.ListStore.__init__(self, str, str, str, str, str, object)
self.db = db
self.db = dbase
for obj in obj_list:
self.append(row=[
DateHandler.get_date(obj),

View File

@ -20,6 +20,10 @@
# $Id$
"""
The TreeModel for the URL list in the Url Tab.
"""
#-------------------------------------------------------------------------
#
# GTK libraries
@ -27,22 +31,18 @@
#-------------------------------------------------------------------------
import gtk
#-------------------------------------------------------------------------
#
# GRAMPS classes
#
#-------------------------------------------------------------------------
#-------------------------------------------------------------------------
#
# WebModel
#
#-------------------------------------------------------------------------
class WebModel(gtk.ListStore):
"""
WebModel derives from the ListStore, defining te items in the list
"""
def __init__(self, obj_list, dbase):
def __init__(self, obj_list, db):
gtk.ListStore.__init__(self, str, str, str, object)
self.db = db
self.db = dbase
for obj in obj_list:
self.append(row=[str(obj.type), obj.path, obj.desc, obj])