Beispiel #1
0
 def hide_hint(self):
     root = Root.instance
     self._curPosY = ValueAnimate(
             self.pos[1], root.size[1])
     if self._timer: 
         self._timer.finish()
     self._timer = Timer(0.1, self._animate)
     Timer.add(self._timer)
     self.state = self.HIDING
Beispiel #2
0
 def input(self, e):
     if e.key == K_RETURN:
         self.on_mouse_down()
         if self.is_under_mouse(mouse.pos):
             Timer.add(Timer(0.2, self.on_mouse_up, 1))
         else:
             Timer.add(Timer(0.2, self.on_mouse_out, 1))
         self.command(e)
     else:
         return True
Beispiel #3
0
 def show_hint(self, hint):
     root = Root.instance
     self.text = hint
     tsize = self.Font.size(hint)
     self.resize((tsize[0]+6, tsize[1]+4))
     self._curPosY = ValueAnimate(
             self.pos[1], root.size[1] - self.size[1])
     if self._timer: 
         self._timer.finish()
     self._timer = Timer(1./FPS, self._animate)
     Timer.add(self._timer)
     self.show()
     self.state = self.SHOWWING
Beispiel #4
0
    def init(self):
        # Focusable.__init__(self)
        self.label = Label(self, text=self.caption, align=self.align, color=self.color, bgcolor=COLOR_TRANS, size=self.size)
        self._underMouse = False
        self._commands = []

        self.bind(EV_MOUSEOVER, self.on_mouse_over, BLK_PRE_NONBLOCK)
        self.bind(EV_MOUSEDOWN, self.on_mouse_down, BLK_PRE_NONBLOCK)
        self.bind(EV_MOUSEOUT, self.on_mouse_out, BLK_PRE_NONBLOCK)
        self.bind(EV_MOUSEUP, self.on_mouse_up, BLK_PRE_NONBLOCK)

        self.curColor = ColorAnimate((0, 0, 0, 0xff), self.bgcolor)
        Timer.add(Timer(1./FPS, self.animate))
        self.bind(EV_CLICK, self.command, BLK_PRE_BLOCK)
        self.bind_command(self.on_mouse_out)
Beispiel #5
0
 def _animate(self, dt):
     self.pos = self.pos[0], self._curPosY.get()
     if self._curPosY.is_end():
         if self.state == self.HIDING:
             self.state == self.HIDED
             if self._timer:
                 self._timer.finish()
                 self._timer = None
             self.hide()
         elif self.state == self.SHOWWING:
             self.state = self.SHOWN
             tm = Timer(self.SHOW_TIME, self.hide_hint, 1)
             Timer.add(tm)
             if self._timer: self._timer.finish()
             self._timer = tm
         return
     self.mark_redraw()
Beispiel #6
0
    def init(self):
        Focusable.__init__(self)
        self.minWidth = self.size[0]
        self.minHeight = self.size[1]

        self.bgLabel = Label(self, level=10, size=self.size, text='', bgcolor=self.bgcolor)
        self.hoverButton = TransButton(self, level=11, size=self.size)
        self.txtLabel = Label(self, level=12, size=self.size, 
                color=self.color, text=self.text, bgcolor=COLOR_TRANS)

        self.redraw()
        self.bind(EV_CLICK, self.set_as_focus, BLK_PRE_BLOCK)

        self._editing = False
        Timer.add(Timer(1./FPS, self.animate))
        self.blinker = ColorAnimate(self.bgcolor, self.bgcolor)

        self.confirmCallBacks = []
        self.changeCallBacks = []
        self._confirmed = False
Beispiel #7
0
 def __init__(self, parent, **dargs):
     super(PopupMenu, self).__init__(parent, **dargs)
     Timer.add(Timer(1./FPS, self.animate))
     self.bind_key(K_ESCAPE, self.hide)
Beispiel #8
0
 def __init__(self, v1, v2):
     self.v = v1
     self.v1 = v2
     self._end = False
     self.timer = Timer.add(Timer(1.0 / FPS, self.step, 1000))