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