Geography and Gtk3 : some cleaning.
correction for bug #06044 and #05975 popup for button 1 in all views color change for the reference person or family remove Hscale and use Scale with orientation selection layer works for rectangle selection. You need to use the last osm-gps-map. svn: r20396
This commit is contained in:
parent
0af3930f62
commit
c7d196f387
@ -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"
|
||||
"<b>%(title)s</b>\n"
|
||||
"The following places are similar : %(gid)s\n"
|
||||
"Eiher you rename the places either you merge them."
|
||||
"\n\n<b>I can't proceed your request</b>.\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):
|
||||
"""
|
||||
|
@ -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()
|
||||
|
||||
|
@ -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):
|
||||
"""
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
|
@ -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):
|
||||
"""
|
||||
|
@ -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):
|
||||
|
@ -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):
|
||||
|
@ -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):
|
||||
|
@ -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):
|
||||
|
@ -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):
|
||||
|
@ -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):
|
||||
|
@ -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):
|
||||
|
Loading…
Reference in New Issue
Block a user