Пример #1
0
	def printMidPoints(self, mids):
		pls = ('Sun', 'Moon', 'Mercury', 'Venus', 'Mars', 'Jupiter', 'Saturn', 'Uranus', 'Neptune', 'Pluto', 'AscNode', 'DescNode')

		for x in mids:
			d,m,s = util.decToDeg(x.m)
			dl,ml,sl = util.decToDeg(x.lat)
			print "%s-%s: %d %d'%d\"  %d %d'%d\"" % (pls[x.p1], pls[x.p2], d,m,s, dl, ml, sl)
Пример #2
0
	def load(self, li):
		idx = 1
		for it in li:
			dirtxt = u'E'
			lon = it[geonames.Geonames.LON]
			if lon < 0.0:
				dirtxt = u'W'
				lon *= -1
			d, m, s = util.decToDeg(lon)
			lontxt = str(d).zfill(2)+dirtxt+str(m).zfill(2)

			dirtxt = u'N'
			lat = it[geonames.Geonames.LAT]
			if lat < 0.0:
				dirtxt = u'S'
				lat *= -1
			d, m, s = util.decToDeg(lat)
			lattxt = str(d).zfill(2)+dirtxt+str(m).zfill(2)

			gmtoffs = it[geonames.Geonames.GMTOFFS]
			signtxt = u'+'
			if gmtoffs < 0.0:
				signtxt = u'-'
				gmtoffs *= -1

			frac = int((gmtoffs-int(gmtoffs))*60.0)
			gmtoffstxt = signtxt+str(int(gmtoffs))+u':'+str(frac).zfill(2)

			self.placedata[idx] = (it[geonames.Geonames.NAME], it[geonames.Geonames.COUNTRYNAME], lontxt, lattxt, gmtoffstxt, str(it[geonames.Geonames.ALTITUDE]))
			idx += 1
Пример #3
0
	def getDateSecond(self, tim, place, newmoonorig):
		h, m, s = util.decToDeg(tim.time) 
		y, mo, d = tim.year, tim.month, tim.day
		y, mo, d, h, m = util.addMins(y, mo, d, h, m, 1)

		tim = chart.Time(y, mo, d, h, m, s, False, tim.cal, chart.Time.GREENWICH, True, 0, 0, False, place, False)

		while True:
			h, m, s = util.decToDeg(tim.time) 
			y, mo, d = tim.year, tim.month, tim.day
			y, mo, d, h, m, s = util.subtractSecs(y, mo, d, h, m, s, 1)
			if y == 0:
				y = 1
				tim = chart.Time(y, mo, d, h, m, s, False, tim.cal, chart.Time.GREENWICH, True, 0, 0, False, place, False)
				return True, tim, True

			tim = chart.Time(y, mo, d, h, m, s, False, tim.cal, chart.Time.GREENWICH, True, 0, 0, False, place, False)

			sun = planets.Planet(tim.jd, astrology.SE_SUN, self.flags)
			moon = planets.Planet(tim.jd, astrology.SE_MOON, self.flags)
			lonsun = sun.data[planets.Planet.LONG]
			lonmoon = moon.data[planets.Planet.LONG]

			d, m, s = util.decToDeg(lonsun)
			lonsun = d+m/60.0+s/3600.0
			d, m, s = util.decToDeg(lonmoon)
			lonmoon = d+m/60.0+s/3600.0

			diff = lonmoon-lonsun
			newmoon, ready = self.isNewMoon(diff)
			if newmoon != newmoonorig or ready:
				return True, tim, ready

		return False, tim
Пример #4
0
	def drawline(self, draw, x, y, clr, idx):
		#bottom horizontal line
		draw.line((x, y+self.LINE_HEIGHT, x+self.TABLE_WIDTH, y+self.LINE_HEIGHT), fill=clr)

		#vertical lines
		offs = (0, self.SMALL_CELL_WIDTH, self.BIG_CELL_WIDTH, self.CELL_WIDTH, self.CELL_WIDTH, self.CELL_WIDTH, self.CELL_WIDTH, self.CELL_WIDTH)

		OFFS = 2
		BOR = commonwnd.CommonWnd.BORDER
		summa = 0
		txtclr = (0,0,0)
		if not self.bw:
			txtclr = self.options.clrtexts
		for i in range(self.COLUMN_NUM+OFFS):#+1 is the leftmost column
			draw.line((x+summa+offs[i], y, x+summa+offs[i], y+self.LINE_HEIGHT), fill=clr)

			d, m, s = 0, 0, 0
			if i >= fixstars.FixStars.LON+OFFS:
				d,m,s = util.decToDeg(self.chart.fixstars.data[idx][i-OFFS])

			if i == 1:
				txt = str(idx+1)+'.'
				w,h = draw.textsize(txt, self.fntText)
				draw.text((x+summa+(offs[i]-w)/2, y+(self.LINE_HEIGHT-h)/2), txt, fill=txtclr, font=self.fntText)
			elif i == fixstars.FixStars.NAME+OFFS or i == fixstars.FixStars.NOMNAME+OFFS:
				txt = self.chart.fixstars.data[idx][i-OFFS]
				w,h = draw.textsize(txt, self.fntText)
				draw.text((x+summa+(offs[i]-w)/2, y+(self.LINE_HEIGHT-h)/2), txt, fill=txtclr, font=self.fntText)
			elif i == fixstars.FixStars.LON+OFFS:
				if self.options.ayanamsha != 0:
					lona = self.chart.fixstars.data[idx][i-OFFS]-self.chart.ayanamsha
					lona = util.normalize(lona)
					d,m,s = util.decToDeg(lona)
				sign = d/chart.Chart.SIGN_DEG
				pos = d%chart.Chart.SIGN_DEG
				wsp,hsp = draw.textsize(' ', self.fntText)
				txtsign = self.signs[sign]
				wsg,hsg = draw.textsize(txtsign, self.fntMorinus)
				txt = (str(pos)).rjust(2)+self.deg_symbol+(str(m)).zfill(2)+"'"+(str(s)).zfill(2)+'"'
				w,h = draw.textsize(txt, self.fntText)
				offset = (offs[i]-(w+wsp+wsg))/2
				draw.text((x+summa+offset, y+(self.LINE_HEIGHT-h)/2), txt, fill=txtclr, font=self.fntText)
				draw.text((x+summa+offset+w+wsp, y+(self.LINE_HEIGHT-h)/2), txtsign, fill=txtclr, font=self.fntMorinus)
			elif i == fixstars.FixStars.LAT+OFFS or i == fixstars.FixStars.DECL+OFFS:
				sign = ''
				if self.chart.fixstars.data[idx][i-2] < 0.0:
					sign = '-'
				txt = sign+(str(d)).rjust(2)+self.deg_symbol+(str(m)).zfill(2)+"'"+(str(s)).zfill(2)+'"'
				w,h = draw.textsize(txt, self.fntText)
				draw.text((x+summa+(offs[i]-w)/2, y+(self.LINE_HEIGHT-h)/2), txt, fill=txtclr, font=self.fntText)
			elif i == fixstars.FixStars.RA+OFFS:
				txt = str(d)+self.deg_symbol+(str(m)).zfill(2)+"'"+(str(s)).zfill(2)+'"'
				if self.options.intime:
					d,m,s = util.decToDeg( self.chart.fixstars.data[idx][i-2]/15.0)
					txt = (str(d)).rjust(2)+':'+(str(m)).zfill(2)+":"+(str(s)).zfill(2)
				w,h = draw.textsize(txt, self.fntText)
				draw.text((x+summa+(offs[i]-w)/2, y+(self.LINE_HEIGHT-h)/2), txt, fill=txtclr, font=self.fntText)

			summa += offs[i]
Пример #5
0
	def fillFields(self, it):
		self.birthplace.SetValue(it[geonames.Geonames.NAME])

		#lon
		east = True
		lon = it[geonames.Geonames.LON]
		if lon < 0.0:
			east = False
			lon *= -1
			
		d, m, s = util.decToDeg(lon)
		self.londeg.SetValue(str(d))
		self.lonmin.SetValue(str(m))
		if east:
			self.placerbE.SetValue(True)
		else:
			self.placerbW.SetValue(True)

		#lat
		north = True
		lat = it[geonames.Geonames.LAT]
		if lat < 0.0:
			north = False
			lat *= -1
			
		d, m, s = util.decToDeg(lat)
		self.latdeg.SetValue(str(d))
		self.latmin.SetValue(str(m))
		if north:
			self.placerbN.SetValue(True)
		else:
			self.placerbS.SetValue(True)

		#zone
		plus = True
		gmtoffs = it[geonames.Geonames.GMTOFFS]
		if gmtoffs < 0.0:
			plus = False
			gmtoffs *= -1

		gmtoffshour = int(gmtoffs)
		gmtoffsmin = int((gmtoffs-gmtoffshour)*60.0)

		self.zhour.SetValue(str(gmtoffshour))
		self.zminute.SetValue(str(gmtoffsmin))
		
		val = 0
		if not plus:
			val = 1
		self.pluscb.SetStringSelection(PlacesDlg.PLUSCHOICES[val])

		#altitude
		alt = int(it[geonames.Geonames.ALTITUDE])
		if alt < 0:
			alt = 0

		self.alt.SetValue(str(alt))
Пример #6
0
	def drawlinelof(self, draw, x, y, name, data, clr, idx):
		#bottom horizontal line
		draw.line((x, y+self.LINE_HEIGHT, x+self.TABLE_WIDTH_ARABIAN, y+self.LINE_HEIGHT), fill=clr)

		#vertical lines
		offs = (0, self.CELL_WIDTH, self.CELL_WIDTH, self.CELL_WIDTH, self.CELL_WIDTH, self.CELL_WIDTH)

		BOR = commonwnd.CommonWnd.BORDER
		summa = 0
		txtclr = (0,0,0)
		if not self.bw:
			txtclr = self.options.clrtexts
		for i in range(self.COLUMN_NUM_ARABIAN+1+1):#+1 is the leftmost column
			draw.line((x+summa+offs[i], y, x+summa+offs[i], y+self.LINE_HEIGHT), fill=clr)

			d, m, s = 0, 0, 0
			if i > 1:
				d,m,s = util.decToDeg(data[i-2])

			if i == 1:
				w,h = draw.textsize(name, self.fntText)
				draw.text((x+summa+(offs[i]-w)/2, y+(self.LINE_HEIGHT-h)/2), name, fill=txtclr, font=self.fntText)
			elif i == 2:
				if self.options.ayanamsha != 0:
					lona = data[i-2]-self.chart.ayanamsha
					lona = util.normalize(lona)
					d,m,s = util.decToDeg(lona)

				sign = d/chart.Chart.SIGN_DEG
				pos = d%chart.Chart.SIGN_DEG
				wsp,hsp = draw.textsize(' ', self.fntText)
				txtsign = self.signs[sign]
				wsg,hsg = draw.textsize(txtsign, self.fntMorinus)
				txt = (str(pos)).rjust(2)+self.deg_symbol+(str(m)).zfill(2)+"'"+(str(s)).zfill(2)+'"'
				w,h = draw.textsize(txt, self.fntText)
				offset = (offs[i]-(w+wsp+wsg))/2
				draw.text((x+summa+offset, y+(self.LINE_HEIGHT-h)/2), txt, fill=txtclr, font=self.fntText)
				draw.text((x+summa+offset+w+wsp, y+(self.LINE_HEIGHT-h)/2), txtsign, fill=txtclr, font=self.fntMorinus)
			elif i == 3 or i == 5:
				sign = ''
				if data[i-2] < 0.0:
					sign = '-'
				txt = sign+(str(d)).rjust(2)+self.deg_symbol+(str(m)).zfill(2)+"'"+(str(s)).zfill(2)+'"'
				w,h = draw.textsize(txt, self.fntText)
				draw.text((x+summa+(offs[i]-w)/2, y+(self.LINE_HEIGHT-h)/2), txt, fill=txtclr, font=self.fntText)
			elif i == 4:
				txt = str(d)+self.deg_symbol+(str(m)).zfill(2)+"'"+(str(s)).zfill(2)+'"'
				if self.options.intime:
					d,m,s = util.decToDeg(data[i-2]/15.0)
					txt = (str(d)).rjust(2)+':'+(str(m)).zfill(2)+":"+(str(s)).zfill(2)
				w,h = draw.textsize(txt, self.fntText)
				draw.text((x+summa+(offs[i]-w)/2, y+(self.LINE_HEIGHT-h)/2), txt, fill=txtclr, font=self.fntText)

			summa += offs[i]
