本文整理汇总了Python中kivy.input.factory.MotionEventFactory.get方法的典型用法代码示例。如果您正苦于以下问题:Python MotionEventFactory.get方法的具体用法?Python MotionEventFactory.get怎么用?Python MotionEventFactory.get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kivy.input.factory.MotionEventFactory
的用法示例。
在下文中一共展示了MotionEventFactory.get方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: probe
# 需要导入模块: from kivy.input.factory import MotionEventFactory [as 别名]
# 或者: from kivy.input.factory.MotionEventFactory import get [as 别名]
def probe(self):
inputs = get_inputs(self.input_path)
inputs = [x for x in inputs if x.has_capability(ABS_MT_POSITION_X)]
for device in inputs:
Logger.info('ProbeSysfs: found device: %s at %s' % (
device.name, device.device))
# must ignore ?
if self.match:
if not match(self.match, device.name, IGNORECASE):
Logger.warning('ProbeSysfs: device not match the'
' rule in config, ignoring.')
continue
d = device.device
devicename = self.device % dict(name=d.split(sep)[-1])
provider = MotionEventFactory.get(self.provider)
if provider is None:
Logger.info('ProbeSysfs: unable to found provider %s' %
self.provider)
Logger.info('ProbeSysfs: fallback on hidinput')
provider = MotionEventFactory.get('hidinput')
if provider is None:
Logger.critical('ProbeSysfs: no input provider found'
' to handle this device !')
continue
instance = provider(devicename, '%s,%s' % (device.device,
','.join(self.args)))
if instance:
from kivy.base import EventLoop
EventLoop.add_input_provider(instance)
示例2: probe
# 需要导入模块: from kivy.input.factory import MotionEventFactory [as 别名]
# 或者: from kivy.input.factory.MotionEventFactory import get [as 别名]
def probe(self):
global EventLoop
from kivy.base import EventLoop
inputs = get_inputs(self.input_path)
Logger.debug('ProbeSysfs: using probesysfs!')
use_mouse = self.should_use_mouse()
if not self.select_all:
inputs = [x for x in inputs if
x.has_capability(ABS_MT_POSITION_X) and
(use_mouse or not x.is_mouse)]
for device in inputs:
Logger.debug('ProbeSysfs: found device: %s at %s' % (
device.name, device.device))
# must ignore ?
if self.match:
if self.use_regex:
if not match(self.match, device.name, IGNORECASE):
Logger.debug('ProbeSysfs: device not match the'
' rule in config, ignoring.')
continue
else:
if self.match not in device.name:
continue
Logger.info('ProbeSysfs: device match: %s' % device.device)
d = device.device
devicename = self.device % dict(name=d.split(sep)[-1])
provider = MotionEventFactory.get(self.provider)
if provider is None:
Logger.info('ProbeSysfs: unable to found provider %s' %
self.provider)
Logger.info('ProbeSysfs: fallback on hidinput')
provider = MotionEventFactory.get('hidinput')
if provider is None:
Logger.critical('ProbeSysfs: no input provider found'
' to handle this device !')
continue
instance = provider(devicename, '%s,%s' % (
device.device, ','.join(self.args)))
if instance:
EventLoop.add_input_provider(instance)