frontends (XMLUI): implementation of read_only attributes for widgets String, TextBox, Password and Bool
This commit is contained in:
parent
2cc6d6549f
commit
e002d55880
1 changed files with 60 additions and 16 deletions
|
|
@ -82,31 +82,41 @@ class DividerWidget(WixWidget, xmlui.DividerWidget, wx.StaticLine):
|
|||
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
|
||||
|
|
|
|||
Loading…
Reference in a new issue