]> git.saurik.com Git - wxWidgets.git/blame - wxPython/wx/lib/analogclockopts.py
DocView patches from Morgen Hua: bug fixes, and additional SVN
[wxWidgets.git] / wxPython / wx / lib / analogclockopts.py
CommitLineData
f04ad14a 1#----------------------------------------------------------------------
4e5d278c 2# Name: wx.lib.analogclockopts
f04ad14a
RD
3# Purpose: An analog clock window - setup frame
4#
5# Author: E. A. Tacao
6#
7# Created: 15-February-2004
8#----------------------------------------------------------------------
9
d6dabac0
RD
10# Originally generated by wx.Glade 0.3.1 on Wed Feb 18 00:05:35 2004
11# Converted to wx namespace by Peter Damoc
f04ad14a 12
4e5d278c
RD
13"""
14A configuration dialog (frame actually) for the AnalogClockWindow
15"""
16
d6dabac0
RD
17
18import wx
19import wx.lib.colourselect as csel
20import wx.lib.dialogs as dlgs
f04ad14a
RD
21import string
22
d6dabac0
RD
23class ACCustomizationFrame(wx.Frame):
24 def __init__(self, parent, id, name, pos=wx.DefaultPosition, size=wx.DefaultSize,
25 style=wx.DEFAULT_FRAME_STYLE | wx.FRAME_NO_TASKBAR | wx.FRAME_FLOAT_ON_PARENT | wx.WANTS_CHARS):
26 # k=wx.NewId();ide=map(lambda x: x+k, range(0,100))
27 ide = [wx.NewId() for i in range(100)]
28
29 #kwds["style"] = wx.CAPTION|wx.SYSTEM_MENU
30 #wx.Frame.__init__(self, *args, **kwds)
31 wx.Frame.__init__(self, parent, id, name, pos, size, style)
f04ad14a 32 self.parent=parent
d6dabac0
RD
33 self.panel_1 = wx.Panel(self, -1)
34 self.notebook_1 = wx.Notebook(self.panel_1, -1, style=0)
35 self.notebook_1_pane_3 = wx.Panel(self.notebook_1, -1)
36 self.notebook_1_pane_2 = wx.Panel(self.notebook_1, -1)
37 self.notebook_1_pane_1 = wx.Panel(self.notebook_1, -1)
38 self.label_top = wx.StaticText(self.panel_1, -1, "Use the options below to change the clock;\nthe main buttons on top of each category reset to its defaults.")
39 self.static_line_1 = wx.StaticLine(self.panel_1, -1)
40 self.button_1 = wx.Button(self.notebook_1_pane_1, ide[1], "SetClockStyle")
41 self.static_line_2 = wx.StaticLine(self.notebook_1_pane_1, -1)
42 self.button_2 = wx.Button(self.notebook_1_pane_1, ide[3], "styles...")
43 self.static_line_3 = wx.StaticLine(self.notebook_1_pane_1, -1, style=wx.LI_VERTICAL)
44 self.button_3 = wx.Button(self.notebook_1_pane_1, ide[2], "SetTickStyles")
45 self.static_line_4 = wx.StaticLine(self.notebook_1_pane_1, -1)
46 self.button_4 = wx.Button(self.notebook_1_pane_1, ide[4], "styles...")
47 self.button_22 = wx.Button(self.notebook_1_pane_1, ide[22], "minutes...")
48 self.static_line_5 = wx.StaticLine(self.notebook_1_pane_1, -1)
49 self.button_5 = wx.Button(self.notebook_1_pane_1, ide[5], "SetShadowColour")
50 self.static_line_6 = wx.StaticLine(self.notebook_1_pane_1, -1)
51 self.button_6 = csel.ColourSelect(self.notebook_1_pane_1, ide[6], "all...")
52 self.static_line_7 = wx.StaticLine(self.notebook_1_pane_1, -1, style=wx.LI_VERTICAL)
53 self.button_7 = wx.Button(self.notebook_1_pane_1, ide[7], "SetWatchPenBrush")
54 self.static_line_8 = wx.StaticLine(self.notebook_1_pane_1, -1)
55 self.button_8 = csel.ColourSelect(self.notebook_1_pane_1, ide[8], "Pen colour...")
56 self.button_9 = csel.ColourSelect(self.notebook_1_pane_1, ide[9], "Brush colour...")
57 self.button_10 = wx.Button(self.notebook_1_pane_2, ide[10], "SetTickColours")
58 self.static_line_8 = wx.StaticLine(self.notebook_1_pane_2, -1)
59 self.button_11 = csel.ColourSelect(self.notebook_1_pane_2, ide[11], "hours...", colour=self.parent.tickMarkHoursPen.GetColour())
60 self.button_12 = csel.ColourSelect(self.notebook_1_pane_2, ide[12], "minutes...", colour=self.parent.tickMarkMinutesPen.GetColour())
61 self.static_line_10 = wx.StaticLine(self.notebook_1_pane_2, -1, style=wx.LI_VERTICAL)
62 self.button_13 = wx.Button(self.notebook_1_pane_2, ide[13], "SetTickSizes")
63 self.static_line_11 = wx.StaticLine(self.notebook_1_pane_2, -1)
64 self.label_1 = wx.StaticText(self.notebook_1_pane_2, -1, "hours")
65 self.spin_ctrl_1 = wx.SpinCtrl(self.notebook_1_pane_2, ide[71], "10", min=1, max=100)
66 self.label_2 = wx.StaticText(self.notebook_1_pane_2, -1, "minutes")
67 self.spin_ctrl_2 = wx.SpinCtrl(self.notebook_1_pane_2, ide[72], "5", min=0, max=100)
68 self.label_3 = wx.StaticText(self.notebook_1_pane_2, -1, "offset")
69 self.spin_ctrl_3 = wx.SpinCtrl(self.notebook_1_pane_2, ide[73], "0", min=0, max=100)
70 self.static_line_12 = wx.StaticLine(self.notebook_1_pane_2, -1, style=wx.LI_VERTICAL)
71 self.button_14 = wx.Button(self.notebook_1_pane_2, ide[14], "SetTickFonts")
72 self.static_line_13 = wx.StaticLine(self.notebook_1_pane_2, -1)
73 self.button_15 = wx.Button(self.notebook_1_pane_2, ide[15], "hours...")
74 self.button_16 = wx.Button(self.notebook_1_pane_2, ide[16], "minutes...")
75 self.button_17 = wx.Button(self.notebook_1_pane_3, ide[17], "SetHandWeights")
76 self.static_line_14 = wx.StaticLine(self.notebook_1_pane_3, -1)
77 self.label_4 = wx.StaticText(self.notebook_1_pane_3, -1, "hours")
78 self.spin_ctrl_4 = wx.SpinCtrl(self.notebook_1_pane_3, ide[74], "5", min=0, max=100)
79 self.label_5 = wx.StaticText(self.notebook_1_pane_3, -1, "minutes")
80 self.spin_ctrl_5 = wx.SpinCtrl(self.notebook_1_pane_3, ide[75], "3", min=0, max=100)
81 self.label_6 = wx.StaticText(self.notebook_1_pane_3, -1, "seconds")
82 self.spin_ctrl_6 = wx.SpinCtrl(self.notebook_1_pane_3, ide[76], "1", min=0, max=100)
83 self.static_line_15 = wx.StaticLine(self.notebook_1_pane_3, -1, style=wx.LI_VERTICAL)
84 self.button_18 = wx.Button(self.notebook_1_pane_3, ide[18], "SetHandColours")
85 self.static_line_16 = wx.StaticLine(self.notebook_1_pane_3, -1)
86 self.button_19 = csel.ColourSelect(self.notebook_1_pane_3, ide[19], "hours...")
87 self.button_20 = csel.ColourSelect(self.notebook_1_pane_3, ide[20], "minutes...")
88 self.button_21 = csel.ColourSelect(self.notebook_1_pane_3, ide[21], "seconds...")
f04ad14a
RD
89
90 self.__set_properties()
91 self.__do_layout()
d6dabac0
RD
92
93
94 self.Bind(wx.EVT_BUTTON, self.OnEventsHook, id=ide[0], id2=ide[29])
95 self.Bind(csel.EVT_COLOURSELECT, self.OnEventsHook, id=ide[0], id2=ide[29])
96 self.Bind(wx.EVT_SPINCTRL, self.OnEventsHook, id=ide[71], id2=ide[80])
97 self.Bind(wx.EVT_RADIOBUTTON, self.OnEventsHook, id=ide[51], id2=ide[60])
98 self.Bind(wx.EVT_WINDOW_DESTROY, self.OnQuit)
f04ad14a
RD
99
100 self.ide=ide
101
102 def __set_properties(self):
f04ad14a
RD
103 #self.SetTitle("AnalogClock Test")
104 self.spin_ctrl_1.SetSize((50, -1))
105 self.spin_ctrl_2.SetSize((50, -1))
106 self.spin_ctrl_3.SetSize((50, -1))
107 self.spin_ctrl_4.SetSize((50, -1))
108 self.spin_ctrl_5.SetSize((50, -1))
109 self.spin_ctrl_6.SetSize((50, -1))
d6dabac0 110
f04ad14a
RD
111
112 def __do_layout(self):
d6dabac0
RD
113 sizer_frame = wx.BoxSizer(wx.HORIZONTAL)
114 sizer_main = wx.BoxSizer(wx.VERTICAL)
115 sizer_25 = wx.BoxSizer(wx.HORIZONTAL)
116 sizer_26 = wx.StaticBoxSizer(wx.StaticBox(self.notebook_1_pane_3, -1, ""), wx.VERTICAL)
117 sizer_27 = wx.BoxSizer(wx.HORIZONTAL)
118 sizer_31 = wx.BoxSizer(wx.VERTICAL)
119 sizer_33 = wx.BoxSizer(wx.HORIZONTAL)
120 sizer_32 = wx.BoxSizer(wx.HORIZONTAL)
121 sizer_28 = wx.BoxSizer(wx.VERTICAL)
122 sizer_30 = wx.BoxSizer(wx.HORIZONTAL)
123 sizer_29 = wx.BoxSizer(wx.HORIZONTAL)
124 sizer_12 = wx.BoxSizer(wx.HORIZONTAL)
125 sizer_13 = wx.StaticBoxSizer(wx.StaticBox(self.notebook_1_pane_2, -1, ""), wx.VERTICAL)
126 sizer_14 = wx.BoxSizer(wx.HORIZONTAL)
127 sizer_22 = wx.BoxSizer(wx.VERTICAL)
128 sizer_24 = wx.BoxSizer(wx.HORIZONTAL)
129 sizer_23 = wx.BoxSizer(wx.HORIZONTAL)
130 sizer_18 = wx.BoxSizer(wx.VERTICAL)
131 sizer_21 = wx.BoxSizer(wx.HORIZONTAL)
132 sizer_20 = wx.BoxSizer(wx.HORIZONTAL)
133 sizer_19 = wx.BoxSizer(wx.HORIZONTAL)
134 sizer_15 = wx.BoxSizer(wx.VERTICAL)
135 sizer_17 = wx.BoxSizer(wx.HORIZONTAL)
136 sizer_16 = wx.BoxSizer(wx.HORIZONTAL)
137 sizer_1 = wx.BoxSizer(wx.HORIZONTAL)
138 sizer_2 = wx.StaticBoxSizer(wx.StaticBox(self.notebook_1_pane_1, -1, ""), wx.VERTICAL)
139 sizer_8 = wx.BoxSizer(wx.HORIZONTAL)
140 sizer_11 = wx.BoxSizer(wx.VERTICAL)
141 sizer_12b = wx.BoxSizer(wx.HORIZONTAL)
142 sizer_9 = wx.BoxSizer(wx.VERTICAL)
143 sizer_10 = wx.BoxSizer(wx.HORIZONTAL)
144 sizer_3 = wx.BoxSizer(wx.HORIZONTAL)
145 sizer_6 = wx.BoxSizer(wx.VERTICAL)
146 sizer_7 = wx.BoxSizer(wx.HORIZONTAL)
147 sizer_4 = wx.BoxSizer(wx.VERTICAL)
148 sizer_5 = wx.BoxSizer(wx.HORIZONTAL)
149 sizer_main.Add(self.label_top, 0, wx.LEFT|wx.TOP, 5)
150 sizer_main.Add(self.static_line_1, 0, wx.TOP|wx.BOTTOM|wx.EXPAND, 10)
151 sizer_4.Add(self.button_1, 0, wx.ALL|wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL, 5)
152 sizer_4.Add(self.static_line_2, 0, wx.LEFT|wx.RIGHT|wx.EXPAND, 20)
153 sizer_5.Add(self.button_2, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5)
154 sizer_4.Add(sizer_5, 1, wx.ALIGN_CENTER_HORIZONTAL, 0)
155 sizer_3.Add(sizer_4, 1, wx.EXPAND, 0)
156 sizer_3.Add(self.static_line_3, 0, wx.EXPAND, 0)
157 sizer_6.Add(self.button_3, 0, wx.ALL|wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL, 5)
158 sizer_6.Add(self.static_line_4, 0, wx.LEFT|wx.RIGHT|wx.EXPAND, 20)
159 sizer_7.Add(self.button_4, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5)
160 sizer_7.Add(self.button_22, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5)
161 sizer_6.Add(sizer_7, 1, wx.ALIGN_CENTER_HORIZONTAL, 0)
162 sizer_3.Add(sizer_6, 1, wx.EXPAND, 0)
163 sizer_2.Add(sizer_3, 1, wx.EXPAND, 0)
164 sizer_2.Add(self.static_line_5, 0, wx.EXPAND, 0)
165 sizer_9.Add(self.button_5, 0, wx.ALL|wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL, 5)
166 sizer_9.Add(self.static_line_6, 0, wx.LEFT|wx.RIGHT|wx.EXPAND, 20)
167 sizer_10.Add(self.button_6, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5)
168 sizer_9.Add(sizer_10, 1, wx.ALIGN_CENTER_HORIZONTAL, 0)
169 sizer_8.Add(sizer_9, 1, wx.EXPAND, 0)
170 sizer_8.Add(self.static_line_7, 0, wx.EXPAND, 0)
171 sizer_11.Add(self.button_7, 0, wx.ALL|wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL, 5)
172 sizer_11.Add(self.static_line_8, 0, wx.LEFT|wx.RIGHT|wx.EXPAND, 20)
173 sizer_12b.Add(self.button_8, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5)
174 sizer_12b.Add(self.button_9, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5)
175 sizer_11.Add(sizer_12b, 1, wx.ALIGN_CENTER_HORIZONTAL, 0)
176 sizer_8.Add(sizer_11, 1, wx.EXPAND, 0)
177 sizer_2.Add(sizer_8, 1, wx.EXPAND, 0)
178 sizer_1.Add(sizer_2, 1, wx.EXPAND, 0)
f04ad14a
RD
179 self.notebook_1_pane_1.SetAutoLayout(1)
180 self.notebook_1_pane_1.SetSizer(sizer_1)
181 sizer_1.Fit(self.notebook_1_pane_1)
182 sizer_1.SetSizeHints(self.notebook_1_pane_1)
d6dabac0
RD
183 sizer_15.Add(self.button_10, 0, wx.ALL|wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL, 5)
184 sizer_15.Add(self.static_line_8, 0, wx.LEFT|wx.RIGHT|wx.EXPAND, 20)
185 sizer_16.Add(self.button_11, 0, wx.ALL|wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL, 5)
186 sizer_15.Add(sizer_16, 1, wx.ALIGN_CENTER_HORIZONTAL, 0)
187 sizer_17.Add(self.button_12, 0, wx.ALL|wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL, 5)
188 sizer_15.Add(sizer_17, 1, wx.ALIGN_CENTER_HORIZONTAL, 0)
189 sizer_14.Add(sizer_15, 1, wx.EXPAND, 0)
190 sizer_14.Add(self.static_line_10, 0, wx.EXPAND, 0)
191 sizer_18.Add(self.button_13, 0, wx.ALL|wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL, 5)
192 sizer_18.Add(self.static_line_11, 0, wx.LEFT|wx.RIGHT|wx.EXPAND, 20)
193 sizer_19.Add(self.label_1, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5)
194 sizer_19.Add(self.spin_ctrl_1, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5)
195 sizer_18.Add(sizer_19, 1, wx.ALIGN_CENTER_HORIZONTAL, 0)
196 sizer_20.Add(self.label_2, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5)
197 sizer_20.Add(self.spin_ctrl_2, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5)
198 sizer_18.Add(sizer_20, 1, wx.ALIGN_CENTER_HORIZONTAL, 0)
199 sizer_21.Add(self.label_3, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5)
200 sizer_21.Add(self.spin_ctrl_3, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5)
201 sizer_18.Add(sizer_21, 1, wx.ALIGN_CENTER_HORIZONTAL, 0)
202 sizer_14.Add(sizer_18, 1, wx.EXPAND, 0)
203 sizer_14.Add(self.static_line_12, 0, wx.EXPAND, 0)
204 sizer_22.Add(self.button_14, 0, wx.ALL|wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL, 5)
205 sizer_22.Add(self.static_line_13, 0, wx.LEFT|wx.RIGHT|wx.EXPAND, 20)
206 sizer_23.Add(self.button_15, 0, wx.ALL|wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL, 5)
207 sizer_22.Add(sizer_23, 1, wx.ALIGN_CENTER_HORIZONTAL, 0)
208 sizer_24.Add(self.button_16, 0, wx.ALL|wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL, 5)
209 sizer_22.Add(sizer_24, 1, wx.ALIGN_CENTER_HORIZONTAL, 0)
210 sizer_14.Add(sizer_22, 1, wx.EXPAND, 0)
211 sizer_13.Add(sizer_14, 1, wx.EXPAND, 0)
212 sizer_12.Add(sizer_13, 1, wx.EXPAND, 0)
f04ad14a
RD
213 self.notebook_1_pane_2.SetAutoLayout(1)
214 self.notebook_1_pane_2.SetSizer(sizer_12)
215 sizer_12.Fit(self.notebook_1_pane_2)
216 sizer_12.SetSizeHints(self.notebook_1_pane_2)
d6dabac0
RD
217 sizer_28.Add(self.button_17, 0, wx.ALL|wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL, 5)
218 sizer_28.Add(self.static_line_14, 0, wx.LEFT|wx.RIGHT|wx.EXPAND, 20)
219 sizer_29.Add(self.label_4, 0, wx.ALL|wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL, 5)
220 sizer_29.Add(self.spin_ctrl_4, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5)
221 sizer_29.Add(self.label_5, 0, wx.ALL|wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL, 5)
222 sizer_29.Add(self.spin_ctrl_5, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5)
223 sizer_28.Add(sizer_29, 1, wx.ALIGN_CENTER_HORIZONTAL, 0)
224 sizer_30.Add(self.label_6, 0, wx.ALL|wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL, 5)
225 sizer_30.Add(self.spin_ctrl_6, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5)
226 sizer_28.Add(sizer_30, 1, wx.ALIGN_CENTER_HORIZONTAL, 0)
227 sizer_27.Add(sizer_28, 1, wx.EXPAND, 0)
228 sizer_27.Add(self.static_line_15, 0, wx.EXPAND, 0)
229 sizer_31.Add(self.button_18, 0, wx.ALL|wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL, 5)
230 sizer_31.Add(self.static_line_16, 0, wx.LEFT|wx.RIGHT|wx.EXPAND, 20)
231 sizer_32.Add(self.button_19, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5)
232 sizer_32.Add(self.button_20, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5)
233 sizer_31.Add(sizer_32, 1, wx.ALIGN_CENTER_HORIZONTAL, 0)
234 sizer_33.Add(self.button_21, 0, wx.ALL|wx.ALIGN_CENTER_VERTICAL, 5)
235 sizer_31.Add(sizer_33, 1, wx.ALIGN_CENTER_HORIZONTAL, 0)
236 sizer_27.Add(sizer_31, 1, wx.EXPAND, 0)
237 sizer_26.Add(sizer_27, 1, wx.EXPAND, 0)
238 sizer_25.Add(sizer_26, 1, wx.EXPAND, 0)
f04ad14a
RD
239 self.notebook_1_pane_3.SetAutoLayout(1)
240 self.notebook_1_pane_3.SetSizer(sizer_25)
241 sizer_25.Fit(self.notebook_1_pane_3)
242 sizer_25.SetSizeHints(self.notebook_1_pane_3)
243 self.notebook_1.AddPage(self.notebook_1_pane_1, "Clock")
244 self.notebook_1.AddPage(self.notebook_1_pane_2, "Ticks")
245 self.notebook_1.AddPage(self.notebook_1_pane_3, "Hands")
d6dabac0 246 sizer_main.Add(wx.NotebookSizer(self.notebook_1), 1, wx.LEFT|wx.RIGHT|wx.BOTTOM|wx.EXPAND, 5)
f04ad14a
RD
247 self.panel_1.SetAutoLayout(1)
248 self.panel_1.SetSizer(sizer_main)
249 sizer_main.Fit(self.panel_1)
250 sizer_main.SetSizeHints(self.panel_1)
d6dabac0 251 sizer_frame.Add(self.panel_1, 1, wx.EXPAND|wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL, 0)
f04ad14a
RD
252 self.SetAutoLayout(1)
253 self.SetSizer(sizer_frame)
254 sizer_frame.Fit(self)
255 sizer_frame.SetSizeHints(self)
256 self.Layout()
f04ad14a
RD
257 self.UpdateWidgets()
258
259 def UpdateAll(self):
260 self.UpdateWidgets()
261 self.parent.OnSize(None)
262
263 def UpdateWidgets(self):
264 self.button_6.SetColour(self.parent.shadowPenColour)
265
266 bc=self.parent.watchPen
267 if bc:
268 bc=bc.GetColour()
269 else:
270 bc=self.parent.GetBackgroundColour()
271 self.button_8.SetColour(bc)
272
273 bc=self.parent.watchBrush
274 if bc:
275 bc=bc.GetColour()
276 else:
277 bc=self.parent.GetBackgroundColour()
278 self.button_9.SetColour(bc)
279
280 self.button_11.SetColour(self.parent.tickMarkHoursPen.GetColour())
281 self.button_12.SetColour(self.parent.tickMarkMinutesPen.GetColour())
282 self.button_19.SetColour(self.parent.handHoursColour)
283 self.button_20.SetColour(self.parent.handMinutesColour)
284 self.button_21.SetColour(self.parent.handSecondsColour)
285
286 self.spin_ctrl_1.SetValue(self.parent.markSizeHour)
287 self.spin_ctrl_2.SetValue(self.parent.markSizeMin)
288 self.spin_ctrl_3.SetValue(self.parent.offM)
289 self.spin_ctrl_4.SetValue(self.parent.handHoursThickness)
290 self.spin_ctrl_5.SetValue(self.parent.handMinutesThickness)
291 self.spin_ctrl_6.SetValue(self.parent.handSecondsThickness)
292
293
294 def gfid(self, id, lista):
d6dabac0
RD
295 return self.ide.index(id) in lista
296 # for x in lista:
297 # if id==self.ide[x]:
298 # f=True
299 # break
300 # else:
301 # f=False
302 # return f
f04ad14a
RD
303
304 def OnEventsHook(self, evt):
305 id=evt.GetId()
306
307 if self.gfid(id, [6,8,9,11,12,19,20,21,23]):
308 self.OnSelectColour(evt)
309
310 elif self.gfid(id, [15,16]):
311 self.OnSelectFont(evt)
312
313 elif self.gfid(id, [71,72,73,74,75,76]):
314 self.OnSpinChange(evt)
315
316 elif self.gfid(id, [3,4,22]):
317 self.OnChangeStyle(evt)
318
319 elif self.gfid(id, [1,2,5,7,10,13,14,17,18]):
320 self.OnDefaults(evt)
321
f04ad14a
RD
322 def OnSelectColour(self, evt):
323 id=evt.GetId();colour=evt.GetValue()
324
325 if id==self.ide[6]:
326 self.parent.SetShadowColour(colour)
327 elif id==self.ide[8]:
d6dabac0 328 self.parent.SetWatchPenBrush(p=wx.Pen(colour, 1, wx.SOLID))
f04ad14a 329 elif id==self.ide[9]:
d6dabac0 330 self.parent.SetWatchPenBrush(b=wx.Brush(colour, wx.SOLID))
f04ad14a
RD
331 elif id==self.ide[11]:
332 self.parent.SetTickColours(h=colour)
333 elif id==self.ide[12]:
334 self.parent.SetTickColours(m=colour)
335 elif id==self.ide[19]:
336 self.parent.SetHandColours(h=colour)
337 elif id==self.ide[20]:
338 self.parent.SetHandColours(m=colour)
339 elif id==self.ide[21]:
340 self.parent.SetHandColours(s=colour)
341
342
343 self.UpdateAll()
344
345
346
347 def OnSelectFont(self, evt):
348 id=evt.GetId()
349 if id==self.ide[15]:
350 font=self.parent.tickMarkHoursFont;font.SetPointSize(self.parent.markSizeHour)
351 colour=self.parent.tickMarkHoursPen.GetColour()
352 else:
353 font=self.parent.tickMarkMinutesFont;font.SetPointSize(self.parent.markSizeMin)
354 colour=self.parent.tickMarkMinutesPen.GetColour()
355
d6dabac0 356 data = wx.FontData()
f04ad14a
RD
357 data.EnableEffects(True)
358 data.SetColour(colour)
359 data.SetInitialFont(font)
360
d6dabac0
RD
361 dlg = wx.FontDialog(self, data)
362 if dlg.ShowModal() == wx.ID_OK:
f04ad14a
RD
363 data = dlg.GetFontData()
364 font = data.GetChosenFont()
365 colour = data.GetColour()
366 if id==self.ide[15]:
367 self.parent.SetTickFonts(h=font)
368 self.parent.SetTickColours(h=colour.Get())
369 else:
370 self.parent.SetTickFonts(m=font)
371 self.parent.SetTickColours(m=colour.Get())
372 dlg.Destroy()
373
374 self.UpdateAll()
375
376 def OnSpinChange(self, evt):
377 id=evt.GetId();v=evt.GetInt()
378 if id==self.ide[71]:
379 self.parent.SetTickSizes(h=v)
380 if id==self.ide[72]:
381 self.parent.SetTickSizes(m=v)
382 if id==self.ide[73]:
383 self.parent.SetMinutesOffset(v)
384 if id==self.ide[74]:
385 self.parent.SetHandWeights(h=v)
386 if id==self.ide[75]:
387 self.parent.SetHandWeights(m=v)
388 if id==self.ide[76]:
389 self.parent.SetHandWeights(s=v)
390
391 self.UpdateAll()
392
393 def OnChangeStyle(self, evt):
394 id=evt.GetId()
395
396 if id==self.ide[3]:
397 x="""SHOW_QUARTERS_TICKS
398 SHOW_HOURS_TICKS
399 SHOW_MINUTES_TICKS
400 ROTATE_TICKS
401 SHOW_HOURS_HAND
402 SHOW_MINUTES_HAND
403 SHOW_SECONDS_HAND
404 SHOW_SHADOWS
405 OVERLAP_TICKS""".split()
406 m=map(lambda f: (self.parent.clockStyle & f)/f, map(lambda f: 2**x.index(f),x))
407
d6dabac0 408 dlg = dlgs.MultipleChoiceDialog(self,
f04ad14a
RD
409 "Select some styles for the clock:",
410 "Styles", x)
411 for i in range(0,len(m)):
412 if m[i]:
413 dlg.lbox.SetSelection(i)
414
d6dabac0 415 if (dlg.ShowModal() == wx.ID_OK):
f04ad14a
RD
416 v=reduce(lambda x,y:x+y,map(lambda f: 2**f,dlg.GetValue()))
417 self.parent.SetClockStyle(v)
418
419 elif id==self.ide[4]:
420 x="""TICKS_NONE
421 TICKS_SQUARE
422 TICKS_CIRCLE
423 TICKS_POLY
424 TICKS_DECIMAL
425 TICKS_ROMAN""".split()
426 m=map(lambda f: (self.parent.tickMarkHoursStyle & f)/f, map(lambda f: 2**x.index(f),x))
427
d6dabac0 428 dlg = wx.SingleChoiceDialog(self,
f04ad14a 429 "Select a style for the hours:",
d6dabac0 430 "Styles", x, wx.CHOICEDLG_STYLE)
f04ad14a
RD
431 for i in range(0,len(m)):
432 if m[i]:
433 dlg.SetSelection(i)
434
d6dabac0 435 if dlg.ShowModal() == wx.ID_OK:
f04ad14a
RD
436 v=2**dlg.GetSelection()
437 self.parent.SetTickStyles(h=v)
438 dlg.Destroy()
439
440 elif id==self.ide[22]:
441 tipo="for the minutes"
442 x="""TICKS_NONE
443 TICKS_SQUARE
444 TICKS_CIRCLE
445 TICKS_POLY
446 TICKS_DECIMAL
447 TICKS_ROMAN""".split()
448 m=map(lambda f: (self.parent.tickMarkMinutesStyle & f)/f, map(lambda f: 2**x.index(f),x))
449
d6dabac0 450 dlg = wx.SingleChoiceDialog(self,
f04ad14a 451 "Select a style for the minutes:",
d6dabac0 452 "Styles", x, wx.CHOICEDLG_STYLE)
f04ad14a
RD
453 for i in range(0,len(m)):
454 if m[i]:
455 dlg.SetSelection(i)
456
d6dabac0 457 if dlg.ShowModal() == wx.ID_OK:
f04ad14a
RD
458 v=2**dlg.GetSelection()
459 self.parent.SetTickStyles(m=v)
460 dlg.Destroy()
461
462 self.UpdateAll()
463
464 def OnDefaults(self, evt):
465 id=evt.GetId()
466 if id==self.ide[1]:
467 self.parent.SetClockStyle(142)
468 elif id==self.ide[2]:
469 self.parent.SetTickStyles(8, 4)
470 elif id==self.ide[5]:
471 self.parent.SetShadowColour((128,128,128))
472 elif id==self.ide[7]:
473 colour=self.parent.GetBackgroundColour()
d6dabac0 474 self.parent.SetWatchPenBrush(p=wx.Pen(colour, 1, wx.SOLID), b=wx.Brush(colour, wx.SOLID))
f04ad14a
RD
475 elif id==self.ide[10]:
476 colour=(0, 0, 0)
477 self.parent.SetTickColours(h=colour, m=colour)
478 elif id==self.ide[13]:
479 self.parent.SetTickSizes(h=10, m=5)
480 self.parent.SetMinutesOffset(0)
481 elif id==self.ide[14]:
d6dabac0 482 self.parent.SetTickFonts(wx.Font(1, wx.SWISS, wx.NORMAL, wx.BOLD))
f04ad14a
RD
483 elif id==self.ide[17]:
484 self.parent.SetHandWeights(h=5, m=3, s=1)
485 elif id==self.ide[18]:
486 colour=(0, 0, 0)
487 self.parent.SetHandColours(h=colour, m=colour, s=colour)
488
489 self.UpdateAll()
490
491
492 def OnQuit(self, evt):
493 self.parent.prefs_open=False
494
495
496#
497##
498### eof
499
500
d6dabac0 501