OrcaSlicer latest
OrcaSlicer
Loading...
Searching...
No Matches
Slic3r::GUI::CalibrationWizard Class Reference

#include </home/runner/work/OrcaSlicer/OrcaSlicer/src/slic3r/GUI/CalibrationWizard.hpp>

Inheritance diagram for Slic3r::GUI::CalibrationWizard:
Collaboration diagram for Slic3r::GUI::CalibrationWizard:

Public Member Functions

 CalibrationWizard (wxWindow *parent, CalibMode mode, wxWindowID id=wxID_ANY, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxTAB_TRAVERSAL)
 ~CalibrationWizard ()
void on_cali_job_finished (wxCommandEvent &event)
virtual void on_cali_job_finished (wxString evt_data)
CalibrationWizardPageStep * get_curr_step ()
void show_step (CalibrationWizardPageStep *step)
virtual void update (MachineObject *obj)
virtual void on_device_connected (MachineObject *obj)
virtual void set_cali_style (CalibrationStyle style)
virtual void set_cali_method (CalibrationMethod method)
CalibMode get_calibration_mode ()
bool save_preset (const std::string &old_preset_name, const std::string &new_preset_name, const std::map< std::string, ConfigOption * > &key_values, wxString &message)
bool save_preset_with_index (const std::string &old_preset_name, const std::string &new_preset_name, const std::map< std::string, ConfigIndexValue > &key_values, wxString &message)
virtual void cache_preset_info (MachineObject *obj, float nozzle_dia, BedType bed_type)
virtual void recover_preset_info (MachineObject *obj)
virtual void back_preset_info (MachineObject *obj, bool cali_finish, bool back_cali_flag=true)
void msw_rescale ()
void on_sys_color_changed ()
bool built () const
bool build_step ()

Protected Member Functions

void on_cali_go_home ()
void add_page_step (CalibrationWizardPageStep *&step, std::function< CalibrationWizardPage *()> make)
void add_build_step (std::function< void()> step)
void add_build_steps_of (StagedBuild &child)

Protected Attributes

wxScrolledWindow * m_scrolledWindow
wxBoxSizer * m_all_pages_sizer
CalibMode m_mode
CalibrationStyle m_cali_style
CalibrationMethod m_cali_method { CalibrationMethod::CALI_METHOD_MANUAL }
MachineObject * curr_obj { nullptr }
MachineObject * last_obj { nullptr }
CalibrationWizardPageStep * m_curr_step { nullptr }
CalibrationWizardPageStep * start_step { nullptr }
CalibrationWizardPageStep * preset_step { nullptr }
CalibrationWizardPageStep * cali_step { nullptr }
CalibrationWizardPageStep * save_step { nullptr }
CalibrationWizardPageStep * cali_coarse_step { nullptr }
CalibrationWizardPageStep * coarse_save_step { nullptr }
CalibrationWizardPageStep * cali_fine_step { nullptr }
CalibrationWizardPageStep * fine_save_step { nullptr }
std::vector< CalibrationWizardPageStep * > m_page_steps
SecondaryCheckDialog * go_home_dialog = nullptr

Private Member Functions

StagedBuild * unfinished_child () const

Private Attributes

std::vector< std::function< void()> > m_steps
std::vector< StagedBuild * > m_children
size_t m_next_step { 0 }

Detailed Description

Constructor & Destructor Documentation

◆ CalibrationWizard()

