当前位置: 首页>>代码示例>>Python>>正文


Python MotionEventFactory.get方法代码示例

本文整理汇总了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)
开发者ID:aidanok,项目名称:kivy,代码行数:35,代码来源:probesysfs.py

示例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)
开发者ID:AndiEcker,项目名称:kivy,代码行数:50,代码来源:probesysfs.py


注:本文中的kivy.input.factory.MotionEventFactory.get方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。