From 18a0c7bd802d5feb079cb484592599137e335c03 Mon Sep 17 00:00:00 2001 From: QIDI TECH <893239786@qq.com> Date: Fri, 20 Sep 2024 18:07:25 +0800 Subject: [PATCH] Optimize Device --- resources/web/guide/css/home.css | 2 +- src/slic3r/GUI/PrinterWebView.cpp | 8 -------- src/slic3r/GUI/PrinterWebView.hpp | 6 ++++++ src/slic3r/Utils/Http.cpp | 4 ++++ src/slic3r/Utils/Moonraker.cpp | 7 +++++-- src/slic3r/Utils/Moonraker.hpp | 4 ++++ 6 files changed, 20 insertions(+), 11 deletions(-) diff --git a/resources/web/guide/css/home.css b/resources/web/guide/css/home.css index 4e9daae..2aa65c7 100644 --- a/resources/web/guide/css/home.css +++ b/resources/web/guide/css/home.css @@ -93,7 +93,7 @@ li { } .accordion > li ol { width: 100%; - background-color: #333; + background-color: #333333; } .accordion > li ol li { position: relative; diff --git a/src/slic3r/GUI/PrinterWebView.cpp b/src/slic3r/GUI/PrinterWebView.cpp index 33b572d..15fc38b 100644 --- a/src/slic3r/GUI/PrinterWebView.cpp +++ b/src/slic3r/GUI/PrinterWebView.cpp @@ -282,7 +282,6 @@ void PrinterWebView::CreatThread() { break; - BOOST_LOG_TRIVIAL(error) << "machine IP: " << (button->getIPLabel()); std::unique_ptr printhost( PrintHost::get_print_host_url((button->getIPLabel()).ToStdString(), (button->getIPLabel()).ToStdString())); if (!printhost) { @@ -482,13 +481,6 @@ void PrinterWebView::SetLoginStatus(bool status) { //y5 std::string head_name = wxGetApp().app_config->get("user_head_name"); wxString head_savePath = (boost::filesystem::path(Slic3r::data_dir()) / "user" / head_name).make_preferred().string(); - std::ifstream file(head_savePath); - if (file.good()) { - file.close(); - remove(head_savePath.c_str()); - } - wxGetApp().app_config->set("user_head_url", ""); - wxGetApp().app_config->set("user_head_name", ""); m_user_head_name = ""; SetPresetChanged(true); UpdateState(); diff --git a/src/slic3r/GUI/PrinterWebView.hpp b/src/slic3r/GUI/PrinterWebView.hpp index 13dcbb8..60d4e2d 100644 --- a/src/slic3r/GUI/PrinterWebView.hpp +++ b/src/slic3r/GUI/PrinterWebView.hpp @@ -45,6 +45,9 @@ #include #include "./Widgets/SwitchButton.hpp" #include "./Widgets/DeviceButton.hpp" + +#include "../Utils/Moonraker.hpp" + namespace Slic3r { namespace GUI { @@ -106,9 +109,12 @@ public: void StopStatusThread() { m_stopThread = true; + //y6 + Moonraker::m_isStop = true; if (m_statusThread.joinable()) { m_statusThread.join(); } + Moonraker::m_isStop = false; }; void SetPauseThread(bool status) { m_pauseThread = status; }; void SetPresetChanged(bool status); diff --git a/src/slic3r/Utils/Http.cpp b/src/slic3r/Utils/Http.cpp index 8c7c8dc..df192da 100644 --- a/src/slic3r/Utils/Http.cpp +++ b/src/slic3r/Utils/Http.cpp @@ -22,6 +22,7 @@ #include #include #include +#include "Moonraker.hpp" namespace fs = boost::filesystem; @@ -225,6 +226,9 @@ int Http::priv::xfercb(void *userp, curl_off_t dltotal, curl_off_t dlnow, curl_o { auto self = static_cast(userp); bool cb_cancel = false; + //y6 + if (Moonraker::GetStop()) + cb_cancel = true; if (self->progressfn) { Progress progress(dltotal, dlnow, ultotal, ulnow, self->buffer); diff --git a/src/slic3r/Utils/Moonraker.cpp b/src/slic3r/Utils/Moonraker.cpp index d3ca8a3..3453a21 100644 --- a/src/slic3r/Utils/Moonraker.cpp +++ b/src/slic3r/Utils/Moonraker.cpp @@ -21,6 +21,9 @@ namespace fs = boost::filesystem; namespace pt = boost::property_tree; namespace Slic3r { +//y6 +bool Moonraker::m_isStop = false; + namespace { #ifdef WIN32 // Workaround for Windows 10/11 mDNS resolve issue, where two mDNS resolves in succession fail. @@ -165,8 +168,8 @@ std::string Moonraker::get_status(wxString &msg) const auto http = Http::get(std::move(url)); set_auth(http); - //B64 - http.timeout_connect(2) + //B64 //y6 + http.timeout_connect(4) .on_error([&](std::string body, std::string error, unsigned status) { // y1 if(status == 404) diff --git a/src/slic3r/Utils/Moonraker.hpp b/src/slic3r/Utils/Moonraker.hpp index a7904ed..dd28e5c 100644 --- a/src/slic3r/Utils/Moonraker.hpp +++ b/src/slic3r/Utils/Moonraker.hpp @@ -42,6 +42,10 @@ public: std::string get_host() const override { return m_show_ip != "" ? m_show_ip : m_host; } const std::string& get_apikey() const { return m_apikey; } const std::string& get_cafile() const { return m_cafile; } + //y6 + static void SetStop(bool isStop) { m_isStop = isStop; }; + static bool GetStop() { return m_isStop; }; + static bool m_isStop; protected: /*