Merge lp:~nataliabidart/magicicada-gui/build-gui into lp:magicicada-gui
- build-gui
- Merge into trunk
Proposed by
Natalia Bidart
Status: | Merged | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Approved by: | Facundo Batista | ||||||||||||||||||||||||
Approved revision: | 13 | ||||||||||||||||||||||||
Merged at revision: | 15 | ||||||||||||||||||||||||
Proposed branch: | lp:~nataliabidart/magicicada-gui/build-gui | ||||||||||||||||||||||||
Merge into: | lp:magicicada-gui | ||||||||||||||||||||||||
Diff against target: |
1396 lines (+599/-638) 14 files modified
bin/magicicada (+3/-56) data/ui/AboutMagicicadaDialog.ui (+0/-40) data/ui/MagicicadaWindow.ui (+0/-232) data/ui/PreferencesMagicicadaDialog.ui (+0/-67) data/ui/about_magicicada_dialog.xml (+0/-9) data/ui/gui.glade (+219/-52) data/ui/magicicada_window.xml (+0/-8) data/ui/preferences_magicicada_dialog.xml (+0/-9) magicicada/AboutMagicicadaDialog.py (+0/-48) magicicada/PreferencesMagicicadaDialog.py (+0/-111) magicicada/__init__.py (+204/-0) magicicada/helpers.py (+15/-3) magicicada/syncdaemon.py (+8/-3) magicicada/tests/test_magicicada.py (+150/-0) |
||||||||||||||||||||||||
To merge this branch: | bzr merge lp:~nataliabidart/magicicada-gui/build-gui | ||||||||||||||||||||||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Facundo Batista | Approve | ||
Review via email: mp+24962@code.launchpad.net |
Commit message
Description of the change
First schema of Magicicada GUI.
To post a comment you must log in.
- 12. By Natalia Bidart
-
Fising some tests.
Revision history for this message
Natalia Bidart (nataliabidart) wrote : | # |
All fixed now!
- 13. By Natalia Bidart
-
Removing no longer needed patch def.
Revision history for this message
Facundo Batista (facundo) wrote : | # |
Approving, but one comment.
Why the decorator that logs to stdout is called "dummy"? When you see a method decorated dummy you expect it to do nothing, but here it *is* executed.
review:
Approve
Revision history for this message
Natalia Bidart (nataliabidart) wrote : | # |
> Approving, but one comment.
>
> Why the decorator that logs to stdout is called "dummy"? When you see a method
> decorated dummy you expect it to do nothing, but here it *is* executed.
I renamed it to print_debug. Thanks for pointing this out!
- 14. By Natalia Bidart
-
Renaming dumy decorator to print_debug.
- 15. By Natalia Bidart
-
Merged trunk in.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'bin/magicicada' | |||
2 | --- bin/magicicada 2010-04-21 23:50:09 +0000 | |||
3 | +++ bin/magicicada 2010-05-15 15:48:32 +0000 | |||
4 | @@ -6,7 +6,6 @@ | |||
5 | 6 | 6 | ||
6 | 7 | import sys | 7 | import sys |
7 | 8 | import os | 8 | import os |
8 | 9 | import gtk | ||
9 | 10 | 9 | ||
10 | 11 | import gettext | 10 | import gettext |
11 | 12 | from gettext import gettext as _ | 11 | from gettext import gettext as _ |
12 | @@ -29,59 +28,7 @@ | |||
13 | 29 | sys.path.insert(0, PROJECT_ROOT_DIRECTORY) | 28 | sys.path.insert(0, PROJECT_ROOT_DIRECTORY) |
14 | 30 | os.putenv('PYTHONPATH', PROJECT_ROOT_DIRECTORY) # for subprocesses | 29 | os.putenv('PYTHONPATH', PROJECT_ROOT_DIRECTORY) # for subprocesses |
15 | 31 | 30 | ||
69 | 32 | from magicicada import ( | 31 | from magicicada import MagicicadaUI |
17 | 33 | AboutMagicicadaDialog, PreferencesMagicicadaDialog) | ||
18 | 34 | from magicicada.helpers import get_builder | ||
19 | 35 | |||
20 | 36 | |||
21 | 37 | class MagicicadaUI(object): | ||
22 | 38 | |||
23 | 39 | def __init__(self): | ||
24 | 40 | """Init.""" | ||
25 | 41 | self.builder = get_builder('gui.glade') | ||
26 | 42 | self.builder.connect_signals(self) | ||
27 | 43 | |||
28 | 44 | global launchpad_available | ||
29 | 45 | if launchpad_available: | ||
30 | 46 | # see https://wiki.ubuntu.com/UbuntuDevelopment/Internationalisation/Coding for more information | ||
31 | 47 | # about LaunchpadIntegration | ||
32 | 48 | helpmenu = self.builder.get_object('helpMenu') | ||
33 | 49 | if helpmenu: | ||
34 | 50 | LaunchpadIntegration.set_sourcepackagename('magicicada') | ||
35 | 51 | LaunchpadIntegration.add_items(helpmenu, 0, False, True) | ||
36 | 52 | else: | ||
37 | 53 | launchpad_available = False | ||
38 | 54 | |||
39 | 55 | # Uncomment the following code to read in preferences at start up. | ||
40 | 56 | #dlg = PreferencesMagicicadaDialog.NewPreferencesMagicicadaDialog() | ||
41 | 57 | #self.preferences = dlg.get_preferences() | ||
42 | 58 | |||
43 | 59 | # Code for other initialization actions should be added here. | ||
44 | 60 | self.builder.get_object('main_window').show_all() | ||
45 | 61 | |||
46 | 62 | def about(self, widget, data=None): | ||
47 | 63 | """Display the about box for magicicada.""" | ||
48 | 64 | about = AboutMagicicadaDialog.AboutMagicicadaDialog() | ||
49 | 65 | response = about.run() | ||
50 | 66 | about.destroy() | ||
51 | 67 | |||
52 | 68 | def preferences(self, widget, data=None): | ||
53 | 69 | """Display the preferences window for magicicada.""" | ||
54 | 70 | prefs = PreferencesMagicicadaDialog.PreferencesMagicicadaDialog() | ||
55 | 71 | response = prefs.run() | ||
56 | 72 | if response == gtk.RESPONSE_OK: | ||
57 | 73 | # Make any updates based on changed preferences here. | ||
58 | 74 | pass | ||
59 | 75 | prefs.destroy() | ||
60 | 76 | |||
61 | 77 | def quit(self, widget, data=None): | ||
62 | 78 | """Signal handler for closing the MagicicadaWindow.""" | ||
63 | 79 | self.destroy() | ||
64 | 80 | |||
65 | 81 | def on_destroy(self, widget, data=None): | ||
66 | 82 | """Called when the MagicicadaWindow is closed.""" | ||
67 | 83 | # Clean up code for saving application state should be added here. | ||
68 | 84 | gtk.main_quit() | ||
70 | 85 | 32 | ||
71 | 86 | if __name__ == "__main__": | 33 | if __name__ == "__main__": |
72 | 87 | # Support for command line options. | 34 | # Support for command line options. |
73 | @@ -99,5 +46,5 @@ | |||
74 | 99 | logging.debug('logging enabled') | 46 | logging.debug('logging enabled') |
75 | 100 | 47 | ||
76 | 101 | # Run the application. | 48 | # Run the application. |
79 | 102 | window = MagicicadaUI() | 49 | window = MagicicadaUI(launchpad_available=launchpad_available) |
80 | 103 | gtk.main() | 50 | window.run() |
81 | 104 | 51 | ||
82 | === added file 'data/media/loader-ball.gif' | |||
83 | 105 | Binary files data/media/loader-ball.gif 1970-01-01 00:00:00 +0000 and data/media/loader-ball.gif 2010-05-15 15:48:32 +0000 differ | 52 | Binary files data/media/loader-ball.gif 1970-01-01 00:00:00 +0000 and data/media/loader-ball.gif 2010-05-15 15:48:32 +0000 differ |
84 | === added file 'data/media/ubuntuone.png' | |||
85 | 106 | Binary files data/media/ubuntuone.png 1970-01-01 00:00:00 +0000 and data/media/ubuntuone.png 2010-05-15 15:48:32 +0000 differ | 53 | Binary files data/media/ubuntuone.png 1970-01-01 00:00:00 +0000 and data/media/ubuntuone.png 2010-05-15 15:48:32 +0000 differ |
86 | === removed file 'data/ui/AboutMagicicadaDialog.ui' | |||
87 | --- data/ui/AboutMagicicadaDialog.ui 2010-04-21 21:18:31 +0000 | |||
88 | +++ data/ui/AboutMagicicadaDialog.ui 1970-01-01 00:00:00 +0000 | |||
89 | @@ -1,40 +0,0 @@ | |||
90 | 1 | <?xml version="1.0"?> | ||
91 | 2 | <interface> | ||
92 | 3 | <requires lib="gtk+" version="2.16"/> | ||
93 | 4 | <!-- interface-requires about_magicicada_dialog 1.0 --> | ||
94 | 5 | <!-- interface-naming-policy project-wide --> | ||
95 | 6 | <object class="AboutMagicicadaDialog" id="about_magicicada_dialog"> | ||
96 | 7 | <property name="border_width">5</property> | ||
97 | 8 | <property name="icon">../media/icon.png</property> | ||
98 | 9 | <property name="type_hint">normal</property> | ||
99 | 10 | <property name="has_separator">False</property> | ||
100 | 11 | <property name="program_name">Magicicada</property> | ||
101 | 12 | <property name="version"></property> | ||
102 | 13 | <property name="copyright"></property> | ||
103 | 14 | <property name="website"></property> | ||
104 | 15 | <property name="license"></property> | ||
105 | 16 | <property name="authors"></property> | ||
106 | 17 | <property name="logo">../media/logo.png</property> | ||
107 | 18 | <child internal-child="vbox"> | ||
108 | 19 | <object class="GtkVBox" id="dialog-vbox1"> | ||
109 | 20 | <property name="visible">True</property> | ||
110 | 21 | <property name="orientation">vertical</property> | ||
111 | 22 | <property name="spacing">2</property> | ||
112 | 23 | <child> | ||
113 | 24 | <placeholder/> | ||
114 | 25 | </child> | ||
115 | 26 | <child internal-child="action_area"> | ||
116 | 27 | <object class="GtkHButtonBox" id="dialog-action_area1"> | ||
117 | 28 | <property name="visible">True</property> | ||
118 | 29 | <property name="layout_style">end</property> | ||
119 | 30 | </object> | ||
120 | 31 | <packing> | ||
121 | 32 | <property name="expand">False</property> | ||
122 | 33 | <property name="pack_type">end</property> | ||
123 | 34 | <property name="position">0</property> | ||
124 | 35 | </packing> | ||
125 | 36 | </child> | ||
126 | 37 | </object> | ||
127 | 38 | </child> | ||
128 | 39 | </object> | ||
129 | 40 | </interface> | ||
130 | 41 | 0 | ||
131 | === removed file 'data/ui/MagicicadaWindow.ui' | |||
132 | --- data/ui/MagicicadaWindow.ui 2010-04-21 21:18:31 +0000 | |||
133 | +++ data/ui/MagicicadaWindow.ui 1970-01-01 00:00:00 +0000 | |||
134 | @@ -1,232 +0,0 @@ | |||
135 | 1 | <?xml version="1.0"?> | ||
136 | 2 | <interface> | ||
137 | 3 | <requires lib="gtk+" version="2.16"/> | ||
138 | 4 | <!-- interface-requires magicicada_window 1.0 --> | ||
139 | 5 | <!-- interface-naming-policy project-wide --> | ||
140 | 6 | <!-- interface-local-resource-path ../media --> | ||
141 | 7 | <object class="MagicicadaWindow" id="magicicada_window"> | ||
142 | 8 | <property name="title" translatable="yes">Magicicada</property> | ||
143 | 9 | <property name="icon">../media/icon.png</property> | ||
144 | 10 | <signal name="destroy" handler="on_destroy"/> | ||
145 | 11 | <child> | ||
146 | 12 | <object class="GtkVBox" id="vbox1"> | ||
147 | 13 | <property name="visible">True</property> | ||
148 | 14 | <property name="orientation">vertical</property> | ||
149 | 15 | <property name="spacing">5</property> | ||
150 | 16 | <child> | ||
151 | 17 | <object class="GtkMenuBar" id="menubar1"> | ||
152 | 18 | <property name="visible">True</property> | ||
153 | 19 | <child> | ||
154 | 20 | <object class="GtkMenuItem" id="menuitem1"> | ||
155 | 21 | <property name="visible">True</property> | ||
156 | 22 | <property name="label" translatable="yes">_File</property> | ||
157 | 23 | <property name="use_underline">True</property> | ||
158 | 24 | <child type="submenu"> | ||
159 | 25 | <object class="GtkMenu" id="menu1"> | ||
160 | 26 | <property name="visible">True</property> | ||
161 | 27 | <child> | ||
162 | 28 | <object class="GtkImageMenuItem" id="imagemenuitem1"> | ||
163 | 29 | <property name="label">gtk-new</property> | ||
164 | 30 | <property name="visible">True</property> | ||
165 | 31 | <property name="use_action_appearance">True</property> | ||
166 | 32 | <property name="use_underline">True</property> | ||
167 | 33 | <property name="use_stock">True</property> | ||
168 | 34 | <accelerator key="n" signal="activate" modifiers="GDK_CONTROL_MASK"/> | ||
169 | 35 | </object> | ||
170 | 36 | </child> | ||
171 | 37 | <child> | ||
172 | 38 | <object class="GtkImageMenuItem" id="imagemenuitem2"> | ||
173 | 39 | <property name="label">gtk-open</property> | ||
174 | 40 | <property name="visible">True</property> | ||
175 | 41 | <property name="use_underline">True</property> | ||
176 | 42 | <property name="use_stock">True</property> | ||
177 | 43 | <accelerator key="o" signal="activate" modifiers="GDK_CONTROL_MASK"/> | ||
178 | 44 | </object> | ||
179 | 45 | </child> | ||
180 | 46 | <child> | ||
181 | 47 | <object class="GtkImageMenuItem" id="imagemenuitem3"> | ||
182 | 48 | <property name="label">gtk-save</property> | ||
183 | 49 | <property name="visible">True</property> | ||
184 | 50 | <property name="use_underline">True</property> | ||
185 | 51 | <property name="use_stock">True</property> | ||
186 | 52 | <accelerator key="s" signal="activate" modifiers="GDK_CONTROL_MASK"/> | ||
187 | 53 | </object> | ||
188 | 54 | </child> | ||
189 | 55 | <child> | ||
190 | 56 | <object class="GtkImageMenuItem" id="imagemenuitem4"> | ||
191 | 57 | <property name="label">gtk-save-as</property> | ||
192 | 58 | <property name="visible">True</property> | ||
193 | 59 | <property name="use_underline">True</property> | ||
194 | 60 | <property name="use_stock">True</property> | ||
195 | 61 | <accelerator key="s" signal="activate" modifiers="GDK_SHIFT_MASK | GDK_CONTROL_MASK"/> | ||
196 | 62 | </object> | ||
197 | 63 | </child> | ||
198 | 64 | <child> | ||
199 | 65 | <object class="GtkSeparatorMenuItem" id="separatormenuitem1"> | ||
200 | 66 | <property name="visible">True</property> | ||
201 | 67 | </object> | ||
202 | 68 | </child> | ||
203 | 69 | <child> | ||
204 | 70 | <object class="GtkImageMenuItem" id="imagemenuitem5"> | ||
205 | 71 | <property name="label">gtk-quit</property> | ||
206 | 72 | <property name="visible">True</property> | ||
207 | 73 | <property name="use_underline">True</property> | ||
208 | 74 | <property name="use_stock">True</property> | ||
209 | 75 | <accelerator key="q" signal="activate" modifiers="GDK_CONTROL_MASK"/> | ||
210 | 76 | <signal name="activate" handler="quit"/> | ||
211 | 77 | </object> | ||
212 | 78 | </child> | ||
213 | 79 | </object> | ||
214 | 80 | </child> | ||
215 | 81 | </object> | ||
216 | 82 | </child> | ||
217 | 83 | <child> | ||
218 | 84 | <object class="GtkMenuItem" id="menuitem2"> | ||
219 | 85 | <property name="visible">True</property> | ||
220 | 86 | <property name="label" translatable="yes">_Edit</property> | ||
221 | 87 | <property name="use_underline">True</property> | ||
222 | 88 | <child type="submenu"> | ||
223 | 89 | <object class="GtkMenu" id="menu2"> | ||
224 | 90 | <property name="visible">True</property> | ||
225 | 91 | <child> | ||
226 | 92 | <object class="GtkImageMenuItem" id="imagemenuitem6"> | ||
227 | 93 | <property name="label">gtk-cut</property> | ||
228 | 94 | <property name="visible">True</property> | ||
229 | 95 | <property name="use_underline">True</property> | ||
230 | 96 | <property name="use_stock">True</property> | ||
231 | 97 | <accelerator key="x" signal="activate" modifiers="GDK_CONTROL_MASK"/> | ||
232 | 98 | </object> | ||
233 | 99 | </child> | ||
234 | 100 | <child> | ||
235 | 101 | <object class="GtkImageMenuItem" id="imagemenuitem7"> | ||
236 | 102 | <property name="label">gtk-copy</property> | ||
237 | 103 | <property name="visible">True</property> | ||
238 | 104 | <property name="use_underline">True</property> | ||
239 | 105 | <property name="use_stock">True</property> | ||
240 | 106 | <accelerator key="c" signal="activate" modifiers="GDK_CONTROL_MASK"/> | ||
241 | 107 | </object> | ||
242 | 108 | </child> | ||
243 | 109 | <child> | ||
244 | 110 | <object class="GtkImageMenuItem" id="imagemenuitem8"> | ||
245 | 111 | <property name="label">gtk-paste</property> | ||
246 | 112 | <property name="visible">True</property> | ||
247 | 113 | <property name="use_underline">True</property> | ||
248 | 114 | <property name="use_stock">True</property> | ||
249 | 115 | <accelerator key="v" signal="activate" modifiers="GDK_CONTROL_MASK"/> | ||
250 | 116 | </object> | ||
251 | 117 | </child> | ||
252 | 118 | <child> | ||
253 | 119 | <object class="GtkImageMenuItem" id="imagemenuitem9"> | ||
254 | 120 | <property name="label">gtk-delete</property> | ||
255 | 121 | <property name="visible">True</property> | ||
256 | 122 | <property name="use_underline">True</property> | ||
257 | 123 | <property name="use_stock">True</property> | ||
258 | 124 | <accelerator key="Delete" signal="activate"/> | ||
259 | 125 | </object> | ||
260 | 126 | </child> | ||
261 | 127 | <child> | ||
262 | 128 | <object class="GtkSeparatorMenuItem" id="separatormenuitem2"> | ||
263 | 129 | <property name="visible">True</property> | ||
264 | 130 | </object> | ||
265 | 131 | </child> | ||
266 | 132 | <child> | ||
267 | 133 | <object class="GtkImageMenuItem" id="imagemenuitem11"> | ||
268 | 134 | <property name="label">gtk-preferences</property> | ||
269 | 135 | <property name="visible">True</property> | ||
270 | 136 | <property name="use_underline">True</property> | ||
271 | 137 | <property name="use_stock">True</property> | ||
272 | 138 | <signal name="activate" handler="preferences"/> | ||
273 | 139 | </object> | ||
274 | 140 | </child> | ||
275 | 141 | </object> | ||
276 | 142 | </child> | ||
277 | 143 | </object> | ||
278 | 144 | </child> | ||
279 | 145 | <child> | ||
280 | 146 | <object class="GtkMenuItem" id="menuitem3"> | ||
281 | 147 | <property name="visible">True</property> | ||
282 | 148 | <property name="label" translatable="yes">_View</property> | ||
283 | 149 | <property name="use_underline">True</property> | ||
284 | 150 | </object> | ||
285 | 151 | </child> | ||
286 | 152 | <child> | ||
287 | 153 | <object class="GtkMenuItem" id="menuitem4"> | ||
288 | 154 | <property name="visible">True</property> | ||
289 | 155 | <property name="label" translatable="yes">_Help</property> | ||
290 | 156 | <property name="use_underline">True</property> | ||
291 | 157 | <child type="submenu"> | ||
292 | 158 | <object class="GtkMenu" id="helpMenu"> | ||
293 | 159 | <property name="visible">True</property> | ||
294 | 160 | <child> | ||
295 | 161 | <object class="GtkImageMenuItem" id="imagemenuitem10"> | ||
296 | 162 | <property name="label">gtk-about</property> | ||
297 | 163 | <property name="visible">True</property> | ||
298 | 164 | <property name="use_underline">True</property> | ||
299 | 165 | <property name="use_stock">True</property> | ||
300 | 166 | <signal name="activate" handler="about"/> | ||
301 | 167 | </object> | ||
302 | 168 | </child> | ||
303 | 169 | </object> | ||
304 | 170 | </child> | ||
305 | 171 | </object> | ||
306 | 172 | </child> | ||
307 | 173 | </object> | ||
308 | 174 | <packing> | ||
309 | 175 | <property name="expand">False</property> | ||
310 | 176 | <property name="position">0</property> | ||
311 | 177 | </packing> | ||
312 | 178 | </child> | ||
313 | 179 | <child> | ||
314 | 180 | <object class="GtkLabel" id="label1"> | ||
315 | 181 | <property name="visible">True</property> | ||
316 | 182 | <property name="xpad">30</property> | ||
317 | 183 | <property name="ypad">5</property> | ||
318 | 184 | <property name="label" translatable="yes">Your application has been created! | ||
319 | 185 | |||
320 | 186 | To start changing this user interface, run 'quickly glade', which will open Glade so you can edit the default windows and dialogs. | ||
321 | 187 | |||
322 | 188 | To change the behavior and edit the python code, run 'quickly edit', which will bring up a text editor.</property> | ||
323 | 189 | <property name="wrap">True</property> | ||
324 | 190 | </object> | ||
325 | 191 | <packing> | ||
326 | 192 | <property name="position">1</property> | ||
327 | 193 | </packing> | ||
328 | 194 | </child> | ||
329 | 195 | <child> | ||
330 | 196 | <object class="GtkImage" id="image1"> | ||
331 | 197 | <property name="visible">True</property> | ||
332 | 198 | <property name="xpad">5</property> | ||
333 | 199 | <property name="ypad">5</property> | ||
334 | 200 | <property name="pixbuf">../media/background.png</property> | ||
335 | 201 | </object> | ||
336 | 202 | <packing> | ||
337 | 203 | <property name="padding">15</property> | ||
338 | 204 | <property name="position">2</property> | ||
339 | 205 | </packing> | ||
340 | 206 | </child> | ||
341 | 207 | <child> | ||
342 | 208 | <object class="GtkStatusbar" id="statusbar1"> | ||
343 | 209 | <property name="visible">True</property> | ||
344 | 210 | <property name="spacing">2</property> | ||
345 | 211 | <child> | ||
346 | 212 | <object class="GtkLabel" id="label2"> | ||
347 | 213 | <property name="visible">True</property> | ||
348 | 214 | <property name="xalign">0</property> | ||
349 | 215 | <property name="xpad">5</property> | ||
350 | 216 | <property name="ypad">5</property> | ||
351 | 217 | <property name="label" translatable="yes">Status Area</property> | ||
352 | 218 | </object> | ||
353 | 219 | <packing> | ||
354 | 220 | <property name="position">0</property> | ||
355 | 221 | </packing> | ||
356 | 222 | </child> | ||
357 | 223 | </object> | ||
358 | 224 | <packing> | ||
359 | 225 | <property name="expand">False</property> | ||
360 | 226 | <property name="position">3</property> | ||
361 | 227 | </packing> | ||
362 | 228 | </child> | ||
363 | 229 | </object> | ||
364 | 230 | </child> | ||
365 | 231 | </object> | ||
366 | 232 | </interface> | ||
367 | 233 | 0 | ||
368 | === removed file 'data/ui/PreferencesMagicicadaDialog.ui' | |||
369 | --- data/ui/PreferencesMagicicadaDialog.ui 2010-04-21 21:18:31 +0000 | |||
370 | +++ data/ui/PreferencesMagicicadaDialog.ui 1970-01-01 00:00:00 +0000 | |||
371 | @@ -1,67 +0,0 @@ | |||
372 | 1 | <?xml version="1.0"?> | ||
373 | 2 | <interface> | ||
374 | 3 | <requires lib="gtk+" version="2.16"/> | ||
375 | 4 | <!-- interface-requires preferences_magicicada_dialog 1.0 --> | ||
376 | 5 | <!-- interface-naming-policy project-wide --> | ||
377 | 6 | <object class="PreferencesMagicicadaDialog" id="preferences_magicicada_dialog"> | ||
378 | 7 | <property name="border_width">5</property> | ||
379 | 8 | <property name="icon">../media/icon.png</property> | ||
380 | 9 | <property name="type_hint">normal</property> | ||
381 | 10 | <property name="has_separator">False</property> | ||
382 | 11 | <child internal-child="vbox"> | ||
383 | 12 | <object class="GtkVBox" id="dialog-vbox1"> | ||
384 | 13 | <property name="visible">True</property> | ||
385 | 14 | <property name="orientation">vertical</property> | ||
386 | 15 | <property name="spacing">2</property> | ||
387 | 16 | <child> | ||
388 | 17 | <placeholder/> | ||
389 | 18 | </child> | ||
390 | 19 | <child internal-child="action_area"> | ||
391 | 20 | <object class="GtkHButtonBox" id="dialog-action_area1"> | ||
392 | 21 | <property name="visible">True</property> | ||
393 | 22 | <property name="layout_style">end</property> | ||
394 | 23 | <child> | ||
395 | 24 | <object class="GtkButton" id="button2"> | ||
396 | 25 | <property name="label">gtk-cancel</property> | ||
397 | 26 | <property name="visible">True</property> | ||
398 | 27 | <property name="can_focus">True</property> | ||
399 | 28 | <property name="receives_default">True</property> | ||
400 | 29 | <property name="use_stock">True</property> | ||
401 | 30 | <signal name="clicked" handler="cancel"/> | ||
402 | 31 | </object> | ||
403 | 32 | <packing> | ||
404 | 33 | <property name="expand">False</property> | ||
405 | 34 | <property name="fill">False</property> | ||
406 | 35 | <property name="position">0</property> | ||
407 | 36 | </packing> | ||
408 | 37 | </child> | ||
409 | 38 | <child> | ||
410 | 39 | <object class="GtkButton" id="button1"> | ||
411 | 40 | <property name="label">gtk-ok</property> | ||
412 | 41 | <property name="visible">True</property> | ||
413 | 42 | <property name="can_focus">True</property> | ||
414 | 43 | <property name="receives_default">True</property> | ||
415 | 44 | <property name="use_stock">True</property> | ||
416 | 45 | <signal name="clicked" handler="ok"/> | ||
417 | 46 | </object> | ||
418 | 47 | <packing> | ||
419 | 48 | <property name="expand">False</property> | ||
420 | 49 | <property name="fill">False</property> | ||
421 | 50 | <property name="position">1</property> | ||
422 | 51 | </packing> | ||
423 | 52 | </child> | ||
424 | 53 | </object> | ||
425 | 54 | <packing> | ||
426 | 55 | <property name="expand">False</property> | ||
427 | 56 | <property name="pack_type">end</property> | ||
428 | 57 | <property name="position">0</property> | ||
429 | 58 | </packing> | ||
430 | 59 | </child> | ||
431 | 60 | </object> | ||
432 | 61 | </child> | ||
433 | 62 | <action-widgets> | ||
434 | 63 | <action-widget response="-6">button2</action-widget> | ||
435 | 64 | <action-widget response="-5">button1</action-widget> | ||
436 | 65 | </action-widgets> | ||
437 | 66 | </object> | ||
438 | 67 | </interface> | ||
439 | 68 | 0 | ||
440 | === removed file 'data/ui/about_magicicada_dialog.xml' | |||
441 | --- data/ui/about_magicicada_dialog.xml 2010-04-21 21:18:31 +0000 | |||
442 | +++ data/ui/about_magicicada_dialog.xml 1970-01-01 00:00:00 +0000 | |||
443 | @@ -1,9 +0,0 @@ | |||
444 | 1 | <glade-catalog name="about_magicicada_dialog" domain="glade-3" | ||
445 | 2 | depends="gtk+" version="1.0"> | ||
446 | 3 | <glade-widget-classes> | ||
447 | 4 | <glade-widget-class title="About Magicicada Dialog" name="AboutMagicicadaDialog" | ||
448 | 5 | generic-name="AboutMagicicadaDialog" parent="GtkAboutDialog" | ||
449 | 6 | icon-name="widget-gtk-about-dialog"/> | ||
450 | 7 | </glade-widget-classes> | ||
451 | 8 | |||
452 | 9 | </glade-catalog> | ||
453 | 10 | 0 | ||
454 | === modified file 'data/ui/gui.glade' | |||
455 | --- data/ui/gui.glade 2010-04-21 23:50:09 +0000 | |||
456 | +++ data/ui/gui.glade 2010-05-15 15:48:32 +0000 | |||
457 | @@ -2,83 +2,196 @@ | |||
458 | 2 | <interface> | 2 | <interface> |
459 | 3 | <requires lib="gtk+" version="2.16"/> | 3 | <requires lib="gtk+" version="2.16"/> |
460 | 4 | <!-- interface-naming-policy project-wide --> | 4 | <!-- interface-naming-policy project-wide --> |
461 | 5 | <object class="GtkListStore" id="liststore1"/> | ||
462 | 6 | <object class="GtkListStore" id="liststore2"/> | ||
463 | 5 | <object class="GtkWindow" id="main_window"> | 7 | <object class="GtkWindow" id="main_window"> |
464 | 8 | <property name="width_request">800</property> | ||
465 | 9 | <property name="height_request">600</property> | ||
466 | 6 | <property name="title" translatable="yes">Magicicada</property> | 10 | <property name="title" translatable="yes">Magicicada</property> |
468 | 7 | <signal name="destroy_event" handler="on_destroy"/> | 11 | <signal name="destroy" handler="on_main_window_destroy"/> |
469 | 8 | <child> | 12 | <child> |
470 | 9 | <object class="GtkVBox" id="vbox1"> | 13 | <object class="GtkVBox" id="vbox1"> |
471 | 10 | <property name="visible">True</property> | 14 | <property name="visible">True</property> |
472 | 11 | <child> | 15 | <child> |
487 | 12 | <object class="GtkVBox" id="vbox2"> | 16 | <object class="GtkMenuBar" id="menubar"> |
488 | 13 | <property name="visible">True</property> | 17 | <property name="visible">True</property> |
489 | 14 | <child> | 18 | <child> |
490 | 15 | <object class="GtkToolbar" id="toolbar"> | 19 | <object class="GtkMenuItem" id="menuitem1"> |
491 | 16 | <property name="visible">True</property> | 20 | <property name="visible">True</property> |
492 | 17 | <property name="icon_size_set">True</property> | 21 | <property name="label" translatable="yes">_File</property> |
493 | 18 | </object> | 22 | <property name="use_underline">True</property> |
494 | 19 | <packing> | 23 | <child type="submenu"> |
495 | 20 | <property name="expand">False</property> | 24 | <object class="GtkMenu" id="menu1"> |
496 | 21 | <property name="position">0</property> | 25 | <property name="visible">True</property> |
497 | 22 | </packing> | 26 | <child> |
498 | 23 | </child> | 27 | <object class="GtkImageMenuItem" id="quit"> |
499 | 24 | <child> | 28 | <property name="label">gtk-quit</property> |
500 | 25 | <object class="GtkHBox" id="hbox1"> | 29 | <property name="visible">True</property> |
501 | 30 | <property name="use_underline">True</property> | ||
502 | 31 | <property name="use_stock">True</property> | ||
503 | 32 | <signal name="activate" handler="on_quit_activate"/> | ||
504 | 33 | </object> | ||
505 | 34 | </child> | ||
506 | 35 | </object> | ||
507 | 36 | </child> | ||
508 | 37 | </object> | ||
509 | 38 | </child> | ||
510 | 39 | <child> | ||
511 | 40 | <object class="GtkMenuItem" id="menuitem4"> | ||
512 | 41 | <property name="visible">True</property> | ||
513 | 42 | <property name="label" translatable="yes">_Help</property> | ||
514 | 43 | <property name="use_underline">True</property> | ||
515 | 44 | <child type="submenu"> | ||
516 | 45 | <object class="GtkMenu" id="menu3"> | ||
517 | 46 | <property name="visible">True</property> | ||
518 | 47 | <child> | ||
519 | 48 | <object class="GtkImageMenuItem" id="about"> | ||
520 | 49 | <property name="label">gtk-about</property> | ||
521 | 50 | <property name="visible">True</property> | ||
522 | 51 | <property name="use_underline">True</property> | ||
523 | 52 | <property name="use_stock">True</property> | ||
524 | 53 | <signal name="activate" handler="on_about_activate"/> | ||
525 | 54 | </object> | ||
526 | 55 | </child> | ||
527 | 56 | </object> | ||
528 | 57 | </child> | ||
529 | 58 | </object> | ||
530 | 59 | </child> | ||
531 | 60 | </object> | ||
532 | 61 | <packing> | ||
533 | 62 | <property name="expand">False</property> | ||
534 | 63 | <property name="position">0</property> | ||
535 | 64 | </packing> | ||
536 | 65 | </child> | ||
537 | 66 | <child> | ||
538 | 67 | <object class="GtkToolbar" id="toolbar"> | ||
539 | 68 | <property name="visible">True</property> | ||
540 | 69 | <property name="toolbar_style">both</property> | ||
541 | 70 | <child> | ||
542 | 71 | <object class="GtkToolButton" id="start"> | ||
543 | 72 | <property name="width_request">50</property> | ||
544 | 73 | <property name="visible">True</property> | ||
545 | 74 | <property name="label" translatable="yes">Start</property> | ||
546 | 75 | <property name="use_underline">True</property> | ||
547 | 76 | <property name="stock_id">gtk-apply</property> | ||
548 | 77 | <signal name="clicked" handler="on_start_clicked"/> | ||
549 | 78 | </object> | ||
550 | 79 | <packing> | ||
551 | 80 | <property name="expand">False</property> | ||
552 | 81 | <property name="homogeneous">True</property> | ||
553 | 82 | </packing> | ||
554 | 83 | </child> | ||
555 | 84 | <child> | ||
556 | 85 | <object class="GtkToolButton" id="stop"> | ||
557 | 86 | <property name="width_request">50</property> | ||
558 | 87 | <property name="label" translatable="yes">Stop</property> | ||
559 | 88 | <property name="use_underline">True</property> | ||
560 | 89 | <property name="stock_id">gtk-stop</property> | ||
561 | 90 | <signal name="clicked" handler="on_stop_clicked"/> | ||
562 | 91 | </object> | ||
563 | 92 | <packing> | ||
564 | 93 | <property name="expand">False</property> | ||
565 | 94 | <property name="homogeneous">True</property> | ||
566 | 95 | </packing> | ||
567 | 96 | </child> | ||
568 | 97 | <child> | ||
569 | 98 | <object class="GtkToolButton" id="connect"> | ||
570 | 99 | <property name="width_request">80</property> | ||
571 | 100 | <property name="visible">True</property> | ||
572 | 101 | <property name="sensitive">False</property> | ||
573 | 102 | <property name="label" translatable="yes">Connect</property> | ||
574 | 103 | <property name="use_underline">True</property> | ||
575 | 104 | <property name="stock_id">gtk-connect</property> | ||
576 | 105 | <signal name="clicked" handler="on_connect_clicked"/> | ||
577 | 106 | </object> | ||
578 | 107 | <packing> | ||
579 | 108 | <property name="expand">False</property> | ||
580 | 109 | <property name="homogeneous">True</property> | ||
581 | 110 | </packing> | ||
582 | 111 | </child> | ||
583 | 112 | <child> | ||
584 | 113 | <object class="GtkToolButton" id="disconnect"> | ||
585 | 114 | <property name="width_request">80</property> | ||
586 | 115 | <property name="label" translatable="yes">Disconnect</property> | ||
587 | 116 | <property name="use_underline">True</property> | ||
588 | 117 | <property name="stock_id">gtk-disconnect</property> | ||
589 | 118 | <signal name="clicked" handler="on_disconnect_clicked"/> | ||
590 | 119 | </object> | ||
591 | 120 | <packing> | ||
592 | 121 | <property name="expand">False</property> | ||
593 | 122 | <property name="homogeneous">True</property> | ||
594 | 123 | </packing> | ||
595 | 124 | </child> | ||
596 | 125 | </object> | ||
597 | 126 | <packing> | ||
598 | 127 | <property name="expand">False</property> | ||
599 | 128 | <property name="position">1</property> | ||
600 | 129 | </packing> | ||
601 | 130 | </child> | ||
602 | 131 | <child> | ||
603 | 132 | <object class="GtkHBox" id="hbox1"> | ||
604 | 133 | <property name="visible">True</property> | ||
605 | 134 | <child> | ||
606 | 135 | <object class="GtkHBox" id="hbox2"> | ||
607 | 26 | <property name="visible">True</property> | 136 | <property name="visible">True</property> |
608 | 27 | <child> | 137 | <child> |
610 | 28 | <object class="GtkHBox" id="hbox2"> | 138 | <object class="GtkImage" id="is_started"> |
611 | 139 | <property name="width_request">30</property> | ||
612 | 29 | <property name="visible">True</property> | 140 | <property name="visible">True</property> |
640 | 30 | <child> | 141 | <property name="sensitive">False</property> |
641 | 31 | <object class="GtkImage" id="image1"> | 142 | <property name="xpad">3</property> |
642 | 32 | <property name="visible">True</property> | 143 | <property name="ypad">3</property> |
643 | 33 | <property name="stock">gtk-yes</property> | 144 | <property name="stock">gtk-yes</property> |
617 | 34 | </object> | ||
618 | 35 | <packing> | ||
619 | 36 | <property name="position">0</property> | ||
620 | 37 | </packing> | ||
621 | 38 | </child> | ||
622 | 39 | <child> | ||
623 | 40 | <object class="GtkImage" id="image2"> | ||
624 | 41 | <property name="visible">True</property> | ||
625 | 42 | <property name="stock">gtk-yes</property> | ||
626 | 43 | </object> | ||
627 | 44 | <packing> | ||
628 | 45 | <property name="position">1</property> | ||
629 | 46 | </packing> | ||
630 | 47 | </child> | ||
631 | 48 | <child> | ||
632 | 49 | <object class="GtkImage" id="image3"> | ||
633 | 50 | <property name="visible">True</property> | ||
634 | 51 | <property name="stock">gtk-no</property> | ||
635 | 52 | </object> | ||
636 | 53 | <packing> | ||
637 | 54 | <property name="position">2</property> | ||
638 | 55 | </packing> | ||
639 | 56 | </child> | ||
644 | 57 | </object> | 145 | </object> |
645 | 58 | <packing> | 146 | <packing> |
646 | 59 | <property name="position">0</property> | 147 | <property name="position">0</property> |
647 | 60 | </packing> | 148 | </packing> |
648 | 61 | </child> | 149 | </child> |
649 | 62 | <child> | 150 | <child> |
651 | 63 | <object class="GtkLabel" id="status"> | 151 | <object class="GtkImage" id="is_connected"> |
652 | 152 | <property name="width_request">30</property> | ||
653 | 64 | <property name="visible">True</property> | 153 | <property name="visible">True</property> |
655 | 65 | <property name="label" translatable="yes">Status</property> | 154 | <property name="sensitive">False</property> |
656 | 155 | <property name="xpad">3</property> | ||
657 | 156 | <property name="ypad">3</property> | ||
658 | 157 | <property name="stock">gtk-yes</property> | ||
659 | 66 | </object> | 158 | </object> |
660 | 67 | <packing> | 159 | <packing> |
661 | 68 | <property name="position">1</property> | 160 | <property name="position">1</property> |
662 | 69 | </packing> | 161 | </packing> |
663 | 70 | </child> | 162 | </child> |
664 | 163 | <child> | ||
665 | 164 | <object class="GtkImage" id="is_online"> | ||
666 | 165 | <property name="width_request">30</property> | ||
667 | 166 | <property name="visible">True</property> | ||
668 | 167 | <property name="sensitive">False</property> | ||
669 | 168 | <property name="xpad">3</property> | ||
670 | 169 | <property name="ypad">3</property> | ||
671 | 170 | <property name="stock">gtk-yes</property> | ||
672 | 171 | </object> | ||
673 | 172 | <packing> | ||
674 | 173 | <property name="position">2</property> | ||
675 | 174 | </packing> | ||
676 | 175 | </child> | ||
677 | 176 | </object> | ||
678 | 177 | <packing> | ||
679 | 178 | <property name="expand">False</property> | ||
680 | 179 | <property name="position">0</property> | ||
681 | 180 | </packing> | ||
682 | 181 | </child> | ||
683 | 182 | <child> | ||
684 | 183 | <object class="GtkLabel" id="status_label"> | ||
685 | 184 | <property name="visible">True</property> | ||
686 | 185 | <property name="label" translatable="yes">Service not started, click Start to continue.</property> | ||
687 | 71 | </object> | 186 | </object> |
688 | 72 | <packing> | 187 | <packing> |
689 | 73 | <property name="position">1</property> | 188 | <property name="position">1</property> |
690 | 74 | </packing> | 189 | </packing> |
691 | 75 | </child> | 190 | </child> |
692 | 76 | <child> | ||
693 | 77 | <placeholder/> | ||
694 | 78 | </child> | ||
695 | 79 | </object> | 191 | </object> |
696 | 80 | <packing> | 192 | <packing> |
698 | 81 | <property name="position">0</property> | 193 | <property name="expand">False</property> |
699 | 194 | <property name="position">2</property> | ||
700 | 82 | </packing> | 195 | </packing> |
701 | 83 | </child> | 196 | </child> |
702 | 84 | <child> | 197 | <child> |
703 | @@ -86,14 +199,68 @@ | |||
704 | 86 | <property name="visible">True</property> | 199 | <property name="visible">True</property> |
705 | 87 | <property name="can_focus">True</property> | 200 | <property name="can_focus">True</property> |
706 | 88 | <child> | 201 | <child> |
708 | 89 | <placeholder/> | 202 | <object class="GtkTreeView" id="metaq_view"> |
709 | 203 | <property name="visible">True</property> | ||
710 | 204 | <property name="can_focus">True</property> | ||
711 | 205 | <property name="model">liststore1</property> | ||
712 | 206 | </object> | ||
713 | 207 | <packing> | ||
714 | 208 | <property name="resize">True</property> | ||
715 | 209 | <property name="shrink">True</property> | ||
716 | 210 | </packing> | ||
717 | 90 | </child> | 211 | </child> |
718 | 91 | <child> | 212 | <child> |
720 | 92 | <placeholder/> | 213 | <object class="GtkTreeView" id="contentq_view"> |
721 | 214 | <property name="visible">True</property> | ||
722 | 215 | <property name="can_focus">True</property> | ||
723 | 216 | <property name="model">liststore2</property> | ||
724 | 217 | </object> | ||
725 | 218 | <packing> | ||
726 | 219 | <property name="resize">True</property> | ||
727 | 220 | <property name="shrink">True</property> | ||
728 | 221 | </packing> | ||
729 | 93 | </child> | 222 | </child> |
730 | 94 | </object> | 223 | </object> |
731 | 95 | <packing> | 224 | <packing> |
733 | 96 | <property name="position">1</property> | 225 | <property name="position">3</property> |
734 | 226 | </packing> | ||
735 | 227 | </child> | ||
736 | 228 | </object> | ||
737 | 229 | </child> | ||
738 | 230 | </object> | ||
739 | 231 | <object class="GtkStatusIcon" id="status_icon"> | ||
740 | 232 | <property name="has_tooltip">True</property> | ||
741 | 233 | <property name="tooltip_text">Magicicada</property> | ||
742 | 234 | <property name="title">Magicicada</property> | ||
743 | 235 | </object> | ||
744 | 236 | <object class="GtkAboutDialog" id="about_dialog"> | ||
745 | 237 | <property name="border_width">5</property> | ||
746 | 238 | <property name="type_hint">normal</property> | ||
747 | 239 | <property name="has_separator">False</property> | ||
748 | 240 | <property name="program_name">Magicicada</property> | ||
749 | 241 | <property name="copyright" translatable="yes">Copyright 2010 Natalia Bidart <natalia.bidart@gmail.com> | ||
750 | 242 | Copyright 2010 Facundo Batista <facundo.batista@gmail.com> | ||
751 | 243 | </property> | ||
752 | 244 | <property name="website">http://launchpad.net/magicicada</property> | ||
753 | 245 | <property name="license" translatable="yes">GPL v3.0</property> | ||
754 | 246 | <property name="authors">Natalia Bidart <natalia.bidart@gmail.com> | ||
755 | 247 | Facundo Batista <facundo.batista@gmail.com></property> | ||
756 | 248 | <child internal-child="vbox"> | ||
757 | 249 | <object class="GtkVBox" id="dialog-vbox1"> | ||
758 | 250 | <property name="visible">True</property> | ||
759 | 251 | <property name="spacing">2</property> | ||
760 | 252 | <child> | ||
761 | 253 | <placeholder/> | ||
762 | 254 | </child> | ||
763 | 255 | <child internal-child="action_area"> | ||
764 | 256 | <object class="GtkHButtonBox" id="dialog-action_area1"> | ||
765 | 257 | <property name="visible">True</property> | ||
766 | 258 | <property name="layout_style">end</property> | ||
767 | 259 | </object> | ||
768 | 260 | <packing> | ||
769 | 261 | <property name="expand">False</property> | ||
770 | 262 | <property name="pack_type">end</property> | ||
771 | 263 | <property name="position">0</property> | ||
772 | 97 | </packing> | 264 | </packing> |
773 | 98 | </child> | 265 | </child> |
774 | 99 | </object> | 266 | </object> |
775 | 100 | 267 | ||
776 | === removed file 'data/ui/magicicada_window.xml' | |||
777 | --- data/ui/magicicada_window.xml 2010-04-21 21:18:31 +0000 | |||
778 | +++ data/ui/magicicada_window.xml 1970-01-01 00:00:00 +0000 | |||
779 | @@ -1,8 +0,0 @@ | |||
780 | 1 | <glade-catalog name="magicicada_window" domain="glade-3" | ||
781 | 2 | depends="gtk+" version="1.0"> | ||
782 | 3 | <glade-widget-classes> | ||
783 | 4 | <glade-widget-class title="Magicicada Window" name="MagicicadaWindow" | ||
784 | 5 | generic-name="MagicicadaWindow" parent="GtkWindow" | ||
785 | 6 | icon-name="widget-gtk-window"/> | ||
786 | 7 | </glade-widget-classes> | ||
787 | 8 | </glade-catalog> | ||
788 | 9 | 0 | ||
789 | === removed file 'data/ui/preferences_magicicada_dialog.xml' | |||
790 | --- data/ui/preferences_magicicada_dialog.xml 2010-04-21 21:18:31 +0000 | |||
791 | +++ data/ui/preferences_magicicada_dialog.xml 1970-01-01 00:00:00 +0000 | |||
792 | @@ -1,9 +0,0 @@ | |||
793 | 1 | <glade-catalog name="preferences_magicicada_dialog" domain="glade-3" | ||
794 | 2 | depends="gtk+" version="1.0"> | ||
795 | 3 | <glade-widget-classes> | ||
796 | 4 | <glade-widget-class title="Magicicada Preferences Dialog" name="PreferencesMagicicadaDialog" | ||
797 | 5 | generic-name="PreferenceMagicicadaDialog" parent="GtkDialog" | ||
798 | 6 | icon-name="widget-gtk-dialog"/> | ||
799 | 7 | </glade-widget-classes> | ||
800 | 8 | |||
801 | 9 | </glade-catalog> | ||
802 | 10 | 0 | ||
803 | === removed file 'magicicada/AboutMagicicadaDialog.py' | |||
804 | --- magicicada/AboutMagicicadaDialog.py 2010-04-21 21:18:31 +0000 | |||
805 | +++ magicicada/AboutMagicicadaDialog.py 1970-01-01 00:00:00 +0000 | |||
806 | @@ -1,48 +0,0 @@ | |||
807 | 1 | # -*- coding: utf-8 -*- | ||
808 | 2 | ### BEGIN LICENSE | ||
809 | 3 | # This file is in the public domain | ||
810 | 4 | ### END LICENSE | ||
811 | 5 | |||
812 | 6 | import gtk | ||
813 | 7 | |||
814 | 8 | from magicicada.helpers import get_builder | ||
815 | 9 | |||
816 | 10 | import gettext | ||
817 | 11 | from gettext import gettext as _ | ||
818 | 12 | gettext.textdomain('magicicada') | ||
819 | 13 | |||
820 | 14 | class AboutMagicicadaDialog(gtk.AboutDialog): | ||
821 | 15 | __gtype_name__ = "AboutMagicicadaDialog" | ||
822 | 16 | |||
823 | 17 | def __new__(cls): | ||
824 | 18 | """Special static method that's automatically called by Python when | ||
825 | 19 | constructing a new instance of this class. | ||
826 | 20 | |||
827 | 21 | Returns a fully instantiated AboutMagicicadaDialog object. | ||
828 | 22 | """ | ||
829 | 23 | builder = get_builder('AboutMagicicadaDialog') | ||
830 | 24 | new_object = builder.get_object("about_magicicada_dialog") | ||
831 | 25 | new_object.finish_initializing(builder) | ||
832 | 26 | return new_object | ||
833 | 27 | |||
834 | 28 | def finish_initializing(self, builder): | ||
835 | 29 | """Called while initializing this instance in __new__ | ||
836 | 30 | |||
837 | 31 | finish_initalizing should be called after parsing the ui definition | ||
838 | 32 | and creating a AboutMagicicadaDialog object with it in order to | ||
839 | 33 | finish initializing the start of the new AboutMagicicadaDialog | ||
840 | 34 | instance. | ||
841 | 35 | |||
842 | 36 | Put your initialization code in here and leave __init__ undefined. | ||
843 | 37 | """ | ||
844 | 38 | # Get a reference to the builder and set up the signals. | ||
845 | 39 | self.builder = builder | ||
846 | 40 | self.builder.connect_signals(self) | ||
847 | 41 | |||
848 | 42 | # Code for other initialization actions should be added here. | ||
849 | 43 | |||
850 | 44 | |||
851 | 45 | if __name__ == "__main__": | ||
852 | 46 | dialog = AboutMagicicadaDialog() | ||
853 | 47 | dialog.show() | ||
854 | 48 | gtk.main() | ||
855 | 49 | 0 | ||
856 | === removed file 'magicicada/PreferencesMagicicadaDialog.py' | |||
857 | --- magicicada/PreferencesMagicicadaDialog.py 2010-04-21 21:18:31 +0000 | |||
858 | +++ magicicada/PreferencesMagicicadaDialog.py 1970-01-01 00:00:00 +0000 | |||
859 | @@ -1,111 +0,0 @@ | |||
860 | 1 | # -*- coding: utf-8 -*- | ||
861 | 2 | ### BEGIN LICENSE | ||
862 | 3 | # This file is in the public domain | ||
863 | 4 | ### END LICENSE | ||
864 | 5 | |||
865 | 6 | from desktopcouch.records.server import CouchDatabase | ||
866 | 7 | from desktopcouch.records.record import Record | ||
867 | 8 | import gtk | ||
868 | 9 | |||
869 | 10 | from magicicada.helpers import get_builder | ||
870 | 11 | |||
871 | 12 | import gettext | ||
872 | 13 | from gettext import gettext as _ | ||
873 | 14 | gettext.textdomain('magicicada') | ||
874 | 15 | |||
875 | 16 | class PreferencesMagicicadaDialog(gtk.Dialog): | ||
876 | 17 | __gtype_name__ = "PreferencesMagicicadaDialog" | ||
877 | 18 | preferences = {} | ||
878 | 19 | |||
879 | 20 | def __new__(cls): | ||
880 | 21 | """Special static method that's automatically called by Python when | ||
881 | 22 | constructing a new instance of this class. | ||
882 | 23 | |||
883 | 24 | Returns a fully instantiated PreferencesMagicicadaDialog object. | ||
884 | 25 | """ | ||
885 | 26 | builder = get_builder('PreferencesMagicicadaDialog') | ||
886 | 27 | new_object = builder.get_object("preferences_magicicada_dialog") | ||
887 | 28 | new_object.finish_initializing(builder) | ||
888 | 29 | return new_object | ||
889 | 30 | |||
890 | 31 | def finish_initializing(self, builder): | ||
891 | 32 | """Called while initializing this instance in __new__ | ||
892 | 33 | |||
893 | 34 | finish_initalizing should be called after parsing the ui definition | ||
894 | 35 | and creating a PreferencesMagicicadaDialog object with it in order to | ||
895 | 36 | finish initializing the start of the new PerferencesMagicicadaDialog | ||
896 | 37 | instance. | ||
897 | 38 | |||
898 | 39 | Put your initialization code in here and leave __init__ undefined. | ||
899 | 40 | """ | ||
900 | 41 | |||
901 | 42 | # Get a reference to the builder and set up the signals. | ||
902 | 43 | self.builder = builder | ||
903 | 44 | self.builder.connect_signals(self) | ||
904 | 45 | |||
905 | 46 | # Set up couchdb and the preference info. | ||
906 | 47 | self._db_name = "magicicada" | ||
907 | 48 | self._database = CouchDatabase(self._db_name, create=True) | ||
908 | 49 | self._preferences = None | ||
909 | 50 | self._key = None | ||
910 | 51 | |||
911 | 52 | # Set the record type and then initalize the preferences. | ||
912 | 53 | self._record_type = ( | ||
913 | 54 | "http://wiki.ubuntu.com/Quickly/RecordTypes/Magicicada/" | ||
914 | 55 | "Preferences") | ||
915 | 56 | self._preferences = self.get_preferences() | ||
916 | 57 | # TODO: code for other initialization actions should be added here | ||
917 | 58 | |||
918 | 59 | def get_preferences(self): | ||
919 | 60 | """Return a dict of preferences for magicicada. | ||
920 | 61 | |||
921 | 62 | Creates a couchdb record if necessary. | ||
922 | 63 | """ | ||
923 | 64 | if self._preferences == None: | ||
924 | 65 | # The dialog is initializing. | ||
925 | 66 | self._load_preferences() | ||
926 | 67 | |||
927 | 68 | # If there were no saved preference, this. | ||
928 | 69 | return self._preferences | ||
929 | 70 | |||
930 | 71 | def _load_preferences(self): | ||
931 | 72 | # TODO: add preferences to the self._preferences dict default | ||
932 | 73 | # preferences that will be overwritten if some are saved | ||
933 | 74 | self._preferences = {"record_type": self._record_type} | ||
934 | 75 | |||
935 | 76 | results = self._database.get_records( | ||
936 | 77 | record_type=self._record_type, create_view=True) | ||
937 | 78 | |||
938 | 79 | if len(results.rows) == 0: | ||
939 | 80 | # No preferences have ever been saved, save them before returning. | ||
940 | 81 | self._key = self._database.put_record(Record(self._preferences)) | ||
941 | 82 | else: | ||
942 | 83 | self._preferences = results.rows[0].value | ||
943 | 84 | del self._preferences['_rev'] | ||
944 | 85 | self._key = results.rows[0].value["_id"] | ||
945 | 86 | |||
946 | 87 | def _save_preferences(self): | ||
947 | 88 | self._database.update_fields(self._key, self._preferences) | ||
948 | 89 | |||
949 | 90 | def ok(self, widget, data=None): | ||
950 | 91 | """The user has elected to save the changes. | ||
951 | 92 | |||
952 | 93 | Called before the dialog returns gtk.RESONSE_OK from run(). | ||
953 | 94 | """ | ||
954 | 95 | |||
955 | 96 | # Make any updates to self._preferences here. e.g. | ||
956 | 97 | #self._preferences["preference1"] = "value2" | ||
957 | 98 | self._save_preferences() | ||
958 | 99 | |||
959 | 100 | def cancel(self, widget, data=None): | ||
960 | 101 | """The user has elected cancel changes. | ||
961 | 102 | |||
962 | 103 | Called before the dialog returns gtk.RESPONSE_CANCEL for run() | ||
963 | 104 | """ | ||
964 | 105 | # Restore any changes to self._preferences here. | ||
965 | 106 | pass | ||
966 | 107 | |||
967 | 108 | if __name__ == "__main__": | ||
968 | 109 | dialog = PreferencesMagicicadaDialog() | ||
969 | 110 | dialog.show() | ||
970 | 111 | gtk.main() | ||
971 | 112 | 0 | ||
972 | === modified file 'magicicada/__init__.py' | |||
973 | --- magicicada/__init__.py 2010-04-21 21:18:31 +0000 | |||
974 | +++ magicicada/__init__.py 2010-05-15 15:48:32 +0000 | |||
975 | @@ -0,0 +1,204 @@ | |||
976 | 1 | # __init__.py | ||
977 | 2 | # | ||
978 | 3 | # Author: Natalia Bidart <natalia.bidart@gmail.com> | ||
979 | 4 | # | ||
980 | 5 | # Copyright 2010 Chicharreros | ||
981 | 6 | # | ||
982 | 7 | # This program is free software: you can redistribute it and/or modify it | ||
983 | 8 | # under the terms of the GNU General Public License version 3, as published | ||
984 | 9 | # by the Free Software Foundation. | ||
985 | 10 | # | ||
986 | 11 | # This program is distributed in the hope that it will be useful, but | ||
987 | 12 | # WITHOUT ANY WARRANTY; without even the implied warranties of | ||
988 | 13 | # MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR | ||
989 | 14 | # PURPOSE. See the GNU General Public License for more details. | ||
990 | 15 | # | ||
991 | 16 | # You should have received a copy of the GNU General Public License along | ||
992 | 17 | # with this program. If not, see <http://www.gnu.org/licenses/>. | ||
993 | 18 | |||
994 | 19 | """Magicicada.""" | ||
995 | 20 | |||
996 | 21 | import gtk | ||
997 | 22 | |||
998 | 23 | import gettext | ||
999 | 24 | from gettext import gettext as _ | ||
1000 | 25 | gettext.textdomain('magicicada') | ||
1001 | 26 | |||
1002 | 27 | from twisted.internet import gtk2reactor # for gtk-2.0 | ||
1003 | 28 | gtk2reactor.install() | ||
1004 | 29 | |||
1005 | 30 | from twisted.internet import reactor | ||
1006 | 31 | |||
1007 | 32 | from magicicada.helpers import get_data_file, get_builder, print_debug | ||
1008 | 33 | from magicicada.syncdaemon import SyncDaemon | ||
1009 | 34 | |||
1010 | 35 | |||
1011 | 36 | class MagicicadaUI(object): | ||
1012 | 37 | |||
1013 | 38 | STATUS = { | ||
1014 | 39 | 'started': _('Service started, click Connect to continue.'), | ||
1015 | 40 | 'connected': _('Service connected. Doing internal synchronization...'), | ||
1016 | 41 | 'online': _('Service reached Nirvana.'), | ||
1017 | 42 | } | ||
1018 | 43 | |||
1019 | 44 | def __init__(self, launchpad_available=False): | ||
1020 | 45 | """Init.""" | ||
1021 | 46 | self.builder = get_builder('gui.glade') | ||
1022 | 47 | self.builder.connect_signals(self) | ||
1023 | 48 | |||
1024 | 49 | if launchpad_available: | ||
1025 | 50 | # for more information about LaunchpadIntegration: | ||
1026 | 51 | # wiki.ubuntu.com/UbuntuDevelopment/Internationalisation/Coding | ||
1027 | 52 | helpmenu = self.builder.get_object('helpMenu') | ||
1028 | 53 | if helpmenu: | ||
1029 | 54 | LaunchpadIntegration.set_sourcepackagename('magicicada') | ||
1030 | 55 | LaunchpadIntegration.add_items(helpmenu, 0, False, True) | ||
1031 | 56 | |||
1032 | 57 | animation_filename = get_data_file('media', 'loader-ball.gif') | ||
1033 | 58 | self.loading_animation = gtk.gdk.PixbufAnimation(animation_filename) | ||
1034 | 59 | |||
1035 | 60 | self.started = self.connected = self.online = False | ||
1036 | 61 | |||
1037 | 62 | widgets = ( | ||
1038 | 63 | 'start', 'stop', 'connect', 'disconnect', # toolbar buttons | ||
1039 | 64 | 'is_started', 'is_connected', 'is_online', # status bar images | ||
1040 | 65 | 'status_label', 'status_icon', # status label and systray icon | ||
1041 | 66 | 'main_window', 'about_dialog', | ||
1042 | 67 | ) | ||
1043 | 68 | for widget in widgets: | ||
1044 | 69 | setattr(self, widget, self.builder.get_object(widget)) | ||
1045 | 70 | |||
1046 | 71 | icon_filename = get_data_file('media', 'ubuntuone.png') | ||
1047 | 72 | self.status_icon.set_from_file(icon_filename) | ||
1048 | 73 | |||
1049 | 74 | self.main_window.set_icon_from_file(icon_filename) | ||
1050 | 75 | self.main_window.show() | ||
1051 | 76 | |||
1052 | 77 | self.syncdaemon = SyncDaemon() | ||
1053 | 78 | |||
1054 | 79 | def run(self): | ||
1055 | 80 | """Do the deed.""" | ||
1056 | 81 | reactor.run() # instead of: gtk.main() | ||
1057 | 82 | |||
1058 | 83 | def shutdown(self): | ||
1059 | 84 | """Stop the deed.""" | ||
1060 | 85 | reactor.stop() # instead of: gtk.main_quit() | ||
1061 | 86 | |||
1062 | 87 | # GTK callbacks | ||
1063 | 88 | |||
1064 | 89 | def on_main_window_destroy(self, widget, data=None): | ||
1065 | 90 | """Called when the MagicicadaWindow is closed.""" | ||
1066 | 91 | # Clean up code for saving application state should be added here. | ||
1067 | 92 | if self.started: | ||
1068 | 93 | self.on_stop_clicked(self.stop) | ||
1069 | 94 | self.syncdaemon.shutdown() | ||
1070 | 95 | |||
1071 | 96 | def on_quit_activate(self, widget, data=None): | ||
1072 | 97 | """Signal handler for closing the program.""" | ||
1073 | 98 | self.on_main_window_destroy(self.main_window) | ||
1074 | 99 | |||
1075 | 100 | def on_about_activate(self, widget, data=None): | ||
1076 | 101 | """Display the about box.""" | ||
1077 | 102 | response = self.about_dialog.run() | ||
1078 | 103 | self.about_dialog.hide() | ||
1079 | 104 | |||
1080 | 105 | @print_debug | ||
1081 | 106 | def on_start_clicked(self, widget, data=None): | ||
1082 | 107 | """Start syncdaemon.""" | ||
1083 | 108 | self.started = True | ||
1084 | 109 | self.connect.set_sensitive(True) | ||
1085 | 110 | self.start.hide() | ||
1086 | 111 | self.stop.show() | ||
1087 | 112 | |||
1088 | 113 | self.doing_something(self.is_started) | ||
1089 | 114 | |||
1090 | 115 | @print_debug | ||
1091 | 116 | def on_stop_clicked(self, widget, data=None): | ||
1092 | 117 | """Stop syncdaemon.""" | ||
1093 | 118 | assert self.started | ||
1094 | 119 | |||
1095 | 120 | if self.connected: | ||
1096 | 121 | self.on_disconnect_clicked(self.disconnect) | ||
1097 | 122 | self.connect.set_sensitive(False) | ||
1098 | 123 | |||
1099 | 124 | self.started = False | ||
1100 | 125 | self.start.show() | ||
1101 | 126 | self.stop.hide() | ||
1102 | 127 | |||
1103 | 128 | self.on_stopped() | ||
1104 | 129 | |||
1105 | 130 | @print_debug | ||
1106 | 131 | def on_connect_clicked(self, widget, data=None): | ||
1107 | 132 | """Connect syncdaemon.""" | ||
1108 | 133 | assert self.started | ||
1109 | 134 | self.connected = True | ||
1110 | 135 | self.connect.hide() | ||
1111 | 136 | self.disconnect.show() | ||
1112 | 137 | |||
1113 | 138 | self.on_started() | ||
1114 | 139 | self.doing_something(self.is_connected) | ||
1115 | 140 | |||
1116 | 141 | @print_debug | ||
1117 | 142 | def on_disconnect_clicked(self, widget, data=None): | ||
1118 | 143 | """Disconnect syncdaemon.""" | ||
1119 | 144 | assert self.started | ||
1120 | 145 | assert self.connected | ||
1121 | 146 | self.connected = False | ||
1122 | 147 | self.connect.show() | ||
1123 | 148 | self.disconnect.hide() | ||
1124 | 149 | |||
1125 | 150 | self.on_disconnected() | ||
1126 | 151 | |||
1127 | 152 | # DBus callbacks | ||
1128 | 153 | |||
1129 | 154 | def on_started(self, *args, **kwargs): | ||
1130 | 155 | """Callback'ed when syncadaemon is started.""" | ||
1131 | 156 | self.stop_doing_something(self.is_started) | ||
1132 | 157 | self.status_label.set_text(self.STATUS['started']) | ||
1133 | 158 | |||
1134 | 159 | def on_stopped(self, *args, **kwargs): | ||
1135 | 160 | """Callback'ed when syncadaemon is stopped.""" | ||
1136 | 161 | |||
1137 | 162 | self.stop_doing_something(self.is_started, sensitive=False) | ||
1138 | 163 | |||
1139 | 164 | self.is_started.set_sensitive(False) | ||
1140 | 165 | self.is_connected.set_sensitive(False) | ||
1141 | 166 | self.is_online.set_sensitive(False) | ||
1142 | 167 | |||
1143 | 168 | def on_connected(self, *args, **kwargs): | ||
1144 | 169 | """Callback'ed when syncadaemon is connected.""" | ||
1145 | 170 | self.is_connected.set_sensitive(True) | ||
1146 | 171 | self.doing_something(self.is_online) | ||
1147 | 172 | self.status_label.set_text(self.STATUS['connected']) | ||
1148 | 173 | |||
1149 | 174 | def on_disconnected(self, *args, **kwargs): | ||
1150 | 175 | """Callback'ed when syncadaemon is disconnected.""" | ||
1151 | 176 | |||
1152 | 177 | self.stop_doing_something(self.is_connected, sensitive=False) | ||
1153 | 178 | |||
1154 | 179 | self.is_connected.set_sensitive(False) | ||
1155 | 180 | self.is_online.set_sensitive(False) | ||
1156 | 181 | |||
1157 | 182 | def on_online(self, *args, **kwargs): | ||
1158 | 183 | """Callback'ed when syncadaemon is online.""" | ||
1159 | 184 | self.is_onlined.set_sensitive(True) | ||
1160 | 185 | self.status_label.set_text(self.STATUS['online']) | ||
1161 | 186 | |||
1162 | 187 | def on_offline(self, *args, **kwargs): | ||
1163 | 188 | """Callback'ed when syncadaemon is offline.""" | ||
1164 | 189 | |||
1165 | 190 | self.stop_doing_something(self.is_online, sensitive=False) | ||
1166 | 191 | |||
1167 | 192 | self.is_online.set_sensitive(False) | ||
1168 | 193 | |||
1169 | 194 | # custom | ||
1170 | 195 | |||
1171 | 196 | def doing_something(self, what): | ||
1172 | 197 | """Set a loader animation on 'what'.""" | ||
1173 | 198 | what.set_sensitive(True) | ||
1174 | 199 | what.set_from_animation(self.loading_animation) | ||
1175 | 200 | |||
1176 | 201 | def stop_doing_something(self, what, sensitive=True): | ||
1177 | 202 | """Set a loader animation on 'what'.""" | ||
1178 | 203 | what.set_from_stock(gtk.STOCK_YES, gtk.ICON_SIZE_BUTTON) | ||
1179 | 204 | what.set_sensitive(sensitive) | ||
1180 | 0 | 205 | ||
1181 | === modified file 'magicicada/helpers.py' | |||
1182 | --- magicicada/helpers.py 2010-04-21 23:50:09 +0000 | |||
1183 | +++ magicicada/helpers.py 2010-05-15 15:48:32 +0000 | |||
1184 | @@ -12,6 +12,8 @@ | |||
1185 | 12 | import os | 12 | import os |
1186 | 13 | import gtk | 13 | import gtk |
1187 | 14 | 14 | ||
1188 | 15 | from functools import wraps | ||
1189 | 16 | |||
1190 | 15 | from magicicada.magicicadaconfig import get_data_file | 17 | from magicicada.magicicadaconfig import get_data_file |
1191 | 16 | 18 | ||
1192 | 17 | import gettext | 19 | import gettext |
1193 | @@ -19,9 +21,8 @@ | |||
1194 | 19 | gettext.textdomain('magicicada') | 21 | gettext.textdomain('magicicada') |
1195 | 20 | 22 | ||
1196 | 21 | def get_builder(builder_file_name): | 23 | def get_builder(builder_file_name): |
1200 | 22 | """Return a fully-instantiated gtk.Builder instance from specified ui | 24 | """Return a fully-instantiated gtk.Builder instance from specified ui file. |
1201 | 23 | file | 25 | |
1199 | 24 | |||
1202 | 25 | :param builder_file_name: The name of the builder file, without extension. | 26 | :param builder_file_name: The name of the builder file, without extension. |
1203 | 26 | Assumed to be in the 'ui' directory under the data path. | 27 | Assumed to be in the 'ui' directory under the data path. |
1204 | 27 | """ | 28 | """ |
1205 | @@ -34,3 +35,14 @@ | |||
1206 | 34 | builder.set_translation_domain('magicicada') | 35 | builder.set_translation_domain('magicicada') |
1207 | 35 | builder.add_from_file(ui_filename) | 36 | builder.add_from_file(ui_filename) |
1208 | 36 | return builder | 37 | return builder |
1209 | 38 | |||
1210 | 39 | def print_debug(f): | ||
1211 | 40 | """Print debug info for 'f'.""" | ||
1212 | 41 | |||
1213 | 42 | @wraps(f) | ||
1214 | 43 | def inner(*args, **kwargs): | ||
1215 | 44 | """Wrap f.""" | ||
1216 | 45 | print('Calling', f.__name__, args, kwargs) | ||
1217 | 46 | f(*args, **kwargs) | ||
1218 | 47 | |||
1219 | 48 | return inner | ||
1220 | 37 | 49 | ||
1221 | === modified file 'magicicada/syncdaemon.py' | |||
1222 | --- magicicada/syncdaemon.py 2010-05-04 01:30:42 +0000 | |||
1223 | +++ magicicada/syncdaemon.py 2010-05-15 15:48:32 +0000 | |||
1224 | @@ -18,9 +18,14 @@ | |||
1225 | 18 | 18 | ||
1226 | 19 | """The backend that communicates Magicicada with the SyncDaemon.""" | 19 | """The backend that communicates Magicicada with the SyncDaemon.""" |
1227 | 20 | 20 | ||
1231 | 21 | # this always first | 21 | import sys |
1232 | 22 | from twisted.internet import glib2reactor | 22 | |
1233 | 23 | glib2reactor.install() | 23 | try: |
1234 | 24 | from twisted.internet import glib2reactor | ||
1235 | 25 | glib2reactor.install() | ||
1236 | 26 | except AssertionError, e: | ||
1237 | 27 | msg = '\nsyncdaemon.py: Not installing glib2reactor because: %s.\n' | ||
1238 | 28 | sys.stderr.write(msg % e) | ||
1239 | 24 | 29 | ||
1240 | 25 | import collections | 30 | import collections |
1241 | 26 | import re | 31 | import re |
1242 | 27 | 32 | ||
1243 | === added file 'magicicada/tests/test_magicicada.py' | |||
1244 | --- magicicada/tests/test_magicicada.py 1970-01-01 00:00:00 +0000 | |||
1245 | +++ magicicada/tests/test_magicicada.py 2010-05-15 15:48:32 +0000 | |||
1246 | @@ -0,0 +1,150 @@ | |||
1247 | 1 | # test_magicicada.py | ||
1248 | 2 | # | ||
1249 | 3 | # Author: Natalia Bidart <natalia.bidart@gmail.com> | ||
1250 | 4 | # | ||
1251 | 5 | # Copyright 2010 Chicharreros | ||
1252 | 6 | # | ||
1253 | 7 | # This program is free software: you can redistribute it and/or modify it | ||
1254 | 8 | # under the terms of the GNU General Public License version 3, as published | ||
1255 | 9 | # by the Free Software Foundation. | ||
1256 | 10 | # | ||
1257 | 11 | # This program is distributed in the hope that it will be useful, but | ||
1258 | 12 | # WITHOUT ANY WARRANTY; without even the implied warranties of | ||
1259 | 13 | # MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR | ||
1260 | 14 | # PURPOSE. See the GNU General Public License for more details. | ||
1261 | 15 | # | ||
1262 | 16 | # You should have received a copy of the GNU General Public License along | ||
1263 | 17 | # with this program. If not, see <http://www.gnu.org/licenses/>. | ||
1264 | 18 | |||
1265 | 19 | """Tests for magicicada.""" | ||
1266 | 20 | |||
1267 | 21 | import gobject | ||
1268 | 22 | import gtk | ||
1269 | 23 | import unittest | ||
1270 | 24 | |||
1271 | 25 | from functools import wraps | ||
1272 | 26 | |||
1273 | 27 | from twisted.internet import reactor | ||
1274 | 28 | from twisted.trial.unittest import TestCase | ||
1275 | 29 | |||
1276 | 30 | from magicicada import MagicicadaUI | ||
1277 | 31 | from magicicada.helpers import get_builder | ||
1278 | 32 | from magicicada.syncdaemon import SyncDaemon | ||
1279 | 33 | |||
1280 | 34 | DEFAULT_TIMEOUT = 200 | ||
1281 | 35 | NO_OP = lambda *a, **kw: None | ||
1282 | 36 | |||
1283 | 37 | def close_window_after(a_test): | ||
1284 | 38 | """Decorator to close the main window after executing f.""" | ||
1285 | 39 | @wraps(a_test) | ||
1286 | 40 | def inner(*args, **kwargs): | ||
1287 | 41 | """Inner function.""" | ||
1288 | 42 | #gobject.timeout_add(DEFAULT_TIMEOUT, a_test) | ||
1289 | 43 | #self.ui.run() | ||
1290 | 44 | |||
1291 | 45 | return inner | ||
1292 | 46 | |||
1293 | 47 | |||
1294 | 48 | class MagicicadaUITestCase(TestCase): | ||
1295 | 49 | """UI test cases for Magicicada UI.""" | ||
1296 | 50 | |||
1297 | 51 | def setUp(self): | ||
1298 | 52 | """Init.""" | ||
1299 | 53 | self.builder = get_builder('gui.glade') | ||
1300 | 54 | self.ui = MagicicadaUI() | ||
1301 | 55 | self._patched = {} | ||
1302 | 56 | self._called = False | ||
1303 | 57 | |||
1304 | 58 | def tearDown(self): | ||
1305 | 59 | """Clenaup.""" | ||
1306 | 60 | self.ui.on_main_window_destroy(self.ui.main_window) | ||
1307 | 61 | for (instance, attr), old_value in self._patched.iteritems(): | ||
1308 | 62 | setattr(instance, attr, old_value) | ||
1309 | 63 | self._called = False | ||
1310 | 64 | self.builder = None | ||
1311 | 65 | |||
1312 | 66 | def test_init_creates_sd_instance(self): | ||
1313 | 67 | """SyncDaemon instance is created at creation time.""" | ||
1314 | 68 | self.assertTrue(isinstance(self.ui.syncdaemon, SyncDaemon)) | ||
1315 | 69 | |||
1316 | 70 | def test_destroy_shutdowns_sd_instance(self): | ||
1317 | 71 | """SyncDaemon instance is shutdown at destroy time.""" | ||
1318 | 72 | self.patch(self.ui.syncdaemon, 'shutdown', | ||
1319 | 73 | lambda *_: setattr(self, '_called', True)) | ||
1320 | 74 | self.ui.on_main_window_destroy(self.ui.main_window) | ||
1321 | 75 | self.assertTrue(self._called, 'syncdaemon.shutdown must be called at destroy time.') | ||
1322 | 76 | |||
1323 | 77 | def test_shutdown_stops_reactor(self): | ||
1324 | 78 | """SyncDaemon instance is shutdown at destroy time.""" | ||
1325 | 79 | self.patch(reactor, 'stop', | ||
1326 | 80 | lambda *_: setattr(self, '_called', True)) | ||
1327 | 81 | self.ui.shutdown() | ||
1328 | 82 | self.assertTrue(self._called, 'reactor.stop must be called at destroy time.') | ||
1329 | 83 | |||
1330 | 84 | |||
1331 | 85 | class MagicicadaUIStartupTestCase(MagicicadaUITestCase): | ||
1332 | 86 | """UI test cases for startup state.""" | ||
1333 | 87 | |||
1334 | 88 | def test_main_window_is_visible(self): | ||
1335 | 89 | """UI can be created.""" | ||
1336 | 90 | self.assertTrue(self.ui.main_window.get_property('visible')) | ||
1337 | 91 | |||
1338 | 92 | def test_start_connect_are_visible(self): | ||
1339 | 93 | """Start and Connect buttons are visible.""" | ||
1340 | 94 | self.assertTrue(self.ui.start.get_property('visible')) | ||
1341 | 95 | self.assertTrue(self.ui.start.is_sensitive()) | ||
1342 | 96 | |||
1343 | 97 | self.assertTrue(self.ui.connect.get_property('visible')) | ||
1344 | 98 | self.assertFalse(self.ui.connect.is_sensitive()) | ||
1345 | 99 | |||
1346 | 100 | def test_stop_disconnect_are_not_visible(self): | ||
1347 | 101 | """Start and Connect buttons are visible.""" | ||
1348 | 102 | self.assertFalse(self.ui.stop.get_property('visible')) | ||
1349 | 103 | self.assertFalse(self.ui.disconnect.get_property('visible')) | ||
1350 | 104 | |||
1351 | 105 | def test_not_started_not_connected_not_online(self): | ||
1352 | 106 | """Test default values for flags.""" | ||
1353 | 107 | self.assertFalse(self.ui.started) | ||
1354 | 108 | self.assertFalse(self.ui.connected) | ||
1355 | 109 | self.assertFalse(self.ui.online) | ||
1356 | 110 | |||
1357 | 111 | def test_indicators_are_non_sensitive(self): | ||
1358 | 112 | """Test default sensitivity for indicators.""" | ||
1359 | 113 | #import pdb; pdb.set_trace() | ||
1360 | 114 | self.assertFalse(self.ui.is_started.is_sensitive()) | ||
1361 | 115 | self.assertFalse(self.ui.is_connected.is_sensitive()) | ||
1362 | 116 | self.assertFalse(self.ui.is_online.is_sensitive()) | ||
1363 | 117 | |||
1364 | 118 | class MagicicadaUIClickedTestCase(MagicicadaUIStartupTestCase): | ||
1365 | 119 | """UI test cases.""" | ||
1366 | 120 | |||
1367 | 121 | def test_started_if_start_clicked(self): | ||
1368 | 122 | """Test started if Start was clicked.""" | ||
1369 | 123 | self.ui.on_start_clicked(self.ui.start) | ||
1370 | 124 | self.assertTrue(self.ui.started) | ||
1371 | 125 | self.assertFalse(self.ui.connected) | ||
1372 | 126 | self.assertFalse(self.ui.online) | ||
1373 | 127 | |||
1374 | 128 | def test_can_connect_can_stop_if_start_clicked(self): | ||
1375 | 129 | """Test Connect and Stop are enabled if Start was clicked.""" | ||
1376 | 130 | self.ui.on_start_clicked(self.ui.start) | ||
1377 | 131 | self.assertFalse(self.ui.start.get_property('visible')) | ||
1378 | 132 | self.assertTrue(self.ui.stop.get_property('visible')) | ||
1379 | 133 | self.assertTrue(self.ui.connect.is_sensitive()) | ||
1380 | 134 | |||
1381 | 135 | def test_connected_if_connect_clicked(self): | ||
1382 | 136 | """Test connected if Connect was clicked.""" | ||
1383 | 137 | self.ui.on_start_clicked(self.ui.start) # need to be started | ||
1384 | 138 | self.ui.on_connect_clicked(self.ui.connect) | ||
1385 | 139 | |||
1386 | 140 | self.assertTrue(self.ui.started) | ||
1387 | 141 | self.assertTrue(self.ui.connected) | ||
1388 | 142 | self.assertFalse(self.ui.online) | ||
1389 | 143 | |||
1390 | 144 | def test_can_disconnect_if_connect_clicked(self): | ||
1391 | 145 | """Test Disconnect is enabled if Connect was clicked.""" | ||
1392 | 146 | self.ui.on_start_clicked(self.ui.start) # need to be started | ||
1393 | 147 | self.ui.on_connect_clicked(self.ui.connect) | ||
1394 | 148 | self.assertFalse(self.ui.connect.get_property('visible')) | ||
1395 | 149 | self.assertTrue(self.ui.disconnect.get_property('visible')) | ||
1396 | 150 |
facundo@ exepus: ~/devel/ reps/magicicada /review_ build-gui$ nosetests
syncdaemon.py: Not installing glib2reactor because: reactor already installed. ....... ....... ....... ....... ....... EEE.... .. ======= ======= ======= ======= ======= ======= ======= ======= ======= ------- ------- ------- ------- ------- ------- ------- ------- ------- regateError: Reactor was unclean. internet. base.DelayedCal l.debug = True to debug) _check_ mq()> _check_ mq()> _check_ mq()> _check_ mq()> _check_ mq()> _check_ mq()> _check_ mq()> _check_ mq()> _check_ mq()> _check_ mq()> _check_ mq()> _check_ mq()> _check_ mq()> _check_ mq()> _check_ mq()> _check_ mq()> _check_ mq()> _check_ mq()> _check_ mq()> _check_ mq()>
.......
=======
ERROR: Check that it polls mq until no more is needed.
-------
DirtyReactorAgg
DelayedCalls: (set twisted.
<DelayedCall 0xac7ab6c [3.80157804489s] called=0 cancelled=0 SyncDaemon.
<DelayedCall 0xac7a8ac [3.79958200455s] called=0 cancelled=0 SyncDaemon.
<DelayedCall 0xac7a96c [3.80020308495s] called=0 cancelled=0 SyncDaemon.
<DelayedCall 0xac7aa6c [3.80084300041s] called=0 cancelled=0 SyncDaemon.
<DelayedCall 0xac7ae6c [3.80354785919s] called=0 cancelled=0 SyncDaemon.
<DelayedCall 0xac7ac6c [3.80206394196s] called=0 cancelled=0 SyncDaemon.
<DelayedCall 0xac7ad6c [3.80287098885s] called=0 cancelled=0 SyncDaemon.
<DelayedCall 0xac7fb8c [3.81115484238s] called=0 cancelled=0 SyncDaemon.
<DelayedCall 0xac7af6c [3.80402112007s] called=0 cancelled=0 SyncDaemon.
<DelayedCall 0xac7f08c [3.80454802513s] called=0 cancelled=0 SyncDaemon.
<DelayedCall 0xac7f18c [3.80509400368s] called=0 cancelled=0 SyncDaemon.
<DelayedCall 0xac7f28c [3.80576300621s] called=0 cancelled=0 SyncDaemon.
<DelayedCall 0xac7f38c [3.80635905266s] called=0 cancelled=0 SyncDaemon.
<DelayedCall 0xac7f48c [3.80693697929s] called=0 cancelled=0 SyncDaemon.
<DelayedCall 0xac7f58c [3.80750989914s] called=0 cancelled=0 SyncDaemon.
<DelayedCall 0xac7f68c [3.80805492401s] called=0 cancelled=0 SyncDaemon.
<DelayedCall 0xac7f78c [3.80859208107s] called=0 cancelled=0 SyncDaemon.
<DelayedCall 0xac7f88c [3.80918884277s] called=0 cancelled=0 SyncDaemon.
<DelayedCall 0xac7f98c [3.80973696709s] called=0 cancelled=0 SyncDaemon.
<DelayedCall 0xac7fa8c [3.81028389931s] called=0 cancelled=0 SyncDaemon.
======= ======= ======= ======= ======= ======= ======= ======= ======= ======= ------- ------- ------- ------- ------- ------- ------- ------- ------- regateError: Reactor was unclean. internet. base.DelayedCal l.debug = True to debug) _check_ mq()> _check_ mq()> _check_ mq()> _check_ mq()> _check_ mq()> _check_ mq()> _check_ mq()>
ERROR: Check that it polls mq while working in both.
-------
DirtyReactorAgg
DelayedCalls: (set twisted.
<DelayedCall 0xac7a72c [4.99101114273s] called=0 cancelled=0 SyncDaemon.
<DelayedCall 0xac7f8ec [4.98898601532s] called=0 cancelled=0 SyncDaemon.
<DelayedCall 0xac7f24c [4.98936009407s] called=0 cancelled=0 SyncDaemon.
<DelayedCall 0xac7a86c [4.98973798752s] called=0 cancelled=0 SyncDaemon.
<DelayedCall 0xac7a7cc [4.99011516571s] called=0 cancelled=0 SyncDaemon.
<DelayedCall 0xac7a7ec [4.99048709869s] called=0 cancelled=0 SyncDaemon.
<DelayedCall 0xac7f4cc [4.99738693237s] called=0 cancelled=0 SyncDaemon.
<DelayedCall 0xac7ad0c [4.99150681496s] called=0 cancelled=0 Sy...