* src/DisplayModels.py: Add Date and Place columns to Media model;

Zip to Place model.
* src/MediaView.py: Support for Date and Place columns.
* src/PlaceView.py: Support for Zil column.
* src/GrampsDbBase.py (get_place_column_order,
get_media_column_order): New column defaults.


svn: r3907
This commit is contained in:
Alex Roitman 2005-01-12 13:41:54 +00:00
parent 156b885b05
commit 2b583a8e6d
5 changed files with 43 additions and 14 deletions

View File

@ -1,3 +1,11 @@
2005-01-12 Martin Hawlisch <Martin.Hawlisch@gmx.de>
* src/DisplayModels.py: Add Date and Place columns to Media model;
Zip to Place model.
* src/MediaView.py: Support for Date and Place columns.
* src/PlaceView.py: Support for Zil column.
* src/GrampsDbBase.py (get_place_column_order,
get_media_column_order): New column defaults.
2005-01-11 Eero Tamminen <eerot@sf>
* src/plugins/StatisticsChart.py: remove localization from command
line options help and put it back to dialog additions. Have

View File

@ -1,7 +1,7 @@
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2000-2003 Donald N. Allingham
# Copyright (C) 2000-2005 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
@ -40,6 +40,7 @@ import gtk
#
#-------------------------------------------------------------------------
import NameDisplay
import DateHandler
_GENDER = [ _(u'female'), _(u'male'), _(u'unknown') ]
@ -292,6 +293,7 @@ class PlaceModel(BaseModel):
self.column_name,
self.column_id,
self.column_parish,
self.column_postal_code,
self.column_city,
self.column_county,
self.column_state,
@ -351,6 +353,12 @@ class PlaceModel(BaseModel):
except:
return u''
def column_postal_code(self,data):
try:
return data[5].get_postal_code()
except:
return u''
def column_change(self,data):
return unicode(time.asctime(time.localtime(data[11])))
@ -371,6 +379,8 @@ class MediaModel(BaseModel):
self.column_mime,
self.column_path,
self.column_change,
self.column_date,
self.column_place,
self.column_handle,
]
BaseModel.__init__(self,db)
@ -390,9 +400,20 @@ class MediaModel(BaseModel):
def column_id(self,data):
return unicode(data[1])
def column_date(self,data):
if data[9]:
return unicode(DateHandler.displayer.display(data[9]))
return u''
def column_place(self,data):
if data[10]:
place = self.db.get_place_from_handle(data[10])
if place:
return place.get_title()
return u''
def column_handle(self,data):
return unicode(data[0])
def column_change(self,data):
return unicode(time.asctime(time.localtime(data[8])))

View File

@ -1196,7 +1196,7 @@ class GrampsDbBase:
Returns the Place display common information stored in the
database's metadata.
"""
default = [(1,1),(1,2),(0,3),(1,4),(0,5),(1,6),(0,7),(0,8),(0,9)]
default = [(1,1),(1,2),(0,3),(0,4),(1,5),(0,6),(1,7),(0,8),(0,9),(0,10)]
if self.metadata == None:
return default
else:
@ -1226,7 +1226,7 @@ class GrampsDbBase:
Returns the MediaObject display common information stored in the
database's metadata.
"""
default = [(1,1),(1,2),(1,3),(0,4)]
default = [(1,1),(0,5),(0,6),(1,2),(1,3),(0,4)]
if self.metadata == None:
return default
else:
@ -1301,4 +1301,3 @@ class Transaction:
if self.last and self.first:
return self.last - self.first + 1
return 0

View File

@ -1,7 +1,7 @@
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2001-2004 Donald N. Allingham
# Copyright (C) 2001-2005 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
@ -66,8 +66,11 @@ column_names = [
_('Type'),
_('Path'),
_('Last Changed'),
_('Date'),
_('Place'),
]
_HANDLE_COL = len(column_names)
#-------------------------------------------------------------------------
#
# MediaView
@ -173,7 +176,7 @@ class MediaView:
if not node:
return
handle = store.get_value(node,5)
handle = store.get_value(node,_HANDLE_COL)
mobj = self.db.get_object_from_handle(handle)
mtype = mobj.get_mime_type()
@ -219,7 +222,7 @@ class MediaView:
store,node = self.selection.get_selected()
if node:
handle = store.get_value(node,5)
handle = store.get_value(node,_HANDLE_COL)
obj = self.db.get_object_from_handle(handle)
self.obj = obj
mime_type = obj.get_mime_type()
@ -284,7 +287,7 @@ class MediaView:
list_store, node = self.selection.get_selected()
if node:
handle = list_store.get_value(node,5)
handle = list_store.get_value(node,_HANDLE_COL)
obj = self.db.get_object_from_handle(handle)
ImageSelect.GlobalMediaProperties(self.db,obj,
self.update_display,
@ -295,7 +298,7 @@ class MediaView:
if not node:
return
handle = store.get_value(node,5)
handle = store.get_value(node,_HANDLE_COL)
mobj = self.db.get_object_from_handle(handle)
if self.is_object_used(mobj):
ans = ImageSelect.DeleteMediaQuery(mobj,self.db,
@ -352,7 +355,7 @@ class MediaView:
if not node:
return
if (const.dnd_images):
handle = store.get_value(node,5)
handle = store.get_value(node,_HANDLE_COL)
obj = self.db.get_object_from_handle(handle)
image = ImgManip.get_thumbnail_image(obj.get_path())
context.set_icon_pixbuf(image,0,0)
@ -415,5 +418,3 @@ class MediaView:
if GrampsKeys.get_media_global():
ImageSelect.GlobalMediaProperties(self.db,photo,None,
self,self.topWindow)

View File

@ -49,6 +49,7 @@ column_names = [
_('Place Name'),
_('ID'),
_('Church Parish'),
_('ZIP/Postal Code'),
_('City'),
_('County'),
_('State'),
@ -257,4 +258,3 @@ class PlaceView:
else:
import MergeData
MergeData.MergePlaces(self.parent.db,mlist[0],mlist[1],self.build_tree)