def do_command_line(self, command_line: Gio.ApplicationCommandLine) -> int: start_app = True options = command_line.get_options_dict() # convert GVariantDict -> GVariant -> dict options = options.end().unpack() exit_value = 0 if _Options.DEBUG.value in options: logging.getLogger().setLevel(logging.DEBUG) for handler in logging.getLogger().handlers: handler.formatter = logging.Formatter(LOG_DEBUG_FORMAT) LOG.debug(f"Option {_Options.DEBUG.value} selected") if _Options.VERSION.value in options: LOG.debug(f"Option {_Options.VERSION.value} selected") print(APP_VERSION) start_app = False if _Options.HIDE_WINDOW.value in options: LOG.debug(f"Option {_Options.HIDE_WINDOW.value} selected") self._start_hidden = True if _Options.AUTOSTART_ON.value in options: LOG.debug(f"Option {_Options.AUTOSTART_ON.value} selected") set_autostart_entry(True) start_app = False if _Options.AUTOSTART_OFF.value in options: LOG.debug(f"Option {_Options.AUTOSTART_OFF.value} selected") set_autostart_entry(True) start_app = False if _Options.CTRL_DISPLAY.value in options: param = options[_Options.CTRL_DISPLAY.value] LOG.debug( f"Option {_Options.CTRL_DISPLAY.value} selected: {param}") self._nvidia_repository.set_ctrl_display(param) if start_app: self.activate() return exit_value
def do_command_line(self, command_line: Gio.ApplicationCommandLine) -> int: Gtk.Application.do_command_line(self, command_line) options = command_line.get_options_dict() if options.contains('quiet'): logging_helpers.set_quiet() if options.contains('separate'): self.profile_separation = True if options.contains('verbose'): logging_helpers.set_verbose() if options.contains('profile'): variant = options.lookup_value('profile') self.profile = variant.get_string() if options.contains('loglevel'): variant = options.lookup_value('loglevel') string = variant.get_string() logging_helpers.set_loglevels(string) if options.contains('config-path'): variant = options.lookup_value('config-path') self.config_path = variant.get_string() self.activate() return 0
def do_command_line(self, command_line: Gio.ApplicationCommandLine) -> int: Gtk.Application.do_command_line(self, command_line) if not command_line.get_is_remote(): self.activate() return 0