From ed6e27714110295b0dbdcdd56abe1c3547ac7032 Mon Sep 17 00:00:00 2001 From: Don Allingham Date: Thu, 18 May 2006 03:14:55 +0000 Subject: [PATCH] svn: r6703 --- src/DisplayTabs/_FamilyLdsEmbedList.py | 1 + src/Filters/_FilterMenu.py | 8 +------ src/Filters/_FilterStore.py | 1 + src/Filters/_FilterWidget.py | 5 ++-- src/Filters/_PersonSidebarFilter.py | 8 +++---- src/Filters/_SearchBar.py | 1 + src/Filters/_SidebarFilter.py | 4 ++-- src/Filters/__init__.py | 1 - src/GrampsDb/_DbUtils.py | 1 + src/GrampsDb/_GrampsDbBase.py | 2 +- src/GrampsDb/_ReadGedcom.py | 33 ++++++++++++-------------- src/GrampsDb/_WriteGedcom.py | 9 +++---- src/PageView.py | 8 ++----- src/StartupDialog.py | 3 --- src/TipOfDay.py | 1 - src/ToolTips.py | 1 + src/Utils.py | 1 - 17 files changed, 36 insertions(+), 52 deletions(-) diff --git a/src/DisplayTabs/_FamilyLdsEmbedList.py b/src/DisplayTabs/_FamilyLdsEmbedList.py index 2b33ec627..37a3b5489 100644 --- a/src/DisplayTabs/_FamilyLdsEmbedList.py +++ b/src/DisplayTabs/_FamilyLdsEmbedList.py @@ -33,6 +33,7 @@ from gettext import gettext as _ # #------------------------------------------------------------------------- from _LdsEmbedList import LdsEmbedList +import RelLib #------------------------------------------------------------------------- # diff --git a/src/Filters/_FilterMenu.py b/src/Filters/_FilterMenu.py index 80ae25442..2e9ca9aca 100644 --- a/src/Filters/_FilterMenu.py +++ b/src/Filters/_FilterMenu.py @@ -26,6 +26,7 @@ # #------------------------------------------------------------------------- import gtk +from gettext import gettext as _ #------------------------------------------------------------------------- # @@ -42,15 +43,12 @@ from Filters import SystemFilters, CustomFilters def build_filter_menu(local_filters = [], default=""): menu = gtk.Menu() - active = 0 cnt = 0 for filt in local_filters: menuitem = gtk.MenuItem(filt.get_name()) menuitem.show() menu.append(menuitem) menuitem.set_data("filter", filt) - if default != "" and default == filt.get_name(): - active = cnt cnt += 1 for filt in SystemFilters.get_filters(): @@ -58,8 +56,6 @@ def build_filter_menu(local_filters = [], default=""): menuitem.show() menu.append(menuitem) menuitem.set_data("filter", filt) - if default != "" and default == filt.get_name(): - active = cnt cnt += 1 for filt in CustomFilters.get_filters(): @@ -67,8 +63,6 @@ def build_filter_menu(local_filters = [], default=""): menuitem.show() menu.append(menuitem) menuitem.set_data("filter", filt) - if default != "" and default == filt.get_name(): - active = cnt cnt += 1 return menu diff --git a/src/Filters/_FilterStore.py b/src/Filters/_FilterStore.py index 5002b8390..f4aaf6a5d 100644 --- a/src/Filters/_FilterStore.py +++ b/src/Filters/_FilterStore.py @@ -30,6 +30,7 @@ Package providing filtering framework for GRAMPS. # #------------------------------------------------------------------------- import gtk +from gettext import gettext as _ #------------------------------------------------------------------------- # diff --git a/src/Filters/_FilterWidget.py b/src/Filters/_FilterWidget.py index 0c38403bb..63482ef01 100644 --- a/src/Filters/_FilterWidget.py +++ b/src/Filters/_FilterWidget.py @@ -30,6 +30,7 @@ Package providing filtering framework for GRAMPS. # #------------------------------------------------------------------------- import gtk +from gettext import gettext as _ #------------------------------------------------------------------------- # @@ -100,8 +101,8 @@ class FilterWidget: self.apply_done_callback() def on_filter_name_changed(self,obj): - print "on_filter_name_changed" - index = self.filter_list.get_active() + pass +# index = self.filter_list.get_active() # mime_filter = self.filter_model.get_filter(index) # qual = mime_filter.need_param # if qual: diff --git a/src/Filters/_PersonSidebarFilter.py b/src/Filters/_PersonSidebarFilter.py index 10db58783..ae7239333 100644 --- a/src/Filters/_PersonSidebarFilter.py +++ b/src/Filters/_PersonSidebarFilter.py @@ -33,7 +33,7 @@ class PersonSidebarFilter(SidebarFilter): def __init__(self, clicked): SidebarFilter.__init__(self) - self.clicked = clicked + self.clicked_func = clicked def create_widget(self): self.filter_name = gtk.Entry() @@ -70,13 +70,13 @@ class PersonSidebarFilter(SidebarFilter): self.filter_name.set_text('') self.filter_id.set_text('') self.filter_birth.set_text('') - self.filter_death.get_text('') - self.filter_note.get_text('') + self.filter_death.set_text('') + self.filter_note.set_text('') self.filter_gender.set_active(0) self.etype.set_text('') def clicked(self, obj): - self.clicked() + self.clicked_func() def get_filter(self): name = self.filter_name.get_text().strip() diff --git a/src/Filters/_SearchBar.py b/src/Filters/_SearchBar.py index be525e27a..978b613ba 100644 --- a/src/Filters/_SearchBar.py +++ b/src/Filters/_SearchBar.py @@ -30,6 +30,7 @@ Package providing filtering framework for GRAMPS. # #------------------------------------------------------------------------- import gtk +from gettext import gettext as _ _RETURN = gtk.gdk.keyval_from_name("Return") diff --git a/src/Filters/_SidebarFilter.py b/src/Filters/_SidebarFilter.py index d153f44a6..7e92435e7 100644 --- a/src/Filters/_SidebarFilter.py +++ b/src/Filters/_SidebarFilter.py @@ -66,7 +66,7 @@ class SidebarFilter: def clear(self, obj): pass - def clicked(self): + def clicked(self, obj): pass def get_filter(self): @@ -78,7 +78,7 @@ class SidebarFilter: def key_press(self, obj, event): if event.keyval == _RETURN and not event.state: - self.clicked() + self.clicked(obj) return False def add_entry(self, name, widget): diff --git a/src/Filters/__init__.py b/src/Filters/__init__.py index bec139e03..ef0c18380 100644 --- a/src/Filters/__init__.py +++ b/src/Filters/__init__.py @@ -33,7 +33,6 @@ from const import system_filters, custom_filters from _FilterList import FilterList from _GenericFilter import GenericFilter from _ParamFilter import ParamFilter -import Rules def reload_system_filters(): global SystemFilters diff --git a/src/GrampsDb/_DbUtils.py b/src/GrampsDb/_DbUtils.py index d540661d0..f693f3f5f 100644 --- a/src/GrampsDb/_DbUtils.py +++ b/src/GrampsDb/_DbUtils.py @@ -20,6 +20,7 @@ # $Id: __init__.py 6086 2006-03-06 03:54:58Z dallingham $ +from gettext import gettext as _ import RelLib from BasicUtils import UpdateCallback diff --git a/src/GrampsDb/_GrampsDbBase.py b/src/GrampsDb/_GrampsDbBase.py index 914753c3f..afc153a92 100644 --- a/src/GrampsDb/_GrampsDbBase.py +++ b/src/GrampsDb/_GrampsDbBase.py @@ -1721,7 +1721,7 @@ class GrampsDbBase(GrampsDBCallback): """ returns True if the handle exists in the current Repository database. """ - return self.repository_map.has_key(str(handle)) != False + return self.repository_map.has_key(str(handle)) def _sortbyname(self, first, second): name1 = self.person_map.get(str(first))[3].sname diff --git a/src/GrampsDb/_ReadGedcom.py b/src/GrampsDb/_ReadGedcom.py index f866ebe82..c03204043 100644 --- a/src/GrampsDb/_ReadGedcom.py +++ b/src/GrampsDb/_ReadGedcom.py @@ -669,7 +669,7 @@ class GedcomParser(UpdateCallback): return (0,tries) def get_next(self): - if self.backoff == False: + if not self.backoff: self.groups = self.lexer.read() self.update() @@ -707,7 +707,6 @@ class GedcomParser(UpdateCallback): self.trans = self.db.transaction_begin("",not use_trans,no_magic) self.db.disable_signals() - t = time.time() self.fam_count = 0 self.indi_count = 0 self.repo_count = 0 @@ -731,9 +730,6 @@ class GedcomParser(UpdateCallback): src.set_note(note) self.db.add_source(src,self.trans) - t = time.time() - t - msg = _('Import Complete: %d seconds') % t - self.db.transaction_commit(self.trans,_("GEDCOM import")) self.db.enable_signals() self.db.request_rebuild() @@ -1513,12 +1509,12 @@ class GedcomParser(UpdateCallback): else: note = "\n%s" % info elif matches[1] in (TOKEN__GODP, TOKEN__WITN, TOKEN__WTN): - if matches[2][0] == "@": - witness_handle = self.find_person_handle(self.map_gid(matches[2][1:-1])) - witness = RelLib.Witness(RelLib.Event.ID,witness_handle) - else: - witness = RelLib.Witness(RelLib.Event.NAME,matches[2]) - event.add_witness(witness) +# if matches[2][0] == "@": +# witness_handle = self.find_person_handle(self.map_gid(matches[2][1:-1])) +# witness = RelLib.Witness(RelLib.Event.ID,witness_handle) +# else: +# witness = RelLib.Witness(RelLib.Event.NAME,matches[2]) +# event.add_witness(witness) self.ignore_sub_junk(level+1) elif matches[1] in (TOKEN_RELI, TOKEN_TIME, TOKEN_ADDR,TOKEN_IGNORE, TOKEN_STAT,TOKEN_TEMP,TOKEN_OBJE): @@ -1674,12 +1670,13 @@ class GedcomParser(UpdateCallback): elif matches[1] == TOKEN_NOTE: note = self.parse_note(matches,event,level+1,note) elif matches[1] in (TOKEN__WITN, TOKEN__WTN): - if matches[2][0] == "@": - witness_handle = self.find_person_handle(self.map_gid(matches[2][1:-1])) - witness = RelLib.Witness(RelLib.Event.ID,witness_handle) - else: - witness = RelLib.Witness(RelLib.Event.NAME,matches[2]) - event.add_witness(witness) + pass +# if matches[2][0] == "@": +# witness_handle = self.find_person_handle(self.map_gid(matches[2][1:-1])) +# witness = RelLib.Witness(RelLib.Event.ID,witness_handle) +# else: +# witness = RelLib.Witness(RelLib.Event.NAME,matches[2]) +# event.add_witness(witness) self.ignore_sub_junk(level+1) else: self.barf(level+1) @@ -2237,7 +2234,7 @@ class GedcomParser(UpdateCallback): if int(the_type) == RelLib.EventType.CUSTOM \ and str(the_type) in self.attrs: attr = RelLib.Attribute() - attr.set_type((RelLib.EventType.CUSTOM,self.gedattr[n])) + attr.set_type((RelLib.EventType.CUSTOM,self.gedattr[matches[2]])) attr.set_value(event.get_description()) state.person.add_attribute(attr) else: diff --git a/src/GrampsDb/_WriteGedcom.py b/src/GrampsDb/_WriteGedcom.py index 5f3d60380..be4430fac 100644 --- a/src/GrampsDb/_WriteGedcom.py +++ b/src/GrampsDb/_WriteGedcom.py @@ -736,7 +736,6 @@ class GedcomWriter(UpdateCallback): event = self.db.get_event_from_handle(event_handle) if not event or self.private and event.get_privacy(): continue - index = int(event.get_type()) val = event.get_type().xml_str() if val == "": val = self.target_ged.gramps2tag(name) @@ -807,7 +806,7 @@ class GedcomWriter(UpdateCallback): if self.adopt == GedcomInfo.ADOPT_LEGACY: if family.get_handle() in \ person.get_parent_family_handle_list(): - self.writeln('2 _STAT %s' % f[2]) + self.writeln('2 _STAT %s' % child_ref.mrel.xml_str()) for srcref in family.get_source_references(): self.write_source_ref(1,srcref) @@ -932,10 +931,9 @@ class GedcomWriter(UpdateCallback): event = self.db.get_event_from_handle(event_ref.ref) if self.private and event.get_privacy(): continue - index = int(event.get_type()) val = event.get_type().xml_str() if val == "": - val = self.target_ged.gramps2tag(index) + val = self.target_ged.gramps2tag(int(event.get_type())) if self.adopt == GedcomInfo.ADOPT_EVENT and val == "ADOP": ad = 1 @@ -983,7 +981,7 @@ class GedcomWriter(UpdateCallback): # needed on how to handle this if event.get_description() != "": self.writeln("1 EVEN %s" % - self.snvtxt(event.get_description())) + self.cnvtxt(event.get_description())) else: self.writeln("1 EVEN") self.writeln("2 TYPE %s" % self.cnvtxt(val)) @@ -1384,7 +1382,6 @@ class GedcomWriter(UpdateCallback): if form: self.writeln('%d FORM %s' % (level+1, form) ) self.writeln('%d TITL %s' % (level+1, photo_obj.get_description())) - dirname = os.path.join (self.dirname, self.images_path) basename = os.path.basename (path) self.writeln('%d FILE %s' % (level+1,os.path.join(self.images_path, basename))) diff --git a/src/PageView.py b/src/PageView.py index 586e3206d..cbaaac4ed 100644 --- a/src/PageView.py +++ b/src/PageView.py @@ -113,10 +113,7 @@ class PageView: self.action_group.set_visible(True) def get_stock(self): - try: - return gtk.STOCK_MEDIA_MISSING - except AttributeError: - return gtk.STOCK_MISSING_IMAGE + return gtk.STOCK_MISSING_IMAGE def get_title(self): return self.title @@ -236,7 +233,7 @@ class BookMarkView(PageView): def enable_action_group(self, obj): PageView.enable_action_group(self, obj) - def disable_action_group(self, obj): + def disable_action_group(self): PageView.disable_action_group(self) def define_actions(self): @@ -581,7 +578,6 @@ class ListView(BookMarkView): search=search) self.list.set_model(self.model) - colmap = self.column_order() if handle: path = self.model.on_get_path(handle) diff --git a/src/StartupDialog.py b/src/StartupDialog.py index 394b00d56..13916eb7c 100644 --- a/src/StartupDialog.py +++ b/src/StartupDialog.py @@ -92,8 +92,6 @@ def upgrade_prefs(): Config.set(Config.RESEARCHER_NAME, client.get_string('/apps/gramps/researcher-name')) - Config.set(Config.DEFAULTVIEW, - client.get_int('/apps/gramps/defaultview')) Config.set(Config.AUTOLOAD, client.get_bool('/apps/gramps/autoload')) Config.set(Config.USE_LDS, @@ -109,7 +107,6 @@ def upgrade_prefs(): toolbar = client.get_int('/apps/gramps/toolbar') if toolbar == 5: toolbar = -1 - Config.set(Config.TOOLBAR,toolbar) Config.set(Config.TOOLBAR_ON, client.get_bool('/apps/gramps/toolbar-on')) return True diff --git a/src/TipOfDay.py b/src/TipOfDay.py index 43cf75aaa..6292b23a4 100644 --- a/src/TipOfDay.py +++ b/src/TipOfDay.py @@ -45,7 +45,6 @@ import gtk.glade #------------------------------------------------------------------------- import const import Config -import Utils import ManagedWindow #------------------------------------------------------------------------- diff --git a/src/ToolTips.py b/src/ToolTips.py index 79ab8d3ad..4ffce7ae7 100644 --- a/src/ToolTips.py +++ b/src/ToolTips.py @@ -51,6 +51,7 @@ # #------------------------------------------------------------------------ from xml.sax.saxutils import escape +from gettext import gettext as _ #------------------------------------------------------------------------- # diff --git a/src/Utils.py b/src/Utils.py index 99f5b3952..41ea757d7 100644 --- a/src/Utils.py +++ b/src/Utils.py @@ -51,7 +51,6 @@ import gtk.gdk # Gramps modules # #------------------------------------------------------------------------- -import const import Mime import NameDisplay import RelLib