Slic3r::GUI::CalibrationWizard::CalibrationWizard ( wxWindow * parent,
CalibMode mode,
wxWindowID id = wxID_ANY,
const wxPoint & pos = wxDefaultPosition,
const wxSize & size = wxDefaultSize,
long style = wxTAB_TRAVERSAL )
105 : wxPanel(parent, id, pos, size, style)
106 , m_mode(mode)
107{
108 SetBackgroundColour(wxColour(0xEEEEEE));
109
110 wxBoxSizer* main_sizer = new wxBoxSizer(wxVERTICAL);
111
112 m_scrolledWindow = new wxScrolledWindow(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHSCROLL | wxVSCROLL);
113 m_scrolledWindow->SetScrollRate(5, FromDIP(20));
114 m_scrolledWindow->SetBackgroundColour(*wxWHITE);
115
116 wxBoxSizer* padding_sizer = new wxBoxSizer(wxHORIZONTAL);
117 padding_sizer->Add(0, 0, 1);
118
119 m_all_pages_sizer = new wxBoxSizer(wxVERTICAL);
120 padding_sizer->Add(m_all_pages_sizer, 0);
121
122 padding_sizer->Add(0, 0, 1);
123
124 m_scrolledWindow->SetSizer(padding_sizer);
125
126 main_sizer->Add(m_scrolledWindow, 1, wxEXPAND | wxALL, FromDIP(10));
127
128 this->SetSizer(main_sizer);
129 this->Layout();
130 main_sizer->Fit(this);
131
132 Bind(EVT_CALIBRATION_JOB_FINISHED, &CalibrationWizard::on_cali_job_finished, this);
133
134#if !BBL_RELEASE_TO_PUBLIC
135 this->Bind(wxEVT_CHAR_HOOK, [this](auto& evt) {
136 const int keyCode = evt.GetKeyCode();
137 switch (keyCode)
138 {
139 case WXK_PAGEUP:
140 {
141 show_step(m_curr_step->prev);
142 break;
143 }
144 case WXK_PAGEDOWN:
145 {
146 show_step(m_curr_step->next);
147 break;
148 }
149 default:
150 evt.Skip();
151 break;
152 }
153 });
154#endif
155}
#define style
Definition WipeTowerDialog.cpp:101
CalibrationWizardPageStep * m_curr_step
Definition CalibrationWizard.hpp:111
CalibMode m_mode
Definition CalibrationWizard.hpp:105
void on_cali_job_finished(wxCommandEvent &event)
Definition CalibrationWizard.cpp:171
wxBoxSizer * m_all_pages_sizer
Definition CalibrationWizard.hpp:103
wxScrolledWindow * m_scrolledWindow
Definition CalibrationWizard.hpp:102
void show_step(CalibrationWizardPageStep *step)
Definition CalibrationWizard.cpp:177

References m_all_pages_sizer, m_curr_step, m_mode, m_scrolledWindow, on_cali_job_finished(), show_step(), and style.

Referenced by Slic3r::GUI::FlowRateWizard::FlowRateWizard(), Slic3r::GUI::MaxVolumetricSpeedWizard::MaxVolumetricSpeedWizard(), and Slic3r::GUI::PressureAdvanceWizard::PressureAdvanceWizard().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ~CalibrationWizard()

Slic3r::GUI::CalibrationWizard::~CalibrationWizard ( )
158{
159 ;
160}

Member Function Documentation

◆ add_build_step()

void Slic3r::GUI::StagedBuild::add_build_step ( std::function< void()> step)
inlineprotectedinherited
39{ m_steps.push_back(std::move(step)); }
std::vector< std::function< void()> > m_steps
Definition StagedBuild.hpp:57

References m_steps.

Referenced by Slic3r::GUI::StatusBasePanel::StatusBasePanel(), Slic3r::GUI::StatusPanel::StatusPanel(), add_build_steps_of(), Slic3r::GUI::CalibrationWizard::add_page_step(), Slic3r::GUI::StatusBasePanel::create_machine_control_page(), Slic3r::GUI::FlowRateWizard::create_pages(), Slic3r::GUI::PressureAdvanceWizard::create_pages(), Slic3r::GUI::AuxiliaryPanel::init_tabpanel(), and Slic3r::GUI::MonitorPanel::init_tabpanel().

Here is the caller graph for this function:

◆ add_build_steps_of()

void Slic3r::GUI::StagedBuild::add_build_steps_of ( StagedBuild & child)
inlineprotectedinherited
44 {
45 m_children.push_back(&child);
46 for (size_t i = child.m_next_step; i < child.m_steps.size(); ++i)
47 add_build_step([&child] { child.build_step(); });
48 }
std::vector< StagedBuild * > m_children
Definition StagedBuild.hpp:58
void add_build_step(std::function< void()> step)
Definition StagedBuild.hpp:39

References add_build_step(), build_step(), m_children, m_next_step, and m_steps.

Referenced by Slic3r::GUI::ProjectPanel::ProjectPanel(), Slic3r::GUI::CalibrationPanel::init_tabpanel(), and Slic3r::GUI::MonitorPanel::init_tabpanel().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ add_page_step()

void Slic3r::GUI::CalibrationWizard::add_page_step ( CalibrationWizardPageStep *& step,
std::function< CalibrationWizardPage *()> make )
protected
163{
164 add_build_step([this, &step, make = std::move(make)] {
165 step = new CalibrationWizardPageStep(make());
166 m_all_pages_sizer->Add(step->page, 1, wxEXPAND | wxALL, FromDIP(25));
167 step->page->Hide();
168 });
169}
void step(Coord &crd, const Dir d, const long n=1)
Definition MarchingSquares.hpp:213

References Slic3r::GUI::StagedBuild::add_build_step(), and m_all_pages_sizer.

Referenced by Slic3r::GUI::FlowRateWizard::create_pages(), and Slic3r::GUI::PressureAdvanceWizard::create_pages().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ back_preset_info()

