Update of the view mode works correctly

This commit is contained in:
YuSanka 2018-05-21 14:49:31 +02:00
parent bd2371cb03
commit 622c613b41
7 changed files with 26 additions and 15 deletions

View File

@ -96,6 +96,8 @@ sub new {
$self->update_ui_from_settings; $self->update_ui_from_settings;
Slic3r::GUI::update_mode();
return $self; return $self;
} }

View File

@ -449,7 +449,8 @@ sub new {
$self->{"object_info_manifold_warning_icon_show"} = sub { $self->{"object_info_manifold_warning_icon_show"} = sub {
if ($self->{object_info_manifold_warning_icon}->IsShown() != $_[0]) { if ($self->{object_info_manifold_warning_icon}->IsShown() != $_[0]) {
Slic3r::GUI::set_show_manifold_warning_icon($_[0]); Slic3r::GUI::set_show_manifold_warning_icon($_[0]);
return if (wxTheApp->{app_config}->get("view_mode") eq "simple"); my $mode = wxTheApp->{app_config}->get("view_mode");
return if ($mode eq "" || $mode eq "simple");
$self->{object_info_manifold_warning_icon}->Show($_[0]); $self->{object_info_manifold_warning_icon}->Show($_[0]);
$self->Layout $self->Layout
} }
@ -548,7 +549,7 @@ sub new {
$self->SetSizer($sizer); $self->SetSizer($sizer);
# Send sizers/buttons to C++ # Send sizers/buttons to C++
Slic3r::GUI::set_objects_from_perl( $self, Slic3r::GUI::set_objects_from_perl( $self->{right_panel},
$frequently_changed_parameters_sizer, $frequently_changed_parameters_sizer,
$expert_mode_part_sizer, $expert_mode_part_sizer,
$scrolled_window_sizer, $scrolled_window_sizer,
@ -1767,7 +1768,7 @@ sub on_extruders_change {
my @presets = $choices->[0]->GetStrings; my @presets = $choices->[0]->GetStrings;
# initialize new choice # initialize new choice
my $choice = Wx::BitmapComboBox->new($self, -1, "", wxDefaultPosition, wxDefaultSize, [@presets], wxCB_READONLY); my $choice = Wx::BitmapComboBox->new($self->{right_panel}, -1, "", wxDefaultPosition, wxDefaultSize, [@presets], wxCB_READONLY);
my $extruder_idx = scalar @$choices; my $extruder_idx = scalar @$choices;
EVT_LEFT_DOWN($choice, sub { $self->filament_color_box_lmouse_down($extruder_idx, @_); } ); EVT_LEFT_DOWN($choice, sub { $self->filament_color_box_lmouse_down($extruder_idx, @_); } );
push @$choices, $choice; push @$choices, $choice;

View File

@ -245,7 +245,7 @@ sub reload_scene {
$self->set_warning_enabled(0); $self->set_warning_enabled(0);
$self->volumes->update_outside_state($self->{config}, 1); $self->volumes->update_outside_state($self->{config}, 1);
Slic3r::GUI::_3DScene::reset_warning_texture(); Slic3r::GUI::_3DScene::reset_warning_texture();
$self->on_enable_action_buttons->(1) if ($self->on_enable_action_buttons); $self->on_enable_action_buttons->(scalar @{$self->{model}->objects} > 0) if ($self->on_enable_action_buttons);
} }
} else { } else {
$self->set_warning_enabled(0); $self->set_warning_enabled(0);

View File

@ -202,7 +202,7 @@ double m_brim_width = 0.0;
wxButton* g_wiping_dialog_button = nullptr; wxButton* g_wiping_dialog_button = nullptr;
//showed/hided controls according to the view mode //showed/hided controls according to the view mode
wxWindow *g_plater = nullptr; wxWindow *g_right_panel = nullptr;
wxBoxSizer *g_frequently_changed_parameters_sizer = nullptr; wxBoxSizer *g_frequently_changed_parameters_sizer = nullptr;
wxBoxSizer *g_expert_mode_part_sizer = nullptr; wxBoxSizer *g_expert_mode_part_sizer = nullptr;
wxBoxSizer *g_scrolled_window_sizer = nullptr; wxBoxSizer *g_scrolled_window_sizer = nullptr;
@ -279,7 +279,7 @@ void set_objects_from_perl( wxWindow* parent, wxBoxSizer *frequently_changed_par
wxButton *btn_print, wxButton *btn_send_gcode, wxButton *btn_print, wxButton *btn_send_gcode,
wxStaticBitmap *manifold_warning_icon) wxStaticBitmap *manifold_warning_icon)
{ {
g_plater = parent; g_right_panel = parent;
g_frequently_changed_parameters_sizer = frequently_changed_parameters_sizer; g_frequently_changed_parameters_sizer = frequently_changed_parameters_sizer;
g_expert_mode_part_sizer = expert_mode_part_sizer; g_expert_mode_part_sizer = expert_mode_part_sizer;
g_scrolled_window_sizer = scrolled_window_sizer; g_scrolled_window_sizer = scrolled_window_sizer;
@ -616,7 +616,6 @@ void create_preset_tabs(bool no_controller, int event_value_change, int event_pr
tab->set_event_value_change(wxEventType(event_value_change)); tab->set_event_value_change(wxEventType(event_value_change));
tab->set_event_presets_changed(wxEventType(event_presets_changed)); tab->set_event_presets_changed(wxEventType(event_presets_changed));
} }
update_mode();// TODO change place of call this function
} }
TabIface* get_preset_tab_iface(char *name) TabIface* get_preset_tab_iface(char *name)
@ -1136,14 +1135,14 @@ void show_scrolled_window_sizer(bool show)
void update_mode() void update_mode()
{ {
wxWindowUpdateLocker noUpdates(g_plater); wxWindowUpdateLocker noUpdates(g_right_panel);
ConfigMenuIDs mode = get_view_mode(); ConfigMenuIDs mode = get_view_mode();
show_frequently_changed_parameters(mode >= ConfigMenuModeRegular); show_frequently_changed_parameters(mode >= ConfigMenuModeRegular);
g_expert_mode_part_sizer->Show(mode == ConfigMenuModeExpert); g_expert_mode_part_sizer->Show(mode == ConfigMenuModeExpert);
show_scrolled_window_sizer(mode >= ConfigMenuModeRegular); show_scrolled_window_sizer(mode >= ConfigMenuModeRegular);
show_buttons(mode >= ConfigMenuModeRegular); show_buttons(mode >= ConfigMenuModeRegular);
g_plater->Layout(); g_right_panel->Layout();
} }
ConfigOptionsGroup* get_optgroup() ConfigOptionsGroup* get_optgroup()

View File

@ -142,6 +142,8 @@ void save_language();
void get_installed_languages(wxArrayString & names, wxArrayLong & identifiers); void get_installed_languages(wxArrayString & names, wxArrayLong & identifiers);
// select language from the list of installed languages // select language from the list of installed languages
bool select_language(wxArrayString & names, wxArrayLong & identifiers); bool select_language(wxArrayString & names, wxArrayLong & identifiers);
// update right panel of the Plater according to view mode
void update_mode();
std::vector<Tab *>& get_tabs_list(); std::vector<Tab *>& get_tabs_list();
bool checked_tab(Tab* tab); bool checked_tab(Tab* tab);

View File

@ -705,13 +705,17 @@ void Tab::on_value_change(const std::string& opt_key, const boost::any& value)
// Show/hide the 'purging volumes' button // Show/hide the 'purging volumes' button
void Tab::update_wiping_button_visibility() { void Tab::update_wiping_button_visibility() {
bool wipe_tower_enabled = dynamic_cast<ConfigOptionBool*>( (m_preset_bundle->prints.get_edited_preset().config ).option("wipe_tower"))->value; if (!get_app_config()->has("view_mode") || get_app_config()->get("view_mode") == "simple")
get_wiping_dialog_button()->Hide();
else {
bool wipe_tower_enabled = dynamic_cast<ConfigOptionBool*>((m_preset_bundle->prints.get_edited_preset().config).option("wipe_tower"))->value;
bool multiple_extruders = dynamic_cast<ConfigOptionFloats*>((m_preset_bundle->printers.get_edited_preset().config).option("nozzle_diameter"))->values.size() > 1; 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; bool single_extruder_mm = dynamic_cast<ConfigOptionBool*>((m_preset_bundle->printers.get_edited_preset().config).option("single_extruder_multi_material"))->value;
if (wipe_tower_enabled && multiple_extruders && single_extruder_mm) if (wipe_tower_enabled && multiple_extruders && single_extruder_mm)
get_wiping_dialog_button()->Show(); get_wiping_dialog_button()->Show();
else get_wiping_dialog_button()->Hide(); else get_wiping_dialog_button()->Hide();
}
(get_wiping_dialog_button()->GetParent())->Layout(); (get_wiping_dialog_button()->GetParent())->Layout();
} }

View File

@ -116,6 +116,9 @@ void set_show_print_info(bool show)
void set_show_manifold_warning_icon(bool show) void set_show_manifold_warning_icon(bool show)
%code%{ Slic3r::GUI::set_show_manifold_warning_icon(show); %}; %code%{ Slic3r::GUI::set_show_manifold_warning_icon(show); %};
void update_mode()
%code%{ Slic3r::GUI::update_mode(); %};
std::string fold_utf8_to_ascii(const char *src) std::string fold_utf8_to_ascii(const char *src)
%code%{ RETVAL = Slic3r::fold_utf8_to_ascii(src); %}; %code%{ RETVAL = Slic3r::fold_utf8_to_ascii(src); %};