diff --git a/src/plugins/lib/maps/geography.py b/src/plugins/lib/maps/geography.py index 5f2d609de..618846949 100644 --- a/src/plugins/lib/maps/geography.py +++ b/src/plugins/lib/maps/geography.py @@ -819,20 +819,40 @@ class GeoGraphyView(OsmGps, NavigationView): oldv = (loc.get_country(), loc.get_state(), loc.get_county()) if loc else None places_handle = self.dbstate.db.iter_place_handles() + nb_places = 0 + gids = "" for place_hdl in places_handle: plce = self.dbstate.db.get_place_from_handle(place_hdl) if plce.get_title() == place.get_title(): - self.mark = [None, None, None, None, None, None, None, - None, None, plce.gramps_id, None, None] - self.select_fct = PlaceSelection(self.uistate, - self.dbstate, - self.osm, - self.selection_layer, - self.place_list, - lat, - lon, - self.__edit_place, - oldv) + nb_places += 1 + if gids == "": + gids = plce.gramps_id + else: + gids = gids + ", " + plce.gramps_id + if nb_places > 1: + from QuestionDialog import WarningDialog + WarningDialog( + _('You have at least two places with the same title.'), + _("The title of the places is :\n" + "%(title)s\n" + "The following places are similar : %(gid)s\n" + "Eiher you rename the places either you merge them." + "\n\nI can't proceed your request.\n") % { + 'title': plce.get_title(), + 'gid': gids} + ) + else: + self.mark = [None, None, None, None, None, None, None, + None, None, plce.gramps_id, None, None] + self.select_fct = PlaceSelection(self.uistate, + self.dbstate, + self.osm, + self.selection_layer, + self.place_list, + lat, + lon, + self.__edit_place, + oldv) def __add_place(self, pcountry, pcounty, pstate, plat, plon): """ diff --git a/src/plugins/lib/maps/lifewaylayer.py b/src/plugins/lib/maps/lifewaylayer.py index 18c158e53..ad6bca480 100644 --- a/src/plugins/lib/maps/lifewaylayer.py +++ b/src/plugins/lib/maps/lifewaylayer.py @@ -138,9 +138,9 @@ class LifeWayLayer(GObject.GObject, osmgpsmap.MapLayer): ctx.translate(coord_x1, coord_y1/coz) ctx.arc(0.0, 0.0, cox, 0.0, 2*pi) ctx.fill() + ctx.set_source_rgba(1.0,0.0,0.0,0.5) ctx.set_line_width(2.0) ctx.arc(0.0, 0.0, cox, 0.0, 2*pi) - ctx.set_source_rgba(1.0,0.0,0.0,0.5) ctx.stroke() ctx.restore() diff --git a/src/plugins/lib/maps/messagelayer.py b/src/plugins/lib/maps/messagelayer.py index 5a0ef98ca..f3ef1ba78 100644 --- a/src/plugins/lib/maps/messagelayer.py +++ b/src/plugins/lib/maps/messagelayer.py @@ -144,6 +144,7 @@ class MessageLayer(GObject.GObject, osmgpsmap.MapLayer): ctx.move_to(coord_x, coord_y) ctx.show_text(line_to_print) coord_y += int(self.size) # calculate the next line position + ctx.stroke() def do_render(self, gpsmap): """ diff --git a/src/plugins/lib/maps/osmGps.py b/src/plugins/lib/maps/osmGps.py index 2d58412b3..db1afe411 100644 --- a/src/plugins/lib/maps/osmGps.py +++ b/src/plugins/lib/maps/osmGps.py @@ -305,7 +305,7 @@ class OsmGps(): lat, lon = self.osm.get_event_location(event).get_degrees() current = osm.convert_screen_to_geographic(int(event.x), int(event.y)) lat, lon = current.get_degrees() - if event.button == 1: + if event.button == 1 and event.type == Gdk.EventType.BUTTON_PRESS: if self.end_selection is not None: self.activate_selection_zoom(osm, event) self.end_selection = None diff --git a/src/plugins/lib/maps/placeselection.py b/src/plugins/lib/maps/placeselection.py index de3ef92fb..5753cf837 100644 --- a/src/plugins/lib/maps/placeselection.py +++ b/src/plugins/lib/maps/placeselection.py @@ -130,8 +130,8 @@ class PlaceSelection(ManagedWindow, OsmGps): self.window.vbox.pack_start(alignment, False, True, 0) adj = Gtk.Adjustment(1.0, 0.1, 3.0, 0.1, 0, 0) # default value is 1.0, minimum is 0.1 and max is 3.0 - slider = Gtk.HScale(adj) - slider.set_update_policy(Gtk.UPDATE_DISCONTINUOUS) + slider = Gtk.Scale(orientation=Gtk.Orientation.HORIZONTAL, + adjustment=adj) slider.set_digits(1) slider.set_value_pos(Gtk.PositionType.BOTTOM) slider.connect('value-changed', self.slider_change, self.lat, self.lon) diff --git a/src/plugins/lib/maps/selectionlayer.py b/src/plugins/lib/maps/selectionlayer.py index 6498f1014..7e47fbf6d 100644 --- a/src/plugins/lib/maps/selectionlayer.py +++ b/src/plugins/lib/maps/selectionlayer.py @@ -28,6 +28,7 @@ # #------------------------------------------------------------------------- import os +from math import pi from gi.repository import GObject #------------------------------------------------------------------------ @@ -87,32 +88,34 @@ class SelectionLayer(GObject.GObject, osmgpsmap.MapLayer): circle[2] + circle[0]) crd_x, crd_y = gpsmap.convert_geographic_to_screen(top_left) crd_x2, crd_y2 = gpsmap.convert_geographic_to_screen(bottom_right) - #drawable.draw_arc(ggc, False, crd_x, crd_y, crd_x2 - crd_x, - # crd_y2 - crd_y, 0, 360*64) - ctx.arc(crd_x, crd_y, crd_x2 - crd_x, crd_y2 - crd_y, 0, 360*64) + width = float(crd_x2 - crd_x) + height = float(crd_y2 - crd_y) + ctx.set_line_width(3.0) + ctx.set_source_rgba(0.0, 0.0, 0.0, 0.8) + ctx.scale(1.0, (height/width)) + #ctx.arc(float(crd_x + crd_x2)/2, float(crd_y + crd_y2)/2, width, 0.0, 2*pi) + # TODO : placement bug : waiting bug correction on osm-gps-map + ctx.arc(float(crd_x + crd_x2)/2, float(crd_y+height*(height/width)/2), width, 0.0, 2*pi) + ctx.stroke() + for rectangle in self.rectangles: top_left, bottom_right = rectangle + ctx.set_source_rgba(0.0, 0.0, 0.0, 0.8) + ctx.set_line_width(3.0) crd_x, crd_y = gpsmap.convert_geographic_to_screen(top_left) crd_x2, crd_y2 = gpsmap.convert_geographic_to_screen(bottom_right) # be sure when can select a region in all case. if ( crd_x < crd_x2 ): if ( crd_y < crd_y2 ): - #drawable.draw_rectangle(ggc, False, crd_x, crd_y, - # crd_x2 - crd_x, crd_y2 - crd_y) ctx.rectangle(crd_x, crd_y, crd_x2 - crd_x, crd_y2 - crd_y) else: - #drawable.draw_rectangle(ggc, False, crd_x, crd_y2, - # crd_x2 - crd_x, crd_y - crd_y2) ctx.rectangle(crd_x, crd_y2, crd_x2 - crd_x, crd_y - crd_y2) else: if ( crd_y < crd_y2 ): - #drawable.draw_rectangle(ggc, False, crd_x2, crd_y, - # crd_x - crd_x2, crd_y2 - crd_y) ctx.rectangle(crd_x2, crd_y, crd_x - crd_x2, crd_y2 - crd_y) else: - #drawable.draw_rectangle(ggc, False, crd_x2, crd_y2, - # crd_x - crd_x2, crd_y - crd_y2) ctx.rectangle(crd_x2, crd_y2, crd_x - crd_x2, crd_y - crd_y2) + ctx.stroke() def do_render(self, gpsmap): """ diff --git a/src/plugins/view/geoclose.py b/src/plugins/view/geoclose.py index 755b0d273..e029fae8d 100644 --- a/src/plugins/view/geoclose.py +++ b/src/plugins/view/geoclose.py @@ -119,7 +119,7 @@ class GeoClose(GeoGraphyView): # specific to geoclose : - ('geography.color1', 'red'), + ('geography.color1', 'blue'), ('geography.color2', 'green'), ('geography.maximum_meeting_zone', 5), @@ -280,7 +280,7 @@ class GeoClose(GeoGraphyView): points.append((startlat, startlon)) self.lifeway_layer.add_way(points, color) if reference: - self.lifeway_layer.add_way_ref(points, color, + self.lifeway_layer.add_way_ref(points, 'orange', float(self._config.get("geography.maximum_meeting_zone")) / 10) return False @@ -476,7 +476,10 @@ class GeoClose(GeoGraphyView): event, lat, lon, prevmark) itemoption.append(center) menu.show() - menu.popup(None, None, None, None, 0, event.time) + menu.popup(None, None, + lambda menu, data: (event.get_root_coords()[0], + event.get_root_coords()[1], True), + None, event.button, event.time) return 0 def add_specific_menu(self, menu, event, lat, lon): diff --git a/src/plugins/view/geoevents.py b/src/plugins/view/geoevents.py index fb60e105b..550f1f5bb 100644 --- a/src/plugins/view/geoevents.py +++ b/src/plugins/view/geoevents.py @@ -352,7 +352,10 @@ class GeoEvents(GeoGraphyView): center.show() center.connect("activate", self.center_here, event, lat, lon, prevmark) itemoption.append(center) - menu.popup(None, None, None, None, 0, event.time) + menu.popup(None, None, + lambda menu, data: (event.get_root_coords()[0], + event.get_root_coords()[1], True), + None, event.button, event.time) return 1 def add_specific_menu(self, menu, event, lat, lon): diff --git a/src/plugins/view/geofamclose.py b/src/plugins/view/geofamclose.py index f51b3f620..7207f146a 100644 --- a/src/plugins/view/geofamclose.py +++ b/src/plugins/view/geofamclose.py @@ -119,7 +119,7 @@ class GeoFamClose(GeoGraphyView): # specific to geoclose : - ('geography.color1', 'red'), + ('geography.color1', 'blue'), ('geography.color2', 'green'), ('geography.maximum_meeting_zone', 5), @@ -309,7 +309,7 @@ class GeoFamClose(GeoGraphyView): points.append((startlat, startlon)) self.lifeway_layer.add_way(points, color) if reference: - self.lifeway_layer.add_way_ref(points, color, + self.lifeway_layer.add_way_ref(points, 'orange', float(self._config.get("geography.maximum_meeting_zone")) / 10) return False @@ -665,7 +665,10 @@ class GeoFamClose(GeoGraphyView): event, lat, lon, prevmark) itemoption.append(center) menu.show() - menu.popup(None, None, None, None, 0, event.time) + menu.popup(None, None, + lambda menu, data: (event.get_root_coords()[0], + event.get_root_coords()[1], True), + None, event.button, event.time) return 0 def add_specific_menu(self, menu, event, lat, lon): diff --git a/src/plugins/view/geofamily.py b/src/plugins/view/geofamily.py index 7fdceb483..30deb09e5 100644 --- a/src/plugins/view/geofamily.py +++ b/src/plugins/view/geofamily.py @@ -445,7 +445,10 @@ class GeoFamily(GeoGraphyView): add_item.show() menu.append(add_item) self.add_event_bubble_message(event, lat, lon, prevmark, add_item) - menu.popup(None, None, None, None, 0, event.time) + menu.popup(None, None, + lambda menu, data: (event.get_root_coords()[0], + event.get_root_coords()[1], True), + None, event.button, event.time) return 1 def add_specific_menu(self, menu, event, lat, lon): diff --git a/src/plugins/view/geomoves.py b/src/plugins/view/geomoves.py index a992c0aba..b27a248e2 100644 --- a/src/plugins/view/geomoves.py +++ b/src/plugins/view/geomoves.py @@ -605,7 +605,10 @@ class GeoMoves(GeoGraphyView): event, lat, lon, prevmark) itemoption.append(center) menu.show() - menu.popup(None, None, None, None, 0, event.time) + menu.popup(None, None, + lambda menu, data: (event.get_root_coords()[0], + event.get_root_coords()[1], True), + None, event.button, event.time) return 1 def add_specific_menu(self, menu, event, lat, lon): diff --git a/src/plugins/view/geoperson.py b/src/plugins/view/geoperson.py index 8a05761da..541087a2b 100644 --- a/src/plugins/view/geoperson.py +++ b/src/plugins/view/geoperson.py @@ -480,7 +480,10 @@ class GeoPerson(GeoGraphyView): center.connect("activate", self.center_here, event, lat, lon, prevmark) itemoption.append(center) menu.show() - menu.popup(None, None, None, None, 0, event.time) + menu.popup(None, None, + lambda menu, data: (event.get_root_coords()[0], + event.get_root_coords()[1], True), + None, event.button, event.time) return 1 def add_specific_menu(self, menu, event, lat, lon): diff --git a/src/plugins/view/geoplaces.py b/src/plugins/view/geoplaces.py index 62c13070f..05ba42ca9 100644 --- a/src/plugins/view/geoplaces.py +++ b/src/plugins/view/geoplaces.py @@ -343,7 +343,10 @@ class GeoPlaces(GeoGraphyView): center.show() center.connect("activate", self.center_here, event, lat, lon, prevmark) itemoption.append(center) - menu.popup(None, None, None, None, 0, event.time) + menu.popup(None, None, + lambda menu, data: (event.get_root_coords()[0], + event.get_root_coords()[1], True), + None, event.button, event.time) return 1 def add_specific_menu(self, menu, event, lat, lon):