def __init__(self): aboutData = KAboutData(APP_NAME, CATALOG, PROGRAM_NAME, VERSION, DESCRIPTION, LICENSE, COPYRIGHT, TEXT, HOMEPAGE, BUG_EMAIL) aboutData.addAuthor(ki18n("GuoCi"), ki18n("Python 3 port maintainer"), "*****@*****.**", "") aboutData.addAuthor(ki18n("Chris Dekter"), ki18n("Developer"), "*****@*****.**", "") aboutData.addAuthor(ki18n("Sam Peterson"), ki18n("Original developer"), "*****@*****.**", "") aboutData.setProgramIconName(common.ICON_FILE) self.aboutData = aboutData KCmdLineArgs.init(sys.argv, aboutData) options = KCmdLineOptions() options.add("l").add("verbose", ki18n("Enable verbose logging")) options.add("c").add("configure", ki18n("Show the configuration window on startup")) KCmdLineArgs.addCmdLineOptions(options) args = KCmdLineArgs.parsedArgs() self.app = KApplication() try: # Create configuration directory if not os.path.exists(CONFIG_DIR): os.makedirs(CONFIG_DIR) # Create data directory (for log file) if not os.path.exists(DATA_DIR): os.makedirs(DATA_DIR) # Create run directory (for lock file) if not os.path.exists(RUN_DIR): os.makedirs(RUN_DIR) # Initialise logger rootLogger = logging.getLogger() rootLogger.setLevel(logging.DEBUG) if args.isSet("verbose"): handler = logging.StreamHandler(sys.stdout) else: handler = logging.handlers.RotatingFileHandler( LOG_FILE, maxBytes=MAX_LOG_SIZE, backupCount=MAX_LOG_COUNT) handler.setLevel(logging.INFO) handler.setFormatter(logging.Formatter(LOG_FORMAT)) rootLogger.addHandler(handler) if self.__verifyNotRunning(): self.__createLockFile() self.initialise(args.isSet("configure")) except Exception as e: self.show_error_dialog( i18n("Fatal error starting AutoKey.\n") + str(e)) logging.exception("Fatal error starting AutoKey: " + str(e)) sys.exit(1)
usage = unicode(i18n("%prog packages_to_install")) parser = OptionParser(usage=usage) packages = filter(lambda x: not x.startswith('-'), sys.argv[1:]) argv = list(set(sys.argv[1:]) - set(packages)) argv.append('--nofork') argv.insert(0, sys.argv[0]) if len(sys.argv) > 1: aboutData.setAppName("pm-install") KCmdLineArgs.init(argv, aboutData) # Add Command Line options options = KCmdLineOptions() options.add("hide-summary", ki18n("Hide summary screen")) KCmdLineArgs.addCmdLineOptions(options) app = KUniqueApplication(True, True) setSystemLocale() args = KCmdLineArgs.parsedArgs() window = PmWindow(app, packages, hide_summary=args.isSet("hide-summary")) window.show() app.exec_() else: