abstract file checking to its own function

This commit is contained in:
Kilian Valkhof 2010-02-02 19:49:37 +01:00
parent 1d2d540455
commit 775d36310c

View file

@ -50,17 +50,20 @@ class StartQT4(QMainWindow):
for image in imagedir: for image in imagedir:
image = directory + "/" + image image = directory + "/" + image
name = QFileInfo(image).fileName() name = QFileInfo(image).fileName()
if name.endsWith("png") or name.endsWith("jpg"): if self.checkname(name):
self.compress_file(image) self.compress_file(image)
def file_from_cmd(self, image): def file_from_cmd(self, image):
self.showapp = False self.showapp = False
if image.endsWith("png") or image.endsWith("jpg"): if self.checkname(name):
self.compress_file(image) self.compress_file(image)
def file_drop(self): def file_drop(self):
print "booya" print "booya"
def checkname(self, filename):
if filename.endsWith("png") or filename.endsWith("jpg"):
return True
def file_dialog(self): def file_dialog(self):
fd = QFileDialog(self) fd = QFileDialog(self)