def update_pigeon(self, pigeon, rowiter=None, path=None): band, year = pigeon.get_band() data = (0, pigeon, 1, pigeon.get_pindex(), 2, band, 3, year, 4, pigeon.get_name(), 5, pigeon.get_colour(), 6, pigeon.get_sex_string(), 7, pigeon.get_loft(), 8, pigeon.get_strain(), 9, _(pigeon.get_status()), 10, utils.get_sex_image(pigeon.sex)) self.update_row(data, rowiter=rowiter, path=path)
def set_sex(self, sex): try: img = utils.get_sex_image(sex) except KeyError: img = None self._entry.set_text("") else: self._entry.set_text(common.get_sex(sex)) self._entry.set_icon_from_pixbuf(0, img)
def add_pigeon(self, pigeon, select=True): ring, year = pigeon.get_band() row = [ pigeon, pigeon.get_pindex(), ring, year, pigeon.get_name(), pigeon.get_colour(), pigeon.get_sex_string(), pigeon.get_loft(), pigeon.get_strain(), pigeon.get_status(), utils.get_sex_image(pigeon.sex) ] self.add_row(row, select)
def __init__(self): store = gtk.ListStore(int, str, gtk.gdk.Pixbuf) gtk.ComboBox.__init__(self, store) for key, value in common.get_sexdic().items(): store.insert(key, [key, value, utils.get_sex_image(key)]) pb = gtk.CellRendererPixbuf() self.pack_start(pb, expand=False) self.add_attribute(pb, "pixbuf", 2) cell = gtk.CellRendererText() self.pack_start(cell, True) self.add_attribute(cell, "text", 1) self.set_active(0) self.show()
def fill_treeview(self, path=0): self._liststore.clear() for pindex, pigeon in pigeonparser.parser.pigeons.items(): if not config.get( "interface.show-all-pigeons") and not pigeon.get_visible(): continue ring, year = pigeon.get_band() self._liststore.insert(0, [ pigeon, pindex, ring, year, pigeon.get_name(), pigeon.get_colour(), pigeon.get_sex_string(), pigeon.get_loft(), pigeon.get_strain(), pigeon.get_status(), utils.get_sex_image(pigeon.sex) ]) self._selection.select_path(path) self.emit("pigeons-changed")
def set_pigeon(self, pigeon): self.clear_pigeon() pindex_selected = pigeon.get_pindex() pindex_sire_sel = pigeon.get_sire_pindex() pindex_dam_sel = pigeon.get_dam_pindex() for pindex, pigeon in pigeonparser.parser.pigeons.items(): ring, year = pigeon.get_band() pindex_sire = pigeon.get_sire_pindex() pindex_dam = pigeon.get_dam_pindex() sex = pigeon.get_sex() seximg = utils.get_sex_image(sex) # Offspring if pindex_sire == pindex_selected or pindex_dam == pindex_selected: self._liststoreoff.insert(0, [pigeon, ring, year, sex, seximg]) # Half relatives if pindex_sire_sel and pindex_sire_sel == pindex_sire and not\ (pindex_sire_sel == pindex_sire and pindex_dam_sel == pindex_dam): self._liststorehalf.insert(0, [pigeon, ring, year, pigeon.get_sire_string(True), sex, seximg]) if pindex_dam_sel and pindex_dam_sel == pindex_dam and not\ (pindex_sire_sel == pindex_sire and pindex_dam_sel == pindex_dam): self._liststorehalf.insert(0, [pigeon, ring, year, pigeon.get_dam_string(True), sex, seximg]) # Direct relatives # We need both sire and dam to retrieve these if not pindex_sire_sel or not pindex_dam_sel: continue if pindex_sire_sel == pindex_sire and pindex_dam_sel == pindex_dam\ and not pindex == pindex_selected: self._liststoredirect.insert(0, [pigeon, ring, year, sex, seximg]) self._liststoredirect.set_sort_column_id(1, gtk.SORT_ASCENDING) self._liststoredirect.set_sort_column_id(2, gtk.SORT_ASCENDING) self._liststorehalf.set_sort_column_id(1, gtk.SORT_ASCENDING) self._liststorehalf.set_sort_column_id(2, gtk.SORT_ASCENDING) self._liststoreoff.set_sort_column_id(1, gtk.SORT_ASCENDING) self._liststoreoff.set_sort_column_id(2, gtk.SORT_ASCENDING)