1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23 """generic dialogs such as progress, error and about"""
24
25 import gettext
26 import os
27
28 import gobject
29 import gtk
30
31 from flumotion.configure import configure
32 from flumotion.common.errors import AlreadyConnectedError, \
33 AlreadyConnectingError, ConnectionFailedError, \
34 ConnectionRefusedError
35
36 __version__ = "$Rev: 8838 $"
37 _ = gettext.gettext
38
39
68
69
71
72 - def __init__(self, title, message, parent = None):
73 gtk.Dialog.__init__(self, title, parent,
74 gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT)
75
76
77 self.label = gtk.Label(message)
78 self.vbox.pack_start(self.label, True, True, 6)
79 self.label.show()
80 self.bar = gtk.ProgressBar()
81 self.bar.show()
82 self.vbox.pack_end(self.bar, True, True, 6)
83 self.active = False
84 self._timeout_id = None
85
86 self.connect('destroy', self._destroy_cb)
87
89 "Show the dialog and start pulsating."
90 self.active = True
91 self.show()
92 self.bar.pulse()
93 self._timeout_id = gobject.timeout_add(200, self._pulse)
94
101
103 "Set the message on the dialog."
104 self.label.set_text(message)
105
107 if not self.active:
108
109 return False
110 self.bar.pulse()
111 return True
112
115
116
118
119 - def __init__(self, message, parent=None, close_on_response=True,
120 secondary_text=None):
121 gtk.MessageDialog.__init__(self, parent, gtk.DIALOG_MODAL,
122 gtk.MESSAGE_ERROR, gtk.BUTTONS_OK, message)
123 b = self.action_area.get_children()[0]
124 b.set_name('ok_button')
125 self.message = message
126 if close_on_response:
127 self.connect("response", lambda self, response: self.hide())
128
129
130 if not hasattr(self, 'format_secondary_text'):
131 self.format_secondary_text = self._format_secondary_text_backport
132
133 if secondary_text:
134 self.format_secondary_text(secondary_text)
135
137 self.set_markup('<span weight="bold" size="larger">%s</span>'
138 '\n\n%s' % (self.message, secondary_text))
139
149 self.connect('response', callback, deferred)
150 self.show()
151 return deferred
152
153
155
157 gtk.Dialog.__init__(self, _('About Flumotion'), parent,
158 gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT,
159 (gtk.STOCK_CLOSE, gtk.RESPONSE_CLOSE))
160 self.set_has_separator(False)
161 self.set_resizable(False)
162 self.set_border_width(12)
163 self.vbox.set_spacing(6)
164
165 image = gtk.Image()
166 self.vbox.pack_start(image)
167 image.set_from_file(os.path.join(configure.imagedir, 'flumotion.png'))
168 image.show()
169
170 version = gtk.Label(
171 '<span size="xx-large"><b>Flumotion %s</b></span>' %
172 configure.version)
173 version.set_selectable(True)
174 self.vbox.pack_start(version)
175 version.set_use_markup(True)
176 version.show()
177
178 text = _('Flumotion is a streaming media server.\n\n'
179 '© 2004, 2005, 2006, 2007, 2008 Fluendo S.L.')
180 authors = (
181 'Johan Dahlin',
182 'Alvin Delagon',
183 'David Gay i Tello',
184 'Pedro Gracia Fajardo',
185 'Aitor Guevara Escalante',
186 'Arek Korbik',
187 'Marek Kowalski',
188 'Julien Le Goff',
189 'Marc-André Lureau',
190 'Xavier Martinez',
191 'Jordi Massaguer Pla',
192 'Andoni Morales Alastruey',
193 'Zaheer Abbas Merali',
194 'Sébastien Merle',
195 'Thodoris Paschidis',
196 'Xavier Queralt Mateu',
197 'Guillaume Quintard',
198 'Josep Joan "Pepe" Ribas',
199 'Mike Smith',
200 'Guillem Solà',
201 'Wim Taymans',
202 'Jan Urbański',
203 'Thomas Vander Stichele',
204 'Andy Wingo',
205 )
206 text += '\n\n<small>' + _('Authors') + ':\n'
207 for author in authors:
208 text += ' %s\n' % author
209 text += '</small>'
210 info = gtk.Label(text)
211 self.vbox.pack_start(info)
212 info.set_use_markup(True)
213 info.set_selectable(True)
214 info.set_justify(gtk.JUSTIFY_FILL)
215 info.set_line_wrap(True)
216 info.show()
217
218
219 try:
220 from flumotion.admin.gtk import about
221 AboutDialog = about.GtkAboutDialog
222 except AttributeError:
223 pass
224
225
247