~parthpanchl/gtg/workspace2

« back to all changes in this revision

Viewing changes to GTG/gtk/backends_dialog/backendscombo.py

  • Committer: Parin Porecha
  • Date: 2014-01-31 06:59:35 UTC
  • mfrom: (1240.2.94 port-to-gtk3-py3)
  • Revision ID: parinporecha@gmail.com-20140131065935-ub6evnrwpmmm25hz
Merged the gtk3 and python3 port with GTG trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
# this program.  If not, see <http://www.gnu.org/licenses/>.
18
18
# -----------------------------------------------------------------------------
19
19
 
20
 
import gtk
 
20
from gi.repository import Gtk
 
21
from gi.repository import GdkPixbuf
21
22
 
22
23
from GTG.backends import BackendFactory
23
24
 
24
25
 
25
 
class BackendsCombo(gtk.ComboBoxEntry):
 
26
class BackendsCombo(Gtk.ComboBox):
26
27
    '''
27
28
    A combobox listing all the available backends types
28
29
    '''
39
40
        @param backends_dialog: reference to the dialog in which this combo is
40
41
                                loaded.
41
42
        '''
42
 
        super(BackendsCombo, self).__init__()
 
43
        Gtk.ComboBox.__init__(self)
43
44
        self.dialog = backends_dialog
44
45
        self._liststore_init()
45
46
        self._renderers_init()
47
48
        self.show_all()
48
49
 
49
50
    def _liststore_init(self):
50
 
        '''Setup the gtk.ListStore'''
51
 
        self.liststore = gtk.ListStore(str, str, gtk.gdk.Pixbuf)
 
51
        '''Setup the Gtk.ListStore'''
 
52
        self.liststore = Gtk.ListStore(str, str, GdkPixbuf.Pixbuf)
52
53
        self.set_model(self.liststore)
53
54
 
54
55
    def _renderers_init(self):
55
56
        '''Configure the cell renderers'''
56
57
        # Text renderer
57
 
        text_cell = gtk.CellRendererText()
 
58
        text_cell = Gtk.CellRendererText()
58
59
        self.pack_start(text_cell, False)
59
 
        self.set_text_column(self.COLUMN_HUMAN_NAME)
 
60
        self.add_attribute(text_cell, 'text', 1)
60
61
        # Icon renderer
61
 
        pixbuf_cell = gtk.CellRendererPixbuf()
 
62
        pixbuf_cell = Gtk.CellRendererPixbuf()
62
63
        self.pack_start(pixbuf_cell, False)
63
64
        self.add_attribute(pixbuf_cell, "pixbuf", self.COLUMN_ICON)
64
65
 
68
69
        '''
69
70
        self.liststore.clear()
70
71
        backend_types = BackendFactory().get_all_backends()
71
 
        for name, module in backend_types.iteritems():
 
72
        for name, module in backend_types.items():
72
73
            # FIXME: Disable adding another localfile backend.
73
74
            # It just produce many warnings, provides no use case
74
75
            # See LP bug #940917 (Izidor)