void Slic3r::GUI::CalibrationWizard::back_preset_info ( MachineObject * obj,
bool cali_finish,
bool back_cali_flag = true )
virtual
470{
471 if (!obj)
472 return;
473
474 PrinterCaliInfo printer_cali_info;
475 printer_cali_info.dev_id = obj->get_dev_id();
476 printer_cali_info.cali_finished = cali_finish;
477 printer_cali_info.cache_flow_ratio = obj->cache_flow_ratio;
478 printer_cali_info.selected_presets = obj->selected_cali_preset;
479 printer_cali_info.cache_flow_rate_calibration_type = obj->flow_ratio_calibration_type;
480 wxGetApp().app_config->save_printer_cali_infos(printer_cali_info, back_cali_flag);
481}

References Slic3r::PrinterCaliInfo::cache_flow_rate_calibration_type, Slic3r::MachineObject::cache_flow_ratio, Slic3r::PrinterCaliInfo::cache_flow_ratio, Slic3r::PrinterCaliInfo::cali_finished, Slic3r::PrinterCaliInfo::dev_id, Slic3r::MachineObject::flow_ratio_calibration_type, Slic3r::MachineObject::get_dev_id(), Slic3r::MachineObject::selected_cali_preset, and Slic3r::PrinterCaliInfo::selected_presets.

Referenced by Slic3r::GUI::FlowRateWizard::cache_coarse_info(), cache_preset_info(), on_cali_go_home(), Slic3r::GUI::FlowRateWizard::on_cali_save(), Slic3r::GUI::MaxVolumetricSpeedWizard::on_cali_save(), and Slic3r::GUI::PressureAdvanceWizard::on_cali_save().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ build_step()

bool Slic3r::GUI::StagedBuild::build_step ( )
inlineinherited
27 {
28 if (m_next_step < m_steps.size()) {
29 // Copied out, since a step may queue more steps and reallocate m_steps.
30 auto step = std::move(m_steps[m_next_step++]);
31 step();
32 } else if (StagedBuild* child = unfinished_child()) {
33 child->build_step();
34 }
35 return !built();
36 }
size_t m_next_step
Definition StagedBuild.hpp:59
StagedBuild * unfinished_child() const
Definition StagedBuild.hpp:51
bool built() const
Definition StagedBuild.hpp:18

References built(), m_next_step, m_steps, and unfinished_child().

Referenced by add_build_steps_of().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ built()

bool Slic3r::GUI::StagedBuild::built ( ) const
inlineinherited
19 {
20 return m_next_step == m_steps.size() &&
21 std::all_of(m_children.begin(), m_children.end(), [](const StagedBuild* child) { return child->built(); });
22 }

References m_children, m_next_step, and m_steps.

Referenced by Slic3r::GUI::StatusPanel::~StatusPanel(), build_step(), Slic3r::GUI::CalibrationPanel::show_status(), Slic3r::GUI::MonitorPanel::show_status(), Slic3r::GUI::CalibrationPanel::update_all(), and Slic3r::GUI::MonitorPanel::update_all().

Here is the caller graph for this function:

◆ cache_preset_info()

void Slic3r::GUI::CalibrationWizard::cache_preset_info ( MachineObject * obj,
float nozzle_dia,
BedType bed_type )
virtual
418{
419 if (!obj) return;
420
421 CalibrationPresetPage* preset_page = (static_cast<CalibrationPresetPage*>(preset_step->page));
422
423 std::map<int, Preset*> selected_filaments = preset_page->get_selected_filaments();
424
425 obj->selected_cali_preset.clear();
426 for (auto& item : selected_filaments) {
427 CaliPresetInfo result;
428 result.tray_id = item.first;
429 result.nozzle_diameter = nozzle_dia;
430 result.bed_type = bed_type;
431 result.filament_id = item.second->filament_id;
432 result.setting_id = item.second->setting_id;
433 result.name = item.second->name;
434
435 if (obj->is_multi_extruders()) {
436 int ams_id, slot_id, tray_id;
437 get_tray_ams_and_slot_id(curr_obj, result.tray_id, ams_id, slot_id, tray_id);
438 result.extruder_id = preset_page->get_extruder_id_by_tray_id(result.tray_id);
439 result.nozzle_diameter = preset_page->get_nozzle_diameter(result.extruder_id);
440 }
441 else {
442 result.extruder_id = 0;
443 }
444 result.nozzle_volume_type = preset_page->get_nozzle_volume_type(result.extruder_id);
445
446 obj->selected_cali_preset.push_back(result);
447 }
448
449 CaliPresetStage stage;
450 preset_page->get_cali_stage(stage, obj->cache_flow_ratio);
451
452 back_preset_info(obj, false);
453}
virtual void back_preset_info(MachineObject *obj, bool cali_finish, bool back_cali_flag=true)
Definition CalibrationWizard.cpp:469
MachineObject * curr_obj
Definition CalibrationWizard.hpp:108
CalibrationWizardPageStep * preset_step
Definition CalibrationWizard.hpp:114
void get_tray_ams_and_slot_id(MachineObject *obj, int in_tray_id, int &ams_id, int &slot_id, int &tray_id)
Definition CalibUtils.cpp:231
CaliPresetStage
Definition CalibrationWizardPresetPage.hpp:32

