Browse Source

moved the properties in the TTkUiTools

pull/115/head
Eugenio Parodi 3 years ago
parent
commit
f13c5fa1f5
  1. 2
      TermTk/TTkUiTools/__init__.py
  2. 24
      TermTk/TTkUiTools/properties/__init__.py
  3. 21
      TermTk/TTkUiTools/properties/about.py
  4. 39
      TermTk/TTkUiTools/properties/button.py
  5. 57
      TermTk/TTkUiTools/properties/checkbox.py
  6. 70
      TermTk/TTkUiTools/properties/combobox.py
  7. 35
      TermTk/TTkUiTools/properties/frame.py
  8. 22
      TermTk/TTkUiTools/properties/graph.py
  9. 21
      TermTk/TTkUiTools/properties/image.py
  10. 36
      TermTk/TTkUiTools/properties/label.py
  11. 43
      TermTk/TTkUiTools/properties/lineedit.py
  12. 23
      TermTk/TTkUiTools/properties/list_.py
  13. 23
      TermTk/TTkUiTools/properties/listwidget.py
  14. 23
      TermTk/TTkUiTools/properties/menubar.py
  15. 21
      TermTk/TTkUiTools/properties/progressbar.py
  16. 52
      TermTk/TTkUiTools/properties/radiobutton.py
  17. 25
      TermTk/TTkUiTools/properties/resizableframe.py
  18. 24
      TermTk/TTkUiTools/properties/scrollarea.py
  19. 23
      TermTk/TTkUiTools/properties/scrollbar.py
  20. 24
      TermTk/TTkUiTools/properties/spacer.py
  21. 24
      TermTk/TTkUiTools/properties/spinbox.py
  22. 40
      TermTk/TTkUiTools/properties/splitter.py
  23. 24
      TermTk/TTkUiTools/properties/tabwidget.py
  24. 24
      TermTk/TTkUiTools/properties/texedit.py
  25. 89
      TermTk/TTkUiTools/properties/widget.py
  26. 49
      TermTk/TTkUiTools/properties/window.py
  27. 24
      TermTk/TTkUiTools/uiloader.py
  28. 40
      TermTk/TTkUiTools/uiproperties.py
  29. 32
      TermTk/TTkWidgets/checkbox.py
  30. 45
      TermTk/TTkWidgets/combobox.py
  31. 11
      TermTk/TTkWidgets/frame.py
  32. 11
      TermTk/TTkWidgets/label.py
  33. 18
      TermTk/TTkWidgets/lineedit.py
  34. 24
      TermTk/TTkWidgets/radiobutton.py
  35. 14
      TermTk/TTkWidgets/splitter.py
  36. 65
      TermTk/TTkWidgets/widget.py
  37. 23
      TermTk/TTkWidgets/window.py
  38. 1
      TermTk/__init__.py
  39. 220
      ttkDesigner/app/propertyeditor.py

2
TermTk/TTkUiTools/__init__.py

@ -0,0 +1,2 @@
from .uiloader import TTkUiLoader
from .uiproperties import TTkUiProperties

24
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

21
TermTk/TTkUiTools/properties/about.py

@ -0,0 +1,21 @@
# MIT License
#
# Copyright (c) 2023 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.

39
TermTk/TTkUiTools/properties/button.py

@ -0,0 +1,39 @@
# MIT License
#
# Copyright (c) 2023 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.
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 } },
}

57
TermTk/TTkUiTools/properties/checkbox.py

@ -0,0 +1,57 @@
# MIT License
#
# Copyright (c) 2023 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.
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 } },
},
}

70
TermTk/TTkUiTools/properties/combobox.py

@ -0,0 +1,70 @@
# MIT License
#
# Copyright (c) 2023 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.
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 } } },
}

35
TermTk/TTkUiTools/properties/frame.py

@ -0,0 +1,35 @@
# MIT License
#
# Copyright (c) 2023 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.
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 } },
}

22
TermTk/TTkUiTools/properties/graph.py

@ -0,0 +1,22 @@
# MIT License
#
# Copyright (c) 2023 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.

