Skip to content

Commit

Permalink
Merge pull request #735 from dadav/fix/add_unload
Browse files Browse the repository at this point in the history
add unload method
  • Loading branch information
evilsocket authored Dec 17, 2019
2 parents f141e15 + 9d63eba commit cae2a18
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
7 changes: 7 additions & 0 deletions pwnagotchi/plugins/default/gps.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,13 @@ def on_ui_setup(self, ui):
),
)


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
Expand Down
6 changes: 5 additions & 1 deletion pwnagotchi/plugins/default/memtemp.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ def on_ui_setup(self, ui):
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
Expand All @@ -78,7 +82,7 @@ def on_ui_update(self, ui):
temp = pwnagotchi.temperature() + 273.15
symbol = "k"
else:
# default to celsius
# default to celsius
temp = pwnagotchi.temperature()
symbol = "c"

Expand Down
4 changes: 4 additions & 0 deletions pwnagotchi/plugins/default/ups_lite.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,5 +58,9 @@ def on_ui_setup(self, ui):
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())

0 comments on commit cae2a18

Please sign in to comment.