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