References back_preset_info(), Slic3r::CaliPresetInfo::bed_type, Slic3r::MachineObject::cache_flow_ratio, curr_obj, Slic3r::CaliPresetInfo::extruder_id, Slic3r::CaliPresetInfo::filament_id, Slic3r::GUI::CalibrationPresetPage::get_cali_stage(), Slic3r::GUI::CalibrationPresetPage::get_extruder_id_by_tray_id(), Slic3r::GUI::CalibrationPresetPage::get_nozzle_diameter(), Slic3r::GUI::CalibrationPresetPage::get_nozzle_volume_type(), Slic3r::GUI::CalibrationPresetPage::get_selected_filaments(), Slic3r::GUI::get_tray_ams_and_slot_id(), Slic3r::MachineObject::is_multi_extruders(), Slic3r::CaliPresetInfo::name, Slic3r::CaliPresetInfo::nozzle_diameter, Slic3r::CaliPresetInfo::nozzle_volume_type, preset_step, Slic3r::MachineObject::selected_cali_preset, Slic3r::CaliPresetInfo::setting_id, and Slic3r::CaliPresetInfo::tray_id.

Referenced by Slic3r::GUI::FlowRateWizard::on_cali_start(), Slic3r::GUI::MaxVolumetricSpeedWizard::on_cali_start(), and Slic3r::GUI::PressureAdvanceWizard::on_cali_start().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ get_calibration_mode()

CalibMode Slic3r::GUI::CalibrationWizard::get_calibration_mode ( )
inline
82{ return m_mode; }

References m_mode.

◆ get_curr_step()

CalibrationWizardPageStep * Slic3r::GUI::CalibrationWizard::get_curr_step ( )
inline
68{ return m_curr_step; }

References m_curr_step.

Referenced by on_cali_go_home().

Here is the caller graph for this function:

◆ msw_rescale()

void Slic3r::GUI::CalibrationWizard::msw_rescale ( )
484{
485 for (int i = 0; i < m_page_steps.size(); i++) {
486 if (m_page_steps[i]->page)
487 m_page_steps[i]->page->msw_rescale();
488 }
489}
std::vector< CalibrationWizardPageStep * > m_page_steps
Definition CalibrationWizard.hpp:124

References m_page_steps.

◆ on_cali_go_home()

void Slic3r::GUI::CalibrationWizard::on_cali_go_home ( )
protected
500{
501 // can go home? confirm to continue
502 CalibrationMethod method;
503 int cali_stage = 0;
504 CalibMode obj_cali_mode = get_obj_calibration_mode(curr_obj, method, cali_stage);
505
506 bool double_confirm = false;
508 if (page_type == CaliPageType::CALI_PAGE_COARSE_SAVE ||
512 page_type == CaliPageType::CALI_PAGE_PA_SAVE) {
513 double_confirm = true;
514 }
515 if (obj_cali_mode == m_mode && curr_obj && (curr_obj->is_in_printing() || double_confirm)) {
516 if (go_home_dialog == nullptr)
517 go_home_dialog = new SecondaryCheckDialog(this, wxID_ANY, _L("Confirm"));
518
519 go_home_dialog->Bind(EVT_SECONDARY_CHECK_CONFIRM, [this](wxCommandEvent &e) {
520 if (curr_obj) {
521 curr_obj->command_task_abort();
522 } else {
523 assert(false);
524 }
525 if (!m_page_steps.empty()) {
527 show_step(m_page_steps.front());
528 }
529 });
530
531 go_home_dialog->update_text(_L("Are you sure to cancel the current calibration and return to the home page?"));
532 go_home_dialog->on_show();
533 } else {
534 if (!m_page_steps.empty()) {
535 back_preset_info(curr_obj, true, obj_cali_mode == m_mode);
536 show_step(m_page_steps.front());
537 }
538 }
539}
#define _L(s)
Definition OBJ.cpp:34
CalibrationWizardPage * page
Definition CalibrationWizard.hpp:40
CaliPageType get_page_type()
Definition CalibrationWizardPage.hpp:306
SecondaryCheckDialog * go_home_dialog
Definition CalibrationWizard.hpp:126
CalibrationWizardPageStep * get_curr_step()
Definition CalibrationWizard.hpp:68
CalibrationMethod
Definition CalibrationWizardPage.hpp:63
CaliPageType
Definition CalibrationWizardPage.hpp:81
@ CALI_PAGE_FINE_SAVE
Definition CalibrationWizardPage.hpp:87
@ CALI_PAGE_COARSE_SAVE
Definition CalibrationWizardPage.hpp:85
@ CALI_PAGE_FLOW_SAVE
Definition CalibrationWizardPage.hpp:89
@ CALI_PAGE_COMMON_SAVE
Definition CalibrationWizardPage.hpp:90
@ CALI_PAGE_PA_SAVE
Definition CalibrationWizardPage.hpp:88
CalibMode get_obj_calibration_mode(const MachineObject *obj)
Definition CalibrationWizardPage.cpp:108
CalibMode
Definition calib.hpp:23

