mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-14 10:35:52 +08:00
Upload to Connect changes
This commit is contained in:
parent
1264f57f84
commit
64c497ce0d
@ -6059,12 +6059,12 @@ void Plater::connect_gcode()
|
||||
std::string printer_uuid;
|
||||
std::string team_id;
|
||||
*/
|
||||
bool set_ready = true;
|
||||
int position = -1;
|
||||
int wait_until = 0;
|
||||
std::string filename = "print.bgcode";
|
||||
std::string printer_uuid = "1234-1234-1234-1234";
|
||||
std::string team_id = "1234";
|
||||
std::string set_ready = p->user_account->get_keyword_from_json(dialog_msg, "set_ready");
|
||||
std::string position = p->user_account->get_keyword_from_json(dialog_msg, "position");
|
||||
std::string wait_until = p->user_account->get_keyword_from_json(dialog_msg, "wait_until");
|
||||
std::string filename = p->user_account->get_keyword_from_json(dialog_msg, "filename");
|
||||
std::string printer_uuid = p->user_account->get_keyword_from_json(dialog_msg, "printer_uuid");
|
||||
std::string team_id = p->user_account->get_keyword_from_json(dialog_msg, "team_id");
|
||||
|
||||
PhysicalPrinter ph_printer("connect_temp_printer", wxGetApp().preset_bundle->physical_printers.default_config(), *selected_printer_preset);
|
||||
ph_printer.config.set_key_value("host_type", new ConfigOptionEnum<PrintHostType>(htPrusaConnectNew));
|
||||
@ -6075,8 +6075,24 @@ void Plater::connect_gcode()
|
||||
|
||||
PrintHostJob upload_job(physical_printer_config);
|
||||
assert(!upload_job.empty());
|
||||
|
||||
upload_job.upload_data.upload_path = filename;
|
||||
/*
|
||||
wxArrayString storage_paths;
|
||||
wxArrayString storage_names;
|
||||
{
|
||||
wxBusyCursor wait;
|
||||
try {
|
||||
upload_job.printhost->get_storage(storage_paths, storage_names);
|
||||
}
|
||||
catch (const Slic3r::IOError& ex) {
|
||||
show_error(this, ex.what(), false);
|
||||
return;
|
||||
}
|
||||
}
|
||||
*/
|
||||
upload_job.upload_data.set_ready = set_ready;
|
||||
upload_job.upload_data.position = position;
|
||||
upload_job.upload_data.wait_until = wait_until;
|
||||
upload_job.upload_data.upload_path = filename + ".bgcode";
|
||||
upload_job.upload_data.post_action = PrintHostPostUploadAction::None;
|
||||
|
||||
p->export_gcode(fs::path(), false, std::move(upload_job));
|
||||
|
@ -41,6 +41,10 @@ struct PrintHostUpload
|
||||
std::string storage;
|
||||
|
||||
PrintHostPostUploadAction post_action { PrintHostPostUploadAction::None };
|
||||
|
||||
std::string set_ready;
|
||||
std::string position;
|
||||
std::string wait_until;
|
||||
};
|
||||
|
||||
class PrintHost
|
||||
|
@ -159,7 +159,21 @@ bool PrusaConnectNew::upload(PrintHostUpload upload_data, ProgressFn progress_fn
|
||||
const std::string escaped_upload_path = upload_data.storage + "/" + escape_path_by_element(upload_data.upload_path.string());
|
||||
const std::string to_print = upload_data.post_action == PrintHostPostUploadAction::StartPrint ? "true" : "false";
|
||||
const std::string to_queue = upload_data.post_action == PrintHostPostUploadAction::QueuePrint ? "true" : "false";
|
||||
std::string url = GUI::format("%1%/app/teams/%2%/files/raw?upload_id=%3%&force=true&printer_uuid=%4%&path=%5%&to_print=%6%&to_queue=%7%", get_host(), m_team_id, upload_id, m_uuid, escaped_upload_path, to_print, to_queue);
|
||||
const std::string set_ready = upload_data.set_ready.empty() ? "" : "&set_ready=" + upload_data.set_ready;
|
||||
const std::string position = upload_data.position.empty() ? "" : "&position=" + upload_data.position;
|
||||
const std::string wait_until = upload_data.wait_until.empty() ? "" : "&wait_until=" + upload_data.wait_until;
|
||||
const std::string url = GUI::format(
|
||||
"%1%/app/teams/%2%/files/raw"
|
||||
"?upload_id=%3%"
|
||||
"&force=true"
|
||||
"&printer_uuid=%4%"
|
||||
"&path=%5%"
|
||||
"&to_print=%6%"
|
||||
"&to_queue=%7%"
|
||||
"%8%"
|
||||
"%9%"
|
||||
"%10%"
|
||||
, get_host(), m_team_id, upload_id, m_uuid, escaped_upload_path, to_print, to_queue, set_ready, position, wait_until);
|
||||
bool res = true;
|
||||
|
||||
BOOST_LOG_TRIVIAL(info) << boost::format("%1%: Uploading file %2% at %3%, filename: %4%, path: %5%, print: %6%")
|
||||
|
Loading…
x
Reference in New Issue
Block a user