add color support to some modules missing it (#735)
* add color support to some modules missing it Affects: amdgpu calendar deluge net_speed plexstatus
This commit is contained in:
parent
b9cb4af8ba
commit
b5a232c4a7
@ -18,10 +18,12 @@ class Amdgpu(IntervalModule):
|
|||||||
|
|
||||||
settings = (
|
settings = (
|
||||||
'format',
|
'format',
|
||||||
|
'color',
|
||||||
('card', '[1, 2, ...] card to read (options are in /sys/class/drm/)')
|
('card', '[1, 2, ...] card to read (options are in /sys/class/drm/)')
|
||||||
)
|
)
|
||||||
|
|
||||||
card = 0
|
card = 0
|
||||||
|
color = None
|
||||||
format = '{temp} {mclk} {sclk}'
|
format = '{temp} {mclk} {sclk}'
|
||||||
|
|
||||||
def init(self):
|
def init(self):
|
||||||
@ -56,6 +58,8 @@ class Amdgpu(IntervalModule):
|
|||||||
self.output = {
|
self.output = {
|
||||||
'full_text': self.format.format(**self.data)
|
'full_text': self.format.format(**self.data)
|
||||||
}
|
}
|
||||||
|
if self.color:
|
||||||
|
self.output['color'] = self.color
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def parse_clk_reading(reading):
|
def parse_clk_reading(reading):
|
||||||
|
@ -142,6 +142,7 @@ class Calendar(IntervalModule, ColorRangeModule):
|
|||||||
('urgent_seconds', "When within this many seconds of the event, set the urgent flag"),
|
('urgent_seconds', "When within this many seconds of the event, set the urgent flag"),
|
||||||
('urgent_blink', 'Whether or not to blink when within urgent_seconds of the event'),
|
('urgent_blink', 'Whether or not to blink when within urgent_seconds of the event'),
|
||||||
('dynamic_color', 'Whether or not to change color as the event approaches'),
|
('dynamic_color', 'Whether or not to change color as the event approaches'),
|
||||||
|
'color'
|
||||||
)
|
)
|
||||||
|
|
||||||
required = ('backend',)
|
required = ('backend',)
|
||||||
@ -155,6 +156,7 @@ class Calendar(IntervalModule, ColorRangeModule):
|
|||||||
dynamic_color = True
|
dynamic_color = True
|
||||||
urgent_seconds = 300
|
urgent_seconds = 300
|
||||||
urgent_blink = False
|
urgent_blink = False
|
||||||
|
color = None
|
||||||
|
|
||||||
current_event = None
|
current_event = None
|
||||||
urgent_acknowledged = False
|
urgent_acknowledged = False
|
||||||
@ -204,9 +206,14 @@ class Calendar(IntervalModule, ColorRangeModule):
|
|||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
if self.current_event and self.current_event.time_remaining > timedelta(seconds=0):
|
if self.current_event and self.current_event.time_remaining > timedelta(seconds=0):
|
||||||
|
color = None
|
||||||
|
if self.color is not None:
|
||||||
|
color = self.color
|
||||||
|
elif self.dynamic_color:
|
||||||
|
color = self.get_color()
|
||||||
self.output = {
|
self.output = {
|
||||||
"full_text": formatp(self.format, **self.current_event.formatters()),
|
"full_text": formatp(self.format, **self.current_event.formatters()),
|
||||||
"color": self.get_color() if self.dynamic_color else None,
|
"color": color,
|
||||||
"urgent": self.is_urgent()
|
"urgent": self.is_urgent()
|
||||||
}
|
}
|
||||||
else:
|
else:
|
||||||
|
@ -25,6 +25,7 @@ class Deluge(IntervalModule):
|
|||||||
|
|
||||||
settings = (
|
settings = (
|
||||||
'format',
|
'format',
|
||||||
|
'color',
|
||||||
('rounding', 'number of decimal places to round numbers too'),
|
('rounding', 'number of decimal places to round numbers too'),
|
||||||
('host', 'address of deluge server (default: 127.0.0.1)'),
|
('host', 'address of deluge server (default: 127.0.0.1)'),
|
||||||
('port', 'port of deluge server (default: 58846)'),
|
('port', 'port of deluge server (default: 58846)'),
|
||||||
@ -38,6 +39,7 @@ class Deluge(IntervalModule):
|
|||||||
host = '127.0.0.1'
|
host = '127.0.0.1'
|
||||||
port = 58846
|
port = 58846
|
||||||
path = None
|
path = None
|
||||||
|
color = None
|
||||||
libtorrent_stats = False
|
libtorrent_stats = False
|
||||||
rounding = 2
|
rounding = 2
|
||||||
offline_string = 'offline'
|
offline_string = 'offline'
|
||||||
@ -79,6 +81,8 @@ class Deluge(IntervalModule):
|
|||||||
self.output = {
|
self.output = {
|
||||||
'full_text': self.format.format(**self.data)
|
'full_text': self.format.format(**self.data)
|
||||||
}
|
}
|
||||||
|
if self.color:
|
||||||
|
self.output['color'] = self.color
|
||||||
|
|
||||||
def parse_values(self, values):
|
def parse_values(self, values):
|
||||||
for k, v in values.items():
|
for k, v in values.items():
|
||||||
|
@ -19,7 +19,8 @@ class NetSpeed(IntervalModule):
|
|||||||
|
|
||||||
settings = (
|
settings = (
|
||||||
("units", "Valid values are B, b, bytes, or bits"),
|
("units", "Valid values are B, b, bytes, or bits"),
|
||||||
"format"
|
"format",
|
||||||
|
'color'
|
||||||
)
|
)
|
||||||
color = "#FFFFFF"
|
color = "#FFFFFF"
|
||||||
interval = 300
|
interval = 300
|
||||||
|
@ -21,6 +21,7 @@ class Plexstatus(IntervalModule):
|
|||||||
|
|
||||||
settings = (
|
settings = (
|
||||||
"format",
|
"format",
|
||||||
|
"color",
|
||||||
("apikey", "Your Plex API authentication key"),
|
("apikey", "Your Plex API authentication key"),
|
||||||
("address", "Hostname or IP address of the Plex Media Server"),
|
("address", "Hostname or IP address of the Plex Media Server"),
|
||||||
("port", "Port which Plex Media Server is running on"),
|
("port", "Port which Plex Media Server is running on"),
|
||||||
|
Loading…
Reference in New Issue
Block a user