mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-15 20:06:01 +08:00
Rename paramters in jsons and add FilamentConfig.
This commit is contained in:
parent
3ff2b179b9
commit
a30961f59a
@ -105,7 +105,7 @@ void fill_supported_printer_models_from_json(boost::property_tree::ptree &ptree,
|
||||
void fill_config_options_from_json(boost::property_tree::ptree& ptree, std::map<std::string, std::string>& result)
|
||||
{
|
||||
assert(!ptree.empty());
|
||||
pt::ptree subtree = parse_tree_for_subtree(ptree, "config_options");
|
||||
pt::ptree subtree = parse_tree_for_subtree(ptree, "printerConfig");
|
||||
for (const auto &item : subtree) {
|
||||
result[item.first] = item.second.data();
|
||||
}
|
||||
|
@ -1320,9 +1320,9 @@ void PrinterPickWebViewDialog::request_compatible_printers_FFF() {
|
||||
"\"nozzleDiameter\": %2%, "
|
||||
"\"material\": \"%1%\", "
|
||||
"\"filename\": \"%5%\", "
|
||||
"\"filamentAbrasive\": \"%6%\", "
|
||||
"\"config_options\": {"
|
||||
, filament_type_serialized, nozzle_diameter_serialized, printer_model_serialized, uuid, filename, filament_abrasive);
|
||||
//"\"filamentAbrasive\": \"%6%\", "
|
||||
"\"printerConfig\": {"
|
||||
, filament_type_serialized, nozzle_diameter_serialized, printer_model_serialized, uuid, filename/*, filament_abrasive*/);
|
||||
|
||||
// std::map<t_config_option_key, std::unique_ptr<ConfigOption>>::const_iterator
|
||||
for (auto it = selected_printer.config.cbegin(); it != selected_printer.config.cend(); ++it) {
|
||||
@ -1334,6 +1334,16 @@ void PrinterPickWebViewDialog::request_compatible_printers_FFF() {
|
||||
request += GUI::format("\"%1%\": \"%2%\"", it->first, value);
|
||||
}
|
||||
|
||||
request += "}, \"filamentConfig\": {";
|
||||
for (auto it = selected_filament.config.cbegin(); it != selected_filament.config.cend(); ++it) {
|
||||
std::string value = selected_filament.config.option(it->first)->serialize();
|
||||
if (value.find('\"') != std::string::npos) {
|
||||
continue;
|
||||
}
|
||||
request += it == selected_filament.config.cbegin() ? "" : ",";
|
||||
request += GUI::format("\"%1%\": \"%2%\"", it->first, value);
|
||||
}
|
||||
|
||||
request += "}}";
|
||||
|
||||
wxString script = GUI::format_wxstr("window._prusaConnect_v1.requestCompatiblePrinter(%1%)", request);
|
||||
|
Loading…
x
Reference in New Issue
Block a user