Removed Sorter.py
svn: r1162
This commit is contained in:
		| @@ -47,7 +47,6 @@ import gtk.glade | ||||
| #------------------------------------------------------------------------- | ||||
| import RelLib | ||||
| import const | ||||
| import Sorter | ||||
| import Utils | ||||
| import GrampsCfg | ||||
|  | ||||
|   | ||||
| @@ -1007,21 +1007,6 @@ class GrampsPreferences: | ||||
|         phone = self.top.get_widget("resphone").get_text() | ||||
|         email = self.top.get_widget("resemail").get_text() | ||||
|          | ||||
|         Sorter.set_enable(self.top.get_widget("enableColors").get_active()) | ||||
|         set_bool("/gramps/color/enableColors",Sorter.get_enable()) | ||||
|          | ||||
|         Sorter.oddfg = self.top.get_widget(ODDFGCOLOR).get_i16() | ||||
|         Sorter.oddbg = self.top.get_widget(ODDBGCOLOR).get_i16() | ||||
|         Sorter.evenfg = self.top.get_widget(EVENFGCOLOR).get_i16() | ||||
|         Sorter.evenbg = self.top.get_widget(EVENBGCOLOR).get_i16() | ||||
|         Sorter.ancestorfg = self.top.get_widget(ANCESTORFGCOLOR).get_i16() | ||||
|          | ||||
|         save_config_color(ODDFGCOLOR,Sorter.oddfg) | ||||
|         save_config_color(ODDBGCOLOR,Sorter.oddbg) | ||||
|         save_config_color(EVENFGCOLOR,Sorter.evenfg) | ||||
|         save_config_color(EVENBGCOLOR,Sorter.evenbg) | ||||
|         save_config_color(ANCESTORFGCOLOR,Sorter.ancestorfg) | ||||
|          | ||||
|         set_string("/gramps/researcher/name",name) | ||||
|         set_string("/gramps/researcher/addr",addr) | ||||
|         set_string("/gramps/researcher/city",city) | ||||
|   | ||||
| @@ -81,4 +81,26 @@ class ErrorDialog: | ||||
|         self.top.show_all() | ||||
|         self.top.run() | ||||
|         self.top.destroy() | ||||
|  | ||||
| class OkDialog: | ||||
|     def __init__(self,msg): | ||||
|         title = '%s - GRAMPS' % _('Error') | ||||
|          | ||||
|         self.top = gtk.Dialog() | ||||
|         self.top.set_title(title) | ||||
|         label = gtk.Label(msg) | ||||
|         label.show() | ||||
|         hbox = gtk.HBox() | ||||
|         image = gtk.Image() | ||||
|         image.set_from_stock(gtk.STOCK_DIALOG_INFO,gtk.ICON_SIZE_DIALOG) | ||||
|         hbox.set_spacing(10) | ||||
|         hbox.pack_start(image) | ||||
|         hbox.add(label) | ||||
|         self.top.vbox.pack_start(hbox) | ||||
|         self.top.set_default_size(300,150) | ||||
|         self.top.add_button(gtk.STOCK_OK,0) | ||||
|         self.top.set_response_sensitive(0,gtk.TRUE) | ||||
|         self.top.show_all() | ||||
|         self.top.run() | ||||
|         self.top.destroy() | ||||
|          | ||||
|   | ||||
							
								
								
									
										200
									
								
								src/Sorter.py
									
									
									
									
									
								
							
							
						
						
									
										200
									
								
								src/Sorter.py
									
									
									
									
									
								
							| @@ -1,200 +0,0 @@ | ||||
| # | ||||
| # Gramps - a GTK+/GNOME based genealogy program | ||||
| # | ||||
| # Copyright (C) 2002  Donald N. Allingham | ||||
| # | ||||
| # This program is free software; you can redistribute it and/or modify | ||||
| # it under the terms of the GNU General Public License as published by | ||||
| # the Free Software Foundation; either version 2 of the License, or | ||||
| # (at your option) any later version. | ||||
| # | ||||
| # This program is distributed in the hope that it will be useful, | ||||
| # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
| # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | ||||
| # GNU General Public License for more details. | ||||
| # | ||||
| # You should have received a copy of the GNU General Public License | ||||
| # along with this program; if not, write to the Free Software | ||||
| # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA | ||||
| # | ||||
|  | ||||
| """ | ||||
| Provides a sorting interface to GtkCList widgets. | ||||
| """ | ||||
|  | ||||
| __author__ = "Donald N. Allingham" | ||||
| __version__ = "$Revision$" | ||||
|  | ||||
| #------------------------------------------------------------------------- | ||||
| # | ||||
| # GTK/Gnome modules | ||||
| # | ||||
| #------------------------------------------------------------------------- | ||||
| import gtk | ||||
| import gtk.gdk | ||||
|  | ||||
| #------------------------------------------------------------------------- | ||||
| # | ||||
| # GRAMPS modules | ||||
| # | ||||
| #------------------------------------------------------------------------- | ||||
| import GrampsCfg | ||||
|  | ||||
| class Sorter: | ||||
|  | ||||
|     """Provides a sorting interface to a GtkCList. Instead of | ||||
|     providing a sorting function, the table should be built with ASCII | ||||
|     sorting information loaded into the table. If the sorting data | ||||
|     should not be visible, the column should be hidden. | ||||
|      | ||||
|     Each column should have a column header that contains a | ||||
|     GtkArrow. The Sorter class with alter the GtkArrow based off | ||||
|     whether the column is sorted in ascending or descending order.""" | ||||
|      | ||||
|     def __init__(self, clist, column_map, key): | ||||
|         """ | ||||
|         Creates a sorter instance associated with the GtkCList. | ||||
|  | ||||
|         clist      - GtkCList with which the Sorter is associated | ||||
|         column_map - A list of tuples that assocates a column with its | ||||
|                      sort column and the GtkArrow that should be altered | ||||
|                      with the column. | ||||
|         key        - text key used for storing the sort column and | ||||
|                      direction in the configuration database. | ||||
|         """ | ||||
|         self.clist = clist | ||||
|         self.column_map = column_map | ||||
|         self.key = key | ||||
|         (self.col,self.sort) = GrampsCfg.get_sort_cols(self.key,0,gtk.SORT_ASCENDING) | ||||
|         self.change_sort(self.col,0) | ||||
|         #self.clist.connect('click-column',self.click) | ||||
|  | ||||
|     def sort_col(self): | ||||
|         """Returns the current column that is being sorted (not the acutal sort | ||||
|         column, but the user visable column""" | ||||
|         return self.col | ||||
|  | ||||
|     def sort_direction(self): | ||||
|         """Returns the current sort direction, either GTK.SORT_ASCENDING or | ||||
|         GTK.SORT_DESCENDING""" | ||||
|         return self.sort | ||||
|  | ||||
|     def click(self,obj,column): | ||||
|         """Callback function that is associated with the GtkCList, changing the | ||||
|         sort column""" | ||||
|         self.change_sort(column) | ||||
|  | ||||
|     def sort_list(self): | ||||
|         """ | ||||
|         Sorts the GtkCList. If list colors have been enabled, set the foreground and | ||||
|         background colors of each row.  | ||||
|         """ | ||||
|         self.clist.freeze() | ||||
|         self.clist.sort() | ||||
|         self.clist.sort() | ||||
|         if _enable: | ||||
|             try: | ||||
|                 cmap = self.clist.get_colormap() | ||||
|                 loddbg  = cmap.alloc(to_signed(oddbg[0]),to_signed(oddbg[1]), | ||||
|                                      to_signed(oddbg[2])) | ||||
|                 loddfg  = cmap.alloc(to_signed(oddfg[0]),to_signed(oddfg[1]), | ||||
|                                      to_signed(oddfg[2])) | ||||
|                 levenbg = cmap.alloc(to_signed(evenbg[0]),to_signed(evenbg[1]), | ||||
|                                      to_signed(evenbg[2])) | ||||
|                 levenfg = cmap.alloc(to_signed(evenfg[0]),to_signed(evenfg[1]), | ||||
|                                      to_signed(evenfg[2])) | ||||
|                 rows = self.clist.rows | ||||
|                 for i in range(0,rows,2): | ||||
|                     self.clist.set_background(i,loddbg) | ||||
|                     self.clist.set_foreground(i,loddfg) | ||||
|                     if i != rows: | ||||
|                         self.clist.set_background(i+1,levenbg) | ||||
|                         self.clist.set_foreground(i+1,levenfg) | ||||
|             except OverflowError: | ||||
|                 pass | ||||
|         self.clist.thaw() | ||||
|          | ||||
|     def change_sort(self,column,change=1): | ||||
|         """ | ||||
|         Changes the sort column of the GtkList if the requested column | ||||
|         is in the column map. If the column has changed, the sort direction | ||||
|         is set to ascending, if the column has not changed, the sort direction | ||||
|         is changed to the opposite sort direction | ||||
|  | ||||
|         column - visible column that should be sorted | ||||
|         change - don't alter the direction | ||||
|         """ | ||||
|  | ||||
|         return | ||||
|         try: | ||||
|             (sort_col,arrow) = self.column_map[column] | ||||
|         except: | ||||
|             return | ||||
|  | ||||
|         for (i,a) in self.column_map: | ||||
|             if arrow != a: | ||||
|                 a.hide() | ||||
|         arrow.show() | ||||
|  | ||||
|         if change: | ||||
|             if self.col == column: | ||||
|                 if self.sort == gtk.SORT_DESCENDING: | ||||
|                     self.sort = gtk.SORT_ASCENDING | ||||
|                     arrow.set(gtk.ARROW_DOWN,2) | ||||
|                 else: | ||||
|                     self.sort = gtk.SORT_DESCENDING | ||||
|                     arrow.set(gtk.ARROW_UP,2) | ||||
|             else: | ||||
|                 self.sort = gtk.SORT_ASCENDING | ||||
|                 arrow.set(gtk.ARROW_DOWN,2) | ||||
|  | ||||
|         self.clist.set_sort_column(sort_col) | ||||
|         self.clist.set_sort_type(self.sort) | ||||
|  | ||||
|         self.sort_list() | ||||
|         self.col = column | ||||
|  | ||||
|         if len(self.clist.selection) > 1: | ||||
|             row = self.clist.selection[0] | ||||
|             self.clist.moveto(row) | ||||
|  | ||||
|         GrampsCfg.save_sort_cols(self.key,self.col,self.sort) | ||||
|          | ||||
| class ChildSorter(Sorter): | ||||
|     """ | ||||
|     Derived from the basic Sorter class to allow the GtkList to be | ||||
|     manually reorderable by the user. | ||||
|     """ | ||||
|      | ||||
|     def change_sort(self,column,change=1): | ||||
|         """ | ||||
|         If the column is the 0, set the list as reorderable. | ||||
|         """ | ||||
|         Sorter.change_sort(self,column,change) | ||||
|         self.clist.set_reorderable(self.col == 0) | ||||
|  | ||||
|  | ||||
| #------------------------------------------------------------------------- | ||||
| # | ||||
| # Color management | ||||
| # | ||||
| #------------------------------------------------------------------------- | ||||
| _enable   = 0 | ||||
| oddbg    = (0xffff,0xffff,0xffff) | ||||
| evenbg   = (0xffff,0xffff,0xffff) | ||||
| oddfg    = (0,0,0) | ||||
| evenfg   = (0,0,0) | ||||
| ancestorfg = (0,0,0) | ||||
|  | ||||
| def to_signed(a): | ||||
|     if a & 0x8000: | ||||
|         return a - 0x10000 | ||||
|     else: | ||||
|         return a | ||||
|  | ||||
| def set_enable(val): | ||||
|     global _enable | ||||
|     _enable = val | ||||
|  | ||||
| def get_enable(): | ||||
|     return _enable | ||||
							
								
								
									
										325
									
								
								src/Sources.py
									
									
									
									
									
								
							
							
						
						
									
										325
									
								
								src/Sources.py
									
									
									
									
									
								
							| @@ -1,325 +0,0 @@ | ||||