References _L, back_preset_info(), Slic3r::GUI::CALI_PAGE_COARSE_SAVE, Slic3r::GUI::CALI_PAGE_COMMON_SAVE, Slic3r::GUI::CALI_PAGE_FINE_SAVE, Slic3r::GUI::CALI_PAGE_FLOW_SAVE, Slic3r::GUI::CALI_PAGE_PA_SAVE, curr_obj, get_curr_step(), Slic3r::GUI::get_obj_calibration_mode(), Slic3r::GUI::CalibrationWizardPage::get_page_type(), go_home_dialog, m_mode, m_page_steps, Slic3r::GUI::CalibrationWizardPageStep::page, and show_step().

Referenced by Slic3r::GUI::FlowRateWizard::on_cali_action(), Slic3r::GUI::MaxVolumetricSpeedWizard::on_cali_action(), and Slic3r::GUI::PressureAdvanceWizard::on_cali_action().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ on_cali_job_finished() [1/2]

void Slic3r::GUI::CalibrationWizard::on_cali_job_finished ( wxCommandEvent & event)
172{
173 this->on_cali_job_finished(event.GetString());
174 event.Skip();
175}

References on_cali_job_finished().

Referenced by CalibrationWizard(), and on_cali_job_finished().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ on_cali_job_finished() [2/2]

virtual void Slic3r::GUI::CalibrationWizard::on_cali_job_finished ( wxString evt_data)
inlinevirtual

◆ on_device_connected()

void Slic3r::GUI::CalibrationWizard::on_device_connected ( MachineObject * obj)
virtual

Reimplemented in Slic3r::GUI::FlowRateWizard, Slic3r::GUI::MaxVolumetricSpeedWizard, and Slic3r::GUI::PressureAdvanceWizard.

219{
220 if (!m_page_steps.empty())
221 show_step(m_page_steps.front());
222
224
225 BOOST_LOG_TRIVIAL(info) << "on_device_connected - machine object status:"
226 << " dev_id = " << obj->get_dev_id()
227 << ", print_type = " << obj->printer_type
228 << ", printer_status = " << obj->print_status
229 << ", cali_finished = " << obj->cali_finished
230 << ", cali_version = " << obj->cali_version
231 << ", cache_flow_ratio = " << obj->cache_flow_ratio
232 << ", sub_task_name = " << obj->subtask_name
233 << ", gcode_file_name = " << obj->m_gcode_file;
234
235 for (const CaliPresetInfo& preset_info : obj->selected_cali_preset) {
236 BOOST_LOG_TRIVIAL(info) << "on_device_connected - selected preset: "
237 << "tray_id = " << preset_info.tray_id
238 << ", nozzle_diameter = " << preset_info.nozzle_diameter
239 << ", filament_id = " << preset_info.filament_id
240 << ", settring_id = " << preset_info.setting_id
241 << ", name = " << preset_info.name;
242 }
243
244 for (int i = 0; i < m_page_steps.size(); i++) {
245 if (m_page_steps[i]->page)
246 m_page_steps[i]->page->on_device_connected(obj);
247 }
248}
virtual void recover_preset_info(MachineObject *obj)
Definition CalibrationWizard.cpp:455

References Slic3r::MachineObject::cache_flow_ratio, Slic3r::MachineObject::cali_finished, Slic3r::MachineObject::cali_version, Slic3r::CaliPresetInfo::filament_id, Slic3r::MachineObject::get_dev_id(), Slic3r::MachineObject::m_gcode_file, m_page_steps, Slic3r::CaliPresetInfo::name, Slic3r::CaliPresetInfo::nozzle_diameter, Slic3r::MachineObject::print_status, Slic3r::MachineObject::printer_type, recover_preset_info(), Slic3r::MachineObject::selected_cali_preset, Slic3r::CaliPresetInfo::setting_id, show_step(), Slic3r::MachineObject::subtask_name, and Slic3r::CaliPresetInfo::tray_id.

