def format_menu_label(self, task): if "project" in task: proj = task["project"].split(".")[-1] else: proj = "None" title = u"%s:\t%s" % (proj, util.strip_description(task["description"])) return title
def set_tasks(self, tasks): """ Update tasks in the tray menu Updates placeholder menu items with real data, proper icons and visibility. """ for idx, item in enumerate(self.task_items): if idx >= len(tasks): item.hide() else: task = tasks[idx] desc = util.strip_description(task.get_summary()) if task.is_active(): label = item.get_children()[0] label.set_markup("<b>%s</b>" % desc) icon = gtk.image_new_from_stock(self.ACTIVE_ICON, gtk.ICON_SIZE_MENU) item.set_image(icon) else: item.set_label(desc) item.set_image(None) item.set_data("task", task) item.show() if tasks: self.separator.show() else: self.separator.hide()
def refresh_table(self): if self.show_all_button.get_active(): tasks = self.all_tasks else: tasks = self.tasks self.model.clear() for task in sorted(tasks, key=self.task_sort_func): row = [task["uuid"], task["status"], task["project"], util.strip_description(task["description"]), "%.1f" % float(task["urgency"]), task.get("priority", "L")] self.model.append(row) title = "Search for tasks (%u)" % len(tasks) self.set_title(title)
def refresh_table(self): if self.show_all_button.get_active(): tasks = self.all_tasks else: tasks = self.tasks self.model.clear() for task in sorted(tasks, key=self.task_sort_func): row = [ task.id(), task["status"], task.get_project(), util.strip_description(task.get_summary()), "%.1f" % float(task["urgency"]), task.get("priority", "L"), task.is_started(), task.get_summary() ] self.model.append(row) title = "Search for tasks (%u)" % len(tasks) self.set_title(title)