From a89e8d1d18046365c33912d3b90db28f33457f5a Mon Sep 17 00:00:00 2001 From: Benny Malengier Date: Mon, 1 Feb 2010 07:01:45 +0000 Subject: [PATCH] Remove column config from db, move to the plugins Start with reuse of preferences for all configuration Allow all view plugins to set configuration dialog TODO: activate the column reorder in config of listviews svn: r14176 --- po/POTFILES.in | 6 +- src/Makefile.am | 4 +- src/config.py | 25 -- src/gen/db/base.py | 124 ------- src/gen/db/dbconst.py | 18 +- src/gen/db/read.py | 153 -------- src/gen/db/test/db_test.py | 20 - src/glade/Makefile.am | 2 +- .../{grampscfg.glade => configure.glade} | 0 src/gui/Makefile.am | 2 + src/{ColumnOrder.py => gui/columnorder.py} | 0 src/{GrampsCfg.py => gui/configure.py} | 343 +++++++++++------- src/gui/viewmanager.py | 13 +- src/gui/views/listview.py | 62 +++- src/gui/views/pageview.py | 85 +++++ src/gui/views/placebaseview.py | 46 +-- src/gui/views/treemodels/notemodel.py | 8 +- src/plugins/import/ImportGrdb.py | 45 +-- src/plugins/lib/libgrdb.py | 170 +-------- src/plugins/view/eventview.py | 42 +-- src/plugins/view/familyview.py | 38 +- src/plugins/view/mediaview.py | 41 +-- src/plugins/view/noteview.py | 39 +- src/plugins/view/personview.py | 49 +-- src/plugins/view/placetreeview.py | 1 - src/plugins/view/repoview.py | 46 ++- src/plugins/view/sourceview.py | 37 +- 27 files changed, 538 insertions(+), 881 deletions(-) rename src/glade/{grampscfg.glade => configure.glade} (100%) rename src/{ColumnOrder.py => gui/columnorder.py} (100%) rename src/{GrampsCfg.py => gui/configure.py} (90%) diff --git a/po/POTFILES.in b/po/POTFILES.in index 186f727a0..2a231f2f7 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -7,7 +7,6 @@ src/ansel_utf8.py src/Assistant.py src/AutoComp.py src/Bookmarks.py -src/ColumnOrder.py src/const.py src/DateEdit.py src/Date.py @@ -18,7 +17,6 @@ src/ExportAssistant.py src/ExportOptions.py src/glade.py src/GrampsAboutDialog.py -src/GrampsCfg.py src/GrampsDisplay.py src/gramps.py src/ImgManip.py @@ -187,6 +185,8 @@ src/gen/utils/callman.py # gui - GUI code src/gui/__init__.py +src/gui/columnorder.py +src/gui/configure.py src/gui/dbguielement.py src/gui/dbloader.py src/gui/dbman.py @@ -842,7 +842,7 @@ src/glade/displaystate.glade src/glade/addmedia.glade src/glade/questiondialog.glade src/glade/columnorder.glade -src/glade/grampscfg.glade +src/glade/configure.glade src/glade/dateedit.glade src/glade/editsource.glade src/glade/styleeditor.glade diff --git a/src/Makefile.am b/src/Makefile.am index 02fed8dfa..e14534393 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -26,8 +26,7 @@ gdir_PYTHON = \ Assistant.py\ AutoComp.py\ Bookmarks.py\ - ColumnOrder.py\ - config.py\ + config.py\ const.py\ DateEdit.py\ Date.py\ @@ -39,7 +38,6 @@ gdir_PYTHON = \ ExportOptions.py\ glade.py\ GrampsAboutDialog.py\ - GrampsCfg.py\ GrampsDisplay.py\ gramps.py\ ImgManip.py\ diff --git a/src/config.py b/src/config.py index 74c8c29a9..02259d2b4 100644 --- a/src/config.py +++ b/src/config.py @@ -285,31 +285,6 @@ register('preferences.sprefix', 'S%04d') register('preferences.todo-color', '#ff0000') register('preferences.use-last-view', True) -register('person-view.columns', [(1, 0, 250), (1, 1, 50), (1, 2, 75), - (1, 3, 100), (1, 4, 175), (1, 5, 100), - (1, 6, 175), (1, 7, 100), (0, 8, 100)]) -register('child-view.columns', [(1, 0), (1, 1), (1, 2), (1, 3), (1, 4), - (1, 5), (0, 6), (0, 7)]) -register('place-view.columns', [(1, 0, 250), (1, 1, 75), (1, 11, 100), - (0, 3, 100), (1, 4, 100, ), (0, 5, 150), - (1, 6, 150), (0, 7, 150), (0, 8, 150), - (0, 9, 150), (0, 10, 150),(0,2,100)]) -register('source-view.columns', [(1, 0, 200), (1, 1, 75), (1, 2, 150), - (0, 3, 100), (1, 4, 150), (0, 5, 100)]) -register('media-view.columns', [(1, 0, 200, ), (1, 1, 75), (1, 2, 100), - (1, 3, 200), (1, 5, 150), (0, 4, 150)]) -register('repository-view.columns', [(1, 0, 200), (1, 1, 75), (0, 5, 100), - (0, 6, 100), (1, 2, 100), (1, 3, 250), - (1, 4, 100), (0, 7, 100), (0, 8, 100), - (0, 9, 100), (0, 10, 100), (0, 12, 100)]) -register('event-view.columns', [(1, 0, 200), (1, 1, 75), (1, 2, 100), - (0, 6, 230), (1, 3, 150), - (1, 4, 200), (0, 5, 100)]) -register('family-view.columns', [(1, 0, 75), (1, 1, 200), (1, 2, 200), - (1, 3, 100), (0, 4, 100)]) -register('note-view.columns', [(1, 0, 350), (1, 1, 75), (1, 2, 100), - (1, 3, 100)]) - register('researcher.researcher-addr', '') register('researcher.researcher-city', '') register('researcher.researcher-country', '') diff --git a/src/gen/db/base.py b/src/gen/db/base.py index 111c21502..9fcf89c6a 100644 --- a/src/gen/db/base.py +++ b/src/gen/db/base.py @@ -195,13 +195,6 @@ class DbReadBase(object): """ raise NotImplementedError - def get_event_column_order(self): - """ - Return the Event display common information stored in the database's - metadata. - """ - raise NotImplementedError - def get_event_cursor(self): """ Return a reference to a cursor over Family objects @@ -289,13 +282,6 @@ class DbReadBase(object): """ raise NotImplementedError - def get_family_list_column_order(self): - """ - Return the Person display common information stored in the database's - metadata. - """ - raise NotImplementedError - def get_family_relation_types(self): """ Return a list of all relationship types associated with Family @@ -334,13 +320,6 @@ class DbReadBase(object): """ raise NotImplementedError - def get_media_column_order(self): - """ - Return the MediaObject display common information stored in the - database's metadata. - """ - raise NotImplementedError - def get_media_cursor(self): """ Return a reference to a cursor over Media objects @@ -387,13 +366,6 @@ class DbReadBase(object): """ raise NotImplementedError - def get_note_column_order(self): - """ - Return the Note display common information stored in the database's - metadata. - """ - raise NotImplementedError - def get_note_cursor(self): """ Return a reference to a cursor over Note objects @@ -503,13 +475,6 @@ class DbReadBase(object): """ raise NotImplementedError - def get_person_column_order(self): - """ - Return the Person display common information stored in the database's - metadata. - """ - raise NotImplementedError - def get_person_cursor(self): """ Return a reference to a cursor over Person objects @@ -555,13 +520,6 @@ class DbReadBase(object): """ raise NotImplementedError - def get_place_column_order(self): - """ - Return the Place display common information stored in thedatabase's - metadata. - """ - raise NotImplementedError - def get_place_cursor(self): """ Return a reference to a cursor over Place objects @@ -666,13 +624,6 @@ class DbReadBase(object): """ raise NotImplementedError - def get_repository_column_order(self): - """ - Return the Repository display common information stored in the - database's metadata. - """ - raise NotImplementedError - def get_repository_cursor(self): """ Return a reference to a cursor over Repository objects @@ -729,13 +680,6 @@ class DbReadBase(object): """ raise NotImplementedError - def get_source_column_order(self): - """ - Return the Source display common information stored in the database's - metadata. - """ - raise NotImplementedError - def get_source_cursor(self): """ Return a reference to a cursor over Source objects @@ -1072,74 +1016,6 @@ class DbReadBase(object): """ raise NotImplementedError - def get_child_column_order(self): - """ - Return the Person display common information stored in the database's - metadata. - """ - raise NotImplementedError - - def set_child_column_order(self, col_list): - """ - Store the Person display common information in the database's metadata. - """ - raise NotImplementedError - - def set_column_order(self, col_list, name): - """ - Store the display information in the database's metadata. - """ - raise NotImplementedError - - def set_event_column_order(self, col_list): - """ - Store the Event display common information in the database's metadata. - """ - raise NotImplementedError - - def set_family_list_column_order(self, col_list): - """ - Store the Person display common information in the database's metadata. - """ - raise NotImplementedError - - def set_media_column_order(self, col_list): - """ - Store the Media display common information in the database's metadata. - """ - raise NotImplementedError - - def set_note_column_order(self, col_list): - """ - Store the Note display common information in the database's metadata. - """ - raise NotImplementedError - - def set_person_column_order(self, col_list): - """ - Store the Person display common information in the database's metadata. - """ - raise NotImplementedError - - def set_place_column_order(self, col_list): - """ - Store the Place display common information in the database's metadata. - """ - raise NotImplementedError - - def set_repository_column_order(self, col_list): - """ - Store the Repository display common information in the database's - metadata. - """ - raise NotImplementedError - - def set_source_column_order(self, col_list): - """ - Store the Source display common information in the database's metadata. - """ - raise NotImplementedError - def set_mediapath(self, path): """ Set the default media path for database, path should be utf-8. diff --git a/src/gen/db/dbconst.py b/src/gen/db/dbconst.py index f4d89323f..83578248d 100644 --- a/src/gen/db/dbconst.py +++ b/src/gen/db/dbconst.py @@ -43,13 +43,7 @@ __all__ = ( ('PERSON_KEY', 'FAMILY_KEY', 'SOURCE_KEY', 'EVENT_KEY', 'MEDIA_KEY', 'PLACE_KEY', 'REPOSITORY_KEY', 'NOTE_KEY', - 'REFERENCE_KEY', 'PERSON_COL_KEY', 'FAMILY_COL_KEY', - 'CHILD_COL_KEY' - ) + - - ('PERSON_COL_KEY', 'FAMILY_COL_KEY', 'CHILD_COL_KEY', - 'PLACE_COL_KEY', 'SOURCE_COL_KEY', 'MEDIA_COL_KEY', - 'EVENT_COL_KEY', 'REPOSITORY_COL_KEY', 'NOTE_COL_KEY' + 'REFERENCE_KEY' ) + ('TXNADD', 'TXNUPD', 'TXNDEL') @@ -84,14 +78,4 @@ REPOSITORY_KEY = 6 REFERENCE_KEY = 7 NOTE_KEY = 8 -PERSON_COL_KEY = 'person-view.columns' -CHILD_COL_KEY = 'child-view.columns' -PLACE_COL_KEY = 'place-view.columns' -SOURCE_COL_KEY = 'source-view.columns' -MEDIA_COL_KEY = 'media-view.columns' -REPOSITORY_COL_KEY = 'repository-view.columns' -EVENT_COL_KEY = 'event-view.columns' -FAMILY_COL_KEY = 'family-view.columns' -NOTE_COL_KEY = 'note-view.columns' - TXNADD, TXNUPD, TXNDEL = 0, 1, 2 diff --git a/src/gen/db/read.py b/src/gen/db/read.py index ffef1eaf5..9350083dc 100644 --- a/src/gen/db/read.py +++ b/src/gen/db/read.py @@ -52,7 +52,6 @@ from gen.utils.callback import Callback from gen.db import (GrampsCursor, DbReadBase) from Utils import create_id import Errors -import config LOG = logging.getLogger(DBLOGNAME) #------------------------------------------------------------------------- @@ -157,16 +156,8 @@ class DbBsddbRead(DbReadBase, Callback): returns a list of all Event types assocated with instances of in the database. - - .. method:: get__column_order() - - returns the object's display common information. - """ - # This holds a reference to the gramps Config module if - # it is available, it is setup by the factory methods. - __config__ = None __signals__ = {} # If this is True logging will be turned on. try: @@ -1369,150 +1360,6 @@ class DbBsddbRead(DbReadBase, Callback): return self.metadata.get('mediapath', None) return None - def set_column_order(self, col_list, name): - if (self.metadata is not None) and (not self.readonly): - self.metadata[name] = col_list - - def set_person_column_order(self, col_list): - """ - Store the Person display common information in the database's metadata. - """ - self.set_column_order(col_list, PERSON_COL_KEY) - - def set_family_list_column_order(self, col_list): - """ - Store the Person display common information in the database's metadata. - """ - self.set_column_order(col_list, FAMILY_COL_KEY) - - def set_child_column_order(self, col_list): - """ - Store the Person display common information in the database's metadata. - """ - self.set_column_order(col_list, CHILD_COL_KEY) - - def set_place_column_order(self, col_list): - """ - Store the Place display common information in the database's metadata. - """ - self.set_column_order(col_list, PLACE_COL_KEY) - - def set_source_column_order(self, col_list): - """ - Store the Source display common information in the database's metadata. - """ - self.set_column_order(col_list, SOURCE_COL_KEY) - - def set_media_column_order(self, col_list): - """ - Store the Media display common information in the database's metadata. - """ - self.set_column_order(col_list, MEDIA_COL_KEY) - - def set_event_column_order(self, col_list): - """ - Store the Event display common information in the database's metadata. - """ - self.set_column_order(col_list, EVENT_COL_KEY) - - def set_repository_column_order(self, col_list): - """ - Store the Repository display common information in the database's - metadata. - """ - self.set_column_order(col_list, REPOSITORY_COL_KEY) - - def set_note_column_order(self, col_list): - """ - Store the Note display common information in the database's metadata. - """ - self.set_column_order(col_list, NOTE_COL_KEY) - - def __get_column_order(self, name): - default = config.get_default(name) - cols = config.get(name) - if len(cols) != len(default): - return cols + default[len(cols):] - else: - return cols - - def get_person_column_order(self): - """ - Return the Person display common information stored in the database's - metadata. - """ - return self.__get_column_order(PERSON_COL_KEY) - - def __get_columns(self, key): - default = config.get_default(key) - values = self.__get_column_order(key) - 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): - """ - Return the Person display common information stored in the database's - metadata. - """ - return self.__get_columns(FAMILY_COL_KEY) - - def get_child_column_order(self): - """ - Return the Person display common information stored in the database's - metadata. - """ - return self.__get_column_order(CHILD_COL_KEY) - - def get_place_column_order(self): - """ - Return the Place display common information stored in thedatabase's - metadata. - """ - return self.__get_columns(PLACE_COL_KEY) - - def get_source_column_order(self): - """ - Return the Source display common information stored in the database's - metadata. - """ - return self.__get_columns(SOURCE_COL_KEY) - - def get_media_column_order(self): - """ - Return the MediaObject display common information stored in the - database's metadata. - """ - return self.__get_columns(MEDIA_COL_KEY) - - def get_event_column_order(self): - """ - Return the Event display common information stored in the database's - metadata. - """ - return self.__get_columns(EVENT_COL_KEY) - - def get_repository_column_order(self): - """ - Return the Repository display common information stored in the - database's metadata. - """ - return self.__get_columns(REPOSITORY_COL_KEY) - - def get_note_column_order(self): - """ - Return the Note display common information stored in the database's - metadata. - """ - return self.__get_columns(NOTE_COL_KEY) - def find_backlink_handles(self, handle, include_classes=None): """ Find all objects that hold a reference to the object handle. diff --git a/src/gen/db/test/db_test.py b/src/gen/db/test/db_test.py index 9231dc488..b77eb3de8 100644 --- a/src/gen/db/test/db_test.py +++ b/src/gen/db/test/db_test.py @@ -20,12 +20,10 @@ class DbTest(object): "find_next_repository_gramps_id", "find_next_source_gramps_id", "get_bookmarks", - "get_child_column_order", "get_child_reference_types", "get_default_handle", "get_default_person", "get_event_bookmarks", - "get_event_column_order", "get_event_cursor", "get_event_from_gramps_id", "get_event_from_handle", @@ -38,14 +36,12 @@ class DbTest(object): "get_family_from_gramps_id", "get_family_from_handle", "get_family_handles", - "get_family_list_column_order", "get_family_relation_types", "get_from_handle", "get_gramps_ids", "get_marker_types", "get_media_attribute_types", "get_media_bookmarks", - "get_media_column_order", "get_media_cursor", "get_media_object_handles", "get_mediapath", @@ -53,7 +49,6 @@ class DbTest(object): "get_name_group_mapping", "get_name_types", "get_note_bookmarks", - "get_note_column_order", "get_note_cursor", "get_note_from_gramps_id", "get_note_from_handle", @@ -70,14 +65,12 @@ class DbTest(object): "get_object_from_gramps_id", "get_object_from_handle", "get_person_attribute_types", - "get_person_column_order", "get_person_cursor", "get_person_event_types", "get_person_from_gramps_id", "get_person_from_handle", "get_person_handles", "get_place_bookmarks", - "get_place_column_order", "get_place_cursor", "get_place_from_gramps_id", "get_place_from_handle", @@ -94,7 +87,6 @@ class DbTest(object): "get_reference_map_primary_cursor", "get_reference_map_referenced_cursor", "get_repo_bookmarks", - "get_repository_column_order", "get_repository_cursor", "get_repository_from_gramps_id", "get_repository_from_handle", @@ -103,7 +95,6 @@ class DbTest(object): "get_researcher", "get_save_path", "get_source_bookmarks", - "get_source_column_order", "get_source_cursor", "get_source_from_gramps_id", "get_source_from_handle", @@ -152,17 +143,6 @@ class DbTest(object): "set_prefixes", "set_repository_id_prefix", "set_source_id_prefix", - # Column order: - "set_child_column_order", - "set_column_order", - "set_event_column_order", - "set_family_list_column_order", - "set_media_column_order", - "set_note_column_order", - "set_person_column_order", - "set_place_column_order", - "set_repository_column_order", - "set_source_column_order", # Other set methods: "set_mediapath", "set_redo_callback", diff --git a/src/glade/Makefile.am b/src/glade/Makefile.am index 7d44bef31..c29933de3 100644 --- a/src/glade/Makefile.am +++ b/src/glade/Makefile.am @@ -19,7 +19,7 @@ dist_pkgdata_DATA = \ addmedia.glade \ questiondialog.glade \ columnorder.glade \ - grampscfg.glade \ + configure.glade \ dateedit.glade \ editsource.glade \ styleeditor.glade \ diff --git a/src/glade/grampscfg.glade b/src/glade/configure.glade similarity index 100% rename from src/glade/grampscfg.glade rename to src/glade/configure.glade diff --git a/src/gui/Makefile.am b/src/gui/Makefile.am index cc636deb3..764bf1ff1 100644 --- a/src/gui/Makefile.am +++ b/src/gui/Makefile.am @@ -13,6 +13,8 @@ pkgdatadir = $(datadir)/@PACKAGE@/gui pkgdata_PYTHON = \ __init__.py \ + columnorder.py \ + configure.py \ dbguielement.py \ dbloader.py \ dbman.py \ diff --git a/src/ColumnOrder.py b/src/gui/columnorder.py similarity index 100% rename from src/ColumnOrder.py rename to src/gui/columnorder.py diff --git a/src/GrampsCfg.py b/src/gui/configure.py similarity index 90% rename from src/GrampsCfg.py rename to src/gui/configure.py index 8feeb0fa7..cb56b5576 100644 --- a/src/GrampsCfg.py +++ b/src/gui/configure.py @@ -50,8 +50,8 @@ import DateHandler from gen.display.name import displayer as _nd from gen.display.name import NameDisplayError import Utils -from gen.lib import Name import gen.lib +from gen.lib import Name import ManagedWindow from gui.widgets import MarkupLabel, BasicLabel from QuestionDialog import ErrorDialog, QuestionDialog2, OkDialog @@ -121,44 +121,209 @@ will be removed around empty fields. Other text will appear literally.""")) def build_menu_names(self, obj): return (_(" Name Editor"), _("Preferences")) -class GrampsPreferences(ManagedWindow.ManagedWindow): - def __init__(self, uistate, dbstate): +#------------------------------------------------------------------------- +# +# ConfigureDialog +# +#------------------------------------------------------------------------- + +class ConfigureDialog(ManagedWindow.ManagedWindow): + """ + Base class for configuration dialogs. They provide a Notebook, to which + pages are added with configuration options, and a Cancel and Save button. + On save, a config file on which the dialog works, is saved to disk, and + a callback called. + """ + def __init__(self, uistate, dbstate, configure_page_funcs, configobj, + configmanager, + dialogtitle=_("Preferences"), on_close=None): + """ + Set up a configuration dialog + :param uistate: a DisplayState instance + :param dbstate: a DbState instance + :param configure_page_funcs: a list of function that return a tuple + (str, gtk.Widget). The string is used as label for the + configuration page, and the widget as the content of the + configuration page + :param configobj: the unique object that is configured, it must be + identifiable (id(configobj)). If the configure dialog of the + configobj is already open, a Errors.WindowActiveError will be + raised. Grab this exception in the calling method + :param configmanager: a configmanager object. Several convenience + methods are present in ConfigureDialog to set up widgets that + write changes directly via this configmanager. + :param dialogtitle: the title of the configuration dialog + :param on_close: callback that is called on close + """ self.dbstate = dbstate - ManagedWindow.ManagedWindow.__init__(self, uistate, [], GrampsPreferences) + self.__config = configmanager + ManagedWindow.ManagedWindow.__init__(self, uistate, [], configobj) self.set_window( - gtk.Dialog(_('Preferences'), - flags=gtk.DIALOG_NO_SEPARATOR, + gtk.Dialog(dialogtitle, flags=gtk.DIALOG_NO_SEPARATOR, buttons=(gtk.STOCK_CLOSE, gtk.RESPONSE_CLOSE)), - None, _('Preferences'), None) - panel = gtk.Notebook() - self.window.vbox.add(panel) + None, dialogtitle, None) + self.panel = gtk.Notebook() + self.window.vbox.add(self.panel) + self.__on_close = on_close self.window.connect('response', self.done) - panel.append_page(self.add_behavior_panel(), - MarkupLabel(_('General'))) - panel.append_page(self.add_database_panel(), - MarkupLabel(_('Database'))) - panel.append_page(self.add_formats_panel(), - MarkupLabel(_('Display'))) - panel.append_page(self.add_text_panel(), - MarkupLabel(_('Text'))) - panel.append_page(self.add_prefix_panel(), - MarkupLabel(_('ID Formats'))) - panel.append_page(self.add_date_panel(), - MarkupLabel(_('Dates'))) - panel.append_page(self.add_advanced_panel(), - MarkupLabel(_('Warnings'))) - panel.append_page(self.add_researcher_panel(), - MarkupLabel(_('Researcher'))) - panel.append_page(self.add_color_panel(), - MarkupLabel(_('Marker Colors'))) + + self.__setup_pages(configure_page_funcs) + self.window.show_all() self.show() + + def __setup_pages(self, configure_page_funcs): + """ + This method builds the notebookpages in the panel + """ + for func in configure_page_funcs: + labeltitle, widget = func() + self.panel.append_page(widget, MarkupLabel(labeltitle)) def done(self, obj, value): - Utils.update_constants() + if self.__on_close: + self.__on_close() self.close() + def update_int_entry(self, obj, constant): + """ + :param obj: an object with get_text method that should contain an + integer + :param constant: the config setting to which the integer value must be + saved + """ + try: + self.__config.set(constant, int(obj.get_text())) + except: + print "WARNING: ignoring invalid value for '%s'" % constant + + def update_entry(self, obj, constant): + """ + :param obj: an object with get_text method + :param constant: the config setting to which the text value must be + saved + """ + self.__config.set(constant, unicode(obj.get_text())) + + def update_color(self, obj, constant, color_hex_label): + color = obj.get_color() + hexval = "#%02x%02x%02x" % (color.red/256, + color.green/256, + color.blue/256) + color_hex_label.set_text(hexval) + self.__config.set(constant, hexval) + + def update_checkbox(self, obj, constant): + self.__config.set(constant, obj.get_active()) + + def update_radiobox(self, obj, constant): + self.__config.set(constant, obj.get_active()) + + def add_checkbox(self, table, label, index, constant, start=1, stop=9): + checkbox = gtk.CheckButton(label) + checkbox.set_active(self.__config.get(constant)) + checkbox.connect('toggled', self.update_checkbox, constant) + table.attach(checkbox, start, stop, index, index+1, yoptions=0) + + def add_radiobox(self, table, label, index, constant, group, column): + radiobox = gtk.RadioButton(group,label) + if self.__config.get(constant) == True: + radiobox.set_active(True) + radiobox.connect('toggled', self.update_radiobox, constant) + table.attach(radiobox, column, column+1, index, index+1, yoptions=0) + return radiobox + + def add_text(self, table, label, index): + text = gtk.Label() + text.set_line_wrap(True) + text.set_alignment(0.,0.) + text.set_text(label) + table.attach(text, 1, 9, index, index+1, yoptions=0) + + def add_path_box(self, table, label, index, entry, path, callback_label, + callback_sel): + """ Add an entry to give in path and a select button to open a + dialog. + Changing entry calls callback_label + Clicking open button call callback_sel + """ + lwidget = BasicLabel("%s: " %label) + hbox = gtk.HBox() + if path: + entry.set_text(path) + entry.connect('changed', callback_label) + btn = gtk.Button() + btn.connect('clicked', callback_sel) + image = gtk.Image() + image.set_from_stock(gtk.STOCK_OPEN, gtk.ICON_SIZE_BUTTON) + image.show() + btn.add(image) + hbox.pack_start(entry, expand=True, fill=True) + hbox.pack_start(btn, expand=False, fill=False) + table.attach(lwidget, 1, 2, index, index+1, yoptions=0, + xoptions=gtk.FILL) + table.attach(hbox, 2, 3, index, index+1, yoptions=0) + + def add_entry(self, table, label, index, constant, callback=None): + if not callback: + callback = self.update_entry + lwidget = BasicLabel("%s: " % label) + entry = gtk.Entry() + entry.set_text(self.__config.get(constant)) + entry.connect('changed', callback, constant) + table.attach(lwidget, 0, 1, index, index+1, yoptions=0, + xoptions=gtk.FILL) + table.attach(entry, 1, 2, index, index+1, yoptions=0) + + def add_pos_int_entry(self, table, label, index, constant, callback=None): + """ entry field for positive integers + """ + lwidget = BasicLabel("%s: " % label) + entry = gtk.Entry() + entry.set_text(str(self.__config.get(constant))) + if callback: + entry.connect('changed', callback, constant) + table.attach(lwidget, 1, 2, index, index+1, yoptions=0, + xoptions=gtk.FILL) + table.attach(entry, 2, 3, index, index+1, yoptions=0) + + def add_color(self, table, label, index, constant): + lwidget = BasicLabel("%s: " % label) + hexval = self.__config.get(constant) + color = gtk.gdk.color_parse(hexval) + entry = gtk.ColorButton(color=color) + color_hex_label = BasicLabel(hexval) + entry.connect('color-set', self.update_color, constant, color_hex_label) + table.attach(lwidget, 0, 1, index, index+1, yoptions=0, + xoptions=gtk.FILL) + table.attach(entry, 1, 2, index, index+1, yoptions=0, xoptions=0) + table.attach(color_hex_label, 2, 3, index, index+1, yoptions=0) + return entry + +#------------------------------------------------------------------------- +# +# GrampsPreferences +# +#------------------------------------------------------------------------- +class GrampsPreferences(ConfigureDialog): + + def __init__(self, uistate, dbstate): + page_funcs = ( + self.add_behavior_panel, + self.add_database_panel, + self.add_formats_panel, + self.add_text_panel, + self.add_prefix_panel, + self.add_date_panel, + self.add_advanced_panel, + self.add_researcher_panel, + self.add_color_panel + ) + ConfigureDialog.__init__(self, uistate, dbstate, page_funcs, + GrampsPreferences, config, + on_close=Utils.update_constants) + def add_researcher_panel(self): table = gtk.Table(3, 8) table.set_border_width(12) @@ -172,7 +337,7 @@ class GrampsPreferences(ManagedWindow.ManagedWindow): self.add_entry(table, _('ZIP/Postal Code'), 5, 'researcher.researcher-postal') self.add_entry(table, _('Phone'), 6, 'researcher.researcher-phone') self.add_entry(table, _('Email'), 7, 'researcher.researcher-email') - return table + return _('Researcher'), table def add_prefix_panel(self): """ @@ -198,7 +363,7 @@ class GrampsPreferences(ManagedWindow.ManagedWindow): self.update_idformat_entry) self.add_entry(table, _('Note'), 7, 'preferences.nprefix', self.update_idformat_entry) - return table + return _('ID Formats'), table def add_advanced_panel(self): table = gtk.Table(4, 8) @@ -222,7 +387,7 @@ class GrampsPreferences(ManagedWindow.ManagedWindow): table, _('Show plugin status dialog on plugin load error.'), 3, 'behavior.pop-plugin-status') - return table + return _('Warnings'), table def add_color_panel(self): table = gtk.Table(3, 8) @@ -240,7 +405,7 @@ class GrampsPreferences(ManagedWindow.ManagedWindow): button = gtk.Button(stock=gtk.STOCK_REVERT_TO_SAVED) button.connect('clicked', self.reset_colors) table.attach(button, 1, 2, 3, 4, yoptions=0, xoptions=0) - return table + return _('Marker Colors'), table def reset_colors(self, obj): @@ -734,7 +899,7 @@ class GrampsPreferences(ManagedWindow.ManagedWindow): _("Show text in sidebar buttons (requires restart)"), row, 'interface.sidebar-text', stop=3) row += 1 - return table + return _('Display'), table def add_text_panel(self): row = 0 @@ -760,7 +925,7 @@ class GrampsPreferences(ManagedWindow.ManagedWindow): self.add_entry(table, _('Private record'), row, 'preferences.private-record-text') row += 1 - return table + return _('Text'), table def cb_name_dialog(self, obj): the_list = self.fmt_obox.get_model() @@ -810,7 +975,7 @@ class GrampsPreferences(ManagedWindow.ManagedWindow): _('Markup for invalid date format'), 7, 'preferences.invalid-date-format', self.update_entry) - return table + return _('Dates'), table def add_behavior_panel(self): table = gtk.Table(3, 8) @@ -845,7 +1010,7 @@ class GrampsPreferences(ManagedWindow.ManagedWindow): 7, self.path_entry, self.dbstate.db.get_mediapath(), self.set_mediapath, self.select_mediapath) - return table + return _('General'), table def add_database_panel(self): table = gtk.Table(2, 2) @@ -860,88 +1025,7 @@ class GrampsPreferences(ManagedWindow.ManagedWindow): _('Automatically load last database'), 1, 'behavior.autoload') - return table - - def add_checkbox(self, table, label, index, constant, start=1, stop=9): - checkbox = gtk.CheckButton(label) - checkbox.set_active(config.get(constant)) - checkbox.connect('toggled', self.update_checkbox, constant) - table.attach(checkbox, start, stop, index, index+1, yoptions=0) - - def add_radiobox(self, table, label, index, constant, group, column): - radiobox = gtk.RadioButton(group,label) - if config.get(constant) == True: - radiobox.set_active(True) - radiobox.connect('toggled', self.update_radiobox, constant) - table.attach(radiobox, column, column+1, index, index+1, yoptions=0) - return radiobox - - def add_text(self, table, label, index): - text = gtk.Label() - text.set_line_wrap(True) - text.set_alignment(0.,0.) - text.set_text(label) - table.attach(text, 1, 9, index, index+1, yoptions=0) - - def add_path_box(self, table, label, index, entry, path, callback_label, - callback_sel): - """ Add an entry to give in path and a select button to open a - dialog. - Changing entry calls callback_label - Clicking open button call callback_sel - """ - lwidget = BasicLabel("%s: " %label) - hbox = gtk.HBox() - if path: - entry.set_text(path) - entry.connect('changed', callback_label) - btn = gtk.Button() - btn.connect('clicked', callback_sel) - image = gtk.Image() - image.set_from_stock(gtk.STOCK_OPEN, gtk.ICON_SIZE_BUTTON) - image.show() - btn.add(image) - hbox.pack_start(entry, expand=True, fill=True) - hbox.pack_start(btn, expand=False, fill=False) - table.attach(lwidget, 1, 2, index, index+1, yoptions=0, - xoptions=gtk.FILL) - table.attach(hbox, 2, 3, index, index+1, yoptions=0) - - def add_entry(self, table, label, index, constant, callback=None): - if not callback: - callback = self.update_entry - lwidget = BasicLabel("%s: " % label) - entry = gtk.Entry() - entry.set_text(config.get(constant)) - entry.connect('changed', callback, constant) - table.attach(lwidget, 0, 1, index, index+1, yoptions=0, - xoptions=gtk.FILL) - table.attach(entry, 1, 2, index, index+1, yoptions=0) - - def add_pos_int_entry(self, table, label, index, constant, callback=None): - """ entry field for positive integers - """ - lwidget = BasicLabel("%s: " % label) - entry = gtk.Entry() - entry.set_text(str(config.get(constant))) - if callback: - entry.connect('changed', callback, constant) - table.attach(lwidget, 1, 2, index, index+1, yoptions=0, - xoptions=gtk.FILL) - table.attach(entry, 2, 3, index, index+1, yoptions=0) - - def add_color(self, table, label, index, constant): - lwidget = BasicLabel("%s: " % label) - hexval = config.get(constant) - color = gtk.gdk.color_parse(hexval) - entry = gtk.ColorButton(color=color) - color_hex_label = BasicLabel(hexval) - entry.connect('color-set', self.update_color, constant, color_hex_label) - table.attach(lwidget, 0, 1, index, index+1, yoptions=0, - xoptions=gtk.FILL) - table.attach(entry, 1, 2, index, index+1, yoptions=0, xoptions=0) - table.attach(color_hex_label, 2, 3, index, index+1, yoptions=0) - return entry + return _('Database'), table def set_mediapath(self, *obj): if self.path_entry.get_text().strip(): @@ -969,15 +1053,6 @@ class GrampsPreferences(ManagedWindow.ManagedWindow): self.path_entry.set_text(val) f.destroy() - def update_int_entry(self, obj, constant): - try: - config.set(constant, int(obj.get_text())) - except: - print "WARNING: ignoring invalid value for '%s'" % constant - - def update_entry(self, obj, constant): - config.set(constant, unicode(obj.get_text())) - def update_idformat_entry(self, obj, constant): config.set(constant, unicode(obj.get_text())) self.dbstate.db.set_prefixes( @@ -1009,20 +1084,6 @@ class GrampsPreferences(ManagedWindow.ManagedWindow): else: obj.set_text(str(intval)) - def update_color(self, obj, constant, color_hex_label): - color = obj.get_color() - hexval = "#%02x%02x%02x" % (color.red/256, - color.green/256, - color.blue/256) - color_hex_label.set_text(hexval) - config.set(constant, hexval) - - def update_checkbox(self, obj, constant): - config.set(constant, obj.get_active()) - - def update_radiobox(self, obj, constant): - config.set(constant, obj.get_active()) - def build_menu_names(self, obj): return (_('Preferences'), None) diff --git a/src/gui/viewmanager.py b/src/gui/viewmanager.py index 6e26c0642..0bdc3ad12 100644 --- a/src/gui/viewmanager.py +++ b/src/gui/viewmanager.py @@ -67,7 +67,6 @@ import ReportBase import DisplayState import const import config -import GrampsCfg import Errors from QuestionDialog import (ErrorDialog, WarningDialog, QuestionDialog2, InfoDialog) @@ -76,6 +75,7 @@ import UndoHistory from gui.dbloader import DbLoader import GrampsDisplay from gui.widgets.progressdialog import ProgressMonitor, GtkProgressDialog +from gui.configure import GrampsPreferences from gen.db.backup import backup from gen.db.exceptions import DbException from GrampsAboutDialog import GrampsAboutDialog @@ -762,7 +762,7 @@ class ViewManager(CLIManager): Open the preferences dialog. """ try: - GrampsCfg.GrampsPreferences(self.uistate, self.dbstate) + GrampsPreferences(self.uistate, self.dbstate) self._key = self.uistate.connect('nameformat-changed', self.active_page.build_tree) except Errors.WindowActiveError: @@ -885,6 +885,7 @@ class ViewManager(CLIManager): page = page_def(self.dbstate, self.uistate) # Category is (string, trans): page.set_category(pdata.category) + page.set_ident(page.get_category() + '_' + pdata.id) page_title = page.get_title() page_category = page.get_category() page_translated_category = page.get_translated_category() @@ -1103,6 +1104,12 @@ class ViewManager(CLIManager): mergeid = self.uimanager.add_ui_from_string(self.ui_category[ category_page]) self.merge_ids.append(mergeid) + + configaction = self.actiongroup.get_action('ConfigView') + if self.active_page.can_configure(): + configaction.set_sensitive(True) + else: + configaction.set_sensitive(False) def change_category(self, obj, page, num=-1): """ @@ -1330,7 +1337,7 @@ class ViewManager(CLIManager): """ Displays the configuration dialog for the active view """ - pass + self.active_page.configure() def undo(self, obj): """ diff --git a/src/gui/views/listview.py b/src/gui/views/listview.py index 0ed53eb8a..5d34d2057 100644 --- a/src/gui/views/listview.py +++ b/src/gui/views/listview.py @@ -51,6 +51,7 @@ import pango # #---------------------------------------------------------------- from gui.views.navigationview import NavigationView +from gui.columnorder import ColumnOrder import config import TreeTips import Errors @@ -80,7 +81,13 @@ LISTTREE = 1 # #---------------------------------------------------------------- class ListView(NavigationView): - + COLUMN_NAMES = [] + #listview config settings that are always present related to the columns + CONFIGSETTINGS = ( + ('columns.visible', []), + ('columns.order', []), + ('columns.sizecol', []) + ) ADD_MSG = "" EDIT_MSG = "" DEL_MSG = "" @@ -127,6 +134,7 @@ class ListView(NavigationView): contains the interface. This containter will be inserted into a gtk.Notebook page. """ + self.init_config() self.vbox = gtk.VBox() self.vbox.set_border_width(4) self.vbox.set_spacing(4) @@ -469,10 +477,24 @@ class ListView(NavigationView): def column_order(self): """ - Must be set by children. The method that obtains the column order - to be used. Format: see ColumnOrder. + Column order is obtained from the config file of the listview. + A column order is a list of 3-tuples. The order in the list is the + order the columns must appear in. + For a column, the 3-tuple should be (enable, modelcol, sizecol), where + enable: show this column or don't show it + modelcol: column in the datamodel this column is build of + size: size the column should have """ - raise NotImplementedError + order = self._config.get('columns.order') + size = self._config.get('columns.sizecol') + vis = self._config.get('columns.visible') + colord = [] + for val, size in zip(order, size): + if val in vis: + colord.append((1, val, size)) + else: + colord.append((0, val, size)) + return colord def column_ord_setfunc(self, clist): """ @@ -1038,8 +1060,38 @@ class ListView(NavigationView): def close_branch(self, obj): """ Collapse the selected branches. - obj: for use of method in event callback + :param obj: not used, present only to allow the use of the method in + event callback """ selected = self.selection.get_selected_rows() for path in selected[1]: self.list.collapse_row(path) + + def can_configure(self): + """ + See :class:`~gui.views.pageview.PageView + :return: bool + """ + return True + + def config_connect(self): + """ + Overwriten from :class:`~gui.views.pageview.PageView method + This method will be called after the ini file is initialized + """ + #func = self.config_callback(self.build_tree) + #self._config.connect('columns.visible', func) + #self._config.connect('columns.order', func) + pass + + def _get_configure_page_funcs(self): + """ + Return a list of functions that create gtk elements to use in the + notebook pages of the Configure dialog + + :return: list of functions + """ + def columnpage(): + return _('Columns', ColumnOrder(self._config, COLUMN_NAMES, + tree=False)) + return [columnpage] diff --git a/src/gui/views/pageview.py b/src/gui/views/pageview.py index 6d6c916b2..3bf251e6d 100644 --- a/src/gui/views/pageview.py +++ b/src/gui/views/pageview.py @@ -46,8 +46,11 @@ from gen.ggettext import gettext as _ # GRAMPS # #---------------------------------------------------------------- +import Errors from gui.dbguielement import DbGUIElement from gui.widgets.menutoolbuttonaction import MenuToolButtonAction +from gui.configure import ConfigureDialog +from config import config #------------------------------------------------------------------------------ # @@ -84,6 +87,8 @@ class PageView(DbGUIElement): placed behind the same button in the sidebar """ + CONFIGSETTINGS = [] + def __init__(self, title, dbstate, uistate): self.title = title self.dbstate = dbstate @@ -102,6 +107,7 @@ class PageView(DbGUIElement): self._dirty_on_change_inactive = True self.func_list = {} self.category = "Miscellaneous" + self.ident = None self.translated_category = _("Miscellaneous") self.dbstate.connect('no-database', self.disable_action_group) @@ -110,6 +116,9 @@ class PageView(DbGUIElement): self.model = None self.selection = None self.handle_col = 0 + + self._config = None + self.__configure_content = None DbGUIElement.__init__(self, dbstate.db) @@ -232,6 +241,12 @@ class PageView(DbGUIElement): """ return self.translated_category + def set_ident(self, ident): + """ + Set the id of the view. This is an unique ident + """ + self.ident = ident + def get_display(self): """ Builds the graphical display, returning the top level widget. @@ -373,3 +388,73 @@ class PageView(DbGUIElement): that should be called when quiting the main application. """ pass + + def init_config(self): + """ + If you need a view with a config, then call this method in the + build_tree method. It will set up a config file for the + view, and use CONFIGSETTINGS to set the config defaults. + The config is later accessbile via self._config + So you can do + self._config.get("section.variable1") + self._config.set("section.variable1", value) + self._config.save() + + CONFIGSETTINGS should be a list with tuples like + ("section.variable1", value) + """ + if self._config: + return + self._config = config.register_manager(self.ident, + use_config_path=True) + for section, value in self.CONFIGSETTINGS: + self._config.register(section, value) + self._config.init() + self.config_connect() + + def config_connect(self): + """ + Overwrite this method to set connects to the config file to monitor + changes. This method will be called after the ini file is initialized + Eg: + self.config.connect("section.option", self.callback) + """ + pass + + def config_callback(self, callback): + """ + Convenience wrappen to create a callback for a config setting + :param callback: a callback function to call. + """ + return lambda arg1, arg2, arg3, arg4: callback() + + def can_configure(self): + """ + Inheriting classes should set if the view has a configure window or not + :return: bool + """ + return False + + def configure(self): + """ + Open the configure dialog for the view. + """ + if not self.__configure_content: + self.__configure_content = self._get_configure_page_funcs() + title = _("Configure %(cat)s - %(view)s") % \ + {'cat': self.get_category(), 'view': self.get_title()} + try: + ConfigureDialog(self.uistate, self.dbstate, + self.__configure_content, + self, self._config, dialogtitle=title) + except Errors.WindowActiveError: + return + + def _get_configure_page_funcs(self): + """ + Return a list of functions that create gtk elements to use in the + notebook pages of the Configure view + + :return: list of functions + """ + raise NotImplementedError diff --git a/src/gui/views/placebaseview.py b/src/gui/views/placebaseview.py index 36eafc57f..d52588c35 100644 --- a/src/gui/views/placebaseview.py +++ b/src/gui/views/placebaseview.py @@ -70,7 +70,21 @@ from gen.ggettext import gettext as _ # #------------------------------------------------------------------------- class PlaceBaseView(ListView): - + """ base view class for place views, be they flat list or tree + """ + COL_NAME = 0 + COL_ID = 1 + COL_PARISH = 2 + COL_ZIP = 3 + COL_CITY = 4 + COL_COUNTY = 5 + COL_STATE = 6 + COL_COUNTRY = 7 + COL_LAT = 8 + COL_LON = 9 + COL_CHAN = 10 + COL_STREET = 11 + # name of the columns COLUMN_NAMES = [ _('Place Name'), _('ID'), @@ -85,7 +99,16 @@ class PlaceBaseView(ListView): _('Last Changed'), _('Street'), ] - + # default setting with visible columns, order of the col, and their size + CONFIGSETTINGS = ( + ('columns.visible', [COL_NAME, COL_ID, COL_STREET, COL_CITY, COL_STATE + ]), + ('columns.order', [COL_NAME, COL_ID, COL_STREET, COL_ZIP, COL_CITY, + COL_COUNTY, COL_STATE, COL_COUNTRY, COL_LAT, + COL_LON, COL_PARISH, COL_CHAN]), + ('columns.sizecol', [250, 75, 100, 100, 100, 100, 150, 150, 150, + 150, 150, 100]) + ) ADD_MSG = _("Add a new place") EDIT_MSG = _("Edit the selected place") DEL_MSG = _("Delete the selected place") @@ -124,17 +147,12 @@ class PlaceBaseView(ListView): def navigation_type(self): return 'Place' - - def column_ord_setfunc(self, clist): - self.dbstate.db.set_place_column_order(clist) def get_bookmarks(self): return self.dbstate.db.get_place_bookmarks() def define_actions(self): ListView.define_actions(self) - self._add_action('ColumnEdit', gtk.STOCK_PROPERTIES, - _('_Column Editor'), callback=self._column_editor) self._add_action('FastMerge', None, _('_Merge...'), callback=self.fast_merge) self._add_toolmenu_action('MapsList', _('Loading...'), @@ -268,19 +286,6 @@ class PlaceBaseView(ListView): def drag_info(self): return DdTargets.PLACE_LINK - def _column_editor(self, obj): - import ColumnOrder - - ColumnOrder.ColumnOrder( - _('Select Place Columns'), - self.uistate, - self.dbstate.db.get_place_column_order(), - PlaceBaseView.COLUMN_NAMES, - self.set_column_order) - - def column_order(self): - return self.dbstate.db.get_place_column_order() - def get_stock(self): return 'gramps-place' @@ -311,7 +316,6 @@ class PlaceBaseView(ListView): - diff --git a/src/gui/views/treemodels/notemodel.py b/src/gui/views/treemodels/notemodel.py index 7bb7caab7..c91c7963e 100644 --- a/src/gui/views/treemodels/notemodel.py +++ b/src/gui/views/treemodels/notemodel.py @@ -60,6 +60,7 @@ class NoteModel(FlatBaseModel): self.column_id, self.column_type, self.column_marker, + self.column_change, self.column_handle, self.column_marker_color ] @@ -68,10 +69,11 @@ class NoteModel(FlatBaseModel): self.column_id, self.column_type, self.column_marker, + self.column_change, self.column_handle, self.column_marker_color ] - self.marker_color_column = 5 + self.marker_color_column = 6 FlatBaseModel.__init__(self, db, scol, order, search=search, skip=skip, sort_map=sort_map) @@ -124,3 +126,7 @@ class NoteModel(FlatBaseModel): return None except IndexError: return None + + def column_change(self,data): + return unicode(time.strftime('%x %X',time.localtime( + data[Note.POS_CHANGE])), GrampsLocale.codeset) diff --git a/src/plugins/import/ImportGrdb.py b/src/plugins/import/ImportGrdb.py index f627b5ffe..4ceeb6cea 100644 --- a/src/plugins/import/ImportGrdb.py +++ b/src/plugins/import/ImportGrdb.py @@ -338,19 +338,6 @@ class GrampsBSDDB(DbGrdb, UpdateCallback): self.metadata.sync() return None - def _set_column_order(self, col_list, name): - if self.metadata and not self.readonly: - if self.UseTXN: - # Start transaction if needed - the_txn = self.env.txn_begin() - else: - the_txn = None - self.metadata.put(name, col_list, txn=the_txn) - if self.UseTXN: - the_txn.commit() - else: - self.metadata.sync() - def version_supported(self): dbversion = self.metadata.get('version',default=_DBVERSION) return ((dbversion <= _DBVERSION) and (dbversion >= _MINVERSION)) @@ -1588,21 +1575,23 @@ class GrampsBSDDB(DbGrdb, UpdateCallback): # Remove event column metadata, since columns have changed. # This will reset all columns to defaults in event view - for name in (PERSON_COL_KEY, EVENT_COL_KEY): - try: - if self.UseTXN: - # Start transaction if needed - the_txn = self.env.txn_begin() - else: - the_txn = None - self.metadata.delete(name, txn=the_txn) - if self.UseTXN: - the_txn.commit() - else: - self.metadata.sync() - except KeyError: - if self.UseTXN: - the_txn.abort() + ## This action is removed: column data is no longer used, so no + ## need to change it + #for name in (PERSON_COL_KEY, EVENT_COL_KEY): + # try: + # if self.UseTXN: + # # Start transaction if needed + # the_txn = self.env.txn_begin() + # else: + # the_txn = None + # self.metadata.delete(name, txn=the_txn) + # if self.UseTXN: + # the_txn.commit() + # else: + # self.metadata.sync() + # except KeyError: + # if self.UseTXN: + # the_txn.abort() # This upgrade adds attribute lists to Event and EventRef objects length = self.get_number_of_events() + len(self.person_map) \ diff --git a/src/plugins/lib/libgrdb.py b/src/plugins/lib/libgrdb.py index 27019a5d7..c7f70ee74 100644 --- a/src/plugins/lib/libgrdb.py +++ b/src/plugins/lib/libgrdb.py @@ -58,10 +58,7 @@ from gen.utils.callback import Callback #------------------------------------------------------------------------- from gen.db.dbconst import (PERSON_KEY, FAMILY_KEY, SOURCE_KEY, EVENT_KEY, MEDIA_KEY, PLACE_KEY, REPOSITORY_KEY, NOTE_KEY, - REFERENCE_KEY, PERSON_COL_KEY, FAMILY_COL_KEY, - CHILD_COL_KEY, PLACE_COL_KEY, SOURCE_COL_KEY, - MEDIA_COL_KEY, EVENT_COL_KEY, REPOSITORY_COL_KEY, - NOTE_COL_KEY) + REFERENCE_KEY) _UNDO_SIZE = 1000 @@ -2294,171 +2291,6 @@ class DbGrdb(Callback): return self.metadata.get('mediapath', None) return None - def set_column_order(self, col_list, name): - if (self.metadata is not None) and (not self.readonly): - self.metadata[name] = col_list - - def set_person_column_order(self, col_list): - """ - Store the Person display common information in the database's metadata. - """ - self.set_column_order(col_list, PERSON_COL_KEY) - - def set_family_list_column_order(self, col_list): - """ - Store the Person display common information in the database's metadata. - """ - self.set_column_order(col_list, FAMILY_COL_KEY) - - def set_child_column_order(self, col_list): - """ - Store the Person display common information in the database's metadata. - """ - self.set_column_order(col_list, CHILD_COL_KEY) - - def set_place_column_order(self, col_list): - """ - Store the Place display common information in the database's metadata. - """ - self.set_column_order(col_list, PLACE_COL_KEY) - - def set_source_column_order(self, col_list): - """ - Store the Source display common information in the database's metadata. - """ - self.set_column_order(col_list, SOURCE_COL_KEY) - - def set_media_column_order(self, col_list): - """ - Store the Media display common information in the database's metadata. - """ - self.set_column_order(col_list, MEDIA_COL_KEY) - - def set_event_column_order(self, col_list): - """ - Store the Event display common information in the database's metadata. - """ - self.set_column_order(col_list, EVENT_COL_KEY) - - def set_repository_column_order(self, col_list): - """ - Store the Repository display common information in the database's - metadata. - """ - self.set_column_order(col_list, REPOSITORY_COL_KEY) - - def set_note_column_order(self, col_list): - """ - Store the Note display common information in the database's metadata. - """ - self.set_column_order(col_list, NOTE_COL_KEY) - - def __get_column_order(self, name, default): - if self.metadata is None: - return default - else: - cols = self.metadata.get(name, default) - if len(cols) != len(default): - return cols + default[len(cols):] - else: - return cols - - def get_person_column_order(self): - """ - Return the Person display common information stored in the database's - metadata. - """ - default = [(1, 1, 100), (1, 2, 100), (1, 3, 150), (0, 4, 150), - (1, 5, 150), (0, 6, 150), (0, 7, 100), (0, 8, 100), - ] - 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): - """ - Return the Person display common information stored in the database's - metadata. - """ - default = [(1, 0, 75), (1, 1, 200), (1, 2, 200), (1, 3, 100), - (0, 4, 100)] - return self.__get_columns(FAMILY_COL_KEY, default) - - def get_child_column_order(self): - """ - Return the Person display common information stored in the database's - metadata. - """ - default = [(1, 0), (1, 1), (1, 2), (1, 3), (1, 4), (1, 5), - (0, 6), (0, 7)] - return self.__get_column_order(CHILD_COL_KEY, default) - - def get_place_column_order(self): - """ - Return the Place display common information stored in thedatabase's - metadata. - """ - default = [(1, 0, 250), (1, 1, 75), (1, 11, 100), (0, 3, 100), - (1, 4, 100, ), (0, 5, 150), (1, 6, 150), (0, 7, 150), - (0, 8, 150), (0, 9, 150), (0, 10, 150),(0,2,100)] - return self.__get_columns(PLACE_COL_KEY, default) - - def get_source_column_order(self): - """ - Return the Source display common information stored in the database's - metadata. - """ - default = [(1, 0, 200), (1, 1, 75), (1, 2, 150), (0, 3, 100), - (1, 4, 150), (0, 5, 100)] - return self.__get_columns(SOURCE_COL_KEY, default) - - def get_media_column_order(self): - """ - Return the MediaObject display common information stored in the - database's metadata. - """ - default = [(1, 0, 200, ), (1, 1, 75), (1, 2, 100), (1, 3, 200), - (1, 5, 150), (0, 4, 150)] - return self.__get_columns(MEDIA_COL_KEY, default) - - def get_event_column_order(self): - """ - Return the Event display common information stored in the database's - metadata. - """ - default = [(1, 0, 200), (1, 1, 75), (1, 2, 100), (1, 3, 150), - (1, 4, 200), (0, 5, 100)] - return self.__get_columns(EVENT_COL_KEY, default) - - def get_repository_column_order(self): - """ - Return the Repository display common information stored in the - database's metadata. - """ - default = [(1, 0, 200), (1, 1, 75), (0, 5, 100), (0, 6, 100), - (1, 2, 100), (1, 3, 250), (1, 4, 100), (0, 7, 100), - (0, 8, 100), (0, 9, 100), (0, 10, 100), (0, 12, 100)] - return self.__get_columns(REPOSITORY_COL_KEY, default) - - def get_note_column_order(self): - """ - Return the Note display common information stored in the database's - metadata. - """ - default = [(1, 0, 350), (1, 1, 75), (1, 2, 100), (1, 3, 100)] - return self.__get_columns(NOTE_COL_KEY, default) - def delete_primary_from_reference_map(self, handle, transaction): """ Called each time an object is removed from the database. diff --git a/src/plugins/view/eventview.py b/src/plugins/view/eventview.py index d6b80edc5..284b68209 100644 --- a/src/plugins/view/eventview.py +++ b/src/plugins/view/eventview.py @@ -66,6 +66,15 @@ class EventView(ListView): """ EventView class, derived from the ListView """ + # columns in the model used in view + COL_DESCR = 0 + COL_ID = 1 + COL_TYPE = 2 + COL_DATE = 3 + COL_PLACE = 4 + COL_CHAN = 5 + COL_PARTIC = 6 + # name of the columns COLUMN_NAMES = [ _('Description'), _('ID'), @@ -75,7 +84,13 @@ class EventView(ListView): _('Last Changed'), _('Main Participants'), ] - + # default setting with visible columns, order of the col, and their size + CONFIGSETTINGS = ( + ('columns.visible', [COL_DESCR, COL_ID, COL_TYPE, COL_DATE, COL_PLACE]), + ('columns.order', [COL_DESCR, COL_ID, COL_TYPE, COL_PARTIC, COL_DATE, + COL_PLACE, COL_CHAN]), + ('columns.sizecol', [200, 75, 100, 230, 150, 200, 100]) + ) ADD_MSG = _("Add a new event") EDIT_MSG = _("Edit the selected event") DEL_MSG = _("Delete the selected event") @@ -113,9 +128,6 @@ class EventView(ListView): def navigation_type(self): return 'Event' - def column_ord_setfunc(self, clist): - self.dbstate.db.set_event_column_order(clist) - def get_bookmarks(self): """ Return the bookmark object @@ -128,12 +140,6 @@ class EventView(ListView): """ return DdTargets.EVENT - def column_order(self): - """ - returns a tuple indicating the column order - """ - return self.dbstate.db.get_event_column_order() - def get_stock(self): """ Use the gramps-event stock icon @@ -170,7 +176,6 @@ class EventView(ListView): - @@ -203,8 +208,6 @@ class EventView(ListView): ListView.define_actions(self) self._add_action('FilterEdit', None, _('Event Filter Editor'), callback=self.filter_editor,) - self._add_action('ColumnEdit', gtk.STOCK_PROPERTIES, - _('_Column Editor'), callback=self._column_editor,) self._add_action('QuickReport', None, _("Quick View"), None, None, None) self._add_action('Dummy', None, @@ -217,19 +220,6 @@ class EventView(ListView): else: return None - def _column_editor(self, obj): - """ - returns a tuple indicating the column order - """ - import ColumnOrder - - ColumnOrder.ColumnOrder( - _('Select Event Columns'), - self.uistate, - self.dbstate.db.get_event_column_order(), - EventView.COLUMN_NAMES, - self.set_column_order) - def add(self, obj): try: EditEvent(self.dbstate, self.uistate, [], gen.lib.Event()) diff --git a/src/plugins/view/familyview.py b/src/plugins/view/familyview.py index fe986999f..d548e80f7 100644 --- a/src/plugins/view/familyview.py +++ b/src/plugins/view/familyview.py @@ -59,7 +59,16 @@ from gen.plug import CATEGORY_QR_FAMILY # #------------------------------------------------------------------------- class FamilyView(ListView): - + """ FamilyView class, derived from the ListView + """ + # columns in the model used in view + COL_ID = 0 + COL_FATHER = 1 + COL_MOTHER = 2 + COL_REL = 3 + COL_MARDATE = 4 + COL_CHAN = 5 + # name of the columns COLUMN_NAMES = [ _('ID'), _('Father'), @@ -68,6 +77,14 @@ class FamilyView(ListView): _('Marriage Date'), _('Last Changed'), ] + #default setting with visible columns, order of the col, and their size + CONFIGSETTINGS = ( + ('columns.visible', [COL_ID, COL_FATHER, COL_MOTHER, COL_REL, + COL_MARDATE]), + ('columns.order', [COL_ID, COL_FATHER, COL_MOTHER, COL_REL, + COL_MARDATE, COL_CHAN]), + ('columns.sizecol', [75, 200, 200, 100, 100, 100]) + ) ADD_MSG = _("Add a new family") EDIT_MSG = _("Edit the selected family") @@ -103,22 +120,6 @@ class FamilyView(ListView): def navigation_type(self): return 'Family' - def column_ord_setfunc(self, clist): - self.dbstate.db.set_family_list_column_order(clist) - - def column_order(self): - return self.dbstate.db.get_family_list_column_order() - - def _column_editor(self, obj): - import ColumnOrder - - ColumnOrder.ColumnOrder( - _('Select Family Columns'), - self.uistate, - self.dbstate.db.get_family_list_column_order(), - FamilyView.COLUMN_NAMES, - self.set_column_order) - def get_stock(self): return 'gramps-family' @@ -143,7 +144,6 @@ class FamilyView(ListView): - @@ -182,8 +182,6 @@ class FamilyView(ListView): """Add the Forward action group to handle the Forward button.""" ListView.define_actions(self) - self._add_action('ColumnEdit', gtk.STOCK_PROPERTIES, - _('_Column Editor...'), callback=self._column_editor) self._add_action('FilterEdit', None, _('Family Filter Editor'), callback=self.filter_editor,) diff --git a/src/plugins/view/mediaview.py b/src/plugins/view/mediaview.py index 426f2c021..c7a845f38 100644 --- a/src/plugins/view/mediaview.py +++ b/src/plugins/view/mediaview.py @@ -75,7 +75,13 @@ class MediaView(ListView): thumbnail image at the top of the view that must be updated when the selection changes or when the selected media object changes. """ - + COL_TITLE = 0 + COL_ID = 1 + COL_TYPE = 2 + COL_PATH = 3 + COL_CHAN = 4 + COL_DATE = 5 + #name of the columns COLUMN_NAMES = [ _('Title'), _('ID'), @@ -84,6 +90,14 @@ class MediaView(ListView): _('Last Changed'), _('Date'), ] + # default setting with visible columns, order of the col, and their size + CONFIGSETTINGS = ( + ('columns.visible', [COL_TITLE, COL_ID, COL_TYPE, COL_PATH, + COL_DATE]), + ('columns.order', [COL_TITLE, COL_ID, COL_TYPE, COL_PATH, + COL_DATE, COL_CHAN]), + ('columns.sizecol', [200, 75, 100, 200, 150, 150]) + ) ADD_MSG = _("Add a new media object") EDIT_MSG = _("Edit the selected media object") @@ -122,9 +136,6 @@ class MediaView(ListView): def navigation_type(self): return 'Media' - def column_ord_setfunc(self, clist): - self.dbstate.db.set_media_column_order(clist) - def _set_dnd(self): """ Set up drag-n-drop. The source and destination are set by calling .target() @@ -219,8 +230,6 @@ class MediaView(ListView): """ ListView.define_actions(self) - self._add_action('ColumnEdit', gtk.STOCK_PROPERTIES, - _('_Column Editor'), callback=self._column_editor) self._add_action('FilterEdit', None, _('Media Filter Editor'), callback=self.filter_editor) self._add_action('OpenMedia', 'gramps-viewmedia', _('View'), @@ -254,25 +263,6 @@ class MediaView(ListView): mfolder, mfile = os.path.split(mpath) open_file_with_default_application(mfolder) - def _column_editor(self, obj): - """ - Start the column editor dialog - """ - import ColumnOrder - - ColumnOrder.ColumnOrder( - _('Select Media Columns'), - self.uistate, - self.dbstate.db.get_media_column_order(), - MediaView.COLUMN_NAMES, - self.set_column_order) - - def column_order(self): - """ - Get the column order from the database - """ - return self.dbstate.db.get_media_column_order() - def get_stock(self): """ Return the icon for this view @@ -354,7 +344,6 @@ class MediaView(ListView): - diff --git a/src/plugins/view/noteview.py b/src/plugins/view/noteview.py index 7b45d98f3..a887adefa 100644 --- a/src/plugins/view/noteview.py +++ b/src/plugins/view/noteview.py @@ -50,7 +50,6 @@ import Utils import Errors import Bookmarks import config -import ColumnOrder from gen.lib import Note from DdTargets import DdTargets from Filters.SideBar import NoteSidebarFilter @@ -63,13 +62,28 @@ from gen.plug import CATEGORY_QR_NOTE # #------------------------------------------------------------------------- class NoteView(ListView): + """ + Noteview, a normal flat listview for the notes + """ + COL_PREVIEW = 0 + COL_ID = 1 + COL_TYPE = 2 + COL_MARKER = 3 + COL_CHAN = 4 COLUMN_NAMES = [ _('Preview'), _('ID'), _('Type'), _('Marker'), + _('Last Changed') ] + # default setting with visible columns, order of the col, and their size + CONFIGSETTINGS = ( + ('columns.visible', [COL_PREVIEW, COL_ID, COL_TYPE, COL_MARKER]), + ('columns.order', [COL_PREVIEW, COL_ID, COL_TYPE, COL_MARKER, + COL_CHAN]), + ('columns.sizecol', [350, 75, 100, 100, 100])) ADD_MSG = _("Add a new note") EDIT_MSG = _("Edit the selected note") @@ -105,9 +119,6 @@ class NoteView(ListView): def navigation_type(self): return 'Note' - def column_ord_setfunc(self, clist): - self.dbstate.db.set_note_column_order(clist) - def get_bookmarks(self): """ Return the bookmark object @@ -120,12 +131,6 @@ class NoteView(ListView): """ return DdTargets.NOTE_LINK - def column_order(self): - """ - returns a tuple indicating the column order - """ - return self.dbstate.db.get_note_column_order() - def get_stock(self): """ Use the gramps-event stock icon @@ -162,7 +167,6 @@ class NoteView(ListView): - @@ -200,8 +204,6 @@ class NoteView(ListView): def define_actions(self): ListView.define_actions(self) - self._add_action('ColumnEdit', gtk.STOCK_PROPERTIES, - _('_Column Editor'), callback=self._column_editor) self._add_action('FilterEdit', None, _('Note Filter Editor'), callback=self.filter_editor,) self._add_action('QuickReport', None, _("Quick View"), None, None, None) @@ -214,17 +216,6 @@ class NoteView(ListView): else: return None - def _column_editor(self, obj): - """ - returns a tuple indicating the column order - """ - ColumnOrder.ColumnOrder( - _('Select Note Columns'), - self.uistate, - self.dbstate.db.get_note_column_order(), - NoteView.COLUMN_NAMES, - self.set_column_order) - def add(self, obj): try: EditNote(self.dbstate, self.uistate, [], Note()) diff --git a/src/plugins/view/personview.py b/src/plugins/view/personview.py index c80d3be9e..6bfd11f49 100644 --- a/src/plugins/view/personview.py +++ b/src/plugins/view/personview.py @@ -73,8 +73,18 @@ from gen.ggettext import sgettext as _ #------------------------------------------------------------------------- class PersonView(ListView): """ - PersonView class, derived from the ListView + PersonView class, derived from the ListView, a treeview """ + COL_NAME = 0 + COL_ID = 1 + COL_GEN = 2 + COL_BDAT = 3 + COL_BPLAC = 4 + COL_DDAT = 5 + COL_DPLAC = 6 + COL_SPOUSE = 7 + COL_CHAN = 8 + #name of the columns COLUMN_NAMES = [ _('Name'), _('ID'), @@ -86,7 +96,13 @@ class PersonView(ListView): _('Spouse'), _('Last Changed'), ] - + # default setting with visible columns, order of the col, and their size + CONFIGSETTINGS = ( + ('columns.visible', [COL_NAME, COL_ID, COL_GEN, COL_BDAT, COL_DDAT]), + ('columns.order', [COL_NAME, COL_ID, COL_GEN, COL_BDAT, COL_BPLAC, + COL_DDAT, COL_DPLAC, COL_SPOUSE, COL_CHAN]), + ('columns.sizecol', [250, 75, 75, 100, 175, 100, 175, 100, 100]) + ) ADD_MSG = _("Add a new person") EDIT_MSG = _("Edit the selected person") DEL_MSG = _("Delete the selected person") @@ -127,9 +143,6 @@ class PersonView(ListView): """ return LISTTREE - def column_ord_setfunc(self, clist): - self.dbstate.db.set_person_column_order(clist) - def navigation_type(self): return 'Person' @@ -151,17 +164,11 @@ class PersonView(ListView): """ return DdTargets.PERSON_LINK_LIST - def column_order(self): - """ - returns a tuple indicating the column order - """ - return self.dbstate.db.get_person_column_order() - def exact_search(self): """ Returns a tuple indicating columns requiring an exact search """ - return (2,) # Gender ('female' contains the string 'male') + return (PersonView.COL_GEN,) # Gender ('female' contains the string 'male') def get_stock(self): """ @@ -207,7 +214,6 @@ class PersonView(ListView): - @@ -252,19 +258,6 @@ class PersonView(ListView): else: return None - def _column_editor(self, obj): - """ - returns a tuple indicating the column order - """ - import ColumnOrder - - ColumnOrder.ColumnOrder( - _('Select Person Columns'), - self.uistate, - self.dbstate.db.get_person_column_order(), - PersonView.COLUMN_NAMES, - self.set_column_order) - def add(self, obj): person = gen.lib.Person() @@ -391,9 +384,7 @@ class PersonView(ListView): ('Add', gtk.STOCK_ADD, _("_Add..."), "Insert", _("Add a new person"), self.add), ('Remove', gtk.STOCK_REMOVE, _("_Remove"), "Delete", - _("Remove the Selected Person"), self.remove), - ('ColumnEdit', gtk.STOCK_PROPERTIES, _('_Column Editor...'), None, - None, self._column_editor), + _("Remove the Selected Person"), self.remove), ('CmpMerge', None, _('Compare and _Merge...'), None, None, self.cmp_merge), ('FastMerge', None, _('_Fast Merge...'), None, None, diff --git a/src/plugins/view/placetreeview.py b/src/plugins/view/placetreeview.py index 0b638c008..c1afaafcb 100644 --- a/src/plugins/view/placetreeview.py +++ b/src/plugins/view/placetreeview.py @@ -107,7 +107,6 @@ class PlaceTreeView(PlaceBaseView): - diff --git a/src/plugins/view/repoview.py b/src/plugins/view/repoview.py index a73dfc193..e0c9cd33b 100644 --- a/src/plugins/view/repoview.py +++ b/src/plugins/view/repoview.py @@ -61,6 +61,21 @@ from gen.ggettext import gettext as _ # #------------------------------------------------------------------------- class RepositoryView(ListView): + """ repository listview class + """ + COL_NAME = 0 + COL_ID = 1 + COL_TYPE = 2 + COL_URL = 3 + COL_STREET = 4 + COL_ZIP = 5 + COL_CITY = 6 + COL_COUNTY = 7 + COL_STATE = 8 + COL_COUNTRY = 9 + COL_EMAIL = 10 + COL_SURL = 11 + COL_CHAN = 12 COLUMN_NAMES = [ _('Name'), @@ -77,7 +92,17 @@ class RepositoryView(ListView): _('Search URL'), _('Last Changed'), ] - + # default setting with visible columns, order of the col, and their size + CONFIGSETTINGS = ( + ('columns.visible', [COL_NAME, COL_ID, COL_TYPE, COL_URL, COL_STREET, + ]), + ('columns.order', [COL_NAME, COL_ID, COL_ZIP, COL_CITY, COL_TYPE, + COL_URL, COL_STREET, COL_COUNTY, COL_STATE, + COL_COUNTRY, COL_EMAIL, COL_SURL, + COL_CHAN]), + ('columns.sizecol', [200, 75, 100, 100, 100, 250, 100, 100, 100, + 100, 100, 100, 100]) + ) ADD_MSG = _("Add a new repository") EDIT_MSG = _("Edit the selected repository") DEL_MSG = _("Delete the selected repository") @@ -113,9 +138,6 @@ class RepositoryView(ListView): def navigation_type(self): return 'Repository' - def column_ord_setfunc(self, clist): - self.dbstate.db.set_repository_column_order(clist) - def get_bookmarks(self): return self.dbstate.db.get_repo_bookmarks() @@ -124,8 +146,6 @@ class RepositoryView(ListView): def define_actions(self): ListView.define_actions(self) - self._add_action('ColumnEdit', gtk.STOCK_PROPERTIES, - _('_Column Editor'), callback=self._column_editor) self._add_action('FilterEdit', None, _('Repository Filter Editor'), callback=self.filter_editor,) self._add_action('QuickReport', None, @@ -133,19 +153,6 @@ class RepositoryView(ListView): self._add_action('Dummy', None, ' ', None, None, self.dummy_report) - def _column_editor(self, obj): - import ColumnOrder - - ColumnOrder.ColumnOrder( - _('Select Repository Columns'), - self.uistate, - self.dbstate.db.get_repository_column_order(), - RepositoryView.COLUMN_NAMES, - self.set_column_order) - - def column_order(self): - return self.dbstate.db.get_repository_column_order() - def get_stock(self): return 'gramps-repository' @@ -176,7 +183,6 @@ class RepositoryView(ListView): - diff --git a/src/plugins/view/sourceview.py b/src/plugins/view/sourceview.py index 3d159b9f1..123d19d0a 100644 --- a/src/plugins/view/sourceview.py +++ b/src/plugins/view/sourceview.py @@ -63,7 +63,15 @@ from gen.ggettext import gettext as _ # #------------------------------------------------------------------------- class SourceView(ListView): - + """ sources listview class + """ + COL_TITLE = 0 + COL_ID = 1 + COL_AUTH = 2 + COL_ABBR = 3 + COL_PINFO = 4 + COL_CHAN = 5 + # name of the columns COLUMN_NAMES = [ _('Title'), _('ID'), @@ -72,7 +80,13 @@ class SourceView(ListView): _('Publication Information'), _('Last Changed'), ] - + # default setting with visible columns, order of the col, and their size + CONFIGSETTINGS = ( + ('columns.visible', [COL_TITLE, COL_ID, COL_AUTH, COL_PINFO]), + ('columns.order', [COL_TITLE, COL_ID, COL_AUTH, COL_ABBR, COL_PINFO, + COL_CHAN]), + ('columns.sizecol', [200, 75, 150, 100, 150, 100]) + ) ADD_MSG = _("Add a new source") EDIT_MSG = _("Edit the selected source") DEL_MSG = _("Delete the selected source") @@ -108,9 +122,6 @@ class SourceView(ListView): def navigation_type(self): return 'Source' - def column_ord_setfunc(self, clist): - self.dbstate.db.set_source_column_order(clist) - def get_bookmarks(self): return self.dbstate.db.get_source_bookmarks() @@ -119,8 +130,6 @@ class SourceView(ListView): def define_actions(self): ListView.define_actions(self) - self._add_action('ColumnEdit', gtk.STOCK_PROPERTIES, - _('_Column Editor'), callback=self._column_editor) self._add_action('FastMerge', None, _('_Merge'), callback=self.fast_merge) self._add_action('FilterEdit', None, _('Source Filter Editor'), @@ -128,19 +137,6 @@ class SourceView(ListView): self._add_action('QuickReport', None, _("Quick View"), None, None, None) self._add_action('Dummy', None, ' ', None, None, self.dummy_report) - def _column_editor(self, obj): - import ColumnOrder - - ColumnOrder.ColumnOrder( - _('Select Source Columns'), - self.uistate, - self.dbstate.db.get_source_column_order(), - SourceView.COLUMN_NAMES, - self.set_column_order) - - def column_order(self): - return self.dbstate.db.get_source_column_order() - def get_stock(self): return 'gramps-source' @@ -171,7 +167,6 @@ class SourceView(ListView): -