21
TermTk/TTkUiTools/properties/image.py

@ -0,0 +1,21 @@
# MIT License
#
# Copyright (c) 2023 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.

36
TermTk/TTkUiTools/properties/label.py

@ -0,0 +1,36 @@
# MIT License
#
# Copyright (c) 2023 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.
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 } },
}

43
TermTk/TTkUiTools/properties/lineedit.py

@ -0,0 +1,43 @@
# MIT License
#
# Copyright (c) 2023 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.
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 } }
}

23
TermTk/TTkUiTools/properties/list_.py

@ -0,0 +1,23 @@
# MIT License
#
# Copyright (c) 2023 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.
TTkListProperties = {}

23
TermTk/TTkUiTools/properties/listwidget.py

@ -0,0 +1,23 @@
#!/usr/bin/env python3
# MIT License
#
# Copyright (c) 2023 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.

23
TermTk/TTkUiTools/properties/menubar.py

@ -0,0 +1,23 @@
#!/usr/bin/env python3
# MIT License
#
# Copyright (c) 2023 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.

21
TermTk/TTkUiTools/properties/progressbar.py

@ -0,0 +1,21 @@
# MIT License
#
# Copyright (c) 2023 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.

52
TermTk/TTkUiTools/properties/radiobutton.py

@ -0,0 +1,52 @@
#!/usr/bin/env python3
# MIT License
#
# Copyright (c) 2023 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.
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 } },
},
}

25
TermTk/TTkUiTools/properties/resizableframe.py

@ -0,0 +1,25 @@
#!/usr/bin/env python3
# MIT License
#
# Copyright (c) 2023 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.
TTkResizableFrameProperties = {}

24
TermTk/TTkUiTools/properties/scrollarea.py

@ -0,0 +1,24 @@
#!/usr/bin/env python3
# MIT License
#
# Copyright (c) 2023 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.

23
TermTk/TTkUiTools/properties/scrollbar.py

@ -0,0 +1,23 @@
#!/usr/bin/env python3
# MIT License
#
# Copyright (c) 2023 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.

24
TermTk/TTkUiTools/properties/spacer.py

@ -0,0 +1,24 @@
#!/usr/bin/env python3
# MIT License
#
# Copyright (c) 2023 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.

24
TermTk/TTkUiTools/properties/spinbox.py

@ -0,0 +1,24 @@
#!/usr/bin/env python3
# MIT License
#
# Copyright (c) 2023 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.

40
TermTk/TTkUiTools/properties/splitter.py

@ -0,0 +1,40 @@
#!/usr/bin/env python3
# MIT License
#
# Copyright (c) 2023 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.
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 } } }
}

24
TermTk/TTkUiTools/properties/tabwidget.py

@ -0,0 +1,24 @@
#!/usr/bin/env python3
# MIT License
#
# Copyright (c) 2023 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.

24
TermTk/TTkUiTools/properties/texedit.py

@ -0,0 +1,24 @@
#!/usr/bin/env python3
# MIT License
#
# Copyright (c) 2023 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.

89
TermTk/TTkUiTools/properties/widget.py

@ -0,0 +1,89 @@
# MIT License
#
# Copyright (c) 2023 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.
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 } },
}

49
TermTk/TTkUiTools/properties/window.py

@ -0,0 +1,49 @@
#!/usr/bin/env python3
# MIT License
#
# Copyright (c) 2023 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.
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 } },
},
}

24
TermTk/TTkUiTools/uiloader.py

@ -0,0 +1,24 @@
# MIT License
#
# Copyright (c) 2023 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.
class TTkUiLoader():
pass

40
TermTk/TTkUiTools/uiproperties.py

@ -0,0 +1,40 @@
# MIT License
#
# Copyright (c) 2023 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.
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,
}

32
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 } },
},
}

45
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 } } },
}

11
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 } },
}

11
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 } },
}

18
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 } }
}

24
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 } },
},
}

14
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 } } }
}

65
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 } },
}

23
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 } },
},
}

1
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()

220
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,)
classItem.addChild(_processUnknown(p,prop))

Loading…
Cancel
Save