diff --git a/resources/todo b/resources/todo index aa3983d..9fbe095 100644 --- a/resources/todo +++ b/resources/todo @@ -5,12 +5,17 @@ todo app wise any random part of code (can leave things in a mess) - consider context managers for handling compression, so as to keep operations atomic and/or rollback-able + - add a recursive option on the command-line for use with -d - make -f accept a list of files - make the current verbose be "normal", and make -verbose print the commandline app prints as well + - verify that a *recompressed* file is smaller than the compressed one - find a way to specify the version once for everywhere +- notification area drag/drop widget +- save chosen directory and geometry/screen position using QSettings + todo else - figure out how to make mac and win versions (someone else :) <- via gui2exe @@ -22,7 +27,6 @@ later versions: punypng api? http://www.gracepointafterfive.com/punypng/api imagemagick/graphicsmagick? always on top option - notification area widget intelligently recompress, i.e. go through the list of files, recompress each until no more gains are seen (and a sensible number-of-tries limit isn't exceeded), and flag that file as fully-optimised. Repeat for each diff --git a/src/trimage/trimage.py b/src/trimage/trimage.py index 7e24db1..6931635 100644 --- a/src/trimage/trimage.py +++ b/src/trimage/trimage.py @@ -215,19 +215,19 @@ class StartQT4(QMainWindow): def checkapps(self): """Check if the required command line apps exist.""" - exe=".exe" if (sys.platform=="win32") else "" + exe = ".exe" if (sys.platform == "win32") else "" status = False - retcode = self.safe_call("jpegoptim"+exe+" --version") + retcode = self.safe_call("jpegoptim" + exe + " --version") if retcode != 0: status = True sys.stderr.write("[error] please install jpegoptim") - retcode = self.safe_call("optipng"+exe+" -v") + retcode = self.safe_call("optipng" + exe + " -v") if retcode != 0: status = True sys.stderr.write("[error] please install optipng") - retcode = self.safe_call("advpng"+exe+" --version") + retcode = self.safe_call("advpng" + exe + " --version") if retcode != 0: status = True sys.stderr.write("[error] please install advancecomp") @@ -252,6 +252,7 @@ class StartQT4(QMainWindow): self.show() self.systemtray.hideMain.setText("&Hide window") + class TriTableModel(QAbstractTableModel): def __init__(self, parent, imagelist, header, *args): @@ -372,11 +373,11 @@ class Image: raise "Tried to compress invalid image (unsupported format or not \ file)" self.reset() - self.compressing=True - exe=".exe" if (sys.platform=="win32") else "" + self.compressing = True + exe = ".exe" if (sys.platform == "win32") else "" runString = { - "jpeg": u"jpegoptim"+exe+" -f --strip-all '%(file)s'", - "png" : u"optipng"+exe+" -force -o7 '%(file)s'&&advpng"+exe+" -z4 '%(file)s'"} + "jpeg": u"jpegoptim" + exe + " -f --strip-all '%(file)s'", + "png": u"optipng" + exe + " -force -o7 '%(file)s'&&advpng" + exe + " -z4 '%(file)s'"} try: retcode = call(runString[self.filetype] % {"file": self.fullpath}, shell=True, stdout=PIPE)