mirror of
https://github.com/Kilian/Trimage.git
synced 2026-01-26 01:58:41 -05:00
don't show the system tray icon if you're using the commandline
This commit is contained in:
parent
cdf9bca4fa
commit
9d25bc738b
1 changed files with 8 additions and 6 deletions
|
|
@ -18,7 +18,7 @@ from multiprocessing import cpu_count
|
||||||
|
|
||||||
from ui import Ui_trimage
|
from ui import Ui_trimage
|
||||||
|
|
||||||
VERSION = "1.0.3"
|
VERSION = "1.0.4"
|
||||||
|
|
||||||
|
|
||||||
class StartQT4(QMainWindow):
|
class StartQT4(QMainWindow):
|
||||||
|
|
@ -28,9 +28,6 @@ class StartQT4(QMainWindow):
|
||||||
self.ui = Ui_trimage()
|
self.ui = Ui_trimage()
|
||||||
self.ui.setupUi(self)
|
self.ui.setupUi(self)
|
||||||
|
|
||||||
if QSystemTrayIcon.isSystemTrayAvailable():
|
|
||||||
self.systemtray = Systray(self)
|
|
||||||
|
|
||||||
self.showapp = True
|
self.showapp = True
|
||||||
self.verbose = True
|
self.verbose = True
|
||||||
self.imagelist = []
|
self.imagelist = []
|
||||||
|
|
@ -75,7 +72,11 @@ class StartQT4(QMainWindow):
|
||||||
# activate command line options
|
# activate command line options
|
||||||
self.commandline_options()
|
self.commandline_options()
|
||||||
|
|
||||||
|
if QSystemTrayIcon.isSystemTrayAvailable() and not self.cli:
|
||||||
|
self.systemtray = Systray(self)
|
||||||
|
|
||||||
def commandline_options(self):
|
def commandline_options(self):
|
||||||
|
self.cli = False
|
||||||
"""Set up the command line options."""
|
"""Set up the command line options."""
|
||||||
parser = OptionParser(version="%prog " + VERSION,
|
parser = OptionParser(version="%prog " + VERSION,
|
||||||
description="GUI front-end to compress png and jpg images via "
|
description="GUI front-end to compress png and jpg images via "
|
||||||
|
|
@ -97,6 +98,7 @@ class StartQT4(QMainWindow):
|
||||||
# make sure we quit after processing finished if using cli
|
# make sure we quit after processing finished if using cli
|
||||||
if options.filename or options.directory:
|
if options.filename or options.directory:
|
||||||
QObject.connect(self.thread, SIGNAL("finished()"), quit)
|
QObject.connect(self.thread, SIGNAL("finished()"), quit)
|
||||||
|
self.cli = True
|
||||||
|
|
||||||
# send to correct function
|
# send to correct function
|
||||||
if options.filename:
|
if options.filename:
|
||||||
|
|
@ -181,7 +183,7 @@ class StartQT4(QMainWindow):
|
||||||
print >> sys.stderr, u"[error] %s not a supported image file" % image.fullpath
|
print >> sys.stderr, u"[error] %s not a supported image file" % image.fullpath
|
||||||
|
|
||||||
self.update_table()
|
self.update_table()
|
||||||
if QSystemTrayIcon.isSystemTrayAvailable():
|
if QSystemTrayIcon.isSystemTrayAvailable() and not self.cli:
|
||||||
self.systemtray.trayIcon.setToolTip("Trimage image compressor (" + str(len(self.imagelist)) + " files)")
|
self.systemtray.trayIcon.setToolTip("Trimage image compressor (" + str(len(self.imagelist)) + " files)")
|
||||||
self.setWindowTitle("Trimage image compressor (" + str(len(self.imagelist)) + " files)")
|
self.setWindowTitle("Trimage image compressor (" + str(len(self.imagelist)) + " files)")
|
||||||
self.thread.compress_file(delegatorlist, self.showapp, self.verbose,
|
self.thread.compress_file(delegatorlist, self.showapp, self.verbose,
|
||||||
|
|
@ -226,7 +228,7 @@ class StartQT4(QMainWindow):
|
||||||
def enable_recompress(self):
|
def enable_recompress(self):
|
||||||
"""Enable the recompress button."""
|
"""Enable the recompress button."""
|
||||||
self.ui.recompress.setEnabled(True)
|
self.ui.recompress.setEnabled(True)
|
||||||
if QSystemTrayIcon.isSystemTrayAvailable():
|
if QSystemTrayIcon.isSystemTrayAvailable() and not self.cli:
|
||||||
self.systemtray.recompress.setEnabled(True)
|
self.systemtray.recompress.setEnabled(True)
|
||||||
|
|
||||||
def checkapps(self):
|
def checkapps(self):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue