mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-09-01 22:37:03 +00:00
Gate agent mode behind use_printer_agents toggle
Replace per-printer auto-activation (is_current_printer_agent_plugin) with a global experimental AppConfig toggle, default off: legacy print-host behavior is unchanged until the user opts in. The toggle drives device-tab routing, print button defaults, connect-button visibility and sidebar layout, and dedups machine-select dialog opens.
This commit is contained in:
@@ -3246,7 +3246,7 @@ void Sidebar::update_all_preset_comboboxes()
|
||||
|
||||
auto p_mainframe = wxGetApp().mainframe;
|
||||
auto cfg = preset_bundle.printers.get_edited_preset().config;
|
||||
const bool use_native_device_tab = preset_bundle.use_bbl_device_tab() || NetworkAgentFactory::is_current_printer_agent_plugin();
|
||||
const bool use_native_device_tab = preset_bundle.use_bbl_device_tab() || wxGetApp().app_config->get_bool("use_printer_agents");
|
||||
|
||||
if (preset_bundle.use_bbl_network()) {
|
||||
//only show connection button for not-BBL printer
|
||||
@@ -3258,7 +3258,8 @@ void Sidebar::update_all_preset_comboboxes()
|
||||
p_mainframe->set_print_button_to_default(MainFrame::PrintSelectType::ePrintPlate);
|
||||
} else {
|
||||
//p->btn_connect_printer->Show();
|
||||
p->m_printer_connect->Show();
|
||||
// ORCA: hide the physical-printer connection button when printer agents are enabled
|
||||
p->m_printer_connect->Show(!wxGetApp().app_config->get_bool("use_printer_agents"));
|
||||
|
||||
// ORCA: show/hide sync-ams button based on filament sync mode
|
||||
auto agent = wxGetApp().getAgent();
|
||||
@@ -3280,7 +3281,9 @@ void Sidebar::update_all_preset_comboboxes()
|
||||
const auto host_type = cfg.option<ConfigOptionEnum<PrintHostType>>("host_type")->value;
|
||||
if (cfg.has("printhost_apikey") && (host_type != htSimplyPrint))
|
||||
apikey = cfg.opt_string("printhost_apikey");
|
||||
print_btn_type = preset_bundle.is_bbl_vendor() ? MainFrame::PrintSelectType::ePrintPlate : MainFrame::PrintSelectType::eSendGcode;
|
||||
print_btn_type = (preset_bundle.is_bbl_vendor() || wxGetApp().app_config->get_bool("use_printer_agents"))
|
||||
? MainFrame::PrintSelectType::ePrintPlate
|
||||
: MainFrame::PrintSelectType::eSendGcode;
|
||||
}
|
||||
|
||||
if (!use_native_device_tab)
|
||||
@@ -3439,7 +3442,10 @@ void Sidebar::update_presets(Preset::Type preset_type)
|
||||
|
||||
bool isBBL = preset_bundle.is_bbl_vendor();
|
||||
bool is_dual_extruder = extruder_variants->size() == 2;
|
||||
p->layout_printer(preset_bundle.use_bbl_network(), isBBL && is_dual_extruder);
|
||||
// why: agent mode drives the native device tab, so the sidebar lays out like BBL
|
||||
// (no physical-printer connect button).
|
||||
p->layout_printer(preset_bundle.use_bbl_network() || wxGetApp().app_config->get_bool("use_printer_agents"),
|
||||
isBBL && is_dual_extruder);
|
||||
|
||||
// Update nozzle titles from printer config (e.g. "Main Nozzle" / "Auxiliary Nozzle" for N6)
|
||||
// UI left = DEPUTY_EXTRUDER_ID(1), UI right = MAIN_EXTRUDER_ID(0)
|
||||
@@ -5625,6 +5631,7 @@ struct Plater::priv
|
||||
void on_action_slice_all(SimpleEvent&);
|
||||
void on_action_publish(wxCommandEvent &evt);
|
||||
void on_action_print_plate(SimpleEvent&);
|
||||
void open_machine_select_dialog(int plate_idx, PrintFromType print_type = PrintFromType::FROM_NORMAL);
|
||||
void on_action_print_all(SimpleEvent&);
|
||||
void on_action_export_gcode(SimpleEvent&);
|
||||
void on_action_send_gcode(SimpleEvent&);
|
||||
@@ -11166,18 +11173,23 @@ void Plater::priv::on_action_print_plate(SimpleEvent&)
|
||||
}
|
||||
|
||||
PresetBundle& preset_bundle = *wxGetApp().preset_bundle;
|
||||
if (preset_bundle.use_bbl_network()) {
|
||||
// BBS
|
||||
if (!m_select_machine_dlg)
|
||||
m_select_machine_dlg = new SelectMachineDialog(q);
|
||||
m_select_machine_dlg->set_print_type(PrintFromType::FROM_NORMAL);
|
||||
m_select_machine_dlg->prepare(partplate_list.get_curr_plate_index());
|
||||
m_select_machine_dlg->ShowModal();
|
||||
if (preset_bundle.use_bbl_network() || wxGetApp().app_config->get_bool("use_printer_agents")) {
|
||||
open_machine_select_dialog(partplate_list.get_curr_plate_index());
|
||||
} else {
|
||||
q->send_gcode_legacy(PLATE_CURRENT_IDX, nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
void Plater::priv::open_machine_select_dialog(int plate_idx, PrintFromType print_type)
|
||||
{
|
||||
// BBS
|
||||
if (!m_select_machine_dlg)
|
||||
m_select_machine_dlg = new SelectMachineDialog(q);
|
||||
m_select_machine_dlg->set_print_type(print_type);
|
||||
m_select_machine_dlg->prepare(plate_idx);
|
||||
m_select_machine_dlg->ShowModal();
|
||||
}
|
||||
|
||||
void Plater::priv::on_action_send_to_multi_machine(SimpleEvent&)
|
||||
{
|
||||
if (!m_send_multi_dlg)
|
||||
@@ -11193,10 +11205,7 @@ void Plater::priv::on_action_print_plate_from_sdcard(SimpleEvent&)
|
||||
}
|
||||
|
||||
//BBS
|
||||
if (!m_select_machine_dlg) m_select_machine_dlg = new SelectMachineDialog(q);
|
||||
m_select_machine_dlg->set_print_type(PrintFromType::FROM_SDCARD_VIEW);
|
||||
m_select_machine_dlg->prepare(0);
|
||||
m_select_machine_dlg->ShowModal();
|
||||
open_machine_select_dialog(0, PrintFromType::FROM_SDCARD_VIEW);
|
||||
}
|
||||
|
||||
void Plater::priv::on_tab_selection_changing(wxBookCtrlEvent& e)
|
||||
@@ -11211,13 +11220,13 @@ void Plater::priv::on_tab_selection_changing(wxBookCtrlEvent& e)
|
||||
sidebar_layout.show = new_sel == MainFrame::tp3DEditor || new_sel == MainFrame::tpPreview;
|
||||
update_sidebar();
|
||||
int old_sel = e.GetOldSelection();
|
||||
const bool is_printer_agent_plugin = NetworkAgentFactory::is_current_printer_agent_plugin();
|
||||
const bool use_printer_agents = wxGetApp().app_config->get_bool("use_printer_agents");
|
||||
const bool use_native_device_tab = wxGetApp().preset_bundle &&
|
||||
(wxGetApp().preset_bundle->use_bbl_device_tab() || is_printer_agent_plugin);
|
||||
(wxGetApp().preset_bundle->use_bbl_device_tab() || use_printer_agents);
|
||||
if (use_native_device_tab && new_sel == MainFrame::tpMonitor) {
|
||||
// BBL network module is only required for BBL-vendor printers.
|
||||
// Non-BBL Python plugins (e.g. moonraker) drive the Device tab without it.
|
||||
if (!is_printer_agent_plugin && wxGetApp().preset_bundle->is_bbl_vendor() && !Slic3r::NetworkAgent::is_network_module_loaded()) {
|
||||
if (!use_printer_agents && wxGetApp().preset_bundle->is_bbl_vendor() && !Slic3r::NetworkAgent::is_network_module_loaded()) {
|
||||
e.Veto();
|
||||
BOOST_LOG_TRIVIAL(info) << boost::format("skipped tab switch from %1% to %2%, lack of network plugins") % old_sel % new_sel;
|
||||
if (q) {
|
||||
@@ -11273,13 +11282,8 @@ void Plater::priv::on_action_print_all(SimpleEvent&)
|
||||
}
|
||||
|
||||
PresetBundle& preset_bundle = *wxGetApp().preset_bundle;
|
||||
if (preset_bundle.use_bbl_network()) {
|
||||
// BBS
|
||||
if (!m_select_machine_dlg)
|
||||
m_select_machine_dlg = new SelectMachineDialog(q);
|
||||
m_select_machine_dlg->set_print_type(PrintFromType::FROM_NORMAL);
|
||||
m_select_machine_dlg->prepare(PLATE_ALL_IDX);
|
||||
m_select_machine_dlg->ShowModal();
|
||||
if (preset_bundle.use_bbl_network() || wxGetApp().app_config->get_bool("use_printer_agents")) {
|
||||
open_machine_select_dialog(PLATE_ALL_IDX);
|
||||
} else {
|
||||
q->send_gcode_legacy(PLATE_ALL_IDX, nullptr);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user