def startup(self): """Do startup.""" if not (self.options.listen or self.options.export): # show the splash screen on normal start self.splash = makeSplashLogo() self.splash.show() # optionally load a translation if self.options.translation: trans = qt4.QTranslator() trans.load(self.options.translation) self.installTranslator(trans) self.thread = ImportThread() self.thread.finished.connect(self.slotStartApplication) self.thread.start()
def __init__(self, options, args): qt4.QObject.__init__(self) self.splash = None if not (options.listen or options.export): # show the splash screen on normal start self.splash = qt4.QSplashScreen(makeSplashLogo()) self.splash.show() self.options = options self.args = args # optionally load a translation if options.translation: trans = qt4.QTranslator() trans.load(options.translation) qt4.qApp.installTranslator(trans) self.thread = ImportThread() self.connect(self.thread, qt4.SIGNAL('finished()'), self.slotStartApplication) self.thread.start()
def slotStartApplication(self): """Start app, after modules imported.""" args = self.args from veusz.utils import vzdbus, vzsamp vzdbus.setup() vzsamp.setup() # add text if we want to display an error after startup startuperrors = [] from veusz import document from veusz import setting # install exception hook after thread has finished global defaultexcepthook defaultexcepthook = sys.excepthook sys.excepthook = excepthook # for people who want to run any old script setting.transient_settings['unsafe_mode'] = bool(args.unsafe_mode) # optionally load a translation txfile = args.translation or setting.settingdb['translation_file'] if txfile: self.trans = qt.QTranslator() if self.trans.load(txfile): self.installTranslator(self.trans) else: startuperrors.append('Error loading translation "%s"' % txfile) # add directories to path if setting.settingdb['external_pythonpath']: sys.path += setting.settingdb['external_pythonpath'].split(':') # load any requested plugins if args.plugin: try: document.Document.loadPlugins(pluginlist=args.plugin) except RuntimeError as e: startuperrors.append(cstr(e)) # different modes if args.listen: # listen to incoming commands listen(args.docs, quiet=args.quiet) elif args.export: export(args.export, args.docs, args.export_option) self.quit() sys.exit(0) else: # standard start main window self.openMainWindow(args.docs) self.startupdone = True # clear splash when startup done if self.splash is not None: self.splash.finish(self.topLevelWidgets()[0]) # this has to be displayed after the main window is created, # otherwise it never gets shown for error in startuperrors: qt.QMessageBox.critical(None, "Veusz", error)