def _getDayNames(self, short=True): symbols = DateFormatSymbols() days = symbols.getShortWeekdays() if short else symbols.getWeekdays() firstDay = GregorianCalendarInstance.getFirstDayOfWeek() daynames = [] for day in xrange(7): actualDay = ((day + firstDay - 1) % 7) daynames.append(days[actualDay + 1]) return daynames
# a number. As in 'every 2 weeks'. # %(days) evaluates to the short version of day names (Mon, Tue, Wed, etc) 'fdup': _(u"%(days)s every %(interval)s %(frequencyplural)s until %(date)s") } class WeekdayEnum(schema.Enumeration): """The names of weekdays. Values shouldn't be displayed directly.""" values="monday","tuesday","wednesday","thursday","friday", \ "saturday","sunday" # map WeekdayEnums to an internationalized abbreviation for display # [i18n] : use the week days returned by PyICU shortWeekdays = DateFormatSymbols().getShortWeekdays() weekdayAbbrevMap = dict(monday=shortWeekdays[Calendar.MONDAY], tuesday=shortWeekdays[Calendar.TUESDAY], wednesday=shortWeekdays[Calendar.WEDNESDAY], thursday=shortWeekdays[Calendar.THURSDAY], friday=shortWeekdays[Calendar.FRIDAY], saturday=shortWeekdays[Calendar.SATURDAY], sunday=shortWeekdays[Calendar.SUNDAY]) class WeekdayAndPositionStruct(schema.Struct): """ Composition of a WeekdayEnum and an integer selecting first (1), last (-1), or n-th occurrence of that weekday in the month. selector=0 represents all days in the month equal to the given weekday.
def Init(self): # date self.selectedDate = None self.firstVisibleDate = None self.lowerDateLimit = None self.upperDateLimit = None # colors self.colHighlightFg = wx.SystemSettings_GetColour( wx.SYS_COLOUR_HIGHLIGHTTEXT) self.colHighlightBg = wx.SystemSettings_GetColour( wx.SYS_COLOUR_HIGHLIGHT) self.colHeaderFg = wx.BLACK self.colHeaderBgPen = wx.WHITE_PEN self.colHeaderBgBrush = wx.WHITE_BRUSH self.mainColour = wx.Colour(0, 0, 0) self.lightColour = wx.Colour(255, 255, 255) self.highlightColour = wx.Colour(204, 204, 204) self.highlightColourBrush = wx.Brush(self.highlightColour) self.highlightColourPen = wx.Pen(self.highlightColour) lineColour = wx.Colour(229, 229, 229) self.lineColourPen = wx.Pen(lineColour, 2) self.lineColourPen.SetCap(wx.CAP_BUTT) self.busyColour = wx.Colour(127, 191, 255) self.busyColourBrush = wx.Brush(self.busyColour) self.busyColourPen = wx.Pen(self.busyColour) self.widthCol = 0 self.heightRow = 0 dateFormatSymbols = DateFormatSymbols() self.months = dateFormatSymbols.getMonths() # this is a 1-based array as entry [0] is an empty string self.weekdays = [ unicode(d) for d in dateFormatSymbols.getWeekdays( DateFormatSymbols.STANDALONE, DateFormatSymbols.NARROW) ] self.busyPercent = {} self.hoverDate = None self.rowOffset = 0 self.todayHeight = 0 self.leftArrowRect = None self.rightArrowRect = None self.todayRect = None self.lineAboveToday = False self.Bind(wx.EVT_PAINT, self.OnMiniCalPaint) if wx.Platform != "__WXMAC__": self.Bind(wx.EVT_SIZE, self.OnMiniCalSize) self.Bind(wx.EVT_LEFT_DOWN, self.OnClick) self.Bind(wx.EVT_LEFT_DCLICK, self.OnDClick)
def _getMonthNames(self, short=True): symbols = DateFormatSymbols() return symbols.getShortMonths() if short else symbols.getMonths()