Skip to content
Snippets Groups Projects
Commit f3b3b66f authored by Jiří Kalvoda's avatar Jiří Kalvoda
Browse files

Cleanup: Remove color option from all modules and parser

Please use _color instead.
parent 400b16a6
No related branches found
No related tags found
No related merge requests found
......@@ -110,15 +110,13 @@ interface Module
class ModuleConstant: Module
{
string text;
Color color;
public void Init(ModuleParent _bar, ConfigSection section)
{
text = section.Mandatory("text");
color = section?["color"]?.AsColor() ?? System.Drawing.ColorTranslator.FromHtml("white");
}
public IEnumerable<Block> Get()
{
return new Block[]{new Block(text, Color: color)};
return new Block[]{new Block(text)};
}
}
......@@ -138,14 +136,14 @@ class ModuleFile: Module
new ConfigParser(
@"
[constant]
color = red
_color = red
text = NFound
"));
ifReadError = new InnerStatusBar(_bar, section.Optional("error_handler")?.AsConfig() ??
new ConfigParser(
@"
[constant]
color = red
_color = red
text = ERR
"));
parser = _bar.GetGlobal<ParserGetter>().ByNameFromConfig(section.Optional("parser"));
......@@ -353,7 +351,7 @@ class ModuleHttp: ModuleSourceThreadAndParser
new ConfigParser(
@"
[constant]
color = red
_color = red
text = ERR
"));
period_ms = section.Optional("period")?.AsMs() ?? 10000;
......
......@@ -104,15 +104,13 @@ interface Parser
[ParserName("text")]
class ParserText: Parser
{
Color color;
public void Init(ModuleParent _bar, Module _module, ConfigSection section)
{
color = section.Optional("color")?.AsColor() ?? System.Drawing.ColorTranslator.FromHtml("white");
}
public IEnumerable<Block> Parse(string data)
{
if(data.Length > 0 && data[^1] == '\n') data = data[..^1];
return data.Split("\n").Select(x => new Block(x, Color: color)).ToArray();
return data.Split("\n").Select(x => new Block(x)).ToArray();
}
}
......
......@@ -176,7 +176,6 @@ short_format = {percent}
[constant]
# Just show some text
text = Hi!
color = red
[file]
......@@ -184,11 +183,11 @@ color = red
path = $HOME/file/to/show
# mandatory <path>
not_found_handler = [constant]
color = red
_color = red
text = NFound
# <config> default see above
error_handler = [constant]
color = red
_color = red
text = ERR
# <config> default see above
......@@ -267,7 +266,7 @@ stdin
# Fetch message from http(s) (for example a JSON api).
error_handler = [constant]
color = red
_color = red
text = ERR
# See file module
......@@ -317,10 +316,6 @@ _default_color = red
# Parser: text
# ------------
# Each line will be one segment of status bar.
#
# Options:
# color = red
# <color>
# Parser: osdd_last
# ------------
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment