1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23 from gettext import gettext as _
24 import os
25
26 import gtk
27 import gobject
28
29 from flumotion.configure import configure
30 from flumotion.common.pygobject import gsignal
31 from flumotion.common import pygobject
32
33
35 - def __init__(self, title, message, parent = None):
36 gtk.Dialog.__init__(self, title, parent,
37 gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT)
38
39
40 self.label = gtk.Label(message)
41 self.vbox.pack_start(self.label, True, True, 6)
42 self.label.show()
43 self.bar = gtk.ProgressBar()
44 self.bar.show()
45 self.vbox.pack_end(self.bar, True, True, 6)
46 self.active = False
47 self._timeout_id = None
48
49 self.connect('destroy', self._destroy_cb)
50
52 "Show the dialog and start pulsating."
53 self.active = True
54 self.show()
55 self.bar.pulse()
56 self._timeout_id = gobject.timeout_add(200, self._pulse)
57
64
66 "Set the message on the dialog."
67 self.label.set_text(message)
68
70 if not self.active:
71
72 return False
73 self.bar.pulse()
74 return True
75
78
80 - def __init__(self, message, parent=None, close_on_response=True,
81 secondary_text=None):
82 gtk.MessageDialog.__init__(self, parent, gtk.DIALOG_MODAL,
83 gtk.MESSAGE_ERROR, gtk.BUTTONS_OK, message)
84 b = self.action_area.get_children()[0]
85 b.set_name('ok_button')
86 self.message = message
87 if close_on_response:
88 self.connect("response", lambda self, response: self.hide())
89
90
91 if not hasattr(self, 'format_secondary_text'):
92 self.format_secondary_text = self._format_secondary_text_backport
93
94 if secondary_text:
95 self.format_secondary_text(secondary_text)
96
98 self.set_markup('<span weight="bold" size="larger">%s</span>'
99 '\n\n%s' % (self.message, secondary_text))
100
109 self.connect('response', callback, deferred)
110 self.show()
111 return deferred
112
114 d = ErrorDialog('Connection refused', parent, True,
115 '"%s" refused your connection.\n'
116 'Check your user name and password and try again.'
117 % host)
118 return d.run()
119
125
127 d = ErrorDialog('Already connected to %s' % info, parent, True,
128 "Seek your satisfaction via existing routes.")
129 return d.run()
130
132 """
133 I am a dialog to get and set GStreamer element properties on a component.
134 """
135
136 gsignal('set', str, str, object)
137 gsignal('get', str, str)
138
139 RESPONSE_FETCH = 0
140
142 title = "Change element property on '%s'" % name
143 gtk.Dialog.__init__(self, title, parent,
144 gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT)
145 self.connect('response', self.response_cb)
146 self._close = self.add_button('Close', gtk.RESPONSE_CLOSE)
147 self._set = self.add_button('Set', gtk.RESPONSE_APPLY)
148 self._fetch = self.add_button('Fetch current', self.RESPONSE_FETCH)
149
150 hbox = gtk.HBox()
151 hbox.show()
152
153 label = gtk.Label('Element')
154 label.show()
155 hbox.pack_start(label, False, False)
156 self.element_combo = gtk.ComboBox()
157 self.element_entry = gtk.Entry()
158 self.element_entry.show()
159 hbox.pack_start(self.element_entry, False, False)
160
161 label = gtk.Label('Property')
162 label.show()
163 hbox.pack_start(label, False, False)
164 self.property_entry = gtk.Entry()
165 self.property_entry.show()
166 hbox.pack_start(self.property_entry, False, False)
167
168 label = gtk.Label('Value')
169 label.show()
170 hbox.pack_start(label, False, False)
171 self.value_entry = gtk.Entry()
172 self.value_entry.show()
173 hbox.pack_start(self.value_entry, False, False)
174
175 self.vbox.pack_start(hbox)
176
178 if response == gtk.RESPONSE_APPLY:
179 self.emit('set', self.element_entry.get_text(),
180 self.property_entry.get_text(),
181 self.value_entry.get_text())
182 elif response == self.RESPONSE_FETCH:
183 self.emit('get', self.element_entry.get_text(),
184 self.property_entry.get_text())
185 elif response == gtk.RESPONSE_CLOSE:
186 dialog.hide()
187
188 - def update_value_entry(self, value):
189 self.value_entry.set_text(str(value))
190
191 pygobject.type_register(PropertyChangeDialog)
192
195 gtk.Dialog.__init__(self, _('About Flumotion'), parent,
196 gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT,
197 (gtk.STOCK_CLOSE, gtk.RESPONSE_CLOSE))
198 self.set_has_separator(False)
199 self.set_resizable(False)
200 self.set_border_width(12)
201 self.vbox.set_spacing(6)
202
203 image = gtk.Image()
204 self.vbox.pack_start(image)
205 image.set_from_file(os.path.join(configure.imagedir, 'fluendo.png'))
206 image.show()
207
208 version = gtk.Label(
209 '<span size="xx-large"><b>Flumotion %s</b></span>' %
210 configure.version)
211 version.set_selectable(True)
212 self.vbox.pack_start(version)
213 version.set_use_markup(True)
214 version.show()
215
216 text = _('Flumotion is a streaming media server.\n\n'
217 '© 2004, 2005, 2006, 2007 Fluendo S.L.')
218 authors = (
219 'Johan Dahlin',
220 'Arek Korbik',
221 'Zaheer Abbas Merali',
222 'Sébastien Merle',
223 'Mike Smith',
224 'Wim Taymans',
225 'Thomas Vander Stichele',
226 'Andy Wingo',
227 )
228 text += '\n\n<small>' + _('Authors') + ':\n'
229 for author in authors:
230 text += ' %s\n' % author
231 text += '</small>'
232 info = gtk.Label(text)
233 self.vbox.pack_start(info)
234 info.set_use_markup(True)
235 info.set_selectable(True)
236 info.set_justify(gtk.JUSTIFY_FILL)
237 info.set_line_wrap(True)
238 info.show()
239