* src/EditPerson,py: allow reordering of event columns

* src/TransTable.py: allow to be initialized with a list instead of a map
* src/gramps.glade: allow reordering of event columns
* src/gramps_main.py: catch program_init exception
* src/ListModel.py: allow reordering of columns


svn: r3230
This commit is contained in:
Don Allingham 2004-06-23 04:54:33 +00:00
parent 162a229161
commit 05440fbaa8
6 changed files with 56 additions and 15 deletions

View File

@ -1,3 +1,10 @@
2004-06-22 Don Allingham <dallingham@users.sourceforge.net>
* src/EditPerson,py: allow reordering of event columns
* src/TransTable.py: allow to be initialized with a list instead of a map
* src/gramps.glade: allow reordering of event columns
* src/gramps_main.py: catch program_init exception
* src/ListModel.py: allow reordering of columns
2004-06-22 Alex Roitman <shura@alex.neuro.umn.edu>
* src/ArgHandler.py (parse_args): Switch from 'tgz' to 'gpkg'
for Gramps package; (handle_args): Use separate dir for all

View File

@ -55,6 +55,7 @@ import ListModel
import RelLib
import Sources
import DateEdit
import TransTable
from QuestionDialog import QuestionDialog, WarningDialog, ErrorDialog, SaveDialog
@ -234,9 +235,24 @@ class EditPerson:
Utils.bold_label(self.gallery_label)
# event display
etitles = [(_('Event'),-1,150),(_('Description'),-1,150),
(_('Date'),-1,100),(_('Place'),-1,100)]
event_default = [ 'Event', 'Description', 'Date', 'Place' ]
self.event_trans = TransTable.TransTable(event_default)
evalues = {
'Event' : (_('Event'),-1,150),
'Description' : (_('Description'),-1,150),
'Date' : (_('Date'),-1,100),
'Place' : (_('Place'),-1,100)
}
values = self.db.metadata.get('event_order')
if not values:
values = event_default
etitles = []
for val in values:
etitles.append(evalues[val])
self.etree = ListModel.ListModel(self.event_list,etitles,
self.on_event_select_row,
self.on_event_update_clicked)
@ -315,13 +331,16 @@ class EditPerson:
self.flowed.set_active(1)
Utils.bold_label(self.notes_label)
self.event_list.drag_dest_set(gtk.DEST_DEFAULT_ALL,pycode_tgts,ACTION_COPY)
self.event_list.drag_dest_set(gtk.DEST_DEFAULT_ALL, pycode_tgts,
ACTION_COPY)
self.event_list.drag_source_set(BUTTON1_MASK, pycode_tgts, ACTION_COPY)
self.event_list.connect('drag_data_get', self.ev_drag_data_get)
self.event_list.connect('drag_begin', self.ev_drag_begin)
self.event_list.connect('drag_data_received',self.ev_drag_data_received)
self.event_list.connect('drag_data_received',
self.ev_drag_data_received)
self.web_list.drag_dest_set(gtk.DEST_DEFAULT_ALL,pycode_tgts,ACTION_COPY)
self.web_list.drag_dest_set(gtk.DEST_DEFAULT_ALL,pycode_tgts,
ACTION_COPY)
self.web_list.drag_source_set(BUTTON1_MASK, pycode_tgts, ACTION_COPY)
self.web_list.connect('drag_data_get', self.url_drag_data_get)
self.web_list.connect('drag_begin', self.url_drag_begin)
@ -417,6 +436,11 @@ class EditPerson:
self.child_windows = {}
def close(self,ok=0):
event_list = []
for col in self.event_list.get_columns():
event_list.append(self.event_trans.find_key(col.get_title()))
self.db.metadata['event_order'] = event_list
self.gallery.close(ok)
self.close_child_windows()
self.remove_itself_from_winsmenu()

View File

@ -48,6 +48,7 @@ class ListModel:
renderer = gtk.CellRendererText()
renderer.set_fixed_height_from_font(1)
column = gtk.TreeViewColumn(name[0],renderer,text=cnum)
column.set_reorderable(gtk.TRUE)
column.set_min_width(name[2])
if name[0] == '':

View File

@ -26,11 +26,17 @@ class TransTable:
def __init__(self,map={}):
self.map = {}
self.rmap = {}
for key in map.keys():
val = unicode(map[key])
self.map[key] = val
self.rmap[val] = unicode(key)
if type(map) == type([]):
for key in map:
val = unicode(_(key))
self.map[key] = val
self.rmap[val] = unicode(key)
else:
for key in map.keys():
val = unicode(map[key])
self.map[key] = val
self.rmap[val] = unicode(key)
def add_pair(self,first,second):
first = unicode(first)

View File

@ -10183,7 +10183,7 @@
<property name="has_focus">True</property>
<property name="headers_visible">True</property>
<property name="rules_hint">False</property>
<property name="reorderable">False</property>
<property name="reorderable">True</property>
<property name="enable_search">True</property>
</widget>
</child>

View File

@ -105,9 +105,12 @@ class Gramps:
def __init__(self,args):
self.program = gnome.program_init('gramps',const.version,
gnome.libgnome_module_info_get(),
args, const.popt_table)
try:
self.program = gnome.program_init('gramps',const.version,
gnome.libgnome_module_info_get(),
args, const.popt_table)
except:
self.program = gnome.program_init('gramps',const.version)
self.program.set_property('app-libdir','%s/lib' % const.prefixdir)
self.program.set_property('app-datadir','%s/share/gramps' % const.prefixdir)
self.program.set_property('app-sysconfdir','%s/etc' % const.prefixdir)