mirror of
https://github.com/Kilian/Trimage.git
synced 2026-01-26 10:08:40 -05:00
implement Menno's fix for Mac OSX
This commit is contained in:
parent
70181f97ef
commit
19308292c0
1 changed files with 13 additions and 3 deletions
|
|
@ -1,6 +1,7 @@
|
|||
#!/usr/bin/python
|
||||
|
||||
import sys
|
||||
import errno
|
||||
from os import listdir
|
||||
from os import path
|
||||
from subprocess import call, PIPE
|
||||
|
|
@ -203,22 +204,31 @@ class StartQT4(QMainWindow):
|
|||
def checkapps(self):
|
||||
"""Check if the required command line apps exist."""
|
||||
status = False
|
||||
retcode = call("jpegoptim --version", shell=True, stdout=PIPE)
|
||||
retcode = self.safe_call("jpegoptim --version")
|
||||
if retcode != 0:
|
||||
status = True
|
||||
sys.stderr.write("[error] please install jpegoptim")
|
||||
|
||||
retcode = call("optipng -v", shell=True, stdout=PIPE)
|
||||
retcode = self.safe_call("optipng -v")
|
||||
if retcode != 0:
|
||||
status = True
|
||||
sys.stderr.write("[error] please install optipng")
|
||||
|
||||
retcode = call("advpng --version", shell=True, stdout=PIPE)
|
||||
retcode = self.save_call("advpng --version")
|
||||
if retcode != 0:
|
||||
status = True
|
||||
sys.stderr.write("[error] please install advancecomp")
|
||||
return status
|
||||
|
||||
def safe_call(self, command):
|
||||
while True:
|
||||
try:
|
||||
return call(command, shell=True, stdout=PIPE)
|
||||
except OSError, e:
|
||||
if e.errno == errno.EINTR:
|
||||
continue
|
||||
else:
|
||||
raise
|
||||
|
||||
class TriTableModel(QAbstractTableModel):
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue