TTkTableProxyEdit🌶️
- class TTkTableProxyEdit[source]🌶️
Bases:
objectProxy class for managing table cell editors
Creates and configures appropriate editor widgets based on cell data type. All editors implement the
TTkTableProxyEditWidgetprotocol.Automatically selects the correct editor type:
_BoolListProxyfor boolean values_ListBaseProxyforTTkCellListTypeBasevalues_SpinBoxProxyfor int and float values_TextEditProxyfor plain text strings_TextPickerProxyfor rich text (TTkString with formatting)_DateTime_DateProxyfor datetime.date values_DateTime_TimeProxyfor datetime.time values_DateTime_DateTimeProxyfor datetime.datetime values
Example usage:
proxy = TTkTableProxyEdit() # Get editor for numeric data editor = proxy.getProxyWidget(data=42, flags=TTkTableProxyEditFlag.BASE) # Get editor for rich text rich_text = TTkString("Hello", TTkColor.BOLD) editor = proxy.getProxyWidget(data=rich_text, flags=TTkTableProxyEditFlag.RICH) if editor: editor.leavingTriggered.connect(handleNavigation) editor.dataChanged.connect(handleDataChange)
Initialize the table proxy edit manager
Sets up the default proxy definitions for all supported data types. Proxies are checked in order, with custom proxies taking precedence.
Methods🌶️
- addProxy(proxy: TTkProxyEditDef) None[source]🌶️
Add a custom proxy definition to the manager
Custom proxies are inserted at the beginning of the list, so they take precedence over default proxies.
- Parameters:
proxy (TTkProxyEditDef) – The proxy definition to add
- getProxyWidget(data, flags: ~TermTk.TTkWidgets.TTkModelView.table_edit_proxy.TTkTableProxyEditFlag = <TTkTableProxyEditFlag.BASE: 1>) TTkTableProxyEditWidget | None[source]🌶️
Get an appropriate editor widget for the given data
Searches through registered proxy definitions to find one that matches the data type and requested flags. Returns the first match.
- Parameters:
data (object) – The data value to edit
flags (TTkTableProxyEditFlag) – Flags indicating editor capabilities (BASE or RICH)
- Returns:
An editor widget instance, or None if no suitable editor found
- Return type:
Optional[TTkTableProxyEditWidget]