mirror of
https://github.com/liberatedsystems/openCom-Companion.git
synced 2024-11-25 14:50:37 +01:00
Use internal map cache dir
This commit is contained in:
parent
a373af2b0f
commit
5110ef3b37
@ -153,6 +153,7 @@ class SidebandApp(MDApp):
|
|||||||
self.map = None
|
self.map = None
|
||||||
self.map_layer = None
|
self.map_layer = None
|
||||||
self.map_screen = None
|
self.map_screen = None
|
||||||
|
self.map_cache = self.sideband.map_cache
|
||||||
self.offline_source = None
|
self.offline_source = None
|
||||||
self.map_settings_screen = None
|
self.map_settings_screen = None
|
||||||
self.object_details_screen = None
|
self.object_details_screen = None
|
||||||
@ -3315,7 +3316,7 @@ class SidebandApp(MDApp):
|
|||||||
current_map_path = self.sideband.config["map_storage_file"]
|
current_map_path = self.sideband.config["map_storage_file"]
|
||||||
if current_map_path == None:
|
if current_map_path == None:
|
||||||
raise ValueError("Map path cannot be None")
|
raise ValueError("Map path cannot be None")
|
||||||
source = MBTilesMapSource(current_map_path)
|
source = MBTilesMapSource(current_map_path, cache_dir=self.map_cache)
|
||||||
self.offline_source = source
|
self.offline_source = source
|
||||||
return self.offline_source
|
return self.offline_source
|
||||||
|
|
||||||
@ -3335,7 +3336,7 @@ class SidebandApp(MDApp):
|
|||||||
source = self.map_get_offline_source()
|
source = self.map_get_offline_source()
|
||||||
|
|
||||||
if source == None:
|
if source == None:
|
||||||
source = MapSource.from_provider("osm", quad_key=False)
|
source = MapSource.from_provider("osm", cache_dir=self.map_cache, quad_key=False)
|
||||||
|
|
||||||
return source
|
return source
|
||||||
|
|
||||||
@ -3386,8 +3387,8 @@ class SidebandApp(MDApp):
|
|||||||
|
|
||||||
source = None
|
source = None
|
||||||
if ml == "offline": source = self.map_get_offline_source()
|
if ml == "offline": source = self.map_get_offline_source()
|
||||||
if ml == "osm": source = MapSource.from_provider("osm", quad_key=False)
|
if ml == "osm": source = MapSource.from_provider("osm", cache_dir=self.map_cache, quad_key=False)
|
||||||
if ml == "ve": source = MapSource.from_provider("ve", quad_key=True)
|
if ml == "ve": source = MapSource.from_provider("ve", cache_dir=self.map_cache, quad_key=True)
|
||||||
|
|
||||||
if source != None:
|
if source != None:
|
||||||
self.map_layer = ml
|
self.map_layer = ml
|
||||||
|
@ -124,12 +124,14 @@ class SidebandCore():
|
|||||||
self.rpc_connection = None
|
self.rpc_connection = None
|
||||||
|
|
||||||
self.app_dir = plyer.storagepath.get_home_dir()+"/.config/sideband"
|
self.app_dir = plyer.storagepath.get_home_dir()+"/.config/sideband"
|
||||||
|
self.cache_dir = self.app_dir+"/cache"
|
||||||
if self.app_dir.startswith("file://"):
|
if self.app_dir.startswith("file://"):
|
||||||
self.app_dir = self.app_dir.replace("file://", "")
|
self.app_dir = self.app_dir.replace("file://", "")
|
||||||
|
|
||||||
self.rns_configdir = None
|
self.rns_configdir = None
|
||||||
if RNS.vendor.platformutils.is_android():
|
if RNS.vendor.platformutils.is_android():
|
||||||
self.app_dir = android_app_dir+"/io.unsigned.sideband/files/"
|
self.app_dir = android_app_dir+"/io.unsigned.sideband/files/"
|
||||||
|
self.cache_dir = self.app_dir+"/cache"
|
||||||
self.rns_configdir = self.app_dir+"/app_storage/reticulum"
|
self.rns_configdir = self.app_dir+"/app_storage/reticulum"
|
||||||
self.asset_dir = self.app_dir+"/app/assets"
|
self.asset_dir = self.app_dir+"/app/assets"
|
||||||
elif RNS.vendor.platformutils.is_darwin():
|
elif RNS.vendor.platformutils.is_darwin():
|
||||||
@ -141,6 +143,10 @@ class SidebandCore():
|
|||||||
else:
|
else:
|
||||||
self.asset_dir = plyer.storagepath.get_application_dir()+"/sbapp/assets"
|
self.asset_dir = plyer.storagepath.get_application_dir()+"/sbapp/assets"
|
||||||
|
|
||||||
|
self.map_cache = self.cache_dir+"/maps"
|
||||||
|
if not os.path.isdir(self.map_cache):
|
||||||
|
os.makedirs(self.map_cache)
|
||||||
|
|
||||||
self.icon = self.asset_dir+"/icon.png"
|
self.icon = self.asset_dir+"/icon.png"
|
||||||
self.icon_48 = self.asset_dir+"/icon_48.png"
|
self.icon_48 = self.asset_dir+"/icon_48.png"
|
||||||
self.icon_32 = self.asset_dir+"/icon_32.png"
|
self.icon_32 = self.asset_dir+"/icon_32.png"
|
||||||
|
Loading…
Reference in New Issue
Block a user