/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: Jelmer Vernooij
  • Date: 2011-04-10 18:44:39 UTC
  • mto: This revision was merged to the branch mainline in revision 730.
  • Revision ID: jelmer@samba.org-20110410184439-g7hqaacexqtviq13
Move i18n support to a separate file, so gettext files aren't loaded unless bzr-gtk is used.

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
 
23
23
import gtk
24
24
 
 
25
 
25
26
class PluginsPage(gtk.VPaned):
 
27
 
26
28
    def __init__(self):
27
29
        gtk.VPaned.__init__(self)
 
30
        self.set_border_width(12)
 
31
        self.set_position(216)
 
32
 
28
33
        scrolledwindow = gtk.ScrolledWindow()
29
34
        scrolledwindow.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
 
35
        scrolledwindow.set_shadow_type(gtk.SHADOW_IN)
30
36
        self.model = gtk.ListStore(str, str)
31
37
        treeview = gtk.TreeView()
32
38
        scrolledwindow.add(treeview)
33
39
        self.pack1(scrolledwindow, resize=True, shrink=False)
34
40
 
35
41
        self.table = gtk.Table(columns=2)
 
42
        self.table.set_border_width(12)
36
43
        self.table.set_row_spacings(6)
37
44
        self.table.set_col_spacings(6)
38
45
 
51
58
        column.pack_start(cell, expand=True)
52
59
        column.add_attribute(cell, "text", 1)
53
60
        treeview.append_column(column)
54
 
        
 
61
 
55
62
        import bzrlib.plugin
56
63
        plugins = bzrlib.plugin.plugins()
57
64
        plugin_names = plugins.keys()
58
65
        plugin_names.sort()
59
66
        for name in plugin_names:
60
67
            self.model.append([name, getattr(plugins[name], '__file__', None)])
61
 
                 
 
68
 
62
69
        scrolledwindow = gtk.ScrolledWindow()
63
70
        scrolledwindow.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
64
71
        scrolledwindow.add_with_viewport(self.table)
67
74
 
68
75
    def row_selected(self, tv, path, tvc):
69
76
        import bzrlib
70
 
        p = bzrlib.plugin.plugins()[self.model[path][0]]
 
77
        p = bzrlib.plugin.plugins()[self.model[path][0]].module
71
78
        from inspect import getdoc
72
79
 
73
80
        for w in self.table.get_children():
74
81
            self.table.remove(w)
75
82
 
76
83
        if getattr(p, '__author__', None) is not None:
77
 
            align = gtk.Alignment(1.0, 0.5)
 
84
            align = gtk.Alignment(0.0, 0.5)
78
85
            label = gtk.Label()
79
86
            label.set_markup("<b>Author:</b>")
80
87
            align.add(label)
90
97
            self.table.attach(align, 1, 2, 0, 1, gtk.EXPAND | gtk.FILL, gtk.FILL)
91
98
 
92
99
        if getattr(p, '__version__', None) is not None:
93
 
            align = gtk.Alignment(1.0, 0.5)
 
100
            align = gtk.Alignment(0.0, 0.5)
94
101
            label = gtk.Label()
95
102
            label.set_markup("<b>Version:</b>")
96
103
            align.add(label)