Merge pull request #735 from dadav/fix/add_unload

add unload method
This commit is contained in:
evilsocket 2019-12-17 16:48:23 +01:00 committed by GitHub
commit cae2a18016
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 1 deletions

View File

@ -113,6 +113,13 @@ class GPS(plugins.Plugin):
),
)
def on_unload(self, ui):
with ui._lock:
ui.remove_element('latitude')
ui.remove_element('longitude')
ui.remove_element('altitude')
def on_ui_update(self, ui):
if self.coordinates and all([
# avoid 0.000... measurements

View File

@ -70,6 +70,10 @@ class MemTemp(plugins.Plugin):
position=h_pos,
label_font=fonts.Small, text_font=fonts.Small))
def on_unload(self, ui):
with ui._lock:
ui.remove_element('memtemp')
def on_ui_update(self, ui):
if self.options['scale'] == "fahrenheit":
temp = (pwnagotchi.temperature() * 9 / 5) + 32

View File

@ -58,5 +58,9 @@ class UPSLite(plugins.Plugin):
ui.add_element('ups', LabeledValue(color=BLACK, label='UPS', value='0%/0V', position=(ui.width() / 2 + 15, 0),
label_font=fonts.Bold, text_font=fonts.Medium))
def on_unload(self, ui):
with ui._lock:
ui.remove_element('ups')
def on_ui_update(self, ui):
ui.set('ups', "%2i%%" % self.ups.capacity())