fixed leaking wxColour
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11944 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -26,18 +26,12 @@ class ColourSelect(wxButton):
|
|||||||
EVT_BUTTON(self, ID, self.OnClick)
|
EVT_BUTTON(self, ID, self.OnClick)
|
||||||
self.SetColourValue(bcolour)
|
self.SetColourValue(bcolour)
|
||||||
|
|
||||||
def __del__(self):
|
|
||||||
if hasattr(self, "set_colour_val"):
|
|
||||||
del self.set_colour_val
|
|
||||||
|
|
||||||
def SetColour(self, bcolour):
|
def SetColour(self, bcolour):
|
||||||
self.SetBackgroundColour(bcolour)
|
self.SetBackgroundColour(bcolour)
|
||||||
|
|
||||||
def SetColourValue(self, bcolour):
|
def SetColourValue(self, bcolour):
|
||||||
self.set_colour_val = wxColour(bcolour[0], bcolour[1], bcolour[2])
|
|
||||||
self.set_colour = bcolour
|
self.set_colour = bcolour
|
||||||
|
self.SetBackgroundColour(self.Get_wxColour())
|
||||||
self.SetBackgroundColour(self.set_colour_val)
|
|
||||||
self.SetForegroundColour(wxWHITE)
|
self.SetForegroundColour(wxWHITE)
|
||||||
|
|
||||||
def SetValue(self, bcolour):
|
def SetValue(self, bcolour):
|
||||||
@@ -46,6 +40,9 @@ class ColourSelect(wxButton):
|
|||||||
def GetColour(self):
|
def GetColour(self):
|
||||||
return self.set_colour
|
return self.set_colour
|
||||||
|
|
||||||
|
def Get_wxColour(self):
|
||||||
|
return wxColour(self.set_colour[0], self.set_colour[1], self.set_colour[2])
|
||||||
|
|
||||||
def OnChange(self):
|
def OnChange(self):
|
||||||
if self.callback != None:
|
if self.callback != None:
|
||||||
self.callback()
|
self.callback()
|
||||||
@@ -53,13 +50,12 @@ class ColourSelect(wxButton):
|
|||||||
def OnClick(self, event):
|
def OnClick(self, event):
|
||||||
data = wxColourData()
|
data = wxColourData()
|
||||||
data.SetChooseFull(true)
|
data.SetChooseFull(true)
|
||||||
data.SetColour(self.set_colour_val)
|
data.SetColour(self.Get_wxColour())
|
||||||
dlg = wxColourDialog(self.win, data)
|
dlg = wxColourDialog(self.win, data)
|
||||||
if dlg.ShowModal() == wxID_OK:
|
if dlg.ShowModal() == wxID_OK:
|
||||||
data = dlg.GetColourData()
|
data = dlg.GetColourData()
|
||||||
self.set_colour = set = data.GetColour().Get()
|
self.set_colour = set = data.GetColour().Get()
|
||||||
self.set_colour_val = bcolour = wxColour(set[0],set[1],set[2])
|
self.SetBackgroundColour(self.Get_wxColour())
|
||||||
self.SetBackgroundColour(bcolour)
|
|
||||||
self.OnChange()
|
self.OnChange()
|
||||||
dlg.Destroy()
|
dlg.Destroy()
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user