From 4cbee97a198b14aeac00828d9ca58af8472a61e6 Mon Sep 17 00:00:00 2001 From: Don Allingham Date: Mon, 29 Dec 2003 18:37:44 +0000 Subject: [PATCH] * src/RelLib.py: add sorting by source title, remove dependency on string module * src/PlaceView.py: do an initial sort, don't rely on "click" function * src/SourceView.py: do an initial sort, don't rely on "click" function svn: r2565 --- src/PlaceView.py | 5 +---- src/RelLib.py | 29 ++++++++++++++++++----------- src/SourceView.py | 2 -- 3 files changed, 19 insertions(+), 17 deletions(-) diff --git a/src/PlaceView.py b/src/PlaceView.py index 187b8700f..06632b508 100644 --- a/src/PlaceView.py +++ b/src/PlaceView.py @@ -85,7 +85,6 @@ class PlaceView: column.set_min_width(title[2]) self.list.append_column(column) - self.list.set_search_column(0) self.model = gtk.ListStore(gobject.TYPE_STRING, gobject.TYPE_STRING, gobject.TYPE_STRING, gobject.TYPE_STRING, gobject.TYPE_STRING, gobject.TYPE_STRING, @@ -94,7 +93,6 @@ class PlaceView: gobject.TYPE_STRING, gobject.TYPE_STRING, gobject.TYPE_STRING) self.list.set_model(self.model) - self.list.get_column(0).clicked() self.selection = self.list.get_selection() self.list.connect('button-press-event',self.button_press) self.topWindow = self.glade.get_widget("gramps") @@ -117,7 +115,7 @@ class PlaceView: gobject.TYPE_STRING) self.id2col = {} - for key in self.db.getPlaceKeys(): + for key in self.db.sortPlaceKeys(): val = self.db.getPlaceDisplay(key) iter = self.model.append() @@ -129,7 +127,6 @@ class PlaceView: 12, val[12] ) self.list.set_model(self.model) - self.list.get_column(0).clicked() def goto(self,id): self.selection.unselect_all() diff --git a/src/RelLib.py b/src/RelLib.py index 10efc6559..bd657b331 100644 --- a/src/RelLib.py +++ b/src/RelLib.py @@ -31,7 +31,6 @@ __version__ = "$Revision$" # #------------------------------------------------------------------------- from re import compile -from string import strip, upper import os #------------------------------------------------------------------------- @@ -446,21 +445,21 @@ class Researcher: def set(self,name,addr,city,state,country,postal,phone,email): """sets the information about the database owner""" if name: - self.name = strip(name) + self.name = name.strip() if addr: - self.addr = strip(addr) + self.addr = addr.strip() if city: - self.city = strip(city) + self.city = city.strip() if state: - self.state = strip(state) + self.state = state.strip() if country: - self.country = strip(country) + self.country = country.strip() if postal: - self.postal = strip(postal) + self.postal = postal.strip() if phone: - self.phone = strip(phone) + self.phone = phone.strip() if email: - self.email = strip(email) + self.email = email.strip() class Location: """Provides information about a place, including city, county, state, @@ -1897,8 +1896,7 @@ class Source: self.abbrev = "" def getDisplayInfo(self): - return [self.title,self.id,self.author,upper(self.title), - upper(self.author)] + return [self.title,self.id,self.author,self.title.upper(),self.author.upper()] def setId(self,newId): """sets the gramps' ID for the Source instance""" @@ -2738,6 +2736,15 @@ class GrampsDB: def getSourceKeys(self): return self.sourceTable.keys() + + def sortbysource(self,f,s): + return cmp(self.sourceTable[f][3],self.placTable[s][3]) + + def sortSourceKeys(self): + keys = self.sourceTable.keys() + if type(keys) == type([]): + keys.sort(self.sortbyplace) + return keys def getSourceDisplay(self,key): return self.sourceTable[key] diff --git a/src/SourceView.py b/src/SourceView.py index cf48ab969..1d169887c 100644 --- a/src/SourceView.py +++ b/src/SourceView.py @@ -89,7 +89,6 @@ class SourceView: gobject.TYPE_STRING, gobject.TYPE_STRING, gobject.TYPE_STRING) self.list.set_model(self.model) - self.list.get_column(0).clicked() self.topWindow = self.glade.get_widget("gramps") def change_db(self,db): @@ -117,7 +116,6 @@ class SourceView: 3, val[3], 4, val[4]) self.list.connect('button-press-event',self.button_press) self.list.set_model(self.model) - self.list.get_column(0).clicked() def button_press(self,obj,event): if event.type == gtk.gdk._2BUTTON_PRESS and event.button == 1: