From 00c9985d605a8972f851129138a7119bf52abef2 Mon Sep 17 00:00:00 2001 From: Don Allingham Date: Thu, 26 Jun 2003 02:53:04 +0000 Subject: [PATCH] * src/plugins/ReadGedcom.py: removed unused variable * src/latin_utf8.py: explicity state iso-8859-1 to unicode translation * src/gramps_main.py: handle clearing of tabs better, eliminating spurious tabs being added on a complete rebuild of the tabs. svn: r1782 --- src/gramps_main.py | 22 ++++++++++++++++------ src/latin_utf8.py | 2 +- src/plugins/ReadGedcom.py | 3 --- 3 files changed, 17 insertions(+), 10 deletions(-) diff --git a/src/gramps_main.py b/src/gramps_main.py index 513ac250b..e3af8a4d1 100755 --- a/src/gramps_main.py +++ b/src/gramps_main.py @@ -136,6 +136,7 @@ class Gramps: self.db.set_fprefix(GrampsCfg.fprefix) self.db.set_sprefix(GrampsCfg.sprefix) self.db.set_pprefix(GrampsCfg.pprefix) + self.clearing_tabs = 0 GrampsCfg.loadConfig(self.update_display) self.relationship = Plugins.relationship_function() @@ -440,6 +441,11 @@ class Gramps: self.topWindow.show() def change_alpha_page(self,obj,junk,page): + """Change the page. Be careful not to take action while the pages + are begin removed. If clearing_tabs is set, then we don't do anything""" + + if self.clearing_tabs: + return self.person_tree = self.pl_page[page] self.person_list = self.pl_page[page].tree self.person_model = self.pl_page[page].model @@ -737,11 +743,13 @@ class Gramps: def clear_person_tabs(self): + self.clearing_tabs = 1 self.ptabs.hide() for i in range(0,len(self.tab_list)): self.ptabs.remove_page(0) self.ptabs.set_show_tabs(0) self.ptabs.show() + self.clearing_tabs = 0 self.id2col = {} self.tab_list = [] self.alpha_page = {} @@ -803,9 +811,12 @@ class Gramps: def tool_callback(self,val): if val: - Utils.modified() - self.clear_person_tabs() - self.full_update() + import_tool_callback() + + def import_tool_callback(self,val): + Utils.modified() + self.clear_person_tabs() + self.full_update() def full_update(self): """Brute force display update, updating all the pages""" @@ -1812,11 +1823,9 @@ class Gramps: self.status_text("") def complete_rebuild(self): - self.topWindow.set_resizable(gtk.FALSE) self.apply_filter() self.goto_active_person() self.modify_statusbar() - self.topWindow.set_resizable(gtk.TRUE) def apply_filter(self,current_model=None): self.status_text(_('Updating display...')) @@ -1860,6 +1869,7 @@ class Gramps: self.modify_statusbar() def create_new_panel(self,pg): + display = gtk.ScrolledWindow() display.set_policy(gtk.POLICY_AUTOMATIC,gtk.POLICY_AUTOMATIC) tree = gtk.TreeView() @@ -1952,7 +1962,7 @@ class Gramps: def import_callback(self,obj,plugin_function): """Call the import plugin""" - plugin_function(self.db,self.active_person,self.tool_callback) + plugin_function(self.db,self.active_person,self.import_tool_callback) self.topWindow.set_title("%s - GRAMPS" % self.db.getSavePath()) def on_preferences_activate(self,obj): diff --git a/src/latin_utf8.py b/src/latin_utf8.py index 05c44b6c6..9f52a61f5 100644 --- a/src/latin_utf8.py +++ b/src/latin_utf8.py @@ -22,6 +22,6 @@ def utf8_to_latin(s): return s.encode('iso-8859-1','replace') def latin_to_utf8(s): - return unicode(s) + return unicode(s,'iso-8859-1') diff --git a/src/plugins/ReadGedcom.py b/src/plugins/ReadGedcom.py index 9fd8abb19..cfbd82e8e 100644 --- a/src/plugins/ReadGedcom.py +++ b/src/plugins/ReadGedcom.py @@ -254,7 +254,6 @@ class GedcomParser: if self.window: self.update(self.file_obj,os.path.basename(file)) - self.code = 0 self.search_paths = [] try: @@ -1488,10 +1487,8 @@ class GedcomParser: self.broken_conc = self.gedsource.get_conc() elif matches[1] == "CHAR": if matches[2] == "UNICODE" or matches[2] == "UTF-8" or matches[2] == "UTF8": - self.code = UNICODE self.cnv = nocnv elif matches[2] == "ANSEL": - self.code = ANSEL self.cnv = ansel_to_utf8 else: self.cnv = latin_utf8.latin_to_utf8