Mailing list archives: November 2002

Site index · List index
Message listThread · Author · Date
<crazy...@etoast.com> {'expectedHost': err.expectedHost, - 'actualHost': err.actualHost}, Sun, 27 Jan, 14:41
tro7.com> 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 - 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):orial.html&amp;quot;&amp;gt;tutorial&amp;lt;/a&amp;gt; on the workings of the Feeds parcel that will fill in the details of writing a parcel. &lt;/span&gt;&lt;span class="cx"&gt; &amp;lt;p /&amp;gt; You can visit the Chandler home page for ideas on how to &amp;lt;a href=&amp;quot;http://chandler.osafounation.org/getinvolved.php&amp;quot;&amp;gt;get involved&amp;lt;/a&amp;gt; with the Chandler project. &amp;lt;p /&amp;gt; &lt;/span&gt; &lt;/pre&gt; îO Fri, 21 Dec, 04:27
Message listThread · Author · Date
Box list
Jul 20081
Mar 20081
Jan 20085
Dec 200715
Nov 20078
Oct 200749
Sep 200725
Aug 2007137
Jul 2007246
Jun 200761
May 200710
Apr 200744
Mar 200716
Feb 20076
Jan 200721
Dec 20065
Nov 200613
Oct 200613
Sep 200623
Aug 200643
Jul 200621
Jun 200652
May 200652
Apr 200629
Mar 200639
Feb 200677
Jan 200620
Dec 200510
Sep 20058
Jun 20052
Apr 20051
Mar 20052
Feb 20054
Dec 20045
Nov 20042
Sep 20041
Aug 20045
Jun 20047
Apr 20041
Feb 20042
Jan 20042
Dec 20031
Nov 20039
Aug 20036
Jun 20033
Mar 20031
Feb 20031
Jan 20033
Dec 20021
Nov 20022
Oct 20024