Skip to main content

Python Signal Library to mimic the Qt Signal system for event driven connections

Project description

# PySignal

A Qt style signal implementation that doesn't require QObjects.
This supports class methods, functions, lambdas and partials.

Signals can either be created on the instance or on the class, and can be handled either as objects or by string name.
Unlike PyQt signals, PySignals do not enforce types by default as I believe this is more pythonic.

## Install

You can install this using pip

pip install PySignal

This is compatible with Python 2.7+ and 3.x

## Usage:

def greet(name):
print "Hello,", name

class Foo(object):
started = ClassSignal()

def __init__(self):
super(Foo, self).__init__()

self.signalFactory = SignalFactory()

foo = Foo()
# Hello, Watson
# Hello, SHerlock

## Signal Types

There are 4 types of Signals included

* `Signal` is the base implementation of the Signal and can be created on a per instance level.
* `ClassSignal` is an object that can be created as a class variable and will act like a signal.
This ensures that all instances of your class will have the signal, but can be managed individually.
* `SignalFactory` allows you to have a single signal object on your class that can generate signals by name.
* `ClassSignalFactory` is the same as a signal factory but lives on the class instead of the instance.

## Changelog

### 1.1.0

* no longer imports the PySignal module and instead parses it.
* Test Coverage has been expanded to 97%
* Slots can no longer be attached multiple times which used to cause them firing multiple times.
* Using callable to find if slot is lambda

### 1.0.1

* Initial Release

## Based on these implementations

## Contributors

Many thanks to:

* Alex Widener for cleaning up my
* Adric Worley for expanding test coverage, cleaning up the code and fixing a duplicate connection bug.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

PySignal-1.1.0.tar.gz (4.3 kB view hashes)

Uploaded source

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page