* src/PageView.py: add ellipsize, better dirty/clean management,

set fixed column width and fixed height
* src/GrampsDb/_GrampsDbBase.py: handle default column sizes


svn: r5807
This commit is contained in:
Don Allingham 2006-01-20 18:18:03 +00:00
parent f704db5004
commit 8ff4bce687
3 changed files with 42 additions and 31 deletions

View File

@ -1,3 +1,8 @@
2006-01-20 Don Allingham <don@gramps-project.org>
* src/PageView.py: add ellipsize, better dirty/clean management,
set fixed column width and fixed height
* src/GrampsDb/_GrampsDbBase.py: handle default column sizes
2006-01-20 Richard Taylor <rjt-gramps@thegrindstone.me.uk> 2006-01-20 Richard Taylor <rjt-gramps@thegrindstone.me.uk>
* src/ObjectSelector/Makefile.am: added automake stuff. * src/ObjectSelector/Makefile.am: added automake stuff.

View File

@ -1612,13 +1612,26 @@ class GrampsDbBase(GrampsDBCallback):
default = [(1,1),(1,2),(1,3),(0,4),(1,5),(0,6),(0,7),(0,8),(0,9,)] default = [(1,1),(1,2),(1,3),(0,4),(1,5),(0,6),(0,7),(0,8),(0,9,)]
return self._get_column_order(PERSON_COL_KEY,default) return self._get_column_order(PERSON_COL_KEY,default)
def _get_columns(self,key,default):
values = self._get_column_order(key,default)
new = []
for val in values:
if len(val) == 2:
for x in default:
if val[1] == x[1]:
new.append((val[0],val[1],x[2]))
break
else:
new.append(val)
return new
def get_family_list_column_order(self): def get_family_list_column_order(self):
""" """
Returns the Person display common information stored in the Returns the Person display common information stored in the
database's metadata. database's metadata.
""" """
default = [(1,0), (1,1),(1,2),(1,3),(0,4)] default = [(1,0,75), (1,1,200),(1,2,200),(1,3,100),(0,4,100)]
return self._get_column_order(FAMILY_COL_KEY,default) return self._get_columns(FAMILY_COL_KEY,default)
def get_child_column_order(self): def get_child_column_order(self):
""" """
@ -1633,40 +1646,40 @@ class GrampsDbBase(GrampsDBCallback):
Returns the Place display common information stored in the Returns the Place display common information stored in the
database's metadata. database's metadata.
""" """
default = [(1,0), (1,1),(1,2),(0,3),(0,4),(1,5),(0,6),(1,7),(0,8),(0,9),(0,10)] default = [(1,0,250), (1,1,75),(1,2,100),(0,3,100),(0,4,100,),(1,5,150),(0,6,150),(1,7,150),(0,8,150),(0,9,150),(0,10,150)]
return self._get_column_order(PLACE_COL_KEY,default) return self._get_columns(PLACE_COL_KEY,default)
def get_source_column_order(self): def get_source_column_order(self):
""" """
Returns the Source display common information stored in the Returns the Source display common information stored in the
database's metadata. database's metadata.
""" """
default = [(1,0),(1,1),(1,2),(0,3),(1,4),(0,5)] default = [(1,0,200),(1,1,75),(1,2,150),(0,3,100),(1,4,150),(0,5,100)]
return self._get_column_order(SOURCE_COL_KEY,default) return self._get_columns(SOURCE_COL_KEY,default)
def get_media_column_order(self): def get_media_column_order(self):
""" """
Returns the MediaObject display common information stored in the Returns the MediaObject display common information stored in the
database's metadata. database's metadata.
""" """
default = [(1,0),(1,1),(1,2),(1,3),(1,5),(0,4)] default = [(1,0,200,),(1,1,75),(1,2,100),(1,3,200),(1,5,150),(0,4,150)]
return self._get_column_order(MEDIA_COL_KEY,default) return self._get_columns(MEDIA_COL_KEY,default)
def get_event_column_order(self): def get_event_column_order(self):
""" """
Returns the Event display common information stored in the Returns the Event display common information stored in the
database's metadata. database's metadata.
""" """
default = [(1,0),(1,1),(1,2),(1,3),(1,4),(1,5),(0,6)] default = [(1,0,200),(1,1,75),(1,2,100),(1,3,150),(1,4,200),(1,5,100),(0,6,100)]
return self._get_column_order(EVENT_COL_KEY,default) return self._get_columns(EVENT_COL_KEY,default)
def get_repository_column_order(self): def get_repository_column_order(self):
""" """
Returns the Repository display common information stored in the Returns the Repository display common information stored in the
database's metadata. database's metadata.
""" """
default = [(1,0),(1,1),(0,5),(0,6),(1,2),(1,3),(0,4),(0,7),(0,8),(0,9),(0,10)] default = [(1,0,200),(1,1,75),(0,5,100),(0,6,100),(1,2,100),(1,3,250),(0,4,100),(0,7,100),(0,8,100),(0,9,100),(0,10,100)]
return self._get_column_order(REPOSITORY_COL_KEY,default) return self._get_columns(REPOSITORY_COL_KEY,default)
def _delete_primary_from_reference_map(self, handle, transaction): def _delete_primary_from_reference_map(self, handle, transaction):
"""Called each time an object is removed from the database. This can """Called each time an object is removed from the database. This can

