diff --git a/gramps2/ChangeLog b/gramps2/ChangeLog index 28c59caf3..f2ceb769a 100644 --- a/gramps2/ChangeLog +++ b/gramps2/ChangeLog @@ -1,3 +1,10 @@ +2004-06-22 Don Allingham + * 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 * src/ArgHandler.py (parse_args): Switch from 'tgz' to 'gpkg' for Gramps package; (handle_args): Use separate dir for all diff --git a/gramps2/src/EditPerson.py b/gramps2/src/EditPerson.py index b33931d9b..1db56e52f 100644 --- a/gramps2/src/EditPerson.py +++ b/gramps2/src/EditPerson.py @@ -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() diff --git a/gramps2/src/ListModel.py b/gramps2/src/ListModel.py index 332d910f2..03b1d7c33 100644 --- a/gramps2/src/ListModel.py +++ b/gramps2/src/ListModel.py @@ -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] == '': diff --git a/gramps2/src/TransTable.py b/gramps2/src/TransTable.py index 030ea7e8a..2be22ab88 100644 --- a/gramps2/src/TransTable.py +++ b/gramps2/src/TransTable.py @@ -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) diff --git a/gramps2/src/gramps.glade b/gramps2/src/gramps.glade index 55fdd71f7..97bfc8ddc 100644 --- a/gramps2/src/gramps.glade +++ b/gramps2/src/gramps.glade @@ -10183,7 +10183,7 @@ True True False - False + True True diff --git a/gramps2/src/gramps_main.py b/gramps2/src/gramps_main.py index 5214636a6..71ef747eb 100755 --- a/gramps2/src/gramps_main.py +++ b/gramps2/src/gramps_main.py @@ -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)