def __init__(self, parent: QWidget = None): super(AboutAutokeyDialog, self).__init__(parent) self.setupUi(self) icon = ui_common.load_icon(ui_common.AutoKeyIcon.AUTOKEY) pixmap = icon.pixmap(icon.actualSize(QSize(1024, 1024))) self.autokey_icon.setPixmap(pixmap) self.autokey_version_label.setText(autokey.common.VERSION)
def __init__(self, app): logger.debug("Creating system tray icon notifier.") icon = QIcon.fromTheme( cm.ConfigManager.SETTINGS[cm.NOTIFICATION_ICON], ui_common.load_icon(ui_common.AutoKeyIcon.SYSTEM_TRAY) ) super(Notifier, self).__init__(icon) # Actions self.action_hide_icon = None # type: QAction self.action_show_config_window = None # type: QAction self.action_quit = None # type: QAction self.action_enable_monitoring = None # type: QAction self.app = app # type: Application self.config_manager = self.app.configManager self.setContextMenu(QMenu("AutoKey")) self.activated.connect(self.on_activate) self._create_static_actions() self.update_tool_tip(cm.ConfigManager.SETTINGS[cm.SERVICE_RUNNING]) self.app.monitoring_disabled.connect(self.update_tool_tip) self.build_menu() if cm.ConfigManager.SETTINGS[cm.SHOW_TRAY_ICON]: logger.debug("About to show the tray icon.") self.show() logger.info("System tray icon notifier created.")
def __init__(self, parent: QWidget = None): super(AboutAutokeyDialog, self).__init__(parent) self.setupUi(self) icon = ui_common.load_icon(ui_common.AutoKeyIcon.AUTOKEY) pixmap = icon.pixmap(icon.actualSize(QSize(1024, 1024))) self.autokey_icon.setPixmap(pixmap) self.autokey_version_label.setText(autokey.common.VERSION) self.python_version_label.setText(sys.version.replace("\n", " "))
def __init__(self, argv: list = sys.argv): super().__init__(argv) self.handler = CallbackEventHandler() parser = generate_argument_parser() self.args = parser.parse_args() try: self._create_storage_directories() self._configure_root_logger() except Exception as e: logging.exception("Fatal error starting AutoKey: " + str(e)) self.show_error_dialog("Fatal error starting AutoKey.", str(e)) sys.exit(1) logging.info("Initialising application") self.setWindowIcon( QIcon.fromTheme(common.ICON_FILE, ui_common.load_icon( ui_common.AutoKeyIcon.AUTOKEY))) try: # Initialise logger if self._verify_not_running(): self._create_lock_file() self.monitor = monitor.FileMonitor(self) self.configManager = cm.get_config_manager(self) self.service = service.Service(self) self.serviceDisabled = False self._try_start_service() self.notifier = Notifier(self) self.configWindow = ConfigWindow(self) self.monitor.start() # Initialise user code dir if self.configManager.userCodeDir is not None: sys.path.append(self.configManager.userCodeDir) logging.debug("Creating DBus service") self.dbus_service = AppService(self) logging.debug("Service created") self.show_configure_signal.connect(self.show_configure, Qt.QueuedConnection) if cm.ConfigManager.SETTINGS[cm.IS_FIRST_RUN]: cm.ConfigManager.SETTINGS[cm.IS_FIRST_RUN] = False self.args.show_config_window = True if self.args.show_config_window: self.show_configure() self.installEventFilter( KeyboardChangeFilter(self.service.mediator.interface)) except Exception as e: logging.exception("Fatal error starting AutoKey: " + str(e)) self.show_error_dialog("Fatal error starting AutoKey.", str(e)) sys.exit(1) else: sys.exit(self.exec_())
def __init__(self, argv: list=sys.argv): super().__init__(argv) self.handler = CallbackEventHandler() parser = generate_argument_parser() self.args = parser.parse_args() try: self._create_storage_directories() self._configure_root_logger() except Exception as e: logging.exception("Fatal error starting AutoKey: " + str(e)) self.show_error_dialog("Fatal error starting AutoKey.", str(e)) sys.exit(1) logging.info("Initialising application") self.setWindowIcon(QIcon.fromTheme(common.ICON_FILE, ui_common.load_icon(ui_common.AutoKeyIcon.AUTOKEY))) try: # Initialise logger if self._verify_not_running(): self._create_lock_file() self.monitor = monitor.FileMonitor(self) self.configManager = cm.get_config_manager(self) self.service = service.Service(self) self.serviceDisabled = False self._try_start_service() self.notifier = Notifier(self) self.configWindow = ConfigWindow(self) self.monitor.start() # Initialise user code dir if self.configManager.userCodeDir is not None: sys.path.append(self.configManager.userCodeDir) logging.debug("Creating DBus service") self.dbus_service = AppService(self) logging.debug("Service created") self.show_configure_signal.connect(self.show_configure, Qt.QueuedConnection) if cm.ConfigManager.SETTINGS[cm.IS_FIRST_RUN]: cm.ConfigManager.SETTINGS[cm.IS_FIRST_RUN] = False self.args.show_config_window = True if self.args.show_config_window: self.show_configure() self.installEventFilter(KeyboardChangeFilter(self.service.mediator.interface)) except Exception as e: logging.exception("Fatal error starting AutoKey: " + str(e)) self.show_error_dialog("Fatal error starting AutoKey.", str(e)) sys.exit(1) else: sys.exit(self.exec_())
def _load_error_state_icon() -> QIcon: return QIcon.fromTheme( "autokey-status-error", ui_common.load_icon(ui_common.AutoKeyIcon.SYSTEM_TRAY_ERROR) )
def _load_default_icon() -> QIcon: return QIcon.fromTheme( cm.ConfigManager.SETTINGS[cm.NOTIFICATION_ICON], ui_common.load_icon(ui_common.AutoKeyIcon.SYSTEM_TRAY) )
def _load_error_state_icon() -> QIcon: return QIcon.fromTheme( "autokey-status-error", ui_common.load_icon(ui_common.AutoKeyIcon.SYSTEM_TRAY_ERROR))
def _load_default_icon() -> QIcon: return QIcon.fromTheme( cm.ConfigManager.SETTINGS[cm.NOTIFICATION_ICON], ui_common.load_icon(ui_common.AutoKeyIcon.SYSTEM_TRAY))