View File

@ -21,6 +21,7 @@
# $Id$ # $Id$
import gtk import gtk
import pango
import TreeTips import TreeTips
import GenericFilter import GenericFilter
@ -314,6 +315,7 @@ class ListView(PageView):
make_model, signal_map): make_model, signal_map):
PageView.__init__(self, title, dbstate, uistate) PageView.__init__(self, title, dbstate, uistate)
self.renderer = gtk.CellRendererText() self.renderer = gtk.CellRendererText()
self.renderer.set_property('ellipsize',pango.ELLIPSIZE_END)
self.sort_col = 0 self.sort_col = 0
self.columns = [] self.columns = []
self.colinfo = columns self.colinfo = columns
@ -342,6 +344,7 @@ class ListView(PageView):
self.list.set_rules_hint(True) self.list.set_rules_hint(True)
self.list.set_headers_visible(True) self.list.set_headers_visible(True)
self.list.set_headers_clickable(True) self.list.set_headers_clickable(True)
self.list.set_fixed_height_mode(True)
self.list.connect('button-press-event',self.button_press) self.list.connect('button-press-event',self.button_press)
self.list.connect('key-press-event',self.key_press) self.list.connect('key-press-event',self.key_press)
@ -354,6 +357,7 @@ class ListView(PageView):
self.vbox.pack_start(scrollwindow,True) self.vbox.pack_start(scrollwindow,True)
self.renderer = gtk.CellRendererText() self.renderer = gtk.CellRendererText()
self.renderer.set_property('ellipsize',pango.ELLIPSIZE_END)
self.inactive = False self.inactive = False
self.columns = [] self.columns = []
@ -412,7 +416,8 @@ class ListView(PageView):
column = gtk.TreeViewColumn(name, self.renderer, text=pair[1]) column = gtk.TreeViewColumn(name, self.renderer, text=pair[1])
column.connect('clicked',self.column_clicked,index) column.connect('clicked',self.column_clicked,index)
column.set_resizable(True) column.set_resizable(True)
column.set_min_width(75) column.set_sizing(gtk.TREE_VIEW_COLUMN_FIXED)
column.set_fixed_width(pair[2])
column.set_clickable(True) column.set_clickable(True)
self.columns.append(column) self.columns.append(column)
self.list.append_column(column) self.list.append_column(column)
@ -444,28 +449,16 @@ class ListView(PageView):
self.dirty = True self.dirty = True
def row_add(self,handle_list): def row_add(self,handle_list):
if self.active: for handle in handle_list:
for handle in handle_list: self.model.add_row_by_handle(handle)
self.model.add_row_by_handle(handle)
else:
print self,"row add dirty"
self.dirty = True
def row_update(self,handle_list): def row_update(self,handle_list):
if self.active: for handle in handle_list:
for handle in handle_list: self.model.update_row_by_handle(handle)
self.model.update_row_by_handle(handle)
else:
print self,"row update dirty"
self.dirty = True
def row_delete(self,handle_list): def row_delete(self,handle_list):
if self.active: for handle in handle_list:
for handle in handle_list: self.model.delete_row_by_handle(handle)
self.model.delete_row_by_handle(handle)
else:
print self,"row delete dirty"
self.dirty = True
def define_actions(self): def define_actions(self):
""" """