Referenced by Slic3r::GUI::FlowRateWizard::on_device_connected(), Slic3r::GUI::MaxVolumetricSpeedWizard::on_device_connected(), and Slic3r::GUI::PressureAdvanceWizard::on_device_connected().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ on_sys_color_changed()

void Slic3r::GUI::CalibrationWizard::on_sys_color_changed ( )
492{
493 for (int i = 0; i < m_page_steps.size(); i++) {
494 if (m_page_steps[i]->page)
495 m_page_steps[i]->page->on_sys_color_changed();
496 }
497}

References m_page_steps.

◆ recover_preset_info()

void Slic3r::GUI::CalibrationWizard::recover_preset_info ( MachineObject * obj)
virtual
456{
457 std::vector<PrinterCaliInfo> back_infos = wxGetApp().app_config->get_printer_cali_infos();
458 for (const auto& back_info : back_infos) {
459 if (obj && (obj->get_dev_id() == back_info.dev_id) ) {
460 obj->set_dev_id(back_info.dev_id);
461 obj->cali_finished = back_info.cali_finished;
462 obj->cache_flow_ratio = back_info.cache_flow_ratio;
463 obj->selected_cali_preset = back_info.selected_presets;
464 obj->flow_ratio_calibration_type = back_info.cache_flow_rate_calibration_type;
465 }
466 }
467}

References Slic3r::MachineObject::cache_flow_ratio, Slic3r::MachineObject::cali_finished, Slic3r::MachineObject::flow_ratio_calibration_type, Slic3r::MachineObject::get_dev_id(), Slic3r::MachineObject::selected_cali_preset, and Slic3r::MachineObject::set_dev_id().

Referenced by on_device_connected().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ save_preset()

bool Slic3r::GUI::CalibrationWizard::save_preset ( const std::string & old_preset_name,
const std::string & new_preset_name,
const std::map< std::string, ConfigOption * > & key_values,
wxString & message )
260{
261 if (new_preset_name.empty()) {
262 message = _L("The name cannot be empty.");
263 return false;
264 }
265
266 PresetCollection *filament_presets = &wxGetApp().preset_bundle->filaments;
267 Preset* preset = filament_presets->find_preset(old_preset_name);
268 if (!preset) {
269 message = wxString::Format(_L("The selected preset: %s was not found."), old_preset_name);
270 return false;
271 }
272
273 Preset temp_preset = *preset;
274
275 std::string new_name = filament_presets->get_preset_name_by_alias(new_preset_name);
276 bool exist_preset = false;
277 // If name is current, get the editing preset
278 Preset *new_preset = filament_presets->find_preset(new_name);
279 if (new_preset) {
280 if (new_preset->is_system) {
281 message = _L("The name cannot be the same as the system preset name.");
282 return false;
283 }
284
285 if (new_preset != preset) {
286 message = _L("The name is the same as another existing preset name");
287 return false;
288 }
289 if (new_preset != &filament_presets->get_edited_preset()) new_preset = &temp_preset;
290 exist_preset = true;
291 } else {
292 new_preset = &temp_preset;
293 }
294
295 for (auto item : key_values) {
296 new_preset->config.set_key_value(item.first, item.second);
297 }
298
299 // Save the preset into Slic3r::data_dir / presets / section_name / preset_name.ini
300 filament_presets->save_current_preset(new_name, false, false, new_preset);
301
302 // BBS create new settings
303 new_preset = filament_presets->find_preset(new_name, false, true);
304 // Preset* preset = &m_presets.preset(it - m_presets.begin(), true);
305 if (!new_preset) {
306 BOOST_LOG_TRIVIAL(info) << "create new preset failed";
307 message = _L("create new preset failed.");
308 return false;
309 }
310
311 // set sync_info for sync service
312 if (exist_preset) {
313 new_preset->sync_info = "update";
314 BOOST_LOG_TRIVIAL(info) << "sync_preset: update preset = " << new_preset->name;
315 } else {
316 new_preset->sync_info = "create";
317 if (wxGetApp().is_user_login()) new_preset->user_id = wxGetApp().getAgent()->get_user_id();
318 BOOST_LOG_TRIVIAL(info) << "sync_preset: create preset = " << new_preset->name;
319 }
320 new_preset->save_info();
321
322 // Mark the print & filament enabled if they are compatible with the currently selected preset.
323 // If saving the preset changes compatibility with other presets, keep the now incompatible dependent presets selected, however with a "red flag" icon showing that they are
324 // no more compatible.
325 wxGetApp().preset_bundle->update_compatible(PresetSelectCompatibleType::Never);
326
327 // BBS if create a new prset name, preset changed from preset name to new preset name
328 if (!exist_preset) { wxGetApp().plater()->sidebar().update_presets_from_to(Preset::Type::TYPE_FILAMENT, old_preset_name, new_preset->name); }
329
330 // todo: zhimin
331 // wxGetApp().mainframe->update_filament_tab_ui();
332 return true;
333}
@ TYPE_FILAMENT
Definition Preset.hpp:248
@ Preset
Definition calib.hpp:39
@ Never
Definition Preset.hpp:523

