* src/DataViews/_RepositoryView.py: column fixes

* src/DataViews/_SourceView.py: column fixes
	* src/DataViews/_EventView.py: column fixes
	* src/DataViews/_FamilyList.py: column fixes
	* src/DataViews/_PlaceView.py: column fixes
	* src/DataViews/_PersonView.py: column fixes
	* src/DisplayModels.py: column/sort fixes
	* src/PageView.py: column/sort fixes


svn: r6664
This commit is contained in:
Don Allingham 2006-05-15 04:14:03 +00:00
parent 0511cb590d
commit 06c27271c5
9 changed files with 77 additions and 44 deletions

View File

@ -8,6 +8,14 @@
* src/plugins/FamilyGroup.py: Fix for Event and EventType changes.
2006-05-14 Don Allingham <don@gramps-project.org>
* src/DataViews/_RepositoryView.py: column fixes
* src/DataViews/_SourceView.py: column fixes
* src/DataViews/_EventView.py: column fixes
* src/DataViews/_FamilyList.py: column fixes
* src/DataViews/_PlaceView.py: column fixes
* src/DataViews/_PersonView.py: column fixes
* src/DisplayModels.py: column/sort fixes
* src/PageView.py: column/sort fixes
* src/DateHandler/__init__.py: import DateParser and DateDisplay
* src/DataViews/_PersonView.py: default gender filter to "any"
* configure.in: bump up to 2.1.2

View File

@ -102,9 +102,6 @@ class EventView(PageView.ListView):
def ui_definition(self):
return '''<ui>
<menubar name="MenuBar">
<menu action="ViewMenu">
<menuitem action="Filter"/>
</menu>
<menu action="BookMenu">
<placeholder name="AddEditBook">
<menuitem action="AddBook"/>

View File

@ -115,9 +115,6 @@ class FamilyListView(PageView.ListView):
</placeholder>
<menuitem action="ColumnEdit"/>
</menu>
<menu action="ViewMenu">
<menuitem action="Filter"/>
</menu>
<menu action="BookMenu">
<placeholder name="AddEditBook">
<menuitem action="AddBook"/>

View File

@ -307,7 +307,13 @@ class PersonView(PageView.PersonNavView):
return table
def clear_clicked(self,obj):
print "clear"
self.filter_name.set_text('')
self.filter_id.set_text('')
self.filter_birth.set_text('')
self.filter_death.get_text('')
self.filter_note.get_text('')
self.filter_gender.set_active(0)
self.event_menu.child.set_text('')
def filter_clicked(self, obj):
name = self.filter_name.get_text().strip()

View File

@ -121,9 +121,6 @@ class PlaceView(PageView.ListView):
def ui_definition(self):
return '''<ui>
<menubar name="MenuBar">
<menu action="ViewMenu">
<menuitem action="Filter"/>
</menu>
<menu action="BookMenu">
<placeholder name="AddEditBook">
<menuitem action="AddBook"/>

View File

@ -127,9 +127,6 @@ class RepositoryView(PageView.ListView):
def ui_definition(self):
return '''<ui>
<menubar name="MenuBar">
<menu action="ViewMenu">
<menuitem action="Filter"/>
</menu>
<menu action="BookMenu">
<placeholder name="AddEditBook">
<menuitem action="AddBook"/>

View File

@ -119,9 +119,6 @@ class SourceView(PageView.ListView):
def ui_definition(self):
return '''<ui>
<menubar name="MenuBar">
<menu action="ViewMenu">
<menuitem action="Filter"/>
</menu>
<menu action="BookMenu">
<placeholder name="AddEditBook">
<menuitem action="AddBook"/>

View File

