コード例 #1
1
 def on_touch_up(self, touch):
     self.points += [touch.pos]
     gesture = Gesture()
     gesture.add_stroke(self.points)
     gesture.normalize()
     gdb = GestureDatabase()
     print "Gesture:", gdb.gesture_to_str(gesture)
コード例 #2
1
class GestureBoard(FloatLayout):
    """
    Our application main widget, derived from touchtracer example, use data
    constructed from touches to match symboles loaded from my_gestures.

    """
    def __init__(self, *args, **kwargs):
        super(GestureBoard, self).__init__()
        self.gdb = GestureDatabase()

        # add pre-recorded gestures to database
        self.gdb.add_gesture(cross)
        self.gdb.add_gesture(check)
        self.gdb.add_gesture(circle)
        self.gdb.add_gesture(square)

    def on_touch_down(self, touch):
        # start collecting points in touch.ud
        # create a line to display the points
        userdata = touch.ud
        with self.canvas:
            Color(1, 1, 0)
            d = 30.
            Ellipse(pos=(touch.x - d/2, touch.y - d/2), size=(d, d))
            userdata['line'] = Line(points=(touch.x, touch.y))
        return True

    def on_touch_move(self, touch):
        # store points of the touch movement
        try:
            touch.ud['line'].points += [touch.x, touch.y]
            return True
        except (KeyError), e:
            pass
コード例 #3
0
    def __init__(self, *args, **kwargs):
        super(GestureBoard, self).__init__()
        self.gdb = GestureDatabase()

        # add pre-recorded gestures to database
        self.gdb.add_gesture(cross)
        self.gdb.add_gesture(check)
        self.gdb.add_gesture(circle)
        self.gdb.add_gesture(square)
コード例 #4
0
 def __init__(self, path='./chronos/assets/gestures/'):
     with open(path + 'gestures.json', "r+") as f:
         self.path = path
         self.str_gestures = json.load(f)
         self.db = GestureDatabase()
         for name, gesture_string in self.str_gestures.items():
             gesture = self.db.str_to_gesture(gesture_string)
             gesture.name = name
             self.db.add_gesture(gesture)
コード例 #5
0
ファイル: tab_panel.py プロジェクト: tehpug/RFAttendance
class TabPannel(TabbedPanel):
    def __init__(self, *args, **kwargs):
        super(TabPannel, self).__init__(*args, **kwargs)
        self.app = RfAttendance.get_running_app()

        self.gdb = GestureDatabase()
        self.left_to_right_gesture = self.gdb.str_to_gesture(left_to_right_gesture)
        self.right_to_left_gesture = self.gdb.str_to_gesture(right_to_left_gesture)

        self.gdb.add_gesture(self.left_to_right_gesture)
        self.gdb.add_gesture(self.right_to_left_gesture)

    def on_touch_down(self, touch):
        touch.ud['line'] = Line(points=(touch.x, touch.y))
        return super(TabPannel, self).on_touch_down(touch)

    def on_touch_move(self, touch):
        try:
            touch.ud['line'].points += [touch.x, touch.y]
            return super(TabbedPanel, self).on_touch_move(touch)
        except KeyError:
            pass

    def on_touch_up(self, touch):
        g = Gesture()
        g.add_stroke(list(zip(
            touch.ud['line'].points[::2],
            touch.ud['line'].points[1::2]
        )))
        g.normalize()
        g.name = ''

        g2 = self.gdb.find(g, minscore=0.70)
        if g2 and g2[1] == self.left_to_right_gesture:
            self.switch_to_left()
        elif g2 and g2[1] == self.right_to_left_gesture:
            self.switch_to_right()

        return super(TabPannel, self).on_touch_up(touch)

    def switch_to_right(self):
        current_tab_index = self.tab_list.index(self.current_tab)
        if current_tab_index == 0:
            return

        try:
            self.switch_to(self.tab_list[current_tab_index - 1])
        except IndexError:
            pass

    def switch_to_left(self):
        current_tab_index = self.tab_list.index(self.current_tab)

        try:
            self.switch_to(self.tab_list[current_tab_index + 1])
        except IndexError:
            pass
コード例 #6
0
 def __init__(self, app, **kwargs):  # inicializace pole
     self.app = app
     super(GameMatrix, self).__init__(**kwargs)
     self.coords = []
     self.dpos = (0, 0)
     self.colors = []
     self.shape = None
     self.active_color = [.1372, .1372, .1372, 1]
     self.inactive_color = [.1372, .1372, .1372, 1]
     self.fUpdate = 12 * 22 * "0"
     self.tnetCoords2 = []
     for y in range(51, 73):
         for x in range(51, 63):
             self.tnetCoords2.append(chr(x) + chr(y))
     self.tnetCoords = []
     for x in range(51, 63):
         col = []
         for y in range(51, 73):
             col.append((chr(x), chr(y)))
         self.tnetCoords.append(col)
     self.tnetColors = []
     for c in range(33, 48):
         self.tnetColors.append(chr(c))
     self.move = False
     self.orientation = 0
     self.colored = set()
     self.colors = [
         deepcopy(self.inactive_color), [0, .6, .8, 1],
         [1, .7333333, .2, 1], [.6, .8, 0, 1], [.666666667, .4, .8, 1],
         [1, .266666667, .266666667, 1]
     ]
     self.COORDS_SET = set()
     for y in range(int(self.rows)):
         line = []
         for x in range(int(self.cols)):
             box = Box()
             box.coords = (x, y)
             box.colored = deepcopy(self.inactive_color)
             self.add_widget(box)
             line.append(box)
             self.COORDS_SET.add((x, y))
         self.coords.append(line)
     self.b = 0
     self.startgame = False
     self.seed = randint(0, 0xFFFFFF)
     self.specials = set()
     self.buildNext = False
     self.mLR = False
     self.gdb = GestureDatabase()
     self.GSTR_DROP = \
     self.gdb.str_to_gesture('eNq1l82O2jAQgO9+Ebg08ng8M/YL0GslHqBKIQK0W4iSbHf37WtPIjZS/6Si4WIYez4P+Yyxt5eny4/35tSN08vQuc9L23u3Pfbg9ptr+73buD6Ut6VBN+434zTcnrqxfIxu+9yT2/4WstdhrueKkpLf3y7Xqaalmpb/kPaljnI9zBXUEt5LCgS3803EKCmwT5yJCXKt5q32Yu31HsETZe85AIAQsBu/tX+fJuo05E7zDEEEBDOg17k8ufH0AF2/O4gRPSk929CDCghgRA9KRyO6Wg13qx7viyaUaRLyY3jVGsQKr15DNsKjikWwwqtZRCu8qkUrtahq0Uotqlpc1H7yDaT1jhbKY3sEH1VtBCu8qo1ohVe1kazwqjaKFV7VRiu1pGrJSi2pWvpQG0Ne/9k+SFezREZ0FUtiRFevlG3orFoZjOhqlY2sslplI6usVtnIKqtV/rC6bPDLCSTBQi89HhIjUvQogcWXn+C/4KJSBWzg6lTQBq5Khf4XXm8Hh6HrrvezvnA97Iu47Q4FG+92UUJppl6Sa38N5nUwogaTXwUxpzkI6yAtwbAOQmnWL64jUEdwriNCWtKia+fqz93ldJ7qHYXcrmyxpbtEXy/H6VyDXIqaQ9PtuRva66FejpLUZQg1vDzWr/1wO74cFJRKJQ2Vs4OUK0sMwEF0gTY/AXq8jUg=')
     self.gdb.add_gesture(self.GSTR_DROP)
     self.dropAnimation2 = Animation(colored=self.inactive_color, d=.03)
     self.dropAnimation = Animation(colored=self.inactive_color, d=.1)
     self.spectate = False
コード例 #7
0
ファイル: queueviewscreen.py プロジェクト: Fisk24/k621
    def __init__(self, *args, **kwargs):
        super(QueueViewManager, self).__init__()
        #Initial values
        self.index = 0
        #Create gesture database
        self.gdb = GestureDatabase()

        #Add gestures
        self.gdb.add_gesture(swipe_left)
        self.gdb.add_gesture(swipe_right)
        self.gesture_tolerence = 0.70  # minimum score that a gesture must reach before actions can be triggered
コード例 #8
0
 def __init__(self, config, gestures, el, *args, **kwarg):
     """
     :param config: string containing the path to the action configuration
     :param gestures: string containing the path to the gestures configuration
     """
     super(EventDispatcher, self).__init__(*args, **kwarg)
     self._event_loop = el
     self._gdb = GestureDatabase()
     self._actions = Actions(config, gestures)
     self.update_devices()
     self._multitouches = []
