From d6cca21e32363c1b9d13014ebeae18a59206ec4a Mon Sep 17 00:00:00 2001 From: Kilian Valkhof Date: Tue, 2 Feb 2010 18:58:32 +0100 Subject: [PATCH] add preliminary command line support --- todo | 5 +++-- trimage.py | 17 ++++++++++++++++- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/todo b/todo index 69a7c06..51149ad 100644 --- a/todo +++ b/todo @@ -25,7 +25,8 @@ optipng for png and gif, jpegoptim for jpeg. both are available in ubuntu as dep todo app wise - implement drag and drop on table - clean up code, make it PEP-8 -- implement threading (and include advpng then) +- implement threading (and include advpng then +- todo else - figure out dependencies for a .deb/how to make a .deb @@ -39,7 +40,7 @@ hurry.filesize (bundled) optipng 0.6.2.1 jpgegoptim 1.2.2 - +advancecomp 1.15 =========================================== 1.5: later versions: diff --git a/trimage.py b/trimage.py index a0da5a9..d83df1b 100644 --- a/trimage.py +++ b/trimage.py @@ -4,6 +4,7 @@ from PyQt4.QtCore import * from PyQt4.QtGui import * from hurry.filesize import * +from optparse import OptionParser from ui import Ui_trimage @@ -21,8 +22,22 @@ class StartQT4(QMainWindow): QObject.connect(self.ui.addfiles, SIGNAL("clicked()"), self.file_dialog) QObject.connect(self.ui.recompress, SIGNAL("clicked()"), self.recompress_files) QObject.connect(self.quit_shortcut, SIGNAL("activated()"), qApp, SLOT('quit()')) - QObject.connect(self.ui.processedfiles, SIGNAL("dragEnterEvent()"), self.file_drop) + parser = OptionParser(usage="%prog [-f] [-q] [-d]", version="%prog 1.0") + parser.add_option("-q", "--quiet", + action="store_false", dest="verbose", default=True, + help="don't print status messages to stdout") + + parser.add_option("-f", "--file", + action="store", type="string", dest="filename", + help="image to compress") + + parser.add_option("-d", "--directory", + action="store", type="string", dest="directory", + help="directory of images to compress") + + (options, args) = parser.parse_args() + print options def file_drop(self): print "booya"