From f13c5fa1f5f3fd90a9465ebb6863d72a7c0e0ed9 Mon Sep 17 00:00:00 2001 From: Eugenio Parodi Date: Thu, 2 Feb 2023 18:15:13 +0000 Subject: [PATCH] moved the properties in the TTkUiTools --- TermTk/TTkUiTools/__init__.py | 2 + TermTk/TTkUiTools/properties/__init__.py | 24 ++ TermTk/TTkUiTools/properties/about.py | 21 ++ TermTk/TTkUiTools/properties/button.py | 39 ++++ TermTk/TTkUiTools/properties/checkbox.py | 57 +++++ TermTk/TTkUiTools/properties/combobox.py | 70 ++++++ TermTk/TTkUiTools/properties/frame.py | 35 +++ TermTk/TTkUiTools/properties/graph.py | 22 ++ TermTk/TTkUiTools/properties/image.py | 21 ++ TermTk/TTkUiTools/properties/label.py | 36 +++ TermTk/TTkUiTools/properties/lineedit.py | 43 ++++ TermTk/TTkUiTools/properties/list_.py | 23 ++ TermTk/TTkUiTools/properties/listwidget.py | 23 ++ TermTk/TTkUiTools/properties/menubar.py | 23 ++ TermTk/TTkUiTools/properties/progressbar.py | 21 ++ TermTk/TTkUiTools/properties/radiobutton.py | 52 +++++ .../TTkUiTools/properties/resizableframe.py | 25 ++ TermTk/TTkUiTools/properties/scrollarea.py | 24 ++ TermTk/TTkUiTools/properties/scrollbar.py | 23 ++ TermTk/TTkUiTools/properties/spacer.py | 24 ++ TermTk/TTkUiTools/properties/spinbox.py | 24 ++ TermTk/TTkUiTools/properties/splitter.py | 40 ++++ TermTk/TTkUiTools/properties/tabwidget.py | 24 ++ TermTk/TTkUiTools/properties/texedit.py | 24 ++ TermTk/TTkUiTools/properties/widget.py | 89 +++++++ TermTk/TTkUiTools/properties/window.py | 49 ++++ TermTk/TTkUiTools/uiloader.py | 24 ++ TermTk/TTkUiTools/uiproperties.py | 40 ++++ TermTk/TTkWidgets/checkbox.py | 32 --- TermTk/TTkWidgets/combobox.py | 45 ---- TermTk/TTkWidgets/frame.py | 11 - TermTk/TTkWidgets/label.py | 11 - TermTk/TTkWidgets/lineedit.py | 18 -- TermTk/TTkWidgets/radiobutton.py | 24 -- TermTk/TTkWidgets/splitter.py | 14 -- TermTk/TTkWidgets/widget.py | 65 ------ TermTk/TTkWidgets/window.py | 23 -- TermTk/__init__.py | 1 + ttkDesigner/app/propertyeditor.py | 220 ++++++++++++------ 39 files changed, 1068 insertions(+), 318 deletions(-) create mode 100644 TermTk/TTkUiTools/__init__.py create mode 100644 TermTk/TTkUiTools/properties/__init__.py create mode 100644 TermTk/TTkUiTools/properties/about.py create mode 100644 TermTk/TTkUiTools/properties/button.py create mode 100644 TermTk/TTkUiTools/properties/checkbox.py create mode 100644 TermTk/TTkUiTools/properties/combobox.py create mode 100644 TermTk/TTkUiTools/properties/frame.py create mode 100644 TermTk/TTkUiTools/properties/graph.py create mode 100644 TermTk/TTkUiTools/properties/image.py create mode 100644 TermTk/TTkUiTools/properties/label.py create mode 100644 TermTk/TTkUiTools/properties/lineedit.py create mode 100644 TermTk/TTkUiTools/properties/list_.py create mode 100644 TermTk/TTkUiTools/properties/listwidget.py create mode 100644 TermTk/TTkUiTools/properties/menubar.py create mode 100644 TermTk/TTkUiTools/properties/progressbar.py create mode 100644 TermTk/TTkUiTools/properties/radiobutton.py create mode 100644 TermTk/TTkUiTools/properties/resizableframe.py create mode 100644 TermTk/TTkUiTools/properties/scrollarea.py create mode 100644 TermTk/TTkUiTools/properties/scrollbar.py create mode 100644 TermTk/TTkUiTools/properties/spacer.py create mode 100644 TermTk/TTkUiTools/properties/spinbox.py create mode 100644 TermTk/TTkUiTools/properties/splitter.py create mode 100644 TermTk/TTkUiTools/properties/tabwidget.py create mode 100644 TermTk/TTkUiTools/properties/texedit.py create mode 100644 TermTk/TTkUiTools/properties/widget.py create mode 100644 TermTk/TTkUiTools/properties/window.py create mode 100644 TermTk/TTkUiTools/uiloader.py create mode 100644 TermTk/TTkUiTools/uiproperties.py diff --git a/TermTk/TTkUiTools/__init__.py b/TermTk/TTkUiTools/__init__.py new file mode 100644 index 00000000..daf3ff57 --- /dev/null +++ b/TermTk/TTkUiTools/__init__.py @@ -0,0 +1,2 @@ +from .uiloader import TTkUiLoader +from .uiproperties import TTkUiProperties \ No newline at end of file diff --git a/TermTk/TTkUiTools/properties/__init__.py b/TermTk/TTkUiTools/properties/__init__.py new file mode 100644 index 00000000..ef65c43d --- /dev/null +++ b/TermTk/TTkUiTools/properties/__init__.py @@ -0,0 +1,24 @@ +# from .about import +from .button import TTkButtonProperties +from .checkbox import TTkCheckboxProperties +from .combobox import TTkComboBoxProperties +from .frame import TTkFrameProperties +# from .graph import +# from .image import +from .label import TTkLabelProperties +from .lineedit import TTkLineEditProperties +from .list_ import TTkListProperties +# from .listwidget import +# from .menubar import +# from .progressbar import +from .radiobutton import TTkRadioButtonProperties +from .resizableframe import TTkResizableFrameProperties +# from .scrollarea import +# from .scrollbar import +# from .spacer import +# from .spinbox import +from .splitter import TTkSplitterProperties +# from .tabwidget import +# from .texedit import +from .widget import TTkWidgetProperties +from .window import TTkWindowProperties diff --git a/TermTk/TTkUiTools/properties/about.py b/TermTk/TTkUiTools/properties/about.py new file mode 100644 index 00000000..044a5b9e --- /dev/null +++ b/TermTk/TTkUiTools/properties/about.py @@ -0,0 +1,21 @@ +# MIT License +# +# Copyright (c) 2023 Eugenio Parodi +# +# 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. diff --git a/TermTk/TTkUiTools/properties/button.py b/TermTk/TTkUiTools/properties/button.py new file mode 100644 index 00000000..539104c7 --- /dev/null +++ b/TermTk/TTkUiTools/properties/button.py @@ -0,0 +1,39 @@ +# MIT License +# +# Copyright (c) 2023 Eugenio Parodi +# +# 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. + +from TermTk.TTkCore.string import TTkString +from TermTk.TTkWidgets.button import TTkButton + +TTkButtonProperties = { + 'Text' : { + 'init': {'name':'text', 'type':TTkString }, + 'get': {'cb':TTkButton.text, 'type':TTkString } , + 'set': {'cb':TTkButton.setText, 'type':TTkString } }, + 'Checkable' : { + 'init': {'name':'checkable', 'type':bool }, + 'get': {'cb':TTkButton.isCheckable, 'type':bool } , + 'set': {'cb':TTkButton.setCheckable, 'type':bool } }, + 'Checked' : { + 'init': {'name':'checked', 'type':bool }, + 'get': {'cb':TTkButton.isChecked, 'type':bool } , + 'set': {'cb':TTkButton.setChecked, 'type':bool } }, + } \ No newline at end of file diff --git a/TermTk/TTkUiTools/properties/checkbox.py b/TermTk/TTkUiTools/properties/checkbox.py new file mode 100644 index 00000000..3515a7fe --- /dev/null +++ b/TermTk/TTkUiTools/properties/checkbox.py @@ -0,0 +1,57 @@ +# MIT License +# +# Copyright (c) 2023 Eugenio Parodi +# +# 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. + +from TermTk.TTkCore.constant import TTkK +from TermTk.TTkCore.string import TTkString +from TermTk.TTkWidgets.checkbox import TTkCheckbox + +TTkCheckboxProperties = { + 'Text' : { + 'init': {'name':'text', 'type':TTkString } , + 'get': {'cb':TTkCheckbox.text, 'type':TTkString } , + 'set': {'cb':TTkCheckbox.setText, 'type':TTkString } }, + 'Tristate' : { + 'init': {'name':'tristate', 'type':bool } , + 'get': {'cb':TTkCheckbox.isTristate, 'type':bool } , + 'set': {'cb':TTkCheckbox.setTristate, 'type':bool } }, + 'Checked' : { + 'init': {'name':'checked', 'type':bool } , + 'get': {'cb':TTkCheckbox.isChecked, 'type':bool } , + 'set': {'cb':TTkCheckbox.setChecked, 'type':bool } }, + 'Check State' : { + 'init': { 'name':'checked', 'type':'singleflag', + 'flags': { + 'Checked' : TTkK.Checked , + 'Unchecked' : TTkK.Unchecked , + 'Partially Checked': TTkK.PartiallyChecked } }, + 'get' : { 'cb':TTkCheckbox.checkState, 'type':'singleflag', + 'flags': { + 'Checked' : TTkK.Checked , + 'Unchecked' : TTkK.Unchecked , + 'Partially Checked': TTkK.PartiallyChecked } }, + 'set' : { 'cb':TTkCheckbox.setCheckState, 'type':'singleflag', + 'flags': { + 'Checked' : TTkK.Checked , + 'Unchecked' : TTkK.Unchecked , + 'Partially Checked': TTkK.PartiallyChecked } }, + }, + } diff --git a/TermTk/TTkUiTools/properties/combobox.py b/TermTk/TTkUiTools/properties/combobox.py new file mode 100644 index 00000000..c1dd59a3 --- /dev/null +++ b/TermTk/TTkUiTools/properties/combobox.py @@ -0,0 +1,70 @@ +# MIT License +# +# Copyright (c) 2023 Eugenio Parodi +# +# 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. + +from TermTk.TTkCore.constant import TTkK +from TermTk.TTkCore.string import TTkString +from TermTk.TTkWidgets.combobox import TTkComboBox + +TTkComboBoxProperties = { + 'Editable' : { + 'init': {'name':'editable', 'type':bool } , + 'get': {'cb':TTkComboBox.isEditable, 'type':bool } , + 'set': {'cb':TTkComboBox.setEditable, 'type':bool } }, + 'Text Align.' : { + 'init': {'name':'textAlign', 'type':'singleflag', + 'flags': { + 'None' : TTkK.Alignment.NONE, + 'Left' : TTkK.Alignment.LEFT_ALIGN, + 'Right' : TTkK.Alignment.RIGHT_ALIGN, + 'Center' : TTkK.Alignment.CENTER_ALIGN, + 'Justify': TTkK.Alignment.JUSTIFY } }, + 'get': {'cb':TTkComboBox.textAlign, 'type':'singleflag', + 'flags': { + 'None' : TTkK.Alignment.NONE, + 'Left' : TTkK.Alignment.LEFT_ALIGN, + 'Right' : TTkK.Alignment.RIGHT_ALIGN, + 'Center' : TTkK.Alignment.CENTER_ALIGN, + 'Justify': TTkK.Alignment.JUSTIFY } } , + 'set': {'cb':TTkComboBox.setTextAlign, 'type':'singleflag', + 'flags': { + 'None' : TTkK.Alignment.NONE, + 'Left' : TTkK.Alignment.LEFT_ALIGN, + 'Right' : TTkK.Alignment.RIGHT_ALIGN, + 'Center' : TTkK.Alignment.CENTER_ALIGN, + 'Justify': TTkK.Alignment.JUSTIFY } } }, + 'Insert Policy' : { + 'init': {'name':'insertPolicy', 'type':'singleflag', + 'flags': { + 'No Insert' : TTkK.InsertPolicy.NoInsert, + 'At Top' : TTkK.InsertPolicy.InsertAtTop, + 'At Bottom' : TTkK.InsertPolicy.InsertAtBottom } }, + 'get': {'cb':TTkComboBox.insertPolicy, 'type':'singleflag', + 'flags': { + 'No Insert' : TTkK.InsertPolicy.NoInsert, + 'At Top' : TTkK.InsertPolicy.InsertAtTop, + 'At Bottom' : TTkK.InsertPolicy.InsertAtBottom } }, + 'set': {'cb':TTkComboBox.setInsertPolicy, 'type':'singleflag', + 'flags': { + 'No Insert' : TTkK.InsertPolicy.NoInsert, + 'At Top' : TTkK.InsertPolicy.InsertAtTop, + 'At Bottom' : TTkK.InsertPolicy.InsertAtBottom } } }, + } \ No newline at end of file diff --git a/TermTk/TTkUiTools/properties/frame.py b/TermTk/TTkUiTools/properties/frame.py new file mode 100644 index 00000000..ba8354cb --- /dev/null +++ b/TermTk/TTkUiTools/properties/frame.py @@ -0,0 +1,35 @@ +# MIT License +# +# Copyright (c) 2023 Eugenio Parodi +# +# 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. + +from TermTk.TTkCore.string import TTkString +from TermTk.TTkWidgets.frame import TTkFrame + +TTkFrameProperties = { + 'Border' : { + 'init': {'name':'border', 'type':bool }, + 'get': {'cb':TTkFrame.border, 'type':bool } , + 'set': {'cb':TTkFrame.setBorder, 'type':bool } }, + 'Title' : { + 'init': {'name':'title', 'type':TTkString }, + 'get': {'cb':TTkFrame.title, 'type':TTkString } , + 'set': {'cb':TTkFrame.setTitle, 'type':TTkString } }, + } \ No newline at end of file diff --git a/TermTk/TTkUiTools/properties/graph.py b/TermTk/TTkUiTools/properties/graph.py new file mode 100644 index 00000000..ee0973b1 --- /dev/null +++ b/TermTk/TTkUiTools/properties/graph.py @@ -0,0 +1,22 @@ +# MIT License +# +# Copyright (c) 2023 Eugenio Parodi +# +# 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. + diff --git a/TermTk/TTkUiTools/properties/image.py b/TermTk/TTkUiTools/properties/image.py new file mode 100644 index 00000000..044a5b9e --- /dev/null +++ b/TermTk/TTkUiTools/properties/image.py @@ -0,0 +1,21 @@ +# MIT License +# +# Copyright (c) 2023 Eugenio Parodi +# +# 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. diff --git a/TermTk/TTkUiTools/properties/label.py b/TermTk/TTkUiTools/properties/label.py new file mode 100644 index 00000000..781e9238 --- /dev/null +++ b/TermTk/TTkUiTools/properties/label.py @@ -0,0 +1,36 @@ +# MIT License +# +# Copyright (c) 2023 Eugenio Parodi +# +# 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. + +from TermTk.TTkCore.color import TTkColor +from TermTk.TTkCore.string import TTkString +from TermTk.TTkWidgets.label import TTkLabel + +TTkLabelProperties = { + 'Text' : { + 'init': {'name':'text', 'type':TTkString }, + 'get': {'cb':TTkLabel.text, 'type':TTkString } , + 'set': {'cb':TTkLabel.setText, 'type':TTkString } }, + 'Color' : { + 'init': {'name':'color', 'type':TTkColor }, + 'get': {'cb':TTkLabel.color, 'type':TTkColor } , + 'set': {'cb':TTkLabel.setColor, 'type':TTkColor } }, + } \ No newline at end of file diff --git a/TermTk/TTkUiTools/properties/lineedit.py b/TermTk/TTkUiTools/properties/lineedit.py new file mode 100644 index 00000000..61488e55 --- /dev/null +++ b/TermTk/TTkUiTools/properties/lineedit.py @@ -0,0 +1,43 @@ +# MIT License +# +# Copyright (c) 2023 Eugenio Parodi +# +# 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. + +from TermTk.TTkCore.string import TTkString +from TermTk.TTkCore.constant import TTkK +from TermTk.TTkWidgets.lineedit import TTkLineEdit + +TTkLineEditProperties = { + 'Input Type' : { + 'init': {'name':'inputType', 'type':'multiflags', + 'flags': { + 'Text' : TTkK.Input_Text , + 'Number' : TTkK.Input_Number , + 'Password': TTkK.Input_Password } }, + 'get': {'cb':TTkLineEdit.inputType, 'type':'multiflags', + 'flags': { + 'Text' : TTkK.Input_Text , + 'Number' : TTkK.Input_Number , + 'Password': TTkK.Input_Password } } }, + 'Text' : { + 'init': {'name':'text', 'type':TTkString } , + 'get': {'cb':TTkLineEdit.text, 'type':TTkString } , + 'set': {'cb':TTkLineEdit.setText, 'type':TTkString } } + } \ No newline at end of file diff --git a/TermTk/TTkUiTools/properties/list_.py b/TermTk/TTkUiTools/properties/list_.py new file mode 100644 index 00000000..e058ecfc --- /dev/null +++ b/TermTk/TTkUiTools/properties/list_.py @@ -0,0 +1,23 @@ +# MIT License +# +# Copyright (c) 2023 Eugenio Parodi +# +# 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. + +TTkListProperties = {} \ No newline at end of file diff --git a/TermTk/TTkUiTools/properties/listwidget.py b/TermTk/TTkUiTools/properties/listwidget.py new file mode 100644 index 00000000..f2708318 --- /dev/null +++ b/TermTk/TTkUiTools/properties/listwidget.py @@ -0,0 +1,23 @@ +#!/usr/bin/env python3 + +# MIT License +# +# Copyright (c) 2023 Eugenio Parodi +# +# 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. diff --git a/TermTk/TTkUiTools/properties/menubar.py b/TermTk/TTkUiTools/properties/menubar.py new file mode 100644 index 00000000..f2708318 --- /dev/null +++ b/TermTk/TTkUiTools/properties/menubar.py @@ -0,0 +1,23 @@ +#!/usr/bin/env python3 + +# MIT License +# +# Copyright (c) 2023 Eugenio Parodi +# +# 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. diff --git a/TermTk/TTkUiTools/properties/progressbar.py b/TermTk/TTkUiTools/properties/progressbar.py new file mode 100644 index 00000000..044a5b9e --- /dev/null +++ b/TermTk/TTkUiTools/properties/progressbar.py @@ -0,0 +1,21 @@ +# MIT License +# +# Copyright (c) 2023 Eugenio Parodi +# +# 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. diff --git a/TermTk/TTkUiTools/properties/radiobutton.py b/TermTk/TTkUiTools/properties/radiobutton.py new file mode 100644 index 00000000..79cc191a --- /dev/null +++ b/TermTk/TTkUiTools/properties/radiobutton.py @@ -0,0 +1,52 @@ +#!/usr/bin/env python3 + +# MIT License +# +# Copyright (c) 2023 Eugenio Parodi +# +# 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. + +from TermTk.TTkCore.constant import TTkK +from TermTk.TTkCore.string import TTkString +from TermTk.TTkWidgets.radiobutton import TTkRadioButton + +TTkRadioButtonProperties = { + 'Text' : { + 'init': {'name':'text', 'type':TTkString } , + 'get': {'cb':TTkRadioButton.text, 'type':TTkString } , + 'set': {'cb':TTkRadioButton.setText, 'type':TTkString } }, + 'Checked' : { + 'init': {'name':'checked', 'type':bool } , + 'get': {'cb':TTkRadioButton.isChecked, 'type':bool } , + 'set': {'cb':TTkRadioButton.setChecked, 'type':bool } }, + 'Check State' : { + 'init': { 'name':'checked', 'type':'singleflag', + 'flags': { + 'Checked' : TTkK.Checked , + 'Unchecked' : TTkK.Unchecked } }, + 'get' : { 'cb':TTkRadioButton.checkState, 'type':'singleflag', + 'flags': { + 'Checked' : TTkK.Checked , + 'Unchecked' : TTkK.Unchecked } }, + 'set' : { 'cb':TTkRadioButton.setCheckState, 'type':'singleflag', + 'flags': { + 'Checked' : TTkK.Checked , + 'Unchecked' : TTkK.Unchecked } }, + }, + } diff --git a/TermTk/TTkUiTools/properties/resizableframe.py b/TermTk/TTkUiTools/properties/resizableframe.py new file mode 100644 index 00000000..b0bbf405 --- /dev/null +++ b/TermTk/TTkUiTools/properties/resizableframe.py @@ -0,0 +1,25 @@ +#!/usr/bin/env python3 + +# MIT License +# +# Copyright (c) 2023 Eugenio Parodi +# +# 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. + +TTkResizableFrameProperties = {} diff --git a/TermTk/TTkUiTools/properties/scrollarea.py b/TermTk/TTkUiTools/properties/scrollarea.py new file mode 100644 index 00000000..4174956b --- /dev/null +++ b/TermTk/TTkUiTools/properties/scrollarea.py @@ -0,0 +1,24 @@ +#!/usr/bin/env python3 + +# MIT License +# +# Copyright (c) 2023 Eugenio Parodi +# +# 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. + diff --git a/TermTk/TTkUiTools/properties/scrollbar.py b/TermTk/TTkUiTools/properties/scrollbar.py new file mode 100644 index 00000000..f2708318 --- /dev/null +++ b/TermTk/TTkUiTools/properties/scrollbar.py @@ -0,0 +1,23 @@ +#!/usr/bin/env python3 + +# MIT License +# +# Copyright (c) 2023 Eugenio Parodi +# +# 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. diff --git a/TermTk/TTkUiTools/properties/spacer.py b/TermTk/TTkUiTools/properties/spacer.py new file mode 100644 index 00000000..4174956b --- /dev/null +++ b/TermTk/TTkUiTools/properties/spacer.py @@ -0,0 +1,24 @@ +#!/usr/bin/env python3 + +# MIT License +# +# Copyright (c) 2023 Eugenio Parodi +# +# 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. + diff --git a/TermTk/TTkUiTools/properties/spinbox.py b/TermTk/TTkUiTools/properties/spinbox.py new file mode 100644 index 00000000..4174956b --- /dev/null +++ b/TermTk/TTkUiTools/properties/spinbox.py @@ -0,0 +1,24 @@ +#!/usr/bin/env python3 + +# MIT License +# +# Copyright (c) 2023 Eugenio Parodi +# +# 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. + diff --git a/TermTk/TTkUiTools/properties/splitter.py b/TermTk/TTkUiTools/properties/splitter.py new file mode 100644 index 00000000..c189761a --- /dev/null +++ b/TermTk/TTkUiTools/properties/splitter.py @@ -0,0 +1,40 @@ +#!/usr/bin/env python3 + +# MIT License +# +# Copyright (c) 2023 Eugenio Parodi +# +# 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. + +from TermTk.TTkCore.constant import TTkK +from TermTk.TTkWidgets.splitter import TTkSplitter + +TTkSplitterProperties = { + 'Border' : { + 'init': {'name':'border', 'type':bool } }, + 'Orientation' : { + 'init': {'name':'orientation', 'type':'singleflag', + 'flags': { + 'Horizontal' : TTkK.HORIZONTAL , + 'Vertical' : TTkK.VERTICAL } } , + 'get': {'cb':TTkSplitter.orientation, 'type':'singleflag', + 'flags': { + 'Horizontal' : TTkK.HORIZONTAL , + 'Vertical' : TTkK.VERTICAL } } } + } diff --git a/TermTk/TTkUiTools/properties/tabwidget.py b/TermTk/TTkUiTools/properties/tabwidget.py new file mode 100644 index 00000000..4174956b --- /dev/null +++ b/TermTk/TTkUiTools/properties/tabwidget.py @@ -0,0 +1,24 @@ +#!/usr/bin/env python3 + +# MIT License +# +# Copyright (c) 2023 Eugenio Parodi +# +# 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. + diff --git a/TermTk/TTkUiTools/properties/texedit.py b/TermTk/TTkUiTools/properties/texedit.py new file mode 100644 index 00000000..4174956b --- /dev/null +++ b/TermTk/TTkUiTools/properties/texedit.py @@ -0,0 +1,24 @@ +#!/usr/bin/env python3 + +# MIT License +# +# Copyright (c) 2023 Eugenio Parodi +# +# 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. + diff --git a/TermTk/TTkUiTools/properties/widget.py b/TermTk/TTkUiTools/properties/widget.py new file mode 100644 index 00000000..b347e9f7 --- /dev/null +++ b/TermTk/TTkUiTools/properties/widget.py @@ -0,0 +1,89 @@ +# MIT License +# +# Copyright (c) 2023 Eugenio Parodi +# +# 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. + +from TermTk.TTkLayouts.layout import TTkLayout +from TermTk.TTkWidgets.widget import TTkWidget + +TTkWidgetProperties = { + # 'X' : { + # 'init': {'name':'x', 'type':int } , + # 'get': { 'cb':x, 'type':int } }, + # 'Y' : { + # 'init': {'name':'y', 'type':int } , + # 'get': { 'cb':y, 'type':int } }, + 'Position' : { + 'init': {'name':'pos', 'type': [ + { 'name': 'x', 'type':int } , + { 'name': 'y', 'type':int } ] }, + 'get': { 'cb':TTkWidget.pos, 'type': [ + { 'name': 'x', 'type':int } , + { 'name': 'y', 'type':int } ] }, + 'set': { 'cb':TTkWidget.move, 'type': [ + { 'name': 'x', 'type':int } , + { 'name': 'y', 'type':int } ] } }, + 'Size' : { + 'init': {'name':'size', 'type': [ + { 'name': 'width', 'type':int } , + { 'name': 'height', 'type':int } ] }, + 'get': { 'cb':TTkWidget.size, 'type': [ + { 'name': 'width', 'type':int } , + { 'name': 'height', 'type':int } ] }, + 'set': { 'cb':TTkWidget.resize, 'type': [ + { 'name': 'width', 'type':int } , + { 'name': 'height', 'type':int } ] } }, + # 'Width' : { + # 'init': {'name':'width', 'type':int } , + # 'get': { 'cb':width, 'type':int } }, + # 'Height' : { + # 'init': {'name':'height', 'type':int } , + # 'get': { 'cb':height, 'type':int } }, + 'Min Width' : { + 'init': {'name':'minWidth', 'type':int } , + 'get': { 'cb':TTkWidget.minimumWidth, 'type':int } , + 'set': { 'cb':TTkWidget.setMinimumWidth,'type':int } }, + 'Min Height' : { + 'init': {'name':'minHeight', 'type':int } , + 'get': { 'cb':TTkWidget.minimumHeight, 'type':int } , + 'set': { 'cb':TTkWidget.setMinimumHeight,'type':int } }, + 'Max Width' : { + 'init': {'name':'maxWidth', 'type':int } , + 'get': { 'cb':TTkWidget.maximumWidth, 'type':int } , + 'set': { 'cb':TTkWidget.setMaximumWidth,'type':int } }, + 'Max Height' : { + 'init': {'name':'maxHeight', 'type':int } , + 'get': { 'cb':TTkWidget.maximumHeight, 'type':int } , + 'set': { 'cb':TTkWidget.setMaximumHeight,'type':int } }, + 'Layout' : { + 'init': {'name':'layout', 'type':TTkLayout} , + 'get': { 'cb':TTkWidget.layout, 'type':TTkLayout} , + 'set': { 'cb':TTkWidget.setLayout, 'type':TTkLayout} }, + 'Name' : { + 'init': {'name':'name', 'type':str } }, + 'Visible' : { + 'init': {'name':'visible', 'type':bool } , + 'get': {'cb':TTkWidget.isVisible, 'type':bool } , + 'set': {'cb':TTkWidget.setVisible, 'type':bool } }, + 'Enabled' : { + 'init': {'name':'enabled', 'type':bool } , + 'get': {'cb':TTkWidget.isEnabled, 'type':bool } , + 'set': {'cb':TTkWidget.setEnabled, 'type':bool } }, + } \ No newline at end of file diff --git a/TermTk/TTkUiTools/properties/window.py b/TermTk/TTkUiTools/properties/window.py new file mode 100644 index 00000000..7ea713db --- /dev/null +++ b/TermTk/TTkUiTools/properties/window.py @@ -0,0 +1,49 @@ +#!/usr/bin/env python3 + +# MIT License +# +# Copyright (c) 2023 Eugenio Parodi +# +# 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. + +from TermTk.TTkCore.constant import TTkK +from TermTk.TTkWidgets.window import TTkWindow + +TTkWindowProperties = { + 'Window Flags' : { + 'init': { 'name':'flags', 'type':'multiflags', + 'flags': { + 'Close Button' : TTkK.WindowFlag.WindowCloseButtonHint , + 'Maximize Button': TTkK.WindowFlag.WindowMaximizeButtonHint , + 'Minimize Button': TTkK.WindowFlag.WindowMinimizeButtonHint , + 'Reduce Button' : TTkK.WindowFlag.WindowReduceButtonHint } }, + 'get' : { 'cb':TTkWindow.windowFlag, 'type':'multiflags', + 'flags': { + 'Close Button' : TTkK.WindowFlag.WindowCloseButtonHint , + 'Maximize Button': TTkK.WindowFlag.WindowMaximizeButtonHint , + 'Minimize Button': TTkK.WindowFlag.WindowMinimizeButtonHint , + 'Reduce Button' : TTkK.WindowFlag.WindowReduceButtonHint } }, + 'set' : { 'cb':TTkWindow.setWindowFlag, 'type':'multiflags', + 'flags': { + 'Close Button' : TTkK.WindowFlag.WindowCloseButtonHint , + 'Maximize Button': TTkK.WindowFlag.WindowMaximizeButtonHint , + 'Minimize Button': TTkK.WindowFlag.WindowMinimizeButtonHint , + 'Reduce Button' : TTkK.WindowFlag.WindowReduceButtonHint } }, + }, + } \ No newline at end of file diff --git a/TermTk/TTkUiTools/uiloader.py b/TermTk/TTkUiTools/uiloader.py new file mode 100644 index 00000000..f513d14d --- /dev/null +++ b/TermTk/TTkUiTools/uiloader.py @@ -0,0 +1,24 @@ +# MIT License +# +# Copyright (c) 2023 Eugenio Parodi +# +# 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. + +class TTkUiLoader(): + pass \ No newline at end of file diff --git a/TermTk/TTkUiTools/uiproperties.py b/TermTk/TTkUiTools/uiproperties.py new file mode 100644 index 00000000..a39fe31d --- /dev/null +++ b/TermTk/TTkUiTools/uiproperties.py @@ -0,0 +1,40 @@ +# MIT License +# +# Copyright (c) 2023 Eugenio Parodi +# +# 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. + +from TermTk.TTkLayouts import TTkLayout, TTkGridLayout, TTkVBoxLayout, TTkHBoxLayout +from TermTk.TTkWidgets import * +from .properties import * + +TTkUiProperties = { + TTkButton: TTkButtonProperties, + TTkCheckbox: TTkCheckboxProperties, + TTkComboBox: TTkComboBoxProperties, + TTkFrame: TTkFrameProperties, + TTkLabel: TTkLabelProperties, + TTkLineEdit: TTkLineEditProperties, + TTkList: TTkListProperties, + TTkRadioButton: TTkRadioButtonProperties, + TTkResizableFrame: TTkResizableFrameProperties, + TTkSplitter: TTkSplitterProperties, + TTkWidget: TTkWidgetProperties, + TTkWindow: TTkWindowProperties, +} diff --git a/TermTk/TTkWidgets/checkbox.py b/TermTk/TTkWidgets/checkbox.py index 35405274..05a45e26 100644 --- a/TermTk/TTkWidgets/checkbox.py +++ b/TermTk/TTkWidgets/checkbox.py @@ -209,35 +209,3 @@ class TTkCheckbox(TTkWidget): self._pressEvent() return True return False - - _ttkProperties = { - 'Text' : { - 'init': {'name':'text', 'type':TTkString } , - 'get': {'cb':text, 'type':TTkString } , - 'set': {'cb':setText, 'type':TTkString } }, - 'Tristate' : { - 'init': {'name':'tristate', 'type':bool } , - 'get': {'cb':isTristate, 'type':bool } , - 'set': {'cb':setTristate, 'type':bool } }, - 'Checked' : { - 'init': {'name':'checked', 'type':bool } , - 'get': {'cb':isChecked, 'type':bool } , - 'set': {'cb':setChecked, 'type':bool } }, - 'Check State' : { - 'init': { 'name':'checked', 'type':'singleflag', - 'flags': { - 'Checked' : TTkK.Checked , - 'Unchecked' : TTkK.Unchecked , - 'Partially Checked': TTkK.PartiallyChecked } }, - 'get' : { 'cb':checkState, 'type':'singleflag', - 'flags': { - 'Checked' : TTkK.Checked , - 'Unchecked' : TTkK.Unchecked , - 'Partially Checked': TTkK.PartiallyChecked } }, - 'set' : { 'cb':setCheckState, 'type':'singleflag', - 'flags': { - 'Checked' : TTkK.Checked , - 'Unchecked' : TTkK.Unchecked , - 'Partially Checked': TTkK.PartiallyChecked } }, - }, - } diff --git a/TermTk/TTkWidgets/combobox.py b/TermTk/TTkWidgets/combobox.py index 8510cf20..42e19601 100644 --- a/TermTk/TTkWidgets/combobox.py +++ b/TermTk/TTkWidgets/combobox.py @@ -278,48 +278,3 @@ class TTkComboBox(TTkWidget): def focusInEvent(self): if self._editable: self._lineEdit.setFocus() - - _ttkProperties = { - 'Editable' : { - 'init': {'name':'editable', 'type':bool } , - 'get': {'cb':isEditable, 'type':bool } , - 'set': {'cb':setEditable, 'type':bool } }, - 'Text Align.' : { - 'init': {'name':'textAlign', 'type':'singleflag', - 'flags': { - 'None' : TTkK.Alignment.NONE, - 'Left' : TTkK.Alignment.LEFT_ALIGN, - 'Right' : TTkK.Alignment.RIGHT_ALIGN, - 'Center' : TTkK.Alignment.CENTER_ALIGN, - 'Justify': TTkK.Alignment.JUSTIFY } }, - 'get': {'cb':textAlign, 'type':'singleflag', - 'flags': { - 'None' : TTkK.Alignment.NONE, - 'Left' : TTkK.Alignment.LEFT_ALIGN, - 'Right' : TTkK.Alignment.RIGHT_ALIGN, - 'Center' : TTkK.Alignment.CENTER_ALIGN, - 'Justify': TTkK.Alignment.JUSTIFY } } , - 'set': {'cb':setTextAlign, 'type':'singleflag', - 'flags': { - 'None' : TTkK.Alignment.NONE, - 'Left' : TTkK.Alignment.LEFT_ALIGN, - 'Right' : TTkK.Alignment.RIGHT_ALIGN, - 'Center' : TTkK.Alignment.CENTER_ALIGN, - 'Justify': TTkK.Alignment.JUSTIFY } } }, - 'Insert Policy' : { - 'init': {'name':'insertPolicy', 'type':'singleflag', - 'flags': { - 'No Insert' : TTkK.InsertPolicy.NoInsert, - 'At Top' : TTkK.InsertPolicy.InsertAtTop, - 'At Bottom' : TTkK.InsertPolicy.InsertAtBottom } }, - 'get': {'cb':insertPolicy, 'type':'singleflag', - 'flags': { - 'No Insert' : TTkK.InsertPolicy.NoInsert, - 'At Top' : TTkK.InsertPolicy.InsertAtTop, - 'At Bottom' : TTkK.InsertPolicy.InsertAtBottom } }, - 'set': {'cb':setInsertPolicy, 'type':'singleflag', - 'flags': { - 'No Insert' : TTkK.InsertPolicy.NoInsert, - 'At Top' : TTkK.InsertPolicy.InsertAtTop, - 'At Bottom' : TTkK.InsertPolicy.InsertAtBottom } } }, - } \ No newline at end of file diff --git a/TermTk/TTkWidgets/frame.py b/TermTk/TTkWidgets/frame.py index b764dba0..758520ed 100644 --- a/TermTk/TTkWidgets/frame.py +++ b/TermTk/TTkWidgets/frame.py @@ -119,14 +119,3 @@ class TTkFrame(TTkWidget): colorText=self._titleColor) elif self._menubarTop: self._canvas.drawMenuBarBg(pos=(0,0),size=self.width(),color=self._borderColor) - - _ttkProperties = { - 'Border' : { - 'init': {'name':'border', 'type':bool }, - 'get': {'cb':border, 'type':bool } , - 'set': {'cb':setBorder, 'type':bool } }, - 'Title' : { - 'init': {'name':'title', 'type':TTkString }, - 'get': {'cb':title, 'type':TTkString } , - 'set': {'cb':setTitle, 'type':TTkString } }, - } \ No newline at end of file diff --git a/TermTk/TTkWidgets/label.py b/TermTk/TTkWidgets/label.py index c592b931..189989eb 100644 --- a/TermTk/TTkWidgets/label.py +++ b/TermTk/TTkWidgets/label.py @@ -81,14 +81,3 @@ class TTkLabel(TTkWidget): def colorUpdated(self, color): self.update() - - _ttkProperties = { - 'Text' : { - 'init': {'name':'text', 'type':TTkString }, - 'get': {'cb':text, 'type':TTkString } , - 'set': {'cb':setText, 'type':TTkString } }, - 'Color' : { - 'init': {'name':'color', 'type':TTkColor }, - 'get': {'cb':color, 'type':TTkColor } , - 'set': {'cb':setColor, 'type':TTkColor } }, - } \ No newline at end of file diff --git a/TermTk/TTkWidgets/lineedit.py b/TermTk/TTkWidgets/lineedit.py index 1f71b170..dfa68636 100644 --- a/TermTk/TTkWidgets/lineedit.py +++ b/TermTk/TTkWidgets/lineedit.py @@ -251,21 +251,3 @@ class TTkLineEdit(TTkWidget): self._selectionTo = 0 TTkHelper.hideCursor() self.update() - - _ttkProperties = { - 'Input Type' : { - 'init': {'name':'inputType', 'type':'multiflags', - 'flags': { - 'Text' : TTkK.Input_Text , - 'Number' : TTkK.Input_Number , - 'Password': TTkK.Input_Password } }, - 'get': {'cb':inputType, 'type':'multiflags', - 'flags': { - 'Text' : TTkK.Input_Text , - 'Number' : TTkK.Input_Number , - 'Password': TTkK.Input_Password } } }, - 'Text' : { - 'init': {'name':'text', 'type':TTkString } , - 'get': {'cb':text, 'type':TTkString } , - 'set': {'cb':setText, 'type':TTkString } } - } \ No newline at end of file diff --git a/TermTk/TTkWidgets/radiobutton.py b/TermTk/TTkWidgets/radiobutton.py index 74fed6eb..4650ddda 100644 --- a/TermTk/TTkWidgets/radiobutton.py +++ b/TermTk/TTkWidgets/radiobutton.py @@ -178,27 +178,3 @@ class TTkRadioButton(TTkWidget): return True return False - _ttkProperties = { - 'Text' : { - 'init': {'name':'text', 'type':TTkString } , - 'get': {'cb':text, 'type':TTkString } , - 'set': {'cb':setText, 'type':TTkString } }, - 'Checked' : { - 'init': {'name':'checked', 'type':bool } , - 'get': {'cb':isChecked, 'type':bool } , - 'set': {'cb':setChecked, 'type':bool } }, - 'Check State' : { - 'init': { 'name':'checked', 'type':'singleflag', - 'flags': { - 'Checked' : TTkK.Checked , - 'Unchecked' : TTkK.Unchecked } }, - 'get' : { 'cb':checkState, 'type':'singleflag', - 'flags': { - 'Checked' : TTkK.Checked , - 'Unchecked' : TTkK.Unchecked } }, - 'set' : { 'cb':setCheckState, 'type':'singleflag', - 'flags': { - 'Checked' : TTkK.Checked , - 'Unchecked' : TTkK.Unchecked } }, - }, - } diff --git a/TermTk/TTkWidgets/splitter.py b/TermTk/TTkWidgets/splitter.py index 8ff51833..514c78ab 100644 --- a/TermTk/TTkWidgets/splitter.py +++ b/TermTk/TTkWidgets/splitter.py @@ -382,17 +382,3 @@ class TTkSplitter(TTkFrame): if ret > item.maximumWidth(): ret = item.maximumWidth() return ret - - _ttkProperties = { - 'Border' : { - 'init': {'name':'border', 'type':bool } }, - 'Orientation' : { - 'init': {'name':'orientation', 'type':'singleflag', - 'flags': { - 'Horizontal' : TTkK.HORIZONTAL , - 'Vertical' : TTkK.VERTICAL } } , - 'get': {'cb':orientation, 'type':'singleflag', - 'flags': { - 'Horizontal' : TTkK.HORIZONTAL , - 'Vertical' : TTkK.VERTICAL } } } - } diff --git a/TermTk/TTkWidgets/widget.py b/TermTk/TTkWidgets/widget.py index 1f5d84fe..7cefeb0a 100644 --- a/TermTk/TTkWidgets/widget.py +++ b/TermTk/TTkWidgets/widget.py @@ -663,68 +663,3 @@ class TTkWidget(TMouseEvents,TKeyEvents, TDragEvents): laf = TTkLookAndFeel() self._lookAndFeel = laf self._lookAndFeel.modified.connect(self.update) - - _ttkProperties = { - # 'X' : { - # 'init': {'name':'x', 'type':int } , - # 'get': { 'cb':x, 'type':int } }, - # 'Y' : { - # 'init': {'name':'y', 'type':int } , - # 'get': { 'cb':y, 'type':int } }, - 'Position' : { - 'init': {'name':'pos', 'type': { - 'name': 'x', 'type':int, - 'name': 'y', 'type':int } }, - 'get': { 'cb':pos, 'type': { - 'name': 'x', 'type':int, - 'name': 'y', 'type':int } }, - 'set': { 'cb':move, 'type': { - 'name': 'x', 'type':int, - 'name': 'y', 'type':int } } }, - 'Size' : { - 'init': {'name':'size', 'type': { - 'name': 'width', 'type':int, - 'name': 'height', 'type':int } }, - 'get': { 'cb':size, 'type': { - 'name': 'width', 'type':int, - 'name': 'height', 'type':int } }, - 'set': { 'cb':resize, 'type': { - 'name': 'width', 'type':int, - 'name': 'height', 'type':int } } }, - # 'Width' : { - # 'init': {'name':'width', 'type':int } , - # 'get': { 'cb':width, 'type':int } }, - # 'Height' : { - # 'init': {'name':'height', 'type':int } , - # 'get': { 'cb':height, 'type':int } }, - 'Min Width' : { - 'init': {'name':'minWidth', 'type':int } , - 'get': { 'cb':minimumWidth, 'type':int } , - 'set': { 'cb':setMinimumWidth,'type':int } }, - 'Min Height' : { - 'init': {'name':'minHeight', 'type':int } , - 'get': { 'cb':minimumHeight, 'type':int } , - 'set': { 'cb':setMinimumHeight,'type':int } }, - 'Max Width' : { - 'init': {'name':'maxWidth', 'type':int } , - 'get': { 'cb':maximumWidth, 'type':int } , - 'set': { 'cb':setMaximumWidth,'type':int } }, - 'Max Height' : { - 'init': {'name':'maxHeight', 'type':int } , - 'get': { 'cb':maximumHeight, 'type':int } , - 'set': { 'cb':setMaximumHeight,'type':int } }, - 'Layout' : { - 'init': {'name':'layout', 'type':TTkLayout} , - 'get': { 'cb':layout, 'type':TTkLayout} , - 'set': { 'cb':setLayout, 'type':TTkLayout} }, - 'Name' : { - 'init': {'name':'name', 'type':str } }, - 'Visible' : { - 'init': {'name':'visible', 'type':bool } , - 'get': {'cb':isVisible, 'type':bool } , - 'set': {'cb':setVisible, 'type':bool } }, - 'Enabled' : { - 'init': {'name':'enabled', 'type':bool } , - 'get': {'cb':isEnabled, 'type':bool } , - 'set': {'cb':setEnabled, 'type':bool } }, - } \ No newline at end of file diff --git a/TermTk/TTkWidgets/window.py b/TermTk/TTkWidgets/window.py index abcd9418..dceb6a30 100644 --- a/TermTk/TTkWidgets/window.py +++ b/TermTk/TTkWidgets/window.py @@ -182,26 +182,3 @@ class TTkWindow(TTkResizableFrame): if self._menubarTop: self._menubarTop.setBorderColor(TTkColor.RST) self.update() - - _ttkProperties = { - 'Window Flags' : { - 'init': { 'name':'flags', 'type':'multiflags', - 'flags': { - 'Close Button' : TTkK.WindowFlag.WindowCloseButtonHint , - 'Maximize Button': TTkK.WindowFlag.WindowMaximizeButtonHint , - 'Minimize Button': TTkK.WindowFlag.WindowMinimizeButtonHint , - 'Reduce Button' : TTkK.WindowFlag.WindowReduceButtonHint } }, - 'get' : { 'cb':windowFlag, 'type':'multiflags', - 'flags': { - 'Close Button' : TTkK.WindowFlag.WindowCloseButtonHint , - 'Maximize Button': TTkK.WindowFlag.WindowMaximizeButtonHint , - 'Minimize Button': TTkK.WindowFlag.WindowMinimizeButtonHint , - 'Reduce Button' : TTkK.WindowFlag.WindowReduceButtonHint } }, - 'set' : { 'cb':setWindowFlag, 'type':'multiflags', - 'flags': { - 'Close Button' : TTkK.WindowFlag.WindowCloseButtonHint , - 'Maximize Button': TTkK.WindowFlag.WindowMaximizeButtonHint , - 'Minimize Button': TTkK.WindowFlag.WindowMinimizeButtonHint , - 'Reduce Button' : TTkK.WindowFlag.WindowReduceButtonHint } }, - }, - } \ No newline at end of file diff --git a/TermTk/__init__.py b/TermTk/__init__.py index ebb1fab4..482217d3 100644 --- a/TermTk/__init__.py +++ b/TermTk/__init__.py @@ -6,5 +6,6 @@ from .TTkTypes import * from .TTkLayouts import * from .TTkTestWidgets import * from .TTkAbstract import * +from .TTkUiTools import * TTkCfg.theme = TTkTheme() diff --git a/ttkDesigner/app/propertyeditor.py b/ttkDesigner/app/propertyeditor.py index 371661b1..1d908dfd 100644 --- a/ttkDesigner/app/propertyeditor.py +++ b/ttkDesigner/app/propertyeditor.py @@ -86,7 +86,8 @@ class _DetailLazyFormView(ttk.TTkAbstractScrollView): class PropertyEditor(ttk.TTkGridLayout): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) - self._detail = ttk.TTkFrame() + self._detail = ttk.TTkTree() + self._detail.setHeaderLabels(["Property","Value"]) self._widget = ttk.TTkWidget() self._superWidget = ttk.TTkWidget() self.addWidget(self._detail) @@ -95,83 +96,152 @@ class PropertyEditor(ttk.TTkGridLayout): def setDetail(self, widget, superWidget): self._widget = widget self._superWidget = superWidget - self.removeWidget(self._detail) self._makeDetail(widget) - self.addWidget(self._detail) def _makeDetail(self, domw): - self._detail = ttk.TTkScrollArea(verticalScrollBarPolicy=ttk.TTkK.ScrollBarAlwaysOn) - dlfv =_DetailLazyFormView() - self._detail.setViewport(dlfv) + def _bound(_f,_w,_l): + def _ret(_v): + _f(_w,_l(_v)) + self._superWidget.updateAll() + return _ret + def _boundFlags(_f,_g,_w,_l,_flag): + def _ret(_v): + _val = _g(_w) + _val = _val|_flag if _l(_v) else _val&~_flag + _f(_w,_val) + self._superWidget.updateAll() + return _ret + + # Multi Flag Fields + # ▼ Input Type │ - (0x0001) + # • Text │[X] 0x0001 + # • Number │[ ] 0x0002 + # • Password │[ ] 0x0004 + def _processMultiFlag(name, prop): + flags = prop['get']['flags'] + ret = ttk.TTkTreeWidgetItem([name,f" - (0x{prop['get']['cb'](domw):04X})"],expanded=True) + # value = ttk.TTkFrame(layout=ttk.TTkVBoxLayout(), height=len(flags), border=False) + for fl in flags: + if 'set' in prop: + fcb = ttk.TTkCheckbox(text=f" 0x{flags[fl]:04X}", checked=bool(prop['get']['cb'](domw)&flags[fl])) + fcb.stateChanged.connect(_boundFlags( + prop['set']['cb'], prop['get']['cb'], + domw, lambda v: v==ttk.TTkK.Checked, flags[fl])) + else: + fcb = ttk.TTkCheckbox(text=f" 0x{flags[fl]:04X}", checked=bool(prop['get']['cb'](domw)&flags[fl]), enabled=False) + ret.addChild(ttk.TTkTreeWidgetItem([f"{fl}", fcb])) + return ret + + # Single Flag Fields + # • Check State │[Partially Checked ^]│ + # │┌───────────────────┐ │ + # ││Checked │ │ + # ││Unchecked │ │ + # ││Partially Checked │ │ + # │└───────────────────┘ │ + def _processSingleFlag(name, prop): + flags = prop['get']['flags'] + items = [(k,v) for k,v in flags.items()] + if 'set' in prop: + value = ttk.TTkComboBox(list=[n for n,_ in items], height=1, textAlign=ttk.TTkK.LEFT_ALIGN) + value.setCurrentIndex([cs for _,cs in items].index(prop['get']['cb'](domw))) + value.currentTextChanged.connect(_bound(prop['set']['cb'],domw, lambda v:flags[v])) + else: + value = ttk.TTkLabel(text=items[[cs for _,cs in items].index(prop['get']['cb'](domw))][0]) + return ttk.TTkTreeWidgetItem([name,value]) + + # List Fields + # property in this format: + # 'Position' : { + # 'init': {'name':'pos', 'type': [ + # { 'name': 'x', 'type':int } , + # { 'name': 'y', 'type':int } ] }, + # 'get': { 'cb':pos, 'type': [ + # { 'name': 'x', 'type':int } , + # { 'name': 'y', 'type':int } ] }, + # 'set': { 'cb':move, 'type': [ + # { 'name': 'x', 'type':int } , + # { 'name': 'y', 'type':int } ] } }, + # + def _processList(name, prop): + curVal = prop['get']['cb'](domw) + value = ttk.TTkLabel(text=f"{curVal}") + ret = ttk.TTkTreeWidgetItem([name,value]) + for _i, _prop in enumerate(prop['get']['type']): + _curVal = curVal[_i] + # if + return ret + + # Dict Fields + def _processDict(name, prop): + curVal = prop['get']['cb'](domw) + value = ttk.TTkLabel(text=f"{curVal} - TBD") + ret = ttk.TTkTreeWidgetItem([name,value]) + return ret + + # Boolean Fields + def _processBool(name, prop): + getval = prop['get']['cb'](domw) + value = ttk.TTkCheckbox(text=f" {p}", checked=getval, height=1) + value.stateChanged.connect(_bound(prop['set']['cb'],domw, lambda v:v==ttk.TTkK.Checked)) + return ttk.TTkTreeWidgetItem([name,value]) + # Integer Fields + def _processInt(name, prop): + getval = prop['get']['cb'](domw) + value = ttk.TTkSpinBox(value=getval, height=1) + value.valueChanged.connect(_bound(prop['set']['cb'],domw,lambda v:v)) + return ttk.TTkTreeWidgetItem([name,value]) + # String Fields + def _processTTkString(name, prop): + getval = prop['get']['cb'](domw) + value = ttk.TTkLineEdit(text=getval, height=1) + value.textEdited.connect(_bound(prop['set']['cb'],domw,lambda v:v)) + return ttk.TTkTreeWidgetItem([name,value]) + # Color Fields + def _processTTkColor(name, prop): + getval = prop['get']['cb'](domw) + value = ttk.TTkColorButtonPicker(color=getval, height=1) + value.colorSelected.connect(_bound(prop['set']['cb'],domw,lambda v:v)) + return ttk.TTkTreeWidgetItem([name,value]) + + # Unrecognised Field + def _processUnknown(name, prop): + getval = prop['get']['cb'](domw) + if type(prop['get']['type']) == str: + getval = f"{prop['get']['type']} = {getval}" + elif issubclass(prop['get']['type'], ttk.TTkLayout): + getval = getval.__class__.__name__ + value = ttk.TTkLabel(minSize=(30,1), maxHeight=1, text=f"{getval}", height=1) + return ttk.TTkTreeWidgetItem([name,value]) + proplist = [] + self._detail.clear() for cc in reversed(type(domw).__mro__): - if hasattr(cc,'_ttkProperties'): - dlfv.addFormRow(ttk.TTkLabel( - minSize=(30,1), maxHeight=1, - color=ttk.TTkColor.bg('#000099')+ttk.TTkColor.fg('#ffff00'), - text=f"{cc.__name__}")) - for p in cc._ttkProperties: - prop = cc._ttkProperties[p] - if prop not in proplist: - proplist.append(prop) - if 'get' in prop: - def _bound(_f,_w,_l): - def _ret(_v): - _f(_w,_l(_v)) - self._superWidget.updateAll() - return _ret - def _boundFlags(_f,_g,_w,_l,_flag): - def _ret(_v): - _val = _g(_w) - _val = _val|_flag if _l(_v) else _val&~_flag - _f(_w,_val) - self._superWidget.updateAll() - return _ret - getval = prop['get']['cb'](domw) - if prop['get']['type'] == 'multiflags': - flags = prop['get']['flags'] - value = ttk.TTkFrame(layout=ttk.TTkVBoxLayout(), height=len(flags), border=False) - for fl in flags: - if 'set' in prop: - value.layout().addWidget(fcb := ttk.TTkCheckbox(text=f" {fl}", checked=bool(prop['get']['cb'](domw)&flags[fl]))) - fcb.stateChanged.connect(_boundFlags( - prop['set']['cb'], prop['get']['cb'], - domw, lambda v: v==ttk.TTkK.Checked, flags[fl])) - else: - value.layout().addWidget(fcb := ttk.TTkCheckbox(text=f" {fl}", checked=bool(prop['get']['cb'](domw)&flags[fl]), enabled=False)) - elif prop['get']['type'] == 'singleflag': - flags = prop['get']['flags'] - items = [(k,v) for k,v in flags.items()] - if 'set' in prop: - value = ttk.TTkComboBox(list=[n for n,_ in items], height=1, textAlign=ttk.TTkK.LEFT_ALIGN) - value.setCurrentIndex([cs for _,cs in items].index(getval)) - value.currentTextChanged.connect(_bound(prop['set']['cb'],domw, lambda v:flags[v])) + # if hasattr(cc,'_ttkProperties'): + if issubclass(cc, ttk.TTkWidget): + classItem = ttk.TTkTreeWidgetItem([cc.__name__,''], expanded=True) + self._detail.addTopLevelItem(classItem) + if cc in ttk.TTkUiProperties: + for p in ttk.TTkUiProperties[cc]: + prop = ttk.TTkUiProperties[cc][p] + if prop not in proplist: + proplist.append(prop) + if 'get' in prop: + if prop['get']['type'] == 'multiflags': + classItem.addChild(_processMultiFlag(p,prop)) + elif prop['get']['type'] == 'singleflag': + classItem.addChild(_processSingleFlag(p,prop)) + elif prop['get']['type'] == bool and 'set' in prop: + classItem.addChild(_processBool(p,prop)) + elif prop['get']['type'] == int and 'set' in prop: + classItem.addChild(_processInt(p,prop)) + elif prop['get']['type'] == ttk.TTkString and 'set' in prop: + classItem.addChild(_processTTkString(p,prop)) + elif prop['get']['type'] == ttk.TTkColor and 'set' in prop: + classItem.addChild(_processTTkColor(p,prop)) + elif type(prop['get']['type']) == list: + classItem.addChild(_processList(p,prop)) + elif type(prop['get']['type']) == dict: + classItem.addChild(_processDict(p,prop)) else: - value = ttk.TTkLabel(text=items[[cs for _,cs in items].index(getval)][0]) - elif prop['get']['type'] == bool and 'set' in prop: - value = ttk.TTkCheckbox(text=f" {p}", checked=getval, height=1) - value.stateChanged.connect(_bound(prop['set']['cb'],domw, lambda v:v==ttk.TTkK.Checked)) - elif prop['get']['type'] == int and 'set' in prop: - value = ttk.TTkSpinBox(value=getval, height=1) - value.valueChanged.connect(_bound(prop['set']['cb'],domw,lambda v:v)) - elif prop['get']['type'] == ttk.TTkString and 'set' in prop: - value = ttk.TTkLineEdit(text=getval, height=1) - value.textEdited.connect(_bound(prop['set']['cb'],domw,lambda v:v)) - elif prop['get']['type'] == ttk.TTkColor and 'set' in prop: - value = ttk.TTkColorButtonPicker(color=getval, height=1) - value.colorSelected.connect(_bound(prop['set']['cb'],domw,lambda v:v)) - elif type(prop['get']['type']) == dict: - curVal = prop['get']['cb'](domw) - value = ttk.TTkLabel(text=f"{curVal}") - else: - if type(prop['get']['type']) == str: - getval = f"{prop['get']['type']} = {getval}" - elif issubclass(prop['get']['type'], ttk.TTkLayout): - getval = getval.__class__.__name__ - value = ttk.TTkLabel(minSize=(30,1), maxHeight=1, text=f"{getval}", height=1) - dlfv.addFormRow( - ttk.TTkLabel( - minSize=(30,1), maxHeight=1, - color=ttk.TTkColor.bg('#222222')+ttk.TTkColor.fg('#88ffff'), - text=f" - {p}"), - value,) \ No newline at end of file + classItem.addChild(_processUnknown(p,prop))