def _rr_weekday_to_gui(rweekday):
    """Given r 0=Mon, ... value, returns 0 based GUI i18n index"""
    # figure the day in sun=1 units
    sun1 = rweekday + 2
    if sun1 == 8: sun1 = 1
    fdow = GregorianCalendarInstance.getFirstDayOfWeek()  ## sun1 units
    return (7 + sun1 - fdow) % 7
def _rr_weekday_to_gui(rweekday):
    """Given r 0=Mon, ... value, returns 0 based GUI i18n index"""
    # figure the day in sun=1 units
    sun1 = rweekday + 2
    if sun1 == 8: sun1 = 1
    fdow = GregorianCalendarInstance.getFirstDayOfWeek()  ## sun1 units
    return (7 + sun1 - fdow) % 7
 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
    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
def _gui_weekday_to_rr(i):
    """
    Given zero based i from the GUI, which is i18n first day based,
    translate to the rrule int for that day. Inverse of
    L{_rr_weekday_to_gui}
    """
    ## now this is a sun=1 encoding of the day that's positive
    sun1 = i + GregorianCalendarInstance.getFirstDayOfWeek()
    
    ## rrule array is fixed['mon', 'tue', ...], so, er, figure out math
    ## sun=1 yields 6
    ## mon=2 yields 0
    ## tue=3 yields 1
    return rrule.weekdays[(sun1 + 5) % 7]
def _gui_weekday_to_rr(i):
    """
    Given zero based i from the GUI, which is i18n first day based,
    translate to the rrule int for that day. Inverse of
    L{_rr_weekday_to_gui}
    """
    ## now this is a sun=1 encoding of the day that's positive
    sun1 = i + GregorianCalendarInstance.getFirstDayOfWeek()

    ## rrule array is fixed['mon', 'tue', ...], so, er, figure out math
    ## sun=1 yields 6
    ## mon=2 yields 0
    ## tue=3 yields 1
    return rrule.weekdays[(sun1 + 5) % 7]