TTkTableProxyEdit

TTkTableProxyEdit🌶️

class TTkTableProxyEdit[source]🌶️

Bases: object

Proxy class for managing table cell editors

Creates and configures appropriate editor widgets based on cell data type. All editors implement the TTkTableProxyEditWidget protocol.

Automatically selects the correct editor type:

  • _BoolListProxy for boolean values

  • _ListBaseProxy for TTkCellListTypeBase values

  • _SpinBoxProxy for int and float values

  • _TextEditProxy for plain text strings

  • _TextPickerProxy for rich text (TTkString with formatting)

  • _DateTime_DateProxy for datetime.date values

  • _DateTime_TimeProxy for datetime.time values

  • _DateTime_DateTimeProxy for 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]