def on_cell_modified(self, renderer, path, newText, data=None): model, curIter = self.abbrList.get_selection().get_selected() oldText = model.get_value(curIter, 0) or "" if EMPTY_FIELD_REGEX.match(newText) and EMPTY_FIELD_REGEX.match(oldText): self.on_removeButton_clicked(renderer) else: model.set(curIter, 0, newText)
def get_abbrs(self): ret = [] model = self.abbrList.get_model() i = iter(model) try: while True: text = model.get_value(i.next().iter, 0) ret.append(text.decode("utf-8")) except StopIteration: pass return list(set(ret))
def on_cell_editing_cancelled(self, renderer, data=None): model, curIter = self.abbrList.get_selection().get_selected() oldText = model.get_value(curIter, 0) or "" self.on_cell_modified(renderer, None, oldText)