FIX: fix the printer drop-down list stuck problem
jira: none Change-Id: I69927a3dc1c2e2f562cbfc47bc5fcf99d0833cdb
This commit is contained in:
parent
93d98a6a69
commit
b549be3180
|
@ -7995,8 +7995,8 @@ void Plater::priv::on_select_preset(wxCommandEvent &evt)
|
|||
//! combo->GetStringSelection().ToUTF8().data());
|
||||
|
||||
wxString wx_name = combo->GetString(selection);
|
||||
if (preset_type == Preset::TYPE_PRINTER) {
|
||||
wx_name = combo->get_preset_item_name(selection); }
|
||||
// if (preset_type == Preset::TYPE_PRINTER) {
|
||||
// wx_name = combo->get_preset_item_name(selection); }
|
||||
|
||||
std::string preset_name = wxGetApp().preset_bundle->get_preset_name_by_alias(preset_type,
|
||||
Preset::remove_suffix_modified(wx_name.ToUTF8().data()));
|
||||
|
|
|
@ -125,7 +125,6 @@ PresetComboBox::PresetComboBox(wxWindow* parent, Preset::Type preset_type, const
|
|||
e.Skip();
|
||||
});
|
||||
Bind(wxEVT_COMBOBOX_DROPDOWN, [this](wxCommandEvent &) {
|
||||
update_printer_list();
|
||||
m_suppress_change = false;
|
||||
});
|
||||
Bind(wxEVT_COMBOBOX_CLOSEUP, [this](wxCommandEvent&) { m_suppress_change = true; });
|
||||
|
@ -416,33 +415,6 @@ void PresetComboBox::update_from_bundle()
|
|||
this->update(m_collection->get_selected_preset().name);
|
||||
}
|
||||
|
||||
bool PresetComboBox::update_printer_list()
|
||||
{
|
||||
if (m_type != Preset::TYPE_PRINTER)
|
||||
return false;
|
||||
|
||||
if (wxGetApp().is_user_login()) {
|
||||
Slic3r::DeviceManager *dev = Slic3r::GUI::wxGetApp().getDeviceManager();
|
||||
if (!dev)
|
||||
return false;
|
||||
|
||||
NetworkAgent *agent = wxGetApp().getAgent();
|
||||
unsigned int http_code;
|
||||
std::string body;
|
||||
int result = agent->get_user_print_info(&http_code, &body);
|
||||
if (!body.empty()) {
|
||||
dev->parse_user_print_info(body);
|
||||
std::vector<std::string> new_machine_list;
|
||||
std::map<std::string, MachineObject *> machine_list = dev->get_my_machine_list();
|
||||
for (auto &it : machine_list) { new_machine_list.push_back(it.first); }
|
||||
if (new_machine_list != m_backup_dev_list) {
|
||||
update();
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void PresetComboBox::add_connected_printers(std::string selected, bool alias_name)
|
||||
{
|
||||
DeviceManager *dev = Slic3r::GUI::wxGetApp().getDeviceManager();
|
||||
|
|
|
@ -75,7 +75,6 @@ public:
|
|||
void update_from_bundle();
|
||||
|
||||
// BBS: printer
|
||||
bool update_printer_list();
|
||||
void add_connected_printers(std::string selected, bool alias_name = false);
|
||||
int selected_connected_printer(int index) const;
|
||||
|
||||
|
|
Loading…
Reference in New Issue