mirror of
https://github.com/Kilian/Trimage.git
synced 2026-01-26 01:58:41 -05:00
add in a check for the app requirements
This commit is contained in:
parent
d345f05cdb
commit
245fde934b
1 changed files with 23 additions and 0 deletions
23
trimage.py
23
trimage.py
|
|
@ -28,6 +28,10 @@ class StartQT4(QMainWindow):
|
|||
self.ui = Ui_trimage()
|
||||
self.ui.setupUi(self)
|
||||
|
||||
# check if apps are installed
|
||||
if self.checkapps():
|
||||
quit()
|
||||
|
||||
#add quit shortcut
|
||||
if hasattr(QKeySequence, 'Quit'):
|
||||
self.quit_shortcut = QShortcut(QKeySequence(QKeySequence.Quit),
|
||||
|
|
@ -195,6 +199,25 @@ class StartQT4(QMainWindow):
|
|||
"""Enable the recompress button."""
|
||||
self.ui.recompress.setEnabled(True)
|
||||
|
||||
def checkapps(self):
|
||||
#check if apps exist
|
||||
status = False
|
||||
retcode = call("jpegoptim --version", shell=True, stdout=PIPE)
|
||||
if retcode != 0:
|
||||
status = True
|
||||
print("[error] please install jpegoptim")
|
||||
|
||||
retcode = call("optipng -v", shell=True, stdout=PIPE)
|
||||
if retcode != 0:
|
||||
status = True
|
||||
print("[error] please install optipng")
|
||||
|
||||
retcode = call("advpng --version", shell=True, stdout=PIPE)
|
||||
if retcode != 0:
|
||||
status = True
|
||||
print("[error] please install advancecomp")
|
||||
return status
|
||||
|
||||
|
||||
class TriTableModel(QAbstractTableModel):
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue