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