]>
Commit | Line | Data |
---|---|---|
caeac82e RD |
1 | __author__ = "E. A. Tacao <e.a.tacao |at| estadao.com.br>" |
2 | __date__ = "15 Fev 2006, 22:00 GMT-03:00" | |
3 | __version__ = "0.02" | |
4 | __doc__ = """ | |
5 | AnalogClock - an analog clock. | |
6 | ||
7 | This control creates an analog clock window. Its features include shadowing, | |
8 | the ability to render numbers as well as any arbitrary polygon as tick marks, | |
9 | resize marks and hands proportionally as the widget itself is resized, rotate | |
10 | marks in a way the get aligned to the watch. It also has a dialog, accessed | |
11 | via a context menu item, allowing one to change on the fly all of its settings. | |
12 | ||
13 | ||
14 | Usage: | |
15 | ||
16 | AnalogClock(parent, id=-1, pos=wx.DefaultPosition, | |
17 | size=wx.DefaultSize, style=wx.NO_BORDER, name="AnalogClock", | |
18 | clockStyle=DEFAULT_CLOCK_STYLE, | |
19 | minutesStyle=TICKS_CIRCLE, hoursStyle=TICKS_POLY) | |
20 | ||
21 | - parent, id, pos, size, style and name are used as in a wx.Window. Please | |
22 | refer to the wx.Window docs for more details. | |
23 | ||
24 | - clockStyle defines the clock style, according to the options below: | |
25 | ||
26 | ==================== ================================ | |
27 | SHOW_QUARTERS_TICKS Show marks for hours 3, 6, 9, 12 | |
28 | SHOW_HOURS_TICKS Show marks for all hours | |
29 | SHOW_MINUTES_TICKS Show marks for minutes | |
30 | ||
31 | SHOW_HOURS_HAND Show hours hand | |
32 | SHOW_MINUTES_HAND Show minutes hand | |
33 | SHOW_SECONDS_HAND Show seconds hand | |
34 | ||
35 | SHOW_SHADOWS Show hands and marks shadows | |
36 | ||
37 | ROTATE_TICKS Align tick marks to watch | |
38 | OVERLAP_TICKS Draw tick marks for minutes even | |
39 | when they match the hours marks. | |
40 | ||
41 | DEFAULT_CLOCK_STYLE The same as SHOW_HOURS_TICKS| | |
42 | SHOW_MINUTES_TICKS| | |
43 | SHOW_HOURS_HAND| | |
44 | SHOW_MINUTES_HAND| | |
45 | SHOW_SECONDS_HAND| | |
46 | SHOW_SHADOWS|ROTATE_TICKS | |
47 | ==================== ================================ | |
48 | ||
49 | - minutesStyle and hoursStyle define the the tick styles, according to the | |
50 | options below: | |
51 | ||
52 | ================= ====================================== | |
53 | TICKS_NONE Don't show tick marks. | |
54 | TICKS_SQUARE Use squares as tick marks. | |
55 | TICKS_CIRCLE Use circles as tick marks. | |
56 | TICKS_POLY Use a polygon as tick marks. A | |
57 | polygon can be passed using | |
58 | SetTickPolygon, otherwise the default | |
59 | polygon will be used. | |
60 | TICKS_DECIMAL Use decimal numbers as tick marks. | |
61 | TICKS_ROMAN Use Roman numbers as tick marks. | |
62 | TICKS_BINARY Use binary numbers as tick marks. | |
63 | TICKS_HEX Use hexadecimal numbers as tick marks. | |
64 | ================= ====================================== | |
65 | ||
66 | ||
67 | Notes: | |
68 | ||
69 | The 'target' keyword that's present in various of the AnalogClock methods may | |
70 | accept one (or more, combined using '|') of the following values: | |
71 | ||
72 | ========= =========================================== | |
73 | HOUR The values passed/retrieved are related to | |
74 | the hours hand/ticks | |
75 | ||
76 | MINUTE The values passed/retrieved are related to | |
77 | the minutes hand/ticks | |
78 | ||
79 | SECOND The values passed/retrieved are related to | |
80 | the seconds hand/ticks | |
81 | ||
82 | ALL The same as HOUR|MINUTE|SECOND, i. e., the | |
83 | values passed/retrieved are related to all | |
84 | of the hours hands/ticks. This is the | |
85 | default value in all methods. | |
86 | ========= =========================================== | |
87 | ||
88 | It is legal to pass target=ALL to methods that don't handle seconds (tick | |
89 | mark related methods). In such cases, ALL will be equivalent to HOUR|MINUTE. | |
90 | ||
91 | All of the 'Get' AnalogClock methods that allow the 'target' keyword | |
92 | will always return a tuple, e. g.: | |
93 | ||
94 | ================================= ======================================== | |
95 | GetHandSize(target=HOUR) Returns a 1 element tuple, containing | |
96 | the size of the hours hand. | |
97 | ||
98 | GetHandSize(target=HOUR|MINUTE) Returns a 2 element tuple, containing | |
99 | the sizes of the hours and the minutes | |
100 | hands, respectively. | |
101 | ||
102 | GetHandSize(target=ALL) Returns a 3 element tuple, containing | |
103 | or the sizes of the hours, minutes and | |
104 | GetHandSize() seconds hands, respectively. | |
105 | ================================= ======================================== | |
106 | ||
107 | ||
108 | About: | |
109 | ||
110 | Most of the ideas and part of the code of AnalogClock were based on the | |
111 | original wxPython's AnalogClock module, which was created by several folks on | |
112 | the wxPython-users list. | |
113 | ||
114 | AnalogClock is distributed under the wxWidgets license. | |
115 | ||
116 | This code should meet the wxPython Coding Guidelines | |
117 | <http://www.wxpython.org/codeguidelines.php> and the wxPython Style Guide | |
118 | <http://wiki.wxpython.org/index.cgi/wxPython_20Style_20Guide>. | |
119 | ||
120 | For all kind of problems, requests, enhancements, bug reports, etc, | |
121 | please drop me an e-mail. | |
122 | ||
123 | For updates please visit <http://j.domaindlx.com/elements28/wxpython/>. | |
124 | """ | |
125 | ||
126 | # History: | |
127 | # | |
128 | # Version 0.02: | |
129 | # - Module/namespace rearranges; | |
130 | # - All '-1' occurrences meaning "use any id" were eliminated or replaced | |
131 | # to 'wx.ID_ANY'. | |
132 | # - Better names to the methods triggered by the context menu events. | |
133 | # - Included small demo class code in analogclock.py. | |
134 | # Version 0.01: | |
135 | # - Initial release. | |
136 | ||
137 | #---------------------------------------------------------------------- | |
138 | ||
139 | from analogclock import AnalogClock, AnalogClockWindow | |
140 | from styles import * | |
141 | ||
142 | # | |
143 | ## | |
144 | ### eof |