* 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
This commit is contained in:
parent
79b7134b55
commit
a75928f974
@ -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()
|
||||
|
@ -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"""
|
||||
@ -2739,6 +2737,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]
|
||||
|
||||
|
@ -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:
|
||||
|
Loading…
Reference in New Issue
Block a user