Mercurial > libervia-backend
diff 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 |
line wrap: on
line diff
--- a/frontends/src/wix/xmlui.py Wed Jun 25 14:01:55 2014 +0200 +++ b/frontends/src/wix/xmlui.py Wed Jun 25 14:01:56 2014 +0200 @@ -82,31 +82,41 @@ class StringWidget(EventWidget, ValueWidget, xmlui.StringWidget, wx.TextCtrl): _xmlui_change_event = wx.EVT_TEXT - def __init__(self, parent, value): - wx.TextCtrl.__init__(self, parent, -1, value) + def __init__(self, parent, value, read_only=False): + style = wx.TE_READONLY if read_only else 0 + wx.TextCtrl.__init__(self, parent, -1, value, style=style) self._xmlui_proportion = 1 class PasswordWidget(EventWidget, ValueWidget, xmlui.PasswordWidget, wx.TextCtrl): _xmlui_change_event = wx.EVT_TEXT - def __init__(self, parent, value): - wx.TextCtrl.__init__(self, parent, -1, value, style=wx.TE_PASSWORD) + def __init__(self, parent, value, read_only=False): + style = wx.TE_PASSWORD + if read_only: + style |= wx.TE_READONLY + wx.TextCtrl.__init__(self, parent, -1, value, style=style) self._xmlui_proportion = 1 class TextBoxWidget(EventWidget, ValueWidget, xmlui.TextBoxWidget, wx.TextCtrl): _xmlui_change_event = wx.EVT_TEXT - def __init__(self, parent, value): - wx.TextCtrl.__init__(self, parent, -1, value, style=wx.TE_MULTILINE) + def __init__(self, parent, value, read_only=False): + style = wx.TE_MULTILINE + if read_only: + style |= wx.TE_READONLY + wx.TextCtrl.__init__(self, parent, -1, value, style=style) self._xmlui_proportion = 1 class BoolWidget(EventWidget, ValueWidget, xmlui.BoolWidget, wx.CheckBox): _xmlui_change_event = wx.EVT_CHECKBOX - def __init__(self, parent, state): + def __init__(self, parent, state, read_only=False): + style = wx.CHK_2STATE + if read_only: + style |= wx.TE_READONLY wx.CheckBox.__init__(self, parent, -1, "", style=wx.CHK_2STATE) self.SetValue(state) self._xmlui_proportion = 1