FIX:Fixed printer name display error
jira:[STUDIO-8619] Change-Id: Ie9ce0cb39623eefa3973a342b447ab2f2a765d28 (cherry picked from commit c41eb657818bb29abb3a2e7c6df7b7d489c80592)
This commit is contained in:
parent
00d274fc29
commit
818948af53
4 changed files with 25 additions and 12 deletions
|
@ -5999,9 +5999,9 @@ std::vector<std::string> DeviceManager::get_compatible_machine(std::string type_
|
|||
return compatible_machine;
|
||||
}
|
||||
|
||||
std::vector<std::string> DeviceManager::get_all_model_id()
|
||||
boost::bimaps::bimap<std::string, std::string> DeviceManager::get_all_model_id_with_name()
|
||||
{
|
||||
std::vector<std::string> models;
|
||||
boost::bimaps::bimap<std::string, std::string> models;
|
||||
std::vector<wxString> m_files;
|
||||
|
||||
wxDir dir(Slic3r::resources_dir() + "/printers/");
|
||||
|
@ -6026,8 +6026,14 @@ std::vector<std::string> DeviceManager::get_all_model_id()
|
|||
json_file >> jj;
|
||||
if (jj.contains("00.00.00.00")) {
|
||||
json const &printer = jj["00.00.00.00"];
|
||||
if (printer.contains("model_id")) {
|
||||
for (auto res : printer["model_id"]) models.emplace_back(res.get<std::string>());
|
||||
|
||||
std::string model_id;
|
||||
std::string display_name;
|
||||
if (printer.contains("model_id")) {model_id = printer["model_id"].get<std::string>();}
|
||||
if (printer.contains("display_name")) {display_name = printer["display_name"].get<std::string>();}
|
||||
|
||||
if (!model_id.empty() && !display_name.empty()) {
|
||||
models.left.insert(make_pair(model_id, display_name));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
#include "libslic3r/ProjectTask.hpp"
|
||||
#include "slic3r/Utils/json_diff.hpp"
|
||||
#include "slic3r/Utils/NetworkAgent.hpp"
|
||||
#include "boost/bimap/bimap.hpp"
|
||||
#include "CameraPopup.hpp"
|
||||
#include "libslic3r/calib.hpp"
|
||||
#include "libslic3r/Utils.hpp"
|
||||
|
@ -1078,11 +1079,11 @@ public:
|
|||
static PrinterArch get_printer_arch(std::string type_str);
|
||||
static std::string get_ftp_folder(std::string type_str);
|
||||
static bool get_printer_is_enclosed(std::string type_str);
|
||||
static std::vector<std::string> get_resolution_supported(std::string type_str);
|
||||
static std::vector<std::string> get_compatible_machine(std::string type_str);
|
||||
static std::vector<std::string> get_all_model_id();
|
||||
static bool load_filaments_blacklist_config();
|
||||
static void check_filaments_in_blacklist(std::string tag_vendor, std::string tag_type, bool& in_blacklist, std::string& ac, std::string& info);
|
||||
static std::vector<std::string> get_resolution_supported(std::string type_str);
|
||||
static std::vector<std::string> get_compatible_machine(std::string type_str);
|
||||
static boost::bimaps::bimap<std::string, std::string> get_all_model_id_with_name();
|
||||
static std::string load_gcode(std::string type_str, std::string gcode_file);
|
||||
};
|
||||
|
||||
|
|
|
@ -1563,9 +1563,9 @@ InputIpAddressDialog::InputIpAddressDialog(wxWindow *parent)
|
|||
m_input_modelID->SetMinSize(wxSize(FromDIP(168), FromDIP(28)));
|
||||
m_input_modelID->SetMaxSize(wxSize(FromDIP(168), FromDIP(28)));
|
||||
|
||||
auto models = DeviceManager::get_all_model_id();
|
||||
for (int i = 0; i < models.size(); i++) {
|
||||
m_input_modelID->Append(models[i]);
|
||||
m_models_map = DeviceManager::get_all_model_id_with_name();
|
||||
for (auto it = m_models_map.begin(); it != m_models_map.end(); ++it) {
|
||||
m_input_modelID->Append(it->right);
|
||||
m_input_modelID->SetSelection(0);
|
||||
}
|
||||
|
||||
|
@ -1883,7 +1883,12 @@ void InputIpAddressDialog::on_ok(wxMouseEvent& evt)
|
|||
std::string str_ip = m_input_ip->GetTextCtrl()->GetValue().ToStdString();
|
||||
std::string str_access_code = m_input_access_code->GetTextCtrl()->GetValue().ToStdString();
|
||||
std::string str_sn = m_input_sn->GetTextCtrl()->GetValue().ToStdString();
|
||||
std::string str_model_id = m_input_modelID->GetStringSelection().ToStdString();
|
||||
std::string str_model_id = "";
|
||||
|
||||
auto it = m_models_map.right.find(m_input_modelID->GetStringSelection().ToStdString());
|
||||
if (it != m_models_map.right.end()) {
|
||||
str_model_id = it->get_left();
|
||||
}
|
||||
|
||||
m_button_ok->Enable(false);
|
||||
m_button_ok->SetBackgroundColor(wxColour(0x90, 0x90, 0x90));
|
||||
|
|
|
@ -314,6 +314,7 @@ public:
|
|||
int m_result;
|
||||
int current_input_index {0};
|
||||
std::shared_ptr<BBLStatusBarSend> m_status_bar;
|
||||
boost::bimaps::bimap<std::string, std::string> m_models_map;
|
||||
|
||||
void switch_input_panel(int index);
|
||||
void on_cancel();
|
||||
|
|
Loading…
Reference in a new issue