示例#1
0
 def draw(self):
     super(AddItemMenu, self).draw()
     for touch in getCurrentTouches():
         if not self in touch.grab_list:
             continue
         with gx_matrix:
             glTranslatef(touch.x, touch.y, 0)
             touch.userdata['new_item'].draw_drag_icon()
示例#2
0
文件: touchring.py 项目: azoon/pymt
    def draw(self):
        for touch in getCurrentTouches():
            if 'kinetic' in touch.profile:
                set_color(1, 1, 1, .2)
            else:
                set_color(1, 1, 1, .7)

            # draw touch
            ring_img.pos = touch.pos
            ring_img.draw()
示例#3
0
    def draw(self):
        color = self.style.get('color')
        ring_img.color = color
        for touch in getCurrentTouches():
            alpha = color[3]
            if 'kinetic' in touch.profile:
                alpha = .2

            # draw touch
            ring_img.opacity = alpha
            ring_img.pos = touch.pos
            ring_img.draw()
示例#4
0
    def draw(self):
        color = self.style.get('color')
        ring_img.color = color
        for touch in getCurrentTouches():
            alpha = color[3]
            if 'kinetic' in touch.profile:
                alpha = .2

            # draw touch
            ring_img.opacity = alpha
            ring_img.pos = touch.pos
            ring_img.draw()
示例#5
0
    def draw(self):
        t = getClock().get_time()
        touches = getCurrentTouches()

        # draw closed touches
        to_delete = []
        ids = [touch.id for touch in touches]
        for id in self.closetouches:
            if not id in ids:
                to_delete.append(id)
                continue
            touch = self.closetouches[id]
            value = ((t - touch.time_start) - 1) / 2.
            if value > 1:
                self.do_close()
                return
            set_color(1, 1, 1, .7)
            drawSemiCircle(pos=(touch.x, touch.y),
                           inner_radius=30,
                           outer_radius=50,
                           slices=64,
                           sweep_angle=value * 360)

        # delete old touches
        for id in to_delete:
            del self.closetouches[id]

        # search
        for touch in touches:
            if 'closeapp.invalid_for_close' in touch.userdata:
                continue
            # distance < 20
            if Vector(touch.osxpos, touch.osypos).distance(
                    Vector(touch.sx, touch.sy)) > 0.015:
                # flag
                touch.userdata['closeapp.invalid_for_close'] = True
                if touch.id in self.closetouches:
                    del self.closetouches[touch.id]
                return
            # 1s minimum
            if t - touch.time_start < 1:
                if touch.id in self.closetouches:
                    del self.closetouches[touch.id]
                return
            # check corner screen
            if touch.sx < .75 or touch.sy < .75:
                if touch.id in self.closetouches:
                    del self.closetouches[touch.id]
                return
            # add touches to closed touches
            self.closetouches[touch.id] = touch
示例#6
0
文件: closeapp.py 项目: Markitox/pymt
    def draw(self):
        t = getClock().get_time()
        touches = getCurrentTouches()

        # draw closed touches
        to_delete = []
        ids = [touch.id for touch in touches]
        for id in self.closetouches:
            if not id in ids:
                to_delete.append(id)
                continue
            touch = self.closetouches[id]
            value = ((t - touch.time_start) - 1) / 2.
            if value > 1:
                self.do_close()
                return
            set_color(1, 1, 1, .7)
            drawSemiCircle(pos=(touch.x, touch.y), inner_radius=30, outer_radius=50, slices=64, sweep_angle=value*360)

        # delete old touches
        for id in to_delete:
            del self.closetouches[id]

        # search
        for touch in touches:
            if 'closeapp.invalid_for_close' in touch.userdata:
                continue
            # distance < 20
            if Vector(*touch.opos).distance(Vector(touch.sx, touch.sy)) > 0.015:
                # flag
                touch.userdata['closeapp.invalid_for_close'] = True
                if touch.id in self.closetouches:
                    del self.closetouches[touch.id]
                return
            # 1s minimum
            if t - touch.time_start < 1:
                if touch.id in self.closetouches:
                    del self.closetouches[touch.id]
                return
            # check corner screen
            if touch.sx < .75 or touch.sy < .75:
                if touch.id in self.closetouches:
                    del self.closetouches[touch.id]
                return
            # add touches to closed touches
            self.closetouches[touch.id] = touch
示例#7
0
    def draw(self):
        bubbles = self.bubbles
        get = self.bubbles.get
        info = self.text_info
        current = getCurrentTouches()
        for touch in current:
            uid = touch.uid
            bubble = get(uid, None)
            if not bubble:
                bubble = MTSpeechBubble(
                    size=(150, 100), color=(0, 0, 0, 1), font_size=9)
                self.bubbles[uid] = bubble
            bubble.pos = touch.pos
            bubble.label = info(touch)
            bubble.dispatch_event('on_draw')

        alive = [x.uid for x in current]
        for uid in bubbles.keys()[:]:
            if uid not in alive:
                del bubbles[uid]