Update moon.py

This commit is contained in:
enkore 2015-09-23 12:53:59 +02:00
parent 94ef50044e
commit 333a6dcdff

View File

@ -11,7 +11,6 @@ from i3pystatus.core.util import TimeWrapper
dec = decimal.Decimal dec = decimal.Decimal
# Moon phase module
class MoonPhase(IntervalModule): class MoonPhase(IntervalModule):
""" """
Available Formatters Available Formatters
@ -33,7 +32,6 @@ class MoonPhase(IntervalModule):
("status", "Current moon phase"), ("status", "Current moon phase"),
("illum", "Percentage that is illuminated"), ("illum", "Percentage that is illuminated"),
("color", "Set color"), ("color", "Set color"),
) )
format = "{illum} {status}" format = "{illum} {status}"
@ -41,7 +39,6 @@ class MoonPhase(IntervalModule):
interval = 60 * 60 * 2 # every 2 hours interval = 60 * 60 * 2 # every 2 hours
status = { status = {
"New Moon": "NM", "New Moon": "NM",
"Waxing Crescent": "WaxCres", "Waxing Crescent": "WaxCres",
"First Quarter": "FQ", "First Quarter": "FQ",
@ -50,7 +47,6 @@ class MoonPhase(IntervalModule):
"Waning Gibbous": "WanGib", "Waning Gibbous": "WanGib",
"Last Quarter": "LQ", "Last Quarter": "LQ",
"Waning Cresent": "WanCres", "Waning Cresent": "WanCres",
} }
color = { color = {
@ -99,19 +95,16 @@ class MoonPhase(IntervalModule):
if lunarCycle > 50: if lunarCycle > 50:
phase = 100 - lunarCycle phase = 100 - lunarCycle
else: else:
phase = lunarCycle * 2 phase = lunarCycle * 2
return phase return phase
def run(self): def run(self):
fdict = { fdict = {
"status": self.status[self.current_phase()], "status": self.status[self.current_phase()],
"illum": self.illum(), "illum": self.illum(),
} }
self.output = { self.output = {
"full_text": formatp(self.format, **fdict), "full_text": formatp(self.format, **fdict),
"color": self.color[self.current_phase()], "color": self.color[self.current_phase()],