コード例 #1
0
ファイル: quickcal.py プロジェクト: skeptycal/QuickCal
    def show_calendar_row(self, first, last, week_no, empty_cells=(0, 0)):
        """Show calendar row."""

        pos = enum("left center right")
        row = ""

        for p in pos:
            if p == pos.center:
                row += CAL_WEEK_NUM_WALL % week_no
            else:
                row += CAL_NO_WEEK_NUM_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):
                is_holiday = self.is_holiday(d)
                if d == self.day and is_holiday:
                    if p == pos.center:
                        row += CAL_CELL_CENTER_HOLIDAY.format(d)
                    else:
                        row += CAL_CELL_OUTER_HIGHLIGHT
                elif d == self.day:
                    if p == pos.center:
                        row += CAL_CELL_CENTER_HIGHLIGHT.format(d)
                    else:
                        row += CAL_CELL_OUTER_HIGHLIGHT
                elif is_holiday:
                    if p == pos.center:
                        row += CAL_CELL_CENTER_HOLIDAY.format(d)
                    else:
                        row += CAL_CELL_OUTER_HOLIDAY
                else:
                    if p == pos.center:
                        row += CAL_CELL_CENTER.format(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
ファイル: quickcal.py プロジェクト: facelessuser/QuickCal
    def show_calendar_row(self, first, last, week_no, empty_cells=(0, 0)):
        """Show calendar row."""

        pos = enum("left center right")
        row = ""

        for p in pos:
            if p == pos.center:
                row += CAL_WEEK_NUM_WALL % week_no
            else:
                row += CAL_NO_WEEK_NUM_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):
                is_holiday = self.is_holiday(d)
                if d == self.day and is_holiday:
                    if p == pos.center:
                        row += CAL_CELL_CENTER_HOLIDAY.format(d)
                    else:
                        row += CAL_CELL_OUTER_HIGHLIGHT
                elif d == self.day:
                    if p == pos.center:
                        row += CAL_CELL_CENTER_HIGHLIGHT.format(d)
                    else:
                        row += CAL_CELL_OUTER_HIGHLIGHT
                elif is_holiday:
                    if p == pos.center:
                        row += CAL_CELL_CENTER_HOLIDAY.format(d)
                    else:
                        row += CAL_CELL_OUTER_HOLIDAY
                else:
                    if p == pos.center:
                        row += CAL_CELL_CENTER.format(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
ファイル: quickcal.py プロジェクト: skeptycal/QuickCal
    import mdpopups
    import time

CSS = '''\
{%- if var.mdpopups_version >= (2, 0, 0) %}
div.quick-cal { margin: 0; padding: 0.5rem; }
{%- else %}
div.scope-hunter { margin: 0; padding: 0; }
{%- endif %}
.quick-cal .header { {{'.string'|css('color')}} }
'''

USE_ST_SYNTAX = int(sublime.version()) >= 3092
ST_SYNTAX = "sublime-syntax" if USE_ST_SYNTAX else 'tmLanguage'
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")

# Calendar display resources
CAL_HEADER = "   |{0:^69}|\n"
CAL_ROW_TOP_DIV = "   -----------------------------------------------------------------------\n"
CAL_ROW_MID_DIV = "   -----------------------------------------------------------------------\n"
CAL_ROW_BTM_DIV = "   -----------------------------------------------------------------------\n"
# (NO-BREAK SPACE) Unicode point U+00A0 or 0xC2A0: denoted with "."
# "...{0: ^3}..."
# "........."
CAL_CELL_CENTER_HIGHLIGHT = "   {0: ^3}   "
CAL_CELL_OUTER_HIGHLIGHT = "         "
コード例 #4
0
ファイル: quickcal.py プロジェクト: facelessuser/QuickCal
    import mdpopups
    import time

CSS = '''\
{%- if var.mdpopups_version >= (2, 0, 0) %}
div.quick-cal { margin: 0; padding: 0.5rem; }
{%- else %}
div.scope-hunter { margin: 0; padding: 0; }
{%- endif %}
.quick-cal .header { {{'.string'|css('color')}} }
'''

USE_ST_SYNTAX = int(sublime.version()) >= 3092
ST_SYNTAX = "sublime-syntax" if USE_ST_SYNTAX else 'tmLanguage'
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"
)

# Calendar display resources
CAL_HEADER = "   |{0:^69}|\n"
CAL_ROW_TOP_DIV = "   -----------------------------------------------------------------------\n"
CAL_ROW_MID_DIV = "   -----------------------------------------------------------------------\n"
CAL_ROW_BTM_DIV = "   -----------------------------------------------------------------------\n"
# (NO-BREAK SPACE) Unicode point U+00A0 or 0xC2A0: denoted with "."
# "...{0: ^3}..."
# "........."
CAL_CELL_CENTER_HIGHLIGHT = "   {0: ^3}   "