diff --git a/todo b/todo index 8621f12..6ce5787 100644 --- a/todo +++ b/todo @@ -2,7 +2,6 @@ todo app wise - errors need to go to standarderror - fix command line options -- give a visual when thread is working todo else - figure out dependencies for a .deb/how to make a .deb @@ -19,6 +18,9 @@ jpgegoptim 1.2.2 advancecomp 1.15 =========================================== later versions: +animate compressing.gif +figure out why QKeySequence.quit doesnt work + allow selection/deletion of rows from table (and subsequently the imagelist) check for double files pnypng api? http://www.gracepointafterfive.com/punypng/api diff --git a/trimage.py b/trimage.py index aa6203b..d7bf48d 100644 --- a/trimage.py +++ b/trimage.py @@ -32,9 +32,6 @@ class StartQT4(QMainWindow): # disable recompress self.ui.recompress.setEnabled(False) - # activate command line options - self.commandline_options() - # make a worker thread self.thread = Worker() @@ -51,6 +48,9 @@ class StartQT4(QMainWindow): QObject.connect(self.thread, SIGNAL("terminated()"), self.update_table) QObject.connect(self.thread, SIGNAL("updateUi"), self.update_table) + # activate command line options + self.commandline_options() + def commandline_options(self): """Set up the command line options.""" parser = OptionParser(version="%prog " + VERSION, @@ -76,10 +76,11 @@ class StartQT4(QMainWindow): compress_file.""" global showapp showapp = False + dirpath = path.abspath(path.dirname(directory)) imagedir = listdir(directory) filelist = QStringList() for image in imagedir: - image = path.join(directory, image) + image = QString(path.join(dirpath, image)) filelist.append(image) self.delegator(filelist) @@ -87,6 +88,7 @@ class StartQT4(QMainWindow): """Get the file and send it to compress_file""" global showapp showapp = False + image = path.abspath(image) filecmdlist = QStringList() filecmdlist.append(image) self.delegator(filecmdlist) @@ -94,6 +96,7 @@ class StartQT4(QMainWindow): def file_drop(self, images): """Get a file from the drag and drop handler and send it to compress_file.""" + print images[0] self.delegator(images) def file_dialog(self): @@ -110,12 +113,10 @@ class StartQT4(QMainWindow): """Send each file in the current file list to compress_file again.""" newimagelist = [] + global imagelist for image in imagelist: newimagelist.append(image[4]) - - for i, image in enumerate(imagelist): - imagelist.remove(image) - + imagelist = [] self.delegator(newimagelist) """ Compress functions @@ -125,7 +126,8 @@ class StartQT4(QMainWindow): for image in images: if self.checkname(image): delegatorlist.append((image, QIcon(image))) - imagelist.append(("Compressing...", "", "", "", image, QIcon(QPixmap("view-refresh.png")))) + #TODO figure out how to animate + imagelist.append(("Compressing...", "", "", "", image, QIcon(QPixmap("compressing.gif")))) self.thread.compress_file(delegatorlist) """ @@ -233,6 +235,7 @@ class Worker(QThread): for image in self.images: #gather old file data filename = image[0] + print(filename) icon = image[1] oldfile = QFileInfo(filename) name = oldfile.fileName() @@ -267,7 +270,6 @@ class Worker(QThread): # append current image to list for i, image in enumerate(imagelist): - print(image[4], filename) if image[4] == filename: imagelist.remove(image) imagelist.insert(i, (name, oldfilesizestr, newfilesizestr, ratiostr, @@ -288,7 +290,6 @@ if __name__ == "__main__": app = QApplication(sys.argv) myapp = StartQT4() - global showapp if showapp: # no command line options called myapp.show() diff --git a/ui.py b/ui.py index 36f8da5..41d7dd4 100644 --- a/ui.py +++ b/ui.py @@ -2,8 +2,7 @@ from PyQt4.QtCore import * from PyQt4.QtGui import * -DEBUG = True - +DEBUG = False class TrimageTableView(QTableView):