forked from evilsocket/pwnagotchi-plugins-contrib
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdisplay_version.py
36 lines (30 loc) · 1.01 KB
/
display_version.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
from pwnagotchi.ui.components import LabeledValue
from pwnagotchi.ui.view import BLACK
import pwnagotchi.plugins as plugins
import pwnagotchi.ui.fonts as fonts
import pwnagotchi
import logging
class PwnagotchiVersion(plugins.Plugin):
__author__ = 'https://github.com/Teraskull/'
__version__ = '1.0.1'
__license__ = 'GPL3'
__description__ = 'A plugin that will add the Pwnagotchi version to the left of the current mode.'
def on_loaded(self):
logging.info('[display_version] Plugin loaded.')
def on_ui_setup(self, ui):
ui.add_element(
'version',
LabeledValue(
color=BLACK,
label='',
value='v0.0.0',
position=(185, 110),
label_font=fonts.Small,
text_font=fonts.Small
)
)
def on_ui_update(self, ui):
ui.set('version', f'v{pwnagotchi.__version__}')
def on_unload(self, ui):
with ui._lock:
ui.remove_element("version")