MCPcopy Index your code
hub / github.com/rawpython/remi / DropDownItem

Class DropDownItem

remi/gui.py:2850–2886  ·  view source on GitHub ↗

item widget for the DropDown

Source from the content-addressed store, hash-verified

2848
2849
2850class DropDownItem(Widget, _MixinTextualWidget):
2851 """item widget for the DropDown"""
2852 @property
2853 @editor_attribute_decorator("WidgetSpecific", '''The value returned to the DropDown in onchange event.
2854 By default it corresponds to the displayed text, unsless it is changes.''', str, {})
2855 def value(self): return unescape(self.attributes.get('value', '').replace(' ', ' '))
2856 @value.setter
2857 def value(self, value): self.attributes['value'] = escape(value.replace(' ', ' '), quote=False)
2858
2859 def __init__(self, text='', *args, **kwargs):
2860 """
2861 Args:
2862 kwargs: See Widget.__init__()
2863 """
2864 super(DropDownItem, self).__init__(*args, **kwargs)
2865 self.type = 'option'
2866 self.value = text
2867 self.set_text(text)
2868
2869 def set_text(self, text):
2870 """
2871 Sets the text label for the Widget.
2872
2873 Args:
2874 text (str): The string label of the Widget.
2875 """
2876 _MixinTextualWidget.set_text(self, text)
2877 self.children['text'] = self.children['text'].replace(' ', ' ')
2878
2879 def get_text(self):
2880 """
2881 Returns:
2882 str: The text content of the Widget. You can set the text content with set_text(text).
2883 """
2884 if 'text' not in self.children.keys():
2885 return ''
2886 return unescape(self.get_child('text').replace(' ', ' '))
2887
2888
2889class Image(Widget):

Callers 2

new_from_listMethod · 0.85
appendMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected