sculpt: show system dialog only after prepare step

This commit is contained in:
Norman Feske 2023-04-27 12:34:24 +02:00
parent 8f0a191c2a
commit 6d91b5d51b
3 changed files with 30 additions and 15 deletions

View File

@ -507,6 +507,11 @@ struct Sculpt::Main : Input_event_handler,
bool settings_available() const override { return _settings.interactive_settings_available(); } bool settings_available() const override { return _settings.interactive_settings_available(); }
bool system_available() const override
{
return _storage._sculpt_partition.valid() && !_prepare_in_progress();
}
/** /**
* Dialog interface * Dialog interface
*/ */
@ -838,6 +843,10 @@ struct Sculpt::Main : Input_event_handler,
{ {
_download_queue.reset(); _download_queue.reset();
_storage.use(target); _storage.use(target);
/* hide system panel button and system dialog when "un-using" */
_panel_menu_view.generate();
_handle_window_layout();
} }
void _reset_storage_dialog_operation() void _reset_storage_dialog_operation()
@ -1590,16 +1599,18 @@ void Sculpt::Main::_handle_window_layout()
gen_window(win, Rect(log_p1, log_p2)); }); gen_window(win, Rect(log_p1, log_p2)); });
int system_right_xpos = 0; int system_right_xpos = 0;
_with_window(window_list, system_view_label, [&] (Xml_node win) { if (system_available()) {
Area const size = win_size(win); _with_window(window_list, system_view_label, [&] (Xml_node win) {
Point const pos = _system_visible Area const size = win_size(win);
? Point(0, avail.y1()) Point const pos = _system_visible
: Point(-size.w(), avail.y1()); ? Point(0, avail.y1())
gen_window(win, Rect(pos, size)); : Point(-size.w(), avail.y1());
gen_window(win, Rect(pos, size));
if (_system_visible) if (_system_visible)
system_right_xpos = size.w(); system_right_xpos = size.w();
}); });
}
_with_window(window_list, settings_view_label, [&] (Xml_node win) { _with_window(window_list, settings_view_label, [&] (Xml_node win) {
Area const size = win_size(win); Area const size = win_size(win);
@ -1958,6 +1969,7 @@ void Sculpt::Main::_handle_runtime_state()
/* trigger update and deploy */ /* trigger update and deploy */
reconfigure_runtime = true; reconfigure_runtime = true;
_panel_menu_view.generate(); /* show "System" button */
} }
} }

View File

@ -21,10 +21,10 @@ void Panel_dialog::generate(Xml_generator &xml) const
xml.node("frame", [&] () { xml.node("frame", [&] () {
xml.attribute("style", "unimportant"); xml.attribute("style", "unimportant");
if (_state.settings_available()) { gen_named_node(xml, "float", "left", [&] () {
gen_named_node(xml, "float", "left", [&] () { xml.attribute("west", true);
xml.attribute("west", true); xml.node("hbox", [&] () {
xml.node("hbox", [&] () { if (_state.system_available()) {
xml.node("button", [&] () { xml.node("button", [&] () {
_item.gen_button_attr(xml, "system"); _item.gen_button_attr(xml, "system");
if (_state.system_visible()) if (_state.system_visible())
@ -33,6 +33,8 @@ void Panel_dialog::generate(Xml_generator &xml) const
xml.attribute("text", "System"); xml.attribute("text", "System");
}); });
}); });
}
if (_state.settings_available()) {
xml.node("button", [&] () { xml.node("button", [&] () {
_item.gen_button_attr(xml, "settings"); _item.gen_button_attr(xml, "settings");
if (_state.settings_visible()) if (_state.settings_visible())
@ -41,9 +43,9 @@ void Panel_dialog::generate(Xml_generator &xml) const
xml.attribute("text", "Settings"); xml.attribute("text", "Settings");
}); });
}); });
}); }
}); });
} });
gen_named_node(xml, "float", "center", [&] () { gen_named_node(xml, "float", "center", [&] () {
xml.node("hbox", [&] () { xml.node("hbox", [&] () {

View File

@ -37,6 +37,7 @@ struct Sculpt::Panel_dialog : Dialog
virtual bool settings_visible() const = 0; virtual bool settings_visible() const = 0;
virtual bool network_visible() const = 0; virtual bool network_visible() const = 0;
virtual bool inspect_tab_visible() const = 0; virtual bool inspect_tab_visible() const = 0;
virtual bool system_available() const = 0;
virtual bool settings_available() const = 0; virtual bool settings_available() const = 0;
}; };