| # | ||||
| # Gramps - a GTK+/GNOME based genealogy program | ||||
| # | ||||
| # Copyright (C) 2000  Donald N. Allingham | ||||
| # | ||||
| # This program is free software; you can redistribute it and/or modify | ||||
| # it under the terms of the GNU General Public License as published by | ||||
| # the Free Software Foundation; either version 2 of the License, or | ||||
| # (at your option) any later version. | ||||
| # | ||||
| # This program is distributed in the hope that it will be useful, | ||||
| # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
| # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | ||||
| # GNU General Public License for more details. | ||||
| # | ||||
| # You should have received a copy of the GNU General Public License | ||||
| # along with this program; if not, write to the Free Software | ||||
| # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA | ||||
| # | ||||
|  | ||||
| #------------------------------------------------------------------------- | ||||
| # | ||||
| # GTK/Gnome modules | ||||
| # | ||||
| #------------------------------------------------------------------------- | ||||
| import gobject | ||||
| import gtk | ||||
| import gtk.glade | ||||
|  | ||||
| #------------------------------------------------------------------------- | ||||
| # | ||||
| # gramps modules | ||||
| # | ||||
| #------------------------------------------------------------------------- | ||||
| import const | ||||
| import Utils | ||||
| import Sorter | ||||
| from RelLib import * | ||||
| from intl import gettext as _ | ||||
|  | ||||
| #------------------------------------------------------------------------- | ||||
| # | ||||
| # SourceSelector | ||||
| # | ||||
| #------------------------------------------------------------------------- | ||||
|  | ||||
| class SourceSelector: | ||||
|     def __init__(self,srclist,parent,update=None): | ||||
|         self.db = parent.db | ||||
|         self.parent = parent | ||||
|         self.orig = srclist | ||||
|         self.list = [] | ||||
|         for s in self.orig: | ||||
|             self.list.append(SourceRef(s)) | ||||
|         self.update=update | ||||
|         self.top = gtk.glade.XML(const.srcselFile,"sourcesel") | ||||
|         self.top.signal_autoconnect({ | ||||
|             "destroy_passed_object" : Utils.destroy_passed_object, | ||||
|             "on_add_src_clicked"    : self.add_src_clicked, | ||||
|             "on_del_src_clicked"    : self.del_src_clicked, | ||||
|             "on_src_ok_clicked"     : self.src_ok_clicked, | ||||
|             }) | ||||
|  | ||||
|         self.sourcesel = self.top.get_widget("sourcesel") | ||||
|         self.slist = self.top.get_widget("slist") | ||||
|         self.selection = self.slist.get_selection() | ||||
|         self.model = gtk.ListStore(gobject.TYPE_STRING, gobject.TYPE_STRING) | ||||
|         self.slist.set_model(self.model) | ||||
|  | ||||
|         colno = 0 | ||||
|         for title in [ (_('ID'),0,100), (_('Title'),1,150)]: | ||||
|             renderer = gtk.CellRendererText () | ||||
|             column = gtk.TreeViewColumn (title[0], renderer, text=colno) | ||||
|             colno = colno + 1 | ||||
|             column.set_clickable (gtk.TRUE) | ||||
|             column.set_resizable(gtk.TRUE) | ||||
|             column.set_sort_column_id(title[1]) | ||||
|             column.set_min_width(title[2]) | ||||
|             self.slist.append_column (column) | ||||
|  | ||||
|         self.redraw() | ||||
|         self.sourcesel.show() | ||||
|  | ||||
|     def redraw(self): | ||||
|         self.model.clear() | ||||
|         for s in self.list: | ||||
|             base = s.getBase() | ||||
|             iter = self.model.append() | ||||
|             self.model.set(iter,0,base.getId(),1,base.getTitle()) | ||||
|  | ||||
|     def src_ok_clicked(self,obj): | ||||
|         del self.orig[:] | ||||
|         for s in self.list: | ||||
|             self.orig.append(s) | ||||
|         if self.update: | ||||
|             self.update(self.orig) | ||||
|         Utils.destroy_passed_object(self.sourcesel) | ||||
|      | ||||
|     def edit_src_clicked(self,obj): | ||||
|         store,iter = self.selection.get_selected() | ||||
|         if iter: | ||||
|             col = store.get_path(iter) | ||||
|             src = self.list[col[0]] | ||||
|             SourceEditor(src,self.db,self.update_clist,self) | ||||
|  | ||||
|     def update_clist(self,inst,ref): | ||||
|         inst.redraw() | ||||
|  | ||||
|     def add_src_clicked(self,obj): | ||||
|         src = SourceRef() | ||||
|         SourceEditor(src,self.db,self.add_ref,self) | ||||
|  | ||||
|     def del_src_clicked(self,obj): | ||||
|         (store,iter) = self.selection.get_selected() | ||||
|         if iter: | ||||
|             path = store.get_path(iter) | ||||
|             del self.list[path[0]] | ||||
|             self.redraw() | ||||
|  | ||||
|     def add_ref(self,inst,ref): | ||||
|         self.parent.lists_changed = 1 | ||||
|         inst.list.append(ref) | ||||
|         inst.redraw() | ||||
|  | ||||
| #------------------------------------------------------------------------- | ||||
| # | ||||
| # SourceTab | ||||
| # | ||||
| #------------------------------------------------------------------------- | ||||
| class SourceTab: | ||||
|     def __init__(self,srclist,parent,top,clist,add_btn,del_btn): | ||||
|         self.db = parent.db | ||||
|         self.parent = parent | ||||
|         self.list = srclist | ||||
|         self.top = top | ||||
|         self.slist = clist | ||||
|         self.selection = clist.get_selection() | ||||
|         self.model = gtk.ListStore(gobject.TYPE_STRING, gobject.TYPE_STRING) | ||||
|  | ||||
|         colno = 0 | ||||
|         for title in [ (_('ID'),0,100), (_('Title'),1,150)]: | ||||
|             renderer = gtk.CellRendererText () | ||||
|             column = gtk.TreeViewColumn (title[0], renderer, text=colno) | ||||
|             colno = colno + 1 | ||||
|             column.set_clickable (gtk.TRUE) | ||||
|             column.set_resizable(gtk.TRUE) | ||||
|             column.set_sort_column_id(title[1]) | ||||
|             column.set_min_width(title[2]) | ||||
|             self.slist.append_column (column) | ||||
|          | ||||
|         self.slist.set_model(self.model) | ||||
|  | ||||
|         add_btn.connect('clicked', self.add_src_clicked) | ||||
|         del_btn.connect('clicked', self.del_src_clicked) | ||||
|         self.slist.connect('button-press-event',self.double_click) | ||||
|         self.redraw() | ||||
|  | ||||
|     def double_click(self,obj,event): | ||||
|         if event.type == gtk.gdk._2BUTTON_PRESS and event.button == 1:  | ||||
|             self.edit_src_clicked(obj) | ||||
|  | ||||
|     def redraw(self): | ||||
|         self.model.clear() | ||||
|         for s in self.list: | ||||
|             base = s.getBase() | ||||
|             iter = self.model.append() | ||||
|             self.model.set(iter,0,base.getId(),1,base.getTitle()) | ||||
|  | ||||
|     def update_clist(self,inst,ref): | ||||
|         inst.redraw() | ||||
|         self.parent.lists_changed = 1 | ||||
|  | ||||
|     def edit_src_clicked(self,obj): | ||||
|         store,iter = self.selection.get_selected() | ||||
|         if iter: | ||||
|             col = store.get_path(iter) | ||||
|             src = self.list[col[0]] | ||||
|             SourceEditor(src,self.db,self.update_clist,self) | ||||
|  | ||||
|     def add_src_clicked(self,obj): | ||||
|         src = SourceRef() | ||||
|         SourceEditor(src,self.db,self.add_ref,self) | ||||
|  | ||||
|     def add_ref(self,inst,ref): | ||||
|         self.parent.lists_changed = 1 | ||||
|         inst.list.append(ref) | ||||
|         inst.redraw() | ||||
|  | ||||
|     def del_src_clicked(self,obj): | ||||
|         (store,iter) = self.selection.get_selected() | ||||
|         if iter: | ||||
|             path = store.get_path(iter) | ||||
|             del self.list[path[0]] | ||||
|             self.redraw() | ||||
|  | ||||
| #------------------------------------------------------------------------- | ||||
| # | ||||
| # SourceEditor | ||||
| # | ||||
| #------------------------------------------------------------------------- | ||||
| class SourceEditor: | ||||
|  | ||||
|     def __init__(self,srcref,database,update=None,parent=None): | ||||
|  | ||||
|         self.db = database | ||||
|         self.parent = parent | ||||
|         self.update = update | ||||
|         self.source_ref = srcref | ||||
|         self.showSource = gtk.glade.XML(const.srcselFile, "sourceDisplay") | ||||
|         self.showSource.signal_autoconnect({ | ||||
|             "on_combo_insert_text"  : Utils.combo_insert_text, | ||||
|             "on_sourceok_clicked"   : self.on_sourceok_clicked, | ||||
|             "on_source_changed"     : self.on_source_changed, | ||||
|             "destroy_passed_object" : Utils.destroy_passed_object | ||||
|             }) | ||||
|         self.sourceDisplay = self.get_widget("sourceDisplay") | ||||
|         self.source_field = self.get_widget("sourceList") | ||||
|         self.title_menu = self.get_widget("source_title") | ||||
|         self.title_menu.set_data("o",self) | ||||
|         self.conf_menu = self.get_widget("conf") | ||||
|         Utils.build_confidence_menu(self.conf_menu) | ||||
|         self.conf_menu.set_history(srcref.getConfidence()) | ||||
|  | ||||
|         self.author_field = self.get_widget("sauthor") | ||||
|         self.pub_field = self.get_widget("spubinfo") | ||||
|  | ||||
|         if self.source_ref: | ||||
|             self.active_source = self.source_ref.getBase() | ||||
|         else: | ||||
|             self.active_source = None | ||||
|         self.draw() | ||||
|         self.sourceDisplay.show() | ||||
|  | ||||
|     def get_widget(self,name): | ||||
|         """returns the widget associated with the specified name""" | ||||
|         return self.showSource.get_widget(name) | ||||
|  | ||||
|     def draw(self): | ||||
|         if self.source_ref: | ||||
|             self.get_widget("spage").set_text(self.source_ref.getPage()) | ||||
|             date = self.source_ref.getDate() | ||||
|             if date: | ||||
|                 self.get_widget("sdate").set_text(date.getDate()) | ||||
|  | ||||
|             text = self.get_widget("stext") | ||||
|             text.get_buffer().set_text(self.source_ref.getText()) | ||||
|  | ||||
|             scom = self.get_widget("scomment") | ||||
|             scom.get_buffer().set_text(self.source_ref.getComments()) | ||||
|             src = self.source_ref.getBase() | ||||
|             self.active_source = src | ||||
|             if src: | ||||
|                 self.author_field.set_text(src.getAuthor()) | ||||
|                 self.pub_field.set_text(src.getPubInfo()) | ||||
|         else: | ||||
|             self.author_field.set_text("") | ||||
|             self.pub_field.set_text("") | ||||
|  | ||||
|         values = self.db.getSourceMap().values() | ||||
|         values.sort(by_title) | ||||
|  | ||||
|         sel_child = None | ||||
|         list = [] | ||||
|         for src in values: | ||||
|             l = gtk.Label("%s [%s]" % (src.getTitle(),src.getId())) | ||||
|             l.show() | ||||
|             l.set_alignment(0,0.5) | ||||
|             c = gtk.ListItem() | ||||
|             c.add(l) | ||||
|             c.set_data("s",src) | ||||
|             c.show() | ||||
|             list.append(c) | ||||
|             if self.active_source == src: | ||||
|                 sel_child = c | ||||
|  | ||||
|         self.title_menu.list.append_items(list) | ||||
|          | ||||
|         if sel_child: | ||||
|             self.title_menu.list.select_child(sel_child) | ||||
|  | ||||
|     def on_sourceok_clicked(self,obj): | ||||
|         if self.active_source != self.source_ref.getBase(): | ||||
|             self.source_ref.setBase(self.active_source) | ||||
|          | ||||
|         page = self.get_widget("spage").get_text() | ||||
|         date = self.get_widget("sdate").get_text() | ||||
|         conf = self.get_widget("conf").get_menu().get_active().get_data('a') | ||||
|  | ||||
|         buffer = self.get_widget("scomment").get_buffer() | ||||
|         comments = buffer.get_text(buffer.get_start_iter(), | ||||
|                                buffer.get_end_iter(),gtk.FALSE) | ||||
|  | ||||
|         buffer = self.get_widget("stext").get_buffer() | ||||
|         text = buffer.get_text(buffer.get_start_iter(), | ||||
|                                buffer.get_end_iter(),gtk.FALSE) | ||||
|  | ||||
|         self.source_ref.setPage(page) | ||||
|         self.source_ref.getDate().set(date) | ||||
|         self.source_ref.setText(text) | ||||
|         self.source_ref.setComments(comments) | ||||
|         self.source_ref.setConfidence(conf) | ||||
|  | ||||
|         if self.update: | ||||
|             self.update(self.parent,self.source_ref) | ||||
|          | ||||
|         Utils.modified() | ||||
|         Utils.destroy_passed_object(obj) | ||||
|  | ||||
|     def on_source_changed(self,obj): | ||||
|         self.active_source = obj.list.get_selection()[0].get_data("s") | ||||
|  | ||||
|         if self.active_source: | ||||
|             self.author_field.set_text(self.active_source.getAuthor()) | ||||
|             self.pub_field.set_text(self.active_source.getPubInfo()) | ||||
|  | ||||
| #------------------------------------------------------------------------- | ||||
| # | ||||
| # | ||||
| # | ||||
| #------------------------------------------------------------------------- | ||||
| def by_title(a,b): | ||||
|     return cmp(a.getTitle(),b.getTitle()) | ||||
|                 | ||||
|  | ||||
|          | ||||
| @@ -158,7 +158,7 @@ class XmlWriter: | ||||
|          | ||||
|         total = person_len + family_len + place_len + source_len | ||||
|  | ||||
|         self.g.write('<?xml version="1.0" encoding="iso-8859-1"?>\n') | ||||
|         self.g.write('<?xml version="1.0"?>\n') | ||||
|         self.g.write('<!DOCTYPE database SYSTEM "gramps.dtd" []>\n') | ||||
|         self.g.write("<database>\n") | ||||
|         self.g.write("  <header>\n") | ||||
|   | ||||
| @@ -28,9 +28,8 @@ import gtk.glade | ||||
|  | ||||
| import const | ||||
| import Utils | ||||
| import intl | ||||
|  | ||||
| _ = intl.gettext | ||||
| from intl import gettext as _ | ||||
| from QuestionDialog import OkDialog | ||||
|  | ||||
| #------------------------------------------------------------------------- | ||||
| # | ||||
| @@ -79,7 +78,7 @@ class ChangeTypes: | ||||
|         else: | ||||
|             msg = _("%d event records were modified") % modified | ||||
|              | ||||
|         gnome.ui.GnomeOkDialog(msg) | ||||
|         OkDialog(msg) | ||||
|         Utils.destroy_passed_object(obj) | ||||
|  | ||||
| #------------------------------------------------------------------------ | ||||
|   | ||||
| @@ -22,14 +22,14 @@ | ||||
|  | ||||
| import RelLib | ||||
| import Utils | ||||
| import intl | ||||
| _ = intl.gettext | ||||
| from intl import gettext as _ | ||||
|  | ||||
| import os | ||||
|  | ||||
| import gnome.ui | ||||
| import gtk | ||||
| import gtk.glade | ||||
| from QuestionDialog import OkDialog | ||||
|  | ||||
| #------------------------------------------------------------------------- | ||||
| # | ||||
| @@ -145,7 +145,7 @@ class CheckIntegrity: | ||||
|         errors = blink + efam + photos + rel | ||||
|          | ||||
|         if errors == 0: | ||||
|             gnome.ui.GnomeOkDialog(_("No errors were found")) | ||||
|             OkDialog(_("No errors were found")) | ||||
|             return | ||||
|  | ||||
|         text = "" | ||||
|   | ||||
| @@ -23,9 +23,8 @@ | ||||
| import RelLib | ||||
| import Utils | ||||
| import soundex | ||||
| import intl | ||||
| import GrampsCfg | ||||
| _ = intl.gettext | ||||
| from intl import gettext as _  | ||||
|  | ||||
| import string | ||||
| import os | ||||
| @@ -35,7 +34,6 @@ from gnome.ui import * | ||||
| import gtk  | ||||
| import gtk.glade | ||||
|  | ||||
|  | ||||
| #------------------------------------------------------------------------- | ||||
| # | ||||
| # | ||||
| @@ -116,8 +114,8 @@ class Merge: | ||||
|      | ||||
|     def progress_update(self,val): | ||||
|         self.progress.set_value(val) | ||||
|         while events_pending(): | ||||
|             mainiteration() | ||||
|         while gtk.events_pending(): | ||||
|             gtk.mainiteration() | ||||
|  | ||||
|     def find_potentials(self,thresh): | ||||
|         top = gtk.glade.XML(self.glade_file,"message") | ||||
|   | ||||
| @@ -25,12 +25,12 @@ import re | ||||
| import intl | ||||
| import Utils | ||||
|  | ||||
| _ = intl.gettext | ||||
| from intl import gettext as _ | ||||
|  | ||||
| import gtk | ||||
| import gtk.glade | ||||
| from gnome.ui import * | ||||
|  | ||||
| import gnome.ui | ||||
| from QuestionDialog import OkDialog | ||||
|  | ||||
| _title_re = re.compile(r"^([A-Za-z][A-Za-z]+\.)\s+(.*)$") | ||||
| _nick_re = re.compile(r"(.+)[(\"](.*)[)\"]") | ||||
| @@ -57,7 +57,7 @@ class PatchNames: | ||||
|         self.db = db | ||||
|         self.title_list = [] | ||||
|         self.nick_list = [] | ||||
|          | ||||
|  | ||||
|         for key in self.db.getPersonKeys(): | ||||
|          | ||||
|             person = self.db.getPerson(key) | ||||
| @@ -72,6 +72,7 @@ class PatchNames: | ||||
|                 self.nick_list.append((key,groups[0],groups[1])) | ||||
|  | ||||
|         msg = "" | ||||
|  | ||||
|         if len(self.nick_list) > 0 or len(self.title_list) > 0: | ||||
|             for (id,name,nick) in self.nick_list: | ||||
|                 p = self.db.getPerson(id) | ||||
| @@ -93,7 +94,7 @@ class PatchNames: | ||||
|                 }) | ||||
|             self.top.get_widget("textwindow").show_string(msg) | ||||
|         else: | ||||
|             GnomeOkDialog(_("No titles or nicknames were found")) | ||||
|             OkDialog(_("No titles or nicknames were found")) | ||||
|             self.cb(0) | ||||
|  | ||||
|     def on_ok_clicked(self,obj): | ||||
|   | ||||
		Reference in New Issue
	
	Block a user