mirror of
https://github.com/Kilian/Trimage.git
synced 2026-01-26 10:08:40 -05:00
abstract file checking to its own function
This commit is contained in:
parent
1d2d540455
commit
775d36310c
1 changed files with 5 additions and 2 deletions
|
|
@ -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)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue