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
SignalCodeenum 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.
Metadata
Release files for PyQt6-mediator-mixin 1.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| PyQt6-mediator-mixin-1.0.3.tar.gz | 14.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| PyQt6_mediator_mixin-1.0.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 28.5 kB
Release files / PyQt6-mediator-mixin-1.0.3.tar.gz
| Download URL | PyQt6-mediator-mixin-1.0.3.tar.gz |
|---|---|
| Size | 14.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d07d0db7b7d756a1082a679e83966efd0c4048272b658ddd9a09d0e4f4a1a940
|
|
BLAKE2b-256 checksum How to use checksums |
0b780ce2478e2e423475622644f6085866b48229504837be6bee64e2bd4b2ddf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.18
|
Release files / PyQt6_mediator_mixin-1.0.3-py3-none-any.whl
| Download URL | PyQt6_mediator_mixin-1.0.3-py3-none-any.whl |
|---|---|
| Size | 14.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
936ff9fa03d5a82a51357fa24b715bd3185249e7f08fef458e56faf457d4eafa
|
|
BLAKE2b-256 checksum How to use checksums |
35d2163fdcb17d86ba68ec6f747134bf51648338249e366a2017b69c6fd94d0f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.18
|