References _L, Slic3r::Preset::config, Slic3r::PresetCollection::find_preset(), Slic3r::PresetCollection::get_edited_preset(), Slic3r::PresetCollection::get_preset_name_by_alias(), Slic3r::Preset::is_system, Slic3r::Preset::name, Slic3r::Never, Slic3r::PresetCollection::save_current_preset(), Slic3r::Preset::save_info(), Slic3r::DynamicConfig::set_key_value(), Slic3r::Preset::sync_info, Slic3r::Preset::TYPE_FILAMENT, and Slic3r::Preset::user_id.

Referenced by Slic3r::GUI::FlowRateWizard::on_cali_save(), and Slic3r::GUI::MaxVolumetricSpeedWizard::on_cali_save().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ save_preset_with_index()

bool Slic3r::GUI::CalibrationWizard::save_preset_with_index ( const std::string & old_preset_name,
const std::string & new_preset_name,
const std::map< std::string, ConfigIndexValue > & key_values,
wxString & message )
336{
337 if (new_preset_name.empty()) {
338 message = _L("The name cannot be empty.");
339 return false;
340 }
341
342 PresetCollection *filament_presets = &wxGetApp().preset_bundle->filaments;
343 Preset *preset = filament_presets->find_preset(old_preset_name);
344 if (!preset) {
345 message = wxString::Format(_L("The selected preset: %s was not found."), old_preset_name);
346 return false;
347 }
348
349 Preset temp_preset = *preset;
350
351 std::string new_name = filament_presets->get_preset_name_by_alias(new_preset_name);
352 bool exist_preset = false;
353 // If name is current, get the editing preset
354 Preset *new_preset = filament_presets->find_preset(new_name);
355 if (new_preset) {
356 if (new_preset->is_system) {
357 message = _L("The name cannot be the same as the system preset name.");
358 return false;
359 }
360
361 if (new_preset != preset) {
362 message = _L("The name is the same as another existing preset name");
363 return false;
364 }
365 if (new_preset != &filament_presets->get_edited_preset())
366 new_preset = &temp_preset;
367 exist_preset = true;
368 } else {
369 new_preset = &temp_preset;
370 }
371
372 for (auto item : key_values) {
373 auto config_opt = new_preset->config.option<ConfigOptionFloatsNullable>(item.first);
374 if (config_opt) {
375 auto& config_value = config_opt->values;
376 config_value[item.second.index] = item.second.value;
377 }
378 else {
379 message = wxString::Format(_L("Could not find parameter: %s."), item.first);
380 }
381 }
382
383 // Save the preset into Slic3r::data_dir / presets / section_name / preset_name.ini
384 filament_presets->save_current_preset(new_name, false, false, new_preset);
385
386 // BBS create new settings
387 new_preset = filament_presets->find_preset(new_name, false, true);
388 // Preset* preset = &m_presets.preset(it - m_presets.begin(), true);
389 if (!new_preset) {
390 BOOST_LOG_TRIVIAL(info) << "create new preset failed";
391 message = _L("create new preset failed.");
392 return false;
393 }
394
395 // set sync_info for sync service
396 if (exist_preset) {
397 new_preset->sync_info = "update";
398 BOOST_LOG_TRIVIAL(info) << "sync_preset: update preset = " << new_preset->name;
399 } else {
400 new_preset->sync_info = "create";
401 if (wxGetApp().is_user_login()) new_preset->user_id = wxGetApp().getAgent()->get_user_id();
402 BOOST_LOG_TRIVIAL(info) << "sync_preset: create preset = " << new_preset->name;
403 }
404 new_preset->save_info();
405
406 // Mark the print & filament enabled if they are compatible with the currently selected preset.
407 // If saving the preset changes compatibility with other presets, keep the now incompatible dependent presets selected, however with a "red flag" icon showing that they are
408 // no more compatible.
409 wxGetApp().preset_bundle->update_compatible(PresetSelectCompatibleType::Never);
410
411 // BBS if create a new prset name, preset changed from preset name to new preset name
412 if (!exist_preset) { wxGetApp().plater()->sidebar().update_presets_from_to(Preset::Type::TYPE_FILAMENT, old_preset_name, new_preset->name); }
413
414 return true;
415}
ConfigOptionFloatsTempl< true > ConfigOptionFloatsNullable
Definition Config.hpp:1016

