parent
d4d9107e6e
commit
5b31272c7c
@ -142,8 +142,27 @@ class GeoGraphyView(OsmGps, NavigationView):
|
||||
self.centerlat = config.get("geography.center-lat")
|
||||
self.zoom = config.get("geography.zoom")
|
||||
self.lock = config.get("geography.lock")
|
||||
if config.get('geography.path') == "":
|
||||
tile_path = config.get('geography.path')
|
||||
if tile_path == "":
|
||||
config.set('geography.path', GEOGRAPHY_PATH)
|
||||
else:
|
||||
# verify is the path always exists
|
||||
if os.path.exists(tile_path) and os.path.isdir(tile_path):
|
||||
self.tile_path_ok = True
|
||||
else:
|
||||
self.tile_path_ok = False
|
||||
try:
|
||||
os.makedirs(tile_path, 0o755) # create dir like mkdir -p
|
||||
except:
|
||||
from gramps.gui.dialog import WarningDialog
|
||||
WarningDialog(_("Tile path"),
|
||||
_("The tile directory doesn't exist anymore:"
|
||||
"\n%s\nTrying to create a new one failed."
|
||||
"\nConfigure the view for the tile path"
|
||||
" and restart gramps."
|
||||
% tile_path),
|
||||
parent=uistate.window)
|
||||
|
||||
if not config.is_set('geography.personal-map'):
|
||||
config.set('geography.personal-map', "")
|
||||
|
||||
@ -274,11 +293,12 @@ class GeoGraphyView(OsmGps, NavigationView):
|
||||
"""
|
||||
Clear the map: places, markers, tracks, messages...
|
||||
"""
|
||||
self.place_list = []
|
||||
self.remove_all_markers()
|
||||
self.remove_all_gps()
|
||||
self.remove_all_tracks()
|
||||
self.message_layer.clear_messages()
|
||||
if self.osm is not None:
|
||||
self.place_list = []
|
||||
self.remove_all_markers()
|
||||
self.remove_all_gps()
|
||||
self.remove_all_tracks()
|
||||
self.message_layer.clear_messages()
|
||||
|
||||
def change_db(self, dbse):
|
||||
"""
|
||||
@ -291,7 +311,10 @@ class GeoGraphyView(OsmGps, NavigationView):
|
||||
dummy_dbse = dbse
|
||||
if self.active:
|
||||
self.bookmarks.redraw()
|
||||
self.build_tree()
|
||||
if self.osm is not None:
|
||||
self.build_tree()
|
||||
self.osm.grab_focus()
|
||||
self.set_crosshair(config.get("geography.show_cross"))
|
||||
|
||||
def can_configure(self):
|
||||
"""
|
||||
@ -541,7 +564,8 @@ class GeoGraphyView(OsmGps, NavigationView):
|
||||
"""
|
||||
Remove the specified layer
|
||||
"""
|
||||
self.osm.remove_layer(layer)
|
||||
if self.osm is not None:
|
||||
self.osm.remove_layer(layer)
|
||||
|
||||
def add_marker(self, menu, event, lat, lon, event_type, differtype,
|
||||
count, color=None):
|
||||
@ -568,19 +592,22 @@ class GeoGraphyView(OsmGps, NavigationView):
|
||||
"""
|
||||
Remove all gps points on the map
|
||||
"""
|
||||
self.osm.gps_clear()
|
||||
if self.osm is not None:
|
||||
self.osm.gps_clear()
|
||||
|
||||
def remove_all_tracks(self):
|
||||
"""
|
||||
Remove all tracks on the map
|
||||
"""
|
||||
self.osm.track_remove_all()
|
||||
if self.osm is not None:
|
||||
self.osm.track_remove_all()
|
||||
|
||||
def remove_all_markers(self):
|
||||
"""
|
||||
Remove all markers on the map
|
||||
"""
|
||||
self.marker_layer.clear_markers()
|
||||
if self.osm is not None:
|
||||
self.marker_layer.clear_markers()
|
||||
|
||||
def _present_in_places_list(self, index, string):
|
||||
"""
|
||||
|
@ -293,6 +293,8 @@ class GeoClose(GeoGraphyView):
|
||||
"""
|
||||
Rebuild the tree with the given person handle as the root.
|
||||
"""
|
||||
if self.osm is None:
|
||||
return
|
||||
self.place_list_active = []
|
||||
self.place_list_ref = []
|
||||
self.all_place_list = []
|
||||
@ -402,6 +404,8 @@ class GeoClose(GeoGraphyView):
|
||||
all handling of visibility is now in rebuild_trees, see that for more
|
||||
information.
|
||||
"""
|
||||
if self.osm is None:
|
||||
return
|
||||
self.lifeway_layer.clear_ways()
|
||||
if not self.dbstate.is_open():
|
||||
return
|
||||
|
@ -216,6 +216,8 @@ class GeoEvents(GeoGraphyView):
|
||||
"""
|
||||
Rebuild the tree with the given events handle as the root.
|
||||
"""
|
||||
if self.osm is None:
|
||||
return
|
||||
self.places_found = []
|
||||
self.build_tree()
|
||||
|
||||
@ -232,6 +234,8 @@ class GeoEvents(GeoGraphyView):
|
||||
all handling of visibility is now in rebuild_trees, see that for more
|
||||
information.
|
||||
"""
|
||||
if self.osm is None:
|
||||
return
|
||||
if not self.dbstate.is_open():
|
||||
return
|
||||
active = self.uistate.get_active('Event')
|
||||
@ -320,6 +324,8 @@ class GeoEvents(GeoGraphyView):
|
||||
Create all markers for each people's event in the database which has
|
||||
a lat/lon.
|
||||
"""
|
||||
if self.osm is None:
|
||||
return
|
||||
dbstate = self.dbstate
|
||||
self.place_list = []
|
||||
self.places_found = []
|
||||
|
@ -325,6 +325,8 @@ class GeoFamClose(GeoGraphyView):
|
||||
"""
|
||||
Rebuild the tree with the given family handle as reference.
|
||||
"""
|
||||
if self.osm is None:
|
||||
return
|
||||
self.place_list_active = []
|
||||
self.place_list_ref = []
|
||||
self.all_place_list = []
|
||||
@ -395,6 +397,8 @@ class GeoFamClose(GeoGraphyView):
|
||||
all handling of visibility is now in rebuild_trees, see that for more
|
||||
information.
|
||||
"""
|
||||
if self.osm is None:
|
||||
return
|
||||
self.lifeway_layer.clear_ways()
|
||||
if not self.dbstate.is_open():
|
||||
return
|
||||
|
@ -216,6 +216,8 @@ class GeoFamily(GeoGraphyView):
|
||||
"""
|
||||
Rebuild the tree with the given person handle as the root.
|
||||
"""
|
||||
if self.osm is None:
|
||||
return
|
||||
self.build_tree()
|
||||
|
||||
def build_tree(self):
|
||||
@ -435,6 +437,8 @@ class GeoFamily(GeoGraphyView):
|
||||
Create all markers for each people's event in the database which has
|
||||
a lat/lon.
|
||||
"""
|
||||
if self.osm is None:
|
||||
return
|
||||
if not handle:
|
||||
return
|
||||
self.place_list = []
|
||||
|
@ -269,6 +269,8 @@ class GeoMoves(GeoGraphyView):
|
||||
"""
|
||||
Rebuild the tree with the given family handle as reference.
|
||||
"""
|
||||
if self.osm is None:
|
||||
return
|
||||
if not self.started:
|
||||
self.started = True
|
||||
self.place_list_active = []
|
||||
@ -290,6 +292,8 @@ class GeoMoves(GeoGraphyView):
|
||||
all handling of visibility is now in rebuild_trees, see that for more
|
||||
information.
|
||||
"""
|
||||
if self.osm is None:
|
||||
return
|
||||
self.place_list_active = []
|
||||
self.place_list_ref = []
|
||||
self.sort = []
|
||||
|
@ -266,6 +266,8 @@ class GeoPerson(GeoGraphyView):
|
||||
"""
|
||||
Rebuild the tree with the given person handle as the root.
|
||||
"""
|
||||
if self.osm is None:
|
||||
return
|
||||
active = self.get_active()
|
||||
self._createmap(None)
|
||||
self.uistate.modify_statusbar(self.dbstate)
|
||||
@ -356,6 +358,8 @@ class GeoPerson(GeoGraphyView):
|
||||
a lat/lon.
|
||||
@param: active is mandatory but unused in this view. Fix : 10088
|
||||
"""
|
||||
if self.osm is None:
|
||||
return
|
||||
dbstate = self.dbstate
|
||||
self.cal = config.get('preferences.calendar-format-report')
|
||||
self.place_list = []
|
||||
|
@ -267,6 +267,8 @@ class GeoPlaces(GeoGraphyView):
|
||||
"""
|
||||
Rebuild the tree with the given places handle as the root.
|
||||
"""
|
||||
if self.osm is None:
|
||||
return
|
||||
self.places_found = []
|
||||
self.build_tree()
|
||||
|
||||
@ -332,6 +334,8 @@ class GeoPlaces(GeoGraphyView):
|
||||
Create all markers for each people's event in the database which has
|
||||
a lat/lon.
|
||||
"""
|
||||
if self.osm is None:
|
||||
return
|
||||
dbstate = self.dbstate
|
||||
self.place_list = []
|
||||
self.places_found = []
|
||||
|
Loading…
Reference in New Issue
Block a user