Next iteration of preventing misleading data flows
This commit is contained in:
parent
74e974b7ab
commit
99b327cf39
@ -4,6 +4,7 @@ import signal
|
||||
import sys
|
||||
from functools import partial
|
||||
from pathlib import Path
|
||||
from typing import Optional
|
||||
|
||||
from loguru import logger
|
||||
|
||||
@ -67,6 +68,8 @@ class App:
|
||||
self.tray.setToolTip("fime")
|
||||
self.update_tray_menu()
|
||||
|
||||
self.last_dialog: Optional[QtWidgets.QDialog] = None
|
||||
|
||||
@QtCore.Slot()
|
||||
def new_task_imported(self):
|
||||
if self.import_task.task_text:
|
||||
@ -92,11 +95,21 @@ class App:
|
||||
self.tray.setToolTip(f"{task} - fime")
|
||||
self.update_tray_menu()
|
||||
|
||||
def close_open_dialog(self):
|
||||
if self.last_dialog and self.last_dialog.isVisible():
|
||||
self.last_dialog.reject()
|
||||
|
||||
def change_task(self, task):
|
||||
self.close_open_dialog()
|
||||
self.active_task = task
|
||||
self.log.log(task)
|
||||
self.tasks.update_jira_task_usage(task)
|
||||
|
||||
def open_new_dialog(self, new_dialog: QtWidgets.QDialog):
|
||||
self.close_open_dialog()
|
||||
self.last_dialog = new_dialog
|
||||
new_dialog.show()
|
||||
|
||||
def update_tray_menu(self):
|
||||
menu_items = []
|
||||
tmp_action = self.menu.addAction("tmp")
|
||||
@ -121,14 +134,14 @@ 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.taskEdit.show))
|
||||
menu_items.append(("Report", self.reportDialog.show))
|
||||
menu_items.append(("Worklog", self.worklogDialog.show))
|
||||
menu_items.append(("Import Jira task", partial(self.open_new_dialog, self.import_task)))
|
||||
menu_items.append(("Edit tasks", partial(self.open_new_dialog, self.taskEdit)))
|
||||
menu_items.append(("Report", partial(self.open_new_dialog, self.reportDialog)))
|
||||
menu_items.append(("Worklog", partial(self.open_new_dialog, self.worklogDialog)))
|
||||
|
||||
menu_items.append((1, None))
|
||||
|
||||
menu_items.append(("About", self.about.show))
|
||||
menu_items.append(("About", partial(self.open_new_dialog, self.about)))
|
||||
menu_items.append(("Close", self.app.quit))
|
||||
|
||||
if self.menu_flipped:
|
||||
|
Loading…
Reference in New Issue
Block a user