コード例 #1
0
 def genParseObject(self,cLocale):
     sym = DateFormatSymbols(cLocale)
     val = sym.getEras()
     frag = Or(CaselessLiteral(val[0].encode('utf-8')))
     for item in val[1:]:
         frag.append(CaselessLiteral(item.encode('utf-8')))
     return frag.setResultsName('era')
コード例 #2
0
 def genParseObject(self,cLocale):
     sym = DateFormatSymbols(cLocale)
     ampm = sym.getAmPmStrings()
     val = CaselessLiteral(ampm[0].encode('utf-8')).setResultsName('am')
     val |= CaselessLiteral(ampm[0].encode('utf-8')).setResultsName('pm')
     val |= CaselessLiteral('am').setResultsName('am')
     val |= CaselessLiteral('pm').setResultsName('pm')
     val |= CaselessLiteral('a').setResultsName('am')
     val |= CaselessLiteral('p').setResultsName('pm')
     return val
コード例 #3
0
 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
コード例 #4
0
    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
コード例 #5
0
    def genParseObject(self,cLocale):

        # generate dictionary of months
        self.monthdict = {}
        x = 1
        sym = DateFormatSymbols(cLocale)
        for sm in sym.getShortMonths():
            self.monthdict[sm.encode('utf-8').lower()] = x
            x += 1
        x = 1            
        for mm in sym.getMonths():
            self.monthdict[mm.encode('utf-8').lower()] = x
            x += 1

        def parseHandler(s,loc,toks):
            if toks[0].lower() not in self.monthdict:
                raise 'f**k'
        
        ret = Word(alphas + alphas8bit).setResultsName('month')
        ret.setParseAction(parseHandler)
        return ret
コード例 #6
0
    # 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.
コード例 #7
0
ファイル: minical.py プロジェクト: HackLinux/chandler
    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)
コード例 #8
0
    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)
コード例 #9
0
 def _getMonthNames(self, short=True):
     symbols = DateFormatSymbols()
     return symbols.getShortMonths() if short else symbols.getMonths()
コード例 #10
0
 def _getMonthNames(self, short=True):
     symbols = DateFormatSymbols()
     return symbols.getShortMonths() if short else symbols.getMonths()