def _paintWeeklyHeaders(self, drawer, day, x, y, width, height): firstDay = utils.setToWeekDayInSameWeek(day, 0, self._weekstart) firstDay.SetHour(0) firstDay.SetMinute(0) firstDay.SetSecond(0) maxDY = 0 for weekday in xrange(7): theDay = utils.setToWeekDayInSameWeek(utils.copyDateTime(firstDay), weekday, self._weekstart) # Recherche la couleur par défaut pour le jour highlight = theDay.IsSameDate(wx.DateTime.Now()) if self.joursSpeciaux != None and highlight == False: couleur = self.joursSpeciaux.GetCouleur(theDay) if couleur != None: highlight = couleur w, h = drawer.DrawDayHeader(theDay, x + weekday * 1.0 * width / 7, y, 1.0 * width / 7, height, highlight=highlight) maxDY = max(maxDY, h) return maxDY
def _paintWeeklyHeaders(self, drawer, day, x, y, width, height): firstDay = utils.setToWeekDayInSameWeek(day, 0, self._weekstart) firstDay.SetHour(0) firstDay.SetMinute(0) firstDay.SetSecond(0) maxDY = 0 for weekday in xrange(7): theDay = utils.setToWeekDayInSameWeek(utils.copyDateTime(firstDay), weekday, self._weekstart) if theDay.IsSameDate(wx.DateTime.Now()): color = self._highlightColor else: color = None w, h = drawer.DrawDayHeader(theDay, x + weekday * 1.0 * width / 7, y, 1.0 * width / 7, height, highlight=color) self._headerBounds.append( (int(x + (weekday + 1) * 1.0 * width / 7), y, height)) maxDY = max(maxDY, h) return maxDY
def _paintWeekly( self, drawer, day, x, y, width, height ): """ Display weekly schedule """ firstDay = utils.setToWeekDayInSameWeek( day, 0, self._weekstart ) firstDay.SetHour(0) firstDay.SetMinute(0) firstDay.SetSecond(0) minWidth = minHeight = 0 if self._style == wxSCHEDULER_VERTICAL: x += LEFT_COLUMN_SIZE width -= LEFT_COLUMN_SIZE maxDY = 0 if self._drawHeaders: theDay = utils.copyDateTime(day) for idx in xrange(self._periodCount): maxDY = max(maxDY, self._paintWeeklyHeaders( drawer, theDay, x + 1.0 * width / self._periodCount * idx, y, 1.0 * width / self._periodCount, height )) theDay.AddDS(wx.DateSpan(weeks=1)) if self._style == wxSCHEDULER_VERTICAL: x -= LEFT_COLUMN_SIZE width += LEFT_COLUMN_SIZE minHeight += maxDY y += maxDY height -= maxDY if self._style == wxSCHEDULER_VERTICAL: w, h = drawer.DrawHours(x, y, width, height, self._style) minWidth += w x += w width -= w day = utils.copyDateTime(firstDay) for idx in xrange(self._periodCount): for weekday in xrange(7): theDay = utils.setToWeekDayInSameWeek(utils.copyDateTime(day), weekday, self._weekstart) self._paintDay(drawer, theDay, x + (weekday + 7 * idx) * 1.0 * width / 7 / self._periodCount, y, 1.0 * width / 7 / self._periodCount, height) day.AddDS(wx.DateSpan(weeks=1)) return max(WEEK_SIZE_MIN.width * self._periodCount + LEFT_COLUMN_SIZE, width), max(WEEK_SIZE_MIN.height, height) else: w, h = self._paintPeriod(drawer, firstDay, 7 * self._periodCount, x, y, width, height) minWidth += w minHeight += h return max(WEEK_SIZE_MIN.width * self._periodCount + LEFT_COLUMN_SIZE, minWidth), minHeight
def _paintWeeklyHeaders( self, drawer, day, x, y, width, height ): firstDay = utils.setToWeekDayInSameWeek( day, 0, self._weekstart ) firstDay.SetHour(0) firstDay.SetMinute(0) firstDay.SetSecond(0) maxDY = 0 for weekday in xrange(7): theDay = utils.setToWeekDayInSameWeek(utils.copyDateTime(firstDay), weekday, self._weekstart) if theDay.IsSameDate( wx.DateTime.Now() ): color = self._highlightColor else: color = None w, h = drawer.DrawDayHeader(theDay, x + weekday * 1.0 * width / 7, y, 1.0 * width / 7, height, highlight=color) self._headerBounds.append((int(x + (weekday + 1) * 1.0 * width / 7), y, height)) maxDY = max(maxDY, h) return maxDY
def _paintWeeklyHeaders( self, drawer, day, x, y, width, height ): firstDay = utils.setToWeekDayInSameWeek( day, 0, self._weekstart ) firstDay.SetHour(0) firstDay.SetMinute(0) firstDay.SetSecond(0) maxDY = 0 for weekday in xrange(7): theDay = utils.setToWeekDayInSameWeek(utils.copyDateTime(firstDay), weekday, self._weekstart) # Recherche la couleur par défaut pour le jour highlight = theDay.IsSameDate( wx.DateTime.Now() ) if self.joursSpeciaux != None and highlight == False : couleur = self.joursSpeciaux.GetCouleur(theDay) if couleur != None : highlight = couleur w, h = drawer.DrawDayHeader(theDay, x + weekday * 1.0 * width / 7, y, 1.0 * width / 7, height, highlight=highlight) maxDY = max(maxDY, h) return maxDY
def _paintWeekly(self, drawer, day, x, y, width, height): """ Display weekly schedule """ firstDay = utils.setToWeekDayInSameWeek(day, 0, self._weekstart) firstDay.SetHour(0) firstDay.SetMinute(0) firstDay.SetSecond(0) minWidth = minHeight = 0 if self._style == wxSCHEDULER_VERTICAL: x += LEFT_COLUMN_SIZE width -= LEFT_COLUMN_SIZE maxDY = 0 if self._drawHeaders: theDay = utils.copyDateTime(day) for idx in xrange(self._periodCount): maxDY = max( maxDY, self._paintWeeklyHeaders( drawer, theDay, x + 1.0 * width / self._periodCount * idx, y, 1.0 * width / self._periodCount, height)) if 'phoenix' in wx.PlatformInfo: theDay.Add(wx.DateSpan(weeks=1)) else: theDay.AddDS(wx.DateSpan(weeks=1)) if self._style == wxSCHEDULER_VERTICAL: x -= LEFT_COLUMN_SIZE width += LEFT_COLUMN_SIZE minHeight += maxDY y += maxDY height -= maxDY if self._style == wxSCHEDULER_VERTICAL: w, h = drawer.DrawHours(x, y, width, height, self._style) minWidth += w x += w width -= w day = utils.copyDateTime(firstDay) for idx in xrange(self._periodCount): for weekday in xrange(7): theDay = utils.setToWeekDayInSameWeek( utils.copyDateTime(day), weekday, self._weekstart) self._paintDay( drawer, theDay, x + (weekday + 7 * idx) * 1.0 * width / 7 / self._periodCount, y, 1.0 * width / 7 / self._periodCount, height) if 'phoenix' in wx.PlatformInfo: day.Add(wx.DateSpan(weeks=1)) else: day.AddDS(wx.DateSpan(weeks=1)) return max( WEEK_SIZE_MIN.width * self._periodCount + LEFT_COLUMN_SIZE, width), max(WEEK_SIZE_MIN.height, height) else: w, h = self._paintPeriod(drawer, firstDay, 7 * self._periodCount, x, y, width, height) minWidth += w minHeight += h return max( WEEK_SIZE_MIN.width * self._periodCount + LEFT_COLUMN_SIZE, minWidth), minHeight