예제 #1
0
    def formatXml(self, stream):
        d = self.details
        vc = GCGregorianDate(date=self.eventTime)
        m_earth = self.m_location.GetEarthData()
        loc = self.m_location
        bDuringAdhika = False

        stream.write('''<xml>
    <request name="AppDay" version="{}">
        <arg name="longitude" value="{}" />
        <arg name="latitude" value="{}" />
        <arg name="timezone" value="{}" />
        <arg name="year" value="{}" />
        <arg name="month" value="{}" />
        <arg name="day" value="{}" />
        <arg name="hour" value="{}" />
        <arg name="minute" value="{}" />
    </request>'''.format(GCStrings.getString(130), loc.m_fLongitude,
                         loc.m_fLatitude, loc.m_fTimezone, self.eventTime.year,
                         self.eventTime.month, self.eventTime.day,
                         self.eventTime.GetHour(),
                         self.eventTime.GetMinuteRound()))

        npada = int(floor(d.nNaksatraElapse / 25.0)) + 1
        if (npada > 4): npada = 4
        is_adhika = "yes" if bDuringAdhika else "no"
        stream.write(
            "\t<result name=\"AppDay\" >\n\t\t<tithi name=\"{}\" elapse=\"%f\" />\n\t\t<naksatra name=\"{}\" elapse=\"%f\" pada=\"{}\"/>\n\t\t<paksa name=\"{}\" />\n\t\t<masa name=\"{}\" adhikamasa=\"{}\"/>\n\t\t<gaurabda value=\"{}\" />\n"
            .format(GCStrings.GetTithiName(d.nTithi), d.nTithiElapse,
                    GCStrings.GetNaksatraName(d.nNaksatra), d.nNaksatraElapse,
                    npada, GCStrings.GetPaksaName(d.nPaksa),
                    GCStrings.GetMasaName(d.nMasa), is_adhika,
                    d.nGaurabdaYear))

        stream.write("\t\t<celebrations>\n")
        for i in range(TRESULT_APP_CELEBS):
            stream.write(
                "\t\t\t<celebration gaurabda=\"{}\" day=\"{}\" month=\"{}\" monthabr=\"{}\" year=\"{}\" />\n"
                .format(
                    self.celeb_gy[i], self.celeb_date[i].day,
                    self.celeb_date[i].month,
                    GCStrings.GetMonthAbreviation(self.celeb_date[i].month),
                    self.celeb_date[i].year))

        stream.write("\t\t</celebrations>\n\t</result>\n</xml>\n")
예제 #2
0
    def CalculateMasaList(self, loc, year, count):
        day = GCDayData()
        earth = loc.GetEarthData()

        self.startYear = year
        self.countYears = count
        self.start = GCGregorianDate(date=GetFirstDayOfYear(earth, year))
        self.end = GCGregorianDate(date=GetFirstDayOfYear(earth, year + count))
        self.location = GCLocation()
        self.location.Set(loc)

        i = 0
        prev_masa = -1
        prev_paksa = -1
        prev_gyear = -1
        current = 0
        d = GCGregorianDate(date=self.start)

        while d.IsBeforeThis(self.end):
            day.DayCalc(d, earth)
            if prev_paksa != day.nPaksa:
                day.nMasa = day.MasaCalc(d, earth)
                if prev_masa != day.nMasa:
                    if len(self.arr) > 0:
                        self.arr[-1]['end'] = GCGregorianDate(date=d,
                                                              addDays=-1)
                    prev_masa = day.nMasa
                    self.arr.append({
                        'masa':
                        day.nMasa,
                        'masaName':
                        GCStrings.GetMasaName(day.nMasa),
                        'year':
                        day.nGaurabdaYear,
                        'start':
                        GCGregorianDate(date=d)
                    })
            prev_paksa = day.nPaksa
            d.NextDay()

        self.arr[-1]['end'] = GCGregorianDate(date=d, addDays=-1)
        return len(self.arr)
예제 #3
0
def FormatDate(vc, va):
    return "{} {} {}\r\n{}, {} Paksa, {} Masa, {}".format(
        vc.day, GCStrings.GetMonthAbreviation(vc.month), vc.year,
        GCStrings.GetTithiName(va.tithi % 15),
        GCStrings.GetPaksaName(va.paksa), GCStrings.GetMasaName(va.masa),
        va.gyear)
