All pastes #375598 Raw Edit

Untitled

public text v1 · immutable
#375598 ·published 2007-02-28 12:57 UTC
rendered paste body
    def populateComboEntry(self, combo, type_, func, sort = None):
        model = gtk.ListStore(gobject.TYPE_STRING, gobject.TYPE_INT)
        combo.set_model(model)
        combo.set_text_column(0)
        result = self.backend.search(type_)
        if sort:
            result.sort(sort)
        for r in result:
            model.append(("%s"%func(r), hasattr(r, "id") and r.id or 0))