Merge pull request #13 from xBelladonna/clock/custom-date

Enable custom date format in config
This commit is contained in:
Simone Margaritelli 2020-06-26 14:17:50 +02:00 committed by GitHub
commit 9a80592597
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -17,6 +17,11 @@ class PwnClock(plugins.Plugin):
__description__ = 'Clock/Calendar for pwnagotchi'
def on_loaded(self):
if 'date_format' in self.options:
self.date_format = self.options['date_format']
else:
self.date_format = "%m/%d/%y"
logging.info("Pwnagotchi Clock Plugin loaded.")
def on_ui_setup(self, ui):
@ -42,5 +47,5 @@ class PwnClock(plugins.Plugin):
def on_ui_update(self, ui):
now = datetime.datetime.now()
time_rn = now.strftime("%m/%d/%y\n%I:%M%p")
time_rn = now.strftime(self.date_format + "\n%I:%M %p")
ui.set('clock', time_rn)