예제 #4
0
 def __str__(self):
     return '{} {}, {} Masa, {}'.format(GCStrings.GetTithiName(self.tithi),
                                        GCStrings.GetPaksaName(self.paksa),
                                        GCStrings.GetMasaName(self.masa),
                                        self.gyear)
예제 #5
0
def writeGaurabdaNextTithiXml(xml, loc, vcStart, vaStart):
    gmasa = vaStart.masa
    gpaksa = 1 if vaStart.tithi >= 15 else 0
    gtithi = vaStart.tithi % 15

    xml.write("<xml>\n")
    xml.write("\t<request name=\"Tithi\" 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=\"start date\" val=\"")
    xml.write(str(vcStart))
    xml.write("\" />\n")
    xml.write("\t\t<arg name=\"masa\" val=\"")
    xml.write(str(gmasa))
    xml.write("\" />\n")
    xml.write("\t\t<arg name=\"paksa\" val=\"")
    xml.write(str(gpaksa))
    xml.write("\" />\n")
    xml.write("\t\t<arg name=\"tithi\" val=\"")
    xml.write(str(gtithi))
    xml.write("\" />\n")
    xml.write("\t</request>\n")
    xml.write("\t<result name=\"Tithi\">\n")

    earth = loc.GetEarthData()
    vcs = GCGregorianDate()
    vce = GCGregorianDate()
    sun = SUNDATA()
    A = 0
    day = GCDayData()

    today = GCGregorianDate(date=vcStart)
    today.PreviousDay()
    vcStart.SubtractDays(15)
    for A in range(0, 4):
        vcs.Set(
            GCTithi.CalcTithiEndEx(vcStart, 0, gmasa, gpaksa, gtithi, earth,
                                   vce))
        if not vcs.IsBeforeThis(today):
            oTithi = gpaksa * 15 + gtithi
            oMasa = gmasa
            oPaksa = gpaksa
            oYear = 0
            xml.write("\t<celebration\n")
            xml.write("\t\trtithi=\"")
            xml.write(GCStrings.GetTithiName(oTithi))
            xml.write("\"\n")
            xml.write("\t\trmasa=\"")
            xml.write(GCStrings.GetMasaName(oMasa))
            xml.write("\"\n")
            xml.write("\t\trpaksa=\"")
            xml.write("Gaura" if oPaksa else "Krsna")
            xml.write("\"\n")
            # test ci je ksaya
            today.Set(vcs)
            today.shour = 0.5
            sun.SunCalc(today, earth)
            sunrise = (sun.sunrise_deg + loc.m_fTimezone * 15.0) / 360
            if sunrise < vcs.shour:
                today.Set(vce)
                sun.SunCalc(today, earth)
                sunrise = (sun.sunrise_deg + loc.m_fTimezone * 15.0) / 360
                if sunrise < vce.shour:
                    # normal type
                    vcs.NextDay()
                    xml.write("\t\ttype=\"normal\"\n")
                else:
                    # ksaya
                    vcs.NextDay()
                    day.DayCalc(vcs, earth)
                    oTithi = day.nTithi
                    oPaksa = day.nPaksa
                    oMasa = day.MasaCalc(vcs, earth)
                    oYear = day.nGaurabdaYear
                    xml.write("\t\ttype=\"ksaya\"\n")
            else:
                # normal, alebo prvy den vriddhi
                today.Set(vce)
                sun.SunCalc(today, earth)
                if (sun.sunrise_deg +
                        loc.m_fTimezone * 15.0) / 360 < vce.shour:
                    # first day of vriddhi type
                    xml.write("\t\ttype=\"vriddhi\"\n")
                else:
                    # normal
                    xml.write("\t\ttype=\"normal\"\n")
            xml.write("\t\tdate=\"")
            xml.write(str(vcs))
            xml.write("\"\n")
            xml.write("\t\totithi=\"")
            xml.write(GCStrings.GetTithiName(oTithi))
            xml.write("\"\n")
            xml.write("\t\tomasa=\"")
            xml.write(GCStrings.GetMasaName(oMasa))
            xml.write("\"\n")
            xml.write("\t\topaksa=\"")
            xml.write("Gaura" if oPaksa else "Krsna")
            xml.write("\"\n")
            xml.write("\t/>\n")
            break
        else:
            vcStart.Set(vcs)
            vcs.NextDay()

    xml.write("\t</result>\n")
    xml.write("</xml>\n")
    return 1
