本文整理汇总了Python中PyKDE4.kdeui.KApplication.installEventFilter方法的典型用法代码示例。如果您正苦于以下问题:Python KApplication.installEventFilter方法的具体用法?Python KApplication.installEventFilter怎么用?Python KApplication.installEventFilter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PyKDE4.kdeui.KApplication
的用法示例。
在下文中一共展示了KApplication.installEventFilter方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from PyKDE4.kdeui import KApplication [as 别名]
# 或者: from PyKDE4.kdeui.KApplication import installEventFilter [as 别名]
#.........这里部分代码省略.........
def initialise(self, configure):
logging.info("Initialising application")
self.monitor = monitor.FileMonitor(self)
self.configManager = get_config_manager(self)
self.service = service.Service(self)
self.serviceDisabled = False
# Initialise user code dir
if self.configManager.userCodeDir is not None:
sys.path.append(self.configManager.userCodeDir)
try:
self.service.start()
except Exception as e:
logging.exception("Error starting interface: " + str(e))
self.serviceDisabled = True
self.show_error_dialog(i18n("Error starting interface. Keyboard monitoring will be disabled.\n" +
"Check your system/configuration."), str(e))
self.notifier = Notifier(self)
self.configWindow = None
self.monitor.start()
dbus.mainloop.qt.DBusQtMainLoop(set_as_default=True)
self.dbusService = common.AppService(self)
if ConfigManager.SETTINGS[IS_FIRST_RUN] or configure:
ConfigManager.SETTINGS[IS_FIRST_RUN] = False
self.show_configure()
self.handler = CallbackEventHandler()
kbChangeFilter = KeyboardChangeFilter(self.service.mediator.interface)
self.app.installEventFilter(kbChangeFilter)
def init_global_hotkeys(self, configManager):
logging.info("Initialise global hotkeys")
configManager.toggleServiceHotkey.set_closure(self.toggle_service)
configManager.configHotkey.set_closure(self.show_configure_async)
def config_altered(self, persistGlobal):
self.configManager.config_altered(persistGlobal)
self.notifier.build_menu()
def hotkey_created(self, item):
logging.debug("Created hotkey: %r %s", item.modifiers, item.hotKey)
self.service.mediator.interface.grab_hotkey(item)
def hotkey_removed(self, item):
logging.debug("Removed hotkey: %r %s", item.modifiers, item.hotKey)
self.service.mediator.interface.ungrab_hotkey(item)
def path_created_or_modified(self, path):
time.sleep(0.5)
changed = self.configManager.path_created_or_modified(path)
if changed and self.configWindow is not None:
self.configWindow.config_modified()
def path_removed(self, path):
time.sleep(0.5)
changed = self.configManager.path_removed(path)
if changed and self.configWindow is not None:
self.configWindow.config_modified()
def unpause_service(self):
"""