Improved reshdift

This commit is contained in:
Martin 2020-05-07 06:44:27 +02:00
parent 45d893aaba
commit 478ee68f89

View file

@ -11,6 +11,7 @@ Parameters:
'auto' uses whatever redshift is configured to do 'auto' uses whatever redshift is configured to do
* redshift.lat : latitude if location is set to 'manual' * redshift.lat : latitude if location is set to 'manual'
* redshift.lon : longitude if location is set to 'manual' * redshift.lon : longitude if location is set to 'manual'
* redshift.transition_info: information about the transitions (x% day) defaults to True
""" """
import re import re
@ -74,6 +75,7 @@ class Module(core.module.Module):
super().__init__(config, theme, core.widget.Widget(self.text)) super().__init__(config, theme, core.widget.Widget(self.text))
self.__thread = None self.__thread = None
self.transition_info = self.parameter("transition_info", "True")
if self.parameter("location", "") == "ipinfo": if self.parameter("location", "") == "ipinfo":
# override lon/lat with ipinfo # override lon/lat with ipinfo
@ -91,7 +93,7 @@ class Module(core.module.Module):
def text(self, widget): def text(self, widget):
val = widget.get("temp", "n/a") val = widget.get("temp", "n/a")
transition = widget.get("transition", "") transition = widget.get("transition", "")
if transition: if transition and self.transition_info=="True":
val = "{} {}".format(val, transition) val = "{} {}".format(val, transition)
return val return val