27
27
class PreferencesWindow(gtk.Dialog):
28
28
"""Displays global preferences windows."""
29
# Note that we don't allow configuration of aliases or
30
# default log formats. This is because doing so wouldn't make
31
# a lot of sense to pure GUI users. Users that need these settings
32
# will already be familiar with the configuration file.
34
29
def __init__(self, config=None):
35
30
""" Initialize the Status window. """
36
31
super(PreferencesWindow, self).__init__(flags=gtk.DIALOG_MODAL)
52
47
table.attach(align, 0, 1, 0, 1, gtk.FILL, gtk.FILL)
49
align = gtk.Alignment(0.0, 0.5)
54
50
self.username = gtk.Entry()
51
align.add(self.username)
55
52
self.username.set_text(self.config.username())
56
table.attach(self.username, 1, 2, 0, 1, gtk.EXPAND | gtk.FILL, gtk.FILL)
53
table.attach(align, 1, 2, 0, 1, gtk.EXPAND | gtk.FILL, gtk.FILL)
58
55
align = gtk.Alignment(1.0, 0.5)
59
56
label = gtk.Label()
62
59
table.attach(align, 0, 1, 1, 2, gtk.FILL, gtk.FILL)
61
align = gtk.Alignment(0.0, 0.5)
64
62
self.email = gtk.Entry()
65
63
self.email.set_text(self.config.gpg_signing_command())
66
table.attach(self.email, 1, 2, 1, 2, gtk.EXPAND | gtk.FILL, gtk.FILL)
65
table.attach(align, 1, 2, 1, 2, gtk.EXPAND | gtk.FILL, gtk.FILL)
68
67
align = gtk.Alignment(1.0, 0.5)
69
68
label = gtk.Label()
72
71
table.attach(align, 0, 1, 2, 3, gtk.FILL, gtk.FILL)
73
align = gtk.Alignment(0.0, 0.5)
74
74
sigvals = gtk.VBox()
75
75
self.check_sigs_if_possible = gtk.RadioButton(None,
76
76
"_Check if possible")
83
83
sigvals.pack_start(self.check_sigs_never)
84
84
# FIXME: Set default
85
table.attach(sigvals, 1, 2, 2, 3, gtk.EXPAND | gtk.FILL, gtk.FILL)
86
table.attach(align, 1, 2, 2, 3, gtk.EXPAND | gtk.FILL, gtk.FILL)
87
88
align = gtk.Alignment(1.0, 0.5)
88
89
label = gtk.Label()
91
92
table.attach(align, 0, 1, 3, 4, gtk.FILL, gtk.FILL)
94
align = gtk.Alignment(0.0, 0.5)
93
95
create_sigs = gtk.VBox()
94
96
self.create_sigs_when_required = gtk.RadioButton(None,
95
97
"Sign When _Required")
101
103
self.create_sigs_when_required, "Sign _Never")
102
104
create_sigs.pack_start(self.create_sigs_never)
103
105
# FIXME: Set default
104
table.attach(create_sigs, 1, 2, 3, 4, gtk.EXPAND | gtk.FILL, gtk.FILL)
106
align.add(create_sigs)
107
table.attach(align, 1, 2, 3, 4, gtk.EXPAND | gtk.FILL, gtk.FILL)
108
111
def _create_pluginpage(self):
112
vbox = gtk.VBox(False, 2)
113
vbox.set_border_width(6)
110
115
scrolledwindow = gtk.ScrolledWindow()
111
116
scrolledwindow.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
112
117
model = gtk.ListStore(str, str)
113
118
treeview = gtk.TreeView()
114
119
scrolledwindow.add(treeview)
115
paned.pack1(scrolledwindow, resize=True, shrink=False)
117
121
table = gtk.Table(columns=2)
118
122
table.set_row_spacings(6)
119
123
table.set_col_spacings(6)
121
126
def row_selected(tv, path, tvc):
122
p = bzrlib.plugin.plugins()[model[path][0]]
127
p = bzrlib.plugin.all_plugins()[model[path][0]]
123
128
from inspect import getdoc
125
130
for w in table.get_children():
184
189
treeview.append_column(column)
186
191
import bzrlib.plugin
187
plugins = bzrlib.plugin.plugins()
192
plugins = bzrlib.plugin.all_plugins()
188
193
plugin_names = plugins.keys()
189
194
plugin_names.sort()
190
195
for name in plugin_names:
191
196
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)
198
vbox.pack_start(scrolledwindow, expand=True, fill=True)
200
vbox.pack_start(table)
201
204
def _create(self):
202
205
self.set_default_size(600, 600)