From d12264f358b125a5a8d7602b96a367b707f719c0 Mon Sep 17 00:00:00 2001 From: Eugenio Parodi Date: Mon, 21 Oct 2024 17:11:07 +0100 Subject: [PATCH] Doc Updated --- .../TTkAbstract/abstractscrollarea.html | 2 +- .../TTkAbstract/abstractscrollview.html | 2 +- .../TTkAbstract/abstracttablemodel.html | 415 ++ _modules/TermTk/TTkCore/TTkTerm/inputkey.html | 2 +- .../TermTk/TTkCore/TTkTerm/inputmouse.html | 2 +- _modules/TermTk/TTkCore/canvas.html | 41 +- _modules/TermTk/TTkCore/color.html | 112 +- _modules/TermTk/TTkCore/constant.html | 204 +- _modules/TermTk/TTkCore/drivers/windows.html | 2 +- _modules/TermTk/TTkCore/helper.html | 8 +- _modules/TermTk/TTkCore/shortcut.html | 237 + _modules/TermTk/TTkCore/signal.html | 4 +- _modules/TermTk/TTkCore/string.html | 19 +- _modules/TermTk/TTkCore/timer_unix.html | 2 +- _modules/TermTk/TTkCore/ttk.html | 2 +- _modules/TermTk/TTkCrossTools/savetools.html | 330 + _modules/TermTk/TTkGui/clipboard.html | 36 +- _modules/TermTk/TTkGui/textdocument.html | 4 +- _modules/TermTk/TTkLayouts/boxlayout.html | 2 +- _modules/TermTk/TTkLayouts/gridlayout.html | 2 +- _modules/TermTk/TTkLayouts/layout.html | 5 +- .../TermTk/TTkTestWidgets/keypressview.html | 2 +- _modules/TermTk/TTkTestWidgets/logviewer.html | 5 +- .../TTkTestWidgets/testabstractscroll.html | 2 +- .../TermTk/TTkTestWidgets/testwidget.html | 2 +- .../TTkTestWidgets/testwidgetsizes.html | 2 +- .../TermTk/TTkTestWidgets/tominspector.html | 2 +- _modules/TermTk/TTkTheme/draw_utf8.html | 2 +- _modules/TermTk/TTkTheme/theme.html | 2 +- _modules/TermTk/TTkUiTools/uiloader.html | 53 +- .../TermTk/TTkWidgets/Fancy/progressbar.html | 2 +- _modules/TermTk/TTkWidgets/Fancy/table.html | 5 +- .../TermTk/TTkWidgets/Fancy/tableview.html | 5 +- _modules/TermTk/TTkWidgets/Fancy/tree.html | 5 +- .../TermTk/TTkWidgets/Fancy/treeview.html | 2 +- .../TermTk/TTkWidgets/Fancy/treewidget.html | 5 +- .../TTkWidgets/TTkModelView/filetree.html | 2 +- .../TTkModelView/filetreewidget.html | 7 +- .../TermTk/TTkWidgets/TTkModelView/table.html | 497 ++ .../TTkModelView/tablemodelcsv.html | 221 + .../TTkModelView/tablemodellist.html | 257 + .../TTkWidgets/TTkModelView/tablewidget.html | 2041 +++++++ .../TermTk/TTkWidgets/TTkModelView/tree.html | 13 +- .../TTkWidgets/TTkModelView/treewidget.html | 85 +- .../TTkWidgets/TTkPickers/colorpicker.html | 14 +- .../TTkWidgets/TTkPickers/filepicker.html | 58 +- .../TTkWidgets/TTkPickers/messagebox.html | 5 +- .../TTkWidgets/TTkPickers/textpicker.html | 52 +- .../TTkWidgets/TTkTerminal/debugterminal.html | 2 +- .../TermTk/TTkWidgets/TTkTerminal/mode.html | 2 +- .../TTkWidgets/TTkTerminal/terminal.html | 5 +- .../TTkWidgets/TTkTerminal/terminalview.html | 22 +- _modules/TermTk/TTkWidgets/about.html | 28 +- _modules/TermTk/TTkWidgets/apptemplate.html | 341 +- _modules/TermTk/TTkWidgets/button.html | 2 +- _modules/TermTk/TTkWidgets/checkbox.html | 2 +- _modules/TermTk/TTkWidgets/combobox.html | 2 +- _modules/TermTk/TTkWidgets/container.html | 4 +- _modules/TermTk/TTkWidgets/frame.html | 2 +- _modules/TermTk/TTkWidgets/graph.html | 2 +- _modules/TermTk/TTkWidgets/image.html | 4 +- _modules/TermTk/TTkWidgets/kodetab.html | 5 +- _modules/TermTk/TTkWidgets/label.html | 2 +- _modules/TermTk/TTkWidgets/lineedit.html | 4 +- _modules/TermTk/TTkWidgets/list_.html | 5 +- _modules/TermTk/TTkWidgets/listwidget.html | 2 +- _modules/TermTk/TTkWidgets/menu.html | 8 +- _modules/TermTk/TTkWidgets/menubar.html | 28 +- _modules/TermTk/TTkWidgets/radiobutton.html | 14 +- .../TermTk/TTkWidgets/resizableframe.html | 2 +- _modules/TermTk/TTkWidgets/scrollarea.html | 5 +- _modules/TermTk/TTkWidgets/scrollbar.html | 13 +- _modules/TermTk/TTkWidgets/slider.html | 281 + _modules/TermTk/TTkWidgets/spacer.html | 2 +- _modules/TermTk/TTkWidgets/spinbox.html | 15 +- _modules/TermTk/TTkWidgets/splitter.html | 2 +- _modules/TermTk/TTkWidgets/tabwidget.html | 2 +- _modules/TermTk/TTkWidgets/texedit.html | 76 +- _modules/TermTk/TTkWidgets/widget.html | 26 +- _modules/TermTk/TTkWidgets/window.html | 2 +- _modules/index.html | 10 +- ...mTk.TTkAbstract.abstracttablemodel.rst.txt | 24 + .../autogen.TermTk/TermTk.TTkAbstract.rst.txt | 3 +- .../TermTk.TTkCore.shortcut.rst.txt | 8 + .../TermTk.TTkCrossTools.rst.txt | 13 + .../TermTk.TTkCrossTools.savetools.rst.txt | 16 + .../TermTk.TTkUiTools.properties.rst.txt | 1 + ...ermTk.TTkUiTools.properties.slider.rst.txt | 8 + .../TermTk.TTkWidgets.TTkModelView.rst.txt | 5 + ...rmTk.TTkWidgets.TTkModelView.table.rst.txt | 16 + ...Widgets.TTkModelView.tablemodelcsv.rst.txt | 16 + ...idgets.TTkModelView.tablemodellist.rst.txt | 16 + ...TkWidgets.TTkModelView.tablewidget.rst.txt | 24 + ...dgets.TTkModelView.tablewidgetitem.rst.txt | 8 + .../autogen.TermTk/TermTk.TTkWidgets.rst.txt | 1 + .../TermTk.TTkWidgets.slider.rst.txt | 16 + _sources/autogen.TermTk/TermTk.rst.txt | 1 + _sources/info/features/widgets.rst.txt | 4 + _sources/info/installing.rst.txt | 7 + _sources/tutorial/000-examples.rst.txt | 36 + _sources/tutorial/examples/README.rst.txt | 36 + .../ttkDesigner/textEdit/README.rst.txt | 2 +- _static/documentation_options.js | 2 +- .../TermTk.TTkAbstract.abstractitemmodel.html | 3 +- ...TermTk.TTkAbstract.abstractscrollarea.html | 3 +- ...TermTk.TTkAbstract.abstractscrollview.html | 7 +- ...TermTk.TTkAbstract.abstracttablemodel.html | 410 ++ autogen.TermTk/TermTk.TTkAbstract.html | 6 +- .../TermTk.TTkCore.TTkTerm.colors.html | 2 +- ...ermTk.TTkCore.TTkTerm.colors_ansi_map.html | 2 +- autogen.TermTk/TermTk.TTkCore.TTkTerm.html | 2 +- .../TermTk.TTkCore.TTkTerm.input.html | 2 +- .../TermTk.TTkCore.TTkTerm.input_mono.html | 2 +- .../TermTk.TTkCore.TTkTerm.input_thread.html | 2 +- .../TermTk.TTkCore.TTkTerm.inputkey.html | 2 +- .../TermTk.TTkCore.TTkTerm.inputmouse.html | 2 +- .../TermTk.TTkCore.TTkTerm.term.html | 2 +- .../TermTk.TTkCore.TTkTerm.term_base.html | 2 +- autogen.TermTk/TermTk.TTkCore.canvas.html | 2 +- autogen.TermTk/TermTk.TTkCore.cfg.html | 2 +- autogen.TermTk/TermTk.TTkCore.color.html | 183 +- autogen.TermTk/TermTk.TTkCore.constant.html | 5380 +++-------------- autogen.TermTk/TermTk.TTkCore.drivers.html | 2 +- .../TermTk.TTkCore.drivers.pyodide.html | 2 +- .../TermTk.TTkCore.drivers.term_pyodide.html | 2 +- .../TermTk.TTkCore.drivers.term_unix.html | 2 +- ...rmTk.TTkCore.drivers.term_unix_serial.html | 2 +- .../TermTk.TTkCore.drivers.term_windows.html | 2 +- .../TermTk.TTkCore.drivers.unix.html | 2 +- .../TermTk.TTkCore.drivers.unix_thread.html | 2 +- .../TermTk.TTkCore.drivers.windows.html | 2 +- autogen.TermTk/TermTk.TTkCore.filebuffer.html | 2 +- autogen.TermTk/TermTk.TTkCore.helper.html | 2 +- autogen.TermTk/TermTk.TTkCore.html | 6 +- autogen.TermTk/TermTk.TTkCore.log.html | 2 +- .../TermTk.TTkCore.propertyanimation.html | 2 +- autogen.TermTk/TermTk.TTkCore.shortcut.html | 15 +- autogen.TermTk/TermTk.TTkCore.signal.html | 2 +- autogen.TermTk/TermTk.TTkCore.string.html | 12 +- autogen.TermTk/TermTk.TTkCore.timer.html | 2 +- .../TermTk.TTkCore.timer_pyodide.html | 2 +- autogen.TermTk/TermTk.TTkCore.timer_unix.html | 2 +- autogen.TermTk/TermTk.TTkCore.ttk.html | 2 +- autogen.TermTk/TermTk.TTkCore.util.html | 2 +- autogen.TermTk/TermTk.TTkCrossTools.html | 151 + .../TermTk.TTkCrossTools.savetools.html | 572 ++ autogen.TermTk/TermTk.TTkGui.clipboard.html | 2 +- autogen.TermTk/TermTk.TTkGui.drag.html | 2 +- autogen.TermTk/TermTk.TTkGui.html | 2 +- autogen.TermTk/TermTk.TTkGui.textcursor.html | 2 +- .../TermTk.TTkGui.textdocument.html | 2 +- autogen.TermTk/TermTk.TTkGui.textwrap1.html | 2 +- autogen.TermTk/TermTk.TTkGui.tooltip.html | 2 +- .../TermTk.TTkLayouts.boxlayout.html | 2 +- .../TermTk.TTkLayouts.gridlayout.html | 2 +- autogen.TermTk/TermTk.TTkLayouts.html | 2 +- autogen.TermTk/TermTk.TTkLayouts.layout.html | 2 +- .../TermTk.TTkTemplates.dragevents.html | 2 +- autogen.TermTk/TermTk.TTkTemplates.html | 2 +- .../TermTk.TTkTemplates.keyevents.html | 2 +- .../TermTk.TTkTemplates.mouseevents.html | 2 +- autogen.TermTk/TermTk.TTkTestWidgets.html | 2 +- .../TermTk.TTkTestWidgets.keypressview.html | 2 +- ...ermTk.TTkTestWidgets.keypressviewfont.html | 2 +- .../TermTk.TTkTestWidgets.logviewer.html | 2 +- ...mTk.TTkTestWidgets.testabstractscroll.html | 2 +- .../TermTk.TTkTestWidgets.testwidget.html | 2 +- ...TermTk.TTkTestWidgets.testwidgetsizes.html | 2 +- .../TermTk.TTkTestWidgets.tominspector.html | 2 +- .../TermTk.TTkTheme.draw_ascii.html | 2 +- autogen.TermTk/TermTk.TTkTheme.draw_utf8.html | 2 +- .../TermTk.TTkTheme.fileicon_ascii.html | 2 +- .../TermTk.TTkTheme.fileicon_nerd.html | 2 +- .../TermTk.TTkTheme.fileicon_utf8.html | 2 +- autogen.TermTk/TermTk.TTkTheme.html | 2 +- autogen.TermTk/TermTk.TTkTheme.theme.html | 2 +- autogen.TermTk/TermTk.TTkTypes.html | 2 +- autogen.TermTk/TermTk.TTkTypes.viewitem.html | 2 +- autogen.TermTk/TermTk.TTkUiTools.html | 2 +- .../TermTk.TTkUiTools.properties.about.html | 3 +- .../TermTk.TTkUiTools.properties.button.html | 3 +- ...TermTk.TTkUiTools.properties.checkbox.html | 3 +- ...mTk.TTkUiTools.properties.colorpicker.html | 3 +- ...TermTk.TTkUiTools.properties.combobox.html | 3 +- ...ermTk.TTkUiTools.properties.container.html | 3 +- ...rmTk.TTkUiTools.properties.filepicker.html | 3 +- .../TermTk.TTkUiTools.properties.frame.html | 3 +- .../TermTk.TTkUiTools.properties.graph.html | 3 +- .../TermTk.TTkUiTools.properties.html | 20 +- .../TermTk.TTkUiTools.properties.image.html | 3 +- .../TermTk.TTkUiTools.properties.label.html | 3 +- .../TermTk.TTkUiTools.properties.layout.html | 3 +- ...TermTk.TTkUiTools.properties.lineedit.html | 3 +- .../TermTk.TTkUiTools.properties.list_.html | 3 +- ...rmTk.TTkUiTools.properties.listwidget.html | 3 +- .../TermTk.TTkUiTools.properties.menu.html | 3 +- .../TermTk.TTkUiTools.properties.menubar.html | 3 +- ...mTk.TTkUiTools.properties.progressbar.html | 3 +- ...mTk.TTkUiTools.properties.radiobutton.html | 3 +- ....TTkUiTools.properties.resizableframe.html | 3 +- ...rmTk.TTkUiTools.properties.scrollarea.html | 3 +- ...ermTk.TTkUiTools.properties.scrollbar.html | 7 +- .../TermTk.TTkUiTools.properties.slider.html | 184 + .../TermTk.TTkUiTools.properties.spacer.html | 7 +- .../TermTk.TTkUiTools.properties.spinbox.html | 3 +- ...TermTk.TTkUiTools.properties.splitter.html | 3 +- ...ermTk.TTkUiTools.properties.tabwidget.html | 3 +- .../TermTk.TTkUiTools.properties.texedit.html | 3 +- .../TermTk.TTkUiTools.properties.widget.html | 3 +- .../TermTk.TTkUiTools.properties.window.html | 3 +- .../TermTk.TTkUiTools.uiloader.html | 14 +- .../TermTk.TTkUiTools.uiproperties.html | 2 +- autogen.TermTk/TermTk.TTkWidgets.Fancy.html | 3 +- .../TermTk.TTkWidgets.Fancy.progressbar.html | 3 +- .../TermTk.TTkWidgets.Fancy.table.html | 3 +- .../TermTk.TTkWidgets.Fancy.tableview.html | 3 +- .../TermTk.TTkWidgets.Fancy.tree.html | 3 +- .../TermTk.TTkWidgets.Fancy.treeview.html | 3 +- .../TermTk.TTkWidgets.Fancy.treewidget.html | 3 +- ...ermTk.TTkWidgets.Fancy.treewidgetitem.html | 3 +- ...rmTk.TTkWidgets.TTkModelView.filetree.html | 7 +- ...TkWidgets.TTkModelView.filetreewidget.html | 17 +- ...dgets.TTkModelView.filetreewidgetitem.html | 11 +- .../TermTk.TTkWidgets.TTkModelView.html | 28 +- .../TermTk.TTkWidgets.TTkModelView.table.html | 1027 ++++ ...TTkWidgets.TTkModelView.tablemodelcsv.html | 338 ++ ...TkWidgets.TTkModelView.tablemodellist.html | 329 + ...k.TTkWidgets.TTkModelView.tablewidget.html | 1261 ++++ ...kWidgets.TTkModelView.tablewidgetitem.html | 160 + .../TermTk.TTkWidgets.TTkModelView.tree.html | 11 +- ...Tk.TTkWidgets.TTkModelView.treewidget.html | 19 +- ...TkWidgets.TTkModelView.treewidgetitem.html | 7 +- ...mTk.TTkWidgets.TTkPickers.colorpicker.html | 2 +- ....TTkWidgets.TTkPickers.dateTimePicker.html | 2 +- ...rmTk.TTkWidgets.TTkPickers.filepicker.html | 2 +- .../TermTk.TTkWidgets.TTkPickers.html | 2 +- ...rmTk.TTkWidgets.TTkPickers.messagebox.html | 228 +- ...rmTk.TTkWidgets.TTkPickers.textpicker.html | 8 +- ....TTkWidgets.TTkTerminal.debugterminal.html | 2 +- .../TermTk.TTkWidgets.TTkTerminal.html | 2 +- .../TermTk.TTkWidgets.TTkTerminal.mode.html | 117 +- ...ermTk.TTkWidgets.TTkTerminal.terminal.html | 2 +- ...TkWidgets.TTkTerminal.terminal_screen.html | 2 +- ...idgets.TTkTerminal.terminal_screen_C1.html | 2 +- ...dgets.TTkTerminal.terminal_screen_CSI.html | 2 +- ...TTkWidgets.TTkTerminal.terminalhelper.html | 2 +- ...k.TTkWidgets.TTkTerminal.terminalview.html | 2 +- ...gets.TTkTerminal.terminalview_CSI_DEC.html | 2 +- .../TermTk.TTkWidgets.TTkTerminal.vt102.html | 2 +- autogen.TermTk/TermTk.TTkWidgets.about.html | 3 +- .../TermTk.TTkWidgets.apptemplate.html | 5 +- autogen.TermTk/TermTk.TTkWidgets.button.html | 3 +- .../TermTk.TTkWidgets.checkbox.html | 5 +- .../TermTk.TTkWidgets.combobox.html | 3 +- .../TermTk.TTkWidgets.container.html | 3 +- autogen.TermTk/TermTk.TTkWidgets.frame.html | 3 +- autogen.TermTk/TermTk.TTkWidgets.graph.html | 3 +- autogen.TermTk/TermTk.TTkWidgets.html | 20 +- autogen.TermTk/TermTk.TTkWidgets.image.html | 3 +- autogen.TermTk/TermTk.TTkWidgets.kodetab.html | 5 +- autogen.TermTk/TermTk.TTkWidgets.label.html | 3 +- .../TermTk.TTkWidgets.lineedit.html | 118 +- autogen.TermTk/TermTk.TTkWidgets.list_.html | 3 +- .../TermTk.TTkWidgets.listwidget.html | 3 +- autogen.TermTk/TermTk.TTkWidgets.menu.html | 5 +- autogen.TermTk/TermTk.TTkWidgets.menubar.html | 7 +- .../TermTk.TTkWidgets.radiobutton.html | 5 +- .../TermTk.TTkWidgets.resizableframe.html | 3 +- .../TermTk.TTkWidgets.scrollarea.html | 3 +- .../TermTk.TTkWidgets.scrollbar.html | 7 +- autogen.TermTk/TermTk.TTkWidgets.slider.html | 685 +++ autogen.TermTk/TermTk.TTkWidgets.spacer.html | 7 +- autogen.TermTk/TermTk.TTkWidgets.spinbox.html | 3 +- .../TermTk.TTkWidgets.splitter.html | 3 +- .../TermTk.TTkWidgets.tabwidget.html | 3 +- autogen.TermTk/TermTk.TTkWidgets.texedit.html | 57 +- autogen.TermTk/TermTk.TTkWidgets.widget.html | 7 +- autogen.TermTk/TermTk.TTkWidgets.window.html | 3 +- autogen.TermTk/TermTk.html | 21 +- genindex.html | 1857 +++--- index.html | 2 +- info/debug.html | 2 +- info/features/crosscompatible.html | 2 +- info/features/index.html | 2 +- info/features/widgets.html | 7 +- info/installing.html | 6 +- info/resources/clipboard.html | 2 +- info/resources/dragdrop.html | 2 +- info/resources/index.html | 2 +- info/resources/input.html | 2 +- info/resources/modal.html | 2 +- info/resources/paint.html | 2 +- objects.inv | Bin 28402 -> 28949 bytes py-modindex.html | 52 +- search.html | 2 +- searchindex.js | 2 +- tutorial/000-examples.html | 28 +- tutorial/001-helloworld.html | 2 +- tutorial/002-layout.html | 2 +- tutorial/003-signalslots.html | 2 +- tutorial/004-logging.html | 2 +- tutorial/005-calculator.html | 2 +- tutorial/examples/README.html | 27 +- tutorial/ttkDesigner/textEdit/README.html | 6 +- 304 files changed, 13294 insertions(+), 6502 deletions(-) create mode 100644 _modules/TermTk/TTkAbstract/abstracttablemodel.html create mode 100644 _modules/TermTk/TTkCore/shortcut.html create mode 100644 _modules/TermTk/TTkCrossTools/savetools.html create mode 100644 _modules/TermTk/TTkWidgets/TTkModelView/table.html create mode 100644 _modules/TermTk/TTkWidgets/TTkModelView/tablemodelcsv.html create mode 100644 _modules/TermTk/TTkWidgets/TTkModelView/tablemodellist.html create mode 100644 _modules/TermTk/TTkWidgets/TTkModelView/tablewidget.html create mode 100644 _modules/TermTk/TTkWidgets/slider.html create mode 100644 _sources/autogen.TermTk/TermTk.TTkAbstract.abstracttablemodel.rst.txt create mode 100644 _sources/autogen.TermTk/TermTk.TTkCrossTools.rst.txt create mode 100644 _sources/autogen.TermTk/TermTk.TTkCrossTools.savetools.rst.txt create mode 100644 _sources/autogen.TermTk/TermTk.TTkUiTools.properties.slider.rst.txt create mode 100644 _sources/autogen.TermTk/TermTk.TTkWidgets.TTkModelView.table.rst.txt create mode 100644 _sources/autogen.TermTk/TermTk.TTkWidgets.TTkModelView.tablemodelcsv.rst.txt create mode 100644 _sources/autogen.TermTk/TermTk.TTkWidgets.TTkModelView.tablemodellist.rst.txt create mode 100644 _sources/autogen.TermTk/TermTk.TTkWidgets.TTkModelView.tablewidget.rst.txt create mode 100644 _sources/autogen.TermTk/TermTk.TTkWidgets.TTkModelView.tablewidgetitem.rst.txt create mode 100644 _sources/autogen.TermTk/TermTk.TTkWidgets.slider.rst.txt create mode 100644 autogen.TermTk/TermTk.TTkAbstract.abstracttablemodel.html create mode 100644 autogen.TermTk/TermTk.TTkCrossTools.html create mode 100644 autogen.TermTk/TermTk.TTkCrossTools.savetools.html create mode 100644 autogen.TermTk/TermTk.TTkUiTools.properties.slider.html create mode 100644 autogen.TermTk/TermTk.TTkWidgets.TTkModelView.table.html create mode 100644 autogen.TermTk/TermTk.TTkWidgets.TTkModelView.tablemodelcsv.html create mode 100644 autogen.TermTk/TermTk.TTkWidgets.TTkModelView.tablemodellist.html create mode 100644 autogen.TermTk/TermTk.TTkWidgets.TTkModelView.tablewidget.html create mode 100644 autogen.TermTk/TermTk.TTkWidgets.TTkModelView.tablewidgetitem.html create mode 100644 autogen.TermTk/TermTk.TTkWidgets.slider.html diff --git a/_modules/TermTk/TTkAbstract/abstractscrollarea.html b/_modules/TermTk/TTkAbstract/abstractscrollarea.html index 06923415..5578be9c 100644 --- a/_modules/TermTk/TTkAbstract/abstractscrollarea.html +++ b/_modules/TermTk/TTkAbstract/abstractscrollarea.html @@ -3,7 +3,7 @@ - TermTk.TTkAbstract.abstractscrollarea — pyTermTk 0.39.0-a + <title>TermTk.TTkAbstract.abstractscrollarea — pyTermTk 0.40.0-a documentation diff --git a/_modules/TermTk/TTkAbstract/abstractscrollview.html b/_modules/TermTk/TTkAbstract/abstractscrollview.html index a8ebd3a0..d658c374 100644 --- a/_modules/TermTk/TTkAbstract/abstractscrollview.html +++ b/_modules/TermTk/TTkAbstract/abstractscrollview.html @@ -3,7 +3,7 @@ - TermTk.TTkAbstract.abstractscrollview — pyTermTk 0.39.0-a + <title>TermTk.TTkAbstract.abstractscrollview — pyTermTk 0.40.0-a documentation diff --git a/_modules/TermTk/TTkAbstract/abstracttablemodel.html b/_modules/TermTk/TTkAbstract/abstracttablemodel.html new file mode 100644 index 00000000..21029db6 --- /dev/null +++ b/_modules/TermTk/TTkAbstract/abstracttablemodel.html @@ -0,0 +1,415 @@ + + + + + + TermTk.TTkAbstract.abstracttablemodel — pyTermTk 0.40.0-a + documentation + + + + + + + + + + + + + + + + + + +
+ + +
+ +
+
+
+
    +
  • »
  • +
  • Module code »
  • +
  • TermTk.TTkAbstract.abstracttablemodel
  • +
  • +
  • +
+
+
+
+
+ +

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']
+
+from TermTk.TTkCore.constant import TTkK
+from TermTk.TTkCore.string import TTkString
+from TermTk.TTkCore.signal import pyTTkSignal, pyTTkSlot
+
+
[docs]class TTkModelIndex(): + ''' + 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] def row(self) -> int: + ''' + Returns the row this model index refers to. + + :return: int + ''' + pass
+ +
[docs] def col(self) -> int: + ''' + Returns the column this model index refers to. + + :return: int + ''' + pass
+ +
[docs] def data(self) -> object: + ''' + Returns the data for the item referred to by the index. + + :return: object + ''' + pass
+ +
[docs] def setData(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
+ +class _TTkModelIndexList(TTkModelIndex): + __slots__ = ('_col','_row','_model') + def __init__(self, row:int, col:list, model) -> None: + self._col = col + self._row = row + self._model = model + super().__init__() + + def row(self) -> int: + return self._row + + def col(self) -> int: + return self._col + + def data(self) -> object: + return self._model.data(self._row,self._col) + + def setData(self, data: object) -> None: + self._model.setData(self._row,self._col,data) + +
[docs]class TTkAbstractTableModel(): + ''' + :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] def rowCount(self) -> int: + ''' + Returns the number of rows of the current model. + + :return: int + ''' + raise NotImplementedError()
+ +
[docs] def columnCount(self) -> int: + ''' + Returns the number of columns of the current moodel. + + :return: int + ''' + raise NotImplementedError()
+ +
[docs] def index(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] def data(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 + ''' + raise NotImplementedError()
+ +
[docs] def setData(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 + ''' + return False
+ +
[docs] def ttkStringData(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) + if isinstance(data,TTkString): + return data + elif type(data) == str: + return TTkString(data) + else: + return TTkString(str(data))
+ +
[docs] def headerData(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` + ''' + if orientation==TTkK.HORIZONTAL: + return TTkString(str(pos)) + elif orientation==TTkK.VERTICAL: + return TTkString(str(pos)) + return TTkString()
+ +
[docs] def flags(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] def sort(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
+
+ +
+
+
+ +
+ +
+

© Copyright 2021, Eugenio Parodi.

+
+ + Built with Sphinx using a + theme + provided by Read the Docs. + + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/_modules/TermTk/TTkCore/TTkTerm/inputkey.html b/_modules/TermTk/TTkCore/TTkTerm/inputkey.html index d62f92e9..a3b6550f 100644 --- a/_modules/TermTk/TTkCore/TTkTerm/inputkey.html +++ b/_modules/TermTk/TTkCore/TTkTerm/inputkey.html @@ -3,7 +3,7 @@ - TermTk.TTkCore.TTkTerm.inputkey — pyTermTk 0.39.0-a + <title>TermTk.TTkCore.TTkTerm.inputkey — pyTermTk 0.40.0-a documentation diff --git a/_modules/TermTk/TTkCore/TTkTerm/inputmouse.html b/_modules/TermTk/TTkCore/TTkTerm/inputmouse.html index 99058b85..626240f8 100644 --- a/_modules/TermTk/TTkCore/TTkTerm/inputmouse.html +++ b/_modules/TermTk/TTkCore/TTkTerm/inputmouse.html @@ -3,7 +3,7 @@ - TermTk.TTkCore.TTkTerm.inputmouse — pyTermTk 0.39.0-a + <title>TermTk.TTkCore.TTkTerm.inputmouse — pyTermTk 0.40.0-a documentation diff --git a/_modules/TermTk/TTkCore/canvas.html b/_modules/TermTk/TTkCore/canvas.html index 6ce43d51..f0f943b6 100644 --- a/_modules/TermTk/TTkCore/canvas.html +++ b/_modules/TermTk/TTkCore/canvas.html @@ -3,7 +3,7 @@ - TermTk.TTkCore.canvas — pyTermTk 0.39.0-a + <title>TermTk.TTkCore.canvas — pyTermTk 0.40.0-a documentation @@ -161,11 +161,12 @@ # self.resize(self._width, self._height) # TTkLog.debug((self._width, self._height)) - def transparent(self): + def transparent(self) -> bool: return self._transparent - def setTransparent(self, tr): + def setTransparent(self, tr=True): self._transparent = tr + self.clean() def enableDoubleBuffer(self): self._doubleBuffer = True @@ -254,8 +255,8 @@ fxb = min(w,fxb) fyb = min(h,fyb) - fillCh = [char]*fw - fillColor = [color]*fw + fillCh = [char]*(fxb-fxa) + fillColor = [color]*(fxb-fxa) for iy in range(fya,fyb): self._data[iy][fxa:fxb] = fillCh self._colors[iy][fxa:fxb] = fillColor @@ -297,7 +298,7 @@ color = colors[i] align = alignments[i] if w > 0: - self.drawTTkString(pos=(x,y), text=txt, width=w, color=color, alignment=align) + self.drawText(pos=(x,y), text=txt, width=w, color=color, alignment=align) x += w + 1 def drawChar(self, pos, char, color=TTkColor.RST): @@ -334,6 +335,8 @@ self._data[y][x+i] = txt[i] if colors[i] == TTkColor.RST != color: self._colors[y][x+i] = color.mod(x+i,y) + elif (not colors[i].background()) and color.background(): + self._colors[y][x+i] = (color + colors[i]).mod(x+i,y) else: self._colors[y][x+i] = colors[i].mod(x+i,y) # Check the full wide chars on the edge of the two canvasses @@ -697,22 +700,6 @@ mb = TTkCfg.theme.menuBar self.drawText(pos=pos, text=f"{mb[3]}{mb[1]*(size-2)}{mb[4]}", color=color) - def drawMenuBarButton(self, width, text, pos=(0,0), border=True, submenu=False, shortcuts=[], color=TTkColor.RST, borderColor=TTkColor.RST, shortcutColor=TTkColor.UNDERLINE ): - mb = TTkCfg.theme.menuBar - x,y = pos - if border: - self.drawText(pos=(x,y), color=borderColor ,text=mb[2]) - self.drawText(pos=(x+1+len(text),y), color=borderColor ,text=mb[0]) - self.drawText(pos=(x+1,y), color=color ,text=text) - off = 1 - else: - self.drawText(pos=(x,y), width=width, color=color ,text=text) - if submenu: - self._set(y,x+width-1, mb[5], color) - off = 0 - for i in shortcuts: - self._set(y,x+i+off, text.charAt(i), shortcutColor) - def execPaint(self, winw, winh): pass @@ -794,9 +781,10 @@ def toAnsi(self): # TTkLog.debug("pushToTerminal") ret = "" + rstColor = str(TTkColor.RST) lastcolor = TTkColor.RST for y in range(0, self._height): - ansi = str(TTkColor.RST) + ansi = str(lastcolor) for x in range(0, self._width): ch = self._data[y][x] color = self._colors[y][x] @@ -804,14 +792,17 @@ ansi += str(color-lastcolor) lastcolor = color ansi+=ch - ret += ansi + '\n' + if lastcolor != TTkColor.RST: + ret += ansi + rstColor + '\n' + else: + ret += ansi + '\n' return ret def pushToTerminal(self, x, y, w, h): # TTkLog.debug("pushToTerminal") lastcolor = TTkColor.RST for y in range(0, self._height): - ansi = TTkColor.RST+TTkTerm.Cursor.moveTo(y+1,1) + ansi = lastcolor+TTkTerm.Cursor.moveTo(y+1,1) for x in range(0, self._width): ch = self._data[y][x] color = self._colors[y][x] diff --git a/_modules/TermTk/TTkCore/color.html b/_modules/TermTk/TTkCore/color.html index 0b920044..ce6d4844 100644 --- a/_modules/TermTk/TTkCore/color.html +++ b/_modules/TermTk/TTkCore/color.html @@ -3,7 +3,7 @@ - TermTk.TTkCore.color — pyTermTk 0.39.0-a + <title>TermTk.TTkCore.color — pyTermTk 0.40.0-a documentation @@ -127,7 +127,8 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -__all__ = ['TTkColor', 'TTkColorGradient', 'TTkLinearGradient'] +__all__ = ['TTkColor', + 'TTkColorGradient', 'TTkLinearGradient', 'TTkAlternateColor'] from TermTk.TTkCore.constant import TTkK from TermTk.TTkCore.helper import TTkHelper @@ -220,7 +221,7 @@ cmax = max(r,g,b) cmin = min(r,g,b) - lum = (cmax-cmin)/2 + lum = (cmax+cmin)/2 if cmax == cmin: return 0,0,lum @@ -353,7 +354,7 @@ return ret def mod(self, x , y): - if self._colorMod is None: return self + if not self._colorMod: return self return self._colorMod.exec(x,y,self) def copy(self, modifier=True): @@ -376,7 +377,7 @@ __slots__ = ('_fgincrement', '_bgincrement', '_val', '_step', '_buffer', '_orientation') _increment: int; _val: int def __init__(self, *args, **kwargs): - _TTkColorModifier.__init__(self, *args, **kwargs) + super().__init__(*args, **kwargs) if "increment" in kwargs: self._fgincrement = kwargs.get("increment") self._bgincrement = kwargs.get("increment") @@ -430,7 +431,7 @@ default_target_color = _TTkColor(fg=(0,255,0), bg=(255,0,0)) def __init__(self, *args, **kwargs): - _TTkColorModifier.__init__(self, *args, **kwargs) + super().__init__(*args, **kwargs) self._base_pos = (0, 0) self._direction = (30, 30) self._target_color = self.default_target_color @@ -495,10 +496,67 @@ color_1 = color_fg_red + color_bg_blue color_2 = color_fg_red + TTkColor.bg('#FFFF00') color_3 = color_2 + TTkColor.UNDERLINE + TTkColor.BOLD + + # Use presets + color_4 = TTkColor.RED + color_5 = TTkColor.BG_YELLOW + color_4 + color_6 = color_5 + TTkColor.UNDERLINE + TTkColor.BOLD + ''' RST = _TTkColor() '''Reset to the default terminal color and modifiers''' + BLACK = _TTkColor(fg=( 0, 0, 0)) + '''(fg) #000000 - Black''' + WHITE = _TTkColor(fg=(255,255,255)) + '''(fg) #FFFFFF - White''' + RED = _TTkColor(fg=(255, 0, 0)) + '''(fg) #FF0000 - Red''' + GREEN = _TTkColor(fg=( 0,255, 0)) + '''(fg) #00FF00 - Green''' + BLUE = _TTkColor(fg=( 0, 0,255)) + '''(fg) #0000FF - Blue''' + CYAN = _TTkColor(fg=( 0,255,255)) + '''(fg) #00FFFF - Cyan''' + MAGENTA = _TTkColor(fg=(255, 0,255)) + '''(fg) #FF00FF - Magenta''' + YELLOW = _TTkColor(fg=(255,255, 0)) + '''(fg) #FFFF00 - Yellow''' + + FG_BLACK = BLACK + '''(fg) #000000 - Black''' + FG_WHITE = WHITE + '''(fg) #FFFFFF - White''' + FG_RED = RED + '''(fg) #FF0000 - Red''' + FG_GREEN = GREEN + '''(fg) #00FF00 - Green''' + FG_BLUE = BLUE + '''(fg) #0000FF - Blue''' + FG_CYAN = CYAN + '''(fg) #00FFFF - Cyan''' + FG_MAGENTA = MAGENTA + '''(fg) #FF00FF - Magenta''' + FG_YELLOW = YELLOW + '''(fg) #FFFF00 - Yellow''' + + BG_BLACK = BLACK.invertFgBg() + '''(bg) #000000 - Black''' + BG_WHITE = WHITE.invertFgBg() + '''(bg) #FFFFFF - White''' + BG_RED = RED.invertFgBg() + '''(bg) #FF0000 - Red''' + BG_GREEN = GREEN.invertFgBg() + '''(bg) #00FF00 - Green''' + BG_BLUE = BLUE.invertFgBg() + '''(bg) #0000FF - Blue''' + BG_CYAN = CYAN.invertFgBg() + '''(bg) #00FFFF - Cyan''' + BG_MAGENTA = MAGENTA.invertFgBg() + '''(bg) #FF00FF - Magenta''' + BG_YELLOW = YELLOW.invertFgBg() + '''(bg) #FFFF00 - Yellow''' + # Modifiers: BOLD = _TTkColor(mod=TTkHelper.Color.BOLD) '''**Bold** modifier''' @@ -540,6 +598,8 @@ :type color: str :param str modifier: (experimental) the color modifier to be used to improve the **kinkiness** :type modifier: TTkColorModifier, optional + + :return: :class:`TTkColor` ''' mod = kwargs.get('modifier', None ) link = kwargs.get('link', '' ) @@ -565,6 +625,8 @@ :type color: str :param str modifier: (experimental) the color modifier to be used to improve the **kinkiness** :type modifier: TTkColorModifier, optional + + :return: :class:`TTkColor` ''' mod = kwargs.get('modifier', None ) link = kwargs.get('link', '' ) @@ -572,7 +634,43 @@ color = args[0] else: color = kwargs.get('color', "" ) - return TTkColor(bg=TTkColor.hexToRGB(color), colorMod=mod, link=link) + return TTkColor(bg=TTkColor.hexToRGB(color), colorMod=mod, link=link) + +
[docs] @staticmethod + def fgbg(fg:str='', bg:str='', link:str='', modifier:_TTkColorModifier=None): + ''' Helper to generate a Background color + + Example: + + .. code:: python + + color_1 = TTkColor.fgbg('#FF0000','#0000FF') + color_2 = TTkColor.fgbg(fg='#00FF00',bg='#0000FF') + color_3 = TTkColor.fgbg('#0000FF','#0000FF', modifier=TTkColorGradient(increment=6)) + + :param str fg: the foreground color representation in (str)HEX + :type fg: str + :param str bg: the background color representation in (str)HEX + :type bg: str + :param str modifier: (experimental) the color modifier to be used to improve the **kinkiness** + :type modifier: TTkColorModifier, optional + + :return: :class:`TTkColor` + ''' + return TTkColor(fg=TTkColor.hexToRGB(fg), bg=TTkColor.hexToRGB(bg), colorMod=modifier, link=link)
+ +class TTkAlternateColor(_TTkColorModifier): + __slots__ = ('_alternateColor') + def __init__(self, alternateColor:TTkColor=TTkColor.RST, **kwargs): + super().__init__(**kwargs) + self.setParam(alternateColor) + + def setParam(self, alternateColor:TTkColor): + self._alternateColor = alternateColor + + def exec(self, x:int, y:int, base_color:TTkColor) -> TTkColor: + if y%2: return self._alternateColor + else: return base_color.copy(modifier=False) diff --git a/_modules/TermTk/TTkCore/constant.html b/_modules/TermTk/TTkCore/constant.html index fc84bf00..e25e1c6c 100644 --- a/_modules/TermTk/TTkCore/constant.html +++ b/_modules/TermTk/TTkCore/constant.html @@ -3,7 +3,7 @@ - TermTk.TTkCore.constant — pyTermTk 0.39.0-a + <title>TermTk.TTkCore.constant — pyTermTk 0.40.0-a documentation @@ -185,7 +185,12 @@ TIME_EVENT = 0x10
[docs] class Direction(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.Unchecked PartiallyChecked = CheckState.PartiallyChecked @@ -221,6 +229,11 @@
[docs] class InsertPolicy(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] class DragDropMode(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] class SortOrder(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.AscendingOrder DescendingOrder = 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] class WrapMode(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] class LineWrapMode(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'''
NoWrap = LineWrapMode.NoWrap WidgetWidth = LineWrapMode.WidgetWidth @@ -339,6 +392,15 @@ '''Input Mouse Event Events reported by :class:`~TermTk.TTkCore.TTkTerm.inputmouse.TTkMouseEvent` -> :class:`~TermTk.TTkCore.TTkTerm.inputmouse.TTkMouseEvent.evt` + + .. autosummary:: + NoEvent + Press + Release + Drag + Move + WHEEL_Up + WHEEL_Down ''' NoEvent = 0x00000000 Press = 0x00010000 @@ -398,7 +460,13 @@ JUSTIFY = Alignment.JUSTIFY
[docs] class FileMode(int): - '''FileMode''' + '''FileMode + + .. autosummary:: + AnyFile + ExistingFile + Directory + ''' AnyFile = 0 '''The name of a file, whether it exists or not.''' ExistingFile = 1 @@ -413,15 +481,88 @@ # ExistingFiles = FileMode.ExistingFiles
[docs] class AcceptMode(int): - '''AcceptMode''' + '''AcceptMode + + .. autosummary:: + AcceptOpen + AcceptSave + ''' AcceptOpen = 0 '''Open''' AcceptSave = 1 '''Save'''
+
[docs] class TTkItemSelectionModel(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] class ItemFlag(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] class LayoutItemTypes(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] class WindowFlag(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] class ShortcutContext(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 = 0x01001282 Key_Dead_E = 0x01001283 Key_Dead_i = 0x01001284 - Key_Dead_I = 0x01001285 + Key_Dead_I = 0x01001285dd3e612f3ca6f9971b2aa0f5e622e21244da98ff Key_Dead_o = 0x01001286 Key_Dead_O = 0x01001287 Key_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 + <title>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 + <title>TermTk.TTkCore.helper — pyTermTk 0.40.0-a documentation @@ -275,12 +275,12 @@ wx += x wy += y + wi = widget.widgetItem() + wi.setLayer(wi.LAYER1) if toolWindow: # Forcing the layer to: # TTkLayoutItem.LAYER1 = 0x40000000 widget.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+1 else: # Draw above the Mouse y = 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 + + + + + + + + + + + + + + + + + + +
+ + +
+ +
+
+
+
    +
  • »
  • +
  • Module code »
  • +
  • TermTk.TTkCore.shortcut
  • +
  • +
  • +
+
+
+
+
+ +

Source code for TermTk.TTkCore.shortcut

+# 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']
+
+from TermTk.TTkCore.log import TTkLog
+from TermTk.TTkCore.constant import TTkK
+from TermTk.TTkCore.helper import TTkHelper
+from TermTk.TTkCore.signal import pyTTkSlot, pyTTkSignal
+from TermTk.TTkCore.TTkTerm.inputkey import TTkKeyEvent
+
+class TTkStandardKey():
+    pass
+
+class TTkKeySequence():
+    __slots__ = ('_key')
+    def __init__(self, key:int):
+        self._key = key
+        mod = (
+            ( TTkK.ControlModifier if key & TTkK.CTRL  else 0 ) |
+            ( TTkK.AltModifier     if key & TTkK.ALT   else 0 ) |
+            ( TTkK.ShiftModifier   if key & TTkK.SHIFT else 0 ) )
+        key &= ~(TTkK.CTRL|TTkK.ALT|TTkK.SHIFT|TTkK.META)
+        t = TTkK.SpecialKey if mod else TTkK.Character
+        self._key = TTkKeyEvent(type=t, key=key, mod=mod, code="")
+        if mod:
+            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:
+        return self._key.__hash__()
+
+    def __eq__(self, __value: object) -> bool:
+        pass
+
+
[docs]class TTkShortcut(): + '''TTkShortcut''' + _shortcuts = {} + __slots__ = ( + '_key', '_parent', '_shortcutContext', + # Signals + 'activated') + def __init__(self, + key:int, parent=None, + shortcutContext: TTkK.ShortcutContext = TTkK.ShortcutContext.WindowShortcut): + if type(key) == int: + key = TTkKeySequence(key)._key + self._key = key + self._parent = parent + self._shortcutContext = shortcutContext + # Signals + self.activated = pyTTkSignal() + if key not in TTkShortcut._shortcuts: + TTkShortcut._shortcuts[key] = [] + TTkShortcut._shortcuts[key].append(self) + + @staticmethod + def processKey(key, focusWidget): + # TTkLog.debug(f"{str(key)=}") + # for k in TTkShortcut._shortcuts: + # TTkLog.debug(f"{str(k)=} - {key==k=}") + if key in TTkShortcut._shortcuts: + for sc in TTkShortcut._shortcuts[key]: + # if sc._parent: + # TTkLog.debug(f"{focusWidget=} {sc._parent=} {sc._parent._parent=}") + # else: + # TTkLog.debug(f"{focusWidget=} {sc._parent=}") + if ( ( sc._shortcutContext == TTkK.WidgetShortcut + and focusWidget == sc._parent ) + or ( sc._shortcutContext == TTkK.WidgetWithChildrenShortcut + and ( focusWidget == sc._parent + or TTkHelper.isParent(sc._parent,focusWidget) ) ) + or ( sc._shortcutContext == TTkK.WindowShortcut ) + or ( sc._shortcutContext == TTkK.ApplicationShortcut )): + if sc.activated._connected_slots: + sc.activated.emit() + return True + return False
+
+ +
+
+
+ +
+ +
+

© Copyright 2021, Eugenio Parodi.

+
+ + Built with Sphinx using a + theme + provided by Read the Docs. + + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/_modules/TermTk/TTkCore/signal.html b/_modules/TermTk/TTkCore/signal.html index 0f207820..a1653c24 100644 --- a/_modules/TermTk/TTkCore/signal.html +++ b/_modules/TermTk/TTkCore/signal.html @@ -3,7 +3,7 @@ - TermTk.TTkCore.signal — pyTermTk 0.39.0-a + <title>TermTk.TTkCore.signal — pyTermTk 0.40.0-a documentation @@ -230,7 +230,7 @@ raise TypeError(error) else: for a,b in zip(slot._TTkslot_attr, self._types): - if not issubclass(a,b): + if a!=b and not issubclass(a,b): error = "Decorated slot has no signature compatible: "+slot.__name__+str(slot._TTkslot_attr)+" != signal"+str(self._types) raise TypeError(error) if slot not in self._connected_slots: diff --git a/_modules/TermTk/TTkCore/string.html b/_modules/TermTk/TTkCore/string.html index c61d1353..2e88ddef 100644 --- a/_modules/TermTk/TTkCore/string.html +++ b/_modules/TermTk/TTkCore/string.html @@ -3,7 +3,7 @@ - TermTk.TTkCore.string — pyTermTk 0.39.0-a + <title>TermTk.TTkCore.string — pyTermTk 0.40.0-a documentation @@ -131,6 +131,7 @@ import re import unicodedata +from types import GeneratorType from TermTk.TTkCore.cfg import TTkCfg from TermTk.TTkCore.constant import TTkK @@ -169,7 +170,7 @@ __slots__ = ('_text','_colors','_baseColor','_hasTab','_hasSpecialWidth') - def __init__(self, text="", color=None): + def __init__(self, text:str="", color:TTkColor=None) -> None: if issubclass(type(text), TTkString): self._text = text._text self._colors = text._colors if color is None else [color]*len(self._text) @@ -395,7 +396,11 @@ return i return len(self._text) -
[docs] def toAscii(self): +
[docs] def isPlainText(self) -> bool: + ''' Return True if the string does not include colors or modifications ''' + return all(TTkColor.RST == c for c in self._colors)
+ +
[docs] def toAscii(self) -> str: ''' Return the ascii representation of the string ''' return self._text
@@ -608,7 +613,7 @@ ret._colors += self._colors start=0 lenMatch = len(match) - while pos := self._text.index(match, start) if match in self._text[start:] else None: + while None != (pos := self._text.index(match, start) if match in self._text[start:] else None): start = pos+lenMatch ret._colors[pos: pos+lenMatch] = [color]*lenMatch elif posFrom == posTo == None: @@ -698,6 +703,8 @@ ''' if not strings: return TTkString() + if isinstance(strings, GeneratorType): + strings = [s for s in strings] ret = TTkString(strings[0]) for s in strings[1:]: ret += self + s @@ -731,7 +738,7 @@ def nextPos(self, pos): pos += 1 for i,ch in enumerate(self._text[pos:]): - if not unicodedata.category(ch) in ('Me','Mn'): + if unicodedata.category(ch) not in ('Me','Mn'): return pos+i return len(self._text) @@ -741,7 +748,7 @@ # TTkLog.debug(f"{str(reversed(self._text[:pos]))} {pos=}") for i,ch in enumerate(reversed(self._text[:pos])): # TTkLog.debug(f"{i}---> {ch} ") - if not unicodedata.category(ch) in ('Me','Mn'): + if unicodedata.category(ch) not in ('Me','Mn'): return pos-i-1 return 0 diff --git a/_modules/TermTk/TTkCore/timer_unix.html b/_modules/TermTk/TTkCore/timer_unix.html index e51f7c4b..8b0030f4 100644 --- a/_modules/TermTk/TTkCore/timer_unix.html +++ b/_modules/TermTk/TTkCore/timer_unix.html @@ -3,7 +3,7 @@ - TermTk.TTkCore.timer_unix — pyTermTk 0.39.0-a + <title>TermTk.TTkCore.timer_unix — pyTermTk 0.40.0-a documentation diff --git a/_modules/TermTk/TTkCore/ttk.html b/_modules/TermTk/TTkCore/ttk.html index 195bbf7b..206aafe7 100644 --- a/_modules/TermTk/TTkCore/ttk.html +++ b/_modules/TermTk/TTkCore/ttk.html @@ -3,7 +3,7 @@ - TermTk.TTkCore.ttk — pyTermTk 0.39.0-a + <title>TermTk.TTkCore.ttk — pyTermTk 0.40.0-a documentation diff --git a/_modules/TermTk/TTkCrossTools/savetools.html b/_modules/TermTk/TTkCrossTools/savetools.html new file mode 100644 index 00000000..60c0cbab --- /dev/null +++ b/_modules/TermTk/TTkCrossTools/savetools.html @@ -0,0 +1,330 @@ + + + + + + TermTk.TTkCrossTools.savetools — pyTermTk 0.40.0-a + documentation + + + + + + + + + + + + + + + + + + +
+ + +
+ +
+
+
+
    +
  • »
  • +
  • Module code »
  • +
  • TermTk.TTkCrossTools.savetools
  • +
  • +
  • +
+
+
+
+
+ +

Source code for TermTk.TTkCrossTools.savetools

+# 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']
+
+import os
+import importlib.util
+import json
+from dataclasses import dataclass
+
+from TermTk import pyTTkSlot, pyTTkSignal
+from TermTk import TTkLog
+from TermTk import TTkMessageBox, TTkFileDialogPicker, TTkHelper, TTkString, TTkK, TTkColor
+
+class ImageData:
+    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
+
+
[docs]class TTkEncoding(str): + TEXT = "text" + TEXT_PLAIN = "text/plain" + TEXT_PLAIN_UTF8 = "text/plain;charset=utf-8" + APPLICATION = 'application' + APPLICATION_JSON = 'application/json' + IMAGE = 'image' + IMAGE_PNG = 'image/png' + IMAGE_SVG = 'image/svg+xml' + IMAGE_JPG = 'image/jpeg'
+ +if importlib.util.find_spec('pyodideProxy'): + TTkLog.info("Using 'pyodideProxy' as clipboard manager") + import pyodideProxy + ttkDragOpen = {} + ttkFileOpen = pyTTkSignal(dict) + + def _open(path, encoding, filter, cb=None): + if not cb: return + ttkFileOpen.connect(cb) + pyodideProxy.openFile(encoding) + + def _save(filePath, content, encoding, filter=None, cb=lambda _d:None): + pyodideProxy.saveFile(os.path.basename(filePath), content, encoding) + + def _connectDragOpen(encoding, cb): + if encoding not in ttkDragOpen: + ttkDragOpen[encoding] = pyTTkSignal(dict) + return ttkDragOpen[encoding].connect(cb) + + def _emitDragOpen(encoding, data): + if encoding.startswith(TTkEncoding.IMAGE): + from PIL import Image + import io + im = Image.open(io.BytesIO(data['data'])) + data['data'] = im + for do in [ttkDragOpen[e] for e in ttkDragOpen if encoding.startswith(e)]: + do.emit(data) + + def _emitFileOpen(encoding, data): + if encoding.startswith(TTkEncoding.IMAGE): + from PIL import Image + import io + # TTkLog.debug(data['data']) + # TTkLog.debug(type(data['data'])) + # Image.open(data['data']) + im = Image.open(io.BytesIO(data['data'])) + # TTkLog.debug(f"{im.size}") + data['data'] = im + ttkFileOpen.emit(data) + ttkFileOpen.clear() + + ttkCrossOpen = _open + ttkCrossSave = _save + ttkCrossSaveAs = _save + ttkEmitDragOpen = _emitDragOpen + ttkEmitFileOpen = _emitFileOpen + ttkConnectDragOpen = _connectDragOpen + +else: + def _crossDecoder_text(fileName) : + with open(fileName) as fp: + return fp.read() + def _crossDecoder_json(fileName) : + with open(fileName) as fp: + # return json.load(fp) + return fp.read() + def _crossDecoder_image(fileName): + from PIL import Image + pilImage = Image.open(fileName) + # pilImage = pilImage.convert('RGBA') + # pilData = list(pilImage.getdata()) + # data = ImageData() + # w,h = data.size = pilImage.size + # data.data = [pilData[i:i+w] for i in range(0, len(pilData), w)] + return pilImage + + _crossDecoder = { + TTkEncoding.TEXT : _crossDecoder_text , + TTkEncoding.TEXT_PLAIN : _crossDecoder_text , + TTkEncoding.TEXT_PLAIN_UTF8 : _crossDecoder_text , + TTkEncoding.APPLICATION : _crossDecoder_json , + TTkEncoding.APPLICATION_JSON : _crossDecoder_json , + TTkEncoding.IMAGE : _crossDecoder_image , + TTkEncoding.IMAGE_PNG : _crossDecoder_image , + TTkEncoding.IMAGE_SVG : _crossDecoder_image , + TTkEncoding.IMAGE_JPG : _crossDecoder_image , + } + + def _open(path, encoding:TTkEncoding, filter:str, cb=None): + if not cb: return + if encoding.startswith(TTkEncoding.IMAGE): + if not importlib.util.find_spec('PIL'): return + def __openFile(fileName): + _decoder = _crossDecoder.get(encoding,lambda _:None) + content = _decoder(fileName) + cb({'name':fileName, 'data':content}) + filePicker = TTkFileDialogPicker(pos = (3,3), size=(100,30), caption="Open", path=path, fileMode=TTkK.FileMode.ExistingFile ,filter=filter) + filePicker.pathPicked.connect(__openFile) + TTkHelper.overlay(None, filePicker, 5, 5, True) + + def _save(filePath, content, encoding): + TTkLog.info(f"Saving to: {filePath}") + with open(filePath,'w') as fp: + fp.write(content) + + def _saveAs(filePath, content, encoding, filter, cb=lambda _d:None): + def _approveFile(fileName): + if os.path.exists(fileName): + @pyTTkSlot(TTkMessageBox.StandardButton) + def _cb(btn): + if btn == TTkMessageBox.StandardButton.Save: + ttkCrossSave(fileName,content,encoding) + elif btn == TTkMessageBox.StandardButton.Cancel: + return + if cb: + cb({'name':fileName}) + messageBox = TTkMessageBox( + text= ( + TTkString( f'A file named "{os.path.basename(fileName)}" already exists.\nDo you want to replace it?', TTkColor.BOLD) + + TTkString( f'\n\nReplacing it will overwrite its contents.') ), + icon=TTkMessageBox.Icon.Warning, + standardButtons=TTkMessageBox.StandardButton.Discard|TTkMessageBox.StandardButton.Save|TTkMessageBox.StandardButton.Cancel) + messageBox.buttonSelected.connect(_cb) + TTkHelper.overlay(None, messageBox, 5, 5, True) + else: + ttkCrossSave(fileName,content,encoding) + if cb: + cb({'name':fileName}) + filePicker = TTkFileDialogPicker( + size=(100,30), path=filePath, + acceptMode=TTkK.AcceptMode.AcceptSave, + caption="Save As...", + fileMode=TTkK.FileMode.AnyFile , + filter=filter) + filePicker.pathPicked.connect(_approveFile) + TTkHelper.overlay(None, filePicker, 5, 5, True) + + ttkCrossOpen = _open + ttkCrossSave = _save + ttkCrossSaveAs = _saveAs + ttkEmitDragOpen = lambda a:None + ttkEmitFileOpen = lambda a:None + ttkConnectDragOpen = lambda a,b:None +
+ +
+
+
+ +
+ +
+

© Copyright 2021, Eugenio Parodi.

+
+ + Built with Sphinx using a + theme + provided by Read the Docs. + + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/_modules/TermTk/TTkGui/clipboard.html b/_modules/TermTk/TTkGui/clipboard.html index d7aeb6dc..10ee76e7 100644 --- a/_modules/TermTk/TTkGui/clipboard.html +++ b/_modules/TermTk/TTkGui/clipboard.html @@ -3,7 +3,7 @@ - TermTk.TTkGui.clipboard — pyTermTk 0.39.0-a + <title>TermTk.TTkGui.clipboard — pyTermTk 0.40.0-a documentation @@ -166,7 +166,24 @@ @staticmethod def _loadClipboardManager(): try: - if importlib.util.find_spec('copykitten'): + if importlib.util.find_spec('pyodideProxy'): + TTkLog.info("Using 'pyodideProxy' as clipboard manager") + import pyodideProxy + import asyncio + async def _async_co(): + text = await pyodideProxy.paste() + TTkLog.debug(f"ttkProxy paste_co: {text}") + return text + def _paste(): + loop = asyncio.get_event_loop() + text = loop.run_until_complete(_async_co()) + # text = loop.run_until_complete(pyodideProxy.paste()) + TTkLog.debug(f"ttkProxy paste: {text=} {_async_co()=}") + return text + TTkClipboard._manager = pyodideProxy + TTkClipboard._setText = pyodideProxy.copy + TTkClipboard._text = pyodideProxy.paste # _paste + elif importlib.util.find_spec('copykitten'): TTkLog.info("Using 'copykitten' as clipboard manager") import copykitten as _c TTkClipboard._manager = _c @@ -214,17 +231,22 @@ except Exception as e: TTkLog.error("Clipboard error, try to export X11 if you are running this UI via SSH") for line in str(e).split("\n"): - TTkLog.error(line)
+ TTkLog.error(str(line))
[docs] @staticmethod def text(): '''text''' if TTkClipboard._text: - txt = TTkClipboard._text() - if txt == str(TTkClipboard._clipboard): + txt = None + try: + txt = TTkClipboard._text() + except Exception as e: + TTkLog.error("Clipboard error, try to export X11 if you are running this UI via SSH") + for line in str(e).split("\n"): + TTkLog.error(line) + if txt == None or txt == str(TTkClipboard._clipboard): return TTkClipboard._clipboard - else: - return TTkClipboard._text() + return txt return TTkClipboard._clipboard
diff --git a/_modules/TermTk/TTkGui/textdocument.html b/_modules/TermTk/TTkGui/textdocument.html index 30bc2f84..40bd0044 100644 --- a/_modules/TermTk/TTkGui/textdocument.html +++ b/_modules/TermTk/TTkGui/textdocument.html @@ -3,7 +3,7 @@ - TermTk.TTkGui.textdocument — pyTermTk 0.39.0-a + <title>TermTk.TTkGui.textdocument — pyTermTk 0.40.0-a documentation @@ -317,6 +317,8 @@ def setText(self, text): remLines = len(self._dataLines) + if not isinstance(text, str) and not isinstance(text,TTkString): + text=str(text) self._dataLines = [TTkString(t) for t in text.split('\n')] self._modified = False self._lastSnap = self._dataLines.copy() diff --git a/_modules/TermTk/TTkLayouts/boxlayout.html b/_modules/TermTk/TTkLayouts/boxlayout.html index 7033e4e3..d4e361a2 100644 --- a/_modules/TermTk/TTkLayouts/boxlayout.html +++ b/_modules/TermTk/TTkLayouts/boxlayout.html @@ -3,7 +3,7 @@ - TermTk.TTkLayouts.boxlayout — pyTermTk 0.39.0-a + <title>TermTk.TTkLayouts.boxlayout — pyTermTk 0.40.0-a documentation diff --git a/_modules/TermTk/TTkLayouts/gridlayout.html b/_modules/TermTk/TTkLayouts/gridlayout.html index 3e33ba51..607295fe 100644 --- a/_modules/TermTk/TTkLayouts/gridlayout.html +++ b/_modules/TermTk/TTkLayouts/gridlayout.html @@ -3,7 +3,7 @@ - TermTk.TTkLayouts.gridlayout — pyTermTk 0.39.0-a + <title>TermTk.TTkLayouts.gridlayout — pyTermTk 0.40.0-a documentation diff --git a/_modules/TermTk/TTkLayouts/layout.html b/_modules/TermTk/TTkLayouts/layout.html index 2f072d42..1cfc6260 100644 --- a/_modules/TermTk/TTkLayouts/layout.html +++ b/_modules/TermTk/TTkLayouts/layout.html @@ -3,7 +3,7 @@ - TermTk.TTkLayouts.layout — pyTermTk 0.39.0-a + <title>TermTk.TTkLayouts.layout — pyTermTk 0.40.0-a documentation @@ -152,7 +152,7 @@ LAYER1 = 0x40000000 LAYER2 = 0x80000000 LAYER3 = 0xC0000000 - LAYERMASK = ~0xC0000000 + LAYERMASK = ~(LAYER0 | LAYER1 | LAYER2 | LAYER3) __slots__ = ( '_x', '_y', '_z', '_w', '_h', @@ -366,6 +366,7 @@ item.widget().setParent(self.parentWidget()) if self.parentWidget() and self.parentWidget().isVisible(): self.parentWidget().update(repaint=True, updateLayout=True) + self.update()
[docs] def addWidget(self, widget): ''' Add a widget to this Layout diff --git a/_modules/TermTk/TTkTestWidgets/keypressview.html b/_modules/TermTk/TTkTestWidgets/keypressview.html index 53efceb2..8f56753c 100644 --- a/_modules/TermTk/TTkTestWidgets/keypressview.html +++ b/_modules/TermTk/TTkTestWidgets/keypressview.html @@ -3,7 +3,7 @@ - TermTk.TTkTestWidgets.keypressview — pyTermTk 0.39.0-a + <title>TermTk.TTkTestWidgets.keypressview — pyTermTk 0.40.0-a documentation diff --git a/_modules/TermTk/TTkTestWidgets/logviewer.html b/_modules/TermTk/TTkTestWidgets/logviewer.html index 129171a4..a3f73156 100644 --- a/_modules/TermTk/TTkTestWidgets/logviewer.html +++ b/_modules/TermTk/TTkTestWidgets/logviewer.html @@ -3,7 +3,7 @@ - TermTk.TTkTestWidgets.logviewer — pyTermTk 0.39.0-a + <title>TermTk.TTkTestWidgets.logviewer — pyTermTk 0.40.0-a documentation @@ -187,7 +187,8 @@ __slots__ = ('_logView') def __init__(self, *args, **kwargs): TTkAbstractScrollArea.__init__(self, *args, **kwargs) - if 'parent' in kwargs: kwargs.pop('parent') + kwargs.pop('parent',None) + kwargs.pop('visible',None) self._logView = _TTkLogViewer(*args, **kwargs) self.setFocusPolicy(TTkK.ClickFocus) self.setViewport(self._logView)
diff --git a/_modules/TermTk/TTkTestWidgets/testabstractscroll.html b/_modules/TermTk/TTkTestWidgets/testabstractscroll.html index 428277bb..d12a9984 100644 --- a/_modules/TermTk/TTkTestWidgets/testabstractscroll.html +++ b/_modules/TermTk/TTkTestWidgets/testabstractscroll.html @@ -3,7 +3,7 @@ - TermTk.TTkTestWidgets.testabstractscroll — pyTermTk 0.39.0-a + <title>TermTk.TTkTestWidgets.testabstractscroll — pyTermTk 0.40.0-a documentation diff --git a/_modules/TermTk/TTkTestWidgets/testwidget.html b/_modules/TermTk/TTkTestWidgets/testwidget.html index 1ba5cdd1..bf375946 100644 --- a/_modules/TermTk/TTkTestWidgets/testwidget.html +++ b/_modules/TermTk/TTkTestWidgets/testwidget.html @@ -3,7 +3,7 @@ - TermTk.TTkTestWidgets.testwidget — pyTermTk 0.39.0-a + <title>TermTk.TTkTestWidgets.testwidget — pyTermTk 0.40.0-a documentation diff --git a/_modules/TermTk/TTkTestWidgets/testwidgetsizes.html b/_modules/TermTk/TTkTestWidgets/testwidgetsizes.html index 58ab6c6d..708cb38c 100644 --- a/_modules/TermTk/TTkTestWidgets/testwidgetsizes.html +++ b/_modules/TermTk/TTkTestWidgets/testwidgetsizes.html @@ -3,7 +3,7 @@ - TermTk.TTkTestWidgets.testwidgetsizes — pyTermTk 0.39.0-a + <title>TermTk.TTkTestWidgets.testwidgetsizes — pyTermTk 0.40.0-a documentation diff --git a/_modules/TermTk/TTkTestWidgets/tominspector.html b/_modules/TermTk/TTkTestWidgets/tominspector.html index 7bd80796..5eff0ed3 100644 --- a/_modules/TermTk/TTkTestWidgets/tominspector.html +++ b/_modules/TermTk/TTkTestWidgets/tominspector.html @@ -3,7 +3,7 @@ - TermTk.TTkTestWidgets.tominspector — pyTermTk 0.39.0-a + <title>TermTk.TTkTestWidgets.tominspector — pyTermTk 0.40.0-a documentation diff --git a/_modules/TermTk/TTkTheme/draw_utf8.html b/_modules/TermTk/TTkTheme/draw_utf8.html index 0101a221..bf7ebf7a 100644 --- a/_modules/TermTk/TTkTheme/draw_utf8.html +++ b/_modules/TermTk/TTkTheme/draw_utf8.html @@ -3,7 +3,7 @@ - TermTk.TTkTheme.draw_utf8 — pyTermTk 0.39.0-a + <title>TermTk.TTkTheme.draw_utf8 — pyTermTk 0.40.0-a documentation diff --git a/_modules/TermTk/TTkTheme/theme.html b/_modules/TermTk/TTkTheme/theme.html index 631948aa..047b23e2 100644 --- a/_modules/TermTk/TTkTheme/theme.html +++ b/_modules/TermTk/TTkTheme/theme.html @@ -3,7 +3,7 @@ - TermTk.TTkTheme.theme — pyTermTk 0.39.0-a + <title>TermTk.TTkTheme.theme — pyTermTk 0.40.0-a documentation diff --git a/_modules/TermTk/TTkUiTools/uiloader.html b/_modules/TermTk/TTkUiTools/uiloader.html index 66e46aca..71cfbc35 100644 --- a/_modules/TermTk/TTkUiTools/uiloader.html +++ b/_modules/TermTk/TTkUiTools/uiloader.html @@ -3,7 +3,7 @@ - TermTk.TTkUiTools.uiloader — pyTermTk 0.39.0-a + <title>TermTk.TTkUiTools.uiloader — pyTermTk 0.40.0-a documentation @@ -127,7 +127,7 @@ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. -__all__ = ['TTkUiLoader'] +__all__ = ['TTkUiLoader','TTkUiSignature'] import json @@ -138,10 +138,12 @@ from TermTk.TTkTestWidgets import * from TermTk.TTkUiTools.uiproperties import TTkUiProperties +TTkUiSignature = "TTkUi/Document" +
[docs]class TTkUiLoader(): '''TTkUiLoader - .. _ttkDesigner: https://github.com/ceccopierangiolieugenio/pyTermTk/tree/main/ttkDesigner + .. _ttkDesigner: https://github.com/ceccopierangiolieugenio/pyTermTk/tree/main/tools/ttkDesigner `ttkdesigner Tutorial <https://github.com/ceccopierangiolieugenio/pyTermTk/blob/main/tutorial/ttkDesigner/textEdit>`_ @@ -180,6 +182,20 @@ ''' return TTkUiLoader.loadDict(json.loads(text), baseWidget, kwargs)
+ def _convert_2_0_1_to_2_0_2(ui): + return { + "type": TTkUiSignature, + "version": "2.0.2", + "connections" : ui['connections'], + "tui": ui['tui'] } + + def _convert_2_0_0_to_2_0_2(ui): + return { + "type": TTkUiSignature, + "version": "2.0.2", + "connections" : ui['connections'], + "tui": ui['tui'] } + def _convert_1_0_1_to_2_0_0(ui): def _processWidget(_wid): if issubclass(globals()[_wid['class']],TTkContainer): @@ -205,8 +221,23 @@ ui = TTkUiLoader._convert_1_0_1_to_2_0_0(ui) return TTkUiLoader._loadDict_2_0_0(ui, *args, **kwargs) + def _loadDict_2_0_0(ui, *args, **kwargs): + ui = TTkUiLoader._convert_2_0_0_to_2_0_2(ui) + return TTkUiLoader._loadDict_2_0_2(ui, *args, **kwargs) + + def _loadDict_2_0_1(ui, *args, **kwargs): + ui = TTkUiLoader._convert_2_0_1_to_2_0_2(ui) + return TTkUiLoader._loadDict_2_0_2(ui, *args, **kwargs) + @staticmethod - def _loadDict_2_0_0(ui, baseWidget:TTkWidget=None, args=None): + def _loadDict_2_0_2(ui, baseWidget:TTkWidget=None, args=None): + if ( + ui['version'] != '2.0.2' or + 'type' not in ui or + ui['type'] != TTkUiSignature): + TTkLog.error("Ui Format not valid") + return None + def _setMenuButton(_menuButtonProp, _menuButton:TTkMenuButton): if 'submenu' in _menuButtonProp: for _sm in _menuButtonProp['submenu']: @@ -355,7 +386,7 @@ layout.addWidget(w) return layout - TTkLog.debug(ui) + # TTkLog.debug(ui) if issubclass(globals()[ui['tui']['class']],TTkLayout): widget = _getLayout(ui['tui'], baseWidget) @@ -365,7 +396,7 @@ def _getSignal(sender, name): for cc in reversed(type(sender).__mro__): if cc.__name__ in TTkUiProperties: - if not name in TTkUiProperties[cc.__name__]['signals']: + if name not in TTkUiProperties[cc.__name__]['signals']: continue signame = TTkUiProperties[cc.__name__]['signals'][name]['name'] return getattr(sender,signame) @@ -374,7 +405,7 @@ def _getSlot(receiver, name): for cc in reversed(type(receiver).__mro__): if cc.__name__ in TTkUiProperties: - if not name in TTkUiProperties[cc.__name__]['slots']: + if name not in TTkUiProperties[cc.__name__]['slots']: continue slotname = TTkUiProperties[cc.__name__]['slots'][name]['name'] return getattr(receiver,slotname) @@ -395,7 +426,9 @@ def normalise(ui): cb = {'1.0.0' : TTkUiLoader._convert_1_0_1_to_2_0_0, '1.0.1' : TTkUiLoader._convert_1_0_1_to_2_0_0, - '2.0.0' : lambda x: x + '2.0.0' : TTkUiLoader._convert_2_0_0_to_2_0_2, + '2.0.1' : TTkUiLoader._convert_2_0_1_to_2_0_2, + '2.0.2' : lambda x: x }.get(ui['version'], lambda x: x) return cb(ui) @@ -414,7 +447,9 @@ ''' cb = {'1.0.0' : TTkUiLoader._loadDict_1_0_0, '1.0.1' : TTkUiLoader._loadDict_1_0_0, - '2.0.0' : TTkUiLoader._loadDict_2_0_0 + '2.0.0' : TTkUiLoader._loadDict_2_0_0, + '2.0.1' : TTkUiLoader._loadDict_2_0_1, + '2.0.2' : TTkUiLoader._loadDict_2_0_2, }.get(ui['version'], None) if cb: return cb(ui, baseWidget, kwargs) diff --git a/_modules/TermTk/TTkWidgets/Fancy/progressbar.html b/_modules/TermTk/TTkWidgets/Fancy/progressbar.html index f784a8f4..245c6c0a 100644 --- a/_modules/TermTk/TTkWidgets/Fancy/progressbar.html +++ b/_modules/TermTk/TTkWidgets/Fancy/progressbar.html @@ -3,7 +3,7 @@ - TermTk.TTkWidgets.Fancy.progressbar — pyTermTk 0.39.0-a + <title>TermTk.TTkWidgets.Fancy.progressbar — pyTermTk 0.40.0-a documentation diff --git a/_modules/TermTk/TTkWidgets/Fancy/table.html b/_modules/TermTk/TTkWidgets/Fancy/table.html index b3c1f8a1..3e88076a 100644 --- a/_modules/TermTk/TTkWidgets/Fancy/table.html +++ b/_modules/TermTk/TTkWidgets/Fancy/table.html @@ -3,7 +3,7 @@ - TermTk.TTkWidgets.Fancy.table — pyTermTk 0.39.0-a + <title>TermTk.TTkWidgets.Fancy.table — pyTermTk 0.40.0-a documentation @@ -144,7 +144,8 @@ def __init__(self, *args, **kwargs): TTkAbstractScrollArea.__init__(self, *args, **kwargs) - if 'parent' in kwargs: kwargs.pop('parent') + kwargs.pop('parent',None) + kwargs.pop('visible',None) self._tableView = TTkFancyTableView(*args, **kwargs) # Forward the signal self.activated = self._tableView.activated diff --git a/_modules/TermTk/TTkWidgets/Fancy/tableview.html b/_modules/TermTk/TTkWidgets/Fancy/tableview.html index 95f30498..89c15428 100644 --- a/_modules/TermTk/TTkWidgets/Fancy/tableview.html +++ b/_modules/TermTk/TTkWidgets/Fancy/tableview.html @@ -3,7 +3,7 @@ - TermTk.TTkWidgets.Fancy.tableview — pyTermTk 0.39.0-a + <title>TermTk.TTkWidgets.Fancy.tableview — pyTermTk 0.40.0-a documentation @@ -483,7 +483,8 @@ def __init__(self, **kwargs): self._excludeEvent = False super().__init__(**(kwargs|{'layout':TTkGridLayout()})) - if 'parent' in kwargs: kwargs.pop('parent') + kwargs.pop('parent',None) + kwargs.pop('visible',None) self._showHeader = kwargs.get('showHeader', True) self._tableView = _TTkFancyTableView(**kwargs) self._header = _TTkFancyTableViewHeader(**kwargs) diff --git a/_modules/TermTk/TTkWidgets/Fancy/tree.html b/_modules/TermTk/TTkWidgets/Fancy/tree.html index 41cdc986..510b28cd 100644 --- a/_modules/TermTk/TTkWidgets/Fancy/tree.html +++ b/_modules/TermTk/TTkWidgets/Fancy/tree.html @@ -3,7 +3,7 @@ - TermTk.TTkWidgets.Fancy.tree — pyTermTk 0.39.0-a + <title>TermTk.TTkWidgets.Fancy.tree — pyTermTk 0.40.0-a documentation @@ -141,7 +141,8 @@ def __init__(self, *args, **kwargs): TTkAbstractScrollArea.__init__(self, *args, **kwargs) - if 'parent' in kwargs: kwargs.pop('parent') + kwargs.pop('parent',None) + kwargs.pop('visible',None) self._treeView = TTkFancyTreeWidget(*args, **kwargs) # Forward the signal self.activated = self._treeView.activated diff --git a/_modules/TermTk/TTkWidgets/Fancy/treeview.html b/_modules/TermTk/TTkWidgets/Fancy/treeview.html index 529dc8cd..8240aa44 100644 --- a/_modules/TermTk/TTkWidgets/Fancy/treeview.html +++ b/_modules/TermTk/TTkWidgets/Fancy/treeview.html @@ -3,7 +3,7 @@ - TermTk.TTkWidgets.Fancy.treeview — pyTermTk 0.39.0-a + <title>TermTk.TTkWidgets.Fancy.treeview — pyTermTk 0.40.0-a documentation diff --git a/_modules/TermTk/TTkWidgets/Fancy/treewidget.html b/_modules/TermTk/TTkWidgets/Fancy/treewidget.html index f0f8024c..6186b2b4 100644 --- a/_modules/TermTk/TTkWidgets/Fancy/treewidget.html +++ b/_modules/TermTk/TTkWidgets/Fancy/treewidget.html @@ -3,7 +3,7 @@ - TermTk.TTkWidgets.Fancy.treewidget — pyTermTk 0.39.0-a + <title>TermTk.TTkWidgets.Fancy.treewidget — pyTermTk 0.40.0-a documentation @@ -188,7 +188,8 @@ super().__init__(*args, **kwargs) self._topLevelItems = TTkFancyTreeWidgetItem(None) self.doubleClicked.connect(self._doubleClickItem) - # if 'parent' in kwargs: kwargs.pop('parent') + # kwargs.pop('parent',None) + # kwargs.pop('visible',None) def _expand(self, item, depth): item.setExpand(True) diff --git a/_modules/TermTk/TTkWidgets/TTkModelView/filetree.html b/_modules/TermTk/TTkWidgets/TTkModelView/filetree.html index 4b26d2c6..314e3acc 100644 --- a/_modules/TermTk/TTkWidgets/TTkModelView/filetree.html +++ b/_modules/TermTk/TTkWidgets/TTkModelView/filetree.html @@ -3,7 +3,7 @@ - TermTk.TTkWidgets.TTkModelView.filetree — pyTermTk 0.39.0-a + <title>TermTk.TTkWidgets.TTkModelView.filetree — pyTermTk 0.40.0-a documentation diff --git a/_modules/TermTk/TTkWidgets/TTkModelView/filetreewidget.html b/_modules/TermTk/TTkWidgets/TTkModelView/filetreewidget.html index 1f84aded..b7118920 100644 --- a/_modules/TermTk/TTkWidgets/TTkModelView/filetreewidget.html +++ b/_modules/TermTk/TTkWidgets/TTkModelView/filetreewidget.html @@ -3,7 +3,7 @@ - TermTk.TTkWidgets.TTkModelView.filetreewidget — pyTermTk 0.39.0-a + <title>TermTk.TTkWidgets.TTkModelView.filetreewidget — pyTermTk 0.40.0-a documentation @@ -158,12 +158,15 @@ self._filter = '*' self.setHeaderLabels(["Name", "Size", "Type", "Date Modified"]) self.openPath(self._path) + self.resizeColumnToContents(0) + self.resizeColumnToContents(1) + self.resizeColumnToContents(2) + self.resizeColumnToContents(3) self.itemExpanded.connect(self._folderExpanded) self.itemCollapsed.connect(self._folderCollapsed) self.itemExpanded.connect(self._updateChildren) self.itemActivated.connect(self._activated) - def setFilter(self, filter): self._filter = filter # TODO: Avoid to refer directly '_rootItem' diff --git a/_modules/TermTk/TTkWidgets/TTkModelView/table.html b/_modules/TermTk/TTkWidgets/TTkModelView/table.html new file mode 100644 index 00000000..e7ee88c4 --- /dev/null +++ b/_modules/TermTk/TTkWidgets/TTkModelView/table.html @@ -0,0 +1,497 @@ + + + + + + TermTk.TTkWidgets.TTkModelView.table — pyTermTk 0.40.0-a + documentation + + + + + + + + + + + + + + + + + + +
+ + +
+ +
+
+
+
    +
  • »
  • +
  • Module code »
  • +
  • TermTk.TTkWidgets.TTkModelView.table
  • +
  • +
  • +
+
+
+
+
+ +

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']
+
+from TermTk.TTkCore.constant import TTkK
+from TermTk.TTkWidgets.TTkModelView.tablewidget import TTkTableWidget
+from TermTk.TTkAbstract.abstractscrollarea import TTkAbstractScrollArea
+from TermTk.TTkAbstract.abstracttablemodel import TTkAbstractTableModel
+
+
[docs]class TTkTable(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 + + + def style(self): + if self._tableView: + return self._tableView.style() + return super().style() + + def setStyle(self, style): + if self._tableView: + self._tableView.setStyle(style) + return super().setStyle(style) + + def mergeStyle(self, style): + if self._tableView: + self._tableView.mergeStyle(style) + return super().mergeStyle(style)
+
+ +
+
+
+ +
+ +
+

© Copyright 2021, Eugenio Parodi.

+
+ + Built with Sphinx using a + theme + provided by Read the Docs. + + +
+
+
+
+
+ + + + \ 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 + + + + + + + + + + + + + + + + + + +
+ + +
+ +
+
+
+
    +
  • »
  • +
  • Module code »
  • +
  • TermTk.TTkWidgets.TTkModelView.tablemodelcsv
  • +
  • +
  • +
+
+
+
+
+ +

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']
+
+import csv
+
+from TermTk.TTkCore.constant import TTkK
+from TermTk.TTkWidgets.TTkModelView.tablemodellist import TTkTableModelList
+
+
[docs]class TTkTableModelCSV(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 = [[]], [], [] + if filename: + with open(filename, "r") as fd: + data, head, idx = self._csvImport(fd) + elif fd: + 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) + for row in csvreader: + data.append(row) + if has_header: + head = data.pop(0) + # check if the first column include an index: + if self._checkIndexColumn(data): + head.pop(0) + for l in data: + idx.append(l.pop(0)) + return data, head, idx + + def _checkIndexColumn(self, data:list[list]) -> bool: + if all(l[0].isdigit() for l in data): + num = int(data[0][0]) + return all(num+i==int(l[0]) for i,l in enumerate(data)) + return False
+
+ +
+
+
+ +
+ +
+

© Copyright 2021, Eugenio Parodi.

+
+ + Built with Sphinx using a + theme + provided by Read the Docs. + + +
+
+
+
+
+ + + + \ 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 + + + + + + + + + + + + + + + + + + +
+ + +
+ +
+
+
+
    +
  • »
  • +
  • Module code »
  • +
  • TermTk.TTkWidgets.TTkModelView.tablemodellist
  • +
  • +
  • +
+
+
+
+
+ +

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']
+
+from TermTk.TTkCore.constant import TTkK
+from TermTk.TTkAbstract.abstracttablemodel import TTkAbstractTableModel, 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__()
+
+    def row(self) -> int:
+        return self._rowCb(self._rowId)
+
+    def col(self) -> int:
+        return self._col
+
+    def data(self) -> object:
+        return self._rowId[self._col]
+
+    def setData(self, data: object) -> None:
+        self._rowId[self._col] = data
+
+
[docs]class TTkTableModelList(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 = data if data else [['']] + self._hheader = header + self._vheader = indexes + super().__init__() + + def modelList(self) -> list[list]: + return self._data + + def setModelList(self, modelList:list[list]) -> None: + if modelList == self._data: return + self._data = modelList + +
[docs] def rowCount(self) -> int: + return len(self._data)
+ +
[docs] def columnCount(self) -> int: + return len(self._data[0]) if self._data else 0
+ +
[docs] def index(self, row:int, col:int) -> TTkModelIndex: + return _TTkModelIndexList( + col = col , + rowId = self._data[row] , + rowCb = lambda rid: self._data.index(rid) )
+ +
[docs] def data(self, row:int, col:int) -> None: + return self._data[row][col]
+ +
[docs] def setData(self, row:int, col:int, data:object) -> None: + self._data[row][col] = data + self.dataChanged.emit((row,col),(1,1)) + return True
+ +
[docs] def headerData(self, num:int, orientation:int): + if orientation == TTkK.HORIZONTAL: + if self._hheader: + return self._hheader[num] + if orientation == TTkK.VERTICAL: + if self._vheader: + return self._vheader[num] + return super().headerData(num, orientation)
+ +
[docs] def flags(self, row:int, col:int) -> TTkK.ItemFlag: + return ( + TTkK.ItemFlag.ItemIsEnabled | + TTkK.ItemFlag.ItemIsEditable | + TTkK.ItemFlag.ItemIsSelectable )
+ +
[docs] def sort(self, column:int, order:TTkK.SortOrder) -> None: + if column == -1: + self._data = self._dataOriginal + else: + try: + self._data = sorted(self._dataOriginal, key=lambda x:x[column], reverse=order==TTkK.SortOrder.DescendingOrder) + except TypeError as _: + self._data = sorted(self._dataOriginal, key=lambda x:str(x[column]), reverse=order==TTkK.SortOrder.DescendingOrder)
+
+ +
+
+
+ +
+ +
+

© Copyright 2021, Eugenio Parodi.

+
+ + Built with Sphinx using a + theme + provided by Read the Docs. + + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/_modules/TermTk/TTkWidgets/TTkModelView/tablewidget.html b/_modules/TermTk/TTkWidgets/TTkModelView/tablewidget.html new file mode 100644 index 00000000..b3d06311 --- /dev/null +++ b/_modules/TermTk/TTkWidgets/TTkModelView/tablewidget.html @@ -0,0 +1,2041 @@ + + + + + + TermTk.TTkWidgets.TTkModelView.tablewidget — pyTermTk 0.40.0-a + documentation + + + + + + + + + + + + + + + + + + +
+ + +
+ +
+
+
+
    +
  • »
  • +
  • Module code »
  • +
  • TermTk.TTkWidgets.TTkModelView.tablewidget
  • +
  • +
  • +
+
+
+
+
+ +

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']
+
+from dataclasses import dataclass
+
+from TermTk.TTkCore.log import TTkLog
+from TermTk.TTkCore.constant import TTkK
+from TermTk.TTkCore.string import TTkString
+from TermTk.TTkCore.color import TTkColor
+from TermTk.TTkCore.signal import pyTTkSignal, pyTTkSlot
+
+from TermTk.TTkGui.clipboard import TTkClipboard
+from TermTk.TTkGui.textcursor import TTkTextCursor
+
+from TermTk.TTkWidgets.texedit  import TTkTextEdit
+from TermTk.TTkWidgets.spinbox  import TTkSpinBox
+from TermTk.TTkWidgets.TTkPickers.textpicker import TTkTextPicker
+from TermTk.TTkWidgets.TTkModelView.tablemodellist import TTkTableModelList, TTkModelIndex
+
+from TermTk.TTkAbstract.abstractscrollview import TTkAbstractScrollView
+from TermTk.TTkAbstract.abstracttablemodel import TTkAbstractTableModel
+
+
[docs]class TTkHeaderView(): + '''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] @pyTTkSlot(bool) + def setVisible(self, visible: bool) -> None: + '''setVisible''' + if self._visible == visible: return + self._visible = visible + self.visibilityUpdated.emit(visible)
+ +
[docs] @pyTTkSlot() + def show(self) -> None: + '''show''' + self.setVisible(True)
+ +
[docs] @pyTTkSlot() + def hide(self) -> None: + '''hide''' + self.setVisible(False)
+ + def isVisible(self) -> bool: + return self._visible
+ +class _ClipboardTable(TTkString): + __slots__=('_data') + def __init__(self,data) -> None: + self._data = data + super().__init__(self._toTTkString()) + + def data(self) -> list: + return self._data + + def _toTTkString(self) -> str: + def _lineHeight(_line): + return max(len(str(_item[2]).split('\n')) for _item in _line) + ret = [] + minx,maxx = min(_a:=[_item[1] for _line in self._data for _item in _line]),max(_a) + # miny,maxy = min(_a:=[x[0][0] for x in self._data]),max(_a) + cols = maxx-minx+1 + colSizes=[0]*cols + for line in self._data: + height = _lineHeight(line) + baseStr = TTkString() + retLines = [[baseStr]*cols for _ in range(height)] + for c,item in enumerate(line): + row,col,data = item + for r,txt in enumerate(TTkString(data).split('\n')): + colSizes[col-minx] = max(colSizes[col-minx],txt.termWidth()) + retLines[r][col-minx] = TTkString(txt) + ret += retLines + return TTkString('\n').join(TTkString(' ').join(s.align(width=colSizes[c]) for c,s in enumerate(l)) for l in ret) + +
[docs]class TTkTableWidget(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 = tableModel if tableModel else TTkTableModelList(list=[['']*10 for _ in range(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() + for i in self._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.newData if newData else i.oldData) + cpsi:TTkModelIndex = self._snapshot[snapId][0] + self._setCurrentCell(cpsi.row(),cpsi.col()) + self._moveCurrentCell(diff=(0,0)) + self.update() + +
[docs] @pyTTkSlot() + def undo(self) -> None: + ''' + Undoes the last operation if undo is available. + ''' + if self._snapshotId == 0: return + self._snapshotId-=1 + self._restoreSnapshot(self._snapshotId, newData=False)
+ +
[docs] @pyTTkSlot() + def redo(self) -> None: + ''' + Redoes the last operation if redo is available. + ''' + if self._snapshotId >= len(self._snapshot): return + self._restoreSnapshot(self._snapshotId, newData=True) + self._snapshotId+=1
+ +
[docs] def isUndoAvailable(self) -> bool: + ''' + isUndoAvailable + + :return: bool + ''' + return self._snapshotId > 0
+ +
[docs] def isRedoAvailable(self) -> bool: + ''' + isRedoAvailable + + :return: bool + ''' + return self._snapshotId < len(self._snapshot)
+ +
[docs] @pyTTkSlot() + def copy(self) -> None: + ''' + Copies any selected cells to the clipboard. + ''' + data = [] + for row,line in enumerate(self._selected): + dataLine = [] + for col,x in enumerate(line): + if x: + dataLine.append((row,col,self._tableModel.data(row,col))) + if dataLine: + data.append(dataLine) + clip = _ClipboardTable(data) + # str(clip) + self._clipboard.setText(clip)
+ + def _cleanSelectedContent(self): + selected = [(_r,_c) for _r,_l in enumerate(self._selected) for _c,_v in enumerate(_l) if _v] + mods = [] + for _row,_col in selected: + mods.append((_row,_col,'')) + self._tableModel_setData(mods) + self.update() + +
[docs] @pyTTkSlot() + def cut(self) -> None: + ''' + Copies the selected ccells to the clipboard and deletes them from the table. + ''' + self.copy() + self._cleanSelectedContent()
+ +
[docs] @pyTTkSlot() + def paste(self) -> None: + ''' + Pastes the text/cells from the clipboard into the table at the current cursor position. + ''' + data = self._clipboard.text() + self.pasteEvent(data)
+ + def pasteEvent(self, data:object): + row,col = self._currentPos if self._currentPos else (0,0) + if isinstance(data,_ClipboardTable): + rows = self._tableModel.rowCount() + cols = self._tableModel.columnCount() + dataList = [] + linearData = [_item for _line in data.data() for _item in _line] + minx,maxx = min(_a:=[_item[1] for _item in linearData]),max(_a) + miny,maxy = min(_a:=[_item[0] for _item in linearData]),max(_a) + for _dl in data.data(): + for item in _dl: + _r,_c,_d = item + _r+=row-miny + _c+=col-minx + if _r<rows and _c<cols: + dataList.append((_r,_c,_d)) + if dataList: + self._tableModel_setData(dataList) + elif isinstance(data,TTkString): + self._tableModel_setData([(row,col,data)]) + else: + self._tableModel_setData([(row,col,str(data))]) + self.update() + return True + + def _tableModel_setData(self, dataList:list): + # this is a helper to keep a snapshot copy if the data change + snaps = [] + for row,col,newData in dataList: + oldData = self._tableModel.data(row=row,col=col) + dataIndex = self._tableModel.index(row=row,col=col) + if newData == oldData: continue + self.cellChanged.emit(row,col) + snaps.append(self._SnapItem( + dataIndex=dataIndex, + oldData=oldData, + newData=newData)) + self._tableModel.setData(row=row,col=col,data=newData) + if snaps: + row,col = self._currentPos if self._currentPos else (0,0) + self._saveSnapshot(snaps,self._tableModel.index(row=row,col=col)) + +
[docs] @pyTTkSlot(bool) + def setSortingEnabled(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 + ''' + if enable == self._sortingEnabled: return + self._sortingEnabled = enable + self.sortByColumn(self._sortColumn, self._sortOrder)
+ +
[docs] def isSortingEnabled(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 + ''' + return self._sortingEnabled
+ +
[docs] @pyTTkSlot(int, TTkK.SortOrder) + def sortByColumn(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()
+ + @pyTTkSlot() + def _headerVisibilityChanged(self): + showVH = self._verticalHeader.isVisible() + showHH = self._horizontallHeader.isVisible() + vhs = self._vHeaderSize if showVH else 0 + hhs = self._hHeaderSize if showHH else 0 + self.setPadding(hhs,0,vhs,0) + self.viewChanged.emit() + + def _refreshLayout(self): + self._selected = None + self._selectedBase = None + self._hoverPos = None + self._dragPos = None + self._currentPos = None + self._hSeparatorSelected = None + self._vSeparatorSelected = None + self._sortColumn = -1 + self._sortOrder = TTkK.AscendingOrder + self._snapshot = [] + self._snapshotId = 0 + rows = self._tableModel.rowCount() + cols = self._tableModel.columnCount() + self._vHeaderSize = vhs = 1+max(len(self._tableModel.headerData(_p, TTkK.VERTICAL)) for _p in range(rows) ) + self._hHeaderSize = hhs = 1 + self.setPadding(hhs,0,vhs,0) + if self._showVSeparators: + self._colsPos = [(1+x)*11 for x in range(cols)] + else: + self._colsPos = [(1+x)*10 for x in range(cols)] + if self._showHSeparators: + self._rowsPos = [1+x*2 for x in range(rows)] + else: + self._rowsPos = [1+x for x in range(rows)] + # self._selectedBase = sb = [False]*cols + # self._selected = [sb]*rows + self.clearSelection() + + # Overridden function + def viewFullAreaSize(self) -> tuple[int, int]: + showVH = self._verticalHeader.isVisible() + showHH = self._horizontallHeader.isVisible() + hhs = self._hHeaderSize if showHH else 0 + vhs = self._vHeaderSize if showVH else 0 + w = vhs+self._colsPos[-1]+1 + h = hhs+self._rowsPos[-1]+1 + return w,h + + # Overridden function + def viewDisplayedSize(self) -> tuple[int, int]: + return self.size() + +
[docs] def clearSelection(self) -> None: + ''' + Deselects all selected items. + The current index will not be changed. + ''' + rows = self._tableModel.rowCount() + cols = self._tableModel.columnCount() + self._selected = [[False]*cols for _ in range(rows)] + self.update()
+ +
[docs] def selectAll(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 _c in range(cols)] for _r in range(rows)] + self.update()
+ +
[docs] def setSelection(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 + if flags & (TTkK.TTkItemSelectionModel.Clear|TTkK.TTkItemSelectionModel.Deselect): + for line in self._selected[y:y+h]: + line[x:x+w]=[False]*w + elif flags & TTkK.TTkItemSelectionModel.Select: + for _r, line in enumerate(self._selected[y:y+h],y): + line[x:x+w]=[cmp==(cmp&flagFunc(_r,_c)) for _c in range(x,min(x+w,cols))] + self.update()
+ +
[docs] def selectRow(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)) for col in range(cols)] + self.update()
+ +
[docs] def selectColumn(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 + for row,line in enumerate(self._selected): + line[col] = cmp==(cmp&flagFunc(row,col)) + self.update()
+ +
[docs] def unselectRow(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] def unselectColumn(self, column:int) -> None: + ''' + Unselects the given column in the table view + + :param column: the column to be unselected + :type column: int + ''' + for line in self._selected: + line[column] = False + self.update()
+ + @pyTTkSlot() + def _viewChangedHandler(self) -> None: + x,y = self.getViewOffsets() + self.layout().setOffset(-x,-y) + self.update() + +
[docs] def rowCount(self) -> int: + ''' + Returns the number of rows. + + :return: int + ''' + return self._tableModel.rowCount()
+ +
[docs] def currentRow(self) -> int: + ''' + Returns the row of the current item. + + :return: int + ''' + if _cp := self._currentPos: + return _cp[0] + return 0
+ +
[docs] def columnCount(self) -> int: + ''' + Returns the number of columns. + + :return: int + ''' + return self._tableModel.columnCount()
+ +
[docs] def currentColumn(self) -> int: + ''' + Returns the column of the current item. + + :return: int + ''' + if _cp := self._currentPos: + return _cp[1] + return 0
+ +
[docs] def verticalHeader(self) -> TTkHeaderView: + ''' + Returns the table view's vertical header. + + :return: :class:`~TermTk.TTkWidgets.TTkModelView.tablewidget.TTkHeaderView` + ''' + return self._verticalHeader
+ +
[docs] def horizontalHeader(self) -> TTkHeaderView: + ''' + Returns the table view's horizontal header. + + :return: :class:`~TermTk.TTkWidgets.TTkModelView.tablewidget.TTkHeaderView` + ''' + return self._horizontallHeader
+ +
[docs] def hSeparatorVisibility(self) -> bool: + ''' + Returns the visibility status of the horizontal separator + + :return: bool + ''' + return self._showHSeparators
+
[docs] def vSeparatorVisibility(self) -> bool: + ''' + Returns the visibility status of the vertical separator + + :return: bool + ''' + return self._showVSeparators
+ +
[docs] def setHSeparatorVisibility(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 + ''' + if self._showHSeparators == visibility: return + self._showHSeparators = visibility + if visibility: + self._rowsPos = [v+i for i,v in enumerate(self._rowsPos,1)] + else: + self._rowsPos = [v-i for i,v in enumerate(self._rowsPos,1)] + self.viewChanged.emit()
+ +
[docs] def setVSeparatorVisibility(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 + ''' + if self._showVSeparators == visibility: return + self._showVSeparators = visibility + if visibility: + self._colsPos = [v+i for i,v in enumerate(self._colsPos,1)] + else: + self._colsPos = [v-i for i,v in enumerate(self._colsPos,1)] + self.viewChanged.emit()
+ +
[docs] def model(self) -> TTkAbstractTableModel: + ''' + Returns the model that this view is presenting. + + :return: :class:`~TermTk.TTkAbstract.abstracttablemodel.TTkAbstractTableModel` + ''' + return self._tableModel
+ +
[docs] def setModel(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()
+ + def focusOutEvent(self) -> None: + self._hSeparatorSelected = None + self._vSeparatorSelected = None + +
[docs] def leaveEvent(self, evt): + self._hoverPos = None + self.update() + return super().leaveEvent(evt)
+ +
[docs] @pyTTkSlot(int) + def setColumnWidth(self, column:int, width: int) -> None: + ''' + Sets the width of the given column. + + :param column: the column + :type column: int + :param width: its width + :type width: int + ''' + i = column + prevPos = self._colsPos[i-1] if i>0 else -1 + if self._showVSeparators: + newPos = prevPos + width + 1 + else: + newPos = prevPos + width + oldPos = self._colsPos[i] + diff = newPos-oldPos + for ii in range(i,len(self._colsPos)): + self._colsPos[ii] += diff + self.viewChanged.emit() + self.update()
+ + def _columnContentsSize(self, column:int) -> int: + def _wid(_c): + txt = self._tableModel.ttkStringData(_c, column) + return max(t.termWidth() for t in txt.split('\n')) + rows = self._tableModel.rowCount() + if self._fastCheck: + w,h = self.size() + row,_ = self._findCell(w//2, h//2, False) + rowa,rowb = max(0,row-100), min(row+100,rows) + else: + rowa,rowb = 0,rows + return max(_wid(i) for i in range(rowa,rowb))+self._dataPadding + +
[docs] @pyTTkSlot(int) + def resizeColumnToContents(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() + def resizeColumnsToContents(self) -> None: + ''' + Resizes all columns based on the size hints of the delegate used to render each item in the columns. + ''' + _d = 1 if self._showVSeparators else 0 + cols = self._tableModel.columnCount() + pos = -1 + for _c in range(cols): + pos += _d+self._columnContentsSize(_c) + self._colsPos[_c] = pos + self.viewChanged.emit() + self.update()
+ +
[docs] @pyTTkSlot(int,int) + def setRowHeight(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] if i>0 else -1 + if self._showHSeparators: + newPos = prevPos + height + 1 + else: + newPos = prevPos + height + oldPos = self._rowsPos[i] + diff = newPos-oldPos + for ii in range(i,len(self._rowsPos)): + self._rowsPos[ii] += diff + self.viewChanged.emit() + self.update()
+ + def _rowContentsSize(self, row:int) -> int: + def _hei(_c): + txt = self._tableModel.ttkStringData(row, _c) + return len(txt.split('\n')) + cols = self._tableModel.columnCount() + if self._fastCheck: + w,h = self.size() + _,col = self._findCell(w//2, h//2, False) + cola,colb = max(0,col-30), min(col+30,cols) + else: + cola,colb = 0,cols + return max(_hei(i) for i in range(cola,colb)) + +
[docs] @pyTTkSlot(int) + def resizeRowToContents(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() + def resizeRowsToContents(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 = 1 if self._showHSeparators else 0 + pos = -1 + for _r in range(rows): + pos += _d + self._rowContentsSize(_r) + self._rowsPos[_r] = pos + self.viewChanged.emit() + self.update()
+ + def _findCell(self, x, y, headers): + showVH = self._verticalHeader.isVisible() + showHH = self._horizontallHeader.isVisible() + hhs = self._hHeaderSize if showHH else 0 + vhs = self._vHeaderSize if showVH else 0 + ox, oy = self.getViewOffsets() + rp = self._rowsPos + cp = self._colsPos + + row = 0 + col = 0 + + if headers and y<hhs: + row = -1 + else: + y += oy-hhs + for row,py in enumerate(rp): + if py>=y: + break + + if headers and x<vhs: + col = -1 + else: + x += ox-vhs + for col,px in enumerate(cp): + if px>=x: + break + + return row,col + + def _editStr(self, x,y,w,h, row, col, data): + _te = TTkTextEdit( + parent=self, pos=(x, y), size=(w,h), + readOnly=False, wrapMode=TTkK.NoWrap) + _tev = _te.textEditView() + _te.setText(data) + _te.textCursor().movePosition(operation=TTkTextCursor.EndOfLine) + _te.setFocus() + + @pyTTkSlot(bool) + def _processClose(change): + if change: + self.focusChanged.disconnect(_processClose) + txt = _te.toRawText() + val = str(txt) if txt.isPlainText() else txt + self._tableModel_setData([(row,col,val)]) + self.update() + _te.close() + self.setFocus() + + # Override the key event + _ke = _tev.keyEvent + _doc = _tev.document() + _cur = _tev.textCursor() + def _keyEvent(evt): + if ( evt.type == TTkK.SpecialKey): + _line = _cur.anchor().line + _pos = _cur.anchor().pos + _lineCount = _doc.lineCount() + # _lineLen + if evt.mod==TTkK.NoModifier: + if evt.key == TTkK.Key_Enter: + # self.enterPressed.emit(True) + self._moveCurrentCell(diff=(0,+1)) + _processClose(True) + return True + elif evt.key == TTkK.Key_Up: + if _line == 0: + self._moveCurrentCell(diff=(0,-1)) + _processClose(True) + return True + elif evt.key == TTkK.Key_Down: + if _lineCount == 1: + self._moveCurrentCell(diff=(0,+1)) + _processClose(True) + return True + elif evt.key == TTkK.Key_Left: + if _pos == _line == 0: + self._moveCurrentCell(diff=(-1, 0)) + _processClose(True) + return True + elif evt.key == TTkK.Key_Right: + if _lineCount == 1 and _pos==len(_doc.toPlainText()): + self._moveCurrentCell(diff=(+1, 0)) + _processClose(True) + return True + elif ( evt.type == TTkK.SpecialKey and + evt.mod==TTkK.ControlModifier|TTkK.AltModifier and + evt.key == TTkK.Key_M ): + evt.mod = TTkK.NoModifier + evt.key = TTkK.Key_Enter + return _ke(evt) + _tev.keyEvent = _keyEvent + + # _tev.enterPressed.connect(_processClose) + self.focusChanged.connect(_processClose) + + def _editNum(self, x,y,w,h, row, col, data): + _sb = TTkSpinBox( + parent=self, pos=(x, y), size=(w,1), + minimum=-1000000, maximum=1000000, + value=data) + _sb.setFocus() + + @pyTTkSlot(bool) + def _processClose(change): + if change: + self.focusChanged.disconnect(_processClose) + val = _sb.value() + self._tableModel_setData([(row,col,val)]) + self.update() + _sb.close() + self.setFocus() + + # Override the key event + _ke = _sb.keyEvent + def _keyEvent(evt): + if ( evt.type == TTkK.SpecialKey): + if evt.mod==TTkK.NoModifier: + if evt.key == TTkK.Key_Enter: + self._moveCurrentCell( 0,+1) + _processClose(True) + return True + return _ke(evt) + _sb.keyEvent = _keyEvent + + self.focusChanged.connect(_processClose) + + def _editTTkString(self, x,y,w,h, row, col, data): + _tp = TTkTextPicker( + parent=self, pos=(x, y), size=(w,h), + text=data, autoSize=False, wrapMode=TTkK.NoWrap) + + _tp.setFocus() + + @pyTTkSlot(bool) + def _processClose(change): + if change: + self.focusChanged.disconnect(_processClose) + txt = _tp.getTTkString() + self._tableModel_setData([(row,col,txt)]) + self.update() + _tp.close() + self.setFocus() + + self.focusChanged.connect(_processClose) + + def _editCell(self, row:int, col:int, richEditSupport:bool=True) -> None: + if not (self._tableModel.flags(row=row,col=col) & TTkK.ItemFlag.ItemIsEditable): + return + showHS = self._showHSeparators + showVS = self._showVSeparators + rp = self._rowsPos + cp = self._colsPos + xa,xb = 1+cp[col-1] if col>0 else 0, cp[col] + (0 if showVS else 1) + ya,yb = 1+rp[row-1] if row>0 else 0, rp[row] + (0 if showHS else 1) + + # Mark only the current cell as aselected + rows = self._tableModel.rowCount() + cols = self._tableModel.columnCount() + self.clearSelection() + self.setSelection(pos=(col,row),size=(1,1),flags=TTkK.TTkItemSelectionModel.Select) + + data = self._tableModel.data(row, col) + if type(data) is str: + self._editStr(xa,ya,xb-xa,yb-ya,row,col,data) + elif type(data) in [int,float]: + self._editNum(xa,ya,xb-xa,yb-ya,row,col,data) + else: + data = self._tableModel.ttkStringData(row, col) + if richEditSupport: + self._editTTkString(xa,ya,xb-xa,yb-ya,row,col,data) + else: + self._editStr(xa,ya,xb-xa,yb-ya,row,col,data) + + def _setCurrentCell(self, currRow:int, currCol:int) -> None: + prevRow,prevCol = self._currentPos if self._currentPos else (0,0) + self._currentPos = (currRow,currCol) + if (currRow,currRow)!=(prevRow,prevCol): + self.currentCellChanged.emit(currRow,currCol,prevRow,prevCol) + + def _moveCurrentCell(self, col=0, row=0, borderStop=True, diff=None): + rows = self._tableModel.rowCount() + cols = self._tableModel.columnCount() + + if diff: + row,col = self._currentPos if self._currentPos else (0,0) + dc,dr = diff + row+=dr + col+=dc + + if borderStop: + row = max(0,min(row, rows-1)) + col = max(0,min(col, cols-1)) + else: + if col >= cols: col=0 ; row+=1 + if col < 0: col=cols-1 ; row-=1 + if row >= rows: row=0 + if row < 0: row=rows-1 + self._setCurrentCell(row,col) + # move the offset to include the cell + w,h = self.size() + ox, oy = self.getViewOffsets() + showVH = self._verticalHeader.isVisible() + showHH = self._horizontallHeader.isVisible() + hhs = self._hHeaderSize if showHH else 0 + vhs = self._vHeaderSize if showVH else 0 + cxa,cxb = self._colsPos[col-1] if col else 0, self._colsPos[col] + cya,cyb = self._rowsPos[row-1] if row else 0, self._rowsPos[row] + if w+ox-vhs < cxb: ox=cxb+vhs-w + if ox > cxa: ox=cxa + if h+oy-hhs < cyb: oy=cyb+hhs-h + if oy > cya: oy=cya + self.viewMoveTo(ox,oy) + self.update() + +
[docs] def keyEvent(self, evt): + # rows = self._tableModel.rowCount() + cols = self._tableModel.columnCount() + if self._currentPos: + row,col = self._currentPos + else: + row,col = 0,0 + if evt.type == TTkK.SpecialKey: + if evt.mod==TTkK.ControlModifier: + if evt.key == TTkK.Key_Z: self.undo() + elif evt.key == TTkK.Key_Y: self.redo() + elif evt.key == TTkK.Key_C: self.copy() + elif evt.key == TTkK.Key_V: self.paste() + elif evt.key == TTkK.Key_X: self.cut() + elif evt.key == TTkK.Key_Tab: # Process Next/Prev + if evt.mod == TTkK.NoModifier: self._moveCurrentCell(col=col+1, row=row, borderStop=False) + elif evt.mod == TTkK.ShiftModifier: self._moveCurrentCell(col=col-1, row=row, borderStop=False) + elif evt.key == TTkK.Key_PageDown: + _,h = self.size() + rp=self._rowsPos[row] + for dy,rh in enumerate(self._rowsPos[row:]): + if rh-rp >= h: break + self._moveCurrentCell(col=col, row=row+dy, borderStop=True) + elif evt.key == TTkK.Key_PageUp: + _,h = self.size() + rp=self._rowsPos[row] + for dy,rh in enumerate(self._rowsPos[row::-1]): + if rp-rh >= h: break + self._moveCurrentCell(col=col, row=row-dy, borderStop=True) + elif evt.key == TTkK.Key_Home: self._moveCurrentCell(col=0, row=row, borderStop=True) + elif evt.key == TTkK.Key_End: self._moveCurrentCell(col=cols, row=row, borderStop=True) + elif evt.mod==TTkK.NoModifier: + if evt.key == TTkK.Key_Up: self._moveCurrentCell(col=col , row=row-1, borderStop=True) + elif evt.key == TTkK.Key_Down: self._moveCurrentCell(col=col , row=row+1, borderStop=True) + elif evt.key == TTkK.Key_Left: self._moveCurrentCell(col=col-1, row=row , borderStop=True) + elif evt.key == TTkK.Key_Right: self._moveCurrentCell(col=col+1, row=row , borderStop=True) + elif evt.key == TTkK.Key_Enter: + if (self._tableModel.flags(row=row,col=col) & TTkK.ItemFlag.ItemIsEditable): + self._editCell(row,col,richEditSupport=False) + else: + self._moveCurrentCell(col=col , row=row+1, borderStop=False) + elif evt.key in (TTkK.Key_Delete, TTkK.Key_Backspace): + self._cleanSelectedContent() + self.update() + return True + else: + if (self._tableModel.flags(row=row,col=col) & TTkK.ItemFlag.ItemIsEditable): + self._tableModel_setData([(row,col,evt.key)]) + self._editCell(row,col,richEditSupport=False) + return True
+ + +
[docs] def mouseDoubleClickEvent(self, evt): + x,y = evt.x, evt.y + ox, oy = self.getViewOffsets() + showHS = self._showHSeparators + showVS = self._showVSeparators + showVH = self._verticalHeader.isVisible() + showHH = self._horizontallHeader.isVisible() + hhs = self._hHeaderSize if showHH else 0 + vhs = self._vHeaderSize if showVH else 0 + + self._hSeparatorSelected = None + self._vSeparatorSelected = None + + rp = self._rowsPos + cp = self._colsPos + + # Handle Header Events + # And return if handled + # This is important to handle the header selection in the next part + if showVS and y < hhs: + _x = x+ox-vhs + for i, c in enumerate(self._colsPos): + if _x == c: + # I-th separator selected + self.resizeColumnToContents(i) + return True + # return True + elif showHS and x < vhs: + _y = y+oy-hhs + for i, r in enumerate(self._rowsPos): + if _y == r: + # I-th separator selected + # I-th separator selected + self.resizeRowToContents(i) + return True + + row,col = self._findCell(x,y, headers=False) + self.cellDoubleClicked.emit(row,col) + self._editCell(row,col) + return True
+ +
[docs] def mouseMoveEvent(self, evt) -> bool: + x,y = evt.x,evt.y + ox, oy = self.getViewOffsets() + showHS = self._showHSeparators + showVS = self._showVSeparators + showVH = self._verticalHeader.isVisible() + showHH = self._horizontallHeader.isVisible() + hhs = self._hHeaderSize if showHH else 0 + vhs = self._vHeaderSize if showVH else 0 + + self._hoverPos = (row,col) = self._findCell(x,y, headers=True) + if showVS and row==-1: + _x = x+ox-vhs + for i, c in enumerate(self._colsPos): + if _x == c: + # Over the I-th separator + self._hoverPos = None + self.update() + return True + if showHS and col==-1: + _y = y+oy-hhs + for i, r in enumerate(self._rowsPos): + if _y == r: + # Over the I-th separator + self._hoverPos = None + self.update() + return True + if row>=0 and col>>0: + self.cellEntered.emit(row,col) + self.update() + return True
+ +
[docs] def mousePressEvent(self, evt) -> bool: + x,y = evt.x, evt.y + ox, oy = self.getViewOffsets() + showHS = self._showHSeparators + showVS = self._showVSeparators + showVH = self._verticalHeader.isVisible() + showHH = self._horizontallHeader.isVisible() + hhs = self._hHeaderSize if showHH else 0 + vhs = self._vHeaderSize if showVH else 0 + + self._hSeparatorSelected = None + self._vSeparatorSelected = None + + # Handle Header Events + # And return if handled + # This is important to handle the header selection in the next part + if y < hhs: + _x = x+ox-vhs + for i, c in enumerate(self._colsPos): + if showVS and _x == c: + # I-th separator selected + self._hSeparatorSelected = i + self.update() + return True + elif self._sortingEnabled and _x == c-(1 if showVS else 0) : # Pressed the sort otder icon + if self._sortColumn == i: + order = TTkK.SortOrder.DescendingOrder if self._sortOrder==TTkK.SortOrder.AscendingOrder else TTkK.SortOrder.AscendingOrder + else: + order = TTkK.SortOrder.AscendingOrder + self.sortByColumn(i,order) + return True + elif showHS and x < vhs: + _y = y+oy-hhs + for i, r in enumerate(self._rowsPos): + if _y == r: + # I-th separator selected + self._vSeparatorSelected = i + self.update() + return True + + row,col = self._findCell(x,y, headers=True) + if not row==col==-1: + self._dragPos = [(row,col),(row,col)] + _ctrl = evt.mod==TTkK.ControlModifier + if row==col==-1: + # Corner Press + # Select Everything + self.selectAll() + elif col==-1: + # Row select + flagFunc = self._tableModel.flags + cmp = TTkK.ItemFlag.ItemIsSelectable + state = all(_sel for i,_sel in enumerate(self._selected[row]) if flagFunc(row,i)&cmp) + if not _ctrl: + self.clearSelection() + if state: + self.unselectRow(row) + else: + self.selectRow(row) + elif row==-1: + # Col select + flagFunc = self._tableModel.flags + cmp = TTkK.ItemFlag.ItemIsSelectable + state = all(_sel[col] for i,_sel in enumerate(self._selected) if flagFunc(i,col)&cmp) + if not _ctrl: + self.clearSelection() + if state: + self.unselectColumn(col) + else: + self.selectColumn(col) + else: + # Cell Select + self.cellClicked.emit(row,col) + # self.cellPressed.emit(row,col) + self._setCurrentCell(row,col) + self.setSelection(pos = (col,row), size = (1,1), + flags = TTkK.TTkItemSelectionModel.Clear if (self._selected[row][col] and _ctrl) else TTkK.TTkItemSelectionModel.Select) + self._hoverPos = None + self.update() + return True
+ +
[docs] def mouseDragEvent(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._hHeaderSize if showHH else 0 + vhs = self._vHeaderSize if showVH else 0 + if self._dragPos and not self._hSeparatorSelected and not self._vSeparatorSelected: + self._dragPos[1] = self._findCell(x,y, headers=False) + self.update() + return True + if self._hSeparatorSelected is not None: + x += ox-vhs + ss = self._hSeparatorSelected + pos = max((ss+1)*4, x) + diff = pos - self._colsPos[ss] + # Align the previous Separators if pushed + for i in range(ss): + self._colsPos[i] = min(self._colsPos[i], pos-(ss-i)*4) + # Align all the other Separators relative to the selection + for i in range(ss, len(self._colsPos)): + self._colsPos[i] += diff + # self._alignWidgets() + self.viewChanged.emit() + self.update() + return True + if self._vSeparatorSelected is not None: + y += oy-hhs + ss = self._vSeparatorSelected + pos = max((ss+1)*2-1, y) + diff = pos - self._rowsPos[ss] + # Align the previous Separators if pushed + for i in range(ss): + self._rowsPos[i] = min(self._rowsPos[i], pos-(ss-i)*2) + # Align all the other Separators relative to the selection + for i in range(ss, len(self._rowsPos)): + self._rowsPos[i] += diff + # self._alignWidgets() + self.viewChanged.emit() + self.update() + return True + return False
+ +
[docs] def mouseReleaseEvent(self, evt) -> bool: + if self._dragPos: + rows = self._tableModel.rowCount() + cols = self._tableModel.columnCount() + state = True + (rowa,cola),(rowb,colb) = self._dragPos + + if evt.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() + + if rowa == -1: + cola,colb=min(cola,colb),max(cola,colb) + rowa,rowb=0,rows-1 + elif cola == -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.Select if state else TTkK.TTkItemSelectionModel.Clear) + + self._hoverPos = None + self._dragPos = None + self.update() + return True
+ + # + # -1 X + # <-(0,0)->│<-(1,0)->│<-(2,0)->│<-(3,0)->│ + # 1 ─────────┼─────────┼─────────┼─────────┼ + # <-(0,1)->│<-(1,1)->│<-(2,1)->│<-(3,1)->│ + # 3 ─────────┼─────────┼─────────┼─────────┼ + # <-(0,2)->│<-(1,2)->│<-(2,2)->│<-(3,2)->│ + # 4 ─────────┼─────────┼─────────┼─────────┼ + # <-(0,3)->│<-(1,3)->│<-(2,3)->│<-(3,3)->│ h-cell = 5 = 10-(4+1) + # │ abc │ │ │ + # │ de │ │ │ + # │ │ │ │ + # │ │ │ │ + # 10 ─────────┼─────────┼─────────┼─────────┼ + # <-(0,4)->│<-(1,4)->│<-(2,4)->│<-(3,4)->│ + # 12 ─────────┼─────────┼─────────┼─────────┼ + # <-(0,5)->│<-(1,5)->│<-(2,5)->│<-(3,5)->│ + # 14 ─────────┼─────────┼─────────┼─────────┼ + + # -1 X + # 0 <-(0,0)->│<-(1,0)->│<-(2,0)->│<-(3,0)->│ + # 1 <-(0,1)->│<-(1,1)->│<-(2,1)->│<-(3,1)->│ + # 2 <-(0,2)->│<-(1,2)->│<-(2,2)->│<-(3,2)->│ + # 3 <-(0,3)->│<-(1,3)->│<-(2,3)->│<-(3,3)->│ h-cell = 5 = 10-(4+1) + # │ abc │ │ │ + # │ de │ │ │ + # │ │ │ │ + # │ │ │ │ + # 8 <-(0,4)->│<-(1,4)->│<-(2,4)->│<-(3,4)->│ + # 9 <-(0,5)->│<-(1,5)->│<-(2,5)->│<-(3,5)->│ + # +
[docs] def paintEvent(self, canvas) -> None: + style = self.currentStyle() + + color:TTkColor= style['color'] + lineColor:TTkColor= style['lineColor'] + headerColor:TTkColor= style['headerColor'] + hoverColor:TTkColor= style['hoverColor'] + currentColor:TTkColor= style['currentColor'] + selectedColor:TTkColor= style['selectedColor'] + separatorColor:TTkColor= style['separatorColor'] + + selectedColorInv:TTkColor = selectedColor.background().invertFgBg() + + vHSeparator = TTkString('▐', separatorColor) + + ox,oy = self.getViewOffsets() + w,h = self.size() + + rows = self._tableModel.rowCount() + cols = self._tableModel.columnCount() + rp = self._rowsPos + cp = self._colsPos + + showVH = self._verticalHeader.isVisible() + showHH = self._horizontallHeader.isVisible() + hhs = self._hHeaderSize if showHH else 0 + vhs = self._vHeaderSize if showVH else 0 + + showHS = self._showHSeparators + showVS = self._showVSeparators + + sliceCol=list(zip([-1]+cp,cp)) + sliceRow=list(zip([-1]+rp,rp)) + + # NOTE: Add Color Cache + # NOTE: Add Select/Hover Cache + # Draw cell and right/bottom corner + + # Find First/Last displayed Rows + rowa, rowb = 0,rows-1 + for row in range(rows): + ya,yb = sliceRow[row] + ya,yb = ya+hhs-oy, yb+hhs-oy + if ya>h : + rowb = row + break + if yb<hhs: + rowa = row + continue + # Use this in range + rrows = (rowa,rowb+1) + + # Find First/Last displayed Cols + cola, colb = 0, cols-1 + for col in range(cols): + xa,xb = sliceCol[col] + xa,xb = xa+vhs-ox, xb+vhs-ox + if xa>w : + colb = col + break + if xb<vhs: + cola = col + continue + # Use this in range + rcols = (cola,colb+1) + + # Cache Cells + _cellsCache = [] + _colorCache2d = [[None]*(colb+1-cola) for _ in range(rowb+1-rowa)] + for row in range(*rrows): + ya,yb = sliceRow[row] + if showHS: + ya,yb = ya+hhs-oy+1, yb+hhs-oy + else: + ya,yb = ya+hhs-oy+1, yb+hhs-oy+1 + if ya>h : break + if yb<hhs: continue + rowColor = color.mod(0,row) + for col in range(*rcols): + xa,xb = sliceCol[col] + if showVS: + xa,xb = xa+vhs-ox+1, xb+vhs-ox + else: + xa,xb = xa+vhs-ox+1, xb+vhs-ox+1 + if xa>w : break + if xb<vhs: continue + cellColor = ( + currentColor if self._currentPos == (row,col) else + hoverColor if self._hoverPos in [(row,col),(-1,col),(row,-1),(-1,-1)] else + selectedColor if self._selected[row][col] else + rowColor ) + _colorCache2d[row-rowa][col-cola] = cellColor + _cellsCache.append([row,col,xa,xb,ya,yb,cellColor]) + + def _drawCellContent(_col,_row,_xa,_xb,_ya,_yb,_color): + txt = self._tableModel.ttkStringData(_row, _col) + if _color != TTkColor.RST: + txt = txt.completeColor(_color) + for i,line in enumerate(txt.split('\n')): + y = i+_ya + canvas.drawTTkString(pos=(_xa,y), text=line, width=_xb-_xa, color=_color) + if y >= _yb-1: break + canvas.fill(pos=(_xa,y+1),size=(_xb-_xa,_yb-y-1),color=_color) + + def _drawCellBottom(_col,_row,_xa,_xb,_ya,_yb,cellColor): + if _yb>=h: return + if _row<rows-1: + _belowColor:TTkColor = _colorCache2d[_row+1-rowa][_col-cola] + + # force black border if there are selections + _sa = self._selected[_row ][_col ] + _sb = self._selected[_row+1][_col ] + if (showHS and showVS) and _sa and not _sb: + _bgA:TTkColor = c if (c:=cellColor.background()) else TTkColor.RST + _bgB:TTkColor = TTkColor.RST + elif (showHS and showVS) and not _sa and _sb: + _bgA:TTkColor = TTkColor.RST + _bgB:TTkColor = c if (c:=_belowColor.background()) else TTkColor.RST + else: + _bgA:TTkColor = c if (c:=cellColor.background()) else TTkColor.RST + _bgB:TTkColor = c if (c:=_belowColor.background()) else TTkColor.RST + + if _bgA == _bgB: + _char='─' + _color = lineColor if _bgA == TTkColor.RST else _bgA + lineColor + elif _bgB == TTkColor.RST: + _char='▀' + _color=_bgA.invertFgBg() + elif _bgA == TTkColor.RST: + _char='▄' + _color=_bgB.invertFgBg() + else: + _char='▀' + _color=_bgB + _bgA.invertFgBg() + else: + _bgA:TTkColor = c if (c:=cellColor.background()) else TTkColor.RST + if self._selected[_row ][_col ]: + _char='▀' + _color=selectedColorInv + elif _bgA:=cellColor.background(): + _char='▀' + _color=_bgA.invertFgBg() + else: + _char='─' + _color=lineColor + canvas.fill(pos=(_xa,_yb), size=(_xb-_xa,1), char=_char, color=_color) + + def _drawCellRight(_col,_row,_xa,_xb,_ya,_yb,cellColor): + if _xb>=w: return + if _col<cols-1: + _rightColor:TTkColor = _colorCache2d[_row-rowa][_col+1-cola] + + # force black border if there are selections + _sa = self._selected[_row ][_col ] + _sc = self._selected[_row ][_col+1] + if (showHS and showVS) and _sa and not _sc: + _bgA:TTkColor = c if (c:=cellColor.background()) else TTkColor.RST + _bgC:TTkColor = TTkColor.RST + elif (showHS and showVS) and not _sa and _sc: + _bgA:TTkColor = TTkColor.RST + _bgC:TTkColor = c if (c:=_rightColor.background()) else TTkColor.RST + else: + _bgA:TTkColor = c if (c:=cellColor.background()) else TTkColor.RST + _bgC:TTkColor = c if (c:=_rightColor.background()) else TTkColor.RST + + if _bgA == _bgC: + _char='│' + _color = lineColor if _bgA == TTkColor.RST else _bgA + lineColor + elif _bgC == TTkColor.RST: + _char='▌' + _color=_bgA.invertFgBg() + elif _bgA == TTkColor.RST: + _char='▐' + _color=_bgC.invertFgBg() + else: + _char='▌' + _color=_bgC + _bgA.invertFgBg() + else: + _bgA:TTkColor = c if (c:=cellColor.background()) else TTkColor.RST + if self._selected[_row ][_col ]: + _char='▌' + _color=selectedColorInv + elif _bgA:=cellColor.background(): + _char=' ' + _color=_bgA + else: + _char='│' + _color=lineColor + canvas.fill(pos=(_xb,_ya), size=(1,_yb-_ya), char=_char, color=_color) + + _charList = [ + # 0x00 0x01 0x02 0x03 + ' ', '▘', '▝', '▀', + # 0x04 0x05 0x06 0x07 + '▖', '▌', '▞', '▛', + # 0x08 0x09 0x0A 0x0B + '▗', '▚', '▐', '▜', + # 0x0C 0x0D 0x0E 0x0F + '▄', '▙', '▟', '█'] + + def _drawCellCorner(_col:int,_row:int,_xa:int,_xb:int,_ya:int,_yb:int,cellColor:TTkColor): + if _yb>=h or _xb>=w: return + _char = 'X' + _color = cellColor + if _row<rows-1 and _col<cols-1: + # Check if there are selected cells: + chId = ( + 0x01 * self._selected[_row ][_col ] + + 0x02 * self._selected[_row ][_col+1] + + 0x04 * self._selected[_row+1][_col ] + + 0x08 * self._selected[_row+1][_col+1] ) + if chId==0x00 or chId==0x0F: + _belowColor:TTkColor = _colorCache2d[_row+1-rowa][_col-cola] + _bgA:TTkColor = c if (c:=cellColor.background()) else TTkColor.RST + _bgB:TTkColor = c if (c:=_belowColor.background()) else TTkColor.RST + + if _bgA == _bgB: + _color = lineColor if _bgA == TTkColor.RST else _bgA + lineColor + _char='┼' + elif _bgB == TTkColor.RST: + _char='▀' + _color=_bgA.invertFgBg() + elif _bgA == TTkColor.RST: + _char='▄' + _color=_bgB.invertFgBg() + else: + _char='▀' + _color=_bgB + _bgA.invertFgBg() + else: + _char = _charList[chId] + _color=selectedColorInv + + elif _col<cols-1: + chId = ( + 0x01 * self._selected[row ][col ] + + 0x02 * self._selected[row ][col+1] ) + if chId: + _char = _charList[chId] + _color=selectedColorInv + elif _c:=cellColor.background(): + _char='▀' + _color = _c.invertFgBg() + else: + _char = '┴' + _color = lineColor + elif _row<rows-1: + chId = ( + (0x01) * self._selected[row ][col ] + + (0x04) * self._selected[row+1][col ] ) + _belowColor:TTkColor = _colorCache2d[_row+1-rowa][_col-cola] + _bgA:TTkColor = c if (c:=cellColor.background()) else TTkColor.RST + _bgB:TTkColor = c if (c:=_belowColor.background()) else TTkColor.RST + + if chId: + _char = _charList[chId] + _color=selectedColorInv + elif _bgA == _bgB == TTkColor.RST: + _char = '┤' + _color = lineColor + elif _bgB == TTkColor.RST: + _char='▀' + _color=_bgA.invertFgBg() + elif _bgA == TTkColor.RST: + _char='▄' + _color=_bgB.invertFgBg() + else: + _char='▀' + _color=_bgB + _bgA.invertFgBg() + else: + chId = ( + (0x01) * self._selected[row ][col ] ) + if chId: + _char = _charList[chId] + _color=selectedColorInv + elif _c:=cellColor.background(): + _char='▀' + _color = _c.invertFgBg() + else: + _char = '┘' + _color = lineColor + canvas.fill(pos=(_xb,_yb), size=(1,1), char=_char, color=_color) + + # # Draw Cells + for row,col,xa,xb,ya,yb,cellColor in _cellsCache: + _drawCellContent(col,row,xa,xb,ya,yb,cellColor) + + if showHS: + _drawCellBottom(col,row,xa,xb,ya,yb,cellColor) + if showVS: + _drawCellRight( col,row,xa,xb,ya,yb,cellColor) + if showHS and showVS: + _drawCellCorner(col,row,xa,xb,ya,yb,cellColor) + + # return f"cc={len(_cellsCache)} size={(w,h)} tw={(sliceCol[0],sliceCol[-1])} th={(sliceRow[0],sliceRow[-1])}" + + if self._hoverPos: + row,col = self._hoverPos + if row == -1: + ya,yb = -1,rp[-1] + else: + ya,yb = sliceRow[row] + if col == -1: + xa,xb = -1,cp[-1] + else: + xa,xb = sliceCol[col] + + if showVS: + xa,xb = xa+vhs-ox, xb+vhs-ox + else: + xa,xb = xa+vhs-ox, xb+vhs-ox+1 + + if showHS: + ya,yb = ya+hhs-oy, yb+hhs-oy + else: + ya,yb = ya+hhs-oy, yb+hhs-oy+1 + + # _drawCell(col,row,xa,xb,ya,yb,hoverColor) + + # Draw Borders + # Top, Bottom + hoverColorInv = hoverColor.background().invertFgBg() + canvas.drawTTkString(pos=(xa,ya), text=TTkString('▗'+('▄'*(xb-xa-1))+'▖',hoverColorInv)) + canvas.drawTTkString(pos=(xa,yb), text=TTkString('▝'+('▀'*(xb-xa-1))+'▘',hoverColorInv)) + # Left, Right + canvas.fill(char='▐',pos=(xa,ya+1), size=(1,yb-ya-1), color=hoverColorInv) + canvas.fill(char='▌',pos=(xb,ya+1), size=(1,yb-ya-1), color=hoverColorInv) + + if self._dragPos: + (rowa,cola),(rowb,colb) = self._dragPos + if rowa == -1: + cola,colb = min(cola,colb),max(cola,colb) + xa = sliceCol[cola][0]-ox+vhs + xb = sliceCol[colb][1]-ox+vhs + (0 if showHS else 1) + ya,yb = -1-oy+hhs,rp[-1]-oy+hhs + elif cola == -1: + rowa,rowb = min(rowa,rowb),max(rowa,rowb) + ya = sliceRow[rowa][0]-oy+hhs + yb = sliceRow[rowb][1]-oy+hhs + (0 if showVS else 1) + xa,xb = -1-ox+vhs,cp[-1]-ox+vhs + else: + cola,colb = min(cola,colb),max(cola,colb) + rowa,rowb = min(rowa,rowb),max(rowa,rowb) + xa = sliceCol[cola][0]-ox+vhs + xb = sliceCol[colb][1]-ox+vhs + (0 if showHS else 1) + ya = sliceRow[rowa][0]-oy+hhs + yb = sliceRow[rowb][1]-oy+hhs + (0 if showVS else 1) + + hoverColorInv = hoverColor.background().invertFgBg() + canvas.drawTTkString(pos=(xa,ya), text=TTkString('▗'+('▄'*(xb-xa-1))+'▖',hoverColorInv)) + canvas.drawTTkString(pos=(xa,yb), text=TTkString('▝'+('▀'*(xb-xa-1))+'▘',hoverColorInv)) + canvas.fill(char='▐',pos=(xa,ya+1), size=(1,yb-ya-1), color=hoverColorInv) + canvas.fill(char='▌',pos=(xb,ya+1), size=(1,yb-ya-1), color=hoverColorInv) + + if self._currentPos: + row,col = self._currentPos + xa = sliceCol[col][0]-ox+vhs + xb = sliceCol[col][1]-ox+vhs + (0 if showVS else 1) + ya = sliceRow[row][0]-oy+hhs + yb = sliceRow[row][1]-oy+hhs + (0 if showHS else 1) + currentColorInv = currentColor.background().invertFgBg() + if showVS and showHS: + canvas.drawTTkString(pos=(xa,ya), text=TTkString('▗'+('▄'*(xb-xa-1))+'▖',currentColorInv)) + canvas.drawTTkString(pos=(xa,yb), text=TTkString('▝'+('▀'*(xb-xa-1))+'▘',currentColorInv)) + canvas.fill(char='▐',pos=(xa,ya+1), size=(1,yb-ya-1), color=currentColorInv) + canvas.fill(char='▌',pos=(xb,ya+1), size=(1,yb-ya-1), color=currentColorInv) + # elif showHS: + # canvas.drawTTkString(pos=(xa+1,ya), text=TTkString( '▄'*(xb-xa-1) ,currentColorInv)) + # canvas.drawTTkString(pos=(xa+1,yb), text=TTkString( '▀'*(xb-xa-1) ,currentColorInv)) + # if showVS: + # canvas.fill(char='▐',pos=(xa,ya+1), size=(1,yb-ya-1), color=currentColorInv) + # canvas.fill(char='▌',pos=(xb,ya+1), size=(1,yb-ya-1), color=currentColorInv) + + # Draw H-Header first: + if showHH: + for col in range(*rcols): + txt = self._tableModel.headerData(col,TTkK.HORIZONTAL) + if isinstance(txt,TTkString): pass + elif type(txt) == str: txt = TTkString(txt) + else: txt = TTkString(f"{txt}") + xa,xb = sliceCol[col] + if showVS: + xa,xb = xa+vhs-ox+1, xb+vhs-ox + else: + xa,xb = xa+vhs-ox+1, xb+vhs-ox+1 + canvas.drawText(pos=(xa,0), text=txt, width=xb-xa, color=headerColor) + if self._sortingEnabled: + s = '•' if col != self._sortColumn else '▼' if self._sortOrder == TTkK.AscendingOrder else '▲' + canvas.drawText(pos=(xb-1,0), text=s, color=headerColor) + if showVS: + canvas.drawChar(pos=(xb,0), char='╿', color=headerColor) + + # Draw V-Header : + if showVH: + hlineHead = TTkString('╾'+'╌'*(vhs-2), color=headerColor) + vHSeparator + for row in range(*rrows): + ya,yb = sliceRow[row] + if showHS: + ya,yb = ya+hhs-oy+1, yb+hhs-oy + else: + ya,yb = ya+hhs-oy+1, yb+hhs-oy+1 + if ya>h : break + if yb<hhs: continue + txt = self._tableModel.headerData(row,TTkK.VERTICAL) + if isinstance(txt,TTkString): pass + elif type(txt) == str: txt = TTkString(txt) + else: txt = TTkString(f"{txt}") + canvas.drawTTkString(pos=(0 ,ya), text=txt, width=vhs, color=headerColor) + canvas.drawTTkString(pos=(vhs-1,ya), text=vHSeparator) + for y in range(ya+1,yb): + canvas.drawTTkString(pos=(0,y), text=vHSeparator, width=vhs, alignment=TTkK.RIGHT_ALIGN, color=headerColor) + if showHS: + canvas.drawTTkString(pos=(0,yb), text=hlineHead) + + # Draw Top/Left Corner + canvas.drawText(pos=(0,0), text=' ', width=vhs, color=separatorColor.invertFgBg() )
+ + + + + +
+ +
+
+
+ +
+ +
+

© Copyright 2021, Eugenio Parodi.

+
+ + Built with Sphinx using a + theme + provided by Read the Docs. + + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/_modules/TermTk/TTkWidgets/TTkModelView/tree.html b/_modules/TermTk/TTkWidgets/TTkModelView/tree.html index c30484bb..af438953 100644 --- a/_modules/TermTk/TTkWidgets/TTkModelView/tree.html +++ b/_modules/TermTk/TTkWidgets/TTkModelView/tree.html @@ -3,7 +3,7 @@ - TermTk.TTkWidgets.TTkModelView.tree — pyTermTk 0.39.0-a + <title>TermTk.TTkWidgets.TTkModelView.tree — pyTermTk 0.40.0-a documentation @@ -140,13 +140,16 @@ 'itemActivated', 'itemChanged', 'itemClicked', 'itemExpanded', 'itemCollapsed', 'itemDoubleClicked', # Forwarded Methods 'setHeaderLabels', + 'setColumnWidth', 'resizeColumnToContents', + 'sortColumn', 'sortItems', # 'appendItem', 'setAlignment', 'setColumnColors', 'setColumnSize', 'setHeader', 'addTopLevelItem', 'addTopLevelItems', 'takeTopLevelItem', 'topLevelItem', 'indexOfTopLevelItem', 'selectedItems', 'clear' ) def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) - if 'parent' in kwargs: kwargs.pop('parent') - self._treeView = kwargs.get('treeWidget',TTkTreeWidget(*args, **kwargs)) + kwargs.pop('parent',None) + kwargs.pop('visible',None) + self._treeView:TTkTreeWidget = kwargs.get('treeWidget',TTkTreeWidget(*args, **kwargs)) self.setViewport(self._treeView) self.setFocusPolicy(TTkK.ClickFocus) @@ -159,6 +162,8 @@ self.itemDoubleClicked = self._treeView.itemDoubleClicked # Forwarded Methods + self.sortColumn = self._treeView.sortColumn + self.sortItems = self._treeView.sortItems #self.setAlignment = self._treeView.setAlignment #self.setHeader = self._treeView.setHeader self.setHeaderLabels = self._treeView.setHeaderLabels @@ -171,6 +176,8 @@ self.topLevelItem = self._treeView.topLevelItem self.indexOfTopLevelItem = self._treeView.indexOfTopLevelItem self.selectedItems = self._treeView.selectedItems + self.setColumnWidth = self._treeView.setColumnWidth + self.resizeColumnToContents = self._treeView.resizeColumnToContents self.clear = self._treeView.clear
diff --git a/_modules/TermTk/TTkWidgets/TTkModelView/treewidget.html b/_modules/TermTk/TTkWidgets/TTkModelView/treewidget.html index fa88ebe5..4d477f35 100644 --- a/_modules/TermTk/TTkWidgets/TTkModelView/treewidget.html +++ b/_modules/TermTk/TTkWidgets/TTkModelView/treewidget.html @@ -3,7 +3,7 @@ - TermTk.TTkWidgets.TTkModelView.treewidget — pyTermTk 0.39.0-a + <title>TermTk.TTkWidgets.TTkModelView.treewidget — pyTermTk 0.40.0-a documentation @@ -157,7 +157,8 @@ 'separatorColor': TTkColor.fg("#888888")}, } - __slots__ = ( '_rootItem', '_header', '_columnsPos', '_cache', + __slots__ = ( '_rootItem', '_cache', + '_header', '_columnsPos', '_selectedId', '_selected', '_separatorSelected', '_sortColumn', '_sortOrder', # Signals @@ -171,7 +172,7 @@ widgets: list firstLine: bool - def __init__(self, *args, **kwargs): + def __init__(self, **kwargs) -> None: # Signals self.itemActivated = pyTTkSignal(TTkTreeWidgetItem, int) self.itemChanged = pyTTkSignal(TTkTreeWidgetItem, int) @@ -180,7 +181,7 @@ self.itemExpanded = pyTTkSignal(TTkTreeWidgetItem) self.itemCollapsed = pyTTkSignal(TTkTreeWidgetItem) - super().__init__(*args, **kwargs) + super().__init__(**kwargs) self._selected = None self._selectedId = None self._separatorSelected = None @@ -197,23 +198,23 @@ self.viewChanged.connect(self._viewChangedHandler) @pyTTkSlot() - def _viewChangedHandler(self): + def _viewChangedHandler(self) -> None: x,y = self.getViewOffsets() self.layout().setOffset(-x,-y) # Overridden function - def viewFullAreaSize(self) -> (int, int): + def viewFullAreaSize(self) -> tuple[int, int]: w = self._columnsPos[-1]+1 if self._columnsPos else 0 h = self._rootItem.size() # TTkLog.debug(f"{w=} {h=}") return w,h # Overridden function - def viewDisplayedSize(self) -> (int, int): + def viewDisplayedSize(self) -> tuple[int, int]: # TTkLog.debug(f"{self.size()=}") return self.size() - def clear(self): + def clear(self) -> None: # Remove all the widgets for ri in self._rootItem.children(): ri.setTreeItemParent(None) @@ -226,14 +227,14 @@ self.viewChanged.emit() self.update() - def addTopLevelItem(self, item): + def addTopLevelItem(self, item:TTkTreeWidgetItem) -> None: self._rootItem.addChild(item) item.setTreeItemParent(self) self._refreshCache() self.viewChanged.emit() self.update() - def addTopLevelItems(self, items): + def addTopLevelItems(self, items:TTkTreeWidgetItem) -> None: self._rootItem.addChildren(items) self._rootItem.setTreeItemParent(self) #for item in items: @@ -242,24 +243,24 @@ self.viewChanged.emit() self.update() - def takeTopLevelItem(self, index): + def takeTopLevelItem(self, index) -> None: self._rootItem.takeChild(index) self._refreshCache() self.viewChanged.emit() self.update() - def topLevelItem(self, index): + def topLevelItem(self, index) -> TTkTreeWidgetItem: return self._rootItem.child(index) - def indexOfTopLevelItem(self, item): + def indexOfTopLevelItem(self, item:TTkTreeWidgetItem) -> int: return self._rootItem.indexOfChild(item) - def selectedItems(self): + def selectedItems(self) -> list[TTkTreeWidgetItem]: if self._selected: return [self._selected] return None - def setHeaderLabels(self, labels): + def setHeaderLabels(self, labels:str): self._header = labels # Set 20 as default column size self._columnsPos = [20+x*20 for x in range(len(labels))] @@ -270,17 +271,47 @@ '''Returns the column used to sort the contents of the widget.''' return self._sortColumn -
[docs] def sortItems(self, col, order): +
[docs] def sortItems(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 = col self._sortOrder = order self._rootItem.sortChildren(col, order)
-
[docs] def mouseDoubleClickEvent(self, evt): + def columnWidth(self, column:int) -> int: + if column==0: + return self._columnsPos[column] + else: + return self._columnsPos[column]-self._columnsPos[column-1]-1 + + def setColumnWidth(self, column:int, width: int) -> None: + i = column + newSize = ((1+self._columnsPos[i-1]) if i>0 else 0) + width + oldSize = self._columnsPos[i] + for ii in range(i,len(self._columnsPos)): + self._columnsPos[ii] += newSize-oldSize+1 + self._alignWidgets() + self.viewChanged.emit() + self.update() + + def resizeColumnToContents(self, column:int) -> None: + contentSize = max(row.data[column].termWidth() for row in self._cache) + self.setColumnWidth(column, contentSize) + +
[docs] def mouseDoubleClickEvent(self, evt) -> bool: x,y = evt.x, evt.y ox, oy = self.getViewOffsets() - y += oy-1 x += ox + + # Handle Header Events + # Doubleclick resize to the content size + if y == 0: + for i, c in enumerate(self._columnsPos): + if x == c: + self.resizeColumnToContents(i) + break + return True + + y += oy-1 if 0 <= y < len(self._cache): item = self._cache[y].item if item.childIndicatorPolicy() == TTkK.DontShowIndicatorWhenChildless and item.children() or \ @@ -306,15 +337,13 @@ self.update() return True
- def focusOutEvent(self): + def focusOutEvent(self) -> None: self._separatorSelected = None -
[docs] def mousePressEvent(self, evt): +
[docs] def mousePressEvent(self, evt) -> bool: x,y = evt.x, evt.y ox, oy = self.getViewOffsets() - x += ox - self._separatorSelected = None # Handle Header Events @@ -360,7 +389,7 @@ self.update() return True
-
[docs] def mouseDragEvent(self, evt): +
[docs] def mouseDragEvent(self, evt) -> bool: ''' :: @@ -388,12 +417,12 @@ for i in range(ss, len(self._columnsPos)): self._columnsPos[i] += diff self._alignWidgets() - self.update() self.viewChanged.emit() + self.update() return True return False
- def _alignWidgets(self): + def _alignWidgets(self) -> None: for y,c in enumerate(self._cache): if not c.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() -
[docs] def paintEvent(self, canvas): +
[docs] def paintEvent(self, canvas) -> None: style = self.currentStyle() color= style['color'] diff --git a/_modules/TermTk/TTkWidgets/TTkPickers/colorpicker.html b/_modules/TermTk/TTkWidgets/TTkPickers/colorpicker.html index 8fd07792..c717cff7 100644 --- a/_modules/TermTk/TTkWidgets/TTkPickers/colorpicker.html +++ b/_modules/TermTk/TTkWidgets/TTkPickers/colorpicker.html @@ -3,7 +3,7 @@ - TermTk.TTkWidgets.TTkPickers.colorpicker — pyTermTk 0.39.0-a + <title>TermTk.TTkWidgets.TTkPickers.colorpicker — pyTermTk 0.40.0-a documentation @@ -559,10 +559,11 @@ canvas.drawBoxTitle(pos=(0,17), size=(26,0), text=TTkString(" Conrols "), align=TTkK.CENTER_ALIGN, color=color, colorText=titleColor)
[docs]class TTkColorButtonPicker(_TTkColorButton): - __slots__ = ('_type', 'colorSelected') + __slots__ = ('_type', 'colorSelected', 'colorSelectedBG') def __init__(self, *args, **kwargs): # Signals - self.colorSelected = pyTTkSignal(TTkColor) + self.colorSelected = pyTTkSignal(TTkColor) + self.colorSelectedBG = pyTTkSignal(TTkColor) _TTkColorButton.__init__(self, *args, **kwargs) self._custom = False self.clicked.connect(self._colorClicked) @@ -574,9 +575,14 @@ def _colorClicked(self): colorPicker = TTkColorDialogPicker(pos = (3,3), size=(75,24), color=self.color(), title="Test Color Picker", border=True) colorPicker.colorSelected.connect(self.setColor) - colorPicker.colorSelected.connect(self.colorSelected.emit) + colorPicker.colorSelected.connect(self._processColorSelected) TTkHelper.overlay(self, colorPicker, -1,-1, True) + @pyTTkSlot(TTkColor) + def _processColorSelected(self, color:TTkColor): + self.colorSelected.emit(color) + self.colorSelectedBG.emit(color.invertFgBg()) +
[docs] def setFocus(self): lastFocus = TTkHelper.getFocus() return super().setFocus()
diff --git a/_modules/TermTk/TTkWidgets/TTkPickers/filepicker.html b/_modules/TermTk/TTkWidgets/TTkPickers/filepicker.html index 577ba711..9a15c8f9 100644 --- a/_modules/TermTk/TTkWidgets/TTkPickers/filepicker.html +++ b/_modules/TermTk/TTkWidgets/TTkPickers/filepicker.html @@ -3,7 +3,7 @@ - TermTk.TTkWidgets.TTkPickers.filepicker — pyTermTk 0.39.0-a + <title>TermTk.TTkWidgets.TTkPickers.filepicker — pyTermTk 0.40.0-a documentation @@ -250,10 +250,10 @@ :param dirName: the name of the folder :type dirName: str ''' - __slots__ = ('_path', '_recentPath', '_recentPathId', '_filters', '_filter', '_caption', '_fileMode', '_acceptMode', + __slots__ = ('_path', '_fileName', '_recentPath', '_recentPathId', '_filters', '_filter', '_caption', '_fileMode', '_acceptMode', # Widgets '_fileTree', '_lookPath', '_btnPrev', '_btnNext', '_btnUp', - '_fileName', '_fileType', '_btnOpen', '_btnCancel', + '_leFileName', '_cbFileType', '_btnOpen', '_btnCancel', # Signals 'pathPicked', 'filePicked', 'filesPicked', 'folderPicked') @@ -271,8 +271,13 @@ self._recentPath = [] self._path = os.path.abspath(kwargs.get('path','.')) - if os.path.isdir(self._path) and self._path[-1]!='/': - self._path += '/' + if os.path.isdir(self._path): + self._fileName = '' + if self._path[-1]!='/': + self._path += '/' + else: + self._fileName = os.path.basename(self._path) + self._path = os.path.dirname(self._path)+'/' self._filter = '*' self._filters = kwargs.get('filter','All Files (*)') self._caption = kwargs.get('caption','File Dialog') @@ -301,31 +306,31 @@ topLayout.addWidget(self._btnUp , 0,4) # Bottom (File Name, Controls) - self._fileName = TTkLineEdit() - self._fileType = TTkComboBox(textAlign=TTkK.LEFT_ALIGN) - self._btnOpen = TTkButton(text="Open" if self._acceptMode == TTkK.AcceptMode.AcceptOpen else "Save", maxWidth=8, enabled=False) - self._btnCancel = TTkButton(text="Cancel",maxWidth=8) + self._leFileName = TTkLineEdit() + self._cbFileType = TTkComboBox(textAlign=TTkK.LEFT_ALIGN) + self._btnOpen = TTkButton(text="Open" if self._acceptMode == TTkK.AcceptMode.AcceptOpen else "Save", maxWidth=8, enabled=False) + self._btnCancel = TTkButton(text="Cancel",maxWidth=8) for f in self._filters.split(';;'): if re.match(r".*\(.*\)",f): - self._fileType.addItem(f) - self._fileType.setCurrentIndex(0) - self._fileType.currentTextChanged.connect(self._fileTypeChanged) + self._cbFileType.addItem(f) + self._cbFileType.setCurrentIndex(0) + self._cbFileType.currentTextChanged.connect(self._cbFileTypeChanged) self._btnOpen.clicked.connect(self._open) self._btnCancel.clicked.connect(self.close) - self._fileName.returnPressed.connect(self._open) - self._fileName.textChanged.connect(self._checkFileName) - self._fileName.textEdited.connect(self._checkFileName) + self._leFileName.returnPressed.connect(self._open) + self._leFileName.textChanged.connect(self._checkFileName) + self._leFileName.textEdited.connect(self._checkFileName) bottomLayout = TTkGridLayout() self.layout().addItem(bottomLayout,2,0) bottomLayout.addWidget(TTkLabel(text="File name:" ,maxWidth=14), 0,0) bottomLayout.addWidget(TTkLabel(text="Files of type:" ,maxWidth=14), 1,0) - bottomLayout.addWidget(self._fileName , 0,1) - bottomLayout.addWidget(self._fileType , 1,1) + bottomLayout.addWidget(self._leFileName , 0,1) + bottomLayout.addWidget(self._cbFileType , 1,1) bottomLayout.addWidget(self._btnOpen , 0,2) bottomLayout.addWidget(self._btnCancel , 1,2) @@ -350,12 +355,9 @@ self._fileTree.itemActivated.connect(self._activatedItem) self._lookPath.currentTextChanged.connect(self._openNewPath) - self._fileName.setText(self._path) - if os.path.isdir(self._path): - self._openNewPath(self._path, True) - else: - self._openNewPath(os.path.dirname(self._path), True) - self._fileTypeChanged(self._fileType.currentText()) + self._leFileName.setText(self._path+self._fileName) + self._openNewPath(self._path, True) + self._cbFileTypeChanged(self._cbFileType.currentText()) def acceptMode(self) -> TTkK.AcceptMode: return self._acceptMode @@ -365,7 +367,7 @@ self._btnOpen.setText("Open" if mode == TTkK.AcceptMode.AcceptOpen else "Save") @pyTTkSlot(str) - def _fileTypeChanged(self, type): + def _cbFileTypeChanged(self, type): self._filter = re.match(r".*\((.*)\)",type).group(1) self._fileTree.setFilter(self._filter) @@ -388,7 +390,7 @@ @pyTTkSlot() def _open(self): - fileName = str(self._fileName.text()) + fileName = str(self._leFileName.text()) if self._fileMode != TTkK.FileMode.AnyFile and not os.path.exists(fileName): return if self._fileMode == TTkK.FileMode.ExistingFile and not os.path.isfile(fileName): return if self._fileMode == TTkK.FileMode.Directory and not os.path.isdir(fileName): return @@ -403,8 +405,10 @@ def _selectedItem(self, item, _): path = item.path() if os.path.isdir(path) and path[-1]!='/': - path = path+'/' - self._fileName.setText(path) + path = path+'/'+self._fileName + elif self._fileMode == TTkK.FileMode.AnyFile: + self._fileName = os.path.basename(path) + self._leFileName.setText(path) @pyTTkSlot(TTkFileTreeWidgetItem, int) def _activatedItem(self, item, _): diff --git a/_modules/TermTk/TTkWidgets/TTkPickers/messagebox.html b/_modules/TermTk/TTkWidgets/TTkPickers/messagebox.html index 54c13e1c..e9435010 100644 --- a/_modules/TermTk/TTkWidgets/TTkPickers/messagebox.html +++ b/_modules/TermTk/TTkWidgets/TTkPickers/messagebox.html @@ -3,7 +3,7 @@ - TermTk.TTkWidgets.TTkPickers.messagebox — pyTermTk 0.39.0-a + <title>TermTk.TTkWidgets.TTkPickers.messagebox — pyTermTk 0.40.0-a documentation @@ -334,7 +334,8 @@ self._widBtnLayout.addWidget(_btn := TTkButton(border=True, text="Yes")) _btn.clicked.connect(_genClickedSlot(sb)) - _,_,w,h = self.layout().fullWidgetAreaGeometry() + # _,_,w,h = self.layout().fullWidgetAreaGeometry() + w,h = self.layout().minimumSize() self.resize(w+2,h+4)
# def setText(self, text):pass diff --git a/_modules/TermTk/TTkWidgets/TTkPickers/textpicker.html b/_modules/TermTk/TTkWidgets/TTkPickers/textpicker.html index 1ca5d830..aa6e1408 100644 --- a/_modules/TermTk/TTkWidgets/TTkPickers/textpicker.html +++ b/_modules/TermTk/TTkWidgets/TTkPickers/textpicker.html @@ -3,7 +3,7 @@ - TermTk.TTkWidgets.TTkPickers.textpicker — pyTermTk 0.39.0-a + <title>TermTk.TTkWidgets.TTkPickers.textpicker — pyTermTk 0.40.0-a documentation @@ -230,7 +230,8 @@ __slots__ = ('_areaView') def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) - if 'parent' in kwargs: kwargs.pop('parent') + kwargs.pop('parent',None) + kwargs.pop('visible',None) self._areaView = _emojiPickerView(*args, **kwargs) self.setFocusPolicy(TTkK.ClickFocus) self.setViewport(self._areaView) @@ -243,11 +244,10 @@ self.emojiClicked = epa.viewport().emojiClicked
[docs]class TTkTextDialogPicker(TTkWindow): - __slots__ = ('_textEdit', '_autoSize', '_multiLine') - def __init__(self, *args, **kwargs): - self._autoSize = kwargs.get('autoSize',False) - self._multiLine = kwargs.get('multiLine',True) - super().__init__(*args, **kwargs) + __slots__ = ('_textEdit', '_autoSize') + def __init__(self, *, autoSize=False, multiLine=True, wrapMode=TTkK.WidgetWidth, **kwargs): + self._autoSize = autoSize + super().__init__(**kwargs) fontLayout = TTkGridLayout(columnMinWidth=1) # Char Fg/Bg buttons fontLayout.addWidget(cb_fg := TTkCheckbox(text=" FG"),0,0) @@ -266,9 +266,9 @@ fontLayout.addWidget(_superSimpleHorizontalLine(),0,10,2,1) - self._textEdit = TTkTextEdit(document=kwargs.get('document',TTkTextDocument()),multiLine=self._multiLine) + self._textEdit = TTkTextEdit(document=kwargs.get('document',TTkTextDocument()),multiLine=multiLine) self._textEdit.setReadOnly(False) - self._textEdit.setLineWrapMode(TTkK.WidgetWidth) + self._textEdit.setLineWrapMode(wrapMode) self._textEdit.setLineNumber('\n' in self._textEdit.toPlainText()) @pyTTkSlot() @@ -326,13 +326,13 @@ cursor.setColor(color) self._textEdit.setFocus() - cb_fg.stateChanged.connect(lambda x: btn_fgColor.setEnabled(x==TTkK.Checked)) - cb_bg.stateChanged.connect(lambda x: btn_bgColor.setEnabled(x==TTkK.Checked)) - cb_fg.clicked.connect(lambda _: _setStyle()) - cb_bg.clicked.connect(lambda _: _setStyle()) + cb_fg.toggled.connect(btn_fgColor.setEnabled) + cb_bg.toggled.connect(btn_bgColor.setEnabled) + cb_fg.clicked.connect(_setStyle) + cb_bg.clicked.connect(_setStyle) - btn_fgColor.colorSelected.connect(lambda _: _setStyle()) - btn_bgColor.colorSelected.connect(lambda _: _setStyle()) + btn_fgColor.colorSelected.connect(_setStyle) + btn_bgColor.colorSelected.connect(_setStyle) btn_bold.clicked.connect(_setStyle) btn_italic.clicked.connect(_setStyle) @@ -370,16 +370,15 @@ Do not use it unless you know what you are doing And I've no idea what I am doing ''' - __slots__ = ('_teButton','_textEdit', 'documentViewChanged', 'textChanged', '_autoSize', '_multiLine') - def __init__(self, *args, **kwargs): + __slots__ = ('_teButton','_textEdit', 'documentViewChanged', 'textChanged', '_autoSize') + def __init__(self, *, text='', autoSize=False, multiLine=True, wrapMode=TTkK.WidgetWidth, **kwargs): self.documentViewChanged = pyTTkSignal(int,int) - self._autoSize = kwargs.get('autoSize',False) - self._multiLine = kwargs.get('multiLine',True) - super().__init__(*args, **kwargs|{'layout':TTkHBoxLayout()}) - self._textEdit = TTkTextEdit(pos=(0,0), size=(self.width()-2,self.height()),multiLine=self._multiLine) - self._textEdit.setText(kwargs.get('text','')) + self._autoSize = autoSize + super().__init__(**kwargs|{'layout':TTkHBoxLayout()}) + self._textEdit = TTkTextEdit(pos=(0,0), size=(self.width()-2,self.height()),multiLine=multiLine) + self._textEdit.setText(text) self._textEdit.setReadOnly(False) - self._textEdit.setLineWrapMode(TTkK.WidgetWidth) + self._textEdit.setLineWrapMode(wrapMode) self.textChanged = self._textEdit.textChanged self._teButton = TTkButton(border=True, text='◉', borderColor=TTkColor.fg("#AAAAFF")+TTkColor.bg("#002244") , pos=(self.width()-2,0), @@ -390,7 +389,9 @@ @pyTTkSlot() def _showTextDialogPicker(): w,h = self.size() - tdp = TTkTextDialogPicker(size=(50,8+h), document=self._textEdit.document(), autoSize=self._autoSize, multiLine=self._multiLine) + tdp = TTkTextDialogPicker(size=(50,8+h), + document=self._textEdit.document(), + autoSize=autoSize, multiLine=multiLine, wrapMode=wrapMode) TTkHelper.overlay(self, tdp, -1, -7, modal=True) tdp.focusTextEdit() @@ -398,6 +399,9 @@ self._textEdit.viewport().viewChanged.connect(self._textPickerViewChanged) +
[docs] def setFocus(self): + return self._textEdit.setFocus()
+ def getTTkString(self): return self._textEdit.toRawText() diff --git a/_modules/TermTk/TTkWidgets/TTkTerminal/debugterminal.html b/_modules/TermTk/TTkWidgets/TTkTerminal/debugterminal.html index 79c15a68..d0ff5a64 100644 --- a/_modules/TermTk/TTkWidgets/TTkTerminal/debugterminal.html +++ b/_modules/TermTk/TTkWidgets/TTkTerminal/debugterminal.html @@ -3,7 +3,7 @@ - TermTk.TTkWidgets.TTkTerminal.debugterminal — pyTermTk 0.39.0-a + <title>TermTk.TTkWidgets.TTkTerminal.debugterminal — pyTermTk 0.40.0-a documentation diff --git a/_modules/TermTk/TTkWidgets/TTkTerminal/mode.html b/_modules/TermTk/TTkWidgets/TTkTerminal/mode.html index efc92833..365042d8 100644 --- a/_modules/TermTk/TTkWidgets/TTkTerminal/mode.html +++ b/_modules/TermTk/TTkWidgets/TTkTerminal/mode.html @@ -3,7 +3,7 @@ - TermTk.TTkWidgets.TTkTerminal.mode — pyTermTk 0.39.0-a + <title>TermTk.TTkWidgets.TTkTerminal.mode — pyTermTk 0.40.0-a documentation diff --git a/_modules/TermTk/TTkWidgets/TTkTerminal/terminal.html b/_modules/TermTk/TTkWidgets/TTkTerminal/terminal.html index dfdc6073..ee67147e 100644 --- a/_modules/TermTk/TTkWidgets/TTkTerminal/terminal.html +++ b/_modules/TermTk/TTkWidgets/TTkTerminal/terminal.html @@ -3,7 +3,7 @@ - TermTk.TTkWidgets.TTkTerminal.terminal — pyTermTk 0.39.0-a + <title>TermTk.TTkWidgets.TTkTerminal.terminal — pyTermTk 0.40.0-a documentation @@ -151,7 +151,8 @@ 'termData', 'termResized') def __init__(self, *args, **kwargs): TTkAbstractScrollArea.__init__(self, *args, **kwargs) - if 'parent' in kwargs: kwargs.pop('parent') + kwargs.pop('parent',None) + kwargs.pop('visible',None) self._terminalView = TTkTerminalView(*args, **kwargs) self.setFocusPolicy(TTkK.ClickFocus) self.setViewport(self._terminalView) diff --git a/_modules/TermTk/TTkWidgets/TTkTerminal/terminalview.html b/_modules/TermTk/TTkWidgets/TTkTerminal/terminalview.html index 355d9892..c7a36599 100644 --- a/_modules/TermTk/TTkWidgets/TTkTerminal/terminalview.html +++ b/_modules/TermTk/TTkWidgets/TTkTerminal/terminalview.html @@ -3,7 +3,7 @@ - TermTk.TTkWidgets.TTkTerminal.terminalview — pyTermTk 0.39.0-a + <title>TermTk.TTkWidgets.TTkTerminal.terminalview — pyTermTk 0.40.0-a documentation @@ -272,7 +272,7 @@ re_CSI_Ps_fu = re.compile(r'^\[(\d*)([@ABCDEFGIJKLMPSTXZ^`abcdeghinqx])') re_CSI_Ps_Ps_fu = re.compile(r'^\[(\d*);(\d*)([Hf])') - re_DEC_SET_RST = re.compile(r'^\[(\??)(\d+)([lh])') + re_DEC_SET_RST = re.compile(r'^\[(\??)([\d;]+)([lh])') # re_CURSOR_1 = re.compile(r'^(\d+)([ABCDEFGIJKLMPSTXZHf])') re_OSC_ps_Pt = re.compile(r'^(\d*);(.*)$') @@ -316,24 +316,26 @@ ################################################ # CSI Modes - # CSI Pm h + # CSI Pm ; Pm ; ... h # Set Mode (SM). - # CSI Pm l + # CSI Pm ; Pm ; ... l # Reset Mode (RM). - # CSI ? Pm h + # CSI ? Pm ; Pm ; ... h # DEC Private Mode Set (DECSET). - # CSI ? Pm l + # CSI ? Pm ; Pm ; ... l # DEC Private Mode Reset (DECRST). ################################################ if m := TTkTerminalView.re_DEC_SET_RST.match(slice): en = m.end() - qm = m.group(1) == '?' - ps = int(m.group(2)) + qm = (m.group(1) == '?') sr = (m.group(3) == 'h') + pms = [int(_pm) for _pm in m.group(2).split(';')] if qm: - self._CSI_DEC_SET_RST(ps,sr) + for pm in pms: + self._CSI_DEC_SET_RST(pm,sr) else: - self._CSI_SM_RM(ps,sr) + for pm in pms: + self._CSI_SM_RM(pm,sr) slice = slice[en:] ################################################ diff --git a/_modules/TermTk/TTkWidgets/about.html b/_modules/TermTk/TTkWidgets/about.html index 64046354..66bfa0db 100644 --- a/_modules/TermTk/TTkWidgets/about.html +++ b/_modules/TermTk/TTkWidgets/about.html @@ -3,7 +3,7 @@ - TermTk.TTkWidgets.about — pyTermTk 0.39.0-a + <title>TermTk.TTkWidgets.about — pyTermTk 0.40.0-a documentation @@ -130,9 +130,22 @@ __all__ = ['TTkAbout'] from TermTk.TTkCore.cfg import TTkCfg +from TermTk.TTkCore.util import TTkUtil from TermTk.TTkCore.color import TTkColor +from TermTk.TTkCore.string import TTkString from TermTk.TTkWidgets.window import TTkWindow -from TermTk.TTkWidgets.image import TTkImage +from TermTk.TTkWidgets.label import TTkLabel + +_peppered_image = TTkUtil.base64_deflate_2_obj( + "eJxtVktyFDEMZcEKjsCGE1CW/C9dhCrOkAuwClUsWWQBk4SE4m6cBMmW23K7p3rysd7o8/Qkz/3bX9/ev2mvz1/5jw9f3N1HfvFv8oWQQqGYCeLdv9vrcQjOEUCiEMTO" + + "oEwxElQG/TYgz6DCRj6+ieN33fuBKOTIsfHxOMFAgCTB/h5nsVCOFFBDBYmGiSEPB4Tt1UmeDRIdpcCGxQsgJxiBcuqgEqgyVFJ+OkAJ1X6Eqj3Uj5kzn1TJM/QaiSuU" + + "SN9N3VEOYT31TCLhcuS0/MnN9AGKNtQgUPQUNTJXKMHd4hGlC61dSgVwjalQqisMWj6+KsgDBUcBGHQ/Qb6T7juoekqnQls0z032g43MXHgqeYX52EKA1xYi8IFjhpyk" + + "9Wz8ecpZHk0rCdUe96Bckrw7jNvEZCQRzZ8V5hK/8wiaW8156SYw0cwFn72YtnCuSsWpLVwJtrY8mOpYDY7dTy4dnZiUGQpH56BGbfyEQGxnql/21WbAREGpWJ5ejAN1" + + "8WoqDpQdZU0Eo1DDz5oKg4qTJ4x/OXPEEyjK0A0NIQ/B8PRkMs6NqQbJnlgmC7M1KFUvO41D+LNdafrajSypw+q90ju5YRlJx5S7MWY3kylObnnst/aAn/beiBMAswHk" + + "i+6VZAAeNw/ABAGp/Ms+26Ln9pHnuSZneLVNQnKYhOAwG0IyTDvg2LJGTX29KIDXCJ4pK8UUFHD3gJazOtRolmC2HnjfhJM+hPWmKoUU1txp8XeqRx2QlNbpI1Vjr8rD" + + "5U2DXq3mDsvOfNqlvUa+RyTDOIh2FzT0BTmKSF6LuBkvvDOKPDpMvEXbHn1c6vRN2kpFuMgl9u2lXnzdyIBqxgR8Vh+GLZhjEoz1rDe3NTPOD+7TKdv/iBsvaPR+fnxK" + + "xQDE4uRREkUJ66XbtrnsPzh2UpZrPsLpiuSfWR4dVb7jqa6eZJnJVIxboW48rdJF2ABxDMxk73q1GcaMFpv7wcfOF+RqZ89t+64LcTjIw8OTYYtVm3J7H3cB43I6aSq0" + + "4Zf9GYaCzmMK1e6+dLH7AkxADRtZ3ojHUrmNqNtco9mqF7pzbppx0GQSQ3Op8FcJ2G5ltCNVLuI74ZeG5vr8rDHAaP/o5bQnnOawWcPyRePnp/8KRQkp")
[docs]class TTkAbout(TTkWindow): peppered=[ @@ -157,6 +170,7 @@ [(0x00,0x00,0x00),(0x00,0x00,0x00),(0x00,0x00,0x00),(0x00,0x00,0x00),(0x00,0x00,0x00),(0x00,0x00,0x00),(0x00,0x00,0x00),(0x0b,0x00,0x00),(0x29,0x00,0x00),(0x30,0x00,0x00),(0x4c,0x00,0x00),(0x95,0x00,0x00),(0xa0,0x00,0x00),(0x61,0x00,0x00),(0x1a,0x00,0x00),(0x10,0x00,0x00),(0x03,0x00,0x00),(0x00,0x00,0x00),(0x00,0x00,0x00),(0x00,0x00,0x00)], [(0x00,0x00,0x00),(0x00,0x00,0x00),(0x00,0x00,0x00),(0x00,0x00,0x00),(0x00,0x00,0x00),(0x00,0x00,0x00),(0x00,0x00,0x00),(0x00,0x00,0x00),(0x00,0x00,0x00),(0x00,0x00,0x00),(0x00,0x00,0x00),(0x00,0x00,0x00),(0x00,0x00,0x00),(0x00,0x00,0x00),(0x00,0x00,0x00),(0x00,0x00,0x00),(0x00,0x00,0x00),(0x00,0x00,0x00),(0x00,0x00,0x00),(0x00,0x00,0x00)]] + pyTermTk = [ " ████████╗ ████████╗ ", " ╚══██╔══╝ ╚══██╔══╝ ", @@ -166,10 +180,12 @@ " ▌ ▐ ╚═╝ ╚═╝ ", " ▚▄▄▘ "] - __slots__=('_image') def __init__(self, *args, **kwargs): TTkWindow.__init__(self, *args, **kwargs) - self._image = TTkImage(parent=self, pos=(0,0), data=TTkAbout.peppered) + TTkLabel(parent=self, pos=( 0, 0), text=_peppered_image) + TTkLabel(parent=self, pos=(20, 6),text=TTkString(f" Version: {TTkCfg.version}", color=TTkColor.fg('#AAAAFF'))) + TTkLabel(parent=self, pos=(12, 8),text=TTkString("Powered By, Eugenio Parodi")) + TTkLabel(parent=self, pos=( 2,10),text=TTkString("https://github.com/ceccopierangiolieugenio/pyTermTk", color=TTkColor.fg('#44FFFF'))) if not self.title(): self.setTitle('About...') self.resize(55,15) @@ -179,9 +195,7 @@ for y, line in enumerate(TTkAbout.pyTermTk): canvas.drawText(pos=(9,3+y),text=line, color=TTkColor.fg(f'#{c[0]:02X}{c[1]:02X}{c[2]:02X}')) c[2]-=0x11 - canvas.drawText(pos=(20,9),text=f" Version: {TTkCfg.version}", color=TTkColor.fg('#AAAAFF')) - canvas.drawText(pos=(12,11),text="Powered By, Eugenio Parodi") - canvas.drawText(pos=(2,13),text="https://github.com/ceccopierangiolieugenio/pyTermTk", color=TTkColor.fg('#44FFFF')) + TTkWindow.paintEvent(self, canvas)
diff --git a/_modules/TermTk/TTkWidgets/apptemplate.html b/_modules/TermTk/TTkWidgets/apptemplate.html index 4e8b8e5e..ceaa70b2 100644 --- a/_modules/TermTk/TTkWidgets/apptemplate.html +++ b/_modules/TermTk/TTkWidgets/apptemplate.html @@ -3,7 +3,7 @@ - TermTk.TTkWidgets.apptemplate — pyTermTk 0.39.0-a + <title>TermTk.TTkWidgets.apptemplate — pyTermTk 0.40.0-a documentation @@ -134,8 +134,10 @@ from TermTk.TTkCore.constant import TTkK from TermTk.TTkCore.color import TTkColor +from TermTk.TTkCore.string import TTkString from TermTk.TTkLayouts import TTkLayout, TTkGridLayout from TermTk.TTkWidgets.container import TTkWidget, TTkContainer +from TermTk.TTkWidgets.menubar import TTkMenuBarLayout
[docs]class TTkAppTemplate(TTkContainer): ''' TTkAppTemplate Layout: @@ -172,11 +174,13 @@ @dataclass(frozen=False) class _Panel: # It's either item or widget - item: TTkLayout = None - widget: TTkWidget = None - size = 0 - border = True - fixed = False + item: TTkLayout = None + widget: TTkWidget = None + title: TTkString = None + menubar: TTkMenuBarLayout = None + size: int = 0 + border: bool = True + fixed: bool = False def setGeometry(self,x,y,w,h): if it := self.item: @@ -231,12 +235,12 @@ return wid.maximumHeight() return 0x10000 - __slots__ = ('_panels', '_splitters', '_selected' + __slots__ = ('_panels', '_splitters', '_menubarLines', '_selected' #Signals ) - def __init__(self, **kwargs): + def __init__(self, border=False, **kwargs): self._panels = { - TTkAppTemplate.MAIN : TTkAppTemplate._Panel(item=TTkLayout()) , + TTkAppTemplate.MAIN : TTkAppTemplate._Panel(item=TTkLayout(), border=border) , TTkAppTemplate.TOP : None , TTkAppTemplate.BOTTOM : None , TTkAppTemplate.LEFT : None , @@ -250,47 +254,96 @@ TTkAppTemplate.RIGHT : None , TTkAppTemplate.HEADER : None , TTkAppTemplate.FOOTER : None } + self._menubarLines = { + TTkAppTemplate.MAIN : None , + TTkAppTemplate.TOP : None , + TTkAppTemplate.BOTTOM : None , + TTkAppTemplate.LEFT : None , + TTkAppTemplate.RIGHT : None , + TTkAppTemplate.HEADER : None , + TTkAppTemplate.FOOTER : None } self._selected = None super().__init__( **kwargs) self.layout().addItem(self._panels[TTkAppTemplate.MAIN].item) - self._updateGeometries() + self._updateGeometries(force=True) self.setFocusPolicy(TTkK.ClickFocus) - def setWidget(self, widget, location): - if not self._panels[location]: - self._panels[location] = TTkAppTemplate._Panel() - self._panels[location].widget = widget - if it:=self._panels[location].item: + def setWidget(self, widget, position=MAIN, size=None, title="", border=None, fixed=None): + if not self._panels[position]: + self._panels[position] = TTkAppTemplate._Panel() + if wid:=self._panels[position].widget: + self.layout().removeWidget(wid) + self._panels[position].widget = None + if it:=self._panels[position].item: self.layout().removeItem(it) - self._panels[location].item = None + self._panels[position].item = None if widget: + self._panels[position].widget = widget self.layout().addWidget(widget) - self._panels[location].size = widget.minimumWidth() if location in (TTkAppTemplate.LEFT,TTkAppTemplate.RIGHT) else widget.maximumWidth() - self._updateGeometries() - - def setItem(self, item, location): - if not self._panels[location]: - self._panels[location] = TTkAppTemplate._Panel() - self._panels[location].item = item - if wid:=self._panels[location].widget: - self.layout().removeWdget(wid) - self._panels[location].widget = None + if border!=None: + self._panels[position].border = border + if fixed != None: + self._panels[position].fixed = fixed + self._panels[position].title = TTkString(title) + self._panels[position].size = ( size if size is not None else + widget.minimumWidth() if position in (TTkAppTemplate.LEFT,TTkAppTemplate.RIGHT) else + widget.minimumHeight() ) + self._updateGeometries(force=True) + + def setItem(self, item, position=MAIN, size=None, title="", border=None, fixed=None): + if not self._panels[position]: + self._panels[position] = TTkAppTemplate._Panel() + if wid:=self._panels[position].widget: + self.layout().removeWidget(wid) + self._panels[position].widget = None + if it:=self._panels[position].item: + self.layout().removeItem(it) + self._panels[position].item = None if item: + self._panels[position].item = item self.layout().addItem(item) - self._updateGeometries() - - def setBorder(self, border=True, location=MAIN): - if not self._panels[location]: - self._panels[location] = TTkAppTemplate._Panel() - self._panels[location].border = border - self._updateGeometries() - - def setFixed(self, fixed=False, location=MAIN): - if not self._panels[location]: - self._panels[location] = TTkAppTemplate._Panel() - self._panels[location].fixed = fixed - self._updateGeometries() + if border!=None: + self._panels[position].border = border + if fixed != None: + self._panels[position].fixed = fixed + self._panels[position].title = TTkString(title) + self._panels[position].size = ( size if size is not None else + item.minimumWidth() if position in (TTkAppTemplate.LEFT,TTkAppTemplate.RIGHT) else + item.minimumHeight() ) + self._updateGeometries(force=True) + + def setTitle(self, position=MAIN, title=""): + if not self._panels[position]: return + self._panels[position].title = TTkString(title) if title else "" + self._updateGeometries(force=True) + + def menuBar(self, position=MAIN): + return None if not self._panels[position] else self._panels[position].menubar + + def setMenuBar(self, menuBar, position=MAIN): + if not self._panels[position]: + self._panels[position] = TTkAppTemplate._Panel() + p = self._panels[position] + if p.menubar: + self.rootLayout().removeItem(p.menubar) + # TODO: Dispose the menubar + p.menubar = menuBar + if menuBar: + self.rootLayout().addItem(p.menubar) + self._updateGeometries(force=True) + + def setBorder(self, border=True, position=MAIN): + if not self._panels[position]: + self._panels[position] = TTkAppTemplate._Panel() + self._panels[position].border = border + self._updateGeometries(force=True) + + def setFixed(self, fixed=False, position=MAIN): + if not self._panels[position]: + self._panels[position] = TTkAppTemplate._Panel() + self._panels[position].fixed = fixed + self._updateGeometries(force=True)
[docs] def resizeEvent(self, w, h): self._updateGeometries()
@@ -329,7 +382,7 @@ elif loc in (TTkAppTemplate.HEADER, TTkAppTemplate.TOP): p.size = evt.y-y else: - p.size = h+y-evt.y + p.size = h+y-evt.y-1 self._updateGeometries() return True
@@ -380,81 +433,122 @@ def minimumHeight(self): pns = self._panels - # Header and Footer border and minHeight - mh=mf=0 - # Header Footer - if (p:=pns[TTkAppTemplate.HEADER]) and p.isVisible(): mh = p.minimumHeight() + ( 1 if p.border else 0 ) - if (p:=pns[TTkAppTemplate.FOOTER]) and p.isVisible(): mf = p.minimumHeight() + ( 1 if p.border else 0 ) - - # Center Left,Right: - mcr=mcl=0 - if (p:=pns[TTkAppTemplate.LEFT ]) and p.isVisible(): mcl = p.minimumHeight() - if (p:=pns[TTkAppTemplate.RIGHT]) and p.isVisible(): mcr = p.minimumHeight() - - # Center Top,Bottom - mct=mcb=0 - if (p:=pns[TTkAppTemplate.TOP ]) and p.isVisible(): mct = p.minimumHeight() + ( 1 if p.border else 0 ) - if (p:=pns[TTkAppTemplate.BOTTOM]) and p.isVisible(): mcb = p.minimumHeight() + ( 1 if p.border else 0 ) - - mcm = (p:=pns[TTkAppTemplate.MAIN]).minimumHeight() - - return mh+mf+max(mcr ,mcl, mcm+mct+mcb ) + ( 2 if p.border else 0 ) + # Retrieve all the panels parameters and hide the menubar if required + def _processPanel(_loc): + _p = pns[_loc] + if not (_p and _p.isVisible()): + return None, 0, False, False + return _p, _p.minimumHeight(), _p.border, _p.menubar + + ph,mh,bh,menh = _processPanel(TTkAppTemplate.HEADER) + pl,ml,bl,menl = _processPanel(TTkAppTemplate.LEFT) + pr,mr,br,menr = _processPanel(TTkAppTemplate.RIGHT) + pt,mt,bt,ment = _processPanel(TTkAppTemplate.TOP) + pm,mm,bm,menm = _processPanel(TTkAppTemplate.MAIN) + pb,mb,bb,menb = _processPanel(TTkAppTemplate.BOTTOM) + pf,mf,bf,menf = _processPanel(TTkAppTemplate.FOOTER) + + # Adjust the sizes based on the menubar and the borders + if menh and not (bm): mh += 1 + if menl and not (bh or (bm and ph==None)): ml += 1 + if menr and not (bh or (bm and ph==None)): mr += 1 + if ment and not (bh or (bm and ph==None)): mt += 1 + if menm and not (bt or (bh and pt==None) or (bm and pt==ph==None)): mm += 1 + if menb and not (bb): mb += 1 + if menf and not (bf): mf += 1 + + return mh+mf+max(mr ,ml, mm+mt+mb ) + ( 2 if bm else 0 ) def maximumHeight(self): pns = self._panels - # Header and Footer border and minHeight - mh=mf=0 - # Header Footer - if (p:=pns[TTkAppTemplate.HEADER]) and p.isVisible(): mh = p.maximumHeight() + ( 1 if p.border else 0 ) - if (p:=pns[TTkAppTemplate.FOOTER]) and p.isVisible(): mf = p.maximumHeight() + ( 1 if p.border else 0 ) - - # Center Left,Right: - mcr=mcl=0x10000 - if (p:=pns[TTkAppTemplate.LEFT ]) and p.isVisible(): mcl = p.maximumHeight() - if (p:=pns[TTkAppTemplate.RIGHT]) and p.isVisible(): mcr = p.maximumHeight() - - # Center Top,Bottom - mct=mcb=0 - if (p:=pns[TTkAppTemplate.TOP ]) and p.isVisible(): mct = p.maximumHeight() + ( 1 if p.border else 0 ) - if (p:=pns[TTkAppTemplate.BOTTOM]) and p.isVisible(): mcb = p.maximumHeight() + ( 1 if p.border else 0 ) - - mcm = (p:=pns[TTkAppTemplate.MAIN]).maximumHeight() - - return mh+mf+min(mcr ,mcl, mcm+mct+mcb ) + ( 2 if p.border else 0 ) - - def _updateGeometries(self): + # Retrieve all the panels parameters and hide the menubar if required + def _processPanel(_loc): + _p = pns[_loc] + if not (_p and _p.isVisible()): + return None, 0, False, False + return _p, _p.maximumHeight(), _p.border, _p.menubar + + ph,mh,bh,menh = _processPanel(TTkAppTemplate.HEADER) + pl,ml,bl,menl = _processPanel(TTkAppTemplate.LEFT) + pr,mr,br,menr = _processPanel(TTkAppTemplate.RIGHT) + pt,mt,bt,ment = _processPanel(TTkAppTemplate.TOP) + pm,mm,bm,menm = _processPanel(TTkAppTemplate.MAIN) + pb,mb,bb,menb = _processPanel(TTkAppTemplate.BOTTOM) + pf,mf,bf,menf = _processPanel(TTkAppTemplate.FOOTER) + + # Adjust the sizes based on the menubar and the borders + if menh and not (bm): mh += 1 + if menl and not (bh or (bm and ph==None)): ml += 1 + if menr and not (bh or (bm and ph==None)): mr += 1 + if ment and not (bh or (bm and ph==None)): mt += 1 + if menm and not (bt or (bh and pt==None) or (bm and pt==ph==None)): mm += 1 + if menb and not (bb): mb += 1 + if menf and not (bf): mf += 1 + + # Those panels cannot have null size + if not mm: mm=0x10000 + if not ml: ml=0x10000 + if not mr: mr=0x10000 + + return mh+mf+min(mr ,ml, mm+mt+mb ) + ( 2 if bm else 0 ) + + def _updateGeometries(self, force=False): w,h = self.size() + if w<=0 or h<=0 or (not force and not self.isVisibleAndParent()): return pns = self._panels spl = self._splitters - - sl=sr=st=sb=sh=sf=0 - bm=bl=br=bt=bb=bh=bf=0 - # A,B,C,D HSplitters - pt=pb=ph=pf=None - if ( (p:=pns[TTkAppTemplate.TOP ]) and p.isVisible() ): pt=p ; ptmin=p.minimumHeight() ; ptmax=p.maximumHeight() ; st=min(max(p.size,ptmin),ptmax) ; ft=p.fixed ; bt=1 if p.border else 0 - if ( (p:=pns[TTkAppTemplate.BOTTOM]) and p.isVisible() ): pb=p ; pbmin=p.minimumHeight() ; pbmax=p.maximumHeight() ; sb=min(max(p.size,pbmin),pbmax) ; fb=p.fixed ; bb=1 if p.border else 0 - if ( (p:=pns[TTkAppTemplate.HEADER]) and p.isVisible() ): ph=p ; phmin=p.minimumHeight() ; phmax=p.maximumHeight() ; sh=min(max(p.size,phmin),phmax) ; fh=p.fixed ; bh=1 if p.border else 0 - if ( (p:=pns[TTkAppTemplate.FOOTER]) and p.isVisible() ): pf=p ; pfmin=p.minimumHeight() ; pfmax=p.maximumHeight() ; sf=min(max(p.size,pfmin),pfmax) ; ff=p.fixed ; bf=1 if p.border else 0 - # E,F VSplitters - pl=pr=None - if ( (p:=pns[TTkAppTemplate.LEFT ]) and p.isVisible() ): pl=p ; plmin=p.minimumWidth() ; plmax=p.maximumWidth() ; sl=min(max(p.size,plmin),plmax) ; fl=p.fixed ; bl=1 if p.border else 0 - if ( (p:=pns[TTkAppTemplate.RIGHT ]) and p.isVisible() ): pr=p ; prmin=p.minimumWidth() ; prmax=p.maximumWidth() ; sr=min(max(p.size,prmin),prmax) ; fr=p.fixed ; br=1 if p.border else 0 + mbl = self._menubarLines + + # Retrieve all the panels parameters and hide the menubar if required + def _processPanel(_loc): + _p = pns[_loc] + if not (_p and _p.isVisible()): + if _p and (_menu:=_p.menubar): + _menu.setGeometry(-1,-1,0,0) + return None, 0, 0x1000, 0, True, 0, None + _min = _p.minimumHeight() + _max = _p.maximumHeight() + _size = min(max(_p.size,_min),_max) + _fixed = _p.fixed + _border = 1 if _p.border else 0 + return _p, _min, _max, _size, _fixed, _border, _p.menubar + + pt,ptmin,ptmax,st,ft,bt,mt = _processPanel(TTkAppTemplate.TOP) + pb,pbmin,pbmax,sb,fb,bb,mb = _processPanel(TTkAppTemplate.BOTTOM) + ph,phmin,phmax,sh,fh,bh,mh = _processPanel(TTkAppTemplate.HEADER) + pf,pfmin,pfmax,sf,ff,bf,mf = _processPanel(TTkAppTemplate.FOOTER) + pl,plmin,plmax,sl,fl,bl,ml = _processPanel(TTkAppTemplate.LEFT) + pr,prmin,prmax,sr,fr,br,mr = _processPanel(TTkAppTemplate.RIGHT) # Main Boundaries pm=pns[TTkAppTemplate.MAIN] + mm=pm.menubar mmaxw = pm.maximumWidth() mminw = pm.minimumWidth() mmaxh = pm.maximumHeight() mminh = pm.minimumHeight() - bm = 1 if pns[TTkAppTemplate.MAIN].border else 0 + bm = 1 if pm.border else 0 w-=(bm<<1)+bl+br h-=(bm<<1)+bt+bb+bh+bf + adjm =adjt =adjb =adjh =adjf =adjl =adjr =0 # Adjustment if we need extra space for the menubar + adjtf=adjbf=adjhf=adjff=adjlf=adjrf=adjmf=0 # 1 if the menu is on a single line bar + # Retune the max/min sizes and adjustment based on the menubar,border and visible widgets + # Check if there is a splitter to be used for the menubar + # Fix bar status if the menu is on the closest splitter + if pt and mt: adjt,adjtf = ( 0, fh if _phbh else True ) if (_phbh:=(ph and bh)) or (not ph and bm) else (1,True) ; st+=adjt ; ptmin+=adjt ; ptmax+=adjt + if pb and mb: adjb,adjbf = ( 0, fb ) if bb else (1,True) ; sb+=adjb ; pbmin+=adjb ; pbmax+=adjb + if ph and mh: adjh,adjhf = ( 0, 0 ) if bm else (1,True) ; sh+=adjh ; phmin+=adjh ; phmax+=adjh + if pf and mf: adjf,adjff = ( 0, ff ) if bf else (1,True) ; sf+=adjf ; pfmin+=adjf ; pfmax+=adjf + if pl and ml: adjl,adjlf = ( 0, fh if _phbh else True ) if (_phbh:=(ph and bh)) or (not ph and bm) else (1,True) ; plmin+=adjl ; plmax+=adjl + if pr and mr: adjr,adjrf = ( 0, fh if _phbh else True ) if (_phbh:=(ph and bh)) or (not ph and bm) else (1,True) ; prmin+=adjr ; prmax+=adjr + if mm: adjm,adjmf = ( 0, ft if (pt and bt) else fh if _phbh else True) if (_phbh:=(ph and bh)) or (not pt and ph and bh) or (not pt and not ph and bm) else (1,True) ; mminh+=adjm ; mmaxh+=adjm + # check horizontal sizes if not (mminw <= (newszw:=(w-sl-sr)) <= mmaxw): # the main width does not fit - # we need to move the (E,F) splitters + # we need to move the (R,L) splitters # * to avoid extra complexity, # Let's resize the right panel first # and adjust the left one to allows the @@ -483,30 +577,46 @@ # Resize any panel to the proper dimension w+=bl+br h+=bt+bb+bh+bf - pm.setGeometry( bm+sl+bl , bm+sh+bh+st+bt , newszw , newszh ) - - if pl: pl.setGeometry( bm , bm+sh+bh , sl , h-sh-bh-sf-bf ) - if pr: pr.setGeometry( bm+sl+bl+newszw+br , bm+sh+bh , sr , h-sh-bh-sf-bf ) - - if ph: ph.setGeometry( bm , bm , w , sh ) - if pt: pt.setGeometry( bm+sl+bl , bm+sh+bh , newszw , st ) - if pb: pb.setGeometry( bm+sl+bl , bm+sh+bh+st+bt+newszh+bb , newszw , sb ) - if pf: pf.setGeometry( bm , bm+sh+bh+st+bt+newszh+bb+sb+bf , w , sf ) + def _setGeometries(_loc, _p, _x,_y,_w,_h,_mb,_adj,_fix): + if _mb: + if _fix: # Fixed + styleToMerge = {'default':{'glyphs':('├','─','┤','┄','┄','▶')}} + else: + styleToMerge = {'default':{'glyphs':('╞','═','╡','┄','┄','▶')}} + if not _adj: + mbl[_loc] = None + else: + mbl[_loc] = {'pos':(_x,_y),'text':f"┄{'─'*(_w-2)}┄"} + for m in _mb._menus(TTkK.LEFT_ALIGN): m.mergeStyle(styleToMerge) + for m in _mb._menus(TTkK.RIGHT_ALIGN): m.mergeStyle(styleToMerge) + for m in _mb._menus(TTkK.CENTER_ALIGN): m.mergeStyle(styleToMerge) + _moff = 0 if _adj else -1 + _mb.setGeometry(_x+1,_y+_moff,_w-2,1) + _p.setGeometry(_x,_y+_adj,_w,_h-_adj) + + # x y w h _mb _adj _fix + _setGeometries( TTkAppTemplate.MAIN , pm, bm+sl+bl , bm+sh+bh+st+bt , newszw , newszh , mm, adjm, adjmf) + if pl: _setGeometries(TTkAppTemplate.LEFT , pl, bm , bm+sh+bh , sl , h-sh-bh-sf-bf , ml, adjl, adjlf) + if pr: _setGeometries(TTkAppTemplate.RIGHT , pr, bm+sl+bl+newszw+br , bm+sh+bh , sr , h-sh-bh-sf-bf , mr, adjr, adjrf) + if ph: _setGeometries(TTkAppTemplate.HEADER , ph, bm , bm , w , sh , mh, adjh, adjhf) + if pt: _setGeometries(TTkAppTemplate.TOP , pt, bm+sl+bl , bm+sh+bh , newszw , st , mt, adjt, adjtf) + if pb: _setGeometries(TTkAppTemplate.BOTTOM , pb, bm+sl+bl , bm+sh+bh+st+bt+newszh+bb , newszw , sb , mb, adjb, adjbf) + if pf: _setGeometries(TTkAppTemplate.FOOTER , pf, bm , bm+sh+bh+st+bt+newszh+bb+sb+bf , w , sf , mf, adjf, adjff) # Define Splitter geometries w,h = self.size() - spl[TTkAppTemplate.HEADER] = None if not bh else {'pos':(0 , bm+sh ) ,'size':w , 'fixed':fh } - spl[TTkAppTemplate.FOOTER] = None if not bf else {'pos':(0 , bm+sh+bh+st+bt+newszh+bb+sb) ,'size':w , 'fixed':ff } + spl[TTkAppTemplate.HEADER] = None if not bh else {'pos':(0 , bm+sh ) ,'size':w , 'fixed':fh , 'panel': ph } + spl[TTkAppTemplate.FOOTER] = None if not bf else {'pos':(0 , bm+sh+bh+st+bt+newszh+bb+sb) ,'size':w , 'fixed':ff , 'panel': pf } ca = sh + (bm if ph else 0 ) cb = bm+sh+bh+st+bt+newszh+bb+sb + (bf if pf else bm) - spl[TTkAppTemplate.LEFT] = None if not bl else {'pos':(bm+sl , ca ) ,'size':cb-ca , 'fixed':fl } - spl[TTkAppTemplate.RIGHT] = None if not br else {'pos':(bm+sl+bl+newszw , ca ) ,'size':cb-ca , 'fixed':fr } + spl[TTkAppTemplate.LEFT] = None if not bl else {'pos':(bm+sl , ca ) ,'size':cb-ca , 'fixed':fl , 'panel': pl } + spl[TTkAppTemplate.RIGHT] = None if not br else {'pos':(bm+sl+bl+newszw , ca ) ,'size':cb-ca , 'fixed':fr , 'panel': pr } ca = sl + (bm if pl else 0 ) cb = bm+sl+bl+newszw + (br if pr else bm) - spl[TTkAppTemplate.TOP] = None if not bt else {'pos':(ca , bm+sh+bh+st ) ,'size':cb-ca , 'fixed':ft } - spl[TTkAppTemplate.BOTTOM] = None if not bb else {'pos':(ca , bm+sh+bh+st+bt+newszh) ,'size':cb-ca , 'fixed':fb } + spl[TTkAppTemplate.TOP] = None if not bt else {'pos':(ca , bm+sh+bh+st ) ,'size':cb-ca , 'fixed':ft , 'panel': pt } + spl[TTkAppTemplate.BOTTOM] = None if not bb else {'pos':(ca , bm+sh+bh+st+bt+newszh) ,'size':cb-ca , 'fixed':fb , 'panel': pb } self.update() @@ -525,6 +635,7 @@ w,h = self.size() pns = self._panels spl = self._splitters + mbl = self._menubarLines if b:=pns[TTkAppTemplate.MAIN].border: canvas.drawBox(pos=(0,0), size=(w,h)) @@ -548,6 +659,12 @@ canvas.fill(pos=(_x,_y), size=(_w,_h), color=color, char=chs[0] ) canvas.drawChar(pos=(_x,_y), color=color, char=chs[1]if b and _x==0 else chs[3]) canvas.drawChar(pos=(_x+_w-1,_y), color=color, char=chs[2]if b and _x+_w==w else chs[4]) + if _title:=sp['panel'].title: + _l = min(w-2,_title.termWidth()) + _tx = (_w-_l)//2 + canvas.drawChar(pos=(_x+_tx,_y), color=color, char=chs[2]) + canvas.drawChar(pos=(_x+_tx+_l+1,_y),color=color, char=chs[1]) + canvas.drawTTkString(pos=(_x+_tx+1,_y),text=_title,width=_l) # Draw the 4 splittters if (sp:=spl[TTkAppTemplate.HEADER]) : drawHLine(sp, color=selectColor if self._selected and TTkAppTemplate.HEADER in self._selected else TTkColor.RST) @@ -574,6 +691,10 @@ drawIntersect(spl[TTkAppTemplate.BOTTOM], spl[TTkAppTemplate.LEFT] , ('├','╞','╟','╠')) drawIntersect(spl[TTkAppTemplate.BOTTOM], spl[TTkAppTemplate.RIGHT], ('┤','╡','╢','╣')) + # Draw extra MenuBar Lines if there is no border to place them + for l in mbl: + if mb:=mbl[l]: + canvas.drawText(pos=mb['pos'],text=mb['text']) return super().paintEvent(canvas)
diff --git a/_modules/TermTk/TTkWidgets/button.html b/_modules/TermTk/TTkWidgets/button.html index 3ca42c0d..c019bbea 100644 --- a/_modules/TermTk/TTkWidgets/button.html +++ b/_modules/TermTk/TTkWidgets/button.html @@ -3,7 +3,7 @@ - TermTk.TTkWidgets.button — pyTermTk 0.39.0-a + <title>TermTk.TTkWidgets.button — pyTermTk 0.40.0-a documentation diff --git a/_modules/TermTk/TTkWidgets/checkbox.html b/_modules/TermTk/TTkWidgets/checkbox.html index b2543b5b..8cc9197a 100644 --- a/_modules/TermTk/TTkWidgets/checkbox.html +++ b/_modules/TermTk/TTkWidgets/checkbox.html @@ -3,7 +3,7 @@ - TermTk.TTkWidgets.checkbox — pyTermTk 0.39.0-a + <title>TermTk.TTkWidgets.checkbox — pyTermTk 0.40.0-a documentation diff --git a/_modules/TermTk/TTkWidgets/combobox.html b/_modules/TermTk/TTkWidgets/combobox.html index 8436d459..34b520d4 100644 --- a/_modules/TermTk/TTkWidgets/combobox.html +++ b/_modules/TermTk/TTkWidgets/combobox.html @@ -3,7 +3,7 @@ - TermTk.TTkWidgets.combobox — pyTermTk 0.39.0-a + <title>TermTk.TTkWidgets.combobox — pyTermTk 0.40.0-a documentation diff --git a/_modules/TermTk/TTkWidgets/container.html b/_modules/TermTk/TTkWidgets/container.html index ba69debf..a8f9d8f1 100644 --- a/_modules/TermTk/TTkWidgets/container.html +++ b/_modules/TermTk/TTkWidgets/container.html @@ -3,7 +3,7 @@ - TermTk.TTkWidgets.container — pyTermTk 0.39.0-a + <title>TermTk.TTkWidgets.container — pyTermTk 0.40.0-a documentation @@ -504,7 +504,7 @@ def update(self, repaint: bool =True, updateLayout: bool =False, updateParent: bool =False): super().update(repaint=repaint, updateLayout=updateLayout, updateParent=updateParent) - if updateLayout and self.rootLayout() is not None: + if updateLayout and self.rootLayout() is not None and self.size() != (0,0): self.rootLayout().setGeometry(0,0,self._width,self._height) self.layout().setGeometry( self._padl, self._padt, diff --git a/_modules/TermTk/TTkWidgets/frame.html b/_modules/TermTk/TTkWidgets/frame.html index 9643464c..817b4439 100644 --- a/_modules/TermTk/TTkWidgets/frame.html +++ b/_modules/TermTk/TTkWidgets/frame.html @@ -3,7 +3,7 @@ - TermTk.TTkWidgets.frame — pyTermTk 0.39.0-a + <title>TermTk.TTkWidgets.frame — pyTermTk 0.40.0-a documentation diff --git a/_modules/TermTk/TTkWidgets/graph.html b/_modules/TermTk/TTkWidgets/graph.html index 2a4e4e1e..b0abbe4c 100644 --- a/_modules/TermTk/TTkWidgets/graph.html +++ b/_modules/TermTk/TTkWidgets/graph.html @@ -3,7 +3,7 @@ - TermTk.TTkWidgets.graph — pyTermTk 0.39.0-a + <title>TermTk.TTkWidgets.graph — pyTermTk 0.40.0-a documentation diff --git a/_modules/TermTk/TTkWidgets/image.html b/_modules/TermTk/TTkWidgets/image.html index e155cd3f..887a7431 100644 --- a/_modules/TermTk/TTkWidgets/image.html +++ b/_modules/TermTk/TTkWidgets/image.html @@ -3,7 +3,7 @@ - TermTk.TTkWidgets.image — pyTermTk 0.39.0-a + <title>TermTk.TTkWidgets.image — pyTermTk 0.40.0-a documentation @@ -260,7 +260,7 @@ return splitReduce(2) def _reduceSex(self, a,b,c,d,e,f): - # quadblitter notcurses like + # sexblitter notcurses like l = (a,b,c,d,e,f) def delta(i): return max(v[i] for v in l) - min(v[i] for v in l) diff --git a/_modules/TermTk/TTkWidgets/kodetab.html b/_modules/TermTk/TTkWidgets/kodetab.html index a5fd96a7..45a6f9da 100644 --- a/_modules/TermTk/TTkWidgets/kodetab.html +++ b/_modules/TermTk/TTkWidgets/kodetab.html @@ -3,7 +3,7 @@ - TermTk.TTkWidgets.kodetab — pyTermTk 0.39.0-a + <title>TermTk.TTkWidgets.kodetab — pyTermTk 0.40.0-a documentation @@ -297,7 +297,8 @@ self.tabBarClicked = pyTTkSignal(TTkTabWidget,int,TTkWidget,object) self.tabCloseRequested = pyTTkSignal(TTkTabWidget,int) super().__init__(**kwargs|{'layout':TTkGridLayout()}) - if 'parent' in kwargs: kwargs.pop('parent') + kwargs.pop('parent',None) + kwargs.pop('visible',None) # self.layout().addWidget(splitter := TTkSplitter()) self._lastKodeTabWidget = _TTkKodeTab(baseWidget=self, **kwargs) self.addWidget(self._lastKodeTabWidget) diff --git a/_modules/TermTk/TTkWidgets/label.html b/_modules/TermTk/TTkWidgets/label.html index 3ae2b2de..1c7d3e82 100644 --- a/_modules/TermTk/TTkWidgets/label.html +++ b/_modules/TermTk/TTkWidgets/label.html @@ -3,7 +3,7 @@ - TermTk.TTkWidgets.label — pyTermTk 0.39.0-a + <title>TermTk.TTkWidgets.label — pyTermTk 0.40.0-a documentation diff --git a/_modules/TermTk/TTkWidgets/lineedit.html b/_modules/TermTk/TTkWidgets/lineedit.html index 0bbf876e..cc1372ad 100644 --- a/_modules/TermTk/TTkWidgets/lineedit.html +++ b/_modules/TermTk/TTkWidgets/lineedit.html @@ -3,7 +3,7 @@ - TermTk.TTkWidgets.lineedit — pyTermTk 0.39.0-a + <title>TermTk.TTkWidgets.lineedit — pyTermTk 0.40.0-a documentation @@ -378,7 +378,7 @@ elif evt.key == TTkK.Key_X: self.cut() else: - return False + return super().keyEvent(evt) return True if evt.key == TTkK.Key_Left: diff --git a/_modules/TermTk/TTkWidgets/list_.html b/_modules/TermTk/TTkWidgets/list_.html index 22e3b64d..2c1b53bf 100644 --- a/_modules/TermTk/TTkWidgets/list_.html +++ b/_modules/TermTk/TTkWidgets/list_.html @@ -3,7 +3,7 @@ - TermTk.TTkWidgets.list_ — pyTermTk 0.39.0-a + <title>TermTk.TTkWidgets.list_ — pyTermTk 0.40.0-a documentation @@ -147,7 +147,8 @@ def __init__(self, *args, **kwargs): TTkAbstractScrollArea.__init__(self, *args, **kwargs) - if 'parent' in kwargs: kwargs.pop('parent') + kwargs.pop('parent',None) + kwargs.pop('visible',None) self._listView = kwargs.get('listWidget',TTkListWidget(*args, **kwargs)) self.setViewport(self._listView) self.itemClicked = self._listView.itemClicked diff --git a/_modules/TermTk/TTkWidgets/listwidget.html b/_modules/TermTk/TTkWidgets/listwidget.html index 1aa2eaa7..ffe62cf8 100644 --- a/_modules/TermTk/TTkWidgets/listwidget.html +++ b/_modules/TermTk/TTkWidgets/listwidget.html @@ -3,7 +3,7 @@ - TermTk.TTkWidgets.listwidget — pyTermTk 0.39.0-a + <title>TermTk.TTkWidgets.listwidget — pyTermTk 0.40.0-a documentation diff --git a/_modules/TermTk/TTkWidgets/menu.html b/_modules/TermTk/TTkWidgets/menu.html index 0ad556f9..a085cb7f 100644 --- a/_modules/TermTk/TTkWidgets/menu.html +++ b/_modules/TermTk/TTkWidgets/menu.html @@ -3,7 +3,7 @@ - TermTk.TTkWidgets.menu — pyTermTk 0.39.0-a + <title>TermTk.TTkWidgets.menu — pyTermTk 0.40.0-a documentation @@ -381,8 +381,7 @@ if not curBtn: curBtn = btns[0] else: - if (i := btns.index(curBtn)-1) >= 0: - curBtn = btns[i] + curBtn = btns[(btns.index(curBtn)-1)%len(btns)] curBtn.setHighlight(True) return True elif evt.key == TTkK.Key_Down: @@ -390,8 +389,7 @@ if not curBtn: curBtn = btns[0] else: - if (i := btns.index(curBtn)+1) < len(btns): - curBtn = btns[i] + curBtn = btns[(btns.index(curBtn)+1)%len(btns)] curBtn.setHighlight(True) return True elif evt.key == TTkK.Key_Left: diff --git a/_modules/TermTk/TTkWidgets/menubar.html b/_modules/TermTk/TTkWidgets/menubar.html index 31cc6143..703ff9c8 100644 --- a/_modules/TermTk/TTkWidgets/menubar.html +++ b/_modules/TermTk/TTkWidgets/menubar.html @@ -3,7 +3,7 @@ - TermTk.TTkWidgets.menubar — pyTermTk 0.39.0-a + <title>TermTk.TTkWidgets.menubar — pyTermTk 0.40.0-a documentation @@ -142,8 +142,11 @@
[docs]class TTkMenuBarButton(TTkMenuButton): classStyle = TTkMenuButton.classStyle | { - 'default': TTkMenuButton.classStyle['default'] | {'borderColor':TTkColor.RST, 'shortcutColor': TTkColor.fg("#dddddd") + TTkColor.UNDERLINE}, - 'clicked': TTkMenuButton.classStyle['clicked'] | {'color': TTkColor.fg("#ffff88")}, + 'default': TTkMenuButton.classStyle['default'] | + {'borderColor':TTkColor.RST, 'shortcutColor': TTkColor.fg("#dddddd") + TTkColor.UNDERLINE, + 'glyphs':('├','─','┤','┄','┄','▶')}, + 'clicked': TTkMenuButton.classStyle['clicked'] | + {'color': TTkColor.fg("#ffff88")}, } __slots__=('_shortcut') @@ -167,23 +170,20 @@
[docs] def paintEvent(self, canvas): style = self.currentStyle() borderColor = style['borderColor'] + glyphs = style['glyphs'] textColor = style['color'] scColor = style['shortcutColor'] if self._checkable: text = ('▣ ' if self._checked else '□ ') + self.text() - width = self.width()+2 else: text = self.text() - width = self.width() - canvas.drawMenuBarButton( - pos=(0,0),text=text, - width=width, - shortcuts=self._shortcut, - border=True, - submenu=len(self._submenu)>0, - color=textColor, - borderColor=borderColor, - shortcutColor=scColor )
+ + canvas.drawText(pos=(0,0), color=borderColor ,text=glyphs[2]) + canvas.drawText(pos=(1+text.termWidth(),0), color=borderColor ,text=glyphs[0]) + canvas.drawText(pos=(1,0), color=textColor ,text=text) + + for sc in self._shortcut: + canvas.drawChar(pos=(0,sc+1), char=text.charAt(sc), color=scColor)
[docs]class TTkMenuBarLayout(TTkHBoxLayout): '''TTkMenuBarLayout''' diff --git a/_modules/TermTk/TTkWidgets/radiobutton.html b/_modules/TermTk/TTkWidgets/radiobutton.html index ef1af82b..b61be1b8 100644 --- a/_modules/TermTk/TTkWidgets/radiobutton.html +++ b/_modules/TermTk/TTkWidgets/radiobutton.html @@ -3,7 +3,7 @@ - TermTk.TTkWidgets.radiobutton — pyTermTk 0.39.0-a + <title>TermTk.TTkWidgets.radiobutton — pyTermTk 0.40.0-a documentation @@ -184,11 +184,12 @@ __slots__ = ( '_checked', '_text', '_radiogroup', # Signals - 'clicked' + 'clicked', 'toggled' ) def __init__(self, *args, **kwargs): # Define Signals self.clicked = pyTTkSignal() + self.toggled = pyTTkSignal(bool) # use name if radiogroup is not available for retrocompatibility self._radiogroup = kwargs.get('name', 'DefaultGroup' ) self._radiogroup = kwargs.get('radiogroup', self._radiogroup ) @@ -262,6 +263,7 @@ self._checked = False else: self._checkEvent() + self.toggled.emit(self._checked) self.update()
[docs] def paintEvent(self, canvas): @@ -282,9 +284,8 @@ # Uncheck the radio already checked; for radio in TTkRadioButton._radioLists[self._radiogroup]: if self != radio != None: - if radio._checked: - radio._checked = False - radio.update() + if radio.isChecked(): + radio.setCheckState(TTkK.Unchecked) self._checked = True def _pressEvent(self): @@ -293,7 +294,8 @@ self.update()
[docs] def mousePressEvent(self, evt): - self._pressEvent() + self.setCheckState(TTkK.Checked) + self.clicked.emit() return True
[docs] def keyEvent(self, evt): diff --git a/_modules/TermTk/TTkWidgets/resizableframe.html b/_modules/TermTk/TTkWidgets/resizableframe.html index 5048056b..5bd537e5 100644 --- a/_modules/TermTk/TTkWidgets/resizableframe.html +++ b/_modules/TermTk/TTkWidgets/resizableframe.html @@ -3,7 +3,7 @@ - TermTk.TTkWidgets.resizableframe — pyTermTk 0.39.0-a + <title>TermTk.TTkWidgets.resizableframe — pyTermTk 0.40.0-a documentation diff --git a/_modules/TermTk/TTkWidgets/scrollarea.html b/_modules/TermTk/TTkWidgets/scrollarea.html index 2e24cfc5..9295ef9f 100644 --- a/_modules/TermTk/TTkWidgets/scrollarea.html +++ b/_modules/TermTk/TTkWidgets/scrollarea.html @@ -3,7 +3,7 @@ - TermTk.TTkWidgets.scrollarea — pyTermTk 0.39.0-a + <title>TermTk.TTkWidgets.scrollarea — pyTermTk 0.40.0-a documentation @@ -162,7 +162,8 @@ __slots__ = ('_areaView') def __init__(self, *args, **kwargs): TTkAbstractScrollArea.__init__(self, *args, **kwargs) - if 'parent' in kwargs: kwargs.pop('parent') + kwargs.pop('parent',None) + kwargs.pop('visible',None) self._areaView = _TTkAreaWidget(*args, **kwargs) self.setFocusPolicy(TTkK.ClickFocus) self.setViewport(self._areaView)
diff --git a/_modules/TermTk/TTkWidgets/scrollbar.html b/_modules/TermTk/TTkWidgets/scrollbar.html index 974a6627..cac63dc0 100644 --- a/_modules/TermTk/TTkWidgets/scrollbar.html +++ b/_modules/TermTk/TTkWidgets/scrollbar.html @@ -3,7 +3,7 @@ - TermTk.TTkWidgets.scrollbar — pyTermTk 0.39.0-a + <title>TermTk.TTkWidgets.scrollbar — pyTermTk 0.40.0-a documentation @@ -243,11 +243,12 @@
[docs] def mousePressEvent(self, evt): if self._orientation == TTkK.VERTICAL: size=self._height - mouse = evt.y + mouse = max(0,min(size,evt.y)) else: size=self._width - mouse = evt.x + mouse = max(0,min(size,evt.x)) + self._draggable = False if mouse == 0: # left/up arrow pressed self.setValue(self._value - self._singleStep) elif mouse == size-1: # right/down arrow pressed @@ -261,19 +262,17 @@ self._draggable = True else: return False - self.setValue(max(self._minimum,min(self._maximum,self._value))) self.sliderMoved.emit(self._value) - # TTkLog.debug(f"m={mouse}, md:{self._mouseDelta}, d:{self._screenPgDown},u:{self._screenPgUp},s:{self._screenScroller}") return True
[docs] def mouseDragEvent(self, evt): if not self._draggable: return False if self._orientation == TTkK.VERTICAL: size=self._height - mouse = evt.y + mouse = max(0,min(size,evt.y)) else: size=self._width - mouse = evt.x + mouse = max(0,min(size,evt.x)) aa = mouse-self._mouseDelta size2 = size-2 diff --git a/_modules/TermTk/TTkWidgets/slider.html b/_modules/TermTk/TTkWidgets/slider.html new file mode 100644 index 00000000..ea3e5565 --- /dev/null +++ b/_modules/TermTk/TTkWidgets/slider.html @@ -0,0 +1,281 @@ + + + + + + TermTk.TTkWidgets.slider — pyTermTk 0.40.0-a + documentation + + + + + + + + + + + + + + + + + + +
+ + +
+ +
+
+
+
    +
  • »
  • +
  • Module code »
  • +
  • TermTk.TTkWidgets.slider
  • +
  • +
  • +
+
+
+
+
+ +

Source code for TermTk.TTkWidgets.slider

+# 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']
+
+from TermTk.TTkCore.log import TTkLog
+from TermTk.TTkCore.constant import TTkK
+from TermTk.TTkCore.canvas import TTkCanvas
+from TermTk.TTkCore.string import TTkString
+from TermTk.TTkCore.signal import pyTTkSlot, pyTTkSignal
+from TermTk.TTkCore.color import TTkColor
+from TermTk.TTkWidgets.scrollbar import TTkScrollBar
+
+'''
+    ref: https://doc.qt.io/qt-5/qslider.html
+'''
+
[docs]class TTkSlider(TTkScrollBar): + '''TtkSlider''' + + classStyle = { + 'default': { + 'color': TTkColor.RST, + 'sliderColor': TTkColor.fg('#6666bb')}, + 'disabled': { + 'color': TTkColor.fg('#666666'), + 'sliderColor': TTkColor.fg('#888888')}, + 'focus': { + 'color': TTkColor.fg('#cccc00'), + 'sliderColor': TTkColor.fg('#8888ff')}, + } + +
[docs] def wheelEvent(self, evt): + if self._orientation == TTkK.VERTICAL: + if evt.evt == TTkK.WHEEL_Up: value = self._value+self._pageStep + else: value = self._value-self._pageStep + else: + if evt.evt == TTkK.WHEEL_Up: value = self._value-self._pageStep + else: value = self._value+self._pageStep + self.setValue(max(self._minimum,min(self._maximum,value))) + self.sliderMoved.emit(self._value) + return True
+ +
[docs] def mousePressEvent(self, evt): + if self._orientation == TTkK.VERTICAL: + size=self._height-1 + mouse = max(0,min(size,size-evt.y)) + else: + size=self._width-1 + mouse = max(0,min(size,evt.x)) + + self._draggable = False + if self._maximum > self._minimum: + smin = self._minimum + smax = self._maximum + sval = self._value + sliderPos = int(0.5+size*(sval-smin)/(smax-smin)) + if mouse < sliderPos: + self.setValue(self._value - self._pageStep) + elif mouse > sliderPos: + self.setValue(self._value + self._pageStep) + else: + self._draggable = True + + self.sliderMoved.emit(self._value) + return True
+ +
[docs] def mouseDragEvent(self, evt): + if not self._draggable: return False + if self._orientation == TTkK.VERTICAL: + size=self._height-1 + mouse = max(0,min(size,size-evt.y)) + else: + size=self._width-1 + mouse = max(0,min(size,evt.x)) + + if self._maximum > self._minimum: + smin = self._minimum + smax = self._maximum + val = int(0.5+smin+(smax-smin)*mouse/size) + if val != self._value: + self.setValue(val) + self.sliderMoved.emit(self._value) + return True
+ + + ''' + ╞═══════════╬═════╡ + + ''' +
[docs] def paintEvent(self, canvas:TTkCanvas): + style = self.currentStyle() + color = style['color'] + sliderColor = style['sliderColor'] + + if self._orientation == TTkK.VERTICAL: + size=self._height-1 + else: + size=self._width-1 + + if self._maximum > self._minimum: + smin = self._minimum + smax = self._maximum + sval = self._value + sliderPos = int(0.5+size*(sval-smin)/(smax-smin)) + else: + # Special case where no scroll is needed + sliderPos = size//2 + + if self._orientation == TTkK.VERTICAL: + canvas.drawChar(pos=(0,0),char='┬',color=color) + for y in range(1,size-sliderPos): + canvas.drawChar(pos=(0,y),char='┊',color=color) + if sliderPos>0: + canvas.drawChar(pos=(0,size-sliderPos),char='╦',color=sliderColor) + for y in range(size-sliderPos+1,size): + canvas.drawChar(pos=(0,y),char='║',color=sliderColor) + canvas.drawChar(pos=(0,size),char='╨',color=sliderColor) + else: + canvas.drawTTkString(pos=(0,size),text=TTkString(f"╧",sliderColor)) + else: + canvas.drawTTkString(pos=(0,0),text=TTkString(f"{'┄'*(size)}┤",color)) + if sliderPos>0: + canvas.drawTTkString(pos=(0,0),text=TTkString(f"╞{'═'*(sliderPos-1)}╣",sliderColor)) + else: + canvas.drawTTkString(pos=(0,0),text=TTkString(f"║",sliderColor))
+
+ +
+
+
+ +
+ +
+

© Copyright 2021, Eugenio Parodi.

+
+ + Built with Sphinx using a + theme + provided by Read the Docs. + + +
+
+
+
+
+ + + + \ No newline at end of file diff --git a/_modules/TermTk/TTkWidgets/spacer.html b/_modules/TermTk/TTkWidgets/spacer.html index 07c7b251..086e6d18 100644 --- a/_modules/TermTk/TTkWidgets/spacer.html +++ b/_modules/TermTk/TTkWidgets/spacer.html @@ -3,7 +3,7 @@ - TermTk.TTkWidgets.spacer — pyTermTk 0.39.0-a + <title>TermTk.TTkWidgets.spacer — pyTermTk 0.40.0-a documentation diff --git a/_modules/TermTk/TTkWidgets/spinbox.html b/_modules/TermTk/TTkWidgets/spinbox.html index 0892a766..8b66a518 100644 --- a/_modules/TermTk/TTkWidgets/spinbox.html +++ b/_modules/TermTk/TTkWidgets/spinbox.html @@ -3,7 +3,7 @@ - TermTk.TTkWidgets.spinbox — pyTermTk 0.39.0-a + <title>TermTk.TTkWidgets.spinbox — pyTermTk 0.40.0-a documentation @@ -207,9 +207,20 @@ self._maximum = maximum self.setValue(self._value)
+ @staticmethod + def _isFloat(num): + try: + float(str(num)) + return True + except: + return False + @pyTTkSlot(str) def _textEdited(self, text): - self.setValue(int(str(text))) + if self._isFloat(text): + self.setValue(float(str(text))) + else: + self.setValue(int(str(text))) self._lineEdit.setText(str(self._value))
[docs] def wheelEvent(self, evt): diff --git a/_modules/TermTk/TTkWidgets/splitter.html b/_modules/TermTk/TTkWidgets/splitter.html index 67a97646..0165abba 100644 --- a/_modules/TermTk/TTkWidgets/splitter.html +++ b/_modules/TermTk/TTkWidgets/splitter.html @@ -3,7 +3,7 @@ - TermTk.TTkWidgets.splitter — pyTermTk 0.39.0-a + <title>TermTk.TTkWidgets.splitter — pyTermTk 0.40.0-a documentation diff --git a/_modules/TermTk/TTkWidgets/tabwidget.html b/_modules/TermTk/TTkWidgets/tabwidget.html index bd70dc57..fe51dfe7 100644 --- a/_modules/TermTk/TTkWidgets/tabwidget.html +++ b/_modules/TermTk/TTkWidgets/tabwidget.html @@ -3,7 +3,7 @@ - TermTk.TTkWidgets.tabwidget — pyTermTk 0.39.0-a + <title>TermTk.TTkWidgets.tabwidget — pyTermTk 0.40.0-a documentation diff --git a/_modules/TermTk/TTkWidgets/texedit.html b/_modules/TermTk/TTkWidgets/texedit.html index d900e404..81eae332 100644 --- a/_modules/TermTk/TTkWidgets/texedit.html +++ b/_modules/TermTk/TTkWidgets/texedit.html @@ -3,7 +3,7 @@ - TermTk.TTkWidgets.texedit — pyTermTk 0.39.0-a + <title>TermTk.TTkWidgets.texedit — pyTermTk 0.40.0-a documentation @@ -137,6 +137,7 @@ from TermTk.TTkCore.cfg import TTkCfg from TermTk.TTkCore.string import TTkString from TermTk.TTkCore.signal import pyTTkSignal, pyTTkSlot +from TermTk.TTkCore.TTkTerm.inputkey import TTkKeyEvent from TermTk.TTkGui.clipboard import TTkClipboard from TermTk.TTkGui.textwrap1 import TTkTextWrap from TermTk.TTkGui.textcursor import TTkTextCursor @@ -254,7 +255,7 @@ self.undoAvailable = pyTTkSignal(bool) self.redoAvailable = pyTTkSignal(bool) self.textChanged = pyTTkSignal() - self._readOnly = kwargs.get('readOnly', True) + self._readOnly = kwargs.get('readOnly', False) self._multiLine = kwargs.get('multiLine', True) self._multiCursor = True self._hsize = 0 @@ -324,11 +325,11 @@ return self._textDocument.isRedoAvailable() return False
-
[docs] def document(self): +
[docs] def document(self) -> TTkTextDocument: '''document''' return self._textDocument
-
[docs] def setDocument(self, document): +
[docs] def setDocument(self, document:TTkTextDocument): '''setDocument''' if self._textDocument: self._textDocument.contentsChanged.disconnect(self._documentChanged) @@ -354,7 +355,7 @@ def wordWrapMode(self, *args, **kwargs): return self._textWrap.wordWrapMode(*args, **kwargs) def setWordWrapMode(self, *args, **kwargs): return self._textWrap.setWordWrapMode(*args, **kwargs) - def textCursor(self): + def textCursor(self) -> TTkTextCursor: return self._textCursor def isReadOnly(self) -> bool : @@ -445,6 +446,7 @@ def _cursorPositionChanged(self, cursor): if cursor == self._textCursor: self.currentColorChanged.emit(cursor.positionColor()) + self._pushCursor()
[docs] def resizeEvent(self, w, h): if ( self.lineWrapMode() == TTkK.WidgetWidth and @@ -595,6 +597,9 @@ # TTkLog.debug(f"Saving {self._textCursor.selectedText()} {self._textCursor._properties[0].anchor.pos}") self._textDocument.saveSnapshot(self._textCursor.copy()) + if evt.key == TTkK.Key_Tab and evt.mod==TTkK.NoModifier: + evt = TTkKeyEvent(TTkK.Character, '\t', '\t', TTkK.NoModifier) + if evt.type == TTkK.SpecialKey: _,_,w,h = self.geometry() @@ -612,9 +617,6 @@ ctrl = evt.mod==TTkK.ControlModifier - if evt.key == TTkK.Key_Tab: - # Don't Handle the special tab key, for now - return False if ctrl: p = self._textCursor.position() cx, cy = self._textWrap.dataToScreenPosition(p.line, p.pos) @@ -634,6 +636,8 @@ self.undo() elif evt.key == TTkK.Key_Y: self.redo() + elif evt.key == TTkK.Key_A: + self._textCursor.select(TTkTextCursor.SelectionType.Document) elif evt.key == TTkK.Key_Up: self._textCursor.movePosition(moveMode=moveMode, operation=TTkTextCursor.Up, textWrap=self._textWrap) self._textCursor.clearColor() @@ -675,6 +679,9 @@ elif evt.key == TTkK.Key_Enter: if self._multiLine: self._textCursor.insertText('\n', moveCursor=True) + else: + # No action performed + return super().keyEvent(evt) # Scroll to align to the cursor p = 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' in kwargs: kwargs.pop('parent') + kwargs.pop('parent', None) + kwargs.pop('visible', None) self._textEditView = textEditView if textEditView else TTkTextEditView(**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 + <title>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): #Signals self.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' in kwargs: + self.setStyle(kwargs['style']) + if 'addStyle' in kwargs: + self.mergeStyle(kwargs['addStyle']) self._canvas = TTkCanvas( width = self._width , @@ -632,7 +641,7 @@ def hasFocus(self): return self._focus - def getCanvas(self): + def getCanvas(self) -> TTkCanvas: return self._canvas def focusPolicy(self): @@ -686,7 +695,7 @@ _S_RELEASED = 0x40 def style(self): - return self._style + return self._style.copy() def currentStyle(self): return self._currentStyle @@ -697,7 +706,9 @@ self.currentStyleChanged.emit(style) self.update() - def setStyle(self, style): + def setStyle(self, style=None): + if not style: + style = self.classStyle.copy() if 'default' not in style: # find the closest subclass/parent holding the style styleType = TTkWidget @@ -715,6 +726,11 @@ def mergeStyle(self, style): cs = None + # for field in style: + # if field in self._style: + # mergeStyle[field] = defaultStyle | self._style[field] | style[field] + # else: + # mergeStyle[field] = defaultStyle for t in self._style: if self._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 + <title>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 + <title>Overview: module code — pyTermTk 0.40.0-a documentation @@ -106,6 +106,7 @@

All modules for which code is available

  • TermTk.TTkAbstract.abstractscrollarea
  • TermTk.TTkAbstract.abstractscrollview
  • +
  • TermTk.TTkAbstract.abstracttablemodel
  • TermTk.TTkCore.TTkTerm.inputkey
  • TermTk.TTkCore.TTkTerm.inputmouse
  • TermTk.TTkCore.canvas
  • @@ -113,10 +114,12 @@
  • TermTk.TTkCore.constant
  • TermTk.TTkCore.drivers.windows
  • TermTk.TTkCore.helper
  • +
  • TermTk.TTkCore.shortcut
  • TermTk.TTkCore.signal
  • TermTk.TTkCore.string
  • TermTk.TTkCore.timer_unix
  • TermTk.TTkCore.ttk
  • +
  • TermTk.TTkCrossTools.savetools
  • TermTk.TTkGui.clipboard
  • TermTk.TTkGui.textdocument
  • TermTk.TTkLayouts.boxlayout
  • @@ -139,6 +142,10 @@
  • TermTk.TTkWidgets.Fancy.treewidget
  • TermTk.TTkWidgets.TTkModelView.filetree
  • TermTk.TTkWidgets.TTkModelView.filetreewidget
  • +
  • TermTk.TTkWidgets.TTkModelView.table
  • +
  • TermTk.TTkWidgets.TTkModelView.tablemodelcsv
  • +
  • TermTk.TTkWidgets.TTkModelView.tablemodellist
  • +
  • TermTk.TTkWidgets.TTkModelView.tablewidget
  • TermTk.TTkWidgets.TTkModelView.tree
  • TermTk.TTkWidgets.TTkModelView.treewidget
  • TermTk.TTkWidgets.TTkPickers.colorpicker
  • @@ -169,6 +176,7 @@
  • TermTk.TTkWidgets.resizableframe
  • TermTk.TTkWidgets.scrollarea
  • TermTk.TTkWidgets.scrollbar
  • +
  • TermTk.TTkWidgets.slider
  • TermTk.TTkWidgets.spacer
  • TermTk.TTkWidgets.spinbox
  • TermTk.TTkWidgets.splitter
  • diff --git a/_sources/autogen.TermTk/TermTk.TTkAbstract.abstracttablemodel.rst.txt b/_sources/autogen.TermTk/TermTk.TTkAbstract.abstracttablemodel.rst.txt new file mode 100644 index 00000000..ff8ec034 --- /dev/null +++ b/_sources/autogen.TermTk/TermTk.TTkAbstract.abstracttablemodel.rst.txt @@ -0,0 +1,24 @@ + +TermTk.TTkAbstract.abstracttablemodel +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. automodule:: TermTk.TTkAbstract.abstracttablemodel + +.. currentmodule:: TermTk.TTkAbstract.abstracttablemodel + + + +TTkModelIndex +============= + +.. autoclass:: TTkModelIndex + :members: + :inherited-members: + + +TTkAbstractTableModel +===================== + +.. autoclass:: TTkAbstractTableModel + :members: + :inherited-members: diff --git a/_sources/autogen.TermTk/TermTk.TTkAbstract.rst.txt b/_sources/autogen.TermTk/TermTk.TTkAbstract.rst.txt index a4c72b97..345a5bc6 100644 --- a/_sources/autogen.TermTk/TermTk.TTkAbstract.rst.txt +++ b/_sources/autogen.TermTk/TermTk.TTkAbstract.rst.txt @@ -12,4 +12,5 @@ TermTk.TTkAbstract TermTk.TTkAbstract.abstractitemmodel TermTk.TTkAbstract.abstractscrollarea - TermTk.TTkAbstract.abstractscrollview \ No newline at end of file + TermTk.TTkAbstract.abstractscrollview + TermTk.TTkAbstract.abstracttablemodel \ No newline at end of file diff --git a/_sources/autogen.TermTk/TermTk.TTkCore.shortcut.rst.txt b/_sources/autogen.TermTk/TermTk.TTkCore.shortcut.rst.txt index b7d36782..c9c915b3 100644 --- a/_sources/autogen.TermTk/TermTk.TTkCore.shortcut.rst.txt +++ b/_sources/autogen.TermTk/TermTk.TTkCore.shortcut.rst.txt @@ -6,3 +6,11 @@ TermTk.TTkCore.shortcut .. currentmodule:: TermTk.TTkCore.shortcut + + +TTkShortcut +=========== + +.. autoclass:: TTkShortcut + :members: + :inherited-members: diff --git a/_sources/autogen.TermTk/TermTk.TTkCrossTools.rst.txt b/_sources/autogen.TermTk/TermTk.TTkCrossTools.rst.txt new file mode 100644 index 00000000..d6569328 --- /dev/null +++ b/_sources/autogen.TermTk/TermTk.TTkCrossTools.rst.txt @@ -0,0 +1,13 @@ + +TermTk.TTkCrossTools +~~~~~~~~~~~~~~~~~~~~ + +.. automodule:: TermTk.TTkCrossTools + +.. currentmodule:: TermTk.TTkCrossTools + + +.. autosummary:: + :toctree: ./ + + TermTk.TTkCrossTools.savetools \ No newline at end of file diff --git a/_sources/autogen.TermTk/TermTk.TTkCrossTools.savetools.rst.txt b/_sources/autogen.TermTk/TermTk.TTkCrossTools.savetools.rst.txt new file mode 100644 index 00000000..9766af7e --- /dev/null +++ b/_sources/autogen.TermTk/TermTk.TTkCrossTools.savetools.rst.txt @@ -0,0 +1,16 @@ + +TermTk.TTkCrossTools.savetools +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. automodule:: TermTk.TTkCrossTools.savetools + +.. currentmodule:: TermTk.TTkCrossTools.savetools + + + +TTkEncoding +=========== + +.. autoclass:: TTkEncoding + :members: + :inherited-members: diff --git a/_sources/autogen.TermTk/TermTk.TTkUiTools.properties.rst.txt b/_sources/autogen.TermTk/TermTk.TTkUiTools.properties.rst.txt index e8d727a5..d1dc4594 100644 --- a/_sources/autogen.TermTk/TermTk.TTkUiTools.properties.rst.txt +++ b/_sources/autogen.TermTk/TermTk.TTkUiTools.properties.rst.txt @@ -32,6 +32,7 @@ TermTk.TTkUiTools.properties TermTk.TTkUiTools.properties.resizableframe TermTk.TTkUiTools.properties.scrollarea TermTk.TTkUiTools.properties.scrollbar + TermTk.TTkUiTools.properties.slider TermTk.TTkUiTools.properties.spacer TermTk.TTkUiTools.properties.spinbox TermTk.TTkUiTools.properties.splitter diff --git a/_sources/autogen.TermTk/TermTk.TTkUiTools.properties.slider.rst.txt b/_sources/autogen.TermTk/TermTk.TTkUiTools.properties.slider.rst.txt new file mode 100644 index 00000000..b152b64f --- /dev/null +++ b/_sources/autogen.TermTk/TermTk.TTkUiTools.properties.slider.rst.txt @@ -0,0 +1,8 @@ + +TermTk.TTkUiTools.properties.slider +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. automodule:: TermTk.TTkUiTools.properties.slider + +.. currentmodule:: TermTk.TTkUiTools.properties.slider + diff --git a/_sources/autogen.TermTk/TermTk.TTkWidgets.TTkModelView.rst.txt b/_sources/autogen.TermTk/TermTk.TTkWidgets.TTkModelView.rst.txt index 9b5b2a48..74c5b350 100644 --- a/_sources/autogen.TermTk/TermTk.TTkWidgets.TTkModelView.rst.txt +++ b/_sources/autogen.TermTk/TermTk.TTkWidgets.TTkModelView.rst.txt @@ -13,6 +13,11 @@ TermTk.TTkWidgets.TTkModelView TermTk.TTkWidgets.TTkModelView.filetree TermTk.TTkWidgets.TTkModelView.filetreewidget TermTk.TTkWidgets.TTkModelView.filetreewidgetitem + TermTk.TTkWidgets.TTkModelView.table + TermTk.TTkWidgets.TTkModelView.tablemodelcsv + TermTk.TTkWidgets.TTkModelView.tablemodellist + TermTk.TTkWidgets.TTkModelView.tablewidget + TermTk.TTkWidgets.TTkModelView.tablewidgetitem TermTk.TTkWidgets.TTkModelView.tree TermTk.TTkWidgets.TTkModelView.treewidget TermTk.TTkWidgets.TTkModelView.treewidgetitem \ No newline at end of file diff --git a/_sources/autogen.TermTk/TermTk.TTkWidgets.TTkModelView.table.rst.txt b/_sources/autogen.TermTk/TermTk.TTkWidgets.TTkModelView.table.rst.txt new file mode 100644 index 00000000..031a6c20 --- /dev/null +++ b/_sources/autogen.TermTk/TermTk.TTkWidgets.TTkModelView.table.rst.txt @@ -0,0 +1,16 @@ + +TermTk.TTkWidgets.TTkModelView.table +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. automodule:: TermTk.TTkWidgets.TTkModelView.table + +.. currentmodule:: TermTk.TTkWidgets.TTkModelView.table + + + +TTkTable +======== + +.. autoclass:: TTkTable + :members: + :inherited-members: diff --git a/_sources/autogen.TermTk/TermTk.TTkWidgets.TTkModelView.tablemodelcsv.rst.txt b/_sources/autogen.TermTk/TermTk.TTkWidgets.TTkModelView.tablemodelcsv.rst.txt new file mode 100644 index 00000000..2ee7970e --- /dev/null +++ b/_sources/autogen.TermTk/TermTk.TTkWidgets.TTkModelView.tablemodelcsv.rst.txt @@ -0,0 +1,16 @@ + +TermTk.TTkWidgets.TTkModelView.tablemodelcsv +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. automodule:: TermTk.TTkWidgets.TTkModelView.tablemodelcsv + +.. currentmodule:: TermTk.TTkWidgets.TTkModelView.tablemodelcsv + + + +TTkTableModelCSV +================ + +.. autoclass:: TTkTableModelCSV + :members: + :inherited-members: diff --git a/_sources/autogen.TermTk/TermTk.TTkWidgets.TTkModelView.tablemodellist.rst.txt b/_sources/autogen.TermTk/TermTk.TTkWidgets.TTkModelView.tablemodellist.rst.txt new file mode 100644 index 00000000..737440e9 --- /dev/null +++ b/_sources/autogen.TermTk/TermTk.TTkWidgets.TTkModelView.tablemodellist.rst.txt @@ -0,0 +1,16 @@ + +TermTk.TTkWidgets.TTkModelView.tablemodellist +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. automodule:: TermTk.TTkWidgets.TTkModelView.tablemodellist + +.. currentmodule:: TermTk.TTkWidgets.TTkModelView.tablemodellist + + + +TTkTableModelList +================= + +.. autoclass:: TTkTableModelList + :members: + :inherited-members: diff --git a/_sources/autogen.TermTk/TermTk.TTkWidgets.TTkModelView.tablewidget.rst.txt b/_sources/autogen.TermTk/TermTk.TTkWidgets.TTkModelView.tablewidget.rst.txt new file mode 100644 index 00000000..2c87aff6 --- /dev/null +++ b/_sources/autogen.TermTk/TermTk.TTkWidgets.TTkModelView.tablewidget.rst.txt @@ -0,0 +1,24 @@ + +TermTk.TTkWidgets.TTkModelView.tablewidget +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. automodule:: TermTk.TTkWidgets.TTkModelView.tablewidget + +.. currentmodule:: TermTk.TTkWidgets.TTkModelView.tablewidget + + + +TTkHeaderView +============= + +.. autoclass:: TTkHeaderView + :members: + :inherited-members: + + +TTkTableWidget +============== + +.. autoclass:: TTkTableWidget + :members: + :inherited-members: diff --git a/_sources/autogen.TermTk/TermTk.TTkWidgets.TTkModelView.tablewidgetitem.rst.txt b/_sources/autogen.TermTk/TermTk.TTkWidgets.TTkModelView.tablewidgetitem.rst.txt new file mode 100644 index 00000000..81ef9500 --- /dev/null +++ b/_sources/autogen.TermTk/TermTk.TTkWidgets.TTkModelView.tablewidgetitem.rst.txt @@ -0,0 +1,8 @@ + +TermTk.TTkWidgets.TTkModelView.tablewidgetitem +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. automodule:: TermTk.TTkWidgets.TTkModelView.tablewidgetitem + +.. currentmodule:: TermTk.TTkWidgets.TTkModelView.tablewidgetitem + diff --git a/_sources/autogen.TermTk/TermTk.TTkWidgets.rst.txt b/_sources/autogen.TermTk/TermTk.TTkWidgets.rst.txt index c29dfcf7..edd4c77a 100644 --- a/_sources/autogen.TermTk/TermTk.TTkWidgets.rst.txt +++ b/_sources/autogen.TermTk/TermTk.TTkWidgets.rst.txt @@ -34,6 +34,7 @@ TermTk.TTkWidgets TermTk.TTkWidgets.resizableframe TermTk.TTkWidgets.scrollarea TermTk.TTkWidgets.scrollbar + TermTk.TTkWidgets.slider TermTk.TTkWidgets.spacer TermTk.TTkWidgets.spinbox TermTk.TTkWidgets.splitter diff --git a/_sources/autogen.TermTk/TermTk.TTkWidgets.slider.rst.txt b/_sources/autogen.TermTk/TermTk.TTkWidgets.slider.rst.txt new file mode 100644 index 00000000..dcb0b41d --- /dev/null +++ b/_sources/autogen.TermTk/TermTk.TTkWidgets.slider.rst.txt @@ -0,0 +1,16 @@ + +TermTk.TTkWidgets.slider +~~~~~~~~~~~~~~~~~~~~~~~~ + +.. automodule:: TermTk.TTkWidgets.slider + +.. currentmodule:: TermTk.TTkWidgets.slider + + + +TTkSlider +========= + +.. autoclass:: TTkSlider + :members: + :inherited-members: diff --git a/_sources/autogen.TermTk/TermTk.rst.txt b/_sources/autogen.TermTk/TermTk.rst.txt index 0fba5c0b..03d6fde4 100644 --- a/_sources/autogen.TermTk/TermTk.rst.txt +++ b/_sources/autogen.TermTk/TermTk.rst.txt @@ -12,6 +12,7 @@ TermTk TermTk.TTkAbstract TermTk.TTkCore + TermTk.TTkCrossTools TermTk.TTkGui TermTk.TTkLayouts TermTk.TTkTemplates diff --git a/_sources/info/features/widgets.rst.txt b/_sources/info/features/widgets.rst.txt index 8f7ec24f..41c49a37 100644 --- a/_sources/info/features/widgets.rst.txt +++ b/_sources/info/features/widgets.rst.txt @@ -53,6 +53,10 @@ Model View .. image:: https://ceccopierangiolieugenio.github.io/binaryRepo/pyTermTk/images/pyTermTk.Widgets.TreeWidget.ttkDesigner.gif * Tree Widget :class:`~TermTk.TTkWidgets.TTkModelView.tree.TTkTree` +.. image:: https://ceccopierangiolieugenio.github.io/binaryRepo/pyTermTk/images/pyTermTk.Widgets.TableWidget.01.gif +.. image:: https://ceccopierangiolieugenio.github.io/binaryRepo/pyTermTk/images/pyTermTk.Widgets.TableWidget.02.gif +* Table Widget :class:`~TermTk.TTkWidgets.TTkModelView.table.TTkTable` + .. image:: https://ceccopierangiolieugenio.github.io/binaryRepo/pyTermTk/images/pyTermTk.Widgets.FileTree.gif * File Tree :class:`~TermTk.TTkWidgets.TTkModelView.filetree.TTkFileTree` diff --git a/_sources/info/installing.rst.txt b/_sources/info/installing.rst.txt index 9c2f9252..d704b644 100644 --- a/_sources/info/installing.rst.txt +++ b/_sources/info/installing.rst.txt @@ -46,6 +46,13 @@ User Install # Clear/Erase/GetRidOf the venv rm -rf .venv +Windows10 Install +~~~~~~~~~~~~~~~~~ + +.. raw:: html + + + .. _install-copy: diff --git a/_sources/tutorial/000-examples.rst.txt b/_sources/tutorial/000-examples.rst.txt index bfcf5a95..6144aee7 100644 --- a/_sources/tutorial/000-examples.rst.txt +++ b/_sources/tutorial/000-examples.rst.txt @@ -54,6 +54,42 @@ TTkTerminal `TTkTerminal/TerminalTab.04.KodeTab.close.py `_ +TTkTable +======== + +`TTkTable/table.01.basic.py `_ +(`tryItOnline `_): + +`TTkTable/table.02.custom.model.01.py `_ +(`tryItOnline `_): + +`TTkTable/table.02.custom.model.02.py `_ +(`tryItOnline `_): + +`TTkTable/table.02.custom.model.03.py `_ +(`tryItOnline `_): + +`TTkTable/table.03.theming.color.01.py `_ +(`tryItOnline `_): + +`TTkTable/table.03.theming.color.02.py `_ +(`tryItOnline `_): + +`TTkTable/table.03.theming.color.03.py `_ +(`tryItOnline `_): + +`TTkTable/table.03.theming.headers.01.py `_ +(`tryItOnline `_): + +`TTkTable/table.03.theming.lines.01.py `_ +(`tryItOnline `_): + +`TTkTable/table.04.methods.py `_ +(`tryItOnline `_): + +`TTkTable/table.05.events.py `_ +(`tryItOnline `_): + TTkTextEdit =========== diff --git a/_sources/tutorial/examples/README.rst.txt b/_sources/tutorial/examples/README.rst.txt index bfcf5a95..6144aee7 100644 --- a/_sources/tutorial/examples/README.rst.txt +++ b/_sources/tutorial/examples/README.rst.txt @@ -54,6 +54,42 @@ TTkTerminal `TTkTerminal/TerminalTab.04.KodeTab.close.py `_ +TTkTable +======== + +`TTkTable/table.01.basic.py `_ +(`tryItOnline `_): + +`TTkTable/table.02.custom.model.01.py `_ +(`tryItOnline `_): + +`TTkTable/table.02.custom.model.02.py `_ +(`tryItOnline `_): + +`TTkTable/table.02.custom.model.03.py `_ +(`tryItOnline `_): + +`TTkTable/table.03.theming.color.01.py `_ +(`tryItOnline `_): + +`TTkTable/table.03.theming.color.02.py `_ +(`tryItOnline `_): + +`TTkTable/table.03.theming.color.03.py `_ +(`tryItOnline `_): + +`TTkTable/table.03.theming.headers.01.py `_ +(`tryItOnline `_): + +`TTkTable/table.03.theming.lines.01.py `_ +(`tryItOnline `_): + +`TTkTable/table.04.methods.py `_ +(`tryItOnline `_): + +`TTkTable/table.05.events.py `_ +(`tryItOnline `_): + TTkTextEdit =========== diff --git a/_sources/tutorial/ttkDesigner/textEdit/README.rst.txt b/_sources/tutorial/ttkDesigner/textEdit/README.rst.txt index 826834e0..0236f5bf 100644 --- a/_sources/tutorial/ttkDesigner/textEdit/README.rst.txt +++ b/_sources/tutorial/ttkDesigner/textEdit/README.rst.txt @@ -1,6 +1,6 @@ .. _pyTermTk: https://github.com/ceccopierangiolieugenio/pyTermTk .. _TermTk: https://github.com/ceccopierangiolieugenio/pyTermTk -.. _ttkDesigner: https://github.com/ceccopierangiolieugenio/pyTermTk/tree/main/ttkDesigner +.. _ttkDesigner: https://github.com/ceccopierangiolieugenio/pyTermTk/tree/main/tools/ttkDesigner .. _Widget: https://ceccopierangiolieugenio.github.io/pyTermTk/autogen.TermTk/TermTk.TTkWidgets.widget.html .. _Textedit: https://ceccopierangiolieugenio.github.io/pyTermTk/autogen.TermTk/TermTk.TTkWidgets.texedit.html diff --git a/_static/documentation_options.js b/_static/documentation_options.js index 08d61ba6..05473aee 100644 --- a/_static/documentation_options.js +++ b/_static/documentation_options.js @@ -1,6 +1,6 @@ var DOCUMENTATION_OPTIONS = { URL_ROOT: document.getElementById("documentation_options").getAttribute('data-url_root'), - VERSION: '0.39.0-a', + VERSION: '0.40.0-a', LANGUAGE: 'en', COLLAPSE_INDEX: false, BUILDER: 'html', diff --git a/autogen.TermTk/TermTk.TTkAbstract.abstractitemmodel.html b/autogen.TermTk/TermTk.TTkAbstract.abstractitemmodel.html index 3ade47e2..de1daf90 100644 --- a/autogen.TermTk/TermTk.TTkAbstract.abstractitemmodel.html +++ b/autogen.TermTk/TermTk.TTkAbstract.abstractitemmodel.html @@ -4,7 +4,7 @@ - TermTk.TTkAbstract.abstractitemmodel — pyTermTk 0.39.0-a + <title>TermTk.TTkAbstract.abstractitemmodel — pyTermTk 0.40.0-a documentation @@ -71,6 +71,7 @@
  • TermTk.TTkAbstract.abstractitemmodel
  • TermTk.TTkAbstract.abstractscrollarea
  • TermTk.TTkAbstract.abstractscrollview
  • +
  • TermTk.TTkAbstract.abstracttablemodel
  • TermTk.TTkCore
  • diff --git a/autogen.TermTk/TermTk.TTkAbstract.abstractscrollarea.html b/autogen.TermTk/TermTk.TTkAbstract.abstractscrollarea.html index a718571e..31829a9b 100644 --- a/autogen.TermTk/TermTk.TTkAbstract.abstractscrollarea.html +++ b/autogen.TermTk/TermTk.TTkAbstract.abstractscrollarea.html @@ -4,7 +4,7 @@ - TermTk.TTkAbstract.abstractscrollarea — pyTermTk 0.39.0-a + <title>TermTk.TTkAbstract.abstractscrollarea — pyTermTk 0.40.0-a documentation @@ -74,6 +74,7 @@
  • TermTk.TTkAbstract.abstractscrollview
  • +
  • TermTk.TTkAbstract.abstracttablemodel
  • TermTk.TTkCore
  • diff --git a/autogen.TermTk/TermTk.TTkAbstract.abstractscrollview.html b/autogen.TermTk/TermTk.TTkAbstract.abstractscrollview.html index 20c95297..0e19469d 100644 --- a/autogen.TermTk/TermTk.TTkAbstract.abstractscrollview.html +++ b/autogen.TermTk/TermTk.TTkAbstract.abstractscrollview.html @@ -4,7 +4,7 @@ - TermTk.TTkAbstract.abstractscrollview — pyTermTk 0.39.0-a + <title>TermTk.TTkAbstract.abstractscrollview — pyTermTk 0.40.0-a documentation @@ -23,7 +23,7 @@ - + @@ -76,6 +76,7 @@
  • TTkAbstractScrollViewGridLayout
  • +
  • TermTk.TTkAbstract.abstracttablemodel
  • TermTk.TTkCore
  • @@ -974,7 +975,7 @@ this need to be overridden in the widget.


    diff --git a/autogen.TermTk/TermTk.TTkAbstract.abstracttablemodel.html b/autogen.TermTk/TermTk.TTkAbstract.abstracttablemodel.html new file mode 100644 index 00000000..fc0181e3 --- /dev/null +++ b/autogen.TermTk/TermTk.TTkAbstract.abstracttablemodel.html @@ -0,0 +1,410 @@ + + + + + + + TermTk.TTkAbstract.abstracttablemodel — pyTermTk 0.40.0-a + documentation + + + + + + + + + + + + + + + + + + + + +
    + + +
    + +
    +
    +
    + +
    +
    +
    +
    + +
    +

    TermTk.TTkAbstract.abstracttablemodel

    +
    +

    TTkModelIndex

    +
    +
    +class TTkModelIndex[source]
    +

    This class is used as an index into item models derived from TTkAbstractTableModel. +The index is used by item views, delegates, and selection models to locate an item in the model.

    +

    New TTkModelIndex objects are created by the model using the TTkAbstractTableModel -> index() function. +An invalid model index can be constructed with the 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 row(), column(), and data() to obtain this information.

    +

    To obtain a model index that refers to an existing item in a model, call TTkAbstractTableModel -> index() with the required row and column values.

    +
    +
    +col() int[source]
    +

    Returns the column this model index refers to.

    +
    +
    Returns
    +

    int

    +
    +
    +
    + +
    +
    +data() object[source]
    +

    Returns the data for the item referred to by the index.

    +
    +
    Returns
    +

    object

    +
    +
    +
    + +
    +
    +row() int[source]
    +

    Returns the row this model index refers to.

    +
    +
    Returns
    +

    int

    +
    +
    +
    + +
    +
    +setData(data: object) None[source]
    +

    Set the data in the item referred by the current index.

    +
    +
    Parameters
    +

    data (object) – the data to be set in the (row,col) position of the table

    +
    +
    +
    + +
    + +
    +
    +

    TTkAbstractTableModel

    +
    +
    +class TTkAbstractTableModel[source]
    +

    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 TTkAbstractItemModel, +it is not suitable for use with tree views.

    +

    The rowCount() and columnCount() functions return the dimensions of the table.

    +

    Subclassing

    +

    When subclassing TTkAbstractTableModel, you must implement rowCount(), columnCount(), and data(). +Well behaved models will also implement headerData().

    +

    Editable models need to implement setData().

    +

    Built-In Implementation

    +

    TTkTableModelList basic subclass implementing a 2d list as data structure

    +

    TTkTableModelCSV subclass of TTkTableModelList including the api to import csv data

    + +++ + + + + +

    Signals

    +
    +
    +
    +signal dataChanged(pos, size)
    +

    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 setData() function, this signal must be emitted explicitly.

    +
    +
    Parameters
    +
      +
    • pos (tuple(int,int)) – the topLeft margin of the modified area

    • +
    • size (tuple(int,int)) – the size of the modified area

    • +
    +
    +
    +
    + +
    +
    +
    +columnCount() int[source]
    +

    Returns the number of columns of the current moodel.

    +
    +
    Returns
    +

    int

    +
    +
    +
    + +
    +
    +data(row: int, col: int) object[source]
    +

    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.

    +
    +
    Parameters
    +
      +
    • row (int) – the row position of the data

    • +
    • col (int) – the column position of the data

    • +
    +
    +
    Returns
    +

    object

    +
    +
    +
    + +
    +
    +flags(row: int, col: int) ItemFlag[source]
    +

    Returns the item flags for the given row,column.

    +

    The base class implementation returns a combination of flags that +enables the item (ItemIsEnabled) +and allows it to be selected (ItemIsSelectable).

    +
    +
    Parameters
    +
      +
    • row (int) – the row position od the data

    • +
    • col (int) – the column position of the data

    • +
    +
    +
    Returns
    +

    ItemFlag

    +
    +
    +
    + +
    +
    +headerData(pos: int, orientation: Direction) TTkString[source]
    +

    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.

    +
    +
    Parameters
    +
      +
    • pos (int) – the position (col or row) of the header

    • +
    • orientation (Direction) – the orienttin of the header to be retrieved

    • +
    +
    +
    Returns
    +

    TTkString

    +
    +
    +
    + +
    +
    +index(row: int, col: int) TTkModelIndex[source]
    +

    Returns the index of the item in the model specified by the given row, column.

    +
    +
    Parameters
    +
      +
    • row (int) – the row position of the index

    • +
    • col (int) – the column position of the index

    • +
    +
    +
    Returns
    +

    TTkModelIndex

    +
    +
    +
    + +
    +
    +rowCount() int[source]
    +

    Returns the number of rows of the current model.

    +
    +
    Returns
    +

    int

    +
    +
    +
    + +
    +
    +setData(row: int, col: int, data: object) bool[source]
    +

    Returns true if successful; otherwise returns false.

    +

    The dataChanged() signal should be emitted if the data was successfully set.

    +

    The base class implementation returns false. This function and data() must be reimplemented for editable models.

    +
    +
    Parameters
    +
      +
    • row (int) – the row position of the data

    • +
    • col (int) – the column position of the data

    • +
    • data (object) – the data to be set in the (row,col) position of the table

    • +
    +
    +
    Returns
    +

    bool

    +
    +
    +
    + +
    +
    +sort(column: int, order: SortOrder) None[source]
    +

    Sorts the model by column in the given order.

    +
    +
    Parameters
    +
      +
    • column (int) – The column index to be sorted, if -1 is provided the original unsorted order is used.

    • +
    • order (SortOrder) – the sorting order

    • +
    +
    +
    +
    + +
    +
    +ttkStringData(row: int, col: int) TTkString[source]
    +

    Returns the TTkString reprsents the ddata stored in the row/column.

    +
    +
    Parameters
    +
      +
    • row (int) – the row position of the data

    • +
    • col (int) – the column position of the data

    • +
    +
    +
    Returns
    +

    TTkString

    +
    +
    +
    + +
    + +
    +
    + + +
    +
    + +
    +
    +
    +
    + + + + \ No newline at end of file diff --git a/autogen.TermTk/TermTk.TTkAbstract.html b/autogen.TermTk/TermTk.TTkAbstract.html index fb5b3ccd..3675ccab 100644 --- a/autogen.TermTk/TermTk.TTkAbstract.html +++ b/autogen.TermTk/TermTk.TTkAbstract.html @@ -4,7 +4,7 @@ - TermTk.TTkAbstract — pyTermTk 0.39.0-a + <title>TermTk.TTkAbstract — pyTermTk 0.40.0-a documentation @@ -71,6 +71,7 @@
  • TermTk.TTkAbstract.abstractitemmodel
  • TermTk.TTkAbstract.abstractscrollarea
  • TermTk.TTkAbstract.abstractscrollview
  • +
  • TermTk.TTkAbstract.abstracttablemodel
  • TermTk.TTkCore
  • @@ -129,6 +130,9 @@

    TermTk.TTkAbstract.abstractscrollview

    +

    TermTk.TTkAbstract.abstracttablemodel

    +

    + diff --git a/autogen.TermTk/TermTk.TTkCore.TTkTerm.colors.html b/autogen.TermTk/TermTk.TTkCore.TTkTerm.colors.html index 7b19a18c..9fb45ae7 100644 --- a/autogen.TermTk/TermTk.TTkCore.TTkTerm.colors.html +++ b/autogen.TermTk/TermTk.TTkCore.TTkTerm.colors.html @@ -4,7 +4,7 @@ - TermTk.TTkCore.TTkTerm.colors — pyTermTk 0.39.0-a + <title>TermTk.TTkCore.TTkTerm.colors — pyTermTk 0.40.0-a documentation diff --git a/autogen.TermTk/TermTk.TTkCore.TTkTerm.colors_ansi_map.html b/autogen.TermTk/TermTk.TTkCore.TTkTerm.colors_ansi_map.html index c0d605fa..3c75b1b8 100644 --- a/autogen.TermTk/TermTk.TTkCore.TTkTerm.colors_ansi_map.html +++ b/autogen.TermTk/TermTk.TTkCore.TTkTerm.colors_ansi_map.html @@ -4,7 +4,7 @@ - TermTk.TTkCore.TTkTerm.colors_ansi_map — pyTermTk 0.39.0-a + <title>TermTk.TTkCore.TTkTerm.colors_ansi_map — pyTermTk 0.40.0-a documentation diff --git a/autogen.TermTk/TermTk.TTkCore.TTkTerm.html b/autogen.TermTk/TermTk.TTkCore.TTkTerm.html index 6a713f54..46286d81 100644 --- a/autogen.TermTk/TermTk.TTkCore.TTkTerm.html +++ b/autogen.TermTk/TermTk.TTkCore.TTkTerm.html @@ -4,7 +4,7 @@ - TermTk.TTkCore.TTkTerm — pyTermTk 0.39.0-a + <title>TermTk.TTkCore.TTkTerm — pyTermTk 0.40.0-a documentation diff --git a/autogen.TermTk/TermTk.TTkCore.TTkTerm.input.html b/autogen.TermTk/TermTk.TTkCore.TTkTerm.input.html index fb5df43b..e27bf5fd 100644 --- a/autogen.TermTk/TermTk.TTkCore.TTkTerm.input.html +++ b/autogen.TermTk/TermTk.TTkCore.TTkTerm.input.html @@ -4,7 +4,7 @@ - TermTk.TTkCore.TTkTerm.input — pyTermTk 0.39.0-a + <title>TermTk.TTkCore.TTkTerm.input — pyTermTk 0.40.0-a documentation diff --git a/autogen.TermTk/TermTk.TTkCore.TTkTerm.input_mono.html b/autogen.TermTk/TermTk.TTkCore.TTkTerm.input_mono.html index 403c7f7a..3ed52ab0 100644 --- a/autogen.TermTk/TermTk.TTkCore.TTkTerm.input_mono.html +++ b/autogen.TermTk/TermTk.TTkCore.TTkTerm.input_mono.html @@ -4,7 +4,7 @@ - TermTk.TTkCore.TTkTerm.input_mono — pyTermTk 0.39.0-a + <title>TermTk.TTkCore.TTkTerm.input_mono — pyTermTk 0.40.0-a documentation diff --git a/autogen.TermTk/TermTk.TTkCore.TTkTerm.input_thread.html b/autogen.TermTk/TermTk.TTkCore.TTkTerm.input_thread.html index 2223776a..a41823ad 100644 --- a/autogen.TermTk/TermTk.TTkCore.TTkTerm.input_thread.html +++ b/autogen.TermTk/TermTk.TTkCore.TTkTerm.input_thread.html @@ -4,7 +4,7 @@ - TermTk.TTkCore.TTkTerm.input_thread — pyTermTk 0.39.0-a + <title>TermTk.TTkCore.TTkTerm.input_thread — pyTermTk 0.40.0-a documentation diff --git a/autogen.TermTk/TermTk.TTkCore.TTkTerm.inputkey.html b/autogen.TermTk/TermTk.TTkCore.TTkTerm.inputkey.html index 5823f9b7..9d33fb71 100644 --- a/autogen.TermTk/TermTk.TTkCore.TTkTerm.inputkey.html +++ b/autogen.TermTk/TermTk.TTkCore.TTkTerm.inputkey.html @@ -4,7 +4,7 @@ - TermTk.TTkCore.TTkTerm.inputkey — pyTermTk 0.39.0-a + <title>TermTk.TTkCore.TTkTerm.inputkey — pyTermTk 0.40.0-a documentation diff --git a/autogen.TermTk/TermTk.TTkCore.TTkTerm.inputmouse.html b/autogen.TermTk/TermTk.TTkCore.TTkTerm.inputmouse.html index 6f7f715b..bcedef47 100644 --- a/autogen.TermTk/TermTk.TTkCore.TTkTerm.inputmouse.html +++ b/autogen.TermTk/TermTk.TTkCore.TTkTerm.inputmouse.html @@ -4,7 +4,7 @@ - TermTk.TTkCore.TTkTerm.inputmouse — pyTermTk 0.39.0-a + <title>TermTk.TTkCore.TTkTerm.inputmouse — pyTermTk 0.40.0-a documentation diff --git a/autogen.TermTk/TermTk.TTkCore.TTkTerm.term.html b/autogen.TermTk/TermTk.TTkCore.TTkTerm.term.html index 7ed736ab..96fca0ad 100644 --- a/autogen.TermTk/TermTk.TTkCore.TTkTerm.term.html +++ b/autogen.TermTk/TermTk.TTkCore.TTkTerm.term.html @@ -4,7 +4,7 @@ - TermTk.TTkCore.TTkTerm.term — pyTermTk 0.39.0-a + <title>TermTk.TTkCore.TTkTerm.term — pyTermTk 0.40.0-a documentation diff --git a/autogen.TermTk/TermTk.TTkCore.TTkTerm.term_base.html b/autogen.TermTk/TermTk.TTkCore.TTkTerm.term_base.html index 943142fd..f8328556 100644 --- a/autogen.TermTk/TermTk.TTkCore.TTkTerm.term_base.html +++ b/autogen.TermTk/TermTk.TTkCore.TTkTerm.term_base.html @@ -4,7 +4,7 @@ - TermTk.TTkCore.TTkTerm.term_base — pyTermTk 0.39.0-a + <title>TermTk.TTkCore.TTkTerm.term_base — pyTermTk 0.40.0-a documentation diff --git a/autogen.TermTk/TermTk.TTkCore.canvas.html b/autogen.TermTk/TermTk.TTkCore.canvas.html index 832de93d..e69da604 100644 --- a/autogen.TermTk/TermTk.TTkCore.canvas.html +++ b/autogen.TermTk/TermTk.TTkCore.canvas.html @@ -4,7 +4,7 @@ - TermTk.TTkCore.canvas — pyTermTk 0.39.0-a + <title>TermTk.TTkCore.canvas — pyTermTk 0.40.0-a documentation diff --git a/autogen.TermTk/TermTk.TTkCore.cfg.html b/autogen.TermTk/TermTk.TTkCore.cfg.html index 420a7c97..c66ec153 100644 --- a/autogen.TermTk/TermTk.TTkCore.cfg.html +++ b/autogen.TermTk/TermTk.TTkCore.cfg.html @@ -4,7 +4,7 @@ - TermTk.TTkCore.cfg — pyTermTk 0.39.0-a + <title>TermTk.TTkCore.cfg — pyTermTk 0.40.0-a documentation diff --git a/autogen.TermTk/TermTk.TTkCore.color.html b/autogen.TermTk/TermTk.TTkCore.color.html index 1942f24b..c89a884c 100644 --- a/autogen.TermTk/TermTk.TTkCore.color.html +++ b/autogen.TermTk/TermTk.TTkCore.color.html @@ -4,7 +4,7 @@ - TermTk.TTkCore.color — pyTermTk 0.39.0-a + <title>TermTk.TTkCore.color — pyTermTk 0.40.0-a documentation @@ -137,7 +137,7 @@

    TTkColor

    -class TTkColor(fg: Optional[tuple] = None, bg: Optional[tuple] = None, mod: int = 0, colorMod=None, link: str = '', clean=False)[source]
    +class TTkColor(fg: tuple = None, bg: tuple = None, mod: int = 0, colorMod=None, link: str = '', clean=False)[source]

    TermTk Color helper

    The TTkColor constructor creates the color based on HEX values.

    Example:

    @@ -155,26 +155,163 @@ color_1 = color_fg_red + color_bg_blue color_2 = color_fg_red + TTkColor.bg('#FFFF00') color_3 = color_2 + TTkColor.UNDERLINE + TTkColor.BOLD + +# Use presets +color_4 = TTkColor.RED +color_5 = TTkColor.BG_YELLOW + color_4 +color_6 = color_5 + TTkColor.UNDERLINE + TTkColor.BOLD
    +
    +
    +BG_BLACK = <TermTk.TTkCore.color._TTkColor object>
    +

    (bg) #000000 - Black

    +
    + +
    +
    +BG_BLUE = <TermTk.TTkCore.color._TTkColor object>
    +

    (bg) #0000FF - Blue

    +
    + +
    +
    +BG_CYAN = <TermTk.TTkCore.color._TTkColor object>
    +

    (bg) #00FFFF - Cyan

    +
    + +
    +
    +BG_GREEN = <TermTk.TTkCore.color._TTkColor object>
    +

    (bg) #00FF00 - Green

    +
    + +
    +
    +BG_MAGENTA = <TermTk.TTkCore.color._TTkColor object>
    +

    (bg) #FF00FF - Magenta

    +
    + +
    +
    +BG_RED = <TermTk.TTkCore.color._TTkColor object>
    +

    (bg) #FF0000 - Red

    +
    + +
    +
    +BG_WHITE = <TermTk.TTkCore.color._TTkColor object>
    +

    (bg) #FFFFFF - White

    +
    + +
    +
    +BG_YELLOW = <TermTk.TTkCore.color._TTkColor object>
    +

    (bg) #FFFF00 - Yellow

    +
    + +
    +
    +BLACK = <TermTk.TTkCore.color._TTkColor object>
    +

    (fg) #000000 - Black

    +
    +
    BLINKING = <TermTk.TTkCore.color._TTkColor object>

    “Blinking” modifier

    +
    +
    +BLUE = <TermTk.TTkCore.color._TTkColor object>
    +

    (fg) #0000FF - Blue

    +
    +
    BOLD = <TermTk.TTkCore.color._TTkColor object>

    Bold modifier

    +
    +
    +CYAN = <TermTk.TTkCore.color._TTkColor object>
    +

    (fg) #00FFFF - Cyan

    +
    + +
    +
    +FG_BLACK = <TermTk.TTkCore.color._TTkColor object>
    +

    (fg) #000000 - Black

    +
    + +
    +
    +FG_BLUE = <TermTk.TTkCore.color._TTkColor object>
    +

    (fg) #0000FF - Blue

    +
    + +
    +
    +FG_CYAN = <TermTk.TTkCore.color._TTkColor object>
    +

    (fg) #00FFFF - Cyan

    +
    + +
    +
    +FG_GREEN = <TermTk.TTkCore.color._TTkColor object>
    +

    (fg) #00FF00 - Green

    +
    + +
    +
    +FG_MAGENTA = <TermTk.TTkCore.color._TTkColor object>
    +

    (fg) #FF00FF - Magenta

    +
    + +
    +
    +FG_RED = <TermTk.TTkCore.color._TTkColor object>
    +

    (fg) #FF0000 - Red

    +
    + +
    +
    +FG_WHITE = <TermTk.TTkCore.color._TTkColor object>
    +

    (fg) #FFFFFF - White

    +
    + +
    +
    +FG_YELLOW = <TermTk.TTkCore.color._TTkColor object>
    +

    (fg) #FFFF00 - Yellow

    +
    + +
    +
    +GREEN = <TermTk.TTkCore.color._TTkColor object>
    +

    (fg) #00FF00 - Green

    +
    +
    ITALIC = <TermTk.TTkCore.color._TTkColor object>

    Italic modifier

    +
    +
    +MAGENTA = <TermTk.TTkCore.color._TTkColor object>
    +

    (fg) #FF00FF - Magenta

    +
    + +
    +
    +RED = <TermTk.TTkCore.color._TTkColor object>
    +

    (fg) #FF0000 - Red

    +
    +
    RST = <TermTk.TTkCore.color._TTkColor object>
    @@ -193,6 +330,18 @@

    Underline modifier

    +
    +
    +WHITE = <TermTk.TTkCore.color._TTkColor object>
    +

    (fg) #FFFFFF - White

    +
    + +
    +
    +YELLOW = <TermTk.TTkCore.color._TTkColor object>
    +

    (fg) #FFFF00 - Yellow

    +
    +
    static bg(*args, **kwargs)[source]
    @@ -210,6 +359,9 @@
  • modifier (TTkColorModifier, optional) – (experimental) the color modifier to be used to improve the kinkiness

  • +
    Returns
    +

    TTkColor

    +
    @@ -230,6 +382,33 @@
  • modifier (TTkColorModifier, optional) – (experimental) the color modifier to be used to improve the kinkiness

  • +
    Returns
    +

    TTkColor

    +
    + + + +
    +
    +static fgbg(fg: str = '', bg: str = '', link: str = '', modifier: _TTkColorModifier = None)[source]
    +

    Helper to generate a Background color

    +

    Example:

    +
    color_1 = TTkColor.fgbg('#FF0000','#0000FF')
    +color_2 = TTkColor.fgbg(fg='#00FF00',bg='#0000FF')
    +color_3 = TTkColor.fgbg('#0000FF','#0000FF', modifier=TTkColorGradient(increment=6))
    +
    +
    +
    +
    Parameters
    +
      +
    • fg (str) – the foreground color representation in (str)HEX

    • +
    • bg (str) – the background color representation in (str)HEX

    • +
    • modifier (TTkColorModifier, optional) – (experimental) the color modifier to be used to improve the kinkiness

    • +
    +
    +
    Returns
    +

    TTkColor

    +
    diff --git a/autogen.TermTk/TermTk.TTkCore.constant.html b/autogen.TermTk/TermTk.TTkCore.constant.html index 613b1939..b46e3ec3 100644 --- a/autogen.TermTk/TermTk.TTkCore.constant.html +++ b/autogen.TermTk/TermTk.TTkCore.constant.html @@ -4,7 +4,7 @@ - TermTk.TTkCore.constant — pyTermTk 0.39.0-a + <title>TermTk.TTkCore.constant — pyTermTk 0.40.0-a documentation @@ -143,7 +143,21 @@
    class AcceptMode[source]
    -
    +
    ++++ + + + + + + + + +

    AcceptOpen

    Open

    AcceptSave

    Save

    +
    AcceptOpen = 0

    Open

    @@ -155,119 +169,6 @@

    Save

    -
    -
    -as_integer_ratio()
    -

    Return integer ratio.

    -

    Return a pair of integers, whose ratio is exactly equal to the original int -and with a positive denominator.

    -
    >>> (10).as_integer_ratio()
    -(10, 1)
    ->>> (-10).as_integer_ratio()
    -(-10, 1)
    ->>> (0).as_integer_ratio()
    -(0, 1)
    -
    -
    -
    - -
    -
    -bit_count()
    -

    Number of ones in the binary representation of the absolute value of self.

    -

    Also known as the population count.

    -
    >>> bin(13)
    -'0b1101'
    ->>> (13).bit_count()
    -3
    -
    -
    -
    - -
    -
    -bit_length()
    -

    Number of bits necessary to represent self in binary.

    -
    >>> bin(37)
    -'0b100101'
    ->>> (37).bit_length()
    -6
    -
    -
    -
    - -
    -
    -conjugate()
    -

    Returns self, the complex conjugate of any int.

    -
    - -
    -
    -denominator
    -

    the denominator of a rational number in lowest terms

    -
    - -
    -
    -from_bytes(byteorder, *, signed=False)
    -

    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.

    -
    -
    -
    - -
    -
    -imag
    -

    the imaginary part of a complex number

    -
    - -
    -
    -numerator
    -

    the numerator of a rational number in lowest terms

    -
    - -
    -
    -real
    -

    the real part of a complex number

    -
    - -
    -
    -to_bytes(length, byteorder, *, signed=False)
    -

    Return an array of bytes representing an integer.

    -
    -
    length

    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.

    -
    -
    -
    -
    @@ -327,119 +228,6 @@ is raised.

    Aligns with the right edge.

    -
    -
    -as_integer_ratio()
    -

    Return integer ratio.

    -

    Return a pair of integers, whose ratio is exactly equal to the original int -and with a positive denominator.

    -
    >>> (10).as_integer_ratio()
    -(10, 1)
    ->>> (-10).as_integer_ratio()
    -(-10, 1)
    ->>> (0).as_integer_ratio()
    -(0, 1)
    -
    -
    -
    - -
    -
    -bit_count()
    -

    Number of ones in the binary representation of the absolute value of self.

    -

    Also known as the population count.

    -
    >>> bin(13)
    -'0b1101'
    ->>> (13).bit_count()
    -3
    -
    -
    -
    - -
    -
    -bit_length()
    -

    Number of bits necessary to represent self in binary.

    -
    >>> bin(37)
    -'0b100101'
    ->>> (37).bit_length()
    -6
    -
    -
    -
    - -
    -
    -conjugate()
    -

    Returns self, the complex conjugate of any int.

    -
    - -
    -
    -denominator
    -

    the denominator of a rational number in lowest terms

    -
    - -
    -
    -from_bytes(byteorder, *, signed=False)
    -

    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.

    -
    -
    -
    - -
    -
    -imag
    -

    the imaginary part of a complex number

    -
    - -
    -
    -numerator
    -

    the numerator of a rational number in lowest terms

    -
    - -
    -
    -real
    -

    the real part of a complex number

    -
    - -
    -
    -to_bytes(length, byteorder, *, signed=False)
    -

    Return an array of bytes representing an integer.

    -
    -
    length

    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.

    -
    -
    -
    -
    @@ -452,128 +240,33 @@ is raised.

    -

    Unchecked

    -

    +

    Unchecked

    +

    The item is unchecked.

    -

    PartiallyChecked

    -

    +

    PartiallyChecked

    +

    The item is partially checked.

    -

    Checked

    -

    +

    Checked

    +

    The item is checked.

    -
    -
    -as_integer_ratio()
    -

    Return integer ratio.

    -

    Return a pair of integers, whose ratio is exactly equal to the original int -and with a positive denominator.

    -
    >>> (10).as_integer_ratio()
    -(10, 1)
    ->>> (-10).as_integer_ratio()
    -(-10, 1)
    ->>> (0).as_integer_ratio()
    -(0, 1)
    -
    -
    -
    - -
    -
    -bit_count()
    -

    Number of ones in the binary representation of the absolute value of self.

    -

    Also known as the population count.

    -
    >>> bin(13)
    -'0b1101'
    ->>> (13).bit_count()
    -3
    -
    -
    -
    - -
    -
    -bit_length()
    -

    Number of bits necessary to represent self in binary.

    -
    >>> bin(37)
    -'0b100101'
    ->>> (37).bit_length()
    -6
    -
    -
    -
    - -
    -
    -conjugate()
    -

    Returns self, the complex conjugate of any int.

    -
    - -
    -
    -denominator
    -

    the denominator of a rational number in lowest terms

    -
    - -
    -
    -from_bytes(byteorder, *, signed=False)
    -

    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.

    -
    -
    -
    -
    -
    -imag
    -

    the imaginary part of a complex number

    +
    +Checked = 2
    +

    The item is checked.

    -
    -numerator
    -

    the numerator of a rational number in lowest terms

    +
    +PartiallyChecked = 1
    +

    The item is partially checked. Items in hierarchical models may be partially checked if some, but not all, of their children are checked.

    -
    -real
    -

    the real part of a complex number

    -
    - -
    -
    -to_bytes(length, byteorder, *, signed=False)
    -

    Return an array of bytes representing an integer.

    -
    -
    length

    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.

    -
    -
    +
    +Unchecked = 0
    +

    The item is unchecked.

    @@ -581,243 +274,31 @@ is raised.

    class ChildIndicatorPolicy[source]
    -
    -
    -as_integer_ratio()
    -

    Return integer ratio.

    -

    Return a pair of integers, whose ratio is exactly equal to the original int -and with a positive denominator.

    -
    >>> (10).as_integer_ratio()
    -(10, 1)
    ->>> (-10).as_integer_ratio()
    -(-10, 1)
    ->>> (0).as_integer_ratio()
    -(0, 1)
    -
    -
    -
    - -
    -
    -bit_count()
    -

    Number of ones in the binary representation of the absolute value of self.

    -

    Also known as the population count.

    -
    >>> bin(13)
    -'0b1101'
    ->>> (13).bit_count()
    -3
    -
    -
    -
    - -
    -
    -bit_length()
    -

    Number of bits necessary to represent self in binary.

    -
    >>> bin(37)
    -'0b100101'
    ->>> (37).bit_length()
    -6
    -
    -
    -
    - -
    -
    -conjugate()
    -

    Returns self, the complex conjugate of any int.

    -
    - -
    -
    -denominator
    -

    the denominator of a rational number in lowest terms

    -
    - -
    -
    -from_bytes(byteorder, *, signed=False)
    -

    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.

    -
    -
    -
    - -
    -
    -imag
    -

    the imaginary part of a complex number

    -
    - -
    -
    -numerator
    -

    the numerator of a rational number in lowest terms

    -
    - -
    -
    -real
    -

    the real part of a complex number

    -
    - -
    -
    -to_bytes(length, byteorder, *, signed=False)
    -

    Return an array of bytes representing an integer.

    -
    -
    length

    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.

    -
    -
    -
    - -
    +
    class ColorType[source]
    -
    -
    -as_integer_ratio()
    -

    Return integer ratio.

    -

    Return a pair of integers, whose ratio is exactly equal to the original int -and with a positive denominator.

    -
    >>> (10).as_integer_ratio()
    -(10, 1)
    ->>> (-10).as_integer_ratio()
    -(-10, 1)
    ->>> (0).as_integer_ratio()
    -(0, 1)
    -
    -
    -
    - -
    -
    -bit_count()
    -

    Number of ones in the binary representation of the absolute value of self.

    -

    Also known as the population count.

    -
    >>> bin(13)
    -'0b1101'
    ->>> (13).bit_count()
    -3
    -
    -
    -
    - -
    -
    -bit_length()
    -

    Number of bits necessary to represent self in binary.

    -
    >>> bin(37)
    -'0b100101'
    ->>> (37).bit_length()
    -6
    -
    -
    -
    - -
    -
    -conjugate()
    -

    Returns self, the complex conjugate of any int.

    -
    - -
    -
    -denominator
    -

    the denominator of a rational number in lowest terms

    -
    - -
    -
    -from_bytes(byteorder, *, signed=False)
    -

    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.

    -
    -
    -
    - -
    -
    -imag
    -

    the imaginary part of a complex number

    -
    - -
    -
    -numerator
    -

    the numerator of a rational number in lowest terms

    -
    - -
    -
    -real
    -

    the real part of a complex number

    -
    - -
    -
    -to_bytes(length, byteorder, *, signed=False)
    -

    Return an array of bytes representing an integer.

    -
    -
    length

    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.

    -
    -
    -
    - -
    +
    class Direction[source]

    This class type is used to describe the direction

    + ++++ + + + + + + + + +

    HORIZONTAL

    Horizontal direction

    VERTICAL

    Vertical direction

    HORIZONTAL = 3
    @@ -830,125 +311,32 @@ is raised.

    Vertical direction

    -
    -
    -as_integer_ratio()
    -

    Return integer ratio.

    -

    Return a pair of integers, whose ratio is exactly equal to the original int -and with a positive denominator.

    -
    >>> (10).as_integer_ratio()
    -(10, 1)
    ->>> (-10).as_integer_ratio()
    -(-10, 1)
    ->>> (0).as_integer_ratio()
    -(0, 1)
    -
    -
    -
    - -
    -
    -bit_count()
    -

    Number of ones in the binary representation of the absolute value of self.

    -

    Also known as the population count.

    -
    >>> bin(13)
    -'0b1101'
    ->>> (13).bit_count()
    -3
    -
    -
    -
    - -
    -
    -bit_length()
    -

    Number of bits necessary to represent self in binary.

    -
    >>> bin(37)
    -'0b100101'
    ->>> (37).bit_length()
    -6
    -
    -
    -
    - -
    -
    -conjugate()
    -

    Returns self, the complex conjugate of any int.

    -
    - -
    -
    -denominator
    -

    the denominator of a rational number in lowest terms

    -
    - -
    -
    -from_bytes(byteorder, *, signed=False)
    -

    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.

    -
    -
    -
    - -
    -
    -imag
    -

    the imaginary part of a complex number

    -
    - -
    -
    -numerator
    -

    the numerator of a rational number in lowest terms

    -
    - -
    -
    -real
    -

    the real part of a complex number

    -
    - -
    -
    -to_bytes(length, byteorder, *, signed=False)
    -

    Return an array of bytes representing an integer.

    -
    -
    length

    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.

    -
    -
    -
    -
    class DragDropMode[source]

    Specifies the Drag and Drop mode allowed by this widget

    + ++++ + + + + + + + + + + + + + + +

    NoDragDrop

    No Drag and Drop is allowed

    AllowDrag

    Drag allowed

    AllowDrop

    Drop allowed

    AllowDragDrop

    Drag and Drop allowed

    AllowDrag = 1
    @@ -973,125 +361,29 @@ is raised.

    No Drag and Drop is allowed

    -
    -
    -as_integer_ratio()
    -

    Return integer ratio.

    -

    Return a pair of integers, whose ratio is exactly equal to the original int -and with a positive denominator.

    -
    >>> (10).as_integer_ratio()
    -(10, 1)
    ->>> (-10).as_integer_ratio()
    -(-10, 1)
    ->>> (0).as_integer_ratio()
    -(0, 1)
    -
    -
    -
    - -
    -
    -bit_count()
    -

    Number of ones in the binary representation of the absolute value of self.

    -

    Also known as the population count.

    -
    >>> bin(13)
    -'0b1101'
    ->>> (13).bit_count()
    -3
    -
    -
    -
    - -
    -
    -bit_length()
    -

    Number of bits necessary to represent self in binary.

    -
    >>> bin(37)
    -'0b100101'
    ->>> (37).bit_length()
    -6
    -
    -
    -
    - -
    -
    -conjugate()
    -

    Returns self, the complex conjugate of any int.

    -
    - -
    -
    -denominator
    -

    the denominator of a rational number in lowest terms

    -
    - -
    -
    -from_bytes(byteorder, *, signed=False)
    -

    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.

    -
    -
    -
    - -
    -
    -imag
    -

    the imaginary part of a complex number

    -
    - -
    -
    -numerator
    -

    the numerator of a rational number in lowest terms

    -
    - -
    -
    -real
    -

    the real part of a complex number

    -
    - -
    -
    -to_bytes(length, byteorder, *, signed=False)
    -

    Return an array of bytes representing an integer.

    -
    -
    length

    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.

    -
    -
    -
    -
    class FileMode[source]
    -
    +
    ++++ + + + + + + + + + + + +

    AnyFile

    The name of a file, whether it exists or not.

    ExistingFile

    The name of a single existing file.

    Directory

    The name of a directory.

    +
    AnyFile = 0

    The name of a file, whether it exists or not.

    @@ -1109,135 +401,39 @@ is raised.

    The name of a single existing file.

    -
    -
    -as_integer_ratio()
    -

    Return integer ratio.

    -

    Return a pair of integers, whose ratio is exactly equal to the original int -and with a positive denominator.

    -
    >>> (10).as_integer_ratio()
    -(10, 1)
    ->>> (-10).as_integer_ratio()
    -(-10, 1)
    ->>> (0).as_integer_ratio()
    -(0, 1)
    -
    -
    -
    - -
    -
    -bit_count()
    -

    Number of ones in the binary representation of the absolute value of self.

    -

    Also known as the population count.

    -
    >>> bin(13)
    -'0b1101'
    ->>> (13).bit_count()
    -3
    -
    -
    -
    -
    -bit_length()
    -

    Number of bits necessary to represent self in binary.

    -
    >>> bin(37)
    -'0b100101'
    ->>> (37).bit_length()
    -6
    -
    -
    +
    +
    +class InsertPolicy[source]
    +

    Specifies what the TTkComboBox should do when a new string is entered by the user.

    + ++++ + + + + + + + + + + + +

    NoInsert

    The string will not be inserted into the combobox.

    InsertAtTop

    The string will be inserted as the first item in the combobox.

    InsertAtBottom

    The string will be inserted after the last item in the combobox.

    +
    +
    +InsertAtBottom = 3
    +

    The string will be inserted after the last item in the combobox.

    -
    -
    -conjugate()
    -

    Returns self, the complex conjugate of any int.

    -
    - -
    -
    -denominator
    -

    the denominator of a rational number in lowest terms

    -
    - -
    -
    -from_bytes(byteorder, *, signed=False)
    -

    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.

    -
    -
    -
    - -
    -
    -imag
    -

    the imaginary part of a complex number

    -
    - -
    -
    -numerator
    -

    the numerator of a rational number in lowest terms

    -
    - -
    -
    -real
    -

    the real part of a complex number

    -
    - -
    -
    -to_bytes(length, byteorder, *, signed=False)
    -

    Return an array of bytes representing an integer.

    -
    -
    length

    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.

    -
    -
    -
    - -
    - -
    -
    -class InsertPolicy[source]
    -

    Specifies what the TTkComboBox should do when a new string is entered by the user.

    -
    -
    -InsertAtBottom = 3
    -

    The string will be inserted after the last item in the combobox.

    -
    - -
    -
    -InsertAtTop = 1
    -

    The string will be inserted as the first item in the combobox.

    +
    +
    +InsertAtTop = 1
    +

    The string will be inserted as the first item in the combobox.

    @@ -1246,117 +442,54 @@ is raised.

    The string will not be inserted into the combobox.

    -
    -
    -as_integer_ratio()
    -

    Return integer ratio.

    -

    Return a pair of integers, whose ratio is exactly equal to the original int -and with a positive denominator.

    -
    >>> (10).as_integer_ratio()
    -(10, 1)
    ->>> (-10).as_integer_ratio()
    -(-10, 1)
    ->>> (0).as_integer_ratio()
    -(0, 1)
    -
    -
    -
    - -
    -
    -bit_count()
    -

    Number of ones in the binary representation of the absolute value of self.

    -

    Also known as the population count.

    -
    >>> bin(13)
    -'0b1101'
    ->>> (13).bit_count()
    -3
    -
    -
    -
    - -
    -
    -bit_length()
    -

    Number of bits necessary to represent self in binary.

    -
    >>> bin(37)
    -'0b100101'
    ->>> (37).bit_length()
    -6
    -
    -
    -
    - -
    -
    -conjugate()
    -

    Returns self, the complex conjugate of any int.

    +
    +
    +class ItemFlag[source]
    +

    ItemFlag describes the properties of an item

    + ++++ + + + + + + + + + + + + + + +

    NoItemFlags

    It does not have any properties set.

    ItemIsSelectable

    It can be selected.

    ItemIsEditable

    It can be edited.

    ItemIsEnabled

    The user can interact with the item.

    -
    -denominator
    -

    the denominator of a rational number in lowest terms

    -
    - -
    -
    -from_bytes(byteorder, *, signed=False)
    -

    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.

    -
    -
    +
    +ItemIsEditable = 2
    +

    It can be edited.

    -
    -imag
    -

    the imaginary part of a complex number

    +
    +ItemIsEnabled = 32
    +

    The user can interact with the item.

    -
    -numerator
    -

    the numerator of a rational number in lowest terms

    +
    +ItemIsSelectable = 1
    +

    It can be selected.

    -
    -real
    -

    the real part of a complex number

    -
    - -
    -
    -to_bytes(length, byteorder, *, signed=False)
    -

    Return an array of bytes representing an integer.

    -
    -
    length

    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.

    -
    -
    +
    +NoItemFlags = 0
    +

    It does not have any properties set.

    @@ -1366,6 +499,47 @@ is raised.

    class KeyModifier[source]

    Input SpecialKey modifiers

    Modifier reported by TTkKeyEvent -> mod

    + ++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

    NoModifier

    No modifier key is pressed.

    ShiftModifier

    A Shift key on the keyboard is pressed.

    ControlModifier

    A Ctrl key on the keyboard is pressed.

    AltModifier

    An Alt key on the keyboard is pressed.

    MetaModifier

    A Meta key on the keyboard is pressed.

    KeypadModifier

    A keypad button is pressed.

    GroupSwitchModifier

    X11 only (unless activated on Windows by a command line argument).

    SHIFT

    The Shift keys provided on all standard keyboards.

    META

    The Meta keys.

    CTRL

    The Ctrl keys.

    ALT

    The normal Alt keys, but not keys like AltGr.

    ALT = 134217728
    @@ -1432,119 +606,6 @@ is raised.

    A Shift key on the keyboard is pressed.

    -
    -
    -as_integer_ratio()
    -

    Return integer ratio.

    -

    Return a pair of integers, whose ratio is exactly equal to the original int -and with a positive denominator.

    -
    >>> (10).as_integer_ratio()
    -(10, 1)
    ->>> (-10).as_integer_ratio()
    -(-10, 1)
    ->>> (0).as_integer_ratio()
    -(0, 1)
    -
    -
    -
    - -
    -
    -bit_count()
    -

    Number of ones in the binary representation of the absolute value of self.

    -

    Also known as the population count.

    -
    >>> bin(13)
    -'0b1101'
    ->>> (13).bit_count()
    -3
    -
    -
    -
    - -
    -
    -bit_length()
    -

    Number of bits necessary to represent self in binary.

    -
    >>> bin(37)
    -'0b100101'
    ->>> (37).bit_length()
    -6
    -
    -
    -
    - -
    -
    -conjugate()
    -

    Returns self, the complex conjugate of any int.

    -
    - -
    -
    -denominator
    -

    the denominator of a rational number in lowest terms

    -
    - -
    -
    -from_bytes(byteorder, *, signed=False)
    -

    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.

    -
    -
    -
    - -
    -
    -imag
    -

    the imaginary part of a complex number

    -
    - -
    -
    -numerator
    -

    the numerator of a rational number in lowest terms

    -
    - -
    -
    -real
    -

    the real part of a complex number

    -
    - -
    -
    -to_bytes(length, byteorder, *, signed=False)
    -

    Return an array of bytes representing an integer.

    -
    -
    length

    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.

    class KeyType[source]

    Input Key Types

    Key type reported by TTkKeyEvent -> key

    + ++++ + + + + + + + + +

    Character

    Input Char Key

    SpecialKey

    Input Special Key

    Character = 1
    @@ -1564,125 +639,26 @@ is raised.

    Input Special Key

    -
    -
    -as_integer_ratio()
    -

    Return integer ratio.

    -

    Return a pair of integers, whose ratio is exactly equal to the original int -and with a positive denominator.

    -
    >>> (10).as_integer_ratio()
    -(10, 1)
    ->>> (-10).as_integer_ratio()
    -(-10, 1)
    ->>> (0).as_integer_ratio()
    -(0, 1)
    -
    -
    -
    - -
    -
    -bit_count()
    -

    Number of ones in the binary representation of the absolute value of self.

    -

    Also known as the population count.

    -
    >>> bin(13)
    -'0b1101'
    ->>> (13).bit_count()
    -3
    -
    -
    -
    - -
    -
    -bit_length()
    -

    Number of bits necessary to represent self in binary.

    -
    >>> bin(37)
    -'0b100101'
    ->>> (37).bit_length()
    -6
    -
    -
    -
    - -
    -
    -conjugate()
    -

    Returns self, the complex conjugate of any int.

    -
    - -
    -
    -denominator
    -

    the denominator of a rational number in lowest terms

    -
    - -
    -
    -from_bytes(byteorder, *, signed=False)
    -

    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.

    -
    -
    -
    - -
    -
    -imag
    -

    the imaginary part of a complex number

    -
    - -
    -
    -numerator
    -

    the numerator of a rational number in lowest terms

    -
    - -
    -
    -real
    -

    the real part of a complex number

    -
    - -
    -
    -to_bytes(length, byteorder, *, signed=False)
    -

    Return an array of bytes representing an integer.

    -
    -
    length

    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.

    -
    -
    -
    -
    class LayoutItemTypes[source]

    Types used internally in TTkLayouts

    + ++++ + + + + + + + + +

    LayoutItem

    Item Type Layout

    WidgetItem

    Item Type Widget

    LayoutItem = 1
    @@ -1695,235 +671,36 @@ is raised.

    Item Type Widget

    -
    -
    -as_integer_ratio()
    -

    Return integer ratio.

    -

    Return a pair of integers, whose ratio is exactly equal to the original int -and with a positive denominator.

    -
    >>> (10).as_integer_ratio()
    -(10, 1)
    ->>> (-10).as_integer_ratio()
    -(-10, 1)
    ->>> (0).as_integer_ratio()
    -(0, 1)
    -
    -
    -
    - -
    -
    -bit_count()
    -

    Number of ones in the binary representation of the absolute value of self.

    -

    Also known as the population count.

    -
    >>> bin(13)
    -'0b1101'
    ->>> (13).bit_count()
    -3
    -
    -
    -
    - -
    -
    -bit_length()
    -

    Number of bits necessary to represent self in binary.

    -
    >>> bin(37)
    -'0b100101'
    ->>> (37).bit_length()
    -6
    -
    -
    -
    - -
    -
    -conjugate()
    -

    Returns self, the complex conjugate of any int.

    -
    - -
    -
    -denominator
    -

    the denominator of a rational number in lowest terms

    -
    - -
    -
    -from_bytes(byteorder, *, signed=False)
    -

    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.

    -
    -
    -
    - -
    -
    -imag
    -

    the imaginary part of a complex number

    -
    - -
    -
    -numerator
    -

    the numerator of a rational number in lowest terms

    -
    - -
    -
    -real
    -

    the real part of a complex number

    -
    - -
    -
    -to_bytes(length, byteorder, *, signed=False)
    -

    Return an array of bytes representing an integer.

    -
    -
    length

    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.

    -
    -
    -
    -
    class LineWrapMode[source]
    -
    -
    -as_integer_ratio()
    -

    Return integer ratio.

    -

    Return a pair of integers, whose ratio is exactly equal to the original int -and with a positive denominator.

    -
    >>> (10).as_integer_ratio()
    -(10, 1)
    ->>> (-10).as_integer_ratio()
    -(-10, 1)
    ->>> (0).as_integer_ratio()
    -(0, 1)
    -
    -
    -
    - -
    -
    -bit_count()
    -

    Number of ones in the binary representation of the absolute value of self.

    -

    Also known as the population count.

    -
    >>> bin(13)
    -'0b1101'
    ->>> (13).bit_count()
    -3
    -
    -
    -
    - -
    -
    -bit_length()
    -

    Number of bits necessary to represent self in binary.

    -
    >>> bin(37)
    -'0b100101'
    ->>> (37).bit_length()
    -6
    -
    -
    -
    - -
    -
    -conjugate()
    -

    Returns self, the complex conjugate of any int.

    -
    - -
    -
    -denominator
    -

    the denominator of a rational number in lowest terms

    -
    - -
    -
    -from_bytes(byteorder, *, signed=False)
    -

    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

    + ++++ + + +
    -
    -imag
    -

    the imaginary part of a complex number

    +
    +FixedWidth = 3
    +

    Wrapping around a fixed width

    -
    -numerator
    -

    the numerator of a rational number in lowest terms

    +
    +NoWrap = 0
    +

    No Wrapping is applied

    -
    -real
    -

    the real part of a complex number

    -
    - -
    -
    -to_bytes(length, byteorder, *, signed=False)
    -

    Return an array of bytes representing an integer.

    -
    -
    length

    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.

    -
    -
    +
    +WidgetWidth = 1
    +

    Wrapping around the Widget width

    @@ -1933,119 +710,35 @@ is raised.

    class MouseEvent[source]

    Input Mouse Event

    Events reported by TTkMouseEvent -> evt

    -
    -
    -as_integer_ratio()
    -

    Return integer ratio.

    -

    Return a pair of integers, whose ratio is exactly equal to the original int -and with a positive denominator.

    -
    >>> (10).as_integer_ratio()
    -(10, 1)
    ->>> (-10).as_integer_ratio()
    -(-10, 1)
    ->>> (0).as_integer_ratio()
    -(0, 1)
    -
    -
    -
    - -
    -
    -bit_count()
    -

    Number of ones in the binary representation of the absolute value of self.

    -

    Also known as the population count.

    -
    >>> bin(13)
    -'0b1101'
    ->>> (13).bit_count()
    -3
    -
    -
    -
    - -
    -
    -bit_length()
    -

    Number of bits necessary to represent self in binary.

    -
    >>> bin(37)
    -'0b100101'
    ->>> (37).bit_length()
    -6
    -
    -
    -
    - -
    -
    -conjugate()
    -

    Returns self, the complex conjugate of any int.

    -
    - -
    -
    -denominator
    -

    the denominator of a rational number in lowest terms

    -
    - -
    -
    -from_bytes(byteorder, *, signed=False)
    -

    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.

    -
    -
    -
    - -
    -
    -imag
    -

    the imaginary part of a complex number

    -
    - -
    -
    -numerator
    -

    the numerator of a rational number in lowest terms

    -
    - -
    -
    -real
    -

    the real part of a complex number

    -
    - -
    -
    -to_bytes(length, byteorder, *, signed=False)
    -

    Return an array of bytes representing an integer.

    -
    -
    length

    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.

    class MouseKey[source]

    Input Mouse Key

    Events reported by TTkMouseEvent -> key

    + ++++ + + + + + + + + + + + + + + + + + + + + + + + +

    NoButton

    The button state does not refer to any button.

    AllButtons

    This value corresponds to a mask of all possible mouse buttons.

    LeftButton

    The left button is pressed, or an event refers to the left button.

    RightButton

    The right button.

    MidButton

    The middle button.

    MiddleButton

    The middle button.

    Wheel

    The wheel control

    AllButtons = 134217727
    @@ -2095,245 +817,39 @@ is raised.

    The wheel control

    -
    -
    -as_integer_ratio()
    -

    Return integer ratio.

    -

    Return a pair of integers, whose ratio is exactly equal to the original int -and with a positive denominator.

    -
    >>> (10).as_integer_ratio()
    -(10, 1)
    ->>> (-10).as_integer_ratio()
    -(-10, 1)
    ->>> (0).as_integer_ratio()
    -(0, 1)
    -
    -
    -
    - -
    -
    -bit_count()
    -

    Number of ones in the binary representation of the absolute value of self.

    -

    Also known as the population count.

    -
    >>> bin(13)
    -'0b1101'
    ->>> (13).bit_count()
    -3
    -
    -
    -
    - -
    -
    -bit_length()
    -

    Number of bits necessary to represent self in binary.

    -
    >>> bin(37)
    -'0b100101'
    ->>> (37).bit_length()
    -6
    -
    -
    -
    - -
    -
    -conjugate()
    -

    Returns self, the complex conjugate of any int.

    -
    - -
    -
    -denominator
    -

    the denominator of a rational number in lowest terms

    -
    - -
    -
    -from_bytes(byteorder, *, signed=False)
    -

    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.

    -
    -
    -
    - -
    -
    -imag
    -

    the imaginary part of a complex number

    -
    - -
    -
    -numerator
    -

    the numerator of a rational number in lowest terms

    -
    - -
    -
    -real
    -

    the real part of a complex number

    -
    - -
    -
    -to_bytes(length, byteorder, *, signed=False)
    -

    Return an array of bytes representing an integer.

    -
    -
    length

    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.

    -
    -
    -
    -
    class ScrollBarPolicy[source]
    -
    -
    -as_integer_ratio()
    -

    Return integer ratio.

    -

    Return a pair of integers, whose ratio is exactly equal to the original int -and with a positive denominator.

    -
    >>> (10).as_integer_ratio()
    -(10, 1)
    ->>> (-10).as_integer_ratio()
    -(-10, 1)
    ->>> (0).as_integer_ratio()
    -(0, 1)
    -
    -
    -
    - -
    -
    -bit_count()
    -

    Number of ones in the binary representation of the absolute value of self.

    -

    Also known as the population count.

    -
    >>> bin(13)
    -'0b1101'
    ->>> (13).bit_count()
    -3
    -
    -
    -
    - -
    -
    -bit_length()
    -

    Number of bits necessary to represent self in binary.

    -
    >>> bin(37)
    -'0b100101'
    ->>> (37).bit_length()
    -6
    -
    -
    -
    - -
    -
    -conjugate()
    -

    Returns self, the complex conjugate of any int.

    -
    - -
    -
    -denominator
    -

    the denominator of a rational number in lowest terms

    -
    - -
    -
    -from_bytes(byteorder, *, signed=False)
    -

    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.

    -
    -
    -
    - -
    -
    -imag
    -

    the imaginary part of a complex number

    -
    - -
    -
    -numerator
    -

    the numerator of a rational number in lowest terms

    -
    - -
    -
    -real
    -

    the real part of a complex number

    -
    - -
    -
    -to_bytes(length, byteorder, *, signed=False)
    -

    Return an array of bytes representing an integer.

    -
    -
    length

    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.

    -
    -
    -
    - -
    +
    class ShortcutContext[source]
    -

    For a TTkShortcut event to occur, +

    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:

    + ++++ + + + + + + + + + + + + + + +

    WidgetShortcut

    The shortcut is active when its parent widget has focus.

    WidgetWithChildrenShortcut

    The shortcut is active when its parent widget, or any of its children has focus.

    WindowShortcut

    The shortcut is active when its parent widget is a logical subwidget of the active top-level window.

    ApplicationShortcut

    The shortcut is active when one of the applications windows are active.

    ApplicationShortcut = 2
    @@ -2358,235 +874,149 @@ The possible contexts are these:

    The shortcut is active when its parent widget is a logical subwidget of the active top-level window.

    -
    -
    -as_integer_ratio()
    -

    Return integer ratio.

    -

    Return a pair of integers, whose ratio is exactly equal to the original int -and with a positive denominator.

    -
    >>> (10).as_integer_ratio()
    -(10, 1)
    ->>> (-10).as_integer_ratio()
    -(-10, 1)
    ->>> (0).as_integer_ratio()
    -(0, 1)
    -
    -
    -
    - -
    -
    -bit_count()
    -

    Number of ones in the binary representation of the absolute value of self.

    -

    Also known as the population count.

    -
    >>> bin(13)
    -'0b1101'
    ->>> (13).bit_count()
    -3
    -
    -
    -
    - -
    -
    -bit_length()
    -

    Number of bits necessary to represent self in binary.

    -
    >>> bin(37)
    -'0b100101'
    ->>> (37).bit_length()
    -6
    -
    -
    -
    -
    -conjugate()
    -

    Returns self, the complex conjugate of any int.

    +
    +
    +class SortOrder[source]
    +

    This enum describes how the items in a widget are sorted.

    + ++++ + + + + + + + + +

    AscendingOrder

    The items are sorted ascending e.g.

    DescendingOrder

    The items are sorted descending e.g.

    +
    +
    +AscendingOrder = 0
    +

    The items are sorted ascending e.g. starts with ‘AAA’ ends with ‘ZZZ’ in Latin-1 locales

    -
    -denominator
    -

    the denominator of a rational number in lowest terms

    +
    +DescendingOrder = 1
    +

    The items are sorted descending e.g. starts with ‘ZZZ’ ends with ‘AAA’ in Latin-1 locales

    -
    -
    -from_bytes(byteorder, *, signed=False)
    -

    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.

    -
    -
    +
    +
    +class TTkItemSelectionModel[source]
    +

    These values describes the way the selection model will be updated.

    + ++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

    NoUpdate

    No selection will be made.

    Clear

    The complete selection will be cleared.

    Select

    All specified indexes will be selected.

    Deselect

    All specified indexes will be deselected.

    Toggle

    All specified indexes will be selected or deselected depending on their current state.

    Current

    The current selection will be updated.

    Rows

    All indexes will be expanded to span rows.

    Columns

    All indexes will be expanded to span columns.

    SelectCurrent

    A combination of Select and Current, provided for convenience.

    ToggleCurrent

    A combination of Toggle and Current, provided for convenience.

    ClearAndSelect

    A combination of Clear and Select, provided for convenience.

    -
    -imag
    -

    the imaginary part of a complex number

    +
    +Clear = 1
    +

    The complete selection will be cleared.

    -
    -numerator
    -

    the numerator of a rational number in lowest terms

    +
    +ClearAndSelect = 3
    +

    A combination of Clear and Select, provided for convenience.

    -
    -real
    -

    the real part of a complex number

    -
    - -
    -
    -to_bytes(length, byteorder, *, signed=False)
    -

    Return an array of bytes representing an integer.

    -
    -
    length

    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.

    -
    -
    -
    - -
    - -
    -
    -class SortOrder[source]
    -
    -
    -as_integer_ratio()
    -

    Return integer ratio.

    -

    Return a pair of integers, whose ratio is exactly equal to the original int -and with a positive denominator.

    -
    >>> (10).as_integer_ratio()
    -(10, 1)
    ->>> (-10).as_integer_ratio()
    -(-10, 1)
    ->>> (0).as_integer_ratio()
    -(0, 1)
    -
    -
    -
    - -
    -
    -bit_count()
    -

    Number of ones in the binary representation of the absolute value of self.

    -

    Also known as the population count.

    -
    >>> bin(13)
    -'0b1101'
    ->>> (13).bit_count()
    -3
    -
    -
    +
    +Columns = 64
    +

    All indexes will be expanded to span columns.

    -
    -
    -bit_length()
    -

    Number of bits necessary to represent self in binary.

    -
    >>> bin(37)
    -'0b100101'
    ->>> (37).bit_length()
    -6
    -
    -
    +
    +
    +Current = 16
    +

    The current selection will be updated.

    -
    -
    -conjugate()
    -

    Returns self, the complex conjugate of any int.

    +
    +
    +Deselect = 4
    +

    All specified indexes will be deselected.

    -
    -denominator
    -

    the denominator of a rational number in lowest terms

    +
    +NoUpdate = 0
    +

    No selection will be made.

    -
    -
    -from_bytes(byteorder, *, signed=False)
    -

    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.

    -
    -
    +
    +
    +Rows = 32
    +

    All indexes will be expanded to span rows.

    -
    -imag
    -

    the imaginary part of a complex number

    +
    +Select = 2
    +

    All specified indexes will be selected.

    -
    -numerator
    -

    the numerator of a rational number in lowest terms

    +
    +SelectCurrent = 18
    +

    A combination of Select and Current, provided for convenience.

    -
    -real
    -

    the real part of a complex number

    +
    +Toggle = 8
    +

    All specified indexes will be selected or deselected depending on their current state.

    -
    -
    -to_bytes(length, byteorder, *, signed=False)
    -

    Return an array of bytes representing an integer.

    -
    -
    length

    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.

    -
    -
    +
    +
    +ToggleCurrent = 24
    +

    A combination of Toggle and Current, provided for convenience.

    @@ -2594,7 +1024,31 @@ is raised.

    class WindowFlag[source]
    -
    +

    Those flags are used to enable customization of the window controls.

    + ++++ + + + + + + + + + + + + + + + + + +

    WindowReduceButtonHint

    Adds a reduce button.

    WindowMinimizeButtonHint

    Adds a minimize button.

    WindowMaximizeButtonHint

    Adds a maximize button.

    WindowMinMaxButtonsHint

    Adds a minimize and a maximize button.

    WindowCloseButtonHint

    Adds a close button.

    +
    WindowCloseButtonHint = 134217728

    Adds a close button.

    @@ -2624,125 +1078,29 @@ is raised.

    Adds a reduce button.

    -
    -
    -as_integer_ratio()
    -

    Return integer ratio.

    -

    Return a pair of integers, whose ratio is exactly equal to the original int -and with a positive denominator.

    -
    >>> (10).as_integer_ratio()
    -(10, 1)
    ->>> (-10).as_integer_ratio()
    -(-10, 1)
    ->>> (0).as_integer_ratio()
    -(0, 1)
    -
    -
    -
    - -
    -
    -bit_count()
    -

    Number of ones in the binary representation of the absolute value of self.

    -

    Also known as the population count.

    -
    >>> bin(13)
    -'0b1101'
    ->>> (13).bit_count()
    -3
    -
    -
    -
    - -
    -
    -bit_length()
    -

    Number of bits necessary to represent self in binary.

    -
    >>> bin(37)
    -'0b100101'
    ->>> (37).bit_length()
    -6
    -
    -
    -
    - -
    -
    -conjugate()
    -

    Returns self, the complex conjugate of any int.

    -
    - -
    -
    -denominator
    -

    the denominator of a rational number in lowest terms

    -
    - -
    -
    -from_bytes(byteorder, *, signed=False)
    -

    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.

    -
    -
    -
    - -
    -
    -imag
    -

    the imaginary part of a complex number

    -
    - -
    -
    -numerator
    -

    the numerator of a rational number in lowest terms

    -
    - -
    -
    -real
    -

    the real part of a complex number

    -
    - -
    -
    -to_bytes(length, byteorder, *, signed=False)
    -

    Return an array of bytes representing an integer.

    -
    -
    length

    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.

    -
    -
    -
    -
    class WrapMode[source]

    Those constants describes how text is wrapped in a document.

    + ++++ + + + + + + + + + + + +

    WordWrap

    Text is wrapped at word boundaries.

    WrapAnywhere

    Text can be wrapped at any point on a line, even if it occurs in the middle of a word.

    WrapAtWordBoundaryOrAnywhere

    If possible, wrapping occurs at a word boundary; otherwise it will occur at the appropriate point on the line, even in the middle of a word.

    WordWrap = 1
    @@ -2761,119 +1119,6 @@ is raised.

    If possible, wrapping occurs at a word boundary; otherwise it will occur at the appropriate point on the line, even in the middle of a word.

    -
    -
    -as_integer_ratio()
    -

    Return integer ratio.

    -

    Return a pair of integers, whose ratio is exactly equal to the original int -and with a positive denominator.

    -
    >>> (10).as_integer_ratio()
    -(10, 1)
    ->>> (-10).as_integer_ratio()
    -(-10, 1)
    ->>> (0).as_integer_ratio()
    -(0, 1)
    -
    -
    -
    - -
    -
    -bit_count()
    -

    Number of ones in the binary representation of the absolute value of self.

    -

    Also known as the population count.

    -
    >>> bin(13)
    -'0b1101'
    ->>> (13).bit_count()
    -3
    -
    -
    -
    - -
    -
    -bit_length()
    -

    Number of bits necessary to represent self in binary.

    -
    >>> bin(37)
    -'0b100101'
    ->>> (37).bit_length()
    -6
    -
    -
    -
    - -
    -
    -conjugate()
    -

    Returns self, the complex conjugate of any int.

    -
    - -
    -
    -denominator
    -

    the denominator of a rational number in lowest terms

    -
    - -
    -
    -from_bytes(byteorder, *, signed=False)
    -

    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.

    -
    -
    -
    - -
    -
    -imag
    -

    the imaginary part of a complex number

    -
    - -
    -
    -numerator
    -

    the numerator of a rational number in lowest terms

    -
    - -
    -
    -real
    -

    the real part of a complex number

    -
    - -
    -
    -to_bytes(length, byteorder, *, signed=False)
    -

    Return an array of bytes representing an integer.

    -
    -
    length

    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.

    -
    -
    -
    -
    @@ -2887,7 +1132,21 @@ is raised.

    class AcceptMode
    -
    +
    ++++ + + + + + + + + +

    AcceptOpen

    Open

    AcceptSave

    Save

    +
    AcceptOpen = 0

    Open

    @@ -2899,119 +1158,6 @@ is raised.

    Save

    -
    -
    -as_integer_ratio()
    -

    Return integer ratio.

    -

    Return a pair of integers, whose ratio is exactly equal to the original int -and with a positive denominator.

    -
    >>> (10).as_integer_ratio()
    -(10, 1)
    ->>> (-10).as_integer_ratio()
    -(-10, 1)
    ->>> (0).as_integer_ratio()
    -(0, 1)
    -
    -
    -
    - -
    -
    -bit_count()
    -

    Number of ones in the binary representation of the absolute value of self.

    -

    Also known as the population count.

    -
    >>> bin(13)
    -'0b1101'
    ->>> (13).bit_count()
    -3
    -
    -
    -
    - -
    -
    -bit_length()
    -

    Number of bits necessary to represent self in binary.

    -
    >>> bin(37)
    -'0b100101'
    ->>> (37).bit_length()
    -6
    -
    -
    -
    - -
    -
    -conjugate()
    -

    Returns self, the complex conjugate of any int.

    -
    - -
    -
    -denominator
    -

    the denominator of a rational number in lowest terms

    -
    - -
    -
    -from_bytes(byteorder, *, signed=False)
    -

    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.

    -
    -
    -
    - -
    -
    -imag
    -

    the imaginary part of a complex number

    -
    - -
    -
    -numerator
    -

    the numerator of a rational number in lowest terms

    -
    - -
    -
    -real
    -

    the real part of a complex number

    -
    - -
    -
    -to_bytes(length, byteorder, *, signed=False)
    -

    Return an array of bytes representing an integer.

    -
    -
    length

    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.

    -
    -
    -
    -
    @@ -3071,119 +1217,6 @@ is raised.

    Aligns with the right edge.

    -
    -
    -as_integer_ratio()
    -

    Return integer ratio.

    -

    Return a pair of integers, whose ratio is exactly equal to the original int -and with a positive denominator.

    -
    >>> (10).as_integer_ratio()
    -(10, 1)
    ->>> (-10).as_integer_ratio()
    -(-10, 1)
    ->>> (0).as_integer_ratio()
    -(0, 1)
    -
    -
    -
    - -
    -
    -bit_count()
    -

    Number of ones in the binary representation of the absolute value of self.

    -

    Also known as the population count.

    -
    >>> bin(13)
    -'0b1101'
    ->>> (13).bit_count()
    -3
    -
    -
    -
    - -
    -
    -bit_length()
    -

    Number of bits necessary to represent self in binary.

    -
    >>> bin(37)
    -'0b100101'
    ->>> (37).bit_length()
    -6
    -
    -
    -
    - -
    -
    -conjugate()
    -

    Returns self, the complex conjugate of any int.

    -
    - -
    -
    -denominator
    -

    the denominator of a rational number in lowest terms

    -
    - -
    -
    -from_bytes(byteorder, *, signed=False)
    -

    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.

    -
    -
    -
    - -
    -
    -imag
    -

    the imaginary part of a complex number

    -
    - -
    -
    -numerator
    -

    the numerator of a rational number in lowest terms

    -
    - -
    -
    -real
    -

    the real part of a complex number

    -
    - -
    -
    -to_bytes(length, byteorder, *, signed=False)
    -

    Return an array of bytes representing an integer.

    -
    -
    length

    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.

    -
    -
    -
    -
    @@ -3196,128 +1229,33 @@ is raised.

    -

    Unchecked

    -

    +

    Unchecked

    +

    The item is unchecked.

    -

    PartiallyChecked

    -

    +

    PartiallyChecked

    +

    The item is partially checked.

    -

    Checked

    -

    +

    Checked

    +

    The item is checked.

    -
    -
    -as_integer_ratio()
    -

    Return integer ratio.

    -

    Return a pair of integers, whose ratio is exactly equal to the original int -and with a positive denominator.

    -
    >>> (10).as_integer_ratio()
    -(10, 1)
    ->>> (-10).as_integer_ratio()
    -(-10, 1)
    ->>> (0).as_integer_ratio()
    -(0, 1)
    -
    -
    -
    - -
    -
    -bit_count()
    -

    Number of ones in the binary representation of the absolute value of self.

    -

    Also known as the population count.

    -
    >>> bin(13)
    -'0b1101'
    ->>> (13).bit_count()
    -3
    -
    -
    -
    - -
    -
    -bit_length()
    -

    Number of bits necessary to represent self in binary.

    -
    >>> bin(37)
    -'0b100101'
    ->>> (37).bit_length()
    -6
    -
    -
    -
    - -
    -
    -conjugate()
    -

    Returns self, the complex conjugate of any int.

    -
    - -
    -
    -denominator
    -

    the denominator of a rational number in lowest terms

    -
    - -
    -
    -from_bytes(byteorder, *, signed=False)
    -

    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.

    -
    -
    -
    -
    -
    -imag
    -

    the imaginary part of a complex number

    +
    +Checked = 2
    +

    The item is checked.

    -
    -numerator
    -

    the numerator of a rational number in lowest terms

    +
    +PartiallyChecked = 1
    +

    The item is partially checked. Items in hierarchical models may be partially checked if some, but not all, of their children are checked.

    -
    -real
    -

    the real part of a complex number

    -
    - -
    -
    -to_bytes(length, byteorder, *, signed=False)
    -

    Return an array of bytes representing an integer.

    -
    -
    length

    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.

    -
    -
    +
    +Unchecked = 0
    +

    The item is unchecked.

    @@ -3325,243 +1263,31 @@ is raised.

    class ChildIndicatorPolicy
    -
    -
    -as_integer_ratio()
    -

    Return integer ratio.

    -

    Return a pair of integers, whose ratio is exactly equal to the original int -and with a positive denominator.

    -
    >>> (10).as_integer_ratio()
    -(10, 1)
    ->>> (-10).as_integer_ratio()
    -(-10, 1)
    ->>> (0).as_integer_ratio()
    -(0, 1)
    -
    -
    -
    - -
    -
    -bit_count()
    -

    Number of ones in the binary representation of the absolute value of self.

    -

    Also known as the population count.

    -
    >>> bin(13)
    -'0b1101'
    ->>> (13).bit_count()
    -3
    -
    -
    -
    - -
    -
    -bit_length()
    -

    Number of bits necessary to represent self in binary.

    -
    >>> bin(37)
    -'0b100101'
    ->>> (37).bit_length()
    -6
    -
    -
    -
    - -
    -
    -conjugate()
    -

    Returns self, the complex conjugate of any int.

    -
    - -
    -
    -denominator
    -

    the denominator of a rational number in lowest terms

    -
    - -
    -
    -from_bytes(byteorder, *, signed=False)
    -

    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.

    -
    -
    -
    - -
    -
    -imag
    -

    the imaginary part of a complex number

    -
    - -
    -
    -numerator
    -

    the numerator of a rational number in lowest terms

    -
    - -
    -
    -real
    -

    the real part of a complex number

    -
    - -
    -
    -to_bytes(length, byteorder, *, signed=False)
    -

    Return an array of bytes representing an integer.

    -
    -
    length

    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.

    -
    -
    -
    - -
    +
    class ColorType
    -
    -
    -as_integer_ratio()
    -

    Return integer ratio.

    -

    Return a pair of integers, whose ratio is exactly equal to the original int -and with a positive denominator.

    -
    >>> (10).as_integer_ratio()
    -(10, 1)
    ->>> (-10).as_integer_ratio()
    -(-10, 1)
    ->>> (0).as_integer_ratio()
    -(0, 1)
    -
    -
    -
    - -
    -
    -bit_count()
    -

    Number of ones in the binary representation of the absolute value of self.

    -

    Also known as the population count.

    -
    >>> bin(13)
    -'0b1101'
    ->>> (13).bit_count()
    -3
    -
    -
    -
    - -
    -
    -bit_length()
    -

    Number of bits necessary to represent self in binary.

    -
    >>> bin(37)
    -'0b100101'
    ->>> (37).bit_length()
    -6
    -
    -
    -
    - -
    -
    -conjugate()
    -

    Returns self, the complex conjugate of any int.

    -
    - -
    -
    -denominator
    -

    the denominator of a rational number in lowest terms

    -
    - -
    -
    -from_bytes(byteorder, *, signed=False)
    -

    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.

    -
    -
    -
    - -
    -
    -imag
    -

    the imaginary part of a complex number

    -
    - -
    -
    -numerator
    -

    the numerator of a rational number in lowest terms

    -
    - -
    -
    -real
    -

    the real part of a complex number

    -
    - -
    -
    -to_bytes(length, byteorder, *, signed=False)
    -

    Return an array of bytes representing an integer.

    -
    -
    length

    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.

    -
    -
    -
    - -
    +
    class Direction

    This class type is used to describe the direction

    + ++++ + + + + + + + + +

    HORIZONTAL

    Horizontal direction

    VERTICAL

    Vertical direction

    HORIZONTAL = 3
    @@ -3574,125 +1300,32 @@ is raised.

    Vertical direction

    -
    -
    -as_integer_ratio()
    -

    Return integer ratio.

    -

    Return a pair of integers, whose ratio is exactly equal to the original int -and with a positive denominator.

    -
    >>> (10).as_integer_ratio()
    -(10, 1)
    ->>> (-10).as_integer_ratio()
    -(-10, 1)
    ->>> (0).as_integer_ratio()
    -(0, 1)
    -
    -
    -
    - -
    -
    -bit_count()
    -

    Number of ones in the binary representation of the absolute value of self.

    -

    Also known as the population count.

    -
    >>> bin(13)
    -'0b1101'
    ->>> (13).bit_count()
    -3
    -
    -
    -
    - -
    -
    -bit_length()
    -

    Number of bits necessary to represent self in binary.

    -
    >>> bin(37)
    -'0b100101'
    ->>> (37).bit_length()
    -6
    -
    -
    -
    - -
    -
    -conjugate()
    -

    Returns self, the complex conjugate of any int.

    -
    - -
    -
    -denominator
    -

    the denominator of a rational number in lowest terms

    -
    - -
    -
    -from_bytes(byteorder, *, signed=False)
    -

    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.

    -
    -
    -
    - -
    -
    -imag
    -

    the imaginary part of a complex number

    -
    - -
    -
    -numerator
    -

    the numerator of a rational number in lowest terms

    -
    - -
    -
    -real
    -

    the real part of a complex number

    -
    - -
    -
    -to_bytes(length, byteorder, *, signed=False)
    -

    Return an array of bytes representing an integer.

    -
    -
    length

    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.

    -
    -
    -
    -
    class DragDropMode

    Specifies the Drag and Drop mode allowed by this widget

    + ++++ + + + + + + + + + + + + + + +

    NoDragDrop

    No Drag and Drop is allowed

    AllowDrag

    Drag allowed

    AllowDrop

    Drop allowed

    AllowDragDrop

    Drag and Drop allowed

    AllowDrag = 1
    @@ -3700,134 +1333,21 @@ is raised.

    -
    -AllowDragDrop = 3
    -

    Drag and Drop allowed

    -
    - -
    -
    -AllowDrop = 2
    -

    Drop allowed

    -
    - -
    -
    -NoDragDrop = 0
    -

    No Drag and Drop is allowed

    -
    - -
    -
    -as_integer_ratio()
    -

    Return integer ratio.

    -

    Return a pair of integers, whose ratio is exactly equal to the original int -and with a positive denominator.

    -
    >>> (10).as_integer_ratio()
    -(10, 1)
    ->>> (-10).as_integer_ratio()
    -(-10, 1)
    ->>> (0).as_integer_ratio()
    -(0, 1)
    -
    -
    -
    - -
    -
    -bit_count()
    -

    Number of ones in the binary representation of the absolute value of self.

    -

    Also known as the population count.

    -
    >>> bin(13)
    -'0b1101'
    ->>> (13).bit_count()
    -3
    -
    -
    -
    - -
    -
    -bit_length()
    -

    Number of bits necessary to represent self in binary.

    -
    >>> bin(37)
    -'0b100101'
    ->>> (37).bit_length()
    -6
    -
    -
    -
    - -
    -
    -conjugate()
    -

    Returns self, the complex conjugate of any int.

    -
    - -
    -
    -denominator
    -

    the denominator of a rational number in lowest terms

    -
    - -
    -
    -from_bytes(byteorder, *, signed=False)
    -

    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.

    -
    -
    -
    - -
    -
    -imag
    -

    the imaginary part of a complex number

    -
    - -
    -
    -numerator
    -

    the numerator of a rational number in lowest terms

    +
    +AllowDragDrop = 3
    +

    Drag and Drop allowed

    -
    -real
    -

    the real part of a complex number

    +
    +AllowDrop = 2
    +

    Drop allowed

    -
    -
    -to_bytes(length, byteorder, *, signed=False)
    -

    Return an array of bytes representing an integer.

    -
    -
    length

    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.

    -
    -
    +
    +
    +NoDragDrop = 0
    +

    No Drag and Drop is allowed

    @@ -3835,7 +1355,24 @@ is raised.

    class FileMode
    -
    +
    ++++ + + + + + + + + + + + +

    AnyFile

    The name of a file, whether it exists or not.

    ExistingFile

    The name of a single existing file.

    Directory

    The name of a directory.

    +
    AnyFile = 0

    The name of a file, whether it exists or not.

    @@ -3853,125 +1390,29 @@ is raised.

    The name of a single existing file.

    -
    -
    -as_integer_ratio()
    -

    Return integer ratio.

    -

    Return a pair of integers, whose ratio is exactly equal to the original int -and with a positive denominator.

    -
    >>> (10).as_integer_ratio()
    -(10, 1)
    ->>> (-10).as_integer_ratio()
    -(-10, 1)
    ->>> (0).as_integer_ratio()
    -(0, 1)
    -
    -
    -
    - -
    -
    -bit_count()
    -

    Number of ones in the binary representation of the absolute value of self.

    -

    Also known as the population count.

    -
    >>> bin(13)
    -'0b1101'
    ->>> (13).bit_count()
    -3
    -
    -
    -
    - -
    -
    -bit_length()
    -

    Number of bits necessary to represent self in binary.

    -
    >>> bin(37)
    -'0b100101'
    ->>> (37).bit_length()
    -6
    -
    -
    -
    - -
    -
    -conjugate()
    -

    Returns self, the complex conjugate of any int.

    -
    - -
    -
    -denominator
    -

    the denominator of a rational number in lowest terms

    -
    - -
    -
    -from_bytes(byteorder, *, signed=False)
    -

    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.

    -
    -
    -
    - -
    -
    -imag
    -

    the imaginary part of a complex number

    -
    - -
    -
    -numerator
    -

    the numerator of a rational number in lowest terms

    -
    - -
    -
    -real
    -

    the real part of a complex number

    -
    - -
    -
    -to_bytes(length, byteorder, *, signed=False)
    -

    Return an array of bytes representing an integer.

    -
    -
    length

    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.

    -
    -
    -
    -
    class InsertPolicy

    Specifies what the TTkComboBox should do when a new string is entered by the user.

    + ++++ + + + + + + + + + + + +

    NoInsert

    The string will not be inserted into the combobox.

    InsertAtTop

    The string will be inserted as the first item in the combobox.

    InsertAtBottom

    The string will be inserted after the last item in the combobox.

    InsertAtBottom = 3
    @@ -3990,117 +1431,54 @@ is raised.

    The string will not be inserted into the combobox.

    -
    -
    -as_integer_ratio()
    -

    Return integer ratio.

    -

    Return a pair of integers, whose ratio is exactly equal to the original int -and with a positive denominator.

    -
    >>> (10).as_integer_ratio()
    -(10, 1)
    ->>> (-10).as_integer_ratio()
    -(-10, 1)
    ->>> (0).as_integer_ratio()
    -(0, 1)
    -
    -
    -
    - -
    -
    -bit_count()
    -

    Number of ones in the binary representation of the absolute value of self.

    -

    Also known as the population count.

    -
    >>> bin(13)
    -'0b1101'
    ->>> (13).bit_count()
    -3
    -
    -
    -
    - -
    -
    -bit_length()
    -

    Number of bits necessary to represent self in binary.

    -
    >>> bin(37)
    -'0b100101'
    ->>> (37).bit_length()
    -6
    -
    -
    -
    - -
    -
    -conjugate()
    -

    Returns self, the complex conjugate of any int.

    +
    +
    +class ItemFlag
    +

    ItemFlag describes the properties of an item

    + ++++ + + + + + + + + + + + + + + +

    NoItemFlags

    It does not have any properties set.

    ItemIsSelectable

    It can be selected.

    ItemIsEditable

    It can be edited.

    ItemIsEnabled

    The user can interact with the item.

    -
    -denominator
    -

    the denominator of a rational number in lowest terms

    -
    - -
    -
    -from_bytes(byteorder, *, signed=False)
    -

    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.

    -
    -
    +
    +ItemIsEditable = 2
    +

    It can be edited.

    -
    -imag
    -

    the imaginary part of a complex number

    +
    +ItemIsEnabled = 32
    +

    The user can interact with the item.

    -
    -numerator
    -

    the numerator of a rational number in lowest terms

    +
    +ItemIsSelectable = 1
    +

    It can be selected.

    -
    -real
    -

    the real part of a complex number

    -
    - -
    -
    -to_bytes(length, byteorder, *, signed=False)
    -

    Return an array of bytes representing an integer.

    -
    -
    length

    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.

    -
    -
    +
    +NoItemFlags = 0
    +

    It does not have any properties set.

    @@ -4110,6 +1488,47 @@ is raised.

    class KeyModifier

    Input SpecialKey modifiers

    Modifier reported by TTkKeyEvent -> mod

    + ++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

    NoModifier

    No modifier key is pressed.

    ShiftModifier

    A Shift key on the keyboard is pressed.

    ControlModifier

    A Ctrl key on the keyboard is pressed.

    AltModifier

    An Alt key on the keyboard is pressed.

    MetaModifier

    A Meta key on the keyboard is pressed.

    KeypadModifier

    A keypad button is pressed.

    GroupSwitchModifier

    X11 only (unless activated on Windows by a command line argument).

    SHIFT

    The Shift keys provided on all standard keyboards.

    META

    The Meta keys.

    CTRL

    The Ctrl keys.

    ALT

    The normal Alt keys, but not keys like AltGr.

    ALT = 134217728
    @@ -4176,119 +1595,6 @@ is raised.

    A Shift key on the keyboard is pressed.

    -
    -
    -as_integer_ratio()
    -

    Return integer ratio.

    -

    Return a pair of integers, whose ratio is exactly equal to the original int -and with a positive denominator.

    -
    >>> (10).as_integer_ratio()
    -(10, 1)
    ->>> (-10).as_integer_ratio()
    -(-10, 1)
    ->>> (0).as_integer_ratio()
    -(0, 1)
    -
    -
    -
    - -
    -
    -bit_count()
    -

    Number of ones in the binary representation of the absolute value of self.

    -

    Also known as the population count.

    -
    >>> bin(13)
    -'0b1101'
    ->>> (13).bit_count()
    -3
    -
    -
    -
    - -
    -
    -bit_length()
    -

    Number of bits necessary to represent self in binary.

    -
    >>> bin(37)
    -'0b100101'
    ->>> (37).bit_length()
    -6
    -
    -
    -
    - -
    -
    -conjugate()
    -

    Returns self, the complex conjugate of any int.

    -
    - -
    -
    -denominator
    -

    the denominator of a rational number in lowest terms

    -
    - -
    -
    -from_bytes(byteorder, *, signed=False)
    -

    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.

    -
    -
    -
    - -
    -
    -imag
    -

    the imaginary part of a complex number

    -
    - -
    -
    -numerator
    -

    the numerator of a rational number in lowest terms

    -
    - -
    -
    -real
    -

    the real part of a complex number

    -
    - -
    -
    -to_bytes(length, byteorder, *, signed=False)
    -

    Return an array of bytes representing an integer.

    -
    -
    length

    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.

    -
    -
    -
    -
    @@ -4296,6 +1602,20 @@ is raised.

    class KeyType

    Input Key Types

    Key type reported by TTkKeyEvent -> key

    + ++++ + + + + + + + + +

    Character

    Input Char Key

    SpecialKey

    Input Special Key

    Character = 1
    @@ -4308,125 +1628,26 @@ is raised.

    Input Special Key

    -
    -
    -as_integer_ratio()
    -

    Return integer ratio.

    -

    Return a pair of integers, whose ratio is exactly equal to the original int -and with a positive denominator.

    -
    >>> (10).as_integer_ratio()
    -(10, 1)
    ->>> (-10).as_integer_ratio()
    -(-10, 1)
    ->>> (0).as_integer_ratio()
    -(0, 1)
    -
    -
    -
    - -
    -
    -bit_count()
    -

    Number of ones in the binary representation of the absolute value of self.

    -

    Also known as the population count.

    -
    >>> bin(13)
    -'0b1101'
    ->>> (13).bit_count()
    -3
    -
    -
    -
    - -
    -
    -bit_length()
    -

    Number of bits necessary to represent self in binary.

    -
    >>> bin(37)
    -'0b100101'
    ->>> (37).bit_length()
    -6
    -
    -
    -
    - -
    -
    -conjugate()
    -

    Returns self, the complex conjugate of any int.

    -
    - -
    -
    -denominator
    -

    the denominator of a rational number in lowest terms

    -
    - -
    -
    -from_bytes(byteorder, *, signed=False)
    -

    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.

    -
    -
    -
    - -
    -
    -imag
    -

    the imaginary part of a complex number

    -
    - -
    -
    -numerator
    -

    the numerator of a rational number in lowest terms

    -
    - -
    -
    -real
    -

    the real part of a complex number

    -
    - -
    -
    -to_bytes(length, byteorder, *, signed=False)
    -

    Return an array of bytes representing an integer.

    -
    -
    length

    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.

    -
    -
    -
    -
    class LayoutItemTypes

    Types used internally in TTkLayouts

    + ++++ + + + + + + + + +

    LayoutItem

    Item Type Layout

    WidgetItem

    Item Type Widget

    LayoutItem = 1
    @@ -4439,357 +1660,74 @@ is raised.

    Item Type Widget

    -
    -
    -as_integer_ratio()
    -

    Return integer ratio.

    -

    Return a pair of integers, whose ratio is exactly equal to the original int -and with a positive denominator.

    -
    >>> (10).as_integer_ratio()
    -(10, 1)
    ->>> (-10).as_integer_ratio()
    -(-10, 1)
    ->>> (0).as_integer_ratio()
    -(0, 1)
    -
    -
    -
    - -
    -
    -bit_count()
    -

    Number of ones in the binary representation of the absolute value of self.

    -

    Also known as the population count.

    -
    >>> bin(13)
    -'0b1101'
    ->>> (13).bit_count()
    -3
    -
    -
    -
    - -
    -
    -bit_length()
    -

    Number of bits necessary to represent self in binary.

    -
    >>> bin(37)
    -'0b100101'
    ->>> (37).bit_length()
    -6
    -
    -
    -
    - -
    -
    -conjugate()
    -

    Returns self, the complex conjugate of any int.

    -
    - -
    -
    -denominator
    -

    the denominator of a rational number in lowest terms

    -
    - -
    -
    -from_bytes(byteorder, *, signed=False)
    -

    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.

    -
    -
    -
    - -
    -
    -imag
    -

    the imaginary part of a complex number

    -
    - -
    -
    -numerator
    -

    the numerator of a rational number in lowest terms

    -
    - -
    -
    -real
    -

    the real part of a complex number

    -
    - -
    -
    -to_bytes(length, byteorder, *, signed=False)
    -

    Return an array of bytes representing an integer.

    -
    -
    length

    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.

    -
    -
    -
    -
    -class LineWrapMode
    -
    -
    -as_integer_ratio()
    -

    Return integer ratio.

    -

    Return a pair of integers, whose ratio is exactly equal to the original int -and with a positive denominator.

    -
    >>> (10).as_integer_ratio()
    -(10, 1)
    ->>> (-10).as_integer_ratio()
    -(-10, 1)
    ->>> (0).as_integer_ratio()
    -(0, 1)
    -
    -
    -
    - -
    -
    -bit_count()
    -

    Number of ones in the binary representation of the absolute value of self.

    -

    Also known as the population count.

    -
    >>> bin(13)
    -'0b1101'
    ->>> (13).bit_count()
    -3
    -
    -
    -
    - -
    -
    -bit_length()
    -

    Number of bits necessary to represent self in binary.

    -
    >>> bin(37)
    -'0b100101'
    ->>> (37).bit_length()
    -6
    -
    -
    -
    - -
    -
    -conjugate()
    -

    Returns self, the complex conjugate of any int.

    -
    - -
    -
    -denominator
    -

    the denominator of a rational number in lowest terms

    -
    - -
    -
    -from_bytes(byteorder, *, signed=False)
    -

    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.

    -
    -
    -
    - -
    -
    -imag
    -

    the imaginary part of a complex number

    -
    - -
    -
    -numerator
    -

    the numerator of a rational number in lowest terms

    -
    - -
    -
    -real
    -

    the real part of a complex number

    -
    - -
    -
    -to_bytes(length, byteorder, *, signed=False)
    -

    Return an array of bytes representing an integer.

    -
    -
    length

    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.

    -
    -
    -
    - -
    - -
    -
    -class MouseEvent
    -

    Input Mouse Event

    -

    Events reported by TTkMouseEvent -> evt

    -
    -
    -as_integer_ratio()
    -

    Return integer ratio.

    -

    Return a pair of integers, whose ratio is exactly equal to the original int -and with a positive denominator.

    -
    >>> (10).as_integer_ratio()
    -(10, 1)
    ->>> (-10).as_integer_ratio()
    -(-10, 1)
    ->>> (0).as_integer_ratio()
    -(0, 1)
    -
    -
    -
    - -
    -
    -bit_count()
    -

    Number of ones in the binary representation of the absolute value of self.

    -

    Also known as the population count.

    -
    >>> bin(13)
    -'0b1101'
    ->>> (13).bit_count()
    -3
    -
    -
    -
    - -
    -
    -bit_length()
    -

    Number of bits necessary to represent self in binary.

    -
    >>> bin(37)
    -'0b100101'
    ->>> (37).bit_length()
    -6
    -
    -
    -
    - -
    -
    -conjugate()
    -

    Returns self, the complex conjugate of any int.

    -
    - -
    -
    -denominator
    -

    the denominator of a rational number in lowest terms

    -
    - -
    -
    -from_bytes(byteorder, *, signed=False)
    -

    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.

    -
    -
    -
    - +class LineWrapMode +

    Those constants describes which wrapping status is required in the document

    + ++++ + + +
    -
    -imag
    -

    the imaginary part of a complex number

    +
    +FixedWidth = 3
    +

    Wrapping around a fixed width

    -
    -numerator
    -

    the numerator of a rational number in lowest terms

    +
    +NoWrap = 0
    +

    No Wrapping is applied

    -
    -real
    -

    the real part of a complex number

    +
    +WidgetWidth = 1
    +

    Wrapping around the Widget width

    -
    -
    -to_bytes(length, byteorder, *, signed=False)
    -

    Return an array of bytes representing an integer.

    -
    -
    length

    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.

    -
    -
    +
    +
    +class MouseEvent
    +

    Input Mouse Event

    +

    Events reported by TTkMouseEvent -> evt

    + ++++ + + + + + + + + + + + + + + + + + + + + + + + +

    NoEvent

    Press

    Release

    Drag

    Move

    WHEEL_Up

    WHEEL_Down

    @@ -4797,6 +1735,35 @@ is raised.

    class MouseKey

    Input Mouse Key

    Events reported by TTkMouseEvent -> key

    + ++++ + + + + + + + + + + + + + + + + + + + + + + + +

    NoButton

    The button state does not refer to any button.

    AllButtons

    This value corresponds to a mask of all possible mouse buttons.

    LeftButton

    The left button is pressed, or an event refers to the left button.

    RightButton

    The right button.

    MidButton

    The middle button.

    MiddleButton

    The middle button.

    Wheel

    The wheel control

    AllButtons = 134217727
    @@ -4839,245 +1806,39 @@ is raised.

    The wheel control

    -
    -
    -as_integer_ratio()
    -

    Return integer ratio.

    -

    Return a pair of integers, whose ratio is exactly equal to the original int -and with a positive denominator.

    -
    >>> (10).as_integer_ratio()
    -(10, 1)
    ->>> (-10).as_integer_ratio()
    -(-10, 1)
    ->>> (0).as_integer_ratio()
    -(0, 1)
    -
    -
    -
    - -
    -
    -bit_count()
    -

    Number of ones in the binary representation of the absolute value of self.

    -

    Also known as the population count.

    -
    >>> bin(13)
    -'0b1101'
    ->>> (13).bit_count()
    -3
    -
    -
    -
    - -
    -
    -bit_length()
    -

    Number of bits necessary to represent self in binary.

    -
    >>> bin(37)
    -'0b100101'
    ->>> (37).bit_length()
    -6
    -
    -
    -
    - -
    -
    -conjugate()
    -

    Returns self, the complex conjugate of any int.

    -
    - -
    -
    -denominator
    -

    the denominator of a rational number in lowest terms

    -
    - -
    -
    -from_bytes(byteorder, *, signed=False)
    -

    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.

    -
    -
    -
    - -
    -
    -imag
    -

    the imaginary part of a complex number

    -
    - -
    -
    -numerator
    -

    the numerator of a rational number in lowest terms

    -
    - -
    -
    -real
    -

    the real part of a complex number

    -
    - -
    -
    -to_bytes(length, byteorder, *, signed=False)
    -

    Return an array of bytes representing an integer.

    -
    -
    length

    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.

    -
    -
    -
    -
    class ScrollBarPolicy
    -
    -
    -as_integer_ratio()
    -

    Return integer ratio.

    -

    Return a pair of integers, whose ratio is exactly equal to the original int -and with a positive denominator.

    -
    >>> (10).as_integer_ratio()
    -(10, 1)
    ->>> (-10).as_integer_ratio()
    -(-10, 1)
    ->>> (0).as_integer_ratio()
    -(0, 1)
    -
    -
    -
    - -
    -
    -bit_count()
    -

    Number of ones in the binary representation of the absolute value of self.

    -

    Also known as the population count.

    -
    >>> bin(13)
    -'0b1101'
    ->>> (13).bit_count()
    -3
    -
    -
    -
    - -
    -
    -bit_length()
    -

    Number of bits necessary to represent self in binary.

    -
    >>> bin(37)
    -'0b100101'
    ->>> (37).bit_length()
    -6
    -
    -
    -
    - -
    -
    -conjugate()
    -

    Returns self, the complex conjugate of any int.

    -
    - -
    -
    -denominator
    -

    the denominator of a rational number in lowest terms

    -
    - -
    -
    -from_bytes(byteorder, *, signed=False)
    -

    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.

    -
    -
    -
    - -
    -
    -imag
    -

    the imaginary part of a complex number

    -
    - -
    -
    -numerator
    -

    the numerator of a rational number in lowest terms

    -
    - -
    -
    -real
    -

    the real part of a complex number

    -
    - -
    -
    -to_bytes(length, byteorder, *, signed=False)
    -

    Return an array of bytes representing an integer.

    -
    -
    length

    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.

    -
    -
    -
    - -
    +
    class ShortcutContext
    -

    For a TTkShortcut event to occur, +

    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:

    + ++++ + + + + + + + + + + + + + + +

    WidgetShortcut

    The shortcut is active when its parent widget has focus.

    WidgetWithChildrenShortcut

    The shortcut is active when its parent widget, or any of its children has focus.

    WindowShortcut

    The shortcut is active when its parent widget is a logical subwidget of the active top-level window.

    ApplicationShortcut

    The shortcut is active when one of the applications windows are active.

    ApplicationShortcut = 2
    @@ -5102,235 +1863,149 @@ The possible contexts are these:

    The shortcut is active when its parent widget is a logical subwidget of the active top-level window.

    -
    -
    -as_integer_ratio()
    -

    Return integer ratio.

    -

    Return a pair of integers, whose ratio is exactly equal to the original int -and with a positive denominator.

    -
    >>> (10).as_integer_ratio()
    -(10, 1)
    ->>> (-10).as_integer_ratio()
    -(-10, 1)
    ->>> (0).as_integer_ratio()
    -(0, 1)
    -
    -
    -
    - -
    -
    -bit_count()
    -

    Number of ones in the binary representation of the absolute value of self.

    -

    Also known as the population count.

    -
    >>> bin(13)
    -'0b1101'
    ->>> (13).bit_count()
    -3
    -
    -
    -
    - -
    -
    -bit_length()
    -

    Number of bits necessary to represent self in binary.

    -
    >>> bin(37)
    -'0b100101'
    ->>> (37).bit_length()
    -6
    -
    -
    -
    -
    -conjugate()
    -

    Returns self, the complex conjugate of any int.

    +
    +
    +class SortOrder
    +

    This enum describes how the items in a widget are sorted.

    + ++++ + + + + + + + + +

    AscendingOrder

    The items are sorted ascending e.g.

    DescendingOrder

    The items are sorted descending e.g.

    +
    +
    +AscendingOrder = 0
    +

    The items are sorted ascending e.g. starts with ‘AAA’ ends with ‘ZZZ’ in Latin-1 locales

    -
    -denominator
    -

    the denominator of a rational number in lowest terms

    +
    +DescendingOrder = 1
    +

    The items are sorted descending e.g. starts with ‘ZZZ’ ends with ‘AAA’ in Latin-1 locales

    -
    -
    -from_bytes(byteorder, *, signed=False)
    -

    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.

    -
    -
    +
    +
    +class TTkItemSelectionModel
    +

    These values describes the way the selection model will be updated.

    + ++++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +

    NoUpdate

    No selection will be made.

    Clear

    The complete selection will be cleared.

    Select

    All specified indexes will be selected.

    Deselect

    All specified indexes will be deselected.

    Toggle

    All specified indexes will be selected or deselected depending on their current state.

    Current

    The current selection will be updated.

    Rows

    All indexes will be expanded to span rows.

    Columns

    All indexes will be expanded to span columns.

    SelectCurrent

    A combination of Select and Current, provided for convenience.

    ToggleCurrent

    A combination of Toggle and Current, provided for convenience.

    ClearAndSelect

    A combination of Clear and Select, provided for convenience.

    -
    -imag
    -

    the imaginary part of a complex number

    +
    +Clear = 1
    +

    The complete selection will be cleared.

    -
    -numerator
    -

    the numerator of a rational number in lowest terms

    +
    +ClearAndSelect = 3
    +

    A combination of Clear and Select, provided for convenience.

    -
    -real
    -

    the real part of a complex number

    -
    - -
    -
    -to_bytes(length, byteorder, *, signed=False)
    -

    Return an array of bytes representing an integer.

    -
    -
    length

    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.

    -
    -
    -
    - -
    - -
    -
    -class SortOrder
    -
    -
    -as_integer_ratio()
    -

    Return integer ratio.

    -

    Return a pair of integers, whose ratio is exactly equal to the original int -and with a positive denominator.

    -
    >>> (10).as_integer_ratio()
    -(10, 1)
    ->>> (-10).as_integer_ratio()
    -(-10, 1)
    ->>> (0).as_integer_ratio()
    -(0, 1)
    -
    -
    -
    - -
    -
    -bit_count()
    -

    Number of ones in the binary representation of the absolute value of self.

    -

    Also known as the population count.

    -
    >>> bin(13)
    -'0b1101'
    ->>> (13).bit_count()
    -3
    -
    -
    +
    +Columns = 64
    +

    All indexes will be expanded to span columns.

    -
    -
    -bit_length()
    -

    Number of bits necessary to represent self in binary.

    -
    >>> bin(37)
    -'0b100101'
    ->>> (37).bit_length()
    -6
    -
    -
    +
    +
    +Current = 16
    +

    The current selection will be updated.

    -
    -
    -conjugate()
    -

    Returns self, the complex conjugate of any int.

    +
    +
    +Deselect = 4
    +

    All specified indexes will be deselected.

    -
    -denominator
    -

    the denominator of a rational number in lowest terms

    +
    +NoUpdate = 0
    +

    No selection will be made.

    -
    -
    -from_bytes(byteorder, *, signed=False)
    -

    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.

    -
    -
    +
    +
    +Rows = 32
    +

    All indexes will be expanded to span rows.

    -
    -imag
    -

    the imaginary part of a complex number

    +
    +Select = 2
    +

    All specified indexes will be selected.

    -
    -numerator
    -

    the numerator of a rational number in lowest terms

    +
    +SelectCurrent = 18
    +

    A combination of Select and Current, provided for convenience.

    -
    -real
    -

    the real part of a complex number

    +
    +Toggle = 8
    +

    All specified indexes will be selected or deselected depending on their current state.

    -
    -
    -to_bytes(length, byteorder, *, signed=False)
    -

    Return an array of bytes representing an integer.

    -
    -
    length

    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.

    -
    -
    +
    +
    +ToggleCurrent = 24
    +

    A combination of Toggle and Current, provided for convenience.

    @@ -5338,7 +2013,31 @@ is raised.

    class WindowFlag
    -
    +

    Those flags are used to enable customization of the window controls.

    + ++++ + + + + + + + + + + + + + + + + + +

    WindowReduceButtonHint

    Adds a reduce button.

    WindowMinimizeButtonHint

    Adds a minimize button.

    WindowMaximizeButtonHint

    Adds a maximize button.

    WindowMinMaxButtonsHint

    Adds a minimize and a maximize button.

    WindowCloseButtonHint

    Adds a close button.

    +
    WindowCloseButtonHint = 134217728

    Adds a close button.

    @@ -5368,125 +2067,29 @@ is raised.

    Adds a reduce button.

    -
    -
    -as_integer_ratio()
    -

    Return integer ratio.

    -

    Return a pair of integers, whose ratio is exactly equal to the original int -and with a positive denominator.

    -
    >>> (10).as_integer_ratio()
    -(10, 1)
    ->>> (-10).as_integer_ratio()
    -(-10, 1)
    ->>> (0).as_integer_ratio()
    -(0, 1)
    -
    -
    -
    - -
    -
    -bit_count()
    -

    Number of ones in the binary representation of the absolute value of self.

    -

    Also known as the population count.

    -
    >>> bin(13)
    -'0b1101'
    ->>> (13).bit_count()
    -3
    -
    -
    -
    - -
    -
    -bit_length()
    -

    Number of bits necessary to represent self in binary.

    -
    >>> bin(37)
    -'0b100101'
    ->>> (37).bit_length()
    -6
    -
    -
    -
    - -
    -
    -conjugate()
    -

    Returns self, the complex conjugate of any int.

    -
    - -
    -
    -denominator
    -

    the denominator of a rational number in lowest terms

    -
    - -
    -
    -from_bytes(byteorder, *, signed=False)
    -

    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.

    -
    -
    -
    - -
    -
    -imag
    -

    the imaginary part of a complex number

    -
    - -
    -
    -numerator
    -

    the numerator of a rational number in lowest terms

    -
    - -
    -
    -real
    -

    the real part of a complex number

    -
    - -
    -
    -to_bytes(length, byteorder, *, signed=False)
    -

    Return an array of bytes representing an integer.

    -
    -
    length

    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.

    -
    -
    -
    -
    class WrapMode

    Those constants describes how text is wrapped in a document.

    + ++++ + + + + + + + + + + + +

    WordWrap

    Text is wrapped at word boundaries.

    WrapAnywhere

    Text can be wrapped at any point on a line, even if it occurs in the middle of a word.

    WrapAtWordBoundaryOrAnywhere

    If possible, wrapping occurs at a word boundary; otherwise it will occur at the appropriate point on the line, even in the middle of a word.

    WordWrap = 1
    @@ -5505,119 +2108,6 @@ is raised.

    If possible, wrapping occurs at a word boundary; otherwise it will occur at the appropriate point on the line, even in the middle of a word.

    -
    -
    -as_integer_ratio()
    -

    Return integer ratio.

    -

    Return a pair of integers, whose ratio is exactly equal to the original int -and with a positive denominator.

    -
    >>> (10).as_integer_ratio()
    -(10, 1)
    ->>> (-10).as_integer_ratio()
    -(-10, 1)
    ->>> (0).as_integer_ratio()
    -(0, 1)
    -
    -
    -
    - -
    -
    -bit_count()
    -

    Number of ones in the binary representation of the absolute value of self.

    -

    Also known as the population count.

    -
    >>> bin(13)
    -'0b1101'
    ->>> (13).bit_count()
    -3
    -
    -
    -
    - -
    -
    -bit_length()
    -

    Number of bits necessary to represent self in binary.

    -
    >>> bin(37)
    -'0b100101'
    ->>> (37).bit_length()
    -6
    -
    -
    -
    - -
    -
    -conjugate()
    -

    Returns self, the complex conjugate of any int.

    -
    - -
    -
    -denominator
    -

    the denominator of a rational number in lowest terms

    -
    - -
    -
    -from_bytes(byteorder, *, signed=False)
    -

    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.

    -
    -
    -
    - -
    -
    -imag
    -

    the imaginary part of a complex number

    -
    - -
    -
    -numerator
    -

    the numerator of a rational number in lowest terms

    -
    - -
    -
    -real
    -

    the real part of a complex number

    -
    - -
    -
    -to_bytes(length, byteorder, *, signed=False)
    -

    Return an array of bytes representing an integer.

    -
    -
    length

    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.

    -
    -
    -
    -
    diff --git a/autogen.TermTk/TermTk.TTkCore.drivers.html b/autogen.TermTk/TermTk.TTkCore.drivers.html index 8ccd3f15..f2f293b8 100644 --- a/autogen.TermTk/TermTk.TTkCore.drivers.html +++ b/autogen.TermTk/TermTk.TTkCore.drivers.html @@ -4,7 +4,7 @@ - TermTk.TTkCore.drivers — pyTermTk 0.39.0-a + <title>TermTk.TTkCore.drivers — pyTermTk 0.40.0-a documentation diff --git a/autogen.TermTk/TermTk.TTkCore.drivers.pyodide.html b/autogen.TermTk/TermTk.TTkCore.drivers.pyodide.html index 5ba64835..2d0dea14 100644 --- a/autogen.TermTk/TermTk.TTkCore.drivers.pyodide.html +++ b/autogen.TermTk/TermTk.TTkCore.drivers.pyodide.html @@ -4,7 +4,7 @@ - TermTk.TTkCore.drivers.pyodide — pyTermTk 0.39.0-a + <title>TermTk.TTkCore.drivers.pyodide — pyTermTk 0.40.0-a documentation diff --git a/autogen.TermTk/TermTk.TTkCore.drivers.term_pyodide.html b/autogen.TermTk/TermTk.TTkCore.drivers.term_pyodide.html index 0d04926b..dc60edb1 100644 --- a/autogen.TermTk/TermTk.TTkCore.drivers.term_pyodide.html +++ b/autogen.TermTk/TermTk.TTkCore.drivers.term_pyodide.html @@ -4,7 +4,7 @@ - TermTk.TTkCore.drivers.term_pyodide — pyTermTk 0.39.0-a + <title>TermTk.TTkCore.drivers.term_pyodide — pyTermTk 0.40.0-a documentation diff --git a/autogen.TermTk/TermTk.TTkCore.drivers.term_unix.html b/autogen.TermTk/TermTk.TTkCore.drivers.term_unix.html index 90443ded..2cabc3a9 100644 --- a/autogen.TermTk/TermTk.TTkCore.drivers.term_unix.html +++ b/autogen.TermTk/TermTk.TTkCore.drivers.term_unix.html @@ -4,7 +4,7 @@ - TermTk.TTkCore.drivers.term_unix — pyTermTk 0.39.0-a + <title>TermTk.TTkCore.drivers.term_unix — pyTermTk 0.40.0-a documentation diff --git a/autogen.TermTk/TermTk.TTkCore.drivers.term_unix_serial.html b/autogen.TermTk/TermTk.TTkCore.drivers.term_unix_serial.html index ff744586..5cf5824b 100644 --- a/autogen.TermTk/TermTk.TTkCore.drivers.term_unix_serial.html +++ b/autogen.TermTk/TermTk.TTkCore.drivers.term_unix_serial.html @@ -4,7 +4,7 @@ - TermTk.TTkCore.drivers.term_unix_serial — pyTermTk 0.39.0-a + <title>TermTk.TTkCore.drivers.term_unix_serial — pyTermTk 0.40.0-a documentation diff --git a/autogen.TermTk/TermTk.TTkCore.drivers.term_windows.html b/autogen.TermTk/TermTk.TTkCore.drivers.term_windows.html index 57523f00..c1dc3fa5 100644 --- a/autogen.TermTk/TermTk.TTkCore.drivers.term_windows.html +++ b/autogen.TermTk/TermTk.TTkCore.drivers.term_windows.html @@ -4,7 +4,7 @@ - TermTk.TTkCore.drivers.term_windows — pyTermTk 0.39.0-a + <title>TermTk.TTkCore.drivers.term_windows — pyTermTk 0.40.0-a documentation diff --git a/autogen.TermTk/TermTk.TTkCore.drivers.unix.html b/autogen.TermTk/TermTk.TTkCore.drivers.unix.html index 52577540..ba3af330 100644 --- a/autogen.TermTk/TermTk.TTkCore.drivers.unix.html +++ b/autogen.TermTk/TermTk.TTkCore.drivers.unix.html @@ -4,7 +4,7 @@ - TermTk.TTkCore.drivers.unix — pyTermTk 0.39.0-a + <title>TermTk.TTkCore.drivers.unix — pyTermTk 0.40.0-a documentation diff --git a/autogen.TermTk/TermTk.TTkCore.drivers.unix_thread.html b/autogen.TermTk/TermTk.TTkCore.drivers.unix_thread.html index 7cea857a..53970cb2 100644 --- a/autogen.TermTk/TermTk.TTkCore.drivers.unix_thread.html +++ b/autogen.TermTk/TermTk.TTkCore.drivers.unix_thread.html @@ -4,7 +4,7 @@ - TermTk.TTkCore.drivers.unix_thread — pyTermTk 0.39.0-a + <title>TermTk.TTkCore.drivers.unix_thread — pyTermTk 0.40.0-a documentation diff --git a/autogen.TermTk/TermTk.TTkCore.drivers.windows.html b/autogen.TermTk/TermTk.TTkCore.drivers.windows.html index 3cf748bc..c163dc21 100644 --- a/autogen.TermTk/TermTk.TTkCore.drivers.windows.html +++ b/autogen.TermTk/TermTk.TTkCore.drivers.windows.html @@ -4,7 +4,7 @@ - TermTk.TTkCore.drivers.windows — pyTermTk 0.39.0-a + <title>TermTk.TTkCore.drivers.windows — pyTermTk 0.40.0-a documentation diff --git a/autogen.TermTk/TermTk.TTkCore.filebuffer.html b/autogen.TermTk/TermTk.TTkCore.filebuffer.html index 7dc805b2..28a98d73 100644 --- a/autogen.TermTk/TermTk.TTkCore.filebuffer.html +++ b/autogen.TermTk/TermTk.TTkCore.filebuffer.html @@ -4,7 +4,7 @@ - TermTk.TTkCore.filebuffer — pyTermTk 0.39.0-a + <title>TermTk.TTkCore.filebuffer — pyTermTk 0.40.0-a documentation diff --git a/autogen.TermTk/TermTk.TTkCore.helper.html b/autogen.TermTk/TermTk.TTkCore.helper.html index f9dbe21f..eb40f7ee 100644 --- a/autogen.TermTk/TermTk.TTkCore.helper.html +++ b/autogen.TermTk/TermTk.TTkCore.helper.html @@ -4,7 +4,7 @@ - TermTk.TTkCore.helper — pyTermTk 0.39.0-a + <title>TermTk.TTkCore.helper — pyTermTk 0.40.0-a documentation diff --git a/autogen.TermTk/TermTk.TTkCore.html b/autogen.TermTk/TermTk.TTkCore.html index 427cbff3..59c4fbee 100644 --- a/autogen.TermTk/TermTk.TTkCore.html +++ b/autogen.TermTk/TermTk.TTkCore.html @@ -4,7 +4,7 @@ - TermTk.TTkCore — pyTermTk 0.39.0-a + <title>TermTk.TTkCore — pyTermTk 0.40.0-a documentation @@ -24,7 +24,7 @@ - + @@ -197,7 +197,7 @@