def get_current_iter(self): entry = self.child model = self.get_model() itr = model.get_iter_first() while itr and model.get_value(itr, 0) != self.current_status: itr = model.iter_next(itr) while itr and model.get_value(itr, 0) == self.current_status: if model.get_value(itr, 1) == util.escape_markup(entry.get_text()): return itr itr = model.iter_next(itr) return None
def set(self, values): model = self.widget.get_model() model.clear() model.append([STAT_ON, 'On', '', True, True]) model.append([STAT_AFK, 'Afk', '', True, True]) model.append([STAT_INVISIBLE, 'Invisible', '', True, False]) model.append([STAT_OFF, 'Off', '', True, False]) for row in values: stat, msg, autoreply_msg = row msg = util.escape_markup(msg) model.append([stat, msg, autoreply_msg, False, stat in (STAT_ON, STAT_AFK),])
def entry_activate_cb(self, widget, *args): icon = widget.get_icon_pixbuf(0) txt = util.escape_markup(widget.get_text()) model = self.get_model() itr = model.get_iter_first() while itr and self.current_status != model.get_value(itr, 0): itr = model.iter_next(itr) while itr and self.current_status == model.get_value(itr, 0): if txt == '' and True == model.get_value(itr, 3): widget.set_text(model.get_value(itr, 1)) widget.modify_text(gtk.STATE_NORMAL, gtk.gdk.color_parse('#CCCCCC')) return if model.get_value(itr, 1) == txt: return itr = model.iter_next(itr) self.set_active_iter(model.insert_before(itr, [self.current_status, txt, '\x01', False, True]))
def get_or_create_group(self, group): itr = self.get_group_itr_by_name(group) if itr is None and self.grouping: self.piters[group] = self.get_model().append(None, [group, '<span><big><b>%s</b></big></span>' % util.escape_markup(group), '', '', '', '', None, None]) self.expand_row(self.get_model().get_path(self.piters[group]), True) return self.piters[group] else: return itr