palette requires restart + suppress fake errors

This commit is contained in:
galister 2026-07-13 00:30:22 +09:00
parent 7ab47ada4b
commit 6a064248dc
2 changed files with 5 additions and 2 deletions

View File

@ -14,6 +14,7 @@ use wlx_common::{config::GeneralConfig, dash_interface::ConfigChangeKind};
use crate::tab::settings::{
SettingType, SettingsMountParams, SettingsTab, Task, horiz_cell,
macros::{MacroParams, options_category, options_checkbox, options_dropdown, options_slider_f32},
mount_requires_restart,
};
pub struct State {}
@ -92,6 +93,8 @@ fn palettes_dropdown(mp: &mut MacroParams, parent: WidgetID) -> anyhow::Result<(
);
}
mount_requires_restart(mp.layout, parent)?;
let btn = mp.parser_state.fetch_component_as::<ComponentButton>(&id)?;
btn.on_click(Rc::new({
let parent_tasks = mp.tasks.clone();

View File

@ -145,7 +145,7 @@ impl ComponentTrait for ComponentButton {
for (child, _) in children {
if let Some(mut widget) = data.layout.state.widgets.get_as::<WidgetSprite>(child) {
if !state.id_sprite.is_null() {
if !state.id_sprite.is_null() && state.id_sprite != child {
log::error!("Button with more than one sprite!");
}
// apply initial color from button
@ -158,7 +158,7 @@ impl ComponentTrait for ComponentButton {
}
state.id_sprite = child;
} else if let Some(mut widget) = data.layout.state.widgets.get_as::<WidgetLabel>(child) {
if !state.id_label.is_null() {
if !state.id_label.is_null() && state.id_label != child {
log::error!("Button with more than one label!");
}
if let Some(on_color) = state.colors.color.on_color() {