diff --git a/bumblebee_status/modules/core/vault.py b/bumblebee_status/modules/core/vault.py index 62f1198..0ec4257 100644 --- a/bumblebee_status/modules/core/vault.py +++ b/bumblebee_status/modules/core/vault.py @@ -48,7 +48,7 @@ def build_menu(parent, current_directory, callback): ) else: - submenu = util.popup.menu(parent, leave=True) + submenu = util.popup.menu(parent, leave=False) build_menu( submenu, os.path.join(current_directory, entry.name), callback ) @@ -88,6 +88,7 @@ class Module(core.module.Module): "pass show -c {}".format(secret_name), wait=False, env=env, + ignore_errors=True, ) self.__timer = threading.Timer(self.__duration, self.__reset) self.__timer.start() diff --git a/bumblebee_status/util/popup.py b/bumblebee_status/util/popup.py index cf69d9a..85fe50b 100644 --- a/bumblebee_status/util/popup.py +++ b/bumblebee_status/util/popup.py @@ -15,6 +15,8 @@ class menu(object): """ def __init__(self, parent=None, leave=True): + self.running = True + self.parent = None if not parent: self._root = tk.Tk() self._root.withdraw() @@ -25,9 +27,12 @@ class menu(object): self._root.withdraw() self._menu = tk.Menu(self._root, tearoff=0) self._menu.bind("", self.__on_focus_out) + self.parent = parent if leave: self._menu.bind("", self.__on_focus_out) + self._menu.bind("", self.release) + """Returns the root node of this menu :return: root node @@ -51,6 +56,11 @@ class menu(object): self._root.destroy() callback() + def release(self, event=None): + self.running=False + if self.parent: + self.parent.release(event) + """Adds a cascading submenu to the current menu :param menuitem: label to display for the submenu @@ -88,7 +98,17 @@ class menu(object): self._menu.tk_popup(event["x"] + offset_x, event["y"] + offset_y) finally: self._menu.grab_release() - self._root.mainloop() + + while self.running == True: + try: + self._root.update_idletasks() + self._root.update() + except: + self.running = False + try: + self._root.destroy() + except: + pass # vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4