From 245fde934b18b992f64f1e05719d1e62fdfaf9de Mon Sep 17 00:00:00 2001 From: Kilian Valkhof Date: Sun, 7 Feb 2010 15:19:50 +0100 Subject: [PATCH] add in a check for the app requirements --- trimage.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/trimage.py b/trimage.py index 4a6e856..97c33d4 100644 --- a/trimage.py +++ b/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):