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