diff --git a/src/libslic3r/AppConfig.cpp b/src/libslic3r/AppConfig.cpp index 2537358..4f9e26b 100644 --- a/src/libslic3r/AppConfig.cpp +++ b/src/libslic3r/AppConfig.cpp @@ -385,6 +385,10 @@ void AppConfig::set_defaults() if (get("allow_ip_resolve").empty()) set("allow_ip_resolve", "1"); + + if(get("switch to device tab after upload").empty()) + set_bool("switch to device tab after upload", false); + // Remove legacy window positions/sizes erase("app", "main_frame_maximized"); erase("app", "main_frame_pos"); diff --git a/src/libslic3r/GCode.cpp b/src/libslic3r/GCode.cpp index 8da9b34..febf97d 100644 --- a/src/libslic3r/GCode.cpp +++ b/src/libslic3r/GCode.cpp @@ -2130,6 +2130,10 @@ void GCode::_do_export(Print& print, GCodeOutputStream &file, ThumbnailsGenerato if (m_config.support_air_filtration.getBool() && m_config.activate_air_filtration.get_at(initial_extruder_id)) { file.write(m_writer.set_exhaust_fan(m_config.during_print_exhaust_fan_speed.get_at(initial_extruder_id), true)); } + //w36 + else { + file.write(m_writer.set_exhaust_fan(0, true)); + } print.throw_if_canceled(); @@ -2425,13 +2429,15 @@ void GCode::_do_export(Print& print, GCodeOutputStream &file, ThumbnailsGenerato activate_air_filtration |= m_config.activate_air_filtration.get_at(extruder.id()); activate_air_filtration &= m_config.support_air_filtration.getBool(); - if (activate_air_filtration) { + //w36 + /*if (activate_air_filtration) { int complete_print_exhaust_fan_speed = 0; for (const auto& extruder : m_writer.extruders()) if (m_config.activate_air_filtration.get_at(extruder.id())) complete_print_exhaust_fan_speed = std::max(complete_print_exhaust_fan_speed, m_config.complete_print_exhaust_fan_speed.get_at(extruder.id())); file.write(m_writer.set_exhaust_fan(complete_print_exhaust_fan_speed, true)); - } + }*/ + file.write(m_writer.set_exhaust_fan(0, true)); //w25 file.write(DoExport::update_print_stats_and_format_filament_stats( // Const inputs @@ -5720,9 +5726,104 @@ std::string GCode::set_object_info(Print* print) gcode << "EXCLUDE_OBJECT_DEFINE NAME=" << get_instance_name(object, inst) << " CENTER=" << center.x() << "," << center.y() << " POLYGON=" << polygon_to_string(inst.get_convex_hull_2d(), print) << "\n"; + + //w33 + std::string instance_name = get_instance_name(object, inst); + bool has_pa_pattern = false; + bool has_pa_line = false; + if (instance_name.find("pa_pattern") != std::string::npos) { + has_pa_pattern = true; + } + else if(instance_name.find("pa_line") != std::string::npos){ + has_pa_line = true; + + } + if ((has_pa_pattern == true || has_pa_line == true) &&(print->calib_params().mode == CalibMode::Calib_PA_Line || print->calib_params().mode == CalibMode::Calib_PA_Pattern)) { + double ext_x = 0; + double box_width = 0; + + double pa_line_width = print->default_region_config().outer_wall_line_width.value == 0 ? + print->default_object_config().line_width.value == 0 ? + EXTRUDER_CONFIG(nozzle_diameter) * 1.125 : + print->default_object_config().line_width.value : + print->default_region_config().outer_wall_line_width.value; + if (has_pa_line) + box_width = 80; + else if(has_pa_pattern) + box_width = 38 - pa_line_width - m_config.layer_height * (1 - M_PI / 4); + + + PrintInstance inst = print->objects().front()->instances().front(); + auto bbox = inst.get_bounding_box(); + + const Polygon polygon = inst.get_convex_hull_2d(); + + ext_x = print->translate_to_print_space(polygon.points.at(1)).x() - print->translate_to_print_space(polygon.points.front()).x(); + + std::ostringstream pa_area_poly_gcode; + pa_area_poly_gcode << "["; + + double sum_x = 0; + double sum_y = 0; + Vec2d first_v(print->translate_to_print_space(polygon.points.at(0)).x()+ ext_x, print->translate_to_print_space(polygon.points.at(0)).y()); + + for (int i = 0; i < polygon.points.size(); i++) { + const auto v = print->translate_to_print_space(polygon.points.at(i)); + if (i == 0 || i == 3) { + pa_area_poly_gcode << "[" << v.x() + ext_x << "," << v.y() << "],"; + sum_x += v.x() + ext_x; + sum_y += v.y(); + first_v(v.x() + ext_x, v.y()); + } + else if(i==1 || i == 2){ + pa_area_poly_gcode << "[" << v.x()+ box_width << "," << v.y() << "],"; + sum_x += v.x() + box_width; + sum_y += v.y(); + } + } + double center_x = sum_x / 4; + double center_y = sum_y / 4; + pa_area_poly_gcode << "[" << first_v.x() << "," << first_v.y() << "]"; + pa_area_poly_gcode << "]"; + + gcode << "EXCLUDE_OBJECT_DEFINE NAME=" << "calib_area_id_1_copy_0" << " CENTER=" << center_x + << "," << center_y << " POLYGON=" << pa_area_poly_gcode.str() + << "\n"; + + } } } } + + if (print->m_tool_ordering.has_wipe_tower()&& print->config().enable_prime_tower) { + const FakeWipeTower wipe_tower_data =print->m_fake_wipe_tower; + double wipe_tower_width = wipe_tower_data.width; + double wipe_tower_depth = wipe_tower_data.depth; + double wipe_tower_x = wipe_tower_data.pos.x(); + double wipe_tower_y = wipe_tower_data.pos.y(); + double wipe_tower_brim_width = wipe_tower_data.brim_width; + double real_width = wipe_tower_width + 2 * wipe_tower_brim_width; + double real_depth = wipe_tower_depth + 2 * wipe_tower_brim_width; + double first_tower_x = wipe_tower_x - wipe_tower_brim_width; + double first_tower_y = wipe_tower_y - wipe_tower_brim_width; + double center_x = first_tower_x + real_width / 2; + double center_y = first_tower_y + real_depth / 2; + + std::ostringstream wipe_tower_area_gcode; + wipe_tower_area_gcode << "["; + + wipe_tower_area_gcode << "[" << first_tower_x << "," << first_tower_y << "],"; + wipe_tower_area_gcode << "[" << first_tower_x + real_width << "," << first_tower_y << "],"; + wipe_tower_area_gcode << "[" << first_tower_x + real_width << "," << first_tower_y + real_depth << "],"; + wipe_tower_area_gcode << "[" << first_tower_x << "," << first_tower_y + real_depth << "],"; + + wipe_tower_area_gcode << "[" << first_tower_x << "," << first_tower_y << "]"; + wipe_tower_area_gcode << "]"; + + gcode << "EXCLUDE_OBJECT_DEFINE NAME=" << "wipe_tower_area" << " CENTER=" << center_x + << "," << center_y << " POLYGON=" << wipe_tower_area_gcode.str() + << "\n"; + } return gcode.str(); } diff --git a/src/libslic3r/Preset.cpp b/src/libslic3r/Preset.cpp index 38105d1..a970353 100644 --- a/src/libslic3r/Preset.cpp +++ b/src/libslic3r/Preset.cpp @@ -919,6 +919,8 @@ static std::vector s_Preset_printer_options { "printhost_cafile","printhost_port","printhost_authorization_type", "printhost_user", "printhost_password", "printhost_ssl_ignore_revoke", "use_relative_e_distances", "extruder_type","use_firmware_retraction" + //w34 + ,"support_multi_bed_types" }; static std::vector s_Preset_sla_print_options { diff --git a/src/libslic3r/PresetBundle.cpp b/src/libslic3r/PresetBundle.cpp index 96d6243..70efc9a 100644 --- a/src/libslic3r/PresetBundle.cpp +++ b/src/libslic3r/PresetBundle.cpp @@ -45,9 +45,12 @@ static std::vector s_project_options { //QDS: add QDT as default const char *PresetBundle::QDT_BUNDLE = "QDT"; -const char *PresetBundle::QDT_DEFAULT_PRINTER_MODEL = "QIDI Lab X1 Carbon"; +const char *PresetBundle::QDT_BUNDLE_Q = "Q Series"; +const char *PresetBundle::QDT_BUNDLE_X_3 = "X 3 Series"; +const char *PresetBundle::QDT_BUNDLE_X_4 = "X 4 Series"; +const char *PresetBundle::QDT_DEFAULT_PRINTER_MODEL = "X-Plus 4"; const char *PresetBundle::QDT_DEFAULT_PRINTER_VARIANT = "0.4"; -const char *PresetBundle::QDT_DEFAULT_FILAMENT = "Generic PLA"; +const char *PresetBundle::QDT_DEFAULT_FILAMENT = "QIDI PLA Rapido"; PresetBundle::PresetBundle() : prints(Preset::TYPE_PRINT, Preset::print_options(), static_cast(FullPrintConfig::defaults())) diff --git a/src/libslic3r/PresetBundle.hpp b/src/libslic3r/PresetBundle.hpp index f8951c4..813afcc 100644 --- a/src/libslic3r/PresetBundle.hpp +++ b/src/libslic3r/PresetBundle.hpp @@ -243,6 +243,9 @@ public: //QDS: add QDT as default static const char *QDT_BUNDLE; + static const char *QDT_BUNDLE_Q; + static const char *QDT_BUNDLE_X_3; + static const char *QDT_BUNDLE_X_4; static const char *QDT_DEFAULT_PRINTER_MODEL; static const char *QDT_DEFAULT_PRINTER_VARIANT; static const char *QDT_DEFAULT_FILAMENT; diff --git a/src/libslic3r/Print.cpp b/src/libslic3r/Print.cpp index 05278cc..c207b7d 100644 --- a/src/libslic3r/Print.cpp +++ b/src/libslic3r/Print.cpp @@ -258,7 +258,9 @@ bool Print::invalidate_state_by_config_options(const ConfigOptionResolver & /* n || opt_key == "initial_layer_infill_speed" || opt_key == "travel_speed" || opt_key == "travel_speed_z" - || opt_key == "initial_layer_speed") { + || opt_key == "initial_layer_speed" + //w34 + || opt_key == "support_multi_bed_types") { //|| opt_key == "z_offset") { steps.emplace_back(psWipeTower); steps.emplace_back(psSkirtBrim); diff --git a/src/libslic3r/PrintConfig.cpp b/src/libslic3r/PrintConfig.cpp index 7c397e5..5bd26bb 100644 --- a/src/libslic3r/PrintConfig.cpp +++ b/src/libslic3r/PrintConfig.cpp @@ -2071,6 +2071,13 @@ void PrintConfigDef::init_fff_params() def->readonly = false; def->set_default_value(new ConfigOptionEnum(gcfMarlinLegacy)); + //w34 + def = this->add("support_multi_bed_types", coBool); + def->label = L("Support multi bed types"); + def->tooltip = L("Enable this option if you want to use multiple bed types"); + def->mode = comSimple; + def->set_default_value(new ConfigOptionBool(false)); + //OrcaSlicer def = this->add("exclude_object", coBool); def->label = L("Exclude objects"); diff --git a/src/libslic3r/PrintConfig.hpp b/src/libslic3r/PrintConfig.hpp index 2321ba8..aef0477 100644 --- a/src/libslic3r/PrintConfig.hpp +++ b/src/libslic3r/PrintConfig.hpp @@ -977,6 +977,8 @@ PRINT_CONFIG_CLASS_DEFINE( ((ConfigOptionEnumsGeneric, extruder_type)) //Orca ((ConfigOptionBool, has_scarf_joint_seam)) + //w34 + ((ConfigOptionBool, support_multi_bed_types)) ) // This object is mapped to Perl as Slic3r::Config::Print. diff --git a/src/slic3r/GUI/BonjourDialog.cpp b/src/slic3r/GUI/BonjourDialog.cpp index 0109ce3..9d65254 100644 --- a/src/slic3r/GUI/BonjourDialog.cpp +++ b/src/slic3r/GUI/BonjourDialog.cpp @@ -88,7 +88,8 @@ BonjourDialog::BonjourDialog(wxWindow *parent, Slic3r::PrinterTechnology tech) { const int em = GUI::wxGetApp().em_unit(); list->SetMinSize(wxSize(40 * em, 30 * em)); - + list->SetTextColour(StateColor::darkModeColorFor(wxColour("#323A3C"))); + list->SetBackgroundColour(StateColor::darkModeColorFor(wxColour("#FFFFFF"))); wxBoxSizer *vsizer = new wxBoxSizer(wxVERTICAL); vsizer->Add(label, 0, wxEXPAND | wxTOP | wxLEFT | wxRIGHT, em); @@ -98,6 +99,7 @@ BonjourDialog::BonjourDialog(wxWindow *parent, Slic3r::PrinterTechnology tech) //B29 list->AppendColumn(_(L("Address")), wxLIST_FORMAT_LEFT); list->AppendColumn(_(L("Hostname")), wxLIST_FORMAT_LEFT); + // list->AppendColumn(_(L("Service name")), wxLIST_FORMAT_LEFT, 20 * em); // if (tech == ptFFF) { @@ -344,6 +346,11 @@ void BonjourDialog::on_timer_process() label->SetLabel(search_str + ": " + _L("Finished") + "."); timer->Stop(); } +#ifdef WIN32 + label->SetForegroundColour(wxColour("#323A3C")); +#else + label->SetForegroundColour(StateColor::darkModeColorFor(wxColour("#323A3C"))); +#endif } IPListDialog::IPListDialog(wxWindow* parent, const wxString& hostname, const std::vector& ips, size_t& selected_index) diff --git a/src/slic3r/GUI/ConfigWizard.cpp b/src/slic3r/GUI/ConfigWizard.cpp index 6303df1..4cb9ff2 100644 --- a/src/slic3r/GUI/ConfigWizard.cpp +++ b/src/slic3r/GUI/ConfigWizard.cpp @@ -124,16 +124,16 @@ BundleMap BundleMap::load() //QDS: add QDT as default //QDS: add json logic for vendor bundle - auto qdt_bundle_path = (vendor_dir / PresetBundle::QDT_BUNDLE).replace_extension(".json"); + auto qdt_bundle_path = (vendor_dir / PresetBundle::QDT_BUNDLE_X_4).replace_extension(".json"); auto qdt_bundle_rsrc = false; if (!boost::filesystem::exists(qdt_bundle_path)) { - qdt_bundle_path = (rsrc_vendor_dir / PresetBundle::QDT_BUNDLE).replace_extension(".json"); + qdt_bundle_path = (rsrc_vendor_dir / PresetBundle::QDT_BUNDLE_X_4).replace_extension(".json"); qdt_bundle_rsrc = true; } { Bundle qdt_bundle; if (qdt_bundle.load(std::move(qdt_bundle_path), qdt_bundle_rsrc, true)) - res.emplace(PresetBundle::QDT_BUNDLE, std::move(qdt_bundle)); + res.emplace(PresetBundle::QDT_BUNDLE_X_4, std::move(qdt_bundle)); } // Load the other bundles in the datadir/vendor directory @@ -163,9 +163,9 @@ BundleMap BundleMap::load() Bundle& BundleMap::qdt_bundle() { //QDS: add QDT as default - auto it = find(PresetBundle::QDT_BUNDLE); + auto it = find(PresetBundle::QDT_BUNDLE_X_4 ); if (it == end()) { - throw Slic3r::RuntimeError("ConfigWizard: Internal error in BundleMap: QDT_BUNDLE not loaded"); + throw Slic3r::RuntimeError("ConfigWizard: Internal error in BundleMap: QDT_BUNDLE_X_4 not loaded"); } return it->second; @@ -628,7 +628,7 @@ void PagePrinters::set_run_reason(ConfigWizard::RunReason run_reason) if (is_primary_printer_page && (run_reason == ConfigWizard::RR_DATA_EMPTY || run_reason == ConfigWizard::RR_DATA_LEGACY) && printer_pickers.size() > 0 - && printer_pickers[0]->vendor_id == PresetBundle::QDT_BUNDLE) { + && printer_pickers[0]->vendor_id == PresetBundle::QDT_BUNDLE_X_4 ) { //QDS: select alll qds machine by default //printer_pickers[0]->select_one(0, true); printer_pickers[0]->select_all(true); @@ -1941,7 +1941,7 @@ void ConfigWizard::priv::create_3rdparty_pages() for (const auto &pair : bundles) { const VendorProfile *vendor = pair.second.vendor_profile; //QDS: add QDT as default - if (vendor->id == PresetBundle::QDT_BUNDLE) { continue; } + if (vendor->id == PresetBundle::QDT_BUNDLE_X_4 ) { continue; } bool is_fff_technology = false; bool is_sla_technology = false; diff --git a/src/slic3r/GUI/CreatePresetsDialog.cpp b/src/slic3r/GUI/CreatePresetsDialog.cpp index 6c99f18..f82d323 100644 --- a/src/slic3r/GUI/CreatePresetsDialog.cpp +++ b/src/slic3r/GUI/CreatePresetsDialog.cpp @@ -3925,7 +3925,7 @@ ExportConfigsDialog::ExportCase ExportConfigsDialog::archive_filament_bundle_to_ std::string printer_vendor = printer_name_to_preset.first; if (printer_vendor.empty()) continue; Preset * filament_preset = printer_name_to_preset.second; - if (preset_is_not_compatible_qdt_printer(filament_preset)) continue; + // if (preset_is_not_compatible_qdt_printer(filament_preset)) continue; if (vendor_to_filament_name.find(std::make_pair(printer_vendor, filament_preset->name)) != vendor_to_filament_name.end()) continue; vendor_to_filament_name.insert(std::make_pair(printer_vendor, filament_preset->name)); std::string preset_path = boost::filesystem::path(filament_preset->file).make_preferred().string(); diff --git a/src/slic3r/GUI/GUI_App.cpp b/src/slic3r/GUI/GUI_App.cpp index 8ae93b4..6c9e6f5 100644 --- a/src/slic3r/GUI/GUI_App.cpp +++ b/src/slic3r/GUI/GUI_App.cpp @@ -4602,70 +4602,19 @@ void GUI_App::check_update(bool show_tips, int by_user) this->no_new_version(); } } -//B +//B y41 void GUI_App::check_new_version(bool show_tips, int by_user) { - std::string platform = "windows"; + QIDINetwork qidi; + qidi.check_new_version(show_tips, by_user); +} -#ifdef __WINDOWS__ - platform = "windows"; -#endif -#ifdef __APPLE__ - platform = "macos"; -#endif -#ifdef __LINUX__ - platform = "linux"; -#endif - std::string query_params = (boost::format("?name=slicer&version=%1%&guide_version=%2%") - % VersionInfo::convert_full_version(SLIC3R_VERSION) - % VersionInfo::convert_full_version("0.0.0.1") - ).str(); - //std::string url = get_http_url(app_config->get_country_code()) + query_params; - std::string url = "https://api.qidi3dprinter.com/code/version_info"; - std::string regon = app_config->get_country_code(); - Slic3r::Http http = Slic3r::Http::get(url); - - http.header("accept", "application/json") - .timeout_connect(TIMEOUT_CONNECT) - .timeout_max(TIMEOUT_RESPONSE) - .on_complete([this, show_tips, by_user, platform,regon](std::string body, unsigned) { - try { - json j = json::parse(body); - - if (j.contains("message")) { - if (j["message"].get() == "success") { - if (j.contains("software")) { - if (j["software"].empty() && show_tips) { - this->no_new_version(); - } - else { - if (j["software"].contains(platform) - && j["software"][platform].contains("url") - && j["software"][platform].contains("version") - && j["software"][platform].contains("description")) { - version_info.url = j["software"][platform]["url"].get(); - version_info.version_str = j["software"][platform]["version"].get(); - version_info.description = j["software"][platform]["description"][regon].get(); - } - if (j["software"].contains("force_update")) { - version_info.force_upgrade = j["software"][platform]["force_update"].get(); - } - CallAfter([this, show_tips, by_user](){ - this->check_update(show_tips, by_user); - }); - } - } - } - } - } - catch (...) { - ; - } - }) - .on_error([this](std::string body, std::string error, unsigned int status) { - handle_http_error(status, body); - BOOST_LOG_TRIVIAL(error) << "check new version error" << body; - }).perform(); +void GUI_App::update_versioninfo(QIDIVersion version) +{ + version_info.url = version.url; + version_info.version_str = version.version_str; + version_info.description = version.description; + version_info.force_upgrade = version.force_upgrade; } diff --git a/src/slic3r/GUI/GUI_App.hpp b/src/slic3r/GUI/GUI_App.hpp index 0247e24..3b8830b 100644 --- a/src/slic3r/GUI/GUI_App.hpp +++ b/src/slic3r/GUI/GUI_App.hpp @@ -668,6 +668,7 @@ public: void cancel_networking_install(); void restart_networking(); void check_config_updates_from_updater() { check_updates(false); } + void update_versioninfo(QIDIVersion version); private: int updating_qidi_networking(); diff --git a/src/slic3r/GUI/OptionsGroup.cpp b/src/slic3r/GUI/OptionsGroup.cpp index 6569cc0..3d04c89 100644 --- a/src/slic3r/GUI/OptionsGroup.cpp +++ b/src/slic3r/GUI/OptionsGroup.cpp @@ -455,6 +455,7 @@ bool OptionsGroup::activate(std::function throw_if_canceled/* = [](){}*/ wxStaticBox * stb = new wxStaticBox(m_parent, wxID_ANY, _(title)); if (!wxOSX) stb->SetBackgroundStyle(wxBG_STYLE_PAINT); stb->SetBackgroundColour(m_parent->GetBackgroundColour()); + stb->SetForegroundColour(StateColor::darkModeColorFor(wxColour("#323A3C"))); stb->SetFont(wxOSX ? wxGetApp().normal_font() : wxGetApp().bold_font()); wxGetApp().UpdateDarkUI(stb); // QDS: new layout @@ -465,7 +466,7 @@ bool OptionsGroup::activate(std::function throw_if_canceled/* = [](){}*/ // QDS: new layout ::StaticLine* stl = new ::StaticLine(m_parent, false, _(title), icon); stl->SetFont(Label::Head_14); - stl->SetForegroundColour("#262E30"); + stl->SetForegroundColour(StateColor::darkModeColorFor(wxColour("#262E30"))); sizer = new wxBoxSizer(wxVERTICAL); if (title.IsEmpty()) { stl->Hide(); diff --git a/src/slic3r/GUI/PhysicalPrinterDialog.cpp b/src/slic3r/GUI/PhysicalPrinterDialog.cpp index e63bd41..11000f5 100644 --- a/src/slic3r/GUI/PhysicalPrinterDialog.cpp +++ b/src/slic3r/GUI/PhysicalPrinterDialog.cpp @@ -78,9 +78,11 @@ PhysicalPrinterDialog::PhysicalPrinterDialog(wxWindow* parent, wxString printer_ m_exit_host = exit_host; wxStaticText *label_top = new wxStaticText(this, wxID_ANY, _L("Machine Name") + ":"); + label_top->SetForegroundColour(StateColor::darkModeColorFor(wxColour("#323A3C"))); wxBoxSizer *input_sizer_name = new wxBoxSizer(wxVERTICAL); m_input_ctrl = new wxTextCtrl(this, wxID_ANY, input_name); + m_input_ctrl->SetForegroundColour(StateColor::darkModeColorFor(wxColour("#323A3C"))); m_valid_label = new wxStaticText(this, wxID_ANY, ""); m_valid_label->SetForegroundColour(wxColor(255, 111, 0)); @@ -89,6 +91,7 @@ PhysicalPrinterDialog::PhysicalPrinterDialog(wxWindow* parent, wxString printer_ input_sizer_name->Add(m_valid_label, 0, wxEXPAND | wxBOTTOM, BORDER_W); wxStaticText* pret_combo_text = new wxStaticText(this, wxID_ANY, _L("Choice your physical printer preset") + ":"); + pret_combo_text->SetForegroundColour(StateColor::darkModeColorFor(wxColour("#323A3C"))); pret_combobox = new wxComboBox(this, wxID_ANY, inherits, wxDefaultPosition, wxDefaultSize); pret_combobox->SetMinSize(wxSize(FromDIP(360), FromDIP(32))); PresetBundle& preset_bundle = *wxGetApp().preset_bundle; diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index 886834c..73bb8be 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -1217,6 +1217,8 @@ void Sidebar::update_all_preset_comboboxes() bool is_qdt_preset = preset_bundle.printers.get_edited_preset().is_qdt_vendor_preset(&preset_bundle); auto cur_preset_name = preset_bundle.printers.get_edited_preset().name; auto p_mainframe = wxGetApp().mainframe; + //w34 + auto cfg = preset_bundle.printers.get_edited_preset().config; p_mainframe->show_device(is_qdt_preset); // y16 @@ -1236,35 +1238,12 @@ void Sidebar::update_all_preset_comboboxes() if (m_soft_first_start && !wxGetApp().get_app_conf_exists()) { use_default_bed_type(); } else { - auto user_bed_type_flag = config->get("user_bed_type") == "true"; - if (!user_bed_type_flag) { //bed_type not follow machine - set_bed_by_curr_bed_type(config); - } else {//bed_type follow machine - if (m_is_gcode_file) {//.gcode.3mf case - m_is_gcode_file = false; - set_bed_by_curr_bed_type(config); - } - else if (user_bed_type_flag) { - if (config->has_section("user_bed_type_list")) { - auto user_bed_type_list = config->get_section("user_bed_type_list"); - if (user_bed_type_list.size() > 0 && user_bed_type_list[cur_preset_name].size() > 0) { - set_bed_type(user_bed_type_list[cur_preset_name]); - } else { - use_default_bed_type(); - } - } else { - use_default_bed_type(); - } - } - } + //w34 } } else { BOOST_LOG_TRIVIAL(debug) << __FUNCTION__ << ":error:AppConfig is nullptr"; } - //m_bed_type_list->Enable(); - //w30 - m_bed_type_list->SelectAndNotify(btPEI); - m_bed_type_list->Disable(); + //w34 } else { // y5 // connection_btn->Show(); @@ -1302,6 +1281,15 @@ void Sidebar::update_all_preset_comboboxes() //p->combo_printer->update(); // Update the filament choosers to only contain the compatible presets, update the color preview, // update the dirty flags. + //w34 + if (cfg.opt_bool("support_multi_bed_types")) { + m_bed_type_list->Enable(); + m_bed_type_list->SelectAndNotify(btPEI); + } + else { + m_bed_type_list->SelectAndNotify(btPEI); + m_bed_type_list->Disable(); + } if (print_tech == ptFFF) { for (PlaterPresetComboBox* cb : p->combos_filament) cb->update(); @@ -2419,6 +2407,7 @@ struct Plater::priv void set_plater_dirty(bool is_dirty) { dirty_state.set_plater_dirty(is_dirty); } bool is_project_dirty() const { return dirty_state.is_dirty(); } bool is_presets_dirty() const { return dirty_state.is_presets_dirty(); } + void resetUploadCount(); void update_project_dirty_from_presets() { // QDS: backup @@ -2782,6 +2771,7 @@ struct Plater::priv bool PopupObjectTable(int object_id, int volume_id, const wxPoint& position); void on_action_send_to_printer(bool isall = false); void on_action_send_to_multi_machine(SimpleEvent&); + int update_print_required_data(Slic3r::DynamicPrintConfig config, Slic3r::Model model, Slic3r::PlateDataPtrs plate_data_list, std::string file_name, std::string file_path); private: bool layers_height_allowed() const; @@ -2821,6 +2811,9 @@ private: bool show_warning_dialog { false }; std::chrono::system_clock::time_point m_time_p; + int UploadCount = 0; + int max_send_number = 1; + int m_sending_interval = 0; //record print preset void record_start_print_preset(std::string action); @@ -7120,16 +7113,26 @@ void Plater::priv::on_action_print_plate(SimpleEvent&) std::string show_ip = dlg->get_machine_ip(); std::string send_apikey = dlg->get_machine_apikey(); std::string project_name = dlg->get_project_name(); + bool is_net_machine = dlg->GetMachineNetMode(); + if (project_name.find(".gcode") == std::string::npos) { project_name += ".gcode"; } - if (send_apikey.empty()) + if (is_net_machine) { PrintHostJob upload_job(send_ip, show_ip); upload_job.upload_data.upload_path = project_name; upload_job.upload_data.post_action = PrintHostPostUploadAction::StartPrint; + upload_job.create_time = std::chrono::system_clock::now(); + upload_job.sendinginterval = m_sending_interval; export_gcode(fs::path(), false, std::move(upload_job)); + std::string link_url = dlg->GetMachineLinkUrl(); + bool is_special_machine = dlg->isSpecialMachine(); + wxGetApp().mainframe->m_printer_view->FormatNetUrl(link_url, show_ip, is_special_machine); + wxGetApp().mainframe->m_printer_view->SetToggleBar(is_net_machine); + wxGetApp().app_config->set("machine_list_net", "1"); + wxGetApp().mainframe->m_printer_view->ShowNetPrinterButton(); } else { @@ -7140,8 +7143,17 @@ void Plater::priv::on_action_print_plate(SimpleEvent&) PrintHostJob upload_job(&cfg_t); upload_job.upload_data.upload_path = project_name; upload_job.upload_data.post_action = PrintHostPostUploadAction::StartPrint; + upload_job.create_time = std::chrono::system_clock::now(); + upload_job.sendinginterval = m_sending_interval; export_gcode(fs::path(), false, std::move(upload_job)); + wxGetApp().mainframe->m_printer_view->FormatUrl(send_ip); + wxGetApp().mainframe->m_printer_view->SetToggleBar(is_net_machine); + wxGetApp().app_config->set("machine_list_net", "0"); + wxGetApp().mainframe->m_printer_view->ShowLocalPrinterButton(); } + bool is_switch_to_device = wxGetApp().app_config->get("switch to device tab after upload") == "true" ? true : false; + if (is_switch_to_device) + wxGetApp().mainframe->select_tab(size_t(3)); } //if (!m_select_machine_dlg) m_select_machine_dlg = new SelectMachineDialog(q); //m_select_machine_dlg->set_print_type(PrintFromType::FROM_NORMAL); @@ -7150,6 +7162,12 @@ void Plater::priv::on_action_print_plate(SimpleEvent&) //record_start_print_preset("print_plate"); } +void Plater::priv::resetUploadCount() +{ + UploadCount = 0; + m_sending_interval = 0; +}; + void Plater::priv::on_action_send_to_multi_machine(SimpleEvent&) { @@ -7160,20 +7178,25 @@ void Plater::priv::on_action_send_to_multi_machine(SimpleEvent&) // m_send_multi_dlg->ShowModal(); if (!m_send_multi_dlg) m_send_multi_dlg = new SendMultiMachinePage(q); + + max_send_number = std::stoi(wxGetApp().app_config->get("max_send")); if (m_send_multi_dlg->ShowModal() == wxID_YES) { - int count = 0; + if (max_send_number != std::stoi(wxGetApp().app_config->get("max_send"))) { + float i = (std::stoi(wxGetApp().app_config->get("max_send")) * 1.0) / max_send_number; + UploadCount *= i; + max_send_number = std::stoi(wxGetApp().app_config->get("max_send")); + } std::string project_name = m_send_multi_dlg->get_project_name(); + if (project_name.find(".gcode") == std::string::npos) + { + project_name += ".gcode"; + } std::chrono::system_clock::time_point curr_time = std::chrono::system_clock::now(); - auto diff = std::chrono::duration_cast(curr_time - m_time_p); std::map> send_machine_info = m_send_multi_dlg->get_selected_machine_info(); for (auto it = send_machine_info.begin(); it != send_machine_info.end(); it++) { - if (project_name.find(".gcode") == std::string::npos) - { - project_name += ".gcode"; - } std::string send_ip = it->second[0]; std::string show_ip = it->second[1]; std::string apikey = it->second[2]; @@ -7183,18 +7206,13 @@ void Plater::priv::on_action_send_to_multi_machine(SimpleEvent&) upload_job.upload_data.upload_path = project_name; upload_job.upload_data.post_action = PrintHostPostUploadAction::None; upload_job.create_time = std::chrono::system_clock::now(); - if (diff.count() < 0) - upload_job.sendinginterval = count / std::stoi(wxGetApp().app_config->get("max_send")) * - std::stoi(wxGetApp().app_config->get("sending_interval")) * 60 - - diff.count() + 4; - else - upload_job.sendinginterval = count / std::stoi(wxGetApp().app_config->get("max_send")) * - std::stoi(wxGetApp().app_config->get("sending_interval")) * 60; - std::chrono::seconds seconds_to_add(upload_job.sendinginterval); + if (UploadCount != 0 && UploadCount % std::stoi(wxGetApp().app_config->get("max_send")) == 0) { + m_sending_interval += std::stoi(wxGetApp().app_config->get("sending_interval")) * 60; + } + upload_job.sendinginterval = m_sending_interval; - m_time_p = upload_job.create_time + seconds_to_add; export_gcode(fs::path(), false, std::move(upload_job)); - count++; + UploadCount++; } else { @@ -7206,18 +7224,13 @@ void Plater::priv::on_action_send_to_multi_machine(SimpleEvent&) upload_job.upload_data.upload_path = project_name; upload_job.upload_data.post_action = PrintHostPostUploadAction::None; upload_job.create_time = std::chrono::system_clock::now(); - if (diff.count() < 0) - upload_job.sendinginterval = count / std::stoi(wxGetApp().app_config->get("max_send")) * - std::stoi(wxGetApp().app_config->get("sending_interval")) * 60 - - diff.count() + 4; - else - upload_job.sendinginterval = count / std::stoi(wxGetApp().app_config->get("max_send")) * - std::stoi(wxGetApp().app_config->get("sending_interval")) * 60; - std::chrono::seconds seconds_to_add(upload_job.sendinginterval); + if (UploadCount != 0 && UploadCount % std::stoi(wxGetApp().app_config->get("max_send")) == 0) { + m_sending_interval += std::stoi(wxGetApp().app_config->get("sending_interval")) * 60; + } + upload_job.sendinginterval = m_sending_interval; - m_time_p = upload_job.create_time + seconds_to_add; export_gcode(fs::path(), false, std::move(upload_job)); - count++; + UploadCount++; } } } @@ -7343,16 +7356,26 @@ void Plater::priv::on_action_export_to_sdcard(SimpleEvent&) std::string show_ip = dlg->get_machine_ip(); std::string send_apikey = dlg->get_machine_apikey(); std::string project_name = dlg->get_project_name(); + bool is_net_machine = dlg->GetMachineNetMode(); + if (project_name.find(".gcode") == std::string::npos) { project_name += ".gcode"; } - if (send_apikey.empty()) + if (is_net_machine) { PrintHostJob upload_job(send_ip, show_ip); upload_job.upload_data.upload_path = project_name; upload_job.upload_data.post_action = PrintHostPostUploadAction::None; + upload_job.create_time = std::chrono::system_clock::now(); + upload_job.sendinginterval = m_sending_interval; export_gcode(fs::path(), false, std::move(upload_job)); + std::string link_url = dlg->GetMachineLinkUrl(); + bool is_special_machine = dlg->isSpecialMachine(); + wxGetApp().mainframe->m_printer_view->FormatNetUrl(link_url, show_ip, is_special_machine); + wxGetApp().mainframe->m_printer_view->SetToggleBar(is_net_machine); + wxGetApp().app_config->set("machine_list_net", "1"); + wxGetApp().mainframe->m_printer_view->ShowNetPrinterButton(); } else { @@ -7363,9 +7386,18 @@ void Plater::priv::on_action_export_to_sdcard(SimpleEvent&) PrintHostJob upload_job(&cfg_t); upload_job.upload_data.upload_path = project_name; upload_job.upload_data.post_action = PrintHostPostUploadAction::None; + upload_job.create_time = std::chrono::system_clock::now(); + upload_job.sendinginterval = m_sending_interval; export_gcode(fs::path(), false, std::move(upload_job)); + wxGetApp().mainframe->m_printer_view->FormatUrl(send_ip); + wxGetApp().mainframe->m_printer_view->SetToggleBar(is_net_machine); + wxGetApp().app_config->set("machine_list_net", "0"); + wxGetApp().mainframe->m_printer_view->ShowLocalPrinterButton(); } - + bool is_switch_to_device = wxGetApp().app_config->get("switch to device tab after upload") == "true" ? true : false; + if (is_switch_to_device) + wxGetApp().mainframe->select_tab(size_t(3)); + } } @@ -8908,6 +8940,7 @@ void Plater::update_project_dirty_from_presets() { p->update_project_dirty_from_ int Plater::save_project_if_dirty(const wxString& reason) { return p->save_project_if_dirty(reason); } void Plater::reset_project_dirty_after_save() { p->reset_project_dirty_after_save(); } void Plater::reset_project_dirty_initial_presets() { p->reset_project_dirty_initial_presets(); } +void Plater::resetUploadCount(){ p->resetUploadCount(); } #if ENABLE_PROJECT_DIRTY_STATE_DEBUG_WINDOW void Plater::render_project_state_debug_window() const { p->render_project_state_debug_window(); } #endif // ENABLE_PROJECT_DIRTY_STATE_DEBUG_WINDOW @@ -9519,9 +9552,8 @@ std::string Plater::double_to_str(const double value) void Plater::calib_pa(const Calib_Params ¶ms) { const auto calib_pa_name = wxString::Format(L"Pressure Advance Test"); - if (new_project(false, false, calib_pa_name) == wxID_CANCEL) + if (new_project(false, true, calib_pa_name) == wxID_CANCEL) return; - wxGetApp().mainframe->select_tab(size_t(MainFrame::tp3DEditor)); switch (params.mode) { case CalibMode::Calib_PA_Line: //w29 @@ -9602,9 +9634,10 @@ std::string Plater::set_pressure_advance(double pa) void Plater::_calib_pa_line(const Calib_Params& params) { - new_project(); + const auto calib_temp_name = wxString::Format(L"pa_line"); + new_project(false, true, calib_temp_name); //w29 - wxGetApp().mainframe->select_tab(size_t(MainFrame::tp3DEditor)); + //wxGetApp().mainframe->select_tab(size_t(MainFrame::tp3DEditor)); std::string input_file; input_file = Slic3r::resources_dir() + "/calib/pressure_advance/pa_line.stl"; std::vector normal_paths; @@ -9670,8 +9703,8 @@ void Plater::_calib_pa_line(const Calib_Params& params) std::stringstream gcode2 = pa_pattern.generate_custom_nums_gcodes(full_config, true, model(), plate_origin, num_double, plate_center.x() - 57.5, start_y + (1 + i * 2) * step_spacing + step_spacing/2); gcode << gcode2.rdbuf(); } - gcode << "\n;WIDTH:" << pa_line_width; - gcode << m_writer.set_acceleration(external_perimeter_acceleration); + gcode << "; LINE_WIDTH: " << pa_line_width << "\n"; + gcode << "M204 S" << external_perimeter_acceleration; gcode << move_to(Vec2d(start_x + 80, start_y), pa_travel_speed, retract_length, retract_speed); gcode << move_to(pa_layer_height); gcode << move_to(Vec2d(start_x + 80, start_y + count * step_spacing), 3000, count * step_spacing * e_per_mm); @@ -9774,10 +9807,10 @@ void Plater::_calib_pa_pattern(const Calib_Params ¶ms) changed_objects({0}); */ - - new_project(); + const auto calib_temp_name = wxString::Format(L"pa_pattern"); + new_project(false, true, calib_temp_name); //w29 - wxGetApp().mainframe->select_tab(size_t(MainFrame::tp3DEditor)); + //wxGetApp().mainframe->select_tab(size_t(MainFrame::tp3DEditor)); std::string input_file; input_file = Slic3r::resources_dir() + "/calib/pressure_advance/pa_pattern.stl"; std::vector normal_paths; @@ -9859,14 +9892,13 @@ void Plater::_calib_pa_pattern(const Calib_Params ¶ms) gcode << gcode2.rdbuf(); } - gcode << "\n;WIDTH:" << pa_line_width; - gcode << m_writer.set_acceleration(external_perimeter_acceleration); + gcode << "; LINE_WIDTH: " << pa_line_width<< "\n"; + gcode << "M204 S" << external_perimeter_acceleration; gcode << move_to(Vec2d(start_x + 2 * line_spacing, start_y - 2 * line_spacing), pa_travel_speed, retract_length, retract_speed); gcode << move_to(pa_layer_height); for (int i = 0; i < 3; i++) { - gcode << "\n;start:"; gcode << move_to(Vec2d(start_x + pa_wall_length - (2 - i) * line_spacing, start_y - (2 - i) * line_spacing), speed_first_layer, (pa_wall_length - 2 * (2 - i) * line_spacing) * e_per_mm); gcode << move_to(Vec2d(start_x + pa_wall_length - (2 - i) * line_spacing, start_y - pa_wall_width + (2 - i) * line_spacing), @@ -10003,9 +10035,10 @@ void Plater::_calib_pa_tower(const Calib_Params ¶ms) } _calib_pa_select_added_objects();*/ - new_project(); + const auto calib_temp_name = wxString::Format(L"pa_tower"); + new_project(false, true, calib_temp_name); //w29 - wxGetApp().mainframe->select_tab(size_t(MainFrame::tp3DEditor)); + //wxGetApp().mainframe->select_tab(size_t(MainFrame::tp3DEditor)); std::string input_file; input_file = Slic3r::resources_dir() + "/calib/pressure_advance/pa_tower.stl"; std::vector normal_paths; @@ -10068,10 +10101,10 @@ void Plater::calib_flowrate(int pass,double input_value) { if (pass != 1 && pass != 2) return; const auto calib_name = wxString::Format(L"Flowrate Test - Pass%d", pass); - if (new_project(false, false, calib_name) == wxID_CANCEL) + if (new_project(false, true, calib_name) == wxID_CANCEL) return; - wxGetApp().mainframe->select_tab(size_t(MainFrame::tp3DEditor)); + //wxGetApp().mainframe->select_tab(size_t(MainFrame::tp3DEditor)); //if (pass == 1) // add_model(false, (boost::filesystem::path(Slic3r::resources_dir()) / "calib" / "filament_flow" / "flowrate-test-pass1.3mf").string()); @@ -10331,8 +10364,7 @@ void Plater::calib_max_vol_speed(const Calib_Params ¶ms) //w29 const auto calib_vol_speed_name = wxString::Format(L"Max volumetric speed test"); - new_project(false, false, calib_vol_speed_name); - wxGetApp().mainframe->select_tab(size_t(MainFrame::tp3DEditor)); + new_project(false, true, calib_vol_speed_name); if (params.mode != CalibMode::Calib_Vol_speed_Tower) return; add_model(false, Slic3r::resources_dir() + "/calib/volumetric_speed/SpeedTestStructure.step"); diff --git a/src/slic3r/GUI/Plater.hpp b/src/slic3r/GUI/Plater.hpp index 1e4e1ac..a058dab 100644 --- a/src/slic3r/GUI/Plater.hpp +++ b/src/slic3r/GUI/Plater.hpp @@ -760,6 +760,8 @@ public: }; std::atomic m_arrange_running{false}; + void resetUploadCount(); + private: struct priv; std::unique_ptr p; diff --git a/src/slic3r/GUI/PrinterWebView.cpp b/src/slic3r/GUI/PrinterWebView.cpp index 0ad6276..84ebf8c 100644 --- a/src/slic3r/GUI/PrinterWebView.cpp +++ b/src/slic3r/GUI/PrinterWebView.cpp @@ -521,17 +521,9 @@ wxBoxSizer *PrinterWebView::init_menu_bar(wxPanel *Panel) machine_button->SetBorderColor(wxColour(57, 51, 55)); machine_button->SetCanFocus(false); machine_button->SetIsSimpleMode(m_isSimpleMode); - wxString formattedHost = ip; - if (!formattedHost.Lower().starts_with("http")) - formattedHost = wxString::Format("http://%s", formattedHost); - if (isQIDI) { - if (!formattedHost.Lower().ends_with("10088")) - formattedHost = wxString::Format("%s:10088", formattedHost); - } - machine_button->Bind(wxEVT_BUTTON, [this, formattedHost](wxCommandEvent &event) { - wxString url = formattedHost; - load_url(url); + machine_button->Bind(wxEVT_BUTTON, [this, ip](wxCommandEvent &event) { + FormatUrl(into_u8(ip)); }); devicesizer->Add(machine_button, wxSizerFlags().Border(wxALL, 1).Expand()); devicesizer->Layout(); @@ -539,7 +531,7 @@ wxBoxSizer *PrinterWebView::init_menu_bar(wxPanel *Panel) // y13 if (isSelected) - load_url(formattedHost); + FormatUrl(into_u8(ip)); } // y22 std::string PrinterWebView::NormalizeVendor(const std::string& str) @@ -614,38 +606,9 @@ wxBoxSizer *PrinterWebView::init_menu_bar(wxPanel *Panel) machine_button->SetIsSimpleMode(m_isSimpleMode); machine_button->Bind(wxEVT_BUTTON, [this, device](wxCommandEvent &event) { - std::string formattedHost; - if (device.isSpecialMachine) - { - if(wxGetApp().app_config->get("dark_color_mode") == "1") - formattedHost = device.link_url + "&theme=dark"; - else - formattedHost = device.link_url + "&theme=light"; - - std::string formattedHost1 = "http://fluidd_" + formattedHost; - std::string formattedHost2 = "http://fluidd2_" + formattedHost; - if (formattedHost1 == m_web || formattedHost2 == m_web) - return; - - if (m_isfluidd_1) - { - formattedHost = "http://fluidd_" + formattedHost; - m_isfluidd_1 = false; - } - else - { - formattedHost = "http://fluidd2_" + formattedHost; - m_isfluidd_1 = true; - } - } - else - { - formattedHost = "http://" + device.link_url; - } - load_net_url(formattedHost, device.local_ip); + FormatNetUrl(device.link_url, device.local_ip, device.isSpecialMachine); }); - devicesizer->Add(machine_button, wxSizerFlags().Border(wxALL, 1).Expand()); devicesizer->Layout(); m_net_buttons.push_back(machine_button); @@ -931,14 +894,7 @@ wxBoxSizer *PrinterWebView::init_menu_bar(wxPanel *Panel) m_handlerl(event); } m_ip = dlg.get_host(); - wxString url; - if (!m_ip.Lower().starts_with("http")) - url = wxString::Format("http://%s", m_ip); - - if (!url.Lower().ends_with("10088")) - url = wxString::Format("%s:10088", url); - - load_url(url); + FormatUrl(into_u8(m_ip)); SetPresetChanged(true); } @@ -1148,5 +1104,59 @@ wxBoxSizer *PrinterWebView::init_menu_bar(wxPanel *Panel) WebView::RunScript(m_browser, javascript); } + + void PrinterWebView::FormatNetUrl(std::string link_url, std::string local_ip, bool isSpecialMachine) + { + std::string formattedHost; + if (isSpecialMachine) + { + if (wxGetApp().app_config->get("dark_color_mode") == "1") + formattedHost = link_url + "&theme=dark"; + else + formattedHost = link_url + "&theme=light"; + + std::string formattedHost1 = "http://fluidd_" + formattedHost; + std::string formattedHost2 = "http://fluidd2_" + formattedHost; + if (formattedHost1 == m_web || formattedHost2 == m_web) + return; + + if (m_isfluidd_1) + { + formattedHost = "http://fluidd_" + formattedHost; + m_isfluidd_1 = false; + } + else + { + formattedHost = "http://fluidd2_" + formattedHost; + m_isfluidd_1 = true; + } + } + else + { + formattedHost = "http://" + link_url; + } + load_net_url(formattedHost, local_ip); + } + + void PrinterWebView::FormatUrl(std::string link_url) + { + wxString m_link_url = from_u8(link_url); + wxString url; + if (!m_link_url.Lower().starts_with("http")) + url = wxString::Format("http://%s", m_link_url); + + if (!url.Lower().ends_with("10088")) + url = wxString::Format("%s:10088", url); + + load_url(url); + } + + void PrinterWebView::SetToggleBar(bool is_net_mode) + { + toggleBar->SetValue(is_net_mode); + m_isNetMode = is_net_mode; + UpdateState(); + } + } // GUI } // Slic3r diff --git a/src/slic3r/GUI/PrinterWebView.hpp b/src/slic3r/GUI/PrinterWebView.hpp index 8f47252..1368d2b 100644 --- a/src/slic3r/GUI/PrinterWebView.hpp +++ b/src/slic3r/GUI/PrinterWebView.hpp @@ -127,6 +127,9 @@ public: std::vector GetNetButton() { return m_net_buttons; }; wxString GetWeburl(){ return m_web; }; void load_disconnect_url(wxString& url); + void FormatNetUrl(std::string link_url, std::string local_ip, bool isSpecialMachine); + void FormatUrl(std::string link_url); + void SetToggleBar(bool is_net_mode); private: wxBoxSizer *leftallsizer; diff --git a/src/slic3r/GUI/SelectMachine.cpp b/src/slic3r/GUI/SelectMachine.cpp index 77dbb6c..504220c 100644 --- a/src/slic3r/GUI/SelectMachine.cpp +++ b/src/slic3r/GUI/SelectMachine.cpp @@ -1009,6 +1009,7 @@ SelectMachineDialog::SelectMachineDialog(Plater *plater, wxString title) m_rename_text = new wxStaticText(m_rename_normal_panel, wxID_ANY, wxT("MyLabel"), wxDefaultPosition, wxDefaultSize, wxST_ELLIPSIZE_END); m_rename_text->SetFont(::Label::Body_13); m_rename_text->SetMaxSize(wxSize(FromDIP(390), -1)); + m_rename_text->SetForegroundColour(StateColor::darkModeColorFor(wxColour("#000000"))); m_rename_button = new ScalableButton(m_rename_normal_panel, wxID_ANY, "ams_editable"); ams_editable = new ScalableBitmap(this, "ams_editable", 13); ams_editable_light = new ScalableBitmap(this, "ams_editable_light", 13); @@ -1027,6 +1028,7 @@ SelectMachineDialog::SelectMachineDialog(Plater *plater, wxString title) auto rename_edit_sizer_v = new wxBoxSizer(wxVERTICAL); m_rename_input = new ::TextInput(m_rename_edit_panel, wxEmptyString, wxEmptyString, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER); + m_rename_input->SetForegroundColour(StateColor::darkModeColorFor(wxColour("#000000"))); m_rename_input->GetTextCtrl()->SetFont(::Label::Body_13); m_rename_input->SetSize(wxSize(FromDIP(380), FromDIP(24))); m_rename_input->SetMinSize(wxSize(FromDIP(380), FromDIP(24))); @@ -1106,6 +1108,7 @@ SelectMachineDialog::SelectMachineDialog(Plater *plater, wxString title) timeimg = new wxStaticBitmap(m_scrollable_region, wxID_ANY, print_time->bmp(), wxDefaultPosition, wxSize(FromDIP(18), FromDIP(18)), 0); m_sizer_basic_weight->Add(timeimg, 1, wxEXPAND | wxALL, FromDIP(5)); m_stext_time = new wxStaticText(m_scrollable_region, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT); + m_stext_time->SetForegroundColour(StateColor::darkModeColorFor(wxColour("#000000"))); m_sizer_basic_weight->Add(m_stext_time, 0, wxALL, FromDIP(5)); m_sizer_basic->Add(m_sizer_basic_weight, 0, wxALIGN_CENTER, 0); m_sizer_basic->Add(0, 0, 0, wxEXPAND | wxLEFT | wxRIGHT, FromDIP(30)); @@ -1114,6 +1117,7 @@ SelectMachineDialog::SelectMachineDialog(Plater *plater, wxString title) weightimg = new wxStaticBitmap(m_scrollable_region, wxID_ANY, print_weight->bmp(), wxDefaultPosition, wxSize(FromDIP(18), FromDIP(18)), 0); m_sizer_basic_time->Add(weightimg, 1, wxEXPAND | wxALL, FromDIP(5)); m_stext_weight = new wxStaticText(m_scrollable_region, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT); + m_stext_weight->SetForegroundColour(StateColor::darkModeColorFor(wxColour("#000000"))); m_sizer_basic_time->Add(m_stext_weight, 0, wxALL, FromDIP(5)); m_sizer_basic->Add(m_sizer_basic_time, 0, wxALIGN_CENTER, 0); @@ -1266,7 +1270,15 @@ SelectMachineDialog::SelectMachineDialog(Plater *plater, wxString title) } }); + m_isSwitch = new wxCheckBox(switch_button_panel, wxID_ANY, _L("Switch to Device tab"), wxDefaultPosition); + m_isSwitch->SetValue((wxGetApp().app_config->get("switch to device tab after upload") == "true") ? true : false); + m_isSwitch->SetForegroundColour(StateColor::darkModeColorFor(wxColour(0, 0, 0))); + wxToolTip* switch_tips = new wxToolTip(_L("Switch to Device tab after upload.")); + m_isSwitch->SetToolTip(switch_tips); + printer_sizer->Add(m_switch_button, 0, wxALIGN_CENTER); + printer_sizer->AddSpacer(20); + printer_sizer->Add(m_isSwitch, 1, wxALIGN_CENTER); switch_button_panel->SetSizer(printer_sizer); switch_button_panel->Layout(); @@ -1650,8 +1662,8 @@ wxWindow *SelectMachineDialog::create_ams_checkbox(wxString title, wxWindow *par auto text = new wxStaticText(checkbox, wxID_ANY, title, wxDefaultPosition, wxDefaultSize, 0); text->SetFont(::Label::Body_13); - text->SetForegroundColour(StateColor::darkModeColorFor(wxColour("#323A3C"))); text->Wrap(-1); + text->SetForegroundColour(StateColor::darkModeColorFor(wxColour("#323A3C"))); sizer_checkbox->Add(text, 0, wxALIGN_CENTER, 0); enable_ams = new ScalableBitmap(this, "enable_ams", 16); @@ -2531,6 +2543,12 @@ void SelectMachineDialog::show_errors(wxString &info) void SelectMachineDialog::on_ok_btn(wxCommandEvent &event) { + bool isSwitch = m_isSwitch->GetValue(); + if (isSwitch) + wxGetApp().app_config->set_bool("switch to device tab after upload", true); + else + wxGetApp().app_config->set_bool("switch to device tab after upload", false); + // y16 machine_name = into_u8(m_comboBox_printer->GetValue()); @@ -2558,6 +2576,8 @@ void SelectMachineDialog::on_ok_btn(wxCommandEvent &event) machine_url = machine.url; machine_ip = machine.ip; machine_apikey = ""; + machine_link_url = machine.link_url; + machine_is_special = machine.is_special; break; } } @@ -3003,6 +3023,8 @@ void SelectMachineDialog::update_user_machine_list() } } machine.display_name = machine.name + " (" + machine.ip + ")"; + machine.link_url = device.link_url; + machine.is_special = device.isSpecialMachine; machine_list_link.push_back(machine); } } @@ -3198,6 +3220,8 @@ void SelectMachineDialog::update_user_printer() } } machine.display_name = machine.name + " (" + machine.ip + ")"; + machine.link_url = device.link_url; + machine.is_special = device.isSpecialMachine; machine_list_link.push_back(machine); } } diff --git a/src/slic3r/GUI/SelectMachine.hpp b/src/slic3r/GUI/SelectMachine.hpp index 27e4c9f..bd274b1 100644 --- a/src/slic3r/GUI/SelectMachine.hpp +++ b/src/slic3r/GUI/SelectMachine.hpp @@ -69,6 +69,8 @@ struct Machine_info { std::string type; std::string display_name; std::string apikey; + std::string link_url = ""; + bool is_special = false; }; @@ -383,6 +385,8 @@ private: std::string machine_url; std::string machine_ip; std::string machine_apikey; + std::string machine_link_url = ""; + bool machine_is_special = false; Slic3r::DynamicPrintConfig m_required_data_config; Slic3r::Model m_required_data_model; @@ -471,6 +475,7 @@ protected: bool m_isNetMode = false; std::string preset_typename_normalized; std::string preset_typename; + wxCheckBox* m_isSwitch{ nullptr }; public: //y30 @@ -564,6 +569,9 @@ public: std::string get_project_name() { return into_u8(m_current_project_name); } std::string NormalizeVendor(const std::string& str); std::string get_machine_apikey() { return machine_apikey; } + std::string GetMachineLinkUrl() { return machine_link_url; } + bool GetMachineNetMode() { return m_isNetMode; } + bool isSpecialMachine() { return machine_is_special; } }; diff --git a/src/slic3r/GUI/SendMultiMachinePage.cpp b/src/slic3r/GUI/SendMultiMachinePage.cpp index ba6bf88..3f1b1e5 100644 --- a/src/slic3r/GUI/SendMultiMachinePage.cpp +++ b/src/slic3r/GUI/SendMultiMachinePage.cpp @@ -762,17 +762,38 @@ wxBoxSizer* SendMultiMachinePage::create_item_input(wxString str_before, wxStrin sizer_input->Add(0, 0, 0, wxEXPAND | wxLEFT, 3); sizer_input->Add(second_title, 0, wxALIGN_CENTER_VERTICAL | wxALL, 3); - input->GetTextCtrl()->Bind(wxEVT_TEXT_ENTER, [this, param, input](wxCommandEvent& e) { - auto value = input->GetTextCtrl()->GetValue(); - app_config->set(param, std::string(value.mb_str())); - app_config->save(); - e.Skip(); - }); + //input->GetTextCtrl()->Bind(wxEVT_TEXT_ENTER, [this, param, input](wxCommandEvent& e) { + // auto value = input->GetTextCtrl()->GetValue(); + // app_config->set(param, std::string(value.mb_str())); + // app_config->save(); + // e.Skip(); + // }); - input->GetTextCtrl()->Bind(wxEVT_KILL_FOCUS, [this, param, input](wxFocusEvent& e) { + //input->GetTextCtrl()->Bind(wxEVT_KILL_FOCUS, [this, param, input](wxFocusEvent& e) { + // auto value = input->GetTextCtrl()->GetValue(); + // app_config->set(param, std::string(value.mb_str())); + // app_config->save(); + // e.Skip(); + // }); + + input->GetTextCtrl()->Bind(wxEVT_TEXT, [this, param, input](wxCommandEvent& e) { auto value = input->GetTextCtrl()->GetValue(); - app_config->set(param, std::string(value.mb_str())); - app_config->save(); + if (!value.empty()) { + if (std::stoi(into_u8(value)) > 6 && (param == "max_send")) { + MessageDialog msg_wingow(nullptr, _L("The max send number cannot exceed 6"), "", wxICON_WARNING | wxOK); + msg_wingow.ShowModal(); + value = "6"; + input->GetTextCtrl()->SetValue(value); + } + else if (std::stoi(into_u8(value)) > 240 && (param == "sending_interval")) { + MessageDialog msg_wingow(nullptr, _L("The sending interval cannot exceed 240"), "", wxICON_WARNING | wxOK); + msg_wingow.ShowModal(); + value = "240"; + input->GetTextCtrl()->SetValue(value); + } + wxGetApp().app_config->set(param, std::string(value.mb_str())); + wxGetApp().app_config->save(); + } e.Skip(); }); @@ -796,6 +817,7 @@ wxBoxSizer* SendMultiMachinePage::create_item_radiobox(wxString title, wxWindow* m_radio_group.Append(rs); wxStaticText* text = new wxStaticText(parent, wxID_ANY, title, wxDefaultPosition, wxDefaultSize); + text->SetForegroundColour(StateColor::darkModeColorFor(wxColour("#000000"))); radiobox_sizer->Add(radiobox, 0, wxLEFT, FromDIP(23)); radiobox_sizer->Add(text, 0, wxLEFT, FromDIP(10)); radiobox->SetToolTip(tooltip); @@ -932,6 +954,7 @@ wxPanel* SendMultiMachinePage::create_page() m_task_name->SetFont(::Label::Body_13); m_task_name->SetMinSize(wxSize(FromDIP(200), -1)); m_task_name->SetMaxSize(wxSize(FromDIP(200), -1)); + m_task_name->SetForegroundColour(StateColor::darkModeColorFor(wxColour("#000000"))); m_rename_button = new ScalableButton(m_rename_normal_panel, wxID_ANY, "ams_editable"); m_rename_button->SetBackgroundColour(*wxWHITE); rename_sizer_h->Add(m_task_name, 0, wxALIGN_CENTER, 0); @@ -947,6 +970,7 @@ wxPanel* SendMultiMachinePage::create_page() auto rename_edit_sizer_v = new wxBoxSizer(wxVERTICAL); m_rename_input = new ::TextInput(m_rename_edit_panel, wxEmptyString, wxEmptyString, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_PROCESS_ENTER); + m_rename_input->SetForegroundColour(StateColor::darkModeColorFor(wxColour("#000000"))); m_rename_input->GetTextCtrl()->SetFont(::Label::Body_13); m_rename_input->SetSize(wxSize(FromDIP(220), FromDIP(24))); m_rename_input->SetMinSize(wxSize(FromDIP(220), FromDIP(24))); @@ -1005,6 +1029,7 @@ wxPanel* SendMultiMachinePage::create_page() timeimg = new wxStaticBitmap(m_title_panel, wxID_ANY, print_time->bmp(), wxDefaultPosition, wxSize(FromDIP(18), FromDIP(18)), 0); m_sizer_basic_time->Add(timeimg, 1, wxEXPAND | wxALL, FromDIP(5)); m_stext_time = new wxStaticText(m_title_panel, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT); + m_stext_time->SetForegroundColour(StateColor::darkModeColorFor(wxColour("#000000"))); m_sizer_basic_time->Add(m_stext_time, 0, wxALL, FromDIP(5)); m_sizer_basic->Add(m_sizer_basic_time, 0, wxALIGN_CENTER, 0); m_sizer_basic->Add(0, 0, 0, wxEXPAND | wxLEFT | wxRIGHT, FromDIP(30)); @@ -1013,6 +1038,7 @@ wxPanel* SendMultiMachinePage::create_page() weightimg = new wxStaticBitmap(m_title_panel, wxID_ANY, print_weight->bmp(), wxDefaultPosition, wxSize(FromDIP(18), FromDIP(18)), 0); m_sizer_basic_weight->Add(weightimg, 1, wxEXPAND | wxALL, FromDIP(5)); m_stext_weight = new wxStaticText(m_title_panel, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT); + m_stext_weight->SetForegroundColour(StateColor::darkModeColorFor(wxColour("#000000"))); m_sizer_basic_weight->Add(m_stext_weight, 0, wxALL, FromDIP(5)); m_sizer_basic->Add(m_sizer_basic_weight, 0, wxALIGN_CENTER, 0); diff --git a/src/slic3r/GUI/Tab.cpp b/src/slic3r/GUI/Tab.cpp index e111a78..bb10e0b 100644 --- a/src/slic3r/GUI/Tab.cpp +++ b/src/slic3r/GUI/Tab.cpp @@ -3079,6 +3079,8 @@ void TabFilament::build() line.append_option(optgroup->get_option("nozzle_temperature")); optgroup->append_line(line); + //w34 + optgroup = page->new_optgroup(L("Bed temperature"), L"param_temperature"); line = { L("Cool Plate / PLA Plate"), L("Bed temperature when cool plate is installed. Value 0 means the filament does not support to print on the Cool Plate") }; line.append_option(optgroup->get_option("cool_plate_temp_initial_layer")); line.append_option(optgroup->get_option("cool_plate_temp")); @@ -3301,6 +3303,8 @@ void TabFilament::toggle_options() m_preset_bundle); } + //w34 + auto cfg = m_preset_bundle->printers.get_edited_preset().config; if (m_active_page->title() == "Cooling") { bool cooling = m_config->opt_bool("slow_down_for_layer_cooling", 0); @@ -3345,9 +3349,11 @@ void TabFilament::toggle_options() toggle_line("chamber_temperatures", support_chamber_temp_control); //w19 + //w34 + auto support_multi_bed_types = cfg.opt_bool("support_multi_bed_types"); for (auto el : {"cool_plate_temp", "cool_plate_temp_initial_layer", "eng_plate_temp", "eng_plate_temp_initial_layer","hot_plate_temp_initial_layer","hot_plate_temp"}) - toggle_line(el, is_QDT_printer); + toggle_line(el, support_multi_bed_types); } if (m_active_page->title() == "Setting Overrides") @@ -3451,6 +3457,8 @@ void TabPrinter::build_fff() option.opt.full_width = true; optgroup->append_single_option_line(option); optgroup->append_single_option_line("printable_height"); + //w34 + optgroup->append_single_option_line("support_multi_bed_types"); optgroup->append_single_option_line("nozzle_volume"); optgroup->append_single_option_line("best_object_pos"); // QDS @@ -3592,7 +3600,7 @@ void TabPrinter::build_fff() }); }; - optgroup->append_single_option_line("scan_first_layer"); + //optgroup->append_single_option_line("scan_first_layer"); optgroup->append_single_option_line("use_relative_e_distances"); optgroup->append_single_option_line("use_firmware_retraction"); // optgroup->append_single_option_line("spaghetti_detector"); diff --git a/src/slic3r/GUI/WebGuideDialog.cpp b/src/slic3r/GUI/WebGuideDialog.cpp index 74e18d5..2a8b980 100644 --- a/src/slic3r/GUI/WebGuideDialog.cpp +++ b/src/slic3r/GUI/WebGuideDialog.cpp @@ -960,7 +960,7 @@ bool GuideFrame::run() //we install the default here bool apply_keeped_changes = false; //clear filament section and use default materials - app.app_config->set_variant(PresetBundle::QDT_BUNDLE, + app.app_config->set_variant(PresetBundle::QDT_BUNDLE_X_4, PresetBundle::QDT_DEFAULT_PRINTER_MODEL, PresetBundle::QDT_DEFAULT_PRINTER_VARIANT, "true"); app.app_config->clear_section(AppConfig::SECTION_FILAMENTS); app.preset_bundle->load_selections(*app.app_config, {PresetBundle::QDT_DEFAULT_PRINTER_MODEL, PresetBundle::QDT_DEFAULT_PRINTER_VARIANT, PresetBundle::QDT_DEFAULT_FILAMENT, std::string()}); @@ -1102,7 +1102,7 @@ int GuideFrame::LoadProfile() // QDS: add json logic for vendor bundle auto qdt_bundle_path = vendor_dir; qdt_bundle_rsrc = false; - if (!boost::filesystem::exists((vendor_dir / PresetBundle::QDT_BUNDLE).replace_extension(".json"))) { + if (!boost::filesystem::exists((vendor_dir / PresetBundle::QDT_BUNDLE_X_4).replace_extension(".json"))) { qdt_bundle_path = rsrc_vendor_dir; qdt_bundle_rsrc = true; } diff --git a/src/slic3r/Utils/PresetUpdater.cpp b/src/slic3r/Utils/PresetUpdater.cpp index 1b6517d..06d27da 100644 --- a/src/slic3r/Utils/PresetUpdater.cpp +++ b/src/slic3r/Utils/PresetUpdater.cpp @@ -1217,6 +1217,9 @@ void PresetUpdater::priv::check_installed_vendor_profiles() const else if ((vendor_name == PresetBundle::QDT_BUNDLE) || (enabled_vendors.find(vendor_name) != enabled_vendors.end())) {//if vendor has no file, copy it from resource for QDT bundles.push_back(vendor_name); } + else if (vendor_name == PresetBundle::QDT_BUNDLE_Q || vendor_name == PresetBundle::QDT_BUNDLE_X_3 || vendor_name == PresetBundle::QDT_BUNDLE_X_4) { + bundles.push_back(vendor_name); + } } else if ((vendor_name == PresetBundle::QDT_BUNDLE) || (enabled_vendors.find(vendor_name) != enabled_vendors.end())) { //always update configs from resource to vendor for QDT bundles.push_back(vendor_name); diff --git a/src/slic3r/Utils/PrintHost.cpp b/src/slic3r/Utils/PrintHost.cpp index d517077..634799a 100644 --- a/src/slic3r/Utils/PrintHost.cpp +++ b/src/slic3r/Utils/PrintHost.cpp @@ -192,6 +192,9 @@ void PrintHostJobQueue::priv::bg_thread_main() remove_source(); job_id++; + if (channel_jobs.size_hint() == 0) { + GUI::wxGetApp().plater()->resetUploadCount(); + } } } catch (const std::exception &e) { emit_error(e.what()); @@ -324,17 +327,25 @@ void PrintHostJobQueue::priv::perform_job(PrintHostJob the_job) break; boost::this_thread::sleep(boost::posix_time::seconds(1)); } - emit_progress(0); // Indicate the upload is starting - bool success = the_job.printhost->upload(std::move(the_job.upload_data), - [this](Http::Progress progress, bool &cancel) { this->progress_fn(std::move(progress), cancel); }, - [this](wxString error) { - emit_error(std::move(error)); + if (this->cancel_fn()) + { + emit_cancel(this->job_id); + } + else + { + emit_progress(0); // Indicate the upload is starting + + bool success = the_job.printhost->upload(std::move(the_job.upload_data), + [this](Http::Progress progress, bool &cancel) { this->progress_fn(std::move(progress), cancel); }, + [this](wxString error) { + emit_error(std::move(error)); + } + ); + + if (success) { + emit_progress(100); } - ); - - if (success) { - emit_progress(100); } }