def refresh(self, task_list): self._block_selection_change = True selected = [(row[0], row[2]) for row in self._get_selected()] # remember name and type # Rebuild model model = self.get_model() if model is None: return model.clear() n_all = self.task_list.get_n_tasks() model.append((_('All Tasks'), n_all, self._type_label, Pango.Weight.BOLD)) # T: "tag" for showing all tasks used_labels = self.task_list.get_labels() for label in self.task_list.task_labels: # explicitly keep sorting from properties if label in used_labels: model.append((label, used_labels[label], self._type_label, Pango.Weight.BOLD)) tags = self.task_list.get_tags() if _NO_TAGS in tags: n_untagged = tags.pop(_NO_TAGS) model.append((_('Untagged'), n_untagged, self._type_untagged, Pango.Weight.NORMAL)) # T: label in tasklist plugins for tasks without a tag model.append(('', 0, self._type_separator, 0)) # separator for tag in natural_sorted(tags): model.append((tag, tags[tag], self._type_tag, Pango.Weight.NORMAL)) # Restore selection def reselect(model, path, iter): row = model[path] name_type = (row[0], row[2]) if name_type in selected: self.get_selection().select_iter(iter) if selected: model.foreach(reselect) self._block_selection_change = False
def refresh(self, task_list): self._block_selection_change = True selected = [(row[0], row[2]) for row in self._get_selected()] # remember name and type # Rebuild model model = self.get_model() if model is None: return model.clear() n_all = self.task_list.get_n_tasks() model.append((_('All Tasks'), n_all, self._type_label, pango.WEIGHT_BOLD)) # T: "tag" for showing all tasks labels = self.task_list.get_labels() plugin = self.task_list.plugin for label in plugin.task_labels: # explicitly keep sorting from preferences if label in labels and label != plugin.next_label: model.append((label, labels[label], self._type_label, pango.WEIGHT_BOLD)) tags = self.task_list.get_tags() if _NO_TAGS in tags: n_untagged = tags.pop(_NO_TAGS) model.append((_('Untagged'), n_untagged, self._type_untagged, pango.WEIGHT_NORMAL)) # T: label in tasklist plugins for tasks without a tag model.append(('', 0, self._type_separator, 0)) # separator for tag in natural_sorted(tags): model.append((tag, tags[tag], self._type_tag, pango.WEIGHT_NORMAL)) # Restore selection def reselect(model, path, iter): row = model[path] name_type = (row[0], row[2]) if name_type in selected: self.get_selection().select_iter(iter) if selected: model.foreach(reselect) self._block_selection_change = False
def refresh(self, qda_codes): self._block_selection_change = True selected = [(row[0], row[2]) for row in self._get_selected()] # remember name and type # Rebuild model model = self.get_model() if model is None: return model.clear() n_all = self.qda_codes.get_n_codes() model.append((_('All Tasks'), n_all, self._type_label, pango.WEIGHT_BOLD)) # T: "tag" for showing all codes labels = self.qda_codes.get_labels() for label in sorted (labels.keys()) : model.append((label, labels[label], self._type_label, pango.WEIGHT_BOLD)) tags = self.qda_codes.get_tags() if _NO_TAGS in tags: n_untagged = tags.pop(_NO_TAGS) model.append((_('Untagged'), n_untagged, self._type_untagged, pango.WEIGHT_NORMAL)) # T: label in qdacodes plugins for codes without a tag model.append(('', 0, self._type_separator, 0)) # separator for tag in natural_sorted(tags): model.append((tag, tags[tag], self._type_tag, pango.WEIGHT_NORMAL)) # Restore selection def reselect(model, path, iter): row = model[path] name_type = (row[0], row[2]) if name_type in selected: self.get_selection().select_iter(iter) if selected: model.foreach(reselect) self._block_selection_change = False