working C++ status bar.
Signed-off-by: tamasmeszaros <meszaros.q@gmail.com>
This commit is contained in:
parent
9e2d48ff3b
commit
15ad0ef2f2
@ -166,6 +166,7 @@ sub thread_cleanup {
|
|||||||
*Slic3r::GUI::Tab::DESTROY = sub {};
|
*Slic3r::GUI::Tab::DESTROY = sub {};
|
||||||
*Slic3r::GUI::PresetHints::DESTROY = sub {};
|
*Slic3r::GUI::PresetHints::DESTROY = sub {};
|
||||||
*Slic3r::GUI::TabIface::DESTROY = sub {};
|
*Slic3r::GUI::TabIface::DESTROY = sub {};
|
||||||
|
*Slic3r::GUI::ProgressStatusBar::DESTROY= sub {};
|
||||||
*Slic3r::OctoPrint::DESTROY = sub {};
|
*Slic3r::OctoPrint::DESTROY = sub {};
|
||||||
*Slic3r::Duet::DESTROY = sub {};
|
*Slic3r::Duet::DESTROY = sub {};
|
||||||
*Slic3r::PresetUpdater::DESTROY = sub {};
|
*Slic3r::PresetUpdater::DESTROY = sub {};
|
||||||
|
@ -63,15 +63,11 @@ sub new {
|
|||||||
|
|
||||||
# initialize status bar
|
# initialize status bar
|
||||||
$self->{statusbar} = Slic3r::GUI::ProgressStatusBar->new();
|
$self->{statusbar} = Slic3r::GUI::ProgressStatusBar->new();
|
||||||
# $self->{statusbar}->SetParent($self, Wx::NewId);
|
|
||||||
$self->{statusbar}->Embed;
|
$self->{statusbar}->Embed;
|
||||||
$self->{statusbar}->SetStatusText(L("Version ").$Slic3r::VERSION.L(" - Remember to check for updates at http://github.com/prusa3d/slic3r/releases"));
|
$self->{statusbar}->SetStatusText(L("Version ").$Slic3r::VERSION.L(" - Remember to check for updates at http://github.com/prusa3d/slic3r/releases"));
|
||||||
|
|
||||||
# Make the global status bar and its progress indicator available in C++
|
# Make the global status bar and its progress indicator available in C++
|
||||||
$appController->set_global_progress_indicator(
|
$appController->set_global_progress_indicator($self->{statusbar});
|
||||||
$self->{statusbar}->GetProgId(),
|
|
||||||
$self->{statusbar}->GetId(),
|
|
||||||
);
|
|
||||||
|
|
||||||
$appController->set_model($self->{plater}->{model});
|
$appController->set_model($self->{plater}->{model});
|
||||||
$appController->set_print($self->{plater}->{print});
|
$appController->set_print($self->{plater}->{print});
|
||||||
|
@ -1569,7 +1569,9 @@ sub on_progress_event {
|
|||||||
my ($self, $percent, $message) = @_;
|
my ($self, $percent, $message) = @_;
|
||||||
|
|
||||||
$self->statusbar->SetProgress($percent);
|
$self->statusbar->SetProgress($percent);
|
||||||
$self->statusbar->SetStatusText("$message…");
|
# TODO: three dot character is not properly translated into C++
|
||||||
|
# $self->statusbar->SetStatusText("$message…");
|
||||||
|
$self->statusbar->SetStatusText("$message...");
|
||||||
}
|
}
|
||||||
|
|
||||||
# Called when the G-code export finishes, either successfully or with an error.
|
# Called when the G-code export finishes, either successfully or with an error.
|
||||||
|
@ -1,146 +1,18 @@
|
|||||||
# Status bar at the bottom of the main screen.
|
# 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;
|
package Slic3r::GUI::ProgressStatusBar;
|
||||||
use strict;
|
use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
|
|
||||||
# use Wx qw(:gauge :misc);
|
|
||||||
# use base 'Wx::StatusBar';
|
|
||||||
|
|
||||||
our $cancel_cb;
|
our $cancel_cb;
|
||||||
|
|
||||||
# sub new {
|
|
||||||
# my $class = shift;
|
|
||||||
# my $self = $class->SUPER::new(@_);
|
|
||||||
|
|
||||||
# $self->{busy} = 0;
|
|
||||||
# $self->{timer} = Wx::Timer->new($self);
|
|
||||||
# $self->{prog} = Wx::Gauge->new($self, wxGA_HORIZONTAL, 100, wxDefaultPosition, wxDefaultSize);
|
|
||||||
# $self->{prog}->Hide;
|
|
||||||
# $self->{cancelbutton} = Wx::Button->new($self, -1, "Cancel", wxDefaultPosition, wxDefaultSize);
|
|
||||||
# $self->{cancelbutton}->Hide;
|
|
||||||
|
|
||||||
# $self->SetFieldsCount(3);
|
|
||||||
# $self->SetStatusWidths(-1, 150, 155);
|
|
||||||
|
|
||||||
# Wx::Event::EVT_TIMER($self, \&OnTimer, $self->{timer});
|
|
||||||
# Wx::Event::EVT_SIZE($self, \&OnSize);
|
|
||||||
# Wx::Event::EVT_BUTTON($self, $self->{cancelbutton}, sub {
|
|
||||||
# $self->{cancel_cb}->();
|
|
||||||
# $self->{cancelbutton}->Hide;
|
|
||||||
# });
|
|
||||||
|
|
||||||
# return $self;
|
|
||||||
# }
|
|
||||||
|
|
||||||
# sub DESTROY {
|
|
||||||
# my $self = shift;
|
|
||||||
# $self->{timer}->Stop if $self->{timer} && $self->{timer}->IsRunning;
|
|
||||||
# }
|
|
||||||
|
|
||||||
# sub OnSize {
|
|
||||||
# my ($self, $event) = @_;
|
|
||||||
|
|
||||||
# my %fields = (
|
|
||||||
# # 0 is reserved for status text
|
|
||||||
# 1 => $self->{cancelbutton},
|
|
||||||
# 2 => $self->{prog},
|
|
||||||
# );
|
|
||||||
|
|
||||||
# foreach (keys %fields) {
|
|
||||||
# my $rect = $self->GetFieldRect($_);
|
|
||||||
# my $offset = &Wx::wxGTK ? 1 : 0; # add a cosmetic 1 pixel offset on wxGTK
|
|
||||||
# my $pos = [$rect->GetX + $offset, $rect->GetY + $offset];
|
|
||||||
# $fields{$_}->Move($pos);
|
|
||||||
# $fields{$_}->SetSize($rect->GetWidth - $offset, $rect->GetHeight);
|
|
||||||
# }
|
|
||||||
|
|
||||||
# $event->Skip;
|
|
||||||
# }
|
|
||||||
|
|
||||||
# sub OnTimer {
|
|
||||||
# my ($self, $event) = @_;
|
|
||||||
|
|
||||||
# if ($self->{prog}->IsShown) {
|
|
||||||
# $self->{timer}->Stop;
|
|
||||||
# }
|
|
||||||
# $self->{prog}->Pulse if $self->{_busy};
|
|
||||||
# }
|
|
||||||
|
|
||||||
sub SetCancelCallback {
|
sub SetCancelCallback {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
my ($cb) = @_;
|
my ($cb) = @_;
|
||||||
$cancel_cb = $cb;
|
$cancel_cb = $cb;
|
||||||
# $cb ? $self->{cancelbutton}->Show : $self->{cancelbutton}->Hide;
|
$cb ? $self->ShowCancelButton : $self->HideCancelButton;
|
||||||
}
|
}
|
||||||
|
|
||||||
# sub Run {
|
|
||||||
# my $self = shift;
|
|
||||||
# my $rate = shift || 100;
|
|
||||||
# if (!$self->{timer}->IsRunning) {
|
|
||||||
# $self->{timer}->Start($rate);
|
|
||||||
# }
|
|
||||||
# }
|
|
||||||
|
|
||||||
# sub GetProgress {
|
|
||||||
# my $self = shift;
|
|
||||||
# return $self->{prog}->GetValue;
|
|
||||||
# }
|
|
||||||
|
|
||||||
# sub SetProgress {
|
|
||||||
# my $self = shift;
|
|
||||||
# my ($val) = @_;
|
|
||||||
# if (!$self->{prog}->IsShown) {
|
|
||||||
# $self->ShowProgress(1);
|
|
||||||
# }
|
|
||||||
# if ($val == $self->{prog}->GetRange) {
|
|
||||||
# $self->{prog}->SetValue(0);
|
|
||||||
# $self->ShowProgress(0);
|
|
||||||
# } else {
|
|
||||||
# $self->{prog}->SetValue($val);
|
|
||||||
# }
|
|
||||||
# }
|
|
||||||
|
|
||||||
# sub SetRange {
|
|
||||||
# my $self = shift;
|
|
||||||
# my ($val) = @_;
|
|
||||||
|
|
||||||
# if ($val != $self->{prog}->GetRange) {
|
|
||||||
# $self->{prog}->SetRange($val);
|
|
||||||
# }
|
|
||||||
# }
|
|
||||||
|
|
||||||
# sub ShowProgress {
|
|
||||||
# my $self = shift;
|
|
||||||
# my ($show) = @_;
|
|
||||||
|
|
||||||
# $self->{prog}->Show($show);
|
|
||||||
# $self->{prog}->Pulse;
|
|
||||||
# }
|
|
||||||
|
|
||||||
# sub StartBusy {
|
|
||||||
# my $self = shift;
|
|
||||||
# my $rate = shift || 100;
|
|
||||||
|
|
||||||
# $self->{_busy} = 1;
|
|
||||||
# $self->ShowProgress(1);
|
|
||||||
# if (!$self->{timer}->IsRunning) {
|
|
||||||
# $self->{timer}->Start($rate);
|
|
||||||
# }
|
|
||||||
# }
|
|
||||||
|
|
||||||
# sub StopBusy {
|
|
||||||
# my $self = shift;
|
|
||||||
|
|
||||||
# $self->{timer}->Stop;
|
|
||||||
# $self->ShowProgress(0);
|
|
||||||
# $self->{prog}->SetValue(0);
|
|
||||||
# $self->{_busy} = 0;
|
|
||||||
# }
|
|
||||||
|
|
||||||
# sub IsBusy {
|
|
||||||
# my $self = shift;
|
|
||||||
# return $self->{_busy};
|
|
||||||
# }
|
|
||||||
|
|
||||||
1;
|
1;
|
||||||
|
@ -305,6 +305,10 @@ void AppController::arrange_model()
|
|||||||
// Set the range of the progress to the object count
|
// Set the range of the progress to the object count
|
||||||
pind->max(count);
|
pind->max(count);
|
||||||
|
|
||||||
|
pind->on_cancel([](){
|
||||||
|
std::cout << "Cannot be cancelled!" << std::endl;
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
auto dist = print_ctl()->config().min_object_distance();
|
auto dist = print_ctl()->config().min_object_distance();
|
||||||
@ -353,7 +357,7 @@ void AppController::arrange_model()
|
|||||||
bed,
|
bed,
|
||||||
arr::BOX,
|
arr::BOX,
|
||||||
false, // create many piles not just one pile
|
false, // create many piles not just one pile
|
||||||
[pind, count](unsigned rem) {
|
[this, pind, count](unsigned rem) {
|
||||||
if(pind)
|
if(pind)
|
||||||
pind->update(count - rem, _(L("Arranging objects...")));
|
pind->update(count - rem, _(L("Arranging objects...")));
|
||||||
});
|
});
|
||||||
@ -369,6 +373,7 @@ void AppController::arrange_model()
|
|||||||
if(pind) {
|
if(pind) {
|
||||||
pind->max(pmax);
|
pind->max(pmax);
|
||||||
pind->update(0, _(L("Arranging done.")));
|
pind->update(0, _(L("Arranging done.")));
|
||||||
|
pind->on_cancel(/*remove cancel function*/);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -15,6 +15,7 @@ class Model;
|
|||||||
class Print;
|
class Print;
|
||||||
class PrintObject;
|
class PrintObject;
|
||||||
class PrintConfig;
|
class PrintConfig;
|
||||||
|
class ProgressStatusBar;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -255,8 +256,7 @@ public:
|
|||||||
* @param gauge_id The ID of the gague widget of the status bar.
|
* @param gauge_id The ID of the gague widget of the status bar.
|
||||||
* @param statusbar_id The ID of the status bar.
|
* @param statusbar_id The ID of the status bar.
|
||||||
*/
|
*/
|
||||||
void set_global_progress_indicator(unsigned gauge_id,
|
void set_global_progress_indicator(ProgressStatusBar *prs);
|
||||||
unsigned statusbar_id);
|
|
||||||
|
|
||||||
void arrange_model();
|
void arrange_model();
|
||||||
};
|
};
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
#include <future>
|
#include <future>
|
||||||
|
|
||||||
#include <slic3r/GUI/GUI.hpp>
|
#include <slic3r/GUI/GUI.hpp>
|
||||||
|
#include <slic3r/GUI/ProgressStatusBar.hpp>
|
||||||
|
|
||||||
#include <wx/app.h>
|
#include <wx/app.h>
|
||||||
#include <wx/filedlg.h>
|
#include <wx/filedlg.h>
|
||||||
@ -210,31 +211,21 @@ AppControllerBoilerplate::create_progress_indicator(unsigned statenum,
|
|||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
// A wrapper progress indicator class around the statusbar created in perl.
|
|
||||||
class Wrapper: public ProgressIndicator, public wxEvtHandler {
|
class Wrapper: public ProgressIndicator, public wxEvtHandler {
|
||||||
wxGauge *gauge_;
|
ProgressStatusBar *sbar_;
|
||||||
wxStatusBar *stbar_;
|
|
||||||
using Base = ProgressIndicator;
|
using Base = ProgressIndicator;
|
||||||
std::string message_;
|
std::string message_;
|
||||||
AppControllerBoilerplate& ctl_;
|
AppControllerBoilerplate& ctl_;
|
||||||
|
|
||||||
void showProgress(bool show = true) {
|
void showProgress(bool show = true) {
|
||||||
gauge_->Show(show);
|
sbar_->show_progress(show);
|
||||||
}
|
}
|
||||||
|
|
||||||
void _state(unsigned st) {
|
void _state(unsigned st) {
|
||||||
if( st <= ProgressIndicator::max() ) {
|
if( st <= ProgressIndicator::max() ) {
|
||||||
Base::state(st);
|
Base::state(st);
|
||||||
|
sbar_->set_status_text(message_);
|
||||||
if(!gauge_->IsShown()) showProgress(true);
|
sbar_->set_progress(st);
|
||||||
|
|
||||||
stbar_->SetStatusText(message_);
|
|
||||||
if(static_cast<long>(st) == gauge_->GetRange()) {
|
|
||||||
gauge_->SetValue(0);
|
|
||||||
showProgress(false);
|
|
||||||
} else {
|
|
||||||
gauge_->SetValue(static_cast<int>(st));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -247,12 +238,12 @@ class Wrapper: public ProgressIndicator, public wxEvtHandler {
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
inline Wrapper(wxGauge *gauge, wxStatusBar *stbar,
|
inline Wrapper(ProgressStatusBar *sbar,
|
||||||
AppControllerBoilerplate& ctl):
|
AppControllerBoilerplate& ctl):
|
||||||
gauge_(gauge), stbar_(stbar), ctl_(ctl)
|
sbar_(sbar), ctl_(ctl)
|
||||||
{
|
{
|
||||||
Base::max(static_cast<float>(gauge->GetRange()));
|
Base::max(static_cast<float>(sbar_->get_range()));
|
||||||
Base::states(static_cast<unsigned>(gauge->GetRange()));
|
Base::states(static_cast<unsigned>(sbar_->get_range()));
|
||||||
|
|
||||||
Bind(PROGRESS_STATUS_UPDATE_EVENT,
|
Bind(PROGRESS_STATUS_UPDATE_EVENT,
|
||||||
&Wrapper::_state,
|
&Wrapper::_state,
|
||||||
@ -265,7 +256,7 @@ public:
|
|||||||
|
|
||||||
virtual void max(float val) override {
|
virtual void max(float val) override {
|
||||||
if(val > 1.0) {
|
if(val > 1.0) {
|
||||||
gauge_->SetRange(static_cast<int>(val));
|
sbar_->set_range(static_cast<int>(val));
|
||||||
ProgressIndicator::max(val);
|
ProgressIndicator::max(val);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -293,18 +284,18 @@ public:
|
|||||||
|
|
||||||
virtual void title(const string & /*title*/) override {}
|
virtual void title(const string & /*title*/) override {}
|
||||||
|
|
||||||
|
virtual void on_cancel(CancelFn fn) override {
|
||||||
|
sbar_->set_cancel_callback(fn);
|
||||||
|
Base::on_cancel(fn);
|
||||||
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
void AppController::set_global_progress_indicator(
|
void AppController::set_global_progress_indicator(ProgressStatusBar *prsb)
|
||||||
unsigned gid,
|
|
||||||
unsigned sid)
|
|
||||||
{
|
{
|
||||||
wxGauge* gauge = dynamic_cast<wxGauge*>(wxWindow::FindWindowById(gid));
|
if(prsb) {
|
||||||
wxStatusBar* sb = dynamic_cast<wxStatusBar*>(wxWindow::FindWindowById(sid));
|
global_progress_indicator(std::make_shared<Wrapper>(prsb, *this));
|
||||||
|
|
||||||
if(gauge && sb) {
|
|
||||||
global_progressind_ = std::make_shared<Wrapper>(gauge, sb, *this);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -30,7 +30,6 @@ ProgressStatusBar::ProgressStatusBar(wxWindow *parent, int id):
|
|||||||
prog_->Hide();
|
prog_->Hide();
|
||||||
cancelbutton_->Hide();
|
cancelbutton_->Hide();
|
||||||
|
|
||||||
|
|
||||||
self->SetFieldsCount(3);
|
self->SetFieldsCount(3);
|
||||||
int w[] = {-1, 150, 155};
|
int w[] = {-1, 150, 155};
|
||||||
self->SetStatusWidths(3, w);
|
self->SetStatusWidths(3, w);
|
||||||
@ -60,11 +59,6 @@ ProgressStatusBar::ProgressStatusBar(wxWindow *parent, int id):
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
//ProgressStatusBar::ProgressStatusBar(): ProgressStatusBar(nullptr, wxID_ANY)
|
|
||||||
//{
|
|
||||||
|
|
||||||
//}
|
|
||||||
|
|
||||||
ProgressStatusBar::~ProgressStatusBar() {
|
ProgressStatusBar::~ProgressStatusBar() {
|
||||||
if(timer_->IsRunning()) timer_->Stop();
|
if(timer_->IsRunning()) timer_->Stop();
|
||||||
}
|
}
|
||||||
@ -86,6 +80,11 @@ void ProgressStatusBar::set_progress(int val)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int ProgressStatusBar::get_range() const
|
||||||
|
{
|
||||||
|
return prog_->GetRange();
|
||||||
|
}
|
||||||
|
|
||||||
void ProgressStatusBar::set_range(int val)
|
void ProgressStatusBar::set_range(int val)
|
||||||
{
|
{
|
||||||
if(val != prog_->GetRange()) {
|
if(val != prog_->GetRange()) {
|
||||||
@ -129,28 +128,25 @@ void ProgressStatusBar::run(int rate)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProgressStatusBar::Embed()
|
void ProgressStatusBar::embed(wxFrame *frame)
|
||||||
{
|
{
|
||||||
std::cout << "Embedding" << std::endl;
|
wxFrame* mf = frame? frame : GUI::get_main_frame();
|
||||||
wxFrame* mf = GUI::get_main_frame();
|
|
||||||
std::cout << mf->GetName() << std::endl;
|
|
||||||
std::cout << self->GetName() << std::endl;
|
|
||||||
mf->SetStatusBar(self);
|
mf->SetStatusBar(self);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProgressStatusBar::SetStatusText(std::string txt)
|
void ProgressStatusBar::set_status_text(const std::string& txt)
|
||||||
{
|
{
|
||||||
self->SetStatusText(txt);
|
self->SetStatusText(txt);
|
||||||
}
|
}
|
||||||
|
|
||||||
int ProgressStatusBar::GetId()
|
void ProgressStatusBar::show_cancel_button()
|
||||||
{
|
{
|
||||||
return self->GetId();
|
cancelbutton_->Show();
|
||||||
}
|
}
|
||||||
|
|
||||||
int ProgressStatusBar::GetProgId()
|
void ProgressStatusBar::hide_cancel_button()
|
||||||
{
|
{
|
||||||
return prog_->GetId();
|
cancelbutton_->Hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -10,6 +10,7 @@ class wxButton;
|
|||||||
class wxTimerEvent;
|
class wxTimerEvent;
|
||||||
class wxStatusBar;
|
class wxStatusBar;
|
||||||
class wxWindow;
|
class wxWindow;
|
||||||
|
class wxFrame;
|
||||||
|
|
||||||
namespace Slic3r {
|
namespace Slic3r {
|
||||||
|
|
||||||
@ -33,19 +34,21 @@ public:
|
|||||||
|
|
||||||
int get_progress() const;
|
int get_progress() const;
|
||||||
void set_progress(int);
|
void set_progress(int);
|
||||||
|
int get_range() const;
|
||||||
void set_range(int = 100);
|
void set_range(int = 100);
|
||||||
void show_progress(bool);
|
void show_progress(bool);
|
||||||
void start_busy(int = 100);
|
void start_busy(int = 100);
|
||||||
void stop_busy();
|
void stop_busy();
|
||||||
inline bool is_busy() const { return busy_; }
|
inline bool is_busy() const { return busy_; }
|
||||||
void set_cancel_callback(CancelFn);
|
void set_cancel_callback(CancelFn = CancelFn());
|
||||||
|
inline void remove_cancel_callback() { set_cancel_callback(); }
|
||||||
void run(int rate);
|
void run(int rate);
|
||||||
|
void embed(wxFrame *frame = nullptr);
|
||||||
|
void set_status_text(const std::string& txt);
|
||||||
|
|
||||||
// Temporary methods to satisfy Perl side
|
// Temporary methods to satisfy Perl side
|
||||||
void Embed();
|
void show_cancel_button();
|
||||||
void SetStatusText(std::string txt);
|
void hide_cancel_button();
|
||||||
int GetId();
|
|
||||||
int GetProgId();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool busy_ = false;
|
bool busy_ = false;
|
||||||
|
@ -12,7 +12,7 @@ namespace Slic3r {
|
|||||||
*/
|
*/
|
||||||
class ProgressIndicator {
|
class ProgressIndicator {
|
||||||
public:
|
public:
|
||||||
using CancelFn = std::function<void(void)>; // Cancel functio signature.
|
using CancelFn = std::function<void(void)>; // Cancel function signature.
|
||||||
|
|
||||||
private:
|
private:
|
||||||
float state_ = .0f, max_ = 1.f, step_;
|
float state_ = .0f, max_ = 1.f, step_;
|
||||||
@ -28,14 +28,14 @@ public:
|
|||||||
/// Get the current progress state
|
/// Get the current progress state
|
||||||
float state() const { return state_; }
|
float state() const { return state_; }
|
||||||
|
|
||||||
/// Set the maximum of hte progress range
|
/// Set the maximum of the progress range
|
||||||
virtual void max(float maxval) { max_ = maxval; }
|
virtual void max(float maxval) { max_ = maxval; }
|
||||||
|
|
||||||
/// Set the current state of the progress.
|
/// Set the current state of the progress.
|
||||||
virtual void state(float val) { state_ = val; }
|
virtual void state(float val) { state_ = val; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Number of states int the progress. Can be used insted of giving a
|
* @brief Number of states int the progress. Can be used instead of giving a
|
||||||
* maximum value.
|
* maximum value.
|
||||||
*/
|
*/
|
||||||
virtual void states(unsigned statenum) {
|
virtual void states(unsigned statenum) {
|
||||||
@ -45,14 +45,14 @@ public:
|
|||||||
/// Message shown on the next status update.
|
/// Message shown on the next status update.
|
||||||
virtual void message(const string&) = 0;
|
virtual void message(const string&) = 0;
|
||||||
|
|
||||||
/// Title of the operaton.
|
/// Title of the operation.
|
||||||
virtual void title(const string&) = 0;
|
virtual void title(const string&) = 0;
|
||||||
|
|
||||||
/// Formatted message for the next status update. Works just like sprinf.
|
/// Formatted message for the next status update. Works just like sprintf.
|
||||||
virtual void message_fmt(const string& fmt, ...);
|
virtual void message_fmt(const string& fmt, ...);
|
||||||
|
|
||||||
/// Set up a cancel callback for the operation if feasible.
|
/// Set up a cancel callback for the operation if feasible.
|
||||||
inline void on_cancel(CancelFn func) { cancelfunc_ = func; }
|
virtual void on_cancel(CancelFn func = CancelFn()) { cancelfunc_ = func; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Explicitly shut down the progress indicator and call the associated
|
* Explicitly shut down the progress indicator and call the associated
|
||||||
@ -60,7 +60,7 @@ public:
|
|||||||
*/
|
*/
|
||||||
virtual void cancel() { cancelfunc_(); }
|
virtual void cancel() { cancelfunc_(); }
|
||||||
|
|
||||||
/// Convinience function to call message and status update in one function.
|
/// Convenience function to call message and status update in one function.
|
||||||
void update(float st, const string& msg) {
|
void update(float st, const string& msg) {
|
||||||
message(msg); state(st);
|
message(msg); state(st);
|
||||||
}
|
}
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
#include "slic3r/AppController.hpp"
|
#include "slic3r/AppController.hpp"
|
||||||
#include "libslic3r/Model.hpp"
|
#include "libslic3r/Model.hpp"
|
||||||
#include "libslic3r/Print.hpp"
|
#include "libslic3r/Print.hpp"
|
||||||
|
#include "slic3r/GUI/ProgressStatusBar.hpp"
|
||||||
%}
|
%}
|
||||||
|
|
||||||
%name{Slic3r::PrintController} class PrintController {
|
%name{Slic3r::PrintController} class PrintController {
|
||||||
@ -21,7 +22,7 @@
|
|||||||
PrintController *print_ctl();
|
PrintController *print_ctl();
|
||||||
void set_model(Model *model);
|
void set_model(Model *model);
|
||||||
void set_print(Print *print);
|
void set_print(Print *print);
|
||||||
void set_global_progress_indicator(unsigned gauge_id, unsigned statusbar_id);
|
void set_global_progress_indicator(ProgressStatusBar *prs);
|
||||||
|
|
||||||
void arrange_model();
|
void arrange_model();
|
||||||
};
|
};
|
@ -33,9 +33,16 @@
|
|||||||
void Run(int rate)
|
void Run(int rate)
|
||||||
%code%{ THIS->run(rate); %};
|
%code%{ THIS->run(rate); %};
|
||||||
|
|
||||||
void Embed();
|
void Embed()
|
||||||
void SetStatusText(std::string txt);
|
%code%{ THIS->embed(); %};
|
||||||
int GetId();
|
|
||||||
int GetProgId();
|
void SetStatusText(std::string txt)
|
||||||
|
%code%{ THIS->set_status_text(txt); %};
|
||||||
|
|
||||||
|
void ShowCancelButton()
|
||||||
|
%code%{ THIS->show_cancel_button(); %};
|
||||||
|
|
||||||
|
void HideCancelButton()
|
||||||
|
%code%{ THIS->hide_cancel_button(); %};
|
||||||
|
|
||||||
};
|
};
|
Loading…
Reference in New Issue
Block a user