mirror of
https://github.com/wxWidgets/Phoenix.git
synced 2026-01-05 03:20:08 +01:00
More docstring ref fixes in wx.lib
This commit is contained in:
@@ -255,7 +255,7 @@ def LightColour(colour, percent):
|
|||||||
|
|
||||||
def PaneCreateStippleBitmap():
|
def PaneCreateStippleBitmap():
|
||||||
"""
|
"""
|
||||||
Creates a stipple bitmap to be used in a :class:`Brush`.
|
Creates a stipple bitmap to be used in a :class:`wx.Brush`.
|
||||||
|
|
||||||
This is used to draw sash resize hints.
|
This is used to draw sash resize hints.
|
||||||
"""
|
"""
|
||||||
|
|||||||
@@ -1427,8 +1427,8 @@ def RestoreOldDC(dc, oldPen, oldBrush, oldMode):
|
|||||||
Restores the old settings for a :class:`wx.DC`.
|
Restores the old settings for a :class:`wx.DC`.
|
||||||
|
|
||||||
:param `dc`: an instance of :class:`wx.DC`;
|
:param `dc`: an instance of :class:`wx.DC`;
|
||||||
:param `oldPen`: an instance of :class:`Pen`;
|
:param `oldPen`: an instance of :class:`wx.Pen`;
|
||||||
:param `oldBrush`: an instance of :class:`Brush`;
|
:param `oldBrush`: an instance of :class:`wx.Brush`;
|
||||||
:param `oldMode`: the :class:`wx.DC` drawing mode bit.
|
:param `oldMode`: the :class:`wx.DC` drawing mode bit.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ to the standard :class:`TreeCtrl` behaviour this class supports:
|
|||||||
* Customized drag and drop images built on the fly;
|
* Customized drag and drop images built on the fly;
|
||||||
* Setting the :class:`CustomTreeCtrl` item buttons to a personalized imagelist;
|
* Setting the :class:`CustomTreeCtrl` item buttons to a personalized imagelist;
|
||||||
* Setting the :class:`CustomTreeCtrl` check/radio item icons to a personalized imagelist;
|
* Setting the :class:`CustomTreeCtrl` check/radio item icons to a personalized imagelist;
|
||||||
* Changing the style of the lines that connect the items (in terms of :class:`Pen` styles);
|
* Changing the style of the lines that connect the items (in terms of :class:`wx.Pen` styles);
|
||||||
* Using an image as a :class:`CustomTreeCtrl` background (currently only in "tile" mode);
|
* Using an image as a :class:`CustomTreeCtrl` background (currently only in "tile" mode);
|
||||||
* Adding images to any item in the leftmost area of the :class:`CustomTreeCtrl` client window.
|
* Adding images to any item in the leftmost area of the :class:`CustomTreeCtrl` client window.
|
||||||
* Separator-type items which are simply visual indicators that are meant to set apart
|
* Separator-type items which are simply visual indicators that are meant to set apart
|
||||||
@@ -4155,7 +4155,7 @@ class CustomTreeCtrl(wx.ScrolledWindow):
|
|||||||
"""
|
"""
|
||||||
Sets the pen used to draw the selected item border.
|
Sets the pen used to draw the selected item border.
|
||||||
|
|
||||||
:param `pen`: an instance of :class:`Pen`.
|
:param `pen`: an instance of :class:`wx.Pen`.
|
||||||
|
|
||||||
:note: The border pen is not used if the Windows Vista selection style is applied.
|
:note: The border pen is not used if the Windows Vista selection style is applied.
|
||||||
"""
|
"""
|
||||||
@@ -4168,7 +4168,7 @@ class CustomTreeCtrl(wx.ScrolledWindow):
|
|||||||
"""
|
"""
|
||||||
Returns the pen used to draw the selected item border.
|
Returns the pen used to draw the selected item border.
|
||||||
|
|
||||||
:return: An instance of :class:`Pen`.
|
:return: An instance of :class:`wx.Pen`.
|
||||||
|
|
||||||
:note: The border pen is not used if the Windows Vista selection style is applied.
|
:note: The border pen is not used if the Windows Vista selection style is applied.
|
||||||
"""
|
"""
|
||||||
@@ -4180,7 +4180,7 @@ class CustomTreeCtrl(wx.ScrolledWindow):
|
|||||||
"""
|
"""
|
||||||
Sets the pen used to draw the connecting lines between items.
|
Sets the pen used to draw the connecting lines between items.
|
||||||
|
|
||||||
:param `pen`: an instance of :class:`Pen`.
|
:param `pen`: an instance of :class:`wx.Pen`.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
self._dottedPen = pen
|
self._dottedPen = pen
|
||||||
@@ -4191,7 +4191,7 @@ class CustomTreeCtrl(wx.ScrolledWindow):
|
|||||||
"""
|
"""
|
||||||
Returns the pen used to draw the connecting lines between items.
|
Returns the pen used to draw the connecting lines between items.
|
||||||
|
|
||||||
:return: An instance of :class:`Pen`.
|
:return: An instance of :class:`wx.Pen`.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
return self._dottedPen
|
return self._dottedPen
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ In addition to the standard :class:`adv.TreeListCtrl` behaviour this class suppo
|
|||||||
* Customized drag and drop images built on the fly;
|
* Customized drag and drop images built on the fly;
|
||||||
* Setting the :class:`HyperTreeList` item buttons to a personalized imagelist;
|
* Setting the :class:`HyperTreeList` item buttons to a personalized imagelist;
|
||||||
* Setting the :class:`HyperTreeList` check/radio item icons to a personalized imagelist;
|
* Setting the :class:`HyperTreeList` check/radio item icons to a personalized imagelist;
|
||||||
* Changing the style of the lines that connect the items (in terms of :class:`Pen` styles);
|
* Changing the style of the lines that connect the items (in terms of :class:`wx.Pen` styles);
|
||||||
* Using an image as a :class:`HyperTreeList` background (currently only in "tile" mode);
|
* Using an image as a :class:`HyperTreeList` background (currently only in "tile" mode);
|
||||||
* Ellipsization of long items when the horizontal space is low, via the ``TR_ELLIPSIZE_LONG_ITEMS``
|
* Ellipsization of long items when the horizontal space is low, via the ``TR_ELLIPSIZE_LONG_ITEMS``
|
||||||
style (`New in version 0.9.3`).
|
style (`New in version 0.9.3`).
|
||||||
|
|||||||
@@ -4446,9 +4446,9 @@ class UltimateListLineData(object):
|
|||||||
:param `highlighted`: ``True`` if the item is highlighted, ``False`` otherwise;
|
:param `highlighted`: ``True`` if the item is highlighted, ``False`` otherwise;
|
||||||
:param `current`: ``True`` if the item is the current item;
|
:param `current`: ``True`` if the item is the current item;
|
||||||
:param `enabled`: ``True`` if the item is enabled, ``False`` otherwise;
|
:param `enabled`: ``True`` if the item is enabled, ``False`` otherwise;
|
||||||
:param `oldPN`: an instance of :class:`Pen`, to save and restore at the end of
|
:param `oldPN`: an instance of :class:`wx.Pen`, to save and restore at the end of
|
||||||
the drawing;
|
the drawing;
|
||||||
:param `oldBR`: an instance of :class:`Brush`, to save and restore at the end of
|
:param `oldBR`: an instance of :class:`wx.Brush`, to save and restore at the end of
|
||||||
the drawing.
|
the drawing.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|||||||
@@ -131,7 +131,7 @@ class FloatCanvas(wx.Panel):
|
|||||||
|
|
||||||
(Note: this really should get re-factored to allow more generic
|
(Note: this really should get re-factored to allow more generic
|
||||||
projections...)
|
projections...)
|
||||||
:param string `BackgroundColor`: any value accepted by :class:`Brush`
|
:param string `BackgroundColor`: any value accepted by :class:`wx.Brush`
|
||||||
:param `Debug`: activate debug, currently it prints some debugging
|
:param `Debug`: activate debug, currently it prints some debugging
|
||||||
information, could be improved.
|
information, could be improved.
|
||||||
|
|
||||||
|
|||||||
@@ -3813,7 +3813,7 @@ class ShapeRegion(object):
|
|||||||
"""
|
"""
|
||||||
Set the pen style.
|
Set the pen style.
|
||||||
|
|
||||||
:param `style`: the style, see :class:`Pen`
|
:param `style`: the style, see :class:`wx.Pen`
|
||||||
|
|
||||||
"""
|
"""
|
||||||
self._penStyle = style
|
self._penStyle = style
|
||||||
|
|||||||
@@ -150,7 +150,7 @@ class dcGraphicsContext(object):
|
|||||||
also with increasing y down.
|
also with increasing y down.
|
||||||
:class:`wx.DC` and :class:`GraphicsContext` fonts are too big in the ratio
|
:class:`wx.DC` and :class:`GraphicsContext` fonts are too big in the ratio
|
||||||
of pixels per inch to points per inch. If screen rendering used Cairo,
|
of pixels per inch to points per inch. If screen rendering used Cairo,
|
||||||
printed fonts need to be scaled but if :class:`GCDC` was used, they are
|
printed fonts need to be scaled but if :class:`wx.GCDC` was used, they are
|
||||||
already scaled.
|
already scaled.
|
||||||
|
|
||||||
:param `context`: **TBW** (?)
|
:param `context`: **TBW** (?)
|
||||||
@@ -229,20 +229,20 @@ class dcGraphicsContext(object):
|
|||||||
|
|
||||||
def SetPen(self, pen):
|
def SetPen(self, pen):
|
||||||
"""
|
"""
|
||||||
Set the :class:`Pen` to be used for stroking lines in future drawing
|
Set the :class:`wx.Pen` to be used for stroking lines in future drawing
|
||||||
operations.
|
operations.
|
||||||
|
|
||||||
:param `pen`: the :class:`Pen` to be used from now on.
|
:param `pen`: the :class:`wx.Pen` to be used from now on.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
self._context.SetPen(pen)
|
self._context.SetPen(pen)
|
||||||
|
|
||||||
def SetBrush(self, brush):
|
def SetBrush(self, brush):
|
||||||
"""
|
"""
|
||||||
Set the :class:`Brush` to be used for filling shapes in future drawing
|
Set the :class:`wx.Brush` to be used for filling shapes in future drawing
|
||||||
operations.
|
operations.
|
||||||
|
|
||||||
:param `brush`: the :class:`Brush` to be used from now on.
|
:param `brush`: the :class:`wx.Brush` to be used from now on.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
self._context.SetBrush(brush)
|
self._context.SetBrush(brush)
|
||||||
|
|||||||
@@ -172,10 +172,11 @@ class PlateButton(wx.Control):
|
|||||||
self.Bind(wx.EVT_KEY_UP, self.OnKeyUp)
|
self.Bind(wx.EVT_KEY_UP, self.OnKeyUp)
|
||||||
self.Bind(wx.EVT_CONTEXT_MENU, lambda evt: self.ShowMenu())
|
self.Bind(wx.EVT_CONTEXT_MENU, lambda evt: self.ShowMenu())
|
||||||
|
|
||||||
|
|
||||||
def __DrawBitmap(self, gc):
|
def __DrawBitmap(self, gc):
|
||||||
"""Draw the bitmap if one has been set
|
"""Draw the bitmap if one has been set
|
||||||
|
|
||||||
:param GCDC `gc`: :class:`GCDC` to draw with
|
:param wx.GCDC `gc`: :class:`wx.GCDC` to draw with
|
||||||
:return: x cordinate to draw text at
|
:return: x cordinate to draw text at
|
||||||
|
|
||||||
"""
|
"""
|
||||||
@@ -192,10 +193,11 @@ class PlateButton(wx.Control):
|
|||||||
else:
|
else:
|
||||||
return 6
|
return 6
|
||||||
|
|
||||||
|
|
||||||
def __DrawDropArrow(self, gc, xpos, ypos):
|
def __DrawDropArrow(self, gc, xpos, ypos):
|
||||||
"""Draw a drop arrow if needed and restore pen/brush after finished
|
"""Draw a drop arrow if needed and restore pen/brush after finished
|
||||||
|
|
||||||
:param GCDC `gc`: :class:`GCDC` to draw with
|
:param wx.GCDC `gc`: :class:`wx.GCDC` to draw with
|
||||||
:param int `xpos`: x cord to start at
|
:param int `xpos`: x cord to start at
|
||||||
:param int `ypos`: y cord to start at
|
:param int `ypos`: y cord to start at
|
||||||
|
|
||||||
@@ -215,10 +217,11 @@ class PlateButton(wx.Control):
|
|||||||
else:
|
else:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
def __DrawHighlight(self, gc, width, height):
|
def __DrawHighlight(self, gc, width, height):
|
||||||
"""Draw the main highlight/pressed state
|
"""Draw the main highlight/pressed state
|
||||||
|
|
||||||
:param GCDC `gc`: :class:`GCDC` to draw with
|
:param wx.GCDC `gc`: :class:`wx.GCDC` to draw with
|
||||||
:param int `width`: width of highlight
|
:param int `width`: width of highlight
|
||||||
:param int `height`: height of highlight
|
:param int `height`: height of highlight
|
||||||
|
|
||||||
@@ -244,6 +247,7 @@ class PlateButton(wx.Control):
|
|||||||
|
|
||||||
gc.DrawRoundedRectangle(1, 1, width - 2, height - 2, rad)
|
gc.DrawRoundedRectangle(1, 1, width - 2, height - 2, rad)
|
||||||
|
|
||||||
|
|
||||||
def __PostEvent(self):
|
def __PostEvent(self):
|
||||||
"""Post a button event to parent of this control"""
|
"""Post a button event to parent of this control"""
|
||||||
if self._style & PB_STYLE_TOGGLE:
|
if self._style & PB_STYLE_TOGGLE:
|
||||||
@@ -255,6 +259,7 @@ class PlateButton(wx.Control):
|
|||||||
bevt.SetString(self.GetLabel())
|
bevt.SetString(self.GetLabel())
|
||||||
self.GetEventHandler().ProcessEvent(bevt)
|
self.GetEventHandler().ProcessEvent(bevt)
|
||||||
|
|
||||||
|
|
||||||
def __DrawButton(self):
|
def __DrawButton(self):
|
||||||
"""Draw the button"""
|
"""Draw the button"""
|
||||||
# TODO using a buffered paintdc on windows with the nobg style
|
# TODO using a buffered paintdc on windows with the nobg style
|
||||||
@@ -325,6 +330,7 @@ class PlateButton(wx.Control):
|
|||||||
gc.DrawText(self.Label, txt_x + 2, txt_y)
|
gc.DrawText(self.Label, txt_x + 2, txt_y)
|
||||||
self.__DrawDropArrow(gc, width - 10, (height // 2) - 2)
|
self.__DrawDropArrow(gc, width - 10, (height // 2) - 2)
|
||||||
|
|
||||||
|
|
||||||
def __InitColors(self):
|
def __InitColors(self):
|
||||||
"""Initialize the default colors"""
|
"""Initialize the default colors"""
|
||||||
color = GetHighlightColour()
|
color = GetHighlightColour()
|
||||||
@@ -335,6 +341,7 @@ class PlateButton(wx.Control):
|
|||||||
htxt=BestLabelColour(self.GetForegroundColour()))
|
htxt=BestLabelColour(self.GetForegroundColour()))
|
||||||
return colors
|
return colors
|
||||||
|
|
||||||
|
|
||||||
def __LeaveWindow(self):
|
def __LeaveWindow(self):
|
||||||
"""Handle updating the buttons state when the mouse cursor leaves"""
|
"""Handle updating the buttons state when the mouse cursor leaves"""
|
||||||
if (self._style & PB_STYLE_TOGGLE) and self._pressed:
|
if (self._style & PB_STYLE_TOGGLE) and self._pressed:
|
||||||
@@ -343,15 +350,16 @@ class PlateButton(wx.Control):
|
|||||||
self._SetState(PLATE_NORMAL)
|
self._SetState(PLATE_NORMAL)
|
||||||
self._pressed = False
|
self._pressed = False
|
||||||
|
|
||||||
|
|
||||||
def _SetState(self, state):
|
def _SetState(self, state):
|
||||||
"""Manually set the state of the button
|
"""Manually set the state of the button
|
||||||
|
|
||||||
:param `state`: one of the PLATE_* values
|
:param `state`: one of the PLATE_* values
|
||||||
|
|
||||||
..note::
|
.. note::
|
||||||
the state may be altered by mouse actions
|
the state may be altered by mouse actions
|
||||||
|
|
||||||
..note::
|
.. note::
|
||||||
Internal use only!
|
Internal use only!
|
||||||
|
|
||||||
"""
|
"""
|
||||||
@@ -362,6 +370,7 @@ class PlateButton(wx.Control):
|
|||||||
else:
|
else:
|
||||||
self.Refresh()
|
self.Refresh()
|
||||||
|
|
||||||
|
|
||||||
def _ToggleState(self):
|
def _ToggleState(self):
|
||||||
"""Toggle button state
|
"""Toggle button state
|
||||||
|
|
||||||
@@ -391,15 +400,18 @@ class PlateButton(wx.Control):
|
|||||||
LabelText = property(lambda self: self.GetLabel(),
|
LabelText = property(lambda self: self.GetLabel(),
|
||||||
lambda self, lbl: self.SetLabel(lbl))
|
lambda self, lbl: self.SetLabel(lbl))
|
||||||
|
|
||||||
|
|
||||||
def AcceptsFocus(self):
|
def AcceptsFocus(self):
|
||||||
"""Can this window have the focus?"""
|
"""Can this window have the focus?"""
|
||||||
return self.IsEnabled()
|
return self.IsEnabled()
|
||||||
|
|
||||||
|
|
||||||
def Disable(self):
|
def Disable(self):
|
||||||
"""Disable the control"""
|
"""Disable the control"""
|
||||||
super(PlateButton, self).Disable()
|
super(PlateButton, self).Disable()
|
||||||
self.Refresh()
|
self.Refresh()
|
||||||
|
|
||||||
|
|
||||||
def DoGetBestSize(self):
|
def DoGetBestSize(self):
|
||||||
"""Calculate the best size of the button
|
"""Calculate the best size of the button
|
||||||
|
|
||||||
@@ -433,15 +445,17 @@ class PlateButton(wx.Control):
|
|||||||
self.CacheBestSize(best)
|
self.CacheBestSize(best)
|
||||||
return best
|
return best
|
||||||
|
|
||||||
|
|
||||||
def Enable(self, enable=True):
|
def Enable(self, enable=True):
|
||||||
"""Enable/Disable the control"""
|
"""Enable/Disable the control"""
|
||||||
super(PlateButton, self).Enable(enable)
|
super(PlateButton, self).Enable(enable)
|
||||||
self.Refresh()
|
self.Refresh()
|
||||||
|
|
||||||
|
|
||||||
def GetBackgroundBrush(self, dc):
|
def GetBackgroundBrush(self, dc):
|
||||||
"""Get the brush for drawing the background of the button
|
"""Get the brush for drawing the background of the button
|
||||||
|
|
||||||
:return: :class:`Brush`
|
:return: :class:`wx.Brush`
|
||||||
|
|
||||||
..note::
|
..note::
|
||||||
used internally when on gtk
|
used internally when on gtk
|
||||||
@@ -461,6 +475,7 @@ class PlateButton(wx.Control):
|
|||||||
brush = wx.Brush(bkgrd, wx.BRUSHSTYLE_SOLID)
|
brush = wx.Brush(bkgrd, wx.BRUSHSTYLE_SOLID)
|
||||||
return brush
|
return brush
|
||||||
|
|
||||||
|
|
||||||
def GetBitmapDisabled(self):
|
def GetBitmapDisabled(self):
|
||||||
"""Get the bitmap of the disable state
|
"""Get the bitmap of the disable state
|
||||||
|
|
||||||
@@ -469,6 +484,7 @@ class PlateButton(wx.Control):
|
|||||||
"""
|
"""
|
||||||
return self.BitmapDisabled
|
return self.BitmapDisabled
|
||||||
|
|
||||||
|
|
||||||
def GetBitmapLabel(self):
|
def GetBitmapLabel(self):
|
||||||
"""Get the label bitmap
|
"""Get the label bitmap
|
||||||
|
|
||||||
@@ -484,6 +500,7 @@ class PlateButton(wx.Control):
|
|||||||
# Alias for GetLabel
|
# Alias for GetLabel
|
||||||
GetLabelText = wx.Control.GetLabel
|
GetLabelText = wx.Control.GetLabel
|
||||||
|
|
||||||
|
|
||||||
def GetMenu(self):
|
def GetMenu(self):
|
||||||
"""Return the menu associated with this button or None if no
|
"""Return the menu associated with this button or None if no
|
||||||
menu is associated with it.
|
menu is associated with it.
|
||||||
@@ -491,21 +508,24 @@ class PlateButton(wx.Control):
|
|||||||
"""
|
"""
|
||||||
return self._menu
|
return self._menu
|
||||||
|
|
||||||
|
|
||||||
def GetState(self):
|
def GetState(self):
|
||||||
"""Get the current state of the button
|
"""Get the current state of the button
|
||||||
|
|
||||||
:return: int
|
:return: int
|
||||||
|
|
||||||
..seeAlso::
|
.. seeAlso::
|
||||||
PLATE_NORMAL, PLATE_HIGHLIGHT, PLATE_PRESSED
|
PLATE_NORMAL, PLATE_HIGHLIGHT, PLATE_PRESSED
|
||||||
|
|
||||||
"""
|
"""
|
||||||
return self._state['cur']
|
return self._state['cur']
|
||||||
|
|
||||||
|
|
||||||
def HasTransparentBackground(self):
|
def HasTransparentBackground(self):
|
||||||
"""Override setting of background fill"""
|
"""Override setting of background fill"""
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
def IsPressed(self):
|
def IsPressed(self):
|
||||||
"""Return if button is pressed (PB_STYLE_TOGGLE)
|
"""Return if button is pressed (PB_STYLE_TOGGLE)
|
||||||
|
|
||||||
@@ -514,6 +534,7 @@ class PlateButton(wx.Control):
|
|||||||
"""
|
"""
|
||||||
return self._pressed
|
return self._pressed
|
||||||
|
|
||||||
|
|
||||||
#---- Event Handlers ----#
|
#---- Event Handlers ----#
|
||||||
|
|
||||||
def OnErase(self, evt):
|
def OnErase(self, evt):
|
||||||
@@ -525,11 +546,13 @@ class PlateButton(wx.Control):
|
|||||||
"""
|
"""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
def OnFocus(self, evt):
|
def OnFocus(self, evt):
|
||||||
"""Set the visual focus state if need be"""
|
"""Set the visual focus state if need be"""
|
||||||
if self._state['cur'] == PLATE_NORMAL:
|
if self._state['cur'] == PLATE_NORMAL:
|
||||||
self._SetState(PLATE_HIGHLIGHT)
|
self._SetState(PLATE_HIGHLIGHT)
|
||||||
|
|
||||||
|
|
||||||
def OnKeyUp(self, evt):
|
def OnKeyUp(self, evt):
|
||||||
"""Execute a single button press action when the Return key is pressed
|
"""Execute a single button press action when the Return key is pressed
|
||||||
and this control has the focus.
|
and this control has the focus.
|
||||||
@@ -544,6 +567,7 @@ class PlateButton(wx.Control):
|
|||||||
else:
|
else:
|
||||||
evt.Skip()
|
evt.Skip()
|
||||||
|
|
||||||
|
|
||||||
def OnKillFocus(self, evt):
|
def OnKillFocus(self, evt):
|
||||||
"""Set the visual state back to normal when focus is lost
|
"""Set the visual state back to normal when focus is lost
|
||||||
unless the control is currently in a pressed state.
|
unless the control is currently in a pressed state.
|
||||||
@@ -555,6 +579,7 @@ class PlateButton(wx.Control):
|
|||||||
if self._state['cur'] != PLATE_PRESSED:
|
if self._state['cur'] != PLATE_PRESSED:
|
||||||
self._SetState(PLATE_NORMAL)
|
self._SetState(PLATE_NORMAL)
|
||||||
|
|
||||||
|
|
||||||
def OnLeftDown(self, evt):
|
def OnLeftDown(self, evt):
|
||||||
"""Sets the pressed state and depending on the click position will
|
"""Sets the pressed state and depending on the click position will
|
||||||
show the popup menu if one has been set.
|
show the popup menu if one has been set.
|
||||||
@@ -576,11 +601,12 @@ class PlateButton(wx.Control):
|
|||||||
|
|
||||||
self.SetFocus()
|
self.SetFocus()
|
||||||
|
|
||||||
|
|
||||||
def OnLeftUp(self, evt):
|
def OnLeftUp(self, evt):
|
||||||
"""Post a button event if the control was previously in a
|
"""Post a button event if the control was previously in a
|
||||||
pressed state.
|
pressed state.
|
||||||
|
|
||||||
:param `evt`: :class:`MouseEvent`
|
:param `evt`: :class:`wx.MouseEvent`
|
||||||
|
|
||||||
"""
|
"""
|
||||||
if self._state['cur'] == PLATE_PRESSED:
|
if self._state['cur'] == PLATE_PRESSED:
|
||||||
@@ -594,6 +620,7 @@ class PlateButton(wx.Control):
|
|||||||
else:
|
else:
|
||||||
self._SetState(PLATE_HIGHLIGHT)
|
self._SetState(PLATE_HIGHLIGHT)
|
||||||
|
|
||||||
|
|
||||||
def OnMenuClose(self, evt):
|
def OnMenuClose(self, evt):
|
||||||
"""Refresh the control to a proper state after the menu has been
|
"""Refresh the control to a proper state after the menu has been
|
||||||
dismissed.
|
dismissed.
|
||||||
@@ -610,6 +637,7 @@ class PlateButton(wx.Control):
|
|||||||
|
|
||||||
#---- End Event Handlers ----#
|
#---- End Event Handlers ----#
|
||||||
|
|
||||||
|
|
||||||
def SetBitmap(self, bmp):
|
def SetBitmap(self, bmp):
|
||||||
"""Set the bitmap displayed in the button
|
"""Set the bitmap displayed in the button
|
||||||
|
|
||||||
@@ -622,6 +650,7 @@ class PlateButton(wx.Control):
|
|||||||
self._bmp['disable'] = img.ConvertToBitmap()
|
self._bmp['disable'] = img.ConvertToBitmap()
|
||||||
self.InvalidateBestSize()
|
self.InvalidateBestSize()
|
||||||
|
|
||||||
|
|
||||||
def SetBitmapDisabled(self, bmp):
|
def SetBitmapDisabled(self, bmp):
|
||||||
"""Set the bitmap for the disabled state
|
"""Set the bitmap for the disabled state
|
||||||
|
|
||||||
@@ -636,26 +665,30 @@ class PlateButton(wx.Control):
|
|||||||
SetBitmapLabel = SetBitmap
|
SetBitmapLabel = SetBitmap
|
||||||
SetBitmapSelected = SetBitmap
|
SetBitmapSelected = SetBitmap
|
||||||
|
|
||||||
|
|
||||||
def SetFocus(self):
|
def SetFocus(self):
|
||||||
"""Set this control to have the focus"""
|
"""Set this control to have the focus"""
|
||||||
if self._state['cur'] != PLATE_PRESSED:
|
if self._state['cur'] != PLATE_PRESSED:
|
||||||
self._SetState(PLATE_HIGHLIGHT)
|
self._SetState(PLATE_HIGHLIGHT)
|
||||||
super(PlateButton, self).SetFocus()
|
super(PlateButton, self).SetFocus()
|
||||||
|
|
||||||
|
|
||||||
def SetFont(self, font):
|
def SetFont(self, font):
|
||||||
"""Adjust size of control when font changes"""
|
"""Adjust size of control when font changes"""
|
||||||
super(PlateButton, self).SetFont(font)
|
super(PlateButton, self).SetFont(font)
|
||||||
self.InvalidateBestSize()
|
self.InvalidateBestSize()
|
||||||
|
|
||||||
|
|
||||||
def SetLabel(self, label):
|
def SetLabel(self, label):
|
||||||
"""Set the label of the button
|
"""Set the label of the button
|
||||||
|
|
||||||
:param string `label`: lable string
|
:param string `label`: label string
|
||||||
|
|
||||||
"""
|
"""
|
||||||
super(PlateButton, self).SetLabel(label)
|
super(PlateButton, self).SetLabel(label)
|
||||||
self.InvalidateBestSize()
|
self.InvalidateBestSize()
|
||||||
|
|
||||||
|
|
||||||
def SetLabelColor(self, normal, hlight=wx.NullColour):
|
def SetLabelColor(self, normal, hlight=wx.NullColour):
|
||||||
"""Set the color of the label. The optimal label color is usually
|
"""Set the color of the label. The optimal label color is usually
|
||||||
automatically selected depending on the button color. In some
|
automatically selected depending on the button color. In some
|
||||||
@@ -685,13 +718,14 @@ class PlateButton(wx.Control):
|
|||||||
else:
|
else:
|
||||||
self.Refresh()
|
self.Refresh()
|
||||||
|
|
||||||
|
|
||||||
def SetMenu(self, menu):
|
def SetMenu(self, menu):
|
||||||
"""Set the menu that can be shown when clicking on the
|
"""Set the menu that can be shown when clicking on the
|
||||||
drop arrow of the button.
|
drop arrow of the button.
|
||||||
|
|
||||||
:param wx.Menu `menu`: :class:`wx.Menu` to use as a PopupMenu
|
:param wx.Menu `menu`: :class:`wx.Menu` to use as a PopupMenu
|
||||||
|
|
||||||
..note::
|
.. note::
|
||||||
Arrow is not drawn unless a menu is set
|
Arrow is not drawn unless a menu is set
|
||||||
|
|
||||||
"""
|
"""
|
||||||
@@ -702,12 +736,13 @@ class PlateButton(wx.Control):
|
|||||||
self.Bind(wx.EVT_MENU_CLOSE, self.OnMenuClose)
|
self.Bind(wx.EVT_MENU_CLOSE, self.OnMenuClose)
|
||||||
self.InvalidateBestSize()
|
self.InvalidateBestSize()
|
||||||
|
|
||||||
|
|
||||||
def SetPressColor(self, color):
|
def SetPressColor(self, color):
|
||||||
"""Set the color used for highlighting the pressed state
|
"""Set the color used for highlighting the pressed state
|
||||||
|
|
||||||
:param wx.Colour `color`: :class:`wx.Colour`
|
:param wx.Colour `color`: :class:`wx.Colour`
|
||||||
|
|
||||||
..note::
|
.. note::
|
||||||
also resets all text colours as necessary
|
also resets all text colours as necessary
|
||||||
|
|
||||||
"""
|
"""
|
||||||
@@ -720,6 +755,7 @@ class PlateButton(wx.Control):
|
|||||||
self._color['htxt'] = BestLabelColour(self._color['hlight'])
|
self._color['htxt'] = BestLabelColour(self._color['hlight'])
|
||||||
self.Refresh()
|
self.Refresh()
|
||||||
|
|
||||||
|
|
||||||
def SetWindowStyle(self, style):
|
def SetWindowStyle(self, style):
|
||||||
"""Sets the window style bytes, the updates take place
|
"""Sets the window style bytes, the updates take place
|
||||||
immediately no need to call refresh afterwards.
|
immediately no need to call refresh afterwards.
|
||||||
@@ -730,11 +766,13 @@ class PlateButton(wx.Control):
|
|||||||
self._style = style
|
self._style = style
|
||||||
self.Refresh()
|
self.Refresh()
|
||||||
|
|
||||||
|
|
||||||
def SetWindowVariant(self, variant):
|
def SetWindowVariant(self, variant):
|
||||||
"""Set the variant/font size of this control"""
|
"""Set the variant/font size of this control"""
|
||||||
super(PlateButton, self).SetWindowVariant(variant)
|
super(PlateButton, self).SetWindowVariant(variant)
|
||||||
self.InvalidateBestSize()
|
self.InvalidateBestSize()
|
||||||
|
|
||||||
|
|
||||||
def ShouldInheritColours(self):
|
def ShouldInheritColours(self):
|
||||||
"""Overridden base class virtual. If the parent has non-default
|
"""Overridden base class virtual. If the parent has non-default
|
||||||
colours then we want this control to inherit them.
|
colours then we want this control to inherit them.
|
||||||
@@ -742,6 +780,7 @@ class PlateButton(wx.Control):
|
|||||||
"""
|
"""
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
def ShowMenu(self):
|
def ShowMenu(self):
|
||||||
"""Show the dropdown menu if one is associated with this control"""
|
"""Show the dropdown menu if one is associated with this control"""
|
||||||
if self._menu is not None:
|
if self._menu is not None:
|
||||||
|
|||||||
Reference in New Issue
Block a user