Browse Source

Massive rework of the :class: resove links

pull/278/head
Eugenio Parodi 1 year ago
parent
commit
0677162a1e
  1. 89
      TermTk/TTkAbstract/abstractscrollview.py
  2. 38
      TermTk/TTkAbstract/abstracttablemodel.py
  3. 10
      TermTk/TTkCore/TTkTerm/inputkey.py
  4. 6
      TermTk/TTkCore/TTkTerm/inputmouse.py
  5. 6
      TermTk/TTkCore/color.py
  6. 18
      TermTk/TTkCore/constant.py
  7. 6
      TermTk/TTkCore/signal.py
  8. 20
      TermTk/TTkCore/string.py
  9. 2
      TermTk/TTkCore/ttk.py
  10. 32
      TermTk/TTkLayouts/gridlayout.py
  11. 26
      TermTk/TTkLayouts/layout.py
  12. 8
      TermTk/TTkTemplates/dragevents.py
  13. 6
      TermTk/TTkTemplates/keyevents.py
  14. 18
      TermTk/TTkTemplates/mouseevents.py
  15. 18
      TermTk/TTkUiTools/uiloader.py
  16. 196
      TermTk/TTkWidgets/TTkModelView/table.py
  17. 2
      TermTk/TTkWidgets/TTkModelView/tablemodelcsv.py
  18. 2
      TermTk/TTkWidgets/TTkModelView/tablemodellist.py
  19. 117
      TermTk/TTkWidgets/TTkModelView/tablewidget.py
  20. 28
      TermTk/TTkWidgets/TTkModelView/treewidget.py
  21. 67
      TermTk/TTkWidgets/TTkPickers/filepicker.py
  22. 30
      TermTk/TTkWidgets/button.py
  23. 54
      TermTk/TTkWidgets/checkbox.py
  24. 12
      TermTk/TTkWidgets/combobox.py
  25. 8
      TermTk/TTkWidgets/container.py
  26. 2
      TermTk/TTkWidgets/frame.py
  27. 6
      TermTk/TTkWidgets/menu.py
  28. 25
      TermTk/TTkWidgets/radiobutton.py
  29. 120
      TermTk/TTkWidgets/texedit.py
  30. 36
      TermTk/TTkWidgets/widget.py
  31. 5
      docs/source/conf.py
  32. 4
      docs/source/info/resources/clipboard.rst
  33. 2
      docs/source/info/resources/modal.rst
  34. 79
      docs/source/sphinx_modules/sphinx_PyRefRole_hacked.py
  35. 42
      docs/source/sphinx_modules/sphinx_ext_autosummary_reworked.py
  36. 1
      docs/source/templates/custom-class-template.01.rst
  37. 2
      docs/source/templates/custom-module-template.01.rst

89
TermTk/TTkAbstract/abstractscrollview.py

