Tweaking names (Thanks Jeff!)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@24916 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -32,11 +32,17 @@
|
|||||||
#
|
#
|
||||||
# o New Bind() method now fully supported.
|
# o New Bind() method now fully supported.
|
||||||
#
|
#
|
||||||
|
# 12/17/2003 - Jeff Grimmett (grimmtooth@softhome.net)
|
||||||
|
#
|
||||||
|
# o wxCalendar renamed to Calendar
|
||||||
|
# o Got rid of unneeded IDs where Bind() could figure it
|
||||||
|
# out for itself.
|
||||||
|
#
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
|
||||||
import wx
|
import wx
|
||||||
import wx.lib.calendar as calendar
|
import wx.lib.calendar
|
||||||
|
|
||||||
import images
|
import images
|
||||||
|
|
||||||
@@ -64,7 +70,7 @@ def GetMonthList():
|
|||||||
monthlist = []
|
monthlist = []
|
||||||
|
|
||||||
for i in range(13):
|
for i in range(13):
|
||||||
name = calendar.Month[i]
|
name = wx.lib.calendar.Month[i]
|
||||||
|
|
||||||
if name != None:
|
if name != None:
|
||||||
monthlist.append(name)
|
monthlist.append(name)
|
||||||
@@ -78,7 +84,7 @@ class TestPanel(wx.Panel):
|
|||||||
self.log = log
|
self.log = log
|
||||||
self.frame = frame
|
self.frame = frame
|
||||||
|
|
||||||
self.calend = calendar.wxCalendar(self, -1, (100, 50), (200, 180))
|
self.calend = wx.lib.calendar.Calendar(self, -1, (100, 50), (200, 180))
|
||||||
|
|
||||||
# start_month = 2 # preselect the date for calendar
|
# start_month = 2 # preselect the date for calendar
|
||||||
# start_year = 2001
|
# start_year = 2001
|
||||||
@@ -90,13 +96,12 @@ class TestPanel(wx.Panel):
|
|||||||
|
|
||||||
monthlist = GetMonthList()
|
monthlist = GetMonthList()
|
||||||
|
|
||||||
mID = wx.NewId()
|
self.date = wx.ComboBox(self, -1, "",
|
||||||
self.date = wx.ComboBox(self, mID, "",
|
|
||||||
(100, 20), (90, -1),
|
(100, 20), (90, -1),
|
||||||
monthlist, wx.CB_DROPDOWN)
|
monthlist, wx.CB_DROPDOWN)
|
||||||
|
|
||||||
self.date.SetSelection(start_month-1)
|
self.date.SetSelection(start_month-1)
|
||||||
self.Bind(wx.EVT_COMBOBOX, self.EvtComboBox, id=mID)
|
self.Bind(wx.EVT_COMBOBOX, self.EvtComboBox, self.date)
|
||||||
|
|
||||||
# set start month and year
|
# set start month and year
|
||||||
|
|
||||||
@@ -114,54 +119,47 @@ class TestPanel(wx.Panel):
|
|||||||
self.ResetDisplay()
|
self.ResetDisplay()
|
||||||
|
|
||||||
# mouse click event
|
# mouse click event
|
||||||
self.Bind(calendar.EVT_CALENDAR, self.MouseClick, self.calend)
|
self.Bind(wx.lib.calendar.EVT_CALENDAR, self.MouseClick, self.calend)
|
||||||
|
|
||||||
# scroll bar for month selection
|
# scroll bar for month selection
|
||||||
|
self.scroll = wx.ScrollBar(self, -1, (100, 240), (200, 20), wx.SB_HORIZONTAL)
|
||||||
mID = wx.NewId()
|
|
||||||
|
|
||||||
self.scroll = wx.ScrollBar(self, mID, (100, 240), (200, 20), wx.SB_HORIZONTAL)
|
|
||||||
self.scroll.SetScrollbar(start_month-1, 1, 12, 1, True)
|
self.scroll.SetScrollbar(start_month-1, 1, 12, 1, True)
|
||||||
self.Bind(wx.EVT_COMMAND_SCROLL, self.Scroll, id=mID)
|
self.Bind(wx.EVT_COMMAND_SCROLL, self.Scroll, self.scroll)
|
||||||
|
|
||||||
# spin control for year selection
|
# spin control for year selection
|
||||||
|
|
||||||
self.dtext = wx.TextCtrl(self, -1, str(start_year), (200, 20), (60, -1))
|
self.dtext = wx.TextCtrl(self, -1, str(start_year), (200, 20), (60, -1))
|
||||||
h = self.dtext.GetSize().height
|
h = self.dtext.GetSize().height
|
||||||
|
|
||||||
mID = wx.NewId()
|
self.spin = wx.SpinButton(self, -1, (270, 20), (h*2, h))
|
||||||
self.spin = wx.SpinButton(self, mID, (270, 20), (h*2, h))
|
|
||||||
self.spin.SetRange(1980, 2010)
|
self.spin.SetRange(1980, 2010)
|
||||||
self.spin.SetValue(start_year)
|
self.spin.SetValue(start_year)
|
||||||
self.Bind(wx.EVT_SPIN, self.OnSpin, id=mID)
|
self.Bind(wx.EVT_SPIN, self.OnSpin, self.spin)
|
||||||
|
|
||||||
# button for calendar dialog test
|
# button for calendar dialog test
|
||||||
|
|
||||||
wx.StaticText(self, -1, "Test Calendar Dialog", (350, 50), (150, -1))
|
wx.StaticText(self, -1, "Test Calendar Dialog", (350, 50), (150, -1))
|
||||||
|
|
||||||
mID = wx.NewId()
|
|
||||||
bmp = images.getCalendarBitmap()
|
bmp = images.getCalendarBitmap()
|
||||||
self.but = wx.BitmapButton(self, mID, bmp, (380, 80))
|
self.but1 = wx.BitmapButton(self, -1, bmp, (380, 80))
|
||||||
self.Bind(wx.EVT_BUTTON, self.TestDlg, id=mID)
|
self.Bind(wx.EVT_BUTTON, self.TestDlg, self.but1)
|
||||||
|
|
||||||
# button for calendar window test
|
# button for calendar window test
|
||||||
|
|
||||||
wx.StaticText(self, -1, "Test Calendar Window", (350, 150), (150, -1))
|
wx.StaticText(self, -1, "Test Calendar Window", (350, 150), (150, -1))
|
||||||
|
|
||||||
mID = wx.NewId()
|
self.but2 = wx.BitmapButton(self, -1, bmp, (380, 180))
|
||||||
self.but = wx.BitmapButton(self, mID, bmp, (380, 180))
|
self.Bind(wx.EVT_BUTTON, self.TestFrame, self.but2)
|
||||||
self.Bind(wx.EVT_BUTTON, self.TestFrame, id=mID)
|
|
||||||
|
|
||||||
wx.StaticText(self, -1, "Test Calendar Print", (350, 250), (150, -1))
|
wx.StaticText(self, -1, "Test Calendar Print", (350, 250), (150, -1))
|
||||||
|
|
||||||
mID = wx.NewId()
|
self.but3 = wx.BitmapButton(self, -1, bmp, (380, 280))
|
||||||
self.but = wx.BitmapButton(self, mID, bmp, (380, 280))
|
self.Bind(wx.EVT_BUTTON, self.OnPreview, self.but3)
|
||||||
self.Bind(wx.EVT_BUTTON, self.OnPreview, id=mID)
|
|
||||||
|
|
||||||
# calendar dialog
|
# calendar dialog
|
||||||
|
|
||||||
def TestDlg(self, event): # test the date dialog
|
def TestDlg(self, event): # test the date dialog
|
||||||
dlg = calendar.CalenDlg(self)
|
dlg = wx.lib.calendar.CalenDlg(self)
|
||||||
dlg.Centre()
|
dlg.Centre()
|
||||||
|
|
||||||
if dlg.ShowModal() == wx.ID_OK:
|
if dlg.ShowModal() == wx.ID_OK:
|
||||||
@@ -214,7 +212,7 @@ class TestPanel(wx.Panel):
|
|||||||
self.ResetDisplay()
|
self.ResetDisplay()
|
||||||
self.log.WriteText('Month: %s\n' % value)
|
self.log.WriteText('Month: %s\n' % value)
|
||||||
|
|
||||||
name = calendar.Month[monthval]
|
name = wx.lib.calendar.Month[monthval]
|
||||||
self.date.SetValue(name)
|
self.date.SetValue(name)
|
||||||
|
|
||||||
# log mouse events
|
# log mouse events
|
||||||
@@ -280,7 +278,7 @@ class CalendFrame(wx.Frame):
|
|||||||
self.MakeToolMenu() # toolbar
|
self.MakeToolMenu() # toolbar
|
||||||
|
|
||||||
self.SetMenuBar(self.mainmenu)
|
self.SetMenuBar(self.mainmenu)
|
||||||
self.calend = calendar.wxCalendar(self, -1)
|
self.calend = wx.lib.calendar.Calendar(self, -1)
|
||||||
self.calend.SetCurrentDay()
|
self.calend.SetCurrentDay()
|
||||||
self.calend.grid_color = 'BLUE'
|
self.calend.grid_color = 'BLUE'
|
||||||
self.calend.SetBusType()
|
self.calend.SetBusType()
|
||||||
@@ -288,7 +286,7 @@ class CalendFrame(wx.Frame):
|
|||||||
|
|
||||||
self.ResetDisplay()
|
self.ResetDisplay()
|
||||||
|
|
||||||
self.Bind(calendar.EVT_CALENDAR, self.MouseClick, self.calend)
|
self.Bind(wx.lib.calendar.EVT_CALENDAR, self.MouseClick, self.calend)
|
||||||
|
|
||||||
def MouseClick(self, evt):
|
def MouseClick(self, evt):
|
||||||
text = '%s CLICK %02d/%02d/%d' % (evt.click, evt.day, evt.month, evt.year) # format date
|
text = '%s CLICK %02d/%02d/%d' % (evt.click, evt.day, evt.month, evt.year) # format date
|
||||||
@@ -471,7 +469,7 @@ class PrintCalend:
|
|||||||
size = DC.GetSize()
|
size = DC.GetSize()
|
||||||
DC.BeginDrawing()
|
DC.BeginDrawing()
|
||||||
|
|
||||||
cal = calendar.PrtCalDraw(self)
|
cal = wx.lib.calendar.PrtCalDraw(self)
|
||||||
|
|
||||||
if self.preview is None:
|
if self.preview is None:
|
||||||
cal.SetPSize(size[0]/self.pagew, size[1]/self.pageh)
|
cal.SetPSize(size[0]/self.pagew, size[1]/self.pageh)
|
||||||
@@ -664,8 +662,8 @@ def runTest(frame, nb, log):
|
|||||||
|
|
||||||
|
|
||||||
overview = """\
|
overview = """\
|
||||||
This control provides a calendar control class for displaying and selecting dates.
|
This control provides a Calendar control class for displaying and selecting dates.
|
||||||
In addition, the class is extended and can now be used for printing/previewing.
|
In addition, the class is extended and can be used for printing/previewing.
|
||||||
|
|
||||||
Additional features include weekend highlighting and business type Monday-Sunday
|
Additional features include weekend highlighting and business type Monday-Sunday
|
||||||
format.
|
format.
|
||||||
|
@@ -2,6 +2,11 @@
|
|||||||
#
|
#
|
||||||
# o Updated for wx namespace. Not tested though.
|
# o Updated for wx namespace. Not tested though.
|
||||||
#
|
#
|
||||||
|
# 12/17/2003 - Jeff Grimmett (grimmtooth@softhome.net)
|
||||||
|
#
|
||||||
|
# o Removed wx prefix from class name,
|
||||||
|
# updated reverse renamer
|
||||||
|
#
|
||||||
|
|
||||||
"""
|
"""
|
||||||
sorry no documentation...
|
sorry no documentation...
|
||||||
@@ -12,7 +17,7 @@ Christopher J. Fama
|
|||||||
import wx
|
import wx
|
||||||
import wx.html as html
|
import wx.html as html
|
||||||
|
|
||||||
class wxPyClickableHtmlWindow(html.HtmlWindow):
|
class PyClickableHtmlWindow(html.HtmlWindow):
|
||||||
"""
|
"""
|
||||||
Class for a wxHtmlWindow which responds to clicks on links by opening a
|
Class for a wxHtmlWindow which responds to clicks on links by opening a
|
||||||
browser pointed at that link, and to shift-clicks by copying the link
|
browser pointed at that link, and to shift-clicks by copying the link
|
||||||
|
@@ -33,6 +33,12 @@
|
|||||||
# integer argument expected, got float
|
# integer argument expected, got float
|
||||||
# newobj = _core.new_Rect(*args, **kwargs)
|
# newobj = _core.new_Rect(*args, **kwargs)
|
||||||
#
|
#
|
||||||
|
# 12/17/2003 - Jeff Grimmett (grimmtooth@softhome.net)
|
||||||
|
#
|
||||||
|
# o A few style-guide nips and tucks
|
||||||
|
# o Renamed wxCalendar to Calendar
|
||||||
|
# o Couple of bugfixes
|
||||||
|
#
|
||||||
|
|
||||||
import wx
|
import wx
|
||||||
|
|
||||||
@@ -235,7 +241,8 @@ class CalDraw:
|
|||||||
else:
|
else:
|
||||||
date = date + 7
|
date = date + 7
|
||||||
|
|
||||||
def GetRect(self): # get the display rectange list of the day grid
|
# get the display rectange list of the day grid
|
||||||
|
def GetRect(self):
|
||||||
cnt = 0
|
cnt = 0
|
||||||
for y in self.gridy[1:-1]:
|
for y in self.gridy[1:-1]:
|
||||||
for x in self.gridx[:-1]:
|
for x in self.gridx[:-1]:
|
||||||
@@ -251,7 +258,8 @@ class CalDraw:
|
|||||||
def GetOffset(self):
|
def GetOffset(self):
|
||||||
return self.st_pos
|
return self.st_pos
|
||||||
|
|
||||||
def DrawMonth(self): # month and year title
|
# month and year title
|
||||||
|
def DrawMonth(self):
|
||||||
month = Month[self.month]
|
month = Month[self.month]
|
||||||
|
|
||||||
sizef = 11
|
sizef = 11
|
||||||
@@ -328,7 +336,8 @@ class CalDraw:
|
|||||||
self.DC.DrawText(day, (x+diffx, y+diffy))
|
self.DC.DrawText(day, (x+diffx, y+diffy))
|
||||||
cnt_x = cnt_x + 1
|
cnt_x = cnt_x + 1
|
||||||
|
|
||||||
def DrawNum(self): # draw the day numbers
|
# draw the day numbers
|
||||||
|
def DrawNum(self):
|
||||||
f = wx.Font(10, self.font, wx.NORMAL, self.bold) # initial font setting
|
f = wx.Font(10, self.font, wx.NORMAL, self.bold) # initial font setting
|
||||||
|
|
||||||
if self.num_auto == True:
|
if self.num_auto == True:
|
||||||
@@ -391,18 +400,21 @@ class CalDraw:
|
|||||||
cnt_x = 0
|
cnt_x = 0
|
||||||
cnt_y = cnt_y + 1
|
cnt_y = cnt_y + 1
|
||||||
|
|
||||||
def Center(self): # calculate the dimensions in the center of the drawing area
|
# calculate the dimensions in the center of the drawing area
|
||||||
|
def Center(self):
|
||||||
bdw = self.x_mrg * 2
|
bdw = self.x_mrg * 2
|
||||||
bdh = self.y_mrg + self.y_end + self.title_offset
|
bdh = self.y_mrg + self.y_end + self.title_offset
|
||||||
|
|
||||||
self.dl_w = int((self.sizew-bdw)/7)
|
self.dl_w = int((self.sizew-bdw)/7)
|
||||||
self.dl_h = int((self.sizeh-bdh)/7)
|
self.dl_h = int((self.sizeh-bdh)/7)
|
||||||
|
|
||||||
self.dl_th = int(self.dl_h*self.cal_week_scale) # week title adjustment
|
# week title adjustment
|
||||||
|
self.dl_th = int(self.dl_h*self.cal_week_scale)
|
||||||
self.cwidth = self.dl_w * 7
|
self.cwidth = self.dl_w * 7
|
||||||
self.cheight = self.dl_h * 6 + self.dl_th
|
self.cheight = self.dl_h * 6 + self.dl_th
|
||||||
|
|
||||||
def DrawSel(self): # highlighted selected days
|
# highlighted selected days
|
||||||
|
def DrawSel(self):
|
||||||
for key in self.cal_sel.keys():
|
for key in self.cal_sel.keys():
|
||||||
sel_color = self.cal_sel[key][1]
|
sel_color = self.cal_sel[key][1]
|
||||||
brush = wx.Brush(wx.NamedColour(sel_color), wx.SOLID)
|
brush = wx.Brush(wx.NamedColour(sel_color), wx.SOLID)
|
||||||
@@ -417,14 +429,16 @@ class CalDraw:
|
|||||||
rect = self.rg[nkey]
|
rect = self.rg[nkey]
|
||||||
self.DC.DrawRectangle((rect.x, rect.y), (rect.width+1, rect.height+1))
|
self.DC.DrawRectangle((rect.x, rect.y), (rect.width+1, rect.height+1))
|
||||||
|
|
||||||
def DrawGrid(self): # calculate and draw the grid lines
|
# calculate and draw the grid lines
|
||||||
|
def DrawGrid(self):
|
||||||
self.DC.SetPen(wx.Pen(wx.NamedColour(self.grid_color), 0))
|
self.DC.SetPen(wx.Pen(wx.NamedColour(self.grid_color), 0))
|
||||||
|
|
||||||
self.gridx = []
|
self.gridx = []
|
||||||
self.gridy = []
|
self.gridy = []
|
||||||
|
|
||||||
self.x_st = self.cx_st + self.x_mrg
|
self.x_st = self.cx_st + self.x_mrg
|
||||||
self.y_st = self.cy_st + self.y_mrg + self.title_offset # start postion of draw
|
# start postion of draw
|
||||||
|
self.y_st = self.cy_st + self.y_mrg + self.title_offset
|
||||||
|
|
||||||
x1 = self.x_st
|
x1 = self.x_st
|
||||||
y1 = self.y_st
|
y1 = self.y_st
|
||||||
@@ -456,10 +470,12 @@ class PrtCalDraw(CalDraw):
|
|||||||
def InitValues(self):
|
def InitValues(self):
|
||||||
self.rg = {}
|
self.rg = {}
|
||||||
self.cal_sel = {}
|
self.cal_sel = {}
|
||||||
self.set_cx_st = 1.0 # start draw border location
|
# start draw border location
|
||||||
|
self.set_cx_st = 1.0
|
||||||
self.set_cy_st = 1.0
|
self.set_cy_st = 1.0
|
||||||
|
|
||||||
self.set_y_mrg = 0.2 # draw offset position
|
# draw offset position
|
||||||
|
self.set_y_mrg = 0.2
|
||||||
self.set_x_mrg = 0.2
|
self.set_x_mrg = 0.2
|
||||||
self.set_y_end = 0.2
|
self.set_y_end = 0.2
|
||||||
|
|
||||||
@@ -471,7 +487,7 @@ class PrtCalDraw(CalDraw):
|
|||||||
def SetPreview(self, preview):
|
def SetPreview(self, preview):
|
||||||
self.preview = preview
|
self.preview = preview
|
||||||
|
|
||||||
class wxCalendar(wx.Window):
|
class Calendar(wx.Window):
|
||||||
def __init__(self, parent, id, pos=wx.DefaultPosition, size=wx.DefaultSize):
|
def __init__(self, parent, id, pos=wx.DefaultPosition, size=wx.DefaultSize):
|
||||||
wx.Window.__init__(self, parent, id, pos, size)
|
wx.Window.__init__(self, parent, id, pos, size)
|
||||||
|
|
||||||
@@ -485,8 +501,9 @@ class wxCalendar(wx.Window):
|
|||||||
self.show_weekend = False
|
self.show_weekend = False
|
||||||
self.cal_type = "NORMAL"
|
self.cal_type = "NORMAL"
|
||||||
|
|
||||||
|
# font colors
|
||||||
self.week_color = 'LIGHT GREY'
|
self.week_color = 'LIGHT GREY'
|
||||||
self.week_font_color = 'BLACK' # font colors
|
self.week_font_color = 'BLACK'
|
||||||
|
|
||||||
self.select_list = []
|
self.select_list = []
|
||||||
|
|
||||||
@@ -499,7 +516,8 @@ class wxCalendar(wx.Window):
|
|||||||
self.sel_key = None # last used by
|
self.sel_key = None # last used by
|
||||||
self.sel_lst = [] # highlighted selected days
|
self.sel_lst = [] # highlighted selected days
|
||||||
|
|
||||||
self.SetNow() # default calendar for current month
|
# default calendar for current month
|
||||||
|
self.SetNow()
|
||||||
|
|
||||||
self.size = None
|
self.size = None
|
||||||
self.set_day = None
|
self.set_day = None
|
||||||
@@ -546,10 +564,10 @@ class wxCalendar(wx.Window):
|
|||||||
self.size = set_size
|
self.size = set_size
|
||||||
|
|
||||||
def SetSelDay(self, sel):
|
def SetSelDay(self, sel):
|
||||||
self.sel_lst = sel # list of highlighted days
|
# list of highlighted days
|
||||||
|
self.sel_lst = sel
|
||||||
|
|
||||||
# get the current date
|
# get the current date
|
||||||
|
|
||||||
def SetNow(self):
|
def SetNow(self):
|
||||||
dt = now()
|
dt = now()
|
||||||
self.month = dt.month
|
self.month = dt.month
|
||||||
@@ -557,7 +575,6 @@ class wxCalendar(wx.Window):
|
|||||||
self.day = dt.day
|
self.day = dt.day
|
||||||
|
|
||||||
# set the current day
|
# set the current day
|
||||||
|
|
||||||
def SetCurrentDay(self):
|
def SetCurrentDay(self):
|
||||||
self.SetNow()
|
self.SetNow()
|
||||||
self.set_day = self.day
|
self.set_day = self.day
|
||||||
@@ -649,7 +666,8 @@ class wxCalendar(wx.Window):
|
|||||||
|
|
||||||
# calendar drawing
|
# calendar drawing
|
||||||
|
|
||||||
def SetWeekColor(self, font_color, week_color): # set font and background color for week title
|
def SetWeekColor(self, font_color, week_color):
|
||||||
|
# set font and background color for week title
|
||||||
self.week_font_color = font_color
|
self.week_font_color = font_color
|
||||||
self.week_color = week_color
|
self.week_color = week_color
|
||||||
|
|
||||||
@@ -658,7 +676,8 @@ class wxCalendar(wx.Window):
|
|||||||
self.select_list.append(list_val)
|
self.select_list.append(list_val)
|
||||||
|
|
||||||
def ShowWeekEnd(self):
|
def ShowWeekEnd(self):
|
||||||
self.show_weekend = True # highlight weekend
|
# highlight weekend
|
||||||
|
self.show_weekend = True
|
||||||
|
|
||||||
def SetBusType(self):
|
def SetBusType(self):
|
||||||
self.cal_type = "BUS"
|
self.cal_type = "BUS"
|
||||||
@@ -714,7 +733,6 @@ class wxCalendar(wx.Window):
|
|||||||
DC.EndDrawing()
|
DC.EndDrawing()
|
||||||
|
|
||||||
# draw the selection rectangle
|
# draw the selection rectangle
|
||||||
|
|
||||||
def DrawRect(self, key, color = 'BLACK', width = 0):
|
def DrawRect(self, key, color = 'BLACK', width = 0):
|
||||||
if key == None:
|
if key == None:
|
||||||
return
|
return
|
||||||
@@ -739,13 +757,15 @@ class wxCalendar(wx.Window):
|
|||||||
|
|
||||||
def SelectDay(self, key):
|
def SelectDay(self, key):
|
||||||
sel_size = 1
|
sel_size = 1
|
||||||
self.DrawRect(self.sel_key, self.back_color, sel_size) # clear large selection
|
# clear large selection
|
||||||
|
self.DrawRect(self.sel_key, self.back_color, sel_size)
|
||||||
|
|
||||||
if self.hide_grid is False:
|
if self.hide_grid is False:
|
||||||
self.DrawRect(self.sel_key, self.grid_color)
|
self.DrawRect(self.sel_key, self.grid_color)
|
||||||
|
|
||||||
self.DrawRect(key, self.sel_color, sel_size)
|
self.DrawRect(key, self.sel_color, sel_size)
|
||||||
self.sel_key = key # store last used by
|
# store last used by
|
||||||
|
self.sel_key = key
|
||||||
self.select_day = None
|
self.select_day = None
|
||||||
|
|
||||||
def ClearDsp(self):
|
def ClearDsp(self):
|
||||||
@@ -756,7 +776,7 @@ class CalenDlg(wx.Dialog):
|
|||||||
wx.Dialog.__init__(self, parent, -1, "Event Calendar", wx.DefaultPosition, (280, 360))
|
wx.Dialog.__init__(self, parent, -1, "Event Calendar", wx.DefaultPosition, (280, 360))
|
||||||
|
|
||||||
# set the calendar and attributes
|
# set the calendar and attributes
|
||||||
self.calend = wxCalendar(self, -1, (20, 60), (240, 200))
|
self.calend = Calendar(self, -1, (20, 60), (240, 200))
|
||||||
|
|
||||||
if month == None:
|
if month == None:
|
||||||
self.calend.SetCurrentDay()
|
self.calend.SetCurrentDay()
|
||||||
@@ -803,7 +823,7 @@ class CalenDlg(wx.Dialog):
|
|||||||
btn = wx.Button(self, -1, ' Ok ', (x_pos, y_pos), but_size)
|
btn = wx.Button(self, -1, ' Ok ', (x_pos, y_pos), but_size)
|
||||||
self.Bind(wx.EVT_BUTTON, self.OnOk, btn)
|
self.Bind(wx.EVT_BUTTON, self.OnOk, btn)
|
||||||
|
|
||||||
btn = wx.Button(self, mID, ' Close ', (x_pos + 120, y_pos), but_size)
|
btn = wx.Button(self, -1, ' Close ', (x_pos + 120, y_pos), but_size)
|
||||||
self.Bind(wx.EVT_BUTTON, self.OnCancel, btn)
|
self.Bind(wx.EVT_BUTTON, self.OnCancel, btn)
|
||||||
|
|
||||||
def OnOk(self, event):
|
def OnOk(self, event):
|
||||||
@@ -815,7 +835,8 @@ class CalenDlg(wx.Dialog):
|
|||||||
# log the mouse clicks
|
# log the mouse clicks
|
||||||
def MouseClick(self, evt):
|
def MouseClick(self, evt):
|
||||||
self.month = evt.month
|
self.month = evt.month
|
||||||
self.result = [evt.click, str(evt.day), Month[evt.month], str(evt.year)] # result click type and date
|
# result click type and date
|
||||||
|
self.result = [evt.click, str(evt.day), Month[evt.month], str(evt.year)]
|
||||||
|
|
||||||
if evt.click == 'DLEFT':
|
if evt.click == 'DLEFT':
|
||||||
self.EndModal(wx.ID_OK)
|
self.EndModal(wx.ID_OK)
|
||||||
|
@@ -6,4 +6,4 @@ import wx.lib.ClickableHtmlWindow
|
|||||||
|
|
||||||
__doc__ = wx.lib.ClickableHtmlWindow.__doc__
|
__doc__ = wx.lib.ClickableHtmlWindow.__doc__
|
||||||
|
|
||||||
wxPyClickableHtmlWindow = wx.lib.ClickableHtmlWindow.wxPyClickableHtmlWindow
|
wxPyClickableHtmlWindow = wx.lib.ClickableHtmlWindow.PyClickableHtmlWindow
|
||||||
|
@@ -6,6 +6,10 @@ import wx.lib.calendar
|
|||||||
|
|
||||||
__doc__ = wx.lib.calendar.__doc__
|
__doc__ = wx.lib.calendar.__doc__
|
||||||
|
|
||||||
|
wxEVT_COMMAND_PYCALENDAR_DAY_CLICKED = wx.lib.calendar.wxEVT_COMMAND_PYCALENDAR_DAY_CLICKED
|
||||||
|
EVT_CALENDAR = wx.lib.calendar.EVT_CALENDAR
|
||||||
|
|
||||||
|
|
||||||
Date = wx.lib.calendar.Date
|
Date = wx.lib.calendar.Date
|
||||||
FillDate = wx.lib.calendar.FillDate
|
FillDate = wx.lib.calendar.FillDate
|
||||||
FormatDay = wx.lib.calendar.FormatDay
|
FormatDay = wx.lib.calendar.FormatDay
|
||||||
@@ -27,5 +31,7 @@ CalDraw = wx.lib.calendar.CalDraw
|
|||||||
CalenDlg = wx.lib.calendar.CalenDlg
|
CalenDlg = wx.lib.calendar.CalenDlg
|
||||||
GetMonthList = wx.lib.calendar.GetMonthList
|
GetMonthList = wx.lib.calendar.GetMonthList
|
||||||
PrtCalDraw = wx.lib.calendar.PrtCalDraw
|
PrtCalDraw = wx.lib.calendar.PrtCalDraw
|
||||||
wxCalendar = wx.lib.calendar.wxCalendar
|
wxCalendar = wx.lib.calendar.Calendar
|
||||||
|
|
||||||
|
wxEVT_COMMAND_PYCALENDAR_DAY_CLICKED = wx.lib.calendar.wxEVT_COMMAND_PYCALENDAR_DAY_CLICKED
|
||||||
|
EVT_CALENDAR = wx.lib.calendar.EVT_CALENDAR
|
||||||
|
Reference in New Issue
Block a user