/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: 2008-06-29 18:12:29 UTC
  • mto: This revision was merged to the branch mainline in revision 519.
  • Revision ID: jelmer@samba.org-20080629181229-1l2m4cf7vvbyh8qg
Simplify progress bar code, use embedded progress bar inside viz window.

Show diffs side-by-side

added added

removed removed

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