Merge lp://qastaging/~andreambu/phatch/pep8 into lp://qastaging/phatch

Proposed by Andrea Ambu
Status: Merged
Merged at revision: not available
Proposed branch: lp://qastaging/~andreambu/phatch/pep8
Merge into: lp://qastaging/phatch
Diff against target: 429 lines (+170/-139)
2 files modified
phatch/linux/__init__.py (+1/-2)
phatch/linux/droplet.py (+169/-137)
To merge this branch: bzr merge lp://qastaging/~andreambu/phatch/pep8
Reviewer Review Type Date Requested Status
Stani Approve
Review via email: mp+20413@code.qastaging.launchpad.net

Commit message

Make linux/ directory follow PEP8

To post a comment you must log in.
1660. By Stani <email address hidden>

Andrea Ambu 2010-03-02 Make linux/ direcotry follow PEP8

Revision history for this message
Stani (stani) wrote :

Merged! Thanks a lot! Feel free to pick another directory.

review: Approve
Revision history for this message
Andrea Ambu (andreambu) wrote :

I'll take console next but I'm not going to do it tonight :D
I'll request for merge ;)

Good night!

On 2 March 2010 00:51, stani <email address hidden> wrote:
> Review: Approve
> Merged! Thanks a lot! Feel free to pick another directory.
> --
> https://code.launchpad.net/~andreambu/phatch/pep8/+merge/20413
> You are the owner of lp:~andreambu/phatch/pep8.
>

