Revamp UI a whole lot
This commit is contained in:
@@ -72,7 +72,8 @@ namespace KernelPanic.UI
|
||||
body.AddToClassList("software-body");
|
||||
// Break at a sentence boundary only. Never reinterpret effect amounts or conditions.
|
||||
int split = displayRules.IndexOf(". ", System.StringComparison.Ordinal);
|
||||
body.Add(Text(split < 0 ? displayRules : displayRules.Substring(0, split + 1), "software-effect"));
|
||||
int lineNumber = 1;
|
||||
body.Add(CodeLine(lineNumber++, Text(split < 0 ? displayRules : displayRules.Substring(0, split + 1), "software-effect")));
|
||||
if (split >= 0)
|
||||
{
|
||||
string details = displayRules.Substring(split + 2);
|
||||
@@ -86,10 +87,10 @@ namespace KernelPanic.UI
|
||||
var rule = new VisualElement();
|
||||
rule.AddToClassList("software-python-rule");
|
||||
rule.Add(Text(line, "software-conditions"));
|
||||
body.Add(rule);
|
||||
body.Add(CodeLine(lineNumber++, rule));
|
||||
}
|
||||
}
|
||||
else body.Add(Text(details, "software-conditions"));
|
||||
else body.Add(CodeLine(lineNumber, Text(details, "software-conditions")));
|
||||
}
|
||||
target.Add(body);
|
||||
|
||||
@@ -111,5 +112,14 @@ namespace KernelPanic.UI
|
||||
label.AddToClassList(className);
|
||||
return label;
|
||||
}
|
||||
|
||||
private static VisualElement CodeLine(int number, VisualElement content)
|
||||
{
|
||||
var row = new VisualElement();
|
||||
row.AddToClassList("software-code-line");
|
||||
row.Add(Text(number.ToString("00"), "software-line-number"));
|
||||
row.Add(content);
|
||||
return row;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user