diff --git a/dialog-warning.png b/dialog-warning.png index a9e4ff3..72e52d8 100644 Binary files a/dialog-warning.png and b/dialog-warning.png differ diff --git a/list-add.png b/list-add.png index 2acdd8f..0ebb109 100644 Binary files a/list-add.png and b/list-add.png differ diff --git a/todo b/todo index 98d4f15..e458ba6 100644 --- a/todo +++ b/todo @@ -12,18 +12,17 @@ - jpegoptim * - libjpeg/jpegtran * gif: - - optipng * + - optipng * no - gifsicle * (maybe) * = available in ubuntu trimage: simple gui for: optipng for png and gif, jpegoptim for jpeg. both are available in ubuntu as dependencies (our primary platform) - +^ no gif. optipng optimized gif by converting to png ========================================== todo app wise -- implement jpegoptim -- implement something for gifs +- implement something for gifs (or not) - implement drag and drop on table - clean up code, make it PEP-8 - figure out what to do with: diff --git a/trimage.py b/trimage.py index 7bb19ed..a2399a8 100644 --- a/trimage.py +++ b/trimage.py @@ -23,9 +23,11 @@ class StartQT4(QMainWindow): QObject.connect(self.quit_shortcut, SIGNAL("activated()"), qApp, SLOT('quit()')) QObject.connect(self.ui.processedfiles, SIGNAL("dragEnterEvent()"), self.file_drop) + def file_drop(self): print "booya" + def file_dialog(self): fd = QFileDialog(self) images = fd.getOpenFileNames(self, @@ -41,9 +43,9 @@ class StartQT4(QMainWindow): def recompress_files(self): - newimage = self.imagelist + imagelistcopy = self.imagelist self.imagelist = [] - for image in newimage: + for image in imagelistcopy: self.compress_file(image[-1]) @@ -52,20 +54,21 @@ class StartQT4(QMainWindow): oldfile = QFileInfo(filename); name = oldfile.fileName() oldfilesize = oldfile.size() + oldfilesizestr = size(oldfilesize, system=alternative) if name.endsWith("jpg"): - print "run jpegoptim" - runfile = system('ls') + runstr = 'jpegoptim --strip-all -f "' + str(filename) + '"' + runfile = system(runstr) elif name.endsWith("png"): - runstr = 'optipng -force "' + str(filename) + '"' + #runstr = 'optipng -force -o7 "' + str(filename) + '"; advpng -z4 "' + str(filename) + '"' ## don't do advpng yet + runstr = 'optipng -force -o7 "' + str(filename) + '"' runfile = system(runstr) else: print "run something for gif" runfile = system('ls') - if runfile == 0: newfile = QFile(filename) newfilesize = newfile.size() @@ -74,7 +77,7 @@ class StartQT4(QMainWindow): ratio = 100 - (float(newfilesize) / float(oldfilesize) * 100) ratiostr = "%.1f%%" % ratio - self.imagelist.append((name, newfilesizestr, ratiostr, filename)) + self.imagelist.append((name, oldfilesizestr, newfilesizestr, ratiostr, filename)) self.update_table() else: @@ -87,7 +90,7 @@ class StartQT4(QMainWindow): # set table model tmodel = tri_table_model(self, self.imagelist, - [' Filename ', ' Size ', ' Compressed ']) + ['Filename', 'Old Size', 'New Size', 'Compressed']) tview.setModel(tmodel) # set minimum size of table @@ -102,7 +105,7 @@ class StartQT4(QMainWindow): nrows = len(self.imagelist) for row in range(nrows): tview.setRowHeight(row, 25) - tview.setColumnWidth(0,400) + tview.setColumnWidth(0,300) tview.setDragDropMode(QAbstractItemView.DropOnly) tview.setAcceptDrops(True) self.enable_recompress() diff --git a/view-refresh.png b/view-refresh.png index 606ea9e..d5e3dbd 100644 Binary files a/view-refresh.png and b/view-refresh.png differ