'wxWS_EX_PROCESS_UI_UPDATES'
]
-buttonSize = (35,-1) # in dialog units, transformed to pixels in panel ctor
+# Global var initialized in Panel.__init__ for button size in screen pixels
+buttonSize = None
+# Button size in dialog units
+buttonSizeD = (35,-1)
# Class that can properly disable children
class PPanel(wx.Panel):
wx.Panel.__init__(self, parent, -1, name=name)
self.modified = self.freeze = False
def Enable(self, value):
+ self.enabled = value
# Something strange is going on with enable so we make sure...
for w in self.GetChildren():
w.Enable(value)
sizer.Add(self.text, 0, wx.RIGHT | wx.ALIGN_CENTER_VERTICAL, 5)
self.button = wx.Button(self, self.ID_BUTTON_CHOICES, 'Edit...', size=buttonSize)
sizer.Add(self.button, 0, wx.ALIGN_CENTER_VERTICAL)
- self.SetAutoLayout(True)
- self.SetSizerAndFit(sizer)
+ self.SetSizer(sizer)
wx.EVT_BUTTON(self, self.ID_BUTTON_CHOICES, self.OnButtonChoices)
wx.EVT_TEXT(self, self.ID_TEXT_CTRL, self.OnChange)
def GetValue(self):
sizer.Add(self.text, 0, wx.ALIGN_CENTER_VERTICAL | wx.TOP | wx.BOTTOM, 2)
self.button = wx.Panel(self, self.ID_BUTTON, wx.DefaultPosition, wx.Size(20, 20))
sizer.Add(self.button, 0, wx.ALIGN_CENTER_VERTICAL | wx.LEFT, 5)
- self.SetAutoLayout(True)
- self.SetSizerAndFit(sizer)
+ self.SetSizer(sizer)
self.textModified = False
wx.EVT_PAINT(self.button, self.OnPaintButton)
wx.EVT_TEXT(self, self.ID_TEXT_CTRL, self.OnChange)
sizer.Add(self.text, 0, wx.RIGHT | wx.ALIGN_CENTER_VERTICAL, 5)
self.button = wx.Button(self, self.ID_BUTTON_SELECT, 'Select...', size=buttonSize)
sizer.Add(self.button, 0, wx.ALIGN_CENTER_VERTICAL)
- self.SetAutoLayout(True)
- self.SetSizerAndFit(sizer)
+ self.SetSizer(sizer)
self.textModified = False
wx.EVT_BUTTON(self, self.ID_BUTTON_SELECT, self.OnButtonSelect)
wx.EVT_TEXT(self, self.ID_TEXT_CTRL, self.OnChange)
self.spin = wx.SpinCtrl(self, self.ID_SPIN_CTRL, size=(60,-1))
self.spin.SetRange(-2147483648, 2147483647) # min/max integers
sizer.Add(self.spin)
- self.SetAutoLayout(True)
- self.SetSizerAndFit(sizer)
+ self.SetSizer(sizer)
wx.EVT_SPINCTRL(self, self.ID_SPIN_CTRL, self.OnChange)
def GetValue(self):
return str(self.spin.GetValue())
self.spin = wx.SpinCtrl(self, self.ID_SPIN_CTRL, size=(60,-1))
self.spin.SetRange(0, 10000) # min/max integers
sizer.Add(self.spin)
- self.SetAutoLayout(True)
- self.SetSizerAndFit(sizer)
+ self.SetSizer(sizer)
wx.EVT_SPINCTRL(self, self.ID_SPIN_CTRL, self.OnChange)
def GetValue(self):
return str(self.spin.GetValue())
self.ID_TEXT_CTRL = wx.NewId()
self.ID_SPIN_BUTTON = wx.NewId()
sizer = wx.BoxSizer(wx.HORIZONTAL)
- self.spin = wx.SpinButton(self, self.ID_SPIN_BUTTON, style = wx.SP_VERTICAL)
+ self.spin = wx.SpinButton(self, self.ID_SPIN_BUTTON, style = wx.SP_VERTICAL, size=(-1,0))
textW = 60 - self.spin.GetSize()[0]
self.text = wx.TextCtrl(self, self.ID_TEXT_CTRL, size=(textW,-1))
self.spin.SetRange(-10000, 10000)
sizer.Add(self.text, 0, wx.EXPAND)
sizer.Add(self.spin, 0, wx.EXPAND)
- self.SetAutoLayout(True)
- self.SetSizerAndFit(sizer)
+ self.SetSizer(sizer)
self.spin.Bind(wx.EVT_SPIN_UP, self.OnSpinUp)
self.spin.Bind(wx.EVT_SPIN_DOWN, self.OnSpinDown)
def GetValue(self):
sizer.Add(self.text, 0, wx.RIGHT | wx.ALIGN_CENTER_VERTICAL, 5)
self.button = wx.Button(self, self.ID_BUTTON_EDIT, 'Edit...', size=buttonSize)
sizer.Add(self.button, 0, wx.ALIGN_CENTER_VERTICAL)
- self.SetAutoLayout(True)
self.SetSizerAndFit(sizer)
wx.EVT_BUTTON(self, self.ID_BUTTON_EDIT, self.OnButtonEdit)
wx.EVT_TEXT(self, self.ID_TEXT_CTRL, self.OnChange)
dlg.Destroy()
class ParamText(PPanel):
- def __init__(self, parent, name, textWidth=-1):
+ def __init__(self, parent, name, textWidth=-1, style=0):
PPanel.__init__(self, parent, name)
self.ID_TEXT_CTRL = wx.NewId()
# We use sizer even here to have the same size of text control
sizer = wx.BoxSizer()
- self.text = wx.TextCtrl(self, self.ID_TEXT_CTRL, size=wx.Size(textWidth,-1))
+ self.text = wx.TextCtrl(self, self.ID_TEXT_CTRL, size=wx.Size(textWidth,-1), style=style)
if textWidth == -1: option = 1
else: option = 0
sizer.Add(self.text, option, wx.ALIGN_CENTER_VERTICAL | wx.TOP | wx.BOTTOM, 2)
- self.SetAutoLayout(True)
- self.SetSizerAndFit(sizer)
+ self.SetSizer(sizer)
wx.EVT_TEXT(self, self.ID_TEXT_CTRL, self.OnChange)
def GetValue(self):
return self.text.GetValue()
def __init__(self, parent, name):
ParamText.__init__(self, parent, name, 100)
+class ParamComment(ParamText):
+ def __init__(self, parent, name):
+ ParamText.__init__(self, parent, name, 330 + buttonSize[0],
+ style=wx.TE_PROCESS_ENTER)
+
class ContentDialog(wx.Dialog):
def __init__(self, parent, value):
# Load from resource
sizer.Add(self.text, 0, wx.RIGHT | wx.ALIGN_CENTER_VERTICAL, 5)
self.button = wx.Button(self, self.ID_BUTTON_EDIT, 'Edit...', size=buttonSize)
sizer.Add(self.button, 0, wx.ALIGN_CENTER_VERTICAL)
- self.SetAutoLayout(True)
- self.SetSizerAndFit(sizer)
+ self.SetSizer(sizer)
self.textModified = False
wx.EVT_BUTTON(self, self.ID_BUTTON_EDIT, self.OnButtonEdit)
wx.EVT_TEXT(self, self.ID_TEXT_CTRL, self.OnChange)
button = wx.RadioButton(self, -1, i, size=(-1,buttonSize[1]), name=i)
topSizer.Add(button, 0, wx.RIGHT, 5)
wx.EVT_RADIOBUTTON(self, button.GetId(), self.OnRadioChoice)
- self.SetAutoLayout(True)
- self.SetSizerAndFit(topSizer)
+ self.SetSizer(topSizer)
def SetStringSelection(self, value):
self.freeze = True
for i in self.choices:
sizer.Add(self.text, 0, wx.RIGHT | wx.ALIGN_CENTER_VERTICAL, 5)
self.button = wx.Button(self, self.ID_BUTTON_BROWSE, 'Browse...',size=buttonSize)
sizer.Add(self.button, 0, wx.ALIGN_CENTER_VERTICAL)
- self.SetAutoLayout(True)
- self.SetSizerAndFit(sizer)
+ self.SetSizer(sizer)
self.textModified = False
wx.EVT_BUTTON(self, self.ID_BUTTON_BROWSE, self.OnButtonBrowse)
wx.EVT_TEXT(self, self.ID_TEXT_CTRL, self.OnChange)
'fg': ParamColour, 'bg': ParamColour, 'font': ParamFont,
'enabled': ParamBool, 'focused': ParamBool, 'hidden': ParamBool,
'tooltip': ParamText, 'bitmap': ParamBitmap, 'icon': ParamBitmap,
- 'encoding': ParamEncoding, 'borders': ParamUnit
+ 'encoding': ParamEncoding, 'borders': ParamUnit,
+ 'comment': ParamComment
}