mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-11 17:08:58 +08:00
Passing uuid from connect webview to connect printerpick
TODO: More sofisticated logic to pass or not pass uuid
This commit is contained in:
parent
76d7af0b05
commit
44cf71390b
@ -3681,6 +3681,7 @@ bool GUI_App::select_printer_from_connect(const std::string& msg)
|
||||
{
|
||||
// parse message
|
||||
std::string model_name = plater()->get_user_account()->get_keyword_from_json(msg, "printer_model");
|
||||
std::string uuid = plater()->get_user_account()->get_keyword_from_json(msg, "uuid");
|
||||
if (model_name.empty()) {
|
||||
std::vector<std::string> compatible_printers;
|
||||
plater()->get_user_account()->fill_supported_printer_models_from_json(msg, compatible_printers);
|
||||
@ -3707,6 +3708,7 @@ bool GUI_App::select_printer_from_connect(const std::string& msg)
|
||||
NotificationType::SelectPrinterFromConnect
|
||||
, printer_preset ? NotificationManager::NotificationLevel::ImportantNotificationLevel : NotificationManager::NotificationLevel::WarningNotificationLevel
|
||||
, out);
|
||||
plater()->get_user_account()->set_current_printer_uuid_from_connect(uuid);
|
||||
return printer_preset;
|
||||
}
|
||||
|
||||
|
@ -72,6 +72,8 @@ public:
|
||||
|
||||
const std::map<std::string, ConnectPrinterState>& get_printer_state_table() const { return printer_state_table; }
|
||||
|
||||
void set_current_printer_uuid_from_connect(const std::string& uuid) { m_current_printer_uuid_from_connect = uuid; }
|
||||
std::string get_current_printer_uuid_from_connect() const { return m_current_printer_uuid_from_connect; }
|
||||
private:
|
||||
void set_username(const std::string& username);
|
||||
|
||||
@ -86,6 +88,8 @@ private:
|
||||
size_t m_fail_counter { 0 };
|
||||
std::string m_avatar_extension;
|
||||
|
||||
std::string m_current_printer_uuid_from_connect;
|
||||
|
||||
const std::map<std::string, ConnectPrinterState> printer_state_table = {
|
||||
{"OFFLINE" , ConnectPrinterState::CONNECT_PRINTER_OFFLINE},
|
||||
{"PRINTING" , ConnectPrinterState::CONNECT_PRINTER_PRINTING},
|
||||
|
@ -1089,14 +1089,15 @@ void PrinterPickWebViewDialog::request_compatible_printers_FFF()
|
||||
// Sending only first filament type for now. This should change to array of values
|
||||
const std::string filament_type_serialized = selected_filament.config.option("filament_type")->serialize();
|
||||
const std::string printer_model_serialized = selected_printer.config.option("printer_model")->serialize();
|
||||
|
||||
const std::string uuid = wxGetApp().plater()->get_user_account()->get_current_printer_uuid_from_connect();
|
||||
|
||||
const std::string request = GUI::format(
|
||||
"{"
|
||||
"\"printerUuid\": \"%4%\", "
|
||||
"\"printerModel\": \"%3%\", "
|
||||
"\"nozzleDiameter\": %2%, "
|
||||
"\"material\": \"%1%\" "
|
||||
"}", filament_type_serialized, nozzle_diameter_serialized, printer_model_serialized);
|
||||
"}", filament_type_serialized, nozzle_diameter_serialized, printer_model_serialized, uuid);
|
||||
|
||||
wxString script = GUI::format_wxstr("window._prusaConnect_v1.requestCompatiblePrinter(%1%)", request);
|
||||
run_script(script);
|
||||
@ -1107,11 +1108,13 @@ void PrinterPickWebViewDialog::request_compatible_printers_SLA()
|
||||
const std::string printer_model_serialized = selected_printer.config.option("printer_model")->serialize();
|
||||
const Preset& selected_material = wxGetApp().preset_bundle->sla_materials.get_selected_preset();
|
||||
const std::string material_type_serialized = selected_material.config.option("material_type")->serialize();
|
||||
const std::string uuid = wxGetApp().plater()->get_user_account()->get_current_printer_uuid_from_connect();
|
||||
const std::string request = GUI::format(
|
||||
"{"
|
||||
"\"printerUuid\": \"%3%\", "
|
||||
"\"material\": \"%1%\", "
|
||||
"\"printerModel\": \"%2%\" "
|
||||
"}", material_type_serialized, printer_model_serialized);
|
||||
"}", material_type_serialized, printer_model_serialized, uuid);
|
||||
|
||||
wxString script = GUI::format_wxstr("window._prusaConnect_v1.requestCompatiblePrinter(%1%)", request);
|
||||
run_script(script);
|
||||
|
Loading…
x
Reference in New Issue
Block a user