def on_command_line(self, app, args): parser = argparse.ArgumentParser(prog='app') parser.add_argument('-d', '--debug', action='store_true') parser.add_argument('--exit', action='store_true') parser.add_argument('--delay', type=int) if not self.running: # First run self.args = parser.parse_args(args.get_arguments()[1:]) self._log_setup() if self.args.delay: CONFIG.conf.update_interval = self.args.delay logger.debug('first run') else: logger.debug('second run') # Second Run # parse cmdline in a non quitting way self.current_args = \ parser.parse_known_args(args.get_arguments()[1:])[0] if self.current_args.exit: logger.debug('quitting') self.quit() sys.exit(0) if self.args.exit: # kill dnf daemon and quit misc.dbus_dnfsystem('Exit') sys.exit(0) self.activate() return 0
def on_command_line(self, app, args): parser = argparse.ArgumentParser(prog='app') parser.add_argument('-d', '--debug', action='store_true') parser.add_argument('-y', '--yes', action='store_true', help='Answer yes/ok to all questions') parser.add_argument( '--exit', action='store_true', help='tell dnfdaemon dbus services used by yumex to exit') parser.add_argument('-I', '--install', type=str, metavar='PACKAGE', help='Install Package') parser.add_argument('-R', '--remove', type=str, metavar='PACKAGE', help='Remove Package') parser.add_argument('--updateall', action='store_true', help='apply all available updates') if not self.running: # First run self.args = parser.parse_args(args.get_arguments()[1:]) if self.args.exit: # kill dnf daemon and quit misc.dbus_dnfsystem('Exit') sys.exit(0) if self.args.debug: misc.logger_setup(loglvl=logging.DEBUG) else: misc.logger_setup() if self.args.install or self.args.remove or self.args.updateall: self.install_mode = True else: # Second Run # parse cmdline in a non quitting way self.current_args = \ parser.parse_known_args(args.get_arguments()[1:])[0] if self.current_args.exit: if self.window.can_close(): self.quit() else: logger.info("Application is busy") if self.current_args.install or self.current_args.remove or \ self.current_args.updateall: self.install_mode = True self.activate() return 0
def on_command_line(self, app, args): parser = argparse.ArgumentParser(prog='app') parser.add_argument('-d', '--debug', action='store_true') parser.add_argument( '-y', '--yes', action='store_true', help='Answer yes/ok to all questions') parser.add_argument('--exit', action='store_true', help='tell dnfdaemon dbus services used by yumex to exit') parser.add_argument( '-I', '--install', type=str, metavar='PACKAGE', help='Install Package') parser.add_argument( '-R', '--remove', type=str, metavar='PACKAGE', help='Remove Package') parser.add_argument( '--updateall', action='store_true', help='apply all available updates') if not self.running: # First run self.args = parser.parse_args(args.get_arguments()[1:]) if self.args.exit: # kill dnf daemon and quit misc.dbus_dnfsystem('Exit') sys.exit(0) if self.args.debug: misc.logger_setup(loglvl=logging.DEBUG) else: misc.logger_setup() if self.args.install or self.args.remove or self.args.updateall: self.install_mode = True else: # Second Run # parse cmdline in a non quitting way self.current_args = \ parser.parse_known_args(args.get_arguments()[1:])[0] if self.current_args.exit: if self.window.can_close(): self.quit() else: self.logger.info("Application is busy") if self.current_args.install or self.current_args.remove or \ self.current_args.updateall: self.install_mode = True self.activate() return 0
def __cleanup_and_quit(self): # all of UpdateApplication is running in main loop, so this is easy misc.dbus_dnfsystem('Exit') self.__main_loop.quit()