[modules/smartstatus] Use common boolean format
This commit is contained in:
parent
7d7324f6ed
commit
7d8b659a55
1 changed files with 6 additions and 5 deletions
|
@ -8,7 +8,7 @@
|
||||||
Parameters:
|
Parameters:
|
||||||
* smartstatus.display: how to display (defaults to 'combined', other choices: 'seperate' or 'singles')
|
* smartstatus.display: how to display (defaults to 'combined', other choices: 'seperate' or 'singles')
|
||||||
* smartstatus.drives: in the case of singles which drives to display, separated comma list value, multiple accepted (defaults to 'sda', example:'sda,sdc')
|
* smartstatus.drives: in the case of singles which drives to display, separated comma list value, multiple accepted (defaults to 'sda', example:'sda,sdc')
|
||||||
* smartstatus.shownames: boolean in the form of "True" or "False" to show the name of the drives in the form of sda, sbd, combined or none at all.
|
* smartstatus.show_names: boolean in the form of "True" or "False" to show the name of the drives in the form of sda, sbd, combined or none at all.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
@ -20,6 +20,7 @@ import core.widget
|
||||||
import core.decorators
|
import core.decorators
|
||||||
|
|
||||||
import util.cli
|
import util.cli
|
||||||
|
import util.format
|
||||||
|
|
||||||
|
|
||||||
class Module(core.module.Module):
|
class Module(core.module.Module):
|
||||||
|
@ -30,7 +31,7 @@ class Module(core.module.Module):
|
||||||
self.devices = self.list_devices()
|
self.devices = self.list_devices()
|
||||||
self.display = self.parameter("display", "combined")
|
self.display = self.parameter("display", "combined")
|
||||||
self.drives = self.parameter("drives", "sda")
|
self.drives = self.parameter("drives", "sda")
|
||||||
self.show_names = self.parameter("show_names", "True")
|
self.show_names = util.format.asbool(self.parameter("show_names", True))
|
||||||
self.widgets(self.create_widgets())
|
self.widgets(self.create_widgets())
|
||||||
|
|
||||||
def create_widgets(self):
|
def create_widgets(self):
|
||||||
|
@ -65,10 +66,10 @@ class Module(core.module.Module):
|
||||||
def output(self, widget):
|
def output(self, widget):
|
||||||
device = widget.get("device")
|
device = widget.get("device")
|
||||||
assessment = widget.get("assessment")
|
assessment = widget.get("assessment")
|
||||||
if self.show_names == "False":
|
if self.show_names:
|
||||||
widget.full_text("{}".format(assessment))
|
|
||||||
else:
|
|
||||||
widget.full_text("{}: {}".format(device, assessment))
|
widget.full_text("{}: {}".format(device, assessment))
|
||||||
|
else:
|
||||||
|
widget.full_text("{}".format(assessment))
|
||||||
|
|
||||||
def state(self, widget):
|
def state(self, widget):
|
||||||
states = []
|
states = []
|
||||||
|
|
Loading…
Reference in a new issue