Пример #7
0
    def drawAscMCPos(self):  # Not used
        (cx, cy) = self.center.Get()
        clrpos = self.options.clrpositions
        if self.bw:
            clrpos = (0, 0, 0)
        for i in range(2):
            lon = self.chart.houses.ascmc[i]
            if self.options.ayanamsha != 0:
                lon -= self.chartRadix.ayanamsha
                lon = util.normalize(lon)

            (d, m, s) = util.decToDeg(lon)
            d = d % chart.Chart.SIGN_DEG
            # 			d, m = util.roundDeg(d%chart.Chart.SIGN_DEG, m, s)

            wdeg, hdeg = self.draw.textsize(str(d), self.fntText)
            wmin, hmin = self.draw.textsize((str(m).zfill(2)), self.fntSmallText)
            x = (
                cx
                + math.cos(
                    math.pi + math.radians(self.chart.houses.ascmc[houses.Houses.ASC] - self.chart.houses.ascmc[i])
                )
                * self.rPosAscMC
            )
            y = (
                cy
                + math.sin(
                    math.pi + math.radians(self.chart.houses.ascmc[houses.Houses.ASC] - self.chart.houses.ascmc[i])
                )
                * self.rPosAscMC
            )
            xdeg = x - wdeg / 2
            ydeg = y - hdeg / 2
            self.draw.text((xdeg, ydeg), str(d), fill=clrpos, font=self.fntText)
            self.draw.text((xdeg + wdeg, ydeg), (str(m)).zfill(2), fill=clrpos, font=self.fntSmallText)
Пример #8
0
	def drawline(self, draw, x, y, clr, idx):
		#bottom horizontal line
		draw.line((x, y+self.LINE_HEIGHT, x+self.TABLE_WIDTH, y+self.LINE_HEIGHT), fill=clr)

		#vertical lines
		offs = (0, self.SMALL_CELL_WIDTH, self.CELL_WIDTH, self.CELL_WIDTH, self.CELL_WIDTH, self.CELL_WIDTH)

		BOR = commonwnd.CommonWnd.BORDER
		summa = 0
		for i in range(self.COLUMN_NUM+1+1):#+1 is the leftmost column
			draw.line((x+summa+offs[i], y, x+summa+offs[i], y+self.LINE_HEIGHT), fill=clr)

			tclr = (0, 0, 0)
			if not self.bw:
				if self.options.useplanetcolors:
					tclr = self.options.clrindividual[idx]
				else:
					dign = self.chart.dignity(idx)
					tclr = self.clrs[dign]

			if i == 1:
				txt = common.common.Planets[idx]
				w,h = draw.textsize(txt, self.fntMorinus)
				draw.text((x+summa+(offs[i]-w)/2, y+(self.LINE_HEIGHT-h)/2), txt, fill=tclr, font=self.fntMorinus)
			elif i != 0:
				h,m,s = util.decToDeg(self.chart.riseset.times[idx][i-2])
				txt = (str(h)).zfill(2)+':'+(str(m)).zfill(2)+':'+(str(s)).zfill(2)
				w,h = draw.textsize(txt, self.fntText)
				draw.text((x+summa+(offs[i]-w)/2, y+(self.LINE_HEIGHT-h)/2), txt, fill=tclr, font=self.fntText)

			summa += offs[i]
	def show(self, y, m, d, t, cnt):
		proftype = chart.Chart.YEAR
		if self.zodprofs:
			prof = profections.Profections(self.chart, y, m, d, t, cnt)
			pchart = chart.Chart(self.chart.name, self.chart.male, self.chart.time, self.chart.place, chart.Chart.PROFECTION, '', self.options, False, proftype)
			pchart.calcProfPos(prof)
		else:
			if not self.usezodprojs and (y+cnt == self.chart.time.year or (y+cnt-self.chart.time.year) % 12 == 0) and m == self.chart.time.month and d == self.chart.time.day:
				pchart = self.chart
			else:
				prof = munprofections.MunProfections(self.chart, y, m, d, t, cnt)
				proflondeg, proflonmin, proflonsec = util.decToDeg(prof.lonZ)
				profplace = chart.Place(mtexts.txts['Profections'], proflondeg, proflonmin, proflonsec, prof.east, self.chart.place.deglat, self.chart.place.minlat, self.chart.place.seclat, self.chart.place.north, self.chart.place.altitude)
				pchart = chart.Chart(self.chart.name, self.chart.male, self.chart.time, profplace, chart.Chart.PROFECTION, '', self.options, False, proftype, self.options.usezodprojsprof)
				pchartpls = chart.Chart(self.chart.name, self.chart.male, self.chart.time, self.chart.place, chart.Chart.PROFECTION, '', self.options, False, proftype, self.options.usezodprojsprof)
				#modify planets, ...
				pchart.planets.calcMundaneProfPos(pchart.houses.ascmc2, pchartpls.planets.planets, self.chart.place.lat, self.chart.obl[0])

				#modify lof
				pchart.fortune.calcMundaneProfPos(pchart.houses.ascmc2, pchartpls.fortune, self.chart.place.lat, self.chart.obl[0])

				#recalc AspMatrix
				pchart.calcAspMatrix()

		self.parent.change(pchart, self.caption, y+cnt, m, d, t)
		self.yeartxt.SetValue(str(y+cnt))
		self.monthtxt.SetValue(str(m))
		if self.zodprofs or self.usezodprojs:
			self.daytxt.SetValue(str(d))
Пример #10
0
	def OnAdd(self, fnd):
		datstr = str(fnd[0])+'.'+str(fnd[1])+'.'+str(fnd[2])
		h, m, s = util.decToDeg(fnd[3])
		timstr = str(h).zfill(2)+':'+str(m).zfill(2)+':'+str(s).zfill(2)
		item = [datstr, timstr]

		self.li.OnAdd(item)
Пример #11
0
	def createTransit(self, year, month, trans):
		self.t[0] = year
		self.t[1] = month
		self.t[2] = trans.transits[0].day
		h, m, s = util.decToDeg(trans.transits[0].time)
		self.t[3] = h
		self.t[4] = m
		self.t[5] = s
Пример #12
0
	def createRevolution(self, year, month, trans, num = 0):
		self.t[0] = year
		self.t[1] = month
		self.t[2] = trans.transits[num].day
		h, m, s = util.decToDeg(trans.transits[num].time)
		self.t[3] = h
		self.t[4] = m
		self.t[5] = s
Пример #13
0
	def printRiseSet(self, pls):
		numangles = len(RiseSet.Angles)
		txt = [mtexts.txtsriseset['Rise'], mtexts.txtsriseset['MC'], mtexts.txtsriseset['Set'], mtexts.txtsriseset['IC']]
		print ''
		print 'Rise/Set times:'
		for i in range(planets.Planets.PLANETS_NUM):#Nodes are excluded
			for angle in range(numangles):
				h,m,s = util.decToDeg(self.times[i][angle])
				print "%s: %s: %02d:%02d:%02d" % (pls.planets[i].name, txt[angle], h, m, s)
	def onDecrDay(self, event):
		h, mi, s = util.decToDeg(self.t)
		yt, mt, dt = util.decrDay(self.y+self.cnt, self.m, self.d)
		tim = chart.Time(yt, mt, dt, h, mi, s, self.chart.time.bc, self.chart.time.cal, self.chart.time.zt, self.chart.time.plus, self.chart.time.zh, self.chart.time.zm, self.chart.time.daylightsaving, self.chart.place, False)
		if tim.jd > self.chart.time.jd:
			y, self.m, self.d = util.decrDay(self.y+self.cnt, self.m, self.d)
			if y != self.y+self.cnt:
				self.cnt -=1
			self.show(self.y, self.m, self.d, self.t, self.cnt)
Пример #15
0
	def read(self):
		res = True

		try:
			f = open(self.fname, 'r')
			lines = f.readlines()
			f.close()

			#Count non-comment lines
			cnt = 0
			for ln in lines:
				if ln[0] == FixStars.COMMENT and ln.find('example') != -1:
					break

				if ln[0] != FixStars.COMMENT:
					cnt += 1

			for i in range(1, cnt+1):
				ret, name, dat, serr = astrology.swe_fixstar_ut(str(i), self.jd, 0)
				d, m, s = util.decToDeg(dat[0])
				sign = d/chart.Chart.SIGN_DEG
				lon = d%chart.Chart.SIGN_DEG
				lontxt = str(lon)+FixStars.signtxts[sign]+' '+(str(m)).zfill(2)+"' "+(str(s)).zfill(2)+'"'
				d, m, s = util.decToDeg(dat[1])
				si = ''
				if dat[1] < 0.0:
					si = '-'
				lattxt = si+str(d)+' '+(str(m)).zfill(2)+"' "+(str(s)).zfill(2)+'"'

				nam = name[0].strip()
				nomnam = ''
				DELIMITER = ','
				if nam.find(DELIMITER) != -1:
					snam = nam.split(DELIMITER)
					nam = snam[0].strip()
					nomnam = snam[1].strip()
					
				self.data.append(FixStars.FixStar(nam, nomnam, lontxt, lattxt))

		except IOError:
			res = False
			pass

		return res
Пример #16
0
	def change(self, chrt, title, y, m, d, t):
		self.chart = chrt
		self.w.chart = chrt
		self.w.drawBkg()
		self.w.Refresh()

		#Update Caption
		h, mi, s = util.decToDeg(t)
		title = title.replace(mtexts.txts['Radix'], mtexts.txts['Profections']+' ('+str(y)+'.'+common.common.months[m-1]+'.'+str(d)+' '+str(h)+':'+str(mi).zfill(2)+':'+str(s).zfill(2)+')')
		self.SetTitle(title)