예제 #6
0
def writeGaurabdaTithiXml(xml, loc, vaStart, vaEnd):
    gyearA = vaStart.gyear
    gyearB = vaEnd.gyear
    gmasa = vaStart.masa
    gpaksa = 1 if vaStart.tithi >= 15 else 0
    gtithi = vaStart.tithi % 15

    if gyearB < gyearA:
        gyearB = gyearA

    xml.write("<xml>\n")
    xml.write("\t<request name=\"Tithi\" 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")
    if gyearA > 1500:
        xml.write("\t\t<arg name=\"year-start\" val=\"")
        xml.write(str(gyearA))
        xml.write("\" />\n")
        xml.write("\t\t<arg name=\"year-end\" val=\"")
        xml.write(str(gyearB))
        xml.write("\" />\n")
    else:
        xml.write("\t\t<arg name=\"gaurabdayear-start\" val=\"")
        xml.write(str(gyearA))
        xml.write("\" />\n")
        xml.write("\t\t<arg name=\"gaurabdayear-end\" val=\"")
        xml.write(str(gyearB))
        xml.write("\" />\n")
    xml.write("\t\t<arg name=\"masa\" val=\"")
    xml.write(str(gmasa))
    xml.write("\" />\n")
    xml.write("\t\t<arg name=\"paksa\" val=\"")
    xml.write(str(gpaksa))
    xml.write("\" />\n")
    xml.write("\t\t<arg name=\"tithi\" val=\"")
    xml.write(str(gtithi))
    xml.write("\" />\n")
    xml.write("\t</request>\n")
    xml.write("\t<result name=\"Tithi\">\n")

    earth = loc.GetEarthData()
    vcs = GCGregorianDate()
    vce = GCGregorianDate()
    today = GCGregorianDate()
    sun = SUNDATA()
    day = GCDayData()
    A = B = 0

    if gyearA > 1500:
        A = gyearA - 1487
        B = gyearB - 1485
    else:
        A = gyearA
        B = gyearB

    for A in range(A, B + 1):
        vcs.Set(GCTithi.CalcTithiEnd(A, gmasa, gpaksa, gtithi, earth, vce))
        if gyearA > 1500:
            if (vcs.year < gyearA) or (vcs.year > gyearB):
                continue
        oTithi = gpaksa * 15 + gtithi
        oMasa = gmasa
        oPaksa = gpaksa
        oYear = 0
        xml.write("\t<celebration\n")
        xml.write("\t\trtithi=\"")
        xml.write(GCStrings.GetTithiName(oTithi))
        xml.write("\"\n")
        xml.write("\t\trmasa=\"")
        xml.write(GCStrings.GetMasaName(oMasa))
        xml.write("\"\n")
        xml.write("\t\trpaksa=\"")
        xml.write('Gaura' if oPaksa else "Krsna")
        xml.write("\"\n")
        # test ci je ksaya
        today.Set(vcs)
        today.shour = 0.5
        sun.SunCalc(today, earth)
        sunrise = (sun.sunrise_deg + loc.m_fTimezone * 15.0) / 360
        if sunrise < vcs.shour:
            today.Set(vce)
            sun.SunCalc(today, earth)
            sunrise = (sun.sunrise_deg + loc.m_fTimezone * 15.0) / 360
            if sunrise < vce.shour:
                # normal type
                vcs.NextDay()
                xml.write("\t\ttype=\"normal\"\n")
            else:
                # ksaya
                vcs.NextDay()
                day.DayCalc(vcs, earth)
                oTithi = day.nTithi
                oPaksa = day.nPaksa
                oMasa = day.MasaCalc(vcs, earth)
                oYear = day.nGaurabdaYear
                xml.write("\t\ttype=\"ksaya\"\n")
        else:
            # normal, alebo prvy den vriddhi
            today.Set(vce)
            sun.SunCalc(today, earth)
            if (sun.sunrise_deg + loc.m_fTimezone * 15.0) / 360 < vce.shour:
                # first day of vriddhi type
                xml.write("\t\ttype=\"vriddhi\"\n")
            else:
                # normal
                xml.write("\t\ttype=\"normal\"\n")
        xml.write("\t\tdate=\"")
        xml.write(str(vcs))
        xml.write("\"\n")
        xml.write("\t\totithi=\"")
        xml.write(GCStrings.GetTithiName(oTithi))
        xml.write("\"\n")
        xml.write("\t\tomasa=\"")
        xml.write(GCStrings.GetMasaName(oMasa))
        xml.write("\"\n")
        xml.write("\t\topaksa=\"")
        xml.write('Gaura' if oPaksa else 'Krsna')
        xml.write("\"\n")
        xml.write("\t/>\n")

    xml.write("\t</result>\n")
    xml.write("</xml>\n")
    return 1
