Skip to main content

A PyQt6 mediator mixin

Project description

PyQt6 Mediator Mixin

PyQt6 Mediator Mixin is a Python library that enhances PyQt6's signal-slot mechanism by implementing the mediator pattern. This pattern allows classes to emit and receive signals without knowing about each other, leading to more modular and maintainable code.

Key features:

  • Mediator pattern implementation for PyQt6 signals.
  • Ability to extend the SignalCode enum for custom signals.

Installation

pip install PyQt6-mediator-mixin

Usage

from PyQt6_mediator_mixin.mediator_mixin import MediatorMixin
from PyQt6_mediator_mixin.enums import SignalCode

class MyClass(MediatorMixin):
    def __init__(self):
        super().__init__()
        self.register(SignalCode.MY_SIGNAL, self.my_slot_function)

    def my_slot_function(self, data):
        print("Received signal with data:", data)

    def some_method(self):
        self.emit(SignalCode.MY_SIGNAL, "some data")

Extending SignalCode Enum

from enum import Enum
from PyQt6_mediator_mixin.signal_code_factory import set_signal_code

class MySignalCode(Enum):
    MY_SIGNAL_1 = 1
    MY_SIGNAL_2 = 2

set_signal_code(MySignalCode)

Now, MyClass can register and emit MY_SIGNAL_1 and MY_SIGNAL_2 using the MediatorMixin.

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

PyQt6-mediator-mixin-1.0.1.tar.gz (14.1 kB view details)

Uploaded Source

Built Distribution

PyQt6_mediator_mixin-1.0.1-py3-none-any.whl (14.1 kB view details)

Uploaded Python 3

File details

Details for the file PyQt6-mediator-mixin-1.0.1.tar.gz.

File metadata

  • Download URL: PyQt6-mediator-mixin-1.0.1.tar.gz
  • Upload date:
  • Size: 14.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.18

File hashes

Hashes for PyQt6-mediator-mixin-1.0.1.tar.gz
Algorithm Hash digest
SHA256 4a1bca6c43add0251fa6159b7fd0402a5a6ad216100df390c0b1c3728bbee3a6
MD5 c32e7b1bb51362a36be900ed587842da
BLAKE2b-256 4e6dc7a279c4ec9166e8c992f5e47fb6dd268bf0c86cce51bf77ab79f600c357

See more details on using hashes here.

File details

Details for the file PyQt6_mediator_mixin-1.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for PyQt6_mediator_mixin-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 5bbfee6bf29face59296291152d938f78b3032ee0f9e2e1d2898e288d8ea9b55
MD5 a122f4890644a8868af6135d9bc49ebc
BLAKE2b-256 3ab03822abdb95dc1d867cf4db14c4676b33ac7a40c1eec68777b07f1a540cfa

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page