Template-based widgets and form helpers for PyQt6 applications
Project description
pyqt6-template-widgets
Template-based widgets and form helpers for PyQt6 applications. The library helps build simple data-driven interfaces from reusable card, list and form templates.
CardTemplate— card layout in a list;FormTemplateandFormField— add/edit form;TemplateListPage— list with search, filter, sort, CRUD;PageManager— switch between login and list screens;- partner-management preset on top of the template widgets;
- calculation helpers for sample business rules.
Installation
pip install pyqt6-template-widgets
Template window
from pyqt6_templates import CardTemplate, FormField, FormTemplate, TemplateListWindow
items = [
{
"partner_type": "Дилер",
"name": "ООО Ромашка",
"director": "Иванов Иван Иванович",
"phone": "+7 223 322 22 32",
"rating": 10,
"discount": 10,
}
]
card_template = CardTemplate(
title="{partner_type} | {name}",
lines=["{director}", "{phone}", "Рейтинг: {rating}"],
badge="{discount}%",
)
form_template = FormTemplate(
title_create="Добавить партнера",
title_edit="Редактировать партнера",
fields=[
FormField("name", "Наименование:", required=True),
FormField("partner_type", "Тип:", kind="choice", choices=["Дилер", "Оптовик"]),
FormField("rating", "Рейтинг:", kind="number", minimum=0),
FormField("director", "Директор:", required=True),
FormField("phone", "Телефон:", required=True),
],
)
window = TemplateListWindow(
title="Список партнеров",
items=items,
card_template=card_template,
form_template=form_template,
)
window.run()
See examples/template_window.py.
Full shoe store app (login + products + orders)
After install:
pip install pyqt6-template-widgets
pyqt6-shoe-store
Other ways to run:
python -m pyqt6_templates.apps
python -m pyqt6_templates.apps.shoe_store
Open the application source (login, list pages, main window):
python -c "from pyqt6_templates.apps import app_source_path; print(app_source_path())"
Test accounts: client1/123, manager1/123, admin1/123, or guest login.
From a git checkout:
python examples/shoe_store.py
Partner preset
from pyqt6_templates import Partner, PartnerListWindow
partner = Partner(
partner_type="Дилер",
name="ООО Ромашка",
director="Иванов Иван Иванович",
phone="+7 223 322 22 32",
rating=10,
total_sales=62000,
)
window = PartnerListWindow(
partners=[partner],
partner_types=["Дилер", "Оптовик"],
)
window.run()
Calculation helpers
from pyqt6_templates import calculate_partner_discount, calculate_required_material
discount = calculate_partner_discount(62000)
material = calculate_required_material(
product_type_id=1,
material_type_id=2,
product_count=10,
parameter_1=2.5,
parameter_2=3.0,
product_type_coefficients={1: 1.2},
material_defect_rates={2: 0.05},
)
PyPI build
python -m pip install build twine
python -m build
python -m twine check dist/*
python -m twine upload dist/*
See docs/PYPI_UPDATE.md for version bump workflow.
What's new in 0.3.0
- full shoe store app bundled:
pyqt6-shoe-storecommand form_helpers:open_form_window,close_form,check_role,confirm_delete- English hover docstrings on all main API
pyqt6_templates.apps.shoe_store— complete reference application
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pyqt6_template_widgets-0.3.0.tar.gz.
File metadata
- Download URL: pyqt6_template_widgets-0.3.0.tar.gz
- Upload date:
- Size: 25.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bbccf4fa580a89f874bd41106a0be588537d7cff727175151fbb8918c1a7d956
|
|
| MD5 |
4ced54b80f406ef0fdc21485ecfc78dc
|
|
| BLAKE2b-256 |
5e4643d1231dcf5eb78539e38c61af91f2ef4007aba66dffb957d7a9afa10f4a
|
File details
Details for the file pyqt6_template_widgets-0.3.0-py3-none-any.whl.
File metadata
- Download URL: pyqt6_template_widgets-0.3.0-py3-none-any.whl
- Upload date:
- Size: 33.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
556c7e9293593e3a39545bb99704c1e6f1d387325023ce1592b22801695d0ad1
|
|
| MD5 |
6d88977eaff52dac307243290735e620
|
|
| BLAKE2b-256 |
0333029a7e1fb04758763dfb23b4f627da19466c89b41becb26974b7fc0a430f
|