From 775d36310cd53ee5a5a2b62871b03e9c871e7cf0 Mon Sep 17 00:00:00 2001 From: Kilian Valkhof Date: Tue, 2 Feb 2010 19:49:37 +0100 Subject: [PATCH] abstract file checking to its own function --- trimage.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/trimage.py b/trimage.py index b9d6ff3..8b054df 100644 --- a/trimage.py +++ b/trimage.py @@ -50,17 +50,20 @@ class StartQT4(QMainWindow): for image in imagedir: image = directory + "/" + image name = QFileInfo(image).fileName() - if name.endsWith("png") or name.endsWith("jpg"): + if self.checkname(name): self.compress_file(image) def file_from_cmd(self, image): self.showapp = False - if image.endsWith("png") or image.endsWith("jpg"): + if self.checkname(name): self.compress_file(image) def file_drop(self): print "booya" + def checkname(self, filename): + if filename.endsWith("png") or filename.endsWith("jpg"): + return True def file_dialog(self): fd = QFileDialog(self)