mirror of
https://github.com/Kilian/Trimage.git
synced 2026-01-26 18:08:42 -05:00
more peb8-ing
This commit is contained in:
parent
318e2afa8a
commit
17fae20713
1 changed files with 7 additions and 4 deletions
11
trimage.py
11
trimage.py
|
|
@ -231,6 +231,7 @@ class TriTableModel(QAbstractTableModel):
|
|||
|
||||
|
||||
class Worker(QThread):
|
||||
|
||||
def __init__(self, parent=None):
|
||||
QThread.__init__(self, parent)
|
||||
self.exiting = False
|
||||
|
|
@ -264,13 +265,14 @@ class Worker(QThread):
|
|||
if extention in ['.jpg', '.jpeg']:
|
||||
runString = 'jpegoptim -f --strip-all "%(file)s"'
|
||||
elif extention in ['.png']:
|
||||
runString = 'optipng -force -o7 "%(file)s"; advpng -z4 "%(file)s"'
|
||||
runString = '''optipng -force -o7 "%(file)s";
|
||||
advpng -z4 "%(file)s"'''
|
||||
else:
|
||||
raise Exception('File %s does not have the appropriate'
|
||||
'extention' % filename)
|
||||
|
||||
try:
|
||||
retcode = call(runString % {'file' : filename}, shell=True,
|
||||
retcode = call(runString % {'file': filename}, shell=True,
|
||||
stdout=PIPE)
|
||||
runfile = retcode
|
||||
except OSError, e:
|
||||
|
|
@ -291,7 +293,8 @@ class Worker(QThread):
|
|||
if image[4] == filename:
|
||||
imagelist.remove(image)
|
||||
imagelist.insert(i, (name, oldfilesizestr,
|
||||
newfilesizestr,ratiostr, filename, icon))
|
||||
newfilesizestr, ratiostr,
|
||||
filename, icon))
|
||||
|
||||
self.emit(SIGNAL("updateUi"))
|
||||
|
||||
|
|
@ -302,7 +305,7 @@ class Worker(QThread):
|
|||
ratiostr)
|
||||
else:
|
||||
# TODO nice error recovery
|
||||
raise Exception('Some error occurred!')
|
||||
raise Exception('[error] %s' % runfile)
|
||||
|
||||
if not showapp:
|
||||
quit()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue