diff --git a/gramps2/src/GrampsDb/_ReadGedcom.py b/gramps2/src/GrampsDb/_ReadGedcom.py index abad47da5..8984629ac 100644 --- a/gramps2/src/GrampsDb/_ReadGedcom.py +++ b/gramps2/src/GrampsDb/_ReadGedcom.py @@ -176,14 +176,14 @@ ged2fam_custom = {} # regular expressions # #------------------------------------------------------------------------- -intRE = re.compile(r"\s*(\d+)\s*$") -nameRegexp= re.compile(r"/?([^/]*)(/([^/]*)(/([^/]*))?)?") -snameRegexp= re.compile(r"/([^/]*)/([^/]*)") -modRegexp = re.compile(r"\s*(EST|CAL)\s+(.*)$") -calRegexp = re.compile(r"\s*(ABT|BEF|AFT)?\s*@#D([^@]+)@\s*(.*)$") +intRE = re.compile(r"\s*(\d+)\s*$") +nameRegexp = re.compile(r"/?([^/]*)(/([^/]*)(/([^/]*))?)?") +snameRegexp = re.compile(r"/([^/]*)/([^/]*)") +modRegexp = re.compile(r"\s*(EST|CAL)\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*(.*)$") -spanRegexp = re.compile(r"\s*FROM\s+@#D([^@]+)@\s*(.*)\s+TO\s+@#D([^@]+)@\s*(.*)$") -intRegexp = re.compile(r"\s*INT\s+([^(]+)\((.*)\)$") +spanRegexp = re.compile(r"\s*FROM\s+@#D([^@]+)@\s*(.*)\s+TO\s+@#D([^@]+)@\s*(.*)$") +intRegexp = re.compile(r"\s*INT\s+([^(]+)\((.*)\)$") #------------------------------------------------------------------------- # @@ -706,12 +706,12 @@ class GedcomParser(UpdateCallback): TOKEN_CHAN : self.func_obje_chan, } - self.place_names = set() + self.place_names = {} cursor = dbase.get_place_cursor() data = cursor.next() while data: (handle,val) = data - self.place_names.add(val[2]) + self.place_names[val[2]] = handle data = cursor.next() cursor.close() @@ -1175,9 +1175,14 @@ class GedcomParser(UpdateCallback): # check to see if we've encountered this name before # 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: - 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: new_id = None @@ -2299,7 +2304,6 @@ class GedcomParser(UpdateCallback): return value def parse_ftw_fam_schema(self,level): - while True: matches = self.get_next() @@ -2313,8 +2317,6 @@ class GedcomParser(UpdateCallback): matches = self.get_next() if self.level_is_finished(matches,level): break -# else: -# print matches def ignore_change_data(self,level): matches = self.get_next() diff --git a/gramps2/src/Merge/_MergePerson.py b/gramps2/src/Merge/_MergePerson.py index 880dff3f0..21549bb97 100644 --- a/gramps2/src/Merge/_MergePerson.py +++ b/gramps2/src/Merge/_MergePerson.py @@ -487,7 +487,7 @@ class MergePeople: not entirely identical to the destination person's primary name. 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() p2_name = self.p2.get_primary_name() @@ -496,10 +496,14 @@ class MergePeople: if not p2_name.is_equal(p1_name): new.add_alternate_name(p2_name) - for name in self.p1.get_alternate_names(): - new.add_alternate_name(name) - for name in self.p2.get_alternate_names(): - new.add_alternate_name(name) + for name in self.p1.get_alternate_names() + self.p2.get_alternate_names(): + if name.is_equal(p1_name): + break + 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): """ diff --git a/gramps2/src/ViewManager.py b/gramps2/src/ViewManager.py index b6f531a19..b7a21e9a9 100644 --- a/gramps2/src/ViewManager.py +++ b/gramps2/src/ViewManager.py @@ -177,6 +177,8 @@ uidefault = ''' + + ''' @@ -364,6 +366,8 @@ class ViewManager: ('F9', None, 'F9', "F9", None, self.keypress), ('F11', None, 'F11', "F11", None, self.keypress), ('F12', None, 'F12', "F12", None, self.keypress), + ('N', None, 'N', "N", None, self.next_view), + ('P', None, 'P', "P", None, self.prev_view), ] self._action_action_list = [ @@ -415,6 +419,22 @@ class ViewManager: self.uistate.push_message(self.state, _("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): self._init_lists() @@ -725,16 +745,16 @@ class ViewManager: use_current = Config.get(Config.USE_LAST_VIEW) if use_current: - current = Config.get(Config.LAST_VIEW) - if current > len(self.pages): - current = 0 + current_page = Config.get(Config.LAST_VIEW) + if current_page > len(self.pages): + current_page = 0 else: - current = 0 + current_page = 0 - self.active_page = self.pages[current] - self.buttons[current].set_active(True) + self.active_page = self.pages[current_page] + self.buttons[current_page].set_active(True) self.active_page.set_active() - self.notebook.set_current_page(current) + self.notebook.set_current_page(current_page) def vb_clicked(self,button,index): if Config.get(Config.VIEW):