Mailing list archives: January 2006

Site index · List index
Message list1 · 2 · 3 · Next »Thread · Author · Date
va...@yahoo.ca> ;>- ssl.askIgnoreSSLError( err.pem, - messages.SSL_HOST_MISMATCH % \ - {'expectedHost': err.expectedHost, - 'actualHost': err.actualHost}, Tue, 22 Feb, 04:55
va...@yahoo.ca> ;>- ssl.askIgnoreSSLError( err.pem, - messages.SSL_HOST_MISMATCH % \ - {'expectedHost': err.expectedHost, - 'actualHost': err.actualHost}, Tue, 22 Feb, 04:55
va...@yahoo.ca> ;>- ssl.askIgnoreSSLError( err.pem, - messages.SSL_HOST_MISMATCH % \ - {'expectedHost': err.expectedHost, - 'actualHost': err.actualHost}, Tue, 22 Feb, 04:55
va...@yahoo.ca> ;>- ssl.askIgnoreSSLError( err.pem, - messages.SSL_HOST_MISMATCH % \ - {'expectedHost': err.expectedHost, - 'actualHost': err.actualHost}, Tue, 22 Feb, 04:55
va...@yahoo.ca> ;>- ssl.askIgnoreSSLError( err.pem, - messages.SSL_HOST_MISMATCH % \ - {'expectedHost': err.expectedHost, - 'actualHost': err.actualHost}, Tue, 22 Feb, 04:55
va...@yahoo.ca> er-App/ocap/chandler/wxui/__init__.py___________________________________________________________________Name:svn:eol-style+native</span> Tue, 22 Feb, 04:55
va...@yahoo.ca> er-App/ocap/chandler/wxui/__init__.py___________________________________________________________________Name:svn:eol-style+native</span> Tue, 22 Feb, 04:55
va...@yahoo.ca> er-App/ocap/chandler/wxui/__init__.py___________________________________________________________________Name:svn:eol-style+native</span> Tue, 22 Feb, 04:55
va...@yahoo.ca> er-App/ocap/chandler/wxui/__init__.py___________________________________________________________________Name:svn:eol-style+native</span> Tue, 22 Feb, 04:55
va...@yahoo.ca> er-App/ocap/chandler/wxui/__init__.py___________________________________________________________________Name:svn:eol-style+native</span> Tue, 22 Feb, 04:55
va...@yahoo.ca> er-App/ocap/chandler/wxui/__init__.py___________________________________________________________________Name:svn:eol-style+native</span> Tue, 22 Feb, 04:55
va...@yahoo.ca> er-App/ocap/chandler/wxui/__init__.py___________________________________________________________________Name:svn:eol-style+native</span> Tue, 22 Feb, 04:55
va...@yahoo.ca> er-App/ocap/chandler/wxui/__init__.py___________________________________________________________________Name:svn:eol-style+native</span> Tue, 22 Feb, 04:55
va...@yahoo.ca> er-App/ocap/chandler/wxui/__init__.py___________________________________________________________________Name:svn:eol-style+native</span> Tue, 22 Feb, 04:55
va...@yahoo.ca> er-App/ocap/chandler/wxui/__init__.py___________________________________________________________________Name:svn:eol-style+native</span> Tue, 22 Feb, 04:55
Parlante ayed):-y=self.DrawMonth(gc,dc,dateToDraw,y,True,font,boldFont,-width,height,transform)-dateToDraw=MonthDelta(dateToDraw,1)---defOnClick(self,event):-(region,value)=self.HitTest(event.GetPosition())--ifregion==CAL_HITTEST_DAY:-self.ChangeDay(value)-self.GenerateEvents(EVT_MINI_CALENDAR_DAY_CHANGED,-EVT_MINI_CALENDAR_SEL_CHANGED)--elifregion==CAL_HITTEST_HEADER:-event.Skip()--elifregion==CAL_HITTEST_TODAY:-self.SetDateAndNotify(value)-self.SetVisibleDateAndNotify(value,True)---elifregion==CAL_HITTEST_SURROUNDING_WEEK:-self.SetVisibleDateAndNotify(value,False)--elifregionin(CAL_HITTEST_DECMONTH,CAL_HITTEST_INCMONTH):-self.SetVisibleDate(value,True)--elifregion==CAL_HITTEST_NOWHERE:-event.Skip()--else:-assertFalse,&quot;Unknownhitregion?&quot;---defOnDClick(self,event):-(region,value)=self.HitTest(event.GetPosition())--ifregionin(CAL_HITTEST_DAY,CAL_HITTEST_SURROUNDING_WEEK):-self.GenerateEvents(EVT_MINI_CALENDAR_DOUBLECLICKED)-else:-event.Skip()--#overridesomebaseclassvirtuals-defDoGetBestSize(self):--dc=wx.ClientDC(self)-font=self.GetDeviceFont()-dc.SetFont(font)--#determinethecolumnwidth(weassumethatthewidestdigit-#plusbusybariswiderthananyweekdaycharacter(hopefully-#inanylanguage))-self.widthCol=0-fordayinxrange(1,32):-(self.heightRow,width)=dc.GetTextExtent(unicode(day))-ifwidth&gt;self.widthCol:-self.widthCol=width--#leavesomemargins-self.widthCol+=8-self.heightRow+=6--self.rowOffset=self.heightRow*2-self.todayHeight=self.heightRow+2--width,height=self.CalcGeometry()-best=wx.Size(width,height)-self.CacheBestSize(best)--returnbest--ifwx.Platform=='__WXMAC__':-defGetDeviceFont(self):-font=self.GetFont()--font=wx.Font(font.GetPointSize()-2,font.GetFamily(),-font.GetStyle(),font.GetWeight(),-font.GetUnderlined(),font.GetFaceName(),-font.GetEncoding())--returnfont-else:-defGetDeviceFont(self):-returnself.GetFont()--defCalcGeometry(self):-&quot;&quot;&quot;-returnbest,unscaled,widthandsize-&quot;&quot;&quot;-width=DAYS_PER_WEEK*self.widthCol+2*SEPARATOR_MARGIN+WIDTH_CORRECTION-height=self.HeaderHeight()+self.months_displayed*self.MonthHeight()--returnwidth,height--defIsExposed(self,x,y,w,h,transform=None):--iftransformisnotNone:-x,y=transform.TransformPoint(x,y)-w,h=transform.TransformPoint(w,h)--returnsuper(PyMiniCalendar,self).IsExposed(x,y,w,h)--defDrawMonth(self,gc,dc,startDate,y,highlightDate,font,boldFont,-clientWidth,clientHeight,transform):-&quot;&quot;&quot;-drawasinglemonth-returntheupdatedvalueofy-&quot;&quot;&quot;--mainFont=gc.CreateFont(font,self.mainColour)-highlightFont=gc.CreateFont(font,self.highlightColour)-lightFont=gc.CreateFont(font,self.lightColour)-blackFont=gc.CreateFont(boldFont,wx.BLACK)-transparentBrush=gc.CreateBrush(wx.TRANSPARENT_BRUSH)--#Getextentofmonth-name+year-headertext=_(u'%(currentMonth)s%(currentYear)d')%{-'currentMonth':self.months[startDate.month-1],-'currentYear':startDate.year}-gc.SetFont(blackFont)-monthw,monthh=gc.GetTextExtent(headertext)--#drawmonth-namecenteredaboveweekdays-monthx=(clientWidth-monthw)/2-monthy=((self.heightRow-monthh)/2)+y+3-gc.DrawText(headertext,monthx,monthy,transparentBrush)--y+=self.heightRow+EXTRA_MONTH_HEIGHT--#drawtheweekdaynames-ifself.IsExposed(0,y,DAYS_PER_WEEK*self.widthCol,self.heightRow,-transform):-gc.SetFont(gc.CreateFont(font,self.colHeaderFg))-gc.SetBrush(self.colHeaderBgBrush)-gc.SetPen(self.colHeaderBgPen)--#drawthebackground-gc.DrawRectangle(0,y-1,clientWidth,self.heightRow+2)--forwdinxrange(DAYS_PER_WEEK):-n=(wd+self.firstDayOfWeek-1)%DAYS_PER_WEEK-dayw=gc.GetTextExtent(self.weekdays[n+1])[0]-gc.DrawText(self.weekdays[n+1],-(wd*self.widthCol)+SEPARATOR_MARGIN+-((self.widthCol-dayw)/2),#centertheday-name-y,-transparentBrush)--y+=self.heightRow-1--weekDate=date(startDate.year,startDate.month,1)-weekDate=self.FirstDayOfWeek(weekDate)--gc.SetFont(mainFont)--fornWeekinxrange(1,WEEKS_TO_DISPLAY+1):-#drawlinesbetweeneachsetofweeks-ifnWeek&lt;=WEEKS_TO_DISPLAYandnWeek!=1:-gc.SetPen(self.lineColourPen)-self.DrawLine(gc,SEPARATOR_MARGIN,y-1,-clientWidth-SEPARATOR_MARGIN,-y-1)--#iftheupdateregiondoesn'tintersectthisrow,don'tpaintit-ifnotself.IsExposed(0,y,DAYS_PER_WEEK*self.widthCol,-self.heightRow-1,transform):-weekDate+=timedelta(days=7)-y+=self.heightRow-continue--#don'tdrawlastweekifnoneofthedaysappearinthemonth-ifnWeek==WEEKS_TO_DISPLAYandweekDate.month!=startDate.month:-weekDate+=timedelta(days=7)-y+=self.heightRow-continue--forweekDayinxrange(DAYS_PER_WEEK):--dayStr=str(weekDate.day)-width=gc.GetTextExtent(dayStr)[0]--columnStart=SEPARATOR_MARGIN+weekDay*self.widthCol-x=columnStart+(self.widthCol-width)/2--ifhighlightDate:-#eitherhighlighttheselectedweekorthe-#selecteddaydependinguponthestyle-highlightWeek=(self.GetWindowStyle()&amp;-CAL_HIGHLIGHT_WEEK)!=0--if(self.hoverDate==weekDateor-#onlyhighlightdaysthatfallinthecurrentmonth-(weekDate.month==startDate.monthand-#highlightingweekandtheweekwearedrawingmatches-((highlightWeekand-self.CompareWeeks(weekDate,self.selectedDate))or-#highlightingasingleday-(nothighlightWeekand-weekDate==self.selectedDate)))):--startX=columnStart+1-width=self.widthCol--gc.SetFont(highlightFont)-gc.SetBrush(self.highlightColourBrush)-gc.SetPen(self.highlightColourPen)--gc.DrawRectangle(startX,y,width,self.heightRow-2)--#drawfree/busyindicator-ifweekDate.month==startDate.month:-busyPercentage=self.GetBusy(weekDate)-assertbusyPercentage&gt;=0-ifbusyPercentage&gt;0:-height=(self.heightRow-Y_ADJUSTMENT_BIG)*busyPercentage-gc.SetBrush(self.busyColourBrush)-gc.SetPen(wx.TRANSPARENT_PEN)-gc.DrawRectangle(columnStart+1,-y+self.heightRow-height-2,2,height)--ifweekDate.month!=startDate.month:-#surroundingweekorout-of-range-#draw&quot;disabled&quot;-gc.SetFont(lightFont)-else:-gc.SetBrush(wx.BLACK_BRUSH)-gc.SetPen(wx.BLACK_PEN)--#todayshouldbeprintedasbold-ifweekDate==date.today():-gc.SetFont(blackFont)-else:-gc.SetFont(mainFont)--gc.DrawText(dayStr,x,y+Y_ADJUSTMENT_SMALL,-wx.NullGraphicsBrush)--weekDate+=timedelta(days=1)--y+=self.heightRow--returny--defSetDateAndNotify(self,date):-&quot;&quot;&quot;-setthedateandsendthenotification-&quot;&quot;&quot;-self.SetDate(date)-self.GenerateEvents(EVT_MINI_CALENDAR_YEAR_CHANGED,-EVT_MINI_CALENDAR_SEL_CHANGED)--defSetVisibleDate(self,date,setVisible):--sameMonth=(self.firstVisibleDate.month==date.month)-sameYear=(self.firstVisibleDate.year==date.year)--ifsameMonthandsameYear:-self.ChangeDay(date)-else:--ifsetVisible:-self.firstVisibleDate=date--ifnotsetVisible:-self.selectedDate=date--self.GenerateEvents(EVT_MINI_CALENDAR_UPDATE_BUSY)--#updatethecalendar-self.Refresh(False)--defSetVisibleDateAndNotify(self,newDate,setVisible):-ifnotsetVisibleandself.selectedDateisnotNone:-oldDate=self.selectedDate-else:-oldDate=self.firstVisibleDate--ifnewDate.year!=oldDate.year:-eventType=EVT_MINI_CALENDAR_YEAR_CHANGED-elifnewDate.month!=oldDate.month:-eventType=EVT_MINI_CALENDAR_MONTH_CHANGED-elifnewDate.day!=oldDate.day:-eventType=EVT_MINI_CALENDAR_DAY_CHANGED-else:-return--self.SetVisibleDate(newDate,setVisible)-self.GenerateEvents(eventType,EVT_MINI_CALENDAR_SEL_CHANGED)---defFirstDayOfWeek(self,targetDate):-&quot;&quot;&quot;-rewindtheselecteddatetothepreviousspecifieddate--Unfortunately,firstDayOfWeekhassunday=1,andweekday()-hasmonday=0,sothey'reactuallyoffby2!-&quot;&quot;&quot;-dayAdjust=(self.firstDayOfWeek-1)-(targetDate.weekday()+1)-ifdayAdjust&gt;0:-dayAdjust-=7-elifdayAdjust==-7:-dayAdjust=0--returntargetDate+timedelta(days=dayAdjust)--defGetWeekOfMonth(self,dt):-&quot;&quot;&quot;-theremaybeissueswithmonday/sundayfirstdayofweek-&quot;&quot;&quot;-week=self.FirstDayOfWeek(dt)-firstWeek=self.FirstDayOfWeek(date(dt.year,dt.month,1))--return(week-firstWeek).days/7+1---defGetWeek(self,targetDate,useRelative=True):-&quot;&quot;&quot;-gettheweek(row,inrange1..WEEKS_TO_DISPLAY)forthegivendate-&quot;&quot;&quot;-#weekofthemonth-ifuseRelative:-returnself.GetWeekOfMonth(targetDate)--#weekoftheyear-targetDate=self.FirstDayOfWeek(targetDate)-year,week,day=targetDate.isocalendar()--returnweek--defCompareWeeks(self,date1,date2):--d1w1=self.FirstDayOfWeek(date1).isocalendar()[:2]-d2w2=self.FirstDayOfWeek(date2).isocalendar()[:2]-returnd1w1==d2w2--defRefreshDate(self,date):-&quot;&quot;&quot;-redrawthegivendate-&quot;&quot;&quot;-#XXXthisdoesn'trefreshtheweekforallvisiblemonths-x=0-y=(self.heightRow*(self.GetWeek(date)-1)+-self.todayHeight+EXTRA_MONTH_HEIGHT+self.rowOffset)--width=DAYS_PER_WEEK*self.widthCol+2*SEPARATOR_MARGIN-height=self.heightRow--ifself.transform:-self.transform.Invert()-x,y=self.transform.TransformPoint(x,y)-width,height=self.transform.TransformDistance(width,height)-self.transform.Invert()--rect=wx.Rect(x,y,width,height)-self.RefreshRect(rect,False)--defGetBusy(self,date):-&quot;&quot;&quot;-getthebusystateforthedesiredposition-&quot;&quot;&quot;-returnself.busyPercent.get(date,0.0)--defChangeDay(self,date):-&quot;&quot;&quot;-changethedateinsidethesamemonth/year-&quot;&quot;&quot;-ifdate!=self.selectedDate:-oldDate=self.selectedDate-else:-oldDate=self.oldDate--ifself.selectedDate!=date:-self.selectedDate=date--ifoldDateisnotNone:-self.RefreshDate(oldDate)-self.RefreshDate(date)--defGenerateEvents(self,*events):-&quot;&quot;&quot;-generatethegivencalendarevent(s)-&quot;&quot;&quot;-forevtinevents:-event=wx.PyCommandEvent(evt.evtType[0])-self.GetEventHandler().ProcessEvent(event)-</span> Sat, 09 Apr, 03:30
Parlante ayed):-y=self.DrawMonth(gc,dc,dateToDraw,y,True,font,boldFont,-width,height,transform)-dateToDraw=MonthDelta(dateToDraw,1)---defOnClick(self,event):-(region,value)=self.HitTest(event.GetPosition())--ifregion==CAL_HITTEST_DAY:-self.ChangeDay(value)-self.GenerateEvents(EVT_MINI_CALENDAR_DAY_CHANGED,-EVT_MINI_CALENDAR_SEL_CHANGED)--elifregion==CAL_HITTEST_HEADER:-event.Skip()--elifregion==CAL_HITTEST_TODAY:-self.SetDateAndNotify(value)-self.SetVisibleDateAndNotify(value,True)---elifregion==CAL_HITTEST_SURROUNDING_WEEK:-self.SetVisibleDateAndNotify(value,False)--elifregionin(CAL_HITTEST_DECMONTH,CAL_HITTEST_INCMONTH):-self.SetVisibleDate(value,True)--elifregion==CAL_HITTEST_NOWHERE:-event.Skip()--else:-assertFalse,&quot;Unknownhitregion?&quot;---defOnDClick(self,event):-(region,value)=self.HitTest(event.GetPosition())--ifregionin(CAL_HITTEST_DAY,CAL_HITTEST_SURROUNDING_WEEK):-self.GenerateEvents(EVT_MINI_CALENDAR_DOUBLECLICKED)-else:-event.Skip()--#overridesomebaseclassvirtuals-defDoGetBestSize(self):--dc=wx.ClientDC(self)-font=self.GetDeviceFont()-dc.SetFont(font)--#determinethecolumnwidth(weassumethatthewidestdigit-#plusbusybariswiderthananyweekdaycharacter(hopefully-#inanylanguage))-self.widthCol=0-fordayinxrange(1,32):-(self.heightRow,width)=dc.GetTextExtent(unicode(day))-ifwidth&gt;self.widthCol:-self.widthCol=width--#leavesomemargins-self.widthCol+=8-self.heightRow+=6--self.rowOffset=self.heightRow*2-self.todayHeight=self.heightRow+2--width,height=self.CalcGeometry()-best=wx.Size(width,height)-self.CacheBestSize(best)--returnbest--ifwx.Platform=='__WXMAC__':-defGetDeviceFont(self):-font=self.GetFont()--font=wx.Font(font.GetPointSize()-2,font.GetFamily(),-font.GetStyle(),font.GetWeight(),-font.GetUnderlined(),font.GetFaceName(),-font.GetEncoding())--returnfont-else:-defGetDeviceFont(self):-returnself.GetFont()--defCalcGeometry(self):-&quot;&quot;&quot;-returnbest,unscaled,widthandsize-&quot;&quot;&quot;-width=DAYS_PER_WEEK*self.widthCol+2*SEPARATOR_MARGIN+WIDTH_CORRECTION-height=self.HeaderHeight()+self.months_displayed*self.MonthHeight()--returnwidth,height--defIsExposed(self,x,y,w,h,transform=None):--iftransformisnotNone:-x,y=transform.TransformPoint(x,y)-w,h=transform.TransformPoint(w,h)--returnsuper(PyMiniCalendar,self).IsExposed(x,y,w,h)--defDrawMonth(self,gc,dc,startDate,y,highlightDate,font,boldFont,-clientWidth,clientHeight,transform):-&quot;&quot;&quot;-drawasinglemonth-returntheupdatedvalueofy-&quot;&quot;&quot;--mainFont=gc.CreateFont(font,self.mainColour)-highlightFont=gc.CreateFont(font,self.highlightColour)-lightFont=gc.CreateFont(font,self.lightColour)-blackFont=gc.CreateFont(boldFont,wx.BLACK)-transparentBrush=gc.CreateBrush(wx.TRANSPARENT_BRUSH)--#Getextentofmonth-name+year-headertext=_(u'%(currentMonth)s%(currentYear)d')%{-'currentMonth':self.months[startDate.month-1],-'currentYear':startDate.year}-gc.SetFont(blackFont)-monthw,monthh=gc.GetTextExtent(headertext)--#drawmonth-namecenteredaboveweekdays-monthx=(clientWidth-monthw)/2-monthy=((self.heightRow-monthh)/2)+y+3-gc.DrawText(headertext,monthx,monthy,transparentBrush)--y+=self.heightRow+EXTRA_MONTH_HEIGHT--#drawtheweekdaynames-ifself.IsExposed(0,y,DAYS_PER_WEEK*self.widthCol,self.heightRow,-transform):-gc.SetFont(gc.CreateFont(font,self.colHeaderFg))-gc.SetBrush(self.colHeaderBgBrush)-gc.SetPen(self.colHeaderBgPen)--#drawthebackground-gc.DrawRectangle(0,y-1,clientWidth,self.heightRow+2)--forwdinxrange(DAYS_PER_WEEK):-n=(wd+self.firstDayOfWeek-1)%DAYS_PER_WEEK-dayw=gc.GetTextExtent(self.weekdays[n+1])[0]-gc.DrawText(self.weekdays[n+1],-(wd*self.widthCol)+SEPARATOR_MARGIN+-((self.widthCol-dayw)/2),#centertheday-name-y,-transparentBrush)--y+=self.heightRow-1--weekDate=date(startDate.year,startDate.month,1)-weekDate=self.FirstDayOfWeek(weekDate)--gc.SetFont(mainFont)--fornWeekinxrange(1,WEEKS_TO_DISPLAY+1):-#drawlinesbetweeneachsetofweeks-ifnWeek&lt;=WEEKS_TO_DISPLAYandnWeek!=1:-gc.SetPen(self.lineColourPen)-self.DrawLine(gc,SEPARATOR_MARGIN,y-1,-clientWidth-SEPARATOR_MARGIN,-y-1)--#iftheupdateregiondoesn'tintersectthisrow,don'tpaintit-ifnotself.IsExposed(0,y,DAYS_PER_WEEK*self.widthCol,-self.heightRow-1,transform):-weekDate+=timedelta(days=7)-y+=self.heightRow-continue--#don'tdrawlastweekifnoneofthedaysappearinthemonth-ifnWeek==WEEKS_TO_DISPLAYandweekDate.month!=startDate.month:-weekDate+=timedelta(days=7)-y+=self.heightRow-continue--forweekDayinxrange(DAYS_PER_WEEK):--dayStr=str(weekDate.day)-width=gc.GetTextExtent(dayStr)[0]--columnStart=SEPARATOR_MARGIN+weekDay*self.widthCol-x=columnStart+(self.widthCol-width)/2--ifhighlightDate:-#eitherhighlighttheselectedweekorthe-#selecteddaydependinguponthestyle-highlightWeek=(self.GetWindowStyle()&amp;-CAL_HIGHLIGHT_WEEK)!=0--if(self.hoverDate==weekDateor-#onlyhighlightdaysthatfallinthecurrentmonth-(weekDate.month==startDate.monthand-#highlightingweekandtheweekwearedrawingmatches-((highlightWeekand-self.CompareWeeks(weekDate,self.selectedDate))or-#highlightingasingleday-(nothighlightWeekand-weekDate==self.selectedDate)))):--startX=columnStart+1-width=self.widthCol--gc.SetFont(highlightFont)-gc.SetBrush(self.highlightColourBrush)-gc.SetPen(self.highlightColourPen)--gc.DrawRectangle(startX,y,width,self.heightRow-2)--#drawfree/busyindicator-ifweekDate.month==startDate.month:-busyPercentage=self.GetBusy(weekDate)-assertbusyPercentage&gt;=0-ifbusyPercentage&gt;0:-height=(self.heightRow-Y_ADJUSTMENT_BIG)*busyPercentage-gc.SetBrush(self.busyColourBrush)-gc.SetPen(wx.TRANSPARENT_PEN)-gc.DrawRectangle(columnStart+1,-y+self.heightRow-height-2,2,height)--ifweekDate.month!=startDate.month:-#surroundingweekorout-of-range-#draw&quot;disabled&quot;-gc.SetFont(lightFont)-else:-gc.SetBrush(wx.BLACK_BRUSH)-gc.SetPen(wx.BLACK_PEN)--#todayshouldbeprintedasbold-ifweekDate==date.today():-gc.SetFont(blackFont)-else:-gc.SetFont(mainFont)--gc.DrawText(dayStr,x,y+Y_ADJUSTMENT_SMALL,-wx.NullGraphicsBrush)--weekDate+=timedelta(days=1)--y+=self.heightRow--returny--defSetDateAndNotify(self,date):-&quot;&quot;&quot;-setthedateandsendthenotification-&quot;&quot;&quot;-self.SetDate(date)-self.GenerateEvents(EVT_MINI_CALENDAR_YEAR_CHANGED,-EVT_MINI_CALENDAR_SEL_CHANGED)--defSetVisibleDate(self,date,setVisible):--sameMonth=(self.firstVisibleDate.month==date.month)-sameYear=(self.firstVisibleDate.year==date.year)--ifsameMonthandsameYear:-self.ChangeDay(date)-else:--ifsetVisible:-self.firstVisibleDate=date--ifnotsetVisible:-self.selectedDate=date--self.GenerateEvents(EVT_MINI_CALENDAR_UPDATE_BUSY)--#updatethecalendar-self.Refresh(False)--defSetVisibleDateAndNotify(self,newDate,setVisible):-ifnotsetVisibleandself.selectedDateisnotNone:-oldDate=self.selectedDate-else:-oldDate=self.firstVisibleDate--ifnewDate.year!=oldDate.year:-eventType=EVT_MINI_CALENDAR_YEAR_CHANGED-elifnewDate.month!=oldDate.month:-eventType=EVT_MINI_CALENDAR_MONTH_CHANGED-elifnewDate.day!=oldDate.day:-eventType=EVT_MINI_CALENDAR_DAY_CHANGED-else:-return--self.SetVisibleDate(newDate,setVisible)-self.GenerateEvents(eventType,EVT_MINI_CALENDAR_SEL_CHANGED)---defFirstDayOfWeek(self,targetDate):-&quot;&quot;&quot;-rewindtheselecteddatetothepreviousspecifieddate--Unfortunately,firstDayOfWeekhassunday=1,andweekday()-hasmonday=0,sothey'reactuallyoffby2!-&quot;&quot;&quot;-dayAdjust=(self.firstDayOfWeek-1)-(targetDate.weekday()+1)-ifdayAdjust&gt;0:-dayAdjust-=7-elifdayAdjust==-7:-dayAdjust=0--returntargetDate+timedelta(days=dayAdjust)--defGetWeekOfMonth(self,dt):-&quot;&quot;&quot;-theremaybeissueswithmonday/sundayfirstdayofweek-&quot;&quot;&quot;-week=self.FirstDayOfWeek(dt)-firstWeek=self.FirstDayOfWeek(date(dt.year,dt.month,1))--return(week-firstWeek).days/7+1---defGetWeek(self,targetDate,useRelative=True):-&quot;&quot;&quot;-gettheweek(row,inrange1..WEEKS_TO_DISPLAY)forthegivendate-&quot;&quot;&quot;-#weekofthemonth-ifuseRelative:-returnself.GetWeekOfMonth(targetDate)--#weekoftheyear-targetDate=self.FirstDayOfWeek(targetDate)-year,week,day=targetDate.isocalendar()--returnweek--defCompareWeeks(self,date1,date2):--d1w1=self.FirstDayOfWeek(date1).isocalendar()[:2]-d2w2=self.FirstDayOfWeek(date2).isocalendar()[:2]-returnd1w1==d2w2--defRefreshDate(self,date):-&quot;&quot;&quot;-redrawthegivendate-&quot;&quot;&quot;-#XXXthisdoesn'trefreshtheweekforallvisiblemonths-x=0-y=(self.heightRow*(self.GetWeek(date)-1)+-self.todayHeight+EXTRA_MONTH_HEIGHT+self.rowOffset)--width=DAYS_PER_WEEK*self.widthCol+2*SEPARATOR_MARGIN-height=self.heightRow--ifself.transform:-self.transform.Invert()-x,y=self.transform.TransformPoint(x,y)-width,height=self.transform.TransformDistance(width,height)-self.transform.Invert()--rect=wx.Rect(x,y,width,height)-self.RefreshRect(rect,False)--defGetBusy(self,date):-&quot;&quot;&quot;-getthebusystateforthedesiredposition-&quot;&quot;&quot;-returnself.busyPercent.get(date,0.0)--defChangeDay(self,date):-&quot;&quot;&quot;-changethedateinsidethesamemonth/year-&quot;&quot;&quot;-ifdate!=self.selectedDate:-oldDate=self.selectedDate-else:-oldDate=self.oldDate--ifself.selectedDate!=date:-self.selectedDate=date--ifoldDateisnotNone:-self.RefreshDate(oldDate)-self.RefreshDate(date)--defGenerateEvents(self,*events):-&quot;&quot;&quot;-generatethegivencalendarevent(s)-&quot;&quot;&quot;-forevtinevents:-event=wx.PyCommandEvent(evt.evtType[0])-self.GetEventHandler().ProcessEvent(event)-</span> Sat, 09 Apr, 03:30
Parlante c.CreateFont(boldFont,wx.BLACK))-todayw,todayh=gc.GetTextExtent(todaytext)--#Drawtodaybutton-self.todayRect=wx.Rect(buttonWidth,y,-buttonWidth*4,self.todayHeight)-todayx=(buttonWidth*5-todayw)/2-todayy=y+(self.todayHeight-todayh)/2--gc.DrawText(todaytext,todayx,todayy,-gc.CreateBrush(wx.TRANSPARENT_BRUSH))--#calculatemontharrows-arrowheight=todayh-5--leftarrow=[(0,arrowheight/2),-(arrowheight/2,0),-(arrowheight/2,arrowheight-1)]-rightarrow=[(0,0),-(arrowheight/2,arrowheight/2),-(0,arrowheight-1)]--#drawmontharrows-arrowy=(self.todayHeight-arrowheight)/2+y-larrowx=(buttonWidth-(arrowheight/2))/2-rarrowx=(buttonWidth/2)+buttonWidth*4--self.leftArrowRect=wx.Rect(0,y,buttonWidth-1,-self.todayHeight)-self.rightArrowRect=wx.Rect(buttonWidth*4+1,y,buttonWidth-1,-self.todayHeight)--pen=wx.Pen(wx.BLACK);-pen.SetJoin(wx.JOIN_MITER)-gc.SetPen(pen)-gc.SetBrush(wx.BLACK_BRUSH)--self.DrawPolygon(gc,leftarrow,larrowx,arrowy,wx.WINDING_RULE)-self.DrawPolygon(gc,rightarrow,rarrowx,arrowy,wx.WINDING_RULE)--y+=self.todayHeight--dateToDraw=self.firstVisibleDate-foriinxrange(self.months_displayed):-y=self.DrawMonth(gc,dc,dateToDraw,y,True,font,boldFont,-width,height,transform)-dateToDraw=MonthDelta(dateToDraw,1)---defOnClick(self,event):-(region,value)=self.HitTest(event.GetPosition())--ifregion==CAL_HITTEST_DAY:-self.ChangeDay(value)-self.GenerateEvents(EVT_MINI_CALENDAR_DAY_CHANGED,-EVT_MINI_CALENDAR_SEL_CHANGED)--elifregion==CAL_HITTEST_HEADER:-event.Skip()--elifregion==CAL_HITTEST_TODAY:-self.SetDateAndNotify(value)-self.SetVisibleDateAndNotify(value,True)---elifregion==CAL_HITTEST_SURROUNDING_WEEK:-self.SetVisibleDateAndNotify(value,False)--elifregionin(CAL_HITTEST_DECMONTH,CAL_HITTEST_INCMONTH):-self.SetVisibleDate(value,True)--elifregion==CAL_HITTEST_NOWHERE:-event.Skip()--else:-assertFalse,&quot;Unknownhitregion?&quot;---defOnDClick(self,event):-(region,value)=self.HitTest(event.GetPosition())--ifregionin(CAL_HITTEST_DAY,CAL_HITTEST_SURROUNDING_WEEK):-self.GenerateEvents(EVT_MINI_CALENDAR_DOUBLECLICKED)-else:-event.Skip()--#overridesomebaseclassvirtuals-defDoGetBestSize(self):--dc=wx.ClientDC(self)-font=self.GetDeviceFont()-dc.SetFont(font)--#determinethecolumnwidth(weassumethatthewidestdigit-#plusbusybariswiderthananyweekdaycharacter(hopefully-#inanylanguage))-self.widthCol=0-fordayinxrange(1,32):-(self.heightRow,width)=dc.GetTextExtent(unicode(day))-ifwidth&gt;self.widthCol:-self.widthCol=width--#leavesomemargins-self.widthCol+=8-self.heightRow+=6--self.rowOffset=self.heightRow*2-self.todayHeight=self.heightRow+2--width,height=self.CalcGeometry()-best=wx.Size(width,height)-self.CacheBestSize(best)--returnbest--ifwx.Platform=='__WXMAC__':-defGetDeviceFont(self):-font=self.GetFont()--font=wx.Font(font.GetPointSize()-2,font.GetFamily(),-font.GetStyle(),font.GetWeight(),-font.GetUnderlined(),font.GetFaceName(),-font.GetEncoding())--returnfont-else:-defGetDeviceFont(self):-returnself.GetFont()--defCalcGeometry(self):-&quot;&quot;&quot;-returnbest,unscaled,widthandsize-&quot;&quot;&quot;-width=DAYS_PER_WEEK*self.widthCol+2*SEPARATOR_MARGIN+WIDTH_CORRECTION-height=self.HeaderHeight()+self.months_displayed*self.MonthHeight()--returnwidth,height--defIsExposed(self,x,y,w,h,transform=None):--iftransformisnotNone:-x,y=transform.TransformPoint(x,y)-w,h=transform.TransformPoint(w,h)--returnsuper(PyMiniCalendar,self).IsExposed(x,y,w,h)--defDrawMonth(self,gc,dc,startDate,y,highlightDate,font,boldFont,-clientWidth,clientHeight,transform):-&quot;&quot;&quot;-drawasinglemonth-returntheupdatedvalueofy-&quot;&quot;&quot;--mainFont=gc.CreateFont(font,self.mainColour)-highlightFont=gc.CreateFont(font,self.highlightColour)-lightFont=gc.CreateFont(font,self.lightColour)-blackFont=gc.CreateFont(boldFont,wx.BLACK)-transparentBrush=gc.CreateBrush(wx.TRANSPARENT_BRUSH)--#Getextentofmonth-name+year-headertext=_(u'%(currentMonth)s%(currentYear)d')%{-'currentMonth':self.months[startDate.month-1],-'currentYear':startDate.year}-gc.SetFont(blackFont)-monthw,monthh=gc.GetTextExtent(headertext)--#drawmonth-namecenteredaboveweekdays-monthx=(clientWidth-monthw)/2-monthy=((self.heightRow-monthh)/2)+y+3-gc.DrawText(headertext,monthx,monthy,transparentBrush)--y+=self.heightRow+EXTRA_MONTH_HEIGHT--#drawtheweekdaynames-ifself.IsExposed(0,y,DAYS_PER_WEEK*self.widthCol,self.heightRow,-transform):-gc.SetFont(gc.CreateFont(font,self.colHeaderFg))-gc.SetBrush(self.colHeaderBgBrush)-gc.SetPen(self.colHeaderBgPen)--#drawthebackground-gc.DrawRectangle(0,y-1,clientWidth,self.heightRow+2)--forwdinxrange(DAYS_PER_WEEK):-n=(wd+self.firstDayOfWeek-1)%DAYS_PER_WEEK-dayw=gc.GetTextExtent(self.weekdays[n+1])[0]-gc.DrawText(self.weekdays[n+1],-(wd*self.widthCol)+SEPARATOR_MARGIN+-((self.widthCol-dayw)/2),#centertheday-name-y,-transparentBrush)--y+=self.heightRow-1--weekDate=date(startDate.year,startDate.month,1)-weekDate=self.FirstDayOfWeek(weekDate)--gc.SetFont(mainFont)--fornWeekinxrange(1,WEEKS_TO_DISPLAY+1):-#drawlinesbetweeneachsetofweeks-ifnWeek&lt;=WEEKS_TO_DISPLAYandnWeek!=1:-gc.SetPen(self.lineColourPen)-self.DrawLine(gc,SEPARATOR_MARGIN,y-1,-clientWidth-SEPARATOR_MARGIN,-y-1)--#iftheupdateregiondoesn'tintersectthisrow,don'tpaintit-ifnotself.IsExposed(0,y,DAYS_PER_WEEK*self.widthCol,-self.heightRow-1,transform):-weekDate+=timedelta(days=7)-y+=self.heightRow-continue--#don'tdrawlastweekifnoneofthedaysappearinthemonth-ifnWeek==WEEKS_TO_DISPLAYandweekDate.month!=startDate.month:-weekDate+=timedelta(days=7)-y+=self.heightRow-continue--forweekDayinxrange(DAYS_PER_WEEK):--dayStr=str(weekDate.day)-width=gc.GetTextExtent(dayStr)[0]--columnStart=SEPARATOR_MARGIN+weekDay*self.widthCol-x=columnStart+(self.widthCol-width)/2--ifhighlightDate:-#eitherhighlighttheselectedweekorthe-#selecteddaydependinguponthestyle-highlightWeek=(self.GetWindowStyle()&amp;-CAL_HIGHLIGHT_WEEK)!=0--if(self.hoverDate==weekDateor-#onlyhighlightdaysthatfallinthecurrentmonth-(weekDate.month==startDate.monthand-#highlightingweekandtheweekwearedrawingmatches-((highlightWeekand-self.CompareWeeks(weekDate,self.selectedDate))or-#highlightingasingleday-(nothighlightWeekand-weekDate==self.selectedDate)))):--startX=columnStart+1-width=self.widthCol--gc.SetFont(highlightFont)-gc.SetBrush(self.highlightColourBrush)-gc.SetPen(self.highlightColourPen)--gc.DrawRectangle(startX,y,width,self.heightRow-2)--#drawfree/busyindicator-ifweekDate.month==startDate.month:-busyPercentage=self.GetBusy(weekDate)-assertbusyPercentage&gt;=0-ifbusyPercentage&gt;0:-height=(self.heightRow-Y_ADJUSTMENT_BIG)*busyPercentage-gc.SetBrush(self.busyColourBrush)-gc.SetPen(wx.TRANSPARENT_PEN)-gc.DrawRectangle(columnStart+1,-y+self.heightRow-height-2,2,height)--ifweekDate.month!=startDate.month:-#surroundingweekorout-of-range-#draw&quot;disabled&quot;-gc.SetFont(lightFont)-else:-gc.SetBrush(wx.BLACK_BRUSH)-gc.SetPen(wx.BLACK_PEN)--#todayshouldbeprintedasbold-ifweekDate==date.today():-gc.SetFont(blackFont)-else:-gc.SetFont(mainFont)--gc.DrawText(dayStr,x,y+Y_ADJUSTMENT_SMALL,-wx.NullGraphicsBrush)--weekDate+=timedelta(days=1)--y+=self.heightRow--returny--defSetDateAndNotify(self,date):-&quot;&quot;&quot;-setthedateandsendthenotification-&quot;&quot;&quot;-self.SetDate(date)-self.GenerateEvents(EVT_MINI_CALENDAR_YEAR_CHANGED,-EVT_MINI_CALENDAR_SEL_CHANGED)--defSetVisibleDate(self,date,setVisible):--sameMonth=(self.firstVisibleDate.month==date.month)-sameYear=(self.firstVisibleDate.year==date.year)--ifsameMonthandsameYear:-self.ChangeDay(date)-else:--ifsetVisible:-self.firstVisibleDate=date--ifnotsetVisible:-self.selectedDate=date--self.GenerateEvents(EVT_MINI_CALENDAR_UPDATE_BUSY)--#updatethecalendar-self.Refresh(False)--defSetVisibleDateAndNotify(self,newDate,setVisible):-ifnotsetVisibleandself.selectedDateisnotNone:-oldDate=self.selectedDate-else:-oldDate=self.firstVisibleDate--ifnewDate.year!=oldDate.year:-eventType=EVT_MINI_CALENDAR_YEAR_CHANGED-elifnewDate.month!=oldDate.month:-eventType=EVT_MINI_CALENDAR_MONTH_CHANGED-elifnewDate.day!=oldDate.day:-eventType=EVT_MINI_CALENDAR_DAY_CHANGED-else:-return--self.SetVisibleDate(newDate,setVisible)-self.GenerateEvents(eventType,EVT_MINI_CALENDAR_SEL_CHANGED)---defFirstDayOfWeek(self,targetDate):-&quot;&quot;&quot;-rewindtheselecteddatetothepreviousspecifieddate--Unfortunately,firstDayOfWeekhassunday=1,andweekday()-hasmonday=0,sothey'reactuallyoffby2!-&quot;&quot;&quot;-dayAdjust=(self.firstDayOfWeek-1)-(targetDate.weekday()+1)-ifdayAdjust&gt;0:-dayAdjust-=7-elifdayAdjust==-7:-dayAdjust=0--returntargetDate+timedelta(days=dayAdjust)--defGetWeekOfMonth(self,dt):-&quot;&quot;&quot;-theremaybeissueswithmonday/sundayfirstdayofweek-&quot;&quot;&quot;-week=self.FirstDayOfWeek(dt)-firstWeek=self.FirstDayOfWeek(date(dt.year,dt.month,1))--return(week-firstWeek).days/7+1---defGetWeek(self,targetDate,useRelative=True):-&quot;&quot;&quot;-gettheweek(row,inrange1..WEEKS_TO_DISPLAY)forthegivendate-&quot;&quot;&quot;-#weekofthemonth-ifuseRelative:-returnself.GetWeekOfMonth(targetDate)--#weekoftheyear-targetDate=self.FirstDayOfWeek(targetDate)-year,week,day=targetDate.isocalendar()--returnweek--defCompareWeeks(self,date1,date2):--d1w1=self.FirstDayOfWeek(date1).isocalendar()[:2]-d2w2=self.FirstDayOfWeek(date2).isocalendar()[:2]-returnd1w1==d2w2--defRefreshDate(self,date):-&quot;&quot;&quot;-redrawthegivendate-&quot;&quot;&quot;-#XXXthisdoesn'trefreshtheweekforallvisiblemonths-x=0-y=(self.heightRow*(self.GetWeek(date)-1)+-self.todayHeight+EXTRA_MONTH_HEIGHT+self.rowOffset)--width=DAYS_PER_WEEK*self.widthCol+2*SEPARATOR_MARGIN-height=self.heightRow--ifself.transform:-self.transform.Invert()-x,y=self.transform.TransformPoint(x,y)-width,height=self.transform.TransformDistance(width,height)-self.transform.Invert()--rect=wx.Rect(x,y,width,height)-self.RefreshRect(rect,False)--defGetBusy(self,date):-&quot;&quot;&quot;-getthebusystateforthedesiredposition-&quot;&quot;&quot;-returnself.busyPercent.get(date,0.0)--defChangeDay(self,date):-&quot;&quot;&quot;-changethedateinsidethesamemonth/year-&quot;&quot;&quot;-ifdate!=self.selectedDate:-oldDate=self.selectedDate-else:-oldDate=self.oldDate--ifself.selectedDate!=date:-self.selectedDate=date--ifoldDateisnotNone:-self.RefreshDate(oldDate)-self.RefreshDate(date)--defGenerateEvents(self,*events):-&quot;&quot;&quot;-generatethegivencalendarevent(s)-&quot;&quot;&quot;-forevtinevents:-event=wx.PyCommandEvent(evt.evtType[0])-self.GetEventHandler().ProcessEvent(event)-</span> Sat, 09 Apr, 03:30
Parlante c.GetTransform() - self.transform = gc.CreateMatrix(*transform.Get()) - self.yOffset = transform.Get()[-1] # for hit tests on Mac - self.transform.Invert() - - font = self.GetDeviceFont() - boldFont = wx.Font(font.GetPointSize(), font.GetFamily(), - font.GetStyle(), wx.BOLD, font.GetUnderlined(), - font.GetFaceName(), font.GetEncoding()) - y = 0 - - # draw the sequential month-selector - gc.SetBrush(wx.TRANSPARENT_BRUSH) - gc.SetPen(wx.LIGHT_GREY_PEN) - if self.lineAboveToday: - self.DrawLine(gc, 0, y, width, y) - self.DrawLine(gc, 0, y + self.todayHeight, - width, y + self.todayHeight) - buttonWidth = width / 5 - self.DrawLine(gc, buttonWidth, y, - buttonWidth, y + self.todayHeight) - self.DrawLine(gc, buttonWidth * 4, y, - buttonWidth * 4, y + self.todayHeight) - - # Get extent of today button - todaytext = _(u&quot;Today&quot;) - gc.SetFont(gc.CreateFont(boldFont, wx.BLACK)) - todayw, todayh = gc.GetTextExtent(todaytext) - - # Draw today button - self.todayRect = wx.Rect(buttonWidth, y, - buttonWidth * 4, self.todayHeight) - todayx = (buttonWidth * 5 - todayw) / 2 - todayy = y + (self.todayHeight - todayh) / 2 - - gc.DrawText(todaytext, todayx, todayy, - gc.CreateBrush(wx.TRANSPARENT_BRUSH)) - - # calculate month arrows - arrowheight = todayh - 5 - - leftarrow = [(0, arrowheight / 2), - (arrowheight / 2, 0), - (arrowheight / 2, arrowheight - 1)] - rightarrow = [(0, 0), - (arrowheight / 2, arrowheight / 2), - (0, arrowheight - 1)] - - # draw month arrows - arrowy = (self.todayHeight - arrowheight) / 2 + y - larrowx = (buttonWidth - (arrowheight / 2)) / 2 - rarrowx = (buttonWidth / 2) + buttonWidth * 4 - - self.leftArrowRect = wx.Rect(0, y, buttonWidth - 1, - self.todayHeight) - self.rightArrowRect = wx.Rect(buttonWidth * 4 + 1, y, buttonWidth - 1, - self.todayHeight) - - pen = wx.Pen(wx.BLACK); - pen.SetJoin(wx.JOIN_MITER) - gc.SetPen(pen) - gc.SetBrush(wx.BLACK_BRUSH) - - self.DrawPolygon(gc, leftarrow, larrowx, arrowy, wx.WINDING_RULE) - self.DrawPolygon(gc, rightarrow, rarrowx, arrowy, wx.WINDING_RULE) - - y += self.todayHeight - - dateToDraw = self.firstVisibleDate - for i in xrange(self.months_displayed): - y = self.DrawMonth(gc, dc, dateToDraw, y, True, font, boldFont, - width, height, transform) - dateToDraw = MonthDelta(dateToDraw, 1) - - - def OnClick(self, event): - (region, value) = self.HitTest(event.GetPosition()) - - if region == CAL_HITTEST_DAY: - self.ChangeDay(value) - self.GenerateEvents(EVT_MINI_CALENDAR_DAY_CHANGED, - EVT_MINI_CALENDAR_SEL_CHANGED) - - elif region == CAL_HITTEST_HEADER: - event.Skip() - - elif region == CAL_HITTEST_TODAY: - self.SetDateAndNotify(value) - self.SetVisibleDateAndNotify(value, True) - - - elif region == CAL_HITTEST_SURROUNDING_WEEK: - self.SetVisibleDateAndNotify(value, False) - - elif region in (CAL_HITTEST_DECMONTH, CAL_HITTEST_INCMONTH): - self.SetVisibleDate(value, True) - - elif region == CAL_HITTEST_NOWHERE: - event.Skip() - - else: - assert False, &quot;Unknown hit region?&quot; - - - def OnDClick(self, event): - (region, value) = self.HitTest(event.GetPosition()) - - if region in (CAL_HITTEST_DAY,CAL_HITTEST_SURROUNDING_WEEK) : - self.GenerateEvents(EVT_MINI_CALENDAR_DOUBLECLICKED) - else: - event.Skip() - - # override some base class virtuals - def DoGetBestSize(self): - - dc = wx.ClientDC(self) - font = self.GetDeviceFont() - dc.SetFont(font) - - # determine the column width (we assume that the widest digit - # plus busy bar is wider than any weekday character (hopefully - # in any language)) - self.widthCol = 0 - for day in xrange(1, 32): - (self.heightRow, width) = dc.GetTextExtent(unicode(day)) - if width &gt; self.widthCol: - self.widthCol = width - - # leave some margins - self.widthCol += 8 - self.heightRow += 6 - - self.rowOffset = self.heightRow * 2 - self.todayHeight = self.heightRow + 2 - - width, height = self.CalcGeometry() - best = wx.Size(width, height) - self.CacheBestSize(best) - - return best - - if wx.Platform == '__WXMAC__': - def GetDeviceFont(self): - font = self.GetFont() - - font = wx.Font(font.GetPointSize() - 2, font.GetFamily(), - font.GetStyle(), font.GetWeight(), - font.GetUnderlined(), font.GetFaceName(), - font.GetEncoding()) - - return font - else: - def GetDeviceFont(self): - return self.GetFont() - - def CalcGeometry(self): - &quot;&quot;&quot; - return best, unscaled, width and size - &quot;&quot;&quot; - width = DAYS_PER_WEEK * self.widthCol + 2 * SEPARATOR_MARGIN + WIDTH_CORRECTION - height = self.HeaderHeight() + self.months_displayed * self.MonthHeight() - - return width, height - - def IsExposed(self, x, y, w, h, transform=None): - - if transform is not None: - x, y = transform.TransformPoint(x, y) - w, h = transform.TransformPoint(w, h) - - return super(PyMiniCalendar, self).IsExposed(x, y, w, h) - - def DrawMonth(self, gc, dc, startDate, y, highlightDate, font, boldFont, - clientWidth, clientHeight, transform): - &quot;&quot;&quot; - draw a single month - return the updated value of y - &quot;&quot;&quot; - - mainFont = gc.CreateFont(font, self.mainColour) - highlightFont = gc.CreateFont(font, self.highlightColour) - lightFont = gc.CreateFont(font, self.lightColour) - blackFont = gc.CreateFont(boldFont, wx.BLACK) - transparentBrush = gc.CreateBrush(wx.TRANSPARENT_BRUSH) - - # Get extent of month-name + year - headertext = _(u'%(currentMonth)s %(currentYear)d') % { - 'currentMonth' : self.months[startDate.month-1], - 'currentYear' : startDate.year } - gc.SetFont(blackFont) - monthw, monthh = gc.GetTextExtent(headertext) - - # draw month-name centered above weekdays - monthx = (clientWidth - monthw) / 2 - monthy = ((self.heightRow - monthh) / 2) + y + 3 - gc.DrawText(headertext, monthx, monthy, transparentBrush) - - y += self.heightRow + EXTRA_MONTH_HEIGHT - - # draw the week day names - if self.IsExposed(0, y, DAYS_PER_WEEK * self.widthCol, self.heightRow, - transform): - gc.SetFont(gc.CreateFont(font, self.colHeaderFg)) - gc.SetBrush(self.colHeaderBgBrush) - gc.SetPen(self.colHeaderBgPen) - - # draw the background - gc.DrawRectangle(0, y-1, clientWidth, self.heightRow+2) - - for wd in xrange(DAYS_PER_WEEK): - n = (wd + self.firstDayOfWeek - 1) % DAYS_PER_WEEK - dayw = gc.GetTextExtent(self.weekdays[n+1])[0] - gc.DrawText(self.weekdays[n+1], - (wd*self.widthCol) + SEPARATOR_MARGIN + - ((self.widthCol- dayw) / 2), # center the day-name - y, - transparentBrush) - - y += self.heightRow - 1 - - weekDate = date(startDate.year, startDate.month, 1) - weekDate = self.FirstDayOfWeek(weekDate) - - gc.SetFont(mainFont) - - for nWeek in xrange(1, WEEKS_TO_DISPLAY+1): - # draw lines between each set of weeks - if nWeek &lt;= WEEKS_TO_DISPLAY and nWeek != 1: - gc.SetPen(self.lineColourPen) - self.DrawLine(gc, SEPARATOR_MARGIN, y - 1, - clientWidth - SEPARATOR_MARGIN, - y - 1) - - # if the update region doesn't intersect this row, don't paint it - if not self.IsExposed(0, y, DAYS_PER_WEEK * self.widthCol, - self.heightRow - 1, transform): - weekDate += timedelta(days=7) - y += self.heightRow - continue - - # don't draw last week if none of the days appear in the month - if nWeek == WEEKS_TO_DISPLAY and weekDate.month != startDate.month: - weekDate += timedelta(days=7) - y += self.heightRow - continue - - for weekDay in xrange(DAYS_PER_WEEK): - - dayStr = str(weekDate.day) - width = gc.GetTextExtent(dayStr)[0] - - columnStart = SEPARATOR_MARGIN + weekDay * self.widthCol - x = columnStart + (self.widthCol - width) / 2 - - if highlightDate: - # either highlight the selected week or the - # selected day depending upon the style - highlightWeek = (self.GetWindowStyle() &amp; - CAL_HIGHLIGHT_WEEK) != 0 - - if (self.hoverDate == weekDate or - # only highlight days that fall in the current month - (weekDate.month == startDate.month and - # highlighting week and the week we are drawing matches - ((highlightWeek and - self.CompareWeeks(weekDate, self.selectedDate)) or - # highlighting a single day - (not highlightWeek and - weekDate == self.selectedDate)))): - - startX = columnStart + 1 - width = self.widthCol - - gc.SetFont(highlightFont) - gc.SetBrush(self.highlightColourBrush) - gc.SetPen(self.highlightColourPen) - - gc.DrawRectangle(startX, y, width, self.heightRow - 2) - - # draw free/busy indicator - if weekDate.month == startDate.month: - busyPercentage = self.GetBusy(weekDate) - assert busyPercentage &gt;= 0 - if busyPercentage &gt; 0: - height = (self.heightRow - Y_ADJUSTMENT_BIG) * busyPercentage - gc.SetBrush(self.busyColourBrush) - gc.SetPen(wx.TRANSPARENT_PEN) - gc.DrawRectangle(columnStart + 1, - y + self.heightRow - height - 2, 2, height) - - if weekDate.month != startDate.month: - # surrounding week or out-of-range - # draw &quot;disabled&quot; - gc.SetFont(lightFont) - else: - gc.SetBrush(wx.BLACK_BRUSH) - gc.SetPen(wx.BLACK_PEN) - - # today should be printed as bold - if weekDate == date.today(): - gc.SetFont(blackFont) - else: - gc.SetFont(mainFont) - - gc.DrawText(dayStr, x, y + Y_ADJUSTMENT_SMALL, - wx.NullGraphicsBrush) - - weekDate += timedelta(days=1) - - y += self.heightRow - - return y - - def SetDateAndNotify(self, date): - &quot;&quot;&quot; - set the date and send the notification - &quot;&quot;&quot; - self.SetDate(date) - self.GenerateEvents(EVT_MINI_CALENDAR_YEAR_CHANGED, - EVT_MINI_CALENDAR_SEL_CHANGED) - - def SetVisibleDate(self, date, setVisible): - - sameMonth = (self.firstVisibleDate.month == date.month) - sameYear = (self.firstVisibleDate.year == date.year) - - if sameMonth and sameYear: - self.ChangeDay(date) - else: - - if setVisible: - self.firstVisibleDate = date - - if not setVisible: - self.selectedDate = date - - self.GenerateEvents(EVT_MINI_CALENDAR_UPDATE_BUSY) - - # update the calendar - self.Refresh(False) - - def SetVisibleDateAndNotify(self, newDate, setVisible): - if not setVisible and self.selectedDate is not None: - oldDate = self.selectedDate - else: - oldDate = self.firstVisibleDate - - if newDate.year != oldDate.year: - eventType = EVT_MINI_CALENDAR_YEAR_CHANGED - elif newDate.month != oldDate.month: - eventType = EVT_MINI_CALENDAR_MONTH_CHANGED - elif newDate.day != oldDate.day: - eventType = EVT_MINI_CALENDAR_DAY_CHANGED - else: - return - - self.SetVisibleDate(newDate, setVisible) - self.GenerateEvents(eventType, EVT_MINI_CALENDAR_SEL_CHANGED) - - - def FirstDayOfWeek(self, targetDate): - &quot;&quot;&quot; - rewind the selected date to the previous specified date - - Unfortunately, firstDayOfWeek has sunday = 1, and weekday() - has monday=0, so they're actually off by 2! - &quot;&quot;&quot; - dayAdjust = (self.firstDayOfWeek - 1) - (targetDate.weekday() + 1) - if dayAdjust &gt; 0: - dayAdjust -= 7 - elif dayAdjust == -7: - dayAdjust = 0 - - return targetDate + timedelta(days=dayAdjust) - - def GetWeekOfMonth(self, dt): - &quot;&quot;&quot; - there may be issues with monday/sunday first day of week - &quot;&quot;&quot; - week = self.FirstDayOfWeek(dt) - firstWeek = self.FirstDayOfWeek(date(dt.year, dt.month, 1)) - - return (week - firstWeek).days / 7 + 1 - - - def GetWeek(self, targetDate, useRelative=True): - &quot;&quot;&quot; - get the week (row, in range 1..WEEKS_TO_DISPLAY) for the given date - &quot;&quot;&quot; - # week of the month - if useRelative: - return self.GetWeekOfMonth(targetDate) - - # week of the year - targetDate = self.FirstDayOfWeek(targetDate) - year, week, day = targetDate.isocalendar() - - return week - - def CompareWeeks(self, date1, date2): - - d1w1 = self.FirstDayOfWeek(date1).isocalendar()[:2] - d2w2 = self.FirstDayOfWeek(date2).isocalendar()[:2] - return d1w1 == d2w2 - - def RefreshDate(self, date): - &quot;&quot;&quot; - redraw the given date - &quot;&quot;&quot; - #XXX this doesn't refresh the week for all visible months - x = 0 - y = (self.heightRow * (self.GetWeek(date) - 1) + - self.todayHeight + EXTRA_MONTH_HEIGHT + self.rowOffset) - - width = DAYS_PER_WEEK * self.widthCol + 2*SEPARATOR_MARGIN - height = self.heightRow - - if self.transform: - self.transform.Invert() - x, y = self.transform.TransformPoint(x, y) - width, height = self.transform.TransformDistance(width, height) - self.transform.Invert() - - rect = wx.Rect(x, y, width, height) - self.RefreshRect(rect, False) - - def GetBusy(self, date): - &quot;&quot;&quot; - get the busy state for the desired position - &quot;&quot;&quot; - return self.busyPercent.get(date, 0.0) - - def ChangeDay(self, date): - &quot;&quot;&quot; - change the date inside the same month/year - &quot;&quot;&quot; - if date != self.selectedDate: - oldDate = self.selectedDate - else: - oldDate = self.oldDate - - if self.selectedDate != date: - self.selectedDate = date - - if oldDate is not None: - self.RefreshDate(oldDate) - self.RefreshDate(date) - - def GenerateEvents(self, *events): - &quot;&quot;&quot; - generate the given calendar event(s) - &quot;&quot;&quot; - for evt in events: - event = wx.PyCommandEvent(evt.evtType[0]) - self.GetEventHandler().ProcessEvent(event) - </span></pre></div> <a id="branchesrearchitectureChandlerAppocapchandlerwxui__init__py"></a> <div class="addfile"><h4>Added: branches/rearchitecture/Chandler-App/ocap/chandler/wxui/__init__.py (15860 => 15861)</h4> <pre class="diff"> <span class="info">--- branches/rearchitecture/Chandler-App/ocap/chandler/wxui/__init__.py 2007-11-16 00:42:53 UTC (rev 15860) +++ branches/rearchitecture/Chandler-App/ocap/chandler/wxui/__init__.py 2007-11-16 00:56:43 UTC (rev 15861) </span><span class="lines">@@ -0,0 +1 @@ </span><span class="add">+&quot;&quot;&quot;Chandler-specific wx-related code&quot;&quot;&quot; </span><span class="cx">\ No newline at end of file Property changes on: branches/rearchitecture/Chandler-App/ocap/chandler/wxui/__init__.py ___________________________________________________________________ Name: svn:eol-style + native </span> </pre> </div> </div> </body> </html> Sat, 09 Apr, 03:30
y Appocapchandlerwxui__init__py"> Sat, 07 Apr, 02:32
y rect = wx.Rect(x, y, width, height) - self.RefreshRect(rect, False) - - def GetBusy(self, date): - &quot;&quot;&quot; - get the busy state for the desired position - &quot;&quot;&quot; - return self.busyPercent.get(date, 0.0) - - def ChangeDay(self, date): - &quot;&quot;&quot; - change the date inside the same month/year - &quot;&quot;&quot; - if date != self.selectedDate: - oldDate = self.selectedDate - else: - oldDate = self.oldDate - - if self.selectedDate != date: - self.selectedDate = date - - if oldDate is not None: - self.RefreshDate(oldDate) - self.RefreshDate(date) - - def GenerateEvents(self, *events): - &quot;&quot;&quot; - generate the given calendar event(s) - &quot;&quot;&quot; - for evt in events: - event = wx.PyCommandEvent(evt.evtType[0]) - self.GetEventHandler().ProcessEvent(event) - </span> Sat, 07 Apr, 02:32
eEvents(self, *events): - &quot;&quot;&quot; - generate the given calendar event(s) - &quot;&quot;&quot; - for evt in events: - event = wx.PyC0ÐÖ" Sat, 07 Apr, 02:32
s quot;add&quot;&amp;gt;+ d = ssl.askIgnoreSSLError(err.untrustedCertificates[0], + err.args[0], self.reconnect) &amp;lt;/span&amp;gt;&amp;lt;span class=&quot;cx&quot;&amp;gt; &amp;lt;/span&amp;gt;&amp;lt;span class=&quot;add&quot;&amp;gt;+ waitForDeferred(d) + &amp;lt;/span&amp;gt;&amp;lt;span class=&quot;cx&quot;&amp;gt; return result except Exception, e: # There is a bug in the M2Crypto code which needs &amp;lt;/span&amp;gt;&amp;lt;span class=&quot;lines&quot;&amp;gt;@@ -331,11 +324,12 @@ &amp;lt;/span&amp;gt;&amp;lt;span class=&quot;cx&quot;&amp;gt; # the progress dialog will also kill the SSL error dialog. # Weird, huh? Welcome to the world of wx... callMethodInUIThread(self.callback, result) &amp;lt;/span&amp;gt;&amp;lt;span class=&quot;rem&quot;&amp;gt;- ssl.askIgnoreSSLError( err.pem, - messages.SSL_HOST_MISMATCH % \ - {'expectedHost': err.expectedHost, - 'actualHost': err.actualHost}, Sat, 07 Apr, 21:37
s ;&amp;lt;span class=&quot;cx&quot;&amp;gt; return result except Exception, e: # There is a bug in the M2Crypto code which needs &amp;lt;/span&amp;gt;&amp;lt;span class=&quot;lines&quot;&amp;gt;@@ -331,11 +324,12 @@ &amp;lt;/span&amp;gt;&amp;lt;span class=&quot;cx&quot;&amp;gt; # the progress dialog will also kill the SSL error dialog. # Weird, huh? Welcome to the world of wx... callMethodInUIThread(self.callback, result) &amp;lt;/span&amp;gt;&amp;lt;span class=&quot;rem&quot;&amp;gt;- ssl.askIgnoreSSLError( err.pem, - messages.SSL_HOST_MISMATCH % \ - {'expectedHost': err.expectedHost, - 'actualHost': err.actualHost}, Sat, 07 Apr, 21:37
an&amp;gt;&amp;lt;span class=&quot;add&quot;&amp;gt;+ waitForDeferred(d) + &amp;lt;/span&amp;gt;&amp;lt;span class=&quot;cx&quot;&amp;gt; return result except Exception, e: # There is a bug in the M2Crypto code which needs &amp;lt;/span&amp;gt;&amp;lt;span class=&quot;lines&quot;&amp;gt;@@ -331,11 +324,12 @@ &amp;lt;/span&amp;gt;&amp;lt;span class=&quot;cx&quot;&amp;gt; # the progress dialog will also kill the SSL error dialog. # Weird, huh? Welcome to the world of wx... callMethodInUIThread(self.callback, result) &amp;lt;/span&amp;gt;&amp;lt;span class=&quot;rem&quot;&amp;gt;- ssl.askIgnoreSSLError( err.pem, - messages.SSL_HOST_MISMATCH % \ - {'expectedHost': err.expectedHost, - 'actualHost': err.actualHost}, Tue, 02 Oct, 19:31
ic p;lt;span class=&quot;add&quot;&amp;gt;+ d = ssl.askIgnoreSSLError(err.untrustedCertificates[0], + err.args[0], self.reconnect) &amp;lt;/span&amp;gt;&amp;lt;span class=&quot;cx&quot;&amp;gt; &amp;lt;/span&amp;gt;&amp;lt;span class=&quot;add&quot;&amp;gt;+ waitForDeferred(d) + &amp;lt;/span&amp;gt;&amp;lt;span class=&quot;cx&quot;&amp;gt; return result except Exception, e: # There is a bug in the M2Crypto code which needs &amp;lt;/span&amp;gt;&amp;lt;span class=&quot;lines&quot;&amp;gt;@@ -331,11 +324,12 @@ &amp;lt;/span&amp;gt;&amp;lt;span class=&quot;cx&quot;&amp;gt; # the progress dialog will also kill the SSL error dialog. # Weird, huh? Welcome to the world of wx... callMethodInUIThread(self.callback, result) &amp;lt;/span&amp;gt;&amp;lt;span class=&quot;rem&quot;&amp;gt;- ssl.askIgnoreSSLError( err.pem, - messages.SSL_HOST_MISMATCH % \ - {'expectedHost': err.expectedHost, - 'actualHost': err.actualHost}, Sun, 07 Jun, 03:49
ic p;lt;span class=&quot;add&quot;&amp;gt;+ d = ssl.askIgnoreSSLError(err.untrustedCertificates[0], + err.args[0], self.reconnect) &amp;lt;/span&amp;gt;&amp;lt;span class=&quot;cx&quot;&amp;gt; &amp;lt;/span&amp;gt;&amp;lt;span class=&quot;add&quot;&amp;gt;+ waitForDeferred(d) + &amp;lt;/span&amp;gt;&amp;lt;span class=&quot;cx&quot;&amp;gt; return result except Exception, e: # There is a bug in the M2Crypto code which needs &amp;lt;/span&amp;gt;&amp;lt;span class=&quot;lines&quot;&amp;gt;@@ -331,11 +324,12 @@ &amp;lt;/span&amp;gt;&amp;lt;span class=&quot;cx&quot;&amp;gt; # the progress dialog will also kill the SSL error dialog. # Weird, huh? Welcome to the world of wx... callMethodInUIThread(self.callback, result) &amp;lt;/span&amp;gt;&amp;lt;span class=&quot;rem&quot;&amp;gt;- ssl.askIgnoreSSLError( err.pem, - messages.SSL_HOST_MISMATCH % \ - {'expectedHost': err.expectedHost, - 'actualHost': err.actualHost}, Sun, 07 Jun, 03:49
ic p;lt;/span&amp;gt;&amp;lt;span class=&quot;cx&quot;&amp;gt; return result except Exception, e: # There is a bug in the M2Crypto code which needs &amp;lt;/span&amp;gt;&amp;lt;span class=&quot;lines&quot;&amp;gt;@@ -331,11 +324,12 @@ &amp;lt;/span&amp;gt;&amp;lt;span class=&quot;cx&quot;&amp;gt; # the progress dialog will also kill the SSL error dialog. # Weird, huh? Welcome to the world of wx... callMethodInUIThread(self.callback, result) &amp;lt;/span&amp;gt;&amp;lt;span class=&quot;rem&quot;&amp;gt;- ssl.askIgnoreSSLError( err.pem, - messages.SSL_HOST_MISMATCH % \ - {'expectedHost': err.expectedHost, - 'actualHost': err.actualHost}, Sun, 07 Jun, 03:49
ic p;lt;/span&amp;gt;&amp;lt;span class=&quot;cx&quot;&amp;gt; return result except Exception, e: # There is a bug in the M2Crypto code which needs &amp;lt;/span&amp;gt;&amp;lt;span class=&quot;lines&quot;&amp;gt;@@ -331,11 +324,12 @@ &amp;lt;/span&amp;gt;&amp;lt;span class=&quot;cx&quot;&amp;gt; # the progress dialog will also kill the SSL error dialog. # Weird, huh? Welcome to the world of wx... callMethodInUIThread(self.callback, result) &amp;lt;/span&amp;gt;&amp;lt;span class=&quot;rem&quot;&amp;gt;- ssl.askIgnoreSSLError( err.pem, - messages.SSL_HOST_MISMATCH % \ - {'expectedHost': err.expectedHost, - 'actualHost': err.actualHost}, Sun, 07 Jun, 03:49
ic p;lt;/span&amp;gt;&amp;lt;span class=&quot;cx&quot;&amp;gt; return result except Exception, e: # There is a bug in the M2Crypto code which needs &amp;lt;/span&amp;gt;&amp;lt;span class=&quot;lines&quot;&amp;gt;@@ -331,11 +324,12 @@ &amp;lt;/span&amp;gt;&amp;lt;span class=&quot;cx&quot;&amp;gt; # the progress dialog will also kill the SSL error dialog. # Weird, huh? Welcome to the world of wx... callMethodInUIThread(self.callback, result) &amp;lt;/span&amp;gt;&amp;lt;span class=&quot;rem&quot;&amp;gt;- ssl.askIgnoreSSLError( err.pem, - messages.SSL_HOST_MISMATCH % \ - {'expectedHost': err.expectedHost, - 'actualHost': err.actualHost}, Sun, 07 Jun, 03:49
ic p;lt;/span&amp;gt;&amp;lt;span class=&quot;cx&quot;&amp;gt; return result except Exception, e: # There is a bug in the M2Crypto code which needs &amp;lt;/span&amp;gt;&amp;lt;span class=&quot;lines&quot;&amp;gt;@@ -331,11 +324,12 @@ &amp;lt;/span&amp;gt;&amp;lt;span class=&quot;cx&quot;&amp;gt; # the progress dialog will also kill the SSL error dialog. # Weird, huh? Welcome to the world of wx... callMethodInUIThread(self.callback, result) &amp;lt;/span&amp;gt;&amp;lt;span class=&quot;rem&quot;&amp;gt;- ssl.askIgnoreSSLError( err.pem, - messages.SSL_HOST_MISMATCH % \ - {'expectedHost': err.expectedHost, - 'actualHost': err.actualHost}, Sun, 07 Jun, 03:49
e 602090044.k190iY3R026630@tutu.osafoundation.org> Tue, 18 Feb, 17:56
e - </span> Tue, 18 Feb, 17:56
e - </span> Tue, 18 Feb, 17:56
e - </span> Tue, 18 Feb, 17:56
e - </span> Tue, 18 Feb, 17:56
e «  Tue, 18 Feb, 17:56
b.@osafoundation.org = gc.GetTransform() - self.transform = gc.CreateMatrix(*transform.Get()) - self.yOffset = transform.Get()[-1] # for hit tests on Mac - self.transform.Invert() - - font = self.GetDeviceFont() - boldFont = wx.Font(font.GetPointSize(), font.GetFamily(), - font.GetStyle(), wx.BOLD, font.GetUnderlined(), - font.GetFaceName(), font.GetEncoding()) - y = 0 - - # draw the sequential month-selector - gc.SetBrush(wx.TRANSPARENT_BRUSH) - gc.SetPen(wx.LIGHT_GREY_PEN) - if self.lineAboveToday: - self.DrawLine(gc, 0, y, width, y) - self.DrawLine(gc, 0, y + self.todayHeight, - width, y + self.todayHeight) - buttonWidth = width / 5 - self.DrawLine(gc, buttonWidth, y, - buttonWidth, y + self.todayHeight) - self.DrawLine(gc, buttonWidth * 4, y, - buttonWidth * 4, y + self.todayHeight) - - # Get extent of today button - todaytext = _(u&quot;Today&quot;) - gc.SetFont(gc.CreateFont(boldFont, wx.BLACK)) - todayw, todayh = gc.GetTextExtent(todaytext) - - # Draw today button - self.todayRect = wx.Rect(buttonWidth, y, - buttonWidth * 4, self.todayHeight) - todayx = (buttonWidth * 5 - todayw) / 2 - todayy = y + (self.todayHeight - todayh) / 2 - - gc.DrawText(todaytext, todayx, todayy, - gc.CreateBrush(wx.TRANSPARENT_BRUSH)) - - # calculate month arrows - arrowheight = todayh - 5 - - leftarrow = [(0, arrowheight / 2), - (arrowheight / 2, 0), - (arrowheight / 2, arrowheight - 1)] - rightarrow = [(0, 0), - (arrowheight / 2, arrowheight / 2), - (0, arrowheight - 1)] - - # draw month arrows - arrowy = (self.todayHeight - arrowheight) / 2 + y - larrowx = (buttonWidth - (arrowheight / 2)) / 2 - rarrowx = (buttonWidth / 2) + buttonWidth * 4 - - self.leftArrowRect = wx.Rect(0, y, buttonWidth - 1, - self.todayHeight) - self.rightArrowRect = wx.Rect(buttonWidth * 4 + 1, y, buttonWidth - 1, - self.todayHeight) - - pen = wx.Pen(wx.BLACK); - pen.SetJoin(wx.JOIN_MITER) - gc.SetPen(pen) - gc.SetBrush(wx.BLACK_BRUSH) - - self.DrawPolygon(gc, leftarrow, larrowx, arrowy, wx.WINDING_RULE) - self.DrawPolygon(gc, rightarrow, rarrowx, arrowy, wx.WINDING_RULE) - - y += self.todayHeight - - dateToDraw = self.firstVisibleDate - for i in xrange(self.months_displayed): - y = self.DrawMonth(gc, dc, dateToDraw, y, True, font, boldFont, - width, height, transform) - dateToDraw = MonthDelta(dateToDraw, 1) - - - def OnClick(self, event): - (region, value) = self.HitTest(event.GetPosition()) - - if region == CAL_HITTEST_DAY: - self.ChangeDay(value) - self.GenerateEvents(EVT_MINI_CALENDAR_DAY_CHANGED, - EVT_MINI_CALENDAR_SEL_CHANGED) - - elif region == CAL_HITTEST_HEADER: - event.Skip() - - elif region == CAL_HITTEST_TODAY: - self.SetDateAndNotify(value) - self.SetVisibleDateAndNotify(value, True) - - - elif region == CAL_HITTEST_SURROUNDING_WEEK: - self.SetVisibleDateAndNotify(value, False) - - elif region in (CAL_HITTEST_DECMONTH, CAL_HITTEST_INCMONTH): - self.SetVisibleDate(value, True) - - elif region == CAL_HITTEST_NOWHERE: - event.Skip() - - else: - assert False, &quot;Unknown hit region?&quot; - - - def OnDClick(self, event): - (region, value) = self.HitTest(event.GetPosition()) - - if region in (CAL_HITTEST_DAY,CAL_HITTEST_SURROUNDING_WEEK) : - self.GenerateEvents(EVT_MINI_CALENDAR_DOUBLECLICKED) - else: - event.Skip() - - # override some base class virtuals - def DoGetBestSize(self): - - dc = wx.ClientDC(self) - font = self.GetDeviceFont() - dc.SetFont(font) - - # determine the column width (we assume that the widest digit - # plus busy bar is wider than any weekday character (hopefully - # in any language)) - self.widthCol = 0 - for day in xrange(1, 32): - (self.heightRow, width) = dc.GetTextExtent(unicode(day)) - if width &gt; self.widthCol: - self.widthCol = width - - # leave some margins - self.widthCol += 8 - self.heightRow += 6 - - self.rowOffset = self.heightRow * 2 - self.todayHeight = self.heightRow + 2 - - width, height = self.CalcGeometry() - best = wx.Size(width, height) - self.CacheBestSize(best) - - return best - - if wx.Platform == '__WXMAC__': - def GetDeviceFont(self): - font = self.GetFont() - - font = wx.Font(font.GetPointSize() - 2, font.GetFamily(), - font.GetStyle(), font.GetWeight(), - font.GetUnderlined(), font.GetFaceName(), - font.GetEncoding()) - - return font - else: - def GetDeviceFont(self): - return self.GetFont() - - def CalcGeometry(self): - &quot;&quot;&quot; - return best, unscaled, width and size - &quot;&quot;&quot; - width = DAYS_PER_WEEK * self.widthCol + 2 * SEPARATOR_MARGIN + WIDTH_CORRECTION - height = self.HeaderHeight() + self.months_displayed * self.MonthHeight() - - return width, height - - def IsExposed(self, x, y, w, h, transform=None): - - if transform is not None: - x, y = transform.TransformPoint(x, y) - w, h = transform.TransformPoint(w, h) - - return super(PyMiniCalendar, self).IsExposed(x, y, w, h) - - def DrawMonth(self, gc, dc, startDate, y, highlightDate, font, boldFont, - clientWidth, clientHeight, transform): - &quot;&quot;&quot; - draw a single month - return the updated value of y - &quot;&quot;&quot; - - mainFont = gc.CreateFont(font, self.mainColour) - highlightFont = gc.CreateFont(font, self.highlightColour) - lightFont = gc.CreateFont(font, self.lightColour) - blackFont = gc.CreateFont(boldFont, wx.BLACK) - transparentBrush = gc.CreateBrush(wx.TRANSPARENT_BRUSH) - - # Get extent of month-name + year - headertext = _(u'%(currentMonth)s %(currentYear)d') % { - 'currentMonth' : self.months[startDate.month-1], - 'currentYear' : startDate.year } - gc.SetFont(blackFont) - monthw, monthh = gc.GetTextExtent(headertext) - - # draw month-name centered above weekdays - monthx = (clientWidth - monthw) / 2 - monthy = ((self.heightRow - monthh) / 2) + y + 3 - gc.DrawText(headertext, monthx, monthy, transparentBrush) - - y += self.heightRow + EXTRA_MONTH_HEIGHT - - # draw the week day names - if self.IsExposed(0, y, DAYS_PER_WEEK * self.widthCol, self.heightRow, - transform): - gc.SetFont(gc.CreateFont(font, self.colHeaderFg)) - gc.SetBrush(self.colHeaderBgBrush) - gc.SetPen(self.colHeaderBgPen) - - # draw the background - gc.DrawRectangle(0, y-1, clientWidth, self.heightRow+2) - - for wd in xrange(DAYS_PER_WEEK): - n = (wd + self.firstDayOfWeek - 1) % DAYS_PER_WEEK - dayw = gc.GetTextExtent(self.weekdays[n+1])[0] - gc.DrawText(self.weekdays[n+1], - (wd*self.widthCol) + SEPARATOR_MARGIN + - ((self.widthCol- dayw) / 2), # center the day-name - y, - transparentBrush) - - y += self.heightRow - 1 - - weekDate = date(startDate.year, startDate.month, 1) - weekDate = self.FirstDayOfWeek(weekDate) - - gc.SetFont(mainFont) - - for nWeek in xrange(1, WEEKS_TO_DISPLAY+1): - # draw lines between each set of weeks - if nWeek &lt;= WEEKS_TO_DISPLAY and nWeek != 1: - gc.SetPen(self.lineColourPen) - self.DrawLine(gc, SEPARATOR_MARGIN, y - 1, - clientWidth - SEPARATOR_MARGIN, - y - 1) - - # if the update region doesn't intersect this row, don't paint it - if not self.IsExposed(0, y, DAYS_PER_WEEK * self.widthCol, - self.heightRow - 1, transform): - weekDate += timedelta(days=7) - y += self.heightRow - continue - - # don't draw last week if none of the days appear in the month - if nWeek == WEEKS_TO_DISPLAY and weekDate.month != startDate.month: - weekDate += timedelta(days=7) - y += self.heightRow - continue - - for weekDay in xrange(DAYS_PER_WEEK): - - dayStr = str(weekDate.day) - width = gc.GetTextExtent(dayStr)[0] - - columnStart = SEPARATOR_MARGIN + weekDay * self.widthCol - x = columnStart + (self.widthCol - width) / 2 - - if highlightDate: - # either highlight the selected week or the - # selected day depending upon the style - highlightWeek = (self.GetWindowStyle() &amp; - CAL_HIGHLIGHT_WEEK) != 0 - - if (self.hoverDate == weekDate or - # only highlight days that fall in the current month - (weekDate.month == startDate.month and - # highlighting week and the week we are drawing matches - ((highlightWeek and - self.CompareWeeks(weekDate, self.selectedDate)) or - # highlighting a single day - (not highlightWeek and - weekDate == self.selectedDate)))): - - startX = columnStart + 1 - width = self.widthCol - - gc.SetFont(highlightFont) - gc.SetBrush(self.highlightColourBrush) - gc.SetPen(self.highlightColourPen) - - gc.DrawRectangle(startX, y, width, self.heightRow - 2) - - # draw free/busy indicator - if weekDate.month == startDate.month: - busyPercentage = self.GetBusy(weekDate) - assert busyPercentage &gt;= 0 - if busyPercentage &gt; 0: - height = (self.heightRow - Y_ADJUSTMENT_BIG) * busyPercentage - gc.SetBrush(self.busyColourBrush) - gc.SetPen(wx.TRANSPARENT_PEN) - gc.DrawRectangle(columnStart + 1, - y + self.heightRow - height - 2, 2, height) - - if weekDate.month != startDate.month: - # surrounding week or out-of-range - # draw &quot;disabled&quot; - gc.SetFont(lightFont) - else: - gc.SetBrush(wx.BLACK_BRUSH) - gc.SetPen(wx.BLACK_PEN) - - # today should be printed as bold - if weekDate == date.today(): - gc.SetFont(blackFont) - else: - gc.SetFont(mainFont) - - gc.DrawText(dayStr, x, y + Y_ADJUSTMENT_SMALL, - wx.NullGraphicsBrush) - - weekDate += timedelta(days=1) - - y += self.heightRow - - return y - - def SetDateAndNotify(self, date): - &quot;&quot;&quot; - set the date and send the notification - &quot;&quot;&quot; - self.SetDate(date) - self.GenerateEvents(EVT_MINI_CALENDAR_YEAR_CHANGED, - EVT_MINI_CALENDAR_SEL_CHANGED) - - def SetVisibleDate(self, date, setVisible): - - sameMonth = (self.firstVisibleDate.month == date.month) - sameYear = (self.firstVisibleDate.year == date.year) - - if sameMonth and sameYear: - self.ChangeDay(date) - else: - - if setVisible: - self.firstVisibleDate = date - - if not setVisible: - self.selectedDate = date - - self.GenerateEvents(EVT_MINI_CALENDAR_UPDATE_BUSY) - - # update the calendar - self.Refresh(False) - - def SetVisibleDateAndNotify(self, newDate, setVisible): - if not setVisible and self.selectedDate is not None: - oldDate = self.selectedDate - else: - oldDate = self.firstVisibleDate - - if newDate.year != oldDate.year: - eventType = EVT_MINI_CALENDAR_YEAR_CHANGED - elif newDate.month != oldDate.month: - eventType = EVT_MINI_CALENDAR_MONTH_CHANGED - elif newDate.day != oldDate.day: - eventType = EVT_MINI_CALENDAR_DAY_CHANGED - else: - return - - self.SetVisibleDate(newDate, setVisible) - self.GenerateEvents(eventType, EVT_MINI_CALENDAR_SEL_CHANGED) - - - def FirstDayOfWeek(self, targetDate): - &quot;&quot;&quot; - rewind the selected date to the previous specified date - - Unfortunately, firstDayOfWeek has sunday = 1, and weekday() - has monday=0, so they're actually off by 2! - &quot;&quot;&quot; - dayAdjust = (self.firstDayOfWeek - 1) - (targetDate.weekday() + 1) - if dayAdjust &gt; 0: - dayAdjust -= 7 - elif dayAdjust == -7: - dayAdjust = 0 - - return targetDate + timedelta(days=dayAdjust) - - def GetWeekOfMonth(self, dt): - &quot;&quot;&quot; - there may be issues with monday/sunday first day of week - &quot;&quot;&quot; - week = self.FirstDayOfWeek(dt) - firstWeek = self.FirstDayOfWeek(date(dt.year, dt.month, 1)) - - return (week - firstWeek).days / 7 + 1 - - - def GetWeek(self, targetDate, useRelative=True): - &quot;&quot;&quot; - get the week (row, in range 1..WEEKS_TO_DISPLAY) for the given date - &quot;&quot;&quot; - # week of the month - if useRelative: - return self.GetWeekOfMonth(targetDate) - - # week of the year - targetDate = self.FirstDayOfWeek(targetDate) - year, week, day = targetDate.isocalendar() - - return week - - def CompareWeeks(self, date1, date2): - - d1w1 = self.FirstDayOfWeek(date1).isocalendar()[:2] - d2w2 = self.FirstDayOfWeek(date2).isocalendar()[:2] - return d1w1 == d2w2 - - def RefreshDate(self, date): - &quot;&quot;&quot; - redraw the given date - &quot;&quot;&quot; - #XXX this doesn't refresh the week for all visible months - x = 0 - y = (self.heightRow * (self.GetWeek(date) - 1) + - self.todayHeight + EXTRA_MONTH_HEIGHT + self.rowOffset) - - width = DAYS_PER_WEEK * self.widthCol + 2*SEPARATOR_MARGIN - height = self.heightRow - - if self.transform: - self.transform.Invert() - x, y = self.transform.TransformPoint(x, y) - width, height = self.transform.TransformDistance(width, height) - self.transform.Invert() - - rect = wx.Rect(x, y, width, height) - self.RefreshRect(rect, False) - - def GetBusy(self, date): - &quot;&quot;&quot; - get the busy state for the desired position - &quot;&quot;&quot; - return self.busyPercent.get(date, 0.0) - - def ChangeDay(self, date): - &quot;&quot;&quot; - change the date inside the same month/year - &quot;&quot;&quot; - if date != self.selectedDate: - oldDate = self.selectedDate - else: - oldDate = self.oldDate - - if self.selectedDate != date: - self.selectedDate = date - - if oldDate is not None: - self.RefreshDate(oldDate) - self.RefreshDate(date) - - def GenerateEvents(self, *events): - &quot;&quot;&quot; - generate the given calendar event(s) - &quot;&quot;&quot; - for evt in events: - event = wx.PyCommandEvent(evt.evtType[0]) - self.GetEventHandler().ProcessEvent(event) - </span></pre></div> <a id="branchesrearchitectureChandlerAppocapchandlerwxui__init__py"></a> <div class="addfile"><h4>Added: branches/rearchitecture/Chandler-App/ocap/chandler/wxui/__init__.py (15860 => 15861)</h4> <pre class="diff"> <span class="info">--- branches/rearchitecture/Chandler-App/ocap/chandler/wxui/__init__.py 2007-11-16 00:42:53 UTC (rev 15860) +++ branches/rearchitecture/Chandler-App/ocap/chandler/wxui/__init__.py 2007-11-16 00:56:43 UTC (rev 15861) </span><span class="lines">@@ -0,0 +1 @@ </span><span class="add">+&quot;&quot;&quot;Chandler-specific wx-related code&quot;&quot;&quot; </span><span class="cx">\ No newline at end of file Property changes on: branches/rearchitecture/Chandler-App/ocap/chandler/wxui/__init__.py ___________________________________________________________________ Name: svn:eol-style + native </span> </pre> </div> </div> </body> </html> Thu, 25 Apr, 03:33
b.@osafoundation.org = gc.GetTransform() - self.transform = gc.CreateMatrix(*transform.Get()) - self.yOffset = transform.Get()[-1] # for hit tests on Mac - self.transform.Invert() - - font = self.GetDeviceFont() - boldFont = wx.Font(font.GetPointSize(), font.GetFamily(), - font.GetStyle(), wx.BOLD, font.GetUnderlined(), - font.GetFaceName(), font.GetEncoding()) - y = 0 - - # draw the sequential month-selector - gc.SetBrush(wx.TRANSPARENT_BRUSH) - gc.SetPen(wx.LIGHT_GREY_PEN) - if self.lineAboveToday: - self.DrawLine(gc, 0, y, width, y) - self.DrawLine(gc, 0, y + self.todayHeight, - width, y + self.todayHeight) - buttonWidth = width / 5 - self.DrawLine(gc, buttonWidth, y, - buttonWidth, y + self.todayHeight) - self.DrawLine(gc, buttonWidth * 4, y, - buttonWidth * 4, y + self.todayHeight) - - # Get extent of today button - todaytext = _(u&quot;Today&quot;) - gc.SetFont(gc.CreateFont(boldFont, wx.BLACK)) - todayw, todayh = gc.GetTextExtent(todaytext) - - # Draw today button - self.todayRect = wx.Rect(buttonWidth, y, - buttonWidth * 4, self.todayHeight) - todayx = (buttonWidth * 5 - todayw) / 2 - todayy = y + (self.todayHeight - todayh) / 2 - - gc.DrawText(todaytext, todayx, todayy, - gc.CreateBrush(wx.TRANSPARENT_BRUSH)) - - # calculate month arrows - arrowheight = todayh - 5 - - leftarrow = [(0, arrowheight / 2), - (arrowheight / 2, 0), - (arrowheight / 2, arrowheight - 1)] - rightarrow = [(0, 0), - (arrowheight / 2, arrowheight / 2), - (0, arrowheight - 1)] - - # draw month arrows - arrowy = (self.todayHeight - arrowheight) / 2 + y - larrowx = (buttonWidth - (arrowheight / 2)) / 2 - rarrowx = (buttonWidth / 2) + buttonWidth * 4 - - self.leftArrowRect = wx.Rect(0, y, buttonWidth - 1, - self.todayHeight) - self.rightArrowRect = wx.Rect(buttonWidth * 4 + 1, y, buttonWidth - 1, - self.todayHeight) - - pen = wx.Pen(wx.BLACK); - pen.SetJoin(wx.JOIN_MITER) - gc.SetPen(pen) - gc.SetBrush(wx.BLACK_BRUSH) - - self.DrawPolygon(gc, leftarrow, larrowx, arrowy, wx.WINDING_RULE) - self.DrawPolygon(gc, rightarrow, rarrowx, arrowy, wx.WINDING_RULE) - - y += self.todayHeight - - dateToDraw = self.firstVisibleDate - for i in xrange(self.months_displayed): - y = self.DrawMonth(gc, dc, dateToDraw, y, True, font, boldFont, - width, height, transform) - dateToDraw = MonthDelta(dateToDraw, 1) - - - def OnClick(self, event): - (region, value) = self.HitTest(event.GetPosition()) - - if region == CAL_HITTEST_DAY: - self.ChangeDay(value) - self.GenerateEvents(EVT_MINI_CALENDAR_DAY_CHANGED, - EVT_MINI_CALENDAR_SEL_CHANGED) - - elif region == CAL_HITTEST_HEADER: - event.Skip() - - elif region == CAL_HITTEST_TODAY: - self.SetDateAndNotify(value) - self.SetVisibleDateAndNotify(value, True) - - - elif region == CAL_HITTEST_SURROUNDING_WEEK: - self.SetVisibleDateAndNotify(value, False) - - elif region in (CAL_HITTEST_DECMONTH, CAL_HITTEST_INCMONTH): - self.SetVisibleDate(value, True) - - elif region == CAL_HITTEST_NOWHERE: - event.Skip() - - else: - assert False, &quot;Unknown hit region?&quot; - - - def OnDClick(self, event): - (region, value) = self.HitTest(event.GetPosition()) - - if region in (CAL_HITTEST_DAY,CAL_HITTEST_SURROUNDING_WEEK) : - self.GenerateEvents(EVT_MINI_CALENDAR_DOUBLECLICKED) - else: - event.Skip() - - # override some base class virtuals - def DoGetBestSize(self): - - dc = wx.ClientDC(self) - font = self.GetDeviceFont() - dc.SetFont(font) - - # determine the column width (we assume that the widest digit - # plus busy bar is wider than any weekday character (hopefully - # in any language)) - self.widthCol = 0 - for day in xrange(1, 32): - (self.heightRow, width) = dc.GetTextExtent(unicode(day)) - if width &gt; self.widthCol: - self.widthCol = width - - # leave some margins - self.widthCol += 8 - self.heightRow += 6 - - self.rowOffset = self.heightRow * 2 - self.todayHeight = self.heightRow + 2 - - width, height = self.CalcGeometry() - best = wx.Size(width, height) - self.CacheBestSize(best) - - return best - - if wx.Platform == '__WXMAC__': - def GetDeviceFont(self): - font = self.GetFont() - - font = wx.Font(font.GetPointSize() - 2, font.GetFamily(), - font.GetStyle(), font.GetWeight(), - font.GetUnderlined(), font.GetFaceName(), - font.GetEncoding()) - - return font - else: - def GetDeviceFont(self): - return self.GetFont() - - def CalcGeometry(self): - &quot;&quot;&quot; - return best, unscaled, width and size - &quot;&quot;&quot; - width = DAYS_PER_WEEK * self.widthCol + 2 * SEPARATOR_MARGIN + WIDTH_CORRECTION - height = self.HeaderHeight() + self.months_displayed * self.MonthHeight() - - return width, height - - def IsExposed(self, x, y, w, h, transform=None): - - if transform is not None: - x, y = transform.TransformPoint(x, y) - w, h = transform.TransformPoint(w, h) - - return super(PyMiniCalendar, self).IsExposed(x, y, w, h) - - def DrawMonth(self, gc, dc, startDate, y, highlightDate, font, boldFont, - clientWidth, clientHeight, transform): - &quot;&quot;&quot; - draw a single month - return the updated value of y - &quot;&quot;&quot; - - mainFont = gc.CreateFont(font, self.mainColour) - highlightFont = gc.CreateFont(font, self.highlightColour) - lightFont = gc.CreateFont(font, self.lightColour) - blackFont = gc.CreateFont(boldFont, wx.BLACK) - transparentBrush = gc.CreateBrush(wx.TRANSPARENT_BRUSH) - - # Get extent of month-name + year - headertext = _(u'%(currentMonth)s %(currentYear)d') % { - 'currentMonth' : self.months[startDate.month-1], - 'currentYear' : startDate.year } - gc.SetFont(blackFont) - monthw, monthh = gc.GetTextExtent(headertext) - - # draw month-name centered above weekdays - monthx = (clientWidth - monthw) / 2 - monthy = ((self.heightRow - monthh) / 2) + y + 3 - gc.DrawText(headertext, monthx, monthy, transparentBrush) - - y += self.heightRow + EXTRA_MONTH_HEIGHT - - # draw the week day names - if self.IsExposed(0, y, DAYS_PER_WEEK * self.widthCol, self.heightRow, - transform): - gc.SetFont(gc.CreateFont(font, self.colHeaderFg)) - gc.SetBrush(self.colHeaderBgBrush) - gc.SetPen(self.colHeaderBgPen) - - # draw the background - gc.DrawRectangle(0, y-1, clientWidth, self.heightRow+2) - - for wd in xrange(DAYS_PER_WEEK): - n = (wd + self.firstDayOfWeek - 1) % DAYS_PER_WEEK - dayw = gc.GetTextExtent(self.weekdays[n+1])[0] - gc.DrawText(self.weekdays[n+1], - (wd*self.widthCol) + SEPARATOR_MARGIN + - ((self.widthCol- dayw) / 2), # center the day-name - y, - transparentBrush) - - y += self.heightRow - 1 - - weekDate = date(startDate.year, startDate.month, 1) - weekDate = self.FirstDayOfWeek(weekDate) - - gc.SetFont(mainFont) - - for nWeek in xrange(1, WEEKS_TO_DISPLAY+1): - # draw lines between each set of weeks - if nWeek &lt;= WEEKS_TO_DISPLAY and nWeek != 1: - gc.SetPen(self.lineColourPen) - self.DrawLine(gc, SEPARATOR_MARGIN, y - 1, - clientWidth - SEPARATOR_MARGIN, - y - 1) - - # if the update region doesn't intersect this row, don't paint it - if not self.IsExposed(0, y, DAYS_PER_WEEK * self.widthCol, - self.heightRow - 1, transform): - weekDate += timedelta(days=7) - y += self.heightRow - continue - - # don't draw last week if none of the days appear in the month - if nWeek == WEEKS_TO_DISPLAY and weekDate.month != startDate.month: - weekDate += timedelta(days=7) - y += self.heightRow - continue - - for weekDay in xrange(DAYS_PER_WEEK): - - dayStr = str(weekDate.day) - width = gc.GetTextExtent(dayStr)[0] - - columnStart = SEPARATOR_MARGIN + weekDay * self.widthCol - x = columnStart + (self.widthCol - width) / 2 - - if highlightDate: - # either highlight the selected week or the - # selected day depending upon the style - highlightWeek = (self.GetWindowStyle() &amp; - CAL_HIGHLIGHT_WEEK) != 0 - - if (self.hoverDate == weekDate or - # only highlight days that fall in the current month - (weekDate.month == startDate.month and - # highlighting week and the week we are drawing matches - ((highlightWeek and - self.CompareWeeks(weekDate, self.selectedDate)) or - # highlighting a single day - (not highlightWeek and - weekDate == self.selectedDate)))): - - startX = columnStart + 1 - width = self.widthCol - - gc.SetFont(highlightFont) - gc.SetBrush(self.highlightColourBrush) - gc.SetPen(self.highlightColourPen) - - gc.DrawRectangle(startX, y, width, self.heightRow - 2) - - # draw free/busy indicator - if weekDate.month == startDate.month: - busyPercentage = self.GetBusy(weekDate) - assert busyPercentage &gt;= 0 - if busyPercentage &gt; 0: - height = (self.heightRow - Y_ADJUSTMENT_BIG) * busyPercentage - gc.SetBrush(self.busyColourBrush) - gc.SetPen(wx.TRANSPARENT_PEN) - gc.DrawRectangle(columnStart + 1, - y + self.heightRow - height - 2, 2, height) - - if weekDate.month != startDate.month: - # surrounding week or out-of-range - # draw &quot;disabled&quot; - gc.SetFont(lightFont) - else: - gc.SetBrush(wx.BLACK_BRUSH) - gc.SetPen(wx.BLACK_PEN) - - # today should be printed as bold - if weekDate == date.today(): - gc.SetFont(blackFont) - else: - gc.SetFont(mainFont) - - gc.DrawText(dayStr, x, y + Y_ADJUSTMENT_SMALL, - wx.NullGraphicsBrush) - - weekDate += timedelta(days=1) - - y += self.heightRow - - return y - - def SetDateAndNotify(self, date): - &quot;&quot;&quot; - set the date and send the notification - &quot;&quot;&quot; - self.SetDate(date) - self.GenerateEvents(EVT_MINI_CALENDAR_YEAR_CHANGED, - EVT_MINI_CALENDAR_SEL_CHANGED) - - def SetVisibleDate(self, date, setVisible): - - sameMonth = (self.firstVisibleDate.month == date.month) - sameYear = (self.firstVisibleDate.year == date.year) - - if sameMonth and sameYear: - self.ChangeDay(date) - else: - - if setVisible: - self.firstVisibleDate = date - - if not setVisible: - self.selectedDate = date - - self.GenerateEvents(EVT_MINI_CALENDAR_UPDATE_BUSY) - - # update the calendar - self.Refresh(False) - - def SetVisibleDateAndNotify(self, newDate, setVisible): - if not setVisible and self.selectedDate is not None: - oldDate = self.selectedDate - else: - oldDate = self.firstVisibleDate - - if newDate.year != oldDate.year: - eventType = EVT_MINI_CALENDAR_YEAR_CHANGED - elif newDate.month != oldDate.month: - eventType = EVT_MINI_CALENDAR_MONTH_CHANGED - elif newDate.day != oldDate.day: - eventType = EVT_MINI_CALENDAR_DAY_CHANGED - else: - return - - self.SetVisibleDate(newDate, setVisible) - self.GenerateEvents(eventType, EVT_MINI_CALENDAR_SEL_CHANGED) - - - def FirstDayOfWeek(self, targetDate): - &quot;&quot;&quot; - rewind the selected date to the previous specified date - - Unfortunately, firstDayOfWeek has sunday = 1, and weekday() - has monday=0, so they're actually off by 2! - &quot;&quot;&quot; - dayAdjust = (self.firstDayOfWeek - 1) - (targetDate.weekday() + 1) - if dayAdjust &gt; 0: - dayAdjust -= 7 - elif dayAdjust == -7: - dayAdjust = 0 - - return targetDate + timedelta(days=dayAdjust) - - def GetWeekOfMonth(self, dt): - &quot;&quot;&quot; - there may be issues with monday/sunday first day of week - &quot;&quot;&quot; - week = self.FirstDayOfWeek(dt) - firstWeek = self.FirstDayOfWeek(date(dt.year, dt.month, 1)) - - return (week - firstWeek).days / 7 + 1 - - - def GetWeek(self, targetDate, useRelative=True): - &quot;&quot;&quot; - get the week (row, in range 1..WEEKS_TO_DISPLAY) for the given date - &quot;&quot;&quot; - # week of the month - if useRelative: - return self.GetWeekOfMonth(targetDate) - - # week of the year - targetDate = self.FirstDayOfWeek(targetDate) - year, week, day = targetDate.isocalendar() - - return week - - def CompareWeeks(self, date1, date2): - - d1w1 = self.FirstDayOfWeek(date1).isocalendar()[:2] - d2w2 = self.FirstDayOfWeek(date2).isocalendar()[:2] - return d1w1 == d2w2 - - def RefreshDate(self, date): - &quot;&quot;&quot; - redraw the given date - &quot;&quot;&quot; - #XXX this doesn't refresh the week for all visible months - x = 0 - y = (self.heightRow * (self.GetWeek(date) - 1) + - self.todayHeight + EXTRA_MONTH_HEIGHT + self.rowOffset) - - width = DAYS_PER_WEEK * self.widthCol + 2*SEPARATOR_MARGIN - height = self.heightRow - - if self.transform: - self.transform.Invert() - x, y = self.transform.TransformPoint(x, y) - width, height = self.transform.TransformDistance(width, height) - self.transform.Invert() - - rect = wx.Rect(x, y, width, height) - self.RefreshRect(rect, False) - - def GetBusy(self, date): - &quot;&quot;&quot; - get the busy state for the desired position - &quot;&quot;&quot; - return self.busyPercent.get(date, 0.0) - - def ChangeDay(self, date): - &quot;&quot;&quot; - change the date inside the same month/year - &quot;&quot;&quot; - if date != self.selectedDate: - oldDate = self.selectedDate - else: - oldDate = self.oldDate - - if self.selectedDate != date: - self.selectedDate = date - - if oldDate is not None: - self.RefreshDate(oldDate) - self.RefreshDate(date) - - def GenerateEvents(self, *events): - &quot;&quot;&quot; - generate the given calendar event(s) - &quot;&quot;&quot; - for evt in events: - event = wx.PyCommandEvent(evt.evtType[0]) - self.GetEventHandler().ProcessEvent(event) - </span></pre></div> <a id="branchesrearchitectureChandlerAppocapchandlerwxui__init__py"></a> <div class="addfile"><h4>Added: branches/rearchitecture/Chandler-App/ocap/chandler/wxui/__init__.py (15860 => 15861)</h4> <pre class="diff"> <span class="info">--- branches/rearchitecture/Chandler-App/ocap/chandler/wxui/__init__.py 2007-11-16 00:42:53 UTC (rev 15860) +++ branches/rearchitecture/Chandler-App/ocap/chandler/wxui/__init__.py 2007-11-16 00:56:43 UTC (rev 15861) </span><span class="lines">@@ -0,0 +1 @@ </span><span class="add">+&quot;&quot;&quot;Chandler-specific wx-related code&quot;&quot;&quot; </span><span class="cx">\ No newline at end of file Property changes on: branches/rearchitecture/Chandler-App/ocap/chandler/wxui/__init__.py ___________________________________________________________________ Name: svn:eol-style + native </span> </pre> </div> </div> </body> </html> Thu, 25 Apr, 03:33
n @@ &amp;lt;/span&amp;gt;&amp;lt;span class=&quot;cx&quot;&amp;gt; # the progress dialog will also kill the SSL error dialog. # Weird, huh? Welcome to the world of wx... callMethodInUIThread(self.callback, result) &amp;lt;/span&amp;gt;&amp;lt;span class=&quot;rem&quot;&amp;gt;- ssl.askIgnoreSSLError( err.pem, - messages.SSL_HOST_MISMATCH % \ - {'expectedHost': err.expectedHost, - 'actualHost': err.actualHost}, Thu, 11 Aug, 20:00
n @@ &amp;lt;/span&amp;gt;&amp;lt;span class=&quot;cx&quot;&amp;gt; # the progress dialog will also kill the SSL error dialog. # Weird, huh? Welcome to the world of wx... callMethodInUIThread(self.callback, result) &amp;lt;/span&amp;gt;&amp;lt;span class=&quot;rem&quot;&amp;gt;- ssl.askIgnoreSSLError( err.pem, - messages.SSL_HOST_MISMATCH % \ - {'expectedHost': err.expectedHost, - 'actualHost': err.actualHost}, Thu, 11 Aug, 20:00
n @@ &amp;lt;/span&amp;gt;&amp;lt;span class=&quot;cx&quot;&amp;gt; # the progress dialog will also kill the SSL error dialog. # Weird, huh? Welcome to the world of wx... callMethodInUIThread(self.callback, result) &amp;lt;/span&amp;gt;&amp;lt;span class=&quot;rem&quot;&amp;gt;- ssl.askIgnoreSSLError( err.pem, - messages.SSL_HOST_MISMATCH % \ - {'expectedHost': err.expectedHost, - 'actualHost': err.actualHost}, Thu, 11 Aug, 20:00
n @@ &amp;lt;/span&amp;gt;&amp;lt;span class=&quot;cx&quot;&amp;gt; # the progress dialog will also kill the SSL error dialog. # Weird, huh? Welcome to the world of wx... callMethodInUIThread(self.callback, result) &amp;lt;/span&amp;gt;&amp;lt;span class=&quot;rem&quot;&amp;gt;- ssl.askIgnoreSSLError( err.pem, - messages.SSL_HOST_MISMATCH % \ - {'expectedHost': err.expectedHost, - 'actualHost': err.actualHost}, Thu, 11 Aug, 20:00
ocap/chandler/wxui/__init__.py___________________________________________________________________Name:svn:eol-style+native</span> Thu, 03 Oct, 09:55
lt {"_p_org__apache__lucene__document__Document", _p_org__apache__lucene__document__DocumentTo_p_java__lang__Object},{"_p_org__apache__lucene__store__Directory", _p_org__apache__lucene__store__DirectoryTo_p_java__lang__Object},{"_p_org__apache__lucene__store__db__DbDirectory", _p_org__apache__lucene__store__db__DbDirectoryTo_p_java__lang__Object},{"_p_org__apache__lucene__index__IndexWriter", _p_org__apache__lucene__index__IndexWriterTo_p_java__lang__Object},{0}}; +static swig_type_info _swigt__p_java__lang__Object[] = {{"_p_java__lang__Object", 0, "java::lang::Object *", 0},{"_p_org__apache__lucene__search__Hits", _p_org__apache__lucene__search__HitsTo_p_java__lang__Object},{"_p_org__apache__lucene__analysis__Analyzer", _p_org__apache__lucene__analysis__AnalyzerTo_p_java__lang__Object},{"_p_org__apache__lucene__search__Searcher", _p_org__apache__lucene__search__SearcherTo_p_java__lang__Object},{"_p_org__apache__lucene__search__IndexSearcher", _p_org__apache__lucene__search__IndexSearcherTo_p_java__lang__Object},{"_p_org__apache__lucene__queryParser__QueryParser", _p_org__apache__lucene__queryParser__QueryParserTo_p_java__lang__Object},{"_p_org__apache__lucene__document__Field", _p_org__apache__lucene__document__FieldTo_p_java__lang__Object},{"_p_org__apache__lucene__analysis__standard__StandardAnalyzer", _p_org__apache__lucene__analysis__standard__StandardAnalyzerTo_p_java__lang__Object},{"_p_org__apache__lucene__search__Query", _p_o! rg__apache__lucene__search__QueryTo_p_java__lang__Object},{"_p_java__io__Reader", _p_java__io__ReaderTo_p_java__lang__Object},{"_p_org__apache__lucene__index__IndexWriter", _p_org__apache__lucene__index__IndexWriterTo_p_java__lang__Object},{"_p_org__apache__lucene__store__Directory", _p_org__apache__lucene__store__DirectoryTo_p_java__lang__Object},{"_p_org__apache__lucene__store__db__DbDirectory", _p_org__apache__lucene__store__db__DbDirectoryTo_p_java__lang__Object},{"_p_org__apache__lucene__document__Document", _p_org__apache__lucene__document__DocumentTo_p_java__lang__Object},{"_p_java__lang__Object"},{0}}; static swig_type_info _swigt__p_jdbtxn[] = {{"_p_jdbtxn", 0, "jdbtxn *", 0},{"_p_jdbtxn"},{0}}; static swig_type_info *swig_types_initial[] = { @@ -2185,6 +2253,8 @@ _swigt__p_jstring, _swigt__p_org__apache__lucene__analysis__standard__StandardAnalyzer, _swigt__p_org__apache__lucene__search__Query, +_swigt__p_jreader, +_swigt__p_java__io__Reader, _swigt__p_org__apache__lucene__index__IndexWriter, _swigt__p_org__apache__lucene__store__db__DbDirectory, _swigt__p_org__apache__lucene__store__Directory, Index: osaf/chandler/persistence/PyLucene/Makefile.mingw diff -u osaf/chandler/persistence/PyLucene/Makefile.mingw:1.2 osaf/chandler/persistence/PyLucene/Makefile.mingw:1.3 --- osaf/chandler/persistence/PyLucene/Makefile.mingw:1.2 Sat Jan 10 19:08:03 2004 +++ osaf/chandler/persistence/PyLucene/Makefile.mingw Tue Jan 13 21:48:50 2004 @@ -35,6 +35,8 @@ PYTHON_INC = $(RELDIR)\bin\include PYTHON_SITE = $(RELDIR)\bin\Lib\site-packages +OBJS = $(BINDIR)\db_const.o $(BINDIR)\db.o $(BINDIR)\store.o $(BINDIR)\lucene.o $(BINDIR)\reader.java.o $(BINDIR)\reader.cpp.o + $(BINDIR)\lucene.o: if not exist $(BINDIR) mkdir $(BINDIR)\classes $(JCC) -C -d $(CLASSES) @lucene.lst @@ -56,7 +58,15 @@ $(JCC) -C -d $(CLASSES) --classpath=$(CLASSES) @store.lst $(JCC) -fjni $(CCFLAGS) -c -o $(BINDIR)\store.o --classpath=$(CLASSES) @store.lst -$(BINDIR)\_PyLucene$(_dbg).pyd: $(BINDIR)\store.o $(BINDIR)\db_const.o $(BINDIR)\db.o $(BINDIR)\lucene.o +$(BINDIR)\reader.java.o: java/org/osafoundation/io/PythonReader.java + $(JCC) -C -d $(CLASSES) java/org/osafoundation/io/PythonReader.java + $(JCC) $(CCFLAGS) -c -o $(BINDIR)/reader.java.o java/org/osafoundation/io/PythonReader.java + $(JCCH) -d $(CLASSES) --classpath=$(CLASSES) org.osafoundation.io.PythonReader + +$(BINDIR)\reader.cpp.o: cpp/PythonReader.cpp $(BINDIR)/reader.java.o + $(JCC) -I$(PYTHON_INC) -I$(CLASSES) $(CCFLAGS) -c -o $(BINDIR)/reader.cpp.o cpp/PythonReader.cpp + +$(BINDIR)\_PyLucene$(_dbg).pyd: $(OBJS) $(JCCH) -d $(CLASSES) --classpath=$(CLASSES) com.sleepycat.db.DbEnv $(JCCH) -d $(CLASSES) --classpath=$(CLASSES) com.sleepycat.db.Db $(JCCH) -d $(CLASSES) --classpath=$(CLASSES) com.sleepycat.db.DbTxn @@ -73,8 +83,8 @@ $(JCCH) -d $(CLASSES) --classpath=$(CLASSES) org.apache.lucene.search.IndexSearcher $(JCCH) -d $(CLASSES) --classpath=$(CLASSES) org.apache.lucene.queryParser.QueryParser - $(CXX) -c $(CCFLAGS) $(PYDBG) -D_NO_OLDNAMES -Dalloca=__builtin_alloca -I$(CLASSES) -I$(PYTHON_INC) -I$(RELDIR)\include\db -o $(BINDIR)\PyLucene_wrap.o PyLucene_wrap.cxx - $(CXX) -shared $(LDFLAGS) -o $(BINDIR)\_PyLucene$(_dbg).pyd $(BINDIR)\db_const.o $(BINDIR)\db.o $(BINDIR)\store.o $(BINDIR)\lucene.o $(RELDIR)\bin\python23$(_dbg).dll $(BINDIR)\PyLucene_wrap.o -lgcj -lwin32k -lws2_32 + $(CXX) -c $(CCFLAGS) $(PYDBG) -D_NO_OLDNAMES -I$(CLASSES) -I$(PYTHON_INC) -I$(RELDIR)\include\db -o $(BINDIR)\PyLucene_wrap.o PyLucene_wrap.cxx + $(CXX) -shared $(LDFLAGS) -o $(BINDIR)\_PyLucene$(_dbg).pyd $(OBJS) $(RELDIR)\bin\python23$(_dbg).dll $(BINDIR)\PyLucene_wrap.o -lgcj -lwin32k -lws2_32 all: $(BINDIR)\_PyLucene$(_dbg).pyd $(BINDIR)\libdb_java42$(dbg).dll echo build of $(BINDIR)\_PyLucene$(_dbg).pyd complete Index: osaf/chandler/persistence/PyLucene/Makefile diff -u osaf/chandler/persistence/PyLucene/Makefile:1.1 osaf/chandler/persistence/PyLucene/Makefile:1.2 --- osaf/chandler/persistence/PyLucene/Makefile:1.1 Sat Jan 10 19:08:03 2004 +++ osaf/chandler/persistence/PyLucene/Makefile Tue Jan 13 21:48:50 2004 @@ -9,8 +9,8 @@ else -CCFLAGS = -O2 -LDFLAGS = +CCFLAGS = -g +LDFLAGS = -g mode = release endif @@ -56,7 +56,16 @@ $(JCC) -C -d $(CLASSES) --classpath=$(CLASSES) $(STORE_SRCS) $(JCC) -fjni $(CCFLAGS) -c -o $(BINDIR)/store.o --classpath=$(CLASSES) $(STORE_SRCS) -PyLucene_wrap.cxx: PyLucene.i +$(BINDIR)/reader.java.o: java/org/osafoundation/io/PythonReader.java + if [ ! -d $(BINDIR) ]; then mkdir -p $(BINDIR)/classes; fi + $(JCC) -C -d $(CLASSES) java/org/osafoundation/io/PythonReader.java + $(JCC) $(CCFLAGS) -c -o $(BINDIR)/reader.java.o java/org/osafoundation/io/PythonReader.java + +$(BINDIR)/reader.cpp.o: cpp/PythonReader.cpp + if [ ! -d $(BINDIR) ]; then mkdir -p $(BINDIR)/classes; fi + $(JCC) -I$(PYTHON_INC) -I$(CLASSES) $(CCFLAGS) -c -o $(BINDIR)/reader.cpp.o cpp/PythonReader.cpp + +PyLucene_wrap.cxx: PyLucene.i $(BINDIR)/reader.java.o $(JCCH) -d $(CLASSES) --classpath=$(CLASSES) com.sleepycat.db.DbEnv $(JCCH) -d $(CLASSES) --classpath=$(CLASSES) com.sleepycat.db.Db $(JCCH) -d $(CLASSES) --classpath=$(CLASSES) com.sleepycat.db.DbTxn @@ -72,10 +81,11 @@ $(JCCH) -d $(CLASSES) --classpath=$(CLASSES) org.apache.lucene.search.Hits $(JCCH) -d $(CLASSES) --classpath=$(CLASSES) org.apache.lucene.search.IndexSearcher $(JCCH) -d $(CLASSES) --classpath=$(CLASSES) org.apache.lucene.queryParser.QueryParser + $(JCCH) -d $(CLASSES) --classpath=$(CLASSES) org.osafoundation.io.PythonReader swig -modern -I$(BINDIR)/classes -c++ -python PyLucene.i -$(BINDIR)/_PyLucene.so: $(BINDIR)/store.o $(BINDIR)/db_const.o $(BINDIR)/db.o $(BINDIR)/lucene.o PyLucene_wrap.cxx - $(CXX) -shared -bundle -o $(BINDIR)/_PyLucene.so $(CCFLAGS) -I$(CLASSES) -I$(PYTHON_INC) -I/usr/local/BerkeleyDB.4.2/include PyLucene_wrap.cxx $(BINDIR)/db_const.o $(BINDIR)/db.o $(BINDIR)/store.o $(BINDIR)/lucene.o -lgcj -liconv -undefined suppress -flat_namespace -multiply_defined suppress +$(BINDIR)/_PyLucene.so: $(BINDIR)/store.o $(BINDIR)/db_const.o $(BINDIR)/db.o $(BINDIR)/lucene.o PyLucene_wrap.cxx $(BINDIR)/reader.java.o $(BINDIR)/reader.cpp.o + $(CXX) -shared -bundle -o $(BINDIR)/_PyLucene.so $(CCFLAGS) -I$(CLASSES) -I$(PYTHON_INC) -I/usr/local/BerkeleyDB.4.2/include PyLucene_wrap.cxx $(BINDIR)/db_const.o $(BINDIR)/db.o $(BINDIR)/store.o $(BINDIR)/lucene.o $(BINDIR)/reader.java.o $(BINDIR)/reader.cpp.o -lgcj -liconv -flat_namespace -multiply_defined suppress -undefined warning all: $(BINDIR)/_PyLucene.so $(BINDIR)/libdb_java-4.2.jnilib echo build of $(BINDIR)/_PyLucene.so complete Index: osaf/chandler/persistence/PyLucene/Makefile.osx diff -u osaf/chandler/persistence/PyLucene/Makefile.osx:1.3 osaf/chandler/persistence/PyLucene/Makefile.osx:1.4 --- osaf/chandler/persistence/PyLucene/Makefile.osx:1.3 Sat Jan 10 19:08:03 2004 +++ osaf/chandler/persistence/PyLucene/Makefile.osx Tue Jan 13 21:48:50 2004 @@ -34,6 +34,8 @@ DB_SRCS = `find $(DB)/java/src/com/sleepycat/db -regex '.*/db/[^/]*java'` STORE_SRCS = `find store -name '*.java' -print` +OBJS = $(BINDIR)/store.o $(BINDIR)/db_const.o $(BINDIR)/db.o $(BINDIR)/lucene.o $(BINDIR)/reader.java.o $(BINDIR)/reader.cpp.o + $(BINDIR)/lucene.o: if [ ! -d $(BINDIR) ]; then mkdir -p $(BINDIR)/classes; fi @@ -58,7 +60,15 @@ $(JCC) -C -d $(CLASSES) --classpath=$(CLASSES) $(STORE_SRCS) $(JCC) -fjni $(CCFLAGS) -c -o $(BINDIR)/store.o --classpath=$(CLASSES) $(STORE_SRCS) -$(BINDIR)/_PyLucene.so: $(BINDIR)/store.o $(BINDIR)/db_const.o $(BINDIR)/db.o $(BINDIR)/lucene.o +$(BINDIR)/reader.java.o: java/org/osafoundation/io/PythonReader.java + $(JCC) -C -d $(CLASSES) java/org/osafoundation/io/PythonReader.java + $(JCC) $(CCFLAGS) -c -o $(BINDIR)/reader.java.o java/org/osafoundation/io/PythonReader.java + $(JCCH) -d $(CLASSES) --classpath=$(CLASSES) org.osafoundation.io.PythonReader + +$(BINDIR)/reader.cpp.o: cpp/PythonReader.cpp $(BINDIR)/reader.java.o + $(JCC) -I$(PYTHON_INC) -I$(CLASSES) $(CCFLAGS) -c -o $(BINDIR)/reader.cpp.o cpp/PythonReader.cpp + +$(BINDIR)/_PyLucene.so: $(OBJS) $(JCCH) -d $(CLASSES) --classpath=$(CLASSES) com.sleepycat.db.DbEnv $(JCCH) -d $(CLASSES) --classpath=$(CLASSES) com.sleepycat.db.Db $(JCCH) -d $(CLASSES) --classpath=$(CLASSES) com.sleepycat.db.DbTxn @@ -74,7 +84,7 @@ $(JCCH) -d $(CLASSES) --classpath=$(CLASSES) org.apache.lucene.search.Hits $(JCCH) -d $(CLASSES) --classpath=$(CLASSES) org.apache.lucene.search.IndexSearcher $(JCCH) -d $(CLASSES) --classpath=$(CLASSES) org.apache.lucene.queryParser.QueryParser - $(CXX) -shared -bundle -o $(BINDIR)/_PyLucene.so $(CCFLAGS) -I$(CLASSES) -I$(PYTHON_INC) -I$(RELDIR)/db/include PyLucene_wrap.cxx $(BINDIR)/db_const.o $(BINDIR)/db.o $(BINDIR)/store.o $(BINDIR)/lucene.o -lgcj -liconv -undefined suppress -flat_namespace -multiply_defined suppress + $(CXX) -shared -bundle -o $(BINDIR)/_PyLucene.so $(CCFLAGS) -I$(CLASSES) -I$(PYTHON_INC) -I$(RELDIR)/db/include PyLucene_wrap.cxx $(OBJS) -lgcj -liconv -undefined suppress -flat_namespace -multiply_defined suppress all: $(BINDIR)/_PyLucene.so $(BINDIR)/libdb_java-4.2.jnilib echo build of $(BINDIR)/_PyLucene.so complete Index: osaf/chandler/persistence/PyLucene/PyLucene.i diff -u osaf/chandler/persistence/PyLucene/PyLucene.i:1.2 osaf/chandler/persistence/PyLucene/PyLucene.i:1.3 --- osaf/chandler/persistence/PyLucene/PyLucene.i:1.2 Sat Jan 10 19:08:03 2004 +++ osaf/chandler/persistence/PyLucene/PyLucene.i Tue Jan 13 21:48:50 2004 @@ -15,6 +15,7 @@ #include &lt;gcj/cni.h&gt; #include &lt;java/lang/Object.h&gt; #include &lt;java/lang/Throwable.h&gt; +#include &lt;java/io/Reader.h&gt; #include "com/sleepycat/db/DbEnv.h" #include "com/sleepycat/db/Db.h" @@ -32,6 +33,7 @@ #include "org/apache/lucene/search/Query.h" #include "org/apache/lucene/search/Hits.h" #include "org/apache/lucene/search/IndexSearcher.h" +#incher &lt;/span&gt;&lt;span class="add"&gt;+ def titleChanged(self, op, name): &lt;/span&gt;&lt;span class="cx"&gt; &lt;/span&gt;&lt;span class="add"&gt;+ count = getattr(self, '_titleChanged', 0) + self._titleChanged = count + 1 + + &lt;/span&gt;&lt;span class="cx"&gt; class Cartoon(Movie): pass &lt;/span&gt; &lt;/pre&gt; &lt;/div&gt; &lt;/div&gt; &lt;/body&gt; &lt;/html&gt; olygo%3c20070305230130.43F56F10E4@tutu.osafoundation.org%3e Tue, 19 Apr, 06:07
lt __apache__lucene__analysis__AnalyzerTo_p_java__lang__Object},{"_p_org__apache__lucene__search__Searcher", _p_org__apache__lucene__search__SearcherTo_p_java__lang__Object},{"_p_org__apache__lucene__search__IndexSearcher", _p_org__apache__lucene__search__IndexSearcherTo_p_java__lang__Object},{"_p_org__apache__lucene__queryParser__QueryParser", _p_org__apache__lucene__queryParser__QueryParserTo_p_java__lang__Object},{"_p_org__apache__lucene__document__Field", _p_org__apache__lucene__document__FieldTo_p_java__lang__Object},{"_p_org__apache__lucene__analysis__standard__StandardAnalyzer", _p_org__apache__lucene__analysis__standard__StandardAnalyzerTo_p_java__lang__Object},{"_p_org__apache__lucene__search__Query", _p_o! rg__apache__lucene__search__QueryTo_p_java__lang__Object},{"_p_java__io__Reader", _p_java__io__ReaderTo_p_java__lang__Object},{"_p_org__apache__lucene__index__IndexWriter", _p_org__apache__lucene__index__IndexWriterTo_p_java__lang__Object},{"_p_org__apache__lucene__store__Directory", _p_org__apache__lucene__store__DirectoryTo_p_java__lang__Object},{"_p_org__apache__lucene__store__db__DbDirectory", _p_org__apache__lucene__store__db__DbDirectoryTo_p_java__lang__Object},{"_p_org__apache__lucene__document__Document", _p_org__apache__lucene__document__DocumentTo_p_java__lang__Object},{"_p_java__lang__Object"},{0}}; static swig_type_info _swigt__p_jdbtxn[] = {{"_p_jdbtxn", 0, "jdbtxn *", 0},{"_p_jdbtxn"},{0}}; static swig_type_info *swig_types_initial[] = { @@ -2185,6 +2253,8 @@ _swigt__p_jstring, _swigt__p_org__apache__lucene__analysis__standard__StandardAnalyzer, _swigt__p_org__apache__lucene__search__Query, +_swigt__p_jreader, +_swigt__p_java__io__Reader, _swigt__p_org__apache__lucene__index__IndexWriter, _swigt__p_org__apache__lucene__store__db__DbDirectory, _swigt__p_org__apache__lucene__store__Directory, Index: osaf/chandler/persistence/PyLucene/Makefile.mingw diff -u osaf/chandler/persistence/PyLucene/Makefile.mingw:1.2 osaf/chandler/persistence/PyLucene/Makefile.mingw:1.3 --- osaf/chandler/persistence/PyLucene/Makefile.mingw:1.2 Sat Jan 10 19:08:03 2004 +++ osaf/chandler/persistence/PyLucene/Makefile.mingw Tue Jan 13 21:48:50 2004 @@ -35,6 +35,8 @@ PYTHON_INC = $(RELDIR)\bin\include PYTHON_SITE = $(RELDIR)\bin\Lib\site-packages +OBJS = $(BINDIR)\db_const.o $(BINDIR)\db.o $(BINDIR)\store.o $(BINDIR)\lucene.o $(BINDIR)\reader.java.o $(BINDIR)\reader.cpp.o + $(BINDIR)\lucene.o: if not exist $(BINDIR) mkdir $(BINDIR)\classes $(JCC) -C -d $(CLASSES) @lucene.lst @@ -56,7 +58,15 @@ $(JCC) -C -d $(CLASSES) --classpath=$(CLASSES) @store.lst $(JCC) -fjni $(CCFLAGS) -c -o $(BINDIR)\store.o --classpath=$(CLASSES) @store.lst -$(BINDIR)\_PyLucene$(_dbg).pyd: $(BINDIR)\store.o $(BINDIR)\db_const.o $(BINDIR)\db.o $(BINDIR)\lucene.o +$(BINDIR)\reader.java.o: java/org/osafoundation/io/PythonReader.java + $(JCC) -C -d $(CLASSES) java/org/osafoundation/io/PythonReader.java + $(JCC) $(CCFLAGS) -c -o $(BINDIR)/reader.java.o java/org/osafoundation/io/PythonReader.java + $(JCCH) -d $(CLASSES) --classpath=$(CLASSES) org.osafoundation.io.PythonReader + +$(BINDIR)\reader.cpp.o: cpp/PythonReader.cpp $(BINDIR)/reader.java.o + $(JCC) -I$(PYTHON_INC) -I$(CLASSES) $(CCFLAGS) -c -o $(BINDIR)/reader.cpp.o cpp/PythonReader.cpp + +$(BINDIR)\_PyLucene$(_dbg).pyd: $(OBJS) $(JCCH) -d $(CLASSES) --classpath=$(CLASSES) com.sleepycat.db.DbEnv $(JCCH) -d $(CLASSES) --classpath=$(CLASSES) com.sleepycat.db.Db $(JCCH) -d $(CLASSES) --classpath=$(CLASSES) com.sleepycat.db.DbTxn @@ -73,8 +83,8 @@ $(JCCH) -d $(CLASSES) --classpath=$(CLASSES) org.apache.lucene.search.IndexSearcher $(JCCH) -d $(CLASSES) --classpath=$(CLASSES) org.apache.lucene.queryParser.QueryParser - $(CXX) -c $(CCFLAGS) $(PYDBG) -D_NO_OLDNAMES -Dalloca=__builtin_alloca -I$(CLASSES) -I$(PYTHON_INC) -I$(RELDIR)\include\db -o $(BINDIR)\PyLucene_wrap.o PyLucene_wrap.cxx - $(CXX) -shared $(LDFLAGS) -o $(BINDIR)\_PyLucene$(_dbg).pyd $(BINDIR)\db_const.o $(BINDIR)\db.o $(BINDIR)\store.o $(BINDIR)\lucene.o $(RELDIR)\bin\python23$(_dbg).dll $(BINDIR)\PyLucene_wrap.o -lgcj -lwin32k -lws2_32 + $(CXX) -c $(CCFLAGS) $(PYDBG) -D_NO_OLDNAMES -I$(CLASSES) -I$(PYTHON_INC) -I$(RELDIR)\include\db -o $(BINDIR)\PyLucene_wrap.o PyLucene_wrap.cxx + $(CXX) -shared $(LDFLAGS) -o $(BINDIR)\_PyLucene$(_dbg).pyd $(OBJS) $(RELDIR)\bin\python23$(_dbg).dll $(BINDIR)\PyLucene_wrap.o -lgcj -lwin32k -lws2_32 all: $(BINDIR)\_PyLucene$(_dbg).pyd $(BINDIR)\libdb_java42$(dbg).dll echo build of $(BINDIR)\_PyLucene$(_dbg).pyd complete Index: osaf/chandler/persistence/PyLucene/Makefile diff -u osaf/chandler/persistence/PyLucene/Makefile:1.1 osaf/chandler/persistence/PyLucene/Makefile:1.2 --- osaf/chandler/persistence/PyLucene/Makefile:1.1 Sat Jan 10 19:08:03 2004 +++ osaf/chandler/persistence/PyLucene/Makefile Tue Jan 13 21:48:50 2004 @@ -9,8 +9,8 @@ else -CCFLAGS = -O2 -LDFLAGS = +CCFLAGS = -g +LDFLAGS = -g mode = release endif @@ -56,7 +56,16 @@ $(JCC) -C -d $(CLASSES) --classpath=$(CLASSES) $(STORE_SRCS) $(JCC) -fjni $(CCFLAGS) -c -o $(BINDIR)/store.o --classpath=$(CLASSES) $(STORE_SRCS) -PyLucene_wrap.cxx: PyLucene.i +$(BINDIR)/reader.java.o: java/org/osafoundation/io/PythonReader.java + if [ ! -d $(BINDIR) ]; then mkdir -p $(BINDIR)/classes; fi + $(JCC) -C -d $(CLASSES) java/org/osafoundation/io/PythonReader.java + $(JCC) $(CCFLAGS) -c -o $(BINDIR)/reader.java.o java/org/osafoundation/io/PythonReader.java + +$(BINDIR)/reader.cpp.o: cpp/PythonReader.cpp + if [ ! -d $(BINDIR) ]; then mkdir -p $(BINDIR)/classes; fi + $(JCC) -I$(PYTHON_INC) -I$(CLASSES) $(CCFLAGS) -c -o $(BINDIR)/reader.cpp.o cpp/PythonReader.cpp + +PyLucene_wrap.cxx: PyLucene.i $(BINDIR)/reader.java.o $(JCCH) -d $(CLASSES) --classpath=$(CLASSES) com.sleepycat.db.DbEnv $(JCCH) -d $(CLASSES) --classpath=$(CLASSES) com.sleepycat.db.Db $(JCCH) -d $(CLASSES) --classpath=$(CLASSES) com.sleepycat.db.DbTxn @@ -72,10 +81,11 @@ $(JCCH) -d $(CLASSES) --classpath=$(CLASSES) org.apache.lucene.search.Hits $(JCCH) -d $(CLASSES) --classpath=$(CLASSES) org.apache.lucene.search.IndexSearcher $(JCCH) -d $(CLASSES) --classpath=$(CLASSES) org.apache.lucene.queryParser.QueryParser + $(JCCH) -d $(CLASSES) --classpath=$(CLASSES) org.osafoundation.io.PythonReader swig -modern -I$(BINDIR)/classes -c++ -python PyLucene.i -$(BINDIR)/_PyLucene.so: $(BINDIR)/store.o $(BINDIR)/db_const.o $(BINDIR)/db.o $(BINDIR)/lucene.o PyLucene_wrap.cxx - $(CXX) -shared -bundle -o $(BINDIR)/_PyLucene.so $(CCFLAGS) -I$(CLASSES) -I$(PYTHON_INC) -I/usr/local/BerkeleyDB.4.2/include PyLucene_wrap.cxx $(BINDIR)/db_const.o $(BINDIR)/db.o $(BINDIR)/store.o $(BINDIR)/lucene.o -lgcj -liconv -undefined suppress -flat_namespace -multiply_defined suppress +$(BINDIR)/_PyLucene.so: $(BINDIR)/store.o $(BINDIR)/db_const.o $(BINDIR)/db.o $(BINDIR)/lucene.o PyLucene_wrap.cxx $(BINDIR)/reader.java.o $(BINDIR)/reader.cpp.o + $(CXX) -shared -bundle -o $(BINDIR)/_PyLucene.so $(CCFLAGS) -I$(CLA