コード例 #9
0
 def __init__(self, **kwargs):  # inicializace
     self.app = kwargs['root']
     self.register_event_type('on_swipe_right')
     self.register_event_type('on_swipe_left')
     super(GestureListener, self).__init__(**kwargs)
     self.gdb = GestureDatabase()
     self.GSTR_SWIPE_LEFT = \
     self.gdb.str_to_gesture('eNqtls2O2jAURvd+EdgU+f7bL0C3lXiAikIEaKYQQabtvH3tC0ITQZtZeJXkU3ycfEdK7vzwcvj1vth1l+Ht3IWvt2Mfw3zbQ1jNjuuf3Sz0WE7LgcJlNbsM59NLdymXHOavvYT5U8jKbwu9VpSV9f3pcBzqslSX5X8s+1bvCj1cn6A+wntZAhiWcRHr9n/qJdVL0pQNjZUIkAzC5cf6/1B2qITdnbe7oRBSxEwSIXJCmkb5a4E9olDEVCBnUGAUsmlWclZuwULvDeGRVSr62BfjNAudRU1YXj1KE5Z3j9aE5d3jQ/dfyikrIEgmzMCRTSZh5OUTtIF5+0RtYF4/SRuY90/WBuYCqI0AdgH8TAAmyBaVc8oCZvkTMBfA1AbmAljawFwAWxuYC+DcBCYuQNoIEBcgbQSIC5BnAjjFmCiJMSOxpemvv7gAsTYwFyC5CUxdgEIbmAtQagNzAdpGgLoAbS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HT)
コード例 #10
0
class Listener(EventDispatcher):
    """
    listener function that queries kivy for touch events, builds the gesture
    and dispatch it through the actions singleton.
    """
    def __init__(self, config, gestures, el, *args, **kwarg):
        """
        :param config: string containing the path to the action configuration
        :param gestures: string containing the path to the gestures configuration
        """
        super(EventDispatcher, self).__init__(*args, **kwarg)
        self._event_loop = el
        self._gdb = GestureDatabase()
        self._actions = Actions(config, gestures)
        self.update_devices()
        self._multitouches = []

    def update_devices(self):
        log.debug('update_devices()')
        context = pyudev.Context()
        for device in context.list_devices(subsystem='input',
                                           ID_INPUT_MOUSE=True):
            if device.sys_name.startswith('event'):
                if 'PRODUCT' in device.parent.keys():
                    self._actions.update_gestures(device.parent['PRODUCT'])
        for gest_n, gest_r in self._actions.get_gestures().iteritems():
            for g in gest_r:
                g = self._gdb.str_to_gesture(g)
                g.normalize()
                g.name = gest_n
                self._gdb.add_gesture(g)

    def on_touch_down(self, touch):
        """
        listening function executed at begining of touch event
        builds the gesture
        """
        self._multitouches.append(touch)
        touch.ud['line'] = Line(points=(touch.sx, touch.sy))
        return True

    def on_touch_move(self, touch):
        """
        listening function executed during touch event
        store points of the gesture
        """
        # store points of the touch movement
        try:
            touch.ud['line'].points += [touch.sx, touch.sy]
            return True
        except (KeyError), e:
            pass
コード例 #11
0
ファイル: listener.py プロジェクト: guyzmo/kitt
class Listener(EventDispatcher):
    """
    listener function that queries kivy for touch events, builds the gesture
    and dispatch it through the actions singleton.
    """
    def __init__(self, config, gestures, el, *args, **kwarg):
        """
        :param config: string containing the path to the action configuration
        :param gestures: string containing the path to the gestures configuration
        """
        super(EventDispatcher, self).__init__(*args, **kwarg)
        self._event_loop = el
        self._gdb = GestureDatabase()
        self._actions = Actions(config, gestures)
        self.update_devices()
        self._multitouches = []

    def update_devices(self):
        log.debug('update_devices()')
        context = pyudev.Context()
        for device in context.list_devices(subsystem='input', ID_INPUT_MOUSE=True):
            if device.sys_name.startswith('event'):
                if 'PRODUCT' in device.parent.keys():
                    self._actions.update_gestures(device.parent['PRODUCT'])
        for gest_n, gest_r in self._actions.get_gestures().iteritems():
            for g in gest_r:
                g = self._gdb.str_to_gesture(g)
                g.normalize()
                g.name = gest_n
                self._gdb.add_gesture(g)

    def on_touch_down(self, touch):
        """
        listening function executed at begining of touch event
        builds the gesture
        """
        self._multitouches.append(touch)
        touch.ud['line'] = Line(points=(touch.sx, touch.sy))
        return True

    def on_touch_move(self, touch):
        """
        listening function executed during touch event
        store points of the gesture
        """
        # store points of the touch movement
        try:
            touch.ud['line'].points += [touch.sx, touch.sy]
            return True
        except (KeyError), e:
            pass
コード例 #12
0
 def __init__(self, *args, **kwargs):
     super().__init__()
     self.gdb = GestureDatabase()
     self.line45 = self.gdb.str_to_gesture(line45_str)
     self.cirlce = self.gdb.str_to_gesture(cirlce_str)
     self.cross = self.gdb.str_to_gesture(cross_str)
     self.line135 = self.line45.rotate(90)
     self.line225 = self.line45.rotate(180)
     self.line315 = self.line45.rotate(270)
     self.gdb.add_gesture(self.line45)
     self.gdb.add_gesture(self.line135)
     self.gdb.add_gesture(self.line225)
     self.gdb.add_gesture(self.line315)
     self.gdb.add_gesture(self.cross)
     self.gdb.add_gesture(self.cirlce)
コード例 #13
0
 def __init__(self, *args, **kwargs):
     super(DrawingCanvas, self).__init__()
     self.gdb = GestureDatabase()
     self.line45 = self.gdb.str_to_gesture(line45_str)
     self.circle = self.gdb.str_to_gesture(circle_str)
     self.cross = self.gdb.str_to_gesture(cross_str)
     self.line135 = self.line45.rotate(90)
     self.line225 = self.line45.rotate(180)
     self.line315 = self.line45.rotate(270)
     self.gdb.add_gesture(self.line45)
     self.gdb.add_gesture(self.line135)
     self.gdb.add_gesture(self.line225)
     self.gdb.add_gesture(self.line315)
     self.gdb.add_gesture(self.circle)
     self.gdb.add_gesture(self.cross)
     self.links = []
コード例 #14
0
ファイル: Screen.py プロジェクト: thica/ORCA-Remote
    def InitVars(self) -> None:
        """ (re) Initialises all vars (also after a definition change) """
        InitSystemVars()
        Globals.oDefinitions.InitVars()
        SetVar(uVarName = u'REPVERSION', oVarValue = ToUnicode(Globals.iVersion))

        # Name of the Current page
        # List for settings dialog
        self.bIntransition              = False
        self.dGestures.clear()
        self.dPopups.clear()
        self.iLastWidgetPage            = 0
        Globals.oActions.InitVars()
        self.oCurrentPage               = None
        self.oFonts.DeInit()
        self.oGdb                       = GestureDatabase()
        self.oPopup                     = None
        self.oScreenPages.DeInit()
        self.uCurrentEffect             = u''
        self.uCurrentEffectDirection    = u''
        self.uCurrentPageName           = u''
        self.uDefaultTransmitterPictureName = u''
        self.uDefaultWaitPictureName    = u''
        self.uDefName                   = u''
        self.uFirstPageName             = u''
        self.uInterFaceToConfig         = u''
        self.uScriptToConfig            = u''
        self.uConfigToConfig            = u''
        self.uSplashText                = u''
        self.iBlockCount                = 0
        self.iBlockAskCount             = 0
        if Globals.oTheScreen:
            Globals.oTheScreen.oSkin.dSkinRedirects.clear()
        gc.collect()
コード例 #15
0
 def on_touch_up(self,touch):
     self.points+=[touch.pos]
     with self.canvas:
         Ellipse(pos=(touch.x-5,touch.y-5),size=(10,10))
     gesture=Gesture()
     gesture.add_stroke(self.points)
     gesture.normalize()
     gdb=GestureDatabase()
コード例 #16
0
    def __init__(self, *args, **kwargs):
        super(GestureBoard, self).__init__()
        self.gdb = GestureDatabase()

        # add pre-recorded gestures to database
        self.gdb.add_gesture(cross)
        self.gdb.add_gesture(check)
        self.gdb.add_gesture(circle)
        self.gdb.add_gesture(square)
コード例 #17
0
class GestureBox(FloatLayout):
    def __init__(self, **kwargs):
        super(Box, self).__init__(**kwargs)
        self.gdb = GestureDatabase()
        top_to_button = self.gdb.str_to_gesture(gesture_string)
        self.gdb.add_gesture(top_to_button)
        self.register_event_type('on_top_to_button')

    def on_touch_down(self, touch):
        super(Box, self).on_touch_down(touch)
        # print('vbar',self.scroll.vbar)
        if self.scroll.vbar[0] > 0.79 and self.collide_point(*touch.pos):
            touch.grab(self)
            touch.ud['data points'] = [(touch.x, touch.y)]

    def on_touch_move(self, touch):
        super(Box, self).on_touch_move(touch)
        if touch.grab_current is self:
            touch.ud['data points'] += [(touch.x, touch.y)]

    def on_touch_up(self, touch):
        super(Box, self).on_touch_up(touch)
        if touch.grab_current is self:
            gesture = Gesture()
            gesture.add_stroke(touch.ud['data points'])
            gesture.normalize()

            match = self.gdb.find(gesture, minscore=0.8)
            if match:
                # print(match[0])
                self.dispatch('on_top_to_button')

            touch.ungrab(self)

    def on_top_to_button(self):
        print('My event happend')

    def add_widget(self, widget):
        if len(self.children) == 0:
            super(Box, self).add_widget(widget)
            self.scroll = widget
        else:
            print("Can't add more than one widget")
コード例 #18
0
ファイル: tab_panel.py プロジェクト: tehpug/RFAttendance
    def __init__(self, *args, **kwargs):
        super(TabPannel, self).__init__(*args, **kwargs)
        self.app = RfAttendance.get_running_app()

        self.gdb = GestureDatabase()
        self.left_to_right_gesture = self.gdb.str_to_gesture(left_to_right_gesture)
        self.right_to_left_gesture = self.gdb.str_to_gesture(right_to_left_gesture)

        self.gdb.add_gesture(self.left_to_right_gesture)
        self.gdb.add_gesture(self.right_to_left_gesture)
コード例 #19
0
ファイル: listener.py プロジェクト: guyzmo/kitt
 def __init__(self, config, gestures, el, *args, **kwarg):
     """
     :param config: string containing the path to the action configuration
     :param gestures: string containing the path to the gestures configuration
     """
     super(EventDispatcher, self).__init__(*args, **kwarg)
     self._event_loop = el
     self._gdb = GestureDatabase()
     self._actions = Actions(config, gestures)
     self.update_devices()
     self._multitouches = []
コード例 #20
0
class GestureListener(Widget):
    def __init__(self, **kwargs):  # inicializace
        self.app = kwargs['root']
        self.register_event_type('on_swipe_right')
        self.register_event_type('on_swipe_left')
        super(GestureListener, self).__init__(**kwargs)
        self.gdb = GestureDatabase()
        self.GSTR_SWIPE_LEFT = \
        self.gdb.str_to_gesture('eNqtls2O2jAURvd+EdgU+f7bL0C3lXiAikIEaKYQQabtvH3tC0ITQZtZeJXkU3ycfEdK7vzwcvj1vth1l+Ht3IWvt2Mfw3zbQ1jNjuuf3S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W5VGVsWtyn1WBYSIxZBztKh8m+5WxRrR3arkNnR1qwqN6G5VqRHdrWojq+pWtZFVdavayKq5VWtk1dyq3WdVY0IDMpn2t7fhLtXkf+H1mLA99/3x96bftO76zcJyBdrFsCIqy8dLwzhYCpuSkK4n5JqAaX4n8pX0FGu60sTjspQYeA/ALs+uDxk4TZFmZeSdNc6CPI0js6CEzfQMnvrD/mmsRx4NK5yPV95UJeP7YTc+1QQrCZpLfQmOp5f+vDlu68krpfqIoYbfVX0ezqfd69axZWjuQKJC3dYgkGp9D3c/Ab86orc=')
        self.gdb.add_gesture(self.GSTR_SWIPE_LEFT)
        self.gdb.add_gesture(self.GSTR_SWIPE_RIGHT)

    def simplegesture(self, name, point_list):
        # Pomocná funkce pro rozpoznávání gesta
        g = Gesture()
        g.add_stroke(point_list)
        g.normalize()
        g.name = name
        return g

    def on_touch_down(self, touch):
        # Při doteku, spustí zaznamenávání
        if self.collide_point(touch.x, touch.y):
            touch.ud["line"] = Line(points=(touch.x, touch.y))
            touch.grab(self)
            print "< grabbed >"

    def on_touch_move(self, touch):
        # Při pohybu prstu, zaznamenává pohyb
        if (touch.grab_current is self):
            touch.ud["line"].points += [touch.x, touch.y]

    def on_touch_up(self, touch):
        # Při zvednutí prstu, porovnává s gestem v databázi
        if (touch.grab_current is self):
            g = self.simplegesture(
                '',
                zip(touch.ud['line'].points[::2],
                    touch.ud['line'].points[1::2]))
            g2 = self.gdb.find(g, minscore=0.80)
            if g2:
                if g2[1] == self.GSTR_SWIPE_LEFT:
                    self.dispatch('on_swipe_left')
                if g2[1] == self.GSTR_SWIPE_RIGHT:
                    self.dispatch('on_swipe_right')
            touch.ungrab(self)

    def on_swipe_left(self, *args):
        # Událost přejetí prstu doleva
        self.app.on_swipe_left()

    def on_swipe_right(self, *args):
        # Událost přejetí prstu doprava
        self.app.on_swipe_right()
コード例 #21
0
ファイル: main.py プロジェクト: leonardocsantoss/kivy-abc
    def __init__(self, *args, **kwargs):
        super(GestureBoard, self).__init__()
        self.gdb = GestureDatabase()

        self.error_sound = SoundLoader.load('error.mp3')
        self.success_sound = SoundLoader.load('success.mp3')

        #Gestures
        for key, ges in gestures.items():
            self.gdb.add_gesture(ges)

        self.sort_letter()
コード例 #22
0
 def __init__(self, **kwargs):   # inicializace
     self.app = kwargs['root']
     self.register_event_type('on_swipe_right')
     self.register_event_type('on_swipe_left')
     super(GestureListener, self).__init__(**kwargs)
     self.gdb = GestureDatabase()
     self.GSTR_SWIPE_LEFT = \
     self.gdb.str_to_gesture('eNqtls2O2jAURvd+EdgU+f7bL0C3lXiAikIEaKYQQabtvH3tC0ITQZtZeJXkU3ycfEdK7vzwcvj1vth1l+Ht3IWvt2Mfw3zbQ1jNjuuf3Sz0WE7LgcJlNbsM59NLdymXHOavvYT5U8jKbwu9VpSV9f3pcBzqslSX5X8s+1bvCj1cn6A+wntZAhiWcRHr9n/qJdVL0pQNjZUIkAzC5cf6/1B2qITdnbe7oRBSxEwSIXJCmkb5a4E9olDEVCBnUGAUsmlWclZuwULvDeGRVSr62BfjNAudRU1YXj1KE5Z3j9aE5d3jQ/dfyikrIEgmzMCRTSZh5OUTtIF5+0RtYF4/SRuY90/WBuYCqI0AdgH8TAAmyBaVc8oCZvkTMBfA1AbmAljawFwAWxuYC+DcBCYuQNoIEBcgbQSIC5BnAjjFmCiJMSOxpemvv7gAsTYwFyC5CUxdgEIbmAtQagNzAdpGgLoAbSNAXYA+E6AEEa38eVWTaflNTLHM+zdowvL6jZqwvH2TT7LqmLc5d93xPrSZ1qnNLMyXlqSsXxLnchh6S2H9GOZrGD+GKXpoNArBQ8mjED1kGIXkIego5BpqHu2exEMbMzWsr6+27w67/VAnUbuPlb8P22FfoxSWEPUaDqfX7rw+buoInLJPGDW+Vfy9P5+2b5sKymUfXmA0SGqmkAG0Dh+Lv5QfIpE=')
     self.GSTR_SWIPE_RIGHT = \
     self.gdb.str_to_gesture('eNq1l82O2jAQgO9+Ebhs5Pm3X4C9VuIBKgoRi3YLEWTb7tvXnmzbjVQKquRcDJOZb4Z8KLKXh+fDt7du31/G13MfHt/XIYblboCwXhw3X/tFGLB8LAuFy3pxGc+n5/5SvnJYvgwSln+FrD0tDFpRVuqH0+E41rJUy/KVsk81KwwwTVBHeCslgGEVuxhZWRNH4KQ55eTz/Kj3KaweYkcZDJMiCwmBhsuXzb+7sHeRsL/eYP+LzQaQsmSIlqLqHXT/6WAT/aHi0VKCyDFlhMyW9A8fwWI0Js7MSJZv45PjcyM8ugGEVnh0PLXCu1mU+/CRAIgSppwVE0q6LRddLlq7Bq4Xc7MG5IIJ2jVwxUTtGrhkaieZXDLdI7n8R9nUVCxnFJUot+lumHIbOrtehkZ0d8vUiO5iWRrR3So3sspulRtZFbcqjayKW5VGVsWtyn1WBYSIxZBztKh8m+5WxRrR3arkNnR1qwqN6G5VqRHdrWojq+pWtZFVdavayKq5VWtk1dyq3WdVY0IDMpn2t7fhLtXkf+H1mLA99/3x96bftO76zcJyBdrFsCIqy8dLwzhYCpuSkK4n5JqAaX4n8pX0FGu60sTjspQYeA/ALs+uDxk4TZFmZeSdNc6CPI0js6CEzfQMnvrD/mmsRx4NK5yPV95UJeP7YTc+1QQrCZpLfQmOp5f+vDlu68krpfqIoYbfVX0ezqfd69axZWjuQKJC3dYgkGp9D3c/Ab86orc=')
     self.gdb.add_gesture(self.GSTR_SWIPE_LEFT)
     self.gdb.add_gesture(self.GSTR_SWIPE_RIGHT)
コード例 #23
0
class GestureManager(object):
    def __init__(self, path='./chronos/assets/gestures/'):
        with open(path + 'gestures.json', "r+") as f:
            self.path = path
            self.str_gestures = json.load(f)
            self.db = GestureDatabase()
            for name, gesture_string in self.str_gestures.items():
                gesture = self.db.str_to_gesture(gesture_string)
                gesture.name = name
                self.db.add_gesture(gesture)

    def add_gesture(self, name, gesture_path):
        gesture = Gesture()
        gesture.add_stroke(gesture_path)
        gesture.normalize()
        if name in self.str_gestures:
            raise ValueError('Cannot overwrite existing gesture in file.')
        gesture.name = name
        self.str_gestures[name] = self.db.gesture_to_str(gesture).decode(
            'utf-8')
        self.db.add_gesture(gesture)

    def save(self, path=None):
        if not path:
            path = self.path
        with open(path + 'gestures.json', "r+") as f:
            f.seek(0)
            json.dump(self.str_gestures, f)
            f.truncate()
コード例 #24
0
def load_gestures():
    gdb = GestureDatabase()
    gdb.add_gesture(cun_1)
    gdb.add_gesture(cun_10)
    print('Loading gestures...')

    return gdb
コード例 #25
0
ファイル: screens.py プロジェクト: AndreMPCosta/CellCount
 def __init__(self, **kwargs):
     super(CurrentSession, self).__init__(**kwargs)
     #self.snack = Snackbar(text="Current session updated", duration=2)
     self.ssm = None
     self.buttons = {}
     self.available_grid_sizes = ['small', 'large']
     self.bind(grid=self.refresh_menu_text, buttons=self.refresh_screen)
     self.working_layout.bind(
         minimum_height=self.working_layout.setter('height'))
     self.menu_items = [{
         'viewclass': 'MDFlatButton',
         'text': 'Show %s grid' % self.grid,
         'on_release': lambda: self.change_grid_size()
     }]
     self.color_manager = ColorManager(md_colors)
     self.clear_anim = Animation(x=self.width,
                                 duration=.5,
                                 transition=animation_type)
     self.bind(width=self.update_anim, size=self.adjust_height)
     self.gdb = GestureDatabase()
     self.gdb.add_gesture(left_to_right)
     Clock.schedule_once(self.my_init)
コード例 #26
0
ファイル: box.py プロジェクト: Smug28/Mobile-TetriNET
 def __init__(self, app, **kwargs):  # inicializace pole
     self.app = app
     super(GameMatrix, self).__init__(**kwargs)
     self.coords = []
     self.dpos = (0,0)
     self.colors = []
     self.shape = None
     self.active_color = [.1372,.1372,.1372,1]
     self.inactive_color = [.1372,.1372,.1372,1]
     self.fUpdate = 12*22*"0"
     self.tnetCoords2 = []
     for y in range(51,73):
         for x in range(51,63):
             self.tnetCoords2.append(chr(x)+chr(y))
     self.tnetCoords = []
     for x in range(51,63):
         col = []
         for y in range(51,73):
             col.append((chr(x), chr(y)))
         self.tnetCoords.append(col)
     self.tnetColors = []
     for c in range(33, 48):
         self.tnetColors.append(chr(c))
     self.move = False
     self.orientation = 0
     self.colored = set()
     self.colors = [deepcopy(self.inactive_color), [0,.6,.8,1], [1,.7333333,.2,1], [.6,.8,0,1], [.666666667,.4,.8,1], [1,.266666667,.266666667,1]]
     self.COORDS_SET = set()
     for y in range(int(self.rows)):
         line = []
         for x in range(int(self.cols)):
             box = Box()
             box.coords = (x, y)
             box.colored = deepcopy(self.inactive_color)
             self.add_widget(box)
             line.append(box)
             self.COORDS_SET.add((x, y))
         self.coords.append(line)
     self.b = 0
     self.startgame = False
     self.seed = randint(0,0xFFFFFF)
     self.specials = set()
     self.buildNext = False
     self.mLR = False
     self.gdb = GestureDatabase()
     self.GSTR_DROP = \
     self.gdb.str_to_gesture('eNq1l82O2jAQgO9+Ebg08ng8M/YL0GslHqBKIQK0W4iSbHf37WtPIjZS/6Si4WIYez4P+Yyxt5eny4/35tSN08vQuc9L23u3Pfbg9ptr+73buD6Ut6VBN+434zTcnrqxfIxu+9yT2/4WstdhrueKkpLf3y7Xqaalmpb/kPaljnI9zBXUEt5LCgS3803EKCmwT5yJCXKt5q32Yu31HsETZe85AIAQsBu/tX+fJuo05E7zDEEEBDOg17k8ufH0AF2/O4gRPSk929CDCghgRA9KRyO6Wg13qx7viyaUaRLyY3jVGsQKr15DNsKjikWwwqtZRCu8qkUrtahq0Uotqlpc1H7yDaT1jhbKY3sEH1VtBCu8qo1ohVe1kazwqjaKFV7VRiu1pGrJSi2pWvpQG0Ne/9k+SFezREZ0FUtiRFevlG3orFoZjOhqlY2sslplI6usVtnIKqtV/rC6bPDLCSTBQi89HhIjUvQogcWXn+C/4KJSBWzg6lTQBq5Khf4XXm8Hh6HrrvezvnA97Iu47Q4FG+92UUJppl6Sa38N5nUwogaTXwUxpzkI6yAtwbAOQmnWL64jUEdwriNCWtKia+fqz93ldJ7qHYXcrmyxpbtEXy/H6VyDXIqaQ9PtuRva66FejpLUZQg1vDzWr/1wO74cFJRKJQ2Vs4OUK0sMwEF0gTY/AXq8jUg=')
     self.gdb.add_gesture(self.GSTR_DROP)
     self.dropAnimation2 = Animation(colored=self.inactive_color, d=.03)
     self.dropAnimation = Animation(colored=self.inactive_color, d=.1)
     self.spectate = False
コード例 #27
0
class GestureListener(Widget):
    def __init__(self, **kwargs):   # inicializace
        self.app = kwargs['root']
        self.register_event_type('on_swipe_right')
        self.register_event_type('on_swipe_left')
        super(GestureListener, self).__init__(**kwargs)
        self.gdb = GestureDatabase()
        self.GSTR_SWIPE_LEFT = \
        self.gdb.str_to_gesture('eNqtls2O2jAURvd+EdgU+f7bL0C3lXiAikIEaKYQQabtvH3tC0ITQZtZeJXkU3ycfEdK7vzwcvj1vth1l+Ht3IWvt2Mfw3zbQ1jNjuuf3Sz0WE7LgcJlNbsM59NLdymXHOavvYT5U8jKbwu9VpSV9f3pcBzqslSX5X8s+1bvCj1cn6A+wntZAhiWcRHr9n/qJdVL0pQNjZUIkAzC5cf6/1B2qITdnbe7oRBSxEwSIXJCmkb5a4E9olDEVCBnUGAUsmlWclZuwULvDeGRVSr62BfjNAudRU1YXj1KE5Z3j9aE5d3jQ/dfyikrIEgmzMCRTSZh5OUTtIF5+0RtYF4/SRuY90/WBuYCqI0AdgH8TAAmyBaVc8oCZvkTMBfA1AbmAljawFwAWxuYC+DcBCYuQNoIEBcgbQSIC5BnAjjFmCiJMSOxpemvv7gAsTYwFyC5CUxdgEIbmAtQagNzAdpGgLoAbSNAXYA+E6AEEa38eVWTaflNTLHM+zdowvL6jZqwvH2TT7LqmLc5d93xPrSZ1qnNLMyXlqSsXxLnchh6S2H9GOZrGD+GKXpoNArBQ8mjED1kGIXkIego5BpqHu2exEMbMzWsr6+27w67/VAnUbuPlb8P22FfoxSWEPUaDqfX7rw+buoInLJPGDW+Vfy9P5+2b5sKymUfXmA0SGqmkAG0Dh+Lv5QfIpE=')
        self.GSTR_SWIPE_RIGHT = \
        self.gdb.str_to_gesture('eNq1l82O2jAQgO9+Ebhs5Pm3X4C9VuIBKgoRi3YLEWTb7tvXnmzbjVQKquRcDJOZb4Z8KLKXh+fDt7du31/G13MfHt/XIYblboCwXhw3X/tFGLB8LAuFy3pxGc+n5/5SvnJYvgwSln+FrD0tDFpRVuqH0+E41rJUy/KVsk81KwwwTVBHeCslgGEVuxhZWRNH4KQ55eTz/Kj3KaweYkcZDJMiCwmBhsuXzb+7sHeRsL/eYP+LzQaQsmSIlqLqHXT/6WAT/aHi0VKCyDFlhMyW9A8fwWI0Js7MSJZv45PjcyM8ugGEVnh0PLXCu1mU+/CRAIgSppwVE0q6LRddLlq7Bq4Xc7MG5IIJ2jVwxUTtGrhkaieZXDLdI7n8R9nUVCxnFJUot+lumHIbOrtehkZ0d8vUiO5iWRrR3So3sspulRtZFbcqjayKW5VGVsWtyn1WBYSIxZBztKh8m+5WxRrR3arkNnR1qwqN6G5VqRHdrWojq+pWtZFVdavayKq5VWtk1dyq3WdVY0IDMpn2t7fhLtXkf+H1mLA99/3x96bftO76zcJyBdrFsCIqy8dLwzhYCpuSkK4n5JqAaX4n8pX0FGu60sTjspQYeA/ALs+uDxk4TZFmZeSdNc6CPI0js6CEzfQMnvrD/mmsRx4NK5yPV95UJeP7YTc+1QQrCZpLfQmOp5f+vDlu68krpfqIoYbfVX0ezqfd69axZWjuQKJC3dYgkGp9D3c/Ab86orc=')
        self.gdb.add_gesture(self.GSTR_SWIPE_LEFT)
        self.gdb.add_gesture(self.GSTR_SWIPE_RIGHT)
        
    def simplegesture(self, name, point_list):
        # Pomocná funkce pro rozpoznávání gesta
        g = Gesture()
        g.add_stroke(point_list)
        g.normalize()
        g.name = name
        return g
        
    def on_touch_down(self, touch):
        # Při doteku, spustí zaznamenávání
        if self.collide_point(touch.x, touch.y):
            touch.ud["line"] = Line(points=(touch.x, touch.y))
            touch.grab(self)
            print "< grabbed >"
            
    def on_touch_move(self, touch):
        # Při pohybu prstu, zaznamenává pohyb
        if (touch.grab_current is self):
            touch.ud["line"].points += [touch.x, touch.y]
    
    def on_touch_up(self, touch):
        # Při zvednutí prstu, porovnává s gestem v databázi
        if (touch.grab_current is self):
            g = self.simplegesture('', zip(touch.ud['line'].points[::2], touch.ud['line'].points[1::2]))
            g2 = self.gdb.find(g, minscore=0.80)
            if g2:
                if g2[1] == self.GSTR_SWIPE_LEFT:
                    self.dispatch('on_swipe_left')
                if g2[1] == self.GSTR_SWIPE_RIGHT:
                    self.dispatch('on_swipe_right')
            touch.ungrab(self)
    
    def on_swipe_left(self, *args):
        # Událost přejetí prstu doleva
        self.app.on_swipe_left()
    
    def on_swipe_right(self, *args):
        # Událost přejetí prstu doprava
        self.app.on_swipe_right()
コード例 #28
0
class cGestureBoard(cTouchRectangle):
    """ base class for recording gestures """
    def __init__(self, **kwargs):
        super(cGestureBoard, self).__init__(**kwargs)
        self.gdb = GestureDatabase()

    def on_touch_down(self, touch):

        #self.DrawStandardGestures()
        # start collecting points in touch.ud
        # create a line to display the points

        if not self.collide_point(touch.x, touch.y):
            return False
        touch.grab(self)

        userdata = touch.ud
        with self.canvas:
            Color(1, 1, 0)
            d = 10.
            Ellipse(pos=(touch.x - d/2, touch.y - d/2), size=(d, d))
            userdata['line'] = Line(points=(touch.x, touch.y))
        return True

    def on_touch_move(self, touch):

        if touch.grab_current is not self:
            return

        # store points of the touch movement
        try:
            touch.ud['line'].points += [touch.x, touch.y]
            return True
        except KeyError:
            pass
        return True

    def on_touch_up(self, touch):

        if touch.grab_current is not self:
            return

        g = simplegesture('',zip(touch.ud['line'].points[::2], touch.ud['line'].points[1::2]))
        # print "gesture representation:", ':',self.gdb.gesture_to_str(g)
        uLogName=Globals.oFnGestureLog.string

        oLogFile = open(uLogName, 'a')
        oLogFile.write('Gesturecode:'+self.gdb.gesture_to_str(g)+'\n')
        oLogFile.close()
        return True
コード例 #29
0
ファイル: GestureBoard.py プロジェクト: thica/ORCA-Remote
class cGestureBoard(cTouchRectangle):
    ''' base class for recording gestures '''
    def __init__(self, **kwargs):
        super(cGestureBoard, self).__init__(**kwargs)
        self.gdb = GestureDatabase()

    def on_touch_down(self, touch):

        #self.DrawStandardGestures()
        # start collecting points in touch.ud
        # create a line to display the points

        if not self.collide_point(touch.x, touch.y):
            return False
        touch.grab(self)

        userdata = touch.ud
        with self.canvas:
            Color(1, 1, 0)
            d = 10.
            Ellipse(pos=(touch.x - d/2, touch.y - d/2), size=(d, d))
            userdata['line'] = Line(points=(touch.x, touch.y))
        return True

    def on_touch_move(self, touch):

        if touch.grab_current is not self:
            return

        # store points of the touch movement
        try:
            touch.ud['line'].points += [touch.x, touch.y]
            return True
        except KeyError:
            pass
        return True

    def on_touch_up(self, touch):

        if touch.grab_current is not self:
            return

        g = simplegesture('',zip(touch.ud['line'].points[::2], touch.ud['line'].points[1::2]))
        # print "gesture representation:", ':',self.gdb.gesture_to_str(g)
        uLogName=oORCA.uGestureLogName

        oLogFile = open(uLogName, 'a')
        oLogFile.write('Gesturecode:'+self.gdb.gesture_to_str(g)+'\n')
        oLogFile.close()
        return True
コード例 #30
0
ファイル: e9.py プロジェクト: MancaManca/Kivy
class GestureBoard(Widget):

    def __init__(self, *args, **kwargs):
        super(GestureBoard, self).__init__()
        self.gdb = GestureDatabase()
        self.gdb.add_gesture(check)

    def on_touch_down(self, touch):
        userdata = touch.ud
        with self.canvas:
            Color(1, 1, 0)
            d = 30.0
            Ellipse(pos=(touch.x - d/2, touch.y - d/2), size=(d, d))userdata['line'] = Line(points=(touch.x, touch.y))
        return True

    def on_touch_move(self, touch):
        try:
            touch.ud['line'].points += [touch.x, touch.y]
            return True
        except (KeyError) as e:
            pass

    def on_touch_up(self, touch):
        g = simplegesture('',list(zip(touch.ud['line'].points[::2],touch.ud['line'].points[1::2])))
コード例 #31
0
 def __init__(self, *args, **kwargs):
     super(DrawingSpace, self).__init__()
     self.gdb = GestureDatabase()
     self.line45 = self.gdb.str_to_gesture(line45_str)
     self.circle = self.gdb.str_to_gesture(circle_str)
     self.cross = self.gdb.str_to_gesture(cross_str)
     self.line135 = self.line45.rotate(90)
     self.line225 = self.line45.rotate(180)
     self.line315 = self.line45.rotate(270)
     self.gdb.add_gesture(self.line45)
     self.gdb.add_gesture(self.line135)
     self.gdb.add_gesture(self.line225)
     self.gdb.add_gesture(self.line315)
     self.gdb.add_gesture(self.circle)
     self.gdb.add_gesture(self.cross)
コード例 #32
0
ファイル: appview.py プロジェクト: triselectif/Rongo-Rongo
    def __init__(self, **kwargs):
        super(AppView, self).__init__(**kwargs)          
 
        #internal variables
        self.touches2 = {}
        self.last_touch_id = -1
        #self.translation_allowed = False
        self.gesture_found = False
        self.position_left = True
        self.anim = False #currently animated

        self.set_texture('style/bar/slider-fond.png') 
        
        #add gestures
        self.gdb = GestureDatabase()
        self.create_gesture( [(0,0),(10,0)] )
        self.create_gesture( [(0,0),(-10,0)] )        
コード例 #33
0
from kivy.gesture import Gesture, GestureDatabase

# Create a gesture
g = Gesture()
g.add_stroke(point_list=[(1, 1), (3, 4), (2, 1)])
g.normalize()
g.name = "triangle"

# Add it to database
gdb = GestureDatabase()
gdb.add_gesture(g)

# And for the next gesture, try to find a match!
g2 = Gesture()
g2.add_stroke(point_list=[(1, 1), (3, 4), (2, 1)])
g2.normalize()
print gdb.find(g2).name  # will print "triangle"

コード例 #34
0
ファイル: e9.py プロジェクト: MancaManca/Kivy
from kivy.app import App

from kivy.uix.widget import Widget
from kivy.uix.button import Button
from kivy.graphics import Color, Ellipse, Line
from kivy.gesture import Gesture, GestureDatabase

gdb = GestureDatabase()

check =\ gdb.str_to_gesture('eNq1l0tuI0cMhvd9EXsTofgmL6BsA/gAgcYWb\GMmtmBpksztwyY1kgZI0rNpbdr+u+pjkX+9+v718+uf3zbP++Pp68d++v\X8PIzp/ukA08Pd2+6P/d10wPwzHzQdH+6Op4/3z/tj/svT/ZeDTPf/Cnm\oZtNBZ5Rl/8P769tp7uZzt/iPbr/NraYD9AjmIXzLLoDTdmxgBLsSMMIw\5OHzcP6eX9O0/WVsCMFGmCuaGgjBdPy0+/8wXGFkeu4Ig7LzgISbMw/j6\fh8hmMMBDIkdBYPimV4pQ7W8EQMUA4LMhMzCyW5watKgJoOHhxsuIz3ws\cVb8ExhpIxDoIgvcEzhoaiZ1geA20Rj+UAwlp4LDxd8OkqO4KHYXLI4oY\OwEai4oPRmHiZXr6iXOiY9mXBFUNYacAVDm4uIOCiaXws24plK9oq7PIU\r56iOqsyg+acyOrezJicpTCI3YYy5HtapFNZSldLCcRgCCk4hqniDZ2dH\ZjCMf1EXh47laNEN2MfEjkzJFgtK3BLHwEAGTcnlSu7LNPLUbo6+n2m5G\bAuVzUr/ShYQzoSBSWi5iXJwyVqWRr4ctX+om1mq+GR7ibAA8dJuHLfC5\nGVbjl7dMS/tk1g3tB3OXZyWXsyyrsMtWtlXY5SnHGmwpPwW+s3M15h5C\kVvM8FyWcWH3Uce5io00A/8Eu7wUWoVdXoqswi4v5eIlseTWl6e9Cqh6+\IUt6OoUwAJD88KwjC4rJVZAazmpsAa6jFRaA10+qqyBLht1DRu1bNQ1bL\Sy0S425mWFOc9khtxcnRwuaEW6PZnH8sFp5aPRKuwy0i5GMnsmHJE32dz\73a5oG3nJgLyemqDgXKtPu/m2//ix379d7u6m8+XdbLrf5jg2Y9picD5O\B/NpN4vQIrYYLWKJHiX6aJFblBahRSvRvEUsETuQjRapxe6uHSjPsBK7u\0CL0mKUyLKJ25/NLbRaUI+PzwGsRdHnVUzsftj7JFdK\7cAUSrW3SugrdpReeqdluV6Fxdu6hdv6hcCeYabQl7KFG5ElWpiM6itqg\tWovWorXYlU6/d234y/71+eWUVud1dRvz2xT/en06vcwfWiP7QFU51dP7\l/3H7u1xX2+gP9F+/MHc7jw1fz98vD99fTxV65yN6YfP81jE8nDMa8j81\bD5B2R9zCo=')

def simplegesture(name, point_list):
    g = Gesture()
    g.add_stroke(point_list)
    g.normalize()
    g.name = name
    return g

class GestureBoard(Widget):

    def __init__(self, *args, **kwargs):
        super(GestureBoard, self).__init__()
        self.gdb = GestureDatabase()
        self.gdb.add_gesture(check)

    def on_touch_down(self, touch):
        userdata = touch.ud
        with self.canvas:
            Color(1, 1, 0)
            d = 30.0
            Ellipse(pos=(touch.x - d/2, touch.y - d/2), size=(d, d))userdata['line'] = Line(points=(touch.x, touch.y))
コード例 #35
0
ファイル: glock.py プロジェクト: istvanzk/WStation
from kivy.gesture import GestureDatabase

gdb = GestureDatabase()

check = gdb.str_to_gesture(
    b'eNp91ntck1UYB/AhIgqVpGZYWWheIC9R2cW09qbZq+aFMmtq4BxOBijsjK1EPbgxLiopVF7QTMlbWpqYd9MgwxuakpqRmq0yxa4YpGZ2ed7jefbZ591j+wPZl998z3nOc86ZOzQ5PfWV7J4p1iyny2GNUOW/zBDnYSGcNYk1hRkMhldTxzttLFRVppoN2svUDH7YrKkpNidrqipphuvaEn7I/2ms3ZE53pXsZGGq0rIF6zAmZbQpHP6c5XRkpluzWLNEFk4+eoQIRLDmMIAWnEXEimfZM1MznFksMpHdFEt+LEELRLCb4VO3cNYy1hQCn5rMolTj5seGVSRPMgjIZreqFYc3WBrKz5hdFpuWbsVZ61gb5Fwli7M7XjTYghJtOLtNS1Rs3DB1assOJcGJtpzdLhIHIkNmRXvrgxPRnLX7/8QdnN0pEoeHLjtZWRsdnLiLs/YicezY0dKyLae1xBE1tF30+UqZuJuze0Tiy7LkoqqGFcGJGM46iMTp0l4HtvfvFJzoyNm9InFm1G29L46ND0504qyzSJya2JhzId6uJaoXhfxSu7hOJrpw1lUkvmqbdWFQZHMt8el8d/cr3bfJRCxncSJxwnWv0uhr1BJbr+6cPXaCIhP3cdZNJI5v6lezs+qslli/4I/QxL04ju6c9RCJo4m7+9y1dJqWKPTsGFm/ziATPTm7XyRqwp9aOW1KG0gYV/UozQibVyYT8Zw9IBKfdbQU1++xaYmtvxdPaigtkYkHOXtIJKqSDEm1vWO0xCd9LoQvi5ksE704e1gktiVNWzV8olYP4566Hx/8Lh3n8ghnj4rEmjENzkRLpZbYb0zbn1uyWiYe46y3SHgGbNtbP9CtJQ52K/LOqrDJxOOc9RF9unJCdN/OM81a4tDP6Q27T9lloi9nT4jErpSog61/03rMWD3vp6SOW6Jk4knOjCKxZ2tElzSbt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k4B4TXixIKcoPA1Yrj8Av6bwDGCFnKb/UP2GQh9gjVw4/5H+LYXfAfr0h//3FJ4FrNdfKD9QeE5VZsfor7PzFNYB+q9yLPIFCn8EtOsv6J8o/BkQN2wuts0vFP4KiNdELg7pNwrrAXGaHrz0L1L4u6rMwWvCgw9qoLAR0CyXw4Mb9g8KLwEWyyV24zQvU3gFsFL/Ze9PCq8C+r8WKnIj/EXhNUCfHJL/q+bfFP4DiAWZjgv3L4EOQ4j2thh393Q5fkfIDbyJzuWOcITewJte9yi9h93Am+lc9rwj/AbeHNzqsowztYC3zsyJVse4jGSro4UWN25fqL0WmZrC3zLGTbI6IoBNoVrSke2IhDcuS8//AL61zRc='
)
コード例 #36
0
#!/usr/bin/env python
from kivy.gesture import GestureDatabase

gdb = GestureDatabase()

square1 = \
gdb.str_to_gesture('eNqlW9uSHLcNfZ8fsV6yRQIgQP6A8poqfUBKsbdklR1pS1on8d8HTaB3GztEzyTaKtdqz5wGiXN4A3v87vNvn//158Onx+/Pf3x7vPzVfz+Vy7tfnurlw09fPv7z8afLE+g/9Rdevn/46fvzt6+/PX7XP+ny7vendnm3DPJh0i5PvIUSff7p6+cvz9tjfXtsJI/9bWNdnqr1YOvCn/pIhcv78kAgYwCOytQHDKKtO//ZPsbL+79sn1NvDLUCANYBl+//+HjeCs1W2uVT2sAnj61/NaEGtfRKQvV27Jl4lXtiFyzQABoW7sB4R8f7DD7uCF5GQdIP+uAuo5d+MzhM7aHeCq6xoXXqpVKFIQMJb8eGGRtvx67YSlEEpYg2U+/o93QT2u3Y0Eigqt6NmeodesM0E+R2aA3ZERVjAGn1jtDTShi3QxMDsQgC4eAGLDdj43QSX5xUSRsIq6yVm46K9hK7lQ4E2AsCD7kn9DQSX4yEVgdyachQtIVDt1utwtqylC4Nx7gdevqILz5WlbONMQQ6bNnDD4SePuKLj6WORjo3RHNvIkzyA7GnkehGbjOvQ5MyetcZrZK0/v+rTdNIqi+xa+9QSEYlGrxJfoj9P45tmk4SvsTG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FdKbrXA6+UMnXSK2pniRq1sGaVa+Ras9rPEQHF6cCyorR3MlopdgTTKKJ1rn4wW1E7aOVXAdlxylbBFbUTVBuf+6+2rDmqb20sc3pzrlopJgHlA4rp8WrMWRtrf06oSfBqdFmzagvGhJoEIAev9qM7bFDUKSZO0nmFQGtJbRleUetCqcq8xqA1nlTT7uKE1nhSkQOK31wcebF7DOWFYq+3i4xcI5qnm5YV9Tscjajf20hE63RndEWtbyRJEYXpBmpF/W4rvk3m+6wV9TusGIM1hMQxY2sI/c5sRS03fhWv5cYQ0Trdy11RawivKDg63+Ft7muYMVB8XGQKKDnKAfXNIsuMbu3omHOg5I2dIGugLGmVgMKW71mPpSVBTQHd6GVQIVA8R8WAeo4660F90XyTgHKgeAIqAV3czXqQt/qoGlDYesmsx9KcogYJvJHFEiTwEwmGa12bIR0NWbOPghKyZtwIqISsydeuErImz6+ErGkrvxIkwLxRthIkWMZ/CRKg61yDBLA1CmrQw9tKrEGP5HrUoIf3uVhnCZaDFtZZAiwuTM0BXcKcs15OfljnRJdTItYaUIuX0pwoysb4pBTu84X9wTnRfrJ9c/ilRIEi/mDImpc4Qta0caanFCSgJY4gAYGjQQLfGSkFCfz8TxAk8FttgvgtxsZlHkGQYOsegiBI4IskQZAAPBMIEvjSSRCyBtyKo0lgXwv9uH/4/uOl/wtY6/O2Qmqc/zx8e/kxKLUL1pe9hr78+uP+6cvPr/3fyNosGN9qd9y/wvrH49Ovb39+Ha5bA/ip3Gk7ZuWcSGtpJ9/+pfTd/wDNLeDK')

squares=[square1,square2,square3,square4,square5,square6,square7,square8]
コード例 #37
0
ファイル: queueviewscreen.py プロジェクト: Fisk24/k621
class QueueViewManager(ScreenManager):
    origin = ObjectProperty()
    manager = ObjectProperty()
    #screens = ListProperty([])
    index = NumericProperty()
    loop = BooleanProperty(False)

    def __init__(self, *args, **kwargs):
        super(QueueViewManager, self).__init__()
        #Initial values
        self.index = 0
        #Create gesture database
        self.gdb = GestureDatabase()

        #Add gestures
        self.gdb.add_gesture(swipe_left)
        self.gdb.add_gesture(swipe_right)
        self.gesture_tolerence = 0.70  # minimum score that a gesture must reach before actions can be triggered

    def getScreenNameByIndex(self, index):
        return str(self.screens[index].name)

    '''
	def getNext(self):
		nextIndex = self.index + 1
		if (self.loop == False):
			# if nextIndex would fall outside the scope of the screens list return None
			if nextIndex > (len(self.screens)-1):
				return None
			# otherwise return the widget associated with nextIndex
			else:
				return self.screens[nextIndex]
		else:
			# if loop is True return the widget no matter what
			if nextIndex > (len(self.screens)-1):
				nextIndex = nextIndex - (len(self.screens)-1)
			return self.screens[nextIndex]
	
	def getPrev(self):
		prevIndex = self.index - 1
		if (self.loop == False) and (prevIndex < 0):
			return None
		else:
			return self.screens[prevIndex]
		
	next    = AliasProperty(getNext, bind=['index'])
	prev    = AliasProperty(getPrev, bind=['index'])
	'''

    def isGesture(self, question, gesture):
        if question.get_score(gesture) > self.gesture_tolerence:
            return True
        else:
            return False

    def on_touch_down(self, touch):
        # create the 'line' key in the touch object, this data is made available
        # to all other functions that recive this touch object
        touch.ud['line'] = Line(points=(touch.x, touch.y))
        super(QueueViewManager, self).on_touch_down(touch)

    def on_touch_move(self, touch):
        # append the newist coordinate data to the point list of the line
        try:
            touch.ud['line'].points += (touch.x, touch.y)
            return True
        except KeyError:
            pass
        super(QueueViewManager, self).on_touch_move(touch)

    def on_touch_up(self, touch):
        try:
            g = simplegesture(
                '',
                list(
                    zip(touch.ud['line'].points[::2],
                        touch.ud['line'].points[1::2])))
            Logger.info('Swipe Left: {}'.format(g.get_score(swipe_left)))
            Logger.info('Swipe Right: {}'.format(g.get_score(swipe_right)))
            if self.isGesture(g, swipe_left):
                Logger.info("Gesture: gesture is a left swipe")
                self.gotoScreenRight()
                # A left swipe should goto the right hand
                # screen, because the act of dragging
                # somthing to the left exposes the right
                # hand side of the object and vice versa.

            if self.isGesture(g, swipe_right):
                Logger.info("Gesture: gesture is a right swipe")
                self.gotoScreenLeft()
        except KeyError:
            pass

        super(QueueViewManager, self).on_touch_up(touch)

    def on_index(self, widget, index):
        Logger.info('QueueViewManager: next: {}'.format(self.next))
        Logger.info("QueueViewManager: index: {}".format(index))
        Logger.info('QueueViewManager: prev: {}'.format(self.prev))
        self.current = self.getScreenNameByIndex(index)

    def gotoScreenLeft(self):
        # only attempt to change the index if self.screens is not empty
        self.transition.direction = 'right'
        '''
		if self.screens != []:
			self.index -= 1
		'''
        self.current = self.previous()

    def gotoScreenRight(self):
        # only attempt to change the index if self.screens is not empty
        self.transition.direction = 'left'
        '''
		if self.screens != []:
			self.index += 1
		'''
        self.current = self.next()

    def addPostViewScreen(self, post):
        newName = str(post['id'])
        if not newName in self.screen_names:
            Logger.info(
                "QueueViewManager: I added post {id} by {artist}".format(
                    id=post['id'], artist=post['artist']))
            widget = PostView(origin=self.origin,
                              coordinator=self.manager,
                              name=newName)
            self.add_widget(widget)
            widget.metadata = post
            Logger.info(widget.name)
            #self.screens.append(widget)
            #widget.bind(origin=self.origin)
        else:
            Logger.info("QueueViewManager: I rejected the duplicate entry")
コード例 #38
0
class GesturePad(Widget):
    minimum_x_distance = NumericProperty(0.0)
    minimum_y_distance = NumericProperty(0.0)

    def __init__(self, **kwargs):
        self.register_event_type('on_left')
        self.register_event_type('on_right')
        self.gdb = GestureDatabase()
        self.gdb.add_gesture(left)
        self.gdb.add_gesture(right)
        super().__init__(**kwargs)

    def simple_gesture(self, name, point_list):
        g = Gesture()
        g.add_stroke(point_list)
        g.normalize()
        g.name = name
        return g

    def on_touch_down(self, touch):
        touch.ud['start'] = (touch.x, touch.y)
        touch.ud['line'] = Line(points=(touch.x, touch.y))
        return super().on_touch_down(touch)

    def on_touch_move(self, touch):
        try:
            touch.ud['line'].points += [touch.x, touch.y]
        except (KeyError) as e:
            pass
        return super().on_touch_move(touch)

    def on_touch_up(self, touch):
        if 'start' in touch.ud:
            if math.fabs(touch.x -
                         touch.ud['start'][0]) <= self.minimum_x_distance:
                return super().on_touch_up(touch)
            if math.fabs(touch.y -
                         touch.ud['start'][1]) <= self.minimum_y_distance:
                return super().on_touch_up(touch)
        else:
            return super().on_touch_up(touch)

        g = self.simple_gesture(
            '',
            list(
                zip(touch.ud['line'].points[::2],
                    touch.ud['line'].points[1::2])))
        # print("gesture representation:", self.gdb.gesture_to_str(g))
        # print("left:", g.get_score(left))
        # print("right:", g.get_score(right))
        g2 = self.gdb.find(g, minscore=0.70)
        if g2:
            if g2[1] == left:
                self.dispatch('on_left')
            if g2[1] == right:
                self.dispatch('on_right')
        return super().on_touch_up(touch)

    def on_left(self, *args):
        pass

    def on_right(self, *args):
        pass
コード例 #39
0
ファイル: gesture_box.py プロジェクト: EJHortala/books-2
gesture_strings = {
    'left_to_right_line': 'eNq1WMtSI0cQvM+PwMVE17vrB9irI/gABwYFELsGBWht79+7p0qPHoE044NExAhyslPVmdU9La5fvr/8/evmafWx+fm+Gr5t39dluH5cw3B39Xr/1+pqWGP7tb3R8HF39bF5f/u++mh/8nD9Yy3D9Zcid0Eb1jpKWRu/fnt53YzD6jjMTwz7fWQNa8gKxhJ+tSGAw+1v5aZocUexWtkNodpYz7/jfYr7Sk6ExZWNXajd/vP+/MdwfIwMT6c/4WknXqComhcSlMILxGPqYEvERUphpdpQR3KeF68h7ovEkYUUrEIxLVpnxTHcR1gizrXuqm7ew7w2hjYdtEWqF6FaiMgFVDpxNHHjgnnVeV8wEkW5lHxkil2mUnauWLNWKx/kqf7PdsQIFbtQuUhlBsmrQidOlQC07q7ztVOkSnAh9ciVulxJuCIZm9ZSvQnv1bEaOmAtwJWR5puGIlWSy4hHptRlimjdj7h26lgPK2nBUqKIlPwi4hyJcpcooLQpOxRnhdbUnTio9dvjEvmIlOlS8hEqd6EWYwSQglbRqXCXKiDkKkqDfD5Wjli5i7VwtTYFz+ukaYqJiEpVtNL6B+b7nSNY9gvJS0Qr22hHdcn9yzQyEO/U0Q+PjsZa4L1EtEJ7+X3dcbVugy+lybaP39aPbeueVY9kRQ7q4yLdb8JsuJUfa4eudHCXefUIVmyvjkX50D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X8DJYLuXaAUGaYPeBul4MIv0aYJoZQRuimhhcjxoZ24jWuUAP9+GNzujzCqCm8LmFALw2c7weXk5I49ZObb5EWBWQjhIcFbCMEhoXhKDhGcleqDIrKQccpmtudiBUuYlh1zmq+4ySOYr7TZI5qsbQ7o4X90YKJjVbX3sefPy9Lzv/5HQ98J8SUlBDv/z8rh/rqPct5ITlxGll+zfvm3e718fNlUmde/tx4ee+8f2/e3x+0NDaz76K8++nbOA5w4RUU+0q/8AAJ5q8g=='
}

from kivy.uix.boxlayout import BoxLayout
# BEGIN GESTURE_DB
from kivy.gesture import GestureDatabase

gestures = GestureDatabase()
for name, gesture_string in gesture_strings.items():
    gesture = gestures.str_to_gesture(gesture_string)
    gesture.name = name
    gestures.add_gesture(gesture)
# END GESTURE_DB


# BEGIN GESTUREBOX
class GestureBox(BoxLayout):
    def on_touch_down(self, touch):
        touch.ud['gesture_path'] = [(touch.x, touch.y)]
        super(GestureBox, self).on_touch_down(touch)

    def on_touch_move(self, touch):
        touch.ud['gesture_path'].append((touch.x, touch.y))
        super(GestureBox, self).on_touch_move(touch)

    def on_touch_up(self, touch):
        print(touch.ud['gesture_path'])
        super(GestureBox, self).on_touch_up(touch)
コード例 #40
0
ファイル: my_gestures.py プロジェクト: dabou/escadron-T42
#!/usr/bin/env python
from kivy.gesture import GestureDatabase

gdb = GestureDatabase()

vertical = \
gdb.str_to_gesture('eNq1l8ty2jAUhvd6kbApI52rzgvQbWd4gA5JPIRJCh4gbfP2lY4dbGbasmDkBYafo0+Xz8JmsXvd/fxYbrvT+f3Yha/juY9h8dynsH7Yb350D6GH8racMJzWD6fz8fDancpHCou3nsPir5C1l4VeKkpL+/6w259rs1yb2T+afatVoU/DCOoQPkqTBGEVlyKJ1NhSRlEkq6P5Xb/FsPoSlzEJ5yQIwhglxajh9Lj5fzfk3XDYDj2wqESIFAdOAWwvcCCbjtL9bbhPPWkbeHa4NYGDrz6kTzhFQl9yMcyqTDN6jMCcPrtOyHgbD47HVniXCtw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PMxk3sjltLoos8nUln5SjirpZcj7lcLhJ+tGPo06b3A/8dYxSCKnjvfmfEOFcxjK9i7kEobKZmgFYi1EoshoNJ+YBecO8HbeJQ9DZTO08tokXXqYyU01LkU5GfY1lzBUNkOrpZdSqlc5F5jOTJ9XGze/IfMwVDZDAVa9Xd766iJRax03tt7Db7hISDgqm6OgVCZl6kTeGo0x2Q9V2Z8tGo7q5ijYMDOH3ySL9z9Ot9H9JtIwVDdD/ZYy1ZtNVwlUP9qmG8w+d/ipm59oOg8+nS6zPhGhuGh52w3B+73+09Ph8LDe0n32+zXdL9lXN9Dkuiw3hOXa5g8tL0dty21HtECA+pcHLYKWy6BGsJUedNEiWPScq9VAYCzzN89lEEHmCDbLIEZQIYNjA4pgQOLZ+QbcEf7SgZDBJRGE5BLfZ/5IR2ggEAPBdgERKhCVHx+NxB1hicjXYIiglQy2C8sGIiTxnvvxZW6QMn2DRGgQUxpgmEG7sEwSEWKR5DtRJml8Cp4vw3M5LZU7l+wn8JRR0l7C3DKV05rBdNJSLE2xsJ1z+SmfEDtBSkRTrlZeR+EVnY5oaiTpO8KlTVIkyoxBLkFSMswdoQzuVKbWc2VqHZBQw8/KWFh4RFsWdlZoOdGFHlGbi7cVZbRmQ0WleAfqeVn6aA1IaO2QsXXNlkKKqMqIZk9By+gJm02V3QFySYLK2diSEBgLJaO5kNul7FKCognh19wakNSj5JszXIKkOCXfkewCBFKpUhMilyA1R1bmMvqhAmQ0t+8yzh8MCCZkbD/eHuhVtFza0WXLyfvlcH/35SX+zeEV4sfMj2jH/HP/+eVLQNQhUQIefXn88/B0+/DpEE9aXL96fJwRvx+fHj9/+5TU5lP3uvVrg/iRKNr/evLRf/0fgMqGqw==')
コード例 #41
0
ファイル: main.py プロジェクト: easytech247/LaneCrash
from highscore import HighScore
from functools import partial
from kivy.properties import (StringProperty,
                             NumericProperty,
                             ListProperty,
                             BooleanProperty,
                             ObjectProperty)

import random
import math
from kivy.uix.behaviors import ButtonBehavior


#-------------------------------------
hsff = HighScore
gdb = GestureDatabase()
swipe_up = gdb.str_to_gesture(up_swipe)
swipe_up.name = "swipe_up"
swipe_down = gdb.str_to_gesture(down_swipe)
swipe_down.name = "swipe_down"
swipe_left = gdb.str_to_gesture(left_swipe)
swipe_left.name = "swipe_left"
swipe_right = gdb.str_to_gesture(right_swipe)
swipe_right.name = "swipe_right"
gdb.add_gesture(swipe_up)
gdb.add_gesture(swipe_down)
gdb.add_gesture(swipe_down)
gdb.add_gesture(swipe_left)
gdb.add_gesture(swipe_right)
#--------------------------------------------
コード例 #42
0
ファイル: gesture_board.py プロジェクト: 15huangtimothy/kivy
class GestureBoard(FloatLayout):
    """
    Our application main widget, derived from touchtracer example, use data
    constructed from touches to match symboles loaded from my_gestures.

    """
    def __init__(self, *args, **kwargs):
        super(GestureBoard, self).__init__()
        self.gdb = GestureDatabase()

        # add pre-recorded gestures to database
        self.gdb.add_gesture(cross)
        self.gdb.add_gesture(check)
        self.gdb.add_gesture(circle)
        self.gdb.add_gesture(square)

    def on_touch_down(self, touch):
        # start collecting points in touch.ud
        # create a line to display the points
        userdata = touch.ud
        with self.canvas:
            Color(1, 1, 0)
            d = 30.
            Ellipse(pos=(touch.x - d / 2, touch.y - d / 2), size=(d, d))
            userdata['line'] = Line(points=(touch.x, touch.y))
        return True

    def on_touch_move(self, touch):
        # store points of the touch movement
        try:
            touch.ud['line'].points += [touch.x, touch.y]
            return True
        except (KeyError) as e:
            pass

    def on_touch_up(self, touch):
        # touch is over, display informations, and check if it matches some
        # known gesture.
        g = simplegesture('', list(zip(touch.ud['line'].points[::2],
                                       touch.ud['line'].points[1::2])))
        # gestures to my_gestures.py
        print("gesture representation:", self.gdb.gesture_to_str(g))

        # print match scores between all known gestures
        print("cross:", g.get_score(cross))
        print("check:", g.get_score(check))
        print("circle:", g.get_score(circle))
        print("square:", g.get_score(square))

        # use database to find the more alike gesture, if any
        g2 = self.gdb.find(g, minscore=0.70)

        print(g2)
        if g2:
            if g2[1] == circle:
                print("circle")
            if g2[1] == square:
                print("square")
            if g2[1] == check:
                print("check")
            if g2[1] == cross:
                print("cross")

        # erase the lines on the screen, this is a bit quick&dirty, since we
        # can have another touch event on the way...
        self.canvas.clear()
コード例 #43
0
ファイル: gestures.py プロジェクト: leonardocsantoss/kivy-abc
#!/usr/bin/env python
from kivy.gesture import GestureDatabase

gdb = GestureDatabase()

gestures = {
    'a': gdb.str_to_gesture('eNqlWUtuHDkS3ddF7M0IjD95Afd2AB9g4LYFW+geW5DUM9O3n0hGZCYpZSkFSJuyXwUfGS8+DEof7/64+8/fN99vH5/+eri9/Jaf9+Xy8ds9XD5/+Pnl37cfLvfo//QPujx+/vD49PDrj9tH/y9fPv55L5ePhySfu9nlXhcq8/X3v+5+Pi3L6rKsXVn2z8Xqcg9xguUIf/sSwMunckMohbVwERAVhOU0/1u+peVbsIagzQo0KlT48vj7l9f34L6HXL4HPRekxlC0ArXGdnn8nsyOayUBLpVbMzin7l6DbdR+WrCqZFiKQd2o/aCFRZft2FqFiufctXO3jdspoDIoFkUtzhvk/3B2pWraBFlqKyR2So5dd5c2yRfHtSFzIxEGs50cXei26MFYEH2Tc3Ls5LSRUxErLWUXHsmtEatH2cUSw3PFsQcTt2CiVFfU06EZIwjv1CSqjZX8/NrANznn7tHELZqQrEbgqYE7NZdSXSi0wixU63kOYg8mbsEsrQqqFXJdixkNwfQ0Ad/UQ4mt+MlPuanHkrZYlqF4yESsDuRWkUEaEWOtcH5w6rGkjKUzgKvJfrJmWsQ/9D3kPZgkO7lnGkglzwqjqjhqrqAumItVTNAz/Zy9h5NsY8fOyrVVg1I9tmNElaF6KJuneDtPcerxpLZxk5ZC3jxcAPQ6bENAiQvgEhRy37y69JSde0QZdnYvbwXwIxYX2UtxqKClX5krox4M/8cb2HtIeQ8psdegS6pmBiqyk4P3Eu86otVcLzqn7gHlPaC4MFIr7Mc0T/93tCzu4WR7S7J4fSpWIlJj/xLKeRVxjyi3IdFXvSsCWaW9mXsXa+IuIYEtrp2SSw+onJ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ViDzRi7a0S0s1Q+x9T7hLkM1j95shUV1SjXFG+ZCO5hDZHuQZtaNsZJlD/KiJcCqFmZp1nJFTHKxZ30NVTnFo6ZfAdUPfsPeQyxWlvB9vB/kkKRvh0tAEZ/T4QVpCRtMWXtBxNJF3N1WG3qLvh/AIsfdCaNx+8V44KUvjoozRdXbBxqa0bPZd0OnBvQm6JJiMFfVtgiW65BTjEd1IsNHu/MBLlSVkKKW6oHDEbXPIZqr6jMJQVeu7Mmw1aWXKTKzjqjB4zw70kQ020ihbjW10KQ5ns9JhkqUel1dOhIwDWOoh2Y22K8tSDysrmhKYbGPXxWAGObHG+9jlAViP4lOpy0I/HvwgB1gejfY4BJaQIUXOs1zzGuBx+pxhudKKpmz1QDYaLuTgKmWMtsP3nFwlb80d7bJJjldtUD7Yc5dNMF3AUQc5ogqOB0eN5Ywq2Q52FBKVFcVEbUUp0cF75EvOqTIG8+OQlIDLX4ToEjKOlUOsMKxoSJCvR98fHr99f22/c4ghNt5L2uYD/v3x6+v39puScp5wAn39+evD8+cfX/rvUGKQbS+iDR/vbv98ev759bcvr/3beF2LO0ehvVtTvMW2V+P2Tnb/X5jkILk='),
}
コード例 #44
0
ファイル: ProfileManager.py プロジェクト: Sebelino/Team18
def getCurrentGestures():
    gestures = db.query("SELECT gestures.name,gestures.description,gestures.representation\
            FROM gestures,profiles,activeprofile WHERE profiles.name =\
            activeprofile.name AND gestures.name = gesturename ORDER BY LOWER(gesturename)")
    return gestures

def getCustomCommands():
    return filter(lambda r: r[0] != u'(No macro)',getCommands())

def getCurrentCommands():
    commands = db.query("SELECT commands.name,commands.description,commands.script\
            FROM commands,profiles,activeprofile WHERE profiles.name =\
            activeprofile.name AND commands.name = commandname ORDER BY LOWER(commandname)")
    return commands

gdb = GestureDatabase()

kivygestures = dict()
for [name,description,representation] in getCurrentGestures():
    if len(representation) < 20:    # Fulhack för att känna igen multitouch.
        continue
    kivygestures.update({representation:name})
    gest = gdb.str_to_gesture(representation.encode("ascii"))
    gdb.add_gesture(gest)

def getCommand(gesture):
    if gesture.multitouch:
        return getMultitouchedCommand(gesture)
    g = gdb.str_to_gesture(gesture.toString())
    identifiedGesture = None
    current_max = 0.7 # Minimum score
コード例 #45
0
ファイル: my_gestures.py プロジェクト: Sebelino/Team18
#!/usr/bin/env python
from kivy.gesture import GestureDatabase

gdb = GestureDatabase()

cross = \
gdb.str_to_gesture('eNq1l9tu3DYQhu/1It6bLjicE+cFtrcF/ACBYwv2Iqkt7G7a5u1DDqlT0lZ7I2Mxsj5JP2f4kxR1OH85//X9+Npfb98uffd7Ow6hO7wM0D0+vD/92T90Q8z/5gN218eH6+3y8aW/5lPqDl8H7g7/KvLot3WDFCnNzw8f5/dbeSyVx+w/Hvuj3NUNUDMoKXzPj0DsTuGIGiRJGCOVbP4pV7E7/RaORJZMwhS1u35++v9WyFvh7rU2ENEMJI1RuLu+NnEEgyhpjEG2xb1y0H3Ek4vbKA6kEmyKEWdxWPaJsaVN8eidH2Ef8ejiOIqHdbeQLvolaLTFLxlty7ulsVlaNBKChCnmEpp+uRSSIozRBLbl3dSoe8m7rdF2kkc3FmGSB1FVphYT6qSejY2sOsXtyYRuLOIkHgEtGrZIKJP4Spk13ZG524qzrXFWLlHmfok/9UvcFndTUe8Rz8OVA7RIYXtAoluKdke3hJU42j0dQ24pwV7ybiptm1oGE+Rz4ilu9w25q8R3qQtnZ2WKd+TutpLeox4pZmt1jHlh3VR3X8nuUceFdIm4qc5uKy9mapCY339jXKb+08tjewlmN5VxH3H3lBcLcASZfzGv4osFPiVk5SnmCb6p766y7qbvvvL0Zg2GKtHGCDjPJ2FKicfI2wuNuKsCu2i7qYLzdiP3BXGLYIs1DEAo0hh1eyaJeyq8i7b7KdM26ddNXpPO7SCSTnHbSnErxXaQVndSJyeJGQOMMe+RJm1aLrk5bku7kYp7SLuPOvlI6/FHs4+87hH2Fats/p8vff8+beVVyl5etTucMA/a7kSE+XAbNHVPmcGK2ZKBsxSciTPUyqAwUmdRKouFCToDqgwLU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jEW1V5cpGyag+LNXvN5ONkzf5ymVorl+w2fh6qZLt5dQGZjfbVITV7sr1ziGdjfwWXE2coA+sUSHLK6JRiCqQ5ZmxaZ0lrzpksD8ztac1B49N69M3hkkpxTIk1B0o2Bawz0zouaqNzwHqMIS+abQWL/UadaF60jSvxsZtoXjS7FM/pgKVubZ1zCOvv2mp2fogMl7z16HZ33Im6dEkKxkS5wzYwsScFg0R+Xej54OQjL8CTD0s+slMx+daDSU7NoMrxNslHDji8/E3rFH7EQW3yYckHD4HoyF2d+0VLq54nmQ+X5KNcZjnN8Yx3w1U+411xCyULob3noqsp/4ZLloi1d1xy8opuhLvpn6OX3wusHafzlZDZaVsKcOy/XlaDjHruXKjs2XYt9WxbqefZdjVJiimAZ9vlmR6zojzbLmVeFdmCyx6c+r/hUl+5XF7YsyFTFn/ZjLu9ctlAiTOXrfrJdfjoQvP2uQ+frDPhcyE+WacKuQSfrL4RR9Mzl1kpzdZW3pKvr775WvDt/uHrt5f+C3dsvrOhwvz3w5eXb8Pajj0J1pcfv98/ffr++X58EuPttNvnW8t/Hp9+fPnz80DDInxXb9kr1i3rv5PR/svgX2//B2XB7Do=')
コード例 #46
0
ファイル: gesturebox.py プロジェクト: buchuki/Todoy
class GestureBox(BoxLayout):
    'GestureBox class. See module documentation for more information.'

    gesture_timeout = NumericProperty(200)
    '''Timeout allowed to trigger the :data:`gesture_distance`, in milliseconds.
    If the user has not moved :data:`gesture_distance` within the timeout,
    the gesture will be disabled, and the touch event will go to the children.

    :data:`gesture_timeout` is a :class:`~kivy.properties.NumericProperty`,
    default to 200 (milliseconds)
    '''

    gesture_distance = NumericProperty('20dp')
    '''Distance to move before attempting to interpret as a gesture,
    in pixels. As soon as the distance has been traveled,
    the :class:`GestureBox` will interpret as a gesture.

    It is advisable that you base this value on the dpi of your target device's
    screen.

    :data:`gesture_distance` is a :class:`~kivy.properties.NumericProperty`,
    default to 20dp.
    '''
    # INTERNAL USE ONLY
    # used internally to store a touch and
    # dispatch it if the touch does not turn into a gesture
    _touch = ObjectProperty(None, allownone=True)

    def __init__(self, *args, **kwargs):
        super(GestureBox, self).__init__(*args, **kwargs)
        self.gestures = GestureDatabase()
        self.register_event_type('on_gesture')

    def add_gesture(self, name, gesture_str):
        '''Add a recognized gesture to the database.

        :param name: a short identifier for the gesture. This value is passed
            to the on_gesture event to identify which gesture occurred.
        :param gesture_str: A (probably very long) string describing the
            gesture and suitable as input to the
            :meth:`GestureDatabase.str_to_gesture` method. The
            `examples/gestures/gesture_board.py` example is a good way to
            generate such gestures.'''
        gesture = self.gestures.str_to_gesture(gesture_str)
        gesture.name = name
        self.gestures.add_gesture(gesture)

    def on_touch_down(self, touch):
        '''(internal) When the touch down event occurs, we save it until we
        know for sure that a gesture is not being initiated. If a gesture
        is initiated we intercept all the touch and motion events. Otherwise,
        we release it to any child widgets.'''
        if not self.collide_point(*touch.pos):
            touch.ud[self._get_uid('cavoid')] = True
            return
        if self._touch:
            return super(GestureBox, self).on_touch_down(touch)
        self._touch = touch
        uid = self._get_uid()
        touch.grab(self)
        touch.ud[uid] = {
            'mode': 'unknown',
            'time': touch.time_start}
        # This will be unscheduled if we determine that a gesture is being
        # attempted before it is called.
        Clock.schedule_once(self._change_touch_mode,
                self.gesture_timeout / 1000.)
        # Start storing the gesture line in case this turns into a gesture
        touch.ud['gesture_line'] = Line(points=(touch.x, touch.y))
        return True

    def on_touch_move(self, touch):
        '''(internal) As with touch down events, motion events are recorded
        until we know that a gesture is or is not being attempted.'''
        if self._get_uid('cavoid') in touch.ud:
            return
        if self._touch is not touch:
            super(GestureBox, self).on_touch_move(touch)
            return self._get_uid() in touch.ud
        if touch.grab_current is not self:
            return True
        ud = touch.ud[self._get_uid()]
        if ud['mode'] == 'unknown':
            dx = abs(touch.ox - touch.x)
            dy = abs(touch.oy - touch.y)
            distance = sqrt(dx * dx + dy * dy)

            # If we've moved more than the thershold distance inside the
            # threshold time, treat as a gesture
            if distance > self.gesture_distance:
                Clock.unschedule(self._change_touch_mode)
                ud['mode'] = 'gesture'

        # Regardless of whether this is a known gesture or not, collect
        # the motion point in case it becomes one.
        try:
            touch.ud['gesture_line'].points += [touch.x, touch.y]
        except KeyError:
            pass

        return True

    def on_touch_up(self, touch):
        '''(internal) When the touch up occurs, we have to decide if a gesture
        was attempted. If so, we fire the on_gesture event. In all other cases
        we propogate the change to child widget.'''
        if self._get_uid('cavoid') in touch.ud:
            return
        if self in [x() for x in touch.grab_list]:
            touch.ungrab(self)
            self._touch = None
            ud = touch.ud[self._get_uid()]
            if ud['mode'] == 'unknown':
                Clock.unschedule(self._change_touch_mode)
                super(GestureBox, self).on_touch_down(touch)
                Clock.schedule_once(partial(self._do_touch_up, touch), .1)
            else:
                # A gesture was attempted. Did it match?
                gesture = Gesture()
                gesture.add_stroke(
                    zip(touch.ud['gesture_line'].points[::2],
                        touch.ud['gesture_line'].points[1::2]))
                gesture.normalize()
                match = self.gestures.find(gesture, minscore=0.70)
                if match:
                    self.dispatch('on_gesture', match[1].name)
                else:
                    # The gesture wasn't recognized; invoke a normal reaction
                    super(GestureBox, self).on_touch_down(touch)
                    Clock.schedule_once(partial(self._do_touch_up, touch), .1)

                return True

        else:
            if self._touch is not touch and self.uid not in touch.ud:
                super(GestureBox, self).on_touch_up(touch)
        return self._get_uid() in touch.ud

    def _do_touch_up(self, touch, *largs):
        '''(internal) Simulate touch up events for anything that has grabbed the touch'''
        super(GestureBox, self).on_touch_up(touch)
        # don't forget about grab event!
        for x in touch.grab_list[:]:
            touch.grab_list.remove(x)
            x = x()
            if not x:
                continue
            touch.grab_current = x
            super(GestureBox, self).on_touch_up(touch)
        touch.grab_current = None
        return True

    def _change_touch_mode(self, *largs):
        '''(internal) Simulate a touch down if we know the touch did not become
        a gesture'''
        if not self._touch:
            return
        uid = self._get_uid()
        touch = self._touch
        ud = touch.ud[uid]
        if ud['mode'] == 'unknown':
            touch.ungrab(self)
            self._touch = None
            touch.push()
            touch.apply_transform_2d(self.to_widget)
            touch.apply_transform_2d(self.to_parent)
            super(GestureBox, self).on_touch_down(touch)
            touch.pop()
            return

    def _get_uid(self, prefix='sv'):
        return '{0}.{1}'.format(prefix, self.uid)

    def on_gesture(self, gesture_name):
        '''Called whenever a gesture has occured. This is a Kivy event. It
        can be overridden in a subclass our bound to using :meth:`Widget.bind`.
        '''
        pass
コード例 #47
0
#!/usr/bin/env python
from kivy.gesture import GestureDatabase

gdb = GestureDatabase()

cross = gdb.str_to_gesture(
    'eNq1l9tu3DYQhu/1It6bLjicE+cFtrcF/ACBYwv2Iqkt7G7a5u1DDqlT0lZ7I2Mxsj5JP2f4k'
    'xR1OH85//X9+Npfb98uffd7Ow6hO7wM0D0+vD/92T90Q8z/5gN218eH6+3y8aW/5lPqDl8H7g'
    '7/KvLot3WDFCnNzw8f5/dbeSyVx+w/Hvuj3NUNUDMoKXzPj0DsTuGIGiRJGCOVbP4pV7E7/Ra'
    'ORJZMwhS1u35++v9WyFvh7rU2ENEMJI1RuLu+NnEEgyhpjEG2xb1y0H3Ek4vbKA6kEmyKEWdx'
    'WPaJsaVN8eidH2Ef8ejiOIqHdbeQLvolaLTFLxlty7ulsVlaNBKChCnmEpp+uRSSIozRBLbl3'
    'dSoe8m7rdF2kkc3FmGSB1FVphYT6qSejY2sOsXtyYRuLOIkHgEtGrZIKJP4Spk13ZG524qzrX'
    'FWLlHmfok/9UvcFndTUe8Rz8OVA7RIYXtAoluKdke3hJU42j0dQ24pwV7ybiptm1oGE+Rz4il'
    'u9w25q8R3qQtnZ2WKd+TutpLeox4pZmt1jHlh3VR3X8nuUceFdIm4qc5uKy9mapCY339jXKb+'
    '08tjewlmN5VxH3H3lBcLcASZfzGv4osFPiVk5SnmCb6p766y7qbvvvL0Zg2GKtHGCDjPJ2FKi'
    'cfI2wuNuKsCu2i7qYLzdiP3BXGLYIs1DEAo0hh1eyaJeyq8i7b7KdM26ddNXpPO7SCSTnHbSn'
    'ErxXaQVndSJyeJGQOMMe+RJm1aLrk5bku7kYp7SLuPOvlI6/FHs4+87hH2Fats/p8vff8+beV'
    'Vyl5etTucMA/a7kSE+XAbNHVPmcGK2ZKBsxSciTPUyqAwUmdRKouFCToDqgwLU3MWQmVUmDnD'
    '1O7jwsCfOuXFt0JxGKNDaS1rhVwhV5gqpBW0CnEJLaw0G4QKwwrGmlJaQaxw1bp5QRBsBb2iZ'
    'MvczQtSWjGvx09m5uXwmnk1tNKDEGYbZli94TX0aqg1nRrE5Z3WoFdDtWyFBr0aqR2URljLqa'
    '1bbNDrsToywth69QfqGIrcaDVoPSoBqkNtbDE1Wi3iqsAtV6gesSdL0vKCalLNdqa5rjpB3vr'
    'z69utfJTmz8qTFclM/z6/3N4cSteSyvT28bW/PL0/935Ffdsd1n9Q7muT+dNw+Xj59lzFU+6W'
    'Y5L8ug5qwTR/PFH5bDz+AM/6Dqo=')

circle = gdb.str_to_gesture(
    'eNq1WNtyGzcMfd8fiV+iIS4EyB9QXzuTD+g4icbxpLU1ttI2f18QoHa5jpy12qlGAyUw9hA4B'
    'yQh3dx/vf/z++7u8Hz69nSYfumfxzTdfD7C9OHdw+0fh3fTEe2f9kHT84d3z6enx6+HZ/svTz'
    'e/H/N0cxHkg4dNR2lQas8fH+8fTu2x0h6rrzz2a4uajhAZtBS+2yOA0z7tCDMkqjk1y0W1pfN'
    '3+zNN+/dpl0pGqmdLJcv0/PH25+uwr5Onu74EMxErVLeGMT3fNXQDT4C1kopbLVBhG92LB91G'
    'h6RJinRb5A2ZF8euM/aP5JyxhVVShbBiJW9ho7OPcMZG1YTzWzTP2LgAm8XyBmx0bJqxsfSkm'
    '8UqMzaRluVduW5ju5o4qwkKmFWruM28cGLNcW3eriXOWi5kv8zbNK7GcwmbabtP0LXEWcuB7M'
コード例 #48
0
ファイル: e9.py プロジェクト: MancaManca/Kivy
 def __init__(self, *args, **kwargs):
     super(GestureBoard, self).__init__()
     self.gdb = GestureDatabase()
     self.gdb.add_gesture(check)
コード例 #49
0
 def __init__(self, **kwargs):
     super(Box, self).__init__(**kwargs)
     self.gdb = GestureDatabase()
     top_to_button = self.gdb.str_to_gesture(gesture_string)
     self.gdb.add_gesture(top_to_button)
     self.register_event_type('on_top_to_button')
コード例 #50
0
from kivy.gesture import GestureDatabase

gdb = GestureDatabase()

cross = gdb.str_to_gesture(
    'eNq1l9tu3DYQhu/1It6bLjicE+cFtrcF/ACBYwv2Iqkt7G7a5u1DDqlT0lZ7I2Mxsj5JP2f4k'
    'xR1OH85//X9+Npfb98uffd7Ow6hO7wM0D0+vD/92T90Q8z/5gN218eH6+3y8aW/5lPqDl8H7g'
    '7/KvLot3WDFCnNzw8f5/dbeSyVx+w/Hvuj3NUNUDMoKXzPj0DsTuGIGiRJGCOVbP4pV7E7/Ra'
    'ORJZMwhS1u35++v9WyFvh7rU2ENEMJI1RuLu+NnEEgyhpjEG2xb1y0H3Ek4vbKA6kEmyKEWdx'
    'WPaJsaVN8eidH2Ef8ejiOIqHdbeQLvolaLTFLxlty7ulsVlaNBKChCnmEpp+uRSSIozRBLbl3'
    'dSoe8m7rdF2kkc3FmGSB1FVphYT6qSejY2sOsXtyYRuLOIkHgEtGrZIKJP4Spk13ZG524qzrX'
    'FWLlHmfok/9UvcFndTUe8Rz8OVA7RIYXtAoluKdke3hJU42j0dQ24pwV7ybiptm1oGE+Rz4il'
    'u9w25q8R3qQtnZ2WKd+TutpLeox4pZmt1jHlh3VR3X8nuUceFdIm4qc5uKy9mapCY339jXKb+'
    '08tjewlmN5VxH3H3lBcLcASZfzGv4osFPiVk5SnmCb6p766y7qbvvvL0Zg2GKtHGCDjPJ2FKi'
    'cfI2wuNuKsCu2i7qYLzdiP3BXGLYIs1DEAo0hh1eyaJeyq8i7b7KdM26ddNXpPO7SCSTnHbSn'
    'ErxXaQVndSJyeJGQOMMe+RJm1aLrk5bku7kYp7SLuPOvlI6/FHs4+87hH2Fats/p8vff8+beV'
    'Vyl5etTucMA/a7kSE+XAbNHVPmcGK2ZKBsxSciTPUyqAwUmdRKouFCToDqgwLU3MWQmVUmDnD'
    '1O7jwsCfOuXFt0JxGKNDaS1rhVwhV5gqpBW0CnEJLaw0G4QKwwrGmlJaQaxw1bp5QRBsBb2iZ'
    'MvczQtSWjGvx09m5uXwmnk1tNKDEGYbZli94TX0aqg1nRrE5Z3WoFdDtWyFBr0aqR2URljLqa'
    '1bbNDrsToywth69QfqGIrcaDVoPSoBqkNtbDE1Wi3iqsAtV6gesSdL0vKCalLNdqa5rjpB3vr'
    'z69utfJTmz8qTFclM/z6/3N4cSteSyvT28bW/PL0/935Ffdsd1n9Q7muT+dNw+Xj59lzFU+6W'
    'Y5L8ug5qwTR/PFH5bDz+AM/6Dqo=')

circle = gdb.str_to_gesture(
    'eNq1WNtyGzcMfd8fiV+iIS4EyB9QXzuTD+g4icbxpLU1ttI2f18QoHa5jpy12qlGAyUw9hA4B'
    'yQh3dx/vf/z++7u8Hz69nSYfumfxzTdfD7C9OHdw+0fh3fTEe2f9kHT84d3z6enx6+HZ/svTz'
    'e/H/N0cxHkg4dNR2lQas8fH+8fTu2x0h6rrzz2a4uajhAZtBS+2yOA0z7tCDMkqjk1y0W1pfN'
    '3+zNN+/dpl0pGqmdLJcv0/PH25+uwr5Onu74EMxErVLeGMT3fNXQDT4C1kopbLVBhG92LB91G'
    'h6RJinRb5A2ZF8euM/aP5JyxhVVShbBiJW9ho7OPcMZG1YTzWzTP2LgAm8XyBmx0bJqxsfSkm'
    '8UqMzaRluVduW5ju5o4qwkKmFWruM28cGLNcW3eriXOWi5kv8zbNK7GcwmbabtP0LXEWcuB7M'
    'Y3pSVxVuRMiGFJaBOcXEzqYrZtwglLEsluBdOSen7R5LiN7nISzehAwsQZwC3yfwJ3PSnP4FZ'
コード例 #51
0
ファイル: GestureBoard.py プロジェクト: thica/ORCA-Remote
 def __init__(self, **kwargs):
     super(cGestureBoard, self).__init__(**kwargs)
     self.gdb = GestureDatabase()
コード例 #52
0
ファイル: gesture_board.py プロジェクト: Magzister/crud
class GestureBoard(FloatLayout):
    """
    Our application main widget, derived from touchtracer example, use data
    constructed from touches to match symboles loaded from my_gestures.

    """
    def __init__(self, *args, **kwargs):
        super(GestureBoard, self).__init__()
        self.gdb = GestureDatabase()

        # add pre-recorded gestures to database
        self.gdb.add_gesture(cross)
        self.gdb.add_gesture(check)
        self.gdb.add_gesture(circle)
        self.gdb.add_gesture(square)

    def on_touch_down(self, touch):
        # start collecting points in touch.ud
        # create a line to display the points
        userdata = touch.ud
        with self.canvas:
            Color(1, 1, 0)
            d = 30.
            Ellipse(pos=(touch.x - d / 2, touch.y - d / 2), size=(d, d))
            userdata['line'] = Line(points=(touch.x, touch.y))
        return True

    def on_touch_move(self, touch):
        # store points of the touch movement
        try:
            touch.ud['line'].points += [touch.x, touch.y]
            return True
        except (KeyError) as e:
            pass

    def on_touch_up(self, touch):
        # touch is over, display informations, and check if it matches some
        # known gesture.
        g = simplegesture(
            '',
            list(
                zip(touch.ud['line'].points[::2],
                    touch.ud['line'].points[1::2])))
        # gestures to my_gestures.py
        print("gesture representation:", self.gdb.gesture_to_str(g))

        # print match scores between all known gestures
        print("cross:", g.get_score(cross))
        print("check:", g.get_score(check))
        print("circle:", g.get_score(circle))
        print("square:", g.get_score(square))

        # use database to find the more alike gesture, if any
        g2 = self.gdb.find(g, minscore=0.70)

        print(g2)
        if g2:
            if g2[1] == circle:
                print("circle")
            if g2[1] == square:
                print("square")
            if g2[1] == check:
                print("check")
            if g2[1] == cross:
                print("cross")

        # erase the lines on the screen, this is a bit quick&dirty, since we
        # can have another touch event on the way...
        self.canvas.clear()
コード例 #53
0
class GestureBoard(FloatLayout):
    """
    Our application main widget, derived from touchtracer example, use data
    constructed from touches to match symboles loaded from my_gestures.

    """
    edge_size = NumericProperty(0)
    exists=BooleanProperty(False)
    def __init__(self, *args, **kwargs):
        super(GestureBoard, self).__init__()
        self.gdb = GestureDatabase()
        # add pre-recorded gestures to database
        for square in squares:
            self.gdb.add_gesture(square)
    def on_touch_down(self, touch):
        super(GestureBoard,self).on_touch_down(touch)
        if self.collide_point(*touch.pos):
            if App.get_running_app().config.getboolean('museotouch','validation') == True:  
                # start collecting points in touch.ud
                # create a line to display the points
                userdata = touch.ud
                userdata['line'] = Line(points=(touch.x, touch.y))
                return True

    def on_touch_move(self, touch):
        if self.collide_point(*touch.pos):
            super(GestureBoard,self).on_touch_move(touch)
            # store points of the touch movement
            try:
                touch.ud['line'].points += [touch.x, touch.y]
                return True
            except (KeyError) as e:
                pass

    def on_touch_up(self, touch):
        super(GestureBoard,self).on_touch_up(touch)
        # touch is over, display informations, and check if it matches some
        # known gesture.
        try :
            g = simplegesture(
                    '',
                    list(zip(touch.ud['line'].points[::2], touch.ud['line'].points[1::2]))
                    )
            self.edge_size = (self.stroke_length(list(zip(touch.ud['line'].points[::2], touch.ud['line'].points[1::2]))))/4 
            if self.edge_size < 150:
                self.edge_size=150               
        # gestures to my_gestures.py
        except :
            return

        # use database to find the more alike gesture, if any
        g2 = self.gdb.find(g, minscore=0.9)
        if g2:
            for index,square in enumerate(squares) :
                if (g2[1] == square):
                    if index in [0,1]:
                        square_pos=[touch.x,touch.y-self.edge_size]
                    elif index in [2,3]:
                        square_pos=[touch.x-self.edge_size,touch.y-self.edge_size]
                    elif index in [4,5]:
                        square_pos=[touch.x-self.edge_size,touch.y]
                    elif index in [6,7]:
                        square_pos=[touch.x,touch.y]
                    valid = Valid(pos=(0,0),size=[self.edge_size,self.edge_size],rotation=180,scale_min=0.5)
                    self.add_widget(valid)
                    Animation(pos=square_pos,d=.3,rotation=0,transition='out_sine').start(valid)
                    self.exists=True
                    break
    def stroke_length(self,l):
        distance = 0
        for index, point in enumerate(l) :
            if index < len(l)-1:
                distance += Vector(point).distance(l[index+1])
        return distance
コード例 #54
0
ファイル: gesturebox.py プロジェクト: buchuki/Todoy
 def __init__(self, *args, **kwargs):
     super(GestureBox, self).__init__(*args, **kwargs)
     self.gestures = GestureDatabase()
     self.register_event_type('on_gesture')
コード例 #55
0
ファイル: screens.py プロジェクト: AndreMPCosta/CellCount
class CurrentSession(Screen):
    _app = ObjectProperty()
    working_layout = ObjectProperty()
    buttons = DictProperty()
    grid = StringProperty('small')
    n_of_cols = NumericProperty(number_of_cols)
    color_manager = ObjectProperty()

    def __init__(self, **kwargs):
        super(CurrentSession, self).__init__(**kwargs)
        #self.snack = Snackbar(text="Current session updated", duration=2)
        self.ssm = None
        self.buttons = {}
        self.available_grid_sizes = ['small', 'large']
        self.bind(grid=self.refresh_menu_text, buttons=self.refresh_screen)
        self.working_layout.bind(
            minimum_height=self.working_layout.setter('height'))
        self.menu_items = [{
            'viewclass': 'MDFlatButton',
            'text': 'Show %s grid' % self.grid,
            'on_release': lambda: self.change_grid_size()
        }]
        self.color_manager = ColorManager(md_colors)
        self.clear_anim = Animation(x=self.width,
                                    duration=.5,
                                    transition=animation_type)
        self.bind(width=self.update_anim, size=self.adjust_height)
        self.gdb = GestureDatabase()
        self.gdb.add_gesture(left_to_right)
        Clock.schedule_once(self.my_init)

    def my_init(self, dt):
        self.manager = self.parent
        self.root = self.parent.parent.parent.parent
        self.working_layout.parent.bind(
            minimum_height=self.working_layout.parent.setter('height'))
        self.init_button = self.ids.add_cells

    def animate_action_button(self, instance):
        # print instance.content
        # anim = Animation(size=(0,0), center_x=instance.center_x, duration=1, transition='in_out_quad')
        # anim2 = Animation(opacity=0, center_x=instance.center_x, duration=1, transition='in_out_quad')
        # print instance.center_x, instance.center_y
        # anim.bind(on_complete= self.teste)
        # anim.start(instance)
        # anim2.start(instance.content)
        self.parent.current = 'workspace'

    def teste(self, x, y):
        print x, y

    def update_anim(self, instance, value):
        self.clear_anim._animated_properties['x'] = self.width

    def refresh_screen(self, instance, value):
        if bool(self.buttons):
            if self.ids.plus_layout.children:
                self.ids.plus_layout.remove_widget(self.ids.add_cells)
        else:
            self.ids.plus_layout.add_widget(self.init_button)

    def on_touch_down(self, touch):
        # create an user defined variable and add the touch coordinates
        touch.ud['gesture_path'] = [(touch.x, touch.y)]
        super(CurrentSession, self).on_touch_down(touch)

    def on_touch_move(self, touch):
        if 'gesture_path' in touch.ud:
            touch.ud['gesture_path'].append((touch.x, touch.y))
        super(CurrentSession, self).on_touch_move(touch)

    def on_touch_up(self, touch):
        if 'gesture_path' in touch.ud:
            # create a gesture object
            gesture = Gesture()
            # add the movement coordinates
            gesture.add_stroke(touch.ud['gesture_path'])
            # normalize so thwu willtolerate size variations
            gesture.normalize()
            # minscore to be attained for a match to be true, default 0.3
            g2 = self.gdb.find(gesture, minscore=0.70)
            if g2:
                print 'swipe left'

        #print("gesture representation:", self.gdb.gesture_to_str(gesture))

    def finish(self):
        print 'finishing'
        self.clear()

    def adjust_height(self, instance, value):
        # TODO Analysis
        pass
        # print self.width, self.height
        # print self.ids.add_cells.pos
        #print self.height
        #self.ids.plus_layout.height = self.height - self.ids.add_cells.height - self.root.ids.toolbar.height
        #print self.ids.plus_layout.height
        # print [x for x in instance.walk()]
        # print self.buttons
        #print type(instance) == GridLayout
        # if type(instance) == GridLayout:
        #     self.ids.plus_layout.height = self.working_layout.row_default_height
        #     self.ids.add_cells.y = self.buttons[sorted(self.buttons.keys())[-1]].y

    # def on_touch_down(self, touch):
    #     print touch

    @mainthread
    def on_enter(self, *args):
        if not self.parent.has_screen('workspace'):
            self.parent.add_widget(self.parent.saved_screens['workspace']())
            self.ssm = self.parent.get_screen(
                'workspace').secondary_screen_manager
        self.update_dots_menu()

    @mainthread
    def on_leave(self, *args):
        if len(self.root.ids['toolbar'].dots_menu.items) > 3:
            del self.root.ids['toolbar'].dots_menu.items[1]

    def update_dots_menu(self):
        self.root.ids['toolbar'].dots_menu.items.insert(1, self.menu_items[0])

    def refresh_menu_text(self, widget, value):
        self.menu_items[0]['text'] = 'Show %s grid' % value

    def change_grid_size(self):
        if self.grid != self.available_grid_sizes[0]:
            self.grid = self.available_grid_sizes[0]
            self.n_of_cols = number_of_cols
        else:
            self.grid = self.available_grid_sizes[1]
            self.n_of_cols = number_of_cols + 1
        self.root.ids['toolbar'].dots_menu.items[1] = self.menu_items[0]
        self.root.ids['toolbar'].dots_menu.custom_dismiss()

    def populate_current_session(self, _widget):
        if _widget.active:
            if not self.buttons.has_key(_widget.pass_text) or dev:
                print 'Adding ' + _widget.pass_text + ' to current session'
                new_text = _widget.pass_text.replace(' ', '\n')
                button = MDColorFlatButton(text=new_text,
                                           id=_widget.pass_text,
                                           size_hint=(1, 1),
                                           on_release=self.add)
                self.bind(grid=button.setter('grid'))
                self.buttons[_widget.pass_text] = button
                button.set_bg_color(
                    get_color_from_hex(self.color_manager.pop()))
                self.working_layout.add_widget(button)
        else:
            if self.buttons.has_key(_widget.pass_text):
                self.working_layout.remove_widget(
                    self.buttons[_widget.pass_text])
                del self.buttons[_widget.pass_text]

    def add(self, button):
        button.set_is_empty(False)
        button.increment_counter()
        if self.parent.get_screen('settings').ids.vibration.active:
            print "I'm vibratin'!"
        if (platform == 'android' or platform == 'ios'
            ) and self.parent.get_screen('settings').ids.vibration.active:
            #print platform
            # try:
            vibrate(0.1)
            # except NotImplementedError:
            #     print "Can't access the vibrate function"

    def clear(self):
        if self.manager.current_screen.name == self.name:
            for i, button in enumerate(self.buttons.values()):
                self.clear_anim.start(button)
                if i == len(self.buttons) - 1:
                    self.clear_anim.bind(on_complete=self.clear_complete)
        else:
            self.ssm.reset = not self.ssm.reset

    def clear_complete(self, instance, value):
        # sm = self.parent.get_screen('workspace').ids.secondary_screen_manager
        # sm.reset = not sm.reset
        self.ssm.reset = not self.ssm.reset
コード例 #56
0
 def __init__(self, *args, **kwargs):
     super(GestureBoard, self).__init__()
     self.gdb = GestureDatabase()
     # add pre-recorded gestures to database
     for square in squares:
         self.gdb.add_gesture(square)
コード例 #57
0
ファイル: gestures.py プロジェクト: luogni/lucaognibene
from kivy.gesture import GestureDatabase

gdb = GestureDatabase()

check = \
gdb.str_to_gesture('eNq1l0tuI0cMhvd9EXsTofgmL6BsA/gAgcYWbGMmtmBpksztwyY1kgZI0rNpbdr+u+pjkX+9+v718+uf3zbP++Pp68d++vX8PIzp/ukA08Pd2+6P/d10wPwzHzQdH+6Op4/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