]> git.saurik.com Git - wxWidgets.git/blame - wxPython/demo/wxCalendar.py
Added XML simplification scripts for generating the wxPython metadata xml.
[wxWidgets.git] / wxPython / demo / wxCalendar.py
CommitLineData
944930d5 1#----------------------------------------------------------------------------
f6bcfd97
BP
2# Name: wxCalendar.py
3# Purpose: Calendar control display testing on panel for wxPython demo
944930d5
RD
4#
5# Author: Lorne White (email: lwhite1@planet.eon.net)
6#
96bfd053 7# Version 0.9
49875c53 8# Date: Feb 26, 2001
944930d5
RD
9# Licence: wxWindows license
10#----------------------------------------------------------------------------
8fa876ca
RD
11# 11/15/2003 - Jeff Grimmett (grimmtooth@softhome.net)
12#
13# o Updated for wx namespace
14# o Some updating of the library itself will be needed for this demo to work
15# correctly.
16#
17# 11/26/2003 - Jeff Grimmett (grimmtooth@softhome.net)
18#
19# o Problems have changed a little. The print dialog requires
20# a wx.Size to work with the calendar library. wx.core doesn't
21# approve, though, so we get deprecation warnings.
22# o Ugh. AFter updating to the Bind() method, things lock up
23# on various control clicks. Will have to debug. Only seems
24# to happen on windows with calendar controls, though.
25#
26# 11/30/2003 - Jeff Grimmett (grimmtooth@softhome.net)
27#
28# o Lockup issue clarification: it appears that the spinner is
29# the culprit.
30#
31# 12/01/2003 - Jeff Grimmett (grimmtooth@softhome.net)
32#
33# o New Bind() method now fully supported.
34#
c1ea08d3
RD
35# 12/17/2003 - Jeff Grimmett (grimmtooth@softhome.net)
36#
37# o wxCalendar renamed to Calendar
38# o Got rid of unneeded IDs where Bind() could figure it
39# out for itself.
40#
8fa876ca
RD
41
42import os
944930d5 43
8fa876ca 44import wx
c1ea08d3 45import wx.lib.calendar
944930d5 46
8fa876ca 47import images
944930d5
RD
48
49
50# highlighted days in month
51
52test_days ={ 0: [],
53 1: [3, 7, 9, 21],
54 2: [2, 10, 4, 9],
55 3: [4, 20, 29],
56 4: [1, 12, 22],
57 5: [2, 10, 15],
58 6: [4, 8, 17],
59 7: [6, 7, 8],
60 8: [5, 10, 20],
61 9: [1, 2, 5, 29],
62 10: [2, 4, 6, 22],
63 11: [6, 9, 12, 28, 29],
64 12: [8, 9, 10, 11, 20] }
65
66# test of full window calendar control functions
67
68def GetMonthList():
8fa876ca 69
944930d5 70 monthlist = []
8fa876ca 71
944930d5 72 for i in range(13):
c1ea08d3 73 name = wx.lib.calendar.Month[i]
8fa876ca 74
944930d5
RD
75 if name != None:
76 monthlist.append(name)
8fa876ca 77
944930d5
RD
78 return monthlist
79
8fa876ca 80class TestPanel(wx.Panel):
f6bcfd97 81 def __init__(self, parent, log, frame):
8fa876ca 82 wx.Panel.__init__(self, parent, -1)
944930d5
RD
83
84 self.log = log
f6bcfd97 85 self.frame = frame
944930d5 86
c1ea08d3 87 self.calend = wx.lib.calendar.Calendar(self, -1, (100, 50), (200, 180))
944930d5 88
49875c53
RD
89# start_month = 2 # preselect the date for calendar
90# start_year = 2001
91
92 start_month = self.calend.GetMonth() # get the current month & year
93 start_year = self.calend.GetYear()
944930d5 94
8fa876ca 95 # month list from DateTime module
944930d5
RD
96
97 monthlist = GetMonthList()
98
c1ea08d3 99 self.date = wx.ComboBox(self, -1, "",
8fa876ca
RD
100 (100, 20), (90, -1),
101 monthlist, wx.CB_DROPDOWN)
102
eb0f373c 103 self.date.SetSelection(start_month-1)
c1ea08d3 104 self.Bind(wx.EVT_COMBOBOX, self.EvtComboBox, self.date)
944930d5 105
8fa876ca 106 # set start month and year
944930d5
RD
107
108 self.calend.SetMonth(start_month)
109 self.calend.SetYear(start_year)
110
8fa876ca 111 # set attributes of calendar
944930d5 112
1e4a197e 113 self.calend.hide_title = True
944930d5 114 self.calend.HideGrid()
f6bcfd97 115 self.calend.SetWeekColor('WHITE', 'BLACK')
944930d5 116
8fa876ca 117 # display routine
944930d5
RD
118
119 self.ResetDisplay()
120
8fa876ca 121 # mouse click event
c1ea08d3 122 self.Bind(wx.lib.calendar.EVT_CALENDAR, self.MouseClick, self.calend)
944930d5 123
8fa876ca 124 # scroll bar for month selection
c1ea08d3 125 self.scroll = wx.ScrollBar(self, -1, (100, 240), (200, 20), wx.SB_HORIZONTAL)
1e4a197e 126 self.scroll.SetScrollbar(start_month-1, 1, 12, 1, True)
c1ea08d3 127 self.Bind(wx.EVT_COMMAND_SCROLL, self.Scroll, self.scroll)
944930d5 128
8fa876ca 129 # spin control for year selection
944930d5 130
8fa876ca 131 self.dtext = wx.TextCtrl(self, -1, str(start_year), (200, 20), (60, -1))
944930d5
RD
132 h = self.dtext.GetSize().height
133
c1ea08d3 134 self.spin = wx.SpinButton(self, -1, (270, 20), (h*2, h))
944930d5
RD
135 self.spin.SetRange(1980, 2010)
136 self.spin.SetValue(start_year)
c1ea08d3 137 self.Bind(wx.EVT_SPIN, self.OnSpin, self.spin)
944930d5 138
8fa876ca 139 # button for calendar dialog test
944930d5 140
8fa876ca 141 wx.StaticText(self, -1, "Test Calendar Dialog", (350, 50), (150, -1))
944930d5 142
96bfd053 143 bmp = images.getCalendarBitmap()
c1ea08d3
RD
144 self.but1 = wx.BitmapButton(self, -1, bmp, (380, 80))
145 self.Bind(wx.EVT_BUTTON, self.TestDlg, self.but1)
944930d5 146
8fa876ca 147 # button for calendar window test
944930d5 148
8fa876ca 149 wx.StaticText(self, -1, "Test Calendar Window", (350, 150), (150, -1))
944930d5 150
c1ea08d3
RD
151 self.but2 = wx.BitmapButton(self, -1, bmp, (380, 180))
152 self.Bind(wx.EVT_BUTTON, self.TestFrame, self.but2)
944930d5 153
8fa876ca 154 wx.StaticText(self, -1, "Test Calendar Print", (350, 250), (150, -1))
f6bcfd97 155
c1ea08d3
RD
156 self.but3 = wx.BitmapButton(self, -1, bmp, (380, 280))
157 self.Bind(wx.EVT_BUTTON, self.OnPreview, self.but3)
f6bcfd97 158
8fa876ca 159 # calendar dialog
944930d5 160
49875c53 161 def TestDlg(self, event): # test the date dialog
c1ea08d3 162 dlg = wx.lib.calendar.CalenDlg(self)
944930d5 163 dlg.Centre()
8fa876ca
RD
164
165 if dlg.ShowModal() == wx.ID_OK:
49875c53
RD
166 result = dlg.result
167 day = result[1]
168 month = result[2]
169 year = result[3]
170 new_date = str(month) + '/'+ str(day) + '/'+ str(year)
171 self.log.WriteText('Date Selected: %s\n' % new_date)
172 else:
173 self.log.WriteText('No Date Selected')
944930d5 174
8fa876ca 175 # calendar window test
944930d5
RD
176
177 def TestFrame(self, event):
e0473f5f 178 frame = CalendFrame(self, -1, "Test Calendar", self.log)
1e4a197e
RD
179 frame.Show(True)
180 return True
944930d5 181
8fa876ca 182 # calendar print preview
f6bcfd97
BP
183
184 def OnPreview(self, event):
185 month = self.calend.GetMonth()
186 year = self.calend.GetYear()
187
188 prt = PrintCalend(self.frame, month, year)
189 prt.Preview()
190
8fa876ca 191 # month and year control events
944930d5
RD
192
193 def OnSpin(self, event):
194 year = event.GetPosition()
195 self.dtext.SetValue(str(year))
196 self.calend.SetYear(year)
197 self.calend.Refresh()
198
199 def EvtComboBox(self, event):
200 name = event.GetString()
201 self.log.WriteText('EvtComboBox: %s\n' % name)
202 monthval = self.date.FindString(name)
1e4a197e 203 self.scroll.SetScrollbar(monthval, 1, 12, 1, True)
944930d5
RD
204
205 self.calend.SetMonth(monthval+1)
206 self.ResetDisplay()
207
208 def Scroll(self, event):
209 value = self.scroll.GetThumbPosition()
210 monthval = int(value)+1
211 self.calend.SetMonth(monthval)
212 self.ResetDisplay()
213 self.log.WriteText('Month: %s\n' % value)
214
c1ea08d3 215 name = wx.lib.calendar.Month[monthval]
944930d5
RD
216 self.date.SetValue(name)
217
8fa876ca 218 # log mouse events
944930d5
RD
219
220 def MouseClick(self, evt):
221 text = '%s CLICK %02d/%02d/%d' % (evt.click, evt.day, evt.month, evt.year) # format date
222 self.log.WriteText('Date Selected: ' + text + '\n')
223
944930d5 224
8fa876ca 225 # set the highlighted days for the calendar
944930d5
RD
226
227 def ResetDisplay(self):
228 month = self.calend.GetMonth()
8fa876ca 229
944930d5
RD
230 try:
231 set_days = test_days[month]
232 except:
233 set_days = [1, 5, 12]
234
f6bcfd97 235 self.calend.AddSelect([4, 11], 'BLUE', 'WHITE')
944930d5
RD
236 self.calend.SetSelDay(set_days)
237 self.calend.Refresh()
238
8fa876ca 239 # increment and decrement toolbar controls
944930d5
RD
240
241 def OnIncYear(self, event):
242 self.calend.IncYear()
243 self.ResetDisplay()
244
245 def OnDecYear(self, event):
246 self.calend.DecYear()
247 self.ResetDisplay()
248
249 def OnIncMonth(self, event):
250 self.calend.IncMonth()
251 self.ResetDisplay()
252
253 def OnDecMonth(self, event):
254 self.calend.DecMonth()
255 self.ResetDisplay()
256
257 def OnCurrent(self, event):
258 self.calend.SetCurrentDay()
259 self.ResetDisplay()
260
944930d5
RD
261# test of full window calendar control functions
262
8fa876ca 263class CalendFrame(wx.Frame):
944930d5 264 def __init__(self, parent, id, title, log):
8fa876ca
RD
265 wx.Frame.__init__(self, parent, id, title, size=(400, 400),
266 style=wx.DEFAULT_FRAME_STYLE|wx.NO_FULL_REPAINT_ON_RESIZE)
267
268 self.Bind(wx.EVT_CLOSE, self.OnCloseWindow)
944930d5
RD
269
270 self.log = log
271 self.CreateStatusBar()
8fa876ca
RD
272 self.mainmenu = wx.MenuBar()
273 menu = wx.Menu()
944930d5
RD
274
275 menu = self.MakeFileMenu()
276 self.mainmenu.Append(menu, '&File')
277
278 self.MakeToolMenu() # toolbar
279
280 self.SetMenuBar(self.mainmenu)
c1ea08d3 281 self.calend = wx.lib.calendar.Calendar(self, -1)
944930d5
RD
282 self.calend.SetCurrentDay()
283 self.calend.grid_color = 'BLUE'
f6bcfd97
BP
284 self.calend.SetBusType()
285# self.calend.ShowWeekEnd()
286
944930d5
RD
287 self.ResetDisplay()
288
c1ea08d3 289 self.Bind(wx.lib.calendar.EVT_CALENDAR, self.MouseClick, self.calend)
944930d5
RD
290
291 def MouseClick(self, evt):
292 text = '%s CLICK %02d/%02d/%d' % (evt.click, evt.day, evt.month, evt.year) # format date
293 self.log.WriteText('Date Selected: ' + text + '\n')
294
295 def OnCloseWindow(self, event):
296 self.Destroy()
297
298 def ResetDisplay(self):
299 month = self.calend.GetMonth()
8fa876ca 300
944930d5
RD
301 try:
302 set_days = test_days[month]
303 except:
304 set_days = [1, 5, 12]
305
f6bcfd97
BP
306 self.calend.AddSelect([2, 16], 'GREEN', 'WHITE')
307
944930d5
RD
308 self.calend.SetSelDay(set_days)
309 self.calend.Refresh()
310
311 def OnIncYear(self, event):
312 self.calend.IncYear()
313 self.ResetDisplay()
314
315 def OnDecYear(self, event):
316 self.calend.DecYear()
317 self.ResetDisplay()
318
319 def OnIncMonth(self, event):
320 self.calend.IncMonth()
321 self.ResetDisplay()
322
323 def OnDecMonth(self, event):
324 self.calend.DecMonth()
325 self.ResetDisplay()
326
327 def OnCurrent(self, event):
328 self.calend.SetCurrentDay()
329 self.ResetDisplay()
330
331 def MakeFileMenu(self):
8fa876ca 332 menu = wx.Menu()
944930d5 333
8fa876ca 334 mID = wx.NewId()
944930d5 335 menu.Append(mID, 'Decrement', 'Next')
8fa876ca 336 self.Bind(wx.EVT_MENU, self.OnDecMonth, id=mID)
944930d5 337
8fa876ca 338 mID = wx.NewId()
944930d5 339 menu.Append(mID, 'Increment', 'Dec')
8fa876ca 340 self.Bind(wx.EVT_MENU, self.OnIncMonth, id=mID)
944930d5
RD
341
342 menu.AppendSeparator()
343
8fa876ca 344 mID = wx.NewId()
944930d5 345 menu.Append(mID, 'E&xit', 'Exit')
8fa876ca 346 self.Bind(wx.EVT_MENU, self.OnCloseWindow, id=mID)
944930d5
RD
347
348 return menu
349
350 def MakeToolMenu(self):
8fa876ca 351 tb = self.CreateToolBar(wx.TB_HORIZONTAL|wx.NO_BORDER)
944930d5 352
8fa876ca 353 mID = wx.NewId()
96bfd053 354 SetToolPath(self, tb, mID, images.getDbDecBitmap(), 'Dec Year')
8fa876ca 355 self.Bind(wx.EVT_TOOL, self.OnDecYear, id=mID)
944930d5 356
8fa876ca 357 mID = wx.NewId()
96bfd053 358 SetToolPath(self, tb, mID, images.getDecBitmap(), 'Dec Month')
8fa876ca 359 self.Bind(wx.EVT_TOOL, self.OnDecMonth, id=mID)
944930d5 360
8fa876ca 361 mID = wx.NewId()
96bfd053 362 SetToolPath(self, tb, mID, images.getPtBitmap(), 'Current Month')
8fa876ca 363 self.Bind(wx.EVT_TOOL, self.OnCurrent, id=mID)
49875c53 364
8fa876ca 365 mID = wx.NewId()
96bfd053 366 SetToolPath(self, tb, mID, images.getIncBitmap(), 'Inc Month')
8fa876ca 367 self.Bind(wx.EVT_TOOL, self.OnIncMonth, id=mID)
944930d5 368
8fa876ca 369 mID = wx.NewId()
96bfd053 370 SetToolPath(self, tb, mID, images.getDbIncBitmap(), 'Inc Year')
8fa876ca 371 self.Bind(wx.EVT_TOOL, self.OnIncYear, id=mID)
944930d5
RD
372
373 tb.Realize()
374
f6bcfd97
BP
375#---------------------------------------------------------------------------
376
377# example class for printing/previewing calendars
378
379class PrintCalend:
380 def __init__(self, parent, month, year):
381 self.frame = parent
382 self.month = month
383 self.year = year
384
385 self.SetParms()
386 self.SetCal()
8fa876ca 387 self.printData = wx.PrintData()
f6bcfd97
BP
388
389 def SetCal(self):
390 self.grid_color = 'BLUE'
391 self.back_color = 'WHITE'
392 self.sel_color = 'RED'
393 self.high_color = 'LIGHT BLUE'
8fa876ca
RD
394 self.font = wx.SWISS
395 self.bold = wx.NORMAL
f6bcfd97
BP
396
397 self.sel_key = None # last used by
398 self.sel_lst = [] # highlighted selected days
399
400 self.size = None
1e4a197e
RD
401 self.hide_title = False
402 self.hide_grid = False
f6bcfd97
BP
403 self.set_day = None
404
405 def SetParms(self):
406 self.ymax = 1
407 self.xmax = 1
408 self.page = 1
409 self.total_pg = 1
410
411 self.preview = None
412 self.scale = 1.0
413
414 self.pagew = 8.5
415 self.pageh = 11.0
416
417 self.txt_marg = 0.1
418 self.lf_marg = 0
419 self.top_marg = 0
420
421 self.page = 0
422
423 def SetDates(self, month, year):
424 self.month = month
425 self.year = year
426
427 def SetStyleDef(self, desc):
428 self.style = desc
429
430 def SetCopies(self, copies): # number of copies of label
431 self.copies = copies
432
433 def SetStart(self, start): # start position of label
434 self.start = start
435
436 def Preview(self):
437 printout = SetPrintout(self)
438 printout2 = SetPrintout(self)
8fa876ca
RD
439 self.preview = wx.PrintPreview(printout, printout2, self.printData)
440
f6bcfd97 441 if not self.preview.Ok():
8fa876ca 442 wx.MessageBox("There was a problem printing!", "Printing", wx.OK)
f6bcfd97
BP
443 return
444
445 self.preview.SetZoom(60) # initial zoom value
446
8fa876ca 447 frame = wx.PreviewFrame(self.preview, self.frame, "Print preview")
f6bcfd97
BP
448
449 frame.Initialize()
450 frame.SetPosition(self.frame.GetPosition())
451 frame.SetSize(self.frame.GetSize())
1e4a197e 452 frame.Show(True)
f6bcfd97
BP
453
454 def Print(self):
8fa876ca 455 pdd = wx.PrintDialogData()
f6bcfd97 456 pdd.SetPrintData(self.printData)
8fa876ca 457 printer = wx.Printer(pdd)
f6bcfd97 458 printout = SetPrintout(self)
8fa876ca
RD
459 frame = wx.Frame(None, -1, "Test")
460
f6bcfd97 461 if not printer.Print(frame, printout):
8fa876ca 462 wx.MessageBox("There was a problem printing.\nPerhaps your current printer is not set correctly?", "Printing", wx.OK)
f6bcfd97
BP
463 else:
464 self.printData = printer.GetPrintDialogData().GetPrintData()
8fa876ca 465
f6bcfd97
BP
466 printout.Destroy()
467
468 def DoDrawing(self, DC):
8fa876ca 469 size = DC.GetSize()
f6bcfd97
BP
470 DC.BeginDrawing()
471
c1ea08d3 472 cal = wx.lib.calendar.PrtCalDraw(self)
f6bcfd97
BP
473
474 if self.preview is None:
475 cal.SetPSize(size[0]/self.pagew, size[1]/self.pageh)
1e4a197e 476 cal.SetPreview(False)
f6bcfd97
BP
477
478 else:
479 if self.preview == 1:
480 cal.SetPSize(size[0]/self.pagew, size[1]/self.pageh)
481 else:
482 cal.SetPSize(self.pwidth, self.pheight)
483
484 cal.SetPreview(self.preview)
485
486 cal.hide_title = self.hide_title # set the calendar parameters
487 cal.hide_grid = self.hide_grid
488
489 cal.grid_color = self.grid_color
490 cal.high_color = self.high_color
491 cal.back_color = self.back_color
1e4a197e 492 cal.outer_border = False
f6bcfd97
BP
493 cal.font = self.font
494 cal.bold = self.bold
495
8fa876ca 496 cal_size = (3.0, 3.0)
f6bcfd97
BP
497 cal.SetSize(cal_size)
498
499 year, month = self.year, self.month
500
501 x = 1.0
8fa876ca 502
f6bcfd97
BP
503 for i in range(2):
504 y = 0.5
8fa876ca 505
f6bcfd97
BP
506 for j in range(3):
507 cal.SetCal(year, month) # current month
508 cal.SetPos(x, y)
509
510 try:
511 set_days = test_days[month]
512 except:
513 set_days = [1, 5, 12]
514
515 cal.AddSelect([2, 16], 'GREEN', 'WHITE')
516
517 cal.DrawCal(DC, set_days)
518
519 year, month = self.IncMonth(year, month)
520 y = y + 3.5
8fa876ca 521
8b9a4190 522 x = x + 4.0 # next column
f6bcfd97
BP
523
524 DC.EndDrawing()
525
526 self.ymax = DC.MaxY()
527 self.xmax = DC.MaxX()
528
529 def IncMonth(self, year, month): # next month
530 month = month + 1
8fa876ca 531
f6bcfd97
BP
532 if month > 12:
533 month = 1
534 year = year + 1
535
536 return year, month
537
538 def GetTotalPages(self):
539 self.pg_cnt = 1
540 return self.pg_cnt
541
542 def SetPage(self, page):
543 self.page = page
544
545 def SetPageSize(self, width, height):
546 self.pwidth, self.pheight = width, height
547
548 def SetTotalSize(self, width, height):
549 self.ptwidth, self.ptheight = width, height
550
551 def SetPreview(self, preview, scale):
552 self.preview = preview
553 self.scale = scale
554
555 def SetTotalSize(self, width, height):
556 self.ptwidth = width
557 self.ptheight = height
558
944930d5 559def SetToolPath(self, tb, id, bmp, title):
96bfd053 560 tb.AddSimpleTool(id, bmp, title, title)
944930d5 561
8fa876ca 562class SetPrintout(wx.Printout):
f6bcfd97 563 def __init__(self, canvas):
8fa876ca 564 wx.Printout.__init__(self)
f6bcfd97
BP
565 self.canvas = canvas
566 self.end_pg = 1
567
568 def OnBeginDocument(self, start, end):
569 return self.base_OnBeginDocument(start, end)
570
571 def OnEndDocument(self):
572 self.base_OnEndDocument()
573
574 def HasPage(self, page):
575 if page <= self.end_pg:
1e4a197e 576 return True
f6bcfd97 577 else:
1e4a197e 578 return False
f6bcfd97
BP
579
580 def GetPageInfo(self):
581 self.end_pg = self.canvas.GetTotalPages()
582 str_pg = 1
8fa876ca 583
f6bcfd97
BP
584 try:
585 end_pg = self.end_pg
586 except:
587 end_pg = 1
8fa876ca 588
f6bcfd97
BP
589 return (str_pg, end_pg, str_pg, end_pg)
590
591 def OnPreparePrinting(self):
592 self.base_OnPreparePrinting()
593
594 def OnBeginPrinting(self):
595 dc = self.GetDC()
596
597 self.preview = self.IsPreview()
8fa876ca 598
f6bcfd97
BP
599 if (self.preview):
600 self.pixelsPerInch = self.GetPPIScreen()
601 else:
602 self.pixelsPerInch = self.GetPPIPrinter()
603
8fa876ca 604 (w, h) = dc.GetSize()
f6bcfd97
BP
605 scaleX = float(w) / 1000
606 scaleY = float(h) / 1000
607 self.printUserScale = min(scaleX, scaleY)
608
609 self.base_OnBeginPrinting()
610
611 def GetSize(self):
612 self.psizew, self.psizeh = self.GetPPIPrinter()
613 return self.psizew, self.psizeh
614
615 def GetTotalSize(self):
616 self.ptsizew, self.ptsizeh = self.GetPageSizePixels()
617 return self.ptsizew, self.ptsizeh
618
619 def OnPrintPage(self, page):
620 dc = self.GetDC()
8fa876ca 621 (w, h) = dc.GetSize()
f6bcfd97
BP
622 scaleX = float(w) / 1000
623 scaleY = float(h) / 1000
624 self.printUserScale = min(scaleX, scaleY)
625 dc.SetUserScale(self.printUserScale, self.printUserScale)
626
627 self.preview = self.IsPreview()
628
629 self.canvas.SetPreview(self.preview, self.printUserScale)
630 self.canvas.SetPage(page)
631
632 self.ptsizew, self.ptsizeh = self.GetPageSizePixels()
633 self.canvas.SetTotalSize(self.ptsizew, self.ptsizeh)
634
635 self.psizew, self.psizeh = self.GetPPIPrinter()
636 self.canvas.SetPageSize(self.psizew, self.psizeh)
637
638 self.canvas.DoDrawing(dc)
1e4a197e 639 return True
e0473f5f 640
8fa876ca 641class MyApp(wx.App):
944930d5 642 def OnInit(self):
8fa876ca 643 frame = CalendFrame(None, -1, "Test Calendar", log)
1e4a197e 644 frame.Show(True)
944930d5 645 self.SetTopWindow(frame)
1e4a197e 646 return True
944930d5
RD
647
648#---------------------------------------------------------------------------
649
650def MessageDlg(self, message, type = 'Message'):
8fa876ca 651 dlg = wx.MessageDialog(self, message, type, wx.OK | wx.ICON_INFORMATION)
944930d5
RD
652 dlg.ShowModal()
653 dlg.Destroy()
654
655#---------------------------------------------------------------------------
656
944930d5 657def runTest(frame, nb, log):
f6bcfd97 658 win = TestPanel(nb, log, frame)
944930d5
RD
659 return win
660
661#---------------------------------------------------------------------------
662
663
664overview = """\
c1ea08d3
RD
665This control provides a Calendar control class for displaying and selecting dates.
666In addition, the class is extended and can be used for printing/previewing.
f6bcfd97 667
8fa876ca
RD
668Additional features include weekend highlighting and business type Monday-Sunday
669format.
944930d5 670
8fa876ca
RD
671See example for various methods used to set display month, year, and highlighted
672dates (different font and background colours).
944930d5
RD
673
674by Lorne White
675
676"""
fd3f2efe
RD
677
678
679
680
681if __name__ == '__main__':
682 import sys,os
683 import run
684 run.main(['', os.path.basename(sys.argv[0])])
685