Skip to content

Commit

Permalink
Merge branch 'devel' of https://github.com/ZeroPhone/ZPUI into devel
Browse files Browse the repository at this point in the history
  • Loading branch information
CRImier committed Feb 19, 2019
2 parents 6944b29 + 5ed3fe3 commit f6221a5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions ui/loading_indicators.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def set_message(self, new_message):
self.refresh()

def run_in_background(self):
if self.t is not None or self.in_foreground:
if self.t is not None or self.is_active:
raise Exception("BaseLoadingIndicator already running!")
self.t = Thread(target=self.activate, name="Background thread for LoadingIndicator {}".format(self.name))
self.t.daemon = True
Expand All @@ -67,6 +67,7 @@ def stop(self):

def __enter__(self):
self.run_in_background()
self.wait_for_active()
return self

def __exit__(self, exc_type, exc_val, exc_tb):
Expand Down Expand Up @@ -104,10 +105,9 @@ def __init__(self, i, o, *args, **kwargs):
self.message = kwargs.pop("message", None)
BaseLoadingIndicator.__init__(self, i, o, refresh_interval=0.01, *args, **kwargs)

def activate(self):
def before_activate(self):
self.start_time = time()
self.counter.start()
return Refresher.activate(self)

@to_be_foreground
def refresh(self):
Expand Down
2 changes: 1 addition & 1 deletion ui/menu.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def __init__(self, *args, **kwargs):
* ``name``: Menu name which can be used internally and for debugging.
* ``entry_height``: number of display rows one menu entry occupies.
* ``append_exit``: Appends an "Exit" alement to menu contents.
* ``append_exit``: Appends an "Exit" element to menu contents.
* ``catch_exit``: If ``MenuExitException`` is received and catch_exit is False, it passes ``MenuExitException`` to the parent menu so that it exits, too. If catch_exit is True, MenuExitException is not passed along.
* ``exitable``: Decides if menu can exit by pressing ``KEY_LEFT``. Set by default and disables ``KEY_LEFT`` callback if unset. Is used for ZPUI main menu, not advised to be used in other settings.
* ``contents_hook``: A function that is called every time menu goes in foreground that returns new menu contents. Allows to almost-dynamically update menu contents.
Expand Down

0 comments on commit f6221a5

Please sign in to comment.