some testing, update todo

This commit is contained in:
Kilian Valkhof 2010-02-05 17:17:06 +01:00
parent 18af1183b7
commit f9ca8e602c
3 changed files with 16 additions and 14 deletions

4
todo
View file

@ -2,7 +2,6 @@
todo app wise todo app wise
- errors need to go to standarderror - errors need to go to standarderror
- fix command line options - fix command line options
- give a visual when thread is working
todo else todo else
- figure out dependencies for a .deb/how to make a .deb - figure out dependencies for a .deb/how to make a .deb
@ -19,6 +18,9 @@ jpgegoptim 1.2.2
advancecomp 1.15 advancecomp 1.15
=========================================== ===========================================
later versions: later versions:
animate compressing.gif
figure out why QKeySequence.quit doesnt work
allow selection/deletion of rows from table (and subsequently the imagelist) allow selection/deletion of rows from table (and subsequently the imagelist)
check for double files check for double files
pnypng api? http://www.gracepointafterfive.com/punypng/api pnypng api? http://www.gracepointafterfive.com/punypng/api

View file

@ -32,9 +32,6 @@ class StartQT4(QMainWindow):
# disable recompress # disable recompress
self.ui.recompress.setEnabled(False) self.ui.recompress.setEnabled(False)
# activate command line options
self.commandline_options()
# make a worker thread # make a worker thread
self.thread = Worker() self.thread = Worker()
@ -51,6 +48,9 @@ class StartQT4(QMainWindow):
QObject.connect(self.thread, SIGNAL("terminated()"), self.update_table) QObject.connect(self.thread, SIGNAL("terminated()"), self.update_table)
QObject.connect(self.thread, SIGNAL("updateUi"), self.update_table) QObject.connect(self.thread, SIGNAL("updateUi"), self.update_table)
# activate command line options
self.commandline_options()
def commandline_options(self): def commandline_options(self):
"""Set up the command line options.""" """Set up the command line options."""
parser = OptionParser(version="%prog " + VERSION, parser = OptionParser(version="%prog " + VERSION,
@ -76,10 +76,11 @@ class StartQT4(QMainWindow):
compress_file.""" compress_file."""
global showapp global showapp
showapp = False showapp = False
dirpath = path.abspath(path.dirname(directory))
imagedir = listdir(directory) imagedir = listdir(directory)
filelist = QStringList() filelist = QStringList()
for image in imagedir: for image in imagedir:
image = path.join(directory, image) image = QString(path.join(dirpath, image))
filelist.append(image) filelist.append(image)
self.delegator(filelist) self.delegator(filelist)
@ -87,6 +88,7 @@ class StartQT4(QMainWindow):
"""Get the file and send it to compress_file""" """Get the file and send it to compress_file"""
global showapp global showapp
showapp = False showapp = False
image = path.abspath(image)
filecmdlist = QStringList() filecmdlist = QStringList()
filecmdlist.append(image) filecmdlist.append(image)
self.delegator(filecmdlist) self.delegator(filecmdlist)
@ -94,6 +96,7 @@ class StartQT4(QMainWindow):
def file_drop(self, images): def file_drop(self, images):
"""Get a file from the drag and drop handler and send it to """Get a file from the drag and drop handler and send it to
compress_file.""" compress_file."""
print images[0]
self.delegator(images) self.delegator(images)
def file_dialog(self): def file_dialog(self):
@ -110,12 +113,10 @@ class StartQT4(QMainWindow):
"""Send each file in the current file list to compress_file again.""" """Send each file in the current file list to compress_file again."""
newimagelist = [] newimagelist = []
global imagelist
for image in imagelist: for image in imagelist:
newimagelist.append(image[4]) newimagelist.append(image[4])
imagelist = []
for i, image in enumerate(imagelist):
imagelist.remove(image)
self.delegator(newimagelist) self.delegator(newimagelist)
""" """
Compress functions Compress functions
@ -125,7 +126,8 @@ class StartQT4(QMainWindow):
for image in images: for image in images:
if self.checkname(image): if self.checkname(image):
delegatorlist.append((image, QIcon(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) self.thread.compress_file(delegatorlist)
""" """
@ -233,6 +235,7 @@ class Worker(QThread):
for image in self.images: for image in self.images:
#gather old file data #gather old file data
filename = image[0] filename = image[0]
print(filename)
icon = image[1] icon = image[1]
oldfile = QFileInfo(filename) oldfile = QFileInfo(filename)
name = oldfile.fileName() name = oldfile.fileName()
@ -267,7 +270,6 @@ class Worker(QThread):
# append current image to list # append current image to list
for i, image in enumerate(imagelist): for i, image in enumerate(imagelist):
print(image[4], filename)
if image[4] == filename: if image[4] == filename:
imagelist.remove(image) imagelist.remove(image)
imagelist.insert(i, (name, oldfilesizestr, newfilesizestr, ratiostr, imagelist.insert(i, (name, oldfilesizestr, newfilesizestr, ratiostr,
@ -288,7 +290,6 @@ if __name__ == "__main__":
app = QApplication(sys.argv) app = QApplication(sys.argv)
myapp = StartQT4() myapp = StartQT4()
global showapp
if showapp: if showapp:
# no command line options called # no command line options called
myapp.show() myapp.show()

3
ui.py
View file

@ -2,8 +2,7 @@ from PyQt4.QtCore import *
from PyQt4.QtGui import * from PyQt4.QtGui import *
DEBUG = True DEBUG = False
class TrimageTableView(QTableView): class TrimageTableView(QTableView):