Fixed incorrect m_wiping_dialog_button showing after appInit

This commit is contained in:
YuSanka 2018-10-24 12:57:23 +02:00
parent 90ecbce9bb
commit e3b4a7b206
5 changed files with 22 additions and 26 deletions

View file

@ -653,7 +653,7 @@ void GUI_App::load_current_presets()
Sidebar& GUI_App::sidebar()
{
return mainframe->m_plater->sidebar();
return plater_->sidebar();
}
ObjectManipulation* GUI_App::obj_manipul()
@ -668,17 +668,17 @@ ObjectList* GUI_App::obj_list()
Plater* GUI_App::plater()
{
return mainframe->m_plater;
return plater_;
}
wxGLCanvas* GUI_App::canvas3D()
{
return mainframe->m_plater->canvas3D();
return plater_->canvas3D();
}
ModelObjectPtrs* GUI_App::model_objects()
{
return &mainframe->m_plater->model().objects;
return &plater_->model().objects;
}
wxNotebook* GUI_App::tab_panel() const

View file

@ -139,6 +139,7 @@ public:
PresetBundle* preset_bundle{ nullptr };
PresetUpdater* preset_updater{ nullptr };
MainFrame* mainframe{ nullptr };
Plater* plater_{ nullptr };
wxNotebook* tab_panel() const ;

View file

@ -139,6 +139,7 @@ void MainFrame::init_tabpanel()
if (!m_no_plater) {
m_plater = new Slic3r::GUI::Plater(m_tabpanel, this);
wxGetApp().plater_ = m_plater;
m_tabpanel->AddPage(m_plater, _(L("Plater")));
}
@ -149,18 +150,6 @@ void MainFrame::init_tabpanel()
// or when the preset's "modified" status changes.
Bind(EVT_TAB_PRESETS_CHANGED, &MainFrame::on_presets_changed, this);
// The following event is emited by the C++ Tab implementation on object selection change.
// EVT_COMMAND($self, -1, $OBJECT_SELECTION_CHANGED_EVENT, sub {
// auto obj_idx = event->GetId();
// // my $child = $event->GetInt == 1 ? 1 : undef;
// // $self->{plater}->select_object($obj_idx < 0 ? undef : $obj_idx, $child);
// // $self->{plater}->item_changed_selection($obj_idx);
//
// auto vol_idx = event->GetInt();
// m_plater->select_object_from_cpp(obj_idx < 0 ? undef : obj_idx, vol_idx < 0 ? -1 : vol_idx);
// });
create_preset_tabs();
std::vector<std::string> tab_names = { "print", "filament", "sla_material", "printer" };
for (auto tab_name : tab_names)
@ -225,9 +214,6 @@ void MainFrame::add_created_tab(Tab* panel)
{
panel->create_preset_tab();
// Load the currently selected preset into the GUI, update the preset selection box.
panel->load_current_preset();
const wxString& tab_name = panel->GetName();
bool add_panel = true;

View file

@ -244,6 +244,7 @@ public:
~FreqChangedParams() {}
wxButton* get_wiping_dialog_button() { return m_wiping_dialog_button; }
void Show(const bool show);
};
FreqChangedParams::FreqChangedParams(wxWindow* parent, const int label_width) :
@ -368,6 +369,16 @@ FreqChangedParams::FreqChangedParams(wxWindow* parent, const int label_width) :
}
void FreqChangedParams::Show(const bool show)
{
bool is_wdb_shown = m_wiping_dialog_button->IsShown();
m_og->sizer->Show(show);
// correct showing of the FreqChangedParams sizer when m_wiping_dialog_button is hidden
if (show && !is_wdb_shown)
m_wiping_dialog_button->Hide();
}
// Sidebar / private
struct Sidebar::priv
@ -416,7 +427,7 @@ void Sidebar::priv::show_preset_comboboxes()
sizer_presets->Show(4, showSLA);
sizer_presets->Show(5, showSLA);
frequently_changed_parameters->get_sizer()->Show(!showSLA);
frequently_changed_parameters->Show(!showSLA);
wxGetApp().plater()->Layout();
wxGetApp().mainframe->Layout();

View file

@ -215,7 +215,9 @@ void Tab::create_preset_tab()
// Initialize the DynamicPrintConfig by default keys/values.
build();
rebuild_page_tree();
update();
// update();
// Load the currently selected preset into the GUI, update the preset selection box.
load_current_preset();
}
void Tab::load_initial_data()
@ -740,9 +742,7 @@ void Tab::update_wiping_button_visibility() {
bool multiple_extruders = dynamic_cast<ConfigOptionFloats*>((m_preset_bundle->printers.get_edited_preset().config).option("nozzle_diameter"))->values.size() > 1;
bool single_extruder_mm = dynamic_cast<ConfigOptionBool*>( (m_preset_bundle->printers.get_edited_preset().config).option("single_extruder_multi_material"))->value;
if (!wxGetApp().mainframe)
return;
auto wiping_dialog_button = wxGetApp().mainframe->m_plater->sidebar().get_wiping_dialog_button();
auto wiping_dialog_button = wxGetApp().sidebar().get_wiping_dialog_button();
if (wiping_dialog_button) {
wiping_dialog_button->Show(wipe_tower_enabled && multiple_extruders && single_extruder_mm);
wiping_dialog_button->GetParent()->Layout();
@ -1862,8 +1862,6 @@ void TabPrinter::extruders_count_changed(size_t extruders_count){
m_preset_bundle->update_multi_material_filament_presets();
build_extruder_pages();
reload_config();
if (!wxGetApp().mainframe)
return;
on_value_change("extruders_count", extruders_count);
wxGetApp().sidebar().update_objects_list_extruder_column(extruders_count);
}