X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/d14a1e28567de23c586bc80017073d0c39f8d18f..7bdfb981a826d29e292738a27700543fa10d2bfb:/wxPython/wx/lib/colourchooser/pycolourbox.py diff --git a/wxPython/wx/lib/colourchooser/pycolourbox.py b/wxPython/wx/lib/colourchooser/pycolourbox.py index 941c619a0e..a1108c7b1c 100644 --- a/wxPython/wx/lib/colourchooser/pycolourbox.py +++ b/wxPython/wx/lib/colourchooser/pycolourbox.py @@ -1,20 +1,29 @@ """ -wxPyColourChooser +PyColourChooser Copyright (C) 2002 Michael Gilfix -This file is part of wxPyColourChooser. +This file is part of PyColourChooser. -This version of wxPyColourChooser is open source; you can redistribute it +This version of PyColourChooser is open source; you can redistribute it and/or modify it under the licensed terms. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. """ +# 12/14/2003 - Jeff Grimmett (grimmtooth@softhome.net) +# +# o 2.5 compatability update. +# +# 12/21/2003 - Jeff Grimmett (grimmtooth@softhome.net) +# +# o wxPyColorChooser -> PyColorChooser +# o wxPyColourChooser -> PyColourChooser +# -from wxPython.wx import * +import wx -class PyColourBox(wxPanel): +class PyColourBox(wx.Panel): """A Colour Selection Box The Colour selection box implements button like behavior but contains @@ -24,13 +33,12 @@ class PyColourBox(wxPanel): def __init__(self, parent, id, colour=(0, 0, 0), size=(25, 20)): """Creates a new colour box instance and initializes the colour content.""" - wxPanel.__init__(self, parent, id, - size=wxSize(size[0], size[1])) + wx.Panel.__init__(self, parent, id, size=size, style=wx.NO_BORDER) - self.colour_box = wxPanel(self, -1, style=wxSIMPLE_BORDER) + self.colour_box = wx.Window(self, -1, style=wx.SIMPLE_BORDER) - sizer = wxGridSizer(1, 1) - sizer.Add(self.colour_box, 0, wxALIGN_CENTER_VERTICAL | wxALIGN_CENTER_HORIZONTAL) + sizer = wx.GridSizer(1, 1) + sizer.Add(self.colour_box, 0, wx.FIXED_MINSIZE | wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_CENTER_HORIZONTAL) sizer.SetItemMinSize(self.colour_box, size[0] - 5, size[1] - 5) self.SetAutoLayout(True) self.SetSizer(sizer) @@ -57,10 +65,10 @@ class PyColourBox(wxPanel): def SetColourTuple(self, colour): """Sets the box's current couple to the given tuple.""" self.colour = colour - self.colour_box.SetBackgroundColour(wxColour(*self.colour)) + self.colour_box.SetBackgroundColour(wx.Colour(*self.colour)) def Update(self): - wxPanel.Update(self) + wx.Panel.Update(self) self.colour_box.Update() def SetHighlight(self, val): @@ -72,7 +80,7 @@ class PyColourBox(wxPanel): red =(self.real_bg.Red() - 45) % 255 green =(self.real_bg.Green() - 45) % 255 blue =(self.real_bg.Blue() - 45) % 255 - new_colour = wxColour(red, green, blue) + new_colour = wx.Colour(red, green, blue) self.SetBackgroundColour(new_colour) else: self.SetBackgroundColour(self.real_bg)