Yet another update of XRCed. Fixes some display issues and some minor
buglets. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@14494 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -144,7 +144,7 @@ class ParamColour(PPanel):
|
||||
self.ID_BUTTON = wxNewId()
|
||||
self.SetBackgroundColour(panel.GetBackgroundColour())
|
||||
sizer = wxBoxSizer()
|
||||
self.text = wxTextCtrl(self, self.ID_TEXT_CTRL, size=buttonSize)
|
||||
self.text = wxTextCtrl(self, self.ID_TEXT_CTRL, size=(65,-1))
|
||||
sizer.Add(self.text, 0, wxRIGHT, 5)
|
||||
self.button = wxPanel(self, self.ID_BUTTON, wxDefaultPosition, wxSize(40, -1))
|
||||
sizer.Add(self.button, 0, wxGROW)
|
||||
@@ -156,11 +156,10 @@ class ParamColour(PPanel):
|
||||
EVT_TEXT(self, self.ID_TEXT_CTRL, self.OnChange)
|
||||
EVT_LEFT_DOWN(self.button, self.OnLeftDown)
|
||||
def GetValue(self):
|
||||
return self.value
|
||||
return self.text.GetValue()
|
||||
def SetValue(self, value):
|
||||
self.freeze = true
|
||||
if not value: value = '#FFFFFF'
|
||||
self.value = value
|
||||
self.text.SetValue(str(value)) # update text ctrl
|
||||
colour = wxColour(int(value[1:3], 16), int(value[3:5], 16), int(value[5:7], 16))
|
||||
self.button.SetBackgroundColour(colour)
|
||||
@@ -169,7 +168,6 @@ class ParamColour(PPanel):
|
||||
def OnChange(self, evt):
|
||||
if self.freeze: return
|
||||
self.SetModified()
|
||||
self.textModified = true
|
||||
evt.Skip()
|
||||
def OnPaintButton(self, evt):
|
||||
dc = wxPaintDC(self.button)
|
||||
@@ -179,11 +177,12 @@ class ParamColour(PPanel):
|
||||
size = self.button.GetSize()
|
||||
dc.DrawRectangle(0, 0, size.x, size.y)
|
||||
def OnLeftDown(self, evt):
|
||||
dlg = wxColourDialog(self)
|
||||
data = wxColourData()
|
||||
data.SetColour(self.GetValue())
|
||||
dlg = wxColourDialog(self, data)
|
||||
if dlg.ShowModal() == wxID_OK:
|
||||
self.SetValue('#%02X%02X%02X' % dlg.GetColourData().GetColour().Get())
|
||||
self.SetModified()
|
||||
self.textModified = false
|
||||
dlg.Destroy()
|
||||
|
||||
################################################################################
|
||||
|
Reference in New Issue
Block a user