diff --git a/README b/README index 5a0770707..4e5155498 100644 --- a/README +++ b/README @@ -1,4 +1,4 @@ -Please read the COPYING file first. +cPlease read the COPYING file first. If building from source, also read the INSTALL file (at least through the "SUPER-SHORT VERSION") before going further. @@ -7,7 +7,6 @@ Requirements The following packages *MUST* be installed in order for Gramps to work: Python 2.5 or greater PyGTK2 2.12 or greater - Python Glade bindings librsvg2 (svg icon view) xdg-utils @@ -27,13 +26,16 @@ The following packages are *STRONGLY RECOMMENDED* to be installed: If WEBKIT ang GECKO are installed, webkit will be used. The following packages are optional - python gtkspell Enable spell checking in the notes - pyenchant Enable query of installed spell check dictionaries + python gtkspell & python enchant : Enable spell checking in the notes, + the first contains the libraries, the second is + needed to query the installed languages. Both must + be present for spell check to activate ttf-freefont More font support in the reports -No longer needed in 3.x: +No longer needed in 3.1: yelp Gnome help browser. At the moment no help is shipped - +No longer needed in 3.2: + python glade bindings Documentation --------------------------------- diff --git a/po/POTFILES.in b/po/POTFILES.in index 2a231f2f7..aebab53d5 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -841,7 +841,6 @@ src/glade/tipofday.glade src/glade/displaystate.glade src/glade/addmedia.glade src/glade/questiondialog.glade -src/glade/columnorder.glade src/glade/configure.glade src/glade/dateedit.glade src/glade/editsource.glade diff --git a/src/glade/Makefile.am b/src/glade/Makefile.am index c29933de3..a694c57b8 100644 --- a/src/glade/Makefile.am +++ b/src/glade/Makefile.am @@ -18,7 +18,6 @@ dist_pkgdata_DATA = \ displaystate.glade \ addmedia.glade \ questiondialog.glade \ - columnorder.glade \ configure.glade \ dateedit.glade \ editsource.glade \ diff --git a/src/glade/columnorder.glade b/src/glade/columnorder.glade deleted file mode 100644 index 265d55335..000000000 --- a/src/glade/columnorder.glade +++ /dev/null @@ -1,94 +0,0 @@ - - - - - - True - dialog - False - - - True - - - True - 12 - 3 - 6 - 6 - - - 400 - 300 - True - True - automatic - automatic - in - - - True - True - True - - - - - 3 - - - - - 6 - 1 - - - - - True - end - - - gtk-cancel - True - True - True - False - True - - - False - False - 0 - - - - - gtk-ok - True - True - True - False - True - - - False - False - 1 - - - - - False - end - 0 - - - - - - cancelbutton - okbutton - - - diff --git a/src/gui/columnorder.py b/src/gui/columnorder.py index d62632db0..7a6b712d7 100644 --- a/src/gui/columnorder.py +++ b/src/gui/columnorder.py @@ -55,23 +55,50 @@ from glade import Glade #------------------------------------------------------------------------- __LOG = logging.getLogger(".ColumnOrder") -class ColumnOrder(ManagedWindow.ManagedWindow): +class ColumnOrder(gtk.VBox): """ - Column ordering selection dialog + Column ordering selection widget """ - def __init__(self, win_name, uistate, arglist, column_names, callback): + def __init__(self, config, column_names, on_apply, tree=False): """ - Create the Column Ordering dialog - """ - ManagedWindow.ManagedWindow.__init__(self, uistate, [], self) + Create the Column Ordering widget based on config - self.glade = Glade() - self.set_window(self.glade.toplevel, None, win_name) + config: a configuration file with column data + column_names: translated names for the possible columns + on_apply: function to run when apply is clicked + tree: are the columns for a treeview, if so, the first columns is not + changable + """ + gtk.VBox.__init__(self) - self.tree = self.glade.get_object('list') - self.arglist = arglist - self.callback = callback + self.treeview = tree + self.colnames = column_names + self.config = config + self.on_apply = on_apply + + self.startrow = 0 + if self.treeview: + label = gtk.Label( + _('Tree View: first column "%s" cannot be changed') % + column_names[0]) + self.startrow = 1 + self.pack_start(label, expand=False, fill=False) + + hbox = gtk.HBox() + hbox.set_spacing(10) + scroll = gtk.ScrolledWindow() + scroll.set_size_request(250,300) + hbox.pack_start(scroll) + self.tree = gtk.TreeView() + self.tree.set_reorderable(True) + scroll.add(self.tree) + self.apply_button = gtk.Button(stock='gtk-apply') + btns = gtk.HButtonBox() + btns.set_layout(gtk.BUTTONBOX_END) + btns.pack_start(self.apply_button) + hbox.pack_start(btns, expand=False) + self.pack_start(hbox) self.model = gtk.ListStore(gobject.TYPE_BOOLEAN, gobject.TYPE_STRING, gobject.TYPE_INT, object) @@ -90,45 +117,53 @@ class ColumnOrder(ManagedWindow.ManagedWindow): column_n.set_min_width(225) self.tree.append_column(column_n) - self.glade.get_object('okbutton').connect('clicked', - self.ok_clicked) - self.glade.get_object('cancelbutton').connect('clicked', - self.cancel_clicked) + self.apply_button.connect('clicked', self.__on_apply) - for item in self.arglist: + #obtain the columns from config file + self.oldorder = self.config.get('columns.order') + self.oldsize = self.config.get('columns.sizecol') + self.oldvis = self.config.get('columns.visible') + colord = [] + for val, size in zip(self.oldorder, self.oldsize): + if val in self.oldvis: + colord.append((1, val, size)) + else: + colord.append((0, val, size)) + for item in colord[self.startrow:]: node = self.model.append() self.model.set(node, 0, item[0], 1, column_names[item[1]], 2, item[1], - 3, item) + 3, item[2]) - def build_menu_names(self, obj): - """ - Build the information for the Managed Window menu entries - """ - return (_('Column Editor'), _('Column Editor')) - - def ok_clicked(self, obj): + def __on_apply(self, obj): """ called with the OK button is pressed """ - newlist = [] - for i in range(0, len(self.arglist)): + neworder = [] + newsize = [] + newvis = [] + if self.treeview: + #first row is fixed + neworder.append(self.oldorder[0]) + newvis.append(self.oldvis[0]) + newsize.append(self.oldsize[0]) + for i in range(0, len(self.colnames[self.startrow:])): node = self.model.get_iter((int(i), )) enable = self.model.get_value(node, 0) index = self.model.get_value(node, 2) - value = self.model.get_value(node, 3) - newlist.append((enable, index, value[2])) - - self.callback(newlist) - self.close() - - def cancel_clicked(self, obj): - """ - Called with the Cancel button is pressed. - """ - self.close() + size = self.model.get_value(node, 3) + if enable: + newvis.append(index) + neworder.append(index) + newsize.append(size) + self.config.set('columns.order', neworder) + self.config.set('columns.sizecol', newsize) + self.config.set('columns.visible', newvis) + self.config.save() + if self.on_apply: + self.on_apply() def toggled(cell, path, model): """ diff --git a/src/gui/views/listview.py b/src/gui/views/listview.py index 5d34d2057..cc29729e7 100644 --- a/src/gui/views/listview.py +++ b/src/gui/views/listview.py @@ -461,11 +461,11 @@ class ListView(NavigationView): sel_data.set(sel_data.target, 8 , pickle.dumps(data)) return True - def set_column_order(self, clist): + def set_column_order(self): """ - change the order of the columns to that given in clist + change the order of the columns to that given in config file + after config file changed. We reset the sort to the first column """ - self.column_ord_setfunc(clist) #now we need to rebuild the model so it contains correct column info self.dirty = True #make sure we sort on first column. We have no idea where the @@ -496,20 +496,6 @@ class ListView(NavigationView): colord.append((0, val, size)) return colord - def column_ord_setfunc(self, clist): - """ - Must be set by children. The method that stores the column order - given by clist (result of ColumnOrder class). - """ - raise NotImplementedError - - def _column_editor(self, obj): - """ - Causes the View to display a column editor. This should be overridden - by any class that provides columns (such as a list based view) - """ - raise NotImplemented - def remove_selected_objects(self): """ Function to remove selected objects @@ -1077,7 +1063,8 @@ class ListView(NavigationView): def config_connect(self): """ Overwriten from :class:`~gui.views.pageview.PageView method - This method will be called after the ini file is initialized + This method will be called after the ini file is initialized, + use it to monitor changes in the ini file """ #func = self.config_callback(self.build_tree) #self._config.connect('columns.visible', func) @@ -1092,6 +1079,7 @@ class ListView(NavigationView): :return: list of functions """ def columnpage(): - return _('Columns', ColumnOrder(self._config, COLUMN_NAMES, - tree=False)) + return _('Columns'), ColumnOrder(self._config, self.COLUMN_NAMES, + self.set_column_order, + tree=self.type_list()==LISTTREE) return [columnpage] diff --git a/src/gui/views/pageview.py b/src/gui/views/pageview.py index 3bf251e6d..23c8f3155 100644 --- a/src/gui/views/pageview.py +++ b/src/gui/views/pageview.py @@ -444,9 +444,12 @@ class PageView(DbGUIElement): title = _("Configure %(cat)s - %(view)s") % \ {'cat': self.get_category(), 'view': self.get_title()} try: - ConfigureDialog(self.uistate, self.dbstate, + ViewConfigureDialog(self.uistate, self.dbstate, self.__configure_content, - self, self._config, dialogtitle=title) + self, self._config, dialogtitle=title, + ident=_("%(cat)s - %(view)s") % + {'cat': self.get_category(), + 'view': self.get_title()}) except Errors.WindowActiveError: return @@ -458,3 +461,18 @@ class PageView(DbGUIElement): :return: list of functions """ raise NotImplementedError + +class ViewConfigureDialog(ConfigureDialog): + """ + All PageViews can have their own configuration dialog + """ + def __init__(self, uistate, dbstate, configure_page_funcs, configobj, + configmanager, + dialogtitle=_("Preferences"), on_close=None, ident=''): + self.ident = ident + ConfigureDialog.__init__(self, uistate, dbstate, configure_page_funcs, + configobj, configmanager, + dialogtitle=dialogtitle, on_close=on_close) + + def build_menu_names(self, obj): + return (_('Configure %s View') % self.ident, None)