/b-gtk/fix-viz

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/b-gtk/fix-viz

« back to all changes in this revision

Viewing changes to preferences/plugins.py

  • Committer: Daniel Schierbeck
  • Date: 2008-04-02 15:54:41 UTC
  • mto: (450.1.15 trunk)
  • mto: This revision was merged to the branch mainline in revision 458.
  • Revision ID: daniel.schierbeck@gmail.com-20080402155441-74e59l7irxo50ju5
Added attribution for tag icon.

Show diffs side-by-side

added added

removed removed

Lines of Context:
27
27
        gtk.VPaned.__init__(self)
28
28
        scrolledwindow = gtk.ScrolledWindow()
29
29
        scrolledwindow.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
30
 
        self.model = gtk.ListStore(str, str)
 
30
        model = gtk.ListStore(str, str)
31
31
        treeview = gtk.TreeView()
32
32
        scrolledwindow.add(treeview)
33
33
        self.pack1(scrolledwindow, resize=True, shrink=False)
34
34
 
35
 
        self.table = gtk.Table(columns=2)
36
 
        self.table.set_row_spacings(6)
37
 
        self.table.set_col_spacings(6)
 
35
        table = gtk.Table(columns=2)
 
36
        table.set_row_spacings(6)
 
37
        table.set_col_spacings(6)
38
38
 
39
39
        treeview.set_headers_visible(False)
40
 
        treeview.set_model(self.model)
 
40
        treeview.set_model(model)
41
41
        treeview.connect("row-activated", self.row_selected)
42
42
 
43
43
        cell = gtk.CellRendererText()
57
57
        plugin_names = plugins.keys()
58
58
        plugin_names.sort()
59
59
        for name in plugin_names:
60
 
            self.model.append([name, getattr(plugins[name], '__file__', None)])
 
60
            model.append([name, getattr(plugins[name], '__file__', None)])
61
61
                 
62
62
        scrolledwindow = gtk.ScrolledWindow()
63
63
        scrolledwindow.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
64
 
        scrolledwindow.add_with_viewport(self.table)
 
64
        scrolledwindow.add_with_viewport(table)
65
65
        self.pack2(scrolledwindow, resize=False, shrink=True)
66
66
        self.show()
67
67
 
68
68
    def row_selected(self, tv, path, tvc):
69
 
        import bzrlib
70
 
        p = bzrlib.plugin.plugins()[self.model[path][0]]
 
69
        p = bzrlib.plugin.plugins()[model[path][0]]
71
70
        from inspect import getdoc
72
71
 
73
 
        for w in self.table.get_children():
74
 
            self.table.remove(w)
 
72
        for w in table.get_children():
 
73
            table.remove(w)
75
74
 
76
75
        if getattr(p, '__author__', None) is not None:
77
76
            align = gtk.Alignment(1.0, 0.5)
78
77
            label = gtk.Label()
79
78
            label.set_markup("<b>Author:</b>")
80
79
            align.add(label)
81
 
            self.table.attach(align, 0, 1, 0, 1, gtk.FILL, gtk.FILL)
 
80
            table.attach(align, 0, 1, 0, 1, gtk.FILL, gtk.FILL)
82
81
            align.show()
83
82
            label.show()
84
83
 
87
86
            author.set_text(p.__author__)
88
87
            author.set_selectable(True)
89
88
            align.add(author)
90
 
            self.table.attach(align, 1, 2, 0, 1, gtk.EXPAND | gtk.FILL, gtk.FILL)
 
89
            table.attach(align, 1, 2, 0, 1, gtk.EXPAND | gtk.FILL, gtk.FILL)
91
90
 
92
91
        if getattr(p, '__version__', None) is not None:
93
92
            align = gtk.Alignment(1.0, 0.5)
94
93
            label = gtk.Label()
95
94
            label.set_markup("<b>Version:</b>")
96
95
            align.add(label)
97
 
            self.table.attach(align, 0, 1, 0, 1, gtk.FILL, gtk.FILL)
 
96
            table.attach(align, 0, 1, 0, 1, gtk.FILL, gtk.FILL)
98
97
            align.show()
99
98
            label.show()
100
99
 
103
102
            author.set_text(p.__version__)
104
103
            author.set_selectable(True)
105
104
            align.add(author)
106
 
            self.table.attach(align, 1, 2, 0, 1, gtk.EXPAND | gtk.FILL, gtk.FILL)
 
105
            table.attach(align, 1, 2, 0, 1, gtk.EXPAND | gtk.FILL, gtk.FILL)
107
106
 
108
107
        if getdoc(p) is not None:
109
108
            align = gtk.Alignment(0.0, 0.5)
111
110
            description.set_text(getdoc(p))
112
111
            description.set_selectable(True)
113
112
            align.add(description)
114
 
            self.table.attach(align, 0, 2, 1, 2, gtk.EXPAND | gtk.FILL, gtk.FILL)
 
113
            table.attach(align, 0, 2, 1, 2, gtk.EXPAND | gtk.FILL, gtk.FILL)
115
114
 
116
 
        self.table.show_all()
 
115
        table.show_all()
117
116
 
118
117