Merge lp:~jonobacon/ubuntu-accomplishments-viewer/publishonline into lp:ubuntu-accomplishments-viewer
- publishonline
- Merge into accomplishments-viewer
Status: | Merged |
---|---|
Merged at revision: | 117 |
Proposed branch: | lp:~jonobacon/ubuntu-accomplishments-viewer/publishonline |
Merge into: | lp:ubuntu-accomplishments-viewer |
Diff against target: |
400 lines (+213/-27) 4 files modified
accomplishments_viewer/AccomplishmentsViewerWindow.py (+10/-0) accomplishments_viewer/PreferencesAccomplishmentsViewerDialog.py (+28/-1) data/ui/PreferencesAccomplishmentsViewerDialog.ui (+119/-0) po/accomplishments-viewer.pot (+56/-26) |
To merge this branch: | bzr merge lp:~jonobacon/ubuntu-accomplishments-viewer/publishonline |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Ubuntu Accomplishments Viewer Developers | Pending | ||
Review via email: mp+111789@code.launchpad.net |
Commit message
Description of the change
This branch adds support to the desktop client for a user to publish their trophies to the web application that will be landing as part of the 0.3 release. Please note, you will also need to have lp:~jonobacon/ubuntu-accomplishments-daemon/publishonline to use this.
This is how it works:
* The user loads Edit -> Preferences and can click a Publish button to share their trophies online. If they are currently publishing they instead see a Stop Publishing button.
Publishing involves the following:
* We scan the list of shared directories for ones that are shared with the validation server.
* For the share that is active, we create a WEBVIEW file in the trophy dir (this is used by the web app to show publishing.
* We also generate a URL with the share name and share id for the user to set up their online trophy cabinet.
This feature should now be complete to land in trunk.
- 118. By Jono Bacon
-
* Launch browser fromt he client now. A better, cleaner way of doing things.
Preview Diff
1 | === modified file 'accomplishments_viewer/AccomplishmentsViewerWindow.py' |
2 | --- accomplishments_viewer/AccomplishmentsViewerWindow.py 2012-06-23 14:05:24 +0000 |
3 | +++ accomplishments_viewer/AccomplishmentsViewerWindow.py 2012-06-25 22:37:19 +0000 |
4 | @@ -263,6 +263,9 @@ |
5 | object.connect_to_signal("trophy_recieved", |
6 | self.trophy_received, |
7 | dbus_interface="org.ubuntu.accomplishments", arg0="Hello") |
8 | + object.connect_to_signal("publish_trophies_online_completed", |
9 | + self.publish_trophies_online_completed, |
10 | + dbus_interface="org.ubuntu.accomplishments", arg0="Hello") |
11 | object.connect_to_signal("scriptrunner_start", |
12 | self.scriptrunner_start, |
13 | dbus_interface="org.ubuntu.accomplishments") |
14 | @@ -272,6 +275,7 @@ |
15 | object.connect_to_signal("ubuntu_one_account_ready", |
16 | self.ubuntu_one_account_ready, |
17 | dbus_interface="org.ubuntu.accomplishments", arg0="Hello") |
18 | + |
19 | except dbus.DBusException: |
20 | traceback.print_exc() |
21 | print usage |
22 | @@ -280,6 +284,9 @@ |
23 | bus.add_signal_receiver(self.trophy_received, |
24 | dbus_interface = "org.ubuntu.accomplishments", |
25 | signal_name = "trophy_received") |
26 | + bus.add_signal_receiver(self.publish_trophies_online_completed, |
27 | + dbus_interface = "org.ubuntu.accomplishments", |
28 | + signal_name = "publish_trophies_online_completed") |
29 | bus.add_signal_receiver(self.scriptrunner_start, |
30 | dbus_interface = "org.ubuntu.accomplishments", |
31 | signal_name = "scriptrunner_start") |
32 | @@ -296,6 +303,9 @@ |
33 | |
34 | return True |
35 | |
36 | + def publish_trophies_online_completed(self, url): |
37 | + webbrowser.open(url) |
38 | + |
39 | def ubuntu_one_account_ready(self): |
40 | if not self.has_u1 == 1: |
41 | self.register_with_verif(None) |
42 | |
43 | === modified file 'accomplishments_viewer/PreferencesAccomplishmentsViewerDialog.py' |
44 | --- accomplishments_viewer/PreferencesAccomplishmentsViewerDialog.py 2012-05-24 13:22:01 +0000 |
45 | +++ accomplishments_viewer/PreferencesAccomplishmentsViewerDialog.py 2012-06-25 22:37:19 +0000 |
46 | @@ -34,6 +34,12 @@ |
47 | super(PreferencesAccomplishmentsViewerDialog, self).finish_initializing(builder) |
48 | self.cb_daemonsessionstart = self.builder.get_object("cb_daemonsessionstart") |
49 | self.cb_hideu1bubbles = self.builder.get_object("cb_hideu1bubbles") |
50 | + self.pref_publish = self.builder.get_object("pref_publish") |
51 | + self.pref_publish_label = self.builder.get_object("pref_publish_label") |
52 | + self.pref_publish_icon = self.builder.get_object("pref_publish_icon") |
53 | + self.publishedstatus = None |
54 | + |
55 | + #trophydir = self.libaccom.get_config_value("config", "trophypath") |
56 | |
57 | # Bind each preference widget to gsettings |
58 | #settings = Gio.Settings("net.launchpad.accomplishments-viewer") |
59 | @@ -45,7 +51,14 @@ |
60 | def prepare(self,daemon_handle): |
61 | self.libaccom = daemon_handle |
62 | self.populate_settings() |
63 | - |
64 | + |
65 | + self.publishedstatus = self.libaccom.get_published_status() |
66 | + |
67 | + if self.publishedstatus == 0: |
68 | + self.pref_publish.set_label(_("Publish...")) |
69 | + else: |
70 | + self.pref_publish.set_label(_("Stop Publishing")) |
71 | + |
72 | def populate_settings(self): |
73 | self.cb_daemonsessionstart.handler_block_by_func(self.cb_daemonsessionstart_toggled) |
74 | self.cb_hideu1bubbles.handler_block_by_func(self.cb_hideu1bubbles_toggled) |
75 | @@ -64,3 +77,17 @@ |
76 | |
77 | def cb_hideu1bubbles_toggled(self, widget): |
78 | self.libaccom.set_block_ubuntuone_notification_bubbles( widget.get_active() ) |
79 | + |
80 | + def on_pref_publish_clicked(self, widget): |
81 | + if self.publishedstatus == 0: |
82 | + self.libaccom.publish_trophies_online() |
83 | + self.pref_publish_label.set_text(_("Please see your web browser to continue...")) |
84 | + self.pref_publish.set_label(_("Stop Publishing")) |
85 | + self.pref_publish_icon.set_visible(True) |
86 | + self.publishedstatus = 1 |
87 | + else: |
88 | + self.libaccom.unpublish_trophies_online() |
89 | + self.pref_publish_label.set_text(_("Trophies are no longer published.")) |
90 | + self.pref_publish.set_label(_("Publish...")) |
91 | + self.pref_publish_icon.set_visible(True) |
92 | + self.publishedstatus = 0 |
93 | |
94 | === modified file 'data/ui/PreferencesAccomplishmentsViewerDialog.ui' |
95 | --- data/ui/PreferencesAccomplishmentsViewerDialog.ui 2012-05-24 11:04:14 +0000 |
96 | +++ data/ui/PreferencesAccomplishmentsViewerDialog.ui 2012-06-25 22:37:19 +0000 |
97 | @@ -156,6 +156,125 @@ |
98 | <property name="position">1</property> |
99 | </packing> |
100 | </child> |
101 | + <child> |
102 | + <object class="GtkFrame" id="frame3"> |
103 | + <property name="visible">True</property> |
104 | + <property name="can_focus">False</property> |
105 | + <property name="margin_left">5</property> |
106 | + <property name="margin_right">5</property> |
107 | + <property name="label_xalign">0</property> |
108 | + <property name="shadow_type">none</property> |
109 | + <child> |
110 | + <object class="GtkAlignment" id="alignment3"> |
111 | + <property name="visible">True</property> |
112 | + <property name="can_focus">False</property> |
113 | + <property name="left_padding">12</property> |
114 | + <child> |
115 | + <object class="GtkBox" id="box2"> |
116 | + <property name="visible">True</property> |
117 | + <property name="can_focus">False</property> |
118 | + <property name="orientation">vertical</property> |
119 | + <child> |
120 | + <object class="GtkLabel" id="label4"> |
121 | + <property name="visible">True</property> |
122 | + <property name="can_focus">False</property> |
123 | + <property name="margin_top">10</property> |
124 | + <property name="margin_bottom">10</property> |
125 | + <property name="label" translatable="yes">To publish your trophies online for others to see, click the <i>Publish</i> button. |
126 | +You can <i>Unpublish</i> later if you want to.</property> |
127 | + <property name="use_markup">True</property> |
128 | + </object> |
129 | + <packing> |
130 | + <property name="expand">False</property> |
131 | + <property name="fill">True</property> |
132 | + <property name="position">0</property> |
133 | + </packing> |
134 | + </child> |
135 | + <child> |
136 | + <object class="GtkBox" id="box3"> |
137 | + <property name="visible">True</property> |
138 | + <property name="can_focus">False</property> |
139 | + <child> |
140 | + <object class="GtkImage" id="pref_publish_icon"> |
141 | + <property name="can_focus">False</property> |
142 | + <property name="margin_right">5</property> |
143 | + <property name="stock">gtk-ok</property> |
144 | + </object> |
145 | + <packing> |
146 | + <property name="expand">False</property> |
147 | + <property name="fill">True</property> |
148 | + <property name="position">0</property> |
149 | + </packing> |
150 | + </child> |
151 | + <child> |
152 | + <object class="GtkLabel" id="pref_publish_label"> |
153 | + <property name="visible">True</property> |
154 | + <property name="can_focus">False</property> |
155 | + <property name="xalign">0</property> |
156 | + <attributes> |
157 | + <attribute name="style" value="italic"/> |
158 | + </attributes> |
159 | + </object> |
160 | + <packing> |
161 | + <property name="expand">True</property> |
162 | + <property name="fill">True</property> |
163 | + <property name="position">1</property> |
164 | + </packing> |
165 | + </child> |
166 | + <child> |
167 | + <object class="GtkButtonBox" id="buttonbox1"> |
168 | + <property name="visible">True</property> |
169 | + <property name="can_focus">False</property> |
170 | + <property name="layout_style">end</property> |
171 | + <child> |
172 | + <object class="GtkButton" id="pref_publish"> |
173 | + <property name="label" translatable="yes">Publish...</property> |
174 | + <property name="use_action_appearance">False</property> |
175 | + <property name="visible">True</property> |
176 | + <property name="can_focus">True</property> |
177 | + <property name="receives_default">True</property> |
178 | + <property name="use_action_appearance">False</property> |
179 | + </object> |
180 | + <packing> |
181 | + <property name="expand">False</property> |
182 | + <property name="fill">False</property> |
183 | + <property name="position">0</property> |
184 | + </packing> |
185 | + </child> |
186 | + </object> |
187 | + <packing> |
188 | + <property name="expand">False</property> |
189 | + <property name="fill">False</property> |
190 | + <property name="position">2</property> |
191 | + </packing> |
192 | + </child> |
193 | + </object> |
194 | + <packing> |
195 | + <property name="expand">False</property> |
196 | + <property name="fill">True</property> |
197 | + <property name="position">1</property> |
198 | + </packing> |
199 | + </child> |
200 | + </object> |
201 | + </child> |
202 | + </object> |
203 | + </child> |
204 | + <child type="label"> |
205 | + <object class="GtkLabel" id="label3"> |
206 | + <property name="visible">True</property> |
207 | + <property name="can_focus">False</property> |
208 | + <property name="label" translatable="yes"><b>Publish Trophies Online</b></property> |
209 | + <property name="use_markup">True</property> |
210 | + </object> |
211 | + </child> |
212 | + </object> |
213 | + <packing> |
214 | + <property name="expand">False</property> |
215 | + <property name="fill">True</property> |
216 | + <property name="padding">5</property> |
217 | + <property name="position">2</property> |
218 | + </packing> |
219 | + </child> |
220 | </object> |
221 | <packing> |
222 | <property name="expand">False</property> |
223 | |
224 | === modified file 'po/accomplishments-viewer.pot' |
225 | --- po/accomplishments-viewer.pot 2012-06-08 17:40:09 +0000 |
226 | +++ po/accomplishments-viewer.pot 2012-06-25 22:37:19 +0000 |
227 | @@ -8,7 +8,7 @@ |
228 | msgstr "" |
229 | "Project-Id-Version: PACKAGE VERSION\n" |
230 | "Report-Msgid-Bugs-To: \n" |
231 | -"POT-Creation-Date: 2012-06-08 10:40-0700\n" |
232 | +"POT-Creation-Date: 2012-06-25 00:47-0700\n" |
233 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" |
234 | "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" |
235 | "Language-Team: LANGUAGE <LL@li.org>\n" |
236 | @@ -17,6 +17,25 @@ |
237 | "Content-Type: text/plain; charset=CHARSET\n" |
238 | "Content-Transfer-Encoding: 8bit\n" |
239 | |
240 | +#: ../accomplishments_viewer/PreferencesAccomplishmentsViewerDialog.py:58 |
241 | +#: ../accomplishments_viewer/PreferencesAccomplishmentsViewerDialog.py:91 |
242 | +#: ../data/ui/PreferencesAccomplishmentsViewerDialog.ui.h:8 |
243 | +msgid "Publish..." |
244 | +msgstr "" |
245 | + |
246 | +#: ../accomplishments_viewer/PreferencesAccomplishmentsViewerDialog.py:60 |
247 | +#: ../accomplishments_viewer/PreferencesAccomplishmentsViewerDialog.py:85 |
248 | +msgid "Stop Publishing" |
249 | +msgstr "" |
250 | + |
251 | +#: ../accomplishments_viewer/PreferencesAccomplishmentsViewerDialog.py:84 |
252 | +msgid "Please see your web browser to continue..." |
253 | +msgstr "" |
254 | + |
255 | +#: ../accomplishments_viewer/PreferencesAccomplishmentsViewerDialog.py:90 |
256 | +msgid "Trophies are no longer published." |
257 | +msgstr "" |
258 | + |
259 | #: ../accomplishments_viewer/AboutAccomplishmentsViewerDialog.py:37 |
260 | msgid "Collection Authors:" |
261 | msgstr "" |
262 | @@ -52,7 +71,7 @@ |
263 | #: ../accomplishments_viewer/__init__.py:29 |
264 | msgid "" |
265 | "Display information about the provided accomplishment ID (e.g. 'ubuntu-" |
266 | -"community/registered-on-launchpad'" |
267 | +"community/registered-on-launchpad')" |
268 | msgstr "" |
269 | |
270 | #: ../data/ui/PreferencesAccomplishmentsViewerDialog.ui.h:1 |
271 | @@ -75,95 +94,106 @@ |
272 | msgid "<b>Notification Bubbles</b>" |
273 | msgstr "" |
274 | |
275 | +#: ../data/ui/PreferencesAccomplishmentsViewerDialog.ui.h:6 |
276 | +msgid "" |
277 | +"To publish your trophies online for others to see, click the <i>Publish</i> " |
278 | +"button.\n" |
279 | +"You can <i>Unpublish</i> later if you want to." |
280 | +msgstr "" |
281 | + |
282 | +#: ../data/ui/PreferencesAccomplishmentsViewerDialog.ui.h:9 |
283 | +msgid "<b>Publish Trophies Online</b>" |
284 | +msgstr "" |
285 | + |
286 | #. Add 'All' button |
287 | -#: ../accomplishments_viewer/AccomplishmentsViewerWindow.py:410 |
288 | +#: ../accomplishments_viewer/AccomplishmentsViewerWindow.py:409 |
289 | msgid "All" |
290 | msgstr "" |
291 | |
292 | -#: ../accomplishments_viewer/AccomplishmentsViewerWindow.py:691 |
293 | -#: ../accomplishments_viewer/AccomplishmentsViewerWindow.py:704 |
294 | +#: ../accomplishments_viewer/AccomplishmentsViewerWindow.py:690 |
295 | +#: ../accomplishments_viewer/AccomplishmentsViewerWindow.py:703 |
296 | msgid "everything" |
297 | msgstr "" |
298 | |
299 | #. # summary table |
300 | -#: ../accomplishments_viewer/AccomplishmentsViewerWindow.py:906 |
301 | +#: ../accomplishments_viewer/AccomplishmentsViewerWindow.py:917 |
302 | msgid "Opportunity Information" |
303 | msgstr "" |
304 | |
305 | -#: ../accomplishments_viewer/AccomplishmentsViewerWindow.py:914 |
306 | +#: ../accomplishments_viewer/AccomplishmentsViewerWindow.py:925 |
307 | msgid "No information available." |
308 | msgstr "" |
309 | |
310 | -#: ../accomplishments_viewer/AccomplishmentsViewerWindow.py:924 |
311 | +#: ../accomplishments_viewer/AccomplishmentsViewerWindow.py:935 |
312 | msgid "Getting Help" |
313 | msgstr "" |
314 | |
315 | -#: ../accomplishments_viewer/AccomplishmentsViewerWindow.py:933 |
316 | +#: ../accomplishments_viewer/AccomplishmentsViewerWindow.py:944 |
317 | msgid "No help available." |
318 | msgstr "" |
319 | |
320 | -#: ../accomplishments_viewer/AccomplishmentsViewerWindow.py:948 |
321 | +#: ../accomplishments_viewer/AccomplishmentsViewerWindow.py:959 |
322 | msgid "This opportunity is locked. You need to complete" |
323 | msgstr "" |
324 | |
325 | -#: ../accomplishments_viewer/AccomplishmentsViewerWindow.py:948 |
326 | -#: ../accomplishments_viewer/AccomplishmentsViewerWindow.py:953 |
327 | +#: ../accomplishments_viewer/AccomplishmentsViewerWindow.py:959 |
328 | +#: ../accomplishments_viewer/AccomplishmentsViewerWindow.py:964 |
329 | msgid "from" |
330 | msgstr "" |
331 | |
332 | -#: ../accomplishments_viewer/AccomplishmentsViewerWindow.py:948 |
333 | +#: ../accomplishments_viewer/AccomplishmentsViewerWindow.py:959 |
334 | msgid "first" |
335 | msgstr "" |
336 | |
337 | -#: ../accomplishments_viewer/AccomplishmentsViewerWindow.py:950 |
338 | +#: ../accomplishments_viewer/AccomplishmentsViewerWindow.py:961 |
339 | msgid "" |
340 | "This opportunity is locked. You need to complete the following opportunities " |
341 | "first:" |
342 | msgstr "" |
343 | |
344 | #. achieved |
345 | -#: ../accomplishments_viewer/AccomplishmentsViewerWindow.py:957 |
346 | +#: ../accomplishments_viewer/AccomplishmentsViewerWindow.py:968 |
347 | msgid "This trophy <strong>was awarded</strong>" |
348 | msgstr "" |
349 | |
350 | -#: ../accomplishments_viewer/AccomplishmentsViewerWindow.py:961 |
351 | +#: ../accomplishments_viewer/AccomplishmentsViewerWindow.py:972 |
352 | msgid "on" |
353 | msgstr "" |
354 | |
355 | -#: ../accomplishments_viewer/AccomplishmentsViewerWindow.py:965 |
356 | +#: ../accomplishments_viewer/AccomplishmentsViewerWindow.py:976 |
357 | msgid "using the following credentials" |
358 | msgstr "" |
359 | |
360 | -#: ../accomplishments_viewer/AccomplishmentsViewerWindow.py:975 |
361 | +#: ../accomplishments_viewer/AccomplishmentsViewerWindow.py:986 |
362 | msgid "This trophy has been verified" |
363 | msgstr "" |
364 | |
365 | -#: ../accomplishments_viewer/AccomplishmentsViewerWindow.py:982 |
366 | +#: ../accomplishments_viewer/AccomplishmentsViewerWindow.py:993 |
367 | msgid "This opportunity requires verification" |
368 | msgstr "" |
369 | |
370 | -#: ../accomplishments_viewer/AccomplishmentsViewerWindow.py:992 |
371 | +#: ../accomplishments_viewer/AccomplishmentsViewerWindow.py:1003 |
372 | msgid "Accomplishment Details" |
373 | msgstr "" |
374 | |
375 | -#: ../accomplishments_viewer/AccomplishmentsViewerWindow.py:1014 |
376 | +#: ../accomplishments_viewer/AccomplishmentsViewerWindow.py:1025 |
377 | msgid "How to accomplish this opportunity" |
378 | msgstr "" |
379 | |
380 | -#: ../accomplishments_viewer/AccomplishmentsViewerWindow.py:1049 |
381 | +#: ../accomplishments_viewer/AccomplishmentsViewerWindow.py:1060 |
382 | msgid "Tips and Tricks" |
383 | msgstr "" |
384 | |
385 | -#: ../accomplishments_viewer/AccomplishmentsViewerWindow.py:1059 |
386 | -#: ../accomplishments_viewer/AccomplishmentsViewerWindow.py:1079 |
387 | +#: ../accomplishments_viewer/AccomplishmentsViewerWindow.py:1070 |
388 | +#: ../accomplishments_viewer/AccomplishmentsViewerWindow.py:1090 |
389 | msgid "None." |
390 | msgstr "" |
391 | |
392 | -#: ../accomplishments_viewer/AccomplishmentsViewerWindow.py:1069 |
393 | +#: ../accomplishments_viewer/AccomplishmentsViewerWindow.py:1080 |
394 | msgid "Pitfalls To Avoid" |
395 | msgstr "" |
396 | |
397 | -#: ../accomplishments_viewer/AccomplishmentsViewerWindow.py:1092 |
398 | +#: ../accomplishments_viewer/AccomplishmentsViewerWindow.py:1103 |
399 | msgid "Further Reading" |
400 | msgstr "" |
401 |