mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-08-29 21:07:11 +00:00
Add unsupported-command feedback to the device UI
This commit is contained in:
@@ -4647,6 +4647,40 @@ void MachineObject::set_ctt_dlg( wxString text){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MachineObject::show_unsupported_dlg(int code)
|
||||||
|
{
|
||||||
|
// why: a dead control invites repeat clicks, and the frame is modeless - without the guard
|
||||||
|
// every click stacks another one. Same shape as set_ctt_dlg above, including the reset on
|
||||||
|
// both hide and close so a dismissed dialog can reappear on the next attempt.
|
||||||
|
if (m_unsupported_dlg_shown) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
m_unsupported_dlg_shown = true;
|
||||||
|
|
||||||
|
// why: two codes so the user learns which kind of dead end this is - the slicer having no
|
||||||
|
// translation for the command, or the printer's own config lacking the hardware to run it.
|
||||||
|
const wxString text = (code == ORCA_NETWORK_ERR_CAP_NOT_AVAILABLE) ?
|
||||||
|
_L("This printer is not configured with the hardware this control needs.") :
|
||||||
|
_L("This control is not supported on this printer.");
|
||||||
|
|
||||||
|
// note: constructed directly rather than through CallAfter because every publish_json caller
|
||||||
|
// is on the UI thread - clicks come from wx handlers, and the agent marshals its own push
|
||||||
|
// callbacks back to main before parse_json runs. set_ctt_dlg relies on the same property.
|
||||||
|
auto unsupported_dlg = new GUI::SecondaryCheckDialog(nullptr, wxID_ANY, _L("Warning"),
|
||||||
|
GUI::SecondaryCheckDialog::VisibleButtons::ONLY_CONFIRM);
|
||||||
|
unsupported_dlg->update_text(text);
|
||||||
|
unsupported_dlg->Bind(wxEVT_SHOW, [this](auto& e) {
|
||||||
|
if (!e.IsShown()) {
|
||||||
|
m_unsupported_dlg_shown = false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
unsupported_dlg->Bind(wxEVT_CLOSE_WINDOW, [this](auto& e) {
|
||||||
|
e.Skip();
|
||||||
|
m_unsupported_dlg_shown = false;
|
||||||
|
});
|
||||||
|
unsupported_dlg->on_show();
|
||||||
|
}
|
||||||
|
|
||||||
int MachineObject::publish_gcode(std::string gcode_str)
|
int MachineObject::publish_gcode(std::string gcode_str)
|
||||||
{
|
{
|
||||||
json j;
|
json j;
|
||||||
|
|||||||
@@ -272,9 +272,11 @@ public:
|
|||||||
bool m_is_online;
|
bool m_is_online;
|
||||||
bool m_lan_mode_connection_state{false};
|
bool m_lan_mode_connection_state{false};
|
||||||
bool m_set_ctt_dlg{ false };
|
bool m_set_ctt_dlg{ false };
|
||||||
|
bool m_unsupported_dlg_shown{ false };
|
||||||
void set_lan_mode_connection_state(bool state) {m_lan_mode_connection_state = state;};
|
void set_lan_mode_connection_state(bool state) {m_lan_mode_connection_state = state;};
|
||||||
bool get_lan_mode_connection_state() {return m_lan_mode_connection_state;};
|
bool get_lan_mode_connection_state() {return m_lan_mode_connection_state;};
|
||||||
void set_ctt_dlg( wxString text);
|
void set_ctt_dlg( wxString text);
|
||||||
|
void show_unsupported_dlg(int code);
|
||||||
int parse_msg_count = 0;
|
int parse_msg_count = 0;
|
||||||
int keep_alive_count = 0;
|
int keep_alive_count = 0;
|
||||||
std::chrono::system_clock::time_point last_update_time; /* last received print data from machine */
|
std::chrono::system_clock::time_point last_update_time; /* last received print data from machine */
|
||||||
|
|||||||
Reference in New Issue
Block a user