From 0b9e415e0855b6981205b3cab883311678435edb Mon Sep 17 00:00:00 2001 From: Faerbit Date: Wed, 2 Feb 2022 21:49:37 +0100 Subject: [PATCH] No clicky clicky --- src/fime/main.py | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/src/fime/main.py b/src/fime/main.py index 53926b8..461b477 100755 --- a/src/fime/main.py +++ b/src/fime/main.py @@ -41,6 +41,7 @@ class App: self.menu_flipped = config.flip_menu self.menu = QtWidgets.QMenu(None) + self.menu.aboutToShow.connect(self.no_clickyclicky) self.import_task = ImportTask(config, None) self.import_task.accepted.connect(self.new_task_imported) @@ -61,19 +62,24 @@ class App: self.tray.setToolTip("fime") self.update_tray_menu() + self.clicky = False + @QtCore.Slot() def new_task_imported(self): + self.clicky = False if self.import_task.task_text: self.tasks.add_jira_task(self.import_task.task_text) - self.update_tray_menu() + self.update_tray_menu() @QtCore.Slot() def tasks_edited(self): + self.clicky = False self.tasks.tasks = self.taskEdit.tasks self.update_tray_menu() @QtCore.Slot() def log_edited(self): + self.clicky = False self.active_task = self.log.last_log() or "Nothing" @property @@ -91,6 +97,16 @@ class App: self.log.log(task) self.tasks.update_jira_task_usage(task) + @QtCore.Slot() + def no_clickyclicky(self): + if self.clicky: + self.menu.clear() + raise FimeException("No clicky clicky!!") + + def click(self, f): + self.clicky = True + f() + def update_tray_menu(self): menu_items = [] tmp_action = self.menu.addAction("tmp") @@ -115,10 +131,10 @@ class App: add_tasks(["Nothing"]) menu_items.append((1, None)) - menu_items.append(("Import Jira task", self.import_task.show)) - menu_items.append(("Edit tasks", self.edit_tasks)) - menu_items.append(("Report", self.reportDialog.show)) - menu_items.append(("Worklog", self.worklogDialog.show)) + menu_items.append(("Import Jira task", partial(self.click, self.import_task.show))) + menu_items.append(("Edit tasks", partial(self.click, self.edit_tasks))) + menu_items.append(("Report", partial(self.click, self.reportDialog.show))) + menu_items.append(("Worklog", partial(self.click, self.worklogDialog.show))) menu_items.append((1, None))