Ejemplo n.º 1
0
print("CONNECT")

qpy.connect(to, 'aSignal(int)', cback)

to.aSignal(131)


class AClass(object):
    def cback(self, v):
        print("AClass.cback: Got {0}".format(v))


aclass = AClass()
aclass2 = AClass()

qpy.connect(to.aSignal, aclass2.cback)
qpy.connect(to, 'aSignal(int)', aclass.cback)

to.aSignal(321)

print("DISCONNECT")

qpy.disconnect(to, 'aSignal(int)', aclass.cback)
qpy.disconnect(to.aSignal, aclass2.cback)
qpy.disconnect(to, 'aSignal(int)', cback)

to.aSignal(123)

print('done!')
Ejemplo n.º 2
0
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL UGO VARETTO BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

import qpy
import qpy_test

class QPyDerived(qpy_test.QpyTestObject):
    def __init__(self, v):
        qpy_test.QpyTestObject.__init__(self, v)


def cback(v):
    print('Got {0}'.format(v))

d = QPyDerived(4)
d.Print()
qpy.connect(d.aSignal, cback)

d.aSignal(123)

qpy.disconnect(d.aSignal, cback)

d.aSignal(321)    
Ejemplo n.º 3
0
qpy.connect(to, 'aSignal(int)', cback)

to.aSignal(131)

class AClass(object):
 	def cback(self, v):
 		print("AClass.cback: Got {0}".format(v))

aclass = AClass()
aclass2 = AClass()

qpy.connect(to.aSignal, aclass2.cback)
qpy.connect(to, 'aSignal(int)', aclass.cback)

to.aSignal(321)

print("DISCONNECT")

qpy.disconnect(to, 'aSignal(int)', aclass.cback)
qpy.disconnect(to.aSignal, aclass2.cback)
qpy.disconnect(to, 'aSignal(int)', cback)

to.aSignal(123)

print('done!')





Ejemplo n.º 4
0
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL UGO VARETTO BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

import qpy
import qpy_test


class QPyDerived(qpy_test.QpyTestObject):
    def __init__(self, v):
        qpy_test.QpyTestObject.__init__(self, v)


def cback(v):
    print('Got {0}'.format(v))


d = QPyDerived(4)
d.Print()
qpy.connect(d.aSignal, cback)

d.aSignal(123)

qpy.disconnect(d.aSignal, cback)

d.aSignal(321)
Ejemplo n.º 5
0
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

import qpy
import qpy_test
obj = qpy_test.QpyTestObject()
def cback(v):
    print("Got {0}".format(v))
class AClass(object):
    def cback(self, v):
        print("AClass.cback: got {0}".format(v))
obj2 = qpy_test.QpyTestObject();
aclass = AClass()

qpy.connect(obj.aSignal, cback)
qpy.connect(obj.aSignal, aclass.cback)
qpy.connect(obj, 'aSignal(int)', obj2, 'catchSignal(int)')
qpy.connect(obj.anotherSignal, obj2.catchAnotherSignal)

obj.aSignal(123)
obj.anotherSignal('123')

qpy.disconnect(obj.aSignal, cback)
qpy.disconnect(obj.aSignal, aclass.cback)
qpy.disconnect(obj, 'aSignal(int)', obj2, 'catchSignal(int)')
qpy.disconnect(obj.anotherSignal, obj2.catchAnotherSignal)

obj.aSignal(123)
obj.anotherSignal("123")