Exemple #1
0
    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
Exemple #2
0
 def EventText(self):
     if self.nType == CCTYPE_S_ARUN:
         return 'arunodaya'
     elif self.nType == CCTYPE_S_RISE:
         return "sunrise"
     elif self.nType == CCTYPE_S_NOON:
         return "noon"
     elif self.nType == CCTYPE_S_SET:
         return "sunset"
     elif self.nType == CCTYPE_TITHI:
         return GCStrings.GetTithiName(self.nData) + " Tithi starts"
     elif self.nType == CCTYPE_NAKS:
         return GCStrings.GetNaksatraName(self.nData) + " Naksatra starts"
     elif self.nType == CCTYPE_YOGA:
         return GCStrings.GetYogaName(self.nData) + " Yoga starts"
     elif self.nType == CCTYPE_SANK:
         return "Sun enters {}".format(
             GCStrings.GetSankrantiName(self.nData))
     elif self.nType == CCTYPE_CONJ:
         return "conjunction in {} rasi".format(
             GCStrings.GetSankrantiName(self.nData))
     elif self.nType == CCTYPE_KALA_START:
         return GCStrings.GetKalaName(self.nData) + " starts"
     elif self.nType == CCTYPE_KALA_END:
         return GCStrings.GetKalaName(self.nData) + " ends"
     elif self.nType == CCTYPE_M_RISE:
         return "moonrise"
     elif self.nType == CCTYPE_M_SET:
         return "moonset"
     elif self.nType == CCTYPE_ASCENDENT:
         return GCStrings.GetSankrantiName(self.nData) + " ascendent"
     elif self.nType == CCTYPE_M_RASI:
         return "Moon enters {}".format(
             GCStrings.GetSankrantiName(self.nData))
     else:
         return ''