Пример #17
0
	def drawline(self, draw, x, y, data, clr, idx):
		#bottom horizontal line
		draw.line((x, y+self.LINE_HEIGHT, x+self.TABLE_WIDTH, y+self.LINE_HEIGHT), fill=clr)

		#vertical lines
		offs = (0, self.CELL_WIDTH, self.CELL_WIDTH, self.CELL_WIDTH, self.CELL_WIDTH, self.CELL_WIDTH)

		BOR = commonwnd.CommonWnd.BORDER
		summa = 0
		txtclr = (0,0,0)
		if not self.bw:
			txtclr = self.options.clrtexts

		for i in range(self.COLUMN_NUM+1+1):#+1 is the leftmost column
			draw.line((x+summa+offs[i], y, x+summa+offs[i], y+self.LINE_HEIGHT), fill=clr)

			if i == arabicparts.ArabicParts.NAME:
				name = data[idx][i]
				w,h = draw.textsize(name, self.fntText)
				draw.text((x+summa+(offs[i+1]-w)/2, y+(self.LINE_HEIGHT-h)/2), data[idx][i], fill=txtclr, font=self.fntText)
			elif i == arabicparts.ArabicParts.FORMULA:
				A = mtexts.partstxts[data[idx][1][0]]
				B = mtexts.partstxts[data[idx][1][1]]
				C = mtexts.partstxts[data[idx][1][2]]

				if data[idx][arabicparts.ArabicParts.DIURNAL] and not self.chart.planets.planets[astrology.SE_SUN].abovehorizon:
					tmp = C
					C = B
					B = tmp

				formula = A+u' + '+B+u' - '+C

				w,h = draw.textsize(formula, self.fntText)
				draw.text((x+summa+self.CELL_WIDTH+(offs[i]-w)/2, y+(self.LINE_HEIGHT-h)/2), formula, fill=txtclr, font=self.fntText)
			elif i == arabicparts.ArabicParts.LONG:
				lon = data[idx][i]
				if self.options.ayanamsha != 0:
					lon = lon-self.chart.ayanamsha
					lon = util.normalize(lon)
				d,m,s = util.decToDeg(lon)

				sign = d/chart.Chart.SIGN_DEG
				pos = d%chart.Chart.SIGN_DEG
				wsp,hsp = draw.textsize(' ', self.fntText)
				txtsign = self.signs[sign]
				wsg,hsg = draw.textsize(txtsign, self.fntMorinus)
				txt = (str(pos)).rjust(2)+self.deg_symbol+(str(m)).zfill(2)+"'"+(str(s)).zfill(2)+'"'
				w,h = draw.textsize(txt, self.fntText)
				offset = (offs[i]-(w+wsp+wsg))/2
				draw.text((x+summa+offset, y+(self.LINE_HEIGHT-h)/2), txt, fill=txtclr, font=self.fntText)
				draw.text((x+summa+offset+w+wsp, y+(self.LINE_HEIGHT-h)/2), txtsign, fill=txtclr, font=self.fntMorinus)
			elif i == arabicparts.ArabicParts.DEGWINNER:
				self.drawDegWinner2(draw, x+summa, y, data[idx][i], txtclr)

			summa += offs[i]
Пример #18
0
	def drawline(self, draw, x, y, clr, pcharts, age, idx):
		#bottom horizontal line
		draw.line((x, y+self.LINE_HEIGHT, x+self.TABLE_WIDTH, y+self.LINE_HEIGHT), fill=clr)

		#vertical lines
		offs = (self.CELL_WIDTH, self.BIG_CELL_WIDTH, self.BIG_CELL_WIDTH, self.BIG_CELL_WIDTH, self.BIG_CELL_WIDTH, self.BIG_CELL_WIDTH, self.BIG_CELL_WIDTH, self.BIG_CELL_WIDTH, self.BIG_CELL_WIDTH, self.BIG_CELL_WIDTH, self.BIG_CELL_WIDTH, self.BIG_CELL_WIDTH, self.BIG_CELL_WIDTH, self.BIG_CELL_WIDTH, self.BIG_CELL_WIDTH)

		BOR = commonwnd.CommonWnd.BORDER
		draw.line((x, y, x, y+self.LINE_HEIGHT), fill=clr)
		summa = 0
		for i in range(self.COLUMN_NUM):
			draw.line((x+summa+offs[i], y, x+summa+offs[i], y+self.LINE_HEIGHT), fill=clr)

			tclr = (0, 0, 0)
			if not self.bw:
				txtclr = self.options.clrtexts

			if i == ProfectionsWnd.AGE:
				txt = str(age+idx)
				w,h = draw.textsize(txt, self.fntText)
				draw.text((x+summa+(offs[i]-w)/2, y+(self.LINE_HEIGHT-h)/2), txt, fill=tclr, font=self.fntText)
			elif i == ProfectionsWnd.DATE:
				txt = str(pcharts[1])+'.'+str(pcharts[2]).zfill(2)+'.'+str(pcharts[3]).zfill(2)+'.'
				w,h = draw.textsize(txt, self.fntText)
				draw.text((x+summa+(offs[i]-w)/2, y+(self.LINE_HEIGHT-h)/2), txt, fill=tclr, font=self.fntText)
			else:
				if i == ProfectionsWnd.ASC:
					lon = pcharts[0].houses.ascmc[houses.Houses.ASC]
				if i == ProfectionsWnd.MC:
					lon = pcharts[0].houses.ascmc[houses.Houses.MC]
				if i == ProfectionsWnd.SUN:
					lon = pcharts[0].planets.planets[astrology.SE_SUN].data[planets.Planet.LONG]
				if i == ProfectionsWnd.MOON:
					lon = pcharts[0].planets.planets[astrology.SE_MOON].data[planets.Planet.LONG]
				if i == ProfectionsWnd.FORTUNE:
					lon = pcharts[0].fortune.fortune[fortune.Fortune.LON]
				if i >= ProfectionsWnd.MERCURY:
					lon = pcharts[0].planets.planets[i-5].data[planets.Planet.LONG]
				if self.options.ayanamsha != 0:
					lon -= self.chart.ayanamsha
					lon = util.normalize(lon)
				d,m,s = util.decToDeg(lon)
				sign = d/chart.Chart.SIGN_DEG
				pos = d%chart.Chart.SIGN_DEG
				wsp,hsp = draw.textsize(' ', self.fntText)
				wsg,hsg = draw.textsize(self.signs[sign], self.fntMorinus)
				txt = (str(pos)).rjust(2)+self.deg_symbol+(str(m)).zfill(2)+"'"+(str(s)).zfill(2)+'"'
				w,h = draw.textsize(txt, self.fntText)
				offset = (offs[i]-(w+wsp+wsg))/2
				draw.text((x+summa+offset, y+(self.LINE_HEIGHT-h)/2), txt, fill=tclr, font=self.fntText)
				draw.text((x+summa+offset+w+wsp, y+(self.LINE_HEIGHT-hsg)/2), self.signs[sign], fill=tclr, font=self.fntMorinus)

			summa += offs[i]
Пример #19
0
	def printTransits(self, ls):
		planets = ('Sun', 'Moon', 'Mercury', 'Venus', 'Mars', 'Jupiter', 'Saturn', 'Uranus', 'Neptune', 'Pluto')
		asps = ['conjunctio', 'semisextil', 'semiquadrat', 'sextil', 'quintile', 'quadrat', 'trigon', 'sesquiquadrat', 'biquintile', 'qinqunx', 'oppositio']
		signs = ['Aries', 'Taurus', 'Gemini', 'Cancer', 'Leo', 'Virgo', 'Libra', 'Scorpio', 'Sagittarius', 'Capricornus', 'Aquarius', 'Pisces']
		ascmc = ['Asc', 'MC']

		for tr in ls:
			d, m, s = util.decToDeg(tr.time)
			if tr.objtype == Transit.PLANET:
				print 'day %d: %s %s %s house:%d %d:%02d:%02d' % (tr.day, planets[tr.plt], asps[tr.aspect], planets[tr.obj], tr.house+1, d, m, s)
			elif tr.objtype == Transit.ASCMC:
				print 'day %d: %s %s %s house:%d %d:%02d:%02d' % (tr.day, planets[tr.plt], asps[tr.aspect], ascmc[tr.obj], tr.house+1, d, m, s)
			else:
				print 'day %d: %s %s house:%d %d:%02d:%02d' % (tr.day, planets[tr.plt], signs[tr.obj], tr.house+1, d, m, s)
Пример #20
0
	def drawLong(self, draw, x, y, lon, clr):
		if self.options.ayanamsha != 0:
			lon -= self.chart.ayanamsha
			lon = util.normalize(lon)

		d,m,s = util.decToDeg(lon)

		sign = d/chart.Chart.SIGN_DEG
		pos = d%chart.Chart.SIGN_DEG
		wsp,hsp = draw.textsize(' ', self.fntText)
		wsg,hsg = draw.textsize(self.signs[sign], self.fntMorinus)
		txt = (str(pos)).rjust(2)+self.deg_symbol+(str(m)).zfill(2)+"'"+(str(s)).zfill(2)+'"'
		w,h = draw.textsize(txt, self.fntText)
		offset = (self.LONGITUDE_CELL_WIDTH-(w+wsp+wsg))/2
		draw.text((x+offset, y+(self.LINE_HEIGHT-h)/2), txt, fill=clr, font=self.fntText)
		draw.text((x+offset+w+wsp, y+(self.LINE_HEIGHT-hsg)/2), self.signs[sign], fill=clr, font=self.fntMorinus)
