Mercurial > libervia-backend
comparison frontends/src/wix/xmlui.py @ 1085:7a39ae3950f7
frontends (XMLUI): implementation of read_only attributes for widgets String, TextBox, Password and Bool
author | Goffi <goffi@goffi.org> |
---|---|
date | Wed, 25 Jun 2014 14:01:56 +0200 |
parents | 5a6354ff468c |
children | b29452cab50b |
comparison
equal
deleted
inserted
replaced
1084:03dcb6ca7e49 | 1085:7a39ae3950f7 |
---|---|
80 | 80 |
81 | 81 |
82 class StringWidget(EventWidget, ValueWidget, xmlui.StringWidget, wx.TextCtrl): | 82 class StringWidget(EventWidget, ValueWidget, xmlui.StringWidget, wx.TextCtrl): |
83 _xmlui_change_event = wx.EVT_TEXT | 83 _xmlui_change_event = wx.EVT_TEXT |
84 | 84 |
85 def __init__(self, parent, value): | 85 def __init__(self, parent, value, read_only=False): |
86 wx.TextCtrl.__init__(self, parent, -1, value) | 86 style = wx.TE_READONLY if read_only else 0 |
87 wx.TextCtrl.__init__(self, parent, -1, value, style=style) | |
87 self._xmlui_proportion = 1 | 88 self._xmlui_proportion = 1 |
88 | 89 |
89 | 90 |
90 class PasswordWidget(EventWidget, ValueWidget, xmlui.PasswordWidget, wx.TextCtrl): | 91 class PasswordWidget(EventWidget, ValueWidget, xmlui.PasswordWidget, wx.TextCtrl): |
91 _xmlui_change_event = wx.EVT_TEXT | 92 _xmlui_change_event = wx.EVT_TEXT |
92 | 93 |
93 def __init__(self, parent, value): | 94 def __init__(self, parent, value, read_only=False): |
94 wx.TextCtrl.__init__(self, parent, -1, value, style=wx.TE_PASSWORD) | 95 style = wx.TE_PASSWORD |
96 if read_only: | |
97 style |= wx.TE_READONLY | |
98 wx.TextCtrl.__init__(self, parent, -1, value, style=style) | |
95 self._xmlui_proportion = 1 | 99 self._xmlui_proportion = 1 |
96 | 100 |
97 | 101 |
98 class TextBoxWidget(EventWidget, ValueWidget, xmlui.TextBoxWidget, wx.TextCtrl): | 102 class TextBoxWidget(EventWidget, ValueWidget, xmlui.TextBoxWidget, wx.TextCtrl): |
99 _xmlui_change_event = wx.EVT_TEXT | 103 _xmlui_change_event = wx.EVT_TEXT |
100 | 104 |
101 def __init__(self, parent, value): | 105 def __init__(self, parent, value, read_only=False): |
102 wx.TextCtrl.__init__(self, parent, -1, value, style=wx.TE_MULTILINE) | 106 style = wx.TE_MULTILINE |
107 if read_only: | |
108 style |= wx.TE_READONLY | |
109 wx.TextCtrl.__init__(self, parent, -1, value, style=style) | |
103 self._xmlui_proportion = 1 | 110 self._xmlui_proportion = 1 |
104 | 111 |
105 | 112 |
106 class BoolWidget(EventWidget, ValueWidget, xmlui.BoolWidget, wx.CheckBox): | 113 class BoolWidget(EventWidget, ValueWidget, xmlui.BoolWidget, wx.CheckBox): |
107 _xmlui_change_event = wx.EVT_CHECKBOX | 114 _xmlui_change_event = wx.EVT_CHECKBOX |
108 | 115 |
109 def __init__(self, parent, state): | 116 def __init__(self, parent, state, read_only=False): |
117 style = wx.CHK_2STATE | |
118 if read_only: | |
119 style |= wx.TE_READONLY | |
110 wx.CheckBox.__init__(self, parent, -1, "", style=wx.CHK_2STATE) | 120 wx.CheckBox.__init__(self, parent, -1, "", style=wx.CHK_2STATE) |
111 self.SetValue(state) | 121 self.SetValue(state) |
112 self._xmlui_proportion = 1 | 122 self._xmlui_proportion = 1 |
113 | 123 |
114 def _xmluiSetValue(self, value): | 124 def _xmluiSetValue(self, value): |