mirror of
https://github.com/Kilian/Trimage.git
synced 2026-01-26 01:58:41 -05:00
pep8 it
This commit is contained in:
parent
6685635d85
commit
ed52fde42d
1 changed files with 19 additions and 14 deletions
21
trimage.py
21
trimage.py
|
|
@ -7,26 +7,34 @@ from hurry.filesize import *
|
|||
from optparse import OptionParser
|
||||
from ui import Ui_trimage
|
||||
|
||||
|
||||
DEBUG = True
|
||||
|
||||
|
||||
class StartQT4(QMainWindow):
|
||||
|
||||
def __init__(self, parent=None):
|
||||
QWidget.__init__(self, parent)
|
||||
self.ui = Ui_trimage()
|
||||
self.ui.setupUi(self)
|
||||
self.quit_shortcut = QShortcut(QKeySequence("Ctrl+Q"), self); # todo use standardKey Quit.
|
||||
# todo use standardKey Quit.
|
||||
self.quit_shortcut = QShortcut(QKeySequence("Ctrl+Q"), self)
|
||||
# set recompress to false
|
||||
self.ui.recompress.setEnabled(False)
|
||||
self.imagelist = []
|
||||
self.showapp = True
|
||||
|
||||
# connect signals with slots
|
||||
QObject.connect(self.ui.addfiles, SIGNAL("clicked()"), self.file_dialog)
|
||||
QObject.connect(self.ui.recompress, SIGNAL("clicked()"), self.recompress_files)
|
||||
QObject.connect(self.quit_shortcut, SIGNAL("activated()"), qApp, SLOT('quit()'))
|
||||
QObject.connect(self.ui.addfiles, SIGNAL("clicked()"),
|
||||
self.file_dialog)
|
||||
QObject.connect(self.ui.recompress, SIGNAL("clicked()"),
|
||||
self.recompress_files)
|
||||
QObject.connect(self.quit_shortcut, SIGNAL("activated()"),
|
||||
qApp, SLOT('quit()'))
|
||||
|
||||
parser = OptionParser(version="%prog 1.0",
|
||||
description="GUI front-end to compress png and jpg images via optipng and jpegoptim")
|
||||
description="GUI front-end to compress png and jpg images via "
|
||||
"optipng and jpegoptim")
|
||||
|
||||
parser.add_option("-f", "--file",
|
||||
action="store", type="string", dest="filename",
|
||||
|
|
@ -75,11 +83,9 @@ class StartQT4(QMainWindow):
|
|||
if self.checkname(name):
|
||||
self.compress_file(image)
|
||||
|
||||
|
||||
def enable_recompress(self):
|
||||
self.ui.recompress.setEnabled(True)
|
||||
|
||||
|
||||
def recompress_files(self):
|
||||
imagelistcopy = self.imagelist
|
||||
self.imagelist = []
|
||||
|
|
@ -184,4 +190,3 @@ if __name__ == "__main__":
|
|||
else:
|
||||
quit()
|
||||
sys.exit(app.exec_())
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue