Merge lp:~zilvador/ubuntu-desktop-accomplishments/sudoku-shotwell into lp:ubuntu-desktop-accomplishments

Proposed by Daniel Ejsing-Duun
Status: Merged
Merged at revision: 86
Proposed branch: lp:~zilvador/ubuntu-desktop-accomplishments/sudoku-shotwell
Merge into: lp:ubuntu-desktop-accomplishments
Diff against target: 294 lines (+225/-1)
12 files modified
Changelog (+8/-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 (+16/-0)
accomplishments/ubuntu-desktop/en/multimedia/musicinrhythmbox.accomplishment (+1/-1)
scripts/ubuntu-desktop/gaming/sudoku_easy.py (+26/-0)
scripts/ubuntu-desktop/gaming/sudoku_hard.py (+32/-0)
scripts/ubuntu-desktop/gaming/sudoku_medium.py (+32/-0)
scripts/ubuntu-desktop/gaming/sudoku_very_hard.py (+23/-0)
scripts/ubuntu-desktop/multimedia/importshotwell.py (+35/-0)
To merge this branch: bzr merge lp:~zilvador/ubuntu-desktop-accomplishments/sudoku-shotwell
Reviewer Review Type Date Requested Status
Matt Fischer Approve
Review via email: mp+140773@code.launchpad.net

Description of the change

A continuation of Tony Vec's work on the Sudoku accomplishment and the Shotwell accomplishment. Testing, code clean-up and a few corrections made to both scripts.

To post a comment you must log in.
63. By Daniel Ejsing-Duun

Merge with Shotwell Accomplishment

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

Please edit ChangeLog and add your name and Tony's name following the format in the file please.

review: Needs Fixing
64. By Daniel Ejsing-Duun

Updated Changelog

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

I tested shotwell and rookie sudoku, works great. +1

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'Changelog'
2--- Changelog 2012-12-07 18:05:53 +0000
3+++ Changelog 2012-12-20 20:25:24 +0000
4@@ -31,4 +31,12 @@
5 [Howard Chan]
6 * Changed accomplishment authors to avoid duplicates (LP: #1080346)
7
8+ [Tony Vec]
9+ [Daniel Ejsing-Duun]
10+ * Added a new accomplishment: Import To Shotwell
11+ * Added a new accomplishment: Rookie Sudoku Player
12+ * Added a new accomplishment: Pro Sudoku Player
13+ * Added a new accomplishment: All Star Sudoku Player
14+ * Added a new accomplishment: Sudoku Master
15+
16 -------------------------------------------------------------------------
17
18=== added file 'accomplishments/ubuntu-desktop/en/gaming/sudoku_easy.accomplishment'
19--- accomplishments/ubuntu-desktop/en/gaming/sudoku_easy.accomplishment 1970-01-01 00:00:00 +0000
20+++ accomplishments/ubuntu-desktop/en/gaming/sudoku_easy.accomplishment 2012-12-20 20:25:24 +0000
21@@ -0,0 +1,13 @@
22+[accomplishment]
23+title = Rookie Sudoku Player
24+description = Win an easy game of Sudoku
25+collection = ubuntu-desktop
26+category = Games:Sudoku
27+icon = default.png
28+summary = You can achieve this accomplishment by completing a game of Sudoku on the <b>easy</b> difficulty.
29+steps = Start Sudoku.
30+ Select an easy game.
31+ Fill out the squares until the whole board is completed.
32+tips = There's no time limit, so no need to rush.
33+ You can get extra help from sudoku's help menu (F1).
34+author = Tony Vec <tvec623@gmail.com>
35
36=== added file 'accomplishments/ubuntu-desktop/en/gaming/sudoku_hard.accomplishment'
37--- accomplishments/ubuntu-desktop/en/gaming/sudoku_hard.accomplishment 1970-01-01 00:00:00 +0000
38+++ accomplishments/ubuntu-desktop/en/gaming/sudoku_hard.accomplishment 2012-12-20 20:25:24 +0000
39@@ -0,0 +1,13 @@
40+[accomplishment]
41+title = All Star Sudoku Player
42+description = Win a hard game of Sudoku
43+collection = ubuntu-desktop
44+category = Games:Sudoku
45+icon = default.png
46+summary = You can achieve this accomplishment by completing a game of Sudoku in the <b>hard</b> difficulty.
47+steps = Start Sudoku.
48+ Select a hard game.
49+ Fill out the squares until the whole board is completed.
50+tips = There's no time limit, so no need to rush.
51+ You can get extra help from sudoku's help menu (F1).
52+author = Tony Vec <tvec623@gmail.com>
53
54=== added file 'accomplishments/ubuntu-desktop/en/gaming/sudoku_medium.accomplishment'
55--- accomplishments/ubuntu-desktop/en/gaming/sudoku_medium.accomplishment 1970-01-01 00:00:00 +0000
56+++ accomplishments/ubuntu-desktop/en/gaming/sudoku_medium.accomplishment 2012-12-20 20:25:24 +0000
57@@ -0,0 +1,13 @@
58+[accomplishment]
59+title = Pro Sudoku Player
60+description = Win a medium game of Sudoku
61+collection = ubuntu-desktop
62+category = Games:Sudoku
63+icon = default.png
64+summary = You can achieve this accomplishment by completing a game of Sudoku on the <b>medium</b> difficulty.
65+steps = Start Sudoku.
66+ Select medium game.
67+ Fill out the squares until the whole board is completed.
68+tips = There's no time limit, so no need to rush.
69+ You can get extra help from sudoku's help menu (F1).
70+author = Tony Vec <tvec623@gmail.com>
71
72=== added file 'accomplishments/ubuntu-desktop/en/gaming/sudoku_very_hard.accomplishment'
73--- accomplishments/ubuntu-desktop/en/gaming/sudoku_very_hard.accomplishment 1970-01-01 00:00:00 +0000
74+++ accomplishments/ubuntu-desktop/en/gaming/sudoku_very_hard.accomplishment 2012-12-20 20:25:24 +0000
75@@ -0,0 +1,13 @@
76+[accomplishment]
77+title = Sudoku Master
78+description = Win very hard a game of Sudoku
79+collection = ubuntu-desktop
80+category = Games:Sudoku
81+icon = default.png
82+summary = You can achieve this accomplishment by completing a game of Sudoku in the <b>very hard</b> difficulty.
83+steps = Start Sudoku.
84+ Select a very hard game.
85+ Fill out the squares until the whole board is completed.
86+tips = There's no time limit, so no need to rush.
87+ You can get extra help from sudoku's help menu (F1).
88+author = Tony Vec <tvec623@gmail.com>
89
90=== added file 'accomplishments/ubuntu-desktop/en/multimedia/importshotwell.accomplishment'
91--- accomplishments/ubuntu-desktop/en/multimedia/importshotwell.accomplishment 1970-01-01 00:00:00 +0000
92+++ accomplishments/ubuntu-desktop/en/multimedia/importshotwell.accomplishment 2012-12-20 20:25:24 +0000
93@@ -0,0 +1,16 @@
94+[accomplishment]
95+title = Import To Shotwell
96+description = Import photos/videos into Shotwell Photo Manager
97+category = Multimedia
98+icon = default.png
99+author = Tony Vec <tvec623@gmail.com>
100+collection = ubuntu-desktop
101+summary = Shotwell Photo Manager allows you to import, organize, view and edit images
102+ This accomplishment is awarded when you <b>import photos or videos</b> into your Shotwell library
103+steps = Click the <i>Dash Home</i>
104+ Enter <i>Shotwell Photo Manager</i>
105+ You will be presented with the Shotwell application icon. Click on it.
106+ 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 to import and press <b>OK</b></li></ul>
107+tips = Shotwell supports JPEG, PNG, TIFF, BMP, and RAW photo files. It even supports video files!
108+pitfalls = Shotwell does not support GIF images.
109+links = http://yorba.org/shotwell/help/
110
111=== modified file 'accomplishments/ubuntu-desktop/en/multimedia/musicinrhythmbox.accomplishment'
112--- accomplishments/ubuntu-desktop/en/multimedia/musicinrhythmbox.accomplishment 2012-06-10 11:46:06 +0000
113+++ accomplishments/ubuntu-desktop/en/multimedia/musicinrhythmbox.accomplishment 2012-12-20 20:25:24 +0000
114@@ -14,6 +14,6 @@
115 Right click the 'music' entry under library and choose 'import file...' for a single song or 'import folder...' for a folder of music
116 Navigate to the folder or song desired
117 tips = You can even buy music through Rhythmbox
118-pitfalls = Using a network share could resultin Rhythmbox reporting that you have missing files if you have not mounted the share prior to launching Rhythmbox.
119+pitfalls = Using a network share could result in Rhythmbox reporting that you have missing files if you have not mounted the share prior to launching Rhythmbox.
120 help = Click the <i>Help</i> menu.
121
122
123=== added file 'scripts/ubuntu-desktop/gaming/sudoku_easy.py'
124--- scripts/ubuntu-desktop/gaming/sudoku_easy.py 1970-01-01 00:00:00 +0000
125+++ scripts/ubuntu-desktop/gaming/sudoku_easy.py 2012-12-20 20:25:24 +0000
126@@ -0,0 +1,26 @@
127+#!/usr/bin/python
128+import sys, os
129+
130+homeDir = os.getenv('HOME')
131+sudoku_path = os.path.join(homeDir,'.config/gnome-sudoku/puzzles/')
132+
133+try:
134+ #Load all finished games
135+ with open(sudoku_path+'finished', 'r') as finished:
136+ finished_games = list(finished)
137+ #Load all easy games
138+ with open(sudoku_path+'easy', 'r') as f:
139+ easy = f.read()
140+ for game in finished_games:
141+ #Lines in the files have a '/n' at the end.
142+ #Truncate before matching the finished list
143+ #with the list of easy games
144+ if game[:-1] 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+ #File does not exist or
151+ #List of game difficulty does not exist
152+ sys.exit(1)
153
154=== added file 'scripts/ubuntu-desktop/gaming/sudoku_hard.py'
155--- scripts/ubuntu-desktop/gaming/sudoku_hard.py 1970-01-01 00:00:00 +0000
156+++ scripts/ubuntu-desktop/gaming/sudoku_hard.py 2012-12-20 20:25:24 +0000
157@@ -0,0 +1,32 @@
158+#!/usr/bin/python
159+import sys, 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+
167+ try:
168+ with open(sudoku_path+'finished', 'r') as finished:
169+ return (list(finished))
170+ except IOError as e:
171+ #file does not exist
172+ sys.exit(1)
173+
174+finished_games = get_finished_levels()
175+
176+try:
177+ with open(sudoku_path+'hard', 'r') as f:
178+ hard = f.read()
179+ for game in finished_games:
180+ #lines in the files have a '/n' at the end.
181+ #Truncate before checking
182+ if game[:-1] in hard:
183+ #easy game has been completed
184+ sys.exit(0)
185+ #No completed games found in easy
186+ sys.exit(1)
187+except IOError as e:
188+ #list of game difficulty does not exist
189+ sys.exit(1)
190
191=== added file 'scripts/ubuntu-desktop/gaming/sudoku_medium.py'
192--- scripts/ubuntu-desktop/gaming/sudoku_medium.py 1970-01-01 00:00:00 +0000
193+++ scripts/ubuntu-desktop/gaming/sudoku_medium.py 2012-12-20 20:25:24 +0000
194@@ -0,0 +1,32 @@
195+#!/usr/bin/python
196+import sys, os
197+
198+homeDir = os.getenv('HOME')
199+sudoku_path = os.path.join(homeDir,'.config/gnome-sudoku/puzzles/')
200+
201+
202+def get_finished_levels():
203+
204+ try:
205+ with open(sudoku_path+'finished', 'r') as finished:
206+ return (list(finished))
207+ except IOError as e:
208+ #file does not exist
209+ sys.exit(1)
210+
211+finished_games = get_finished_levels()
212+
213+try:
214+ with open(sudoku_path+'medium', 'r') as f:
215+ medium = f.read()
216+ for game in finished_games:
217+ #lines in the files have a '/n' at the end.
218+ #Truncate before checking
219+ if game[:-1] in medium:
220+ #easy game has been completed
221+ sys.exit(0)
222+ #No completed games found in easy
223+ sys.exit(1)
224+except IOError as e:
225+ #list of game difficulty does not exist
226+ sys.exit(1)
227
228=== added file 'scripts/ubuntu-desktop/gaming/sudoku_very_hard.py'
229--- scripts/ubuntu-desktop/gaming/sudoku_very_hard.py 1970-01-01 00:00:00 +0000
230+++ scripts/ubuntu-desktop/gaming/sudoku_very_hard.py 2012-12-20 20:25:24 +0000
231@@ -0,0 +1,23 @@
232+#!/usr/bin/python
233+import sys, os
234+
235+homeDir = os.getenv('HOME')
236+sudoku_path = os.path.join(homeDir,'.config/gnome-sudoku/puzzles/')
237+
238+try:
239+ with open(sudoku_path+'finished', 'r') as finished:
240+ finished_games = list(finished)
241+ with open(sudoku_path+'very_hard', 'r') as f:
242+ very_hard = f.read()
243+ for game in finished_games:
244+ #lines in the files have a '/n' at the end.
245+ #Truncate before checking
246+ if game[:-1] in very_hard:
247+ #easy game has been completed
248+ sys.exit(0)
249+ #No completed games found in easy
250+ sys.exit(1)
251+except IOError as e:
252+ #file does not exist or
253+ #list of game difficulty does not exist
254+ sys.exit(1)
255
256=== added file 'scripts/ubuntu-desktop/multimedia/importshotwell.py'
257--- scripts/ubuntu-desktop/multimedia/importshotwell.py 1970-01-01 00:00:00 +0000
258+++ scripts/ubuntu-desktop/multimedia/importshotwell.py 2012-12-20 20:25:24 +0000
259@@ -0,0 +1,35 @@
260+#!/usr/bin/python
261+import os, sqlite3, sys
262+
263+homeDir = os.getenv('HOME')
264+path = os.path.join(homeDir,'.local/share/shotwell/data/photo.db')
265+
266+if os.path.exists(path):
267+ #Connect to Shotwell library db
268+ try:
269+ db = sqlite3.connect(path)
270+ except sqlite3.DatabaseError, e:
271+ #Corrupted database file
272+ print "It seems that the Shotwell database has been corrupted."
273+ sys.exit(1)
274+
275+ cursor = db.cursor()
276+
277+ cursor.execute('SELECT count(id) FROM PhotoTable')
278+ image_count = cursor.fetchone()
279+
280+ cursor.execute('SELECT count(id) FROM VideoTable')
281+ video_count = cursor.fetchone()
282+
283+ #Close the cursor and database
284+ cursor.close()
285+ db.close()
286+
287+ if image_count[0] > 0 or video_count[0] > 0:
288+ #The user has images or videos in Shotwell
289+ sys.exit(0)
290+ else:
291+ #The user does not have images or videos in Shotwell
292+ sys.exit(1)
293+else:
294+ sys.exit(1)

Subscribers

People subscribed via source and target branches