/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-03-02 15:24:46 UTC
  • Revision ID: jelmer@samba.org-20110302152446-q8iogg8f2rweh25s
startĀ onĀ 0.101.0

Show diffs side-by-side

added added

removed removed

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