Example #1
0
 def GetTextEP(self):
     str = ''
     (m1, h1) = modf(self.eparana_time1)
     if self.eparana_time2 >= 0.0:
         (m2, h2) = modf(self.eparana_time2)
         if GCDisplaySettings.getValue(50):
             str += "{} {:02d}:{:02d} ({}) - {:02d}:{:02d} ({}) {}".format(
                 GCStrings.getString(60), int(h1), int(m1 * 60),
                 GCStrings.GetParanaReasonText(self.eparana_type1), int(h2),
                 int(m2 * 60),
                 GCStrings.GetParanaReasonText(self.eparana_type2),
                 GCStrings.GetDSTSignature(self.hasDST))
         else:
             str += "{} {:02d}:{:02d} - {:02d}:{:02d} ({})".format(
                 GCStrings.getString(60), int(h1), int(m1 * 60), int(h2),
                 int(m2 * 60), GCStrings.GetDSTSignature(self.hasDST))
     elif self.eparana_time1 >= 0.0:
         if GCDisplaySettings.getValue(50):
             str += "{} {:02d}:{:02d} ({}) {}".format(
                 GCStrings.getString(61), int(h1), int(m1 * 60),
                 GCStrings.GetParanaReasonText(self.eparana_type1),
                 GCStrings.GetDSTSignature(self.hasDST))
         else:
             str += "{} {:02d}:{:02d} ({})".format(
                 GCStrings.getString(61), int(h1), int(m1 * 60),
                 GCStrings.GetDSTSignature(self.hasDST))
     else:
         str = GCStrings.getString(62)
     return str
Example #2
0
    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
Example #3
0
    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
Example #4
0
    def WriteTodayInfo(self,sb,p):
        sb.AppendLine()
        stream = sb.Target

        for ed in p.dayEvents:
            if 'disp' not in ed or ed['disp'] == -1 or GCDisplaySettings.getValue(ed['disp']):
                if 'spec' in ed:
                    sb.AppendHeader3(ed['text'],fillChar='-')
                else:
                    sb.AppendString(ed['text'])
                sb.AppendLine()

        if GCDisplaySettings.getValue(45):
            tda = p.astrodata.sun.rise
            sb.AppendLine()
            stream.write("Brahma Muhurta {} - {} ({})".format(tda.short(-96), tda.short(-48), GCStrings.GetDSTSignature(p.hasDST)))

        if GCDisplaySettings.getValue(29):
            sb.AppendLine()
            tda = p.astrodata.sun.rise
            stream.write("{} {} ".format(GCStrings.getString(51), tda.short() ))
            if (GCDisplaySettings.getValue(32)):
                stream.write(" sandhya {} - {} ", tda.short(-24), tda.short(24))
            stream.write(" ({})".format(GCStrings.GetDSTSignature(p.hasDST)))
            sb.AppendLine()


        if (GCDisplaySettings.getValue(30)):
            sb.AppendLine()
            tda = p.astrodata.sun.noon
            stream.write("{} {} ".format(GCStrings.getString(857), tda.short() ))
            if (GCDisplaySettings.getValue(32)):
                stream.write(" sandhya {} - {} ", tda.short(-24), tda.short(24))
            stream.write(" ({})".format(GCStrings.GetDSTSignature(p.hasDST)))
            sb.AppendLine()

        if (GCDisplaySettings.getValue(31)):
            sb.AppendLine()
            tda = p.astrodata.sun.set
            stream.write("{} {} ".format(GCStrings.getString(52), tda.short() ))
            if (GCDisplaySettings.getValue(32)):
                stream.write(" sandhya {} - {} ", tda.short(-24), tda.short(24))
            stream.write(" ({})".format(GCStrings.GetDSTSignature(p.hasDST)))
            sb.AppendLine()

        if (GCDisplaySettings.getValue(33)):
            sb.AppendLine()
            sb.AppendString(GCStrings.getString(51) + " info")
            sb.AppendLine()
            sb.AppendString("   Moon in {} {}".format(GCStrings.GetNaksatraName(p.astrodata.nNaksatra), GCStrings.getString(15)))

            if (GCDisplaySettings.getValue(47)):
                sb.AppendString(", {:.1f}% passed ({} Pada)".format(p.astrodata.nNaksatraElapse, GCStrings.getString(811+int(p.astrodata.nNaksatraElapse/25))))

            if (GCDisplaySettings.getValue(46)):
                sb.AppendString(", Moon in {} {}".format( GCStrings.GetSankrantiName(p.astrodata.nMoonRasi), GCStrings.getString(105)))

            sb.AppendString(", {} {}".format(GCStrings.GetYogaName(p.astrodata.nYoga), GCStrings.getString(104)))
            sb.AppendLine()
            sb.AppendString("   Sun in {} {}.".format(GCStrings.GetSankrantiName(p.astrodata.nSunRasi), GCStrings.getString(105)))
            sb.AppendLine()

        sb.AppendNote()
        sb.AppendDocumentTail()