Updates to contributed library stuff, a new version of PyCrust
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11602 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
#
|
||||
# Author: Lorne White, Lorne.White@telusplanet.net
|
||||
#
|
||||
# Created: Feb 25, 2001
|
||||
# Created: Sept 4, 2001
|
||||
# Licence: wxWindows license
|
||||
#----------------------------------------------------------------------------
|
||||
|
||||
@@ -16,25 +16,40 @@ from wxPython.wx import *
|
||||
# button colour will change to new colour
|
||||
# GetColour method to get the selected colour
|
||||
|
||||
# Updates:
|
||||
# call back to function if changes made
|
||||
|
||||
class ColourSelect(wxButton):
|
||||
def __init__(self, parent, position = wxPoint(20, 20), bcolour = [0, 0, 0], size = wxSize(20, 20)):
|
||||
def __init__(self, parent, position = wxPoint(20, 20), bcolour = [0, 0, 0], size = wxSize(20, 20), callback = None):
|
||||
self.win = parent
|
||||
self.callback = callback
|
||||
|
||||
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
|
||||
self.SetColourValue(bcolour)
|
||||
|
||||
def SetColour(self, bcolour):
|
||||
self.b.SetBackgroundColour(bcolour)
|
||||
|
||||
def SetColourValue(self, bcolour):
|
||||
self.set_colour_val = wxColor(bcolour[0], bcolour[1], bcolour[2])
|
||||
self.set_colour = bcolour
|
||||
|
||||
self.b.SetBackgroundColour(self.set_colour_val)
|
||||
self.b.SetForegroundColour(wxWHITE)
|
||||
|
||||
def SetValue(self, bcolour):
|
||||
self.SetColourValue(bcolour)
|
||||
|
||||
def GetColour(self):
|
||||
return self.set_colour
|
||||
|
||||
def OnChange(self):
|
||||
if self.callback != None:
|
||||
self.callback()
|
||||
|
||||
def OnClick(self, event):
|
||||
data = wxColourData()
|
||||
data.SetChooseFull(true)
|
||||
@@ -45,6 +60,7 @@ class ColourSelect(wxButton):
|
||||
self.set_colour = set = data.GetColour().Get()
|
||||
self.set_colour_val = bcolour = wxColour(set[0],set[1],set[2])
|
||||
self.b.SetBackgroundColour(bcolour)
|
||||
self.OnChange()
|
||||
dlg.Destroy()
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user