* 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
This commit is contained in:
Don Allingham 2003-06-26 02:53:04 +00:00
parent b9534f03ad
commit 00c9985d60
3 changed files with 17 additions and 10 deletions

View File

@ -136,6 +136,7 @@ class Gramps:
self.db.set_fprefix(GrampsCfg.fprefix) self.db.set_fprefix(GrampsCfg.fprefix)
self.db.set_sprefix(GrampsCfg.sprefix) self.db.set_sprefix(GrampsCfg.sprefix)
self.db.set_pprefix(GrampsCfg.pprefix) self.db.set_pprefix(GrampsCfg.pprefix)
self.clearing_tabs = 0
GrampsCfg.loadConfig(self.update_display) GrampsCfg.loadConfig(self.update_display)
self.relationship = Plugins.relationship_function() self.relationship = Plugins.relationship_function()
@ -440,6 +441,11 @@ class Gramps:
self.topWindow.show() self.topWindow.show()
def change_alpha_page(self,obj,junk,page): 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_tree = self.pl_page[page]
self.person_list = self.pl_page[page].tree self.person_list = self.pl_page[page].tree
self.person_model = self.pl_page[page].model self.person_model = self.pl_page[page].model
@ -737,11 +743,13 @@ class Gramps:
def clear_person_tabs(self): def clear_person_tabs(self):
self.clearing_tabs = 1
self.ptabs.hide() self.ptabs.hide()
for i in range(0,len(self.tab_list)): for i in range(0,len(self.tab_list)):
self.ptabs.remove_page(0) self.ptabs.remove_page(0)
self.ptabs.set_show_tabs(0) self.ptabs.set_show_tabs(0)
self.ptabs.show() self.ptabs.show()
self.clearing_tabs = 0
self.id2col = {} self.id2col = {}
self.tab_list = [] self.tab_list = []
self.alpha_page = {} self.alpha_page = {}
@ -803,9 +811,12 @@ class Gramps:
def tool_callback(self,val): def tool_callback(self,val):
if val: if val:
Utils.modified() import_tool_callback()
self.clear_person_tabs()
self.full_update() def import_tool_callback(self,val):
Utils.modified()
self.clear_person_tabs()
self.full_update()
def full_update(self): def full_update(self):
"""Brute force display update, updating all the pages""" """Brute force display update, updating all the pages"""
@ -1812,11 +1823,9 @@ class Gramps:
self.status_text("") self.status_text("")
def complete_rebuild(self): def complete_rebuild(self):
self.topWindow.set_resizable(gtk.FALSE)
self.apply_filter() self.apply_filter()
self.goto_active_person() self.goto_active_person()
self.modify_statusbar() self.modify_statusbar()
self.topWindow.set_resizable(gtk.TRUE)
def apply_filter(self,current_model=None): def apply_filter(self,current_model=None):
self.status_text(_('Updating display...')) self.status_text(_('Updating display...'))
@ -1860,6 +1869,7 @@ class Gramps:
self.modify_statusbar() self.modify_statusbar()
def create_new_panel(self,pg): def create_new_panel(self,pg):
display = gtk.ScrolledWindow() display = gtk.ScrolledWindow()
display.set_policy(gtk.POLICY_AUTOMATIC,gtk.POLICY_AUTOMATIC) display.set_policy(gtk.POLICY_AUTOMATIC,gtk.POLICY_AUTOMATIC)
tree = gtk.TreeView() tree = gtk.TreeView()
@ -1952,7 +1962,7 @@ class Gramps:
def import_callback(self,obj,plugin_function): def import_callback(self,obj,plugin_function):
"""Call the import plugin""" """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()) self.topWindow.set_title("%s - GRAMPS" % self.db.getSavePath())
def on_preferences_activate(self,obj): def on_preferences_activate(self,obj):

View File

@ -22,6 +22,6 @@ def utf8_to_latin(s):
return s.encode('iso-8859-1','replace') return s.encode('iso-8859-1','replace')
def latin_to_utf8(s): def latin_to_utf8(s):
return unicode(s) return unicode(s,'iso-8859-1')

View File

@ -254,7 +254,6 @@ class GedcomParser:
if self.window: if self.window:
self.update(self.file_obj,os.path.basename(file)) self.update(self.file_obj,os.path.basename(file))
self.code = 0
self.search_paths = [] self.search_paths = []
try: try:
@ -1488,10 +1487,8 @@ class GedcomParser:
self.broken_conc = self.gedsource.get_conc() self.broken_conc = self.gedsource.get_conc()
elif matches[1] == "CHAR": elif matches[1] == "CHAR":
if matches[2] == "UNICODE" or matches[2] == "UTF-8" or matches[2] == "UTF8": if matches[2] == "UNICODE" or matches[2] == "UTF-8" or matches[2] == "UTF8":
self.code = UNICODE
self.cnv = nocnv self.cnv = nocnv
elif matches[2] == "ANSEL": elif matches[2] == "ANSEL":
self.code = ANSEL
self.cnv = ansel_to_utf8 self.cnv = ansel_to_utf8
else: else:
self.cnv = latin_utf8.latin_to_utf8 self.cnv = latin_utf8.latin_to_utf8