svn: r7860

This commit is contained in:
Don Allingham 2006-12-31 05:17:35 +00:00
parent f148620fc2
commit 91c6c4b923
3 changed files with 52 additions and 26 deletions

View File

@ -176,14 +176,14 @@ ged2fam_custom = {}
# regular expressions # regular expressions
# #
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
intRE = re.compile(r"\s*(\d+)\s*$") intRE = re.compile(r"\s*(\d+)\s*$")
nameRegexp= re.compile(r"/?([^/]*)(/([^/]*)(/([^/]*))?)?") nameRegexp = re.compile(r"/?([^/]*)(/([^/]*)(/([^/]*))?)?")
snameRegexp= re.compile(r"/([^/]*)/([^/]*)") snameRegexp = re.compile(r"/([^/]*)/([^/]*)")
modRegexp = re.compile(r"\s*(EST|CAL)\s+(.*)$") modRegexp = re.compile(r"\s*(EST|CAL)\s+(.*)$")
calRegexp = re.compile(r"\s*(ABT|BEF|AFT)?\s*@#D([^@]+)@\s*(.*)$") calRegexp = re.compile(r"\s*(ABT|BEF|AFT)?\s*@#D([^@]+)@\s*(.*)$")
rangeRegexp = re.compile(r"\s*BET\s+@#D([^@]+)@\s*(.*)\s+AND\s+@#D([^@]+)@\s*(.*)$") rangeRegexp = re.compile(r"\s*BET\s+@#D([^@]+)@\s*(.*)\s+AND\s+@#D([^@]+)@\s*(.*)$")
spanRegexp = re.compile(r"\s*FROM\s+@#D([^@]+)@\s*(.*)\s+TO\s+@#D([^@]+)@\s*(.*)$") spanRegexp = re.compile(r"\s*FROM\s+@#D([^@]+)@\s*(.*)\s+TO\s+@#D([^@]+)@\s*(.*)$")
intRegexp = re.compile(r"\s*INT\s+([^(]+)\((.*)\)$") intRegexp = re.compile(r"\s*INT\s+([^(]+)\((.*)\)$")
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@ -706,12 +706,12 @@ class GedcomParser(UpdateCallback):
TOKEN_CHAN : self.func_obje_chan, TOKEN_CHAN : self.func_obje_chan,
} }
self.place_names = set() self.place_names = {}
cursor = dbase.get_place_cursor() cursor = dbase.get_place_cursor()
data = cursor.next() data = cursor.next()
while data: while data:
(handle,val) = data (handle,val) = data
self.place_names.add(val[2]) self.place_names[val[2]] = handle
data = cursor.next() data = cursor.next()
cursor.close() cursor.close()
@ -1175,9 +1175,14 @@ class GedcomParser(UpdateCallback):
# check to see if we've encountered this name before # check to see if we've encountered this name before
# if we haven't we need to get a new GRAMPS ID # if we haven't we need to get a new GRAMPS ID
intid = self.lid2id.get(title)
intid = self.place_names.get(title)
if intid == None: if intid == None:
new_id = self.db.find_next_place_gramps_id() intid = self.lid2id.get(title)
if intid == None:
new_id = self.db.find_next_place_gramps_id()
else:
new_id = None
else: else:
new_id = None new_id = None
@ -2299,7 +2304,6 @@ class GedcomParser(UpdateCallback):
return value return value
def parse_ftw_fam_schema(self,level): def parse_ftw_fam_schema(self,level):
while True: while True:
matches = self.get_next() matches = self.get_next()
@ -2313,8 +2317,6 @@ class GedcomParser(UpdateCallback):
matches = self.get_next() matches = self.get_next()
if self.level_is_finished(matches,level): if self.level_is_finished(matches,level):
break break
# else:
# print matches
def ignore_change_data(self,level): def ignore_change_data(self,level):
matches = self.get_next() matches = self.get_next()

View File

@ -487,7 +487,7 @@ class MergePeople:
not entirely identical to the destination person's primary name. not entirely identical to the destination person's primary name.
Remaining alternate names are then added to the merged Remaining alternate names are then added to the merged
person's alternate names. person's alternate names, removing exact duplicates.
""" """
p1_name = self.p1.get_primary_name() p1_name = self.p1.get_primary_name()
p2_name = self.p2.get_primary_name() p2_name = self.p2.get_primary_name()
@ -496,10 +496,14 @@ class MergePeople:
if not p2_name.is_equal(p1_name): if not p2_name.is_equal(p1_name):
new.add_alternate_name(p2_name) new.add_alternate_name(p2_name)
for name in self.p1.get_alternate_names(): for name in self.p1.get_alternate_names() + self.p2.get_alternate_names():
new.add_alternate_name(name) if name.is_equal(p1_name):
for name in self.p2.get_alternate_names(): break
new.add_alternate_name(name) for item in new.get_alternate_names():
if item.is_equal(name):
break
else:
new.add_alternate_name(name)
def merge_birth(self, new,trans): def merge_birth(self, new,trans):
""" """

View File

@ -177,6 +177,8 @@ uidefault = '''<ui>
<accelerator action="F9"/> <accelerator action="F9"/>
<accelerator action="F11"/> <accelerator action="F11"/>
<accelerator action="F12"/> <accelerator action="F12"/>
<accelerator action="<Alt>N"/>
<accelerator action="<Alt>P"/>
</ui> </ui>
''' '''
@ -364,6 +366,8 @@ class ViewManager:
('F9', None, 'F9', "F9", None, self.keypress), ('F9', None, 'F9', "F9", None, self.keypress),
('F11', None, 'F11', "F11", None, self.keypress), ('F11', None, 'F11', "F11", None, self.keypress),
('F12', None, 'F12', "F12", None, self.keypress), ('F12', None, 'F12', "F12", None, self.keypress),
('<Alt>N', None, '<Alt>N', "<Alt>N", None, self.next_view),
('<Alt>P', None, '<Alt>P', "<Alt>P", None, self.prev_view),
] ]
self._action_action_list = [ self._action_action_list = [
@ -415,6 +419,22 @@ class ViewManager:
self.uistate.push_message(self.state, self.uistate.push_message(self.state,
_("Key %s is not bound") % name) _("Key %s is not bound") % name)
def next_view(self, action):
current_page = self.notebook.get_current_page()
if current_page == len(self.pages)-1:
new_page = 0
else:
new_page = current_page + 1
self.buttons[new_page].set_active(True)
def prev_view(self, action):
current_page = self.notebook.get_current_page()
if current_page == 0:
new_page = len(self.pages)-1
else:
new_page = current_page - 1
self.buttons[new_page].set_active(True)
def init_interface(self): def init_interface(self):
self._init_lists() self._init_lists()
@ -725,16 +745,16 @@ class ViewManager:
use_current = Config.get(Config.USE_LAST_VIEW) use_current = Config.get(Config.USE_LAST_VIEW)
if use_current: if use_current:
current = Config.get(Config.LAST_VIEW) current_page = Config.get(Config.LAST_VIEW)
if current > len(self.pages): if current_page > len(self.pages):
current = 0 current_page = 0
else: else:
current = 0 current_page = 0
self.active_page = self.pages[current] self.active_page = self.pages[current_page]
self.buttons[current].set_active(True) self.buttons[current_page].set_active(True)
self.active_page.set_active() self.active_page.set_active()
self.notebook.set_current_page(current) self.notebook.set_current_page(current_page)
def vb_clicked(self,button,index): def vb_clicked(self,button,index):
if Config.get(Config.VIEW): if Config.get(Config.VIEW):