Updated marker handling
This commit is contained in:
parent
c77fb4ce20
commit
b340711526
|
@ -1,6 +1,6 @@
|
||||||
__debug_build__ = False
|
__debug_build__ = False
|
||||||
__disable_shaders__ = False
|
__disable_shaders__ = False
|
||||||
__version__ = "0.6.3"
|
__version__ = "0.7.0"
|
||||||
__variant__ = "beta"
|
__variant__ = "beta"
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
|
@ -3224,9 +3224,8 @@ class SidebandApp(MDApp):
|
||||||
RNS.log("Could not create map marker for "+RNS.prettyhexrep(source)+": "+str(e), RNS.LOG_ERROR)
|
RNS.log("Could not create map marker for "+RNS.prettyhexrep(source)+": "+str(e), RNS.LOG_ERROR)
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def map_update_markers(self, sender=None):
|
def map_update_markers(self, sender=None):
|
||||||
|
RNS.log("Updating map markers", RNS.LOG_DEBUG)
|
||||||
earliest = time.time() - self.sideband.config["map_history_limit"]
|
earliest = time.time() - self.sideband.config["map_history_limit"]
|
||||||
telemetry_entries = self.sideband.list_telemetry(after=earliest)
|
telemetry_entries = self.sideband.list_telemetry(after=earliest)
|
||||||
own_address = self.sideband.lxmf_destination.hash
|
own_address = self.sideband.lxmf_destination.hash
|
||||||
|
@ -3275,9 +3274,12 @@ class SidebandApp(MDApp):
|
||||||
stale_markers.append(marker)
|
stale_markers.append(marker)
|
||||||
|
|
||||||
for marker in stale_markers:
|
for marker in stale_markers:
|
||||||
|
RNS.log("Removing stale marker: "+str(marker), RNS.LOG_DEBUG)
|
||||||
try:
|
try:
|
||||||
self.map_screen.ids.map_layout.map.remove_widget(self.map_markers[marker])
|
to_remove = self.map_markers[marker]
|
||||||
|
self.map_screen.ids.map_layout.map.remove_marker(to_remove)
|
||||||
self.map_markers.pop(marker)
|
self.map_markers.pop(marker)
|
||||||
|
changes = True
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
RNS.log("Error while removing map marker: "+str(e), RNS.LOG_ERROR)
|
RNS.log("Error while removing map marker: "+str(e), RNS.LOG_ERROR)
|
||||||
|
|
||||||
|
|
|
@ -81,7 +81,7 @@ class SidebandCore():
|
||||||
AUTO_ANNOUNCE_RANDOM_MIN = 90 # In minutes
|
AUTO_ANNOUNCE_RANDOM_MIN = 90 # In minutes
|
||||||
AUTO_ANNOUNCE_RANDOM_MAX = 480 # In minutes
|
AUTO_ANNOUNCE_RANDOM_MAX = 480 # In minutes
|
||||||
|
|
||||||
DEFAULT_APPEARANCE = ["alpha-p-circle-outline", [0,0,0,1], [1,1,1,1]]
|
DEFAULT_APPEARANCE = ["account", [0,0,0,1], [1,1,1,1]]
|
||||||
|
|
||||||
aspect_filter = "lxmf.delivery"
|
aspect_filter = "lxmf.delivery"
|
||||||
def received_announce(self, destination_hash, announced_identity, app_data):
|
def received_announce(self, destination_hash, announced_identity, app_data):
|
||||||
|
@ -805,7 +805,7 @@ class SidebandCore():
|
||||||
|
|
||||||
def setstate(self, prop, val):
|
def setstate(self, prop, val):
|
||||||
# TODO: remove
|
# TODO: remove
|
||||||
us = time.time()
|
# us = time.time()
|
||||||
|
|
||||||
if not RNS.vendor.platformutils.is_android():
|
if not RNS.vendor.platformutils.is_android():
|
||||||
self.getstate_cache[prop] = val
|
self.getstate_cache[prop] = val
|
||||||
|
@ -1226,6 +1226,9 @@ class SidebandCore():
|
||||||
if data_dict == None:
|
if data_dict == None:
|
||||||
data_dict = {}
|
data_dict = {}
|
||||||
|
|
||||||
|
if not "appearance" in data_dict:
|
||||||
|
data_dict["appearance"] = None
|
||||||
|
|
||||||
if data_dict["appearance"] != appearance:
|
if data_dict["appearance"] != appearance:
|
||||||
data_dict["appearance"] = appearance
|
data_dict["appearance"] = appearance
|
||||||
packed_dict = msgpack.packb(data_dict)
|
packed_dict = msgpack.packb(data_dict)
|
||||||
|
@ -1696,6 +1699,7 @@ class SidebandCore():
|
||||||
def stop_telemetry(self):
|
def stop_telemetry(self):
|
||||||
self.telemetry_running = False
|
self.telemetry_running = False
|
||||||
self.telemeter.stop_all()
|
self.telemeter.stop_all()
|
||||||
|
self.setstate("app.flags.last_telemetry", time.time())
|
||||||
|
|
||||||
def update_telemetry(self):
|
def update_telemetry(self):
|
||||||
try:
|
try:
|
||||||
|
@ -1722,6 +1726,8 @@ class SidebandCore():
|
||||||
self.telemetry_changes += 1
|
self.telemetry_changes += 1
|
||||||
self.latest_telemetry = telemetry
|
self.latest_telemetry = telemetry
|
||||||
self.latest_packed_telemetry = packed_telemetry
|
self.latest_packed_telemetry = packed_telemetry
|
||||||
|
self.setstate("app.flags.last_telemetry", time.time())
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
RNS.log("Error while updating telemetry: "+str(e), RNS.LOG_ERROR)
|
RNS.log("Error while updating telemetry: "+str(e), RNS.LOG_ERROR)
|
||||||
|
|
||||||
|
@ -2435,8 +2441,6 @@ class SidebandCore():
|
||||||
if send_telemetry or send_appearance:
|
if send_telemetry or send_appearance:
|
||||||
fields = {}
|
fields = {}
|
||||||
if send_appearance:
|
if send_appearance:
|
||||||
# TODO: REMOVE
|
|
||||||
RNS.log("Sending appearance", RNS.LOG_WARNING)
|
|
||||||
def fth(c):
|
def fth(c):
|
||||||
r = c[0]; g = c[1]; b = c[2]
|
r = c[0]; g = c[1]; b = c[2]
|
||||||
r = min(max(0, r), 1); g = min(max(0, g), 1); b = min(max(0, b), 1)
|
r = min(max(0, r), 1); g = min(max(0, g), 1); b = min(max(0, b), 1)
|
||||||
|
@ -2450,8 +2454,6 @@ class SidebandCore():
|
||||||
fields[LXMF.FIELD_ICON_APPEARANCE] = [icon, fg, bg]
|
fields[LXMF.FIELD_ICON_APPEARANCE] = [icon, fg, bg]
|
||||||
|
|
||||||
if send_telemetry:
|
if send_telemetry:
|
||||||
# TODO: REMOVE
|
|
||||||
RNS.log("Sending telemetry", RNS.LOG_WARNING)
|
|
||||||
fields[LXMF.FIELD_TELEMETRY] = self.latest_packed_telemetry
|
fields[LXMF.FIELD_TELEMETRY] = self.latest_packed_telemetry
|
||||||
|
|
||||||
return fields
|
return fields
|
||||||
|
|
Loading…
Reference in New Issue