FIX: should not display sync dialog when open obj file
2. select machine with unchecked presets, cannot get the corresponding machine preset jira: 9070 9065 Change-Id: Ic971a17eef464bead4f247d769ab6be4facb68d1
This commit is contained in:
parent
4b083d8d82
commit
a297b57249
|
@ -4977,46 +4977,48 @@ std::vector<size_t> Plater::priv::load_files(const std::vector<fs::path>& input_
|
|||
}
|
||||
}
|
||||
|
||||
DeviceManager *dev = Slic3r::GUI::wxGetApp().getDeviceManager();
|
||||
if (dev) {
|
||||
MachineObject *obj = dev->get_selected_machine();
|
||||
if (obj && obj->is_info_ready()) {
|
||||
if (obj->m_extder_data.extders.size() > 0) {
|
||||
PresetBundle *preset_bundle = wxGetApp().preset_bundle;
|
||||
Preset &printer_preset = preset_bundle->printers.get_selected_preset();
|
||||
if (load_config) {
|
||||
DeviceManager *dev = Slic3r::GUI::wxGetApp().getDeviceManager();
|
||||
if (dev) {
|
||||
MachineObject *obj = dev->get_selected_machine();
|
||||
if (obj && obj->is_info_ready()) {
|
||||
if (obj->m_extder_data.extders.size() > 0) {
|
||||
PresetBundle *preset_bundle = wxGetApp().preset_bundle;
|
||||
Preset &printer_preset = preset_bundle->printers.get_selected_preset();
|
||||
|
||||
double preset_nozzle_diameter = 0.4;
|
||||
const ConfigOption *opt = printer_preset.config.option("nozzle_diameter");
|
||||
if (opt)
|
||||
preset_nozzle_diameter = static_cast<const ConfigOptionFloatsNullable *>(opt)->values[0];
|
||||
float machine_nozzle_diameter = obj->m_extder_data.extders[0].current_nozzle_diameter;
|
||||
double preset_nozzle_diameter = 0.4;
|
||||
const ConfigOption *opt = printer_preset.config.option("nozzle_diameter");
|
||||
if (opt) preset_nozzle_diameter = static_cast<const ConfigOptionFloatsNullable *>(opt)->values[0];
|
||||
float machine_nozzle_diameter = obj->m_extder_data.extders[0].current_nozzle_diameter;
|
||||
|
||||
std::string machine_type = obj->printer_type;
|
||||
if (obj->is_support_upgrade_kit && obj->installed_upgrade_kit)
|
||||
machine_type = "C12";
|
||||
std::string machine_type = obj->printer_type;
|
||||
if (obj->is_support_upgrade_kit && obj->installed_upgrade_kit) machine_type = "C12";
|
||||
|
||||
if (printer_preset.get_current_printer_type(preset_bundle) != machine_type || !is_approx((float) preset_nozzle_diameter, machine_nozzle_diameter)) {
|
||||
Preset *machine_preset = get_printer_preset(obj);
|
||||
if (machine_preset != nullptr) {
|
||||
bool sync_printer_info = false;
|
||||
if (!wxGetApp().app_config->has("sync_after_load_file_show_flag")) {
|
||||
wxString tips = from_u8((boost::format(L("The printer you are currently bound to is %s,\nThe printer preset for your current file is %s,\n")) %machine_preset->name % printer_preset.name).str());
|
||||
if (obj->is_multi_extruders())
|
||||
tips += L("Do you want to sync printer presets, ams and nozzle information immediately?");
|
||||
else
|
||||
tips += L("Do you want to sync printer presets immediately?");
|
||||
if (printer_preset.get_current_printer_type(preset_bundle) != machine_type || !is_approx((float) preset_nozzle_diameter, machine_nozzle_diameter)) {
|
||||
Preset *machine_preset = get_printer_preset(obj);
|
||||
if (machine_preset != nullptr) {
|
||||
bool sync_printer_info = false;
|
||||
if (!wxGetApp().app_config->has("sync_after_load_file_show_flag")) {
|
||||
wxString tips = from_u8((boost::format(L("The printer you are currently bound to is %s,\nThe printer preset for your current file is %s,\n")) %
|
||||
machine_preset->name % printer_preset.name)
|
||||
.str());
|
||||
if (obj->is_multi_extruders())
|
||||
tips += L("Do you want to sync printer presets, ams and nozzle information immediately?");
|
||||
else
|
||||
tips += L("Do you want to sync printer presets immediately?");
|
||||
|
||||
TipsDialog dlg(wxGetApp().mainframe, _L("Tips"), tips, "sync_after_load_file_show_flag", wxYES_NO);
|
||||
if (dlg.ShowModal() == wxID_YES) { sync_printer_info = true; }
|
||||
} else {
|
||||
sync_printer_info = wxGetApp().app_config->get("sync_after_load_file_show_flag") == "true";
|
||||
}
|
||||
if (sync_printer_info) {
|
||||
update_objects_position_when_select_preset([&obj, machine_preset]() {
|
||||
Tab *printer_tab = GUI::wxGetApp().get_tab(Preset::Type::TYPE_PRINTER);
|
||||
printer_tab->select_preset(machine_preset->name);
|
||||
if (obj->is_multi_extruders()) GUI::wxGetApp().sidebar().sync_extruder_list();
|
||||
});
|
||||
TipsDialog dlg(wxGetApp().mainframe, _L("Tips"), tips, "sync_after_load_file_show_flag", wxYES_NO);
|
||||
if (dlg.ShowModal() == wxID_YES) { sync_printer_info = true; }
|
||||
} else {
|
||||
sync_printer_info = wxGetApp().app_config->get("sync_after_load_file_show_flag") == "true";
|
||||
}
|
||||
if (sync_printer_info) {
|
||||
update_objects_position_when_select_preset([&obj, machine_preset]() {
|
||||
Tab *printer_tab = GUI::wxGetApp().get_tab(Preset::Type::TYPE_PRINTER);
|
||||
printer_tab->select_preset(machine_preset->name);
|
||||
if (obj->is_multi_extruders()) GUI::wxGetApp().sidebar().sync_extruder_list();
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -416,6 +416,8 @@ void PresetComboBox::add_connected_printers(std::string selected, bool alias_nam
|
|||
set_label_marker(Append(separator(L("My Printer")), wxNullBitmap));
|
||||
m_first_printer_idx = GetCount();
|
||||
for (auto iter = machine_list.begin(); iter != machine_list.end(); ++iter) {
|
||||
Preset* printer_preset = get_printer_preset(iter->second);
|
||||
printer_preset->is_visible = true;
|
||||
int item_id = Append(from_u8(iter->second->dev_name), wxNullBitmap, &m_first_printer_idx + std::distance(machine_list.begin(), iter));
|
||||
}
|
||||
m_last_printer_idx = GetCount();
|
||||
|
|
Loading…
Reference in New Issue