FIX: back up the selected printer in prepare page
jira: none Change-Id: Ibd163f78c4ce911a88459ecca96660ed4aa68ab2
This commit is contained in:
parent
ad7fadceaa
commit
392e8e1891
|
@ -2885,6 +2885,11 @@ void Sidebar::sync_ams_list()
|
||||||
notify_manager->bbl_show_seqprintinfo_notification(info_text);
|
notify_manager->bbl_show_seqprintinfo_notification(info_text);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PlaterPresetComboBox* Sidebar::printer_combox()
|
||||||
|
{
|
||||||
|
return p->combo_printer;
|
||||||
|
}
|
||||||
|
|
||||||
ObjectList* Sidebar::obj_list()
|
ObjectList* Sidebar::obj_list()
|
||||||
{
|
{
|
||||||
// BBS
|
// BBS
|
||||||
|
|
|
@ -161,6 +161,7 @@ public:
|
||||||
bool should_sync_extruder_list(MachineObject* obj);
|
bool should_sync_extruder_list(MachineObject* obj);
|
||||||
void update_sync_status(const MachineObject* obj);
|
void update_sync_status(const MachineObject* obj);
|
||||||
|
|
||||||
|
PlaterPresetComboBox * printer_combox();
|
||||||
ObjectList* obj_list();
|
ObjectList* obj_list();
|
||||||
ObjectSettings* obj_settings();
|
ObjectSettings* obj_settings();
|
||||||
ObjectLayers* obj_layers();
|
ObjectLayers* obj_layers();
|
||||||
|
|
|
@ -182,7 +182,7 @@ void PresetComboBox::invalidate_selection()
|
||||||
|
|
||||||
void PresetComboBox::validate_selection(bool predicate/*=false*/)
|
void PresetComboBox::validate_selection(bool predicate/*=false*/)
|
||||||
{
|
{
|
||||||
if (predicate ||
|
if (predicate &&
|
||||||
// just in case: mark m_last_selected as a first added element
|
// just in case: mark m_last_selected as a first added element
|
||||||
m_last_selected == INT_MAX)
|
m_last_selected == INT_MAX)
|
||||||
m_last_selected = GetCount() - 1;
|
m_last_selected = GetCount() - 1;
|
||||||
|
@ -290,24 +290,28 @@ wxString PresetComboBox::get_preset_item_name(unsigned int index)
|
||||||
if (m_type == Preset::TYPE_PRINTER) {
|
if (m_type == Preset::TYPE_PRINTER) {
|
||||||
int idx = selected_connected_printer(index);
|
int idx = selected_connected_printer(index);
|
||||||
if (idx < 0) {
|
if (idx < 0) {
|
||||||
|
m_selected_dev_id.clear();
|
||||||
return GetString(index);
|
return GetString(index);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
DeviceManager *dev = Slic3r::GUI::wxGetApp().getDeviceManager();
|
DeviceManager *dev = Slic3r::GUI::wxGetApp().getDeviceManager();
|
||||||
if (!dev) {
|
if (!dev) {
|
||||||
assert(false);
|
assert(false);
|
||||||
|
m_selected_dev_id.clear();
|
||||||
return GetString(index);
|
return GetString(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::map<std::string, MachineObject *> machine_list = dev->get_my_machine_list();
|
std::map<std::string, MachineObject *> machine_list = dev->get_my_machine_list();
|
||||||
if (machine_list.empty()) {
|
if (machine_list.empty()) {
|
||||||
assert(false);
|
assert(false);
|
||||||
|
m_selected_dev_id.clear();
|
||||||
return GetString(index);
|
return GetString(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
auto iter = m_backup_dev_list_sorted.begin();
|
auto iter = m_backup_dev_list_sorted.begin();
|
||||||
std::advance(iter, idx);
|
std::advance(iter, idx);
|
||||||
if (iter != m_backup_dev_list_sorted.end() && machine_list.find(*iter) != machine_list.end()) {
|
if (iter != m_backup_dev_list_sorted.end() && machine_list.find(*iter) != machine_list.end()) {
|
||||||
|
m_selected_dev_id = *iter;
|
||||||
Preset* machine_preset = get_printer_preset(machine_list[*iter]);
|
Preset* machine_preset = get_printer_preset(machine_list[*iter]);
|
||||||
if (machine_preset) {
|
if (machine_preset) {
|
||||||
dev->set_selected_machine(*iter);
|
dev->set_selected_machine(*iter);
|
||||||
|
@ -317,6 +321,7 @@ wxString PresetComboBox::get_preset_item_name(unsigned int index)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_selected_dev_id.clear();
|
||||||
return GetString(index);
|
return GetString(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -476,6 +481,7 @@ void PresetComboBox::add_connected_printers(std::string selected, bool alias_nam
|
||||||
boost::replace_all(printer_model, "Bambu Lab ", "");
|
boost::replace_all(printer_model, "Bambu Lab ", "");
|
||||||
auto text = iter->second->dev_name + " (" + printer_model + ")";
|
auto text = iter->second->dev_name + " (" + printer_model + ")";
|
||||||
int item_id = Append(from_u8(text), wxNullBitmap, &m_first_printer_idx + std::distance(user_machine_list.begin(), iter));
|
int item_id = Append(from_u8(text), wxNullBitmap, &m_first_printer_idx + std::distance(user_machine_list.begin(), iter));
|
||||||
|
validate_selection(m_selected_dev_id == iter->first);
|
||||||
}
|
}
|
||||||
m_last_printer_idx = GetCount();
|
m_last_printer_idx = GetCount();
|
||||||
}
|
}
|
||||||
|
|
|
@ -81,6 +81,8 @@ public:
|
||||||
void set_filament_idx(const int extr_idx) { m_filament_idx = extr_idx; }
|
void set_filament_idx(const int extr_idx) { m_filament_idx = extr_idx; }
|
||||||
int get_filament_idx() const { return m_filament_idx; }
|
int get_filament_idx() const { return m_filament_idx; }
|
||||||
|
|
||||||
|
std::string get_selected_dev_id() const { return m_selected_dev_id; }
|
||||||
|
|
||||||
// BBS
|
// BBS
|
||||||
wxString get_tooltip(const Preset& preset);
|
wxString get_tooltip(const Preset& preset);
|
||||||
|
|
||||||
|
@ -138,6 +140,7 @@ protected:
|
||||||
|
|
||||||
std::vector<std::string> m_backup_dev_list;
|
std::vector<std::string> m_backup_dev_list;
|
||||||
std::vector<std::string> m_backup_dev_list_sorted;
|
std::vector<std::string> m_backup_dev_list_sorted;
|
||||||
|
std::string m_selected_dev_id;
|
||||||
|
|
||||||
PrinterTechnology printer_technology {ptAny};
|
PrinterTechnology printer_technology {ptAny};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue