def onExposeEvent(self, widget=None, event=None): cr = self.getContext() self.drawBg(cr) self.drawTextList( cr, [[ (core.getWeekDayN(i), ''), ] for i in range(7)], ) self.drawCursorFg(cr)
def onExposeEvent(self, widget=None, event=None): cr = self.getContext() self.drawBg(cr) self.drawTextList( cr, [ [ (core.getWeekDayN(i), ""), ] for i in range(7) ], ) self.drawCursorFg(cr)
def drawCairo(self, cr): if not self.data: return t0 = now() w = self.get_allocation().width h = self.get_allocation().height cr.rectangle(0, 0, w, h) fillColor(cr, ui.bgColor) textColor = ui.textColor gridColor = ui.mcalGridColor ## FIXME ### #classBounds = self.term.classTimeBounds titles, tmfactors = self.term.getClassBoundsFormatted() ### weekDayLayouts = [] weekDayLayoutsWidth = [] for j in range(7): layout = newTextLayout(self, core.getWeekDayN(j)) layoutW, layoutH = layout.get_pixel_size() weekDayLayouts.append(layout) weekDayLayoutsWidth.append(layoutW) leftMargin = max(weekDayLayoutsWidth) + 6 ### topMargin = 20 ## FIXME ### Calc Coordinates: ycenters(list), dy(float) ycenters = [ topMargin + (h-topMargin)*(1.0+2*i)/14.0 for i in range(7) ] ## centers y dy = (h-topMargin)/7.0 ## delta y ### Draw grid ## tmfactors includes 0 at the first, and 1 at the end setColor(cr, gridColor) ## for i in range(7): cr.rectangle(0, ycenters[i]-dy/2.0, w, 1) cr.fill() ## for factor in tmfactors[:-1]: x = leftMargin + factor*(w-leftMargin) if rtl: x = w - x cr.rectangle(x, 0, 1, h) cr.fill() ### setColor(cr, textColor) for i,title in enumerate(titles): layout = newTextLayout(self, title) layoutW, layoutH = layout.get_pixel_size() ## dx = (w - leftMargin) * (tmfactors[i+1] - tmfactors[i]) if dx < layoutW: continue ## factor = (tmfactors[i] + tmfactors[i+1])/2.0 x = factor*(w-leftMargin) + leftMargin if rtl: x = w - x x -= layoutW/2.0 ## y = (topMargin-layoutH)/2.0 - 1 ## cr.move_to(x, y) show_layout(cr, layout) ### for j in range(7): layout = weekDayLayouts[j] layoutW, layoutH = layout.get_pixel_size() x = leftMargin/2.0 if rtl: x = w - x x -= layoutW/2.0 ## y = topMargin + (h-topMargin)*(j+0.5)/7.0 - layoutH/2.0 ## cr.move_to(x, y) show_layout(cr, layout) for j in range(7): wd = (j+core.firstWeekDay)%7 for i,dayData in enumerate(self.data[wd]): textList = [] for classData in dayData: text = classData['name'] if classData['weekNumMode']: text += '(<span color="#f00">' + _(classData['weekNumMode'].capitalize()) + '</span>)' textList.append(text) dx = (w - leftMargin) * (tmfactors[i+1] - tmfactors[i]) layout = newTextLayout(self, '\n'.join(textList), maxSize=(dx, dy)) layoutW, layoutH = layout.get_pixel_size() ## factor = (tmfactors[i] + tmfactors[i+1])/2.0 x = factor*(w-leftMargin) + leftMargin if rtl: x = w - x x -= layoutW/2.0 ## y = topMargin + (h-topMargin)*(j+0.5)/7.0 - layoutH/2.0 ## cr.move_to(x, y) show_layout(cr, layout)
def exportToHtml(fpath, monthsStatus, title=""): ##################### Options: calTypesFormat = ((2, "SUB"), (0, None), (1, "SUB") ) # a list of (calTypeIndex, htmlTag) tuples sizeMap = lambda size: size * 0.25 - 0.5 # FIXME sep = " " pluginsTextSep = " <B>ـ</B> " pluginsTextPerLine = True ## description of each day in one line ##################### bgColor = rgbToHtml(*ui.bgColor) inactiveColor = rgbToHtml(*colorComposite(ui.inactiveColor, ui.bgColor)) borderColor = rgbToHtml(*colorComposite(ui.borderColor, ui.bgColor)) borderTextColor = rgbToHtml(*ui.borderTextColor) textColor = rgbToHtml(*ui.textColor) holidayColor = rgbToHtml(*ui.holidayColor) colors = [rgbToHtml(*x["color"]) for x in ui.mcalTypeParams] if locale_man.rtl: DIR = "RTL" else: DIR = "LRT" text = """<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML> <HEAD> <META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=utf-8"> <TITLE>%s</TITLE> </HEAD> <BODY LANG="%s" DIR="%s" BGCOLOR="%s">\n""" % ( title, locale_man.langSh, DIR, bgColor, ) for status in monthsStatus: text += " <P>\n" for i, line in enumerate(getMonthDesc(status).split("\n")): try: color = colors[i] except IndexError: color = textColor text += " <FONT COLOR=\"%s\">%s</FONT>\n <BR>\n" % ( color, line, ) text += " </P>\n" text += """ <TABLE WIDTH=100%% BGCOLOR="%s" BORDER=%s BORDERCOLOR="#000000" CELLPADDING=4 CELLSPACING=0> <TR VALIGN=TOP>\n""" % ( bgColor, int(ui.mcalGrid), ) text += """ <TD WIDTH=9%% BGCOLOR="%s"> <P ALIGN=CENTER></P> </TD>\n""" % borderColor # what text? FIXME for j in range(7): text += """ <TD WIDTH=13%% BGCOLOR="%s"> <P ALIGN=CENTER> <FONT COLOR="%s"><B>%s</B></FONT> </P> </TD>\n""" % ( borderColor, borderTextColor, core.getWeekDayN(j), ) pluginsText = "<P><FONT COLOR=\"%s\">\n" % colors[0] text += " </TR>\n" for i in range(6): text += """ <TR VALIGN=TOP> <TD WIDTH=9%% BGCOLOR="%s"> <P ALIGN=CENTER> <FONT COLOR="%s"><B>%s</B></FONT> </P> </TD>\n""" % ( borderColor, borderTextColor, _(status.weekNum[i]), ) for j in range(7): cell = status[i][j] text += " <TD WIDTH=13%>\n" text += " <P DIR=\"LTR\" ALIGN=CENTER>\n" for (calTypeIndex, calTypeTag) in calTypesFormat: try: mode = calTypes.active[calTypeIndex] except IndexError: continue try: params = ui.mcalTypeParams[calTypeIndex] except IndexError: continue day = _(cell.dates[mode][2], mode) ## , 2 font = params["font"] face = font[0] if font[1]: face += " Bold" if font[2]: face += " Underline" size = str(sizeMap(font[3])) if cell.month != status.month: if calTypeIndex == 0: text += " " if calTypeTag: text += "<%s>" % calTypeTag text += "<FONT COLOR=\"%s\" FACE=\"%s\" SIZE=\"%s\">%s</FONT>" % ( inactiveColor, face, size, day, ) if calTypeTag: text += "</%s>" % calTypeTag text += "\n" break else: continue text += " " if calTypeTag: text += "<%s>" % calTypeTag if calTypeIndex == 0 and cell.holiday: color = holidayColor else: color = colors[calTypeIndex] text += "<FONT COLOR=\"%s\" FACE=\"%s\" SIZE=\"%s\">%s</FONT>" % ( color, face, size, day, ) if calTypeTag: text += "</%s>" % calTypeTag text += "\n" #text += sep##??????????? text += " </P>\n </TD>\n" if cell.month == status.month: if cell.holiday: color = holidayColor else: color = colors[0] t = cell.pluginsText.replace("\n", pluginsTextSep) if t: pluginsText += "<B><FONT COLOR=\"%s\">%s</FONT>:</B>" % ( color, _(cell.dates[calTypes.primary][2]), ) pluginsText += " <SMALL>%s</SMALL>" % t if pluginsTextPerLine: pluginsText += "<BR>\n" else: pluginsText += " \n" text += " </TR>\n" pluginsText += " </FONT></P>\n" text += " </TABLE>\n" text += pluginsText text += "\n<P STYLE=\"border-bottom: 5pt double %s\"></P>\n" % colors[0] text += """ <P> <FONT COLOR="%s">%s <A HREF="%s">%s</A> %s %s</FONT> </P> </BODY> </HTML>""" % ( colors[0], _("Generated by"), core.homePage, core.APP_DESC, _("version"), core.VERSION, ) open(fpath, "w").write(text)
def drawCairo(self, cr): if not self.data: return t0 = now() w = self.get_allocation().width h = self.get_allocation().height cr.rectangle(0, 0, w, h) fillColor(cr, ui.bgColor) textColor = ui.textColor gridColor = ui.mcalGridColor ## FIXME ### #classBounds = self.term.classTimeBounds titles, tmfactors = self.term.getClassBoundsFormatted() ### weekDayLayouts = [] weekDayLayoutsWidth = [] for j in range(7): layout = newTextLayout(self, core.getWeekDayN(j)) layoutW, layoutH = layout.get_pixel_size() weekDayLayouts.append(layout) weekDayLayoutsWidth.append(layoutW) leftMargin = max(weekDayLayoutsWidth) + 6 ### topMargin = 20 ## FIXME ### Calc Coordinates: ycenters(list), dy(float) ycenters = [ topMargin + (h - topMargin) * (1 + 2 * i) / 14 for i in range(7) ] ## centers y dy = (h - topMargin) / 7 # delta y ### Draw grid ## tmfactors includes 0 at the first, and 1 at the end setColor(cr, gridColor) ## for i in range(7): cr.rectangle( 0, ycenters[i] - dy / 2, w, 1, ) cr.fill() ## for factor in tmfactors[:-1]: x = leftMargin + factor * (w - leftMargin) if rtl: x = w - x cr.rectangle(x, 0, 1, h) cr.fill() ### setColor(cr, textColor) for i, title in enumerate(titles): layout = newTextLayout(self, title) layoutW, layoutH = layout.get_pixel_size() ## dx = (w - leftMargin) * (tmfactors[i + 1] - tmfactors[i]) if dx < layoutW: continue ## factor = (tmfactors[i] + tmfactors[i + 1]) / 2 x = factor * (w - leftMargin) + leftMargin if rtl: x = w - x x -= layoutW / 2 ## y = (topMargin - layoutH) / 2 - 1 ## cr.move_to(x, y) show_layout(cr, layout) ### for j in range(7): layout = weekDayLayouts[j] layoutW, layoutH = layout.get_pixel_size() x = leftMargin / 2 if rtl: x = w - x x -= layoutW / 2 ## y = topMargin + (h - topMargin) * (j + 0.5) / 7 - layoutH / 2 ## cr.move_to(x, y) show_layout(cr, layout) for j in range(7): wd = (j + core.firstWeekDay) % 7 for i, dayData in enumerate(self.data[wd]): textList = [] for classData in dayData: text = classData["name"] if classData["weekNumMode"]: text += ( "(<span color=\"#f00\">" + _(classData["weekNumMode"].capitalize()) + "</span>)" ) textList.append(text) dx = (w - leftMargin) * (tmfactors[i + 1] - tmfactors[i]) layout = newTextLayout( self, "\n".join(textList), maxSize=(dx, dy), ) layoutW, layoutH = layout.get_pixel_size() ## factor = (tmfactors[i] + tmfactors[i + 1]) / 2 x = factor * (w - leftMargin) + leftMargin if rtl: x = w - x x -= layoutW / 2 ## y = topMargin + (h - topMargin) * (j + 0.5) / 7 - layoutH / 2 ## cr.move_to(x, y) show_layout(cr, layout)
def exportToHtml(fpath, monthsStatus, title=''): ##################### Options: format = ((2, 'SUB'), (0, None), (1, 'SUB')) ## (dateMode, htmlTag) sizeMap = lambda size: size*0.25 - 0.5 ## ??????????????? sep = ' ' pluginsTextSep = ' <B>ـ</B> ' pluginsTextPerLine = True ## description of each day in one line ##################### bgColor = rgbToHtml(*ui.bgColor) inactiveColor = rgbToHtml(*colorComposite(ui.inactiveColor, ui.bgColor)) borderColor= rgbToHtml(*colorComposite(ui.borderColor, ui.bgColor)) borderTextColor = rgbToHtml(*ui.borderTextColor) textColor = rgbToHtml(*ui.textColor) holidayColor = rgbToHtml(*ui.holidayColor) colors = [rgbToHtml(*x['color']) for x in ui.mcalTypeParams] if locale_man.rtl: DIR = 'RTL' else: DIR = 'LRT' text = '''<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML> <HEAD> <META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=utf-8"> <TITLE>%s</TITLE> </HEAD> <BODY LANG="%s" DIR="%s" BGCOLOR="%s">\n'''%(title, locale_man.langSh, DIR, bgColor) for status in monthsStatus: text += ' <P>\n' for i, line in enumerate(getMonthDesc(status).split('\n')): try: color = colors[i] except IndexError: color = textColor text += ' <FONT COLOR="%s">%s</FONT>\n <BR>\n'%(color, line) text += ' </P>\n' text += ''' <TABLE WIDTH=100%% BGCOLOR="%s" BORDER=%s BORDERCOLOR="#000000" CELLPADDING=4 CELLSPACING=0> <TR VALIGN=TOP>\n'''\ %(bgColor, int(ui.mcalGrid)) text += ''' <TD WIDTH=9%% BGCOLOR="%s"> <P ALIGN=CENTER></P> </TD>\n'''%borderColor## what text???????? for j in range(7): text += ''' <TD WIDTH=13%% BGCOLOR="%s"> <P ALIGN=CENTER> <FONT COLOR="%s"><B>%s</B></FONT> </P> </TD>\n'''%(borderColor, borderTextColor, core.getWeekDayN(j)) pluginsText = '<P><FONT COLOR="%s">\n'%colors[0] text += ' </TR>\n' for i in range(6): text += ''' <TR VALIGN=TOP> <TD WIDTH=9%% BGCOLOR="%s"> <P ALIGN=CENTER> <FONT COLOR="%s"><B>%s</B></FONT> </P> </TD>\n'''%(borderColor, borderTextColor, _(status.weekNum[i])) for j in range(7): cell = status[i][j] text += ' <TD WIDTH=13%>\n <P DIR="LTR" ALIGN=CENTER>\n' for (ind, tag) in format: try: mode = calTypes.active[ind] except IndexError: continue try: params = ui.mcalTypeParams[ind] except IndexError: continue day = _(cell.dates[mode][2], mode)## , 2 font = params['font'] face = font[0] if font[1]: face += ' Bold' if font[2]: face += ' Underline' size = str(sizeMap(font[3])) if cell.month != status.month: if ind==0: text += ' ' if tag: text += '<%s>'%tag text += '<FONT COLOR="%s" FACE="%s" SIZE="%s">%s</FONT>'%( inactiveColor, face, size, day, ) if tag: text += '</%s>'%tag text += '\n' break else: continue text += ' ' if tag: text += '<%s>'%tag if ind==0 and cell.holiday: color = holidayColor else: color = colors[ind] text += '<FONT COLOR="%s" FACE="%s" SIZE="%s">%s</FONT>'%(color, face, size, day) if tag: text += '</%s>'%tag text += '\n' #text += sep##??????????? text += ' </P>\n </TD>\n' if cell.month == status.month: if cell.holiday: color = holidayColor else: color = colors[0] t = cell.pluginsText.replace('\n', pluginsTextSep) if t: pluginsText += '<B><FONT COLOR="%s">%s</FONT>:</B> <SMALL>%s</SMALL>'%( color, _(cell.dates[calTypes.primary][2]), t, ) if pluginsTextPerLine: pluginsText += '<BR>\n' else: pluginsText += ' \n' text += ' </TR>\n' pluginsText += ' </FONT></P>\n' text += ' </TABLE>\n' text += pluginsText text += '\n<P STYLE="border-bottom: 5pt double %s"></P>\n'%colors[0] text += ''' <P> <FONT COLOR="%s">%s <A HREF="%s">%s</A> %s %s</FONT> </P> </BODY> </HTML>'''%( colors[0], _('Generated by'), core.homePage, core.APP_DESC, _('version'), core.VERSION, ) open(fpath, 'w').write(text)
def exportToHtml(fpath, monthsStatus, title=""): ##################### Options: calTypesFormat = ( (2, "SUB"), (0, None), (1, "SUB") ) # a list of (calTypeIndex, htmlTag) tuples sizeMap = lambda size: size * 0.25 - 0.5 # FIXME sep = " " pluginsTextSep = " <B>ـ</B> " pluginsTextPerLine = True ## description of each day in one line ##################### bgColor = rgbToHtml(*ui.bgColor) inactiveColor = rgbToHtml(*colorComposite(ui.inactiveColor, ui.bgColor)) borderColor = rgbToHtml(*colorComposite(ui.borderColor, ui.bgColor)) borderTextColor = rgbToHtml(*ui.borderTextColor) textColor = rgbToHtml(*ui.textColor) holidayColor = rgbToHtml(*ui.holidayColor) colors = [rgbToHtml(*x["color"]) for x in ui.mcalTypeParams] if locale_man.rtl: DIR = "RTL" else: DIR = "LRT" text = """<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML> <HEAD> <META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=utf-8"> <TITLE>%s</TITLE> </HEAD> <BODY LANG="%s" DIR="%s" BGCOLOR="%s">\n""" % ( title, locale_man.langSh, DIR, bgColor, ) for status in monthsStatus: text += " <P>\n" for i, line in enumerate(getMonthDesc(status).split("\n")): try: color = colors[i] except IndexError: color = textColor text += " <FONT COLOR=\"%s\">%s</FONT>\n <BR>\n" % ( color, line, ) text += " </P>\n" text += """ <TABLE WIDTH=100%% BGCOLOR="%s" BORDER=%s BORDERCOLOR="#000000" CELLPADDING=4 CELLSPACING=0> <TR VALIGN=TOP>\n""" % ( bgColor, int(ui.mcalGrid), ) text += """ <TD WIDTH=9%% BGCOLOR="%s"> <P ALIGN=CENTER></P> </TD>\n""" % borderColor # what text? FIXME for j in range(7): text += """ <TD WIDTH=13%% BGCOLOR="%s"> <P ALIGN=CENTER> <FONT COLOR="%s"><B>%s</B></FONT> </P> </TD>\n""" % ( borderColor, borderTextColor, core.getWeekDayN(j), ) pluginsText = "<P><FONT COLOR=\"%s\">\n" % colors[0] text += " </TR>\n" for i in range(6): text += """ <TR VALIGN=TOP> <TD WIDTH=9%% BGCOLOR="%s"> <P ALIGN=CENTER> <FONT COLOR="%s"><B>%s</B></FONT> </P> </TD>\n""" % ( borderColor, borderTextColor, _(status.weekNum[i]), ) for j in range(7): cell = status[i][j] text += " <TD WIDTH=13%>\n" text += " <P DIR=\"LTR\" ALIGN=CENTER>\n" for (calTypeIndex, calTypeTag) in calTypesFormat: try: mode = calTypes.active[calTypeIndex] except IndexError: continue try: params = ui.mcalTypeParams[calTypeIndex] except IndexError: continue day = _(cell.dates[mode][2], mode)## , 2 font = params["font"] face = font[0] if font[1]: face += " Bold" if font[2]: face += " Underline" size = str(sizeMap(font[3])) if cell.month != status.month: if calTypeIndex == 0: text += " " if calTypeTag: text += "<%s>" % calTypeTag text += "<FONT COLOR=\"%s\" FACE=\"%s\" SIZE=\"%s\">%s</FONT>" % ( inactiveColor, face, size, day, ) if calTypeTag: text += "</%s>" % calTypeTag text += "\n" break else: continue text += " " if calTypeTag: text += "<%s>" % calTypeTag if calTypeIndex == 0 and cell.holiday: color = holidayColor else: color = colors[calTypeIndex] text += "<FONT COLOR=\"%s\" FACE=\"%s\" SIZE=\"%s\">%s</FONT>" % ( color, face, size, day, ) if calTypeTag: text += "</%s>" % calTypeTag text += "\n" #text += sep##??????????? text += " </P>\n </TD>\n" if cell.month == status.month: if cell.holiday: color = holidayColor else: color = colors[0] t = cell.pluginsText.replace("\n", pluginsTextSep) if t: pluginsText += "<B><FONT COLOR=\"%s\">%s</FONT>:</B>" pluginsText += " <SMALL>%s</SMALL>" % ( color, _(cell.dates[calTypes.primary][2]), t, ) if pluginsTextPerLine: pluginsText += "<BR>\n" else: pluginsText += " \n" text += " </TR>\n" pluginsText += " </FONT></P>\n" text += " </TABLE>\n" text += pluginsText text += "\n<P STYLE=\"border-bottom: 5pt double %s\"></P>\n" % colors[0] text += """ <P> <FONT COLOR="%s">%s <A HREF="%s">%s</A> %s %s</FONT> </P> </BODY> </HTML>""" % ( colors[0], _("Generated by"), core.homePage, core.APP_DESC, _("version"), core.VERSION, ) open(fpath, "w").write(text)
def exportToHtml(fpath, monthsStatus, title=''): ##################### Options: format = ((2, 'SUB'), (0, None), (1, 'SUB')) ## (dateMode, htmlTag) sizeMap = lambda size: size * 0.25 - 0.5 ## ??????????????? sep = ' ' pluginsTextSep = ' <B>ـ</B> ' pluginsTextPerLine = True ## description of each day in one line ##################### bgColor = rgbToHtml(*ui.bgColor) inactiveColor = rgbToHtml(*colorComposite(ui.inactiveColor, ui.bgColor)) borderColor = rgbToHtml(*colorComposite(ui.borderColor, ui.bgColor)) borderTextColor = rgbToHtml(*ui.borderTextColor) textColor = rgbToHtml(*ui.textColor) holidayColor = rgbToHtml(*ui.holidayColor) colors = [rgbToHtml(*x['color']) for x in ui.mcalTypeParams] if locale_man.rtl: DIR = 'RTL' else: DIR = 'LRT' text = '''<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML> <HEAD> <META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=utf-8"> <TITLE>%s</TITLE> </HEAD> <BODY LANG="%s" DIR="%s" BGCOLOR="%s">\n''' % (title, locale_man.langSh, DIR, bgColor) for status in monthsStatus: text += ' <P>\n' for i, line in enumerate(getMonthDesc(status).split('\n')): try: color = colors[i] except IndexError: color = textColor text += ' <FONT COLOR="%s">%s</FONT>\n <BR>\n' % ( color, line) text += ' </P>\n' text += ''' <TABLE WIDTH=100%% BGCOLOR="%s" BORDER=%s BORDERCOLOR="#000000" CELLPADDING=4 CELLSPACING=0> <TR VALIGN=TOP>\n'''\ %(bgColor, int(ui.mcalGrid)) text += ''' <TD WIDTH=9%% BGCOLOR="%s"> <P ALIGN=CENTER></P> </TD>\n''' % borderColor ## what text???????? for j in range(7): text += ''' <TD WIDTH=13%% BGCOLOR="%s"> <P ALIGN=CENTER> <FONT COLOR="%s"><B>%s</B></FONT> </P> </TD>\n''' % (borderColor, borderTextColor, core.getWeekDayN(j)) pluginsText = '<P><FONT COLOR="%s">\n' % colors[0] text += ' </TR>\n' for i in range(6): text += ''' <TR VALIGN=TOP> <TD WIDTH=9%% BGCOLOR="%s"> <P ALIGN=CENTER> <FONT COLOR="%s"><B>%s</B></FONT> </P> </TD>\n''' % (borderColor, borderTextColor, _(status.weekNum[i])) for j in range(7): cell = status[i][j] text += ' <TD WIDTH=13%>\n <P DIR="LTR" ALIGN=CENTER>\n' for (ind, tag) in format: try: mode = calTypes.active[ind] except IndexError: continue try: params = ui.mcalTypeParams[ind] except IndexError: continue day = _(cell.dates[mode][2], mode) ## , 2 font = params['font'] face = font[0] if font[1]: face += ' Bold' if font[2]: face += ' Underline' size = str(sizeMap(font[3])) if cell.month != status.month: if ind == 0: text += ' ' if tag: text += '<%s>' % tag text += '<FONT COLOR="%s" FACE="%s" SIZE="%s">%s</FONT>' % ( inactiveColor, face, size, day, ) if tag: text += '</%s>' % tag text += '\n' break else: continue text += ' ' if tag: text += '<%s>' % tag if ind == 0 and cell.holiday: color = holidayColor else: color = colors[ind] text += '<FONT COLOR="%s" FACE="%s" SIZE="%s">%s</FONT>' % ( color, face, size, day) if tag: text += '</%s>' % tag text += '\n' #text += sep##??????????? text += ' </P>\n </TD>\n' if cell.month == status.month: if cell.holiday: color = holidayColor else: color = colors[0] t = cell.pluginsText.replace('\n', pluginsTextSep) if t: pluginsText += '<B><FONT COLOR="%s">%s</FONT>:</B> <SMALL>%s</SMALL>' % ( color, _(cell.dates[calTypes.primary][2]), t, ) if pluginsTextPerLine: pluginsText += '<BR>\n' else: pluginsText += ' \n' text += ' </TR>\n' pluginsText += ' </FONT></P>\n' text += ' </TABLE>\n' text += pluginsText text += '\n<P STYLE="border-bottom: 5pt double %s"></P>\n' % colors[0] text += ''' <P> <FONT COLOR="%s">%s <A HREF="%s">%s</A> %s %s</FONT> </P> </BODY> </HTML>''' % ( colors[0], _('Generated by'), core.homePage, core.APP_DESC, _('version'), core.VERSION, ) open(fpath, 'w').write(text)