Merge lp:~jonobacon/ubuntu-accomplishments-viewer/publishonline into lp:ubuntu-accomplishments-viewer

Proposed by Jono Bacon
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
Reviewer Review Type Date Requested Status
Ubuntu Accomplishments Viewer Developers Pending
Review via email: mp+111789@code.launchpad.net

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.

To post a comment you must log in.
118. By Jono Bacon

 * Launch browser fromt he client now. A better, cleaner way of doing things.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'accomplishments_viewer/AccomplishmentsViewerWindow.py'
--- accomplishments_viewer/AccomplishmentsViewerWindow.py 2012-06-23 14:05:24 +0000
+++ accomplishments_viewer/AccomplishmentsViewerWindow.py 2012-06-25 22:37:19 +0000
@@ -263,6 +263,9 @@
263 object.connect_to_signal("trophy_recieved",263 object.connect_to_signal("trophy_recieved",
264 self.trophy_received,264 self.trophy_received,
265 dbus_interface="org.ubuntu.accomplishments", arg0="Hello")265 dbus_interface="org.ubuntu.accomplishments", arg0="Hello")
266 object.connect_to_signal("publish_trophies_online_completed",
267 self.publish_trophies_online_completed,
268 dbus_interface="org.ubuntu.accomplishments", arg0="Hello")
266 object.connect_to_signal("scriptrunner_start",269 object.connect_to_signal("scriptrunner_start",
267 self.scriptrunner_start,270 self.scriptrunner_start,
268 dbus_interface="org.ubuntu.accomplishments")271 dbus_interface="org.ubuntu.accomplishments")
@@ -272,6 +275,7 @@
272 object.connect_to_signal("ubuntu_one_account_ready",275 object.connect_to_signal("ubuntu_one_account_ready",
273 self.ubuntu_one_account_ready,276 self.ubuntu_one_account_ready,
274 dbus_interface="org.ubuntu.accomplishments", arg0="Hello")277 dbus_interface="org.ubuntu.accomplishments", arg0="Hello")
278
275 except dbus.DBusException:279 except dbus.DBusException:
276 traceback.print_exc()280 traceback.print_exc()
277 print usage281 print usage
@@ -280,6 +284,9 @@
280 bus.add_signal_receiver(self.trophy_received,284 bus.add_signal_receiver(self.trophy_received,
281 dbus_interface = "org.ubuntu.accomplishments",285 dbus_interface = "org.ubuntu.accomplishments",
282 signal_name = "trophy_received")286 signal_name = "trophy_received")
287 bus.add_signal_receiver(self.publish_trophies_online_completed,
288 dbus_interface = "org.ubuntu.accomplishments",
289 signal_name = "publish_trophies_online_completed")
283 bus.add_signal_receiver(self.scriptrunner_start,290 bus.add_signal_receiver(self.scriptrunner_start,
284 dbus_interface = "org.ubuntu.accomplishments",291 dbus_interface = "org.ubuntu.accomplishments",
285 signal_name = "scriptrunner_start")292 signal_name = "scriptrunner_start")
@@ -296,6 +303,9 @@
296 303
297 return True304 return True
298305
306 def publish_trophies_online_completed(self, url):
307 webbrowser.open(url)
308
299 def ubuntu_one_account_ready(self): 309 def ubuntu_one_account_ready(self):
300 if not self.has_u1 == 1:310 if not self.has_u1 == 1:
301 self.register_with_verif(None)311 self.register_with_verif(None)
302312
=== modified file 'accomplishments_viewer/PreferencesAccomplishmentsViewerDialog.py'
--- accomplishments_viewer/PreferencesAccomplishmentsViewerDialog.py 2012-05-24 13:22:01 +0000
+++ accomplishments_viewer/PreferencesAccomplishmentsViewerDialog.py 2012-06-25 22:37:19 +0000
@@ -34,6 +34,12 @@
34 super(PreferencesAccomplishmentsViewerDialog, self).finish_initializing(builder)34 super(PreferencesAccomplishmentsViewerDialog, self).finish_initializing(builder)
35 self.cb_daemonsessionstart = self.builder.get_object("cb_daemonsessionstart")35 self.cb_daemonsessionstart = self.builder.get_object("cb_daemonsessionstart")
36 self.cb_hideu1bubbles = self.builder.get_object("cb_hideu1bubbles")36 self.cb_hideu1bubbles = self.builder.get_object("cb_hideu1bubbles")
37 self.pref_publish = self.builder.get_object("pref_publish")
38 self.pref_publish_label = self.builder.get_object("pref_publish_label")
39 self.pref_publish_icon = self.builder.get_object("pref_publish_icon")
40 self.publishedstatus = None
41
42 #trophydir = self.libaccom.get_config_value("config", "trophypath")
37 43
38 # Bind each preference widget to gsettings44 # Bind each preference widget to gsettings
39 #settings = Gio.Settings("net.launchpad.accomplishments-viewer")45 #settings = Gio.Settings("net.launchpad.accomplishments-viewer")
@@ -45,7 +51,14 @@
45 def prepare(self,daemon_handle):51 def prepare(self,daemon_handle):
46 self.libaccom = daemon_handle52 self.libaccom = daemon_handle
47 self.populate_settings()53 self.populate_settings()
4854
55 self.publishedstatus = self.libaccom.get_published_status()
56
57 if self.publishedstatus == 0:
58 self.pref_publish.set_label(_("Publish..."))
59 else:
60 self.pref_publish.set_label(_("Stop Publishing"))
61
49 def populate_settings(self):62 def populate_settings(self):
50 self.cb_daemonsessionstart.handler_block_by_func(self.cb_daemonsessionstart_toggled)63 self.cb_daemonsessionstart.handler_block_by_func(self.cb_daemonsessionstart_toggled)
51 self.cb_hideu1bubbles.handler_block_by_func(self.cb_hideu1bubbles_toggled)64 self.cb_hideu1bubbles.handler_block_by_func(self.cb_hideu1bubbles_toggled)
@@ -64,3 +77,17 @@
6477
65 def cb_hideu1bubbles_toggled(self, widget):78 def cb_hideu1bubbles_toggled(self, widget):
66 self.libaccom.set_block_ubuntuone_notification_bubbles( widget.get_active() )79 self.libaccom.set_block_ubuntuone_notification_bubbles( widget.get_active() )
80
81 def on_pref_publish_clicked(self, widget):
82 if self.publishedstatus == 0:
83 self.libaccom.publish_trophies_online()
84 self.pref_publish_label.set_text(_("Please see your web browser to continue..."))
85 self.pref_publish.set_label(_("Stop Publishing"))
86 self.pref_publish_icon.set_visible(True)
87 self.publishedstatus = 1
88 else:
89 self.libaccom.unpublish_trophies_online()
90 self.pref_publish_label.set_text(_("Trophies are no longer published."))
91 self.pref_publish.set_label(_("Publish..."))
92 self.pref_publish_icon.set_visible(True)
93 self.publishedstatus = 0
6794
=== modified file 'data/ui/PreferencesAccomplishmentsViewerDialog.ui'
--- data/ui/PreferencesAccomplishmentsViewerDialog.ui 2012-05-24 11:04:14 +0000
+++ data/ui/PreferencesAccomplishmentsViewerDialog.ui 2012-06-25 22:37:19 +0000
@@ -156,6 +156,125 @@
156 <property name="position">1</property>156 <property name="position">1</property>
157 </packing>157 </packing>
158 </child>158 </child>
159 <child>
160 <object class="GtkFrame" id="frame3">
161 <property name="visible">True</property>
162 <property name="can_focus">False</property>
163 <property name="margin_left">5</property>
164 <property name="margin_right">5</property>
165 <property name="label_xalign">0</property>
166 <property name="shadow_type">none</property>
167 <child>
168 <object class="GtkAlignment" id="alignment3">
169 <property name="visible">True</property>
170 <property name="can_focus">False</property>
171 <property name="left_padding">12</property>
172 <child>
173 <object class="GtkBox" id="box2">
174 <property name="visible">True</property>
175 <property name="can_focus">False</property>
176 <property name="orientation">vertical</property>
177 <child>
178 <object class="GtkLabel" id="label4">
179 <property name="visible">True</property>
180 <property name="can_focus">False</property>
181 <property name="margin_top">10</property>
182 <property name="margin_bottom">10</property>
183 <property name="label" translatable="yes">To publish your trophies online for others to see, click the &lt;i&gt;Publish&lt;/i&gt; button.
184You can &lt;i&gt;Unpublish&lt;/i&gt; later if you want to.</property>
185 <property name="use_markup">True</property>
186 </object>
187 <packing>
188 <property name="expand">False</property>
189 <property name="fill">True</property>
190 <property name="position">0</property>
191 </packing>
192 </child>
193 <child>
194 <object class="GtkBox" id="box3">
195 <property name="visible">True</property>
196 <property name="can_focus">False</property>
197 <child>
198 <object class="GtkImage" id="pref_publish_icon">
199 <property name="can_focus">False</property>
200 <property name="margin_right">5</property>
201 <property name="stock">gtk-ok</property>
202 </object>
203 <packing>
204 <property name="expand">False</property>
205 <property name="fill">True</property>
206 <property name="position">0</property>
207 </packing>
208 </child>
209 <child>
210 <object class="GtkLabel" id="pref_publish_label">
211 <property name="visible">True</property>
212 <property name="can_focus">False</property>
213 <property name="xalign">0</property>
214 <attributes>
215 <attribute name="style" value="italic"/>
216 </attributes>
217 </object>
218 <packing>
219 <property name="expand">True</property>
220 <property name="fill">True</property>
221 <property name="position">1</property>
222 </packing>
223 </child>
224 <child>
225 <object class="GtkButtonBox" id="buttonbox1">
226 <property name="visible">True</property>
227 <property name="can_focus">False</property>
228 <property name="layout_style">end</property>
229 <child>
230 <object class="GtkButton" id="pref_publish">
231 <property name="label" translatable="yes">Publish...</property>
232 <property name="use_action_appearance">False</property>
233 <property name="visible">True</property>
234 <property name="can_focus">True</property>
235 <property name="receives_default">True</property>
236 <property name="use_action_appearance">False</property>
237 </object>
238 <packing>
239 <property name="expand">False</property>
240 <property name="fill">False</property>
241 <property name="position">0</property>
242 </packing>
243 </child>
244 </object>
245 <packing>
246 <property name="expand">False</property>
247 <property name="fill">False</property>
248 <property name="position">2</property>
249 </packing>
250 </child>
251 </object>
252 <packing>
253 <property name="expand">False</property>
254 <property name="fill">True</property>
255 <property name="position">1</property>
256 </packing>
257 </child>
258 </object>
259 </child>
260 </object>
261 </child>
262 <child type="label">
263 <object class="GtkLabel" id="label3">
264 <property name="visible">True</property>
265 <property name="can_focus">False</property>
266 <property name="label" translatable="yes">&lt;b&gt;Publish Trophies Online&lt;/b&gt;</property>
267 <property name="use_markup">True</property>
268 </object>
269 </child>
270 </object>
271 <packing>
272 <property name="expand">False</property>
273 <property name="fill">True</property>
274 <property name="padding">5</property>
275 <property name="position">2</property>
276 </packing>
277 </child>
159 </object>278 </object>
160 <packing>279 <packing>
161 <property name="expand">False</property>280 <property name="expand">False</property>
162281
=== modified file 'po/accomplishments-viewer.pot'
--- po/accomplishments-viewer.pot 2012-06-08 17:40:09 +0000
+++ po/accomplishments-viewer.pot 2012-06-25 22:37:19 +0000
@@ -8,7 +8,7 @@
8msgstr ""8msgstr ""
9"Project-Id-Version: PACKAGE VERSION\n"9"Project-Id-Version: PACKAGE VERSION\n"
10"Report-Msgid-Bugs-To: \n"10"Report-Msgid-Bugs-To: \n"
11"POT-Creation-Date: 2012-06-08 10:40-0700\n"11"POT-Creation-Date: 2012-06-25 00:47-0700\n"
12"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"12"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
13"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"13"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14"Language-Team: LANGUAGE <LL@li.org>\n"14"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -17,6 +17,25 @@
17"Content-Type: text/plain; charset=CHARSET\n"17"Content-Type: text/plain; charset=CHARSET\n"
18"Content-Transfer-Encoding: 8bit\n"18"Content-Transfer-Encoding: 8bit\n"
1919
20#: ../accomplishments_viewer/PreferencesAccomplishmentsViewerDialog.py:58
21#: ../accomplishments_viewer/PreferencesAccomplishmentsViewerDialog.py:91
22#: ../data/ui/PreferencesAccomplishmentsViewerDialog.ui.h:8
23msgid "Publish..."
24msgstr ""
25
26#: ../accomplishments_viewer/PreferencesAccomplishmentsViewerDialog.py:60
27#: ../accomplishments_viewer/PreferencesAccomplishmentsViewerDialog.py:85
28msgid "Stop Publishing"
29msgstr ""
30
31#: ../accomplishments_viewer/PreferencesAccomplishmentsViewerDialog.py:84
32msgid "Please see your web browser to continue..."
33msgstr ""
34
35#: ../accomplishments_viewer/PreferencesAccomplishmentsViewerDialog.py:90
36msgid "Trophies are no longer published."
37msgstr ""
38
20#: ../accomplishments_viewer/AboutAccomplishmentsViewerDialog.py:3739#: ../accomplishments_viewer/AboutAccomplishmentsViewerDialog.py:37
21msgid "Collection Authors:"40msgid "Collection Authors:"
22msgstr ""41msgstr ""
@@ -52,7 +71,7 @@
52#: ../accomplishments_viewer/__init__.py:2971#: ../accomplishments_viewer/__init__.py:29
53msgid ""72msgid ""
54"Display information about the provided accomplishment ID (e.g. 'ubuntu-"73"Display information about the provided accomplishment ID (e.g. 'ubuntu-"
55"community/registered-on-launchpad'"74"community/registered-on-launchpad')"
56msgstr ""75msgstr ""
5776
58#: ../data/ui/PreferencesAccomplishmentsViewerDialog.ui.h:177#: ../data/ui/PreferencesAccomplishmentsViewerDialog.ui.h:1
@@ -75,95 +94,106 @@
75msgid "<b>Notification Bubbles</b>"94msgid "<b>Notification Bubbles</b>"
76msgstr ""95msgstr ""
7796
97#: ../data/ui/PreferencesAccomplishmentsViewerDialog.ui.h:6
98msgid ""
99"To publish your trophies online for others to see, click the <i>Publish</i> "
100"button.\n"
101"You can <i>Unpublish</i> later if you want to."
102msgstr ""
103
104#: ../data/ui/PreferencesAccomplishmentsViewerDialog.ui.h:9
105msgid "<b>Publish Trophies Online</b>"
106msgstr ""
107
78#. Add 'All' button108#. Add 'All' button
79#: ../accomplishments_viewer/AccomplishmentsViewerWindow.py:410109#: ../accomplishments_viewer/AccomplishmentsViewerWindow.py:409
80msgid "All"110msgid "All"
81msgstr ""111msgstr ""
82112
83#: ../accomplishments_viewer/AccomplishmentsViewerWindow.py:691113#: ../accomplishments_viewer/AccomplishmentsViewerWindow.py:690
84#: ../accomplishments_viewer/AccomplishmentsViewerWindow.py:704114#: ../accomplishments_viewer/AccomplishmentsViewerWindow.py:703
85msgid "everything"115msgid "everything"
86msgstr ""116msgstr ""
87117
88#. # summary table118#. # summary table
89#: ../accomplishments_viewer/AccomplishmentsViewerWindow.py:906119#: ../accomplishments_viewer/AccomplishmentsViewerWindow.py:917
90msgid "Opportunity Information"120msgid "Opportunity Information"
91msgstr ""121msgstr ""
92122
93#: ../accomplishments_viewer/AccomplishmentsViewerWindow.py:914123#: ../accomplishments_viewer/AccomplishmentsViewerWindow.py:925
94msgid "No information available."124msgid "No information available."
95msgstr ""125msgstr ""
96126
97#: ../accomplishments_viewer/AccomplishmentsViewerWindow.py:924127#: ../accomplishments_viewer/AccomplishmentsViewerWindow.py:935
98msgid "Getting Help"128msgid "Getting Help"
99msgstr ""129msgstr ""
100130
101#: ../accomplishments_viewer/AccomplishmentsViewerWindow.py:933131#: ../accomplishments_viewer/AccomplishmentsViewerWindow.py:944
102msgid "No help available."132msgid "No help available."
103msgstr ""133msgstr ""
104134
105#: ../accomplishments_viewer/AccomplishmentsViewerWindow.py:948135#: ../accomplishments_viewer/AccomplishmentsViewerWindow.py:959
106msgid "This opportunity is locked. You need to complete"136msgid "This opportunity is locked. You need to complete"
107msgstr ""137msgstr ""
108138
109#: ../accomplishments_viewer/AccomplishmentsViewerWindow.py:948139#: ../accomplishments_viewer/AccomplishmentsViewerWindow.py:959
110#: ../accomplishments_viewer/AccomplishmentsViewerWindow.py:953140#: ../accomplishments_viewer/AccomplishmentsViewerWindow.py:964
111msgid "from"141msgid "from"
112msgstr ""142msgstr ""
113143
114#: ../accomplishments_viewer/AccomplishmentsViewerWindow.py:948144#: ../accomplishments_viewer/AccomplishmentsViewerWindow.py:959
115msgid "first"145msgid "first"
116msgstr ""146msgstr ""
117147
118#: ../accomplishments_viewer/AccomplishmentsViewerWindow.py:950148#: ../accomplishments_viewer/AccomplishmentsViewerWindow.py:961
119msgid ""149msgid ""
120"This opportunity is locked. You need to complete the following opportunities "150"This opportunity is locked. You need to complete the following opportunities "
121"first:"151"first:"
122msgstr ""152msgstr ""
123153
124#. achieved154#. achieved
125#: ../accomplishments_viewer/AccomplishmentsViewerWindow.py:957155#: ../accomplishments_viewer/AccomplishmentsViewerWindow.py:968
126msgid "This trophy <strong>was awarded</strong>"156msgid "This trophy <strong>was awarded</strong>"
127msgstr ""157msgstr ""
128158
129#: ../accomplishments_viewer/AccomplishmentsViewerWindow.py:961159#: ../accomplishments_viewer/AccomplishmentsViewerWindow.py:972
130msgid "on"160msgid "on"
131msgstr ""161msgstr ""
132162
133#: ../accomplishments_viewer/AccomplishmentsViewerWindow.py:965163#: ../accomplishments_viewer/AccomplishmentsViewerWindow.py:976
134msgid "using the following credentials"164msgid "using the following credentials"
135msgstr ""165msgstr ""
136166
137#: ../accomplishments_viewer/AccomplishmentsViewerWindow.py:975167#: ../accomplishments_viewer/AccomplishmentsViewerWindow.py:986
138msgid "This trophy has been verified"168msgid "This trophy has been verified"
139msgstr ""169msgstr ""
140170
141#: ../accomplishments_viewer/AccomplishmentsViewerWindow.py:982171#: ../accomplishments_viewer/AccomplishmentsViewerWindow.py:993
142msgid "This opportunity requires verification"172msgid "This opportunity requires verification"
143msgstr ""173msgstr ""
144174
145#: ../accomplishments_viewer/AccomplishmentsViewerWindow.py:992175#: ../accomplishments_viewer/AccomplishmentsViewerWindow.py:1003
146msgid "Accomplishment Details"176msgid "Accomplishment Details"
147msgstr ""177msgstr ""
148178
149#: ../accomplishments_viewer/AccomplishmentsViewerWindow.py:1014179#: ../accomplishments_viewer/AccomplishmentsViewerWindow.py:1025
150msgid "How to accomplish this opportunity"180msgid "How to accomplish this opportunity"
151msgstr ""181msgstr ""
152182
153#: ../accomplishments_viewer/AccomplishmentsViewerWindow.py:1049183#: ../accomplishments_viewer/AccomplishmentsViewerWindow.py:1060
154msgid "Tips and Tricks"184msgid "Tips and Tricks"
155msgstr ""185msgstr ""
156186
157#: ../accomplishments_viewer/AccomplishmentsViewerWindow.py:1059187#: ../accomplishments_viewer/AccomplishmentsViewerWindow.py:1070
158#: ../accomplishments_viewer/AccomplishmentsViewerWindow.py:1079188#: ../accomplishments_viewer/AccomplishmentsViewerWindow.py:1090
159msgid "None."189msgid "None."
160msgstr ""190msgstr ""
161191
162#: ../accomplishments_viewer/AccomplishmentsViewerWindow.py:1069192#: ../accomplishments_viewer/AccomplishmentsViewerWindow.py:1080
163msgid "Pitfalls To Avoid"193msgid "Pitfalls To Avoid"
164msgstr ""194msgstr ""
165195
166#: ../accomplishments_viewer/AccomplishmentsViewerWindow.py:1092196#: ../accomplishments_viewer/AccomplishmentsViewerWindow.py:1103
167msgid "Further Reading"197msgid "Further Reading"
168msgstr ""198msgstr ""
169199

Subscribers

People subscribed via source and target branches

to all changes: