mirror of
https://github.com/wxWidgets/Phoenix.git
synced 2026-01-05 11:30:06 +01:00
Trim Whitespace analogclock directory
This commit is contained in:
@@ -7,7 +7,7 @@ AnalogClock - an analog clock.
|
||||
This control creates an analog clock window. Its features include shadowing,
|
||||
the ability to render numbers as well as any arbitrary polygon as tick marks,
|
||||
resize marks and hands proportionally as the widget itself is resized, rotate
|
||||
marks in a way the get aligned to the watch. It also has a dialog, accessed
|
||||
marks in a way the get aligned to the watch. It also has a dialog, accessed
|
||||
via a context menu item, allowing one to change on the fly all of its settings.
|
||||
|
||||
|
||||
@@ -113,7 +113,7 @@ the wxPython-users list.
|
||||
|
||||
AnalogClock is distributed under the wxWidgets license.
|
||||
|
||||
This code should meet the wxPython Coding Guidelines
|
||||
This code should meet the wxPython Coding Guidelines
|
||||
<http://www.wxpython.org/codeguidelines.php> and the wxPython Style Guide
|
||||
<http://wiki.wxpython.org/index.cgi/wxPython_20Style_20Guide>.
|
||||
|
||||
@@ -127,7 +127,7 @@ For updates please visit <http://j.domaindlx.com/elements28/wxpython/>.
|
||||
#
|
||||
# Version 0.02:
|
||||
# - Module/namespace rearranges;
|
||||
# - All '-1' occurrences meaning "use any id" were eliminated or replaced
|
||||
# - All '-1' occurrences meaning "use any id" were eliminated or replaced
|
||||
# to 'wx.ID_ANY'.
|
||||
# - Better names to the methods triggered by the context menu events.
|
||||
# - Included small demo class code in analogclock.py.
|
||||
|
||||
@@ -98,7 +98,7 @@ class AnalogClock(wx.Window):
|
||||
# Do initial drawing (in case there is not an initial size event)
|
||||
self.RecalcCoords(self.GetSize())
|
||||
self.DrawBox()
|
||||
|
||||
|
||||
# Initialize the timer that drives the update of the clock face.
|
||||
# Update every half second to ensure that there is at least one true
|
||||
# update during each realtime second.
|
||||
@@ -112,7 +112,7 @@ class AnalogClock(wx.Window):
|
||||
size = wx.Size(50,50)
|
||||
self.CacheBestSize(size)
|
||||
return size
|
||||
|
||||
|
||||
|
||||
def _OnSize(self, evt):
|
||||
size = self.GetClientSize()
|
||||
@@ -131,7 +131,7 @@ class AnalogClock(wx.Window):
|
||||
def _OnTimer(self, evt):
|
||||
self.Refresh(False)
|
||||
self.Update()
|
||||
|
||||
|
||||
|
||||
def _OnDestroyWindow(self, evt):
|
||||
self.timer.Stop()
|
||||
@@ -336,7 +336,7 @@ class AnalogClock(wx.Window):
|
||||
self.RecalcCoords(size)
|
||||
self.DrawBox()
|
||||
self.Refresh(False)
|
||||
|
||||
|
||||
|
||||
def SetHandSize(self, size, target=ALL):
|
||||
"""Sets thickness of hands."""
|
||||
@@ -590,10 +590,10 @@ class AnalogClockWindow(AnalogClock):
|
||||
|
||||
def SetMinutesOffset(self, o):
|
||||
pass
|
||||
|
||||
|
||||
def SetShadowColour(self, s):
|
||||
pass
|
||||
|
||||
|
||||
def SetWatchPenBrush(self, p=None, b=None):
|
||||
if p:
|
||||
self.SetFaceBorderColour(p.GetColour())
|
||||
@@ -611,7 +611,7 @@ class AnalogClockWindow(AnalogClock):
|
||||
if m:
|
||||
self.SetTickStyle(h, MINUTE)
|
||||
|
||||
|
||||
|
||||
# Test stuff ----------------------------------------------------------
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
@@ -61,8 +61,8 @@ class Element:
|
||||
|
||||
def RecalcCoords(self, clocksize, centre, scale):
|
||||
pass
|
||||
|
||||
|
||||
|
||||
|
||||
def GetSize(self):
|
||||
return self.size
|
||||
|
||||
@@ -77,8 +77,8 @@ class Element:
|
||||
|
||||
def GetMaxSize(self, scale=1):
|
||||
return self.size * scale
|
||||
|
||||
|
||||
|
||||
|
||||
def GetScale(self):
|
||||
return self.scale
|
||||
|
||||
@@ -147,7 +147,7 @@ class ElementWithDyer(Element):
|
||||
def GetShadowColour(self):
|
||||
return self.dyer.GetShadowColour()
|
||||
|
||||
|
||||
|
||||
def SetFillColour(self, colour):
|
||||
self.dyer.SetFillColour(colour)
|
||||
|
||||
@@ -158,8 +158,8 @@ class ElementWithDyer(Element):
|
||||
|
||||
def SetBorderWidth(self, width):
|
||||
self.dyer.SetBorderWidth(width)
|
||||
|
||||
|
||||
|
||||
|
||||
def SetShadowColour(self, colour):
|
||||
self.dyer.SetShadowColour(colour)
|
||||
|
||||
@@ -263,7 +263,7 @@ class TickPoly(Element):
|
||||
|
||||
width = max([x for x, y in polygon])
|
||||
height = max([y for x, y in polygon])
|
||||
|
||||
|
||||
return polygon, width, height
|
||||
|
||||
|
||||
@@ -381,7 +381,7 @@ class TickNone(Element):
|
||||
|
||||
def Draw(self, dc, offset=0):
|
||||
pass
|
||||
|
||||
|
||||
#----------------------------------------------------------------------
|
||||
|
||||
class Dyer:
|
||||
@@ -484,7 +484,7 @@ class HandSet:
|
||||
# else prevent exceptions on leap seconds
|
||||
elif idx <= 0 or idx > 60:
|
||||
idx = 59
|
||||
# and adjust idx offset for minutes and non-leap seconds
|
||||
# and adjust idx offset for minutes and non-leap seconds
|
||||
else:
|
||||
idx = idx - 1
|
||||
angle = math.radians(180 - 6 * (idx + 1))
|
||||
@@ -594,7 +594,7 @@ class TickSet:
|
||||
|
||||
def _draw(self, dc, shadow=False):
|
||||
dc.SetFont(self.font)
|
||||
|
||||
|
||||
a_tick = self.ticks[0]
|
||||
|
||||
if shadow:
|
||||
@@ -670,7 +670,7 @@ class TickSet:
|
||||
a_tick.GetOffset() * scale - \
|
||||
self.parent.shadowOffset * scale
|
||||
|
||||
# If we are a set of hours, the number of elements of this tickset is
|
||||
# If we are a set of hours, the number of elements of this tickset is
|
||||
# 12 and ticks are separated by a distance of 30 degrees;
|
||||
# if we are a set of minutes, the number of elements of this tickset is
|
||||
# 60 and ticks are separated by a distance of 6 degrees.
|
||||
|
||||
@@ -17,13 +17,13 @@ from wx.lib.buttons import GenButton
|
||||
|
||||
class FontSelect(GenButton):
|
||||
def __init__(self, parent, size=(75, 21), value=None):
|
||||
GenButton.__init__(self, parent, wx.ID_ANY, label="Select...",
|
||||
GenButton.__init__(self, parent, wx.ID_ANY, label="Select...",
|
||||
size=size)
|
||||
self.SetBezelWidth(1)
|
||||
|
||||
self.parent = parent
|
||||
self.SetValue(value)
|
||||
|
||||
|
||||
self.parent.Bind(wx.EVT_BUTTON, self.OnClick, self)
|
||||
|
||||
|
||||
|
||||
@@ -109,7 +109,7 @@ class _GroupBase(wx.Panel):
|
||||
def OnChoice(self, evt):
|
||||
self.clock.SetWindowStyle(eval(evt.GetString()))
|
||||
|
||||
|
||||
|
||||
def UpdateControls(self):
|
||||
if hasattr(self, "ft"):
|
||||
self.ft.SetValue(self.clock.GetTickFont(self.target)[0])
|
||||
@@ -236,7 +236,7 @@ class _Group_3(_Group_1):
|
||||
sizer.Detach(widget)
|
||||
widget.Destroy()
|
||||
sizer.Layout()
|
||||
|
||||
|
||||
p = wx.StaticText(self, label="Shadow:")
|
||||
sizer.Add(p, pos=(2, 0), flag=wx.ALIGN_CENTRE_VERTICAL)
|
||||
|
||||
@@ -428,7 +428,7 @@ class Setup(wx.Dialog):
|
||||
|
||||
self.SetSizerAndFit(sizer)
|
||||
wx.CallAfter(self.UpdateControls)
|
||||
|
||||
|
||||
|
||||
def OnClose(self, evt):
|
||||
self.Hide()
|
||||
|
||||
Reference in New Issue
Block a user