예제 #7
0
    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()
예제 #8
0
    def writeHtml(self, stream):
        d = self.details
        vc = GCGregorianDate(date=self.eventTime)
        m_earth = self.m_location.GetEarthData()

        stream.write("<html><head><title>Appearance day</title>")
        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\n<body>\n")
        stream.write("<h2 align=center>Appearance day Calculation</h2>")
        stream.write("<table align=center><tr><td valign=top>\n\n")
        stream.write("<table align=center>")
        stream.write("<tr><td colspan=3 class=hed>Details</td></tr>\n")
        stream.write("<tr><td colspan=2>{}</td><td> {}</td></tr>\n".format(
            GCStrings.getString(7), vc))
        stream.write(
            "<tr><td colspan=2>{}</td><td> {}:{:02d}</td></tr>\n\n".format(
                GCStrings.getString(8), vc.GetHour(), vc.GetMinuteRound()))
        stream.write("<tr><td colspan=2>{}</td><td> {}</td></tr>\n".format(
            GCStrings.getString(9), self.m_location.m_strName))
        stream.write("<tr><td colspan=2>{}</td><td> {}</td></tr>\n".format(
            GCStrings.getString(10),
            GCEarthData.GetTextLatitude(self.m_location.m_fLatitude)))
        stream.write("<tr><td colspan=2>{}</td><td> {}</td></tr>\n".format(
            GCStrings.getString(11),
            GCEarthData.GetTextLongitude(self.m_location.m_fLongitude)))
        stream.write("<tr><td colspan=2>{}</td><td> ".format(
            GCStrings.getString(12)))
        stream.write(
            GCTimeZone.GetTimeZoneOffsetText(self.m_location.m_fTimezone))
        stream.write("</td></tr>\n")
        stream.write("<tr><td colspan=2>DST</td><td>N/A</td></tr>\n")
        stream.write("<tr><td colspan=2>{}</td><td> {}</td></tr>\n".format(
            GCStrings.getString(13), GCStrings.GetTithiName(d.nTithi)))
        stream.write(
            "<tr><td colspan=2>{}</td><td> {:.2f} %</td></tr>\n".format(
                GCStrings.getString(14), d.nTithiElapse))
        stream.write("<tr><td colspan=2>{}</td><td> {}</td></tr>\n".format(
            GCStrings.getString(15), GCStrings.GetNaksatraName(d.nNaksatra)))
        stream.write(
            "<tr><td colspan=2>{}</td><td> {:.2f} %</td></tr>\n".format(
                GCStrings.getString(16), d.nNaksatraElapse))
        stream.write("<tr><td colspan=2>{}</td><td> {}</td></tr>\n".format(
            GCStrings.getString(20), GCStrings.GetPaksaName(d.nPaksa)))
        if (self.b_adhika == True):
            stream.write(
                "<tr><td colspan=2>{}</td><td> {} {}</td></tr>\n".format(
                    GCStrings.getString(22), GCStrings.GetMasaName(d.nMasa),
                    GCStrings.getString(21)))
        else:
            stream.write("<tr><td colspan=2>{}</td><td> {}</td></tr>\n".format(
                GCStrings.getString(22), GCStrings.GetMasaName(d.nMasa)))
        stream.write("<tr><td colspan=2>{}</td><td> {}</td></tr>\n\n".format(
            GCStrings.getString(23), d.nGaurabdaYear))

        stream.write("</table></td><td valign=top><table>")
        stream.write("<tr><td colspan=3 class=hed>{}</td></tr>\n".format(
            GCStrings.getString(24)))

        for o in range(TRESULT_APP_CELEBS):
            stream.write(
                "<tr><td>Gaurabda {}</td><td>&nbsp;&nbsp;:&nbsp;&nbsp;</td><td><b>{}</b></td></tr>"
                .format(self.celeb_gy[o], self.celeb_date[o]))
        stream.write("</table>")
        stream.write("</td></tr></table>\n\n")
        stream.write(
            "<hr align=center width=\"50%\">\n<p style=\'text-align:center;font-size:8pt\'>Generated by {}</p>"
            .format(GCStrings.getString(130)))
        stream.write("</body></html>")