@ -93,7 +93,6 @@ class BaseModel(gtk.GenericTreeModel):
def set_sort_column(self,col):
self.sort_func = self.smap[col]
#print self.sort_func
def sort_keys(self):
cursor = self.gen_cursor()
@ -101,7 +100,8 @@ class BaseModel(gtk.GenericTreeModel):
data = cursor.next()
while data:
sarray.append((locale.strxfrm(self.sort_func(data[1])),data[0]))
key = locale.strxfrm(self.sort_func(data[1]))
sarray.append((key,data[0]))
data = cursor.next()
cursor.close()
@ -277,7 +277,7 @@ class SourceModel(BaseModel):
GrampsLocale.codeset)
def sort_change(self,data):
return time.localtime(data[8])
return "%012x" % data[8]
def column_tooltip(self,data):
if const.use_tips:
@ -387,7 +387,7 @@ class PlaceModel(BaseModel):
return u''
def sort_change(self,data):
return time.localtime(data[11])
return "%012x" % data[11]
def column_change(self,data):
return unicode(time.strftime('%x %X',time.localtime(data[11])),
@ -396,8 +396,9 @@ class PlaceModel(BaseModel):
def column_tooltip(self,data):
if const.use_tips:
try:
t = ToolTips.TipFromFunction(self.db, lambda:
self.db.get_place_from_handle(data[0]))
t = ToolTips.TipFromFunction(
self.db, lambda:
self.db.get_place_from_handle(data[0]))
except:
log.error("Failed to create tooltip.", exc_info=True)
return t
@ -476,7 +477,7 @@ class FamilyModel(BaseModel):
return unicode(data[1])
def sort_change(self,data):
return time.localtime(data[13])
return "%012x" % data[13]
def column_change(self,data):
return unicode(time.strftime('%x %X',time.localtime(data[13])),
@ -553,14 +554,16 @@ class MediaModel(BaseModel):
def column_date(self,data):
if data[9]:
return unicode(DateHandler.displayer.display(data[9]))
date = RelLib.Date()
date.unserialize(data[9])
return unicode(DateHandler.displayer.display(date))
return u''
def column_handle(self,data):
return unicode(data[0])
def sort_change(self,data):
return time.localtime(data[8])
return "%012x" % data[8]
def column_change(self,data):
return unicode(time.strftime('%x %X',time.localtime(data[8])),
@ -645,8 +648,7 @@ class EventModel(BaseModel):
return unicode(data[0])
def sort_change(self,data):
#print time.localtime(data[10])
return time.localtime(data[10])
return "%012x" % data[10]
def column_change(self,data):
return unicode(time.strftime('%x %X',time.localtime(data[10])),
@ -724,14 +726,21 @@ class RepositoryModel(BaseModel):
def column_city(self,data):
try:
return data[4].get_city()
if data[4]:
addr = RelLib.Address()
addr.unserialize(data[4][0])
return addr.get_city()
else:
return u''
except:
return u''
def column_street(self,data):
try:
if data[5]:
return data[5][0].get_street()
addr = RelLib.Address()
addr.unserialize(data[5][0])
return addr.get_street()
else:
return u''
except:
@ -740,7 +749,9 @@ class RepositoryModel(BaseModel):
def column_county(self,data):
try:
if data[5]:
return data[5][0].get_county()
addr = RelLib.Address()
addr.unserialize(data[5][0])
return addr.get_county()
else:
return u''
except:
@ -749,7 +760,9 @@ class RepositoryModel(BaseModel):
def column_state(self,data):
try:
if data[5]:
return data[5][0].get_state()
addr = RelLib.Address()
addr.unserialize(data[5][0])
return addr.get_state()
else:
return u''
except:
@ -758,7 +771,9 @@ class RepositoryModel(BaseModel):
def column_country(self,data):
try:
if data[5]:
return data[5][0].get_country()
addr = RelLib.Address()
addr.unserialize(data[5][0])
return addr.get_country()
else:
return u''
except:
@ -767,7 +782,9 @@ class RepositoryModel(BaseModel):
def column_postal_code(self,data):
try:
if data[5]:
return data[5][0].get_postal_code()
addr = RelLib.Address()
addr.unserialize(data[5][0])
return addr.get_postal_code()
else:
return u''
except:
@ -776,24 +793,40 @@ class RepositoryModel(BaseModel):
def column_phone(self,data):
try:
if data[5]:
return data[5][0].get_phone()
addr = RelLib.Address()
addr.unserialize(data[5][0])
return addr.get_phone()
else:
return u''
except:
return u''
def column_email(self,data):
return unicode(data[5])
if data[6]:
for i in data[6]:
url = RelLib.Url()
url.unserialize(i)
if url.get_type() == RelLib.UrlType.EMAIL:
return unicode(url.path)
return u''
def column_search_url(self,data):
return unicode(data[6])
if data[6]:
for i in data[6]:
url = RelLib.Url()
url.unserialize(i)
if url.get_type() == RelLib.UrlType.WEB_SEARCH:
return unicode(url.path)
return u''
def column_home_url(self,data):
if data[6]:
urllist = data[6]
return unicode(urllist[0].path)
else:
return u""
for i in data[6]:
url = RelLib.Url()
url.unserialize(i)
if url.get_type() == RelLib.UrlType.WEB_HOME:
return unicode(url.path)
return u""
def column_tooltip(self,data):
return ""

View File

@ -568,6 +568,7 @@ class ListView(BookMarkView):
order = gtk.SORT_ASCENDING
else:
order = gtk.SORT_DESCENDING
self.sort_col = data
handle = self.first_selected()
@ -578,6 +579,7 @@ class ListView(BookMarkView):
self.model = self.make_model(self.dbstate.db, self.sort_col, order,
search=search)
self.list.set_model(self.model)
colmap = self.column_order()
@ -586,9 +588,8 @@ class ListView(BookMarkView):
self.selection.select_path(path)
self.list.scroll_to_cell(path,None,1,0.5,0)
for i in xrange(len(self.columns)):
self.columns[i].set_sort_indicator(i==colmap[data][1])
self.columns[i].set_sort_indicator(i==self.sort_col)
self.columns[self.sort_col].set_sort_order(order)
# print self.sort_col, order, colmap
def build_columns(self):
for column in self.columns: