uitk is a versatile package for managing user interfaces, widgets, and event handling in Python using PySide2. Using naming convention, the switchboard module provides a convenient way to load UI files, register custom widgets, manage slots and styles, and interact with widgets. It aims to simplify the development and management of complex user interfaces.
Project description
UITK
uitk is a versatile package for managing user interfaces, widgets, and event handling in Python using PySide2. Using naming convention, the switchboard module provides a convenient way to load UI files, register custom widgets, manage slots and styles, and interact with widgets. It aims to simplify the development and management of complex user interfaces.
Features
- Dynamically load UI files
- Register and use custom widgets
- Subclass the MainWindows with utility properties
- Initialize child widgets with utility properties
- Manages slot connections and event handling
- Supports UI heirarchy navigation and submenus
- Supports UI tags for custom event behavior.
- Store and retrieve UI and slot history
- Garbage collection protection for widgets
Design:
Module | Description |
---|---|
switchboard | Load dynamic UI, assign convenience properties, and handle slot connections. |
events | Event handling for dynamic UI widgets. |
stylesheet | Define stylesheet presets and have them auto applied to your UI on initialization. |
widgets | A source directory for custom widgets. |
Installation:
To install:
Add the uitk
folder to a directory on your python path, or
install via pip in a command line window using:
python -m pip install uitk
Basic Example:
Create an instance of Switchboard to load your dynamic ui.
from uitk import Switchboard
class MyProject():
...
class MySlots(MyProject):
def __init__(self):
self.sb = self.get_switchboard_instance()
def MyButtonsObjectName(self):
print("Button clicked!")
sb = Switchboard(slots_location=MySlots)
ui = sb.example #Get the UI using it's name (or sb.getUi(<name>))
print ('ui:'.ljust(20), sb.ui) #The current UI
print ('ui name:'.ljust(20), ui.name) #The UI's filename.
print ('ui path:'.ljust(20), ui.path) #The directory path containing the UI file
print ('ui tags:'.ljust(20), ui.tags) #Any UI tags as a list
print ('ui level:'.ljust(20), ui.level) #The UI level
print ('is current ui:'.ljust(20), ui.isCurrentUi) #True if the UI is set as current
print ('is submenu:'.ljust(20), ui.isSubmenu) #True if the UI is a submenu
print ('is connected:'.ljust(20), ui.isConnected) #True if the UI is connected to its slots
print ('is initialized:'.ljust(20), ui.isInitialized) #True after the UI is first shown
print ('slots:'.ljust(20), ui.slots) #The associated slots class instance
print ('method:'.ljust(20), ui.MyButtonsObjectName.getSlot()) #The associated slot
print ('widget from method:'.ljust(20), sb.getWidgetFromMethod(ui.MyButtonsObjectName.getSlot()))
print ('widget:'.ljust(20), ui.MyButtonsObjectName) #Get a widget from the UI by it's name
print ('all widgets:'.ljust(20), [(w.name or w.type) for w in ui.widgets]) #All widgets of the UI
ui.show(app_exec=True)
Advanced Example:
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.