def GetTextRtf(self): str = "\\par {} {}\\tab {}\\tab ".format( self.date, GCStrings.GetDayOfWeek(self.date.dayOfWeek)[:2], self.GetFullTithiName()) if GCDisplaySettings.getValue(39): str += GCStrings.GetPaksaChar(self.astrodata.nPaksa) + ' ' else: str += ' ' if GCDisplaySettings.getValue(37): str += '\\tab {}'.format( GCStrings.GetYogaName(self.astrodata.nYoga)) if GCDisplaySettings.getValue(36): str += '\\tab {}'.format( GCStrings.GetNaksatraName(self.astrodata.nNaksatra)) if GCDisplaySettings.getValue( 38) and self.nFastType != FastType.FAST_NULL: str += "\\tab *" else: str += "\\tab " if GCDisplaySettings.getValue(41): rasi = GCRasi.GetRasi(self.astrodata.moon.longitude_deg, self.astrodata.msAyanamsa) if GCDisplaySettings.getValue(41) == 1: str += "\\tab {}".format(GCStrings.GetSankrantiName(rasi)) else: str += "\\tab {}".format(GCStrings.GetSankrantiNameEn(rasi)) str += "\r\n" return str
def writeHtml(self, stream): stream.write("<html>\n<head>\n<title>Core Events</title>\n\n") stream.write( "<style>\n<!--\nbody {\n font-family:Verdana;\n font-size:11pt;\n}\n\ntd.hed {\n font-size:11pt;\n font-weight:bold;\n" ) stream.write( " background:#aaaaaa;\n color:white;\n text-align:center;\n vertical-align:center;\n padding-left:15pt;\n padding-right:15pt;\n" ) stream.write( " padding-top:5pt;\n padding-bottom:5pt;\n}\n-->\n</style>\n") stream.write("</head>\n") stream.write("<body>\n\n") stream.write( "<h1 align=center>Events</h1>\n<p align=center>From {} to {}.</p>\n\n" .format(self.m_vcStart, self.m_vcEnd)) stream.write("<p align=center>{}</p>\n".format( self.m_location.m_strFullName)) prevd = GCGregorianDate() prevd.day = 0 prevd.month = 0 prevd.year = 0 prevt = -1 stream.write("<table align=center><tr>\n") last_header = '' new_header = '' for dnr in self.p_events: if self.b_sorted: new_header = " {} - {} ".format( dnr.Time, GCStrings.GetDayOfWeek(dnr.Time.dayOfWeek)) else: new_header = self.header_text[dnr.nType] if last_header != new_header: stream.write( f"<td class=\"hed\" colspan=2>{new_header}</td></tr>\n<tr>\n" ) last_header = new_header stream.write("<td>{}</td><td>{}</td></tr><tr>\n".format( dnr.EventText(), dnr.Time.time_str())) stream.write("</tr></table>\n") stream.write( "<hr align=center width=\"50%%\">\n<p align=center>Generated by {}</p>" .format(GCStrings.getString(130))) stream.write("</body>\n</html>\n") return 1
def formatRtf(self, stream): sb = GCStringBuilder(stream) sb.Format = SBTF_RTF sb.fontSizeH1 = GCLayoutData.textSizeH1 sb.fontSizeH2 = GCLayoutData.textSizeH2 sb.fontSizeText = GCLayoutData.textSizeText sb.fontSizeNote = GCLayoutData.textSizeNote sb.AppendDocumentHeader() sb.AppendHeader1("Events") stream.write("\\par from {} to {}.\\par\r\n\\par\r\n".format( self.m_vcStart, self.m_vcEnd)) stream.write("{}\\par\r\n\\par\r\n".format( self.m_location.m_strFullName)) prevd = GCGregorianDate() prevd.day = 0 prevd.month = 0 prevd.year = 0 prevt = -1 last_header = '' for dnr in self.p_events: new_header = '' if self.b_sorted: new_header = " {} - {} ".format( dnr.Time, GCStrings.GetDayOfWeek(dnr.Time.dayOfWeek)) else: new_header = header_text[dnr.nType] if last_header != new_header: sb.AppendLine() sb.AppendHeader2(new_header) sb.AppendLine() last_header = new_header stream.write("\\par {} {} {}".format( dnr.Time.time_str(), GCStrings.GetDSTSignature(dnr.nDst), dnr.EventText())) sb.AppendLine() sb.AppendNote() sb.AppendDocumentTail() return 1
def GetTextA(self): str = "{} {} {} ".format( self.date.__str__().rjust(12, ' '), GCStrings.GetDayOfWeek(self.date.dayOfWeek)[:2], self.GetFullTithiName().ljust(34, ' ')) if GCDisplaySettings.getValue(39): str += GCStrings.GetPaksaChar(self.astrodata.nPaksa) + ' ' else: str += ' ' if GCDisplaySettings.getValue(37): str += '{}'.format( GCStrings.GetYogaName(self.astrodata.nYoga).ljust(10, ' ')) if GCDisplaySettings.getValue(36): str += '{}'.format( GCStrings.GetNaksatraName(self.astrodata.nNaksatra).ljust( 15, ' ')) if GCDisplaySettings.getValue( 38) and self.nFastType != FastType.FAST_NULL: str += " *" else: str += " " if GCDisplaySettings.getValue(41): rasi = GCRasi.GetRasi(self.astrodata.moon.longitude_deg, self.astrodata.msAyanamsa) if GCDisplaySettings.getValue(41) == 1: str += " {}".format( GCStrings.GetSankrantiName(rasi).ljust(15, ' ')) else: str += " {}".format( GCStrings.GetSankrantiNameEn(rasi).ljust(15, ' ')) return str
def formatText(self, stream): sb = GCStringBuilder(stream) sb.Format = SBTF_TEXT stream.write("Events from {} to {}.\r\n\r\n".format( self.m_vcStart, self.m_vcEnd)) stream.write("{}\r\n\r\n".format(self.m_location.m_strFullName)) prevd = GCGregorianDate() prevd.day = 0 prevd.month = 0 prevd.year = 0 prevt = -1 last_header = '' for dnr in self.p_events: new_header = '' if self.b_sorted: new_header = " {} - {} ".format( dnr.Time, GCStrings.GetDayOfWeek(dnr.Time.dayOfWeek)) else: new_header = header_text[dnr.nType] if last_header != new_header: sb.AppendLine() sb.AppendHeader3(new_header) sb.AppendLine() last_header = new_header stream.write(" {} {} {}".format( dnr.Time.time_str(), GCStrings.GetDSTSignature(dnr.nDst), dnr.EventText())) sb.AppendLine() sb.AppendLine() sb.AppendNote() return 1