1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 """connection widgets and dialogs"""
23
24 import os
25 import gettext
26
27 import gobject
28 import gtk
29 from kiwi.ui.objectlist import Column
30 from pango import ELLIPSIZE_MIDDLE, ELLIPSIZE_END
31
32 from flumotion.admin.connections import getRecentConnections, \
33 hasRecentConnections
34 from flumotion.common.pygobject import gsignal, gproperty
35 from flumotion.ui.glade import GladeWidget, GladeWindow
36
37 __version__ = "$Rev: 8569 $"
38 _ = gettext.gettext
39
40
43
44
46 gladeFile = 'connections.glade'
47
48 gsignal('have-connection', bool)
49 gsignal('connection-activated', object)
50 gsignal('connections-cleared')
51
53 GladeWidget.__init__(self)
54
55 self.connections.set_columns(
56 [Column("host", title=_("Hostname"), searchable=True,
57 ellipsize=ELLIPSIZE_MIDDLE, expand=True, width=100),
58 Column("manager", title=_("Manager"), searchable=True,
59 ellipsize=ELLIPSIZE_END, expand=True, width=50),
60 Column("timestamp", title=_("Last used"),
61 sorted=True,
62 order=gtk.SORT_DESCENDING,
63 format_func=format_timestamp),
64 ])
65 self.connections.add_list(getRecentConnections())
66 self.connections.get_treeview().set_search_equal_func(
67 self._searchEqual)
68 self.connections.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
69 self.connections.set_property('selection-mode', gtk.SELECTION_SINGLE)
70 self.connections.set_size_request(-1, 160)
71
72 self._updateButtons()
73
80
88
93
97
98
99
104
107
108 - def update(self, connection):
110
111
112
118
122
125
128
129 gobject.type_register(Connections)
130
131
133 gladeFile = 'connection-dialog.glade'
134
135 gsignal('have-connection', object)
136
139
142
143 - def on_ok(self, button):
144 self.emit('have-connection',
145 self.widgets['connections'].get_selected())
146
149
151 self.button_ok.set_sensitive(False)
152
153 gobject.type_register(ConnectionsDialog)
154
155
157 gladeFile = 'open-connection.glade'
158
159 gproperty(bool, 'can-activate', 'If the state of the widget is complete',
160 False)
161
168
172
174 old_can_act = self.get_property('can-activate')
175 can_act = self.host_entry.get_text() and self.port_entry.get_text()
176
177 if old_can_act != can_act:
178 self.set_property('can-activate', can_act)
179
181 if button.get_active():
182 self.port_entry.set_text('7531')
183 else:
184 self.port_entry.set_text('8642')
185
187 self.host_entry.set_text(state['host'])
188 self.port_entry.set_text(str(state['port']))
189 self.ssl_check.set_active(not state['use_insecure'])
190
192 return {'host': self.host_entry.get_text(),
193 'port': int(self.port_entry.get_text()),
194 'use_insecure': not self.ssl_check.get_active()}
195 gobject.type_register(OpenConnection)
196
197
199 gladeFile = 'authenticate.glade'
200
201 gproperty(bool, 'can-activate', 'If the state of the widget is complete',
202 False)
203
204
205 auth_method_combo = None
206 user_entry = None
207 passwd_entry = None
208
215
217 toplevel = self.get_toplevel()
218 toplevel.wizard.next()
219
222
224 can_act = self.user_entry.get_text() and self.passwd_entry.get_text()
225 self.set_property('can-activate', can_act)
226
234
238 gobject.type_register(Authenticate)
239