Poodletooth-iLand/panda/python/Lib/site-packages/wx/lib/agw/shapedbutton.py
2015-03-06 06:11:40 -06:00

1809 lines
68 KiB
Python

# --------------------------------------------------------------------------- #
# SHAPEDBUTTON Control wxPython IMPLEMENTATION
# Python Code By:
#
# Andrea Gavana, @ 18 Oct 2005
# Latest Revision: 16 Jul 2012, 15.00 GMT
#
#
# TODO List/Caveats
#
# 1. Elliptic Buttons May Be Handled Better, In My Opinion. They Look Nice
# But They Are Somewhat More Difficult To Handle When Using Sizers.
# This Is Probably Due To Some Lack In My Implementation;
#
# 2. I Am Unable To Translate The 2 Files "UpButton.png" And "DownButton.png"
# Using "img2py" (Under wx.tools) Or With PIL In Order To Embed Them In
# A Python File. Every Translation I Made, Did Not Preserve The Alpha
# Channel So I Ended Up With Round Buttons Inside Black Squares. Does
# Anyone Have A Suggestion Here?
#
# 3. Creating *A Lot* Of ShapedButtons May Require Some Time. In The Demo,
# I Create 23 Buttons In About 0.4 Seconds On Windows XP, 3 GHz 1 GB RAM.
#
# 4. Creating Buttons With Size Greater Than wx.Size(200, 200) May Display
# Buttons With Clearly Evident Pixel Edges. This Is Due To The Size Of The
# Image Files I Load During Initialization. If This Is Not Satisfactory,
# Please Let Me Know And I Will Upload Bigger Files.
#
# For All Kind Of Problems, Requests Of Enhancements And Bug Reports, Please
# Write To Me At:
#
# andrea.gavana@gmail.com
# andrea.gavana@maerskoil.com
#
# Or, Obviously, To The wxPython Mailing List!!!
#
# Tags: phoenix-port, unittest, documented, py3-port
#
# End Of Comments
# --------------------------------------------------------------------------- #
"""
`ShapedButton` tries to fill the lack of "custom shaped" controls in wxPython
and it can be used to build round or elliptic-shaped buttons.
Description
===========
`ShapedButton` tries to fill the lack of "custom shaped" controls in wxPython
(that depends on the same lack in wxWidgets). It can be used to build round
buttons or elliptic buttons.
I have stolen some code from :mod:`lib.buttons` in order to recreate the same
classes (`GenButton`, `GenBitmapButton`, `GenBitmapTextButton`, `GenToggleButton`,
`GenBitmapToggleButton`, `GenBitmapTextToggleButton`). Here you have the same
classes (with "Gen" replaced by "S"), with the same event handling, but they
are rounded/elliptical buttons.
`ShapedButton` is based on a :class:`Window`, in which 2 images are drawn depending
on the button state (pressed or not pressed). The 2 images have been stolen
from Audacity (written with wxWidgets) and rearranged/reshaped/restyled
using adobe PhotoShop.
Changing the button colour in runtime was more difficult, but using some
intelligent instruction from the PIL library it can be done.
`ShapedButton` reacts on mouse events *only* if the mouse event occurred inside
the circle/ellipse, even if `ShapedButton` is built on a rectangular window.
This behavior is a lot different with respect to Audacity round buttons.
Usage
=====
Usage example::
import wx
import wx.lib.agw.shapedbutton as SB
class MyFrame(wx.Frame):
def __init__(self, parent):
wx.Frame.__init__(self, parent, -1, "ShapedButton Demo")
panel = wx.Panel(self)
# Create 2 bitmaps for the button
upbmp = wx.Bitmap("play.png", wx.BITMAP_TYPE_PNG)
disbmp = wx.Bitmap("playdisabled.png", wx.BITMAP_TYPE_PNG)
play = SB.SBitmapToggleButton(panel, -1, upbmp, (100, 50))
play.SetUseFocusIndicator(False)
play.SetBitmapDisabled(disbmp)
# our normal wxApp-derived class, as usual
app = wx.App(0)
frame = MyFrame(None)
app.SetTopWindow(frame)
frame.Show()
app.MainLoop()
The `ShapedButton` construction and usage is quite similar to the :mod:`lib.buttons`
implementation.
Methods and Settings
====================
With `ShapedButton` you can:
- Create rounded/elliptical buttons/togglebuttons;
- Set images for the enabled/disabled/focused/selected state of the button;
- Draw the focus indicator (or disable it);
- Set label colour and font;
- Apply a rotation to the `ShapedButton` label;
- Change `ShapedButton` shape and text orientation in runtime.
:note: `ShapedButton` **requires** PIL (Python Imaging Library) library to be installed,
which can be downloaded from http://www.pythonware.com/products/pil/ .
Window Styles
=============
`No particular window styles are available for this class.`
Events Processing
=================
This class processes the following events:
================= ==================================================
Event Name Description
================= ==================================================
``wx.EVT_BUTTON`` Process a `wxEVT_COMMAND_BUTTON_CLICKED` event, when the button is clicked.
================= ==================================================
License And Version
===================
`ShapedButton` is distributed under the wxPython license.
Latest revision: Andrea Gavana @ 16 Jul 2012, 15.00 GMT
Version 0.5
"""
#----------------------------------------------------------------------
# Beginning Of SHAPEDBUTTON wxPython Code
#----------------------------------------------------------------------
import wx
# First Check If PIL Is Installed Properly
try:
import PIL.Image as Image
except ImportError:
errstr = ("\nShapedButton *Requires* PIL (Python Imaging Library).\n"
"You Can Get It At:\n\n"
"http://www.pythonware.com/products/pil/\n\n"
"ShapedButton Can Not Continue. Exiting...\n")
raise Exception(errstr)
import os
folder = os.path.split(__file__)[0]
# Import Some Stuff For The Annoying Ellipsis... ;-)
from math import sin, cos, pi
#-----------------------------------------------------------------------------
# PATH & FILE FILLING FUNCTION (OS INDEPENDENT)
# This Is Required To Load The Pressed And Non-Pressed Images From The
# "images" Directory.
#-----------------------------------------------------------------------------
def opj(path):
"""
Convert paths to the platform-specific separator.
:param `path`: the path to convert.
"""
strs = os.path.join(*tuple(path.split('/')))
# HACK: on Linux, a leading / gets lost...
if path.startswith('/'):
strs = '/' + strs
return strs
#-----------------------------------------------------------------------------
#----------------------------------------------------------------------
# Class SButtonEvent
# Code Stolen From wx.lib.buttons. This Class Handles All The Button
# And ToggleButton Events.
#----------------------------------------------------------------------
class SButtonEvent(wx.CommandEvent):
""" Event sent from the generic buttons when the button is activated. """
def __init__(self, eventType, eventId):
"""
Default class constructor.
:param `eventType`: the event type;
:param `eventId`: the event identifier.
"""
wx.CommandEvent.__init__(self, eventType, eventId)
self.isDown = False
self.theButton = None
def SetIsDown(self, isDown):
"""
Sets the button event as pressed.
:param `isDown`: ``True`` to set the event as "pressed", ``False`` otherwise.
"""
self.isDown = isDown
def GetIsDown(self):
""" Returns ``True`` if the button event is "pressed". """
return self.isDown
def SetButtonObj(self, btn):
"""
Sets the event object for the event.
:param `btn`: the button object.
"""
self.theButton = btn
def GetButtonObj(self):
""" Returns the object associated with this event. """
return self.theButton
#----------------------------------------------------------------------
# SBUTTON Class
# This Is The Main Class Implementation. See __init__() Method For
# Details. All The Other Button Types Depend On This Class For Event
# Handling And Property Settings.
#----------------------------------------------------------------------
class SButton(wx.Window):
""" This is the main implementation of `ShapedButton`. """
_labeldelta = 1
def __init__(self, parent, id=wx.ID_ANY, label="", pos=wx.DefaultPosition,
size=wx.DefaultSize):
"""
Default class constructor.
:param `parent`: the :class:`SButton` parent. Must not be ``None``;
:param `id`: window identifier. A value of -1 indicates a default value;
:param `label`: the button text label;
:param `pos`: the control position. A value of (-1, -1) indicates a default position,
chosen by either the windowing system or wxPython, depending on platform;
:param `size`: the control size. A value of (-1, -1) indicates a default size,
chosen by either the windowing system or wxPython, depending on platform.
"""
wx.Window.__init__(self, parent, id, pos, size)
if label is None:
label = ""
self._enabled = True
self._isup = True
self._hasfocus = False
self._usefocusind = True
# Initialize Button Properties
self.SetButtonColour()
self.SetLabel(label)
self.SetLabelColour()
self.InitColours()
self.SetAngleOfRotation()
self.SetEllipseAxis()
if size == wx.DefaultSize:
self.SetInitialSize(self.DoGetBestSize())
# Event Binding
self.Bind(wx.EVT_LEFT_DOWN, self.OnLeftDown)
self.Bind(wx.EVT_LEFT_UP, self.OnLeftUp)
if wx.Platform == '__WXMSW__':
self.Bind(wx.EVT_LEFT_DCLICK, self.OnLeftDown)
self.Bind(wx.EVT_MOTION, self.OnMotion)
self.Bind(wx.EVT_SET_FOCUS, self.OnGainFocus)
self.Bind(wx.EVT_KILL_FOCUS, self.OnLoseFocus)
self.Bind(wx.EVT_KEY_DOWN, self.OnKeyDown)
self.Bind(wx.EVT_KEY_UP, self.OnKeyUp)
self.Bind(wx.EVT_SIZE, self.OnSize)
self.Bind(wx.EVT_ERASE_BACKGROUND, lambda x: None)
self.Bind(wx.EVT_PAINT, self.OnPaint)
def SetButtonColour(self, colour=None):
"""
Sets the button colour, for all button states.
:param `colour`: an instance of :class:`Colour`.
:note: The original button images are greyscale with a lot of pixels with
different colours. Changing smoothly the button colour in order to
give the same 3D effect can be efficiently done only with PIL.
"""
if colour is None:
colour = wx.WHITE
palette = colour.Red(), colour.Green(), colour.Blue()
self._buttoncolour = colour
self._mainbuttondown = DownButton.GetImage()
self._mainbuttonup = UpButton.GetImage()
def GetButtonColour(self):
""" Returns the button colour. """
return self._buttoncolour
def SetLabelColour(self, colour=None):
"""
Sets the button label colour.
:param `colour`: an instance of :class:`Colour`.
"""
if colour is None:
colour = wx.BLACK
self._labelcolour = colour
def GetLabelColour(self):
""" Returns the button label colour. """
return self._labelcolour
def SetLabel(self, label=None):
"""
Sets the button label.
:param `label`: the new button label.
"""
if label is None:
label = ""
self._buttonlabel = label
def GetLabel(self):
""" Returns the button label. """
return self._buttonlabel
def SetBestSize(self, size=None):
"""
Given the current font settings, calculate and set a good size.
:param `size`: if not ``None``, an instance of :class:`Size` to pass to
`SetInitialSize`.
"""
if size is None:
size = wx.DefaultSize
self.SetInitialSize(size)
def DoGetBestSize(self):
"""
Overridden base class virtual. Determines the best size of the button
based on the label size.
:note: Overridden from :class:`Window`.
"""
w, h, usemin = self._GetLabelSize()
defsize = wx.Button.GetDefaultSize()
width = 12 + w
if usemin and width < defsize.width:
width = defsize.width
height = 11 + h
if usemin and height < defsize.height:
height = defsize.height
return (width, height)
def AcceptsFocus(self):
"""
Can this window be given focus by mouse click?
:note: Overridden from :class:`Window`.
"""
return self.IsShown() and self.IsEnabled()
def ShouldInheritColours(self):
"""
Overridden base class virtual. Buttons usually do not inherit
parent's colours.
"""
return False
def Enable(self, enable=True):
"""
Enables/disables the button.
:param `enable`: ``True`` to enable the button, ``False`` to disable it.
:note: Overridden from :class:`Window`.
"""
self._enabled = enable
self.Refresh()
def IsEnabled(self):
""" Returns wheter the button is enabled or not. """
return self._enabled
def SetUseFocusIndicator(self, flag):
"""
Specifies if a focus indicator (dotted line) should be used.
:param `flag`: ``True`` to use the focus indicator, ``False`` otherwise.
"""
self._usefocusind = flag
def GetUseFocusIndicator(self):
""" Returns focus indicator flag. """
return self._usefocusind
def InitColours(self):
"""
Calculates a new set of focus indicator colour and indicator pen
based on button colour and label colour.
"""
textclr = self.GetLabelColour()
faceclr = self.GetButtonColour()
r, g, b, a = faceclr.Get()
hr, hg, hb = min(255,r+64), min(255,g+64), min(255,b+64)
self._focusclr = wx.Colour(hr, hg, hb)
if wx.Platform == "__WXMAC__":
self._focusindpen = wx.Pen(textclr, 1)
else:
self._focusindpen = wx.Pen(textclr, 1, wx.USER_DASH)
self._focusindpen.SetDashes([1,1])
self._focusindpen.SetCap(wx.CAP_BUTT)
def SetDefault(self):
""" Sets the button as default item. """
self.GetParent().SetDefaultItem(self)
def _GetLabelSize(self):
""" Used internally """
w, h = self.GetTextExtent(self.GetLabel())
return w, h, True
def Notify(self):
""" Notifies an event and let it be processed. """
evt = SButtonEvent(wx.wxEVT_COMMAND_BUTTON_CLICKED, self.GetId())
evt.SetIsDown(not self._isup)
evt.SetButtonObj(self)
evt.SetEventObject(self)
self.GetEventHandler().ProcessEvent(evt)
def DrawMainButton(self, dc, width, height):
"""
Draws the main button, in whichever state it is.
:param `dc`: an instance of :class:`DC`;
:param `width`: the button width;
:param `height`: the button height.
"""
w = min(width, height)
if w <= 2:
return
position = self.GetPosition()
main, secondary = self.GetEllipseAxis()
xc = width/2.0
yc = height/2.0
if abs(main - secondary) < 1e-6:
# In This Case The Button Is A Circle
if self._isup:
img = self._mainbuttonup.Scale(w, w)
else:
img = self._mainbuttondown.Scale(w, w)
else:
# In This Case The Button Is An Ellipse... Some Math To Do
rect = self.GetRect()
if main > secondary:
# This Is An Ellipse With Main Axis Aligned With X Axis
rect2 = w
rect3 = w*secondary//main
else:
# This Is An Ellipse With Main Axis Aligned With Y Axis
rect3 = w
rect2 = w*main//secondary
if self._isup:
img = self._mainbuttonup.Scale(rect2, rect3)
else:
img = self._mainbuttondown.Scale(rect2, rect3)
bmp = img.ConvertToBitmap()
if abs(main - secondary) < 1e-6:
if height > width:
xpos = 0
ypos = (height - width)//2
else:
xpos = (width - height)//2
ypos = 0
else:
if height > width:
if main > secondary:
xpos = 0
ypos = (height - rect3)//2
else:
xpos = (width - rect2)//2
ypos = (height - rect3)//2
else:
if main > secondary:
xpos = (width - rect2)//2
ypos = (height - rect3)//2
else:
xpos = (width - rect2)//2
ypos = 0
# Draw Finally The Bitmap
dc.DrawBitmap(bmp, xpos, ypos, True)
# Store Bitmap Position And Size To Draw An Elliptical Focus Indicator
self._xpos = xpos
self._ypos = ypos
self._imgx = img.GetWidth()
self._imgy = img.GetHeight()
def DrawLabel(self, dc, width, height, dw=0, dh=0):
"""
Draws the label on the button.
:param `dc`: an instance of :class:`DC`;
:param `width`: the button width;
:param `height`: the button height;
:param `dw`: width differential, to show a 3D effect;
:param `dh`: height differential, to show a 3D effect.
"""
dc.SetFont(self.GetFont())
if self.IsEnabled():
dc.SetTextForeground(self.GetLabelColour())
else:
dc.SetTextForeground(wx.SystemSettings.GetColour(wx.SYS_COLOUR_GRAYTEXT))
label = self.GetLabel()
tw, th = dc.GetTextExtent(label)
w = min(width, height)
# labeldelta Is Used To Give The Impression Of A "3D" Click
if not self._isup:
dw = dh = self._labeldelta
angle = self.GetAngleOfRotation()*pi/180.0
# Check If There Is Any Rotation Chosen By The User
if angle == 0:
dc.DrawText(label, (width-tw)//2+dw, (height-th)//2+dh)
else:
xc, yc = (width//2, height//2)
xp = xc - (tw//2)* cos(angle) - (th//2)*sin(angle)
yp = yc + (tw//2)*sin(angle) - (th//2)*cos(angle)
dc.DrawRotatedText(label, xp + dw, yp + dh , angle*180/pi)
def DrawFocusIndicator(self, dc, width, height):
"""
Draws the focus indicator. This is a circle/ellipse inside the button
drawn with a dotted-style pen, to let the user know which button has
the focus.
:param `dc`: an instance of :class:`DC`;
:param `width`: the button width;
:param `height`: the button height.
"""
self._focusindpen.SetColour(self._focusclr)
dc.SetLogicalFunction(wx.INVERT)
dc.SetPen(self._focusindpen)
dc.SetBrush(wx.TRANSPARENT_BRUSH)
main, secondary = self.GetEllipseAxis()
if abs(main - secondary) < 1e-6:
# Ah, That Is A Round Button
if height > width:
dc.DrawCircle(width//2, height//2, width//2-4)
else:
dc.DrawCircle(width//2, height//2, height//2-4)
else:
# This Is An Ellipse
if hasattr(self, "_xpos"):
dc.DrawEllipse(self._xpos + 2, self._ypos + 2, self._imgx - 4, self._imgy - 4)
dc.SetLogicalFunction(wx.COPY)
def OnSize(self, event):
"""
Handles the ``wx.EVT_SIZE`` event for :class:`SButton`.
:param `event`: a :class:`SizeEvent` event to be processed.
"""
self.Refresh()
event.Skip()
def OnPaint(self, event):
"""
Handles the ``wx.EVT_PAINT`` event for :class:`SButton`.
:param `event`: a :class:`PaintEvent` event to be processed.
"""
width, height = self.GetClientSize()
# Use A Double Buffered DC (Good Speed Up)
dc = wx.BufferedPaintDC(self)
# The DC Background *Must* Be The Same As The Parent Background Colour,
# In Order To Hide The Fact That Our "Shaped" Button Is Still Constructed
# Over A Rectangular Window
brush = wx.Brush(self.GetParent().GetBackgroundColour())
dc.SetBackground(brush)
dc.Clear()
self.DrawMainButton(dc, width, height)
self.DrawLabel(dc, width, height)
if self._hasfocus and self._usefocusind:
self.DrawFocusIndicator(dc, width, height)
def IsOutside(self, x, y):
"""
Checks if a mouse events occurred inside the circle/ellipse or not.
:param `x`: the mouse x position;
:param `y`: the mouse y position.
"""
width, height = self.GetClientSize()
diam = min(width, height)
xc, yc = (width//2, height//2)
main, secondary = self.GetEllipseAxis()
if abs(main - secondary) < 1e-6:
# This Is A Circle
if ((x - xc)**2.0 + (y - yc)**2.0) > (diam/2.0)**2.0:
return True
else:
# This Is An Ellipse
mn = max(main, secondary)
main = self._imgx/2.0
secondary = self._imgy/2.0
if (((x-xc)/main)**2.0 + ((y-yc)/secondary)**2.0) > 1:
return True
return False
def OnLeftDown(self, event):
"""
Handles the ``wx.EVT_LEFT_DOWN`` event for :class:`SButton`.
:param `event`: a :class:`MouseEvent` event to be processed.
"""
if not self.IsEnabled():
return
x, y = (event.GetX(), event.GetY())
if self.IsOutside(x,y):
return
self._isup = False
if not self.HasCapture():
self.CaptureMouse()
self.SetFocus()
self.Refresh()
event.Skip()
def OnLeftUp(self, event):
"""
Handles the ``wx.EVT_LEFT_UP`` event for :class:`SButton`.
:param `event`: a :class:`MouseEvent` event to be processed.
"""
if not self.IsEnabled() or not self.HasCapture():
return
if self.HasCapture():
self.ReleaseMouse()
if not self._isup:
self.Notify()
self._isup = True
self.Refresh()
event.Skip()
def OnMotion(self, event):
"""
Handles the ``wx.EVT_MOTION`` event for :class:`SButton`.
:param `event`: a :class:`MouseEvent` event to be processed.
"""
if not self.IsEnabled() or not self.HasCapture():
return
if event.LeftIsDown() and self.HasCapture():
x, y = event.GetPosition()
if self._isup and not self.IsOutside(x, y):
self._isup = False
self.Refresh()
return
if not self._isup and self.IsOutside(x,y):
self._isup = True
self.Refresh()
return
event.Skip()
def OnGainFocus(self, event):
"""
Handles the ``wx.EVT_SET_FOCUS`` event for :class:`SButton`.
:param `event`: a :class:`FocusEvent` event to be processed.
"""
self._hasfocus = True
dc = wx.ClientDC(self)
w, h = self.GetClientSize()
if self._usefocusind:
self.DrawFocusIndicator(dc, w, h)
def OnLoseFocus(self, event):
"""
Handles the ``wx.EVT_KILL_FOCUS`` event for :class:`SButton`.
:param `event`: a :class:`FocusEvent` event to be processed.
"""
self._hasfocus = False
dc = wx.ClientDC(self)
w, h = self.GetClientSize()
if self._usefocusind:
self.DrawFocusIndicator(dc, w, h)
self.Refresh()
def OnKeyDown(self, event):
"""
Handles the ``wx.EVT_KEY_DOWN`` event for :class:`SButton`.
:param `event`: a :class:`KeyEvent` event to be processed.
"""
if self._hasfocus and event.GetKeyCode() == ord(" "):
self._isup = False
self.Refresh()
event.Skip()
def OnKeyUp(self, event):
"""
Handles the ``wx.EVT_KEY_UP`` event for :class:`SButton`.
:param `event`: a :class:`KeyEvent` event to be processed.
"""
if self._hasfocus and event.GetKeyCode() == ord(" "):
self._isup = True
self.Notify()
self.Refresh()
event.Skip()
def MakePalette(self, tr, tg, tb):
"""
Creates a palette to be applied on an image based on input colour.
:param `tr`: the red intensity of the input colour;
:param `tg`: the green intensity of the input colour;
:param `tb`: the blue intensity of the input colour.
"""
l = []
for i in range(255):
l.extend([tr*i // 255, tg*i // 255, tb*i // 255])
return l
def ConvertWXToPIL(self, bmp):
"""
Converts a :class:`Image` into a PIL image.
:param `bmp`: an instance of :class:`Image`.
"""
width = bmp.GetWidth()
height = bmp.GetHeight()
img = Image.fromstring("RGBA", (width, height), bmp.GetData())
return img
def ConvertPILToWX(self, pil, alpha=True):
"""
Converts a PIL image into a :class:`Image`.
:param `pil`: a PIL image;
:param `alpha`: ``True`` if the image contains alpha transparency, ``False``
otherwise.
"""
if alpha:
image = wx.Image(*pil.size)
image.SetData(pil.convert("RGB").tostring())
image.SetAlpha(pil.convert("RGBA").tostring()[3::4])
else:
image = wx.Image(pil.size[0], pil.size[1])
new_image = pil.convert('RGB')
data = new_image.tostring()
image.SetData(data)
return image
def SetAngleOfRotation(self, angle=None):
"""
Sets angle of button label rotation.
:param `angle`: the label rotation, in degrees.
"""
if angle is None:
angle = 0
self._rotation = angle*pi/180
def GetAngleOfRotation(self):
""" Returns angle of button label rotation, in degrees. """
return self._rotation*180.0/pi
def SetEllipseAxis(self, main=None, secondary=None):
"""
Sets the ellipse axis. What it is important is not their absolute values
but their ratio.
:param `main`: a floating point number representing the absolute dimension
of the main ellipse axis;
:param `secondary`: a floating point number representing the absolute dimension
of the secondary ellipse axis.
"""
if main is None:
main = 1.0
secondary = 1.0
self._ellipseaxis = (main, secondary)
def GetEllipseAxis(self):
""" Returns the ellipse axes. """
return self._ellipseaxis
#----------------------------------------------------------------------
# SBITMAPBUTTON Class
# It Is Derived From SButton, And It Is A Class Useful To Draw A
# ShapedButton With An Image In The Middle. The Button Can Have 4
# Different Bitmaps Assigned To Its Different States (Pressed, Non
# Pressed, With Focus, Disabled).
#----------------------------------------------------------------------
class SBitmapButton(SButton):
"""
Subclass of :class:`SButton` which displays a bitmap, acting like a
:class:`BitmapButton`.
"""
def __init__(self, parent, id, bitmap, pos=wx.DefaultPosition, size=wx.DefaultSize):
"""
Default class constructor.
:param `parent`: the :class:`SBitmapButton` parent. Must not be ``None``;
:param `id`: window identifier. A value of -1 indicates a default value;
:param `bitmap`: the button bitmap (if any);
:param `pos`: the control position. A value of (-1, -1) indicates a default position,
chosen by either the windowing system or wxPython, depending on platform;
:param `size`: the control size. A value of (-1, -1) indicates a default size,
chosen by either the windowing system or wxPython, depending on platform.
"""
self._bmpdisabled = None
self._bmpfocus = None
self._bmpselected = None
self.SetBitmapLabel(bitmap)
SButton.__init__(self, parent, id, "", pos, size)
def GetBitmapLabel(self):
""" Returns the bitmap associated with the button in the normal state. """
return self._bmplabel
def GetBitmapDisabled(self):
""" Returns the bitmap displayed when the button is disabled. """
return self._bmpdisabled
def GetBitmapFocus(self):
""" Returns the bitmap displayed when the button has the focus. """
return self._bmpfocus
def GetBitmapSelected(self):
""" Returns the bitmap displayed when the button is selected (pressed). """
return self._bmpselected
def SetBitmapDisabled(self, bitmap):
"""
Sets the bitmap to display when the button is disabled.
:param `bitmap`: a valid :class:`Bitmap` object.
"""
self._bmpdisabled = bitmap
def SetBitmapFocus(self, bitmap):
"""
Sets the bitmap to display when the button has the focus.
:param `bitmap`: a valid :class:`Bitmap` object.
"""
self._bmpfocus = bitmap
self.SetUseFocusIndicator(False)
def SetBitmapSelected(self, bitmap):
"""
Sets the bitmap to display when the button is selected (pressed).
:param `bitmap`: a valid :class:`Bitmap` object.
"""
self._bmpselected = bitmap
def SetBitmapLabel(self, bitmap, createothers=True):
"""
Sets the bitmap to display normally. This is the only one that is
required.
:param `bitmap`: a valid :class:`Bitmap` object;
:param `createothers`: if set to ``True``, then the other bitmaps will be
generated on the fly. Currently, only the disabled bitmap is generated.
"""
self._bmplabel = bitmap
if bitmap is not None and createothers:
dis_bitmap = wx.Bitmap(bitmap.ConvertToImage().ConvertToGreyscale())
self.SetBitmapDisabled(dis_bitmap)
def _GetLabelSize(self):
""" Used internally. """
if not self._bmplabel:
return -1, -1, False
return self._bmplabel.GetWidth() + 2, self._bmplabel.GetHeight() + 2, False
def DrawLabel(self, dc, width, height, dw=0, dh=0):
"""
Draws the bitmap in the middle of the button.
:param `dc`: an instance of :class:`DC`;
:param `width`: the button width;
:param `height`: the button height;
:param `dw`: width differential, to show a 3D effect;
:param `dh`: height differential, to show a 3D effect.
"""
bmp = self._bmplabel
if self._bmpdisabled and not self.IsEnabled():
bmp = self._bmpdisabled
if self._bmpfocus and self._hasfocus:
bmp = self._bmpfocus
if self._bmpselected and not self._isup:
bmp = self._bmpselected
bw, bh = bmp.GetWidth(), bmp.GetHeight()
if not self._isup:
dw = dh = self._labeldelta
hasMask = bmp.GetMask() != None
dc.DrawBitmap(bmp, (width - bw)//2 + dw, (height - bh)//2 + dh, hasMask)
#----------------------------------------------------------------------
# SBITMAPTEXTBUTTON Class
# It Is Derived From SButton, And It Is A Class Useful To Draw A
# ShapedButton With An Image And Some Text Ceneterd In The Middle.
# The Button Can Have 4 Different Bitmaps Assigned To Its Different
# States (Pressed, Non Pressed, With Focus, Disabled).
#----------------------------------------------------------------------
class SBitmapTextButton(SBitmapButton):
"""
Subclass of :class:`SButton` which displays a bitmap and a label.
"""
def __init__(self, parent, id, bitmap, label,
pos=wx.DefaultPosition, size=wx.DefaultSize):
"""
Default class constructor.
:param `parent`: the :class:`SBitmapTextButton` parent. Must not be ``None``;
:param `id`: window identifier. A value of -1 indicates a default value;
:param `bitmap`: the button bitmap (if any);
:param `label`: the button text label;
:param `pos`: the control position. A value of (-1, -1) indicates a default position,
chosen by either the windowing system or wxPython, depending on platform;
:param `size`: the control size. A value of (-1, -1) indicates a default size,
chosen by either the windowing system or wxPython, depending on platform.
"""
SBitmapButton.__init__(self, parent, id, bitmap, pos, size)
self.SetLabel(label)
def _GetLabelSize(self):
""" Used internally. """
w, h = self.GetTextExtent(self.GetLabel())
if not self._bmplabel:
return w, h, True # if there isn't a bitmap use the size of the text
w_bmp = self._bmplabel.GetWidth() + 2
h_bmp = self._bmplabel.GetHeight() + 2
width = w + w_bmp
if h_bmp > h:
height = h_bmp
else:
height = h
return width, height, True
def DrawLabel(self, dc, width, height, dw=0, dh=0):
"""
Draws the bitmap and the text label.
:param `dc`: an instance of :class:`DC`;
:param `width`: the button width;
:param `height`: the button height;
:param `dw`: width differential, to show a 3D effect;
:param `dh`: height differential, to show a 3D effect.
"""
bmp = self._bmplabel
if bmp != None: # if the bitmap is used
if self._bmpdisabled and not self.IsEnabled():
bmp = self._bmpdisabled
if self._bmpfocus and self._hasfocus:
bmp = self._bmpfocus
if self._bmpselected and not self._isup:
bmp = self._bmpselected
bw, bh = bmp.GetWidth(), bmp.GetHeight()
if not self._isup:
dw = dh = self._labeldelta
hasMask = bmp.GetMask() != None
else:
bw = bh = 0 # no bitmap -> size is zero
dc.SetFont(self.GetFont())
if self.IsEnabled():
dc.SetTextForeground(self.GetLabelColour())
else:
dc.SetTextForeground(wx.SystemSettings.GetColour(wx.SYS_COLOUR_GRAYTEXT))
label = self.GetLabel()
tw, th = dc.GetTextExtent(label) # size of text
if not self._isup:
dw = dh = self._labeldelta
w = min(width, height)
pos_x = (width - bw - tw)//2 + dw # adjust for bitmap and text to centre
rotangle = self.GetAngleOfRotation()*pi/180.0
if bmp != None:
if rotangle < 1.0/180.0:
dc.DrawBitmap(bmp, pos_x, (height - bh)//2 + dh, hasMask) # draw bitmap if available
pos_x = pos_x + 4 # extra spacing from bitmap
else:
pass
if rotangle < 1.0/180.0:
dc.DrawText(label, pos_x + dw + bw, (height-th)//2+dh) # draw the text
else:
xc, yc = (width//2, height//2)
xp = xc - (tw//2)* cos(rotangle) - (th//2)*sin(rotangle)
yp = yc + (tw//2)*sin(rotangle) - (th//2)*cos(rotangle)
dc.DrawRotatedText(label, xp, yp , rotangle*180.0/pi)
#----------------------------------------------------------------------
# __STOGGLEMIXIN Class
# A Mixin That Allows To Transform Any Of SButton, SBitmapButton And
# SBitmapTextButton In The Corresponding ToggleButtons.
#----------------------------------------------------------------------
class __SToggleMixin(object):
"""
A mixin that allows to transform any of :class:`SButton`, :class:`SBitmapButton` and
:class:`SBitmapTextButton` in the corresponding toggle buttons.
"""
def SetToggle(self, flag):
"""
Sets the button as toggled/not toggled.
:param `flag`: ``True`` to set the button as toggled, ``False`` otherwise.
"""
self._isup = not flag
self.Refresh()
SetValue = SetToggle
def GetToggle(self):
""" Returns the toggled state of a button. """
return not self._isup
GetValue = GetToggle
def OnLeftDown(self, event):
"""
Handles the ``wx.EVT_LEFT_DOWN`` event for the button.
:param `event`: a :class:`MouseEvent` event to be processed.
"""
if not self.IsEnabled():
return
x, y = (event.GetX(), event.GetY())
if self.IsOutside(x,y):
return
self._saveup = self._isup
self._isup = not self._isup
if not self.HasCapture():
self.CaptureMouse()
self.SetFocus()
self.Refresh()
def OnLeftUp(self, event):
"""
Handles the ``wx.EVT_LEFT_UP`` event for the button.
:param `event`: a :class:`MouseEvent` event to be processed.
"""
if not self.IsEnabled() or not self.HasCapture():
return
if self.HasCapture():
if self._isup != self._saveup:
self.Notify()
self.ReleaseMouse()
self.Refresh()
def OnKeyDown(self, event):
"""
Handles the ``wx.EVT_KEY_DOWN`` event for the button.
:param `event`: a :class:`KeyEvent` event to be processed.
"""
event.Skip()
def OnMotion(self, event):
"""
Handles the ``wx.EVT_MOTION`` event for the button.
:param `event`: a :class:`MouseEvent` event to be processed.
"""
if not self.IsEnabled():
return
if event.LeftIsDown() and self.HasCapture():
x, y = event.GetPosition()
w, h = self.GetClientSize()
if not self.IsOutside(x, y):
self._isup = not self._saveup
self.Refresh()
return
if self.IsOutside(x,y):
self._isup = self._saveup
self.Refresh()
return
event.Skip()
def OnKeyUp(self, event):
"""
Handles the ``wx.EVT_KEY_UP`` event for the button.
:param `event`: a :class:`KeyEvent` event to be processed.
"""
if self._hasfocus and event.GetKeyCode() == ord(" "):
self._isup = not self._isup
self.Notify()
self.Refresh()
event.Skip()
#----------------------------------------------------------------------
# STOGGLEBUTTON Class
#----------------------------------------------------------------------
class SToggleButton(__SToggleMixin, SButton):
""" A `ShapedButton` toggle button. """
pass
#----------------------------------------------------------------------
# SBITMAPTOGGLEBUTTON Class
#----------------------------------------------------------------------
class SBitmapToggleButton(__SToggleMixin, SBitmapButton):
""" A `ShapedButton` toggle bitmap button. """
pass
#----------------------------------------------------------------------
# SBITMAPTEXTTOGGLEBUTTON Class
#----------------------------------------------------------------------
class SBitmapTextToggleButton(__SToggleMixin, SBitmapTextButton):
""" A `ShapedButton` toggle bitmap button with a text label. """
pass
#----------------------------------------------------------------------
from wx.lib.embeddedimage import PyEmbeddedImage
UpButton = PyEmbeddedImage(
"iVBORw0KGgoAAAANSUhEUgAAAMgAAADICAMAAACahl6sAAAACXBIWXMAAA7DAAAOwwHHb6hk"
"AAAABGdBTUEAALGOfPtRkwAAACBjSFJNAAB6JQAAgIMAAPn/AACA6QAAdTAAAOpgAAA6mAAA"
"F2+SX8VGAAADAFBMVEX//////8z//5n//2b//zP//wD/zP//zMz/zJn/zGb/zDP/zAD/mf//"
"mcz/mZn/mWb/mTP/mQD/Zv//Zsz/Zpn/Zmb/ZjP/ZgD/M///M8z/M5n/M2b/MzP/MwD/AP//"
"AMz/AJn/AGb/ADP/AADM///M/8zM/5nM/2bM/zPM/wDMzP/MzMzMzJnMzGbMzDPMzADMmf/M"
"mczMmZnMmWbMmTPMmQDMZv/MZszMZpnMZmbMZjPMZgDMM//MM8zMM5nMM2bMMzPMMwDMAP/M"
"AMzMAJnMAGbMADPMAACZ//+Z/8yZ/5mZ/2aZ/zOZ/wCZzP+ZzMyZzJmZzGaZzDOZzACZmf+Z"
"mcyZmZmZmWaZmTOZmQCZZv+ZZsyZZpmZZmaZZjOZZgCZM/+ZM8yZM5mZM2aZMzOZMwCZAP+Z"
"AMyZAJmZAGaZADOZAABm//9m/8xm/5lm/2Zm/zNm/wBmzP9mzMxmzJlmzGZmzDNmzABmmf9m"
"mcxmmZlmmWZmmTNmmQBmZv9mZsxmZplmZmZmZjNmZgBmM/9mM8xmM5lmM2ZmMzNmMwBmAP9m"
"AMxmAJlmAGZmADNmAAAz//8z/8wz/5kz/2Yz/zMz/wAzzP8zzMwzzJkzzGYzzDMzzAAzmf8z"
"mcwzmZkzmWYzmTMzmQAzZv8zZswzZpkzZmYzZjMzZgAzM/8zM8wzM5kzM2YzMzMzMwAzAP8z"
"AMwzAJkzAGYzADMzAAAA//8A/8wA/5kA/2YA/zMA/wAAzP8AzMwAzJkAzGYAzDMAzAAAmf8A"
"mcwAmZkAmWYAmTMAmQAAZv8AZswAZpkAZmYAZjMAZgAAM/8AM8wAM5kAM2YAMzMAMwAAAP8A"
"AMwAAJkAAGYAADMAAADU1NTT09PS0tLR0dHQ0NDNzc3Ly8vKysrJycnIyMjHx8fGxsbFxcXC"
"wsLBwcH39/f09PTw8PDs7Ozo6Ojj4+Pe3t7Z2dnX19fV1dXOzs7ExMTDw8O+vr66urq1tbWw"
"sLCsrKyoqKikpKSgoKCcnJyUlJSPj4////+2FWUJAAABAHRSTlP/////////////////////"
"////////////////////////////////////////////////////////////////////////"
"////////////////////////////////////////////////////////////////////////"
"////////////////////////////////////////////////////////////////////////"
"////////////////////////////////////////////////////////////////////////"
"//////////////////////////////8AU/cHJQAAIcNJREFUeNpi+D9MAEAAMQwXjwAE0LDx"
"CEAA0cIjL9+8wwreA8GHGzdvvn1FA0sBAoj6HsHhCySP3Lx54y3VrQUIIGp6BOHkt2/fAgkQ"
"BWKBIIpvQB76cPPmrVtUtBwggBio6o232AHYT9g8cvs21awHCCCqeOQV2LFg8AYI4Yw3EIDq"
"KUTUfPhw48ONGzdvvaaGGwACiAoeeQF14hv8AN03sJgB+uTWS8pdARBAlHoE2QuvXwMROgAK"
"Y/UNIqWBY4XiRAYQQJR55DVKVLzGBbDEDCL/gzwCipVbbyhyCkAAUeARhnfIkQEFr5AAVr9g"
"ZBZY8gLGyh0KXAMQQAwUJyp4enqFCRD+wOsTSO0CKsTukO0cgAAi0yMvoXEBcj/UBy/BAKdP"
"wKohHkHzDKSeBCYvkFfu3CGz2gcIIAayYwPuESRvQHyC8A5q0nqNvTBG88gd8mIFIIAYyPIG"
"PF9APIHwBlqkvMY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j+QNQdxOcOCAAIINI88p/hyZPPn5EbK3Cf/EQFv0AQ"
"Dn5Dj8j5DfMDNElB4uMv3BPgEhfStvpGossAAohE5f/fPv70Ca12/vEd7hOQ85HCH+x8mB+A"
"vvgNjwpYbCAAuKQCZw5IYfWBRIcBBBCpHoGkL/AwF6LtivAJcixAUxH0VAOUmEDyB3jbF7T6"
"gzQQYXt0SAMAAUSGR/6De4xPUS4FgfoEkZx+wz3yB8Uj4M1Rf5E8A/MGOIuD8zipuQMCAAKI"
"HI9AMv0XRHPlO1I9hxwhGB6BhD/CA2GQjAE7vQxyqvI3spwEEEDkeeT/68+fUdriKBU2wiPI"
"XglD+CQsDO6PMMg5Lb+gp8US3yRBBwABRKZHgAB25yJynYIovpD8ghIvcACVg5xSCEtS5GQO"
"KAAIIPI98p8BmrzgNT2KV5ALXah3fv9G8gHEDxBfQK8YILnIRQYAAUSBVtCMEOKWP6S2OXKs"
"IMcMqg+gyQnhi1sUOQUggCjzyP//z56h9ZZQEhhycYwKYIco/4Alqm8UOgQggCj1CKivgiWz"
"fEdqtGABiGsFIM3k15S7AiCAqOCR///fQHqAX7H0ubA1IVH6MEAtb6nhBoAAoopHoKXYl2fw"
"zI8xRIHomKD2jqlmPUAAUc8joPzy7BnqfZLfcACYPBUtBwgganoEAu48RR0xwQq0qW4tQABR"
"3yPALHMbv0fuvqWBpQABRAuPDAgACKBh4xGAABo2HgEIMABb8EQbIiGeqQAAAABJRU5ErkJg"
"gg==")
#----------------------------------------------------------------------
DownButton = PyEmbeddedImage(
"iVBORw0KGgoAAAANSUhEUgAAAMgAAADICAMAAACahl6sAAAACXBIWXMAAA7DAAAOwwHHb6hk"
"AAAABGdBTUEAALGOfPtRkwAAACBjSFJNAAB6JQAAgIMAAPn/AACA6QAAdTAAAOpgAAA6mAAA"
"F2+SX8VGAAADAFBMVEX//////8z//5n//2b//zP//wD/zP//zMz/zJn/zGb/zDP/zAD/mf//"
"mcz/mZn/mWb/mTP/mQD/Zv//Zsz/Zpn/Zmb/ZjP/ZgD/M///M8z/M5n/M2b/MzP/MwD/AP//"
"AMz/AJn/AGb/ADP/AADM///M/8zM/5nM/2bM/zPM/wDMzP/MzMzMzJnMzGbMzDPMzADMmf/M"
"mczMmZnMmWbMmTPMmQDMZv/MZszMZpnMZmbMZjPMZgDMM//MM8zMM5nMM2bMMzPMMwDMAP/M"
"AMzMAJnMAGbMADPMAACZ//+Z/8yZ/5mZ/2aZ/zOZ/wCZzP+ZzMyZzJmZzGaZzDOZzACZmf+Z"
"mcyZmZmZmWaZmTOZmQCZZv+ZZsyZZpmZZmaZZjOZZgCZM/+ZM8yZM5mZM2aZMzOZMwCZAP+Z"
"AMyZAJmZAGaZADOZAABm//9m/8xm/5lm/2Zm/zNm/wBmzP9mzMxmzJlmzGZmzDNmzABmmf9m"
"mcxmmZlmmWZmmTNmmQBmZv9mZsxmZplmZmZmZjNmZgBmM/9mM8xmM5lmM2ZmMzNmMwBmAP9m"
"AMxmAJlmAGZmADNmAAAz//8z/8wz/5kz/2Yz/zMz/wAzzP8zzMwzzJkzzGYzzDMzzAAzmf8z"
"mcwzmZkzmWYzmTMzmQAzZv8zZswzZpkzZmYzZjMzZgAzM/8zM8wzM5kzM2YzMzMzMwAzAP8z"
"AMwzAJkzAGYzADMzAAAA//8A/8wA/5kA/2YA/zMA/wAAzP8AzMwAzJkAzGYAzDMAzAAAmf8A"
"mcwAmZkAmWYAmTMAmQAAZv8AZswAZpkAZmYAZjMAZgAAM/8AM8wAM5kAM2YAMzMAMwAAAP8A"
"AMwAAJkAAGYAADMAAADV1dXU1NTT09PS0tLR0dHQ0NDOzs7Nzc3Ly8vKysrJycnIyMjGxsbD"
"w8PCwsL39/f09PTx8fHu7u7p6enk5OTf39/Z2dnW1tbPz8/Hx8fExMS/v7+7u7u3t7e0tLSw"
"sLCtra2pqamlpaWhoaGdnZ2Tk5OPj4////+ZlMjzAAABAHRSTlP/////////////////////"
"////////////////////////////////////////////////////////////////////////"
"////////////////////////////////////////////////////////////////////////"
"////////////////////////////////////////////////////////////////////////"
"////////////////////////////////////////////////////////////////////////"
"//////////////////////////////8AU/cHJQAAIMRJREFUeNpi+D9MAEAAMQwXjwAE0LDx"
"CEAA0cIjb+9/wQE+g8GdNzSwFCCAqO8R7S+4AcQjz549+0B1awECiJoeAbr0KwR8QwNQ4a9f"
"viK8A/IPFS0HCCAG6nvjGy4A8Qsibp5R0ysAAUQVj7yFeeA7CPzADr5DANRHyL6hSpYBCCAq"
"eOQ1NBJgfviJDSB7B9Mvryl3BUAAUeoRkCcgPgA59xcY/IYBKPcXlPEL4Smwb6ApjTr5BSCA"
"KPPI7a+QqEDyxm/sAMUrkJhBRAzEJ+8ocgpAAFHgEQZIbEAiA+aFP1gAmm+Q/PIdyStAvzyl"
"wDUAAcRAYaKCxQXcD2FQgN0zEJ/8gmYaSLRACmWwTz59Its5AAFEpkfewjwBiQhkH2AArL4B"
"e+Yn3C9wrzz9RGbGBwgg8jwCLmrh/vjzG+6Pv38x/QH3ye8/6EkMFiuIbP/06acnZDkJIIAY"
"yEtU4OgA+QIRFX+hANU3KMkLwyPwAgwSJ1/AcUKeVwACiIF8f/z8hUhSf+EewZmuUPMJwiff"
"kYtisFc+PSHDJwABRKpH3oN9AU5TUE/8hccFqk9gSQqpCEb4AZhHEEUxwi/w4uvTk7ckOgwg"
"gBhILXLBsQFJVMgJCs0bEF/AowAlIqBegBbDP38gl8RfYXn+yRMSXQYQQAykZnJQdPxE9cY/"
"NH8g/IDi8p+/sLZdfqK0XJCS10eSnAYQQKR45AHUH6BkhYiMf3CfhCF7A7VVgtrgggHUNhi4"
"wQZtf4Gi5Mnj9yQ4DiCAGEiKDkgWB3kD4oV/QAAkkOMCWk0g3P0dJ0BvGyO3WUDZ5OPHx8S7"
"DiCAiPcIuAqEFLngDP4PCv6iegPqD2TngZ0IcymssY/mG1gTH1Z4gTP8ExJ8AhBADERHByyT"
"QxPVP2SPQLwB8gRSM+o7om+I6Dti6XvBOipoLWJQgwWYvIjNK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AAAABJRU5ErkJggg==")
if __name__ == '__main__':
import wx
class MyFrame(wx.Frame):
def __init__(self, parent):
wx.Frame.__init__(self, parent, -1, "ShapedButton Demo")
panel = wx.Panel(self)
# Create bitmaps for the button
bmp = wx.ArtProvider.GetBitmap(wx.ART_INFORMATION, wx.ART_OTHER, (16, 16))
play = SBitmapToggleButton(panel, -1, bmp, (100, 50))
play.SetUseFocusIndicator(False)
# our normal wxApp-derived class, as usual
app = wx.App(0)
frame = MyFrame(None)
app.SetTopWindow(frame)
frame.Show()
app.MainLoop()