Browse Source

chore: reworked autogen

pull/426/head
Parodi, Eugenio 🌶 9 months ago
parent
commit
f2d35ae24a
  1. 68
      libs/pyTermTk/TermTk/TTkWidgets/TTkModelView/table.py
  2. 12
      libs/pyTermTk/TermTk/TTkWidgets/TTkTerminal/terminal.py
  3. 4
      libs/pyTermTk/TermTk/TTkWidgets/texedit.py
  4. 2
      tools/autogenForwarded.py

68
libs/pyTermTk/TermTk/TTkWidgets/TTkModelView/table.py

@ -202,7 +202,7 @@ class TTkTable(TTkAbstractScrollArea):
.. seealso:: this method is forwarded to :py:meth:`TTkTableWidget.isUndoAvailable`
isUndoAvailable
:return: bool
'''
return self._tableView.isUndoAvailable()
@ -211,7 +211,7 @@ class TTkTable(TTkAbstractScrollArea):
.. seealso:: this method is forwarded to :py:meth:`TTkTableWidget.isRedoAvailable`
isRedoAvailable
:return: bool
'''
return self._tableView.isRedoAvailable()
@ -247,9 +247,9 @@ class TTkTable(TTkAbstractScrollArea):
If enable is true, enables sorting for the table and immediately trigger a
call to :meth:`sortByColumn`
with the current sort section and order
**Note**: Setter function for property sortingEnabled.
:param enable: the availability of undo
:type enable: bool
'''
@ -261,11 +261,11 @@ class TTkTable(TTkAbstractScrollArea):
This property holds whether sorting is enabled
If this property is true, sorting is enabled for the table.
If this property is false, sorting is not enabled. The default value is false.
**Note**: . Setting the property to true with :meth:`setSortingEnabled`
immediately triggers a call to :meth:`sortByColumn`
with the current sort section and order.
:return: bool
'''
return self._tableView.isSortingEnabled()
@ -275,13 +275,13 @@ class TTkTable(TTkAbstractScrollArea):
.. seealso:: this method is forwarded to :py:meth:`TTkTableWidget.sortByColumn`
Sorts the model by the values in the given column and order.
column may be -1, in which case no sort indicator will be shown and the model will return to its natural, unsorted order.
Note that not all models support this and may even crash in this case.
:param column: the column used for the sorting, -1 to keep the table unsorted
:type column: bool
:param order: the sort order
:type order: :py:class:`TTkK.SortOrder`
'''
@ -307,7 +307,7 @@ class TTkTable(TTkAbstractScrollArea):
.. seealso:: this method is forwarded to :py:meth:`TTkTableWidget.setSelection`
Selects the items within the given rect and in accordance with the specified selection flags.
:param pos: the x,y position of the rect
:type pos: tuple[int,int]
:param size: the width,height of the rect used for the selection
@ -321,7 +321,7 @@ class TTkTable(TTkAbstractScrollArea):
.. seealso:: this method is forwarded to :py:meth:`TTkTableWidget.selectRow`
Selects the given row in the table view
:param row: the row to be selected
:type row: int
'''
@ -331,7 +331,7 @@ class TTkTable(TTkAbstractScrollArea):
.. seealso:: this method is forwarded to :py:meth:`TTkTableWidget.selectColumn`
Selects the given column in the table view
:param col: the column to be selected
:type col: int
'''
@ -341,7 +341,7 @@ class TTkTable(TTkAbstractScrollArea):
.. seealso:: this method is forwarded to :py:meth:`TTkTableWidget.unselectRow`
Unselects the given row in the table view
:param row: the row to be unselected
:type row: int
'''
@ -351,7 +351,7 @@ class TTkTable(TTkAbstractScrollArea):
.. seealso:: this method is forwarded to :py:meth:`TTkTableWidget.unselectColumn`
Unselects the given column in the table view
:param column: the column to be unselected
:type column: int
'''
@ -361,7 +361,7 @@ class TTkTable(TTkAbstractScrollArea):
.. seealso:: this method is forwarded to :py:meth:`TTkTableWidget.rowCount`
Returns the number of rows.
:return: int
'''
return self._tableView.rowCount()
@ -370,7 +370,7 @@ class TTkTable(TTkAbstractScrollArea):
.. seealso:: this method is forwarded to :py:meth:`TTkTableWidget.currentRow`
Returns the row of the current item.
:return: int
'''
return self._tableView.currentRow()
@ -379,7 +379,7 @@ class TTkTable(TTkAbstractScrollArea):
.. seealso:: this method is forwarded to :py:meth:`TTkTableWidget.columnCount`
Returns the number of columns.
:return: int
'''
return self._tableView.columnCount()
@ -388,7 +388,7 @@ class TTkTable(TTkAbstractScrollArea):
.. seealso:: this method is forwarded to :py:meth:`TTkTableWidget.currentColumn`
Returns the column of the current item.
:return: int
'''
return self._tableView.currentColumn()
@ -397,7 +397,7 @@ class TTkTable(TTkAbstractScrollArea):
.. seealso:: this method is forwarded to :py:meth:`TTkTableWidget.verticalHeader`
Returns the table view's vertical header.
:return: :py:class:`TTkHeaderView`
'''
return self._tableView.verticalHeader()
@ -406,7 +406,7 @@ class TTkTable(TTkAbstractScrollArea):
.. seealso:: this method is forwarded to :py:meth:`TTkTableWidget.horizontalHeader`
Returns the table view's horizontal header.
:return: :py:class:`TTkHeaderView`
'''
return self._tableView.horizontalHeader()
@ -415,7 +415,7 @@ class TTkTable(TTkAbstractScrollArea):
.. seealso:: this method is forwarded to :py:meth:`TTkTableWidget.hSeparatorVisibility`
Returns the visibility status of the horizontal separator
:return: bool
'''
return self._tableView.hSeparatorVisibility()
@ -424,7 +424,7 @@ class TTkTable(TTkAbstractScrollArea):
.. seealso:: this method is forwarded to :py:meth:`TTkTableWidget.vSeparatorVisibility`
Returns the visibility status of the vertical separator
:return: bool
'''
return self._tableView.vSeparatorVisibility()
@ -433,9 +433,9 @@ class TTkTable(TTkAbstractScrollArea):
.. seealso:: this method is forwarded to :py:meth:`TTkTableWidget.setHSeparatorVisibility`
Set the the visibility of the horizontal separators (lines)
::
Customer Id First Name Last Name Company
1 DD37Cf93aecA6Dc Sheryl Baxter Rasmussen Group
@ -443,7 +443,7 @@ class TTkTable(TTkAbstractScrollArea):
3 6F94879bDAfE5a6 Roy Berry Murillo-Perry
:param visibility: the visibility status
:type visibility: bool
'''
@ -453,9 +453,9 @@ class TTkTable(TTkAbstractScrollArea):
.. seealso:: this method is forwarded to :py:meth:`TTkTableWidget.setVSeparatorVisibility`
Set the the visibility of the vertical separators (lines)
::
Customer Id First Name Last Name Company
1 DD37Cf93aecA6Dc Sheryl Baxter Rasmussen Group
2 1Ef7b82A4CAAD10 Preston Lozano Vega-Gentry
@ -463,7 +463,7 @@ class TTkTable(TTkAbstractScrollArea):
4 5Cef8BFA16c5e3c Linda Olsen Dominguez, Mcmillan and Don
5 053d585Ab6b3159 Joanna Bender Martin, Lang and Andrade
6 2d08FB17EE273F4 Aimee Downs Steele Group
:param visibility: the visibility status
:type visibility: bool
'''
@ -473,7 +473,7 @@ class TTkTable(TTkAbstractScrollArea):
.. seealso:: this method is forwarded to :py:meth:`TTkTableWidget.model`
Returns the model that this view is presenting.
:return: :py:class:`TTkAbstractTableModel`
'''
return self._tableView.model()
@ -482,7 +482,7 @@ class TTkTable(TTkAbstractScrollArea):
.. seealso:: this method is forwarded to :py:meth:`TTkTableWidget.setModel`
Sets the model for the view to present.
:param model:
:type model: :py:class:`TTkAbstractTableModel`
'''
@ -493,7 +493,7 @@ class TTkTable(TTkAbstractScrollArea):
.. seealso:: this method is forwarded to :py:meth:`TTkTableWidget.setColumnWidth`
Sets the width of the given column.
:param column: the column
:type column: int
:param width: its width
@ -506,7 +506,7 @@ class TTkTable(TTkAbstractScrollArea):
.. seealso:: this method is forwarded to :py:meth:`TTkTableWidget.resizeColumnToContents`
Resizes the given column based on the size hints of the delegate used to render each item in the column.
:param column: the column to be resized
:type column: int
'''
@ -525,7 +525,7 @@ class TTkTable(TTkAbstractScrollArea):
.. seealso:: this method is forwarded to :py:meth:`TTkTableWidget.setRowHeight`
Sets the height of the given row.
:param row: the row
:type row: int
:param height: its height
@ -538,7 +538,7 @@ class TTkTable(TTkAbstractScrollArea):
.. seealso:: this method is forwarded to :py:meth:`TTkTableWidget.resizeRowToContents`
Resizes the given row based on the size hints of the delegate used to render each item in the row.
:param row: the row to be resized
:type row: int
'''

12
libs/pyTermTk/TermTk/TTkWidgets/TTkTerminal/terminal.py

@ -72,7 +72,7 @@ class TTkTerminal(TTkAbstractScrollArea):
.. seealso:: this method is forwarded to :py:meth:`TTkTerminalView.titleChanged`
This signal is emitted when the terminal title change through OSC "ESC ]0;"
:param title: the new title
:type title: str
'''
@ -91,7 +91,7 @@ class TTkTerminal(TTkAbstractScrollArea):
.. seealso:: this method is forwarded to :py:meth:`TTkTerminalView.textSelected`
This signal is emitted when a text is selected.
:param text: the selected text
:type text: :py:class:`ttkString`
'''
@ -102,14 +102,14 @@ class TTkTerminal(TTkAbstractScrollArea):
.. seealso:: this method is forwarded to :py:meth:`TTkTerminalView.termData`
This signal is emitted when data event fires.
This happens for example when the user types or pastes into the terminal.
The event value is whatever 'str' results, in a typical setup,
this should be passed on to the backing pty.
This signal is used in :py:class:`TTkTerminalHelper` through :py:meth:`TTkTerminalHelper.attachTTkTerminal`
to frward all the terminal events to the pty interface.
:param data: the event data
:type data: str
'''
@ -120,7 +120,7 @@ class TTkTerminal(TTkAbstractScrollArea):
.. seealso:: this method is forwarded to :py:meth:`TTkTerminalView.termResized`
This signal is emitted when the terminal is resized.
:param size: the new size [width, height] of the terminal
:type size: (int,int)
'''

4
libs/pyTermTk/TermTk/TTkWidgets/texedit.py

@ -1200,7 +1200,7 @@ class TTkTextEdit(TTkAbstractScrollArea):
.. seealso:: this method is forwarded to :py:meth:`TTkTextEditView.extraSelections`
Returns previously set extra selections.
:rtype: list[:py:class:`ExtraSelection`]
'''
return self._textEditView.extraSelections()
@ -1211,7 +1211,7 @@ class TTkTextEdit(TTkAbstractScrollArea):
This function allows temporarily marking certain regions in the document with a given color,
specified as selections. This can be useful for example in a programming editor to mark a
whole line of text with a given background color to indicate the existence of a breakpoint.
:param extraSelections: the list of extra selections.
:type extraSelections: list[:py:class:`ExtraSelection`]
'''

2
tools/autogenForwarded.py

@ -109,7 +109,7 @@ def autogen_methods(data: _ForwardData) -> List[str]:
doc_indent + f".. seealso:: this method is forwarded to :py:meth:`{class_name}.{method_name}`\n",
])
if doc:
lines.extend([doc_indent + _l for _l in doc.split('\n')])
lines.extend([f"{doc_indent}{_l}" if _l else '' for _l in doc.split('\n')])
lines.append(doc_indent + "'''")
# Format the signature string
signatures.extend([

Loading…
Cancel
Save