Source code for TermTk.TTkAbstract.abstracttablemodel
+# MIT License
+#
+# Copyright (c) 2024 Eugenio Parodi <ceccopierangiolieugenio AT googlemail DOT com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in all
+# copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+__all__=['TTkAbstractTableModel','TTkModelIndex']
+
+fromTermTk.TTkCore.constantimportTTkK
+fromTermTk.TTkCore.stringimportTTkString
+fromTermTk.TTkCore.signalimportpyTTkSignal,pyTTkSlot
+
+
[docs]classTTkModelIndex():
+ '''
+ This class is used as an index into item models derived from :class:`~TermTk.TTkAbstract.abstracttablemodel.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.
+
+ 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.
+ '''
+ def__init__(self)->None:
+ pass
+
+
[docs]defrow(self)->int:
+ '''
+ Returns the row this model index refers to.
+
+ :return: int
+ '''
+ pass
+
+
[docs]defcol(self)->int:
+ '''
+ Returns the column this model index refers to.
+
+ :return: int
+ '''
+ pass
+
+
[docs]defdata(self)->object:
+ '''
+ Returns the data for the item referred to by the index.
+
+ :return: object
+ '''
+ pass
+
+
[docs]defsetData(self,data:object)->None:
+ '''
+ Set the data in the item referred by the current index.
+
+ :param data: the data to be set in the (row,col) position of the table
+ :type data: object
+ '''
+ pass
[docs]classTTkAbstractTableModel():
+ '''
+ :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`,
+ 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`.
+ 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
+
+ :class:`~TermTk.TTkWidgets.TTkModelView.tablemodelcsv.TTkTableModelCSV` subclass of :class:`~TermTk.TTkWidgets.TTkModelView.tablemodellist.TTkTableModelList` including the api to import csv data
+
+ +-----------------------------------------------------------------------------------------------+
+ | `Signals <https://ceccopierangiolieugenio.github.io/pyTermTk/tutorial/003-signalslots.html>`_ |
+ +-----------------------------------------------------------------------------------------------+
+
+ .. py:method:: dataChanged(pos,size)
+ :signal:
+
+ This signal is emitted whenever the data in an existing item changes.
+
+ If more items are affected, the pos/size definne the minimum area including all of those changes.
+
+ When reimplementing the :meth:`setData` function, this signal must be emitted explicitly.
+
+ :param pos: the topLeft margin of the modified area
+ :type pos: tuple(int,int)
+
+ :param size: the size of the modified area
+ :type size: tuple(int,int)
+ '''
+ __slots__=(
+ # Signals
+ 'dataChanged'
+ )
+ def__init__(self):
+ self.dataChanged=pyTTkSignal(tuple[int,int],tuple[int,int])
+
+
[docs]defrowCount(self)->int:
+ '''
+ Returns the number of rows of the current model.
+
+ :return: int
+ '''
+ raiseNotImplementedError()
+
+
[docs]defcolumnCount(self)->int:
+ '''
+ Returns the number of columns of the current moodel.
+
+ :return: int
+ '''
+ raiseNotImplementedError()
+
+
[docs]defindex(self,row:int,col:int)->TTkModelIndex:
+ '''
+ Returns the index of the item in the model specified by the given row, column.
+
+ :param row: the row position of the index
+ :type row: int
+ :param col: the column position of the index
+ :type col: int
+
+ :return: :class:`~TermTk.TTkAbstract.abstracttablemodel.TTkModelIndex`
+ '''
+ return_TTkModelIndexList(row,col,self)
+
+
[docs]defdata(self,row:int,col:int)->object:
+ '''
+ Returns the data stored for the item referred to by the row/column.
+
+ Note: If you do not have a value to return, return *None* instead of returning 0.
+
+ :param row: the row position of the data
+ :type row: int
+ :param col: the column position of the data
+ :type col: int
+
+ :return: object
+ '''
+ raiseNotImplementedError()
+
+
[docs]defsetData(self,row:int,col:int,data:object)->bool:
+ '''
+ Returns true if successful; otherwise returns false.
+
+ The :meth:`~TermTk.TTkAbstract.abstracttablemodel.TTkAbstractTableModel.dataChanged` signal should be emitted if the data was successfully set.
+
+ The base class implementation returns false. This function and :meth:`data` must be reimplemented for editable models.
+
+ :param row: the row position of the data
+ :type row: int
+ :param col: the column position of the data
+ :type col: int
+ :param data: the data to be set in the (row,col) position of the table
+ :type data: object
+
+ :return: bool
+ '''
+ returnFalse
+
+
[docs]defttkStringData(self,row:int,col:int)->TTkString:
+ '''
+ Returns the :class:`~TermTk.TTkCore.string.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`
+ '''
+ data=self.data(row,col)
+ ifisinstance(data,TTkString):
+ returndata
+ eliftype(data)==str:
+ returnTTkString(data)
+ else:
+ returnTTkString(str(data))
+
+
[docs]defheaderData(self,pos:int,orientation:TTkK.Direction)->TTkString:
+ '''
+ Returns the data for the given role and section in the header with the specified orientation.
+
+ For horizontal headers, the section number corresponds to the column number.
+ Similarly, for vertical headers, the section number corresponds to the row number.
+
+ :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`
+
+ :return: :class:`~TermTk.TTkCore.string.TTkString`
+ '''
+ iforientation==TTkK.HORIZONTAL:
+ returnTTkString(str(pos))
+ eliforientation==TTkK.VERTICAL:
+ returnTTkString(str(pos))
+ returnTTkString()
+
+
[docs]defflags(self,row:int,col:int)->TTkK.ItemFlag:
+ '''
+ 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`).
+
+ :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(
+ TTkK.ItemFlag.ItemIsEnabled|
+ TTkK.ItemFlag.ItemIsSelectable)
+
+
[docs]defsort(self,column:int,order:TTkK.SortOrder)->None:
+ '''
+ Sorts the model by column in the given order.
+
+ :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`
+ '''
+ pass
[docs]classDirection(int):
- '''This class type is used to describe the direction'''
+ '''This class type is used to describe the direction
+
+ .. autosummary::
+ HORIZONTAL
+ VERTICAL
+ '''HORIZONTAL=0x01+0x02'''Horizontal direction'''VERTICAL=0x04+0x08
@@ -212,8 +217,11 @@
Checked '''Unchecked=0x00
+ '''The item is unchecked.'''PartiallyChecked=0x01
- Checked=0x02
+ '''The item is partially checked. Items in hierarchical models may be partially checked if some, but not all, of their children are checked.'''
+ Checked=0x02
+ '''The item is checked.'''Unchecked=CheckState.UncheckedPartiallyChecked=CheckState.PartiallyChecked
@@ -221,6 +229,11 @@
[docs]classInsertPolicy(int):'''Specifies what the :class:`~TermTk.TTkWidgets.combobox.TTkComboBox` should do when a new string is entered by the user.
+
+ .. autosummary::
+ NoInsert
+ InsertAtTop
+ InsertAtBottom '''NoInsert=0x00'''The string will not be inserted into the combobox.'''
@@ -238,7 +251,14 @@
# '''The string is inserted in the alphabetic order in the combobox.'''
[docs]classDragDropMode(int):
- '''Specifies the Drag and Drop mode allowed by this widget'''
+ '''Specifies the Drag and Drop mode allowed by this widget
+
+ .. autosummary::
+ NoDragDrop
+ AllowDrag
+ AllowDrop
+ AllowDragDrop
+ '''NoDragDrop=0x00'''No Drag and Drop is allowed'''AllowDrag=0x01
@@ -262,8 +282,16 @@
DontShowIndicatorWhenChildless=ChildIndicatorPolicy.DontShowIndicatorWhenChildless
[docs]classSortOrder(int):
+ '''This enum describes how the items in a widget are sorted.
+
+ .. autosummary::
+ AscendingOrder
+ DescendingOrder
+ '''AscendingOrder=0x00
- DescendingOrder=0x01
+ '''The items are sorted ascending e.g. starts with 'AAA' ends with 'ZZZ' in Latin-1 locales'''
+ DescendingOrder=0x01
+ '''The items are sorted descending e.g. starts with 'ZZZ' ends with 'AAA' in Latin-1 locales'''
AscendingOrder=SortOrder.AscendingOrderDescendingOrder=SortOrder.DescendingOrder
@@ -281,6 +309,15 @@
'''Input Mouse Key Events reported by :class:`~TermTk.TTkCore.TTkTerm.inputmouse.TTkMouseEvent` -> :class:`~TermTk.TTkCore.TTkTerm.inputmouse.TTkMouseEvent.key`
+
+ .. autosummary::
+ NoButton
+ AllButtons
+ LeftButton
+ RightButton
+ MidButton
+ MiddleButton
+ Wheel '''NoButton=0x00000000'''The button state does not refer to any button.'''
@@ -306,7 +343,13 @@
Wheel=MouseKey.Wheel
[docs]classWrapMode(int):
- '''Those constants describes how text is wrapped in a document.'''
+ '''Those constants describes how text is wrapped in a document.
+
+ .. autosummary::
+ WordWrap
+ WrapAnywhere
+ WrapAtWordBoundaryOrAnywhere
+ '''# NoWrap = 0x00# '''Text is not wrapped at all.'''WordWrap=0x01
@@ -325,9 +368,19 @@
WrapAtWordBoundaryOrAnywhere=WrapMode.WrapAtWordBoundaryOrAnywhere
[docs]classLineWrapMode(int):
+ '''Those constants describes which wrapping status is required in the document
+
+ .. autosummary::
+ NoWrapk
+ WidgetWidthk
+ FixedWidthk
+ '''NoWrap=0x00
+ '''No Wrapping is applied'''WidgetWidth=0x01
- FixedWidth=0x03
+ '''Wrapping around the Widget width'''
+ FixedWidth=0x03
+ '''Wrapping around a fixed width'''
[docs]classTTkItemSelectionModel(int):
+ '''These values describes the way the selection model will be updated.
+
+ .. autosummary::
+ NoUpdate
+ Clear
+ Select
+ Deselect
+ Toggle
+ Current
+ Rows
+ Columns
+ SelectCurrent
+ ToggleCurrent
+ ClearAndSelect
+ '''
+ NoUpdate=0x0000
+ '''No selection will be made.'''
+ Clear=0x0001
+ '''The complete selection will be cleared.'''
+ Select=0x0002
+ '''All specified indexes will be selected.'''
+ Deselect=0x0004
+ '''All specified indexes will be deselected.'''
+ Toggle=0x0008
+ '''All specified indexes will be selected or deselected depending on their current state.'''
+ Current=0x0010
+ '''The current selection will be updated.'''
+ Rows=0x0020
+ '''All indexes will be expanded to span rows.'''
+ Columns=0x0040
+ '''All indexes will be expanded to span columns.'''
+ SelectCurrent=Select|Current
+ '''A combination of Select and Current, provided for convenience.'''
+ ToggleCurrent=Toggle|Current
+ '''A combination of Toggle and Current, provided for convenience.'''
+ ClearAndSelect=Clear|Select
+ '''A combination of Clear and Select, provided for convenience.'''
+
+
[docs]classItemFlag(int):
+ ''':class:`ItemFlag` describes the properties of an item
+
+ .. autosummary::
+ NoItemFlags
+ ItemIsSelectable
+ ItemIsEditable
+ ItemIsEnabled
+ '''
+ NoItemFlags=0x0000
+ '''It does not have any properties set.'''
+ ItemIsSelectable=0x0001
+ '''It can be selected.'''
+ ItemIsEditable=0x0002
+ '''It can be edited.'''
+ # ItemIsDragEnabled = 0x0004
+ # '''It can be dragged.'''
+ # ItemIsDropEnabled = 0x0008
+ # '''It can be used as a drop target.'''
+ # ItemIsUserCheckable = 0x0010
+ # '''It can be checked or unchecked by the user.'''
+ ItemIsEnabled=0x0020
+ '''The user can interact with the item.'''
+
# LayoutItem Types
[docs]classLayoutItemTypes(int):
- '''Types used internally in :mod:`~TermTk.TTkLayouts`'''
+ '''Types used internally in :mod:`~TermTk.TTkLayouts`
+
+ .. autosummary::
+ LayoutItem
+ WidgetItem
+ '''LayoutItem=0x01'''Item Type Layout'''WidgetItem=0x02
@@ -432,6 +573,16 @@
WidgetItem=LayoutItemTypes.WidgetItem
[docs]classWindowFlag(int):
+ '''
+ Those flags are used to enable customization of the window controls.
+
+ .. autosummary::
+ WindowReduceButtonHint
+ WindowMinimizeButtonHint
+ WindowMaximizeButtonHint
+ WindowMinMaxButtonsHint
+ WindowCloseButtonHint
+ '''# FramelessWindowHint = 0x00000800# ''' Produces a borderless window.'''# CustomizeWindowHint = 0x02000000
@@ -463,6 +614,10 @@
'''Input Key Types Key type reported by :class:`~TermTk.TTkCore.TTkTerm.inputkey.TTkKeyEvent` -> :class:`~TermTk.TTkCore.TTkTerm.inputkey.TTkKeyEvent.key`
+
+ .. autosummary::
+ Character
+ SpecialKey '''Character=0x0001'''Input Char Key'''
@@ -477,6 +632,19 @@
'''Input :class:`~TermTk.TTkCore.constant.TTkConstant.KeyType.SpecialKey` modifiers Modifier reported by :class:`~TermTk.TTkCore.TTkTerm.inputkey.TTkKeyEvent` -> :class:`~TermTk.TTkCore.TTkTerm.inputkey.TTkKeyEvent.mod`
+
+ .. autosummary::
+ NoModifier
+ ShiftModifier
+ ControlModifier
+ AltModifier
+ MetaModifier
+ KeypadModifier
+ GroupSwitchModifier
+ SHIFT
+ META
+ CTRL
+ ALT '''NoModifier=0x00000000'''No modifier key is pressed.'''
@@ -516,9 +684,17 @@
ALT=KeyModifier.ALT
[docs]classShortcutContext(int):
- '''For a :class:`~TermTk.TTkCore.shortcut.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:'''
+ '''
+ For a :class:`~TermTk.TTkCore.shortcut.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:
+
+ .. autosummary::
+ WidgetShortcut
+ WidgetWithChildrenShortcut
+ WindowShortcut
+ ApplicationShortcut
+ '''WidgetShortcut=0x00'''The shortcut is active when its parent widget has focus.'''WidgetWithChildrenShortcut=0x03
@@ -810,7 +986,7 @@
Key_Dead_e=0x01001282Key_Dead_E=0x01001283Key_Dead_i=0x01001284
- Key_Dead_I=0x01001285
+ Key_Dead_I=0x01001285dd3e612f3ca6f9971b2aa0f5e622e21244da98ffKey_Dead_o=0x01001286Key_Dead_O=0x01001287Key_Dead_u=0x01001288
diff --git a/_modules/TermTk/TTkCore/drivers/windows.html b/_modules/TermTk/TTkCore/drivers/windows.html
index 4b28c840..ab7469bf 100644
--- a/_modules/TermTk/TTkCore/drivers/windows.html
+++ b/_modules/TermTk/TTkCore/drivers/windows.html
@@ -3,7 +3,7 @@
- TermTk.TTkCore.drivers.windows — pyTermTk 0.39.0-a
+ TermTk.TTkCore.drivers.windows — pyTermTk 0.40.0-a
documentation
diff --git a/_modules/TermTk/TTkCore/helper.html b/_modules/TermTk/TTkCore/helper.html
index e84ee303..6fed2a2b 100644
--- a/_modules/TermTk/TTkCore/helper.html
+++ b/_modules/TermTk/TTkCore/helper.html
@@ -3,7 +3,7 @@
- TermTk.TTkCore.helper — pyTermTk 0.39.0-a
+ TermTk.TTkCore.helper — pyTermTk 0.40.0-a
documentation
@@ -275,12 +275,12 @@
wx+=xwy+=y
+ wi=widget.widgetItem()
+ wi.setLayer(wi.LAYER1)iftoolWindow:# Forcing the layer to:# TTkLayoutItem.LAYER1 = 0x40000000widget.move(wx,wy)
- wi=widget.widgetItem()
- wi.setLayer(wi.LAYER1)else:TTkHelper._overlay.append(TTkHelper._Overlay(wx,wy,widget,TTkHelper._focusWidget,modal))TTkHelper._rootWidget.rootLayout().addWidget(widget)
@@ -634,6 +634,8 @@
y=my+1else:# Draw above the Mousey=max(0,my-th)
+ wi=tt.widgetItem()
+ wi.setLayer(wi.LAYER3)tt.move(x,y)TTkHelper._rootWidget.rootLayout().addWidget(tt)tt.raiseWidget()
diff --git a/_modules/TermTk/TTkCore/shortcut.html b/_modules/TermTk/TTkCore/shortcut.html
new file mode 100644
index 00000000..9c89843b
--- /dev/null
+++ b/_modules/TermTk/TTkCore/shortcut.html
@@ -0,0 +1,237 @@
+
+
+
+
+
+ TermTk.TTkCore.shortcut — pyTermTk 0.40.0-a
+ documentation
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# MIT License
+#
+# Copyright (c) 2024 Eugenio Parodi <ceccopierangiolieugenio AT googlemail DOT com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in all
+# copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+__all__=['TTkShortcut']
+
+fromTermTk.TTkCore.logimportTTkLog
+fromTermTk.TTkCore.constantimportTTkK
+fromTermTk.TTkCore.helperimportTTkHelper
+fromTermTk.TTkCore.signalimportpyTTkSlot,pyTTkSignal
+fromTermTk.TTkCore.TTkTerm.inputkeyimportTTkKeyEvent
+
+classTTkStandardKey():
+ pass
+
+classTTkKeySequence():
+ __slots__=('_key')
+ def__init__(self,key:int):
+ self._key=key
+ mod=(
+ (TTkK.ControlModifierifkey&TTkK.CTRLelse0)|
+ (TTkK.AltModifierifkey&TTkK.ALTelse0)|
+ (TTkK.ShiftModifierifkey&TTkK.SHIFTelse0))
+ key&=~(TTkK.CTRL|TTkK.ALT|TTkK.SHIFT|TTkK.META)
+ t=TTkK.SpecialKeyifmodelseTTkK.Character
+ self._key=TTkKeyEvent(type=t,key=key,mod=mod,code="")
+ ifmod:
+ self._key=TTkKeyEvent(mod=mod,code="",type=TTkK.SpecialKey,key=key)
+ else:
+ self._key=TTkKeyEvent(mod=mod,code="",type=TTkK.Character,key=chr(key))
+
+
+
+ def__hash__(self)->int:
+ returnself._key.__hash__()
+
+ def__eq__(self,__value:object)->bool:
+ pass
+
+
[docs]defisPlainText(self)->bool:
+ ''' Return True if the string does not include colors or modifications '''
+ returnall(TTkColor.RST==cforcinself._colors)
+
+
[docs]deftoAscii(self)->str:''' Return the ascii representation of the string '''returnself._text
+# MIT License
+#
+# Copyright (c) 2024 Eugenio Parodi <ceccopierangiolieugenio AT googlemail DOT com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in all
+# copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+__all__=[
+ 'ttkCrossOpen',
+ 'ttkCrossSave','ttkCrossSaveAs',
+ 'TTkEncoding','ImageData',
+ 'ttkConnectDragOpen',
+ 'ttkEmitDragOpen','ttkEmitFileOpen']
+
+importos
+importimportlib.util
+importjson
+fromdataclassesimportdataclass
+
+fromTermTkimportpyTTkSlot,pyTTkSignal
+fromTermTkimportTTkLog
+fromTermTkimportTTkMessageBox,TTkFileDialogPicker,TTkHelper,TTkString,TTkK,TTkColor
+
+classImageData:
+ size:list[int,int]=(0,0)
+ data:list[list[list[int,int,int,int]]]=[]
+
+ttkCrossOpen=None
+ttkCrossSave=None
+ttkCrossSaveAs=None
+ttkEmitDragOpen=None
+ttkEmitFileOpen=None
+ttkConnectDragOpen=None
+
+
Source code for TermTk.TTkWidgets.TTkModelView.table
+# MIT License
+#
+# Copyright (c) 2024 Eugenio Parodi <ceccopierangiolieugenio AT googlemail DOT com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in all
+# copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+__all__=['TTkTable']
+
+fromTermTk.TTkCore.constantimportTTkK
+fromTermTk.TTkWidgets.TTkModelView.tablewidgetimportTTkTableWidget
+fromTermTk.TTkAbstract.abstractscrollareaimportTTkAbstractScrollArea
+fromTermTk.TTkAbstract.abstracttablemodelimportTTkAbstractTableModel
+
+
[docs]classTTkTable(TTkAbstractScrollArea):
+ '''
+ A :class:`TTkTable` implements a table view (:class:`~TermTk.TTkWidgets.TTkModelView.tablewidget.TTkTableWidget`) that displays items from a model.
+
+ ::
+
+ Customer Id ╿First Name ╿Last Name ╿Company ╿City ╿
+ 1 │DD37Cf93aecA6Dc │Sheryl │Baxter │Rasmussen Group │East Leonard │
+ ╾╌╌┼────────────────┼───────────┼────────────┼────────────────────────────────┼────────────────────┤
+ 2 │1Ef7b82A4CAAD10 │Preston │Lozano │Vega-Gentry │East Jimmychester │
+ ╾╌╌┼────────────────┼───────────┼────────────┼────────────────────────────────┼────────────────────┤
+ 3 │6F94879bDAfE5a6 │Roy │Berry │Murillo-Perry │Isabelborough │
+ ╾╌╌┼────────────────┼───────────┼────────────┼────────────────────────────────┼────────────────────┤
+ 4 │5Cef8BFA16c5e3c │Linda │Olsen │Dominguez, Mcmillan and Donovan │Bensonview │
+ ╾╌╌┼────────────────┼───────────┼────────────┼────────────────────────────────┼────────────────────┤
+ 5 │053d585Ab6b3159 │Joanna │Bender │Martin, Lang and Andrade │West Priscilla │
+ ╾╌╌┼────────────────┼───────────┼────────────┼────────────────────────────────┼────────────────────┤
+ 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
+
+ +-----------------------------------------------------------------------------------------------+
+ | `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`
+
+ .. py:method:: redo()
+
+ This method is forwarded to :meth:`~TermTk.TTkWidgets.TTkModelView.tablewidget.TTkTableWidget.redo`
+
+ .. py:method:: isUndoAvailable()
+
+ This method is forwarded to :meth:`~TermTk.TTkWidgets.TTkModelView.tablewidget.TTkTableWidget.isUndoAvailable`
+
+ .. py:method:: isRedoAvailable()
+
+ This method is forwarded to :meth:`~TermTk.TTkWidgets.TTkModelView.tablewidget.TTkTableWidget.isRedoAvailable`
+
+ .. py:method:: copy()
+
+ This method is forwarded to :meth:`~TermTk.TTkWidgets.TTkModelView.tablewidget.TTkTableWidget.copy`
+
+ .. py:method:: cut()
+
+ This method is forwarded to :meth:`~TermTk.TTkWidgets.TTkModelView.tablewidget.TTkTableWidget.cut`
+
+ .. py:method:: paste()
+
+ This method is forwarded to :meth:`~TermTk.TTkWidgets.TTkModelView.tablewidget.TTkTableWidget.paste`
+
+ .. py:method:: setSortingEnabled()
+
+ This method is forwarded to :meth:`~TermTk.TTkWidgets.TTkModelView.tablewidget.TTkTableWidget.setSortingEnabled`
+
+ .. py:method:: isSortingEnabled()
+
+ This method is forwarded to :meth:`~TermTk.TTkWidgets.TTkModelView.tablewidget.TTkTableWidget.isSortingEnabled`
+
+ .. py:method:: sortByColumn()
+
+ This method is forwarded to :meth:`~TermTk.TTkWidgets.TTkModelView.tablewidget.TTkTableWidget.sortByColumn`
+
+ .. py:method:: clearSelection()
+
+ This method is forwarded to :meth:`~TermTk.TTkWidgets.TTkModelView.tablewidget.TTkTableWidget.clearSelection`
+
+ .. py:method:: selectAll()
+
+ This method is forwarded to :meth:`~TermTk.TTkWidgets.TTkModelView.tablewidget.TTkTableWidget.selectAll`
+
+ .. py:method:: setSelection()
+
+ This method is forwarded to :meth:`~TermTk.TTkWidgets.TTkModelView.tablewidget.TTkTableWidget.setSelection`
+
+ .. py:method:: selectRow()
+
+ This method is forwarded to :meth:`~TermTk.TTkWidgets.TTkModelView.tablewidget.TTkTableWidget.selectRow`
+
+ .. py:method:: selectColumn()
+
+ This method is forwarded to :meth:`~TermTk.TTkWidgets.TTkModelView.tablewidget.TTkTableWidget.selectColumn`
+
+ .. py:method:: unselectRow()
+
+ This method is forwarded to :meth:`~TermTk.TTkWidgets.TTkModelView.tablewidget.TTkTableWidget.unselectRow`
+
+ .. py:method:: unselectColumn()
+
+ This method is forwarded to :meth:`~TermTk.TTkWidgets.TTkModelView.tablewidget.TTkTableWidget.unselectColumn`
+
+ .. py:method:: rowCount()
+
+ This method is forwarded to :meth:`~TermTk.TTkWidgets.TTkModelView.tablewidget.TTkTableWidget.rowCount`
+
+ .. py:method:: currentRow()
+
+ This method is forwarded to :meth:`~TermTk.TTkWidgets.TTkModelView.tablewidget.TTkTableWidget.currentRow`
+
+ .. py:method:: columnCount()
+
+ This method is forwarded to :meth:`~TermTk.TTkWidgets.TTkModelView.tablewidget.TTkTableWidget.columnCount`
+
+ .. py:method:: currentColumn()
+
+ This method is forwarded to :meth:`~TermTk.TTkWidgets.TTkModelView.tablewidget.TTkTableWidget.currentColumn`
+
+ .. py:method:: verticalHeader()
+
+ This method is forwarded to :meth:`~TermTk.TTkWidgets.TTkModelView.tablewidget.TTkTableWidget.verticalHeader`
+
+ .. py:method:: horizontalHeader()
+
+ This method is forwarded to :meth:`~TermTk.TTkWidgets.TTkModelView.tablewidget.TTkTableWidget.horizontalHeader`
+
+ .. py:method:: hSeparatorVisibility()
+
+ This method is forwarded to :meth:`~TermTk.TTkWidgets.TTkModelView.tablewidget.TTkTableWidget.hSeparatorVisibility`
+
+ .. py:method:: vSeparatorVisibility()
+
+ This method is forwarded to :meth:`~TermTk.TTkWidgets.TTkModelView.tablewidget.TTkTableWidget.vSeparatorVisibility`
+
+ .. py:method:: setHSeparatorVisibility()
+
+ This method is forwarded to :meth:`~TermTk.TTkWidgets.TTkModelView.tablewidget.TTkTableWidget.setHSeparatorVisibility`
+
+ .. py:method:: setVSeparatorVisibility()
+
+ This method is forwarded to :meth:`~TermTk.TTkWidgets.TTkModelView.tablewidget.TTkTableWidget.setVSeparatorVisibility`
+
+ .. py:method:: model()
+
+ This method is forwarded to :meth:`~TermTk.TTkWidgets.TTkModelView.tablewidget.TTkTableWidget.model`
+
+ .. py:method:: setModel()
+
+ This method is forwarded to :meth:`~TermTk.TTkWidgets.TTkModelView.tablewidget.TTkTableWidget.setModel`
+
+ .. py:method:: setColumnWidth()
+
+ This method is forwarded to :meth:`~TermTk.TTkWidgets.TTkModelView.tablewidget.TTkTableWidget.setColumnWidth`
+
+ .. py:method:: resizeColumnToContents()
+
+ This method is forwarded to :meth:`~TermTk.TTkWidgets.TTkModelView.tablewidget.TTkTableWidget.resizeColumnToContents`
+
+ .. py:method:: resizeColumnsToContents()
+
+ This method is forwarded to :meth:`~TermTk.TTkWidgets.TTkModelView.tablewidget.TTkTableWidget.resizeColumnsToContents`
+
+ .. py:method:: setRowHeight()
+
+ This method is forwarded to :meth:`~TermTk.TTkWidgets.TTkModelView.tablewidget.TTkTableWidget.setRowHeight`
+
+ .. py:method:: resizeRowToContents()
+
+ This method is forwarded to :meth:`~TermTk.TTkWidgets.TTkModelView.tablewidget.TTkTableWidget.resizeRowToContents`
+
+ .. py:method:: resizeRowsToContents()
+
+ This method is forwarded to :meth:`~TermTk.TTkWidgets.TTkModelView.tablewidget.TTkTableWidget.resizeRowsToContents`
+
+
+ '''
+ __slots__=(
+ '_tableView',
+ # Forwarded Signals
+ # 'cellActivated',
+ 'cellChanged',
+ 'cellClicked','cellDoubleClicked',
+ 'cellEntered',# 'cellPressed',
+ 'currentCellChanged',
+
+ # Forwarded Methods From TTkTable
+ 'undo','redo',
+ 'isUndoAvailable','isRedoAvailable',
+ 'copy','cut','paste',
+ 'setSortingEnabled','isSortingEnabled','sortByColumn',
+ 'clearSelection','selectAll','setSelection',
+ 'selectRow','selectColumn','unselectRow','unselectColumn',
+ 'rowCount','currentRow','columnCount','currentColumn',
+ 'verticalHeader','horizontalHeader',
+ 'hSeparatorVisibility','vSeparatorVisibility','setHSeparatorVisibility','setVSeparatorVisibility',
+ 'model','setModel',
+ 'setColumnWidth','resizeColumnToContents','resizeColumnsToContents',
+ 'setRowHeight','resizeRowToContents','resizeRowsToContents',
+ )
+
+ def__init__(self,*,
+ parent=None,visible=True,
+ **kwargs):
+ self._tableView=None
+ super().__init__(parent=parent,visible=visible,**kwargs)
+ self._tableView:TTkTableWidget=kwargs.get('TableWidget',TTkTableWidget(**kwargs))
+ self.setViewport(self._tableView)
+ # self.setFocusPolicy(TTkK.ClickFocus)
+
+ # Forward Signals
+ self.cellChanged=self._tableView.cellChanged
+ self.cellClicked=self._tableView.cellClicked
+ self.cellEntered=self._tableView.cellEntered
+ self.cellDoubleClicked=self._tableView.cellDoubleClicked
+ self.currentCellChanged=self._tableView.currentCellChanged
+
+ # Forward Methods
+ self.setFocus=self._tableView.setFocus
+ self.focusChanged=self._tableView.focusChanged
+
+ self.undo=self._tableView.undo
+ self.redo=self._tableView.redo
+
+ self.isUndoAvailable=self._tableView.isUndoAvailable
+ self.isRedoAvailable=self._tableView.isRedoAvailable
+
+ self.copy=self._tableView.copy
+ self.cut=self._tableView.cut
+ self.paste=self._tableView.paste
+
+ self.setSortingEnabled=self._tableView.setSortingEnabled
+ self.isSortingEnabled=self._tableView.isSortingEnabled
+ self.sortByColumn=self._tableView.sortByColumn
+
+ self.clearSelection=self._tableView.clearSelection
+ self.selectAll=self._tableView.selectAll
+ self.setSelection=self._tableView.setSelection
+ self.selectRow=self._tableView.selectRow
+ self.selectColumn=self._tableView.selectColumn
+ self.unselectRow=self._tableView.unselectRow
+ self.unselectColumn=self._tableView.unselectColumn
+
+ self.rowCount=self._tableView.rowCount
+ self.currentRow=self._tableView.currentRow
+ self.columnCount=self._tableView.columnCount
+ self.currentColumn=self._tableView.currentColumn
+
+ self.verticalHeader=self._tableView.verticalHeader
+ self.horizontalHeader=self._tableView.horizontalHeader
+
+ self.hSeparatorVisibility=self._tableView.hSeparatorVisibility
+ self.vSeparatorVisibility=self._tableView.vSeparatorVisibility
+ self.setHSeparatorVisibility=self._tableView.setHSeparatorVisibility
+ self.setVSeparatorVisibility=self._tableView.setVSeparatorVisibility
+
+ self.model=self._tableView.model
+ self.setModel=self._tableView.setModel
+
+ self.setColumnWidth=self._tableView.setColumnWidth
+ self.resizeColumnToContents=self._tableView.resizeColumnToContents
+ self.resizeColumnsToContents=self._tableView.resizeColumnsToContents
+ self.setRowHeight=self._tableView.setRowHeight
+ self.resizeRowToContents=self._tableView.resizeRowToContents
+ self.resizeRowsToContents=self._tableView.resizeRowsToContents
+
+
+ defstyle(self):
+ ifself._tableView:
+ returnself._tableView.style()
+ returnsuper().style()
+
+ defsetStyle(self,style):
+ ifself._tableView:
+ self._tableView.setStyle(style)
+ returnsuper().setStyle(style)
+
+ defmergeStyle(self,style):
+ ifself._tableView:
+ self._tableView.mergeStyle(style)
+ returnsuper().mergeStyle(style)
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/_modules/TermTk/TTkWidgets/TTkModelView/tablemodelcsv.html b/_modules/TermTk/TTkWidgets/TTkModelView/tablemodelcsv.html
new file mode 100644
index 00000000..2f471676
--- /dev/null
+++ b/_modules/TermTk/TTkWidgets/TTkModelView/tablemodelcsv.html
@@ -0,0 +1,221 @@
+
+
+
+
+
+ TermTk.TTkWidgets.TTkModelView.tablemodelcsv — pyTermTk 0.40.0-a
+ documentation
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Source code for TermTk.TTkWidgets.TTkModelView.tablemodelcsv
+# MIT License
+#
+# Copyright (c) 2024 Eugenio Parodi <ceccopierangiolieugenio AT googlemail DOT com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in all
+# copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+__all__=['TTkTableModelCSV']
+
+importcsv
+
+fromTermTk.TTkCore.constantimportTTkK
+fromTermTk.TTkWidgets.TTkModelView.tablemodellistimportTTkTableModelList
+
+
[docs]classTTkTableModelCSV(TTkTableModelList):
+ '''
+ :class:`TTkTableModelCSV` extends :class:`~TermTk.TTkWidgets.TTkModelView.tablemodellist.TTkTableModelList` with cvs loading helpers.
+
+ You can address the csv file through the Filename (filename) or the FileDescriptor (fd).
+
+ ::
+
+ import TermTk as ttk
+
+ # TableModel from csv filename
+ tm1 = ttk.TTkTableModelCSV(filename='path/file.csv')
+
+ # TableModel from csv FileDescriptor
+ with open('path/file.csv') as fd:
+ tm2 = ttk.TTkTableModelCSV(fd=fd)
+
+ :param filename: the csv filename, if missing the file descriptor is used instead.
+ :type filename: str, optional
+
+ :param fd: the FileDescriptor
+ :type fd: io, optional
+ '''
+
+ def__init__(self,*,filename:str=None,fd=None):
+ data,head,idx=[[]],[],[]
+ iffilename:
+ withopen(filename,"r")asfd:
+ data,head,idx=self._csvImport(fd)
+ eliffd:
+ data,head,idx=self._csvImport(fd)
+ super().__init__(data=data,header=head,indexes=idx)
+
+ def_csvImport(self,fd)->tuple[list,list,list[list]]:
+ data,head,idx=[],[],[]
+ sniffer=csv.Sniffer()
+ has_header=sniffer.has_header(fd.read(2048))
+ fd.seek(0)
+ csvreader=csv.reader(fd)
+ forrowincsvreader:
+ data.append(row)
+ ifhas_header:
+ head=data.pop(0)
+ # check if the first column include an index:
+ ifself._checkIndexColumn(data):
+ head.pop(0)
+ forlindata:
+ idx.append(l.pop(0))
+ returndata,head,idx
+
+ def_checkIndexColumn(self,data:list[list])->bool:
+ ifall(l[0].isdigit()forlindata):
+ num=int(data[0][0])
+ returnall(num+i==int(l[0])fori,linenumerate(data))
+ returnFalse
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/_modules/TermTk/TTkWidgets/TTkModelView/tablemodellist.html b/_modules/TermTk/TTkWidgets/TTkModelView/tablemodellist.html
new file mode 100644
index 00000000..436d9c27
--- /dev/null
+++ b/_modules/TermTk/TTkWidgets/TTkModelView/tablemodellist.html
@@ -0,0 +1,257 @@
+
+
+
+
+
+ TermTk.TTkWidgets.TTkModelView.tablemodellist — pyTermTk 0.40.0-a
+ documentation
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Source code for TermTk.TTkWidgets.TTkModelView.tablemodellist
+# MIT License
+#
+# Copyright (c) 2024 Eugenio Parodi <ceccopierangiolieugenio AT googlemail DOT com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in all
+# copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+__all__=['TTkTableModelList']
+
+fromTermTk.TTkCore.constantimportTTkK
+fromTermTk.TTkAbstract.abstracttablemodelimportTTkAbstractTableModel,TTkModelIndex
+
+class_TTkModelIndexList(TTkModelIndex):
+ __slots__=('_col','_rowId','_rowCb')
+ def__init__(self,col:int,rowId:list,rowCb)->None:
+ self._col=col
+ self._rowId=rowId
+ self._rowCb=rowCb
+ super().__init__()
+
+ defrow(self)->int:
+ returnself._rowCb(self._rowId)
+
+ defcol(self)->int:
+ returnself._col
+
+ defdata(self)->object:
+ returnself._rowId[self._col]
+
+ defsetData(self,data:object)->None:
+ self._rowId[self._col]=data
+
+
[docs]classTTkTableModelList(TTkAbstractTableModel):
+ '''
+ :class:`TTkTableModelList` extends :class:`~TermTk.TTkAbstract.abstracttablemodel.TTkAbstractTableModel`,
+ including a basic model with a 2d list data structure
+
+ :param data: the 2D List model for the view to present.
+ :type data: list[list]
+
+ :param header: the header labels, defaults to the column number.
+ :type header: list[str], optional
+
+ :param indexes: the index labels, defaults to the line number.
+ :type indexes: list[str], optional
+ '''
+
+ __slots__=('_data','_dataOriginal','_hheader','_vheader')
+
+ def__init__(self,*,data:list[list[object]]=[],header:list[str]=[],indexes:list[str]=[])->None:
+ self._data=self._dataOriginal=dataifdataelse[['']]
+ self._hheader=header
+ self._vheader=indexes
+ super().__init__()
+
+ defmodelList(self)->list[list]:
+ returnself._data
+
+ defsetModelList(self,modelList:list[list])->None:
+ ifmodelList==self._data:return
+ self._data=modelList
+
+
Source code for TermTk.TTkWidgets.TTkModelView.tablewidget
+# MIT License
+#
+# Copyright (c) 2024 Eugenio Parodi <ceccopierangiolieugenio AT googlemail DOT com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in all
+# copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+
+__all__=['TTkTableWidget','TTkHeaderView']
+
+fromdataclassesimportdataclass
+
+fromTermTk.TTkCore.logimportTTkLog
+fromTermTk.TTkCore.constantimportTTkK
+fromTermTk.TTkCore.stringimportTTkString
+fromTermTk.TTkCore.colorimportTTkColor
+fromTermTk.TTkCore.signalimportpyTTkSignal,pyTTkSlot
+
+fromTermTk.TTkGui.clipboardimportTTkClipboard
+fromTermTk.TTkGui.textcursorimportTTkTextCursor
+
+fromTermTk.TTkWidgets.texeditimportTTkTextEdit
+fromTermTk.TTkWidgets.spinboximportTTkSpinBox
+fromTermTk.TTkWidgets.TTkPickers.textpickerimportTTkTextPicker
+fromTermTk.TTkWidgets.TTkModelView.tablemodellistimportTTkTableModelList,TTkModelIndex
+
+fromTermTk.TTkAbstract.abstractscrollviewimportTTkAbstractScrollView
+fromTermTk.TTkAbstract.abstracttablemodelimportTTkAbstractTableModel
+
+
[docs]classTTkHeaderView():
+ '''TTkHeaderView
+ This is a placeholder for a proper "TTkHeaderView"
+ '''
+ __slots__=('_visible','visibilityUpdated')
+ def__init__(self,visible=True)->None:
+ self.visibilityUpdated=pyTTkSignal(bool)
+ self._visible=visible
+
+
[docs]classTTkTableWidget(TTkAbstractScrollView):
+ '''
+ A :class:`TTkTableWidget` implements a table view that displays items from a model.
+
+ ::
+
+ Customer Id ╿First Name ╿Last Name ╿Company ╿City ╿
+ 1 │DD37Cf93aecA6Dc │Sheryl │Baxter │Rasmussen Group │East Leonard │
+ ╾╌╌┼────────────────┼───────────┼────────────┼────────────────────────────────┼────────────────────┤
+ 2 │1Ef7b82A4CAAD10 │Preston │Lozano │Vega-Gentry │East Jimmychester │
+ ╾╌╌┼────────────────┼───────────┼────────────┼────────────────────────────────┼────────────────────┤
+ 3 │6F94879bDAfE5a6 │Roy │Berry │Murillo-Perry │Isabelborough │
+ ╾╌╌┼────────────────┼───────────┼────────────┼────────────────────────────────┼────────────────────┤
+ 4 │5Cef8BFA16c5e3c │Linda │Olsen │Dominguez, Mcmillan and Donovan │Bensonview │
+ ╾╌╌┼────────────────┼───────────┼────────────┼────────────────────────────────┼────────────────────┤
+ 5 │053d585Ab6b3159 │Joanna │Bender │Martin, Lang and Andrade │West Priscilla │
+ ╾╌╌┼────────────────┼───────────┼────────────┼────────────────────────────────┼────────────────────┤
+ 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.
+
+ :class:`TTkTableWidget` implements the methods to allow it to display data provided by models derived from the :class:`~TermTk.TTkAbstract.abstracttablemodel.TTkAbstractTableModel` class.
+
+ **Navigation**
+
+ You can navigate the cells in the table by clicking on a cell with the mouse,
+ or by using the arrow keys,
+ you can also hit Tab and Backtab to move from cell to cell.
+
+ **Visual Appearance**
+
+ The table has a vertical header that can be obtained using the :meth:`verticalHeader` function,
+ and a horizontal header that is available through the :meth:`horizontalHeader` function.
+ The height of each row in the table can be set using :meth:`setRowHeight`;
+ similarly, the width of columns can be set using :meth:`setColumnWidth`.
+
+ They can be selected with :meth:`selectRow` and :meth:`selectColumn`.
+ The table will show a grid depending on the :meth:`setHSeparatorVisibility` :meth:`setVSeparatorVisibility` methods.
+
+ The items shown in a table view, like those in the other item views, are rendered and edited using standard delegates.
+ However, for some tasks it is sometimes useful to be able to insert widgets in a table instead.
+ Widgets are set for particular indexes with the setIndexWidget() function, and later retrieved with indexWidget().
+
+ By default, the cells in a table do not expand to fill the available space.
+ You can make the cells fill the available space by stretching the last header section.
+
+ To distribute the available space according to the space requirement of each column or row,
+ 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`
+
+ :param vSeparator: show the vertical separators, defaults to True
+ :type vSeparator: bool, optional
+
+ :param hSeparator: show the horizontal separators, defaults to True
+ :type hSeparator: bool, optional
+
+ :param vHeader: show the vertical header, defaults to True
+ :type vHeader: bool, optional
+
+ :param hHeader: show the horizontal header, defaults to True
+ :type hHeader: bool, optional
+
+ :param sortingEnabled: enable the column sorting, defaults to False
+ :type sortingEnabled: bool, optional
+
+ :param dataPadding: the right column padding, defaults to 1
+ :type dataPadding: int, optional
+
+ +-----------------------------------------------------------------------------------------------+
+ | `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
+
+ '''
+
+ 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,
+ vHeader:bool=True,hHeader:bool=True,
+ sortingEnabled=False,dataPadding=1,
+ **kwargs)->None:
+ # Signals
+ # self.itemActivated = pyTTkSignal(TTkTableWidgetItem, int)
+ # self.itemChanged = pyTTkSignal(TTkTableWidgetItem, int)
+ # self.itemClicked = pyTTkSignal(TTkTableWidgetItem, int)
+ # self.itemDoubleClicked = pyTTkSignal(TTkTableWidgetItem, int)
+ # self.itemExpanded = pyTTkSignal(TTkTableWidgetItem)
+ # self.itemCollapsed = pyTTkSignal(TTkTableWidgetItem)
+
+ # self.cellActivated = pyTTkSignal(int,int)
+ self.cellChanged=pyTTkSignal(int,int)
+ self.cellClicked=pyTTkSignal(int,int)
+ self.cellDoubleClicked=pyTTkSignal(int,int)
+ self.cellEntered=pyTTkSignal(int,int)
+ # self.cellPressed = pyTTkSignal(int,int)
+ self.currentCellChanged=pyTTkSignal(int,int,int,int)
+ # self.currentItemChanged(QTableWidgetItem *current, QTableWidgetItem *previous)
+
+ self._fastCheck=True
+ self._guessDataEdit=True
+
+ self._clipboard=TTkClipboard()
+ self._snapshot=[]
+ self._snapshotId=0
+ self._dataPadding=dataPadding
+ self._sortingEnabled=sortingEnabled
+ self._showHSeparators=vSeparator
+ self._showVSeparators=hSeparator
+ self._verticalHeader=TTkHeaderView(visible=vHeader)
+ self._horizontallHeader=TTkHeaderView(visible=hHeader)
+ self._selected=None
+ self._selectedBase=None
+ self._hoverPos=None
+ self._dragPos=None
+ self._currentPos=None
+ self._internal={}
+ self._hSeparatorSelected=None
+ self._vSeparatorSelected=None
+ self._sortColumn=-1
+ self._sortOrder=TTkK.AscendingOrder
+ self._tableModel=tableModeliftableModelelseTTkTableModelList(list=[['']*10for_inrange(10)])
+ self._tableModel.dataChanged.connect(self.update)
+ super().__init__(**kwargs)
+ self._refreshLayout()
+ self.setMinimumHeight(1)
+ self.setFocusPolicy(TTkK.ClickFocus+TTkK.TabFocus)
+ # self._rootItem = TTkTableWidgetItem(expanded=True)
+ # self.clear()
+ self.viewChanged.connect(self._viewChangedHandler)
+ self._verticalHeader.visibilityUpdated.connect(self._headerVisibilityChanged)
+ self._horizontallHeader.visibilityUpdated.connect(self._headerVisibilityChanged)
+
+ @dataclass
+ class_SnapItem():
+ dataIndex:TTkModelIndex=None
+ newData:object=None
+ oldData:object=None
+
+ def_saveSnapshot(self,items:list,currentPos:tuple[int])->None:
+ self._snapshot=self._snapshot[:self._snapshotId]+[[currentPos]+items]
+ self._snapshotId+=1
+
+ def_restoreSnapshot(self,snapId:int,newData=True):
+ rows=self._tableModel.rowCount()
+ cols=self._tableModel.columnCount()
+ self.clearSelection()
+ foriinself._snapshot[snapId][1:]:
+ row=i.dataIndex.row()
+ col=i.dataIndex.col()
+ self.setSelection(pos=(col,row),size=(1,1),flags=TTkK.TTkItemSelectionModel.Select)
+ i.dataIndex.setData(i.newDataifnewDataelsei.oldData)
+ cpsi:TTkModelIndex=self._snapshot[snapId][0]
+ self._setCurrentCell(cpsi.row(),cpsi.col())
+ self._moveCurrentCell(diff=(0,0))
+ self.update()
+
+
[docs]@pyTTkSlot()
+ defundo(self)->None:
+ '''
+ Undoes the last operation if undo is available.
+ '''
+ ifself._snapshotId==0:return
+ self._snapshotId-=1
+ self._restoreSnapshot(self._snapshotId,newData=False)
+
+
[docs]@pyTTkSlot()
+ defredo(self)->None:
+ '''
+ Redoes the last operation if redo is available.
+ '''
+ ifself._snapshotId>=len(self._snapshot):return
+ self._restoreSnapshot(self._snapshotId,newData=True)
+ self._snapshotId+=1
[docs]@pyTTkSlot()
+ defcut(self)->None:
+ '''
+ Copies the selected ccells to the clipboard and deletes them from the table.
+ '''
+ self.copy()
+ self._cleanSelectedContent()
+
+
[docs]@pyTTkSlot()
+ defpaste(self)->None:
+ '''
+ Pastes the text/cells from the clipboard into the table at the current cursor position.
+ '''
+ data=self._clipboard.text()
+ self.pasteEvent(data)
[docs]@pyTTkSlot(bool)
+ defsetSortingEnabled(self,enable:bool)->None:
+ '''
+ 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
+ '''
+ ifenable==self._sortingEnabled:return
+ self._sortingEnabled=enable
+ self.sortByColumn(self._sortColumn,self._sortOrder)
+
+
[docs]defisSortingEnabled(self)->bool:
+ '''
+ 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
+ '''
+ returnself._sortingEnabled
+
+
[docs]@pyTTkSlot(int,TTkK.SortOrder)
+ defsortByColumn(self,column:int,order:TTkK.SortOrder)->None:
+ '''
+ 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: :class:`~TermTk.TTkCore.constant.TTkK.SortOrder`
+ '''
+ self._sortColumn=column
+ self._sortOrder=order
+ self._tableModel.sort(column,order)
+ self.update()
[docs]defclearSelection(self)->None:
+ '''
+ Deselects all selected items.
+ The current index will not be changed.
+ '''
+ rows=self._tableModel.rowCount()
+ cols=self._tableModel.columnCount()
+ self._selected=[[False]*colsfor_inrange(rows)]
+ self.update()
+
+
[docs]defselectAll(self)->None:
+ '''
+ Selects all items in the view.
+ This function will use the selection behavior set on the view when selecting.
+ '''
+ rows=self._tableModel.rowCount()
+ cols=self._tableModel.columnCount()
+ flagFunc=self._tableModel.flags
+ cmp=TTkK.ItemFlag.ItemIsSelectable
+ self._selected=[[cmp==(cmp&flagFunc(_r,_c))for_cinrange(cols)]for_rinrange(rows)]
+ self.update()
+
+
[docs]defsetSelection(self,pos:tuple[int,int],size:tuple[int,int],flags:TTkK.TTkItemSelectionModel)->None:
+ '''
+ 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
+ :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`
+ '''
+ x,y=pos
+ w,h=size
+ rows=self._tableModel.rowCount()
+ cols=self._tableModel.columnCount()
+ flagFunc=self._tableModel.flags
+ cmp=TTkK.ItemFlag.ItemIsSelectable
+ ifflags&(TTkK.TTkItemSelectionModel.Clear|TTkK.TTkItemSelectionModel.Deselect):
+ forlineinself._selected[y:y+h]:
+ line[x:x+w]=[False]*w
+ elifflags&TTkK.TTkItemSelectionModel.Select:
+ for_r,lineinenumerate(self._selected[y:y+h],y):
+ line[x:x+w]=[cmp==(cmp&flagFunc(_r,_c))for_cinrange(x,min(x+w,cols))]
+ self.update()
+
+
[docs]defselectRow(self,row:int)->None:
+ '''
+ Selects the given row in the table view
+
+ :param row: the row to be selected
+ :type row: int
+ '''
+ cols=self._tableModel.columnCount()
+ cmp=TTkK.ItemFlag.ItemIsSelectable
+ flagFunc=self._tableModel.flags
+ self._selected[row]=[cmp==(cmp&flagFunc(row,col))forcolinrange(cols)]
+ self.update()
+
+
[docs]defselectColumn(self,col:int)->None:
+ '''
+ Selects the given column in the table view
+
+ :param col: the column to be selected
+ :type col: int
+ '''
+ cmp=TTkK.ItemFlag.ItemIsSelectable
+ flagFunc=self._tableModel.flags
+ forrow,lineinenumerate(self._selected):
+ line[col]=cmp==(cmp&flagFunc(row,col))
+ self.update()
+
+
[docs]defunselectRow(self,row:int)->None:
+ '''
+ Unselects the given row in the table view
+
+ :param row: the row to be unselected
+ :type row: int
+ '''
+ cols=self._tableModel.columnCount()
+ self._selected[row]=[False]*cols
+ self.update()
+
+
[docs]defunselectColumn(self,column:int)->None:
+ '''
+ Unselects the given column in the table view
+
+ :param column: the column to be unselected
+ :type column: int
+ '''
+ forlineinself._selected:
+ line[column]=False
+ self.update()
[docs]defrowCount(self)->int:
+ '''
+ Returns the number of rows.
+
+ :return: int
+ '''
+ returnself._tableModel.rowCount()
+
+
[docs]defcurrentRow(self)->int:
+ '''
+ Returns the row of the current item.
+
+ :return: int
+ '''
+ if_cp:=self._currentPos:
+ return_cp[0]
+ return0
+
+
[docs]defcolumnCount(self)->int:
+ '''
+ Returns the number of columns.
+
+ :return: int
+ '''
+ returnself._tableModel.columnCount()
+
+
[docs]defcurrentColumn(self)->int:
+ '''
+ Returns the column of the current item.
+
+ :return: int
+ '''
+ if_cp:=self._currentPos:
+ return_cp[1]
+ return0
[docs]defhSeparatorVisibility(self)->bool:
+ '''
+ Returns the visibility status of the horizontal separator
+
+ :return: bool
+ '''
+ returnself._showHSeparators
+
[docs]defvSeparatorVisibility(self)->bool:
+ '''
+ Returns the visibility status of the vertical separator
+
+ :return: bool
+ '''
+ returnself._showVSeparators
+
+
[docs]defsetHSeparatorVisibility(self,visibility:bool)->None:
+ '''
+ Set the the visibility of the horizontal separators (lines)
+
+ ::
+
+ Customer Id First Name Last Name Company
+ 1 │ DD37Cf93aecA6Dc Sheryl Baxter Rasmussen Group
+ ╾╌╌┼───────────────────────────────────────────────────────────
+ 2 │ 1Ef7b82A4CAAD10 Preston Lozano Vega-Gentry
+ ╾╌╌┼───────────────────────────────────────────────────────────
+ 3 │ 6F94879bDAfE5a6 Roy Berry Murillo-Perry
+ ╾╌╌┼───────────────────────────────────────────────────────────
+
+ :param visibility: the visibility status
+ :type visibility: bool
+ '''
+ ifself._showHSeparators==visibility:return
+ self._showHSeparators=visibility
+ ifvisibility:
+ self._rowsPos=[v+ifori,vinenumerate(self._rowsPos,1)]
+ else:
+ self._rowsPos=[v-ifori,vinenumerate(self._rowsPos,1)]
+ self.viewChanged.emit()
+
+
[docs]defsetVSeparatorVisibility(self,visibility:bool):
+ '''
+ 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 │
+ 3 │ 6F94879bDAfE5a6 │Roy │Berry │Murillo-Perry │
+ 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
+ '''
+ ifself._showVSeparators==visibility:return
+ self._showVSeparators=visibility
+ ifvisibility:
+ self._colsPos=[v+ifori,vinenumerate(self._colsPos,1)]
+ else:
+ self._colsPos=[v-ifori,vinenumerate(self._colsPos,1)]
+ self.viewChanged.emit()
+
+
[docs]defmodel(self)->TTkAbstractTableModel:
+ '''
+ Returns the model that this view is presenting.
+
+ :return: :class:`~TermTk.TTkAbstract.abstracttablemodel.TTkAbstractTableModel`
+ '''
+ returnself._tableModel
+
+
[docs]defsetModel(self,model:TTkAbstractTableModel)->None:
+ '''
+ Sets the model for the view to present.
+
+ :param model:
+ :type model: :class:`~TermTk.TTkAbstract.abstracttablemodel.TTkAbstractTableModel`
+ '''
+ self._tableModel.dataChanged.disconnect(self.update)
+ self._tableModel=model
+ self._tableModel.dataChanged.connect(self.update)
+ self._refreshLayout()
+ self.viewChanged.emit()
[docs]@pyTTkSlot(int)
+ defresizeColumnToContents(self,column:int)->None:
+ '''
+ 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
+ '''
+ self.setColumnWidth(column,self._columnContentsSize(column))
+
+
[docs]@pyTTkSlot()
+ defresizeColumnsToContents(self)->None:
+ '''
+ Resizes all columns based on the size hints of the delegate used to render each item in the columns.
+ '''
+ _d=1ifself._showVSeparatorselse0
+ cols=self._tableModel.columnCount()
+ pos=-1
+ for_cinrange(cols):
+ pos+=_d+self._columnContentsSize(_c)
+ self._colsPos[_c]=pos
+ self.viewChanged.emit()
+ self.update()
+
+
[docs]@pyTTkSlot(int,int)
+ defsetRowHeight(self,row:int,height:int)->None:
+ '''
+ Sets the height of the given row.
+
+ :param row: the row
+ :type row: int
+ :param height: its height
+ :type height: int
+ '''
+ i=row
+ prevPos=self._rowsPos[i-1]ifi>0else-1
+ ifself._showHSeparators:
+ newPos=prevPos+height+1
+ else:
+ newPos=prevPos+height
+ oldPos=self._rowsPos[i]
+ diff=newPos-oldPos
+ foriiinrange(i,len(self._rowsPos)):
+ self._rowsPos[ii]+=diff
+ self.viewChanged.emit()
+ self.update()
[docs]@pyTTkSlot(int)
+ defresizeRowToContents(self,row:int)->None:
+ '''
+ 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
+ '''
+ self.setRowHeight(row,self._rowContentsSize(row))
+
+
[docs]@pyTTkSlot()
+ defresizeRowsToContents(self)->None:
+ '''
+ Resizes all rows based on the size hints of the delegate used to render each item in the rows.
+ '''
+ rows=self._tableModel.rowCount()
+ _d=1ifself._showHSeparatorselse0
+ pos=-1
+ for_rinrange(rows):
+ pos+=_d+self._rowContentsSize(_r)
+ self._rowsPos[_r]=pos
+ self.viewChanged.emit()
+ self.update()
[docs]defmouseDragEvent(self,evt)->bool:
+ # columnPos (Selected = 2)
+ # 0 1 2 3 4
+ # ----|-------|--------|----------|---|
+ # Mouse (Drag) Pos
+ # ^
+ # I consider at least 4 char (3+1) as spacing
+ # Min Selected Pos = (Selected+1) * 4
+ x,y=evt.x,evt.y
+ ox,oy=self.getViewOffsets()
+ showVH=self._verticalHeader.isVisible()
+ showHH=self._horizontallHeader.isVisible()
+ hhs=self._hHeaderSizeifshowHHelse0
+ vhs=self._vHeaderSizeifshowVHelse0
+ ifself._dragPosandnotself._hSeparatorSelectedandnotself._vSeparatorSelected:
+ self._dragPos[1]=self._findCell(x,y,headers=False)
+ self.update()
+ returnTrue
+ ifself._hSeparatorSelectedisnotNone:
+ x+=ox-vhs
+ ss=self._hSeparatorSelected
+ pos=max((ss+1)*4,x)
+ diff=pos-self._colsPos[ss]
+ # Align the previous Separators if pushed
+ foriinrange(ss):
+ self._colsPos[i]=min(self._colsPos[i],pos-(ss-i)*4)
+ # Align all the other Separators relative to the selection
+ foriinrange(ss,len(self._colsPos)):
+ self._colsPos[i]+=diff
+ # self._alignWidgets()
+ self.viewChanged.emit()
+ self.update()
+ returnTrue
+ ifself._vSeparatorSelectedisnotNone:
+ y+=oy-hhs
+ ss=self._vSeparatorSelected
+ pos=max((ss+1)*2-1,y)
+ diff=pos-self._rowsPos[ss]
+ # Align the previous Separators if pushed
+ foriinrange(ss):
+ self._rowsPos[i]=min(self._rowsPos[i],pos-(ss-i)*2)
+ # Align all the other Separators relative to the selection
+ foriinrange(ss,len(self._rowsPos)):
+ self._rowsPos[i]+=diff
+ # self._alignWidgets()
+ self.viewChanged.emit()
+ self.update()
+ returnTrue
+ returnFalse
+
+
[docs]defmouseReleaseEvent(self,evt)->bool:
+ ifself._dragPos:
+ rows=self._tableModel.rowCount()
+ cols=self._tableModel.columnCount()
+ state=True
+ (rowa,cola),(rowb,colb)=self._dragPos
+
+ ifevt.mod==TTkK.ControlModifier:
+ # Pick the status to be applied to the selection if CTRL is Pressed
+ # In case of line/row selection I choose the element 0 of that line
+ state=self._selected[max(0,rowa)][max(0,cola)]
+ else:
+ # Clear the selection if no ctrl has been pressed
+ self.clearSelection()
+
+ ifrowa==-1:
+ cola,colb=min(cola,colb),max(cola,colb)
+ rowa,rowb=0,rows-1
+ elifcola==-1:
+ rowa,rowb=min(rowa,rowb),max(rowa,rowb)
+ cola,colb=0,cols-1
+ else:
+ cola,colb=min(cola,colb),max(cola,colb)
+ rowa,rowb=min(rowa,rowb),max(rowa,rowb)
+
+ self.setSelection(pos=(cola,rowa),size=(colb-cola+1,rowb-rowa+1),
+ flags=TTkK.TTkItemSelectionModel.SelectifstateelseTTkK.TTkItemSelectionModel.Clear)
+
+ self._hoverPos=None
+ self._dragPos=None
+ self.update()
+ returnTrue
[docs]defsortItems(self,col:int,order:TTkK.SortOrder):'''Sorts the items in the widget in the specified order by the values in the given column.'''self._sortColumn=colself._sortOrder=orderself._rootItem.sortChildren(col,order)
- def_alignWidgets(self):
+ def_alignWidgets(self)->None:fory,cinenumerate(self._cache):ifnotc.firstLine:continue
@@ -406,7 +435,7 @@
w.show()@pyTTkSlot()
- def_refreshCache(self):
+ def_refreshCache(self)->None:''' I save a representation of the displayed tree in a cache array to avoid eccessve recursion over the items and identify quickly the nth displayed line to improve the interaction
@@ -415,7 +444,7 @@
[ item, level, data=[txtCol1, txtCol2, txtCol3, ... ]] '''self._cache=[]
- def_addToCache(_child,_level):
+ def_addToCache(_child,_level:int)->None:_data=[]_widgets=[]_h=_child.height()
@@ -461,7 +490,7 @@
self.update()self.viewChanged.emit()
-
+# MIT License
+#
+# Copyright (c) 2024 Eugenio Parodi <ceccopierangiolieugenio AT googlemail DOT com>
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in all
+# copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+__all__=['TTkSlider']
+
+fromTermTk.TTkCore.logimportTTkLog
+fromTermTk.TTkCore.constantimportTTkK
+fromTermTk.TTkCore.canvasimportTTkCanvas
+fromTermTk.TTkCore.stringimportTTkString
+fromTermTk.TTkCore.signalimportpyTTkSlot,pyTTkSignal
+fromTermTk.TTkCore.colorimportTTkColor
+fromTermTk.TTkWidgets.scrollbarimportTTkScrollBar
+
+'''
+ ref: https://doc.qt.io/qt-5/qslider.html
+'''
+
[docs]defresizeEvent(self,w,h):if(self.lineWrapMode()==TTkK.WidgetWidthand
@@ -595,6 +597,9 @@
# TTkLog.debug(f"Saving {self._textCursor.selectedText()} {self._textCursor._properties[0].anchor.pos}")self._textDocument.saveSnapshot(self._textCursor.copy())
+ ifevt.key==TTkK.Key_Tabandevt.mod==TTkK.NoModifier:
+ evt=TTkKeyEvent(TTkK.Character,'\t','\t',TTkK.NoModifier)
+
ifevt.type==TTkK.SpecialKey:_,_,w,h=self.geometry()
@@ -612,9 +617,6 @@
ctrl=evt.mod==TTkK.ControlModifier
- ifevt.key==TTkK.Key_Tab:
- # Don't Handle the special tab key, for now
- returnFalseifctrl:p=self._textCursor.position()cx,cy=self._textWrap.dataToScreenPosition(p.line,p.pos)
@@ -634,6 +636,8 @@
self.undo()elifevt.key==TTkK.Key_Y:self.redo()
+ elifevt.key==TTkK.Key_A:
+ self._textCursor.select(TTkTextCursor.SelectionType.Document)elifevt.key==TTkK.Key_Up:self._textCursor.movePosition(moveMode=moveMode,operation=TTkTextCursor.Up,textWrap=self._textWrap)self._textCursor.clearColor()
@@ -675,6 +679,9 @@
elifevt.key==TTkK.Key_Enter:ifself._multiLine:self._textCursor.insertText('\n',moveCursor=True)
+ else:
+ # No action performed
+ returnsuper().keyEvent(evt)# Scroll to align to the cursorp=self._textCursor.position()cx,cy=self._textWrap.dataToScreenPosition(p.line,p.pos)
@@ -791,103 +798,103 @@
.. py:method:: clear()
- This method is forwarded to :class:`~TermTk.TTkWidgets.texedit.TTkTextEditView.clear`
+ This method is forwarded to :meth:`~TermTk.TTkWidgets.texedit.TTkTextEditView.clear` .. py:method:: setText(text)
- This method is forwarded to :class:`~TermTk.TTkWidgets.texedit.TTkTextEditView.setText`
+ This method is forwarded to :meth:`~TermTk.TTkWidgets.texedit.TTkTextEditView.setText` .. py:method:: append(text)
- This method is forwarded to :class:`~TermTk.TTkWidgets.texedit.TTkTextEditView.append`
+ This method is forwarded to :meth:`~TermTk.TTkWidgets.texedit.TTkTextEditView.append` .. py:method:: isReadOnly()
- This method is forwarded to :class:`~TermTk.TTkWidgets.texedit.TTkTextEditView.isReadOnly`
+ This method is forwarded to :meth:`~TermTk.TTkWidgets.texedit.TTkTextEditView.isReadOnly` .. py:method:: setReadOnly(ro)
- This method is forwarded to :class:`~TermTk.TTkWidgets.texedit.TTkTextEditView.setReadOnly`
+ This method is forwarded to :meth:`~TermTk.TTkWidgets.texedit.TTkTextEditView.setReadOnly` .. py:method:: document()
- This method is forwarded to :class:`~TermTk.TTkWidgets.texedit.TTkTextEditView.document`
+ This method is forwarded to :meth:`~TermTk.TTkWidgets.texedit.TTkTextEditView.document` .. py:method:: wrapWidth()
- This method is forwarded to :class:`~TermTk.TTkWidgets.texedit.TTkTextEditView.wrapWidth`
+ This method is forwarded to :meth:`~TermTk.TTkWidgets.texedit.TTkTextEditView.wrapWidth` .. py:method:: setWrapWidth(width)
- This method is forwarded to :class:`~TermTk.TTkWidgets.texedit.TTkTextEditView.setWrapWidth`
+ This method is forwarded to :meth:`~TermTk.TTkWidgets.texedit.TTkTextEditView.setWrapWidth` .. py:method:: multiLine()
- This method is forwarded to :class:`~TermTk.TTkWidgets.texedit.TTkTextEditView.multiLine`
+ This method is forwarded to :meth:`~TermTk.TTkWidgets.texedit.TTkTextEditView.multiLine` .. py:method:: lineWrapMode()
- This method is forwarded to :class:`~TermTk.TTkWidgets.texedit.TTkTextEditView.lineWrapMode`
+ This method is forwarded to :meth:`~TermTk.TTkWidgets.texedit.TTkTextEditView.lineWrapMode` .. py:method:: setLineWrapMode(mode)
- This method is forwarded to :class:`~TermTk.TTkWidgets.texedit.TTkTextEditView.setLineWrapMode`
+ This method is forwarded to :meth:`~TermTk.TTkWidgets.texedit.TTkTextEditView.setLineWrapMode` .. py:method:: wordWrapMode()
- This method is forwarded to :class:`~TermTk.TTkWidgets.texedit.TTkTextEditView.wordWrapMode`
+ This method is forwarded to :meth:`~TermTk.TTkWidgets.texedit.TTkTextEditView.wordWrapMode` .. py:method:: setWordWrapMode(mode)
- This method is forwarded to :class:`~TermTk.TTkWidgets.texedit.TTkTextEditView.setWordWrapMode`
+ This method is forwarded to :meth:`~TermTk.TTkWidgets.texedit.TTkTextEditView.setWordWrapMode` .. py:method:: textCursor()
- This method is forwarded to :class:`~TermTk.TTkWidgets.texedit.TTkTextEditView.textCursor`
+ This method is forwarded to :meth:`~TermTk.TTkWidgets.texedit.TTkTextEditView.textCursor` .. py:method:: setColor(color)
- This method is forwarded to :class:`~TermTk.TTkWidgets.texedit.TTkTextEditView.setColor`
+ This method is forwarded to :meth:`~TermTk.TTkWidgets.texedit.TTkTextEditView.setColor` .. py:method:: cut()
- This method is forwarded to :class:`~TermTk.TTkWidgets.texedit.TTkTextEditView.cut`
+ This method is forwarded to :meth:`~TermTk.TTkWidgets.texedit.TTkTextEditView.cut` .. py:method:: copy()
- This method is forwarded to :class:`~TermTk.TTkWidgets.texedit.TTkTextEditView.copy`
+ This method is forwarded to :meth:`~TermTk.TTkWidgets.texedit.TTkTextEditView.copy` .. py:method:: paste()
- This method is forwarded to :class:`~TermTk.TTkWidgets.texedit.TTkTextEditView.paste`
+ This method is forwarded to :meth:`~TermTk.TTkWidgets.texedit.TTkTextEditView.paste` .. py:method:: undo()
- This method is forwarded to :class:`~TermTk.TTkWidgets.texedit.TTkTextEditView.undo`
+ This method is forwarded to :meth:`~TermTk.TTkWidgets.texedit.TTkTextEditView.undo` .. py:method:: redo()
- This method is forwarded to :class:`~TermTk.TTkWidgets.texedit.TTkTextEditView.redo`
+ This method is forwarded to :meth:`~TermTk.TTkWidgets.texedit.TTkTextEditView.redo` .. py:method:: isUndoAvailable()
- This method is forwarded to :class:`~TermTk.TTkWidgets.texedit.TTkTextEditView.isUndoAvailable`
+ This method is forwarded to :meth:`~TermTk.TTkWidgets.texedit.TTkTextEditView.isUndoAvailable` .. py:method:: isRedoAvailable()
- This method is forwarded to :class:`~TermTk.TTkWidgets.texedit.TTkTextEditView.isRedoAvailable`
+ This method is forwarded to :meth:`~TermTk.TTkWidgets.texedit.TTkTextEditView.isRedoAvailable` .. py:method:: toAnsi()
- This method is forwarded to :class:`~TermTk.TTkWidgets.texedit.TTkTextEditView.toAnsi`
+ This method is forwarded to :meth:`~TermTk.TTkWidgets.texedit.TTkTextEditView.toAnsi` .. py:method:: toRawText()
- This method is forwarded to :class:`~TermTk.TTkWidgets.texedit.TTkTextEditView.toRawText`
+ This method is forwarded to :meth:`~TermTk.TTkWidgets.texedit.TTkTextEditView.toRawText` .. py:method:: toPlainText()
- This method is forwarded to :class:`~TermTk.TTkWidgets.texedit.TTkTextEditView.toPlainText`
+ This method is forwarded to :meth:`~TermTk.TTkWidgets.texedit.TTkTextEditView.toPlainText` '''__slots__=(
@@ -911,7 +918,8 @@
)def__init__(self,textEditView=None,lineNumber=False,lineNumberStarting=0,**kwargs):super().__init__(**kwargs)
- if'parent'inkwargs:kwargs.pop('parent')
+ kwargs.pop('parent',None)
+ kwargs.pop('visible',None)self._textEditView=textEditViewiftextEditViewelseTTkTextEditView(**kwargs)# self.setFocusPolicy(self._textEditView.focusPolicy())# self._textEditView.setFocusPolicy(TTkK.ParentFocus)
diff --git a/_modules/TermTk/TTkWidgets/widget.html b/_modules/TermTk/TTkWidgets/widget.html
index 45d3c8e3..498193a5 100644
--- a/_modules/TermTk/TTkWidgets/widget.html
+++ b/_modules/TermTk/TTkWidgets/widget.html
@@ -3,7 +3,7 @@
- TermTk.TTkWidgets.widget — pyTermTk 0.39.0-a
+ TermTk.TTkWidgets.widget — pyTermTk 0.40.0-a
documentation
@@ -186,6 +186,11 @@
:param toolTip: This property holds the widget's tooltip :type toolTip: :class:`~TermTk.TTkCore.string.TTkString`
+ :param style: this field hold the custom style to be used by this widget
+ :type style: dict
+ :param addStyle: this field is required to override/merge the new style on top of the current one, useful if only few params need to be changed
+ :type addStyle: dict
+
:param bool,optional visible: the visibility, optional, defaults to True :param bool,optional enabled: the ability to handle input events, optional, defaults to True '''
@@ -214,7 +219,7 @@
#Signals'focusChanged','sizeChanged','currentStyleChanged','closed')
- def__init__(self,*args,**kwargs):
+ def__init__(self,**kwargs):#Signalsself.focusChanged=pyTTkSignal(bool)self.sizeChanged=pyTTkSignal(int,int)
@@ -258,6 +263,10 @@
self._currentStyle=TTkWidget.classStyle['default']self.setStyle(self.classStyle)self._processStyleEvent(TTkWidget._S_DEFAULT)
+ if'style'inkwargs:
+ self.setStyle(kwargs['style'])
+ if'addStyle'inkwargs:
+ self.mergeStyle(kwargs['addStyle'])self._canvas=TTkCanvas(width=self._width,
@@ -632,7 +641,7 @@
defhasFocus(self):returnself._focus
- defgetCanvas(self):
+ defgetCanvas(self)->TTkCanvas:returnself._canvasdeffocusPolicy(self):
@@ -686,7 +695,7 @@
_S_RELEASED=0x40defstyle(self):
- returnself._style
+ returnself._style.copy()defcurrentStyle(self):returnself._currentStyle
@@ -697,7 +706,9 @@
self.currentStyleChanged.emit(style)self.update()
- defsetStyle(self,style):
+ defsetStyle(self,style=None):
+ ifnotstyle:
+ style=self.classStyle.copy()if'default'notinstyle:# find the closest subclass/parent holding the stylestyleType=TTkWidget
@@ -715,6 +726,11 @@
defmergeStyle(self,style):cs=None
+ # for field in style:
+ # if field in self._style:
+ # mergeStyle[field] = defaultStyle | self._style[field] | style[field]
+ # else:
+ # mergeStyle[field] = defaultStylefortinself._style:ifself._style[t]==self._currentStyle:cs=t
diff --git a/_modules/TermTk/TTkWidgets/window.html b/_modules/TermTk/TTkWidgets/window.html
index 099b46f6..42303f75 100644
--- a/_modules/TermTk/TTkWidgets/window.html
+++ b/_modules/TermTk/TTkWidgets/window.html
@@ -3,7 +3,7 @@
- TermTk.TTkWidgets.window — pyTermTk 0.39.0-a
+ TermTk.TTkWidgets.window — pyTermTk 0.40.0-a
documentation
diff --git a/_modules/index.html b/_modules/index.html
index e4db1edc..225d5131 100644
--- a/_modules/index.html
+++ b/_modules/index.html
@@ -3,7 +3,7 @@
- Overview: module code — pyTermTk 0.39.0-a
+ Overview: module code — pyTermTk 0.40.0-a
documentation
@@ -106,6 +106,7 @@
Return the integer represented by the given array of bytes.
-
-
bytes
Holds the array of bytes to convert. The argument must either
-support the buffer protocol or be an iterable object producing bytes.
-Bytes and bytearray are examples of built-in objects that support the
-buffer protocol.
-
-
byteorder
The byte order used to represent the integer. If byteorder is ‘big’,
-the most significant byte is at the beginning of the byte array. If
-byteorder is ‘little’, the most significant byte is at the end of the
-byte array. To request the native byte order of the host system, use
-`sys.byteorder’ as the byte order value.
-
-
signed
Indicates whether two’s complement is used to represent the integer.
Length of bytes object to use. An OverflowError is raised if the
-integer is not representable with the given number of bytes.
-
-
byteorder
The byte order used to represent the integer. If byteorder is ‘big’,
-the most significant byte is at the beginning of the byte array. If
-byteorder is ‘little’, the most significant byte is at the end of the
-byte array. To request the native byte order of the host system, use
-`sys.byteorder’ as the byte order value.
-
-
signed
Determines whether two’s complement is used to represent the integer.
-If signed is False and a negative integer is given, an OverflowError
-is raised.
Return the integer represented by the given array of bytes.
-
-
bytes
Holds the array of bytes to convert. The argument must either
-support the buffer protocol or be an iterable object producing bytes.
-Bytes and bytearray are examples of built-in objects that support the
-buffer protocol.
-
-
byteorder
The byte order used to represent the integer. If byteorder is ‘big’,
-the most significant byte is at the beginning of the byte array. If
-byteorder is ‘little’, the most significant byte is at the end of the
-byte array. To request the native byte order of the host system, use
-`sys.byteorder’ as the byte order value.
-
-
signed
Indicates whether two’s complement is used to represent the integer.
Length of bytes object to use. An OverflowError is raised if the
-integer is not representable with the given number of bytes.
-
-
byteorder
The byte order used to represent the integer. If byteorder is ‘big’,
-the most significant byte is at the beginning of the byte array. If
-byteorder is ‘little’, the most significant byte is at the end of the
-byte array. To request the native byte order of the host system, use
-`sys.byteorder’ as the byte order value.
-
-
signed
Determines whether two’s complement is used to represent the integer.
-If signed is False and a negative integer is given, an OverflowError
-is raised.
Return the integer represented by the given array of bytes.
-
-
bytes
Holds the array of bytes to convert. The argument must either
-support the buffer protocol or be an iterable object producing bytes.
-Bytes and bytearray are examples of built-in objects that support the
-buffer protocol.
-
-
byteorder
The byte order used to represent the integer. If byteorder is ‘big’,
-the most significant byte is at the beginning of the byte array. If
-byteorder is ‘little’, the most significant byte is at the end of the
-byte array. To request the native byte order of the host system, use
-`sys.byteorder’ as the byte order value.
-
-
signed
Indicates whether two’s complement is used to represent the integer.
Length of bytes object to use. An OverflowError is raised if the
-integer is not representable with the given number of bytes.
-
-
byteorder
The byte order used to represent the integer. If byteorder is ‘big’,
-the most significant byte is at the beginning of the byte array. If
-byteorder is ‘little’, the most significant byte is at the end of the
-byte array. To request the native byte order of the host system, use
-`sys.byteorder’ as the byte order value.
-
-
signed
Determines whether two’s complement is used to represent the integer.
-If signed is False and a negative integer is given, an OverflowError
-is raised.
Return the integer represented by the given array of bytes.
-
-
bytes
Holds the array of bytes to convert. The argument must either
-support the buffer protocol or be an iterable object producing bytes.
-Bytes and bytearray are examples of built-in objects that support the
-buffer protocol.
-
-
byteorder
The byte order used to represent the integer. If byteorder is ‘big’,
-the most significant byte is at the beginning of the byte array. If
-byteorder is ‘little’, the most significant byte is at the end of the
-byte array. To request the native byte order of the host system, use
-`sys.byteorder’ as the byte order value.
-
-
signed
Indicates whether two’s complement is used to represent the integer.
Length of bytes object to use. An OverflowError is raised if the
-integer is not representable with the given number of bytes.
-
-
byteorder
The byte order used to represent the integer. If byteorder is ‘big’,
-the most significant byte is at the beginning of the byte array. If
-byteorder is ‘little’, the most significant byte is at the end of the
-byte array. To request the native byte order of the host system, use
-`sys.byteorder’ as the byte order value.
-
-
signed
Determines whether two’s complement is used to represent the integer.
-If signed is False and a negative integer is given, an OverflowError
-is raised.
Return the integer represented by the given array of bytes.
-
-
bytes
Holds the array of bytes to convert. The argument must either
-support the buffer protocol or be an iterable object producing bytes.
-Bytes and bytearray are examples of built-in objects that support the
-buffer protocol.
-
-
byteorder
The byte order used to represent the integer. If byteorder is ‘big’,
-the most significant byte is at the beginning of the byte array. If
-byteorder is ‘little’, the most significant byte is at the end of the
-byte array. To request the native byte order of the host system, use
-`sys.byteorder’ as the byte order value.
-
-
signed
Indicates whether two’s complement is used to represent the integer.
Length of bytes object to use. An OverflowError is raised if the
-integer is not representable with the given number of bytes.
-
-
byteorder
The byte order used to represent the integer. If byteorder is ‘big’,
-the most significant byte is at the beginning of the byte array. If
-byteorder is ‘little’, the most significant byte is at the end of the
-byte array. To request the native byte order of the host system, use
-`sys.byteorder’ as the byte order value.
-
-
signed
Determines whether two’s complement is used to represent the integer.
-If signed is False and a negative integer is given, an OverflowError
-is raised.
Return the integer represented by the given array of bytes.
-
-
bytes
Holds the array of bytes to convert. The argument must either
-support the buffer protocol or be an iterable object producing bytes.
-Bytes and bytearray are examples of built-in objects that support the
-buffer protocol.
-
-
byteorder
The byte order used to represent the integer. If byteorder is ‘big’,
-the most significant byte is at the beginning of the byte array. If
-byteorder is ‘little’, the most significant byte is at the end of the
-byte array. To request the native byte order of the host system, use
-`sys.byteorder’ as the byte order value.
-
-
signed
Indicates whether two’s complement is used to represent the integer.
Length of bytes object to use. An OverflowError is raised if the
-integer is not representable with the given number of bytes.
-
-
byteorder
The byte order used to represent the integer. If byteorder is ‘big’,
-the most significant byte is at the beginning of the byte array. If
-byteorder is ‘little’, the most significant byte is at the end of the
-byte array. To request the native byte order of the host system, use
-`sys.byteorder’ as the byte order value.
-
-
signed
Determines whether two’s complement is used to represent the integer.
-If signed is False and a negative integer is given, an OverflowError
-is raised.
Return the integer represented by the given array of bytes.
-
-
bytes
Holds the array of bytes to convert. The argument must either
-support the buffer protocol or be an iterable object producing bytes.
-Bytes and bytearray are examples of built-in objects that support the
-buffer protocol.
-
-
byteorder
The byte order used to represent the integer. If byteorder is ‘big’,
-the most significant byte is at the beginning of the byte array. If
-byteorder is ‘little’, the most significant byte is at the end of the
-byte array. To request the native byte order of the host system, use
-`sys.byteorder’ as the byte order value.
-
-
signed
Indicates whether two’s complement is used to represent the integer.
Length of bytes object to use. An OverflowError is raised if the
-integer is not representable with the given number of bytes.
-
-
byteorder
The byte order used to represent the integer. If byteorder is ‘big’,
-the most significant byte is at the beginning of the byte array. If
-byteorder is ‘little’, the most significant byte is at the end of the
-byte array. To request the native byte order of the host system, use
-`sys.byteorder’ as the byte order value.
-
-
signed
Determines whether two’s complement is used to represent the integer.
-If signed is False and a negative integer is given, an OverflowError
-is raised.
Return the integer represented by the given array of bytes.
-
-
bytes
Holds the array of bytes to convert. The argument must either
-support the buffer protocol or be an iterable object producing bytes.
-Bytes and bytearray are examples of built-in objects that support the
-buffer protocol.
-
-
byteorder
The byte order used to represent the integer. If byteorder is ‘big’,
-the most significant byte is at the beginning of the byte array. If
-byteorder is ‘little’, the most significant byte is at the end of the
-byte array. To request the native byte order of the host system, use
-`sys.byteorder’ as the byte order value.
-
-
signed
Indicates whether two’s complement is used to represent the integer.
Length of bytes object to use. An OverflowError is raised if the
-integer is not representable with the given number of bytes.
-
-
byteorder
The byte order used to represent the integer. If byteorder is ‘big’,
-the most significant byte is at the beginning of the byte array. If
-byteorder is ‘little’, the most significant byte is at the end of the
-byte array. To request the native byte order of the host system, use
-`sys.byteorder’ as the byte order value.
-
-
signed
Determines whether two’s complement is used to represent the integer.
-If signed is False and a negative integer is given, an OverflowError
-is raised.
Return the integer represented by the given array of bytes.
-
-
bytes
Holds the array of bytes to convert. The argument must either
-support the buffer protocol or be an iterable object producing bytes.
-Bytes and bytearray are examples of built-in objects that support the
-buffer protocol.
-
-
byteorder
The byte order used to represent the integer. If byteorder is ‘big’,
-the most significant byte is at the beginning of the byte array. If
-byteorder is ‘little’, the most significant byte is at the end of the
-byte array. To request the native byte order of the host system, use
-`sys.byteorder’ as the byte order value.
-
-
signed
Indicates whether two’s complement is used to represent the integer.
Length of bytes object to use. An OverflowError is raised if the
-integer is not representable with the given number of bytes.
-
-
byteorder
The byte order used to represent the integer. If byteorder is ‘big’,
-the most significant byte is at the beginning of the byte array. If
-byteorder is ‘little’, the most significant byte is at the end of the
-byte array. To request the native byte order of the host system, use
-`sys.byteorder’ as the byte order value.
-
-
signed
Determines whether two’s complement is used to represent the integer.
-If signed is False and a negative integer is given, an OverflowError
-is raised.
Return the integer represented by the given array of bytes.
-
-
bytes
Holds the array of bytes to convert. The argument must either
-support the buffer protocol or be an iterable object producing bytes.
-Bytes and bytearray are examples of built-in objects that support the
-buffer protocol.
-
-
byteorder
The byte order used to represent the integer. If byteorder is ‘big’,
-the most significant byte is at the beginning of the byte array. If
-byteorder is ‘little’, the most significant byte is at the end of the
-byte array. To request the native byte order of the host system, use
-`sys.byteorder’ as the byte order value.
-
-
signed
Indicates whether two’s complement is used to represent the integer.
Length of bytes object to use. An OverflowError is raised if the
-integer is not representable with the given number of bytes.
-
-
byteorder
The byte order used to represent the integer. If byteorder is ‘big’,
-the most significant byte is at the beginning of the byte array. If
-byteorder is ‘little’, the most significant byte is at the end of the
-byte array. To request the native byte order of the host system, use
-`sys.byteorder’ as the byte order value.
-
-
signed
Determines whether two’s complement is used to represent the integer.
-If signed is False and a negative integer is given, an OverflowError
-is raised.
-
-
-
-
@@ -1552,6 +613,20 @@ is raised.
classKeyType[source]
Return the integer represented by the given array of bytes.
-
-
bytes
Holds the array of bytes to convert. The argument must either
-support the buffer protocol or be an iterable object producing bytes.
-Bytes and bytearray are examples of built-in objects that support the
-buffer protocol.
-
-
byteorder
The byte order used to represent the integer. If byteorder is ‘big’,
-the most significant byte is at the beginning of the byte array. If
-byteorder is ‘little’, the most significant byte is at the end of the
-byte array. To request the native byte order of the host system, use
-`sys.byteorder’ as the byte order value.
-
-
signed
Indicates whether two’s complement is used to represent the integer.
Length of bytes object to use. An OverflowError is raised if the
-integer is not representable with the given number of bytes.
-
-
byteorder
The byte order used to represent the integer. If byteorder is ‘big’,
-the most significant byte is at the beginning of the byte array. If
-byteorder is ‘little’, the most significant byte is at the end of the
-byte array. To request the native byte order of the host system, use
-`sys.byteorder’ as the byte order value.
-
-
signed
Determines whether two’s complement is used to represent the integer.
-If signed is False and a negative integer is given, an OverflowError
-is raised.
Return the integer represented by the given array of bytes.
-
-
bytes
Holds the array of bytes to convert. The argument must either
-support the buffer protocol or be an iterable object producing bytes.
-Bytes and bytearray are examples of built-in objects that support the
-buffer protocol.
-
-
byteorder
The byte order used to represent the integer. If byteorder is ‘big’,
-the most significant byte is at the beginning of the byte array. If
-byteorder is ‘little’, the most significant byte is at the end of the
-byte array. To request the native byte order of the host system, use
-`sys.byteorder’ as the byte order value.
-
-
signed
Indicates whether two’s complement is used to represent the integer.
Length of bytes object to use. An OverflowError is raised if the
-integer is not representable with the given number of bytes.
-
-
byteorder
The byte order used to represent the integer. If byteorder is ‘big’,
-the most significant byte is at the beginning of the byte array. If
-byteorder is ‘little’, the most significant byte is at the end of the
-byte array. To request the native byte order of the host system, use
-`sys.byteorder’ as the byte order value.
-
-
signed
Determines whether two’s complement is used to represent the integer.
-If signed is False and a negative integer is given, an OverflowError
-is raised.
Return the integer represented by the given array of bytes.
-
-
bytes
Holds the array of bytes to convert. The argument must either
-support the buffer protocol or be an iterable object producing bytes.
-Bytes and bytearray are examples of built-in objects that support the
-buffer protocol.
-
-
byteorder
The byte order used to represent the integer. If byteorder is ‘big’,
-the most significant byte is at the beginning of the byte array. If
-byteorder is ‘little’, the most significant byte is at the end of the
-byte array. To request the native byte order of the host system, use
-`sys.byteorder’ as the byte order value.
-
-
signed
Indicates whether two’s complement is used to represent the integer.
-
-
-
-
+
Those constants describes which wrapping status is required in the document
Length of bytes object to use. An OverflowError is raised if the
-integer is not representable with the given number of bytes.
-
-
byteorder
The byte order used to represent the integer. If byteorder is ‘big’,
-the most significant byte is at the beginning of the byte array. If
-byteorder is ‘little’, the most significant byte is at the end of the
-byte array. To request the native byte order of the host system, use
-`sys.byteorder’ as the byte order value.
-
-
signed
Determines whether two’s complement is used to represent the integer.
-If signed is False and a negative integer is given, an OverflowError
-is raised.
Return the integer represented by the given array of bytes.
-
-
bytes
Holds the array of bytes to convert. The argument must either
-support the buffer protocol or be an iterable object producing bytes.
-Bytes and bytearray are examples of built-in objects that support the
-buffer protocol.
-
-
byteorder
The byte order used to represent the integer. If byteorder is ‘big’,
-the most significant byte is at the beginning of the byte array. If
-byteorder is ‘little’, the most significant byte is at the end of the
-byte array. To request the native byte order of the host system, use
-`sys.byteorder’ as the byte order value.
-
-
signed
Indicates whether two’s complement is used to represent the integer.
Length of bytes object to use. An OverflowError is raised if the
-integer is not representable with the given number of bytes.
-
-
byteorder
The byte order used to represent the integer. If byteorder is ‘big’,
-the most significant byte is at the beginning of the byte array. If
-byteorder is ‘little’, the most significant byte is at the end of the
-byte array. To request the native byte order of the host system, use
-`sys.byteorder’ as the byte order value.
-
-
signed
Determines whether two’s complement is used to represent the integer.
-If signed is False and a negative integer is given, an OverflowError
-is raised.
-
-
-
-
+
+
+
+
+
+
+
NoEvent
+
+
+
Press
+
+
+
Release
+
+
+
Drag
+
+
+
Move
+
+
+
WHEEL_Up
+
+
+
WHEEL_Down
+
+
+
+
@@ -2053,6 +746,35 @@ is raised.
classMouseKey[source]
Return the integer represented by the given array of bytes.
-
-
bytes
Holds the array of bytes to convert. The argument must either
-support the buffer protocol or be an iterable object producing bytes.
-Bytes and bytearray are examples of built-in objects that support the
-buffer protocol.
-
-
byteorder
The byte order used to represent the integer. If byteorder is ‘big’,
-the most significant byte is at the beginning of the byte array. If
-byteorder is ‘little’, the most significant byte is at the end of the
-byte array. To request the native byte order of the host system, use
-`sys.byteorder’ as the byte order value.
-
-
signed
Indicates whether two’s complement is used to represent the integer.
Length of bytes object to use. An OverflowError is raised if the
-integer is not representable with the given number of bytes.
-
-
byteorder
The byte order used to represent the integer. If byteorder is ‘big’,
-the most significant byte is at the beginning of the byte array. If
-byteorder is ‘little’, the most significant byte is at the end of the
-byte array. To request the native byte order of the host system, use
-`sys.byteorder’ as the byte order value.
-
-
signed
Determines whether two’s complement is used to represent the integer.
-If signed is False and a negative integer is given, an OverflowError
-is raised.
Return the integer represented by the given array of bytes.
-
-
bytes
Holds the array of bytes to convert. The argument must either
-support the buffer protocol or be an iterable object producing bytes.
-Bytes and bytearray are examples of built-in objects that support the
-buffer protocol.
-
-
byteorder
The byte order used to represent the integer. If byteorder is ‘big’,
-the most significant byte is at the beginning of the byte array. If
-byteorder is ‘little’, the most significant byte is at the end of the
-byte array. To request the native byte order of the host system, use
-`sys.byteorder’ as the byte order value.
-
-
signed
Indicates whether two’s complement is used to represent the integer.
Length of bytes object to use. An OverflowError is raised if the
-integer is not representable with the given number of bytes.
-
-
byteorder
The byte order used to represent the integer. If byteorder is ‘big’,
-the most significant byte is at the beginning of the byte array. If
-byteorder is ‘little’, the most significant byte is at the end of the
-byte array. To request the native byte order of the host system, use
-`sys.byteorder’ as the byte order value.
-
-
signed
Determines whether two’s complement is used to represent the integer.
-If signed is False and a negative integer is given, an OverflowError
-is raised.
For a 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:
Return the integer represented by the given array of bytes.
-
-
bytes
Holds the array of bytes to convert. The argument must either
-support the buffer protocol or be an iterable object producing bytes.
-Bytes and bytearray are examples of built-in objects that support the
-buffer protocol.
-
-
byteorder
The byte order used to represent the integer. If byteorder is ‘big’,
-the most significant byte is at the beginning of the byte array. If
-byteorder is ‘little’, the most significant byte is at the end of the
-byte array. To request the native byte order of the host system, use
-`sys.byteorder’ as the byte order value.
-
-
signed
Indicates whether two’s complement is used to represent the integer.
Length of bytes object to use. An OverflowError is raised if the
-integer is not representable with the given number of bytes.
-
-
byteorder
The byte order used to represent the integer. If byteorder is ‘big’,
-the most significant byte is at the beginning of the byte array. If
-byteorder is ‘little’, the most significant byte is at the end of the
-byte array. To request the native byte order of the host system, use
-`sys.byteorder’ as the byte order value.
-
-
signed
Determines whether two’s complement is used to represent the integer.
-If signed is False and a negative integer is given, an OverflowError
-is raised.
Return the integer represented by the given array of bytes.
-
-
bytes
Holds the array of bytes to convert. The argument must either
-support the buffer protocol or be an iterable object producing bytes.
-Bytes and bytearray are examples of built-in objects that support the
-buffer protocol.
-
-
byteorder
The byte order used to represent the integer. If byteorder is ‘big’,
-the most significant byte is at the beginning of the byte array. If
-byteorder is ‘little’, the most significant byte is at the end of the
-byte array. To request the native byte order of the host system, use
-`sys.byteorder’ as the byte order value.
-
-
signed
Indicates whether two’s complement is used to represent the integer.
Length of bytes object to use. An OverflowError is raised if the
-integer is not representable with the given number of bytes.
-
-
byteorder
The byte order used to represent the integer. If byteorder is ‘big’,
-the most significant byte is at the beginning of the byte array. If
-byteorder is ‘little’, the most significant byte is at the end of the
-byte array. To request the native byte order of the host system, use
-`sys.byteorder’ as the byte order value.
-
-
signed
Determines whether two’s complement is used to represent the integer.
-If signed is False and a negative integer is given, an OverflowError
-is raised.
Return the integer represented by the given array of bytes.
-
-
bytes
Holds the array of bytes to convert. The argument must either
-support the buffer protocol or be an iterable object producing bytes.
-Bytes and bytearray are examples of built-in objects that support the
-buffer protocol.
-
-
byteorder
The byte order used to represent the integer. If byteorder is ‘big’,
-the most significant byte is at the beginning of the byte array. If
-byteorder is ‘little’, the most significant byte is at the end of the
-byte array. To request the native byte order of the host system, use
-`sys.byteorder’ as the byte order value.
-
-
signed
Indicates whether two’s complement is used to represent the integer.
Length of bytes object to use. An OverflowError is raised if the
-integer is not representable with the given number of bytes.
-
-
byteorder
The byte order used to represent the integer. If byteorder is ‘big’,
-the most significant byte is at the beginning of the byte array. If
-byteorder is ‘little’, the most significant byte is at the end of the
-byte array. To request the native byte order of the host system, use
-`sys.byteorder’ as the byte order value.
-
-
signed
Determines whether two’s complement is used to represent the integer.
-If signed is False and a negative integer is given, an OverflowError
-is raised.
Return the integer represented by the given array of bytes.
-
-
bytes
Holds the array of bytes to convert. The argument must either
-support the buffer protocol or be an iterable object producing bytes.
-Bytes and bytearray are examples of built-in objects that support the
-buffer protocol.
-
-
byteorder
The byte order used to represent the integer. If byteorder is ‘big’,
-the most significant byte is at the beginning of the byte array. If
-byteorder is ‘little’, the most significant byte is at the end of the
-byte array. To request the native byte order of the host system, use
-`sys.byteorder’ as the byte order value.
-
-
signed
Indicates whether two’s complement is used to represent the integer.
Length of bytes object to use. An OverflowError is raised if the
-integer is not representable with the given number of bytes.
-
-
byteorder
The byte order used to represent the integer. If byteorder is ‘big’,
-the most significant byte is at the beginning of the byte array. If
-byteorder is ‘little’, the most significant byte is at the end of the
-byte array. To request the native byte order of the host system, use
-`sys.byteorder’ as the byte order value.
-
-
signed
Determines whether two’s complement is used to represent the integer.
-If signed is False and a negative integer is given, an OverflowError
-is raised.
Return the integer represented by the given array of bytes.
-
-
bytes
Holds the array of bytes to convert. The argument must either
-support the buffer protocol or be an iterable object producing bytes.
-Bytes and bytearray are examples of built-in objects that support the
-buffer protocol.
-
-
byteorder
The byte order used to represent the integer. If byteorder is ‘big’,
-the most significant byte is at the beginning of the byte array. If
-byteorder is ‘little’, the most significant byte is at the end of the
-byte array. To request the native byte order of the host system, use
-`sys.byteorder’ as the byte order value.
-
-
signed
Indicates whether two’s complement is used to represent the integer.
Length of bytes object to use. An OverflowError is raised if the
-integer is not representable with the given number of bytes.
-
-
byteorder
The byte order used to represent the integer. If byteorder is ‘big’,
-the most significant byte is at the beginning of the byte array. If
-byteorder is ‘little’, the most significant byte is at the end of the
-byte array. To request the native byte order of the host system, use
-`sys.byteorder’ as the byte order value.
-
-
signed
Determines whether two’s complement is used to represent the integer.
-If signed is False and a negative integer is given, an OverflowError
-is raised.
Return the integer represented by the given array of bytes.
-
-
bytes
Holds the array of bytes to convert. The argument must either
-support the buffer protocol or be an iterable object producing bytes.
-Bytes and bytearray are examples of built-in objects that support the
-buffer protocol.
-
-
byteorder
The byte order used to represent the integer. If byteorder is ‘big’,
-the most significant byte is at the beginning of the byte array. If
-byteorder is ‘little’, the most significant byte is at the end of the
-byte array. To request the native byte order of the host system, use
-`sys.byteorder’ as the byte order value.
-
-
signed
Indicates whether two’s complement is used to represent the integer.
Length of bytes object to use. An OverflowError is raised if the
-integer is not representable with the given number of bytes.
-
-
byteorder
The byte order used to represent the integer. If byteorder is ‘big’,
-the most significant byte is at the beginning of the byte array. If
-byteorder is ‘little’, the most significant byte is at the end of the
-byte array. To request the native byte order of the host system, use
-`sys.byteorder’ as the byte order value.
-
-
signed
Determines whether two’s complement is used to represent the integer.
-If signed is False and a negative integer is given, an OverflowError
-is raised.
Return the integer represented by the given array of bytes.
-
-
bytes
Holds the array of bytes to convert. The argument must either
-support the buffer protocol or be an iterable object producing bytes.
-Bytes and bytearray are examples of built-in objects that support the
-buffer protocol.
-
-
byteorder
The byte order used to represent the integer. If byteorder is ‘big’,
-the most significant byte is at the beginning of the byte array. If
-byteorder is ‘little’, the most significant byte is at the end of the
-byte array. To request the native byte order of the host system, use
-`sys.byteorder’ as the byte order value.
-
-
signed
Indicates whether two’s complement is used to represent the integer.
Length of bytes object to use. An OverflowError is raised if the
-integer is not representable with the given number of bytes.
-
-
byteorder
The byte order used to represent the integer. If byteorder is ‘big’,
-the most significant byte is at the beginning of the byte array. If
-byteorder is ‘little’, the most significant byte is at the end of the
-byte array. To request the native byte order of the host system, use
-`sys.byteorder’ as the byte order value.
-
-
signed
Determines whether two’s complement is used to represent the integer.
-If signed is False and a negative integer is given, an OverflowError
-is raised.
Return the integer represented by the given array of bytes.
-
-
bytes
Holds the array of bytes to convert. The argument must either
-support the buffer protocol or be an iterable object producing bytes.
-Bytes and bytearray are examples of built-in objects that support the
-buffer protocol.
-
-
byteorder
The byte order used to represent the integer. If byteorder is ‘big’,
-the most significant byte is at the beginning of the byte array. If
-byteorder is ‘little’, the most significant byte is at the end of the
-byte array. To request the native byte order of the host system, use
-`sys.byteorder’ as the byte order value.
-
-
signed
Indicates whether two’s complement is used to represent the integer.
Length of bytes object to use. An OverflowError is raised if the
-integer is not representable with the given number of bytes.
-
-
byteorder
The byte order used to represent the integer. If byteorder is ‘big’,
-the most significant byte is at the beginning of the byte array. If
-byteorder is ‘little’, the most significant byte is at the end of the
-byte array. To request the native byte order of the host system, use
-`sys.byteorder’ as the byte order value.
-
-
signed
Determines whether two’s complement is used to represent the integer.
-If signed is False and a negative integer is given, an OverflowError
-is raised.
Return the integer represented by the given array of bytes.
-
-
bytes
Holds the array of bytes to convert. The argument must either
-support the buffer protocol or be an iterable object producing bytes.
-Bytes and bytearray are examples of built-in objects that support the
-buffer protocol.
-
-
byteorder
The byte order used to represent the integer. If byteorder is ‘big’,
-the most significant byte is at the beginning of the byte array. If
-byteorder is ‘little’, the most significant byte is at the end of the
-byte array. To request the native byte order of the host system, use
-`sys.byteorder’ as the byte order value.
-
-
signed
Indicates whether two’s complement is used to represent the integer.
Length of bytes object to use. An OverflowError is raised if the
-integer is not representable with the given number of bytes.
-
-
byteorder
The byte order used to represent the integer. If byteorder is ‘big’,
-the most significant byte is at the beginning of the byte array. If
-byteorder is ‘little’, the most significant byte is at the end of the
-byte array. To request the native byte order of the host system, use
-`sys.byteorder’ as the byte order value.
-
-
signed
Determines whether two’s complement is used to represent the integer.
-If signed is False and a negative integer is given, an OverflowError
-is raised.
Return the integer represented by the given array of bytes.
-
-
bytes
Holds the array of bytes to convert. The argument must either
-support the buffer protocol or be an iterable object producing bytes.
-Bytes and bytearray are examples of built-in objects that support the
-buffer protocol.
-
-
byteorder
The byte order used to represent the integer. If byteorder is ‘big’,
-the most significant byte is at the beginning of the byte array. If
-byteorder is ‘little’, the most significant byte is at the end of the
-byte array. To request the native byte order of the host system, use
-`sys.byteorder’ as the byte order value.
-
-
signed
Indicates whether two’s complement is used to represent the integer.
Length of bytes object to use. An OverflowError is raised if the
-integer is not representable with the given number of bytes.
-
-
byteorder
The byte order used to represent the integer. If byteorder is ‘big’,
-the most significant byte is at the beginning of the byte array. If
-byteorder is ‘little’, the most significant byte is at the end of the
-byte array. To request the native byte order of the host system, use
-`sys.byteorder’ as the byte order value.
-
-
signed
Determines whether two’s complement is used to represent the integer.
-If signed is False and a negative integer is given, an OverflowError
-is raised.
Return the integer represented by the given array of bytes.
-
-
bytes
Holds the array of bytes to convert. The argument must either
-support the buffer protocol or be an iterable object producing bytes.
-Bytes and bytearray are examples of built-in objects that support the
-buffer protocol.
-
-
byteorder
The byte order used to represent the integer. If byteorder is ‘big’,
-the most significant byte is at the beginning of the byte array. If
-byteorder is ‘little’, the most significant byte is at the end of the
-byte array. To request the native byte order of the host system, use
-`sys.byteorder’ as the byte order value.
-
-
signed
Indicates whether two’s complement is used to represent the integer.
Length of bytes object to use. An OverflowError is raised if the
-integer is not representable with the given number of bytes.
-
-
byteorder
The byte order used to represent the integer. If byteorder is ‘big’,
-the most significant byte is at the beginning of the byte array. If
-byteorder is ‘little’, the most significant byte is at the end of the
-byte array. To request the native byte order of the host system, use
-`sys.byteorder’ as the byte order value.
-
-
signed
Determines whether two’s complement is used to represent the integer.
-If signed is False and a negative integer is given, an OverflowError
-is raised.
Return the integer represented by the given array of bytes.
-
-
bytes
Holds the array of bytes to convert. The argument must either
-support the buffer protocol or be an iterable object producing bytes.
-Bytes and bytearray are examples of built-in objects that support the
-buffer protocol.
-
-
byteorder
The byte order used to represent the integer. If byteorder is ‘big’,
-the most significant byte is at the beginning of the byte array. If
-byteorder is ‘little’, the most significant byte is at the end of the
-byte array. To request the native byte order of the host system, use
-`sys.byteorder’ as the byte order value.
-
-
signed
Indicates whether two’s complement is used to represent the integer.
Length of bytes object to use. An OverflowError is raised if the
-integer is not representable with the given number of bytes.
-
-
byteorder
The byte order used to represent the integer. If byteorder is ‘big’,
-the most significant byte is at the beginning of the byte array. If
-byteorder is ‘little’, the most significant byte is at the end of the
-byte array. To request the native byte order of the host system, use
-`sys.byteorder’ as the byte order value.
-
-
signed
Determines whether two’s complement is used to represent the integer.
-If signed is False and a negative integer is given, an OverflowError
-is raised.
Return the integer represented by the given array of bytes.
-
-
bytes
Holds the array of bytes to convert. The argument must either
-support the buffer protocol or be an iterable object producing bytes.
-Bytes and bytearray are examples of built-in objects that support the
-buffer protocol.
-
-
byteorder
The byte order used to represent the integer. If byteorder is ‘big’,
-the most significant byte is at the beginning of the byte array. If
-byteorder is ‘little’, the most significant byte is at the end of the
-byte array. To request the native byte order of the host system, use
-`sys.byteorder’ as the byte order value.
-
-
signed
Indicates whether two’s complement is used to represent the integer.
Length of bytes object to use. An OverflowError is raised if the
-integer is not representable with the given number of bytes.
-
-
byteorder
The byte order used to represent the integer. If byteorder is ‘big’,
-the most significant byte is at the beginning of the byte array. If
-byteorder is ‘little’, the most significant byte is at the end of the
-byte array. To request the native byte order of the host system, use
-`sys.byteorder’ as the byte order value.
-
-
signed
Determines whether two’s complement is used to represent the integer.
-If signed is False and a negative integer is given, an OverflowError
-is raised.
Return the integer represented by the given array of bytes.
-
-
bytes
Holds the array of bytes to convert. The argument must either
-support the buffer protocol or be an iterable object producing bytes.
-Bytes and bytearray are examples of built-in objects that support the
-buffer protocol.
-
-
byteorder
The byte order used to represent the integer. If byteorder is ‘big’,
-the most significant byte is at the beginning of the byte array. If
-byteorder is ‘little’, the most significant byte is at the end of the
-byte array. To request the native byte order of the host system, use
-`sys.byteorder’ as the byte order value.
-
-
signed
Indicates whether two’s complement is used to represent the integer.
Length of bytes object to use. An OverflowError is raised if the
-integer is not representable with the given number of bytes.
-
-
byteorder
The byte order used to represent the integer. If byteorder is ‘big’,
-the most significant byte is at the beginning of the byte array. If
-byteorder is ‘little’, the most significant byte is at the end of the
-byte array. To request the native byte order of the host system, use
-`sys.byteorder’ as the byte order value.
-
-
signed
Determines whether two’s complement is used to represent the integer.
-If signed is False and a negative integer is given, an OverflowError
-is raised.
Return the integer represented by the given array of bytes.
-
-
bytes
Holds the array of bytes to convert. The argument must either
-support the buffer protocol or be an iterable object producing bytes.
-Bytes and bytearray are examples of built-in objects that support the
-buffer protocol.
-
-
byteorder
The byte order used to represent the integer. If byteorder is ‘big’,
-the most significant byte is at the beginning of the byte array. If
-byteorder is ‘little’, the most significant byte is at the end of the
-byte array. To request the native byte order of the host system, use
-`sys.byteorder’ as the byte order value.
-
-
signed
Indicates whether two’s complement is used to represent the integer.
Length of bytes object to use. An OverflowError is raised if the
-integer is not representable with the given number of bytes.
-
-
byteorder
The byte order used to represent the integer. If byteorder is ‘big’,
-the most significant byte is at the beginning of the byte array. If
-byteorder is ‘little’, the most significant byte is at the end of the
-byte array. To request the native byte order of the host system, use
-`sys.byteorder’ as the byte order value.
-
-
signed
Determines whether two’s complement is used to represent the integer.
-If signed is False and a negative integer is given, an OverflowError
-is raised.
Return the integer represented by the given array of bytes.
-
-
bytes
Holds the array of bytes to convert. The argument must either
-support the buffer protocol or be an iterable object producing bytes.
-Bytes and bytearray are examples of built-in objects that support the
-buffer protocol.
-
-
byteorder
The byte order used to represent the integer. If byteorder is ‘big’,
-the most significant byte is at the beginning of the byte array. If
-byteorder is ‘little’, the most significant byte is at the end of the
-byte array. To request the native byte order of the host system, use
-`sys.byteorder’ as the byte order value.
-
-
signed
Indicates whether two’s complement is used to represent the integer.
Length of bytes object to use. An OverflowError is raised if the
-integer is not representable with the given number of bytes.
-
-
byteorder
The byte order used to represent the integer. If byteorder is ‘big’,
-the most significant byte is at the beginning of the byte array. If
-byteorder is ‘little’, the most significant byte is at the end of the
-byte array. To request the native byte order of the host system, use
-`sys.byteorder’ as the byte order value.
-
-
signed
Determines whether two’s complement is used to represent the integer.
-If signed is False and a negative integer is given, an OverflowError
-is raised.
Return the integer represented by the given array of bytes.
-
-
bytes
Holds the array of bytes to convert. The argument must either
-support the buffer protocol or be an iterable object producing bytes.
-Bytes and bytearray are examples of built-in objects that support the
-buffer protocol.
-
-
byteorder
The byte order used to represent the integer. If byteorder is ‘big’,
-the most significant byte is at the beginning of the byte array. If
-byteorder is ‘little’, the most significant byte is at the end of the
-byte array. To request the native byte order of the host system, use
-`sys.byteorder’ as the byte order value.
-
-
signed
Indicates whether two’s complement is used to represent the integer.
Length of bytes object to use. An OverflowError is raised if the
-integer is not representable with the given number of bytes.
-
-
byteorder
The byte order used to represent the integer. If byteorder is ‘big’,
-the most significant byte is at the beginning of the byte array. If
-byteorder is ‘little’, the most significant byte is at the end of the
-byte array. To request the native byte order of the host system, use
-`sys.byteorder’ as the byte order value.
-
-
signed
Determines whether two’s complement is used to represent the integer.
-If signed is False and a negative integer is given, an OverflowError
-is raised.
Return the integer represented by the given array of bytes.
-
-
bytes
Holds the array of bytes to convert. The argument must either
-support the buffer protocol or be an iterable object producing bytes.
-Bytes and bytearray are examples of built-in objects that support the
-buffer protocol.
-
-
byteorder
The byte order used to represent the integer. If byteorder is ‘big’,
-the most significant byte is at the beginning of the byte array. If
-byteorder is ‘little’, the most significant byte is at the end of the
-byte array. To request the native byte order of the host system, use
-`sys.byteorder’ as the byte order value.
-
-
signed
Indicates whether two’s complement is used to represent the integer.
Length of bytes object to use. An OverflowError is raised if the
-integer is not representable with the given number of bytes.
-
-
byteorder
The byte order used to represent the integer. If byteorder is ‘big’,
-the most significant byte is at the beginning of the byte array. If
-byteorder is ‘little’, the most significant byte is at the end of the
-byte array. To request the native byte order of the host system, use
-`sys.byteorder’ as the byte order value.
-
-
signed
Determines whether two’s complement is used to represent the integer.
-If signed is False and a negative integer is given, an OverflowError
-is raised.
Return the integer represented by the given array of bytes.
-
-
bytes
Holds the array of bytes to convert. The argument must either
-support the buffer protocol or be an iterable object producing bytes.
-Bytes and bytearray are examples of built-in objects that support the
-buffer protocol.
-
-
byteorder
The byte order used to represent the integer. If byteorder is ‘big’,
-the most significant byte is at the beginning of the byte array. If
-byteorder is ‘little’, the most significant byte is at the end of the
-byte array. To request the native byte order of the host system, use
-`sys.byteorder’ as the byte order value.
-
-
signed
Indicates whether two’s complement is used to represent the integer.
Length of bytes object to use. An OverflowError is raised if the
-integer is not representable with the given number of bytes.
-
-
byteorder
The byte order used to represent the integer. If byteorder is ‘big’,
-the most significant byte is at the beginning of the byte array. If
-byteorder is ‘little’, the most significant byte is at the end of the
-byte array. To request the native byte order of the host system, use
-`sys.byteorder’ as the byte order value.
-
-
signed
Determines whether two’s complement is used to represent the integer.
-If signed is False and a negative integer is given, an OverflowError
-is raised.
Return the integer represented by the given array of bytes.
-
-
bytes
Holds the array of bytes to convert. The argument must either
-support the buffer protocol or be an iterable object producing bytes.
-Bytes and bytearray are examples of built-in objects that support the
-buffer protocol.
-
-
byteorder
The byte order used to represent the integer. If byteorder is ‘big’,
-the most significant byte is at the beginning of the byte array. If
-byteorder is ‘little’, the most significant byte is at the end of the
-byte array. To request the native byte order of the host system, use
-`sys.byteorder’ as the byte order value.
-
-
signed
Indicates whether two’s complement is used to represent the integer.
Length of bytes object to use. An OverflowError is raised if the
-integer is not representable with the given number of bytes.
-
-
byteorder
The byte order used to represent the integer. If byteorder is ‘big’,
-the most significant byte is at the beginning of the byte array. If
-byteorder is ‘little’, the most significant byte is at the end of the
-byte array. To request the native byte order of the host system, use
-`sys.byteorder’ as the byte order value.
-
-
signed
Determines whether two’s complement is used to represent the integer.
-If signed is False and a negative integer is given, an OverflowError
-is raised.
For a 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:
Return the integer represented by the given array of bytes.
-
-
bytes
Holds the array of bytes to convert. The argument must either
-support the buffer protocol or be an iterable object producing bytes.
-Bytes and bytearray are examples of built-in objects that support the
-buffer protocol.
-
-
byteorder
The byte order used to represent the integer. If byteorder is ‘big’,
-the most significant byte is at the beginning of the byte array. If
-byteorder is ‘little’, the most significant byte is at the end of the
-byte array. To request the native byte order of the host system, use
-`sys.byteorder’ as the byte order value.
-
-
signed
Indicates whether two’s complement is used to represent the integer.
Length of bytes object to use. An OverflowError is raised if the
-integer is not representable with the given number of bytes.
-
-
byteorder
The byte order used to represent the integer. If byteorder is ‘big’,
-the most significant byte is at the beginning of the byte array. If
-byteorder is ‘little’, the most significant byte is at the end of the
-byte array. To request the native byte order of the host system, use
-`sys.byteorder’ as the byte order value.
-
-
signed
Determines whether two’s complement is used to represent the integer.
-If signed is False and a negative integer is given, an OverflowError
-is raised.
Return the integer represented by the given array of bytes.
-
-
bytes
Holds the array of bytes to convert. The argument must either
-support the buffer protocol or be an iterable object producing bytes.
-Bytes and bytearray are examples of built-in objects that support the
-buffer protocol.
-
-
byteorder
The byte order used to represent the integer. If byteorder is ‘big’,
-the most significant byte is at the beginning of the byte array. If
-byteorder is ‘little’, the most significant byte is at the end of the
-byte array. To request the native byte order of the host system, use
-`sys.byteorder’ as the byte order value.
-
-
signed
Indicates whether two’s complement is used to represent the integer.
Length of bytes object to use. An OverflowError is raised if the
-integer is not representable with the given number of bytes.
-
-
byteorder
The byte order used to represent the integer. If byteorder is ‘big’,
-the most significant byte is at the beginning of the byte array. If
-byteorder is ‘little’, the most significant byte is at the end of the
-byte array. To request the native byte order of the host system, use
-`sys.byteorder’ as the byte order value.
-
-
signed
Determines whether two’s complement is used to represent the integer.
-If signed is False and a negative integer is given, an OverflowError
-is raised.
Return the integer represented by the given array of bytes.
-
-
bytes
Holds the array of bytes to convert. The argument must either
-support the buffer protocol or be an iterable object producing bytes.
-Bytes and bytearray are examples of built-in objects that support the
-buffer protocol.
-
-
byteorder
The byte order used to represent the integer. If byteorder is ‘big’,
-the most significant byte is at the beginning of the byte array. If
-byteorder is ‘little’, the most significant byte is at the end of the
-byte array. To request the native byte order of the host system, use
-`sys.byteorder’ as the byte order value.
-
-
signed
Indicates whether two’s complement is used to represent the integer.
Length of bytes object to use. An OverflowError is raised if the
-integer is not representable with the given number of bytes.
-
-
byteorder
The byte order used to represent the integer. If byteorder is ‘big’,
-the most significant byte is at the beginning of the byte array. If
-byteorder is ‘little’, the most significant byte is at the end of the
-byte array. To request the native byte order of the host system, use
-`sys.byteorder’ as the byte order value.
-
-
signed
Determines whether two’s complement is used to represent the integer.
-If signed is False and a negative integer is given, an OverflowError
-is raised.
Return the integer represented by the given array of bytes.
-
-
bytes
Holds the array of bytes to convert. The argument must either
-support the buffer protocol or be an iterable object producing bytes.
-Bytes and bytearray are examples of built-in objects that support the
-buffer protocol.
-
-
byteorder
The byte order used to represent the integer. If byteorder is ‘big’,
-the most significant byte is at the beginning of the byte array. If
-byteorder is ‘little’, the most significant byte is at the end of the
-byte array. To request the native byte order of the host system, use
-`sys.byteorder’ as the byte order value.
-
-
signed
Indicates whether two’s complement is used to represent the integer.
Length of bytes object to use. An OverflowError is raised if the
-integer is not representable with the given number of bytes.
-
-
byteorder
The byte order used to represent the integer. If byteorder is ‘big’,
-the most significant byte is at the beginning of the byte array. If
-byteorder is ‘little’, the most significant byte is at the end of the
-byte array. To request the native byte order of the host system, use
-`sys.byteorder’ as the byte order value.
-
-
signed
Determines whether two’s complement is used to represent the integer.
-If signed is False and a negative integer is given, an OverflowError
-is raised.