@ -30,6 +30,8 @@ from TermTk.TTkLayouts.layout import TTkLayout
from TermTk.TTkLayouts.gridlayout import TTkGridLayout
class TTkAbstractScrollViewInterface():
'''TTkAbstractScrollViewInterface'''
# Override this function
def viewFullAreaSize(self) -> (int, int):
raise NotImplementedError()
@ -46,6 +48,34 @@ class TTkAbstractScrollViewInterface():
return self._viewOffsetX, self._viewOffsetY
class TTkAbstractScrollView(TTkContainer, TTkAbstractScrollViewInterface):
'''TTkAbstractScrollView'''
viewMovedTo:pyTTkSignal
'''
This signal is emitted when the view content move to a new position (x,y),
:param x: the new horizontal offset
:type x: int
:param y: the new vertical offset
:type y: int
'''
viewSizeChanged:pyTTkSignal
'''
This signal is emitted when the view content size changed
:param width: the new width
:type width: int
:param height: the new heighht
:type height: int
'''
viewChanged:pyTTkSignal
'''
This signal is emitted whenever there is a change in the view content topology (size,pos)
.. note:: This signal must be implemented in any implementation
of :py:class:`TTkAbstractScrollView` to notify that the view content boudaries changed
'''
__slots__ = (
'_viewOffsetX', '_viewOffsetY',
# Signals
@ -98,6 +128,34 @@ class TTkAbstractScrollView(TTkContainer, TTkAbstractScrollViewInterface):
return super().update(repaint, updateLayout, updateParent)
class TTkAbstractScrollViewLayout(TTkLayout, TTkAbstractScrollViewInterface):
'''TTkAbstractScrollViewLayout'''
viewMovedTo:pyTTkSignal
'''
This signal is emitted when the view content move to a new position (x,y),
:param x: the new horizontal offset
:type x: int
:param y: the new vertical offset
:type y: int
'''
viewSizeChanged:pyTTkSignal
'''
This signal is emitted when the view content size changed
:param width: the new width
:type width: int
:param height: the new heighht
:type height: int
'''
viewChanged:pyTTkSignal
'''
This signal is emitted whenever there is a change in the view content topology (size,pos)
.. note:: This signal must be implemented in any implementation
of :py:class:`TTkAbstractScrollView` to notify that the view content boudaries changed
'''
__slots__ = (
'_viewOffsetX', '_viewOffsetY',
# Signals
@ -130,10 +188,39 @@ class TTkAbstractScrollViewLayout(TTkLayout, TTkAbstractScrollViewInterface):
self.viewChanged.emit()
class TTkAbstractScrollViewGridLayout(TTkGridLayout, TTkAbstractScrollViewInterface):
'''TTkAbstractScrollViewGridLayout'''
viewMovedTo:pyTTkSignal
'''
This signal is emitted when the view content move to a new position (x,y),
:param x: the new horizontal offset
:type x: int
:param y: the new vertical offset
:type y: int
'''
viewSizeChanged:pyTTkSignal
'''
This signal is emitted when the view content size changed
:param width: the new width
:type width: int
:param height: the new heighht
:type height: int
'''
viewChanged:pyTTkSignal
'''
This signal is emitted whenever there is a change in the view content topology (size,pos)
.. note:: This signal is normally emitted from any implementation
of :py:class:`TTkAbstractScrollView` to notify that the view content boudaries changed
'''
__slots__ = (
'_viewOffsetX', '_viewOffsetY',
'_excludeEvent',
# Signals
'viewMovedTo', 'viewSizeChanged', 'viewChanged', '_excludeEvent')
'viewMovedTo', 'viewSizeChanged', 'viewChanged')
def __init__(self, *args, **kwargs):
# Signals

38
TermTk/TTkAbstract/abstracttablemodel.py

@ -28,16 +28,16 @@ from TermTk.TTkCore.signal import pyTTkSignal, pyTTkSlot
class TTkModelIndex():
'''
This class is used as an index into item models derived from :class:`~TermTk.TTkAbstract.abstracttablemodel.TTkAbstractTableModel`.
This class is used as an index into item models derived from :py:class:`TTkAbstractTableModel`.
The index is used by item views, delegates, and selection models to locate an item in the model.
New :class:`~TermTk.TTkAbstract.abstracttablemodel.TTkModelIndex` objects are created by the model using the :class:`~TermTk.TTkAbstract.abstracttablemodel.TTkAbstractTableModel` -> :meth:`~TermTk.TTkAbstract.abstracttablemodel.TTkAbstractTableModel.index` function.
An invalid model index can be constructed with the :class:`~TermTk.TTkAbstract.abstracttablemodel.TTkModelIndex` constructor.
New :py:class:`TTkModelIndex` objects are created by the model using the :py:class:`TTkAbstractTableModel` -> :meth:`~TermTk.TTkAbstract.abstracttablemodel.TTkAbstractTableModel.index` function.
An invalid model index can be constructed with the :py:class:`TTkModelIndex` constructor.
Model indexes refer to items in models, and contain all the information required to specify their locations in those models.
Each index is located in a given row and column; use :meth:`row`, :meth:`column`, and :meth:`data` to obtain this information.
To obtain a model index that refers to an existing item in a model, call :class:`~TermTk.TTkAbstract.abstracttablemodel.TTkAbstractTableModel` -> :meth:`~TermTk.TTkAbstract.abstracttablemodel.TTkAbstractTableModel.index` with the required row and column values.
To obtain a model index that refers to an existing item in a model, call :py:class:`TTkAbstractTableModel` -> :meth:`~TermTk.TTkAbstract.abstracttablemodel.TTkAbstractTableModel.index` with the required row and column values.
'''
def __init__(self) -> None:
pass
@ -97,27 +97,27 @@ class _TTkModelIndexList(TTkModelIndex):
class TTkAbstractTableModel():
'''
:class:`TTkAbstractTableModel` provides a standard interface for
:py:class:`TTkAbstractTableModel` provides a standard interface for
models that represent their data as a two-dimensional array of items.
It is not used directly, but must be subclassed.
Since the model provides a more specialized interface than :class:`~TermTk.TTkAbstract.abstractitemmodel.TTkAbstractItemModel`,
Since the model provides a more specialized interface than :py:class:`TTkAbstractItemModel`,
it is not suitable for use with tree views.
The :meth:`rowCount` and :meth:`columnCount` functions return the dimensions of the table.
**Subclassing**
When subclassing :class:`TTkAbstractTableModel`, you must implement :meth:`rowCount`, :meth:`columnCount`, and :meth:`data`.
When subclassing :py:class:`TTkAbstractTableModel`, you must implement :meth:`rowCount`, :meth:`columnCount`, and :meth:`data`.
Well behaved models will also implement :meth:`headerData`.
Editable models need to implement :meth:`setData`.
**Built-In Implementation**
:class:`~TermTk.TTkWidgets.TTkModelView.tablemodellist.TTkTableModelList` basic subclass implementing a 2d list as data structure
:py:class:`TTkTableModelList` basic subclass implementing a 2d list as data structure
:class:`~TermTk.TTkWidgets.TTkModelView.tablemodelcsv.TTkTableModelCSV` subclass of :class:`~TermTk.TTkWidgets.TTkModelView.tablemodellist.TTkTableModelList` including the api to import csv data
:py:class:`TTkTableModelCSV` subclass of :py:class:`TTkTableModelList` including the api to import csv data
'''
@ -126,7 +126,7 @@ class TTkAbstractTableModel():
'dataChanged'
)
dataChanged:pyTTkSignal[int,int]
dataChanged:pyTTkSignal
'''
This signal is emitted whenever the data in an existing item changes.
@ -168,7 +168,7 @@ class TTkAbstractTableModel():
:param col: the column position of the index
:type col: int
:return: :class:`~TermTk.TTkAbstract.abstracttablemodel.TTkModelIndex`
:return: :py:class:`TTkModelIndex`
'''
return _TTkModelIndexList(row,col,self)
@ -208,14 +208,14 @@ class TTkAbstractTableModel():
def ttkStringData(self, row:int, col:int) -> TTkString:
'''
Returns the :class:`~TermTk.TTkCore.string.TTkString` reprsents the ddata stored in the row/column.
Returns the :py:class:`TTkString` reprsents the ddata stored in the row/column.
:param row: the row position of the data
:type row: int
:param col: the column position of the data
:type col: int
:return: :class:`~TermTk.TTkCore.string.TTkString`
:return: :py:class:`TTkString`
'''
data = self.data(row,col)
if isinstance(data,TTkString):
@ -235,9 +235,9 @@ class TTkAbstractTableModel():
:param pos: the position (col or row) of the header
:type pos: int
:param orientation: the orienttin of the header to be retrieved
:type orientation: :class:`~TermTk.TTkCore.constant.TTkConstant.Direction`
:type orientation: :py:class:`~TermTk.TTkCore.constant.TTkConstant.Direction`
:return: :class:`~TermTk.TTkCore.string.TTkString`
:return: :py:class:`TTkString`
'''
if orientation==TTkK.HORIZONTAL:
return TTkString(str(pos))
@ -250,15 +250,15 @@ class TTkAbstractTableModel():
Returns the item flags for the given row,column.
The base class implementation returns a combination of flags that
enables the item (:class:`~TermTk.TTkCore.constant.TTkConstant.ItemFlag.ItemIsEnabled`)
and allows it to be selected (:class:`~TermTk.TTkCore.constant.TTkConstant.ItemFlag.ItemIsSelectable`).
enables the item (:py:class:`~TermTk.TTkCore.constant.TTkConstant.ItemFlag.ItemIsEnabled`)
and allows it to be selected (:py:class:`~TermTk.TTkCore.constant.TTkConstant.ItemFlag.ItemIsSelectable`).
:param row: the row position od the data
:type row: int
:param col: the column position of the data
:type col: int
:return: :class:`~TermTk.TTkCore.constant.TTkConstant.ItemFlag`
:return: :py:class:`~TermTk.TTkCore.constant.TTkConstant.ItemFlag`
'''
return (
TTkK.ItemFlag.ItemIsEnabled |
@ -271,6 +271,6 @@ class TTkAbstractTableModel():
:param column: The column index to be sorted, if -1 is provided the original unsorted order is used.
:type column: int
:param order: the sorting order
:type order: :class:`~TermTk.TTkCore.constant.TTkConstant.SortOrder`
:type order: :py:class:`~TermTk.TTkCore.constant.TTkConstant.SortOrder`
'''
pass

10
TermTk/TTkCore/TTkTerm/inputkey.py

@ -30,18 +30,18 @@ class TTkKeyEvent:
:Demo: `test.input.py <https://github.com/ceccopierangiolieugenio/pyTermTk/blob/main/tests/test.input.py>`_
:param type: The key input type recorded
:type type: :class:`~TermTk.TTkCore.constant.TTkConstant.KeyType`
:type type: :py:class:`~TermTk.TTkCore.constant.TTkConstant.KeyType`
:param key: the key
:type key: str
:param code: The terminal code used to represent this input
:type code: str
:param mod: The modifier used by the :class:`~TermTk.TTkCore.constant.TTkConstant.KeyType.SpecialKey` type
:type mod: :class:`~TermTk.TTkCore.constant.TTkConstant.KeyModifier`
:param mod: The modifier used by the :py:class:`~TermTk.TTkCore.constant.TTkConstant.KeyType.SpecialKey` type
:type mod: :py:class:`~TermTk.TTkCore.constant.TTkConstant.KeyModifier`
.. py:attribute:: type
:type: KeyType
The key input :class:`~TermTk.TTkCore.constant.TTkConstant.KeyType` recorded
The key input :py:class:`~TermTk.TTkCore.constant.TTkConstant.KeyType` recorded
.. py:attribute:: key
:type: str
@ -56,7 +56,7 @@ class TTkKeyEvent:
.. py:attribute:: mod
:type: KeyModifier
The :class:`~TermTk.TTkCore.constant.TTkConstant.KeyModifier` used by the :class:`~TermTk.TTkCore.constant.TTkConstant.KeyType.SpecialKey` type
The :py:class:`~TermTk.TTkCore.constant.TTkConstant.KeyModifier` used by the :py:class:`~TermTk.TTkCore.constant.TTkConstant.KeyType.SpecialKey` type
'''
__slots__ = ('type', 'key', 'code', 'mod')

6
TermTk/TTkCore/TTkTerm/inputmouse.py

@ -42,17 +42,17 @@ class TTkMouseEvent:
.. py:attribute:: key
:type: MouseKey
The :class:`~TermTk.TTkCore.constant.TTkConstant.MouseKey` reported in this event (i.e. :class:`~TermTk.TTkCore.constant.TTkConstant.MouseKey.LeftButton`)
The :py:class:`~TermTk.TTkCore.constant.TTkConstant.MouseKey` reported in this event (i.e. :py:class:`~TermTk.TTkCore.constant.TTkConstant.MouseKey.LeftButton`)
.. py:attribute:: mod
:type: KeyModifier
The :class:`~TermTk.TTkCore.constant.TTkConstant.KeyModifier` used, default :class:`~TermTk.TTkCore.constant.TTkConstant.KeyModifier.NoModifier`
The :py:class:`~TermTk.TTkCore.constant.TTkConstant.KeyModifier` used, default :py:class:`~TermTk.TTkCore.constant.TTkConstant.KeyModifier.NoModifier`
.. py:attribute:: evt
:type: MouseEvent
The :class:`~TermTk.TTkCore.constant.TTkConstant.MouseEvent` reported in this event (i.e. :class:`~TermTk.TTkCore.constant.TTkConstant.MouseKey.Press`)
The :py:class:`~TermTk.TTkCore.constant.TTkConstant.MouseEvent` reported in this event (i.e. :py:class:`~TermTk.TTkCore.constant.TTkConstant.MouseKey.Press`)
.. py:attribute:: tap
:type: int

6
TermTk/TTkCore/color.py

@ -492,7 +492,7 @@ class TTkColor(_TTkColor):
:param str modifier: (experimental) the color modifier to be used to improve the **kinkiness**
:type modifier: TTkColorModifier, optional
:return: :class:`TTkColor`
:return: :py:class:`TTkColor`
'''
mod = kwargs.get('modifier', None )
link = kwargs.get('link', '' )
@ -519,7 +519,7 @@ class TTkColor(_TTkColor):
:param str modifier: (experimental) the color modifier to be used to improve the **kinkiness**
:type modifier: TTkColorModifier, optional
:return: :class:`TTkColor`
:return: :py:class:`TTkColor`
'''
mod = kwargs.get('modifier', None )
link = kwargs.get('link', '' )
@ -548,7 +548,7 @@ class TTkColor(_TTkColor):
:param str modifier: (experimental) the color modifier to be used to improve the **kinkiness**
:type modifier: TTkColorModifier, optional
:return: :class:`TTkColor`
:return: :py:class:`TTkColor`
'''
return TTkColor(fg=TTkColor.hexToRGB(fg), bg=TTkColor.hexToRGB(bg), colorMod=modifier, link=link)

18
TermTk/TTkCore/constant.py

@ -121,7 +121,7 @@ class TTkConstant:
Checked = CheckState.Checked
class InsertPolicy(int):
'''Specifies what the :class:`~TermTk.TTkWidgets.combobox.TTkComboBox` should do when a new string is entered by the user.
'''Specifies what the :py:class:`TTkComboBox` should do when a new string is entered by the user.
.. autosummary::
NoInsert
@ -201,7 +201,7 @@ class TTkConstant:
class MouseKey(int):
'''Input Mouse Key
Events reported by :class:`~TermTk.TTkCore.TTkTerm.inputmouse.TTkMouseEvent` -> :class:`~TermTk.TTkCore.TTkTerm.inputmouse.TTkMouseEvent.key`
Events reported by :py:class:`TTkMouseEvent` -> :py:class:`~TermTk.TTkCore.TTkTerm.inputmouse.TTkMouseEvent.key`
.. autosummary::
NoButton
@ -248,7 +248,7 @@ class TTkConstant:
WordWrap = 0x01
'''Text is wrapped at word boundaries.'''
# ManualWrap = 0x02
# '''Same as :class:`~TermTk.TTkCore.constant.TTkConstant.WrapMode.NoWrap`'''
# '''Same as :py:class:`~TermTk.TTkCore.constant.TTkConstant.WrapMode.NoWrap`'''
WrapAnywhere = 0x03
'''Text can be wrapped at any point on a line, even if it occurs in the middle of a word.'''
WrapAtWordBoundaryOrAnywhere = 0x04
@ -284,7 +284,7 @@ class TTkConstant:
class MouseEvent(int):
'''Input Mouse Event
Events reported by :class:`~TermTk.TTkCore.TTkTerm.inputmouse.TTkMouseEvent` -> :class:`~TermTk.TTkCore.TTkTerm.inputmouse.TTkMouseEvent.evt`
Events reported by :py:class:`TTkMouseEvent` -> :py:class:`~TermTk.TTkCore.TTkTerm.inputmouse.TTkMouseEvent.evt`
.. autosummary::
NoEvent
@ -425,7 +425,7 @@ class TTkConstant:
'''A combination of Clear and Select, provided for convenience.'''
class ItemFlag(int):
''':class:`ItemFlag` describes the properties of an item
''':py:class:`ItemFlag` describes the properties of an item
.. autosummary::
NoItemFlags
@ -506,7 +506,7 @@ class TTkConstant:
class KeyType(int):
'''Input Key Types
Key type reported by :class:`~TermTk.TTkCore.TTkTerm.inputkey.TTkKeyEvent` -> :class:`~TermTk.TTkCore.TTkTerm.inputkey.TTkKeyEvent.key`
Key type reported by :py:class:`TTkKeyEvent` -> :py:class:`~TermTk.TTkCore.TTkTerm.inputkey.TTkKeyEvent.key`
.. autosummary::
Character
@ -522,9 +522,9 @@ class TTkConstant:
class KeyModifier(int):
'''Input :class:`~TermTk.TTkCore.constant.TTkConstant.KeyType.SpecialKey` modifiers
'''Input :py:class:`~TermTk.TTkCore.constant.TTkConstant.KeyType.SpecialKey` modifiers
Modifier reported by :class:`~TermTk.TTkCore.TTkTerm.inputkey.TTkKeyEvent` -> :class:`~TermTk.TTkCore.TTkTerm.inputkey.TTkKeyEvent.mod`
Modifier reported by :py:class:`TTkKeyEvent` -> :py:class:`~TermTk.TTkCore.TTkTerm.inputkey.TTkKeyEvent.mod`
.. autosummary::
NoModifier
@ -578,7 +578,7 @@ class TTkConstant:
class ShortcutContext(int):
'''
For a :class:`~TermTk.TTkCore.shortcut.TTkShortcut` event to occur,
For a :py:class:`TTkShortcut` event to occur,
the shortcut's key sequence must be entered by the user in a context where the shortcut is active.
The possible contexts are these:

6
TermTk/TTkCore/signal.py

@ -69,9 +69,9 @@ def pyTTkSlot(*args):
return func
return pyTTkSlot_d
Ts = TypeVarTuple("Ts")
class pyTTkSignal(Generic[*Ts]):
# Ts = TypeVarTuple("Ts")
# class pyTTkSignal(Generic[*Ts]):
class pyTTkSignal():
_signals = []
__slots__ = ('_types', '_connected_slots', '_mutex')
def __init__(self, *args, **kwargs):

20
TermTk/TTkCore/string.py

@ -37,8 +37,8 @@ class TTkString():
:param text: text of the string, defaults to ""
:type text: str, optional
:param color: the color of the string, defaults to :class:`~TermTk.TTkCore.color.TTkColor.RST`
:type color: :class:`~TermTk.TTkCore.color.TTkColor`, optional
:param color: the color of the string, defaults to :py:class:`~TermTk.TTkCore.color.TTkColor.RST`
:type color: :py:class:`TTkColor`, optional
Example:
@ -321,10 +321,10 @@ class TTkString():
:param width: the new width
:type width: int, optional
:param color: the color of the padding, defaults to :class:`~TermTk.TTkCore.color.TTkColor.RST`
:type color: :class:`~TermTk.TTkCore.color.TTkColor`, optional
:param alignment: the alignment of the text to the full width :class:`~TermTk.TTkCore.constant.TTkConstant.Alignment.NONE`
:type alignment: :class:`~TermTk.TTkCore.constant.TTkConstant.Alignment`, optional
:param color: the color of the padding, defaults to :py:class:`~TermTk.TTkCore.color.TTkColor.RST`
:type color: :py:class:`TTkColor`, optional
:param alignment: the alignment of the text to the full width :py:class:`~TermTk.TTkCore.constant.TTkConstant.Alignment.NONE`
:type alignment: :py:class:`~TermTk.TTkCore.constant.TTkConstant.Alignment`, optional
'''
lentxt = self.termWidth()
if not width or width == lentxt: return self
@ -450,8 +450,8 @@ class TTkString():
If only the color is specified, the entire string is colorized
:param color: the color to be used, defaults to :class:`~TermTk.TTkCore.color.TTkColor.RST`
:type color: :class:`~TermTk.TTkCore.color.TTkColor`
:param color: the color to be used, defaults to :py:class:`~TermTk.TTkCore.color.TTkColor.RST`
:type color: :py:class:`TTkColor`
:param match: the match to colorize
:type match: str, optional
:param posFrom: the initial position of the color
@ -489,8 +489,8 @@ class TTkString():
If only the color is specified, the entire string is colorized
:param color: the color to be used, defaults to :class:`~TermTk.TTkCore.color.TTkColor.RST`
:type color: :class:`~TermTk.TTkCore.color.TTkColor`
:param color: the color to be used, defaults to :py:class:`~TermTk.TTkCore.color.TTkColor.RST`
:type color: :py:class:`TTkColor`
:param match: the match to colorize
:type match: str, optional
:param posFrom: the initial position of the color

2
TermTk/TTkCore/ttk.py

@ -311,7 +311,7 @@ class TTk(TTkContainer):
.. warning::
Method Deprecated,
use :class:`~TermTk.TTkCore.helper.TTkHelper` -> :class:`~TermTk.TTkCore.helper.TTkHelper.quit` instead
use :py:class:`TTkHelper` -> :py:class:`~TermTk.TTkCore.helper.TTkHelper.quit` instead
i.e.

32
TermTk/TTkLayouts/gridlayout.py

@ -173,30 +173,30 @@ class TTkGridLayout(TTkLayout):
# addWidget(self, widget, row, col)
def addWidget(self, widget, row=None, col=None, rowspan=1, colspan=1, direction=TTkK.HORIZONTAL):
'''Add the widget to this :class:`TTkGridLayout`, this function uses :meth:`~addItem`
'''Add the widget to this :py:class:`TTkGridLayout`, this function uses :meth:`~addItem`
:param widget: the widget to be added
:type widget: :class:`~TermTk.TTkWidgets.widget.TTkWidget`
:type widget: :py:class:`TTkWidget`
:param int row: the row of the grid, optional, defaults to None
:param int col: the col of the grid, optional, defaults to None
:param int rowspan: the rows used by the widget, optional, defaults to 1
:param int colspan: the cols used by the widget, optional, defaults to 1
:param direction: The direction the new item will be added if row/col are not specified, defaults to defaults to :class:`~TermTk.TTkCore.constant.TTkConstant.Direction.HORIZONTAL`
:type direction: :class:`~TermTk.TTkCore.constant.TTkConstant.Direction`
:param direction: The direction the new item will be added if row/col are not specified, defaults to defaults to :py:class:`~TermTk.TTkCore.constant.TTkConstant.Direction.HORIZONTAL`
:type direction: :py:class:`~TermTk.TTkCore.constant.TTkConstant.Direction`
'''
TTkGridLayout.addWidgets(self,[widget], row, col, rowspan, colspan, direction)
def addWidgets(self, widgets, row=None, col=None, rowspan=1, colspan=1, direction=TTkK.HORIZONTAL):
'''Add the widgets to this :class:`TTkGridLayout`, this function uses :meth:`~addItem`
'''Add the widgets to this :py:class:`TTkGridLayout`, this function uses :meth:`~addItem`
:param widgets: the widgets to be added
:type widgets: list of :class:`~TermTk.TTkWidgets.widget.TTkWidget`
:type widgets: list of :py:class:`TTkWidget`
:param int row: the row of the grid, optional, defaults to None
:param int col: the col of the grid, optional, defaults to None
:param int rowspan: the rows used by the widget, optional, defaults to 1
:param int colspan: the cols used by the widget, optional, defaults to 1
:param direction: The direction the new items will be added if row/col are not specified, defaults to defaults to :class:`~TermTk.TTkCore.constant.TTkConstant.Direction.HORIZONTAL`
:type direction: :class:`~TermTk.TTkCore.constant.TTkConstant.Direction`
:param direction: The direction the new items will be added if row/col are not specified, defaults to defaults to :py:class:`~TermTk.TTkCore.constant.TTkConstant.Direction.HORIZONTAL`
:type direction: :py:class:`~TermTk.TTkCore.constant.TTkConstant.Direction`
'''
self.removeWidgets(widgets)
items = [w.widgetItem() for w in widgets]
@ -207,30 +207,30 @@ class TTkGridLayout(TTkLayout):
def replaceItem(self, item, index): pass
def addItem(self, item, row=None, col=None, rowspan=1, colspan=1, direction=TTkK.HORIZONTAL):
'''Add the item to this :class:`TTkGridLayout`
'''Add the item to this :py:class:`TTkGridLayout`
:param item: the item to be added
:type item: :class:`~TermTk.TTkLayouts.layout.TTkLayoutItem`
:type item: :py:class:`TTkLayoutItem`
:param int row: the row of the grid, optional, defaults to None
:param int col: the col of the grid, optional, defaults to None
:param int rowspan: the rows used by the item, optional, defaults to 1
:param int colspan: the cols used by the item, optional, defaults to 1
:param direction: The direction the new item will be added if row/col are not specified, defaults to defaults to :class:`~TermTk.TTkCore.constant.TTkConstant.Direction.HORIZONTAL`
:type direction: :class:`~TermTk.TTkCore.constant.TTkConstant.Direction`
:param direction: The direction the new item will be added if row/col are not specified, defaults to defaults to :py:class:`~TermTk.TTkCore.constant.TTkConstant.Direction.HORIZONTAL`
:type direction: :py:class:`~TermTk.TTkCore.constant.TTkConstant.Direction`
'''
self.addItems([item],row,col,rowspan,colspan,direction)
def addItems(self, items, row=None, col=None, rowspan=1, colspan=1, direction=TTkK.HORIZONTAL):
'''Add the items to this :class:`TTkGridLayout`
'''Add the items to this :py:class:`TTkGridLayout`
:param items: the items to be added
:type items: list of :class:`~TermTk.TTkLayouts.layout.TTkLayoutItem`
:type items: list of :py:class:`TTkLayoutItem`
:param int row: the row of the grid, optional, defaults to None
:param int col: the col of the grid, optional, defaults to None
:param int rowspan: the rows used by the item, optional, defaults to 1
:param int colspan: the cols used by the item, optional, defaults to 1
:param direction: The direction the new items will be added if row/col are not specified, defaults to defaults to :class:`~TermTk.TTkCore.constant.TTkConstant.Direction.HORIZONTAL`
:type direction: :class:`~TermTk.TTkCore.constant.TTkConstant.Direction`
:param direction: The direction the new items will be added if row/col are not specified, defaults to defaults to :py:class:`~TermTk.TTkCore.constant.TTkConstant.Direction.HORIZONTAL`
:type direction: :py:class:`~TermTk.TTkCore.constant.TTkConstant.Direction`
'''
nitems = len(items)
self.removeItems(items)

26
TermTk/TTkLayouts/layout.py

@ -29,16 +29,16 @@ __all__ = ['TTkLayoutItem', 'TTkLayout']
from TermTk.TTkCore.constant import TTkK
class TTkLayoutItem:
''' :class:`~TTkLayoutItem` is the base class of layout Items inherited by :class:`~TTkLayout`, :class:`~TTkWidgetItem`, and all the derived layout managers.
''' :py:class:`~TTkLayoutItem` is the base class of layout Items inherited by :py:class:`~TTkLayout`, :py:class:`~TTkWidgetItem`, and all the derived layout managers.
:param int row: (used only in the :class:`~TermTk.TTkLayouts.gridlayout.TTkGridLayout`), the row of the grid, optional, defaults to None
:param int col: (used only in the :class:`~TermTk.TTkLayouts.gridlayout.TTkGridLayout`), the col of the grid, optional, defaults to None
:param int rowspan: (used only in the :class:`~TermTk.TTkLayouts.gridlayout.TTkGridLayout`), the rows used by this, optional, defaults to 1
:param int colspan: (used only in the :class:`~TermTk.TTkLayouts.gridlayout.TTkGridLayout`), the cols used by this, optional, defaults to 1
:param int row: (used only in the :py:class:`TTkGridLayout`), the row of the grid, optional, defaults to None
:param int col: (used only in the :py:class:`TTkGridLayout`), the col of the grid, optional, defaults to None
:param int rowspan: (used only in the :py:class:`TTkGridLayout`), the rows used by this, optional, defaults to 1
:param int colspan: (used only in the :py:class:`TTkGridLayout`), the cols used by this, optional, defaults to 1
:param layoutItemType: The Type of this class, optional, defaults to TTkK.NONE
:type layoutItemType: :class:`~TermTk.TTkCore.constant.TTkConstant.LayoutItemTypes`
:type layoutItemType: :py:class:`~TermTk.TTkCore.constant.TTkConstant.LayoutItemTypes`
:param alignment: The alignment of this item in the layout (not yet used)
:type alignment: :class:`~TermTk.TTkCore.constant.TTkConstant.Alignment`
:type alignment: :py:class:`~TermTk.TTkCore.constant.TTkConstant.Alignment`
'''
LAYER0 = 0x00000000
@ -154,9 +154,9 @@ class TTkLayoutItem:
class TTkLayout(TTkLayoutItem):
'''
| The :class:`TTkLayout` class is the base class of geometry managers. <br/>
| The :py:class:`TTkLayout` class is the base class of geometry managers. <br/>
| It allows free placement of the widgets in the layout area. <br/>
| Used mainly to have free range moving :class:`~TermTk.TTkWidgets.window.TTkWindow` because the widgets are not automatically rearranged after a layout event
| Used mainly to have free range moving :py:class:`TTkWindow` because the widgets are not automatically rearranged after a layout event
::
@ -265,7 +265,7 @@ class TTkLayout(TTkLayoutItem):
''' Add a widget to this Layout
:param widget: the widget to be added
:type widget: :class:`~TermTk.TTkWidgets`
:type widget: :py:class:`TTkWidgets`
'''
self.insertItems(len(self._items),[widget])
@ -273,7 +273,7 @@ class TTkLayout(TTkLayoutItem):
''' Add a list of widgets to this Layout
:param widgets: the widget to be added
:type widgets: list of :class:`~TermTk.TTkWidgets`
:type widgets: list of :py:class:`TTkWidgets`
'''
self.insertItems(len(self._items),widgets)
@ -303,7 +303,7 @@ class TTkLayout(TTkLayoutItem):
''' Remove a widget from this Layout
:param widget: the widget to be removed
:type widget: :class:`~TermTk.TTkWidgets`
:type widget: :py:class:`TTkWidgets`
'''
self.removeWidgets([widget])
@ -311,7 +311,7 @@ class TTkLayout(TTkLayoutItem):
''' Remove a list of widget from this Layout
:param widgets: the widget to be removed
:type widgets: list of :class:`~TermTk.TTkWidgets`
:type widgets: list of :py:class:`TTkWidgets`
'''
for item in reversed(self._items):
if item._layoutItemType == TTkK.WidgetItem:

8
TermTk/TTkTemplates/dragevents.py

@ -28,7 +28,7 @@ class TDragEvents():
.. note:: Reimplement this function to handle this event
:param evt: The drop event
:type evt: :class:`~TermTk.TTkGui.drag.TTkDropEvent`
:type evt: :py:class:`TTkDropEvent`
:return: **True** if the event has been handled
:rtype: bool
@ -42,7 +42,7 @@ class TDragEvents():
.. note:: Reimplement this function to handle this event
:param evt: The drop event
:type evt: :class:`~TermTk.TTkGui.drag.TTkDropEvent`
:type evt: :py:class:`TTkDropEvent`
:return: **True** if the event has been handled
:rtype: bool
@ -56,7 +56,7 @@ class TDragEvents():
.. note:: Reimplement this function to handle this event
:param evt: The drop event
:type evt: :class:`~TermTk.TTkGui.drag.TTkDropEvent`
:type evt: :py:class:`TTkDropEvent`
:return: **True** if the event has been handled
:rtype: bool
@ -70,7 +70,7 @@ class TDragEvents():
.. note:: Reimplement this function to handle this event
:param evt: The drop event
:type evt: :class:`~TermTk.TTkGui.drag.TTkDropEvent`
:type evt: :py:class:`TTkDropEvent`
:return: **True** if the event has been handled
:rtype: bool

6
TermTk/TTkTemplates/keyevents.py

@ -28,7 +28,7 @@ class TKeyEvents():
.. note:: Reimplement this function to handle this event
:param evt: The keyboard event
:type evt: :class:`~TermTk.TTkCore.TTkTerm.inputkey.TTkKeyEvent`
:type evt: :py:class:`TTkKeyEvent`
:return: **True** if the event has been handled
:rtype: bool
@ -41,7 +41,7 @@ class TKeyEvents():
.. note:: Reimplement this function to handle this event
:param evt: The keyboard event
:type evt: :class:`~TermTk.TTkCore.TTkTerm.inputkey.TTkKeyEvent`
:type evt: :py:class:`TTkKeyEvent`
:return: **True** if the event has been handled
:rtype: bool
@ -55,7 +55,7 @@ class TKeyEvents():
.. note:: Reimplement this function to handle this event
:param evt: The keyboard event
:type evt: :class:`~TermTk.TTkCore.TTkTerm.inputkey.TTkKeyEvent`
:type evt: :py:class:`TTkKeyEvent`
:return: **True** if the event has been handled
:rtype: bool

18
TermTk/TTkTemplates/mouseevents.py

@ -28,7 +28,7 @@ class TMouseEvents():
.. note:: Reimplement this function to handle this event
:param evt: The mouse event
:type evt: :class:`~TermTk.TTkCore.TTkTerm.inputmouse.TTkMouseEvent`
:type evt: :py:class:`TTkMouseEvent`
:return: **True** if the event has been handled
:rtype: bool
@ -42,7 +42,7 @@ class TMouseEvents():
.. note:: Reimplement this function to handle this event
:param evt: The mouse event
:type evt: :class:`~TermTk.TTkCore.TTkTerm.inputmouse.TTkMouseEvent`
:type evt: :py:class:`TTkMouseEvent`
:return: **True** if the event has been handled
:rtype: bool
@ -56,7 +56,7 @@ class TMouseEvents():
.. note:: Reimplement this function to handle this event
:param evt: The mouse event
:type evt: :class:`~TermTk.TTkCore.TTkTerm.inputmouse.TTkMouseEvent`
:type evt: :py:class:`TTkMouseEvent`
:return: **True** if the event has been handled
:rtype: bool
@ -70,7 +70,7 @@ class TMouseEvents():
.. note:: Reimplement this function to handle this event
:param evt: The mouse event
:type evt: :class:`~TermTk.TTkCore.TTkTerm.inputmouse.TTkMouseEvent`
:type evt: :py:class:`TTkMouseEvent`
:return: **True** if the event has been handled
:rtype: bool
@ -84,7 +84,7 @@ class TMouseEvents():
.. note:: Reimplement this function to handle this event
:param evt: The mouse event
:type evt: :class:`~TermTk.TTkCore.TTkTerm.inputmouse.TTkMouseEvent`
:type evt: :py:class:`TTkMouseEvent`
:return: **True** if the event has been handled
:rtype: bool
@ -98,7 +98,7 @@ class TMouseEvents():
.. note:: Reimplement this function to handle this event
:param evt: The mouse event
:type evt: :class:`~TermTk.TTkCore.TTkTerm.inputmouse.TTkMouseEvent`
:type evt: :py:class:`TTkMouseEvent`
:return: **True** if the event has been handled
:rtype: bool
@ -112,7 +112,7 @@ class TMouseEvents():
.. note:: Reimplement this function to handle this event
:param evt: The mouse event
:type evt: :class:`~TermTk.TTkCore.TTkTerm.inputmouse.TTkMouseEvent`
:type evt: :py:class:`TTkMouseEvent`
:return: **True** if the event has been handled
:rtype: bool
@ -126,7 +126,7 @@ class TMouseEvents():
.. note:: Reimplement this function to handle this event
:param evt: The mouse event
:type evt: :class:`~TermTk.TTkCore.TTkTerm.inputmouse.TTkMouseEvent`
:type evt: :py:class:`TTkMouseEvent`
:return: **True** if the event has been handled
:rtype: bool
@ -140,7 +140,7 @@ class TMouseEvents():
.. note:: Reimplement this function to handle this event
:param evt: The mouse event
:type evt: :class:`~TermTk.TTkCore.TTkTerm.inputmouse.TTkMouseEvent`
:type evt: :py:class:`TTkMouseEvent`
:return: **True** if the event has been handled
:rtype: bool

18
TermTk/TTkUiTools/uiloader.py

@ -49,12 +49,12 @@ class TTkUiLoader():
:param filePath: the file path
:type filePath: str
:param baseWidget: the custom widget that will be extended with this ui definition, if not defined a new :class:`~TermTk.TTkWidgets.widget.TTkWidget` will be returned,defaults to **None**
:type baseWidget: :class:`~TermTk.TTkWidgets.widget.TTkWidget`, optional
:param baseWidget: the custom widget that will be extended with this ui definition, if not defined a new :py:class:`TTkWidget` will be returned,defaults to **None**
:type baseWidget: :py:class:`TTkWidget`, optional
:param kwargs: the custom initialization args,defaults to **None**
:type kwargs: dictionary, optional
:return: :class:`~TermTk.TTkWidgets.widget.TTkWidget`
:return: :py:class:`TTkWidget`
'''
with open(filePath) as f:
return TTkUiLoader.loadJson(f.read(), baseWidget, kwargs)
@ -66,12 +66,12 @@ class TTkUiLoader():
:param text: the representation of the widget in Json format
:type text: json generated by ttkDesigner_
:param baseWidget: the custom widget that will be extended with this ui definition, if not defined a new :class:`~TermTk.TTkWidgets.widget.TTkWidget` will be returned,defaults to **None**
:type baseWidget: :class:`~TermTk.TTkWidgets.widget.TTkWidget`, optional
:param baseWidget: the custom widget that will be extended with this ui definition, if not defined a new :py:class:`TTkWidget` will be returned,defaults to **None**
:type baseWidget: :py:class:`TTkWidget`, optional
:param kwargs: the custom initialization args,defaults to **None**
:type kwargs: dictionary, optional
:return: :class:`~TermTk.TTkWidgets.widget.TTkWidget`
:return: :py:class:`TTkWidget`
'''
return TTkUiLoader.loadDict(json.loads(text), baseWidget, kwargs)
@ -331,12 +331,12 @@ class TTkUiLoader():
:param ui: the representation of the widget
:type ui: dictionary generated by ttkDesigner_
:param baseWidget: the custom widget that will be extended with this ui definition, if not defined a new :class:`~TermTk.TTkWidgets.widget.TTkWidget` will be returned,defaults to **None**
:type baseWidget: :class:`~TermTk.TTkWidgets.widget.TTkWidget`, optional
:param baseWidget: the custom widget that will be extended with this ui definition, if not defined a new :py:class:`TTkWidget` will be returned,defaults to **None**
:type baseWidget: :py:class:`TTkWidget`, optional
:param kwargs: the custom initialization args,defaults to **None**
:type kwargs: dictionary, optional
:return: :class:`~TermTk.TTkWidgets.widget.TTkWidget`
:return: :py:class:`TTkWidget`
'''
cb = {'1.0.0' : TTkUiLoader._loadDict_1_0_0,
'1.0.1' : TTkUiLoader._loadDict_1_0_0,

196
TermTk/TTkWidgets/TTkModelView/table.py

@ -23,13 +23,14 @@
__all__ = ['TTkTable']
from TermTk.TTkCore.constant import TTkK
from TermTk.TTkCore.signal import pyTTkSignal, pyTTkSlot
from TermTk.TTkWidgets.TTkModelView.tablewidget import TTkTableWidget
from TermTk.TTkAbstract.abstractscrollarea import TTkAbstractScrollArea
from TermTk.TTkAbstract.abstracttablemodel import TTkAbstractTableModel
class TTkTable(TTkAbstractScrollArea):
'''
A :class:`TTkTable` implements a table view (:class:`~TermTk.TTkWidgets.TTkModelView.tablewidget.TTkTableWidget`) that displays items from a model.
A :py:class:`TTkTable` implements a table view (:py:class:`TTkTableWidget`) that displays items from a model.
::
@ -47,213 +48,212 @@ class TTkTable(TTkAbstractScrollArea):
6 2d08FB17EE273F4 Aimee Downs Steele Group Chavezborough
please refer to :class:`~TermTk.TTkWidgets.TTkModelView.tablewidget.TTkTableWidget` for a detailed descriptoin of all the available methods and init params
please refer to :py:class:`TTkTableWidget` for a detailed descriptoin of all the available methods and init params
+-----------------------------------------------------------------------------------------------+
| `Signals <https://ceccopierangiolieugenio.github.io/pyTermTk/tutorial/003-signalslots.html>`_ |
+-----------------------------------------------------------------------------------------------+
.. py:method:: cellChanged(row, col)
:signal:
This signal is emitted whenever the data of the item in the cell specified by row and column has changed.
:param row: the row
:type row: int
:param col: the column
:type col: int
.. py:method:: cellClicked(row, col)
:signal:
This signal is emitted whenever a cell in the table is clicked.
The row and column specified is the cell that was clicked.
:param row: the row
:type row: int
:param col: the column
:type col: int
.. py:method:: cellDoubleClicked(row, col)
:signal:
This signal is emitted whenever a cell in the table is double clicked.
The row and column specified is the cell that was double clicked.
:param row: the row
:type row: int
:param col: the column
:type col: int
.. py:method:: cellEntered(row, col)
:signal:
This signal is emitted when the mouse cursor enters a cell.
The cell is specified by row and column.
:param row: the row
:type row: int
:param col: the column
:type col: int
.. py:method:: currentCellChanged(currRow, currCol, prevRow, prevCol)
:signal:
This signal is emitted whenever the current cell changes.
The cell specified by **prevRow** and **prevCol** is the cell that previously had the focus,
the cell specified by **currRow** and **currCol** is the new current cell.
:param currRow: the current row
:type currRow: int
:param currColumn: the current column
:type currColumn: int
:param prevRow: the previous row
:type prevRow: int
:param prevCol: the previous column
:type prevCol: int
.. py:method:: undo()
This method is forwarded to :meth:`~TermTk.TTkWidgets.TTkModelView.tablewidget.TTkTableWidget.undo`
This method is forwarded to :meth:`TTkTableWidget.undo`
.. py:method:: redo()
This method is forwarded to :meth:`~TermTk.TTkWidgets.TTkModelView.tablewidget.TTkTableWidget.redo`
This method is forwarded to :meth:`TTkTableWidget.redo`
.. py:method:: isUndoAvailable()
This method is forwarded to :meth:`~TermTk.TTkWidgets.TTkModelView.tablewidget.TTkTableWidget.isUndoAvailable`
This method is forwarded to :meth:`TTkTableWidget.isUndoAvailable`
.. py:method:: isRedoAvailable()
This method is forwarded to :meth:`~TermTk.TTkWidgets.TTkModelView.tablewidget.TTkTableWidget.isRedoAvailable`
This method is forwarded to :meth:`TTkTableWidget.isRedoAvailable`
.. py:method:: copy()
This method is forwarded to :meth:`~TermTk.TTkWidgets.TTkModelView.tablewidget.TTkTableWidget.copy`
This method is forwarded to :meth:`TTkTableWidget.copy`
.. py:method:: cut()
This method is forwarded to :meth:`~TermTk.TTkWidgets.TTkModelView.tablewidget.TTkTableWidget.cut`
This method is forwarded to :meth:`TTkTableWidget.cut`
.. py:method:: paste()
This method is forwarded to :meth:`~TermTk.TTkWidgets.TTkModelView.tablewidget.TTkTableWidget.paste`
This method is forwarded to :meth:`TTkTableWidget.paste`
.. py:method:: setSortingEnabled()
This method is forwarded to :meth:`~TermTk.TTkWidgets.TTkModelView.tablewidget.TTkTableWidget.setSortingEnabled`
This method is forwarded to :meth:`TTkTableWidget.setSortingEnabled`
.. py:method:: isSortingEnabled()
This method is forwarded to :meth:`~TermTk.TTkWidgets.TTkModelView.tablewidget.TTkTableWidget.isSortingEnabled`
This method is forwarded to :meth:`TTkTableWidget.isSortingEnabled`
.. py:method:: sortByColumn()
This method is forwarded to :meth:`~TermTk.TTkWidgets.TTkModelView.tablewidget.TTkTableWidget.sortByColumn`
This method is forwarded to :meth:`TTkTableWidget.sortByColumn`
.. py:method:: clearSelection()
This method is forwarded to :meth:`~TermTk.TTkWidgets.TTkModelView.tablewidget.TTkTableWidget.clearSelection`
This method is forwarded to :meth:`TTkTableWidget.clearSelection`
.. py:method:: selectAll()
This method is forwarded to :meth:`~TermTk.TTkWidgets.TTkModelView.tablewidget.TTkTableWidget.selectAll`
This method is forwarded to :meth:`TTkTableWidget.selectAll`
.. py:method:: setSelection()
This method is forwarded to :meth:`~TermTk.TTkWidgets.TTkModelView.tablewidget.TTkTableWidget.setSelection`
This method is forwarded to :meth:`TTkTableWidget.setSelection`
.. py:method:: selectRow()
This method is forwarded to :meth:`~TermTk.TTkWidgets.TTkModelView.tablewidget.TTkTableWidget.selectRow`
This method is forwarded to :meth:`TTkTableWidget.selectRow`
.. py:method:: selectColumn()
This method is forwarded to :meth:`~TermTk.TTkWidgets.TTkModelView.tablewidget.TTkTableWidget.selectColumn`
This method is forwarded to :meth:`TTkTableWidget.selectColumn`
.. py:method:: unselectRow()
This method is forwarded to :meth:`~TermTk.TTkWidgets.TTkModelView.tablewidget.TTkTableWidget.unselectRow`
This method is forwarded to :meth:`TTkTableWidget.unselectRow`
.. py:method:: unselectColumn()
This method is forwarded to :meth:`~TermTk.TTkWidgets.TTkModelView.tablewidget.TTkTableWidget.unselectColumn`
This method is forwarded to :meth:`TTkTableWidget.unselectColumn`
.. py:method:: rowCount()
This method is forwarded to :meth:`~TermTk.TTkWidgets.TTkModelView.tablewidget.TTkTableWidget.rowCount`
This method is forwarded to :meth:`TTkTableWidget.rowCount`
.. py:method:: currentRow()
This method is forwarded to :meth:`~TermTk.TTkWidgets.TTkModelView.tablewidget.TTkTableWidget.currentRow`
This method is forwarded to :meth:`TTkTableWidget.currentRow`
.. py:method:: columnCount()
This method is forwarded to :meth:`~TermTk.TTkWidgets.TTkModelView.tablewidget.TTkTableWidget.columnCount`
This method is forwarded to :meth:`TTkTableWidget.columnCount`
.. py:method:: currentColumn()
This method is forwarded to :meth:`~TermTk.TTkWidgets.TTkModelView.tablewidget.TTkTableWidget.currentColumn`
This method is forwarded to :meth:`TTkTableWidget.currentColumn`
.. py:method:: verticalHeader()
This method is forwarded to :meth:`~TermTk.TTkWidgets.TTkModelView.tablewidget.TTkTableWidget.verticalHeader`
This method is forwarded to :meth:`TTkTableWidget.verticalHeader`
.. py:method:: horizontalHeader()
This method is forwarded to :meth:`~TermTk.TTkWidgets.TTkModelView.tablewidget.TTkTableWidget.horizontalHeader`
This method is forwarded to :meth:`TTkTableWidget.horizontalHeader`
.. py:method:: hSeparatorVisibility()
This method is forwarded to :meth:`~TermTk.TTkWidgets.TTkModelView.tablewidget.TTkTableWidget.hSeparatorVisibility`
This method is forwarded to :meth:`TTkTableWidget.hSeparatorVisibility`
.. py:method:: vSeparatorVisibility()
This method is forwarded to :meth:`~TermTk.TTkWidgets.TTkModelView.tablewidget.TTkTableWidget.vSeparatorVisibility`
This method is forwarded to :meth:`TTkTableWidget.vSeparatorVisibility`
.. py:method:: setHSeparatorVisibility()
This method is forwarded to :meth:`~TermTk.TTkWidgets.TTkModelView.tablewidget.TTkTableWidget.setHSeparatorVisibility`
This method is forwarded to :meth:`TTkTableWidget.setHSeparatorVisibility`
.. py:method:: setVSeparatorVisibility()
This method is forwarded to :meth:`~TermTk.TTkWidgets.TTkModelView.tablewidget.TTkTableWidget.setVSeparatorVisibility`
This method is forwarded to :meth:`TTkTableWidget.setVSeparatorVisibility`
.. py:method:: model()
This method is forwarded to :meth:`~TermTk.TTkWidgets.TTkModelView.tablewidget.TTkTableWidget.model`
This method is forwarded to :meth:`TTkTableWidget.model`
.. py:method:: setModel()
This method is forwarded to :meth:`~TermTk.TTkWidgets.TTkModelView.tablewidget.TTkTableWidget.setModel`
This method is forwarded to :meth:`TTkTableWidget.setModel`
.. py:method:: setColumnWidth()
This method is forwarded to :meth:`~TermTk.TTkWidgets.TTkModelView.tablewidget.TTkTableWidget.setColumnWidth`
This method is forwarded to :meth:`TTkTableWidget.setColumnWidth`
.. py:method:: resizeColumnToContents()
This method is forwarded to :meth:`~TermTk.TTkWidgets.TTkModelView.tablewidget.TTkTableWidget.resizeColumnToContents`
This method is forwarded to :meth:`TTkTableWidget.resizeColumnToContents`
.. py:method:: resizeColumnsToContents()
This method is forwarded to :meth:`~TermTk.TTkWidgets.TTkModelView.tablewidget.TTkTableWidget.resizeColumnsToContents`
This method is forwarded to :meth:`TTkTableWidget.resizeColumnsToContents`
.. py:method:: setRowHeight()
This method is forwarded to :meth:`~TermTk.TTkWidgets.TTkModelView.tablewidget.TTkTableWidget.setRowHeight`
This method is forwarded to :meth:`TTkTableWidget.setRowHeight`
.. py:method:: resizeRowToContents()
This method is forwarded to :meth:`~TermTk.TTkWidgets.TTkModelView.tablewidget.TTkTableWidget.resizeRowToContents`
This method is forwarded to :meth:`TTkTableWidget.resizeRowToContents`
.. py:method:: resizeRowsToContents()
This method is forwarded to :meth:`~TermTk.TTkWidgets.TTkModelView.tablewidget.TTkTableWidget.resizeRowsToContents`
This method is forwarded to :meth:`TTkTableWidget.resizeRowsToContents`
'''
# resizeRowsToContents:TTkTableWidget.resizeRowsToContents
# '''
# This method is forwarded to :meth:`TTkTableWidget.resizeRowsToContents`
# '''
cellChanged:pyTTkSignal
'''
This signal is emitted whenever the data of the item in the cell specified by row and column has changed.
:param row: the row
:type row: int
:param col: the column
:type col: int
'''
cellClicked:pyTTkSignal
'''
This signal is emitted whenever a cell in the table is clicked.
The row and column specified is the cell that was clicked.
:param row: the row
:type row: int
:param col: the column
:type col: int
'''
cellDoubleClicked:pyTTkSignal
'''
This signal is emitted whenever a cell in the table is double clicked.
The row and column specified is the cell that was double clicked.
:param row: the row
:type row: int
:param col: the column
:type col: int
'''
cellEntered:pyTTkSignal
'''
This signal is emitted when the mouse cursor enters a cell.
The cell is specified by row and column.
:param row: the row
:type row: int
:param col: the column
:type col: int
'''
# self.cellPressed = pyTTkSignal(int,int)
currentCellChanged:pyTTkSignal
'''
This signal is emitted whenever the current cell changes.
The cell specified by **prevRow** and **prevCol** is the cell that previously had the focus,
the cell specified by **currRow** and **currCol** is the new current cell.
:param currRow: the current row
:type currRow: int
:param currColumn: the current column
:type currColumn: int
:param prevRow: the previous row
:type prevRow: int
:param prevCol: the previous column
:type prevCol: int
'''
__slots__ = (
'_tableView',
# Forwarded Signals

2
TermTk/TTkWidgets/TTkModelView/tablemodelcsv.py

@ -29,7 +29,7 @@ from TermTk.TTkWidgets.TTkModelView.tablemodellist import TTkTableModelList
class TTkTableModelCSV(TTkTableModelList):
'''
:class:`TTkTableModelCSV` extends :class:`~TermTk.TTkWidgets.TTkModelView.tablemodellist.TTkTableModelList` with cvs loading helpers.
:py:class:`TTkTableModelCSV` extends :py:class:`TTkTableModelList` with cvs loading helpers.
You can address the csv file through the Filename (filename) or the FileDescriptor (fd).

2
TermTk/TTkWidgets/TTkModelView/tablemodellist.py

@ -47,7 +47,7 @@ class _TTkModelIndexList(TTkModelIndex):
class TTkTableModelList(TTkAbstractTableModel):
'''
:class:`TTkTableModelList` extends :class:`~TermTk.TTkAbstract.abstracttablemodel.TTkAbstractTableModel`,
:py:class:`TTkTableModelList` extends :py:class:`TTkAbstractTableModel`,
including a basic model with a 2d list data structure
:param data: the 2D List model for the view to present.

117
TermTk/TTkWidgets/TTkModelView/tablewidget.py

@ -102,7 +102,7 @@ class _ClipboardTable(TTkString):
class TTkTableWidget(TTkAbstractScrollView):
'''
A :class:`TTkTableWidget` implements a table view that displays items from a model.
A :py:class:`TTkTableWidget` implements a table view that displays items from a model.
::
@ -120,9 +120,9 @@ class TTkTableWidget(TTkAbstractScrollView):
6 2d08FB17EE273F4 Aimee Downs Steele Group Chavezborough
The :class:`TTkTableWidget` class is one of the Model/View Classes and is part of TermTk's model/view framework.
The :py:class:`TTkTableWidget` class is one of the Model/View Classes and is part of TermTk's model/view framework.
:class:`TTkTableWidget` implements the methods to allow it to display data provided by models derived from the :class:`~TermTk.TTkAbstract.abstracttablemodel.TTkAbstractTableModel` class.
:py:class:`TTkTableWidget` implements the methods to allow it to display data provided by models derived from the :py:class:`TTkAbstractTableModel` class.
**Navigation**
@ -151,7 +151,7 @@ class TTkTableWidget(TTkAbstractScrollView):
call the view's :meth:`resizeColumnsToContents` or :meth:`resizeRowsToContents` functions.
:param tableModel: the model for the view to present.
:type tableModel: :class:`~TermTk.TTkAbstract.abstracttablemodel.TTkAbstractTableModel`
:type tableModel: :py:class:`TTkAbstractTableModel`
:param vSeparator: show the vertical separators, defaults to True
:type vSeparator: bool, optional
@ -172,49 +172,7 @@ class TTkTableWidget(TTkAbstractScrollView):
:type dataPadding: int, optional
'''
classStyle = {
'default': {
'color': TTkColor.RST,
'lineColor': TTkColor.fg("#444444"),
'headerColor': TTkColor.fg("#FFFFFF")+TTkColor.bg("#444444")+TTkColor.BOLD,
'hoverColor': TTkColor.fg("#FFFF00")+TTkColor.bg("#0088AA")+TTkColor.BOLD,
'currentColor': TTkColor.fg("#FFFF00")+TTkColor.bg("#0088FF")+TTkColor.BOLD,
'selectedColor': TTkColor.bg("#0066AA"),
'separatorColor': TTkColor.fg("#555555")+TTkColor.bg("#444444")},
'disabled': {
'color': TTkColor.fg("#888888"),
'lineColor': TTkColor.fg("#888888"),
'headerColor': TTkColor.fg("#888888"),
'hoverColor': TTkColor.bg("#888888"),
'currentColor': TTkColor.bg("#888888"),
'selectedColor': TTkColor.fg("#888888"),
'separatorColor': TTkColor.fg("#888888")},
}
'''default style'''
__slots__ = ( '_tableModel',
'_clipboard',
'_vHeaderSize', '_hHeaderSize',
'_showVSeparators', '_showHSeparators',
'_verticalHeader', '_horizontallHeader',
'_colsPos', '_rowsPos',
'_sortingEnabled',
'_dataPadding',
'_internal',
'_selected', '_selectedBase',
'_hSeparatorSelected', '_vSeparatorSelected',
'_hoverPos', '_dragPos', '_currentPos',
'_sortColumn', '_sortOrder',
'_fastCheck', '_guessDataEdit',
'_snapshot', '_snapshotId',
# Signals
# 'cellActivated',
'cellChanged',
'cellClicked', 'cellDoubleClicked',
'cellEntered', # 'cellPressed',
'currentCellChanged',
)
cellChanged:pyTTkSignal[int,int]
cellChanged:pyTTkSignal
'''
This signal is emitted whenever the data of the item in the cell specified by row and column has changed.
@ -223,7 +181,7 @@ class TTkTableWidget(TTkAbstractScrollView):
:param col: the column
:type col: int
'''
cellClicked:pyTTkSignal[int,int]
cellClicked:pyTTkSignal
'''
This signal is emitted whenever a cell in the table is clicked.
The row and column specified is the cell that was clicked.
@ -233,7 +191,7 @@ class TTkTableWidget(TTkAbstractScrollView):
:param col: the column
:type col: int
'''
cellDoubleClicked:pyTTkSignal[int,int]
cellDoubleClicked:pyTTkSignal
'''
This signal is emitted whenever a cell in the table is double clicked.
The row and column specified is the cell that was double clicked.
@ -243,7 +201,7 @@ class TTkTableWidget(TTkAbstractScrollView):
:param col: the column
:type col: int
'''
cellEntered:pyTTkSignal[int,int]
cellEntered:pyTTkSignal
'''
This signal is emitted when the mouse cursor enters a cell.
The cell is specified by row and column.
@ -254,7 +212,7 @@ class TTkTableWidget(TTkAbstractScrollView):
:type col: int
'''
# self.cellPressed = pyTTkSignal(int,int)
currentCellChanged:pyTTkSignal[int,int,int,int]
currentCellChanged:pyTTkSignal
'''
This signal is emitted whenever the current cell changes.
The cell specified by **prevRow** and **prevCol** is the cell that previously had the focus,
@ -270,6 +228,49 @@ class TTkTableWidget(TTkAbstractScrollView):
:type prevCol: int
'''
classStyle = {
'default': {
'color': TTkColor.RST,
'lineColor': TTkColor.fg("#444444"),
'headerColor': TTkColor.fg("#FFFFFF")+TTkColor.bg("#444444")+TTkColor.BOLD,
'hoverColor': TTkColor.fg("#FFFF00")+TTkColor.bg("#0088AA")+TTkColor.BOLD,
'currentColor': TTkColor.fg("#FFFF00")+TTkColor.bg("#0088FF")+TTkColor.BOLD,
'selectedColor': TTkColor.bg("#0066AA"),
'separatorColor': TTkColor.fg("#555555")+TTkColor.bg("#444444")},
'disabled': {
'color': TTkColor.fg("#888888"),
'lineColor': TTkColor.fg("#888888"),
'headerColor': TTkColor.fg("#888888"),
'hoverColor': TTkColor.bg("#888888"),
'currentColor': TTkColor.bg("#888888"),
'selectedColor': TTkColor.fg("#888888"),
'separatorColor': TTkColor.fg("#888888")},
}
'''default style'''
__slots__ = ( '_tableModel',
'_clipboard',
'_vHeaderSize', '_hHeaderSize',
'_showVSeparators', '_showHSeparators',
'_verticalHeader', '_horizontallHeader',
'_colsPos', '_rowsPos',
'_sortingEnabled',
'_dataPadding',
'_internal',
'_selected', '_selectedBase',
'_hSeparatorSelected', '_vSeparatorSelected',
'_hoverPos', '_dragPos', '_currentPos',
'_sortColumn', '_sortOrder',
'_fastCheck', '_guessDataEdit',
'_snapshot', '_snapshotId',
# Signals
# 'cellActivated',
'cellChanged',
'cellClicked', 'cellDoubleClicked',
'cellEntered', # 'cellPressed',
'currentCellChanged',
)
def __init__(self, *,
tableModel:TTkAbstractTableModel=None,
vSeparator:bool=True, hSeparator:bool=True,
@ -510,7 +511,7 @@ class TTkTableWidget(TTkAbstractScrollView):
:type column: bool
:param order: the sort order
:type order: :class:`~TermTk.TTkCore.constant.TTkK.SortOrder`
:type order: :py:class:`~TermTk.TTkCore.constant.TTkK.SortOrder`
'''
self._sortColumn = column
self._sortOrder = order
@ -599,8 +600,8 @@ class TTkTableWidget(TTkAbstractScrollView):
:type pos: tuple[int,int]
:param size: the width,height of the rect used for the selection
:type size: tuple[int,int]
:param flags: the selection model used (i.e. :class:`~TermTk.TTkCore.constant.TTkK.TTkItemSelectionModel.Select`)
:type flags: :class:`~TermTk.TTkCore.constant.TTkK.TTkItemSelectionModel`
:param flags: the selection model used (i.e. :py:class:`~TermTk.TTkCore.constant.TTkK.TTkItemSelectionModel.Select`)
:type flags: :py:class:`TTkItemSelectionModel`
'''
x,y = pos
w,h = size
@ -710,7 +711,7 @@ class TTkTableWidget(TTkAbstractScrollView):
'''
Returns the table view's vertical header.
:return: :class:`~TermTk.TTkWidgets.TTkModelView.tablewidget.TTkHeaderView`
:return: :py:class:`TTkHeaderView`
'''
return self._verticalHeader
@ -718,7 +719,7 @@ class TTkTableWidget(TTkAbstractScrollView):
'''
Returns the table view's horizontal header.
:return: :class:`~TermTk.TTkWidgets.TTkModelView.tablewidget.TTkHeaderView`
:return: :py:class:`TTkHeaderView`
'''
return self._horizontallHeader
@ -791,7 +792,7 @@ class TTkTableWidget(TTkAbstractScrollView):
'''
Returns the model that this view is presenting.
:return: :class:`~TermTk.TTkAbstract.abstracttablemodel.TTkAbstractTableModel`
:return: :py:class:`TTkAbstractTableModel`
'''
return self._tableModel
@ -800,7 +801,7 @@ class TTkTableWidget(TTkAbstractScrollView):
Sets the model for the view to present.
:param model:
:type model: :class:`~TermTk.TTkAbstract.abstracttablemodel.TTkAbstractTableModel`
:type model: :py:class:`TTkAbstractTableModel`
'''
self._tableModel.dataChanged.disconnect(self.update)
self._tableModel = model

28
TermTk/TTkWidgets/TTkModelView/treewidget.py

@ -35,10 +35,10 @@ from dataclasses import dataclass
class TTkTreeWidget(TTkAbstractScrollView):
'''TTkTreeWidget
The :class:`TTkTreeWidget` class is a convenience class that provides a standard tree
The :py:class:`TTkTreeWidget` class is a convenience class that provides a standard tree
widget with a classic item-based interface.
This class is based on TTk's Model/View architecture and uses a default model to hold items,
each of which is a :class:`~TermTk.TTkWidgets.TTkModelView.treewidgetitem.TTkTreeWidgetItem`.
each of which is a :py:class:`TTkTreeWidgetItem`.
In its simplest form, a tree widget can be constructed in the following way:
@ -68,60 +68,60 @@ class TTkTreeWidget(TTkAbstractScrollView):
The isSortingEnabled() function indicates whether sorting is enabled.
'''
itemActivated:pyTTkSignal[TTkTreeWidgetItem, int]
itemActivated:pyTTkSignal
'''
This signal is emitted when the user activates an item by double-clicking
or pressing a special key (e.g., Enter).
:param item: the item that was clicked.
:type item: :class:`~TermTk.TTkWidgets.TTkModelView.treewidgetitem.TTkTreeWidgetItem`
:type item: :py:class:`TTkTreeWidgetItem`
:param col: the item's column that was clicked.
:type col: int
'''
itemChanged:pyTTkSignal[TTkTreeWidgetItem, int]
itemChanged:pyTTkSignal
'''
This signal is emitted when the contents of the column in the specified item changes.
:param item: the item reported by this signal
:type item: :class:`~TermTk.TTkWidgets.TTkModelView.treewidgetitem.TTkTreeWidgetItem`
:type item: :py:class:`TTkTreeWidgetItem`
:param col: the item's column
:type col: int
'''
itemClicked:pyTTkSignal[TTkTreeWidgetItem, int]
itemClicked:pyTTkSignal
'''
This signal is emitted when the user clicks inside the widget.
If no item was clicked, no signal will be emitted.
:param item: the item that was clicked.
:type item: :class:`~TermTk.TTkWidgets.TTkModelView.treewidgetitem.TTkTreeWidgetItem`
:type item: :py:class:`TTkTreeWidgetItem`
:param col: the item's column that was clicked.
:type col: int
'''
itemDoubleClicked:pyTTkSignal[TTkTreeWidgetItem, int]
itemDoubleClicked:pyTTkSignal
'''
This signal is emitted when the user double clicks inside the widget.
If no item was double clicked, no signal will be emitted.
:param item: the item that was clicked.
:type item: :class:`~TermTk.TTkWidgets.TTkModelView.treewidgetitem.TTkTreeWidgetItem`
:type item: :py:class:`TTkTreeWidgetItem`
:param col: the item's column that was clicked.
:type col: int
'''
itemExpanded:pyTTkSignal[TTkTreeWidgetItem]
itemExpanded:pyTTkSignal
'''
This signal is emitted when the specified item is expanded so that all of its children are displayed.
:param item: the item reported by this signal
:type item: :class:`~TermTk.TTkWidgets.TTkModelView.treewidgetitem.TTkTreeWidgetItem`
:type item: :py:class:`TTkTreeWidgetItem`
'''
itemCollapsed:pyTTkSignal[TTkTreeWidgetItem]
itemCollapsed:pyTTkSignal
'''
This signal is emitted when the specified item is collapsed so that none of its children are displayed.
:param item: the item reported by this signal
:type item: :class:`~TermTk.TTkWidgets.TTkModelView.treewidgetitem.TTkTreeWidgetItem`
:type item: :py:class:`TTkTreeWidgetItem`
'''
classStyle = {

67
TermTk/TTkWidgets/TTkPickers/filepicker.py

@ -108,41 +108,37 @@ class TTkFileDialogPicker(TTkWindow):
:type filter: str, optional
:param fileMode: The file mode defines the number and type of items that the user is expected to select in the dialog, defaults to :py:class:`~TermTk.TTkCore.constant.TTkConstant.FileMode.Anyfile`
:type fileMode: :py:class:`~TermTk.TTkCore.constant.TTkConstant.FileMode`, optional
:param fileMode: The file mode defines the number and type of items that the user is expected to select in the dialog, defaults to :class:`~TermTk.TTkCore.constant.TTkConstant.FileMode.Anyfile`
:type fileMode: :class:`~TermTk.TTkCore.constant.TTkConstant.FileMode`, optional
:param acceptMode: TThe action mode defines whether the dialog is for opening or saving files, defaults to :class:`~TermTk.TTkCore.constant.TTkConstant.AcceptMode.AcceptOpen`
:type acceptMode: :class:`~TermTk.TTkCore.constant.TTkConstant.AcceptMode`, optional
+-----------------------------------------------------------------------------------------------+
| `Signals <https://ceccopierangiolieugenio.github.io/pyTermTk/tutorial/003-signalslots.html>`_ |
+-----------------------------------------------------------------------------------------------+
.. py:method:: pathPicked(pathName)
:signal:
This signal is emitted whenever any path is picked (Files/Dir)
:param pathName: the name of the path
:type pathName: str
:param acceptMode: TThe action mode defines whether the dialog is for opening or saving files, defaults to :py:class:`~TermTk.TTkCore.constant.TTkConstant.AcceptMode.AcceptOpen`
:type acceptMode: :py:class:`~TermTk.TTkCore.constant.TTkConstant.AcceptMode`, optional
'''
.. py:method:: filePicked(fileName)
:signal:
pathPicked:pyTTkSignal
'''
This signal is emitted whenever any path is picked (Files/Dir)
This signal is emitted whenever any file is picked
:param pathName: the name of the path
:type pathName: str
'''
:param fileName: the name of the file
:type fileName: str
filePicked:pyTTkSignal
'''
This signal is emitted whenever any file is picked
.. py:method:: folderPicked(dirName)
:signal:
:param fileName: the name of the file
:type fileName: str
'''
This signal is emitted whenever any folder is picked
folderPicked:pyTTkSignal
'''
This signal is emitted whenever any folder is picked
:param dirName: the name of the folder
:type dirName: str
:param dirName: the name of the folder
:type dirName: str
'''
__slots__ = ('_path', '_fileName', '_recentPath', '_recentPathId', '_filters', '_filter', '_caption', '_fileMode', '_acceptMode',
# Widgets
'_fileTree', '_lookPath', '_btnPrev', '_btnNext', '_btnUp',
@ -430,34 +426,31 @@ class TTkFileButtonPicker(TTkButton):
:type filter: str, optional
:param fileMode: The file mode defines the number and type of items that the user is expected to select in the dialog, defaults to :class:`~TermTk.TTkCore.constant.TTkConstant.FileMode.Anyfile`
:type fileMode: :class:`~TermTk.TTkCore.constant.TTkConstant.FileMode`, optional
:param fileMode: The file mode defines the number and type of items that the user is expected to select in the dialog, defaults to :py:class:`~TermTk.TTkCore.constant.TTkConstant.FileMode.Anyfile`
:type fileMode: :py:class:`~TermTk.TTkCore.constant.TTkConstant.FileMode`, optional
:param acceptMode: TThe action mode defines whether the dialog is for opening or saving files, defaults to :class:`~TermTk.TTkCore.constant.TTkConstant.AcceptMode.AcceptOpen`
:type acceptMode: :class:`~TermTk.TTkCore.constant.TTkConstant.AcceptMode`, optional
:param acceptMode: TThe action mode defines whether the dialog is for opening or saving files, defaults to :py:class:`~TermTk.TTkCore.constant.TTkConstant.AcceptMode.AcceptOpen`
:type acceptMode: :py:class:`~TermTk.TTkCore.constant.TTkConstant.AcceptMode`, optional
+-----------------------------------------------------------------------------------------------+
| `Signals <https://ceccopierangiolieugenio.github.io/pyTermTk/tutorial/003-signalslots.html>`_ |
+-----------------------------------------------------------------------------------------------+
.. py:method:: pathPicked(pathName)
:signal:
.. py:method:: pathPicked(pathName:pyTTkSignal
This signal is emitted whenever any path is picked (Files/Dir)
:param pathName: the name of the path
:type pathName: str
.. py:method:: filePicked(fileName)
:signal:
.. py:method:: filePicked(fileName:pyTTkSignal
This signal is emitted whenever any file is picked
:param fileName: the name of the file
:type fileName: str
.. py:method:: folderPicked(dirName)
:signal:
.. py:method:: folderPicked(dirName:pyTTkSignal
This signal is emitted whenever any folder is picked

30
TermTk/TTkWidgets/button.py

@ -63,24 +63,20 @@ class TTkButton(TTkWidget):
:type checked: bool, optional
:param bool checkable: define if the button is checkable, defaults to "False"
:type checkable: bool, optional
'''
+-----------------------------------------------------------------------------------------------+
| `Signals <https://ceccopierangiolieugenio.github.io/pyTermTk/tutorial/003-signalslots.html>`_ |
+-----------------------------------------------------------------------------------------------+
.. py:method:: clicked()
:signal:
This signal is emitted when the button is activated
.. py:method:: toggled(checked)
:signal:
This signal is emitted whenever the button state changes if checkeable, i.e., whenever the user checks or unchecks it.
clicked:pyTTkSignal
'''
This signal is emitted when the button is activated
'''
:param checked: True if checked otherwise False
:type checked: bool
toggled:pyTTkSignal
'''
This signal is emitted whenever the button state changes if checkeable,
i.e., whenever the user checks or unchecks it.
:param checked: True if checked otherwise False
:type checked: bool
'''
classStyle = {
@ -189,7 +185,7 @@ class TTkButton(TTkWidget):
def text(self):
''' This property holds the text shown on the button
:return: :class:`~TermTk.TTkCore.string.TTkString`
:return: :py:class:`TTkString`
'''
return TTkString('\n').join(self._text)
@ -197,7 +193,7 @@ class TTkButton(TTkWidget):
''' This property holds the text shown on the button
:param text:
:type text: :class:`~TermTk.TTkCore.string.TTkString`
:type text: :py:class:`TTkString`
'''
if self._text and self._text[0] == text: return
self._text = TTkString(text).split('\n')

54
TermTk/TTkWidgets/checkbox.py

@ -52,36 +52,30 @@ class TTkCheckbox(TTkWidget):
:type text: str, optional
:param bool checked: Checked status, defaults to "False"
:type checked: bool, optional
'''
+-----------------------------------------------------------------------------------------------+
| `Signals <https://ceccopierangiolieugenio.github.io/pyTermTk/tutorial/003-signalslots.html>`_ |
+-----------------------------------------------------------------------------------------------+
.. py:method:: clicked(checked)
:signal:
This signal is emitted when the button is activated
:param checked: True if checked otherwise False
:type checked: bool
.. py:method:: stateChanged(state)
:signal:
This signal is emitted whenever the checkbox's state changes, i.e., whenever the user checks or unchecks it.
:param state: state of the checkbox
:type state: :class:`~TermTk.TTkCore.constant.TTkConstant.CheckState`
clicked:pyTTkSignal
'''
This signal is emitted when the button is activated
'''
.. py:method:: toggled(checked)
:signal:
toggled:pyTTkSignal
'''
This signal is emitted whenever the button state changes if checkeable,
i.e., whenever the user checks or unchecks it.
This signal is emitted whenever the checkbox's state changes, i.e., whenever the user checks or unchecks it.
:param checked: True if checked otherwise False
:type checked: bool
'''
:param checked: True if checked otherwise False
:type checked: bool
stateChanged:pyTTkSignal
'''
This signal is emitted whenever the checkbox's state changes,
i.e., whenever the user checks or unchecks it.
'''
:param state: state of the checkbox
:type state: :py:class:`TTkK.CheckState`
'''
classStyle = {
'default': {'color': TTkColor.RST,
@ -121,7 +115,7 @@ class TTkCheckbox(TTkWidget):
def text(self):
''' This property holds the text shown on the checkhox
:return: :class:`~TermTk.TTkCore.string.TTkString`
:return: :py:class:`TTkString`
'''
return self._text
@ -130,7 +124,7 @@ class TTkCheckbox(TTkWidget):
''' This property holds the text shown on the checkhox
:param text:
:type text: :class:`~TermTk.TTkCore.string.TTkString`
:type text: :py:class:`TTkString`
'''
if self._text.sameAs(text): return
self._text = TTkString(text)
@ -157,7 +151,7 @@ class TTkCheckbox(TTkWidget):
def isChecked(self):
''' This property holds whether the checkbox is checked
:return: bool - True if :class:`~TermTk.TTkCore.constant.TTkConstant.CheckState.Checked` or :class:`~TermTk.TTkCore.constant.TTkConstant.CheckState.PartiallyChecked`
:return: bool - True if :py:class:`~TermTk.TTkCore.constant.TTkConstant.CheckState.Checked` or :py:class:`~TermTk.TTkCore.constant.TTkConstant.CheckState.PartiallyChecked`
'''
return self._checkStatus != TTkK.Unchecked
@ -173,7 +167,7 @@ class TTkCheckbox(TTkWidget):
def checkState(self):
''' Retrieve the state of the checkbox
:return: :class:`~TermTk.TTkCore.constant.TTkConstant.CheckState` : the checkbox status
:return: :py:class:`~TermTk.TTkCore.constant.TTkConstant.CheckState` : the checkbox status
'''
return self._checkStatus
@ -182,7 +176,7 @@ class TTkCheckbox(TTkWidget):
''' Sets the checkbox's check state.
:param state: state of the checkbox
:type state: :class:`~TermTk.TTkCore.constant.TTkConstant.CheckState`
:type state: :py:class:`~TermTk.TTkCore.constant.TTkConstant.CheckState`
'''
if self._checkStatus == state: return
if state==TTkK.PartiallyChecked and not self._tristate: return

12
TermTk/TTkWidgets/combobox.py

@ -52,11 +52,11 @@ class TTkComboBox(TTkContainer):
:param list: the list of the items selectable by this combobox, defaults to "[]"
:type list: list(str), optional
:param insertPolicy: the policy used to determine where user-inserted items should appear in the combobox, defaults to :class:`~TermTk.TTkCore.constant.TTkConstant.InsertPolicy.InsertAtBottom`
:type insertPolicy: :class:`~TermTk.TTkCore.constant.TTkConstant.InsertPolicy`, optional
:param insertPolicy: the policy used to determine where user-inserted items should appear in the combobox, defaults to :py:class:`~TermTk.TTkCore.constant.TTkConstant.InsertPolicy.InsertAtBottom`
:type insertPolicy: :py:class:`~TermTk.TTkCore.constant.TTkConstant.InsertPolicy`, optional
:param textAlign: This enum type is used to define the text alignment, defaults to :class:`~TermTk.TTkCore.constant.TTkConstant.Alignment.CENTER_ALIGN`
:tye textAlign: :class:`~TermTk.TTkCore.constant.TTkConstant.Alignment`, optional
:param textAlign: This enum type is used to define the text alignment, defaults to :py:class:`~TermTk.TTkCore.constant.TTkConstant.Alignment.CENTER_ALIGN`
:tye textAlign: :py:class:`~TermTk.TTkCore.constant.TTkConstant.Alignment`, optional
:param editable: This property holds whether the combo box can be edited by the user, defaults to False
:type editable: bool, optional
@ -122,7 +122,7 @@ class TTkComboBox(TTkContainer):
def textAlign(self):
'''his property holds the displayed text alignment
:return: :class:`~TermTk.TTkCore.constant.TTkConstant.Alignment`
:return: :py:class:`~TermTk.TTkCore.constant.TTkConstant.Alignment`
'''
return self._textAlign
@ -130,7 +130,7 @@ class TTkComboBox(TTkContainer):
'''This property holds the displayed text alignment
:param align:
:type align: :class:`~TermTk.TTkCore.constant.TTkConstant.Alignment`
:type align: :py:class:`~TermTk.TTkCore.constant.TTkConstant.Alignment`
'''
if self._textAlign != align:
self._textAlign = align

8
TermTk/TTkWidgets/container.py

@ -56,7 +56,7 @@ class TTkContainer(TTkWidget):
:param int paddingLeft: the Left padding, override Left padding if already defined, optional, default=padding
:param int paddingRight: the Right padding, override Right padding if already defined, optional, default=padding
:param layout: the layout of this widget, optional, defaults to :class:`~TermTk.TTkLayouts.layout.TTkLayout`
:param layout: the layout of this widget, optional, defaults to :py:class:`TTkLayout`
:type layout: :mod:`TermTk.TTkLayouts`
'''
@ -87,7 +87,7 @@ class TTkContainer(TTkWidget):
.. warning::
Method Deprecated,
use :class:`TTkWidget` -> :class:`~TermTk.TTkWidgets.widget.TTkWidget.layout` -> :class:`~TermTk.TTkLayouts.layout.TTkLayout.addWidget`
use :py:class:`TTkWidget` -> :py:class:`~TermTk.TTkWidgets.widget.TTkWidget.layout` -> :py:class:`~TermTk.TTkLayouts.layout.TTkLayout.addWidget`
i.e.
@ -103,7 +103,7 @@ class TTkContainer(TTkWidget):
.. warning::
Method Deprecated,
use :class:`TTkWidget` -> :class:`~TermTk.TTkWidgets.widget.TTkWidget.layout` -> :class:`~TermTk.TTkLayouts.layout.TTkLayout.removeWidget`
use :py:class:`TTkWidget` -> :py:class:`~TermTk.TTkWidgets.widget.TTkWidget.layout` -> :py:class:`~TermTk.TTkLayouts.layout.TTkLayout.removeWidget`
i.e.
@ -334,7 +334,7 @@ class TTkContainer(TTkWidget):
''' Get the layout
:return: The layout used
:rtype: :class:`TTkLayout` or derived
:rtype: :py:class:`TTkLayout` or derived
'''
return self._layout.itemAt(0)

2
TermTk/TTkWidgets/frame.py

@ -78,7 +78,7 @@ class TTkFrame(TTkContainer):
.. warning::
Method Deprecated,
use :class:`~TermTk.TTkWidgets.frame.setMenuBar` instead
use :py:class:`~TermTk.TTkWidgets.frame.setMenuBar` instead
i.e.

6
TermTk/TTkWidgets/menu.py

@ -84,7 +84,7 @@ class TTkMenuButton(TTkWidget):
return self.parentWidget().setFocus()
def data(self):
''' Returns the user data as set in the constructor or :class:`setData`.'''
''' Returns the user data as set in the constructor or :py:class:`setData`.'''
return self._data
def setData(self, data):
@ -140,7 +140,7 @@ class TTkMenuButton(TTkWidget):
def text(self):
''' This property holds the text shown
:return: :class:`~TermTk.TTkCore.string.TTkString`
:return: :py:class:`TTkString`
'''
return self._text
@ -148,7 +148,7 @@ class TTkMenuButton(TTkWidget):
''' This property holds the text shown
:param text:
:type text: :class:`~TermTk.TTkCore.string.TTkString`
:type text: :py:class:`TTkString`
'''
if self._text == text: return
self._text = TTkString(text)

25
TermTk/TTkWidgets/radiobutton.py

@ -49,17 +49,12 @@ class TTkRadioButton(TTkWidget):
:type radiogroup: str, optional
:param bool checked: Checked status, defaults to "False"
:type checked: bool, optional
'''
+-----------------------------------------------------------------------------------------------+
| `Signals <https://ceccopierangiolieugenio.github.io/pyTermTk/tutorial/003-signalslots.html>`_ |
+-----------------------------------------------------------------------------------------------+
.. py:method:: clicked()
:signal:
This signal is emitted when the button is activated
'''
clicked:pyTTkSignal
'''
This signal is emitted when the button is activated
'''
classStyle = {
'default': {'color': TTkColor.RST,
@ -104,7 +99,7 @@ class TTkRadioButton(TTkWidget):
def text(self):
''' This property holds the text shown on the checkhox
:return: :class:`~TermTk.TTkCore.string.TTkString`
:return: :py:class:`TTkString`
'''
return self._text
@ -112,7 +107,7 @@ class TTkRadioButton(TTkWidget):
''' This property holds the text shown on the checkhox
:param text:
:type text: :class:`~TermTk.TTkCore.string.TTkString`
:type text: :py:class:`TTkString`
'''
if self._text.sameAs(text): return
self._text = TTkString(text)
@ -122,7 +117,7 @@ class TTkRadioButton(TTkWidget):
def isChecked(self):
''' This property holds whether the radiobutton is checked
:return: bool - True if :class:`~TermTk.TTkCore.constant.TTkConstant.CheckState.Checked` or :class:`~TermTk.TTkCore.constant.TTkConstant.CheckState.PartiallyChecked`
:return: bool - True if :py:class:`~TermTk.TTkCore.constant.TTkConstant.CheckState.Checked` or :py:class:`~TermTk.TTkCore.constant.TTkConstant.CheckState.PartiallyChecked`
'''
return self._checked
@ -137,7 +132,7 @@ class TTkRadioButton(TTkWidget):
def checkState(self):
''' Retrieve the state of the radiobutton
:return: :class:`~TermTk.TTkCore.constant.TTkConstant.CheckState` : the checkbox status
:return: :py:class:`~TermTk.TTkCore.constant.TTkConstant.CheckState` : the checkbox status
'''
if self._checked:
return TTkK.Checked
@ -148,7 +143,7 @@ class TTkRadioButton(TTkWidget):
''' Sets the radiobutton's check state.
:param state: state of the checkbox
:type state: :class:`~TermTk.TTkCore.constant.TTkConstant.CheckState`
:type state: :py:class:`~TermTk.TTkCore.constant.TTkConstant.CheckState`
'''
if not self._checked and state == TTkK.Unchecked: return
if self._checked and state != TTkK.Unchecked: return

120
TermTk/TTkWidgets/texedit.py

@ -651,145 +651,147 @@ class TTkTextEdit(TTkAbstractScrollArea):
:type multiLine: bool, optional
:param document: If required an external Document can be used in this text editor, this option is useful if multiple editors share the same document as in the `demo <https://ceccopierangiolieugenio.github.io/pyTermTk/sandbox/sandbox.html?fileUri=https://raw.githubusercontent.com/ceccopierangiolieugenio/pyTermTk/main/demo/showcase/textedit.py>`__, defaults to a new Document
:type document: :class:`~TermTk.TTkGui.textdocument.TTkTextDocument`, optional
:type document: :py:class:`TTkTextDocument`, optional
+-----------------------------------------------------------------------------------------------+
| `Signals <https://ceccopierangiolieugenio.github.io/pyTermTk/tutorial/003-signalslots.html>`_ |
+-----------------------------------------------------------------------------------------------+
.. py:method:: currentColorChanged(color)
:signal:
This signal is emitted if the current character color has changed, for example caused by a change of the cursor position.
:param color: the new color
:type color: :class:`~TermTk.TTkCore.color.TTkColor`
.. py:method:: undoAvailable(available)
:signal:
This signal is emitted whenever undo operations become available (available is true) or unavailable (available is false).
:param available: the availability of undo
:type available: bool
.. py:method:: redoAvailable(available)
:signal:
This signal is emitted whenever redo operations become available (available is true) or unavailable (available is false).
:param available: the availability of redo
:type available: bool
.. py:method:: textChanged()
:signal:
This signal is emitted whenever the document's content changes; for example, when text is inserted or deleted, or when formatting is applied.
.. py:method:: toAnsi()
.. py:method:: toAnsi()
.. py:method:: clear()
This method is forwarded to :meth:`~TermTk.TTkWidgets.texedit.TTkTextEditView.clear`
This method is forwarded to :meth:`TTkTextEditView.clear`
.. py:method:: setText(text)
This method is forwarded to :meth:`~TermTk.TTkWidgets.texedit.TTkTextEditView.setText`
This method is forwarded to :meth:`TTkTextEditView.setText`
.. py:method:: append(text)
This method is forwarded to :meth:`~TermTk.TTkWidgets.texedit.TTkTextEditView.append`
This method is forwarded to :meth:`TTkTextEditView.append`
.. py:method:: isReadOnly()
This method is forwarded to :meth:`~TermTk.TTkWidgets.texedit.TTkTextEditView.isReadOnly`
This method is forwarded to :meth:`TTkTextEditView.isReadOnly`
.. py:method:: setReadOnly(ro)
This method is forwarded to :meth:`~TermTk.TTkWidgets.texedit.TTkTextEditView.setReadOnly`
This method is forwarded to :meth:`TTkTextEditView.setReadOnly`
.. py:method:: document()
This method is forwarded to :meth:`~TermTk.TTkWidgets.texedit.TTkTextEditView.document`
This method is forwarded to :meth:`TTkTextEditView.document`
.. py:method:: wrapWidth()
This method is forwarded to :meth:`~TermTk.TTkWidgets.texedit.TTkTextEditView.wrapWidth`
This method is forwarded to :meth:`TTkTextEditView.wrapWidth`
.. py:method:: setWrapWidth(width)
This method is forwarded to :meth:`~TermTk.TTkWidgets.texedit.TTkTextEditView.setWrapWidth`
This method is forwarded to :meth:`TTkTextEditView.setWrapWidth`
.. py:method:: multiLine()
This method is forwarded to :meth:`~TermTk.TTkWidgets.texedit.TTkTextEditView.multiLine`
This method is forwarded to :meth:`TTkTextEditView.multiLine`
.. py:method:: lineWrapMode()
This method is forwarded to :meth:`~TermTk.TTkWidgets.texedit.TTkTextEditView.lineWrapMode`
This method is forwarded to :meth:`TTkTextEditView.lineWrapMode`
.. py:method:: setLineWrapMode(mode)
This method is forwarded to :meth:`~TermTk.TTkWidgets.texedit.TTkTextEditView.setLineWrapMode`
This method is forwarded to :meth:`TTkTextEditView.setLineWrapMode`
.. py:method:: wordWrapMode()
This method is forwarded to :meth:`~TermTk.TTkWidgets.texedit.TTkTextEditView.wordWrapMode`
This method is forwarded to :meth:`TTkTextEditView.wordWrapMode`
.. py:method:: setWordWrapMode(mode)
This method is forwarded to :meth:`~TermTk.TTkWidgets.texedit.TTkTextEditView.setWordWrapMode`
This method is forwarded to :meth:`TTkTextEditView.setWordWrapMode`
.. py:method:: textCursor()
This method is forwarded to :meth:`~TermTk.TTkWidgets.texedit.TTkTextEditView.textCursor`
This method is forwarded to :meth:`TTkTextEditView.textCursor`
.. py:method:: setColor(color)
This method is forwarded to :meth:`~TermTk.TTkWidgets.texedit.TTkTextEditView.setColor`
This method is forwarded to :meth:`TTkTextEditView.setColor`
.. py:method:: cut()
This method is forwarded to :meth:`~TermTk.TTkWidgets.texedit.TTkTextEditView.cut`
This method is forwarded to :meth:`TTkTextEditView.cut`
.. py:method:: copy()
This method is forwarded to :meth:`~TermTk.TTkWidgets.texedit.TTkTextEditView.copy`
This method is forwarded to :meth:`TTkTextEditView.copy`
.. py:method:: paste()
This method is forwarded to :meth:`~TermTk.TTkWidgets.texedit.TTkTextEditView.paste`
This method is forwarded to :meth:`TTkTextEditView.paste`
.. py:method:: undo()
This method is forwarded to :meth:`~TermTk.TTkWidgets.texedit.TTkTextEditView.undo`
This method is forwarded to :meth:`TTkTextEditView.undo`
.. py:method:: redo()
This method is forwarded to :meth:`~TermTk.TTkWidgets.texedit.TTkTextEditView.redo`
This method is forwarded to :meth:`TTkTextEditView.redo`
.. py:method:: isUndoAvailable()
This method is forwarded to :meth:`~TermTk.TTkWidgets.texedit.TTkTextEditView.isUndoAvailable`
This method is forwarded to :meth:`TTkTextEditView.isUndoAvailable`
.. py:method:: isRedoAvailable()
This method is forwarded to :meth:`~TermTk.TTkWidgets.texedit.TTkTextEditView.isRedoAvailable`
This method is forwarded to :meth:`TTkTextEditView.isRedoAvailable`
.. py:method:: toAnsi()
This method is forwarded to :meth:`~TermTk.TTkWidgets.texedit.TTkTextEditView.toAnsi`
This method is forwarded to :meth:`TTkTextEditView.toAnsi`
.. py:method:: toRawText()
This method is forwarded to :meth:`~TermTk.TTkWidgets.texedit.TTkTextEditView.toRawText`
This method is forwarded to :meth:`TTkTextEditView.toRawText`
.. py:method:: toPlainText()
This method is forwarded to :meth:`~TermTk.TTkWidgets.texedit.TTkTextEditView.toPlainText`
This method is forwarded to :meth:`TTkTextEditView.toPlainText`
'''
currentColorChanged:pyTTkSignal
'''
This signal is emitted if the current character color has changed,
for example caused by a change of the cursor position.
:param color: the new color
:type color: :py:class:`TTkColor`
'''
undoAvailable:pyTTkSignal
'''
This signal is emitted whenever undo operations become available (available is true)
or unavailable (available is false).
:param available: the availability of undo
:type available: bool
'''
redoAvailable:pyTTkSignal
'''
This signal is emitted whenever redo operations become available (available is true)
or unavailable (available is false).
:param available: the availability of redo
:type available: bool
'''
textChanged:pyTTkSignal
'''
This signal is emitted whenever the document's content changes;
for example, when text is inserted or deleted, or when formatting is applied.
'''
__slots__ = (
'_textEditView',
'_lineNumberView', '_lineNumber',

36
TermTk/TTkWidgets/widget.py

@ -59,7 +59,7 @@ class TTkWidget(TMouseEvents,TKeyEvents, TDragEvents):
:param name: the name of the widget, defaults to ""
:type name: str, optional
:param parent: the parent widget, defaults to None
:type parent: :class:`TTkWidget`, optional
:type parent: :py:class:`TTkWidget`, optional
:param int x: the x position, defaults to 0
:param int y: the y position, defaults to 0
@ -77,7 +77,7 @@ class TTkWidget(TMouseEvents,TKeyEvents, TDragEvents):
:param [int,int] minSize: the minSize [width,height] of the widget, optional
:param toolTip: This property holds the widget's tooltip
:type toolTip: :class:`~TermTk.TTkCore.string.TTkString`
:type toolTip: :py:class:`TTkString`
:param style: this field hold the custom style to be used by this widget
:type style: dict
@ -88,6 +88,38 @@ class TTkWidget(TMouseEvents,TKeyEvents, TDragEvents):
:param bool,optional enabled: the ability to handle input events, optional, defaults to True
'''
focusChanged:pyTTkSignal
'''
This signal is emitted whenever the focus status change
i.e. with the :meth:`setFocus` or :meth:`clearFocus` methods
:param status: the curent focus status
:type status: bool
'''
sizeChanged:pyTTkSignal
'''
This signal is emitted whenever the widget size change
:param width: the new widget width
:type width: int
:param height: the new widget height
:type height: int
'''
currentStyleChanged:pyTTkSignal
'''
This signal is emitted whenever the widget stye change
:param style: the new style applied
:type style: dict
'''
closed:pyTTkSignal
'''
This signal is emitted whenever the widget is closed
:param widget: the widget closed (=self)
:type widget: TTkWidget
'''
classStyle = {
'default': {'color': TTkColor.RST, 'borderColor': TTkColor.RST},
'disabled': {'color': TTkColor.fg('#888888'), 'borderColor': TTkColor.fg('#888888')},

5
docs/source/conf.py

@ -39,7 +39,12 @@ extensions = [
#'sphinx_epytext',
'sphinx.ext.autodoc', # Core library for html generation from docstrings
#'sphinx.ext.autosummary', # Create neat summary tables
# Personal extensions/hacks to overcome the
# FUCKNG unwritten idiotic sphinx rules
# Fuck you Sphinx!!!
'sphinx_ext_autosummary_reworked', # Create neat summary tables
'sphinx_PyRefRole_hacked', # Resolve Domainless TermTk Classes
'method_signal',
]

4
docs/source/info/resources/clipboard.rst

@ -7,7 +7,7 @@ Clipboard
.. _pyTermTk: https://github.com/ceccopierangiolieugenio/pyTermTk
pyTermTk_ include a clipboard wrapper :class:`~TermTk.TTkGui.clipboard.TTkClipboard`, around any of the following libraries:
pyTermTk_ include a clipboard wrapper :py:class:`TTkClipboard`, around any of the following libraries:
- `copykitten <https://github.com/klavionik/copykitten>`_ - Robust, dependency-free way to use the system clipboard in Python.
- `pyperclip <https://github.com/asweigart/pyperclip>`_ - Python module for cross-platform clipboard functions.
@ -46,7 +46,7 @@ i.e.
Usage
-----
Once initialized the clipboard manager, 2 apis are provided that can be used to access the clipboard (:class:`~TermTk.TTkGui.clipboard.TTkClipboard.setText`, :class:`~TermTk.TTkGui.clipboard.TTkClipboard.text`)
Once initialized the clipboard manager, 2 apis are provided that can be used to access the clipboard (:py:class:`TTkClipboard.setText`, :py:class:`TTkClipboard.text`)
.. code:: python

2
docs/source/info/resources/modal.rst

@ -4,5 +4,5 @@ Overlay Widgets (Windows)
An Overlay Widget is a Widget that is placed on top of any other components.
It is normally used to define toolbox or modal windows.
The routine :class:`~TermTk.TTkCore.helper.TTkHelper` -> :class:`~TermTk.TTkCore.helper.TTkHelper.overlay` is required in order to achieve this
The routine :py:class:`TTkHelper` -> :py:class:`TTkHelper.overlay` is required in order to achieve this

79
docs/source/sphinx_modules/sphinx_PyRefRole_hacked.py

@ -0,0 +1,79 @@
"""Sphinx extension to handle the signal directive in the method."""
__version__ = '2024.10'
import inspect
import ast
import sys
import types
import re
from typing import get_type_hints
from typing import get_overloads
from typing import TYPE_CHECKING, Any, ClassVar, NamedTuple, cast
from sphinx.util.inspect import signature, stringify_signature
from sphinx import addnodes
from docutils import nodes
from docutils.parsers.rst import directives
from sphinx.domains.python import PyMethod, PyObject
import sphinx.domains.python as sphinxPythonDomain
if True or TYPE_CHECKING:
from collections.abc import Sequence
from docutils.nodes import Node, system_message
from sphinx.application import Sphinx
from sphinx.extension import Extension
from sphinx.util.typing import ExtensionMetadata, OptionSpec
from sphinx.writers.html5 import HTML5Translator
import sphinx.ext.autosummary as seauto
import sphinx.ext.autosummary.generate as seautogenerate
import TermTk as ttk
import ast
import inspect
def setup(app: Sphinx) -> ExtensionMetadata:
'''Initialise the extension.'''
# Collect all pyTermTk roles and domains
modules = {}
def _parseModules(_mod):
if _file:=getattr(_mod,'__file__',None):
if '__init__.py' in _file and '/TermTk/' in _file:
print(_file)
for _name, _obj in inspect.getmembers(_mod):
if inspect.isclass(_obj):
if _name not in modules:
modules[_name] = _mod.__name__
modules[_name] = _mod.__name__ if len(_mod.__name__)>len(modules[_name]) else modules[_name]
print(f" * {_name=} = {_obj}")
for _module in sys.modules:
_parseModules(sys.modules[_module])
for x in modules.items():
print(x)
_process_link_bk = sphinxPythonDomain.PyXRefRole.process_link
def _hacked_process_link(self, env, refnode,
has_explicit_title, title: str, target, _process_link_bk=_process_link_bk) -> tuple[str, str]:
print(f"-----------> HACKED !!! {title=} {target=}")
oldTitle = title
if title in modules:
title = f"~{modules[title]}.{title}"
print(f"-----------> {oldTitle=} -> {title=}")
oldTarget = target
if target in modules:
target = f"~{modules[target]}.{target}"
print(f"-----------> {oldTarget=} -> {target=}")
return _process_link_bk(self, env, refnode,
has_explicit_title, title, target)
sphinxPythonDomain.PyXRefRole.process_link = _hacked_process_link

42
docs/source/sphinx_modules/sphinx_ext_autosummary_reworked.py

@ -102,12 +102,29 @@ def setup(app: Sphinx) -> ExtensionMetadata:
modSub = {}
modSubSorted = {}
modStyles = {}
ttkAllSignals={}
ttkAllSlots={}
def _getSignals(_obj):
ret = []
for _name in (_th:=get_type_hints(_obj)):
print(f"{_th=}")
if _name.startswith('_'): continue
if 'pyTTkSignal' in str(_th[_name]):
ret.append(_name)
else:
print(ttk.TTkString(f"element not typed: {_name} - { _th[_name]}",ttk.TTkColor.BG_CYAN))
return ret
def _parseModules(_mod):
if _file:=getattr(_mod,'__file__',None):
if '__init__.py' in _file and '/TermTk/' in _file:
print(_file)
for _name, _obj in inspect.getmembers(_mod):
if _mod.__name__ == 'TermTk.TTkCore.drivers': continue
if inspect.isclass(_obj):
if _name not in ttkAllSignals:
ttkAllSignals[_name] = _getSignals(_obj)
if _name not in modStyles:
modStyles[_name] = _get_classStyleCode(_obj)
if _name not in modules:
@ -121,6 +138,7 @@ def setup(app: Sphinx) -> ExtensionMetadata:
for x in modules.items():
print(x)
a,b = x
# if a == 'TermTk.TTkCore.drivers': continue
if b not in modSorted:
modSorted[b] = []
modSorted[b].append(a)
@ -167,8 +185,11 @@ def setup(app: Sphinx) -> ExtensionMetadata:
print(f"{context=}")
print(f"{modname=}")
print(f"{qualname=}")
ttkSignals = []
ttkSignalsImported = {}
ttkSlots = []
ttkSlotsImported = {}
ttkMethods = []
ttkInheritedMethods = []
ttkSubClasses = modSorted.get(name,[])
@ -188,15 +209,16 @@ def setup(app: Sphinx) -> ExtensionMetadata:
# _name = member[0]
# if _name.startswith('_'): continue
# _hint = get_type_hints(obj)[_name]
print(f"{obj=} - {get_type_hints(obj)=}")
for _name in (_th:=get_type_hints(obj)):
print(f"{_th=}")
if _name.startswith('_'): continue
if 'pyTTkSignal' in str(_th[_name]):
ttkSignals.append(_name)
else:
print(ttk.TTkString(f"element not typed: {_name} - { _th[_name]}",ttk.TTkColor.BG_CYAN))
print(ttkSignals)
# print(f"{obj=} - {get_type_hints(obj)=}")
# for _name in (_th:=get_type_hints(obj)):
# print(f"{_th=}")
# if _name.startswith('_'): continue
# if 'pyTTkSignal' in str(_th[_name]):
# ttkSignals.append(_name)
# else:
# print(ttk.TTkString(f"element not typed: {_name} - { _th[_name]}",ttk.TTkColor.BG_CYAN))
# print(ttkSignals)
def _hasmethod(obj, name):
return hasattr(obj, name) and type(getattr(obj, name)) in (types.MethodType, types.FunctionType)
@ -212,10 +234,10 @@ def setup(app: Sphinx) -> ExtensionMetadata:
context |= {
'TTkStyle':modStyles.get(qualname,''),
'TTkSignals':ttkAllSignals.get(qualname,''),
'TTkSubClasses': ttkSubClasses,
'TTkSubModules': ttkSubModules,
'TTkMethods':ttkMethods,
'TTkSignals':ttkSignals,
'TTkSlots':ttkSlots}
print('\n'.join([f" * {x}={context[x]}" for x in context]))

1
docs/source/templates/custom-class-template.01.rst

@ -5,6 +5,7 @@ Pippo CUSTOM_CLASS_TEMPLATE.001
.. currentmodule:: {{ module }}
.. autoclass:: {{ objname }}
:show-inheritance:
{% if TTkStyle %}
Style

2
docs/source/templates/custom-module-template.01.rst

@ -18,7 +18,7 @@ Pippo CUSTOM_MODULE_TEMPLATE.001
{% endif %}
{% if TTkSubModules %}
.. rubric:: Modules
.. rubric:: {{ _('Modules') }}
.. autosummary::
:toctree: Modules:

Loading…
Cancel
Save