Пример #21
0
    def drawline(self, draw, x, y, clr, idx):
        # bottom horizontal line
        draw.line((x, y + self.LINE_HEIGHT, x + self.TABLE_WIDTH, y + self.LINE_HEIGHT), fill=clr)

        # vertical lines
        offs = (0, self.SMALL_CELL_WIDTH, self.CELL_WIDTH, self.CELL_WIDTH, self.CELL_WIDTH)

        BOR = commonwnd.CommonWnd.BORDER
        summa = 0
        for i in range(self.COLUMN_NUM + 1 + 1):  # +1 is the leftmost column
            draw.line((x + summa + offs[i], y, x + summa + offs[i], y + self.LINE_HEIGHT), fill=clr)

            tclr = (0, 0, 0)
            if not self.bw:
                if self.options.useplanetcolors:
                    objidx = idx
                    if objidx > astrology.SE_MEAN_NODE:
                        objidx = astrology.SE_MEAN_NODE
                    tclr = self.options.clrindividual[objidx]
                else:
                    dign = self.chart.dignity(idx)
                    tclr = self.clrs[dign]

            if i == 1:
                txt = common.common.Planets[idx]
                w, h = draw.textsize(txt, self.fntMorinus)
                draw.text(
                    (x + summa + (offs[i] - w) / 2, y + (self.LINE_HEIGHT - h) / 2),
                    txt,
                    fill=tclr,
                    font=self.fntMorinus,
                )
            elif i != 0:
                data = self.chart.planets.planets[idx].data[planets.Planet.SPLON + (i - 2)]
                d, m, s = util.decToDeg(data)
                sign = ""
                if data < 0.0:
                    sign = "-"
                txt = sign + (str(d)).rjust(2) + self.deg_symbol + (str(m)).zfill(2) + "'" + (str(s)).zfill(2) + '"'
                w, h = draw.textsize(txt, self.fntText)
                draw.text(
                    (x + summa + (offs[i] - w) / 2, y + (self.LINE_HEIGHT - h) / 2), txt, fill=tclr, font=self.fntText
                )

            summa += offs[i]
	def show(self, age):
		wait = wx.BusyCursor()
		y = self.chart.time.year#+age
		m = self.chart.time.month
		d = self.chart.time.day
		t = self.chart.time.time

		if self.feb29:
			d -= 1

		self.agetxt.SetValue(str(age))

		pcharts = []

		cyc = 0
		while(cyc < 12):
			if self.zodiacalprofs:
				prof = profections.Profections(self.chart, y, m, d, t, age+cyc)
				pchart = chart.Chart(self.chart.name, self.chart.male, self.chart.time, self.chart.place, chart.Chart.PROFECTION, '', self.options, False, self.proftype)
				pchart.calcProfPos(prof)
			else:
				if not self.usezodprojs and (y+age+cyc == self.chart.time.year or (y+age+cyc-self.chart.time.year) % 12 == 0) and m == self.chart.time.month and d == self.chart.time.day:
					pchart = self.chart
				else:
					prof = munprofections.MunProfections(self.chart, y+age+cyc, m, d, t)
					proflondeg, proflonmin, proflonsec = util.decToDeg(prof.lonZ)
					profplace = chart.Place(mtexts.txts['Profections'], proflondeg, proflonmin, proflonsec, prof.east, self.chart.place.deglat, self.chart.place.minlat, self.chart.place.seclat, self.chart.place.north, self.chart.place.altitude)
					pchart = chart.Chart(self.chart.name, self.chart.male, self.chart.time, profplace, chart.Chart.PROFECTION, '', self.options, False, self.proftype, self.options.usezodprojsprof)
					pchartpls = chart.Chart(self.chart.name, self.chart.male, self.chart.time, self.chart.place, chart.Chart.PROFECTION, '', self.options, False, self.proftype, self.options.usezodprojsprof)
					#modify planets, ...
					pchart.planets.calcMundaneProfPos(pchart.houses.ascmc2, pchartpls.planets.planets, self.chart.place.lat, self.chart.obl[0])
	
					#modify lof
					pchart.fortune.calcMundaneProfPos(pchart.houses.ascmc2, pchartpls.fortune, self.chart.place.lat, self.chart.obl[0])
	
			pcharts.append((pchart, y+age+cyc, m, d, t))
			cyc += 1

		self.parent.change(age, pcharts, self.options)
Пример #23
0
    def drawHousePos(self):  # Not used
        (cx, cy) = self.center.Get()
        clrpos = self.options.clrpositions
        if self.bw:
            clrpos = (0, 0, 0)
        skipasc = False
        skipmc = False
        if self.chart.houses.cusps[1] == self.chart.houses.ascmc[houses.Houses.ASC]:
            skipasc = True
        if self.chart.houses.cusps[10] == self.chart.houses.ascmc[houses.Houses.MC]:
            skipmc = True

        asc = self.chart.houses.ascmc[houses.Houses.ASC]
        if self.options.ayanamsha != 0 and self.options.hsys == "W":
            asc = util.normalize(self.chart.houses.ascmc[houses.Houses.ASC] - self.chartRadix.ayanamsha)
        for i in range(1, houses.Houses.HOUSE_NUM + 1):
            if i >= 4 and i < 10:
                continue
            if (skipasc and i == 1) or (skipmc and i == 10):
                continue

            lon = self.chart.houses.cusps[i]
            if self.options.ayanamsha != 0 and self.options.hsys != "W":
                lon -= self.chartRadix.ayanamsha
                lon = util.normalize(lon)
            (d, m, s) = util.decToDeg(lon)
            d = d % chart.Chart.SIGN_DEG
            # 			d, m = util.roundDeg(d%chart.Chart.SIGN_DEG, m, s)

            wdeg, hdeg = self.draw.textsize(str(d), self.fntText)
            wmin, hmin = self.draw.textsize((str(m).zfill(2)), self.fntSmallText)
            x = cx + math.cos(math.pi + math.radians(asc - self.chart.houses.cusps[i])) * self.rPosHouses
            y = cy + math.sin(math.pi + math.radians(asc - self.chart.houses.cusps[i])) * self.rPosHouses
            xdeg = x - wdeg / 2
            ydeg = y - hdeg / 2
            self.draw.text((xdeg, ydeg), str(d), fill=clrpos, font=self.fntText)
            self.draw.text((xdeg + wdeg, ydeg), (str(m)).zfill(2), fill=clrpos, font=self.fntSmallText)
Пример #24
0
	def drawline(self, draw, x, y, idx, txt, data, clr):
		#bottom horizontal line
		draw.line((x, y+self.LINE_HEIGHT, x+self.TABLE_WIDTH, y+self.LINE_HEIGHT), fill=clr)

		#vertical lines
		offs = (0, self.SMALL_CELL_WIDTH, self.CELL_WIDTH, self.CELL_WIDTH, self.CELL_WIDTH, self.CELL_WIDTH)

		summa = 0
		for i in range(self.COLUMN_NUM+1+1):#+1 is the leftmost column
			draw.line((x+summa+offs[i], y, x+summa+offs[i], y+self.LINE_HEIGHT), fill=clr)
			summa += offs[i]

		#draw symbols
		clr = (0,0,0)
		if not self.bw:
			if self.options.useplanetcolors:
				clr = self.options.clrindividual[idx]
			else:
				dign = self.chart.dignity(idx)
				clr = self.clrs[dign]

		w,h = draw.textsize(txt[idx], self.fntMorinus)
		offset = (self.SMALL_CELL_WIDTH-w)/2
		draw.text((x+offset, y+(self.LINE_HEIGHT-h)/2), txt[idx], fill=clr, font=self.fntMorinus)

		#arrange data in order(parallel, contraparallel)
		dataord = []
		for i in range(len(data)):
			if data[i][0] == -1.0:
				break
			if data[i][1] == chart.Chart.PARALLEL:
				dataord.append(data[i][0])

		if len(dataord) < 2:
			dataord.append(-1.0)
			if len(dataord) < 2:
				dataord.append(-1.0)

		for i in range(len(data)):
			if data[i][0] == -1.0:
				break
			if data[i][1] == chart.Chart.CONTRAPARALLEL:
				dataord.append(data[i][0])

		if len(dataord) < 4:
			dataord.append(-1.0)
			if len(dataord) < 4:
				dataord.append(-1.0)

		#data
		offs = (self.CELL_WIDTH, self.CELL_WIDTH, self.CELL_WIDTH, self.CELL_WIDTH)
		summa = 0
		for i in range(len(dataord)):
			if dataord[i] == -1:
				summa += offs[i]
				continue

			d,m,s = util.decToDeg(dataord[i])
			if self.options.ayanamsha != 0:
				lona = dataord[i]-self.chart.ayanamsha
				lona = util.normalize(lona)
				d,m,s = util.decToDeg(lona)

			sign = d/chart.Chart.SIGN_DEG
			pos = d%chart.Chart.SIGN_DEG
			wsp,hsp = draw.textsize(' ', self.fntText)
			wsg,hsg = draw.textsize(self.signs[sign], self.fntMorinus)
			txt = (str(pos)).rjust(2)+self.deg_symbol+(str(m)).zfill(2)+"'"+(str(s)).zfill(2)+'"'
			w,h = draw.textsize(txt, self.fntText)
			offset = (offs[i]-(w+wsp+wsg))/2
			draw.text((x+self.SMALL_CELL_WIDTH+summa+offset, y+(self.LINE_HEIGHT-h)/2), txt, fill=clr, font=self.fntText)
			draw.text((x+self.SMALL_CELL_WIDTH+summa+offset+w+wsp, y+(self.LINE_HEIGHT-hsg)/2), self.signs[sign], fill=clr, font=self.fntMorinus)

			summa += offs[i]
Пример #25
0
    def drawline(self, draw, x, y, clr, pcharts, age, idx):
        #bottom horizontal line
        draw.line((x, y + self.LINE_HEIGHT, x + self.TABLE_WIDTH,
                   y + self.LINE_HEIGHT),
                  fill=clr)

        #vertical lines
        offs = (self.CELL_WIDTH, self.BIG_CELL_WIDTH, self.BIG_CELL_WIDTH,
                self.BIG_CELL_WIDTH, self.BIG_CELL_WIDTH, self.BIG_CELL_WIDTH,
                self.BIG_CELL_WIDTH, self.BIG_CELL_WIDTH, self.BIG_CELL_WIDTH,
                self.BIG_CELL_WIDTH, self.BIG_CELL_WIDTH, self.BIG_CELL_WIDTH,
                self.BIG_CELL_WIDTH, self.BIG_CELL_WIDTH, self.BIG_CELL_WIDTH)

        BOR = commonwnd.CommonWnd.BORDER
        draw.line((x, y, x, y + self.LINE_HEIGHT), fill=clr)
        summa = 0
        for i in range(self.COLUMN_NUM):
            draw.line((x + summa + offs[i], y, x + summa + offs[i],
                       y + self.LINE_HEIGHT),
                      fill=clr)

            tclr = (0, 0, 0)
            if not self.bw:
                txtclr = self.options.clrtexts

            if i == ProfectionsWnd.AGE:
                txt = str(age + idx)
                w, h = draw.textsize(txt, self.fntText)
                draw.text((x + summa + (offs[i] - w) / 2, y +
                           (self.LINE_HEIGHT - h) / 2),
                          txt,
                          fill=tclr,
                          font=self.fntText)
            elif i == ProfectionsWnd.DATE:
                txt = str(pcharts[1]) + '.' + str(
                    pcharts[2]).zfill(2) + '.' + str(pcharts[3]).zfill(2) + '.'
                w, h = draw.textsize(txt, self.fntText)
                draw.text((x + summa + (offs[i] - w) / 2, y +
                           (self.LINE_HEIGHT - h) / 2),
                          txt,
                          fill=tclr,
                          font=self.fntText)
            else:
                if i == ProfectionsWnd.ASC:
                    lon = pcharts[0].houses.ascmc[houses.Houses.ASC]
                if i == ProfectionsWnd.MC:
                    lon = pcharts[0].houses.ascmc[houses.Houses.MC]
                if i == ProfectionsWnd.SUN:
                    lon = pcharts[0].planets.planets[astrology.SE_SUN].data[
                        planets.Planet.LONG]
                if i == ProfectionsWnd.MOON:
                    lon = pcharts[0].planets.planets[astrology.SE_MOON].data[
                        planets.Planet.LONG]
                if i == ProfectionsWnd.FORTUNE:
                    lon = pcharts[0].fortune.fortune[fortune.Fortune.LON]
                if i >= ProfectionsWnd.MERCURY:
                    lon = pcharts[0].planets.planets[i - 5].data[
                        planets.Planet.LONG]
                if self.options.ayanamsha != 0:
                    lon -= self.chart.ayanamsha
                    lon = util.normalize(lon)
                d, m, s = util.decToDeg(lon)
                sign = d / chart.Chart.SIGN_DEG
                pos = d % chart.Chart.SIGN_DEG
                wsp, hsp = draw.textsize(' ', self.fntText)
                wsg, hsg = draw.textsize(self.signs[sign], self.fntMorinus)
                txt = (str(pos)).rjust(2) + self.deg_symbol + (
                    str(m)).zfill(2) + "'" + (str(s)).zfill(2) + '"'
                w, h = draw.textsize(txt, self.fntText)
                offset = (offs[i] - (w + wsp + wsg)) / 2
                draw.text((x + summa + offset, y + (self.LINE_HEIGHT - h) / 2),
                          txt,
                          fill=tclr,
                          font=self.fntText)
                draw.text((x + summa + offset + w + wsp, y +
                           (self.LINE_HEIGHT - hsg) / 2),
                          self.signs[sign],
                          fill=tclr,
                          font=self.fntMorinus)

            summa += offs[i]
Пример #26
0
	def drawBkg(self):
		if self.bw:
			self.bkgclr = (255,255,255)
		else:
			self.bkgclr = self.options.clrbackground

		self.SetBackgroundColour(self.bkgclr)

		tableclr = self.options.clrtable
		if self.bw:
			tableclr = (0,0,0)

		txtclr = self.options.clrtexts
		if self.bw:
			txtclr = (0,0,0)

		img = Image.new('RGB', (self.WIDTH, self.HEIGHT), self.bkgclr)
		draw = ImageDraw.Draw(img)

		txt = mtexts.txts['Longitude']
		w,h = draw.textsize(txt, self.fntText)
		num = len(self.ar)
		if self.options.intables:
			if not self.options.transcendental[chart.Chart.TRANSURANUS]:
				num -= 1
			if not self.options.transcendental[chart.Chart.TRANSNEPTUNE]:
				num -= 1
			if not self.options.transcendental[chart.Chart.TRANSPLUTO]:
				num -= 1
			if not self.options.shownodes:
				num -= 1
		for i in range(num):
			x = self.ar[i][0]+self.SMALL_CELL_WIDTH
			y = self.ar[i][1]
			draw.line((x, y, x+self.CELL_WIDTH, y), fill=tableclr)
			draw.line((x, y, x, y+self.LINE_HEIGHT), fill=tableclr)
			draw.line((x+self.CELL_WIDTH, y, x+self.CELL_WIDTH, y+self.LINE_HEIGHT), fill=tableclr)
			draw.line((x-self.SMALL_CELL_WIDTH, y+self.LINE_HEIGHT, x+self.CELL_WIDTH, y+self.LINE_HEIGHT), fill=tableclr)
			draw.text((x+(self.CELL_WIDTH-w)/2, self.ar[i][1]+(self.LINE_HEIGHT-h)/2), txt, fill=txtclr, font=self.fntText)

		artmp = [11, 10, 9, 8, 7, 6, 5, 4, 3, 2]
		length = len(artmp)

#		arln = [0, 11, 21, 30, 38, 45, 51, 56, 60, 63, 65]  #11 is linenum of 1st table 21 is 1st and 2nd ...
		arln = [0]
		for i in range(length):
			arln.append(arln[i]+artmp[i])

		for i in range(num):
			ln = 1
			for j in range(arln[i], arln[i+1]):		
				if self.options.intables and ((self.chart.midpoints.mids[j].p2 == astrology.SE_URANUS and not self.options.transcendental[chart.Chart.TRANSURANUS]) or (self.chart.midpoints.mids[j].p2 == astrology.SE_NEPTUNE and not self.options.transcendental[chart.Chart.TRANSNEPTUNE]) or (self.chart.midpoints.mids[j].p2 == astrology.SE_PLUTO and not self.options.transcendental[chart.Chart.TRANSPLUTO]) or (self.chart.midpoints.mids[j].p2 == astrology.SE_MEAN_NODE and not self.options.shownodes) or (self.chart.midpoints.mids[j].p2 == astrology.SE_TRUE_NODE and not self.options.shownodes)):
					continue
				wsp,hsp = draw.textsize(' - ', self.fntText)
				p1 = common.common.Planets[self.chart.midpoints.mids[j].p1]
				p2 = common.common.Planets[self.chart.midpoints.mids[j].p2]
				wpl1,hpl1 = draw.textsize(p1, self.fntMorinus)
				wpl2,hpl2 = draw.textsize(p2, self.fntMorinus)
				clr1 = (0,0,0)
				clr2 = (0,0,0)
				if not self.bw:
					if self.options.useplanetcolors:
						objidx1 = self.chart.midpoints.mids[j].p1
						objidx2 = self.chart.midpoints.mids[j].p2
						if objidx1 >= planets.Planets.PLANETS_NUM-1:
							objidx1 -= 1
						if objidx2 >= planets.Planets.PLANETS_NUM-1:
							objidx2 -= 1
						clr1 = self.options.clrindividual[objidx1]
						clr2 = self.options.clrindividual[objidx2]
					else:
						dign1 = self.chart.dignity(self.chart.midpoints.mids[j].p1)
						dign2 = self.chart.dignity(self.chart.midpoints.mids[j].p2)
						clr1 = self.clrs[dign1]
						clr2 = self.clrs[dign2]
				draw.text((self.ar[i][0]+(self.SMALL_CELL_WIDTH-(wpl1+wsp+wpl2))/2, self.ar[i][1]+self.LINE_HEIGHT*ln+(self.LINE_HEIGHT-hsp)/2), p1, fill=clr1, font=self.fntMorinus)
				draw.text((self.ar[i][0]+(self.SMALL_CELL_WIDTH-(wpl1+wsp+wpl2))/2+wpl1, self.ar[i][1]+self.LINE_HEIGHT*ln+(self.LINE_HEIGHT-hsp)/2), ' - ', fill=txtclr, font=self.fntText)
				draw.text((self.ar[i][0]+(self.SMALL_CELL_WIDTH-(wpl1+wsp+wpl2))/2+wpl1+wsp, self.ar[i][1]+self.LINE_HEIGHT*ln+(self.LINE_HEIGHT-hsp)/2), p2, fill=clr2, font=self.fntMorinus)

				lona = self.chart.midpoints.mids[j].m
				if self.options.ayanamsha != 0:
					lona -= self.chart.ayanamsha
					lona = util.normalize(lona)
				lon = lona
				d,m,s = util.decToDeg(lon)
				sign = int(lon/chart.Chart.SIGN_DEG)
				pos = int(lon%chart.Chart.SIGN_DEG)
				wsp,hsp = draw.textsize(' ', self.fntText)
				wsg,hsg = draw.textsize(self.signs[sign], self.fntMorinus)
				txt = (str(pos)).rjust(2)+self.deg_symbol+(str(m)).zfill(2)+"'"+(str(s)).zfill(2)+'"'
				w,h = draw.textsize(txt, self.fntText)
				offs = (self.CELL_WIDTH-(w+wsp+wsg))/2
				draw.text((self.ar[i][0]+self.SMALL_CELL_WIDTH+offs, self.ar[i][1]+self.LINE_HEIGHT*ln+(self.LINE_HEIGHT-hsp)/2), txt, fill=txtclr, font=self.fntText)
				draw.text((self.ar[i][0]+self.SMALL_CELL_WIDTH+offs+w, self.ar[i][1]+self.LINE_HEIGHT*ln+(self.LINE_HEIGHT-hsp)/2), ' ', fill=txtclr, font=self.fntText)
				draw.text((self.ar[i][0]+self.SMALL_CELL_WIDTH+offs+w+wsp, self.ar[i][1]+self.LINE_HEIGHT*ln+(self.LINE_HEIGHT-hsp)/2), self.signs[sign], fill=txtclr, font=self.fntMorinus)

				x = self.ar[i][0]
				y = self.ar[i][1]+self.LINE_HEIGHT*ln
				draw.line((x, y+self.LINE_HEIGHT, x+self.SMALL_CELL_WIDTH+self.CELL_WIDTH, y+self.LINE_HEIGHT), fill=tableclr)
				draw.line((x, y+self.LINE_HEIGHT, x, y), fill=tableclr)
				draw.line((x+self.SMALL_CELL_WIDTH, y+self.LINE_HEIGHT, x+self.SMALL_CELL_WIDTH, y), fill=tableclr)
				draw.line((x+self.SMALL_CELL_WIDTH+self.CELL_WIDTH, y+self.LINE_HEIGHT, x+self.SMALL_CELL_WIDTH+self.CELL_WIDTH, y), fill=tableclr)

				ln += 1

		wxImg = wx.Image(img.size[0], img.size[1])
		wxImg.SetData(img.tobytes())
		self.buffer = wx.Bitmap(wxImg)
