Previous topic

qarbon.release

Next topic

qarbon.util

This Page

qarbon.signal

Simple implementation of signal/slot pattern.

Classes

Signal Represents typical Signal pattern with connect, disconnect and emit.
class qarbon.signal.Signal(*args, **kwargs)[source]

Bases: object

Represents typical Signal pattern with connect, disconnect and emit. Can be used as a descriptor. Example:

class Car(object):

    temperatureChanged = Signal(float)

    def set_temperature(self, temp):
        self.__temp = temp
        self.temperatureChanged.emit(temp)
    
car = Car()

def on_temp_changed(temp):
    print("Car temperature changed to {0}".format(temp))

car.temperatureChanged.connect(on_temp_changed)

car.set_temperature(13.4)
set_cache(*args, **kwargs)[source]

Fills the cache without actually emitting the signal. Not part of the API. It is a helper method for signal owners to use as necessary.

slots()[source]

Returns the list of connected slots.

connect(slot)[source]

Connect a slot to this signal.

disconnect(slot)[source]

Disconnect the slot from this signal.

emit(*args, **kwargs)[source]

emit signal.