/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: Curtis Hovey
  • Date: 2011-07-31 15:52:43 UTC
  • mto: This revision was merged to the branch mainline in revision 741.
  • Revision ID: sinzui.is@verizon.net-20110731155243-ln8istmxbryhb4pz
Mechanical changes made by pygi.convert.sh.

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
except:
21
21
    pass
22
22
 
23
 
import gtk
24
 
 
25
 
class PluginsPage(gtk.VPaned):
 
23
from gi.repository import Gtk
 
24
 
 
25
 
 
26
class PluginsPage(Gtk.VPaned):
 
27
 
26
28
    def __init__(self):
27
 
        gtk.VPaned.__init__(self)
28
 
        scrolledwindow = gtk.ScrolledWindow()
29
 
        scrolledwindow.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
30
 
        self.model = gtk.ListStore(str, str)
31
 
        treeview = gtk.TreeView()
 
29
        GObject.GObject.__init__(self)
 
30
        self.set_border_width(12)
 
31
        self.set_position(216)
 
32
 
 
33
        scrolledwindow = Gtk.ScrolledWindow()
 
34
        scrolledwindow.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
 
35
        scrolledwindow.set_shadow_type(Gtk.ShadowType.IN)
 
36
        self.model = Gtk.ListStore(str, str)
 
37
        treeview = Gtk.TreeView()
32
38
        scrolledwindow.add(treeview)
33
39
        self.pack1(scrolledwindow, resize=True, shrink=False)
34
40
 
35
 
        self.table = gtk.Table(columns=2)
 
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
 
40
47
        treeview.set_model(self.model)
41
48
        treeview.connect("row-activated", self.row_selected)
42
49
 
43
 
        cell = gtk.CellRendererText()
44
 
        column = gtk.TreeViewColumn()
45
 
        column.pack_start(cell, expand=True)
 
50
        cell = Gtk.CellRendererText()
 
51
        column = Gtk.TreeViewColumn()
 
52
        column.pack_start(cell, True, True, 0)
46
53
        column.add_attribute(cell, "text", 0)
47
54
        treeview.append_column(column)
48
55
 
49
 
        cell = gtk.CellRendererText()
50
 
        column = gtk.TreeViewColumn()
51
 
        column.pack_start(cell, expand=True)
 
56
        cell = Gtk.CellRendererText()
 
57
        column = Gtk.TreeViewColumn()
 
58
        column.pack_start(cell, True, True, 0)
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
 
                 
62
 
        scrolledwindow = gtk.ScrolledWindow()
63
 
        scrolledwindow.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
 
68
 
 
69
        scrolledwindow = Gtk.ScrolledWindow()
 
70
        scrolledwindow.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
64
71
        scrolledwindow.add_with_viewport(self.table)
65
72
        self.pack2(scrolledwindow, resize=False, shrink=True)
66
73
        self.show()
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)
78
 
            label = gtk.Label()
 
84
            align = Gtk.Alignment.new(0.0, 0.5)
 
85
            label = Gtk.Label()
79
86
            label.set_markup("<b>Author:</b>")
80
87
            align.add(label)
81
 
            self.table.attach(align, 0, 1, 0, 1, gtk.FILL, gtk.FILL)
 
88
            self.table.attach(align, 0, 1, 0, 1, Gtk.AttachOptions.FILL, Gtk.AttachOptions.FILL)
82
89
            align.show()
83
90
            label.show()
84
91
 
85
 
            align = gtk.Alignment(0.0, 0.5)
86
 
            author = gtk.Label()
 
92
            align = Gtk.Alignment.new(0.0, 0.5)
 
93
            author = Gtk.Label()
87
94
            author.set_text(p.__author__)
88
95
            author.set_selectable(True)
89
96
            align.add(author)
90
 
            self.table.attach(align, 1, 2, 0, 1, gtk.EXPAND | gtk.FILL, gtk.FILL)
 
97
            self.table.attach(align, 1, 2, 0, 1, Gtk.AttachOptions.EXPAND | Gtk.AttachOptions.FILL, Gtk.AttachOptions.FILL)
91
98
 
92
99
        if getattr(p, '__version__', None) is not None:
93
 
            align = gtk.Alignment(1.0, 0.5)
94
 
            label = gtk.Label()
 
100
            align = Gtk.Alignment.new(0.0, 0.5)
 
101
            label = Gtk.Label()
95
102
            label.set_markup("<b>Version:</b>")
96
103
            align.add(label)
97
 
            self.table.attach(align, 0, 1, 0, 1, gtk.FILL, gtk.FILL)
 
104
            self.table.attach(align, 0, 1, 0, 1, Gtk.AttachOptions.FILL, Gtk.AttachOptions.FILL)
98
105
            align.show()
99
106
            label.show()
100
107
 
101
 
            align = gtk.Alignment(0.0, 0.5)
102
 
            author = gtk.Label()
 
108
            align = Gtk.Alignment.new(0.0, 0.5)
 
109
            author = Gtk.Label()
103
110
            author.set_text(p.__version__)
104
111
            author.set_selectable(True)
105
112
            align.add(author)
106
 
            self.table.attach(align, 1, 2, 0, 1, gtk.EXPAND | gtk.FILL, gtk.FILL)
 
113
            self.table.attach(align, 1, 2, 0, 1, Gtk.AttachOptions.EXPAND | Gtk.AttachOptions.FILL, Gtk.AttachOptions.FILL)
107
114
 
108
115
        if getdoc(p) is not None:
109
 
            align = gtk.Alignment(0.0, 0.5)
110
 
            description = gtk.Label()
 
116
            align = Gtk.Alignment.new(0.0, 0.5)
 
117
            description = Gtk.Label()
111
118
            description.set_text(getdoc(p))
112
119
            description.set_selectable(True)
113
120
            align.add(description)
114
 
            self.table.attach(align, 0, 2, 1, 2, gtk.EXPAND | gtk.FILL, gtk.FILL)
 
121
            self.table.attach(align, 0, 2, 1, 2, Gtk.AttachOptions.EXPAND | Gtk.AttachOptions.FILL, Gtk.AttachOptions.FILL)
115
122
 
116
123
        self.table.show_all()
117
124