From 94613d658d51ca5b56ca5247b5a069336d489886 Mon Sep 17 00:00:00 2001 From: Kilian Valkhof Date: Tue, 2 Feb 2010 20:57:08 +0100 Subject: [PATCH] update checkname function to be better --- todo | 2 +- trimage.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/todo b/todo index fd215da..93c132f 100644 --- a/todo +++ b/todo @@ -28,7 +28,7 @@ todo app wise - implement threading (and include advpng then) - errors need to go to standarderror - test with filenames in spaces (probably works already) - +- test differnt file name cases todo else - figure out dependencies for a .deb/how to make a .deb diff --git a/trimage.py b/trimage.py index d48603a..071c5e8 100644 --- a/trimage.py +++ b/trimage.py @@ -68,7 +68,7 @@ class StartQT4(QMainWindow): print("booya") def checkname(self, filename): - if filename.endsWith("png") or filename.endsWith("jpg"): + if os.path.splitext(filename)[1].lower() in ["jpg", "jpeg", "png"]: return True def file_dialog(self): @@ -76,7 +76,7 @@ class StartQT4(QMainWindow): images = fd.getOpenFileNames(self, "Select one or more image files to compress", "", # directory - "Image files (*.png *.jpg)") + "Image files (*.png *.jpg *.jpeg)") for image in images: if self.checkname(image): self.compress_file(image)