예제 #1
0
def show_calendar_row(first, last, today, month, empty_cells=(0, 0)):
    pos = enum("left center right")
    row = u""

    for p in pos:
        row += cal_cell_wall
        if empty_cells[0] > 0:
            row += (cal_cell_empty * empty_cells[0]) + (cal_cell_empty_wall *
                                                        (empty_cells[0] - 1))
            row += cal_cell_wall
        for d in range(first, last):
            if d == today:
                if p == pos.center:
                    row += cal_cell_center_highlight.format(unicode(d))
                else:
                    row += cal_cell_outer_highlight
            elif is_holiday(month, d):
                if p == pos.center:
                    row += cal_cell_center_holiday.format(unicode(d))
                else:
                    row += cal_cell_outer_holiday
            else:
                if p == pos.center:
                    row += cal_cell_center.format(unicode(d))
                else:
                    row += cal_cell_outer
            row += cal_cell_wall
        if empty_cells[1] > 0:
            row += (cal_cell_empty * empty_cells[1]) + (cal_cell_empty_wall *
                                                        (empty_cells[1] - 1))
            row += cal_cell_wall
        row += "\n"
    return row
예제 #2
0
def show_calendar_row(first, last, today, month, empty_cells=(0, 0)):
    pos = enum("left center right")
    row = u""

    for p in pos:
        row += cal_cell_wall
        if empty_cells[0] > 0:
            row += (cal_cell_empty * empty_cells[0]) + (cal_cell_empty_wall * (empty_cells[0] - 1))
            row += cal_cell_wall
        for d in range(first, last):
            if d == today:
                if p == pos.center:
                    row += cal_cell_center_highlight.format(unicode(d))
                else:
                    row += cal_cell_outer_highlight
            elif is_holiday(month, d):
                if p == pos.center:
                    row += cal_cell_center_holiday.format(unicode(d))
                else:
                    row += cal_cell_outer_holiday
            else:
                if p == pos.center:
                    row += cal_cell_center.format(unicode(d))
                else:
                    row += cal_cell_outer
            row += cal_cell_wall
        if empty_cells[1] > 0:
            row += (cal_cell_empty * empty_cells[1]) + (cal_cell_empty_wall * (empty_cells[1] - 1))
            row += cal_cell_wall
        row += "\n"
    return row
예제 #3
0
"""
Calendar Viewer

Copyright (c) 2012 Isaac Muse <*****@*****.**>
License: MIT
"""

from datetime import date
import sublime_plugin
import sublime
from CalendarLib.enum import enum
import re
from os.path import join

months = enum(
    "January February March April May June July August September October November December",
    start=1,
    name="Months")
weekdays = enum("Monday Tuesday Wednesday Thursday Friday Saturday Sunday",
                start=1,
                name="Days")
cal_header = u"|{0:^69}|\n"
cal_row_top_div = u"-----------------------------------------------------------------------\n"
cal_row_mid_div = u"-----------------------------------------------------------------------\n"
cal_row_btm_div = u"-----------------------------------------------------------------------\n"
# cal_cell_center_highlight = u"...{0:.^3}..."
# cal_cell_outer_highlight = u"........."
cal_cell_center_highlight = u"   {0: ^3}   "
cal_cell_outer_highlight = u"         "
cal_cell_center_holiday = u"   {0: ^3}   "
cal_cell_outer_holiday = u"         "
cal_cell_center = u"   {0:^3}   "
예제 #4
0
"""
Calendar Viewer

Copyright (c) 2012 Isaac Muse <*****@*****.**>
License: MIT
"""

from datetime import date
import sublime_plugin
import sublime
from CalendarLib.enum import enum
import re
from os.path import join


months = enum("January February March April May June July August September October November December", start=1, name="Months")
weekdays = enum("Monday Tuesday Wednesday Thursday Friday Saturday Sunday", start=1, name="Days")
cal_header = u"|{0:^69}|\n"
cal_row_top_div = u"-----------------------------------------------------------------------\n"
cal_row_mid_div = u"-----------------------------------------------------------------------\n"
cal_row_btm_div = u"-----------------------------------------------------------------------\n"
# cal_cell_center_highlight = u"...{0:.^3}..."
# cal_cell_outer_highlight = u"........."
cal_cell_center_highlight = u"   {0: ^3}   "
cal_cell_outer_highlight = u"         "
cal_cell_center_holiday = u"   {0: ^3}   "
cal_cell_outer_holiday = u"         "
cal_cell_center = u"   {0:^3}   "
cal_cell_outer = u"         "
cal_cell_empty = u"         "
cal_cell_empty_wall = u" "