Merge lp:~tvec623/ubuntu-desktop-accomplishments/20120827-sudoku-accomplishment into lp:ubuntu-desktop-accomplishments

Proposed by Tony Vec
Status: Rejected
Rejected by: Matt Fischer
Proposed branch: lp:~tvec623/ubuntu-desktop-accomplishments/20120827-sudoku-accomplishment
Merge into: lp:ubuntu-desktop-accomplishments
Diff against target: 309 lines (+244/-0)
12 files modified
CATEGORIES (+1/-0)
Changelog (+1/-0)
accomplishments/ubuntu-desktop/en/gaming/sudoku_easy.accomplishment (+13/-0)
accomplishments/ubuntu-desktop/en/gaming/sudoku_hard.accomplishment (+13/-0)
accomplishments/ubuntu-desktop/en/gaming/sudoku_medium.accomplishment (+13/-0)
accomplishments/ubuntu-desktop/en/gaming/sudoku_very_hard.accomplishment (+13/-0)
accomplishments/ubuntu-desktop/en/multimedia/importshotwell.accomplishment (+18/-0)
scripts/ubuntu-desktop/gaming/sudoku_easy.py (+34/-0)
scripts/ubuntu-desktop/gaming/sudoku_hard.py (+34/-0)
scripts/ubuntu-desktop/gaming/sudoku_medium.py (+34/-0)
scripts/ubuntu-desktop/gaming/sudoku_very_hard.py (+35/-0)
scripts/ubuntu-desktop/multimedia/importshotwell.py (+35/-0)
To merge this branch: bzr merge lp:~tvec623/ubuntu-desktop-accomplishments/20120827-sudoku-accomplishment
Reviewer Review Type Date Requested Status
Rafał Cieślak Needs Fixing
Review via email: mp+121459@code.launchpad.net

Description of the change

Added 4 accomplishments: Accomplishment checks if user has completed the four levels in Sudoku.

To post a comment you must log in.
Revision history for this message
Rafał Cieślak (rafalcieslak256) wrote :

Cool accomplishments! We were definitely lacking these ones. Great thanks for your work on them.

There are two small things that will need fixing before I merge this branch:

* Somehow the importshotwell accomplishment is included in this branch too. I guess that's accidental, as you have proposed a separate branch with them.
* The category your Sudoku accomplishments use is "Gaming". That's correct, but it would be cool if we grouped them to a sub-category withing gaming, named "Sudoku". To do this, you need to set their category to "Gaming:Sudoku".

review: Needs Fixing
Revision history for this message
Matt Fischer (mfisch) wrote :

Tony,

Any updates?

Revision history for this message
Matt Fischer (mfisch) wrote :