예제 #9
0
    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()
예제 #10
0
    def writeHtml(self, stream):
        p = self.GetCurrentDay()
        loc = self.calendar.m_Location
        vc = p.date
        sb = GCStringBuilder(stream)
        sb.Format = SBTF_HTML

        if (p == None): return

        stream.write("<html>\n<head>\n<title></title>")
        stream.write("<style>\n<!--\nbody {\n  font-family:Verdana;\n  font-size:9.5pt;\n}\n\ntd.hed {\n  font-size:9.5pt;\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")
        stream.write("<h2>{}</h2>\n".format(vc.GetDateTextWithTodayExt()))
        stream.write("<h4>{}</h4>\n".format(loc.m_strFullName))
        stream.write("<p>  {}, {} {}<br>  {} {}, {} Gaurabda</p>".format(GCStrings.GetTithiName(p.astrodata.nTithi), GCStrings.GetPaksaName(p.astrodata.nPaksa), GCStrings.getString(20), GCStrings.GetMasaName(p.astrodata.nMasa), GCStrings.getString(22), p.astrodata.nGaurabdaYear))

        prevCountFest = 0

        stream.write("<p>")
        self.WriteTodayInfo(sb,p)
예제 #11
0
    def formatRtf(self, stream):
        p = self.GetCurrentDay()
        loc = self.calendar.m_Location
        vc = p.date

        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()

        stream.write("\\f2\\fs{} {} ".format(GCLayoutData.textSizeH1, vc.GetDateTextWithTodayExt()))
        stream.write("\\par\\f2\\fs{} {{\\fs{} {} }}\\line {} ({}, {}, Timezone: {})\\par\r\n\\par\r\n  {}, {} {}\\par\r\n  {} {}, {} Gaurabda\\par\r\n\\par\r\n".format( GCLayoutData.textSizeText, GCLayoutData.textSizeText+4, GCStrings.getString(p.date.dayOfWeek), loc.m_strName, GCEarthData.GetTextLatitude(loc.m_fLatitude), GCEarthData.GetTextLongitude(loc.m_fLongitude), GCTimeZone.GetTimeZoneName(loc.m_nTimezoneId), GCStrings.GetTithiName(p.astrodata.nTithi), GCStrings.GetPaksaName(p.astrodata.nPaksa), GCStrings.getString(20), GCStrings.GetMasaName(p.astrodata.nMasa), GCStrings.getString(22), p.astrodata.nGaurabdaYear))

        self.WriteTodayInfo(sb,p)
예제 #12
0
    def formatPlain(self, stream):
        p = self.GetCurrentDay()
        loc = self.calendar.m_Location
        vc = p.date

        sb = GCStringBuilder(stream)
        sb.Format = SBTF_TEXT

        if (p == None): return

        stream.write("{} ({}, {}, Timezone: {})\r\n\r\n[{} - {}]\r\n  {}, {} {}\r\n  {} {}, {} Gaurabda\r\n\r\n".format(loc.m_strName, GCEarthData.GetTextLatitude(loc.m_fLatitude), GCEarthData.GetTextLongitude(loc.m_fLongitude), GCTimeZone.GetTimeZoneName(loc.m_nTimezoneId), vc, GCStrings.getString(vc.dayOfWeek), GCStrings.GetTithiName(p.astrodata.nTithi), GCStrings.GetPaksaName(p.astrodata.nPaksa), GCStrings.getString(20), GCStrings.GetMasaName(p.astrodata.nMasa), GCStrings.getString(22), p.astrodata.nGaurabdaYear))

        self.WriteTodayInfo(sb,p)