diff --git a/src/fime/main.py b/src/fime/main.py index 937cac8..6b3b8c8 100755 --- a/src/fime/main.py +++ b/src/fime/main.py @@ -75,23 +75,22 @@ class App: def update_tray_menu(self): def add_tasks(tasks): - action_height = None for t in tasks: - a = self.menu.addAction(t) - action_height = self.menu.actionGeometry(a).height() - a.triggered.connect(partial(self.change_task, t)) + action = self.menu.addAction(t) + action.triggered.connect(partial(self.change_task, t)) if t == self.active_task: - a.setIcon(QtGui.QIcon.fromTheme("go-next")) - return action_height + action.setIcon(QtGui.QIcon.fromTheme("go-next")) + + tmp_action = self.menu.addAction("tmp") + action_height = self.menu.actionGeometry(tmp_action).height() self.menu.clear() + add_tasks(self.tasks.tasks) - action_height = add_tasks(self.tasks.tasks) + self.menu.addSeparator() already_taken = (len(self.tasks.tasks) + 4) * action_height available_space = get_screen_height(self.menu) * 0.8 - already_taken jira_entry_count = int(available_space // action_height) - - self.menu.addSeparator() add_tasks(self.tasks.jira_tasks[:jira_entry_count]) self.menu.addSeparator()