diff --git a/wx/lib/agw/aui/aui_utilities.py b/wx/lib/agw/aui/aui_utilities.py index cdcbf8e4..52f2eca0 100644 --- a/wx/lib/agw/aui/aui_utilities.py +++ b/wx/lib/agw/aui/aui_utilities.py @@ -255,7 +255,7 @@ def LightColour(colour, percent): 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. """ diff --git a/wx/lib/agw/cubecolourdialog.py b/wx/lib/agw/cubecolourdialog.py index d007e31b..796d2b3a 100644 --- a/wx/lib/agw/cubecolourdialog.py +++ b/wx/lib/agw/cubecolourdialog.py @@ -1427,8 +1427,8 @@ def RestoreOldDC(dc, oldPen, oldBrush, oldMode): Restores the old settings for a :class:`wx.DC`. :param `dc`: an instance of :class:`wx.DC`; - :param `oldPen`: an instance of :class:`Pen`; - :param `oldBrush`: an instance of :class:`Brush`; + :param `oldPen`: an instance of :class:`wx.Pen`; + :param `oldBrush`: an instance of :class:`wx.Brush`; :param `oldMode`: the :class:`wx.DC` drawing mode bit. """ diff --git a/wx/lib/agw/customtreectrl.py b/wx/lib/agw/customtreectrl.py index f2bbe561..d8a37e66 100644 --- a/wx/lib/agw/customtreectrl.py +++ b/wx/lib/agw/customtreectrl.py @@ -81,7 +81,7 @@ to the standard :class:`TreeCtrl` behaviour this class supports: * Customized drag and drop images built on the fly; * Setting the :class:`CustomTreeCtrl` item buttons 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); * 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 @@ -4155,7 +4155,7 @@ class CustomTreeCtrl(wx.ScrolledWindow): """ 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. """ @@ -4168,7 +4168,7 @@ class CustomTreeCtrl(wx.ScrolledWindow): """ 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. """ @@ -4180,7 +4180,7 @@ class CustomTreeCtrl(wx.ScrolledWindow): """ 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 @@ -4191,7 +4191,7 @@ class CustomTreeCtrl(wx.ScrolledWindow): """ 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 diff --git a/wx/lib/agw/hypertreelist.py b/wx/lib/agw/hypertreelist.py index bb023586..8ee52183 100644 --- a/wx/lib/agw/hypertreelist.py +++ b/wx/lib/agw/hypertreelist.py @@ -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; * Setting the :class:`HyperTreeList` item buttons 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); * Ellipsization of long items when the horizontal space is low, via the ``TR_ELLIPSIZE_LONG_ITEMS`` style (`New in version 0.9.3`). diff --git a/wx/lib/agw/ultimatelistctrl.py b/wx/lib/agw/ultimatelistctrl.py index 8cb0128f..addf9f56 100644 --- a/wx/lib/agw/ultimatelistctrl.py +++ b/wx/lib/agw/ultimatelistctrl.py @@ -4446,9 +4446,9 @@ class UltimateListLineData(object): :param `highlighted`: ``True`` if the item is highlighted, ``False`` otherwise; :param `current`: ``True`` if the item is the current item; :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; - :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. """ diff --git a/wx/lib/floatcanvas/FloatCanvas.py b/wx/lib/floatcanvas/FloatCanvas.py index 1e05186f..850feb06 100644 --- a/wx/lib/floatcanvas/FloatCanvas.py +++ b/wx/lib/floatcanvas/FloatCanvas.py @@ -131,7 +131,7 @@ class FloatCanvas(wx.Panel): (Note: this really should get re-factored to allow more generic 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 information, could be improved. diff --git a/wx/lib/ogl/basic.py b/wx/lib/ogl/basic.py index 0242238e..725f44bc 100644 --- a/wx/lib/ogl/basic.py +++ b/wx/lib/ogl/basic.py @@ -3813,7 +3813,7 @@ class ShapeRegion(object): """ Set the pen style. - :param `style`: the style, see :class:`Pen` + :param `style`: the style, see :class:`wx.Pen` """ self._penStyle = style diff --git a/wx/lib/pdfviewer/dcgraphics.py b/wx/lib/pdfviewer/dcgraphics.py index 857f7ce5..7a7f2124 100644 --- a/wx/lib/pdfviewer/dcgraphics.py +++ b/wx/lib/pdfviewer/dcgraphics.py @@ -150,7 +150,7 @@ class dcGraphicsContext(object): also with increasing y down. :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, - 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. :param `context`: **TBW** (?) @@ -229,20 +229,20 @@ class dcGraphicsContext(object): 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. - :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) 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. - :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) diff --git a/wx/lib/platebtn.py b/wx/lib/platebtn.py index 636f5c64..226852b0 100644 --- a/wx/lib/platebtn.py +++ b/wx/lib/platebtn.py @@ -172,10 +172,11 @@ class PlateButton(wx.Control): self.Bind(wx.EVT_KEY_UP, self.OnKeyUp) self.Bind(wx.EVT_CONTEXT_MENU, lambda evt: self.ShowMenu()) + def __DrawBitmap(self, gc): """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 """ @@ -192,10 +193,11 @@ class PlateButton(wx.Control): else: return 6 + def __DrawDropArrow(self, gc, xpos, ypos): """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 `ypos`: y cord to start at @@ -215,10 +217,11 @@ class PlateButton(wx.Control): else: pass + def __DrawHighlight(self, gc, width, height): """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 `height`: height of highlight @@ -244,6 +247,7 @@ class PlateButton(wx.Control): gc.DrawRoundedRectangle(1, 1, width - 2, height - 2, rad) + def __PostEvent(self): """Post a button event to parent of this control""" if self._style & PB_STYLE_TOGGLE: @@ -255,6 +259,7 @@ class PlateButton(wx.Control): bevt.SetString(self.GetLabel()) self.GetEventHandler().ProcessEvent(bevt) + def __DrawButton(self): """Draw the button""" # 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) self.__DrawDropArrow(gc, width - 10, (height // 2) - 2) + def __InitColors(self): """Initialize the default colors""" color = GetHighlightColour() @@ -335,6 +341,7 @@ class PlateButton(wx.Control): htxt=BestLabelColour(self.GetForegroundColour())) return colors + def __LeaveWindow(self): """Handle updating the buttons state when the mouse cursor leaves""" if (self._style & PB_STYLE_TOGGLE) and self._pressed: @@ -343,15 +350,16 @@ class PlateButton(wx.Control): self._SetState(PLATE_NORMAL) self._pressed = False + def _SetState(self, state): """Manually set the state of the button :param `state`: one of the PLATE_* values - ..note:: + .. note:: the state may be altered by mouse actions - ..note:: + .. note:: Internal use only! """ @@ -362,6 +370,7 @@ class PlateButton(wx.Control): else: self.Refresh() + def _ToggleState(self): """Toggle button state @@ -391,15 +400,18 @@ class PlateButton(wx.Control): LabelText = property(lambda self: self.GetLabel(), lambda self, lbl: self.SetLabel(lbl)) + def AcceptsFocus(self): """Can this window have the focus?""" return self.IsEnabled() + def Disable(self): """Disable the control""" super(PlateButton, self).Disable() self.Refresh() + def DoGetBestSize(self): """Calculate the best size of the button @@ -433,15 +445,17 @@ class PlateButton(wx.Control): self.CacheBestSize(best) return best + def Enable(self, enable=True): """Enable/Disable the control""" super(PlateButton, self).Enable(enable) self.Refresh() + def GetBackgroundBrush(self, dc): """Get the brush for drawing the background of the button - :return: :class:`Brush` + :return: :class:`wx.Brush` ..note:: used internally when on gtk @@ -461,6 +475,7 @@ class PlateButton(wx.Control): brush = wx.Brush(bkgrd, wx.BRUSHSTYLE_SOLID) return brush + def GetBitmapDisabled(self): """Get the bitmap of the disable state @@ -469,6 +484,7 @@ class PlateButton(wx.Control): """ return self.BitmapDisabled + def GetBitmapLabel(self): """Get the label bitmap @@ -484,6 +500,7 @@ class PlateButton(wx.Control): # Alias for GetLabel GetLabelText = wx.Control.GetLabel + def GetMenu(self): """Return the menu associated with this button or None if no menu is associated with it. @@ -491,21 +508,24 @@ class PlateButton(wx.Control): """ return self._menu + def GetState(self): """Get the current state of the button :return: int - ..seeAlso:: + .. seeAlso:: PLATE_NORMAL, PLATE_HIGHLIGHT, PLATE_PRESSED """ return self._state['cur'] + def HasTransparentBackground(self): """Override setting of background fill""" return True + def IsPressed(self): """Return if button is pressed (PB_STYLE_TOGGLE) @@ -514,6 +534,7 @@ class PlateButton(wx.Control): """ return self._pressed + #---- Event Handlers ----# def OnErase(self, evt): @@ -525,11 +546,13 @@ class PlateButton(wx.Control): """ pass + def OnFocus(self, evt): """Set the visual focus state if need be""" if self._state['cur'] == PLATE_NORMAL: self._SetState(PLATE_HIGHLIGHT) + def OnKeyUp(self, evt): """Execute a single button press action when the Return key is pressed and this control has the focus. @@ -544,6 +567,7 @@ class PlateButton(wx.Control): else: evt.Skip() + def OnKillFocus(self, evt): """Set the visual state back to normal when focus is lost unless the control is currently in a pressed state. @@ -555,6 +579,7 @@ class PlateButton(wx.Control): if self._state['cur'] != PLATE_PRESSED: self._SetState(PLATE_NORMAL) + def OnLeftDown(self, evt): """Sets the pressed state and depending on the click position will show the popup menu if one has been set. @@ -576,11 +601,12 @@ class PlateButton(wx.Control): self.SetFocus() + def OnLeftUp(self, evt): """Post a button event if the control was previously in a pressed state. - :param `evt`: :class:`MouseEvent` + :param `evt`: :class:`wx.MouseEvent` """ if self._state['cur'] == PLATE_PRESSED: @@ -594,6 +620,7 @@ class PlateButton(wx.Control): else: self._SetState(PLATE_HIGHLIGHT) + def OnMenuClose(self, evt): """Refresh the control to a proper state after the menu has been dismissed. @@ -610,6 +637,7 @@ class PlateButton(wx.Control): #---- End Event Handlers ----# + def SetBitmap(self, bmp): """Set the bitmap displayed in the button @@ -622,6 +650,7 @@ class PlateButton(wx.Control): self._bmp['disable'] = img.ConvertToBitmap() self.InvalidateBestSize() + def SetBitmapDisabled(self, bmp): """Set the bitmap for the disabled state @@ -636,26 +665,30 @@ class PlateButton(wx.Control): SetBitmapLabel = SetBitmap SetBitmapSelected = SetBitmap + def SetFocus(self): """Set this control to have the focus""" if self._state['cur'] != PLATE_PRESSED: self._SetState(PLATE_HIGHLIGHT) super(PlateButton, self).SetFocus() + def SetFont(self, font): """Adjust size of control when font changes""" super(PlateButton, self).SetFont(font) self.InvalidateBestSize() + def SetLabel(self, label): """Set the label of the button - :param string `label`: lable string + :param string `label`: label string """ super(PlateButton, self).SetLabel(label) self.InvalidateBestSize() + def SetLabelColor(self, normal, hlight=wx.NullColour): """Set the color of the label. The optimal label color is usually automatically selected depending on the button color. In some @@ -685,13 +718,14 @@ class PlateButton(wx.Control): else: self.Refresh() + def SetMenu(self, menu): """Set the menu that can be shown when clicking on the drop arrow of the button. :param wx.Menu `menu`: :class:`wx.Menu` to use as a PopupMenu - ..note:: + .. note:: 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.InvalidateBestSize() + def SetPressColor(self, color): """Set the color used for highlighting the pressed state :param wx.Colour `color`: :class:`wx.Colour` - ..note:: + .. note:: also resets all text colours as necessary """ @@ -720,6 +755,7 @@ class PlateButton(wx.Control): self._color['htxt'] = BestLabelColour(self._color['hlight']) self.Refresh() + def SetWindowStyle(self, style): """Sets the window style bytes, the updates take place immediately no need to call refresh afterwards. @@ -730,11 +766,13 @@ class PlateButton(wx.Control): self._style = style self.Refresh() + def SetWindowVariant(self, variant): """Set the variant/font size of this control""" super(PlateButton, self).SetWindowVariant(variant) self.InvalidateBestSize() + def ShouldInheritColours(self): """Overridden base class virtual. If the parent has non-default colours then we want this control to inherit them. @@ -742,6 +780,7 @@ class PlateButton(wx.Control): """ return True + def ShowMenu(self): """Show the dropdown menu if one is associated with this control""" if self._menu is not None: