speedmeter FONT fixes

This commit is contained in:
Metallicow
2016-10-04 14:34:47 -05:00
committed by Robin Dunn
parent c4769f59ae
commit 805b30a9f2

View File

@@ -69,7 +69,7 @@ Usage example::
class MyFrame(wx.Frame):
def __init__(self, parent):
wx.Frame.__init__(self, parent, -1, "SpeedMeter Demo")
speed = SM.SpeedMeter(self, agwStyle=SM.SM_DRAW_HAND|SM.SM_DRAW_SECTORS|SM.SM_DRAW_MIDDLE_TEXT|SM.SM_DRAW_SECONDARY_TICKS)
@@ -77,7 +77,7 @@ Usage example::
# Set The Region Of Existence Of SpeedMeter (Always In Radians!!!!)
speed.SetAngleRange(-pi/6, 7*pi/6)
# Create The Intervals That Will Divide Our SpeedMeter In Sectors
# Create The Intervals That Will Divide Our SpeedMeter In Sectors
intervals = range(0, 201, 20)
speed.SetIntervals(intervals)
@@ -95,14 +95,14 @@ Usage example::
speed.SetNumberOfSecondaryTicks(5)
# Set The Font For The Ticks Markers
speed.SetTicksFont(wx.Font(7, wx.SWISS, wx.NORMAL, wx.NORMAL))
speed.SetTicksFont(wx.Font(7, wx.FONTFAMILY_SWISS, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL))
# Set The Text In The Center Of SpeedMeter
speed.SetMiddleText("Km/h")
# Assign The Colour To The Center Text
speed.SetMiddleTextColour(wx.WHITE)
# Assign A Font To The Center Text
speed.SetMiddleTextFont(wx.Font(8, wx.SWISS, wx.NORMAL, wx.BOLD))
speed.SetMiddleTextFont(wx.Font(8, wx.FONTFAMILY_SWISS, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD))
# Set The Colour For The Hand Indicator
speed.SetHandColour(wx.Colour(255, 50, 0))
@@ -110,12 +110,12 @@ Usage example::
# Do Not Draw The External (Container) Arc. Drawing The External Arc May
# Sometimes Create Uglier Controls. Try To Comment This Line And See It
# For Yourself!
speed.DrawExternalArc(False)
speed.DrawExternalArc(False)
# Set The Current Value For The SpeedMeter
speed.SetSpeedValue(44)
# our normal wxApp-derived class, as usual
app = wx.App(0)
@@ -235,7 +235,7 @@ SM_BUFFERED_DC = 1
# SM_DRAW_FANCY_TICKS: With This Style You Can Use XML Tags To Create
# Some Custom Text And Draw It At The Ticks Position.
# See wx.lib.fancytext For The Tags.
SM_ROTATE_TEXT = 1
""" Draws the ticks rotated: the ticks are rotated accordingly to the tick marks positions. """
SM_DRAW_SECTORS = 2
@@ -332,14 +332,14 @@ class BufferedWindow(wx.Window):
# This might result in OnSize getting called twice on some
# platforms at initialization, but little harm done.
self.doSetWindowCreated(None)
def doSetWindowCreated(self, evt):
"""
Method to call OnSize on GTK when window is created.
"""
self._isWindowCreated = True
self.OnSize(None)
def Draw(self, dc):
"""
This method should be overridden when sub-classed.
@@ -370,17 +370,17 @@ class BufferedWindow(wx.Window):
:param `event`: a :class:`wx.SizeEvent` event to be processed.
"""
self.Width, self.Height = self.GetClientSize()
# Make new off screen bitmap: this bitmap will always have the
# current drawing in it, so it can be used to save the image to
# a file, or whatever.
# Some platforms object to creating bitmaps with size < (1,1)
self.Width = max(self.Width, 1)
self.Height = max(self.Height, 1)
self._Buffer = wx.Bitmap(self.Width, self.Height)
if self._isWindowCreated:
self.UpdateDrawing()
@@ -452,7 +452,7 @@ class SpeedMeter(BufferedWindow):
``SM_DRAW_GRADIENT`` 0x200 A gradient of colours will fill the control.
``SM_DRAW_FANCY_TICKS`` 0x400 With this style you can use xml tags to create some custom text and draw it at the ticks position. See :mod:`lib.fancytext` for the tags.
=========================== =========== ==================================================
:param `bufferedstyle`: this value allows you to use the normal :class:`PaintDC` or the
double buffered drawing options:
@@ -1190,7 +1190,7 @@ class SpeedMeter(BufferedWindow):
Sets the range of existence for :class:`SpeedMeter`.
:param `start`: the starting angle, in radians;
:param `end`: the ending angle, in radians.
:param `end`: the ending angle, in radians.
"""
self._anglerange = [start, end]
@@ -1212,7 +1212,7 @@ class SpeedMeter(BufferedWindow):
:param `colours`: a Python list of colours. The length of this list should be
the same as the number of circle sectors in :class:`SpeedMeter`. If defaulted to ``None``,
all the intervals will have a white colour.
:note: Every interval (circle sector) should have a colour.
"""
@@ -1291,7 +1291,7 @@ class SpeedMeter(BufferedWindow):
"""
if font is None:
self._originalfont = [wx.Font(10, wx.SWISS, wx.NORMAL, wx.BOLD, False)]
self._originalfont = [wx.Font(10, wx.FONTFAMILY_SWISS, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD, False)]
self._originalsize = 10
else:
self._originalfont = [font]
@@ -1502,7 +1502,7 @@ class SpeedMeter(BufferedWindow):
"""
if font is None:
self._middletextfont = wx.Font(1, wx.SWISS, wx.NORMAL, wx.BOLD, False)
self._middletextfont = wx.Font(1, wx.FONTFAMILY_SWISS, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD, False)
self._middletextsize = 10.0
self._middletextfont.SetPointSize(self._middletextsize)
else:
@@ -1569,7 +1569,7 @@ class SpeedMeter(BufferedWindow):
:param `radius`: the :class:`SpeedMeter` radius;
:param `angle`: the angular position of the mouse;
:param `centerX`: the `x` position of the :class:`SpeedMeter` center;
:param `centerX`: the `y` position of the :class:`SpeedMeter` center.
:param `centerX`: the `y` position of the :class:`SpeedMeter` center.
"""
x = radius*cos(angle) + centerX