This was superseded by a later MP.

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'CATEGORIES'
2--- CATEGORIES 2012-05-19 18:08:54 +0000
3+++ CATEGORIES 2012-08-27 16:12:31 +0000
4@@ -4,3 +4,4 @@
5
6 Audio and Video
7 Games
8+Multimedia
9
10=== modified file 'Changelog'
11--- Changelog 2012-08-16 00:40:29 +0000
12+++ Changelog 2012-08-27 16:12:31 +0000
13@@ -13,3 +13,4 @@
14
15 * Bug #1036960: Wrong Information in "Shared With Accomplishment Service" Accomplishment (BenHagan)
16 * Bug #1013161: "Shared With Accomplishments Service" accomplishment is not fully defined (BenHagan )
17+ * New feature: Sudoku Accomplishments added (Tony Vec)
18
19=== added file 'accomplishments/ubuntu-desktop/en/gaming/sudoku_easy.accomplishment'
20--- accomplishments/ubuntu-desktop/en/gaming/sudoku_easy.accomplishment 1970-01-01 00:00:00 +0000
21+++ accomplishments/ubuntu-desktop/en/gaming/sudoku_easy.accomplishment 2012-08-27 16:12:31 +0000
22@@ -0,0 +1,13 @@
23+[accomplishment]
24+title=Rookie Sudoku Player
25+description=Win a Easy game of Sudoku
26+collection=ubuntu-desktop
27+category=Games
28+icon=default.png
29+summary = You can achieve this accomplishment by completing a game of Sudoku in the <b>Easy</b> difficulty .
30+steps: Start Sudoku.
31+ Select Easy game.
32+ Fill out all the squares until the whole board is completed
33+tips = There's no time limit, so no need to rush.
34+ You can get extra help from sudoku's help menu (F1).
35+author = Tony Vec <tvec623@gmail.com>
36
37=== added file 'accomplishments/ubuntu-desktop/en/gaming/sudoku_hard.accomplishment'
38--- accomplishments/ubuntu-desktop/en/gaming/sudoku_hard.accomplishment 1970-01-01 00:00:00 +0000
39+++ accomplishments/ubuntu-desktop/en/gaming/sudoku_hard.accomplishment 2012-08-27 16:12:31 +0000
40@@ -0,0 +1,13 @@
41+[accomplishment]
42+title=All Star Sudoku Player
43+description=Win a game of Sudoku in Hard
44+collection=ubuntu-desktop
45+category=Games
46+icon=default.png
47+summary = You can achieve this accomplishment by completing a game of Sudoku in the <b>Hard</b> difficulty .
48+steps: Start Sudoku.
49+ Select Hard game.
50+ Fill out all the squares until the whole board is completed
51+tips = There's no time limit, so no need to rush.
52+ You can get extra help from sudoku's help menu (F1).
53+author = Tony Vec <tvec623@gmail.com>
54
55=== added file 'accomplishments/ubuntu-desktop/en/gaming/sudoku_medium.accomplishment'
56--- accomplishments/ubuntu-desktop/en/gaming/sudoku_medium.accomplishment 1970-01-01 00:00:00 +0000
57+++ accomplishments/ubuntu-desktop/en/gaming/sudoku_medium.accomplishment 2012-08-27 16:12:31 +0000
58@@ -0,0 +1,13 @@
59+[accomplishment]
60+title=Pro Sudoku Player
61+description=Win a medium game of Sudoku
62+collection=ubuntu-desktop
63+category=Games
64+icon=default.png
65+summary = You can achieve this accomplishment by completing a game of Sudoku in the <b>Medium</b> difficulty .
66+steps: Start Sudoku.
67+ Select Medium game.
68+ Fill out all the squares until the whole board is completed
69+tips = There's no time limit, so no need to rush.
70+ You can get extra help from sudoku's help menu (F1).
71+author = Tony Vec <tvec623@gmail.com>
72
73=== added file 'accomplishments/ubuntu-desktop/en/gaming/sudoku_very_hard.accomplishment'
74--- accomplishments/ubuntu-desktop/en/gaming/sudoku_very_hard.accomplishment 1970-01-01 00:00:00 +0000
75+++ accomplishments/ubuntu-desktop/en/gaming/sudoku_very_hard.accomplishment 2012-08-27 16:12:31 +0000
76@@ -0,0 +1,13 @@
77+[accomplishment]
78+title=Sudoku Master
79+description=Win a game of Sudoku wtih the Very Hard difficulty
80+collection=ubuntu-desktop
81+category=Games
82+icon=default.png
83+summary = You can achieve this accomplishment by completing a game of Sudoku in the <b>Very Hard</b> difficulty .
84+steps: Start Sudoku.
85+ Select Very Hard game.
86+ Fill out all the squares until the whole board is completed
87+tips = There's no time limit, so no need to rush.
88+ You can get extra help from sudoku's help menu (F1).
89+author = Tony Vec <tvec623@gmail.com>
90
91=== added file 'accomplishments/ubuntu-desktop/en/multimedia/importshotwell.accomplishment'
92--- accomplishments/ubuntu-desktop/en/multimedia/importshotwell.accomplishment 1970-01-01 00:00:00 +0000
93+++ accomplishments/ubuntu-desktop/en/multimedia/importshotwell.accomplishment 2012-08-27 16:12:31 +0000
94@@ -0,0 +1,18 @@
95+[accomplishment]
96+title = Import To Shotwell
97+description = Import photos/videos into Shotwell Photo Manager
98+category = Multimedia
99+icon = default.png
100+author = Tony Vec <tvec623@gmail.com>
101+collection = ubuntu-desktop
102+summary = Shotwell Photo Manager allows you to import, organize, view, and edit images
103+ This accomplishment is awarded when you <b>import photos or videos</b> to your Shotwell library
104+steps = Click the <i>Dash Home</i>
105+ Enter <i>Shotwell Photo Manager</i>
106+ You will be presented with the Shotwell application
107+ Click the the icon
108+ To import, you can: <ul><li>Drag and drop a folder/file onto the application; or</li><li> Go to <b>File</b> and choose <b>Import from folder...</b>; Select the folder you want imported and press <b>OK</b></li></ul>
109+tips = Shotwell supports JPEG, PNG, TIFF, BMP, and RAW photo files. It even supports video files!
110+pitfalls = Shotwell does not support GIF images.
111+links = http://yorba.org/shotwell/help/
112+
113
114=== added file 'scripts/ubuntu-desktop/gaming/sudoku_easy.py'
115--- scripts/ubuntu-desktop/gaming/sudoku_easy.py 1970-01-01 00:00:00 +0000
116+++ scripts/ubuntu-desktop/gaming/sudoku_easy.py 2012-08-27 16:12:31 +0000
117@@ -0,0 +1,34 @@
118+#!/usr/bin/python
119+import sys
120+import os
121+
122+homeDir = os.getenv('HOME')
123+sudoku_path = os.path.join(homeDir,'.config/gnome-sudoku/puzzles/')
124+
125+
126+def get_finished_levels():
127+ #Should save last finished results if already checked
128+ #for now, just start with 0
129+ last_checked = 0
130+ try:
131+ with open(sudoku_path+'finished') as finished:
132+ return (list(finished)[last_checked:])
133+ except IOError as e:
134+ #file does not exist
135+ sys.exit(1)
136+
137+#games have a '/n' for next games. Truncate before checking
138+finished_games = get_finished_levels()
139+
140+try:
141+ with open(sudoku_path+'easy') as f:
142+ easy = f.read()
143+ for game in finished_games:
144+ if game[:-2] in easy:
145+ #easy game has been completed
146+ sys.exit(0)
147+ #No completed games found in easy
148+ sys.exit(1)
149+except IOError as e:
150+ #list of game difficulty does not exist
151+ sys.exit(1)
152
153=== added file 'scripts/ubuntu-desktop/gaming/sudoku_hard.py'
154--- scripts/ubuntu-desktop/gaming/sudoku_hard.py 1970-01-01 00:00:00 +0000
155+++ scripts/ubuntu-desktop/gaming/sudoku_hard.py 2012-08-27 16:12:31 +0000
156@@ -0,0 +1,34 @@
157+#!/usr/bin/python
158+import sys
159+import os
160+
161+homeDir = os.getenv('HOME')
162+sudoku_path = os.path.join(homeDir,'.config/gnome-sudoku/puzzles/')
163+
164+
165+def get_finished_levels():
166+ #Should save last finished results if already checked
167+ #for now, just start with 0
168+ last_checked = 0
169+ try:
170+ with open(sudoku_path+'finished') as finished:
171+ return (list(finished)[last_checked:])
172+ except IOError as e:
173+ #file does not exist
174+ sys.exit(1)
175+
176+#games have a '/n' for next games. Truncate before checking
177+finished_games = get_finished_levels()
178+
179+try:
180+ with open(sudoku_path+'hard') as f:
181+ hard = f.read()
182+ for game in finished_games:
183+ if game[:-2] in hard:
184+ #hard game has been completed
185+ sys.exit(0)
186+ #No completed games found in hard
187+ sys.exit(1)
188+except IOError as e:
189+ #list of game difficulty does not exist
190+ sys.exit(1)
191
192=== added file 'scripts/ubuntu-desktop/gaming/sudoku_medium.py'
193--- scripts/ubuntu-desktop/gaming/sudoku_medium.py 1970-01-01 00:00:00 +0000
194+++ scripts/ubuntu-desktop/gaming/sudoku_medium.py 2012-08-27 16:12:31 +0000
195@@ -0,0 +1,34 @@
196+#!/usr/bin/python
197+import sys
198+import os
199+
200+homeDir = os.getenv('HOME')
201+sudoku_path = os.path.join(homeDir,'.config/gnome-sudoku/puzzles/')
202+
203+
204+def get_finished_levels():
205+ #Should save last finished results if already checked
206+ #for now, just start with 0
207+ last_checked = 0
208+ try:
209+ with open(sudoku_path+'finished') as finished:
210+ return (list(finished)[last_checked:])
211+ except IOError as e:
212+ #file does not exist
213+ sys.exit(1)
214+
215+#games have a '/n' for next games. Truncate before checking
216+finished_games = get_finished_levels()
217+
218+try:
219+ with open(sudoku_path+'medium') as f:
220+ medium = f.read()
221+ for game in finished_games:
222+ if game[:-2] in medium:
223+ #medium game has been completed
224+ sys.exit(0)
225+ #No completed games found in medium
226+ sys.exit(1)
227+except IOError as e:
228+ #list of game difficulty does not exist
229+ sys.exit(1)
230
231=== added file 'scripts/ubuntu-desktop/gaming/sudoku_very_hard.py'
232--- scripts/ubuntu-desktop/gaming/sudoku_very_hard.py 1970-01-01 00:00:00 +0000
233+++ scripts/ubuntu-desktop/gaming/sudoku_very_hard.py 2012-08-27 16:12:31 +0000
234@@ -0,0 +1,35 @@
235+#!/usr/bin/python
236+import sys
237+import os
238+
239+homeDir = os.getenv('HOME')
240+sudoku_path = os.path.join(homeDir,'.config/gnome-sudoku/puzzles/')
241+
242+
243+def get_finished_levels():
244+ #Should save last finished results if already checked
245+ #for now, just start with 0
246+ last_checked = 0
247+ try:
248+ with open(sudoku_path+'finished') as finished:
249+ return (list(finished)[last_checked:])
250+ except IOError as e:
251+ #file does not exist
252+ sys.exit(1)
253+
254+
255+#games have a '/n' for next games. Truncate before checking
256+finished_games = get_finished_levels()
257+
258+try:
259+ with open(sudoku_path+'very_hard', 'r') as f:
260+ very_hard = f.read()
261+ for game in finished_games:
262+ if game[:-2] in very_hard:
263+ #vestructure pry hard game has been completed
264+ sys.exit(0)
265+ #No completed games found in very hard
266+ sys.exit(1)
267+except IOError as e:
268+ #list of game difficulty does not exist
269+ sys.exit(1)
270
271=== added file 'scripts/ubuntu-desktop/multimedia/importshotwell.py'
272--- scripts/ubuntu-desktop/multimedia/importshotwell.py 1970-01-01 00:00:00 +0000
273+++ scripts/ubuntu-desktop/multimedia/importshotwell.py 2012-08-27 16:12:31 +0000
274@@ -0,0 +1,35 @@
275+#!/usr/bin/python
276+import os
277+import sqlite3
278+import sys
279+
280+homeDir = os.getenv('HOME')
281+path = os.path.join(homeDir,'.shotwell/data/photo.db')
282+
283+if os.path.exists(path):
284+ #connect to Shotwell library db
285+ db = sqlite3.connect(path)
286+
287+ photo_curs = db.cursor()
288+ video_curs = db.cursor()
289+
290+ photo_curs.execute('SELECT count(id) FROM PhotoTable')
291+ video_curs.execute('SELECT count(id) FROM VideoTable')
292+
293+ image_count = photo_curs.fetchone()
294+ video_count = video_curs.fetchone()
295+
296+ #Close the cursor and Database
297+ photo_curs.close()
298+ video_curs.close()
299+ db.close()
300+
301+ if image_count[0] > 0 or video_count[0] > 0:
302+ #user has images in Shotwell
303+ print image_count[0], video_count[0]
304+ sys.exit(0)
305+ else:
306+ #user does not have images in Shotwell
307+ sys.exit(1)
308+else:
309+ sys.exit(1)

Subscribers

People subscribed via source and target branches