Пример #27
0
	def __init__(self, chrt):
		self.time = chrt.time
		self.lon = chrt.planets.planets[astrology.SE_MOON].data[planets.Planet.LONG]

		self.flags = astrology.SEFLG_SPEED+astrology.SEFLG_SWIEPH

		#for topical almutens
		self.lons = []

		if not chrt.time.bc:
			lonsun = chrt.planets.planets[astrology.SE_SUN].data[planets.Planet.LONG]
			lonmoon = chrt.planets.planets[astrology.SE_MOON].data[planets.Planet.LONG]

			d, m, s = util.decToDeg(lonsun)
			lonsun = d+m/60.0+s/3600.0
			d, m, s = util.decToDeg(lonmoon)
			lonmoon = d+m/60.0+s/3600.0

			diff = lonmoon-lonsun
			self.newmoon, self.ready = self.isNewMoon(diff)

			if not self.ready:
				ok, self.time, self.ready = self.getDateHour(self.time, chrt.place, self.newmoon)
				if not self.ready:
					ok, self.time, self.ready = self.getDateMinute(self.time, chrt.place, self.newmoon)
					if not self.ready:
						ok, self.time, self.ready = self.getDateSecond(self.time, chrt.place, self.newmoon)

			hses = houses.Houses(self.time.jd, 0, chrt.place.lat, chrt.place.lon, chrt.options.hsys, chrt.obl[0], chrt.options.ayanamsha, chrt.ayanamsha)
			moon = planets.Planet(self.time.jd, astrology.SE_MOON, self.flags, chrt.place.lat, hses.ascmc2)
			if self.newmoon:
				self.lon = moon.data[planets.Planet.LONG]
			else:
				if chrt.options.syzmoon == options.Options.MOON:
					self.lon = moon.data[planets.Planet.LONG]
				elif chrt.options.syzmoon == options.Options.ABOVEHOR:
					if moon.abovehorizon:
						self.lon = moon.data[planets.Planet.LONG]
					else:
						sun = planets.Planet(self.time.jd, astrology.SE_SUN, self.flags)
						self.lon = sun.data[planets.Planet.LONG]
				else:
					moon = planets.Planet(self.time.jd, astrology.SE_MOON, self.flags, chrt.place.lat, chrt.houses.ascmc2)
					if moon.abovehorizon:
						self.lon = moon.data[planets.Planet.LONG]
					else:
						sun = planets.Planet(self.time.jd, astrology.SE_SUN, self.flags)
						self.lon = sun.data[planets.Planet.LONG]

		ra, decl, dist = astrology.swe_cotrans(self.lon, 0.0, 1.0, -chrt.obl[0])
		self.speculum = [self.lon, 0.0, ra, decl]

		#the other syzygy (i.e. if the syzygy was conjunction then calculate the opposition and vice versa)
		self.lon2 = chrt.planets.planets[astrology.SE_MOON].data[planets.Planet.LONG]
		if not chrt.time.bc:
			self.time2 = self.time
			ok, self.time2, self.ready2 = self.getDateHour(self.time2, chrt.place, not self.newmoon)
			if not self.ready2:
				ok, self.time2, self.ready2 = self.getDateMinute(self.time2, chrt.place, not self.newmoon)
				if not self.ready2:
					ok, self.time2, self.ready2 = self.getDateSecond(self.time2, chrt.place, not self.newmoon)

			hses2 = houses.Houses(self.time2.jd, 0, chrt.place.lat, chrt.place.lon, chrt.options.hsys, chrt.obl[0], chrt.options.ayanamsha, chrt.ayanamsha)
			moon2 = planets.Planet(self.time2.jd, astrology.SE_MOON, self.flags, chrt.place.lat, hses2.ascmc2)
			if not self.newmoon:
				self.lon2 = moon2.data[planets.Planet.LONG]
			else:
				if chrt.options.syzmoon == options.Options.MOON:
					self.lon2 = moon2.data[planets.Planet.LONG]
				elif chrt.options.syzmoon == options.Options.ABOVEHOR:
					if moon2.abovehorizon:
						self.lon2 = moon2.data[planets.Planet.LONG]
					else:
						sun2 = planets.Planet(self.time2.jd, astrology.SE_SUN, self.flags)
						self.lon2 = sun2.data[planets.Planet.LONG]
				else:
					moon2 = planets.Planet(self.time2.jd, astrology.SE_MOON, self.flags, chrt.place.lat, chrt.houses.ascmc2)
					if moon2.abovehorizon:
						self.lon2 = moon2.data[planets.Planet.LONG]
					else:
						sun2 = planets.Planet(self.time2.jd, astrology.SE_SUN, self.flags)
						self.lon2 = sun2.data[planets.Planet.LONG]

			ra2, decl2, dist2 = astrology.swe_cotrans(self.lon2, 0.0, 1.0, -chrt.obl[0])
			self.speculum2 = [self.lon2, 0.0, ra2, decl2]

			#for topical almutens
			self.lons.append(self.lon)#Default
			if self.newmoon: #Conjunction
				self.lons.append(self.lon)
			else:
				self.lons.append(self.lon2)
			#Moon in chart of Syzygy
			hses = houses.Houses(self.time.jd, 0, chrt.place.lat, chrt.place.lon, chrt.options.hsys, chrt.obl[0], chrt.options.ayanamsha, chrt.ayanamsha)
			moonSyz = planets.Planet(self.time.jd, astrology.SE_MOON, self.flags, chrt.place.lat, hses.ascmc2)
			hses2 = houses.Houses(self.time2.jd, 0, chrt.place.lat, chrt.place.lon, chrt.options.hsys, chrt.obl[0], chrt.options.ayanamsha, chrt.ayanamsha)
			moonSyz2 = planets.Planet(self.time2.jd, astrology.SE_MOON, self.flags, chrt.place.lat, hses2.ascmc2)
			if not self.newmoon: #Opposition
				if moonSyz.abovehorizon:
					self.lons.append(moonSyz.data[planets.Planet.LONG])
				else:
					sun = planets.Planet(self.time.jd, astrology.SE_SUN, self.flags)
					self.lons.append(sun.data[planets.Planet.LONG])
			else:
				if moonSyz2.abovehorizon:
					self.lons.append(moonSyz2.data[planets.Planet.LONG])
				else:
					sun2 = planets.Planet(self.time2.jd, astrology.SE_SUN, self.flags)
					self.lons.append(sun2.data[planets.Planet.LONG])
			if not self.newmoon: #OppositionRadix
				moon = planets.Planet(self.time.jd, astrology.SE_MOON, self.flags, chrt.place.lat, chrt.houses.ascmc2)
				if moon.abovehorizon:
					self.lons.append(moon.data[planets.Planet.LONG])
				else:
					sun = planets.Planet(self.time.jd, astrology.SE_SUN, self.flags)
					self.lons.append(sun.data[planets.Planet.LONG])
			else:
				moon = planets.Planet(self.time2.jd, astrology.SE_MOON, self.flags, chrt.place.lat, chrt.houses.ascmc2)
				if moon.abovehorizon:
					self.lons.append(moon.data[planets.Planet.LONG])
				else:
					sun = planets.Planet(self.time.jd, astrology.SE_SUN, self.flags)
					self.lons.append(sun.data[planets.Planet.LONG])
			if not self.newmoon: #Opposition Moon
				self.lons.append(moonSyz.data[planets.Planet.LONG])
			else:
				self.lons.append(moonSyz2.data[planets.Planet.LONG])
Пример #28
0
	def drawBkg(self):
		if self.bw:
			self.bkgclr = (255,255,255)
		else:
			self.bkgclr = self.options.clrbackground

		self.SetBackgroundColour(self.bkgclr)

		tableclr = self.options.clrtable
		if self.bw:
			tableclr = (0,0,0)

		txtclr = self.options.clrtexts
		if self.bw:
			txtclr = (0,0,0)

		img = Image.new('RGB', (self.WIDTH, self.HEIGHT), self.bkgclr)
		draw = ImageDraw.Draw(img)

		BOR = commonwnd.CommonWnd.BORDER

		#Grid
		x = BOR
		y = BOR
		for i in range(self.LINE_NUM+1):
			draw.line((x, y+self.LINE_HEIGHT*i, x+self.TABLE_WIDTH, y+self.LINE_HEIGHT*i), fill=tableclr)

		for i in range(self.COLUMN_NUM+1+1):
			draw.line((x+self.CELL_WIDTH*i, y, x+self.CELL_WIDTH*i, y+self.TABLE_HEIGHT), fill=tableclr)

		#Data
		SIDTIME = 0
		OBL = 1
		JD = 2
		VERTEX = 3
		EQUATASC = 4

		txts = (mtexts.txts['SidTime'], mtexts.txts['OblEcl'], mtexts.txts['JulianDay'], mtexts.txts['Vertex'], mtexts.txts['EquAsc'])
		data = (self.chart.houses.ascmc[houses.Houses.ARMC]/15.0, self.chart.obl[0], self.chart.time.jd, self.chart.houses.ascmc[houses.Houses.VERTEX], self.chart.houses.ascmc[houses.Houses.EQUASC])
		for i in range(self.LINE_NUM):
			w,h = draw.textsize(txts[i], self.fntText)
			draw.text((BOR+(self.CELL_WIDTH-w)/2, BOR+self.LINE_HEIGHT*i+(self.LINE_HEIGHT-h)/2), txts[i], fill=txtclr, font=self.fntText)

			d, m, s = util.decToDeg(data[i])

			if i == SIDTIME:
				txt = str(d)+':'+(str(m)).zfill(2)+':'+(str(s)).zfill(2)
				w,h = draw.textsize(txt, self.fntText)
				draw.text((BOR+self.CELL_WIDTH+(self.CELL_WIDTH-w)/2, BOR+self.LINE_HEIGHT*i+(self.LINE_HEIGHT-h)/2), txt, fill=txtclr, font=self.fntText)
			elif i == OBL:
				txt = (str(d)).rjust(2)+self.deg_symbol+(str(m)).zfill(2)+"'"+(str(s)).zfill(2)+'"'
				w,h = draw.textsize(txt, self.fntText)
				draw.text((BOR+self.CELL_WIDTH+(self.CELL_WIDTH-w)/2, BOR+self.LINE_HEIGHT*i+(self.LINE_HEIGHT-h)/2), txt, fill=txtclr, font=self.fntText)
			elif i == JD:
				txt = str(data[i])
				w,h = draw.textsize(txt, self.fntText)
				draw.text((BOR+self.CELL_WIDTH+(self.CELL_WIDTH-w)/2, BOR+self.LINE_HEIGHT*i+(self.LINE_HEIGHT-h)/2), txt, fill=txtclr, font=self.fntText)
			else:
				if self.options.ayanamsha != 0:
					ayanlon = data[i]-self.chart.ayanamsha
					ayanlon = util.normalize(ayanlon)
					d, m, s = util.decToDeg(ayanlon)
				sign = d/chart.Chart.SIGN_DEG
				pos = d%chart.Chart.SIGN_DEG
				wsp,hsp = draw.textsize(' ', self.fntText)
				txtsign = self.signs[sign]
				wsg,hsg = draw.textsize(txtsign, self.fntMorinus)
				txt = (str(pos)).rjust(2)+self.deg_symbol+(str(m)).zfill(2)+"'"+(str(s)).zfill(2)+'"'
				w,h = draw.textsize(txt, self.fntText)
				offset = (self.CELL_WIDTH-(w+wsp+wsg))/2
				draw.text((BOR+self.CELL_WIDTH+offset, BOR+self.LINE_HEIGHT*i+(self.LINE_HEIGHT-h)/2), txt, fill=txtclr, font=self.fntText)
				draw.text((BOR+self.CELL_WIDTH+offset+w+wsp, BOR+self.LINE_HEIGHT*i+(self.LINE_HEIGHT-h)/2), txtsign, fill=txtclr, font=self.fntMorinus)

		#Table 2
		txts = (mtexts.txts['Syzygy'], mtexts.txts['Date2'], mtexts.txts['Longitude'])
		x = BOR
		y = BOR+self.LINE_NUM*self.LINE_HEIGHT+self.TABLE2_OFFS

		draw.line((x, y, x+self.TABLE_WIDTH2, y), fill=tableclr)
		draw.line((x, y+self.LINE_HEIGHT, x+self.TABLE_WIDTH2, y+self.LINE_HEIGHT), fill=tableclr)
		draw.line((x, y+2*self.LINE_HEIGHT, x+self.TABLE_WIDTH2, y+2*self.LINE_HEIGHT), fill=tableclr)
		draw.line((x, y, x, y+2*self.LINE_HEIGHT), fill=tableclr)
		draw.line((x+self.CELL_WIDTH, y+self.LINE_HEIGHT, x+self.CELL_WIDTH, y+2*self.LINE_HEIGHT), fill=tableclr)
		draw.line((x+2*self.CELL_WIDTH, y+self.LINE_HEIGHT, x+2*self.CELL_WIDTH, y+2*self.LINE_HEIGHT), fill=tableclr)
		draw.line((x+3*self.CELL_WIDTH, y+self.LINE_HEIGHT, x+3*self.CELL_WIDTH, y+2*self.LINE_HEIGHT), fill=tableclr)
		draw.line((x+self.TABLE_WIDTH2, y, x+self.TABLE_WIDTH2, y+2*self.LINE_HEIGHT), fill=tableclr)

		num = len(txts)
		for i in range(num):
			w,h = draw.textsize(txts[i], self.fntText)
			draw.text((BOR+self.CELL_WIDTH*i+(self.CELL_WIDTH-w)/2, y+(self.LINE_HEIGHT-h)/2), txts[i], fill=txtclr, font=self.fntText)

		if not self.chart.time.bc:
			txt = mtexts.txts['NewMoon']
			if not self.chart.syzygy.newmoon:
				txt = mtexts.txts['FullMoon']
			w,h = draw.textsize(txt, self.fntText)
			draw.text((x+(self.CELL_WIDTH-w)/2, y+self.LINE_HEIGHT+(self.LINE_HEIGHT-h)/2), txt, fill=txtclr, font=self.fntText)

			h, m, s = util.decToDeg(self.chart.syzygy.time.time)
			txt = str(self.chart.syzygy.time.year)+'.'+str(self.chart.syzygy.time.month).zfill(2)+'.'+str(self.chart.syzygy.time.day).zfill(2)+'.'+' '+str(h).rjust(2)+':'+str(m).zfill(2)+':'+str(s).zfill(2)
			w,h = draw.textsize(txt, self.fntText)
			draw.text((x+self.CELL_WIDTH+(self.CELL_WIDTH-w)/2, y+self.LINE_HEIGHT+(self.LINE_HEIGHT-h)/2), txt, fill=txtclr, font=self.fntText)

			lon = self.chart.syzygy.lon
			if self.options.ayanamsha != 0:
				lon = lon-self.chart.ayanamsha
				lon = util.normalize(lon)

			d, m, s = util.decToDeg(lon)
			sign = d/chart.Chart.SIGN_DEG
			pos = d%chart.Chart.SIGN_DEG
			wsp,hsp = draw.textsize(' ', self.fntText)
			wsg,hsg = draw.textsize(self.signs[sign], self.fntMorinus)
			txt = (str(pos)).rjust(2)+self.deg_symbol+(str(m)).zfill(2)+"'"+(str(s)).zfill(2)+'"'
			w,h = draw.textsize(txt, self.fntText)
			offset = (self.CELL_WIDTH-(w+wsp+wsg))/2
			draw.text((x+2*self.CELL_WIDTH+offset, y+self.LINE_HEIGHT+(self.LINE_HEIGHT-h)/2), txt, fill=txtclr, font=self.fntText)
			draw.text((x+2*self.CELL_WIDTH+offset+w+wsp, y+self.LINE_HEIGHT+(self.LINE_HEIGHT-hsg)/2), self.signs[sign], fill=txtclr, font=self.fntMorinus)


		wxImg = wx.EmptyImage(img.size[0], img.size[1])
		wxImg.SetData(img.tostring())
		self.buffer = wx.BitmapFromImage(wxImg)
	def __init__(self, parent, chrt, y, m, d, t, direct, arc, opts, terrestrial):

		self.parent = parent
		self.chart = chrt
		self.y = y
		self.m = m
		self.d = d
		self.t = t
		self.direct = direct
		self.arc = arc
		self.options = opts
		self.terrestrial = terrestrial

        # Instead of calling wx.Dialog.__init__ we precreate the dialog
        # so we can set an extra style that must be set before
        # creation, and then we create the GUI object using the Create
        # method.
		pre = wx.PreDialog()
		pre.SetExtraStyle(wx.DIALOG_EX_CONTEXTHELP)
		pre.Create(parent, -1, mtexts.txts['PDsInChart'], pos=wx.DefaultPosition, size=wx.DefaultSize, style=wx.DEFAULT_DIALOG_STYLE)

        # This next step is the most important, it turns this Python
        # object into the real wrapper of the dialog (instead of pre)
        # as far as the wxPython extension is concerned.
		self.PostCreate(pre)

		#main vertical sizer
		mvsizer = wx.BoxSizer(wx.VERTICAL)
		#main horizontal sizer
		mhsizer = wx.BoxSizer(wx.HORIZONTAL)

		#Date
		rnge = 3000
		checker = rangechecker.RangeChecker()
		if checker.isExtended():
			rnge = 5000
		self.sdate =wx.StaticBox(self, label='')
		datesizer = wx.StaticBoxSizer(self.sdate, wx.VERTICAL)
		self.daterb = wx.RadioButton(self, -1, '', style=wx.RB_GROUP)
		datesizer.Add(self.daterb, 0, wx.GROW|wx.ALIGN_LEFT|wx.ALL, 5)###
		vsizer = wx.BoxSizer(wx.VERTICAL)
