def startmain(): """ Initialise the application and display the main window. """ args = parse_arguments() app = QApplication(sys.argv) app.cleanup_files = [] if not args.native_style: app.setStyle(QStyleFactory.create('Fusion')) app.setPalette(QApplication.style().standardPalette()) app_icon = QIcon(':/icons/ui/ot_icon.svg') print(app_icon.isNull(), app_icon.pixmap(200, 200).isNull()) app.setApplicationName(APP_NAME) app.setApplicationVersion(VERSION_STRING) app.setOrganizationName(ORG_NAME) app.setWindowIcon(app_icon) print('AppName: {0:s}'.format(app.applicationName())) print('AppVersion: {0:s}'.format(app.applicationVersion())) print('Company Name: {0:s}'.format(app.organizationName())) QLocale.setDefault(QLocale(QLocale.English, QLocale.UnitedKingdom)) # Add passed arguments to app. app.args = args print('Args:', app.args) # Check to see if application already running. existing_pid = instance_check(app) if existing_pid: print(existing_pid) if app.args.quit_existing: # Command line argument passed to close existing program. Do that, then quit. if platform.system() == "Windows": subprocess.Popen("taskkill /F /T /PID %i" % existing_pid, shell=True) else: os.killpg(existing_pid, signal.SIGKILL) else: message_box_error('Program already running.', 'You can only have one copy of the Bing Wallpaper Changer running at once.') sys.exit() mainwindow = MainWindow() # mainwindow.show() sys.exit(app.exec_())