本文整理汇总了Python中cfclient.utils.input.JoystickReader.isRunning方法的典型用法代码示例。如果您正苦于以下问题:Python JoystickReader.isRunning方法的具体用法?Python JoystickReader.isRunning怎么用?Python JoystickReader.isRunning使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cfclient.utils.input.JoystickReader
的用法示例。
在下文中一共展示了JoystickReader.isRunning方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: MainUI
# 需要导入模块: from cfclient.utils.input import JoystickReader [as 别名]
# 或者: from cfclient.utils.input.JoystickReader import isRunning [as 别名]
#.........这里部分代码省略.........
def connectionLost(self, linkURI, msg):
if self.isActiveWindow():
warningCaption = "Communication failure"
error = "Connection lost to %s: %s" % (linkURI, msg)
QMessageBox.critical(self, warningCaption, error)
self.setUIState(UIState.DISCONNECTED, linkURI)
def connectionFailed(self, linkURI, error):
msg = "Failed to connect on %s: %s" % (linkURI, error)
warningCaption = "Communication failure"
QMessageBox.critical(self, warningCaption, msg)
self.setUIState(UIState.DISCONNECTED, linkURI)
def closeEvent(self, event):
self.hide()
self.cf.close_link()
Config().save_file()
def connectButtonClicked(self):
if self.uiState == UIState.CONNECTED:
self.cf.close_link()
elif self.uiState == UIState.CONNECTING:
self.cf.close_link()
self.setUIState(UIState.DISCONNECTED)
else:
self.connectDialogue.show()
def inputDeviceError(self, error):
self.cf.close_link()
QMessageBox.critical(self, "Input device error", error)
def _load_input_data(self):
if self.joystickReader.isRunning():
self.joystickReader.stopInput()
# Populate combo box with available input device configurations
for c in ConfigManager().get_list_of_configs():
node = QAction(c, self._menu_mappings, checkable=True, enabled=False)
node.toggled.connect(self._inputconfig_selected)
self.configGroup.addAction(node)
self._menu_mappings.addAction(node)
self.joystickReader.start()
def _reload_configs(self, newConfigName):
# remove the old actions from the group and the menu
for action in self._menu_mappings.actions():
self.configGroup.removeAction(action)
self._menu_mappings.clear()
# reload the conf files, and populate the menu
self._load_input_data()
self._update_input(self._active_device, newConfigName)
def _update_input(self, device="", config=""):
self.joystickReader.stopInput()
self._active_config = str(config)
self._active_device = str(device)
Config().set("input_device", self._active_device)
Config().get("device_config_mapping")[self._active_device] = self._active_config
self.joystickReader.startInput(self._active_device, self._active_config)
# update the checked state of the menu items
for c in self._menu_mappings.actions():