Exemplo n.º 1
0
 def __init__(self, funcOn, funcOff, text="", state=False):
     QtGui.QCheckBox.__init__(self,text)
     self.setChecked(state)
     def checkBoxCB(n):
         if n == 2:
             funcOn()
         elif n == 0:
             funcOff()
     connect(self, "stateChanged(int)", checkBoxCB)
Exemplo n.º 2
0
 def setupGui(self):
     ## self.widget has next, prev buttons, plus a QStackedWidget for holding per page controls
     self.widget = ChangePageUI()
     ## the initial state
     self.widget.previous.hide()
     self.widget.next.hide()
     connect(self.widget.next, "clicked(bool)", self.nextPage)
     connect(self.widget.previous, "clicked(bool)", self.prevPage)
     ## ============================
     self.notesStack = QtGui.QStackedWidget()
Exemplo n.º 3
0
 def chain(animations, pause=100):
     '''
     Runs all animations one after another
     @param animations:
     @param pause:
     '''
     for i in range(len(animations)-1):
         animations[i].pauseTimer.setInterval(pause)
         connect(animations[i],"finished()",animations[i].pauseTimer.start)
         connect(animations[i].pauseTimer,"timeout()",animations[i+1].start)
Exemplo n.º 4
0
 def setupGui(self):
     ## self.widget has next, prev buttons, plus a QStackedWidget for holding per page controls
     self.widget = ChangePageUI()
     ## the initial state
     self.widget.previous.hide()
     self.widget.next.hide()
     connect(self.widget.next, "clicked(bool)", self.nextPage)
     connect(self.widget.previous, "clicked(bool)", self.prevPage)
     ## ============================
     self.notesStack = QtGui.QStackedWidget()
Exemplo n.º 5
0
    def __init__(self, funcOn, funcOff, text="", state=False):
        QtGui.QCheckBox.__init__(self, text)
        self.setChecked(state)

        def checkBoxCB(n):
            if n == 2:
                funcOn()
            elif n == 0:
                funcOff()

        connect(self, "stateChanged(int)", checkBoxCB)
Exemplo n.º 6
0
 def chain(animations, pause=100):
     '''
     Runs all animations one after another
     @param animations:
     @param pause:
     '''
     for i in range(len(animations) - 1):
         animations[i].pauseTimer.setInterval(pause)
         connect(animations[i], "finished()",
                 animations[i].pauseTimer.start)
         connect(animations[i].pauseTimer, "timeout()",
                 animations[i + 1].start)
Exemplo n.º 7
0
 def __init__(self, duration, times):
     QtCore.QObject.__init__(self)
     self.times = self.timesleft = times
     self.oneshot = SoOneShot()
     self.oneshot.duration = duration
     self.oneshot.flags = SoOneShot.HOLD_FINAL
     ## necesitamos un SoField para poder extraer el
     ## valor con getValue()
     ## can't this value be obtained directly from a SoEngineOutput?
     self.value = SoSFFloat()
     self.value.connectFrom(self.oneshot.ramp)
     self.sensor = SoFieldSensor(self.callback, self.value)
     self.sensor.attach(self.value)
     connect(self, "finished()", self.cycle)
Exemplo n.º 8
0
    def __init__(self, text, iter, func, parent=None):
        QtGui.QSpinBox.__init__(self)
        (vmin, vmax, vini) = iter
        self.setMinimum(vmin)
        self.setMaximum(vmax)
        self.setValue(vini)
        self.func = func
        connect(self, "valueChanged(int)", lambda x: func(x))

        layout = QtGui.QHBoxLayout()
        lab = QtGui.QLabel(text)
        layout.addWidget(lab)
        layout.addWidget(self)

        if parent:
            parent.addLayout(layout)
Exemplo n.º 9
0
    def __init__(self, text,iter,func,parent=None):
        QtGui.QSpinBox.__init__(self)
        (vmin, vmax, vini) = iter
        self.setMinimum(vmin)
        self.setMaximum(vmax)
        self.setSingleStep(.1)
        self.setValue(vini)
        self.func = func
        connect(self,"valueChanged(double)", lambda x: func(x))

        layout  =  QtGui.QHBoxLayout()
        lab = QtGui.QLabel(text)
        layout.addWidget(lab)
        layout.addWidget(self)

        if parent:
            parent.addLayout(layout)
Exemplo n.º 10
0
class Animation(OneShotTimeLine):
    def __init__(self, func, (duration, nmin, nmax)):
        self.functions = [func]
        super(Animation, self).__init__(duration)
        self.setFrameRange(nmin, nmax)
        connect(self, "frameChanged(int)", self.functions[-1])
        ## ======================================
        ## This is used for the static method "chain"
        ## it is the pause between animations
        self.pauseTimer = QtCore.QTimer()
        self.pauseTimer.setSingleShot(True)
        self.__anim_queue = []
Exemplo n.º 11
0
 def onStart(self, func):
     connect(self, "stateChanged(QTimeLine::State)", lambda state: func() if state == 2 else None)
     return self
Exemplo n.º 12
0
# -*- coding: utf-8 -*-

from PyQt4 import QtCore
from superficie.util import connect
from superficie.util import tuplize
from one_shot import OneShot


class Animation(OneShot):
    def __init__(self, func, (duration, nmin, nmax), times=1):
        self.functions = [func]
        super(Animation, self).__init__(duration / 1000.0, times)
        #        self.setCurveShape(self.LinearCurve)
        self.setFrameRange(nmin, nmax)
        connect(self, "frameChanged(int)", self.functions[-1])
        #        connect(self, "ramp(float)", self.functions[-1])
        ## ======================================
        ## This is used for the static method "chain"
        ## it is the pause between animations
        self.pauseTimer = QtCore.QTimer()
        self.pauseTimer.setSingleShot(True)
        self.__anim_queue = []

    @staticmethod
    def chain(animations, pause=100):
        '''
        Runs all animations one after another
        @param animations:
        @param pause:
        '''
        for i in range(len(animations) - 1):
Exemplo n.º 13
0
 def addFunction(self, func):
     self.functions.append(func)
     connect(self, "frameChanged(int)", self.functions[-1])
Exemplo n.º 14
0
 def onStart(self, func):
     "Executes func at the same time that this animation"
     for f in tuplize(func):
         connect(self, "started()", f)
     return self
Exemplo n.º 15
0
 def onStart(self, func):
     "Executes func at the same time that this animation"
     for f in tuplize(func):
         connect(self, "started()", f)
     return self
Exemplo n.º 16
0
 def __init__(self,text,func,parent=None):
     QtGui.QPushButton.__init__(self,text)
     self.func = func
     connect(self,"clicked(bool)", lambda x: func())
     if parent:
         parent.addWidget(self)
Exemplo n.º 17
0
 def __init__(self, duration):
     QtCore.QObject.__init__(self)
     self.time_line = QtCore.QTimeLine(duration)
     connect(self.time_line, "frameChanged(int)", self.relay_frame_changed)
     connect(self.time_line, "finished()", self.relay_finished)
Exemplo n.º 18
0
 def __init__(self, text, func, parent=None):
     QtGui.QPushButton.__init__(self, text)
     self.func = func
     connect(self, "clicked(bool)", lambda x: func())
     if parent:
         parent.addWidget(self)
Exemplo n.º 19
0
 def addFunction(self,func):
     self.functions.append(func)
     connect(self, "frameChanged(int)", self.functions[-1])