Exemple #3
0
    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 writeXml(xml, loc, vcStart, vcEnd):
    dt = GCTime()
    zodiac = 0

    d = GCGregorianDate(date=vcStart)

    xml.write("<xml>\n")
    xml.write("\t<request name=\"Sankranti\" version=\"")
    xml.write(GCStrings.getString(130))
    xml.write("\">\n")
    xml.write("\t\t<arg name=\"longitude\" val=\"")
    xml.write(str(loc.m_fLongitude))
    xml.write("\" />\n")
    xml.write("\t\t<arg name=\"latitude\" val=\"")
    xml.write(str(loc.m_fLatitude))
    xml.write("\" />\n")
    xml.write("\t\t<arg name=\"timezone\" val=\"")
    xml.write(str(loc.m_fTimezone))
    xml.write("\" />\n")
    xml.write("\t\t<arg name=\"location\" val=\"")
    xml.write(loc.m_strName)
    xml.write("\" />\n")
    xml.write("\t\t<arg name=\"startdate\" val=\"")
    xml.write(repr(vcStart))
    xml.write("\" />\n")
    xml.write("\t\t<arg name=\"enddate\" val=\"")
    xml.write(repr(vcEnd))
    xml.write("\" />\n")
    xml.write("\t</request>\n")
    xml.write("\t<result name=\"SankrantiList\">\n")

    while d.IsBeforeThis(vcEnd):
        nextDate, zodiac = GetNextSankranti(d)
        d.Set(nextDate)
        d.InitWeekDay()
        xml.write("\t\t<sank date=\"")
        xml.write(str(d))
        xml.write("\" ")
        xml.write("dayweekid=\"")
        xml.write(str(d.dayOfWeek))
        xml.write("\" dayweek=\"")
        xml.write(GCStrings.getString(d.dayOfWeek))
        xml.write("\" ")

        dt.SetDegTime(360 * d.shour)

        xml.write(" time=\"")
        xml.write(repr(dt))
        xml.write("\" >\n")
        xml.write("\t\t\t<zodiac sans=\"")
        xml.write(GCStrings.GetSankrantiName(zodiac))
        xml.write("\" eng=\"")
        xml.write(GCStrings.GetSankrantiNameEn(zodiac))
        xml.write("\" id=\"")
        xml.write(str(zodiac))
        xml.write("\" />\n")
        xml.write("\t\t</sank>\n")

        d.NextDay()
        d.NextDay()

    xml.write("\t</result>\n")
    xml.write("</xml>")

    return 1
    def formatPlainText(self, stream):
        d = self.details
        vc = GCGregorianDate(date=self.eventTime)
        m_earth = self.m_location.GetEarthData()

        sb = GCStringBuilder(stream)
        sb.Format = SBTF_TEXT

        sb.AppendLine(GCStrings.getString(25))
        sb.AppendLine("")

        sb.AppendLine("{:15s} : {} {} {}".format(
            GCStrings.getString(7), vc.day,
            GCStrings.GetMonthAbreviation(vc.month), vc.year))

        sb.AppendLine("{:15s} : {}:{:02d}".format(GCStrings.getString(8),
                                                  vc.GetHour(),
                                                  vc.GetMinuteRound()))
        sb.AppendLine("")

        sb.AppendLine("{:15s} : {}".format(GCStrings.getString(9),
                                           self.m_location.m_strName))
        sb.AppendLine("{:15s} : {}".format(GCStrings.getString(10),
                                           self.m_location.m_strLatitude))
        sb.AppendLine("{:15s} : {}".format(GCStrings.getString(11),
                                           self.m_location.m_strLongitude))
        sb.AppendLine("{:15s} : {}".format(GCStrings.getString(12),
                                           self.m_location.m_strTimeZone))
        sb.AppendLine("{:15s} : N/A".format("DST"))
        sb.AppendLine("")

        sb.AppendLine("{:15s} : {}".format(GCStrings.getString(13),
                                           GCStrings.GetTithiName(d.nTithi)))
        sb.AppendLine("{:15s} : {:.2f} %".format(GCStrings.getString(14),
                                                 d.nTithiElapse))
        sb.AppendLine("{:15s} : {}".format(
            GCStrings.getString(15), GCStrings.GetNaksatraName(d.nNaksatra)))
        sb.AppendLine("{:15s} : {:.2f} % ({} pada)".format(
            GCStrings.getString(16), d.nNaksatraElapse,
            GCStrings.getString(811 + int(d.nNaksatraElapse / 25.0))))
        sb.AppendLine("{:15s} : {} ({})".format(
            "Moon Rasi", GCStrings.GetSankrantiName(d.nMoonRasi),
            GCStrings.GetSankrantiNameEn(d.nMoonRasi)))
        sb.AppendLine("{:15s} : {} ({})".format(
            "Sun Rasi", GCStrings.GetSankrantiName(d.nSunRasi),
            GCStrings.GetSankrantiNameEn(d.nSunRasi)))

        sb.AppendLine("{:15s} : {}".format(GCStrings.getString(20),
                                           GCStrings.GetPaksaName(d.nPaksa)))
        if (self.b_adhika == True):
            sb.AppendLine("{:15s} : {} {}".format(
                GCStrings.getString(22), GCStrings.GetMasaName(d.nMasa),
                GCStrings.getString(21)))
        else:
            sb.AppendLine("{:15s} : {}".format(GCStrings.getString(22),
                                               GCStrings.GetMasaName(d.nMasa)))
        sb.AppendLine("{:15s} : {}".format(GCStrings.getString(23),
                                           d.nGaurabdaYear))

        if (GCDisplaySettings.getValue(48)):
            sb.AppendLine()
            sb.AppendLine(GCStrings.getString(17))
            sb.AppendLine()

            sb.AppendLine("%25s : {}... ".format(
                GCStrings.getString(18),
                GCStrings.GetNaksatraChildSylable(
                    d.nNaksatra, int(d.nNaksatraElapse / 25.0))))
            sb.AppendLine("%25s : {}... ".format(
                GCStrings.getString(19),
                GCStrings.GetRasiChildSylable(d.nMoonRasi)))

        sb.AppendLine()
        sb.AppendLine(GCStrings.getString(24))
        sb.AppendLine()

        for o in range(TRESULT_APP_CELEBS):
            sb.AppendLine("   Gaurabda {:3d} : {} ".format(
                self.celeb_gy[o], self.celeb_date[o]))

        sb.AppendNote()
    def formatRtf(self, stream):
        d = self.details
        vc = GCGregorianDate(date=self.eventTime)
        m_earth = self.m_location.GetEarthData()

        sb = GCStringBuilder(stream)
        sb.fontSizeH1 = GCLayoutData.textSizeH1
        sb.fontSizeH2 = GCLayoutData.textSizeH2
        sb.fontSizeText = GCLayoutData.textSizeText
        sb.fontSizeNote = GCLayoutData.textSizeNote
        sb.Format = SBTF_RTF

        sb.AppendDocumentHeader()

        sb.AppendHeader1(GCStrings.getString(25))

        sb.AppendLine("\\tab {} : {{\\b {} {} {} }}".format(
            GCStrings.getString(7), vc.day,
            GCStrings.GetMonthAbreviation(vc.month), vc.year))

        sb.AppendLine("\\tab {} : {{\\b {}:{:02d} }}".format(
            GCStrings.getString(8), vc.GetHour(), vc.GetMinuteRound()))
        sb.AppendLine("")

        sb.AppendLine("\\tab {} : {{\\b {} }}".format(
            GCStrings.getString(9), self.m_location.m_strName))
        sb.AppendLine("\\tab {} : {{\\b {} }}".format(
            GCStrings.getString(10), self.m_location.m_strLatitude))
        sb.AppendLine("\\tab {} : {{\\b {} }}".format(
            GCStrings.getString(11), self.m_location.m_strLongitude))
        sb.AppendLine("\\tab {} : {{\\b {} }}".format(
            GCStrings.getString(12),
            GCTimeZone.GetTimeZoneName(self.m_location.m_nTimezoneId)))
        sb.AppendLine("\\tab {} : {{\\b N/A }}".format("DST"))
        sb.AppendLine("")

        sb.AppendLine("\\tab {} : {{\\b {} }}".format(
            GCStrings.getString(13), GCStrings.GetTithiName(d.nTithi)))
        sb.AppendLine("\\tab {} : {{\\b {:.2f} % }}".format(
            GCStrings.getString(14), d.nTithiElapse))
        sb.AppendLine("\\tab {} : {{\\b {} }}".format(
            GCStrings.getString(15), GCStrings.GetNaksatraName(d.nNaksatra)))
        sb.AppendLine("\\tab {} : {{\\b {:.2f} % ({} pada) }}".format(
            GCStrings.getString(16), d.nNaksatraElapse,
            GCStrings.getString(811 + int(d.nNaksatraElapse / 25.0))))
        sb.AppendLine("\\tab {} : {{\\b {} ({}) }}".format(
            "Moon Rasi", GCStrings.GetSankrantiName(d.nMoonRasi),
            GCStrings.GetSankrantiNameEn(d.nMoonRasi)))
        sb.AppendLine("\\tab {} : {{\\b {} ({}) }}".format(
            "Sun Rasi", GCStrings.GetSankrantiName(d.nSunRasi),
            GCStrings.GetSankrantiNameEn(d.nSunRasi)))

        sb.AppendLine("\\tab {} : {{\\b {} }}".format(
            GCStrings.getString(20), GCStrings.GetPaksaName(d.nPaksa)))
        if (self.b_adhika == True):
            sb.AppendLine("\\tab {} : {{\\b {} {} }}".format(
                GCStrings.getString(22), GCStrings.GetMasaName(d.nMasa),
                GCStrings.getString(21)))
        else:
            sb.AppendLine("\\tab {} : {{\\b {} }}".format(
                GCStrings.getString(22), GCStrings.GetMasaName(d.nMasa)))
        sb.AppendLine("\\tab {} : {{\\b {} }}".format(GCStrings.getString(23),
                                                      d.nGaurabdaYear))

        if (GCDisplaySettings.getValue(48)):
            sb.AppendLine("")
            sb.AppendHeader2(GCStrings.getString(17))
            sb.AppendLine("")
            sb.AppendLine("\\tab {} : {{\\b {}...  }}".format(
                GCStrings.getString(18),
                GCStrings.GetNaksatraChildSylable(
                    d.nNaksatra, int(d.nNaksatraElapse / 25.0))))
            sb.AppendLine("\\tab {} : {{\\b {}...  }}".format(
                GCStrings.getString(19),
                GCStrings.GetRasiChildSylable(d.nMoonRasi)))

        sb.AppendLine("{{\\fs{} {} }}".format(GCLayoutData.textSizeH2,
                                              GCStrings.getString(24)))
        sb.AppendLine("")

        for o in range(TRESULT_APP_CELEBS):
            sb.AppendLine("\\tab Gaurabda {} : {{\\b {} }}".format(
                self.celeb_gy[o], self.celeb_date[o]))

        sb.AppendDocumentTail()
Exemple #7
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()