Added ability to use xml resource files. Still need to add ability to
subclass wxXmlResourceHandler, etc... Added wxGridAutoEditMixin to the mixins library package. Made ColourSelect be derived from wxButton. Fixed a few bugs here and there, added some missing methods, etc. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@10588 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -16,40 +16,31 @@ from wxPython.wx import *
|
||||
# button colour will change to new colour
|
||||
# GetColour method to get the selected colour
|
||||
|
||||
class ColourSelect:
|
||||
def __init__(self, parent, position = wxPoint(20, 20), bcolour = [0, 0, 0], size = wxSize(20, 20)):
|
||||
self.win = parent
|
||||
if size is None:
|
||||
size = wxSize(20, 20)
|
||||
class ColourSelect(wxButton):
|
||||
def __init__(self, parent, id, bcolour=(0, 0, 0), pos=wxDefaultPosition, size=wxDefaultSize):
|
||||
wxButton.__init__(self, parent, id, "", pos=pos, size=size)
|
||||
EVT_BUTTON(parent, self.GetId(), self.OnClick)
|
||||
self.SetForegroundColour(wxWHITE)
|
||||
self.SetColour(bcolour)
|
||||
|
||||
mID = NewId()
|
||||
self.b = b = wxButton(parent, mID, "", position, size)
|
||||
EVT_BUTTON(parent, mID, self.OnClick)
|
||||
|
||||
self.set_colour_val = set_colour = wxColor(bcolour[0], bcolour[1], bcolour[2])
|
||||
b.SetBackgroundColour(set_colour)
|
||||
b.SetForegroundColour(wxWHITE)
|
||||
self.set_colour = bcolour
|
||||
|
||||
def SetColour(self, bcolour):
|
||||
self.b.SetBackgroundColour(bcolour)
|
||||
self.set_colour_val = set_colour = wxColor(bcolour[0], bcolour[1], bcolour[2])
|
||||
self.SetBackgroundColour(set_colour)
|
||||
self.set_colour = bcolour
|
||||
|
||||
|
||||
def GetColour(self):
|
||||
return self.set_colour
|
||||
|
||||
|
||||
def OnClick(self, event):
|
||||
data = wxColourData()
|
||||
data.SetChooseFull(true)
|
||||
data.SetColour(self.set_colour_val)
|
||||
dlg = wxColourDialog(self.win, data)
|
||||
dlg = wxColourDialog(self.GetParent(), data)
|
||||
if dlg.ShowModal() == wxID_OK:
|
||||
data = dlg.GetColourData()
|
||||
self.set_colour = set = data.GetColour().Get()
|
||||
self.set_colour_val = bcolour = wxColour(set[0],set[1],set[2])
|
||||
self.b.SetBackgroundColour(bcolour)
|
||||
self.SetColour(data.GetColour().Get())
|
||||
dlg.Destroy()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user