References _L, Slic3r::Preset::config, Slic3r::PresetCollection::find_preset(), Slic3r::PresetCollection::get_edited_preset(), Slic3r::PresetCollection::get_preset_name_by_alias(), Slic3r::Preset::is_system, Slic3r::Preset::name, Slic3r::Never, Slic3r::ConfigBase::option(), Slic3r::PresetCollection::save_current_preset(), Slic3r::Preset::save_info(), Slic3r::Preset::sync_info, Slic3r::Preset::TYPE_FILAMENT, and Slic3r::Preset::user_id.

Referenced by Slic3r::GUI::FlowRateWizard::on_cali_save().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ set_cali_method()

void Slic3r::GUI::CalibrationWizard::set_cali_method ( CalibrationMethod method)
virtual

Reimplemented in Slic3r::GUI::FlowRateWizard.

251{
252 m_cali_method = method;
253 for (int i = 0; i < m_page_steps.size(); i++) {
254 if (m_page_steps[i]->page)
255 m_page_steps[i]->page->set_cali_method(method);
256 }
257}
CalibrationMethod m_cali_method
Definition CalibrationWizard.hpp:107

References m_cali_method, and m_page_steps.

Referenced by Slic3r::GUI::PressureAdvanceWizard::on_cali_action(), Slic3r::GUI::MaxVolumetricSpeedWizard::on_device_connected(), Slic3r::GUI::PressureAdvanceWizard::on_device_connected(), and Slic3r::GUI::FlowRateWizard::set_cali_method().

Here is the caller graph for this function:

◆ set_cali_style()

virtual void Slic3r::GUI::CalibrationWizard::set_cali_style ( CalibrationStyle style)
inlinevirtual
76 {
78 }
CalibrationStyle m_cali_style
Definition CalibrationWizard.hpp:106

References m_cali_style, and style.

◆ show_step()

◆ unfinished_child()

StagedBuild * Slic3r::GUI::StagedBuild::unfinished_child ( ) const
inlineprivateinherited
52 {
53 auto it = std::find_if(m_children.begin(), m_children.end(), [](const StagedBuild* child) { return !child->built(); });
54 return it == m_children.end() ? nullptr : *it;
55 }

References m_children.

Referenced by build_step().

Here is the caller graph for this function:

◆ update()

void Slic3r::GUI::CalibrationWizard::update ( MachineObject * obj)
virtual

Reimplemented in Slic3r::GUI::FlowRateWizard, and Slic3r::GUI::PressureAdvanceWizard.

196{
197 curr_obj = obj;
198
199 /* only update curr step
200 if (m_curr_step) {
201 m_curr_step->page->update(obj);
202 }
203 */
204 if (!obj) {
205 for (int i = 0; i < m_page_steps.size(); i++) {
206 if (m_page_steps[i]->page)
207 m_page_steps[i]->page->on_reset_page();
208 }
209 }
210
211 // update all page steps
212 for (int i = 0; i < m_page_steps.size(); i++) {
213 if (m_page_steps[i]->page)
214 m_page_steps[i]->page->update(obj);
215 }
216}

References curr_obj, and m_page_steps.

Referenced by Slic3r::GUI::FlowRateWizard::update(), and Slic3r::GUI::PressureAdvanceWizard::update().

Here is the caller graph for this function:

Member Data Documentation

◆ cali_coarse_step

◆ cali_fine_step

◆ cali_step

◆ coarse_save_step

◆ curr_obj

◆ fine_save_step

CalibrationWizardPageStep* Slic3r::GUI::CalibrationWizard::fine_save_step { nullptr }
protected

◆ go_home_dialog

SecondaryCheckDialog* Slic3r::GUI::CalibrationWizard::go_home_dialog = nullptr
protected

Referenced by on_cali_go_home().

◆ last_obj

MachineObject* Slic3r::GUI::CalibrationWizard::last_obj { nullptr }
protected
109{ nullptr };

◆ m_all_pages_sizer

wxBoxSizer* Slic3r::GUI::CalibrationWizard::m_all_pages_sizer
protected

◆ m_cali_method

◆ m_cali_style

CalibrationStyle Slic3r::GUI::CalibrationWizard::m_cali_style
protected

Referenced by set_cali_style().

◆ m_children

std::vector<StagedBuild*> Slic3r::GUI::StagedBuild::m_children
privateinherited

◆ m_curr_step

◆ m_mode

◆ m_next_step

size_t Slic3r::GUI::StagedBuild::m_next_step { 0 }
privateinherited
59{ 0 };

Referenced by add_build_steps_of(), build_step(), and built().

◆ m_page_steps

◆ m_scrolledWindow

◆ m_steps

std::vector<std::function<void()> > Slic3r::GUI::StagedBuild::m_steps
privateinherited

◆ preset_step

◆ save_step

◆ start_step


The documentation for this class was generated from the following files: