specify global for showapp

This commit is contained in:
Kilian Valkhof 2010-02-05 15:51:11 +01:00
parent e0453ca056
commit 18af1183b7

View file

@ -74,6 +74,7 @@ class StartQT4(QMainWindow):
def dir_from_cmd(self, directory): def dir_from_cmd(self, directory):
"""Read the files in the directory and send all files to """Read the files in the directory and send all files to
compress_file.""" compress_file."""
global showapp
showapp = False showapp = False
imagedir = listdir(directory) imagedir = listdir(directory)
filelist = QStringList() filelist = QStringList()
@ -84,6 +85,7 @@ class StartQT4(QMainWindow):
def file_from_cmd(self, image): def file_from_cmd(self, image):
"""Get the file and send it to compress_file""" """Get the file and send it to compress_file"""
global showapp
showapp = False showapp = False
filecmdlist = QStringList() filecmdlist = QStringList()
filecmdlist.append(image) filecmdlist.append(image)
@ -272,6 +274,7 @@ class Worker(QThread):
filename, icon)) filename, icon))
self.emit(SIGNAL("updateUi")) self.emit(SIGNAL("updateUi"))
global showapp
if showapp != True: if showapp != True:
# we work via the commandline # we work via the commandline
print("File:" + filename + ", Old Size:" + oldfilesizestr + print("File:" + filename + ", Old Size:" + oldfilesizestr +
@ -285,6 +288,7 @@ if __name__ == "__main__":
app = QApplication(sys.argv) app = QApplication(sys.argv)
myapp = StartQT4() myapp = StartQT4()
global showapp
if showapp: if showapp:
# no command line options called # no command line options called
myapp.show() myapp.show()