Some improvements

This commit is contained in:
YuSanka 2019-03-19 14:36:32 +01:00
parent ba54ce0309
commit b7a1bd927a
4 changed files with 19 additions and 3 deletions

View File

@ -743,6 +743,13 @@ wxNotebook* GUI_App::tab_panel() const
return mainframe->m_tabpanel;
}
int GUI_App::extruders_cnt() const
{
const Preset& preset = preset_bundle->printers.get_selected_preset();
return preset.printer_technology() == ptSLA ? 1 :
preset.config.option<ConfigOptionFloats>("nozzle_diameter")->values.size();
}
void GUI_App::window_pos_save(wxTopLevelWindow* window, const std::string &name)
{
if (name.empty()) { return; }

View File

@ -163,6 +163,7 @@ public:
Plater* plater_{ nullptr };
wxNotebook* tab_panel() const ;
int extruders_cnt() const;
std::vector<Tab *> tabs_list;

View File

@ -51,8 +51,7 @@ static DynamicPrintConfig& printer_config()
static int extruders_count()
{
return printer_technology() == ptSLA ? 1 :
printer_config().option<ConfigOptionFloats>("nozzle_diameter")->values.size();
return wxGetApp().extruders_cnt();
}
ObjectList::ObjectList(wxWindow* parent) :

View File

@ -295,8 +295,17 @@ wxBitmapComboBox(parent, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(15 *
wxGetApp().tab_panel()->ChangeSelection(page_id);
tab->select_preset(GetString(GetSelection()).ToUTF8().data());
/* In a case of a multi-material printing, for editing another Filament Preset
* it's needed to select this preset for the "Filament settings" Tab
*/
if (preset_type == Preset::TYPE_FILAMENT && wxGetApp().extruders_cnt() > 1)
{
const std::string& selected_preset = GetString(GetSelection()).ToUTF8().data();
// Call select_preset() only if there is new preset and not just modified
if ( !boost::algorithm::ends_with(selected_preset, "(modified)") )
tab->select_preset(selected_preset);
}
}));
}