2006-08-20 Alex Roitman <shura@gramps-project.org>

* src/DataViews/_EventView.py (column_names): Remove cause column.
	* src/DisplayModels/_EventModel.py: Use constants for column
	numbers; remove cause column.	



svn: r7218
This commit is contained in:
Alex Roitman 2006-08-21 02:10:55 +00:00
parent 52fa9ea155
commit e407d28d90
3 changed files with 32 additions and 17 deletions

View File

@ -1,3 +1,8 @@
2006-08-20 Alex Roitman <shura@gramps-project.org>
* src/DataViews/_EventView.py (column_names): Remove cause column.
* src/DisplayModels/_EventModel.py: Use constants for column
numbers; remove cause column.
2006-08-20 Brian Matherly <brian@gramps-project.org> 2006-08-20 Brian Matherly <brian@gramps-project.org>
* src/Config/_GrampsIniKeys.py: Report error on invalid filename * src/Config/_GrampsIniKeys.py: Report error on invalid filename
* src/const.py.in: detect windows home directory before others * src/const.py.in: detect windows home directory before others

View File

@ -57,7 +57,6 @@ column_names = [
_('Type'), _('Type'),
_('Date'), _('Date'),
_('Place'), _('Place'),
_('Cause'),
_('Last Changed'), _('Last Changed'),
] ]

View File

@ -51,6 +51,19 @@ import DateHandler
import RelLib import RelLib
from _BaseModel import BaseModel from _BaseModel import BaseModel
#-------------------------------------------------------------------------
#
# COLUMN constants
#
#-------------------------------------------------------------------------
COLUMN_HANDLE = 0
COLUMN_ID = 1
COLUMN_TYPE = 2
COLUMN_DATE = 3
COLUMN_DESCRIPTION = 4
COLUMN_PLACE = 5
COLUMN_CHANGE = 10
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
# EventModel # EventModel
@ -69,7 +82,6 @@ class EventModel(BaseModel):
self.column_type, self.column_type,
self.column_date, self.column_date,
self.column_place, self.column_place,
self.column_cause,
self.column_change, self.column_change,
self.column_handle, self.column_handle,
self.column_tooltip, self.column_tooltip,
@ -80,7 +92,6 @@ class EventModel(BaseModel):
self.column_type, self.column_type,
self.sort_date, self.sort_date,
self.column_place, self.column_place,
self.column_cause,
self.sort_change, self.sort_change,
self.column_handle, self.column_handle,
self.column_tooltip, self.column_tooltip,
@ -92,50 +103,50 @@ class EventModel(BaseModel):
return len(self.fmap)+1 return len(self.fmap)+1
def column_description(self,data): def column_description(self,data):
return data[4] return data[COLUMN_DESCRIPTION]
def column_cause(self,data):
return data[6]
def column_place(self,data): def column_place(self,data):
if data[5]: if data[COLUMN_PLACE]:
return self.db.get_place_from_handle(data[5]).get_title() return self.db.get_place_from_handle(data[COLUMN_PLACE]).get_title()
else: else:
return u'' return u''
def column_type(self,data): def column_type(self,data):
return str(RelLib.EventType(data[2])) return str(RelLib.EventType(data[COLUMN_TYPE]))
def column_id(self,data): def column_id(self,data):
return unicode(data[1]) return unicode(data[COLUMN_ID])
def column_date(self,data): def column_date(self,data):
if data[3]: if data[COLUMN_DATE]:
event = RelLib.Event() event = RelLib.Event()
event.unserialize(data) event.unserialize(data)
return DateHandler.get_date(event) return DateHandler.get_date(event)
return u'' return u''
def sort_date(self,data): def sort_date(self,data):
if data[3]: if data[COLUMN_DATE]:
event = RelLib.Event() event = RelLib.Event()
event.unserialize(data) event.unserialize(data)
return "%09d" % event.get_date_object().get_sort_value() return "%09d" % event.get_date_object().get_sort_value()
return u'' return u''
def column_handle(self,data): def column_handle(self,data):
return unicode(data[0]) return unicode(data[COLUMN_HANDLE])
def sort_change(self,data): def sort_change(self,data):
return "%012x" % data[10] return "%012x" % data[COLUMN_CHANGE]
def column_change(self,data): def column_change(self,data):
return unicode(time.strftime('%x %X',time.localtime(data[10])), return unicode(time.strftime('%x %X',
time.localtime(data[COLUMN_CHANGE])),
GrampsLocale.codeset) GrampsLocale.codeset)
def column_tooltip(self,data): def column_tooltip(self,data):
try: try:
t = ToolTips.TipFromFunction(self.db, lambda: self.db.get_event_from_handle(data[0])) t = ToolTips.TipFromFunction(
self.db,
lambda: self.db.get_event_from_handle(data[COLUMN_HANDLE]))
except: except:
log.error("Failed to create tooltip.", exc_info=True) log.error("Failed to create tooltip.", exc_info=True)
return t return t