Show/hide warning icon according to the view mode

This commit is contained in:
YuSanka 2018-05-18 11:39:49 +02:00
parent 4e47f4973c
commit 876cf9aa8b
4 changed files with 47 additions and 13 deletions

View file

@ -442,7 +442,16 @@ sub new {
$self->{"object_info_$field"}->SetFont($Slic3r::GUI::small_font);
if ($field eq 'manifold') {
$self->{object_info_manifold_warning_icon} = Wx::StaticBitmap->new($scrolled_window_panel, -1, Wx::Bitmap->new(Slic3r::var("error.png"), wxBITMAP_TYPE_PNG));
$self->{object_info_manifold_warning_icon}->Hide;
#$self->{object_info_manifold_warning_icon}->Hide;
$self->{"object_info_manifold_warning_icon_show"} = sub {
if ($self->{object_info_manifold_warning_icon}->IsShown() != $_[0]) {
Slic3r::GUI::set_show_manifold_warning_icon($_[0]);
return if (wxTheApp->{app_config}->get("view_mode") eq "simple");
$self->{object_info_manifold_warning_icon}->Show($_[0]);
$self->Layout
}
};
$self->{"object_info_manifold_warning_icon_show"}->(0);
my $h_sizer = Wx::BoxSizer->new(wxHORIZONTAL);
$h_sizer->Add($self->{object_info_manifold_warning_icon}, 0);
@ -511,10 +520,7 @@ sub new {
# }
if ($scrolled_window_sizer->IsShown(2) != $_[0]) {
Slic3r::GUI::set_show_print_info($_[0]);
my $mode = wxTheApp->{app_config}->get("view_mode");
printf $mode."\n";
return if ($mode eq "simple");
print "non-simple\n";
return if (wxTheApp->{app_config}->get("view_mode") eq "simple");
$scrolled_window_sizer->Show(2, $_[0]);
$scrolled_window_panel->Layout
}
@ -542,7 +548,8 @@ sub new {
$self->{btn_export_stl},
$self->{btn_reslice},
$self->{btn_print},
$self->{btn_send_gcode} );
$self->{btn_send_gcode},
$self->{object_info_manifold_warning_icon} );
}
# Last correct selected item for each preset
@ -881,6 +888,9 @@ sub remove {
$self->select_object(undef);
$self->update;
$self->schedule_background_process;
# Hide the slicing results if the current slicing status is no more valid.
$self->{"print_info_box_show"}->(0);
}
sub reset {
@ -900,6 +910,9 @@ sub reset {
$self->select_object(undef);
$self->update;
# Hide the slicing results if the current slicing status is no more valid.
$self->{"print_info_box_show"}->(0);
}
sub increase {
@ -2017,7 +2030,8 @@ sub selection_changed {
$self->{object_info_facets}->SetLabel(sprintf(L('%d (%d shells)'), $model_object->facets_count, $stats->{number_of_parts}));
if (my $errors = sum(@$stats{qw(degenerate_facets edges_fixed facets_removed facets_added facets_reversed backwards_edges)})) {
$self->{object_info_manifold}->SetLabel(sprintf(L("Auto-repaired (%d errors)"), $errors));
$self->{object_info_manifold_warning_icon}->Show;
#$self->{object_info_manifold_warning_icon}->Show;
$self->{"object_info_manifold_warning_icon_show"}->(1);
# we don't show normals_fixed because we never provide normals
# to admesh, so it generates normals for all facets
@ -2027,14 +2041,16 @@ sub selection_changed {
$self->{object_info_manifold_warning_icon}->SetToolTipString($message);
} else {
$self->{object_info_manifold}->SetLabel(L("Yes"));
$self->{object_info_manifold_warning_icon}->Hide;
#$self->{object_info_manifold_warning_icon}->Hide;
$self->{"object_info_manifold_warning_icon_show"}->(0);
}
} else {
$self->{object_info_facets}->SetLabel($object->facets);
}
} else {
$self->{"object_info_$_"}->SetLabel("") for qw(size volume facets materials manifold);
$self->{object_info_manifold_warning_icon}->Hide;
#$self->{object_info_manifold_warning_icon}->Hide;
$self->{"object_info_manifold_warning_icon_show"}->(0);
$self->{object_info_manifold}->SetToolTipString("");
}
$self->Layout;

View file

@ -210,7 +210,9 @@ wxButton *g_btn_export_stl = nullptr;
wxButton *g_btn_reslice = nullptr;
wxButton *g_btn_print = nullptr;
wxButton *g_btn_send_gcode = nullptr;
wxStaticBitmap *g_manifold_warning_icon = nullptr;
bool g_show_print_info = false;
bool g_show_manifold_warning_icon = false;
static void init_label_colours()
{
@ -274,7 +276,8 @@ void set_preset_updater(PresetUpdater *updater)
void set_objects_from_perl( wxWindow* parent, wxBoxSizer *frequently_changed_parameters_sizer,
wxBoxSizer *expert_mode_part_sizer, wxBoxSizer *scrolled_window_sizer,
wxButton *btn_export_stl, wxButton *btn_reslice,
wxButton *btn_print, wxButton *btn_send_gcode)
wxButton *btn_print, wxButton *btn_send_gcode,
wxStaticBitmap *manifold_warning_icon)
{
g_plater = parent;
g_frequently_changed_parameters_sizer = frequently_changed_parameters_sizer;
@ -284,6 +287,7 @@ void set_objects_from_perl( wxWindow* parent, wxBoxSizer *frequently_changed_par
g_btn_reslice = btn_reslice;
g_btn_print = btn_print;
g_btn_send_gcode = btn_send_gcode;
g_manifold_warning_icon = manifold_warning_icon;
}
void set_show_print_info(bool show)
@ -291,6 +295,11 @@ void set_show_print_info(bool show)
g_show_print_info = show;
}
void set_show_manifold_warning_icon(bool show)
{
g_show_manifold_warning_icon = show;
}
std::vector<Tab *>& get_tabs_list()
{
return g_tabs_list;
@ -1122,6 +1131,7 @@ void show_scrolled_window_sizer(bool show)
g_scrolled_window_sizer->Show(static_cast<size_t>(0), show);
g_scrolled_window_sizer->Show(1, show);
g_scrolled_window_sizer->Show(2, show && g_show_print_info);
g_manifold_warning_icon->Show(show && g_show_manifold_warning_icon);
}
void update_mode()

View file

@ -20,6 +20,7 @@ class wxBoxSizer;
class wxFlexGridSizer;
class wxButton;
class wxFileDialog;
class wxStaticBitmap;
namespace Slic3r {
@ -86,8 +87,10 @@ void set_objects_from_perl( wxWindow* parent,
wxButton *btn_export_stl,
wxButton *btn_reslice,
wxButton *btn_print,
wxButton *btn_send_gcode);
wxButton *btn_send_gcode,
wxStaticBitmap *manifold_warning_icon);
void set_show_print_info(bool show);
void set_show_manifold_warning_icon(bool show);
AppConfig* get_app_config();
wxApp* get_app();

View file

@ -97,7 +97,8 @@ void set_objects_from_perl( SV *ui_parent,
SV *btn_export_stl,
SV *btn_reslice,
SV *btn_print,
SV *btn_send_gcode)
SV *btn_send_gcode,
SV *manifold_warning_icon)
%code%{ Slic3r::GUI::set_objects_from_perl(
(wxWindow *)wxPli_sv_2_object(aTHX_ ui_parent, "Wx::Window"),
(wxBoxSizer *)wxPli_sv_2_object(aTHX_ frequently_changed_parameters_sizer, "Wx::BoxSizer"),
@ -106,11 +107,15 @@ void set_objects_from_perl( SV *ui_parent,
(wxButton *)wxPli_sv_2_object(aTHX_ btn_export_stl, "Wx::Button"),
(wxButton *)wxPli_sv_2_object(aTHX_ btn_reslice, "Wx::Button"),
(wxButton *)wxPli_sv_2_object(aTHX_ btn_print, "Wx::Button"),
(wxButton *)wxPli_sv_2_object(aTHX_ btn_send_gcode, "Wx::Button")); %};
(wxButton *)wxPli_sv_2_object(aTHX_ btn_send_gcode, "Wx::Button"),
(wxStaticBitmap *)wxPli_sv_2_object(aTHX_ manifold_warning_icon, "Wx::StaticBitmap")); %};
void set_show_print_info(bool show)
%code%{ Slic3r::GUI::set_show_print_info(show); %};
void set_show_manifold_warning_icon(bool show)
%code%{ Slic3r::GUI::set_show_manifold_warning_icon(show); %};
std::string fold_utf8_to_ascii(const char *src)
%code%{ RETVAL = Slic3r::fold_utf8_to_ascii(src); %};