mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-12-25 17:18:49 -07:00
FIX: back up the selected printer in prepare page
jira: none Change-Id: Ibd163f78c4ce911a88459ecca96660ed4aa68ab2 (cherry picked from commit 392e8e18915d0db26ca8a3840d5783cc81cd1c1c)
This commit is contained in:
parent
0ffe93a093
commit
04643255e7
4 changed files with 22 additions and 4 deletions
|
|
@ -2773,6 +2773,11 @@ void Sidebar::update_dynamic_filament_list()
|
|||
dynamic_filament_list_1_based.update();
|
||||
}
|
||||
|
||||
PlaterPresetComboBox* Sidebar::printer_combox()
|
||||
{
|
||||
return p->combo_printer;
|
||||
}
|
||||
|
||||
ObjectList* Sidebar::obj_list()
|
||||
{
|
||||
// BBS
|
||||
|
|
|
|||
|
|
@ -174,6 +174,7 @@ public:
|
|||
void show_SEMM_buttons(bool bshow);
|
||||
void update_dynamic_filament_list();
|
||||
|
||||
PlaterPresetComboBox * printer_combox();
|
||||
ObjectList* obj_list();
|
||||
ObjectSettings* obj_settings();
|
||||
ObjectLayers* obj_layers();
|
||||
|
|
|
|||
|
|
@ -180,7 +180,7 @@ void PresetComboBox::invalidate_selection()
|
|||
|
||||
void PresetComboBox::validate_selection(bool predicate/*=false*/)
|
||||
{
|
||||
if (predicate ||
|
||||
if (predicate &&
|
||||
// just in case: mark m_last_selected as a first added element
|
||||
m_last_selected == INT_MAX)
|
||||
m_last_selected = GetCount() - 1;
|
||||
|
|
@ -310,30 +310,37 @@ wxString PresetComboBox::get_preset_item_name(unsigned int index)
|
|||
if (m_type == Preset::TYPE_PRINTER) {
|
||||
int idx = selected_connected_printer();
|
||||
if (idx < 0) {
|
||||
m_selected_dev_id.clear();
|
||||
return GetString(index);
|
||||
}
|
||||
else {
|
||||
DeviceManager *dev = Slic3r::GUI::wxGetApp().getDeviceManager();
|
||||
if (!dev) {
|
||||
assert(false);
|
||||
m_selected_dev_id.clear();
|
||||
return GetString(index);
|
||||
}
|
||||
|
||||
std::map<std::string, MachineObject *> machine_list = dev->get_my_machine_list();
|
||||
if (machine_list.empty()) {
|
||||
assert(false);
|
||||
m_selected_dev_id.clear();
|
||||
return GetString(index);
|
||||
}
|
||||
|
||||
auto iter = machine_list.begin();
|
||||
std::advance(iter, idx);
|
||||
Preset* machine_preset = get_printer_preset(iter->second);
|
||||
if (machine_preset) {
|
||||
return from_u8(machine_preset->name);
|
||||
if (iter != machine_list.end()) {
|
||||
m_selected_dev_id = *iter;
|
||||
Preset* machine_preset = get_printer_preset(iter->second);
|
||||
if (machine_preset) {
|
||||
return from_u8(machine_preset->name);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
m_selected_dev_id.clear();
|
||||
return GetString(index);
|
||||
}
|
||||
|
||||
|
|
@ -447,6 +454,7 @@ void PresetComboBox::add_connected_printers(std::string selected, bool alias_nam
|
|||
boost::replace_all(printer_model, "Bambu Lab ", "");
|
||||
auto text = iter->second->dev_name + " (" + printer_model + ")";
|
||||
int item_id = Append(from_u8(text), wxNullBitmap, &m_first_printer_idx + std::distance(machine_list.begin(), iter));
|
||||
validate_selection(m_selected_dev_id == iter->first);
|
||||
}
|
||||
m_last_printer_idx = GetCount();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -77,6 +77,8 @@ public:
|
|||
void set_filament_idx(const int extr_idx) { m_filament_idx = extr_idx; }
|
||||
int get_filament_idx() const { return m_filament_idx; }
|
||||
|
||||
std::string get_selected_dev_id() const { return m_selected_dev_id; }
|
||||
|
||||
// BBS
|
||||
wxString get_tooltip(const Preset& preset);
|
||||
|
||||
|
|
@ -132,6 +134,8 @@ protected:
|
|||
int m_first_printer_idx = 0;
|
||||
int m_last_printer_idx = 0;
|
||||
|
||||
std::string m_selected_dev_id;
|
||||
|
||||
PrinterTechnology printer_technology {ptAny};
|
||||
|
||||
void invalidate_selection();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue