diff --git a/gramps/gen/relationship.py b/gramps/gen/relationship.py index 6c5da76fb..7c9789ac5 100644 --- a/gramps/gen/relationship.py +++ b/gramps/gen/relationship.py @@ -2181,18 +2181,18 @@ class RelationshipCalculator: return trans_text("gender unknown|ex-spouse") elif spouse_type == self.PARTNER_UNMARRIED: if gender == MALE: - return trans_text("unmarried|husband") + return trans_text("male,unmarried|partner") elif gender == FEMALE: - return trans_text("unmarried|wife") + return trans_text("female,unmarried|partner") else: - return trans_text("gender unknown,unmarried|spouse") + return trans_text("gender unknown,unmarried|partner") elif spouse_type == self.PARTNER_EX_UNMARRIED: if gender == MALE: - return trans_text("unmarried|ex-husband") + return trans_text("male,unmarried|ex-partner") elif gender == FEMALE: - return trans_text("unmarried|ex-wife") + return trans_text("female,unmarried|ex-partner") else: - return trans_text("gender unknown,unmarried|ex-spouse") + return trans_text("gender unknown,unmarried|ex-partner") elif spouse_type == self.PARTNER_CIVIL_UNION: if gender == MALE: return trans_text("male,civil union|partner") diff --git a/gramps/gen/utils/place.py b/gramps/gen/utils/place.py index 7283f9711..910232df8 100644 --- a/gramps/gen/utils/place.py +++ b/gramps/gen/utils/place.py @@ -283,13 +283,6 @@ def __convert_float_val(val, typedeg="lat"): # it is checked that degree >0, 0<= minutes <= 60, # 0<= seconds <= 60, direction is in the directions dic. - #change , to . so that , input works in non , localization - #this is no problem, as a number like 100,000.20 cannot appear in - #lat/lon - #change XX,YY into XX.YY - if val.find(r'.') == -1: - val = val.replace(',', '.') - # format: XX.YYYY v = __convert_using_float_repr(val) if v is not None: diff --git a/gramps/gen/utils/test/place_test.py b/gramps/gen/utils/test/place_test.py index 168c18a05..fb40f0e85 100644 --- a/gramps/gen/utils/test/place_test.py +++ b/gramps/gen/utils/test/place_test.py @@ -183,10 +183,10 @@ class PlaceTest(unittest.TestCase): def test_decimal_localization(self): lat, lon = '50.849888888888', '2,885897222222' - self._test_formats_success(lat, lon) + self._test_formats_fail(lat, lon) lat, lon = '89°59\'59.9999"S', '179°59\'59,9999"W' - self._test_formats_success(lat, lon) + self._test_formats_fail(lat, lon) lat, lon = '89°59\'1.599,999"S', '179°59\'59,9999"W' self._test_formats_fail(lat, lon) diff --git a/gramps/gui/displaystate.py b/gramps/gui/displaystate.py index 2a9395bbf..fdf5ed531 100644 --- a/gramps/gui/displaystate.py +++ b/gramps/gui/displaystate.py @@ -118,30 +118,6 @@ class History(Callback): if initial_person: self.push(initial_person.get_handle()) - def remove(self, handle, old_id=None): - """ - Remove a handle from the history list - """ - if old_id: - del_id = old_id - else: - del_id = handle - - history_count = self.history.count(del_id) - for c in range(history_count): - self.history.remove(del_id) - self.index -= 1 - - mhc = self.mru.count(del_id) - for c in range(mhc): - self.mru.remove(del_id) - self.emit('mru-changed', (self.mru, )) - if self.history: - newact = self.history[self.index] - if not isinstance(newact, str): - newact = str(newact) - self.emit('active-changed', (newact,)) - def push(self, handle): """ Pushes the handle on the history stack @@ -231,8 +207,21 @@ class History(Callback): Called in response to an object-delete signal. Removes a list of handles from the history. """ - for handle in handle_list: - self.remove(handle) + for del_id in handle_list: + history_count = self.history.count(del_id) + for dummy in range(history_count): + self.history.remove(del_id) + self.index -= 1 + + mhc = self.mru.count(del_id) + for dummy in range(mhc): + self.mru.remove(del_id) + if self.history: + newact = self.history[self.index] + if not isinstance(newact, str): + newact = str(newact) + self.emit('active-changed', (newact,)) + self.emit('mru-changed', (self.mru, )) def history_changed(self): """ diff --git a/gramps/gui/editors/displaytabs/surnametab.py b/gramps/gui/editors/displaytabs/surnametab.py index 23691201e..dd60ba301 100644 --- a/gramps/gui/editors/displaytabs/surnametab.py +++ b/gramps/gui/editors/displaytabs/surnametab.py @@ -50,6 +50,9 @@ from ...ddtargets import DdTargets from gramps.gen.lib import Surname, NameOriginType from ...utils import match_primary_mask, no_match_primary_mask +# table for skipping illegal control chars +INVISIBLE = dict.fromkeys(list(range(32))) + #------------------------------------------------------------------------- # # SurnameTab @@ -281,7 +284,8 @@ class SurnameTab(EmbeddedList): colnr must be the column in the model. """ node = self.model.get_iter(path) - self.model.set_value(node, colnr, new_text) + text = new_text.translate(INVISIBLE).strip() + self.model.set_value(node, colnr, text) self.update() def on_orig_edited(self, cellr, path, new_text, colnr): diff --git a/gramps/gui/views/listview.py b/gramps/gui/views/listview.py index 2149ddfcf..445692648 100644 --- a/gramps/gui/views/listview.py +++ b/gramps/gui/views/listview.py @@ -781,9 +781,19 @@ class ListView(NavigationView): if self.active or \ (not self.dirty and not self._dirty_on_change_inactive): cput = perf_counter() - list(map(self.model.delete_row_by_handle, handle_list)) - LOG.debug(' ' + self.__class__.__name__ + ' row_delete ' + - str(perf_counter() - cput) + ' sec') + for hndl in handle_list: + if hndl != handle_list[-1]: + # For multiple deletes, row updates can result in a + # selection changed signal to a handle already + # deleted. In these cases we don't want to change the + # active to non-existant handles. + self.model.dont_change_active = True + else: + # Allow active changed on last item deleted + self.model.dont_change_active = False + self.model.delete_row_by_handle(hndl) + LOG.debug(' ' + self.__class__.__name__ + ' row_delete ' + + str(perf_counter() - cput) + ' sec') if self.active: self.uistate.show_filter_results(self.dbstate, self.model.displayed(), diff --git a/gramps/gui/views/navigationview.py b/gramps/gui/views/navigationview.py index 3f8803a46..c04e73104 100644 --- a/gramps/gui/views/navigationview.py +++ b/gramps/gui/views/navigationview.py @@ -324,7 +324,7 @@ class NavigationView(PageView): _("You need to set a 'default person' to go to. " "Select the People View, select the person you want as " "'Home Person', then confirm your choice " - "via the menu Edit ->Set Home Person."), + "via the menu Edit -> Set Home Person."), parent=self.uistate.window) def jump(self, *obj): diff --git a/gramps/gui/widgets/monitoredwidgets.py b/gramps/gui/widgets/monitoredwidgets.py index 4a2c59c60..00d970377 100644 --- a/gramps/gui/widgets/monitoredwidgets.py +++ b/gramps/gui/widgets/monitoredwidgets.py @@ -64,6 +64,9 @@ from gramps.gen.errors import ValidationError _RETURN = Gdk.keyval_from_name("Return") _KP_ENTER = Gdk.keyval_from_name("KP_Enter") +# table for skipping illegal control chars +INVISIBLE = dict.fromkeys(list(range(32))) + #------------------------------------------------------------------------- # # MonitoredCheckbox class @@ -112,6 +115,7 @@ class MonitoredEntry: if get_val(): self.obj.set_text(get_val()) self.obj.connect('changed', self._on_change) + self.obj.connect('focus-out-event', self._on_quit) self.obj.set_editable(not read_only) if autolist: @@ -136,8 +140,15 @@ class MonitoredEntry: def connect(self, signal, callback, *data): self.obj.connect(signal, callback, *data) + def _on_quit(self, obj, event): + text = obj.get_text().translate(INVISIBLE).strip() + self.set_val(text) + obj.set_text(text) + def _on_change(self, obj): - self.set_val(obj.get_text()) + new_text = obj.get_text().translate(INVISIBLE) + self.set_val(new_text) + obj.set_text(new_text) if self.changed: self.changed(obj) diff --git a/gramps/plugins/view/geoplaces.py b/gramps/plugins/view/geoplaces.py index a2a4466cf..4c677e2e6 100644 --- a/gramps/plugins/view/geoplaces.py +++ b/gramps/plugins/view/geoplaces.py @@ -437,8 +437,10 @@ class GeoPlaces(GeoGraphyView): latitude, longitude = conv_lat_lon(place.get_latitude(), place.get_longitude(), "D.D8") - self.osm.set_center_and_zoom(float(latitude), float(longitude), - int(config.get( + if latitude and longitude: + self.osm.set_center_and_zoom(float(latitude), + float(longitude), + int(config.get( "geography.zoom_when_center"))) else: self.message_layer.add_message( diff --git a/mac/gramps.modules b/mac/gramps.modules index 88b8ccc3f..cbcd7d77d 100644 --- a/mac/gramps.modules +++ b/mac/gramps.modules @@ -24,9 +24,9 @@ + href="https://graphviz.gitlab.io/pub/graphviz/stable/SOURCES/"/> + href="http://www.exiv2.org/releases/"/>