mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-05-19 19:33:47 +00:00
ENH: remove json exception ->the message which processed by process_network_msg is not json
jira: [none] Change-Id: I770a2c89809d97bdd17c194a556d2c5461cc0cbd (cherry picked from commit 23f4dd625234918bffaa2ffefb7e65f516e1d870)
This commit is contained in:
@@ -1822,21 +1822,19 @@ void GUI_App::init_networking_callbacks()
|
|||||||
CallAfter([this, dev_id, msg] {
|
CallAfter([this, dev_id, msg] {
|
||||||
if (is_closing())
|
if (is_closing())
|
||||||
return;
|
return;
|
||||||
this->process_network_msg(dev_id, msg);
|
|
||||||
|
|
||||||
MachineObject* obj = this->m_device_manager->get_user_machine(dev_id);
|
if (process_network_msg(dev_id, msg)) {
|
||||||
if (obj) {
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (MachineObject* obj = this->m_device_manager->get_user_machine(dev_id)) {
|
||||||
auto sel = this->m_device_manager->get_selected_machine();
|
auto sel = this->m_device_manager->get_selected_machine();
|
||||||
|
if (sel && sel->get_dev_id() == dev_id) {
|
||||||
if (sel && sel->get_dev_id() == dev_id)
|
|
||||||
{
|
|
||||||
obj->parse_json("cloud", msg);
|
obj->parse_json("cloud", msg);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
obj->parse_json("cloud", msg, true);
|
obj->parse_json("cloud", msg, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (sel == obj || sel == nullptr) {
|
if (sel == obj || sel == nullptr) {
|
||||||
GUI::wxGetApp().sidebar().load_ams_list(obj->get_dev_id(), obj);
|
GUI::wxGetApp().sidebar().load_ams_list(obj->get_dev_id(), obj);
|
||||||
}
|
}
|
||||||
@@ -1876,10 +1874,11 @@ void GUI_App::init_networking_callbacks()
|
|||||||
if (is_closing())
|
if (is_closing())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
this->process_network_msg(dev_id, msg);
|
if (this->process_network_msg(dev_id, msg)) {
|
||||||
MachineObject* obj = m_device_manager->get_my_machine(dev_id);
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (obj) {
|
if (MachineObject* obj = m_device_manager->get_my_machine(dev_id)) {
|
||||||
obj->parse_json("lan", msg);
|
obj->parse_json("lan", msg);
|
||||||
if (this->m_device_manager->get_selected_machine() == obj) {
|
if (this->m_device_manager->get_selected_machine() == obj) {
|
||||||
GUI::wxGetApp().sidebar().load_ams_list(obj->get_dev_id(), obj);
|
GUI::wxGetApp().sidebar().load_ams_list(obj->get_dev_id(), obj);
|
||||||
@@ -4883,27 +4882,34 @@ void GUI_App::check_new_version_sf(bool show_tips, int by_user)
|
|||||||
http.perform();
|
http.perform();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GUI_App::process_network_msg(std::string dev_id, std::string msg)
|
// return true if handled
|
||||||
|
bool GUI_App::process_network_msg(std::string dev_id, std::string msg)
|
||||||
{
|
{
|
||||||
if (dev_id.empty()) {
|
if (dev_id.empty()) {
|
||||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << msg;
|
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << msg;
|
||||||
}
|
}
|
||||||
else if (msg == "device_cert_installed") {
|
else if (msg == "device_cert_installed") {
|
||||||
BOOST_LOG_TRIVIAL(info) << "process_network_msg, device_cert_installed";
|
BOOST_LOG_TRIVIAL(info) << "process_network_msg, device_cert_installed";
|
||||||
Slic3r::DeviceManager* dev = Slic3r::GUI::wxGetApp().getDeviceManager();
|
if (Slic3r::DeviceManager* dev = Slic3r::GUI::wxGetApp().getDeviceManager()) {
|
||||||
if (!dev) return;
|
if (MachineObject* obj = dev->get_my_machine(dev_id)) {
|
||||||
MachineObject* obj = dev->get_my_machine(dev_id);
|
obj->update_device_cert_state(true);
|
||||||
if (obj) {
|
}
|
||||||
obj->update_device_cert_state(true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
else if (msg == "device_cert_uninstalled") {
|
else if (msg == "device_cert_uninstalled") {
|
||||||
BOOST_LOG_TRIVIAL(info) << "process_network_msg, device_cert_uninstalled";
|
BOOST_LOG_TRIVIAL(info) << "process_network_msg, device_cert_uninstalled";
|
||||||
Slic3r::DeviceManager *dev = Slic3r::GUI::wxGetApp().getDeviceManager();
|
if (Slic3r::DeviceManager *dev = Slic3r::GUI::wxGetApp().getDeviceManager()) {
|
||||||
if (!dev) return;
|
if (MachineObject* obj = dev->get_my_machine(dev_id)){
|
||||||
MachineObject *obj = dev->get_my_machine(dev_id);
|
obj->update_device_cert_state(false);
|
||||||
if (obj) { obj->update_device_cert_state(false); }
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
//BBS pop up a dialog and download files
|
//BBS pop up a dialog and download files
|
||||||
|
|||||||
@@ -482,7 +482,7 @@ public:
|
|||||||
void check_update(bool show_tips, int by_user);
|
void check_update(bool show_tips, int by_user);
|
||||||
void check_new_version(bool show_tips = false, int by_user = 0);
|
void check_new_version(bool show_tips = false, int by_user = 0);
|
||||||
void check_new_version_sf(bool show_tips = false, int by_user = 0);
|
void check_new_version_sf(bool show_tips = false, int by_user = 0);
|
||||||
void process_network_msg(std::string dev_id, std::string msg);
|
bool process_network_msg(std::string dev_id, std::string msg);
|
||||||
void request_new_version(int by_user);
|
void request_new_version(int by_user);
|
||||||
void enter_force_upgrade();
|
void enter_force_upgrade();
|
||||||
void set_skip_version(bool skip = true);
|
void set_skip_version(bool skip = true);
|
||||||
|
|||||||
Reference in New Issue
Block a user