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