Adding moon phase module

This commit is contained in:
Aaron Fordham 2015-09-10 23:41:04 +00:00
parent ae8a57afdc
commit e939d54eaf

View File

@ -3,13 +3,12 @@ from i3pystatus import IntervalModule, formatp
import datetime
import math
import decimal
#import ephem
import os
from i3pystatus.core.util import TimeWrapper
dec = decimal.Decimal
# Moon phase module
class MoonPhase(IntervalModule):
@ -28,8 +27,6 @@ class MoonPhase(IntervalModule):
Last Quarter:
Waning Crescent:
}
"""
settings = (
@ -44,7 +41,6 @@ class MoonPhase(IntervalModule):
interval = 60 * 60 * 2 # every 2 hours
status = {
"New Moon": "NM",
@ -69,7 +65,6 @@ class MoonPhase(IntervalModule):
"Waning Crescent": "#FF341F",
}
def pos(now=None):
now = None
days_in_second = 86400
@ -85,7 +80,6 @@ class MoonPhase(IntervalModule):
return lunarCycle % dec(1)
def current_phase(self):
lunarCycle = self.pos()
@ -109,7 +103,6 @@ class MoonPhase(IntervalModule):
lunarCycle = float(self.pos()) * 100
if lunarCycle > 50:
phase = 100 - lunarCycle
else:
@ -119,15 +112,12 @@ class MoonPhase(IntervalModule):
def run(self):
fdict = {
"status": self.status[self.current_phase()],
"illum": self.illum(),
#"phase_color": self.phase_color[self.current_phase()],
}
self.output = {
"full_text": formatp(self.format, **fdict),
"color": self.phase_color[self.current_phase()],
}