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