mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-05-19 11:23:42 +00: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:
@@ -2773,6 +2773,11 @@ void Sidebar::update_dynamic_filament_list()
|
|||||||
dynamic_filament_list_1_based.update();
|
dynamic_filament_list_1_based.update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PlaterPresetComboBox* Sidebar::printer_combox()
|
||||||
|
{
|
||||||
|
return p->combo_printer;
|
||||||
|
}
|
||||||
|
|
||||||
ObjectList* Sidebar::obj_list()
|
ObjectList* Sidebar::obj_list()
|
||||||
{
|
{
|
||||||
// BBS
|
// BBS
|
||||||
|
|||||||
@@ -174,6 +174,7 @@ public:
|
|||||||
void show_SEMM_buttons(bool bshow);
|
void show_SEMM_buttons(bool bshow);
|
||||||
void update_dynamic_filament_list();
|
void update_dynamic_filament_list();
|
||||||
|
|
||||||
|
PlaterPresetComboBox * printer_combox();
|
||||||
ObjectList* obj_list();
|
ObjectList* obj_list();
|
||||||
ObjectSettings* obj_settings();
|
ObjectSettings* obj_settings();
|
||||||
ObjectLayers* obj_layers();
|
ObjectLayers* obj_layers();
|
||||||
|
|||||||
@@ -180,7 +180,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;
|
||||||
@@ -310,30 +310,37 @@ 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();
|
int idx = selected_connected_printer();
|
||||||
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 = machine_list.begin();
|
auto iter = machine_list.begin();
|
||||||
std::advance(iter, idx);
|
std::advance(iter, idx);
|
||||||
Preset* machine_preset = get_printer_preset(iter->second);
|
if (iter != machine_list.end()) {
|
||||||
if (machine_preset) {
|
m_selected_dev_id = *iter;
|
||||||
return from_u8(machine_preset->name);
|
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);
|
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 ", "");
|
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(machine_list.begin(), iter));
|
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();
|
m_last_printer_idx = GetCount();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -77,6 +77,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);
|
||||||
|
|
||||||
@@ -132,6 +134,8 @@ protected:
|
|||||||
int m_first_printer_idx = 0;
|
int m_first_printer_idx = 0;
|
||||||
int m_last_printer_idx = 0;
|
int m_last_printer_idx = 0;
|
||||||
|
|
||||||
|
std::string m_selected_dev_id;
|
||||||
|
|
||||||
PrinterTechnology printer_technology {ptAny};
|
PrinterTechnology printer_technology {ptAny};
|
||||||
|
|
||||||
void invalidate_selection();
|
void invalidate_selection();
|
||||||
|
|||||||
Reference in New Issue
Block a user