diff --git a/dash-frontend/assets/gui/dashboard.xml b/dash-frontend/assets/gui/dashboard.xml
index 5d214f2..9a0c017 100644
--- a/dash-frontend/assets/gui/dashboard.xml
+++ b/dash-frontend/assets/gui/dashboard.xml
@@ -29,7 +29,7 @@
-
\ No newline at end of file
+
diff --git a/wgui/src/parser/component_button.rs b/wgui/src/parser/component_button.rs
index 9857d80..aa58840 100644
--- a/wgui/src/parser/component_button.rs
+++ b/wgui/src/parser/component_button.rs
@@ -5,7 +5,7 @@ use crate::{
i18n::Translation,
layout::WidgetID,
parser::{
- parse_check_f32, parse_check_i32, parse_children, parse_f32, print_invalid_attrib, process_component,
+ parse_children, parse_f32, process_component,
style::{parse_color_opt, parse_round, parse_style, parse_text_style},
AttribPair, ParserContext, ParserFile,
},
@@ -19,6 +19,7 @@ pub fn parse_component_button<'a>(
node: roxmltree::Node<'a, 'a>,
parent_id: WidgetID,
attribs: &[AttribPair],
+ tag_name: &str,
) -> anyhow::Result
{
let mut color: Option = None;
let mut border = 2.0;
@@ -34,8 +35,8 @@ pub fn parse_component_button<'a>(
let mut translation: Option = None;
- let text_style = parse_text_style(attribs);
- let style = parse_style(attribs);
+ let text_style = parse_text_style(ctx, attribs, tag_name);
+ let style = parse_style(ctx, attribs, tag_name);
for pair in attribs {
let (key, value) = (pair.attrib.as_ref(), pair.value.as_ref());
@@ -51,22 +52,29 @@ pub fn parse_component_button<'a>(
}
}
"round" => {
- parse_round(value, &mut round, ctx.doc_params.globals.get().defaults.rounding_mult);
+ parse_round(
+ ctx,
+ tag_name,
+ key,
+ value,
+ &mut round,
+ ctx.doc_params.globals.get().defaults.rounding_mult,
+ );
}
"color" => {
- parse_color_opt(value, &mut color);
+ parse_color_opt(ctx, tag_name, key, value, &mut color);
}
"border" => {
- parse_check_f32(value, &mut border);
+ ctx.parse_check_f32(tag_name, key, value, &mut border);
}
"border_color" => {
- parse_color_opt(value, &mut border_color);
+ parse_color_opt(ctx, tag_name, key, value, &mut border_color);
}
"hover_color" => {
- parse_color_opt(value, &mut hover_color);
+ parse_color_opt(ctx, tag_name, key, value, &mut hover_color);
}
"hover_border_color" => {
- parse_color_opt(value, &mut hover_border_color);
+ parse_color_opt(ctx, tag_name, key, value, &mut hover_border_color);
}
"sprite_src" | "sprite_src_ext" | "sprite_src_builtin" | "sprite_src_internal" => {
let asset_path = match key {
@@ -90,14 +98,14 @@ pub fn parse_component_button<'a>(
"top" => Some(tooltip::TooltipSide::Top),
"bottom" => Some(tooltip::TooltipSide::Bottom),
_ => {
- print_invalid_attrib(key, value);
+ ctx.print_invalid_attrib(tag_name, key, value);
None
}
}
}
"sticky" => {
let mut sticky_i32 = 0;
- sticky = parse_check_i32(value, &mut sticky_i32) && sticky_i32 == 1;
+ sticky = ctx.parse_check_i32(tag_name, key, value, &mut sticky_i32) && sticky_i32 == 1;
}
"long_press_time" => {
long_press_time = parse_f32(value).unwrap_or(long_press_time);
diff --git a/wgui/src/parser/component_checkbox.rs b/wgui/src/parser/component_checkbox.rs
index 5cf7c26..5d3cdd5 100644
--- a/wgui/src/parser/component_checkbox.rs
+++ b/wgui/src/parser/component_checkbox.rs
@@ -2,9 +2,7 @@ use crate::{
components::{checkbox, radio_group::ComponentRadioGroup, Component},
i18n::Translation,
layout::WidgetID,
- parser::{
- parse_check_f32, parse_check_i32, process_component, style::parse_style, AttribPair, Fetchable, ParserContext,
- },
+ parser::{process_component, style::parse_style, AttribPair, Fetchable, ParserContext},
};
pub enum CheckboxKind {
@@ -16,6 +14,7 @@ pub fn parse_component_checkbox(
ctx: &mut ParserContext,
parent_id: WidgetID,
attribs: &[AttribPair],
+ tag_name: &str,
kind: CheckboxKind,
) -> anyhow::Result {
let mut box_size = 24.0;
@@ -23,7 +22,7 @@ pub fn parse_component_checkbox(
let mut checked = 0;
let mut component_value = None;
- let style = parse_style(attribs);
+ let style = parse_style(ctx, attribs, tag_name);
for pair in attribs {
let (key, value) = (pair.attrib.as_ref(), pair.value.as_ref());
@@ -42,10 +41,10 @@ pub fn parse_component_checkbox(
component_value = Some(value.into());
}
"box_size" => {
- parse_check_f32(value, &mut box_size);
+ ctx.parse_check_f32(tag_name, key, value, &mut box_size);
}
"checked" => {
- parse_check_i32(value, &mut checked);
+ ctx.parse_check_i32(tag_name, key, value, &mut checked);
}
_ => {}
}
diff --git a/wgui/src/parser/component_radio_group.rs b/wgui/src/parser/component_radio_group.rs
index 7cab53a..6587b08 100644
--- a/wgui/src/parser/component_radio_group.rs
+++ b/wgui/src/parser/component_radio_group.rs
@@ -1,7 +1,7 @@
use crate::{
- components::{Component, radio_group},
+ components::{radio_group, Component},
layout::WidgetID,
- parser::{AttribPair, ParserContext, ParserFile, parse_children, process_component, style::parse_style},
+ parser::{parse_children, process_component, style::parse_style, AttribPair, ParserContext, ParserFile},
};
pub fn parse_component_radio_group<'a>(
@@ -10,8 +10,9 @@ pub fn parse_component_radio_group<'a>(
node: roxmltree::Node<'a, 'a>,
parent_id: WidgetID,
attribs: &[AttribPair],
+ tag_name: &str,
) -> anyhow::Result {
- let style = parse_style(attribs);
+ let style = parse_style(ctx, attribs, tag_name);
let (widget, component) = radio_group::construct(&mut ctx.get_construct_essentials(parent_id), style)?;
diff --git a/wgui/src/parser/component_slider.rs b/wgui/src/parser/component_slider.rs
index 54f3fdf..4a6e1a3 100644
--- a/wgui/src/parser/component_slider.rs
+++ b/wgui/src/parser/component_slider.rs
@@ -1,7 +1,7 @@
use crate::{
- components::{Component, slider},
+ components::{slider, Component},
layout::WidgetID,
- parser::{AttribPair, ParserContext, parse_check_f32, parse_check_i32, process_component, style::parse_style},
+ parser::{process_component, style::parse_style, AttribPair, ParserContext},
widget::ConstructEssentials,
};
@@ -9,6 +9,7 @@ pub fn parse_component_slider(
ctx: &mut ParserContext,
parent_id: WidgetID,
attribs: &[AttribPair],
+ tag_name: &str,
) -> anyhow::Result {
let mut min_value = 0.0;
let mut max_value = 1.0;
@@ -16,25 +17,25 @@ pub fn parse_component_slider(
let mut step = 1.0;
let mut show_value = 1;
- let style = parse_style(attribs);
+ let style = parse_style(ctx, attribs, tag_name);
for pair in attribs {
let (key, value) = (pair.attrib.as_ref(), pair.value.as_ref());
match key {
"min_value" => {
- parse_check_f32(value, &mut min_value);
+ ctx.parse_check_f32(tag_name, key, value, &mut min_value);
}
"max_value" => {
- parse_check_f32(value, &mut max_value);
+ ctx.parse_check_f32(tag_name, key, value, &mut max_value);
}
"value" => {
- parse_check_f32(value, &mut initial_value);
+ ctx.parse_check_f32(tag_name, key, value, &mut initial_value);
}
"step" => {
- parse_check_f32(value, &mut step);
+ ctx.parse_check_f32(tag_name, key, value, &mut step);
}
"show_value" => {
- parse_check_i32(value, &mut show_value);
+ ctx.parse_check_i32(tag_name, key, value, &mut show_value);
}
_ => {}
}
diff --git a/wgui/src/parser/mod.rs b/wgui/src/parser/mod.rs
index 7f1c144..e5c7f76 100644
--- a/wgui/src/parser/mod.rs
+++ b/wgui/src/parser/mod.rs
@@ -10,16 +10,9 @@ mod widget_rectangle;
mod widget_sprite;
use crate::{
- assets::{AssetPath, AssetPathOwned, normalize_path},
- components::{Component, ComponentWeak},
- drawing::{self},
- globals::WguiGlobals,
- i18n::Translation,
- layout::{Layout, LayoutParams, LayoutState, Widget, WidgetID, WidgetMap, WidgetPair},
- log::LogErr,
- parser::{
+ assets::{normalize_path, AssetPath, AssetPathOwned}, components::{Component, ComponentWeak}, drawing::{self}, globals::WguiGlobals, i18n::Translation, layout::{Layout, LayoutParams, LayoutState, Widget, WidgetID, WidgetMap, WidgetPair}, log::LogErr, parser::{
component_button::parse_component_button,
- component_checkbox::{CheckboxKind, parse_component_checkbox},
+ component_checkbox::{parse_component_checkbox, CheckboxKind},
component_radio_group::parse_component_radio_group,
component_slider::parse_component_slider,
widget_div::parse_widget_div,
@@ -27,9 +20,7 @@ use crate::{
widget_label::parse_widget_label,
widget_rectangle::parse_widget_rectangle,
widget_sprite::parse_widget_sprite,
- },
- widget::ConstructEssentials,
- windowing::context_menu,
+ }, widget::ConstructEssentials, windowing::context_menu
};
use anyhow::Context;
use ouroboros::self_referencing;
@@ -224,7 +215,7 @@ impl ParserState {
template_parameters: HashMap, Rc>,
) -> anyhow::Result {
let Some(template) = self.data.templates.get(template_name) else {
- anyhow::bail!("no template named \"{template_name}\" found");
+ anyhow::bail!("{:?}: no template named \"{template_name}\" found", self.path.get_path_buf());
};
let mut ctx = ParserContext {
@@ -314,7 +305,7 @@ impl ParserState {
});
}
other => {
- anyhow::bail!("unexpected <{other}> tag");
+ anyhow::bail!("{:?}: unexpected <{other}> tag", self.path.get_path_buf());
}
}
}
@@ -443,7 +434,7 @@ impl ParserContext<'_> {
.insert(id.clone(), component.weak())
.is_some()
{
- log::warn!("duplicate component ID \"{id}\" in the same layout file!");
+ log::warn!("{}: duplicate component ID \"{id}\"", self.doc_params.path.get_str());
}
self.data_local.components.push(component);
@@ -451,7 +442,7 @@ impl ParserContext<'_> {
fn insert_id(&mut self, id: &Rc, widget_id: WidgetID) {
if self.data_local.ids.insert(id.clone(), widget_id).is_some() {
- log::warn!("duplicate widget ID \"{id}\" in the same layout file!");
+ log::warn!("{}: duplicate widget ID \"{id}\"", self.doc_params.path.get_str());
}
}
@@ -479,6 +470,77 @@ impl ParserContext<'_> {
insert_color_vars!(self, "faded", def.faded_color, def.translucent_alpha);
insert_color_vars!(self, "bg", def.bg_color, def.translucent_alpha);
}
+fn print_invalid_attrib(&self, tag_name: &str, key: &str, value: &str) {
+ log::warn!("{}: <{tag_name}> value for \"{key}\" is invalid: \"{value}\"", self.doc_params.path.get_str());
+}
+
+fn print_missing_attrib(&self, tag_name: &str, attr: &str) {
+ log::warn!("{}: <{tag_name}> is missing \"{attr}\".", self.doc_params.path.get_str());
+}
+
+fn parse_val(&self, tag_name: &str, key: &str, value: &str) -> Option {
+ let Ok(val) = value.parse::() else {
+ self.print_invalid_attrib(tag_name, key, value);
+ return None;
+ };
+ Some(val)
+}
+
+fn parse_percent(&self, tag_name: &str, key: &str, value: &str) -> Option {
+ let Some(val_str) = value.split('%').next() else {
+ self.print_invalid_attrib(tag_name, key, value);
+ return None;
+ };
+
+ let Ok(val) = val_str.parse::() else {
+ self.print_invalid_attrib(tag_name, key, value);
+ return None;
+ };
+ Some(val / 100.0)
+}
+
+fn parse_size_unit(&self, tag_name: &str, key: &str, value: &str) -> Option
+where
+ T: taffy::prelude::FromPercent + taffy::prelude::FromLength,
+{
+ if is_percent(value) {
+ Some(taffy::prelude::percent(self.parse_percent(tag_name, key, value)?))
+ } else {
+ Some(taffy::prelude::length(parse_f32(value)?))
+ }
+}
+
+fn parse_check_i32(&self, tag_name: &str, key: &str, value: &str, num: &mut i32) -> bool {
+ if let Some(value) = parse_i32(value) {
+ *num = value;
+ true
+ } else {
+ self.print_invalid_attrib(tag_name, key, value);
+ false
+ }
+}
+
+fn parse_check_f32(&self, tag_name: &str, key: &str, value: &str, num: &mut f32) -> bool {
+ if let Some(value) = parse_f32(value) {
+ *num = value;
+ true
+ } else {
+ self.print_invalid_attrib(tag_name, key, value);
+ false
+ }
+}
+}
+
+fn parse_i32(value: &str) -> Option {
+ value.parse::().ok()
+}
+
+fn parse_f32(value: &str) -> Option {
+ value.parse::().ok()
+}
+
+fn is_percent(value: &str) -> bool {
+ value.ends_with('%')
}
// Parses a color from a HTML hex string
@@ -510,7 +572,6 @@ pub fn parse_color_hex(html_hex: &str) -> Option {
f32::from(a) / 255.,
));
}
- log::warn!("failed to parse color \"{html_hex}\"");
None
}
@@ -522,81 +583,6 @@ fn require_tag_by_name<'a>(node: &roxmltree::Node<'a, 'a>, name: &str) -> anyhow
get_tag_by_name(node, name).ok_or_else(|| anyhow::anyhow!("Tag \"{name}\" not found"))
}
-fn print_invalid_attrib(key: &str, value: &str) {
- log::warn!("Invalid value \"{value}\" in attribute \"{key}\"");
-}
-
-fn print_missing_attrib(tag_name: &str, attr: &str) {
- log::warn!("Missing attribute {attr} in tag <{tag_name}>");
-}
-
-fn print_invalid_value(value: &str) {
- log::warn!("Invalid value \"{value}\"");
-}
-
-fn parse_val(value: &str) -> Option {
- let Ok(val) = value.parse::() else {
- print_invalid_value(value);
- return None;
- };
- Some(val)
-}
-
-fn is_percent(value: &str) -> bool {
- value.ends_with('%')
-}
-
-fn parse_percent(value: &str) -> Option {
- let Some(val_str) = value.split('%').next() else {
- print_invalid_value(value);
- return None;
- };
-
- let Ok(val) = val_str.parse::() else {
- print_invalid_value(value);
- return None;
- };
- Some(val / 100.0)
-}
-
-fn parse_i32(value: &str) -> Option {
- value.parse::().ok()
-}
-
-fn parse_f32(value: &str) -> Option {
- value.parse::().ok()
-}
-
-fn parse_check_i32(value: &str, num: &mut i32) -> bool {
- if let Some(value) = parse_i32(value) {
- *num = value;
- true
- } else {
- print_invalid_value(value);
- false
- }
-}
-
-fn parse_check_f32(value: &str, num: &mut f32) -> bool {
- if let Some(value) = parse_f32(value) {
- *num = value;
- true
- } else {
- print_invalid_value(value);
- false
- }
-}
-
-fn parse_size_unit(value: &str) -> Option
-where
- T: taffy::prelude::FromPercent + taffy::prelude::FromLength,
-{
- if is_percent(value) {
- Some(taffy::prelude::percent(parse_percent(value)?))
- } else {
- Some(taffy::prelude::length(parse_f32(value)?))
- }
-}
fn parse_widget_other_internal(
template: &Rc,
@@ -631,7 +617,7 @@ fn parse_widget_other(
attribs: &[AttribPair],
) -> anyhow::Result<()> {
let Some(template) = ctx.get_template(xml_tag_name) else {
- log::error!("Undefined tag named \"{xml_tag_name}\"");
+ log::error!("{}: Undefined tag named \"{xml_tag_name}\"", ctx.doc_params.path.get_str());
return Ok(()); // not critical
};
@@ -647,6 +633,8 @@ fn parse_tag_include(
parent_id: WidgetID,
attribs: &[AttribPair],
) -> anyhow::Result<()> {
+ const TAG_NAME: &str = "include";
+
let mut path = None;
let mut optional = false;
@@ -678,16 +666,16 @@ fn parse_tag_include(
}
"optional" => {
let mut optional_i32 = 0;
- optional = parse_check_i32(&pair.value, &mut optional_i32) && optional_i32 == 1;
+ optional = ctx.parse_check_i32(TAG_NAME, &pair.attrib, &pair.value, &mut optional_i32) && optional_i32 == 1;
}
_ => {
- print_invalid_attrib(pair.attrib.as_ref(), pair.value.as_ref());
+ ctx.print_invalid_attrib(TAG_NAME, pair.attrib.as_ref(), pair.value.as_ref());
}
}
}
let Some(path) = path else {
- log::warn!("include tag with no source! specify either: src, src_builtin, src_internal");
+ ctx.print_missing_attrib("include", "src");
return Ok(());
};
let path_ref = path.as_ref();
@@ -703,7 +691,7 @@ fn parse_tag_include(
Ok(())
}
-fn parse_tag_var<'a>(ctx: &mut ParserContext, node: roxmltree::Node<'a, 'a>) {
+fn parse_tag_var<'a>(ctx: &mut ParserContext, tag_name: &str, node: roxmltree::Node<'a, 'a>) {
let mut out_key: Option<&str> = None;
let mut out_value: Option<&str> = None;
@@ -718,18 +706,18 @@ fn parse_tag_var<'a>(ctx: &mut ParserContext, node: roxmltree::Node<'a, 'a>) {
out_value = Some(value);
}
_ => {
- print_invalid_attrib(key, value);
+ ctx.print_invalid_attrib(tag_name, key, value);
}
}
}
let Some(key) = out_key else {
- print_missing_attrib("var", "key");
+ ctx.print_missing_attrib(tag_name, "key");
return;
};
let Some(value) = out_value else {
- print_missing_attrib("var", "value");
+ ctx.print_missing_attrib(tag_name, "value");
return;
};
@@ -769,7 +757,10 @@ fn process_attrib(
match ctx.get_var(name) {
Some(name) => AttribPair::new(key, name),
- None => AttribPair::new(key, "undefined"),
+ None => {
+ log::warn!("{}: undefined variable \"{value}\"", ctx.doc_params.path.get_str());
+ AttribPair::new(key, "undefined")
+ },
}
} else {
AttribPair::new(key, replace_vars(value, template_parameters))
@@ -806,7 +797,7 @@ fn process_attribs<'a>(
res.push(process_attrib(&file.template_parameters, ctx, macro_key, macro_value));
}
} else {
- log::warn!("requested macro named \"{value}\" not found!");
+ log::warn!("{}: requested macro named \"{value}\" not found!", ctx.doc_params.path.get_str());
}
} else {
res.push(process_attrib(&file.template_parameters, ctx, key, value));
@@ -821,11 +812,11 @@ fn parse_tag_theme<'a>(ctx: &mut ParserContext, node: roxmltree::Node<'a, 'a>) {
let child_name = child_node.tag_name().name();
match child_name {
"var" => {
- parse_tag_var(ctx, child_node);
+ parse_tag_var(ctx, child_name, child_node);
}
"" => { /* ignore */ }
_ => {
- print_invalid_value(child_name);
+ log::warn!("{}: <{child_name}> is not a valid child to .", ctx.doc_params.path.get_str());
}
}
}
@@ -842,13 +833,13 @@ fn parse_tag_template(file: &ParserFile, ctx: &mut ParserContext, node: roxmltre
template_name = Some(pair.value);
}
_ => {
- print_invalid_attrib(pair.value.as_ref(), pair.value.as_ref());
+ ctx.print_invalid_attrib("template", &pair.attrib, pair.value.as_ref());
}
}
}
-
+
let Some(name) = template_name else {
- log::error!("Template name not specified, ignoring");
+ ctx.print_missing_attrib("template", "name");
return;
};
@@ -874,14 +865,14 @@ fn parse_tag_macro(file: &ParserFile, ctx: &mut ParserContext, node: roxmltree::
}
_ => {
if macro_attribs.insert(pair.attrib.clone(), pair.value).is_some() {
- log::warn!("macro attrib \"{}\" already defined!", pair.attrib);
+ log::warn!("{}: macro attrib \"{}\" already defined!", ctx.doc_params.path.get_str(), pair.attrib);
}
}
}
}
let Some(name) = macro_name else {
- log::error!("Macro name not specified, ignoring");
+ ctx.print_missing_attrib("macro", "name");
return;
};
@@ -904,7 +895,7 @@ fn process_component(ctx: &mut ParserContext, component: Component, widget_id: W
ctx.insert_component(widget_id, component, component_id);
}
-fn parse_widget_universal(ctx: &mut ParserContext, widget: &WidgetPair, attribs: &[AttribPair]) {
+fn parse_widget_universal(ctx: &mut ParserContext, widget: &WidgetPair, attribs: &[AttribPair], tag_name: &str) {
for pair in attribs {
#[allow(clippy::single_match)]
match pair.attrib.as_ref() {
@@ -916,21 +907,21 @@ fn parse_widget_universal(ctx: &mut ParserContext, widget: &WidgetPair, attribs:
if let Some(num) = parse_i32(&pair.value) {
widget.widget.state().flags.new_pass = num != 0;
} else {
- print_invalid_attrib(&pair.attrib, &pair.value);
+ ctx.print_invalid_attrib(tag_name, &pair.attrib, &pair.value);
}
}
"interactable" => {
if let Some(num) = parse_i32(&pair.value) {
widget.widget.state().flags.interactable = num != 0;
} else {
- print_invalid_attrib(&pair.attrib, &pair.value);
+ ctx.print_invalid_attrib(tag_name, &pair.attrib, &pair.value);
}
}
"consume_mouse_events" => {
if let Some(num) = parse_i32(&pair.value) {
widget.widget.state().flags.consume_mouse_events = num != 0;
} else {
- print_invalid_attrib(&pair.attrib, &pair.value);
+ ctx.print_invalid_attrib(tag_name, &pair.attrib, &pair.value);
}
}
_ => {}
@@ -945,6 +936,7 @@ fn parse_child<'a>(
child_node: roxmltree::Node<'a, 'a>,
parent_id: WidgetID,
) -> anyhow::Result<()> {
+ let tag_name = child_node.tag_name().name();
match parent_node.attribute("ignore_in_mode") {
Some("dev") => {
if !ctx.doc_params.extra.dev_mode {
@@ -956,44 +948,44 @@ fn parse_child<'a>(
return Ok(()); // do not parse
}
}
- Some(s) => print_invalid_attrib("ignore_in_mode", s),
+ Some(s) => ctx.print_invalid_attrib(tag_name, "ignore_in_mode", s),
_ => {}
}
let attribs = process_attribs(file, ctx, &child_node, false);
-
let mut new_widget_id: Option = None;
- match child_node.tag_name().name() {
+ match tag_name {
"include" => {
parse_tag_include(file, ctx, parent_id, &attribs)?;
}
"div" => {
- new_widget_id = Some(parse_widget_div(file, ctx, child_node, parent_id, &attribs)?);
+ new_widget_id = Some(parse_widget_div(file, ctx, child_node, parent_id, &attribs, tag_name)?);
}
"rectangle" => {
- new_widget_id = Some(parse_widget_rectangle(file, ctx, child_node, parent_id, &attribs)?);
+ new_widget_id = Some(parse_widget_rectangle(file, ctx, child_node, parent_id, &attribs, tag_name)?);
}
"label" => {
- new_widget_id = Some(parse_widget_label(file, ctx, child_node, parent_id, &attribs)?);
+ new_widget_id = Some(parse_widget_label(file, ctx, child_node, parent_id, &attribs, tag_name)?);
}
"sprite" => {
- new_widget_id = Some(parse_widget_sprite(file, ctx, child_node, parent_id, &attribs)?);
+ new_widget_id = Some(parse_widget_sprite(file, ctx, child_node, parent_id, &attribs, tag_name)?);
}
"image" => {
- new_widget_id = Some(parse_widget_image(file, ctx, child_node, parent_id, &attribs)?);
+ new_widget_id = Some(parse_widget_image(file, ctx, child_node, parent_id, &attribs, tag_name)?);
}
"Button" => {
- new_widget_id = Some(parse_component_button(file, ctx, child_node, parent_id, &attribs)?);
+ new_widget_id = Some(parse_component_button(file, ctx, child_node, parent_id, &attribs, tag_name)?);
}
"Slider" => {
- new_widget_id = Some(parse_component_slider(ctx, parent_id, &attribs)?);
+ new_widget_id = Some(parse_component_slider(ctx, parent_id, &attribs, tag_name)?);
}
"CheckBox" => {
new_widget_id = Some(parse_component_checkbox(
ctx,
parent_id,
&attribs,
+ tag_name,
CheckboxKind::CheckBox,
)?);
}
@@ -1002,11 +994,12 @@ fn parse_child<'a>(
ctx,
parent_id,
&attribs,
+ tag_name,
CheckboxKind::RadioBox,
)?);
}
"RadioGroup" => {
- new_widget_id = Some(parse_component_radio_group(file, ctx, child_node, parent_id, &attribs)?);
+ new_widget_id = Some(parse_component_radio_group(file, ctx, child_node, parent_id, &attribs, tag_name)?);
}
"" => { /* ignore */ }
other_tag_name => {
diff --git a/wgui/src/parser/style.rs b/wgui/src/parser/style.rs
index 2a308d9..2f6607a 100644
--- a/wgui/src/parser/style.rs
+++ b/wgui/src/parser/style.rs
@@ -5,45 +5,55 @@ use taffy::{
use crate::{
drawing,
- parser::{
- AttribPair, is_percent, parse_color_hex, parse_f32, parse_percent, parse_size_unit, parse_val,
- print_invalid_attrib, print_invalid_value,
- },
+ parser::{is_percent, parse_color_hex, parse_f32, AttribPair, ParserContext},
renderer_vk::text::{FontWeight, HorizontalAlign, TextStyle},
widget::util::WLength,
};
-pub fn parse_round(value: &str, round: &mut WLength, multiplier: f32) {
+pub fn parse_round(
+ ctx: &ParserContext<'_>,
+ tag_name: &str,
+ key: &str,
+ value: &str,
+ round: &mut WLength,
+ multiplier: f32,
+) {
if is_percent(value) {
- if let Some(val) = parse_percent(value) {
+ if let Some(val) = ctx.parse_percent(tag_name, key, value) {
*round = WLength::Percent(val);
} else {
- print_invalid_value(value);
+ ctx.print_invalid_attrib(tag_name, key, value);
}
} else if let Some(val) = parse_f32(value) {
*round = WLength::Units((val * multiplier).max(0.));
} else {
- print_invalid_value(value);
+ ctx.print_invalid_attrib(tag_name, key, value);
}
}
-pub fn parse_color(value: &str, color: &mut drawing::Color) {
+pub fn parse_color(ctx: &ParserContext<'_>, tag_name: &str, key: &str, value: &str, color: &mut drawing::Color) {
if let Some(res_color) = parse_color_hex(value) {
*color = res_color;
} else {
- print_invalid_value(value);
+ ctx.print_invalid_attrib(tag_name, key, value);
}
}
-pub fn parse_color_opt(value: &str, color: &mut Option) {
+pub fn parse_color_opt(
+ ctx: &ParserContext<'_>,
+ tag_name: &str,
+ key: &str,
+ value: &str,
+ color: &mut Option,
+) {
if let Some(res_color) = parse_color_hex(value) {
*color = Some(res_color);
} else {
- print_invalid_value(value);
+ ctx.print_invalid_attrib(tag_name, key, value);
}
}
-pub fn parse_text_style(attribs: &[AttribPair]) -> TextStyle {
+pub fn parse_text_style(ctx: &ParserContext<'_>, attribs: &[AttribPair], tag_name: &str) -> TextStyle {
let mut style = TextStyle::default();
for pair in attribs {
@@ -61,7 +71,7 @@ pub fn parse_text_style(attribs: &[AttribPair]) -> TextStyle {
"justified" => style.align = Some(HorizontalAlign::Justified),
"end" => style.align = Some(HorizontalAlign::End),
_ => {
- print_invalid_attrib(key, value);
+ ctx.print_invalid_attrib(tag_name, key, value);
}
},
"weight" => match value {
@@ -69,14 +79,14 @@ pub fn parse_text_style(attribs: &[AttribPair]) -> TextStyle {
"normal" => style.weight = Some(FontWeight::Normal),
"bold" => style.weight = Some(FontWeight::Bold),
_ => {
- print_invalid_attrib(key, value);
+ ctx.print_invalid_attrib(tag_name, key, value);
}
},
"size" => {
if let Ok(size) = value.parse::() {
style.size = Some(size);
} else {
- print_invalid_attrib(key, value);
+ ctx.print_invalid_attrib(tag_name, key, value);
}
}
"shadow" => {
@@ -88,21 +98,21 @@ pub fn parse_text_style(attribs: &[AttribPair]) -> TextStyle {
if let Ok(x) = value.parse::() {
style.shadow.get_or_insert_default().x = x;
} else {
- print_invalid_attrib(key, value);
+ ctx.print_invalid_attrib(tag_name, key, value);
}
}
"shadow_y" => {
if let Ok(y) = value.parse::() {
style.shadow.get_or_insert_default().y = y;
} else {
- print_invalid_attrib(key, value);
+ ctx.print_invalid_attrib(tag_name, key, value);
}
}
"wrap" => {
if let Ok(y) = value.parse::() {
style.wrap = y == 1;
} else {
- print_invalid_attrib(key, value);
+ ctx.print_invalid_attrib(tag_name, key, value);
}
}
_ => {}
@@ -114,7 +124,7 @@ pub fn parse_text_style(attribs: &[AttribPair]) -> TextStyle {
#[allow(clippy::too_many_lines)]
#[allow(clippy::cognitive_complexity)]
-pub fn parse_style(attribs: &[AttribPair]) -> taffy::Style {
+pub fn parse_style(ctx: &ParserContext<'_>, attribs: &[AttribPair], tag_name: &str) -> taffy::Style {
let mut style = taffy::Style::default();
for pair in attribs {
@@ -126,51 +136,51 @@ pub fn parse_style(attribs: &[AttribPair]) -> taffy::Style {
"grid" => style.display = Display::Grid,
"none" => style.display = Display::None,
_ => {
- print_invalid_attrib(key, value);
+ ctx.print_invalid_attrib(tag_name, key, value);
}
},
"margin_left" => {
- if let Some(dim) = parse_size_unit(value) {
+ if let Some(dim) = ctx.parse_size_unit(tag_name, key, value) {
style.margin.left = dim;
}
}
"margin_right" => {
- if let Some(dim) = parse_size_unit(value) {
+ if let Some(dim) = ctx.parse_size_unit(tag_name, key, value) {
style.margin.right = dim;
}
}
"margin_top" => {
- if let Some(dim) = parse_size_unit(value) {
+ if let Some(dim) = ctx.parse_size_unit(tag_name, key, value) {
style.margin.top = dim;
}
}
"margin_bottom" => {
- if let Some(dim) = parse_size_unit(value) {
+ if let Some(dim) = ctx.parse_size_unit(tag_name, key, value) {
style.margin.bottom = dim;
}
}
"padding_left" => {
- if let Some(dim) = parse_size_unit(value) {
+ if let Some(dim) = ctx.parse_size_unit(tag_name, key, value) {
style.padding.left = dim;
}
}
"padding_right" => {
- if let Some(dim) = parse_size_unit(value) {
+ if let Some(dim) = ctx.parse_size_unit(tag_name, key, value) {
style.padding.right = dim;
}
}
"padding_top" => {
- if let Some(dim) = parse_size_unit(value) {
+ if let Some(dim) = ctx.parse_size_unit(tag_name, key, value) {
style.padding.top = dim;
}
}
"padding_bottom" => {
- if let Some(dim) = parse_size_unit(value) {
+ if let Some(dim) = ctx.parse_size_unit(tag_name, key, value) {
style.padding.bottom = dim;
}
}
"margin" => {
- if let Some(dim) = parse_size_unit(value) {
+ if let Some(dim) = ctx.parse_size_unit(tag_name, key, value) {
style.margin.left = dim;
style.margin.right = dim;
style.margin.top = dim;
@@ -178,7 +188,7 @@ pub fn parse_style(attribs: &[AttribPair]) -> taffy::Style {
}
}
"padding" => {
- if let Some(dim) = parse_size_unit(value) {
+ if let Some(dim) = ctx.parse_size_unit(tag_name, key, value) {
style.padding.left = dim;
style.padding.right = dim;
style.padding.top = dim;
@@ -203,7 +213,7 @@ pub fn parse_style(attribs: &[AttribPair]) -> taffy::Style {
style.overflow.y = Overflow::Scroll;
}
_ => {
- print_invalid_attrib(key, value);
+ ctx.print_invalid_attrib(tag_name, key, value);
}
},
"overflow_x" => match value {
@@ -212,7 +222,7 @@ pub fn parse_style(attribs: &[AttribPair]) -> taffy::Style {
"clip" => style.overflow.x = Overflow::Clip,
"scroll" => style.overflow.x = Overflow::Scroll,
_ => {
- print_invalid_attrib(key, value);
+ ctx.print_invalid_attrib(tag_name, key, value);
}
},
"overflow_y" => match value {
@@ -221,56 +231,56 @@ pub fn parse_style(attribs: &[AttribPair]) -> taffy::Style {
"clip" => style.overflow.y = Overflow::Clip,
"scroll" => style.overflow.y = Overflow::Scroll,
_ => {
- print_invalid_attrib(key, value);
+ ctx.print_invalid_attrib(tag_name, key, value);
}
},
"min_width" => {
- if let Some(dim) = parse_size_unit(value) {
+ if let Some(dim) = ctx.parse_size_unit(tag_name, key, value) {
style.min_size.width = dim;
}
}
"min_height" => {
- if let Some(dim) = parse_size_unit(value) {
+ if let Some(dim) = ctx.parse_size_unit(tag_name, key, value) {
style.min_size.height = dim;
}
}
"max_width" => {
- if let Some(dim) = parse_size_unit(value) {
+ if let Some(dim) = ctx.parse_size_unit(tag_name, key, value) {
style.max_size.width = dim;
}
}
"max_height" => {
- if let Some(dim) = parse_size_unit(value) {
+ if let Some(dim) = ctx.parse_size_unit(tag_name, key, value) {
style.max_size.height = dim;
}
}
"width" => {
- if let Some(dim) = parse_size_unit(value) {
+ if let Some(dim) = ctx.parse_size_unit(tag_name, key, value) {
style.size.width = dim;
}
}
"height" => {
- if let Some(dim) = parse_size_unit(value) {
+ if let Some(dim) = ctx.parse_size_unit(tag_name, key, value) {
style.size.height = dim;
}
}
"gap" => {
- if let Some(val) = parse_size_unit(value) {
+ if let Some(val) = ctx.parse_size_unit(tag_name, key, value) {
style.gap = val;
}
}
"flex_basis" => {
- if let Some(val) = parse_size_unit(value) {
+ if let Some(val) = ctx.parse_size_unit(tag_name, key, value) {
style.flex_basis = val;
}
}
"flex_grow" => {
- if let Some(val) = parse_val(value) {
+ if let Some(val) = ctx.parse_val(tag_name, key, value) {
style.flex_grow = val;
}
}
"flex_shrink" => {
- if let Some(val) = parse_val(value) {
+ if let Some(val) = ctx.parse_val(tag_name, key, value) {
style.flex_shrink = val;
}
}
@@ -278,14 +288,14 @@ pub fn parse_style(attribs: &[AttribPair]) -> taffy::Style {
"absolute" => style.position = taffy::Position::Absolute,
"relative" => style.position = taffy::Position::Relative,
_ => {
- print_invalid_attrib(key, value);
+ ctx.print_invalid_attrib(tag_name, key, value);
}
},
"box_sizing" => match value {
"border_box" => style.box_sizing = BoxSizing::BorderBox,
"content_box" => style.box_sizing = BoxSizing::ContentBox,
_ => {
- print_invalid_attrib(key, value);
+ ctx.print_invalid_attrib(tag_name, key, value);
}
},
"align_self" => match value {
@@ -297,7 +307,7 @@ pub fn parse_style(attribs: &[AttribPair]) -> taffy::Style {
"start" => style.align_self = Some(AlignSelf::Start),
"stretch" => style.align_self = Some(AlignSelf::Stretch),
_ => {
- print_invalid_attrib(key, value);
+ ctx.print_invalid_attrib(tag_name, key, value);
}
},
"justify_self" => match value {
@@ -308,7 +318,7 @@ pub fn parse_style(attribs: &[AttribPair]) -> taffy::Style {
"start" => style.justify_self = Some(JustifySelf::Start),
"stretch" => style.justify_self = Some(JustifySelf::Stretch),
_ => {
- print_invalid_attrib(key, value);
+ ctx.print_invalid_attrib(tag_name, key, value);
}
},
"align_items" => match value {
@@ -320,7 +330,7 @@ pub fn parse_style(attribs: &[AttribPair]) -> taffy::Style {
"start" => style.align_items = Some(AlignItems::Start),
"stretch" => style.align_items = Some(AlignItems::Stretch),
_ => {
- print_invalid_attrib(key, value);
+ ctx.print_invalid_attrib(tag_name, key, value);
}
},
"align_content" => match value {
@@ -334,7 +344,7 @@ pub fn parse_style(attribs: &[AttribPair]) -> taffy::Style {
"start" => style.align_content = Some(AlignContent::Start),
"stretch" => style.align_content = Some(AlignContent::Stretch),
_ => {
- print_invalid_attrib(key, value);
+ ctx.print_invalid_attrib(tag_name, key, value);
}
},
"justify_content" => match value {
@@ -348,7 +358,7 @@ pub fn parse_style(attribs: &[AttribPair]) -> taffy::Style {
"start" => style.justify_content = Some(JustifyContent::Start),
"stretch" => style.justify_content = Some(JustifyContent::Stretch),
_ => {
- print_invalid_attrib(key, value);
+ ctx.print_invalid_attrib(tag_name, key, value);
}
},
"flex_wrap" => match value {
@@ -363,7 +373,7 @@ pub fn parse_style(attribs: &[AttribPair]) -> taffy::Style {
"row_reverse" => style.flex_direction = FlexDirection::RowReverse,
"row" => style.flex_direction = FlexDirection::Row,
_ => {
- print_invalid_attrib(key, value);
+ ctx.print_invalid_attrib(tag_name, key, value);
}
},
_ => {}
diff --git a/wgui/src/parser/widget_div.rs b/wgui/src/parser/widget_div.rs
index 5c5fdbb..bd755cc 100644
--- a/wgui/src/parser/widget_div.rs
+++ b/wgui/src/parser/widget_div.rs
@@ -1,6 +1,6 @@
use crate::{
layout::WidgetID,
- parser::{AttribPair, ParserContext, ParserFile, parse_children, parse_widget_universal, style::parse_style},
+ parser::{parse_children, parse_widget_universal, style::parse_style, AttribPair, ParserContext, ParserFile},
widget::div::WidgetDiv,
};
@@ -10,12 +10,13 @@ pub fn parse_widget_div<'a>(
node: roxmltree::Node<'a, 'a>,
parent_id: WidgetID,
attribs: &[AttribPair],
+ tag_name: &str,
) -> anyhow::Result {
- let style = parse_style(attribs);
+ let style = parse_style(ctx, attribs, tag_name);
let (widget, _) = ctx.layout.add_child(parent_id, WidgetDiv::create(), style)?;
- parse_widget_universal(ctx, &widget, attribs);
+ parse_widget_universal(ctx, &widget, attribs, tag_name);
parse_children(file, ctx, node, widget.id)?;
Ok(widget.id)
diff --git a/wgui/src/parser/widget_image.rs b/wgui/src/parser/widget_image.rs
index 997766c..007b536 100644
--- a/wgui/src/parser/widget_image.rs
+++ b/wgui/src/parser/widget_image.rs
@@ -2,8 +2,9 @@ use crate::{
assets::AssetPath,
layout::WidgetID,
parser::{
- AttribPair, ParserContext, ParserFile, parse_children, parse_widget_universal, print_invalid_attrib,
+ parse_children, parse_widget_universal,
style::{parse_color, parse_round, parse_style},
+ AttribPair, ParserContext, ParserFile,
},
renderer_vk::text::custom_glyph::CustomGlyphData,
widget::image::{WidgetImage, WidgetImageParams},
@@ -15,9 +16,10 @@ pub fn parse_widget_image<'a>(
node: roxmltree::Node<'a, 'a>,
parent_id: WidgetID,
attribs: &[AttribPair],
+ tag_name: &str,
) -> anyhow::Result {
let mut params = WidgetImageParams::default();
- let style = parse_style(attribs);
+ let style = parse_style(ctx, attribs, tag_name);
let mut glyph = None;
for pair in attribs {
@@ -44,6 +46,9 @@ pub fn parse_widget_image<'a>(
}
"round" => {
parse_round(
+ ctx,
+ tag_name,
+ key,
value,
&mut params.round,
ctx.doc_params.globals.get().defaults.rounding_mult,
@@ -51,12 +56,12 @@ pub fn parse_widget_image<'a>(
}
"border" => {
params.border = value.parse().unwrap_or_else(|_| {
- print_invalid_attrib(key, value);
+ ctx.print_invalid_attrib(tag_name, key, value);
0.0
});
}
"border_color" => {
- parse_color(value, &mut params.border_color);
+ parse_color(ctx, tag_name, key, value, &mut params.border_color);
}
_ => {}
}
@@ -65,12 +70,12 @@ pub fn parse_widget_image<'a>(
if let Some(glyph) = glyph {
params.glyph_data = Some(glyph);
} else {
- log::warn!("No source for image node!");
+ ctx.print_missing_attrib(tag_name, "src");
}
let (widget, _) = ctx.layout.add_child(parent_id, WidgetImage::create(params), style)?;
- parse_widget_universal(ctx, &widget, attribs);
+ parse_widget_universal(ctx, &widget, attribs, tag_name);
parse_children(file, ctx, node, widget.id)?;
Ok(widget.id)
diff --git a/wgui/src/parser/widget_label.rs b/wgui/src/parser/widget_label.rs
index 1ace124..4d3e497 100644
--- a/wgui/src/parser/widget_label.rs
+++ b/wgui/src/parser/widget_label.rs
@@ -2,8 +2,9 @@ use crate::{
i18n::Translation,
layout::WidgetID,
parser::{
- AttribPair, ParserContext, ParserFile, parse_children, parse_i32, parse_widget_universal, print_invalid_attrib,
+ parse_children, parse_i32, parse_widget_universal,
style::{parse_style, parse_text_style},
+ AttribPair, ParserContext, ParserFile,
},
widget::label::{WidgetLabel, WidgetLabelParams},
};
@@ -14,11 +15,12 @@ pub fn parse_widget_label<'a>(
node: roxmltree::Node<'a, 'a>,
parent_id: WidgetID,
attribs: &[AttribPair],
+ tag_name: &str,
) -> anyhow::Result {
let mut params = WidgetLabelParams::default();
- let style = parse_style(attribs);
- params.style = parse_text_style(attribs);
+ let style = parse_style(ctx, attribs, tag_name);
+ params.style = parse_text_style(ctx, attribs, tag_name);
for pair in attribs {
let (key, value) = (pair.attrib.as_ref(), pair.value.as_ref());
@@ -27,7 +29,7 @@ pub fn parse_widget_label<'a>(
if let Some(num) = parse_i32(value) {
params.style.wrap = num == 1;
} else {
- print_invalid_attrib(key, value);
+ ctx.print_invalid_attrib(tag_name, key, value);
}
}
"text" => {
@@ -50,7 +52,7 @@ pub fn parse_widget_label<'a>(
.layout
.add_child(parent_id, WidgetLabel::create(&mut globals.get(), params), style)?;
- parse_widget_universal(ctx, &widget, attribs);
+ parse_widget_universal(ctx, &widget, attribs, tag_name);
parse_children(file, ctx, node, widget.id)?;
Ok(widget.id)
diff --git a/wgui/src/parser/widget_rectangle.rs b/wgui/src/parser/widget_rectangle.rs
index 3346304..78b424a 100644
--- a/wgui/src/parser/widget_rectangle.rs
+++ b/wgui/src/parser/widget_rectangle.rs
@@ -2,8 +2,9 @@ use crate::{
drawing::GradientMode,
layout::WidgetID,
parser::{
- AttribPair, ParserContext, ParserFile, parse_children, parse_widget_universal, print_invalid_attrib,
+ parse_children, parse_widget_universal,
style::{parse_color, parse_round, parse_style},
+ AttribPair, ParserContext, ParserFile,
},
widget::rectangle::{WidgetRectangle, WidgetRectangleParams},
};
@@ -14,18 +15,19 @@ pub fn parse_widget_rectangle<'a>(
node: roxmltree::Node<'a, 'a>,
parent_id: WidgetID,
attribs: &[AttribPair],
+ tag_name: &str,
) -> anyhow::Result {
let mut params = WidgetRectangleParams::default();
- let style = parse_style(attribs);
+ let style = parse_style(ctx, attribs, tag_name);
for pair in attribs {
let (key, value) = (pair.attrib.as_ref(), pair.value.as_ref());
match key {
"color" => {
- parse_color(value, &mut params.color);
+ parse_color(ctx, tag_name, key, value, &mut params.color);
}
"color2" => {
- parse_color(value, &mut params.color2);
+ parse_color(ctx, tag_name, key, value, &mut params.color2);
}
"gradient" => {
params.gradient = match value {
@@ -34,13 +36,16 @@ pub fn parse_widget_rectangle<'a>(
"radial" => GradientMode::Radial,
"none" => GradientMode::None,
_ => {
- print_invalid_attrib(key, value);
+ ctx.print_invalid_attrib(tag_name, key, value);
GradientMode::None
}
}
}
"round" => {
parse_round(
+ ctx,
+ tag_name,
+ key,
value,
&mut params.round,
ctx.doc_params.globals.get().defaults.rounding_mult,
@@ -48,12 +53,12 @@ pub fn parse_widget_rectangle<'a>(
}
"border" => {
params.border = value.parse().unwrap_or_else(|_| {
- print_invalid_attrib(key, value);
+ ctx.print_invalid_attrib(tag_name, key, value);
0.0
});
}
"border_color" => {
- parse_color(value, &mut params.border_color);
+ parse_color(ctx, tag_name, key, value, &mut params.border_color);
}
_ => {}
}
@@ -63,7 +68,7 @@ pub fn parse_widget_rectangle<'a>(
.layout
.add_child(parent_id, WidgetRectangle::create(params), style)?;
- parse_widget_universal(ctx, &widget, attribs);
+ parse_widget_universal(ctx, &widget, attribs, tag_name);
parse_children(file, ctx, node, widget.id)?;
Ok(widget.id)
diff --git a/wgui/src/parser/widget_sprite.rs b/wgui/src/parser/widget_sprite.rs
index b70ace8..6938b0f 100644
--- a/wgui/src/parser/widget_sprite.rs
+++ b/wgui/src/parser/widget_sprite.rs
@@ -1,12 +1,12 @@
use crate::{
assets::AssetPath,
layout::WidgetID,
- parser::{AttribPair, ParserContext, ParserFile, parse_children, parse_widget_universal, style::parse_style},
+ parser::{parse_children, parse_widget_universal, style::parse_style, AttribPair, ParserContext, ParserFile},
renderer_vk::text::custom_glyph::CustomGlyphData,
widget::sprite::{WidgetSprite, WidgetSpriteParams},
};
-use super::{parse_color_hex, print_invalid_attrib};
+use super::parse_color_hex;
pub fn parse_widget_sprite<'a>(
file: &'a ParserFile,
@@ -14,9 +14,10 @@ pub fn parse_widget_sprite<'a>(
node: roxmltree::Node<'a, 'a>,
parent_id: WidgetID,
attribs: &[AttribPair],
+ tag_name: &str,
) -> anyhow::Result {
let mut params = WidgetSpriteParams::default();
- let style = parse_style(attribs);
+ let style = parse_style(ctx, attribs, tag_name);
let mut glyph = None;
for pair in attribs {
@@ -45,7 +46,7 @@ pub fn parse_widget_sprite<'a>(
if let Some(color) = parse_color_hex(value) {
params.color = Some(color);
} else {
- print_invalid_attrib(key, value);
+ ctx.print_invalid_attrib(tag_name, key, value);
}
}
_ => {}
@@ -55,12 +56,12 @@ pub fn parse_widget_sprite<'a>(
if let Some(glyph) = glyph {
params.glyph_data = Some(glyph);
} else {
- log::warn!("No source for sprite node!");
+ ctx.print_missing_attrib(tag_name, "src");
}
let (widget, _) = ctx.layout.add_child(parent_id, WidgetSprite::create(params), style)?;
- parse_widget_universal(ctx, &widget, attribs);
+ parse_widget_universal(ctx, &widget, attribs, tag_name);
parse_children(file, ctx, node, widget.id)?;
Ok(widget.id)
diff --git a/wgui/src/windowing/window.rs b/wgui/src/windowing/window.rs
index f70aa0b..4999b79 100644
--- a/wgui/src/windowing/window.rs
+++ b/wgui/src/windowing/window.rs
@@ -13,12 +13,7 @@ use crate::{
i18n::Translation,
layout::{Layout, LayoutTask, LayoutTasks, WidgetPair},
parser::{self, Fetchable, ParserState},
- widget::{
- div::WidgetDiv,
- label::WidgetLabel,
- rectangle::{WidgetRectangle, WidgetRectangleParams},
- EventResult,
- },
+ widget::{div::WidgetDiv, label::WidgetLabel, rectangle::WidgetRectangle, EventResult},
};
struct OpenedWindow {
diff --git a/wlx-overlay-s/src/assets/gui/keyboard.xml b/wlx-overlay-s/src/assets/gui/keyboard.xml
index c772fbe..6378a1b 100644
--- a/wlx-overlay-s/src/assets/gui/keyboard.xml
+++ b/wlx-overlay-s/src/assets/gui/keyboard.xml
@@ -108,7 +108,7 @@
@@ -123,7 +123,7 @@