108
def _create_pluginpage(self):
110
scrolledwindow = gtk.ScrolledWindow()
111
scrolledwindow.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
112
model = gtk.ListStore(str, str)
113
treeview = gtk.TreeView()
114
scrolledwindow.add(treeview)
115
paned.pack1(scrolledwindow, resize=True, shrink=False)
117
table = gtk.Table(columns=2)
118
table.set_row_spacings(6)
119
table.set_col_spacings(6)
121
def row_selected(tv, path, tvc):
122
p = bzrlib.plugin.plugins()[model[path][0]]
123
from inspect import getdoc
125
for w in table.get_children():
128
if getattr(p, '__author__', None) is not None:
129
align = gtk.Alignment(1.0, 0.5)
131
label.set_markup("<b>Author:</b>")
133
table.attach(align, 0, 1, 0, 1, gtk.FILL, gtk.FILL)
137
align = gtk.Alignment(0.0, 0.5)
139
author.set_text(p.__author__)
140
author.set_selectable(True)
142
table.attach(align, 1, 2, 0, 1, gtk.EXPAND | gtk.FILL, gtk.FILL)
144
if getattr(p, '__version__', None) is not None:
145
align = gtk.Alignment(1.0, 0.5)
147
label.set_markup("<b>Version:</b>")
149
table.attach(align, 0, 1, 0, 1, gtk.FILL, gtk.FILL)
153
align = gtk.Alignment(0.0, 0.5)
155
author.set_text(p.__version__)
156
author.set_selectable(True)
158
table.attach(align, 1, 2, 0, 1, gtk.EXPAND | gtk.FILL, gtk.FILL)
160
if getdoc(p) is not None:
161
align = gtk.Alignment(0.0, 0.5)
162
description = gtk.Label()
163
description.set_text(getdoc(p))
164
description.set_selectable(True)
165
align.add(description)
166
table.attach(align, 0, 2, 1, 2, gtk.EXPAND | gtk.FILL, gtk.FILL)
170
treeview.set_headers_visible(False)
171
treeview.set_model(model)
172
treeview.connect("row-activated", row_selected)
174
cell = gtk.CellRendererText()
175
column = gtk.TreeViewColumn()
176
column.pack_start(cell, expand=True)
177
column.add_attribute(cell, "text", 0)
178
treeview.append_column(column)
180
cell = gtk.CellRendererText()
181
column = gtk.TreeViewColumn()
182
column.pack_start(cell, expand=True)
183
column.add_attribute(cell, "text", 1)
184
treeview.append_column(column)
187
plugins = bzrlib.plugin.plugins()
188
plugin_names = plugins.keys()
190
for name in plugin_names:
191
model.append([name, getattr(plugins[name], '__file__', None)])
193
scrolledwindow = gtk.ScrolledWindow()
194
scrolledwindow.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
195
scrolledwindow.add_with_viewport(table)
196
paned.pack2(scrolledwindow, resize=False, shrink=True)
201
109
def _create(self):
202
110
self.set_default_size(600, 600)
203
111
notebook = gtk.Notebook()
204
112
notebook.insert_page(self._create_mainpage(), gtk.Label("Main"))
205
notebook.insert_page(self._create_pluginpage(), gtk.Label("Plugins"))
113
notebook.insert_page(PluginsPage(), gtk.Label("Plugins"))
206
114
self.vbox.pack_start(notebook, True, True)
207
115
self.vbox.show_all()