Browse Source

Added Color Picker in the ttkDesigner

pull/137/head
Eugenio Parodi 3 years ago
parent
commit
79a0dfb1a8
  1. 1
      TermTk/TTkUiTools/properties/__init__.py
  2. 38
      TermTk/TTkUiTools/properties/colorpicker.py
  3. 1
      TermTk/TTkUiTools/uiproperties.py
  4. 3
      TermTk/TTkWidgets/texedit.py
  5. 6
      ttkDesigner/app/widgetbox.py

1
TermTk/TTkUiTools/properties/__init__.py

@ -1,6 +1,7 @@
# from .about import
from .button import TTkButtonProperties
from .checkbox import TTkCheckboxProperties
from .colorpicker import TTkColorButtonPickerProperties
from .combobox import TTkComboBoxProperties
from .frame import TTkFrameProperties
# from .graph import

38
TermTk/TTkUiTools/properties/colorpicker.py

@ -0,0 +1,38 @@
# 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.TTkWidgets.TTkPickers.colorpicker import TTkColorButtonPicker
TTkColorButtonPickerProperties = {
'properties' : {
'Color' : {
'init': {'name':'color', 'type':TTkColor },
'get': {'cb':TTkColorButtonPicker.color, 'type':TTkColor } ,
'set': {'cb':TTkColorButtonPicker.setColor, 'type':TTkColor } }, },
'signals' : {
'colorSelected(TTkColor)' : {'name': 'colorSelected', 'type' : TTkColor},
},
'slots' : {
'setColor(TTkColor)' : {'name': 'setColor', 'type' : TTkColor},
}
}

1
TermTk/TTkUiTools/uiproperties.py

@ -28,6 +28,7 @@ TTkUiProperties = {
# Widgets
TTkButton.__name__: TTkButtonProperties,
TTkCheckbox.__name__: TTkCheckboxProperties,
TTkColorButtonPicker.__name__ : TTkColorButtonPickerProperties,
TTkComboBox.__name__: TTkComboBoxProperties,
TTkFrame.__name__: TTkFrameProperties,
TTkLabel.__name__: TTkLabelProperties,

3
TermTk/TTkWidgets/texedit.py

@ -580,6 +580,7 @@ class TTkTextEdit(TTkAbstractScrollArea):
'lineWrapMode', 'setLineWrapMode',
'wordWrapMode', 'setWordWrapMode',
'textCursor', 'setFocus',
'copy', 'paste',
'undo', 'redo', 'isUndoAvailable', 'isRedoAvailable',
# Export Methods,
'toAnsi', 'toRawText', 'toPlainText', # 'toHtml', 'toMarkdown',
@ -612,6 +613,8 @@ class TTkTextEdit(TTkAbstractScrollArea):
self.textCursor = self._textEditView.textCursor
self.setFocus = self._textEditView.setFocus
self.multiLine = self._textEditView.multiLine
self.copy = self._textEditView.copy
self.paste = self._textEditView.paste
self.undo = self._textEditView.undo
self.redo = self._textEditView.redo
self.isUndoAvailable = self._textEditView.isUndoAvailable

6
ttkDesigner/app/widgetbox.py

@ -59,6 +59,12 @@ dWidgets = {
"Frame" : { "class":ttk.TTkFrame, "params":{'size':(20,5), 'border':True}},
"Resizable Frame" : { "class":ttk.TTkResizableFrame, "params":{'size':(20,5)}},
},
'Pickers':{
"Color Picker" : { "class":ttk.TTkColorButtonPicker, "params":{'size':(6,3), 'border':True}},
"File Picker" : { "class":ttk.TTkButton, "params":{'size':(20,3)}, "disabled": True},
"Date Picker" : { "class":ttk.TTkButton, "params":{'size':(20,3)}, "disabled": True},
"TtkString Picker" : { "class":ttk.TTkButton, "params":{'size':(20,3)}, "disabled": True},
},
'Debug':{
"Log Viewer" : { "class":ttk.TTkLogViewer, "params":{'size':(60,10)}},
"Input View" : { "class":ttk.TTkKeyPressView, "params":{'size':(60,3)}},

Loading…
Cancel
Save