mirror of
https://github.com/QIDITECH/QIDISlicer.git
synced 2026-02-01 08:28:42 +03:00
update slic3r
This commit is contained in:
@@ -451,13 +451,14 @@ void WebViewDialog::EndModal(int retCode)
|
||||
wxDialog::EndModal(retCode);
|
||||
}
|
||||
|
||||
PrinterPickWebViewDialog::PrinterPickWebViewDialog(wxWindow* parent, std::string& ret_val)
|
||||
PrinterPickWebViewDialog::PrinterPickWebViewDialog(wxWindow* parent, std::string& ret_val, bool multiple_beds)
|
||||
: WebViewDialog(parent
|
||||
, GUI::from_u8(Utils::ServiceConfig::instance().connect_select_printer_url())
|
||||
, _L("Choose a printer")
|
||||
, wxSize(parent->GetClientSize().x / 4 * 3, parent->GetClientSize().y/ 4 * 3)
|
||||
,{"_qidiSlicer"}
|
||||
, "connect_loading")
|
||||
, m_multiple_beds(multiple_beds)
|
||||
, m_ret_val(ret_val)
|
||||
{
|
||||
|
||||
@@ -579,7 +580,9 @@ void PrinterPickWebViewDialog::request_compatible_printers_FFF() {
|
||||
|
||||
const std::string uuid = wxGetApp().plater()->get_user_account()->get_current_printer_uuid_from_connect(printer_model_serialized);
|
||||
const std::string filename = wxGetApp().plater()->get_upload_filename();
|
||||
//filament_abrasive
|
||||
|
||||
const std::string multiple_beds_value = m_multiple_beds ? "true" : "false";
|
||||
|
||||
std::string request = GUI::format(
|
||||
"{"
|
||||
"\"printerUuid\": \"%4%\", "
|
||||
@@ -588,9 +591,10 @@ void PrinterPickWebViewDialog::request_compatible_printers_FFF() {
|
||||
"\"material\": %1%, "
|
||||
"\"filename\": \"%5%\", "
|
||||
"\"filament_abrasive\": %6%,"
|
||||
"\"high_flow\": %7%"
|
||||
"\"high_flow\": %7%,"
|
||||
"\"multiple_beds\": %8%"
|
||||
"}"
|
||||
, filament_type_serialized, nozzle_diameter_serialized, printer_model_serialized, uuid, filename, filament_abrasive_serialized, nozzle_high_flow_serialized);
|
||||
, filament_type_serialized, nozzle_diameter_serialized, printer_model_serialized, uuid, filename, filament_abrasive_serialized, nozzle_high_flow_serialized, multiple_beds_value);
|
||||
|
||||
wxString script = GUI::format_wxstr("window._qidiConnect_v2.requestCompatiblePrinter(%1%)", request);
|
||||
run_script(script);
|
||||
@@ -608,13 +612,15 @@ void PrinterPickWebViewDialog::request_compatible_printers_SLA()
|
||||
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(printer_model_serialized);
|
||||
const std::string filename = wxGetApp().plater()->get_upload_filename();
|
||||
const std::string multiple_beds_value = m_multiple_beds ? "true" : "false";
|
||||
const std::string request = GUI::format(
|
||||
"{"
|
||||
"\"printerUuid\": \"%3%\", "
|
||||
"\"material\": \"%1%\", "
|
||||
"\"printerModel\": \"%2%\", "
|
||||
"\"filename\": \"%4%\" "
|
||||
"}", material_type_serialized, printer_model_serialized, uuid, filename);
|
||||
"\"filename\": \"%4%\", "
|
||||
"\"multiple_beds\": \"%5%\" "
|
||||
"}", material_type_serialized, printer_model_serialized, uuid, filename, multiple_beds_value);
|
||||
|
||||
wxString script = GUI::format_wxstr("window._qidiConnect_v2.requestCompatiblePrinter(%1%)", request);
|
||||
run_script(script);
|
||||
@@ -692,19 +698,28 @@ LoginWebViewDialog::LoginWebViewDialog(wxWindow *parent, std::string &ret_val, c
|
||||
, m_ret_val(ret_val)
|
||||
, p_evt_handler(evt_handler)
|
||||
{
|
||||
m_force_quit_timer.SetOwner(this, 0);
|
||||
Bind(wxEVT_TIMER, [this](wxTimerEvent &evt)
|
||||
{
|
||||
m_force_quit = true;
|
||||
});
|
||||
Centre();
|
||||
}
|
||||
void LoginWebViewDialog::on_navigation_request(wxWebViewEvent &evt)
|
||||
{
|
||||
wxString url = evt.GetURL();
|
||||
if (url.starts_with(L"qidislicer")) {
|
||||
delete_cookies(m_browser, Utils::ServiceConfig::instance().account_url());
|
||||
delete_cookies(m_browser, "https://accounts.google.com");
|
||||
delete_cookies(m_browser, "https://appleid.apple.com");
|
||||
delete_cookies(m_browser, "https://facebook.com");
|
||||
m_waiting_for_counters = true;
|
||||
m_atomic_counter = 0;
|
||||
m_counter_to_match = 4;
|
||||
delete_cookies_with_counter(m_browser, Utils::ServiceConfig::instance().account_url(), m_atomic_counter);
|
||||
delete_cookies_with_counter(m_browser, "https://accounts.google.com", m_atomic_counter);
|
||||
delete_cookies_with_counter(m_browser, "https://appleid.apple.com", m_atomic_counter);
|
||||
delete_cookies_with_counter(m_browser, "https://facebook.com", m_atomic_counter);
|
||||
evt.Veto();
|
||||
m_ret_val = into_u8(url);
|
||||
EndModal(wxID_OK);
|
||||
m_force_quit_timer.Start(2000, wxTIMER_ONE_SHOT);
|
||||
// End modal is moved to on_idle
|
||||
} else if (url.Find(L"accounts.google.com") != wxNOT_FOUND
|
||||
|| url.Find(L"appleid.apple.com") != wxNOT_FOUND
|
||||
|| url.Find(L"facebook.com") != wxNOT_FOUND) {
|
||||
@@ -725,5 +740,36 @@ void LoginWebViewDialog::on_dpi_changed(const wxRect &suggested_rect)
|
||||
Fit();
|
||||
Refresh();
|
||||
}
|
||||
|
||||
void LoginWebViewDialog::on_idle(wxIdleEvent& WXUNUSED(evt))
|
||||
{
|
||||
if (!m_browser)
|
||||
return;
|
||||
if (m_browser->IsBusy()) {
|
||||
if constexpr (!is_linux) {
|
||||
wxSetCursor(wxCURSOR_ARROWWAIT);
|
||||
}
|
||||
} else {
|
||||
if constexpr (!is_linux) {
|
||||
wxSetCursor(wxNullCursor);
|
||||
}
|
||||
if (m_load_error_page) {
|
||||
m_load_error_page = false;
|
||||
m_browser->LoadURL(GUI::format_wxstr("file://%1%/web/error_no_reload.html", boost::filesystem::path(resources_dir()).generic_string()));
|
||||
}
|
||||
if (m_waiting_for_counters && m_atomic_counter == m_counter_to_match)
|
||||
{
|
||||
EndModal(wxID_OK);
|
||||
}
|
||||
if (m_force_quit)
|
||||
{
|
||||
EndModal(wxID_OK);
|
||||
}
|
||||
}
|
||||
#ifdef DEBUG_URL_PANEL
|
||||
m_button_stop->Enable(m_browser->IsBusy());
|
||||
#endif
|
||||
}
|
||||
|
||||
} // GUI
|
||||
} // Slic3r
|
||||
|
||||
Reference in New Issue
Block a user