Finished porting of the status bar to C++.
This commit is contained in:
parent
36faa090fc
commit
2c9dc4dbbf
@ -10,7 +10,6 @@ use Slic3r::GUI::MainFrame;
|
||||
use Slic3r::GUI::Plater;
|
||||
use Slic3r::GUI::Plater::3D;
|
||||
use Slic3r::GUI::Plater::3DPreview;
|
||||
use Slic3r::GUI::ProgressStatusBar;
|
||||
|
||||
use Wx::Locale gettext => 'L';
|
||||
|
||||
|
@ -114,6 +114,7 @@ sub new {
|
||||
# Save the slic3r.ini. Usually the ini file is saved from "on idle" callback,
|
||||
# but in rare cases it may not have been called yet.
|
||||
wxTheApp->{app_config}->save;
|
||||
$self->{statusbar}->ResetCancelCallback();
|
||||
$self->{plater}->{print} = undef if($self->{plater});
|
||||
Slic3r::GUI::_3DScene::remove_all_canvases();
|
||||
Slic3r::GUI::deregister_on_request_update_callback();
|
||||
|
@ -1534,7 +1534,7 @@ sub on_process_completed {
|
||||
# At this point of time the thread should be either finished or canceled,
|
||||
# so the following call just confirms, that the produced data were consumed.
|
||||
$self->{background_slicing_process}->stop;
|
||||
$self->statusbar->SetCancelCallback(undef);
|
||||
$self->statusbar->ResetCancelCallback();
|
||||
$self->statusbar->StopBusy;
|
||||
$self->statusbar->SetStatusText("");
|
||||
|
||||
|
@ -1,18 +0,0 @@
|
||||
# Status bar at the bottom of the main screen.
|
||||
# Now it just implements cancel cb on perl side, every other functionality is
|
||||
# in C++
|
||||
|
||||
package Slic3r::GUI::ProgressStatusBar;
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
our $cancel_cb;
|
||||
|
||||
sub SetCancelCallback {
|
||||
my $self = shift;
|
||||
my ($cb) = @_;
|
||||
$cancel_cb = $cb;
|
||||
$cb ? $self->ShowCancelButton : $self->HideCancelButton;
|
||||
}
|
||||
|
||||
1;
|
@ -54,6 +54,7 @@ ProgressStatusBar::ProgressStatusBar(wxWindow *parent, int id):
|
||||
|
||||
cancelbutton_->Bind(wxEVT_BUTTON, [this](const wxCommandEvent&) {
|
||||
if(cancel_cb_) cancel_cb_();
|
||||
m_perl_cancel_callback.call();
|
||||
cancelbutton_->Hide();
|
||||
});
|
||||
}
|
||||
|
@ -4,6 +4,8 @@
|
||||
#include <memory>
|
||||
#include <functional>
|
||||
|
||||
#include "../../libslic3r/Utils.hpp"
|
||||
|
||||
class wxTimer;
|
||||
class wxGauge;
|
||||
class wxButton;
|
||||
@ -50,6 +52,7 @@ public:
|
||||
void show_cancel_button();
|
||||
void hide_cancel_button();
|
||||
|
||||
PerlCallback m_perl_cancel_callback;
|
||||
private:
|
||||
bool busy_ = false;
|
||||
CancelFn cancel_cb_;
|
||||
|
@ -39,10 +39,9 @@
|
||||
void SetStatusText(const char *txt)
|
||||
%code%{ THIS->set_status_text(txt); %};
|
||||
|
||||
void ShowCancelButton()
|
||||
%code%{ THIS->show_cancel_button(); %};
|
||||
|
||||
void HideCancelButton()
|
||||
%code%{ THIS->hide_cancel_button(); %};
|
||||
void SetCancelCallback(SV* callback)
|
||||
%code%{ THIS->m_perl_cancel_callback.register_callback(callback); THIS->show_cancel_button();%};
|
||||
void ResetCancelCallback()
|
||||
%code%{ THIS->m_perl_cancel_callback.deregister_callback(); THIS->hide_cancel_button(); %};
|
||||
|
||||
};
|
Loading…
Reference in New Issue
Block a user