#		self.dateckb = wx.CheckBox(self, -1, mtexts.txts['BC'])
#		vsizer.Add(self.dateckb, 0, wx.ALIGN_LEFT|wx.LEFT|wx.RIGHT|wx.TOP, 5)

		fgsizer = wx.FlexGridSizer(2, 3)
		self.yeartxt = wx.StaticText(self, -1, mtexts.txts['Year']+':')
		vsizer.Add(self.yeartxt, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.LEFT, 0)
		self.year = wx.TextCtrl(self, -1, '', validator=intvalidator.IntValidator(0, rnge), size=(50,-1))
		vsizer.Add(self.year, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.LEFT, 0)
		if checker.isExtended():
			self.year.SetHelpText(mtexts.txts['HelpYear'])
		else:
			self.year.SetHelpText(mtexts.txts['HelpYear2'])
		self.year.SetMaxLength(4)
		self.year.SetValue(str(self.y))
		fgsizer.Add(vsizer, 0, wx.ALIGN_LEFT|wx.ALL, 5)

		vsizer = wx.BoxSizer(wx.VERTICAL)
		self.monthtxt = wx.StaticText(self, -1, mtexts.txts['Month']+':')
		vsizer.Add(self.monthtxt, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.LEFT, 0)
		self.month = wx.TextCtrl(self, -1, '', validator=intvalidator.IntValidator(1, 12), size=(50,-1))
		self.month.SetHelpText(mtexts.txts['HelpMonth'])
		self.month.SetMaxLength(2)
		self.month.SetValue(str(self.m))
		vsizer.Add(self.month, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.LEFT, 0)
		fgsizer.Add(vsizer, 0, wx.ALIGN_LEFT|wx.ALL, 5)

		vsizer = wx.BoxSizer(wx.VERTICAL)
		self.daytxt = wx.StaticText(self, -1, mtexts.txts['Day']+':')
		vsizer.Add(self.daytxt, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.LEFT, 0)
		self.day = wx.TextCtrl(self, -1, '', validator=intvalidator.IntValidator(1, 31), size=(50,-1))
		self.day.SetHelpText(mtexts.txts['HelpDay'])
		self.day.SetMaxLength(2)
		self.day.SetValue(str(self.d))
		vsizer.Add(self.day, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.LEFT, 0)
		fgsizer.Add(vsizer, 0, wx.ALIGN_LEFT|wx.ALL, 5)

		#time
		ho, mi, se = util.decToDeg(self.t)

		vsizer = wx.BoxSizer(wx.VERTICAL)
		self.hourtxt = wx.StaticText(self, -1, mtexts.txts['Hour']+':')
		vsizer.Add(self.hourtxt, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.LEFT, 0)
		self.hour = wx.TextCtrl(self, -1, '', validator=intvalidator.IntValidator(0, 23), size=(50,-1))
		self.hour.SetHelpText(mtexts.txts['HelpHour'])
		vsizer.Add(self.hour, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.LEFT, 0)
		self.hour.SetMaxLength(2)
		self.hour.SetValue(str(ho))
		fgsizer.Add(vsizer, 0, wx.ALIGN_LEFT|wx.ALL, 5)

		vsizer = wx.BoxSizer(wx.VERTICAL)
		self.minutetxt = wx.StaticText(self, -1, mtexts.txts['Min']+':')
		vsizer.Add(self.minutetxt, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.LEFT, 0)
		self.minute = wx.TextCtrl(self, -1, '', validator=intvalidator.IntValidator(0, 59), size=(50,-1))
		self.minute.SetHelpText(mtexts.txts['HelpMin'])
		self.minute.SetMaxLength(2)
		self.minute.SetValue(str(mi))
		vsizer.Add(self.minute, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.LEFT, 0)
		fgsizer.Add(vsizer, 0, wx.ALIGN_LEFT|wx.ALL, 5)

		vsizer = wx.BoxSizer(wx.VERTICAL)
		self.secondtxt = wx.StaticText(self, -1, mtexts.txts['Sec']+':')
		vsizer.Add(self.secondtxt, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.LEFT, 0)
		self.second = wx.TextCtrl(self, -1, '', validator=intvalidator.IntValidator(0, 59), size=(50,-1))
		self.second.SetHelpText(mtexts.txts['HelpMin'])
		self.second.SetMaxLength(2)
		self.second.SetValue(str(se))
		vsizer.Add(self.second, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.LEFT, 0)
		fgsizer.Add(vsizer, 0, wx.ALIGN_LEFT|wx.ALL, 5)

		datesizer.Add(fgsizer, 0, wx.GROW|wx.ALIGN_CENTER|wx.ALL, 5)###

		#DA
		self.sda = wx.StaticBox(self, label='')
		dasizer = wx.StaticBoxSizer(self.sda, wx.VERTICAL)

		self.arcrb = wx.RadioButton(self, -1, '')
		dasizer.Add(self.arcrb, 0, wx.ALIGN_LEFT|wx.ALL, 5)
		vsizer = wx.BoxSizer(wx.VERTICAL)
		hsizer = wx.BoxSizer(wx.HORIZONTAL)
		self.datxt = wx.StaticText(self, -1, mtexts.txts['Arc']+':')
		hsizer.Add(self.datxt, 0, wx.ALIGN_CENTER|wx.LEFT, 0)
		self.da = wx.TextCtrl(self, -1, '', validator=floatvalidator.FloatValidator(0.0, 100.0), size=(100,-1))
		self.da.SetMaxLength(10)
		hsizer.Add(self.da, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.LEFT, 0)
		vsizer.Add(hsizer, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.LEFT, 0)

		dasizer.Add(vsizer, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.ALL, 5)
		self.da.SetValue(str(self.arc))

		#Direction
		self.sdir = wx.StaticBox(self, label='')
		dirsizer = wx.StaticBoxSizer(self.sdir, wx.VERTICAL)

		vsizer = wx.BoxSizer(wx.VERTICAL)
		self.positiverb = wx.RadioButton(self, -1, mtexts.txts['Direct'], style=wx.RB_GROUP)
		self.negativerb = wx.RadioButton(self, -1, mtexts.txts['Converse'])
		vsizer.Add(self.positiverb, 0, wx.LEFT, 0)
		vsizer.Add(self.negativerb, 0, wx.LEFT, 0)

		if self.direct:
			self.positiverb.SetValue(True)
		else:
			self.negativerb.SetValue(True)

		dirsizer.Add(vsizer, 0, wx.ALIGN_CENTER_HORIZONTAL|wx.LEFT, 0)

		#ShowBtn
		self.sshow = wx.StaticBox(self, label='')
		showsizer = wx.StaticBoxSizer(self.sshow, wx.VERTICAL)
		ID_SHOWBTN = wx.NewId()
		self.btnShow = wx.Button(self, ID_SHOWBTN, mtexts.txts['Show'])
		showsizer.Add(self.btnShow, 0, wx.ALIGN_CENTER|wx.ALL, 10)


		mvsizer.Add(datesizer, 0, wx.GROW|wx.ALIGN_LEFT|wx.LEFT|wx.RIGHT, 5)
		mvsizer.Add(dasizer, 0, wx.GROW|wx.ALIGN_LEFT|wx.LEFT|wx.RIGHT, 5)
		mvsizer.Add(dirsizer, 0, wx.GROW|wx.ALIGN_LEFT|wx.LEFT|wx.RIGHT, 5)
		mvsizer.Add(showsizer, 0, wx.GROW|wx.ALIGN_LEFT|wx.LEFT|wx.RIGHT, 5)

		btnsizer = wx.StdDialogButtonSizer()

		if wx.Platform != '__WXMSW__':
			btn = wx.ContextHelpButton(self)
			btnsizer.AddButton(btn)
        
		btnOk = wx.Button(self, wx.ID_OK, mtexts.txts['Ok'])
		btnOk.SetHelpText(mtexts.txts['HelpOk'])
		btnOk.SetDefault()
		btnsizer.AddButton(btnOk)
		btnsizer.Realize()

		mvsizer.Add(btnsizer, 0, wx.GROW|wx.ALL, 10)
		self.SetSizer(mvsizer)
		mvsizer.Fit(self)

		self.Bind(wx.EVT_RADIOBUTTON, self.onDate, id=self.daterb.GetId())
		self.Bind(wx.EVT_RADIOBUTTON, self.onArc, id=self.arcrb.GetId())
		self.Bind(wx.EVT_BUTTON, self.onShowBtn, id=ID_SHOWBTN)

		self.enableDate(True)
		self.enableArc(False)
