diff --git a/src/libslic3r/GCode.cpp b/src/libslic3r/GCode.cpp index 3cd467492..d8365bc79 100644 --- a/src/libslic3r/GCode.cpp +++ b/src/libslic3r/GCode.cpp @@ -2745,7 +2745,7 @@ void GCode::append_full_config(const Print &print, std::string &str) "print_host", "printhost_apikey", "printhost_cafile", - "repetier_slug" + "printhost_slug" }; assert(std::is_sorted(banned_keys.begin(), banned_keys.end())); auto is_banned = [banned_keys](const std::string &key) { diff --git a/src/libslic3r/PrintConfig.cpp b/src/libslic3r/PrintConfig.cpp index a6b1add7c..17adea974 100644 --- a/src/libslic3r/PrintConfig.cpp +++ b/src/libslic3r/PrintConfig.cpp @@ -149,9 +149,9 @@ void PrintConfigDef::init_common_params() def->mode = comAdvanced; def->set_default_value(new ConfigOptionString("")); - def = this->add("repetier_slug", coString); - def->label = L("Repetier Printer"); - def->tooltip = L("Name of the Repetier printer"); + def = this->add("printhost_slug", coString); + def->label = L("Printer"); + def->tooltip = L("Name of the printer"); def->gui_type = "select_open"; def->mode = comAdvanced; def->set_default_value(new ConfigOptionString("")); diff --git a/src/libslic3r/PrintConfig.hpp b/src/libslic3r/PrintConfig.hpp index df003e816..c5a03dcec 100644 --- a/src/libslic3r/PrintConfig.hpp +++ b/src/libslic3r/PrintConfig.hpp @@ -1277,7 +1277,7 @@ public: ConfigOptionString print_host; ConfigOptionString printhost_apikey; ConfigOptionString printhost_cafile; - ConfigOptionString repetier_slug; + ConfigOptionString printhost_slug; ConfigOptionString serial_port; ConfigOptionInt serial_speed; @@ -1288,7 +1288,7 @@ protected: OPT_PTR(print_host); OPT_PTR(printhost_apikey); OPT_PTR(printhost_cafile); - OPT_PTR(repetier_slug); + OPT_PTR(printhost_slug); OPT_PTR(serial_port); OPT_PTR(serial_speed); } diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index 66547ebf7..12d422a11 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -2066,7 +2066,7 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame) "complete_objects_one_skirt", "duplicate_distance", "extruder_clearance_radius", "skirts", "skirt_distance", "skirt_height", "brim_width", "variable_layer_height", "serial_port", "serial_speed", "host_type", "print_host", - "printhost_apikey", "printhost_cafile", "repetier_slug", "nozzle_diameter", "single_extruder_multi_material", + "printhost_apikey", "printhost_cafile", "printhost_slug", "nozzle_diameter", "single_extruder_multi_material", "wipe_tower", "wipe_tower_x", "wipe_tower_y", "wipe_tower_width", "wipe_tower_rotation_angle", "wipe_tower_brim", "extruder_colour", "filament_colour", "max_print_height", "printer_model", "printer_technology", // These values are necessary to construct SlicingParameters by the Canvas3D variable layer height editor. diff --git a/src/slic3r/GUI/Preset.cpp b/src/slic3r/GUI/Preset.cpp index 0af064746..7982c83ec 100644 --- a/src/slic3r/GUI/Preset.cpp +++ b/src/slic3r/GUI/Preset.cpp @@ -613,7 +613,7 @@ const std::vector& Preset::printer_options() "bed_shape", "bed_custom_texture", "bed_custom_model", "z_offset", "gcode_flavor", "use_relative_e_distances", "serial_port", "serial_speed", "use_firmware_retraction", "use_volumetric_e", "variable_layer_height", "min_length", - "host_type", "print_host", "printhost_apikey", "printhost_cafile", "repetier_slug", + "host_type", "print_host", "printhost_apikey", "printhost_cafile", "printhost_slug", "single_extruder_multi_material", "start_gcode", "end_gcode", "before_layer_gcode", "layer_gcode", "toolchange_gcode", "feature_gcode", "between_objects_gcode", "printer_vendor", "printer_model", "printer_variant", "printer_notes", "cooling_tube_retraction", @@ -751,7 +751,7 @@ const std::vector& Preset::sla_printer_options() "gamma_correction", "min_exposure_time", "max_exposure_time", "min_initial_exposure_time", "max_initial_exposure_time", - "print_host", "printhost_apikey", "printhost_cafile", "repetier_slug", + "print_host", "printhost_apikey", "printhost_cafile", "printhost_slug", "printer_notes", "inherits", "thumbnails", @@ -891,18 +891,18 @@ static ProfileHostParams profile_host_params_same_or_anonymized(const DynamicPri auto opt_print_host_old = cfg_old.option("print_host"); auto opt_printhost_apikey_old = cfg_old.option("printhost_apikey"); auto opt_printhost_cafile_old = cfg_old.option("printhost_cafile"); - auto opt_repetier_slug_old = cfg_old.option("repetier_slug"); + auto opt_printhost_slug_old = cfg_old.option("printhost_slug"); auto opt_print_host_new = cfg_new.option("print_host"); auto opt_printhost_apikey_new = cfg_new.option("printhost_apikey"); auto opt_printhost_cafile_new = cfg_new.option("printhost_cafile"); - auto opt_repetier_slug_new = cfg_new.option("repetier_slug"); + auto opt_printhost_slug_new = cfg_new.option("printhost_slug"); // If the new print host data is undefined, use the old data. bool new_print_host_undefined = (opt_print_host_new == nullptr || opt_print_host_new ->empty()) && (opt_printhost_apikey_new == nullptr || opt_printhost_apikey_new ->empty()) && (opt_printhost_cafile_new == nullptr || opt_printhost_cafile_new ->empty()) && - (opt_repetier_slug_new == nullptr || opt_repetier_slug_new ->empty()); + (opt_printhost_slug_new == nullptr || opt_printhost_slug_new ->empty()); if (new_print_host_undefined) return ProfileHostParams::Anonymized; @@ -911,7 +911,7 @@ static ProfileHostParams profile_host_params_same_or_anonymized(const DynamicPri (l != nullptr && r != nullptr && l->value == r->value); }; return (opt_same(opt_print_host_old, opt_print_host_new) && opt_same(opt_printhost_apikey_old, opt_printhost_apikey_new) && - opt_same(opt_printhost_cafile_old, opt_printhost_cafile_new) && opt_same(opt_repetier_slug_old, opt_repetier_slug_new)) + opt_same(opt_printhost_cafile_old, opt_printhost_cafile_new) && opt_same(opt_printhost_slug_old, opt_printhost_slug_new)) ? ProfileHostParams::Same : ProfileHostParams::Different; } @@ -924,7 +924,7 @@ static bool profile_print_params_same(const DynamicPrintConfig &cfg_old, const D "compatible_printers", "compatible_printers_condition", "inherits", "print_settings_id", "filament_settings_id", "sla_print_settings_id", "sla_material_settings_id", "printer_settings_id", "printer_model", "printer_variant", "default_print_profile", "default_filament_profile", "default_sla_print_profile", "default_sla_material_profile", - "print_host", "printhost_apikey", "repetier_slug", "printhost_cafile" }) + "print_host", "printhost_apikey", "printhost_slug", "printhost_cafile" }) diff.erase(std::remove(diff.begin(), diff.end(), key), diff.end()); // Preset with the same name as stored inside the config exists. return diff.empty() && profile_host_params_same_or_anonymized(cfg_old, cfg_new) != ProfileHostParams::Different; @@ -974,7 +974,7 @@ Preset& PresetCollection::load_external_preset( opt_update("print_host"); opt_update("printhost_apikey"); opt_update("printhost_cafile"); - opt_update("repetier_slug"); + opt_update("printhost_slug"); } } // Update the "inherits" field. diff --git a/src/slic3r/GUI/PresetBundle.cpp b/src/slic3r/GUI/PresetBundle.cpp index 233953f27..ec02fbdac 100644 --- a/src/slic3r/GUI/PresetBundle.cpp +++ b/src/slic3r/GUI/PresetBundle.cpp @@ -526,7 +526,7 @@ DynamicPrintConfig PresetBundle::full_config_secure() const DynamicPrintConfig config = this->full_config(); config.erase("print_host"); config.erase("printhost_apikey"); - config.erase("repetier_slug"); + config.erase("printhost_slug"); config.erase("printhost_cafile"); return config; } diff --git a/src/slic3r/GUI/Tab.cpp b/src/slic3r/GUI/Tab.cpp index bdda5c9a5..18d8a3219 100644 --- a/src/slic3r/GUI/Tab.cpp +++ b/src/slic3r/GUI/Tab.cpp @@ -1993,8 +1993,8 @@ void TabPrinter::build_printhost(ConfigOptionsGroup *optgroup) }; auto print_host_printers = [this](wxWindow* parent) { - add_scaled_button(parent, &m_repetier_slug_browse_btn, "browse", _(L("Refresh Printers")), wxBU_LEFT | wxBU_EXACTFIT); - ScalableButton* btn = m_repetier_slug_browse_btn; + add_scaled_button(parent, &m_printhost_slug_browse_btn, "browse", _(L("Refresh Printers")), wxBU_LEFT | wxBU_EXACTFIT); + ScalableButton* btn = m_printhost_slug_browse_btn; btn->SetFont(Slic3r::GUI::wxGetApp().normal_font()); auto sizer = new wxBoxSizer(wxHORIZONTAL); @@ -2015,7 +2015,7 @@ void TabPrinter::build_printhost(ConfigOptionsGroup *optgroup) option.opt.width = Field::def_width_wider(); optgroup->append_single_option_line(option); - option = optgroup->get_option("repetier_slug"); + option = optgroup->get_option("printhost_slug"); option.opt.width = Field::def_width_wider(); Line slug_line = optgroup->create_single_option_line(option); slug_line.append_widget(print_host_printers); @@ -2138,7 +2138,7 @@ void TabPrinter::update_printers() std::unique_ptr host(PrintHost::get_print_host(m_config)); wxArrayString printers; - Field *rs = get_field("repetier_slug"); + Field *rs = get_field("printhost_slug"); if (!host->get_printers(printers)) { std::vector slugs; @@ -2521,9 +2521,9 @@ void TabPrinter::update_fff() m_print_host_test_btn->Enable(!m_config->opt_string("print_host").empty() && host->can_test()); if(m_printhost_browse_btn) m_printhost_browse_btn->Enable(host->has_auto_discovery()); - m_repetier_slug_browse_btn->Enable(host->can_support_multiple_printers()); + m_printhost_slug_browse_btn->Enable(host->can_support_multiple_printers()); - Field *rs = get_field("repetier_slug"); + Field *rs = get_field("printhost_slug"); if (host->can_support_multiple_printers()) { update_printers(); rs->enable(); diff --git a/src/slic3r/GUI/Tab.hpp b/src/slic3r/GUI/Tab.hpp index de152e162..98ea3bbd7 100644 --- a/src/slic3r/GUI/Tab.hpp +++ b/src/slic3r/GUI/Tab.hpp @@ -393,7 +393,7 @@ public: ScalableButton* m_print_host_test_btn = nullptr; ScalableButton* m_printhost_browse_btn = nullptr; ScalableButton* m_printhost_browse_printer_btn = nullptr; - ScalableButton* m_repetier_slug_browse_btn = nullptr; + ScalableButton* m_printhost_slug_browse_btn = nullptr; ScalableButton* m_reset_to_filament_color = nullptr; size_t m_extruders_count; diff --git a/src/slic3r/Utils/Repetier.cpp b/src/slic3r/Utils/Repetier.cpp index fe6eae047..57feb9f12 100644 --- a/src/slic3r/Utils/Repetier.cpp +++ b/src/slic3r/Utils/Repetier.cpp @@ -28,7 +28,7 @@ Repetier::Repetier(DynamicPrintConfig *config) : host(config->opt_string("print_host")), apikey(config->opt_string("printhost_apikey")), cafile(config->opt_string("printhost_cafile")), - slug(config->opt_string("repetier_slug")) + slug(config->opt_string("printhost_slug")) {} const char* Repetier::get_name() const { return "Repetier"; } @@ -41,7 +41,7 @@ bool Repetier::test(wxString &msg) const const char *name = get_name(); bool res = true; - auto url = make_url("printer/version"); + auto url = make_url("printer/info"); BOOST_LOG_TRIVIAL(info) << boost::format("%1%: List version at: %2%") % name % url; @@ -61,20 +61,11 @@ bool Repetier::test(wxString &msg) const pt::ptree ptree; pt::read_json(ss, ptree); - /* - const auto error = ptree.get_optional("error"); - if (error) { - msg = GUI::from_u8((boost::format(_utf8(L("%s"))) % error).str()); - res = false; - } else { - BOOST_FOREACH(boost::property_tree::ptree::value_type &v, ptree.get_child("data.")) { - const auto slug = v.second.get("slug"); - slugs.push_back(slug); - } - - //res = !printers.empty(); + const auto text = ptree.get_optional("name"); + res = validate_version_text(text); + if (! res) { + msg = GUI::from_u8((boost::format(_utf8(L("Mismatched type of print host: %s"))) % (text ? *text : "Repetier")).str()); } - */ } catch (const std::exception &) { res = false;