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