#		self.enablePosNeg(False)

		self.da.SetFocus()
Пример #30
0
	def check(self, planet1, planet2, lon):
		#Handle 360-0 transitions(Pisces-Aries)

		y1, m1, s1 = util.decToDeg(planet1.data[planets.Planet.LONG])
		y2, m2, s2 = util.decToDeg(planet2.data[planets.Planet.LONG])

		if (self.ftdataapprox[findtimedlg.FindTimeDlg.USEAPPROX] and (self.ftdataapprox[findtimedlg.FindTimeDlg.APPROXDEG] != 0 or self.ftdataapprox[findtimedlg.FindTimeDlg.APPROXMIN] != 0 or self.ftdataapprox[findtimedlg.FindTimeDlg.APPROXSEC] != 0)):
			lon1 = float(y1)+float(m1)/60.0+float(s1)/3600.0
			lon2 = float(y2)+float(m2)/60.0+float(s2)/3600.0

			if lon2 < lon1:
				tlon = lon1
				lon1 = lon2
				lon2 = tlon

			approxval = self.ftdataapprox[findtimedlg.FindTimeDlg.APPROXDEG]+self.ftdataapprox[findtimedlg.FindTimeDlg.APPROXMIN]/60.0+self.ftdataapprox[findtimedlg.FindTimeDlg.APPROXSEC]/3600.0
			lona = util.normalize(lon-approxval)
			lonb = util.normalize(lon+approxval)

			if lonb < lona:
				tlon = lona
				lona = lonb
				lonb = tlon

			if (lon2 > FindTime.CIRCLE-FindTime.OFFSET and lon1 < FindTime.OFFSET) and (lonb > FindTime.CIRCLE-FindTime.OFFSET and lona < FindTime.OFFSET):
				return True

			if (lon2 > FindTime.CIRCLE-FindTime.OFFSET and lon1 < FindTime.OFFSET) and (lonb > FindTime.CIRCLE-FindTime.OFFSET and lona > FindTime.CIRCLE-FindTime.OFFSET):
				if (lon2 <= lona):
					return True

				return False

			if (lonb > FindTime.CIRCLE-FindTime.OFFSET and lona < FindTime.OFFSET) and (lon2 > FindTime.CIRCLE-FindTime.OFFSET and lon1 > FindTime.CIRCLE-FindTime.OFFSET):
				if (lonb <= lon1):
					return True

				return False

			if (lonb < FindTime.OFFSET and lona < FindTime.OFFSET) and (lon2 > FindTime.CIRCLE-FindTime.OFFSET and lon1 < FindTime.OFFSET):
				if (lonb <= lon1):
					return True

				return False

			if (lonb > FindTime.CIRCLE-FindTime.OFFSET and lona < FindTime.OFFSET) and (lon2 < FindTime.OFFSET and lon1 < FindTime.OFFSET):
				if (lon2 <= lona):
					return True

				return False

			if (lonb > FindTime.CIRCLE-FindTime.OFFSET and lona < FindTime.OFFSET) and (lon2 > FindTime.OFFSET and lon2 < FindTime.CIRCLE-FindTime.OFFSET and lon1 > FindTime.OFFSET and lon1 < FindTime.CIRCLE-FindTime.OFFSET) or (lon2 > FindTime.CIRCLE-FindTime.OFFSET and lon1 < FindTime.OFFSET) and (lonb > FindTime.OFFSET and lonb < FindTime.CIRCLE-FindTime.OFFSET and lona > FindTime.OFFSET and lona < FindTime.CIRCLE-FindTime.OFFSET):
				return False

			#Handle normal case
			if (lon1 <= lona and lon2 >= lona) or (lona <= lon1 and lonb >= lon1):
				return True

		else:
			lon1 = lon2 = 0.0
			if self.ftdatause[findtimedlg.FindTimeDlg.MIN] and self.ftdatause[findtimedlg.FindTimeDlg.SEC]:
				lon1 = float(y1)+float(m1)/60.0+float(s1)/3600.0
				lon2 = float(y2)+float(m2)/60.0+float(s2)/3600.0
			else:
				if not self.ftdatause[findtimedlg.FindTimeDlg.SEC]:
					lon1 = float(y1)+float(m1)/60.0
					lon2 = float(y2)+float(m2)/60.0
				if not self.ftdatause[findtimedlg.FindTimeDlg.MIN]:
					lon1 = float(y1)
					lon2 = float(y2)

			if lon2 < lon1:
				tlon = lon1
				lon1 = lon2
				lon2 = tlon

			if (lon2 > FindTime.CIRCLE-FindTime.OFFSET and lon1 < FindTime.OFFSET):
				if lon2 <= lon or lon1 > lon:
					return True
				return False

			#Handle normal case
			if (lon1 <= lon and lon2 >= lon):
				return True

		return False
Пример #31
0
	def compute(self):
		y = self.chart.time.year
		m = self.chart.time.month
		d = self.chart.time.day

		hour = self.chart.time.hour
		minute = self.chart.time.minute
		second = self.chart.time.second

		hr = 0.0

		#GMT to LocalMean
		t = (self.chart.place.deglon+self.chart.place.minlon/60.0)*4 #long * 4min
		meantime = 0.0
		if self.chart.place.east:
			meantime = self.chart.time.time+t/60.0
		else:
			meantime = self.chart.time.time-t/60.0

		#check over/underflow
		HOURSPERDAY = 24.0
		if meantime >= HOURSPERDAY:
			meantime -= HOURSPERDAY
			y, m, d = util.incrDay(y, m, d)
		elif meantime < 0.0:
			meantime += HOURSPERDAY
			y, m, d = util.decrDay(y, m, d)

		if self.soltime:
			calflag = astrology.SE_GREG_CAL
			if self.chart.time.cal == chart.Time.JULIAN:
				calflag = astrology.SE_JUL_CAL
			yt = y
			if self.chart.time.bc:
				yt = -y
			jdmean = astrology.swe_julday(yt, m, d, meantime, calflag)

			#Get jdapp
			ret, te, serr = astrology.swe_time_equ(jdmean)
			jdapp = jdmean-te
			y, m, d, hr = astrology.swe_revjul(jdapp, calflag)
			hour,minute,second = util.decToDeg(hr)
#			print '%d:%02d:%02d' % (hour,minute,second)
		else:
			hour,minute,second = util.decToDeg(meantime)

		for i in range(self.age):
			if self.direct:
				y, m, d = util.incrDay(y, m, d)
			else:	
				y, m, d = util.decrDay(y, m, d)

		if self.soltime:
			#Back to meantime on the last day
			yt = y
			if self.chart.time.bc:
				yt = -y
			calflag = astrology.SE_GREG_CAL
			if self.chart.time.cal == chart.Time.JULIAN:
				calflag = astrology.SE_JUL_CAL
			jdapp = astrology.swe_julday(yt, m, d, hr, calflag)

			ret, te, serr = astrology.swe_time_equ(jdapp)
			jdmean = jdapp+te
			y, m, d, hr = astrology.swe_revjul(jdmean, calflag)
			hour,minute,second = util.decToDeg(hr)
#			print '%d:%02d:%02d' % (hour,minute,second)

		return y, m, d, hour, minute, second
	def calcTrueSolarArcRegressive(self, arc):
		LIM = 120.0 #arbitrary value
		y = self.chart.time.year
		m = self.chart.time.month
		d = self.chart.time.day

		h, mi, s = util.decToDeg(self.chart.time.time)
		tt = 0.0

		#Subtract arc from Suns's pos (long or ra)
		prSunPos = self.chart.planets.planets[astrology.SE_SUN].dataEqu[planets.Planet.RAEQU]
		if self.options.pdkeyd == primdirs.PrimDirs.TRUESOLARECLIPTICALARC:
			prSunPos = self.chart.planets.planets[astrology.SE_SUN].data[planets.Planet.LONG]

		prSunPosEnd = prSunPos-arc
		transition = False #Pisces-Aries
		if prSunPosEnd < 0.0:
			prSunPos += 360.0
			prSunPosEnd += 360.0
			transition = True

#		Find day in ephemeris
		while (prSunPos >= prSunPosEnd):
			y, m, d = util.decrDay(y, m, d)
			ti = chart.Time(y, m, d, 0, 0, 0, False, self.chart.time.cal, chart.Time.GREENWICH, True, 0, 0, False, self.chart.place, False)
			sun = planets.Planet(ti.jd, astrology.SE_SUN, astrology.SEFLG_SWIEPH)
			
			pos = sun.dataEqu[planets.Planet.RAEQU]
			if self.options.pdkeyd == primdirs.PrimDirs.TRUESOLARECLIPTICALARC:
				pos = sun.data[planets.Planet.LONG]
			if transition and pos < LIM:
				pos += 360.0
			prSunPos = pos

		if (prSunPos != prSunPosEnd):
			if transition:
				prSunPosEnd -= 360.0

			trlon = 0.0
			if self.options.pdkeyd == primdirs.PrimDirs.TRUESOLARECLIPTICALARC:
				trlon = prSunPosEnd
			else:
				#to Longitude...
				trlon = util.ra2ecl(prSunPosEnd, self.chart.obl[0])

			trans = transits.Transits()
			trans.day(y, m, d, self.chart, astrology.SE_SUN, trlon)

			if len(trans.transits) > 0:
				tt = trans.transits[0].time
		else:
			#the time is midnight
			tt = 0.0

		#difference
		th, tm, ts = util.decToDeg(tt)
		d1 = datetime.datetime(y, m, d, th, tm, ts) #in GMT
		d2 = datetime.datetime(self.chart.time.year, self.chart.time.month, self.chart.time.day, h, mi, s) #in GMT
		diff = d2-d1
		ddays = diff.days
		dtime = diff.seconds/3600.0
		#dtime to days
		dtimeindays = dtime/24.0

		tt = ddays+dtimeindays

		return tt