Sync with bbs

This commit is contained in:
Noisyfox 2025-01-23 13:29:27 +08:00
parent 5f3ff22218
commit bee7188599
9 changed files with 42 additions and 48 deletions

View file

@ -2,10 +2,10 @@
#include "GUI_App.hpp"
#include <wx/wx.h>
#include <wx/mstream.h>
#include <wx/sizer.h>
#include <wx/statbox.h>
#include "wx/evtloop.h"
#include <wx/mstream.h>
#include <wx/tokenzr.h>
#include <wx/richmsgdlg.h>
#include <wx/richtext/richtextctrl.h>

View file

@ -2668,7 +2668,6 @@ std::string MachineObject::setting_id_to_type(std::string setting_id, std::strin
if (type.empty()) { type = tray_type; }
BOOST_LOG_TRIVIAL(info) << "The values of tray_info_idx and tray_type do not match tray_info_idx " << setting_id << " tray_type " << tray_type << " system_type" << type;
}
return type;
}
@ -2700,7 +2699,6 @@ int MachineObject::parse_json(std::string payload, bool key_field_only)
if (j_pre.empty()) {
return 0;
}
if (j_pre.contains("print")) {
if (m_active_state == NotActive) m_active_state = Active;
if (j_pre["print"].contains("command")) {
@ -3083,9 +3081,7 @@ int MachineObject::parse_json(std::string payload, bool key_field_only)
}
}
if (jj.contains("command")) {
if (jj["command"].get<std::string>() == "ams_change_filament") {
if (jj.contains("errno")) {
if (jj["errno"].is_number()) {
@ -3117,8 +3113,6 @@ int MachineObject::parse_json(std::string payload, bool key_field_only)
}
}
}
if (jj["command"].get<std::string>() == "push_status") {
m_push_count++;
last_push_time = last_update_time;
@ -3283,7 +3277,7 @@ int MachineObject::parse_json(std::string payload, bool key_field_only)
if (jj.contains("project_id")
&& jj.contains("profile_id")
&& jj.contains("subtask_id")
){
) {
obj_subtask_id = jj["subtask_id"].get<std::string>();
int plate_index = -1;
@ -3314,7 +3308,6 @@ int MachineObject::parse_json(std::string payload, bool key_field_only)
}
}
#pragma endregion
#pragma region status
@ -3584,13 +3577,14 @@ int MachineObject::parse_json(std::string payload, bool key_field_only)
&& jj["upgrade_state"]["dis_state"].get<int>() == 3) {
GUI::wxGetApp().CallAfter([this] {
this->command_get_version();
});
});
}
if (upgrade_display_hold_count > 0)
upgrade_display_hold_count--;
else
upgrade_display_state = jj["upgrade_state"]["dis_state"].get<int>();
} else {
}
else {
if (upgrade_display_hold_count > 0)
upgrade_display_hold_count--;
else {
@ -3641,7 +3635,8 @@ int MachineObject::parse_json(std::string payload, bool key_field_only)
new_ver_list.insert(std::make_pair(ver_info.name, ver_info));
}
} else {
}
else {
new_ver_list.clear();
}
}
@ -5331,6 +5326,8 @@ void DeviceManager::check_pushing()
}
}
void DeviceManager::on_machine_alive(std::string json_str)
{
try {
@ -5855,7 +5852,7 @@ void DeviceManager::parse_user_print_info(std::string body)
}
}
}
catch (std::exception&) {
catch (std::exception& e) {
;
}
}
@ -6094,15 +6091,11 @@ void DeviceManager::check_filaments_in_blacklist(std::string tag_vendor, std::st
{
vendor = prohibited_filament["vendor"].get<std::string>();
type = prohibited_filament["type"].get<std::string>();
if (GUI::wxGetApp().app_config->get("skip_ams_blacklist_check") == "true") {
action = "warning";
}
else {
action = prohibited_filament["action"].get<std::string>();
}
if (GUI::wxGetApp().app_config->get("skip_ams_blacklist_check") == "true") {
action = "warning";
} else {
action = prohibited_filament["action"].get<std::string>();
}
description = prohibited_filament["description"].get<std::string>();
description = blacklist_prompt[description].ToUTF8().data();

View file

@ -2,11 +2,11 @@
#define slic3r_DeviceManager_hpp_
#include <map>
#include <mutex>
#include <vector>
#include <string>
#include <memory>
#include <chrono>
#include <mutex>
#include <boost/thread.hpp>
#include <boost/nowide/fstream.hpp>
#include "nlohmann/json.hpp"

View file

@ -1028,7 +1028,7 @@ void GUI_App::post_init()
std::time_t lw_t = boost::filesystem::last_write_time(temp_path) ;
files_vec.push_back({ lw_t, temp_path.filename().string() });
}
} catch (const std::exception &ex) {
} catch (const std::exception &) {
}
}
std::sort(files_vec.begin(), files_vec.end(), [](

View file

@ -1,13 +1,6 @@
#ifndef slic3r_GUI_App_hpp_
#define slic3r_GUI_App_hpp_
#include <wx/app.h>
#include <wx/colour.h>
#include <wx/font.h>
#include <wx/string.h>
#include <wx/snglinst.h>
#include <wx/msgdlg.h>
#include <memory>
#include <string>
#include "ImGuiWrapper.hpp"
@ -26,6 +19,13 @@
#include "slic3r/GUI/HttpServer.hpp"
#include "../Utils/PrintHost.hpp"
#include <wx/app.h>
#include <wx/colour.h>
#include <wx/font.h>
#include <wx/string.h>
#include <wx/snglinst.h>
#include <wx/msgdlg.h>
#include <mutex>
#include <stack>
@ -275,7 +275,7 @@ private:
std::unique_ptr <OtherInstanceMessageHandler> m_other_instance_message_handler;
std::unique_ptr <wxSingleInstanceChecker> m_single_instance_checker;
std::string m_instance_hash_string;
size_t m_instance_hash_int;
size_t m_instance_hash_int;
std::unique_ptr<Downloader> m_downloader;
@ -310,8 +310,8 @@ private:
HttpServer m_http_server;
bool m_show_gcode_window{true};
boost::thread m_check_network_thread;
public:
//try again when subscription fails
public:
//try again when subscription fails
void on_start_subscribe_again(std::string dev_id);
void check_filaments_in_blacklist(std::string tag_supplier, std::string tag_material, bool& in_blacklist, std::string& action, std::string& info);
std::string get_local_models_path();
@ -557,7 +557,7 @@ private:
#endif /* __APPLE */
Sidebar& sidebar();
GizmoObjectManipulation* obj_manipul();
GizmoObjectManipulation *obj_manipul();
ObjectSettings* obj_settings();
ObjectList* obj_list();
ObjectLayers* obj_layers();

View file

@ -255,7 +255,7 @@ void MediaFilePanel::SetMachineObject(MachineObject* obj)
m_button_management->Enable(false);
SetSelecting(false);
if (m_machine.empty()) {
m_image_grid->SetStatus(m_bmp_failed, _L("No printers."));
m_image_grid->SetStatus(m_bmp_failed, _L("Please confirm if the printer is connected."));
} else {
boost::shared_ptr<PrinterFileSystem> fs(new PrinterFileSystem);
fs->Attached();
@ -296,7 +296,7 @@ void MediaFilePanel::SetMachineObject(MachineObject* obj)
switch (status) {
case PrinterFileSystem::Initializing: icon = m_bmp_loading; msg = _L("Initializing..."); break;
case PrinterFileSystem::Connecting: icon = m_bmp_loading; msg = _L("Connecting..."); break;
case PrinterFileSystem::Failed: icon = m_bmp_failed; if (extra != 1) msg = _L("Connect failed [%d]!"); break;
case PrinterFileSystem::Failed: icon = m_bmp_failed; if (extra != 1) msg = _L("Please check the network and try again, You can restart or update the printer if the issue persists."); break;
case PrinterFileSystem::ListSyncing: icon = m_bmp_loading; msg = _L("Loading file list..."); break;
case PrinterFileSystem::ListReady: icon = extra == 0 ? m_bmp_empty : m_bmp_failed; msg = extra == 0 ? _L("No files") : _L("Load failed"); break;
}
@ -310,7 +310,6 @@ void MediaFilePanel::SetMachineObject(MachineObject* obj)
if (e.GetInt() == PrinterFileSystem::Initializing)
fetchUrl(boost::weak_ptr(fs));
err = fs->GetLastError();
if ((status == PrinterFileSystem::Failed && m_last_errors.find(err) == m_last_errors.end()) ||
status == PrinterFileSystem::ListReady) {
m_last_errors.insert(fs->GetLastError());
@ -429,7 +428,7 @@ void MediaFilePanel::fetchUrl(boost::weak_ptr<PrinterFileSystem> wfs)
if (!fs || fs != m_image_grid->GetFileSystem()) return;
if (!IsEnabled()) {
m_waiting_enable = true;
m_image_grid->SetStatus(m_bmp_failed, _L("Initialize failed (Device connection not ready)!"));
m_image_grid->SetStatus(m_bmp_failed, _L("Please confirm if the printer is connected."));
fs->SetUrl("0");
return;
}
@ -441,7 +440,7 @@ void MediaFilePanel::fetchUrl(boost::weak_ptr<PrinterFileSystem> wfs)
return;
}
if (!m_sdcard_exist) {
m_image_grid->SetStatus(m_bmp_failed, _L("Initialize failed (Storage unavailable, insert SD card.)!"));
m_image_grid->SetStatus(m_bmp_failed, _L("Please check if the SD card is inserted into the printer.\nIf it still cannot be read, you can try formatting the SD card."));
fs->SetUrl("0");
return;
}
@ -495,9 +494,9 @@ void MediaFilePanel::fetchUrl(boost::weak_ptr<PrinterFileSystem> wfs)
boost::shared_ptr fs(wfs.lock());
if (!fs || fs != m_image_grid->GetFileSystem()) return;
if (boost::algorithm::starts_with(url, "bambu:///")) {
fs->SetUrl(url + "&device=" + m + "&dev_ver=" + v);
fs->SetUrl(url);
} else {
m_image_grid->SetStatus(m_bmp_failed, wxString::Format(_L("Initialize failed (%s)!"), url.empty() ? _L("Network unreachable") : from_u8(url)));
m_image_grid->SetStatus(m_bmp_failed, _L("Connection Failed. Please check the network and try again"));
fs->SetUrl("3");
}
});

View file

@ -8,9 +8,11 @@
#ifndef MediaFilePanel_h
#define MediaFilePanel_h
#include <set>
#include "GUI_Utils.hpp"
#include "wxExtensions.hpp"
#include <set>
#include <wx/frame.h>
class Button;

View file

@ -638,7 +638,7 @@ wxBoxSizer *Newer3mfVersionDialog::get_btn_sizer()
}
});
}
if (!file_version_newer) {
m_later_btn = new Button(this, _L("Not for now"));
m_later_btn->SetBackgroundColor(btn_bg_white);
@ -671,7 +671,7 @@ NetworkErrorDialog::NetworkErrorDialog(wxWindow* parent)
auto m_line_top = new wxPanel(this, wxID_ANY, wxDefaultPosition, wxSize(-1, 1), wxTAB_TRAVERSAL);
m_line_top->SetBackgroundColour(wxColour(166, 169, 170));
wxBoxSizer* sizer_bacis_text = new wxBoxSizer(wxVERTICAL);
m_text_basic = new Label(this, _L("The server is unable to respond. Please click the link below to check the server status."));
@ -702,7 +702,7 @@ NetworkErrorDialog::NetworkErrorDialog(wxWindow* parent)
m_text_proposal->Wrap(FromDIP(470));
m_text_proposal->SetFont(::Label::Body_14);
m_text_proposal->SetForegroundColour(0x323A3C);
m_text_wiki = new wxHyperlinkCtrl(this, wxID_ANY, _L("How to use LAN only mode"), "");
m_text_wiki->SetFont(::Label::Body_13);
m_text_wiki->Bind(wxEVT_LEFT_DOWN, [this](auto& e) {wxGetApp().link_to_lan_only_wiki(); });
@ -719,7 +719,7 @@ NetworkErrorDialog::NetworkErrorDialog(wxWindow* parent)
checkbox->SetValue(false);
auto checkbox_title = new Label(this, _L("Dont't show this dialog again"));
auto checkbox_title = new Label(this, _L("Don't show this dialog again"));
checkbox_title->SetForegroundColour(0x323A3C);
checkbox_title->SetFont(::Label::Body_14);
checkbox_title->Wrap(-1);

View file

@ -313,7 +313,7 @@ public:
bool m_show_access_code{ false };
int m_result;
int current_input_index {0};
std::shared_ptr<BBLStatusBarSend> m_status_bar;
std::shared_ptr<BBLStatusBarSend> m_status_bar;
boost::bimaps::bimap<std::string, std::string> m_models_map;
void switch_input_panel(int index);