--
Andrea

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'phatch/linux/__init__.py'
2--- phatch/linux/__init__.py 2008-01-28 15:21:33 +0000
3+++ phatch/linux/__init__.py 2010-03-01 23:28:14 +0000
4@@ -10,9 +10,8 @@
5 # but WITHOUT ANY WARRANTY; without even the implied warranty of
6 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
7 # GNU General Public License for more details.
8-#
9+#
10 # You should have received a copy of the GNU General Public License
11 # along with this program. If not, see http://www.gnu.org/licenses/
12 #
13 # Phatch recommends SPE (http://pythonide.stani.be) for editing python files.
14-
15
16=== modified file 'phatch/linux/droplet.py'
17--- phatch/linux/droplet.py 2010-02-24 21:00:07 +0000
18+++ phatch/linux/droplet.py 2010-03-01 23:28:14 +0000
19@@ -14,7 +14,10 @@
20 # You should have received a copy of the GNU General Public License
21 # along with this program. If not, see http://www.gnu.org/licenses/
22
23-import new, os
24+# Follows PEP8
25+
26+import new
27+import os
28 import wx
29 from core import ct
30 from lib.reverse_translation import _t
31@@ -27,170 +30,199 @@
32 try:
33 from thunar import thunar_exists, create_thunar_action
34 except ImportError:
35+
36 def thunar_exists():
37 return False
38
39 try:
40- from lib.linux.nautilusExtension import nautilus_exists, create_nautilus_extension
41+ from lib.linux.nautilusExtension import nautilus_exists, \
42+ create_nautilus_extension
43 except ImportError:
44+
45 def nautilus_exists():
46 return False
47
48-WX_ENCODING = wx.GetDefaultPyEncoding()
49+WX_ENCODING = wx.GetDefaultPyEncoding()
50
51
52 #---general
53-def menu_action(self,program,comment,method,*args,**keyw):
54+def menu_action(self, program, comment, method, *args, **keyw):
55 try:
56- success = method(*args,**keyw)
57+ success = method(*args, **keyw)
58 self.show_info(_('If you restart %s, '
59- 'the action will appear in the context menu.')%program + comment)
60+ 'the action will appear in the context menu.') % program + comment)
61 except Exception, details:
62- reason = exception_to_unicode(details,WX_ENCODING)
63+ reason = exception_to_unicode(details, WX_ENCODING)
64 self.show_error(_('Phatch could not install the action in %s:')\
65 % program + '\n\n' + reason)
66
67 #---droplet
68-def create_phatch_droplet(actionlist, folder, icon = 'phatch'):
69- """"""
70- create_droplet(
71- name = system.filename_to_title(actionlist),
72- command = ct.COMMAND['DROP']%actionlist,
73- folder = folder,
74- icon = icon,
75- )
76-
77-def create_phatch_recent_droplet(folder, icon = 'phatch'):
78- """"""
79- create_droplet(
80- name = ct.LABEL_PHATCH_RECENT,
81- command = ct.COMMAND['RECENT'],
82- folder = folder,
83- icon = icon,
84- )
85-
86-def create_phatch_inspector_droplet(folder, icon = 'phatch'):
87- """"""
88- create_droplet(
89- name = ct.LABEL_PHATCH_INSPECTOR,
90- command = ct.COMMAND['INSPECTOR'],
91- folder = folder,
92- icon = icon,
93- )
94-
95-def on_menu_file_export_droplet_actionlist(self,event):
96- if self.is_save_not_ok(): return
97- self.menu_file_export_droplet(create_phatch_droplet,self.filename)
98-
99-def on_menu_file_export_droplet_recent(self,event):
100+
101+
102+def create_phatch_droplet(actionlist, folder, icon='phatch'):
103+ """"""
104+ create_droplet(
105+ name=system.filename_to_title(actionlist),
106+ command=ct.COMMAND['DROP'] % actionlist,
107+ folder=folder,
108+ icon=icon,
109+ )
110+
111+
112+def create_phatch_recent_droplet(folder, icon='phatch'):
113+ """"""
114+ create_droplet(
115+ name=ct.LABEL_PHATCH_RECENT,
116+ command=ct.COMMAND['RECENT'],
117+ folder=folder,
118+ icon=icon,
119+ )
120+
121+
122+def create_phatch_inspector_droplet(folder, icon='phatch'):
123+ """"""
124+ create_droplet(
125+ name=ct.LABEL_PHATCH_INSPECTOR,
126+ command=ct.COMMAND['INSPECTOR'],
127+ folder=folder,
128+ icon=icon,
129+ )
130+
131+
132+def on_menu_file_export_droplet_actionlist(self, event):
133+ if self.is_save_not_ok():
134+ return
135+ self.menu_file_export_droplet(create_phatch_droplet, self.filename)
136+
137+
138+def on_menu_file_export_droplet_recent(self, event):
139 self.menu_file_export_droplet(create_phatch_recent_droplet)
140
141-def on_menu_file_export_droplet_inspector(self,event):
142+
143+def on_menu_file_export_droplet_inspector(self, event):
144 self.menu_file_export_droplet(create_phatch_inspector_droplet)
145
146 #---thunar
147-def create_phatch_thunar_action(actionlist, description='', icon = 'phatch'):
148- """"""
149- return create_thunar_action(
150- name = ct.LABEL_PHATCH_ACTIONLIST%system.filename_to_title(actionlist),
151- description = description,
152- command = ct.COMMAND['DROP']%actionlist,
153- icon = icon,
154- types = '<directories/><image-files/>',
155- )
156-
157-def create_phatch_recent_thunar_action(icon = 'phatch'):
158- """"""
159- return create_thunar_action(
160- name = ct.LABEL_PHATCH_RECENT + '...',
161- description = ct.DESCRIPTION_RECENT,
162- command = ct.COMMAND['RECENT'],
163- icon = icon,
164- types = '<directories/><image-files/>',
165- )
166-
167-def create_phatch_inspect_thunar_action(icon = 'phatch'):
168- """"""
169- return create_thunar_action(
170- name = ct.INFO['name'] + ' ' + ct.LABEL_PHATCH_INSPECTOR + '...',
171- description = ct.DESCRIPTION_INSPECTOR,
172- command = ct.COMMAND['INSPECTOR'],
173- icon = icon,
174- types = '<image-files/>',
175- )
176-
177-def on_menu_file_export_thunar_actionlist(self,event):
178- if self.is_save_not_ok(): return
179- menu_action(self,'Thunar','',create_phatch_thunar_action,self.filename,
180+
181+
182+def create_phatch_thunar_action(actionlist, description='', icon='phatch'):
183+ """"""
184+ return create_thunar_action(
185+ name=ct.LABEL_PHATCH_ACTIONLIST % system.filename_to_title(actionlist),
186+ description=description,
187+ command=ct.COMMAND['DROP'] % actionlist,
188+ icon=icon,
189+ types='<directories/><image-files/>',
190+ )
191+
192+
193+def create_phatch_recent_thunar_action(icon='phatch'):
194+ """"""
195+ return create_thunar_action(
196+ name=ct.LABEL_PHATCH_RECENT + '...',
197+ description=ct.DESCRIPTION_RECENT,
198+ command=ct.COMMAND['RECENT'],
199+ icon=icon,
200+ types='<directories/><image-files/>',
201+ )
202+
203+
204+def create_phatch_inspect_thunar_action(icon='phatch'):
205+ """"""
206+ return create_thunar_action(
207+ name=ct.INFO['name'] + ' ' + ct.LABEL_PHATCH_INSPECTOR + '...',
208+ description=ct.DESCRIPTION_INSPECTOR,
209+ command=ct.COMMAND['INSPECTOR'],
210+ icon=icon,
211+ types='<image-files/>',
212+ )
213+
214+
215+def on_menu_file_export_thunar_actionlist(self, event):
216+ if self.is_save_not_ok():
217+ return
218+ menu_action(self, 'Thunar', '', create_phatch_thunar_action, self.filename,
219 description='')
220
221-def on_menu_file_export_thunar_recent(self,event):
222- menu_action(self,'Thunar','',create_phatch_recent_thunar_action)
223-
224-def on_menu_file_export_thunar_inspector(self,event):
225- menu_action(self,'Thunar','',create_phatch_inspect_thunar_action)
226+
227+def on_menu_file_export_thunar_recent(self, event):
228+ menu_action(self, 'Thunar', '', create_phatch_recent_thunar_action)
229+
230+
231+def on_menu_file_export_thunar_inspector(self, event):
232+ menu_action(self, 'Thunar', '', create_phatch_inspect_thunar_action)
233
234 #---nautilus
235-REQUIRES_PYTHON_NAUTILUS = '\n\n(%s)'%\
236+REQUIRES_PYTHON_NAUTILUS = '\n\n(%s)' % \
237 _('This requires also that the python-nautilus package is installed.')
238-TOOLTIP = '_("%s")'%_t('Batch process images with Phatch')
239-PRELOAD = """
240+TOOLTIP = '_("%s")' % _t('Batch process images with Phatch')
241+PRELOAD = """
242 from phatch.core.config import load_locale_only
243 load_locale_only()"""
244
245+
246 def create_phatch_nautilus_action(actionlist):
247- name = os.path.splitext(os.path.basename(actionlist))[0]
248- title = system.title(name)
249+ name = os.path.splitext(os.path.basename(actionlist))[0]
250+ title = system.title(name)
251 create_nautilus_extension(
252- name = 'phatch_actionlist_' + \
253- name.encode('ascii','ignore'),
254- label = '_("%s") + "..."'%_t('Phatch with %s')%title,
255- command = 'phatch -d "%s" %%s &'%actionlist,
256- mimetypes = IMAGE_READ_MIMETYPES,
257- tooltip = TOOLTIP,
258- preload = PRELOAD,
259+ name='phatch_actionlist_' + \
260+ name.encode('ascii', 'ignore'),
261+ label='_("%s") + "..."' % _t('Phatch with %s') % title,
262+ command='phatch -d "%s" %%s &' % actionlist,
263+ mimetypes=IMAGE_READ_MIMETYPES,
264+ tooltip=TOOLTIP,
265+ preload=PRELOAD,
266 )
267
268+
269 def create_phatch_recent_nautilus_action():
270 create_nautilus_extension(
271- name = 'phatch_recent',
272- label = '_("%s") + "..."'%\
273+ name='phatch_recent',
274+ label='_("%s") + "..."' % \
275 _t('Process with recent Phatch action list'),
276- command = 'phatch -d recent %s &',
277- mimetypes = IMAGE_READ_MIMETYPES,
278- tooltip = TOOLTIP,
279- preload = PRELOAD,
280+ command='phatch -d recent %s &',
281+ mimetypes=IMAGE_READ_MIMETYPES,
282+ tooltip=TOOLTIP,
283+ preload=PRELOAD,
284 )
285
286+
287 def create_phatch_inspect_nautilus_action():
288 create_nautilus_extension(
289- name = 'phatch_image_inspector',
290- label = '_("%s") + "..."'%\
291+ name='phatch_image_inspector',
292+ label='_("%s") + "..."' % \
293 _t('Inspect with Phatch'),
294- command = 'phatch -n %s &',
295- mimetypes = IMAGE_READ_MIMETYPES,
296- tooltip = '_("%s")'%_t('Inspect EXIF & IPTC tags'),
297- preload = PRELOAD,
298+ command='phatch -n %s &',
299+ mimetypes=IMAGE_READ_MIMETYPES,
300+ tooltip='_("%s")' % _t('Inspect EXIF & IPTC tags'),
301+ preload=PRELOAD,
302 )
303
304-def on_menu_file_export_nautilus_actionlist(self,event):
305- if self.is_save_not_ok(): return
306- menu_action(self,'Nautilus',REQUIRES_PYTHON_NAUTILUS,
307- create_phatch_nautilus_action,self.filename)
308-
309-def on_menu_file_export_nautilus_recent(self,event):
310- menu_action(self,'Nautilus',REQUIRES_PYTHON_NAUTILUS,
311+
312+def on_menu_file_export_nautilus_actionlist(self, event):
313+ if self.is_save_not_ok():
314+ return
315+ menu_action(self, 'Nautilus', REQUIRES_PYTHON_NAUTILUS,
316+ create_phatch_nautilus_action, self.filename)
317+
318+
319+def on_menu_file_export_nautilus_recent(self, event):
320+ menu_action(self, 'Nautilus', REQUIRES_PYTHON_NAUTILUS,
321 create_phatch_recent_nautilus_action)
322
323-def on_menu_file_export_nautilus_inspector(self,event):
324- menu_action(self,'Nautilus',REQUIRES_PYTHON_NAUTILUS,
325+
326+def on_menu_file_export_nautilus_inspector(self, event):
327+ menu_action(self, 'Nautilus', REQUIRES_PYTHON_NAUTILUS,
328 create_phatch_inspect_nautilus_action)
329
330 #---install
331-def install_menu_item(self,menu,name,label,tooltip="",
332+
333+
334+def install_menu_item(self, menu, name, label, tooltip="",
335 style=wx.ITEM_NORMAL):
336- method = globals()['on_' + name]
337- return self.install_menu_item(menu,name,label,method,tooltip,style)
338+ method = globals()['on_' + name]
339+ return self.install_menu_item(menu, name, label, method, tooltip, style)
340+
341
342 def install(self):
343 #install menu items in reverse order
344@@ -198,17 +230,17 @@
345 #thunar
346 if thunar_exists():
347 install_menu_item(self, self.menu_file_export,
348- name = 'menu_file_export_thunar_inspector',
349- label = ct.INTEGRATE_PHATCH_INSPECTOR%"Thuna&r",
350+ name='menu_file_export_thunar_inspector',
351+ label=ct.INTEGRATE_PHATCH_INSPECTOR % "Thuna&r",
352 )
353 install_menu_item(self, self.menu_file_export,
354- name = 'menu_file_export_thunar_recent',
355- label = ct.INTEGRATE_PHATCH_RECENT%"T&hunar",
356+ name='menu_file_export_thunar_recent',
357+ label=ct.INTEGRATE_PHATCH_RECENT % "T&hunar",
358 )
359 self.menu_item.append((self.menu_file_export,
360 [install_menu_item(self, self.menu_file_export,
361- name = 'menu_file_export_thunar_actionlist',
362- label = ct.INTEGRATE_PHATCH_ACTIONLIST%"&Thunar",
363+ name='menu_file_export_thunar_actionlist',
364+ label=ct.INTEGRATE_PHATCH_ACTIONLIST % "&Thunar",
365 )]))
366 self.menu_file_export.InsertSeparator(3)
367
368@@ -216,44 +248,44 @@
369 if nautilus_exists():
370 if not SYSTEM_INSTALL:
371 install_menu_item(self, self.menu_file_export,
372- name = 'menu_file_export_nautilus_inspector',
373- label = ct.INTEGRATE_PHATCH_INSPECTOR%"Nautil&us",
374+ name='menu_file_export_nautilus_inspector',
375+ label=ct.INTEGRATE_PHATCH_INSPECTOR % "Nautil&us",
376 )
377 install_menu_item(self, self.menu_file_export,
378- name = 'menu_file_export_nautilus_recent',
379- label = ct.INTEGRATE_PHATCH_RECENT%"Nauti&lus",
380+ name='menu_file_export_nautilus_recent',
381+ label=ct.INTEGRATE_PHATCH_RECENT % "Nauti&lus",
382 )
383 self.menu_item.append((self.menu_file_export,
384 [install_menu_item(self, self.menu_file_export,
385- name = 'menu_file_export_nautilus_actionlist',
386- label = ct.INTEGRATE_PHATCH_ACTIONLIST%"Nautilu&s",
387+ name='menu_file_export_nautilus_actionlist',
388+ label=ct.INTEGRATE_PHATCH_ACTIONLIST % "Nautilu&s",
389 )]))
390 if SYSTEM_INSTALL:
391- separator = 1
392+ separator = 1
393 else:
394- separator = 3
395+ separator = 3
396 self.menu_file_export.InsertSeparator(separator)
397
398 #droplet
399 install_menu_item(self, self.menu_file_export,
400- name = 'menu_file_export_droplet_inspector',
401- label = ct.DROPLET_PHATCH_INSPECTOR,
402+ name='menu_file_export_droplet_inspector',
403+ label=ct.DROPLET_PHATCH_INSPECTOR,
404 )
405 install_menu_item(self, self.menu_file_export,
406- name = 'menu_file_export_droplet_recent',
407- label = ct.DROPLET_PHATCH_RECENT,
408+ name='menu_file_export_droplet_recent',
409+ label=ct.DROPLET_PHATCH_RECENT,
410 )
411 self.menu_item.append((self.menu_file_export,
412 [install_menu_item(self, self.menu_file_export,
413- name = 'menu_file_export_droplet_actionlist',
414- label = ct.DROPLET_PHATCH_ACTIONLIST,
415+ name='menu_file_export_droplet_actionlist',
416+ label=ct.DROPLET_PHATCH_ACTIONLIST,
417 )]))
418 self.menu_file_export.InsertSeparator(3)
419
420
421 if __name__ == '__main__':
422 create_phatch_droplet(
423- actionlist = '/home/stani/sync/python/phatch/action lists/tutorials/thumb round 3d reflect.phatch',
424- folder = '/home/stani/sync/Desktop',
425+ actionlist=''.join('/home/stani/sync/python/phatch/action ',
426+ 'lists/tutorials/thumb round 3d reflect.phatch'),
427+ folder='/home/stani/sync/Desktop',
428 )
429-

Subscribers

People subscribed via source and target branches

to status/vote changes: