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))