NEW: rearch calibration
Change-Id: I20ee304eba1a63e08d0a36abdf06ebe6a6e4451f Signed-off-by: Stone Li <stone.li@bambulab.com>
BIN
resources/images/cali_page_after_flow.png
Normal file
After Width: | Height: | Size: 2.7 KiB |
BIN
resources/images/cali_page_after_pa.png
Normal file
After Width: | Height: | Size: 3.1 KiB |
BIN
resources/images/cali_page_before_flow.png
Normal file
After Width: | Height: | Size: 2.8 KiB |
BIN
resources/images/cali_page_before_pa.png
Normal file
After Width: | Height: | Size: 3.2 KiB |
4
resources/images/cali_page_caption_help.svg
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
<svg width="48" height="48" viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<rect width="48" height="48" rx="24" fill="#D9D9D9"/>
|
||||||
|
<path d="M18.96 19.68C19.2933 18.7067 19.86 17.9533 20.66 17.42C21.4733 16.8733 22.4067 16.6 23.46 16.6C24.2467 16.6 24.94 16.7533 25.54 17.06C26.14 17.3533 26.6067 17.7667 26.94 18.3C27.2733 18.82 27.44 19.4067 27.44 20.06C27.44 20.7267 27.28 21.2867 26.96 21.74C26.6533 22.18 26.1867 22.6733 25.56 23.22C25.12 23.6333 24.7667 23.9867 24.5 24.28C24.2333 24.5733 24.0067 24.9267 23.82 25.34C23.6467 25.74 23.56 26.2067 23.56 26.74C23.56 27.1133 23.6067 27.4933 23.7 27.88H22.32C22.1467 27.28 22.06 26.7267 22.06 26.22C22.06 25.6733 22.1467 25.1933 22.32 24.78C22.5067 24.3533 22.7267 24 22.98 23.72C23.2333 23.4267 23.5733 23.08 24 22.68C24.52 22.2133 24.9067 21.8067 25.16 21.46C25.4133 21.1 25.54 20.68 25.54 20.2C25.54 19.6 25.3333 19.12 24.92 18.76C24.5067 18.4 23.9667 18.22 23.3 18.22C21.94 18.22 20.9533 18.9733 20.34 20.48L18.96 19.68ZM23.18 32.22C22.8733 32.22 22.6067 32.1067 22.38 31.88C22.1667 31.6533 22.06 31.3867 22.06 31.08C22.06 30.76 22.1667 30.4867 22.38 30.26C22.6067 30.0333 22.8733 29.92 23.18 29.92C23.5 29.92 23.7667 30.0333 23.98 30.26C24.2067 30.4867 24.32 30.76 24.32 31.08C24.32 31.3867 24.2067 31.6533 23.98 31.88C23.7667 32.1067 23.5 32.22 23.18 32.22Z" fill="black"/>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 1.3 KiB |
4
resources/images/cali_page_caption_help_hover.svg
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
<svg width="48" height="48" viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<rect width="48" height="48" rx="24" fill="#D9D9D9"/>
|
||||||
|
<path d="M18.96 19.68C19.2933 18.7067 19.86 17.9533 20.66 17.42C21.4733 16.8733 22.4067 16.6 23.46 16.6C24.2467 16.6 24.94 16.7533 25.54 17.06C26.14 17.3533 26.6067 17.7667 26.94 18.3C27.2733 18.82 27.44 19.4067 27.44 20.06C27.44 20.7267 27.28 21.2867 26.96 21.74C26.6533 22.18 26.1867 22.6733 25.56 23.22C25.12 23.6333 24.7667 23.9867 24.5 24.28C24.2333 24.5733 24.0067 24.9267 23.82 25.34C23.6467 25.74 23.56 26.2067 23.56 26.74C23.56 27.1133 23.6067 27.4933 23.7 27.88H22.32C22.1467 27.28 22.06 26.7267 22.06 26.22C22.06 25.6733 22.1467 25.1933 22.32 24.78C22.5067 24.3533 22.7267 24 22.98 23.72C23.2333 23.4267 23.5733 23.08 24 22.68C24.52 22.2133 24.9067 21.8067 25.16 21.46C25.4133 21.1 25.54 20.68 25.54 20.2C25.54 19.6 25.3333 19.12 24.92 18.76C24.5067 18.4 23.9667 18.22 23.3 18.22C21.94 18.22 20.9533 18.9733 20.34 20.48L18.96 19.68ZM23.18 32.22C22.8733 32.22 22.6067 32.1067 22.38 31.88C22.1667 31.6533 22.06 31.3867 22.06 31.08C22.06 30.76 22.1667 30.4867 22.38 30.26C22.6067 30.0333 22.8733 29.92 23.18 29.92C23.5 29.92 23.7667 30.0333 23.98 30.26C24.2067 30.4867 24.32 30.76 24.32 31.08C24.32 31.3867 24.2067 31.6533 23.98 31.88C23.7667 32.1067 23.5 32.22 23.18 32.22Z" fill="black"/>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 1.3 KiB |
3
resources/images/cali_page_caption_prev.svg
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
<svg width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<path d="M4.58579 18.5858C3.80474 19.3668 3.80474 20.6332 4.58579 21.4142L17.3137 34.1421C18.0948 34.9232 19.3611 34.9232 20.1421 34.1421C20.9232 33.3611 20.9232 32.0948 20.1421 31.3137L8.82843 20L20.1421 8.68629C20.9232 7.90524 20.9232 6.63891 20.1421 5.85786C19.3611 5.07682 18.0948 5.07682 17.3137 5.85786L4.58579 18.5858ZM34.5 18H6V22H34.5V18Z" fill="black"/>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 467 B |
3
resources/images/cali_page_caption_prev_hover.svg
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
<svg width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||||
|
<path d="M4.58579 18.5858C3.80474 19.3668 3.80474 20.6332 4.58579 21.4142L17.3137 34.1421C18.0948 34.9232 19.3611 34.9232 20.1421 34.1421C20.9232 33.3611 20.9232 32.0948 20.1421 31.3137L8.82843 20L20.1421 8.68629C20.9232 7.90524 20.9232 6.63891 20.1421 5.85786C19.3611 5.07682 18.0948 5.07682 17.3137 5.85786L4.58579 18.5858ZM34.5 18H6V22H34.5V18Z" fill="black"/>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 467 B |
|
@ -32,11 +32,8 @@ struct PrinterCaliInfo
|
||||||
std::string dev_id;
|
std::string dev_id;
|
||||||
CalibMode mode;
|
CalibMode mode;
|
||||||
CalibState state;
|
CalibState state;
|
||||||
//std::string filament_preset;
|
/* tray index -> filament preset name */
|
||||||
//std::vector<int> tray_ids;
|
|
||||||
std::map<int, std::string> filament_presets;
|
std::map<int, std::string> filament_presets;
|
||||||
//float nozzle_dia;
|
|
||||||
//int bed_type;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Calib_Params
|
struct Calib_Params
|
||||||
|
|
|
@ -392,14 +392,22 @@ set(SLIC3R_GUI_SOURCES
|
||||||
GUI/ReleaseNote.cpp
|
GUI/ReleaseNote.cpp
|
||||||
GUI/SingleChoiceDialog.hpp
|
GUI/SingleChoiceDialog.hpp
|
||||||
GUI/SingleChoiceDialog.cpp
|
GUI/SingleChoiceDialog.cpp
|
||||||
|
GUI/CaliHistoryDialog.hpp
|
||||||
|
GUI/CaliHistoryDialog.cpp
|
||||||
GUI/CalibrationPanel.hpp
|
GUI/CalibrationPanel.hpp
|
||||||
GUI/CalibrationPanel.cpp
|
GUI/CalibrationPanel.cpp
|
||||||
GUI/CalibrationWizard.hpp
|
GUI/CalibrationWizard.hpp
|
||||||
GUI/CalibrationWizard.cpp
|
GUI/CalibrationWizard.cpp
|
||||||
GUI/EditCalibrationHistoryDialog.cpp
|
|
||||||
GUI/EditCalibrationHistoryDialog.hpp
|
|
||||||
GUI/CalibrationWizardPage.cpp
|
GUI/CalibrationWizardPage.cpp
|
||||||
GUI/CalibrationWizardPage.hpp
|
GUI/CalibrationWizardPage.hpp
|
||||||
|
GUI/CalibrationWizardStartPage.cpp
|
||||||
|
GUI/CalibrationWizardStartPage.hpp
|
||||||
|
GUI/CalibrationWizardPresetPage.cpp
|
||||||
|
GUI/CalibrationWizardPresetPage.hpp
|
||||||
|
GUI/CalibrationWizardCaliPage.cpp
|
||||||
|
GUI/CalibrationWizardCaliPage.hpp
|
||||||
|
GUI/CalibrationWizardSavePage.cpp
|
||||||
|
GUI/CalibrationWizardSavePage.hpp
|
||||||
GUI/calib_dlg.cpp
|
GUI/calib_dlg.cpp
|
||||||
GUI/calib_dlg.hpp
|
GUI/calib_dlg.hpp
|
||||||
GUI/Calibration.hpp
|
GUI/Calibration.hpp
|
||||||
|
|
421
src/slic3r/GUI/CaliHistoryDialog.cpp
Normal file
|
@ -0,0 +1,421 @@
|
||||||
|
#include "CaliHistoryDialog.hpp"
|
||||||
|
#include "I18N.hpp"
|
||||||
|
|
||||||
|
#include "libslic3r/Utils.hpp"
|
||||||
|
#include "GUI.hpp"
|
||||||
|
#include "GUI_App.hpp"
|
||||||
|
#include "format.hpp"
|
||||||
|
#include "MsgDialog.hpp"
|
||||||
|
#include "slic3r/Utils/CalibUtils.hpp"
|
||||||
|
|
||||||
|
namespace Slic3r {
|
||||||
|
namespace GUI {
|
||||||
|
|
||||||
|
|
||||||
|
#define HISTORY_WINDOW_SIZE wxSize(FromDIP(600), FromDIP(450))
|
||||||
|
#define EDIT_HISTORY_DIALOG_INPUT_SIZE wxSize(FromDIP(160), FromDIP(24))
|
||||||
|
#define HISTORY_WINDOW_ITEMS_COUNT 4
|
||||||
|
|
||||||
|
HistoryWindow::HistoryWindow(wxWindow* parent, const std::vector<PACalibResult>& calib_results_history)
|
||||||
|
: DPIDialog(parent, wxID_ANY, _L("Pressure Advance Calibration Result"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE)
|
||||||
|
, m_calib_results_history(calib_results_history)
|
||||||
|
{
|
||||||
|
this->SetBackgroundColour(*wxWHITE);
|
||||||
|
auto main_sizer = new wxBoxSizer(wxVERTICAL);
|
||||||
|
|
||||||
|
auto scroll_window = new wxScrolledWindow(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHSCROLL | wxVSCROLL);
|
||||||
|
scroll_window->SetScrollRate(5, 5);
|
||||||
|
scroll_window->SetBackgroundColour(*wxWHITE);
|
||||||
|
|
||||||
|
auto scroll_sizer = new wxBoxSizer(wxVERTICAL);
|
||||||
|
scroll_window->SetSizer(scroll_sizer);
|
||||||
|
|
||||||
|
wxPanel* comboBox_panel = new wxPanel(scroll_window);
|
||||||
|
comboBox_panel->SetBackgroundColour(wxColour(238, 238, 238));
|
||||||
|
auto comboBox_sizer = new wxBoxSizer(wxVERTICAL);
|
||||||
|
comboBox_panel->SetSizer(comboBox_sizer);
|
||||||
|
comboBox_sizer->AddSpacer(10);
|
||||||
|
|
||||||
|
auto nozzle_dia_title = new wxStaticText(comboBox_panel, wxID_ANY, _L("Nozzle Diameter"));
|
||||||
|
nozzle_dia_title->SetFont(Label::Head_14);
|
||||||
|
comboBox_sizer->Add(nozzle_dia_title, 0, wxLEFT | wxRIGHT, FromDIP(15));
|
||||||
|
comboBox_sizer->AddSpacer(10);
|
||||||
|
|
||||||
|
m_comboBox_nozzle_dia = new ComboBox(comboBox_panel, wxID_ANY, "", wxDefaultPosition, wxSize(FromDIP(500), FromDIP(24)), 0, nullptr, wxCB_READONLY);
|
||||||
|
comboBox_sizer->Add(m_comboBox_nozzle_dia, 0, wxLEFT | wxRIGHT, FromDIP(15));
|
||||||
|
comboBox_sizer->AddSpacer(10);
|
||||||
|
|
||||||
|
scroll_sizer->Add(comboBox_panel);
|
||||||
|
|
||||||
|
scroll_sizer->AddSpacer(FromDIP(15));
|
||||||
|
|
||||||
|
wxPanel* tips_panel = new wxPanel(scroll_window, wxID_ANY);
|
||||||
|
auto tips_sizer = new wxBoxSizer(wxVERTICAL);
|
||||||
|
tips_panel->SetSizer(tips_sizer);
|
||||||
|
m_tips = new wxStaticText(tips_panel, wxID_ANY, "");
|
||||||
|
m_tips->SetForegroundColour({ 145, 145, 145 });
|
||||||
|
tips_sizer->Add(m_tips, 0, wxEXPAND);
|
||||||
|
|
||||||
|
scroll_sizer->Add(tips_panel, 0, wxEXPAND);
|
||||||
|
|
||||||
|
scroll_sizer->AddSpacer(FromDIP(15));
|
||||||
|
|
||||||
|
m_history_data_panel = new wxPanel(scroll_window);
|
||||||
|
|
||||||
|
scroll_sizer->Add(m_history_data_panel, 1, wxEXPAND);
|
||||||
|
|
||||||
|
main_sizer->Add(scroll_window, 1, wxEXPAND | wxALL, FromDIP(10));
|
||||||
|
SetSizer(main_sizer);
|
||||||
|
main_sizer->Fit(this);
|
||||||
|
SetMinSize(HISTORY_WINDOW_SIZE);
|
||||||
|
SetSize(HISTORY_WINDOW_SIZE);
|
||||||
|
CenterOnParent();
|
||||||
|
|
||||||
|
wxGetApp().UpdateDlgDarkUI(this);
|
||||||
|
|
||||||
|
m_comboBox_nozzle_dia->Bind(wxEVT_COMBOBOX, &HistoryWindow::on_select_nozzle, this);
|
||||||
|
|
||||||
|
m_refresh_timer = new wxTimer();
|
||||||
|
m_refresh_timer->SetOwner(this);
|
||||||
|
m_refresh_timer->Start(200);
|
||||||
|
Bind(wxEVT_TIMER, &HistoryWindow::on_timer, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
HistoryWindow::~HistoryWindow()
|
||||||
|
{
|
||||||
|
m_refresh_timer->Stop();
|
||||||
|
}
|
||||||
|
|
||||||
|
void HistoryWindow::sync_history_result(MachineObject* obj)
|
||||||
|
{
|
||||||
|
BOOST_LOG_TRIVIAL(info) << "sync_history_result";
|
||||||
|
|
||||||
|
m_calib_results_history.clear();
|
||||||
|
if (obj)
|
||||||
|
m_calib_results_history = obj->pa_calib_tab;
|
||||||
|
|
||||||
|
if (m_calib_results_history.empty()) {
|
||||||
|
// for test
|
||||||
|
/*
|
||||||
|
std::vector<PACalibResult> temp_test;
|
||||||
|
PACalibResult test{ 0, 0, 0.0f, "test", "test", "test_name", 0.1f, 0.5f };
|
||||||
|
temp_test.push_back(test);
|
||||||
|
test.tray_id = 1;
|
||||||
|
temp_test.push_back(test);
|
||||||
|
test.tray_id = 2;
|
||||||
|
temp_test.push_back(test);
|
||||||
|
test.tray_id = 3;
|
||||||
|
temp_test.push_back(test);
|
||||||
|
m_calib_results_history = temp_test;
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
|
sync_history_data();
|
||||||
|
|
||||||
|
if (m_calib_results_history.empty()) {
|
||||||
|
m_tips->SetLabel(_L("No History Result"));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
m_tips->SetLabel("Success to get history result");
|
||||||
|
}
|
||||||
|
m_tips->Refresh();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void HistoryWindow::on_device_connected(MachineObject* obj)
|
||||||
|
{
|
||||||
|
if (!obj) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
curr_obj = obj;
|
||||||
|
// init nozzle value
|
||||||
|
static std::array<float, 4> nozzle_diameter_list = { 0.2f, 0.4f, 0.6f, 0.8f };
|
||||||
|
int selection = 1;
|
||||||
|
for (int i = 0; i < nozzle_diameter_list.size(); i++) {
|
||||||
|
m_comboBox_nozzle_dia->AppendString(wxString::Format("%1.1f mm", nozzle_diameter_list[i]));
|
||||||
|
if (abs(curr_obj->nozzle_diameter - nozzle_diameter_list[i]) < 1e-3) {
|
||||||
|
selection = i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
m_comboBox_nozzle_dia->SetSelection(selection);
|
||||||
|
|
||||||
|
// trigger on_select nozzle
|
||||||
|
wxCommandEvent evt(wxEVT_COMBOBOX);
|
||||||
|
evt.SetEventObject(m_comboBox_nozzle_dia);
|
||||||
|
wxPostEvent(m_comboBox_nozzle_dia, evt);
|
||||||
|
}
|
||||||
|
|
||||||
|
void HistoryWindow::on_timer(wxTimerEvent& event)
|
||||||
|
{
|
||||||
|
update(curr_obj);
|
||||||
|
}
|
||||||
|
|
||||||
|
void HistoryWindow::update(MachineObject* obj)
|
||||||
|
{
|
||||||
|
if (!obj) return;
|
||||||
|
|
||||||
|
if (obj->cali_version != history_version) {
|
||||||
|
if (obj->has_get_pa_calib_tab) {
|
||||||
|
history_version = obj->cali_version;
|
||||||
|
reqeust_history_result(obj);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// sync when history is not empty
|
||||||
|
if (obj->has_get_pa_calib_tab && m_calib_results_history.empty()) {
|
||||||
|
sync_history_result(curr_obj);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void HistoryWindow::on_select_nozzle(wxCommandEvent& evt)
|
||||||
|
{
|
||||||
|
reqeust_history_result(curr_obj);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void HistoryWindow::reqeust_history_result(MachineObject* obj)
|
||||||
|
{
|
||||||
|
if (curr_obj) {
|
||||||
|
curr_obj->reset_pa_cali_history_result();
|
||||||
|
sync_history_result(curr_obj);
|
||||||
|
|
||||||
|
float nozzle_value = get_nozzle_value();
|
||||||
|
if (nozzle_value > 0) {
|
||||||
|
CalibUtils::emit_get_PA_calib_infos(nozzle_value);
|
||||||
|
m_tips->SetLabel("Refreshing the historical pressure advance records");
|
||||||
|
BOOST_LOG_TRIVIAL(info) << "request calib history";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void HistoryWindow::sync_history_data() {
|
||||||
|
m_history_data_panel->DestroyChildren();
|
||||||
|
wxGridBagSizer* gbSizer;
|
||||||
|
gbSizer = new wxGridBagSizer(FromDIP(0), FromDIP(80));
|
||||||
|
gbSizer->SetFlexibleDirection(wxBOTH);
|
||||||
|
gbSizer->SetNonFlexibleGrowMode(wxFLEX_GROWMODE_SPECIFIED);
|
||||||
|
|
||||||
|
m_history_data_panel->SetSizer(gbSizer, true);
|
||||||
|
|
||||||
|
auto title_material = new wxStaticText(m_history_data_panel, wxID_ANY, _L("Material"));
|
||||||
|
title_material->SetFont(Label::Head_14);
|
||||||
|
gbSizer->Add(title_material, { 0, 0 }, { 1, 1 }, wxBOTTOM, FromDIP(15));
|
||||||
|
|
||||||
|
auto title_k = new wxStaticText(m_history_data_panel, wxID_ANY, _L("K"));
|
||||||
|
title_k->SetFont(Label::Head_14);
|
||||||
|
gbSizer->Add(title_k, { 0, 1 }, { 1, 1 }, wxBOTTOM, FromDIP(15));
|
||||||
|
|
||||||
|
// Hide
|
||||||
|
//auto title_n = new wxStaticText(m_history_data_panel, wxID_ANY, _L("N"));
|
||||||
|
//title_n->SetFont(Label::Head_14);
|
||||||
|
//gbSizer->Add(title_n, { 0, 2 }, { 1, 1 }, wxBOTTOM, FromDIP(15));
|
||||||
|
|
||||||
|
auto title_action = new wxStaticText(m_history_data_panel, wxID_ANY, _L("Action"));
|
||||||
|
title_action->SetFont(Label::Head_14);
|
||||||
|
gbSizer->Add(title_action, { 0, 2 }, { 1, 1 });
|
||||||
|
|
||||||
|
int i = 1;
|
||||||
|
for (auto& result : m_calib_results_history) {
|
||||||
|
wxString material_name = "";
|
||||||
|
material_name = result.name;
|
||||||
|
auto material_name_value = new wxStaticText(m_history_data_panel, wxID_ANY, material_name);
|
||||||
|
auto k_str = wxString::Format("%.3f", result.k_value);
|
||||||
|
auto n_str = wxString::Format("%.3f", result.n_coef);
|
||||||
|
auto k_value = new wxStaticText(m_history_data_panel, wxID_ANY, k_str);
|
||||||
|
auto n_value = new wxStaticText(m_history_data_panel, wxID_ANY, n_str);
|
||||||
|
n_value->Hide();
|
||||||
|
auto delete_button = new Button(m_history_data_panel, _L("Delete"));
|
||||||
|
delete_button->SetBackgroundColour(*wxWHITE);
|
||||||
|
delete_button->SetMinSize(wxSize(-1, FromDIP(24)));
|
||||||
|
delete_button->SetCornerRadius(FromDIP(12));
|
||||||
|
delete_button->Bind(wxEVT_BUTTON, [this, gbSizer, i, &result](auto& e) {
|
||||||
|
for (int j = 0; j < HISTORY_WINDOW_ITEMS_COUNT; j++) {
|
||||||
|
auto item = gbSizer->FindItemAtPosition({ i, j });
|
||||||
|
item->GetWindow()->Hide();
|
||||||
|
}
|
||||||
|
gbSizer->SetEmptyCellSize({ 0,0 });
|
||||||
|
m_history_data_panel->Layout();
|
||||||
|
m_history_data_panel->Fit();
|
||||||
|
CalibUtils::delete_PA_calib_result({ result.tray_id, result.cali_idx, result.nozzle_diameter, result.filament_id });
|
||||||
|
});
|
||||||
|
|
||||||
|
auto edit_button = new Button(m_history_data_panel, _L("Edit"));
|
||||||
|
StateColor btn_bg_green(std::pair<wxColour, int>(wxColour(27, 136, 68), StateColor::Pressed),
|
||||||
|
std::pair<wxColour, int>(wxColour(61, 203, 115), StateColor::Hovered),
|
||||||
|
std::pair<wxColour, int>(wxColour(0, 174, 66), StateColor::Normal));
|
||||||
|
edit_button->SetBackgroundColour(*wxWHITE);
|
||||||
|
edit_button->SetBackgroundColor(btn_bg_green);
|
||||||
|
edit_button->SetBorderColor(wxColour(0, 174, 66));
|
||||||
|
edit_button->SetTextColor(wxColour("#FFFFFE"));
|
||||||
|
edit_button->SetMinSize(wxSize(-1, FromDIP(24)));
|
||||||
|
edit_button->SetCornerRadius(FromDIP(12));
|
||||||
|
edit_button->Bind(wxEVT_BUTTON, [this, &result, k_value, material_name_value](auto& e) {
|
||||||
|
PACalibResult result_buffer = result;
|
||||||
|
result_buffer.k_value = stof(k_value->GetLabel().ToStdString());
|
||||||
|
result_buffer.name = material_name_value->GetLabel().ToStdString();
|
||||||
|
EditCalibrationHistoryDialog dlg(this, result_buffer);
|
||||||
|
if (dlg.ShowModal() == wxID_OK) {
|
||||||
|
auto new_result = dlg.get_result();
|
||||||
|
|
||||||
|
wxString new_k_str = wxString::Format("%.3f", new_result.k_value);
|
||||||
|
k_value->SetLabel(new_k_str);
|
||||||
|
material_name_value->SetLabel(new_result.name);
|
||||||
|
|
||||||
|
new_result.tray_id = -1;
|
||||||
|
CalibUtils::set_PA_calib_result({ new_result });
|
||||||
|
|
||||||
|
// TODO Re-request history and refresh page
|
||||||
|
//wxCommandEvent evt(wxEVT_COMBOBOX);
|
||||||
|
//evt.SetEventObject(m_comboBox_nozzle_dia);
|
||||||
|
//wxPostEvent(m_comboBox_nozzle_dia, evt);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
gbSizer->Add(material_name_value, { i, 0 }, { 1, 1 }, wxBOTTOM, FromDIP(15));
|
||||||
|
gbSizer->Add(k_value, { i, 1 }, { 1, 1 }, wxBOTTOM, FromDIP(15));
|
||||||
|
//gbSizer->Add(n_value, { i, 2 }, { 1, 1 }, wxBOTTOM, FromDIP(15));
|
||||||
|
gbSizer->Add(delete_button, { i, 2 }, { 1, 1 }, wxBOTTOM, FromDIP(15));
|
||||||
|
gbSizer->Add(edit_button, { i, 3 }, { 1, 1 }, wxBOTTOM, FromDIP(15));
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
Layout();
|
||||||
|
}
|
||||||
|
|
||||||
|
float HistoryWindow::get_nozzle_value()
|
||||||
|
{
|
||||||
|
double nozzle_value = 0.0;
|
||||||
|
wxString nozzle_value_str = m_comboBox_nozzle_dia->GetValue();
|
||||||
|
try {
|
||||||
|
nozzle_value_str.ToDouble(&nozzle_value);
|
||||||
|
}
|
||||||
|
catch (...) {
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
return nozzle_value;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
EditCalibrationHistoryDialog::EditCalibrationHistoryDialog(wxWindow* parent, const PACalibResult& result)
|
||||||
|
: DPIDialog(parent, wxID_ANY, _L("Edit Pressure Advance"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE)
|
||||||
|
, m_new_result(result)
|
||||||
|
{
|
||||||
|
this->SetBackgroundColour(*wxWHITE);
|
||||||
|
auto main_sizer = new wxBoxSizer(wxVERTICAL);
|
||||||
|
|
||||||
|
auto top_panel = new wxPanel(this);
|
||||||
|
auto panel_sizer = new wxBoxSizer(wxVERTICAL);
|
||||||
|
top_panel->SetSizer(panel_sizer);
|
||||||
|
|
||||||
|
auto flex_sizer = new wxFlexGridSizer(0, 2, FromDIP(15), FromDIP(30));
|
||||||
|
flex_sizer->SetFlexibleDirection(wxBOTH);
|
||||||
|
flex_sizer->SetNonFlexibleGrowMode(wxFLEX_GROWMODE_SPECIFIED);
|
||||||
|
|
||||||
|
wxStaticText* material_name_title = new wxStaticText(top_panel, wxID_ANY, _L("Material"));
|
||||||
|
TextInput* material_name_value = new TextInput(top_panel, m_new_result.name, "", "", wxDefaultPosition, EDIT_HISTORY_DIALOG_INPUT_SIZE, wxTE_PROCESS_ENTER);
|
||||||
|
material_name_value->GetTextCtrl()->Bind(wxEVT_TEXT_ENTER, [this, material_name_value](auto& e) {
|
||||||
|
if (!material_name_value->GetTextCtrl()->GetValue().IsEmpty())
|
||||||
|
m_new_result.name = material_name_value->GetTextCtrl()->GetValue().ToStdString();
|
||||||
|
});
|
||||||
|
material_name_value->GetTextCtrl()->Bind(wxEVT_KILL_FOCUS, [this, material_name_value](auto& e) {
|
||||||
|
if (!material_name_value->GetTextCtrl()->GetValue().IsEmpty())
|
||||||
|
m_new_result.name = material_name_value->GetTextCtrl()->GetValue().ToStdString();
|
||||||
|
e.Skip();
|
||||||
|
});
|
||||||
|
flex_sizer->Add(material_name_title);
|
||||||
|
flex_sizer->Add(material_name_value);
|
||||||
|
|
||||||
|
wxStaticText* k_title = new wxStaticText(top_panel, wxID_ANY, _L("K Factor"));
|
||||||
|
auto k_str = wxString::Format("%.3f", m_new_result.k_value);
|
||||||
|
TextInput* k_value = new TextInput(top_panel, k_str, "", "", wxDefaultPosition, EDIT_HISTORY_DIALOG_INPUT_SIZE, wxTE_PROCESS_ENTER);
|
||||||
|
k_value->GetTextCtrl()->Bind(wxEVT_TEXT_ENTER, [this, k_value](auto& e) {
|
||||||
|
float k = 0.0f;
|
||||||
|
if (!CalibUtils::validate_input_k_value(k_value->GetTextCtrl()->GetValue(), &k)) {
|
||||||
|
MessageDialog msg_dlg(nullptr, _L("Please input a valid value (K in 0~0.5)"), wxEmptyString, wxICON_WARNING | wxOK);
|
||||||
|
msg_dlg.ShowModal();
|
||||||
|
}
|
||||||
|
wxString k_str = wxString::Format("%.3f", k);
|
||||||
|
k_value->GetTextCtrl()->SetValue(k_str);
|
||||||
|
m_new_result.k_value = k;
|
||||||
|
});
|
||||||
|
k_value->GetTextCtrl()->Bind(wxEVT_KILL_FOCUS, [this, k_value](auto& e) {
|
||||||
|
float k = 0.0f;
|
||||||
|
if (!CalibUtils::validate_input_k_value(k_value->GetTextCtrl()->GetValue(), &k)) {
|
||||||
|
MessageDialog msg_dlg(nullptr, _L("Please input a valid value (K in 0~0.5)"), wxEmptyString, wxICON_WARNING | wxOK);
|
||||||
|
msg_dlg.ShowModal();
|
||||||
|
}
|
||||||
|
wxString k_str = wxString::Format("%.3f", k);
|
||||||
|
k_value->GetTextCtrl()->SetValue(k_str);
|
||||||
|
m_new_result.k_value = k;
|
||||||
|
e.Skip();
|
||||||
|
});
|
||||||
|
flex_sizer->Add(k_title);
|
||||||
|
flex_sizer->Add(k_value);
|
||||||
|
|
||||||
|
// Hide:
|
||||||
|
//wxStaticText* n_title = new wxStaticText(top_panel, wxID_ANY, _L("N Factor"));
|
||||||
|
//TextInput* n_value = new TextInput(top_panel, n, "", "", wxDefaultPosition, EDIT_HISTORY_DIALOG_INPUT_SIZE, wxTE_PROCESS_ENTER);
|
||||||
|
//flex_sizer->Add(n_title);
|
||||||
|
//flex_sizer->Add(n_value);
|
||||||
|
|
||||||
|
panel_sizer->Add(flex_sizer);
|
||||||
|
|
||||||
|
panel_sizer->AddSpacer(FromDIP(25));
|
||||||
|
|
||||||
|
auto btn_sizer = new wxBoxSizer(wxHORIZONTAL);
|
||||||
|
Button* save_btn = new Button(top_panel, _L("Save"));
|
||||||
|
StateColor btn_bg_green(std::pair<wxColour, int>(wxColour(27, 136, 68), StateColor::Pressed),
|
||||||
|
std::pair<wxColour, int>(wxColour(61, 203, 115), StateColor::Hovered),
|
||||||
|
std::pair<wxColour, int>(wxColour(0, 174, 66), StateColor::Normal));
|
||||||
|
save_btn->SetBackgroundColour(*wxWHITE);
|
||||||
|
save_btn->SetBackgroundColor(btn_bg_green);
|
||||||
|
save_btn->SetBorderColor(wxColour(0, 174, 66));
|
||||||
|
save_btn->SetTextColor(wxColour("#FFFFFE"));
|
||||||
|
save_btn->SetMinSize(wxSize(-1, FromDIP(24)));
|
||||||
|
save_btn->SetCornerRadius(FromDIP(12));
|
||||||
|
Button* cancel_btn = new Button(top_panel, _L("Cancel"));
|
||||||
|
cancel_btn->SetBackgroundColour(*wxWHITE);
|
||||||
|
cancel_btn->SetMinSize(wxSize(-1, FromDIP(24)));
|
||||||
|
cancel_btn->SetCornerRadius(FromDIP(12));
|
||||||
|
save_btn->Bind(wxEVT_BUTTON, &EditCalibrationHistoryDialog::on_save, this);
|
||||||
|
cancel_btn->Bind(wxEVT_BUTTON, &EditCalibrationHistoryDialog::on_cancel, this);
|
||||||
|
btn_sizer->AddStretchSpacer();
|
||||||
|
btn_sizer->Add(save_btn);
|
||||||
|
btn_sizer->AddSpacer(FromDIP(20));
|
||||||
|
btn_sizer->Add(cancel_btn);
|
||||||
|
panel_sizer->Add(btn_sizer, 0, wxEXPAND, 0);
|
||||||
|
|
||||||
|
|
||||||
|
main_sizer->Add(top_panel, 1, wxEXPAND | wxALL, FromDIP(20));
|
||||||
|
|
||||||
|
SetSizer(main_sizer);
|
||||||
|
Layout();
|
||||||
|
Fit();
|
||||||
|
CenterOnParent();
|
||||||
|
|
||||||
|
wxGetApp().UpdateDlgDarkUI(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
EditCalibrationHistoryDialog::~EditCalibrationHistoryDialog() {
|
||||||
|
}
|
||||||
|
|
||||||
|
PACalibResult EditCalibrationHistoryDialog::get_result() {
|
||||||
|
return m_new_result;
|
||||||
|
}
|
||||||
|
|
||||||
|
void EditCalibrationHistoryDialog::on_save(wxCommandEvent& event) {
|
||||||
|
EndModal(wxID_OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
void EditCalibrationHistoryDialog::on_cancel(wxCommandEvent& event) {
|
||||||
|
EndModal(wxID_CANCEL);
|
||||||
|
}
|
||||||
|
|
||||||
|
void EditCalibrationHistoryDialog::on_dpi_changed(const wxRect& suggested_rect)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace GUI
|
||||||
|
} // namespace Slic3r
|
57
src/slic3r/GUI/CaliHistoryDialog.hpp
Normal file
|
@ -0,0 +1,57 @@
|
||||||
|
#ifndef slic3r_GUI_CaliHistory_hpp_
|
||||||
|
#define slic3r_GUI_CaliHistory_hpp_
|
||||||
|
|
||||||
|
#include "GUI_Utils.hpp"
|
||||||
|
#include "wxExtensions.hpp"
|
||||||
|
#include "Widgets/ComboBox.hpp"
|
||||||
|
#include "DeviceManager.hpp"
|
||||||
|
|
||||||
|
namespace Slic3r {
|
||||||
|
namespace GUI {
|
||||||
|
|
||||||
|
class HistoryWindow : public DPIDialog {
|
||||||
|
public:
|
||||||
|
HistoryWindow(wxWindow* parent, const std::vector<PACalibResult>& calib_results_history);
|
||||||
|
~HistoryWindow();
|
||||||
|
void on_dpi_changed(const wxRect& suggested_rect) {}
|
||||||
|
void on_select_nozzle(wxCommandEvent& evt);
|
||||||
|
void reqeust_history_result(MachineObject* obj);
|
||||||
|
void sync_history_result(MachineObject* obj);
|
||||||
|
void on_device_connected(MachineObject* obj);
|
||||||
|
void on_timer(wxTimerEvent& event);
|
||||||
|
void update(MachineObject* obj);
|
||||||
|
protected:
|
||||||
|
void sync_history_data();
|
||||||
|
float get_nozzle_value();
|
||||||
|
|
||||||
|
wxPanel* m_history_data_panel;
|
||||||
|
ComboBox* m_comboBox_nozzle_dia;
|
||||||
|
wxStaticText* m_tips;
|
||||||
|
|
||||||
|
wxTimer* m_refresh_timer { nullptr };
|
||||||
|
|
||||||
|
std::vector<PACalibResult> m_calib_results_history;
|
||||||
|
MachineObject* curr_obj { nullptr };
|
||||||
|
int history_version = -1;
|
||||||
|
};
|
||||||
|
|
||||||
|
class EditCalibrationHistoryDialog : public DPIDialog
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
EditCalibrationHistoryDialog(wxWindow* parent, const PACalibResult& result);
|
||||||
|
~EditCalibrationHistoryDialog();
|
||||||
|
void on_dpi_changed(const wxRect& suggested_rect) override;
|
||||||
|
PACalibResult get_result();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual void on_save(wxCommandEvent& event);
|
||||||
|
virtual void on_cancel(wxCommandEvent& event);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
PACalibResult m_new_result;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace GUI
|
||||||
|
} // namespace Slic3r
|
||||||
|
|
||||||
|
#endif
|
|
@ -459,20 +459,19 @@ CalibrationPanel::CalibrationPanel(wxWindow* parent, wxWindowID id, const wxPoin
|
||||||
|
|
||||||
void CalibrationPanel::init_tabpanel() {
|
void CalibrationPanel::init_tabpanel() {
|
||||||
m_side_tools = new SideTools(this, wxID_ANY);
|
m_side_tools = new SideTools(this, wxID_ANY);
|
||||||
m_side_tools->Connect(wxEVT_LEFT_DOWN, wxMouseEventHandler(CalibrationPanel::on_printer_clicked), NULL, this);
|
m_side_tools->get_panel()->Connect(wxEVT_LEFT_DOWN, wxMouseEventHandler(CalibrationPanel::on_printer_clicked), NULL, this);
|
||||||
|
|
||||||
|
|
||||||
wxBoxSizer* sizer_side_tools = new wxBoxSizer(wxVERTICAL);
|
wxBoxSizer* sizer_side_tools = new wxBoxSizer(wxVERTICAL);
|
||||||
sizer_side_tools->Add(m_side_tools, 1, wxEXPAND, 0);
|
sizer_side_tools->Add(m_side_tools, 1, wxEXPAND, 0);
|
||||||
|
|
||||||
m_tabpanel = new Tabbook(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, sizer_side_tools, wxNB_LEFT | wxTAB_TRAVERSAL | wxNB_NOPAGETHEME);
|
m_tabpanel = new Tabbook(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, sizer_side_tools, wxNB_LEFT | wxTAB_TRAVERSAL | wxNB_NOPAGETHEME);
|
||||||
|
m_side_tools->set_table_panel(m_tabpanel);
|
||||||
m_tabpanel->SetBackgroundColour(*wxWHITE);
|
m_tabpanel->SetBackgroundColour(*wxWHITE);
|
||||||
|
|
||||||
m_cali_panels[0] = new PressureAdvanceWizard(m_tabpanel);
|
m_cali_panels[0] = new PressureAdvanceWizard(m_tabpanel);
|
||||||
m_cali_panels[1] = new FlowRateWizard(m_tabpanel);
|
m_cali_panels[1] = new FlowRateWizard(m_tabpanel);
|
||||||
m_cali_panels[2] = new MaxVolumetricSpeedWizard(m_tabpanel);
|
m_cali_panels[2] = new MaxVolumetricSpeedWizard(m_tabpanel);
|
||||||
//m_cali_panels[3] = new TemperatureWizard(m_tabpanel);
|
|
||||||
//m_cali_panels[4] = new RetractionWizard(m_tabpanel);
|
|
||||||
|
|
||||||
for (int i = 0; i < (int)CALI_MODE_COUNT; i++) {
|
for (int i = 0; i < (int)CALI_MODE_COUNT; i++) {
|
||||||
bool selected = false;
|
bool selected = false;
|
||||||
|
@ -487,11 +486,7 @@ void CalibrationPanel::init_tabpanel() {
|
||||||
for (int i = 0; i < (int)CALI_MODE_COUNT; i++)
|
for (int i = 0; i < (int)CALI_MODE_COUNT; i++)
|
||||||
m_tabpanel->SetPageImage(i, "");
|
m_tabpanel->SetPageImage(i, "");
|
||||||
|
|
||||||
m_tabpanel->Bind(wxEVT_BOOKCTRL_PAGE_CHANGED, [this](wxBookCtrlEvent&) {
|
m_initialized = true;
|
||||||
wxCommandEvent e (EVT_CALIBRATION_TAB_CHANGED);
|
|
||||||
e.SetEventObject(m_tabpanel->GetCurrentPage());
|
|
||||||
wxPostEvent(m_tabpanel->GetCurrentPage(), e);
|
|
||||||
}, m_tabpanel->GetId());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CalibrationPanel::init_timer()
|
void CalibrationPanel::init_timer()
|
||||||
|
@ -507,60 +502,137 @@ void CalibrationPanel::on_timer(wxTimerEvent& event) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void CalibrationPanel::update_print_error_info(int code, std::string msg, std::string extra) {
|
void CalibrationPanel::update_print_error_info(int code, std::string msg, std::string extra) {
|
||||||
for (int i = 0; i < m_tabpanel->GetPageCount(); i++) {
|
// update current wizard only
|
||||||
if(m_tabpanel->GetPage(i))
|
int curr_selected = m_tabpanel->GetSelection();
|
||||||
static_cast<CalibrationWizard*>(m_tabpanel->GetPage(i))->update_print_error_info(code, msg, extra);
|
if (curr_selected >= 0 && curr_selected < CALI_MODE_COUNT) {
|
||||||
|
if (m_cali_panels[curr_selected]) {
|
||||||
|
auto page = m_cali_panels[curr_selected]->get_curr_step()->page;
|
||||||
|
if(page && page->get_page_type() == CaliPageType::CALI_PAGE_PRESET){
|
||||||
|
auto preset_page = static_cast<CalibrationPresetPage*>(page);
|
||||||
|
if (preset_page->get_page_status() == CaliPresetPageStatus::CaliPresetStatusSending)
|
||||||
|
preset_page->update_print_error_info(code, msg, extra);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CalibrationPanel::update_all() {
|
void CalibrationPanel::update_all() {
|
||||||
for (int i = 0; i < (int)CALI_MODE_COUNT; i++) {
|
|
||||||
m_cali_panels[i]->update_printer();
|
|
||||||
if (m_cali_panels[i]->IsShown())
|
|
||||||
m_cali_panels[i]->update_print_progress();
|
|
||||||
}
|
|
||||||
|
|
||||||
NetworkAgent* m_agent = wxGetApp().getAgent();
|
NetworkAgent* m_agent = wxGetApp().getAgent();
|
||||||
Slic3r::DeviceManager* dev = Slic3r::GUI::wxGetApp().getDeviceManager();
|
Slic3r::DeviceManager* dev = Slic3r::GUI::wxGetApp().getDeviceManager();
|
||||||
if (!dev)
|
if (!dev) return;
|
||||||
|
obj = dev->get_selected_machine();
|
||||||
|
|
||||||
|
// update current wizard only
|
||||||
|
int curr_selected = m_tabpanel->GetSelection();
|
||||||
|
|
||||||
|
if (curr_selected >= 0 && curr_selected < CALI_MODE_COUNT) {
|
||||||
|
if (m_cali_panels[curr_selected])
|
||||||
|
m_cali_panels[curr_selected]->update(obj);
|
||||||
|
}
|
||||||
|
|
||||||
|
// check valid machine
|
||||||
|
if (obj && dev->get_my_machine(obj->dev_id) == nullptr) {
|
||||||
|
dev->set_selected_machine("");
|
||||||
|
if (m_agent)
|
||||||
|
m_agent->set_user_selected_machine("");
|
||||||
|
show_status((int)MONITOR_NO_PRINTER);
|
||||||
return;
|
return;
|
||||||
MachineObject* obj = dev->get_selected_machine();
|
}
|
||||||
|
|
||||||
|
if (wxGetApp().is_user_login()) {
|
||||||
|
dev->check_pushing();
|
||||||
|
try {
|
||||||
|
m_agent->refresh_connection();
|
||||||
|
}
|
||||||
|
catch (...) {
|
||||||
|
;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (obj) {
|
||||||
|
wxGetApp().reset_to_active();
|
||||||
|
if (obj->connection_type() != last_conn_type) {
|
||||||
|
last_conn_type = obj->connection_type();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
m_side_tools->update_status(obj);
|
||||||
|
|
||||||
if (!obj) {
|
if (!obj) {
|
||||||
m_side_tools->set_none_printer_mode();
|
show_status((int)MONITOR_NO_PRINTER);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Update Device Info */
|
if (obj->is_connecting()) {
|
||||||
m_side_tools->set_current_printer_name(obj->dev_name);
|
show_status(MONITOR_CONNECTING);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else if (!obj->is_connected()) {
|
||||||
|
int server_status = 0;
|
||||||
|
// only disconnected server in cloud mode
|
||||||
|
if (obj->connection_type() != "lan") {
|
||||||
|
if (m_agent) {
|
||||||
|
server_status = m_agent->is_server_connected() ? 0 : (int)MONITOR_DISCONNECTED_SERVER;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
show_status((int)MONITOR_DISCONNECTED + server_status);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// update wifi signal image
|
show_status(MONITOR_NORMAL);
|
||||||
int wifi_signal_val = 0;
|
}
|
||||||
if (!obj->is_connected() || obj->is_connecting()) {
|
|
||||||
m_side_tools->set_current_printer_signal(WifiSignal::NONE);
|
void CalibrationPanel::show_status(int status)
|
||||||
}
|
{
|
||||||
else {
|
if (!m_initialized) return;
|
||||||
if (!obj->wifi_signal.empty() && boost::ends_with(obj->wifi_signal, "dBm")) {
|
if (last_status == status)return;
|
||||||
try {
|
if (last_status & (int)MonitorStatus::MONITOR_CONNECTING != 0) {
|
||||||
wifi_signal_val = std::stoi(obj->wifi_signal.substr(0, obj->wifi_signal.size() - 3));
|
NetworkAgent* agent = wxGetApp().getAgent();
|
||||||
}
|
json j;
|
||||||
catch (...) {
|
j["dev_id"] = obj ? obj->dev_id : "obj_nullptr";
|
||||||
;
|
if (status & (int)MonitorStatus::MONITOR_DISCONNECTED != 0) {
|
||||||
}
|
j["result"] = "failed";
|
||||||
if (wifi_signal_val > -45) {
|
if (agent) {
|
||||||
m_side_tools->set_current_printer_signal(WifiSignal::STRONG);
|
agent->track_event("connect_dev", j.dump());
|
||||||
}
|
|
||||||
else if (wifi_signal_val <= -45 && wifi_signal_val >= -60) {
|
|
||||||
m_side_tools->set_current_printer_signal(WifiSignal::MIDDLE);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
m_side_tools->set_current_printer_signal(WifiSignal::WEAK);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else if (status & (int)MonitorStatus::MONITOR_NORMAL != 0) {
|
||||||
m_side_tools->set_current_printer_signal(WifiSignal::MIDDLE);
|
j["result"] = "success";
|
||||||
|
if (agent) {
|
||||||
|
agent->track_event("connect_dev", j.dump());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
last_status = status;
|
||||||
|
|
||||||
|
BOOST_LOG_TRIVIAL(info) << "monitor: show_status = " << status;
|
||||||
|
|
||||||
|
|
||||||
|
Freeze();
|
||||||
|
// update panels
|
||||||
|
if (m_side_tools) { m_side_tools->show_status(status); };
|
||||||
|
|
||||||
|
if ((status & (int)MonitorStatus::MONITOR_NO_PRINTER) != 0) {
|
||||||
|
set_default();
|
||||||
|
m_tabpanel->Layout();
|
||||||
|
}
|
||||||
|
else if (((status & (int)MonitorStatus::MONITOR_NORMAL) != 0)
|
||||||
|
|| ((status & (int)MonitorStatus::MONITOR_DISCONNECTED) != 0)
|
||||||
|
|| ((status & (int)MonitorStatus::MONITOR_DISCONNECTED_SERVER) != 0)
|
||||||
|
|| ((status & (int)MonitorStatus::MONITOR_CONNECTING) != 0))
|
||||||
|
{
|
||||||
|
|
||||||
|
if (((status & (int)MonitorStatus::MONITOR_DISCONNECTED) != 0)
|
||||||
|
|| ((status & (int)MonitorStatus::MONITOR_DISCONNECTED_SERVER) != 0)
|
||||||
|
|| ((status & (int)MonitorStatus::MONITOR_CONNECTING) != 0))
|
||||||
|
{
|
||||||
|
set_default();
|
||||||
|
}
|
||||||
|
m_tabpanel->Layout();
|
||||||
|
}
|
||||||
|
Layout();
|
||||||
|
Thaw();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CalibrationPanel::Show(bool show) {
|
bool CalibrationPanel::Show(bool show) {
|
||||||
|
@ -596,8 +668,15 @@ void CalibrationPanel::on_printer_clicked(wxMouseEvent& event)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CalibrationPanel::set_default()
|
||||||
|
{
|
||||||
|
obj = nullptr;
|
||||||
|
last_conn_type = "undefined";
|
||||||
|
wxGetApp().sidebar().load_ams_list({}, {});
|
||||||
|
}
|
||||||
|
|
||||||
CalibrationPanel::~CalibrationPanel() {
|
CalibrationPanel::~CalibrationPanel() {
|
||||||
m_side_tools->Disconnect(wxEVT_LEFT_DOWN, wxMouseEventHandler(CalibrationPanel::on_printer_clicked), NULL, this);
|
m_side_tools->get_panel()->Disconnect(wxEVT_LEFT_DOWN, wxMouseEventHandler(CalibrationPanel::on_printer_clicked), NULL, this);
|
||||||
if (m_refresh_timer)
|
if (m_refresh_timer)
|
||||||
m_refresh_timer->Stop();
|
m_refresh_timer->Stop();
|
||||||
delete m_refresh_timer;
|
delete m_refresh_timer;
|
||||||
|
|
|
@ -86,7 +86,7 @@ private:
|
||||||
wxBoxSizer* m_sizer_my_devices{ nullptr };
|
wxBoxSizer* m_sizer_my_devices{ nullptr };
|
||||||
wxScrolledWindow* m_scrolledWindow{ nullptr };
|
wxScrolledWindow* m_scrolledWindow{ nullptr };
|
||||||
wxTimer* m_refresh_timer{ nullptr };
|
wxTimer* m_refresh_timer{ nullptr };
|
||||||
std::vector<MPanel*> m_user_list_machine_panel;
|
std::vector<MPanel*> m_user_list_machine_panel;
|
||||||
boost::thread* get_print_info_thread{ nullptr };
|
boost::thread* get_print_info_thread{ nullptr };
|
||||||
std::string m_print_info;
|
std::string m_print_info;
|
||||||
std::map<std::string, MachineObject*> m_bind_machine_list;
|
std::map<std::string, MachineObject*> m_bind_machine_list;
|
||||||
|
@ -107,21 +107,25 @@ public:
|
||||||
Tabbook* get_tabpanel() { return m_tabpanel; };
|
Tabbook* get_tabpanel() { return m_tabpanel; };
|
||||||
void update_print_error_info(int code, std::string msg, std::string extra);
|
void update_print_error_info(int code, std::string msg, std::string extra);
|
||||||
void update_all();
|
void update_all();
|
||||||
|
void show_status(int status);
|
||||||
bool Show(bool show);
|
bool Show(bool show);
|
||||||
void on_printer_clicked(wxMouseEvent& event);
|
void on_printer_clicked(wxMouseEvent& event);
|
||||||
|
void set_default();
|
||||||
protected:
|
protected:
|
||||||
void init_tabpanel();
|
void init_tabpanel();
|
||||||
void init_timer();
|
void init_timer();
|
||||||
void on_timer(wxTimerEvent& event);
|
void on_timer(wxTimerEvent& event);
|
||||||
|
|
||||||
private:
|
|
||||||
SideTools* m_side_tools{ nullptr };
|
|
||||||
Tabbook* m_tabpanel{ nullptr };
|
|
||||||
SelectMObjectPopup m_mobjectlist_popup;
|
|
||||||
|
|
||||||
CalibrationWizard* m_cali_panels[CALI_MODE_COUNT];
|
int last_status;
|
||||||
|
bool m_initialized { false };
|
||||||
wxTimer* m_refresh_timer = nullptr;
|
std::string last_conn_type = "undedefined";
|
||||||
|
MachineObject* obj{ nullptr };
|
||||||
|
SideTools* m_side_tools{ nullptr };
|
||||||
|
Tabbook* m_tabpanel{ nullptr };
|
||||||
|
SelectMObjectPopup m_mobjectlist_popup;
|
||||||
|
CalibrationWizard* m_cali_panels[CALI_MODE_COUNT];
|
||||||
|
wxTimer* m_refresh_timer = nullptr;
|
||||||
};
|
};
|
||||||
}} // namespace Slic3r::GUI
|
}} // namespace Slic3r::GUI
|
||||||
|
|
||||||
|
|
|
@ -1,445 +1,165 @@
|
||||||
#ifndef slic3r_GUI_CalibrationWizard_hpp_
|
#ifndef slic3r_GUI_CalibrationWizard_hpp_
|
||||||
#define slic3r_GUI_CalibrationWizard_hpp_
|
#define slic3r_GUI_CalibrationWizard_hpp_
|
||||||
|
|
||||||
|
#include "../slic3r/Utils/CalibUtils.hpp"
|
||||||
|
|
||||||
#include "DeviceManager.hpp"
|
#include "DeviceManager.hpp"
|
||||||
#include "CalibrationWizardPage.hpp"
|
#include "CalibrationWizardPage.hpp"
|
||||||
#include "Widgets/ComboBox.hpp"
|
#include "CalibrationWizardStartPage.hpp"
|
||||||
#include "Widgets/TextInput.hpp"
|
#include "CalibrationWizardPresetPage.hpp"
|
||||||
#include "Widgets/AMSControl.hpp"
|
#include "CalibrationWizardCaliPage.hpp"
|
||||||
#include "Widgets/ProgressBar.hpp"
|
#include "CalibrationWizardSavePage.hpp"
|
||||||
#include "SavePresetDialog.hpp"
|
|
||||||
#include "PresetComboBoxes.hpp"
|
|
||||||
#include "EditCalibrationHistoryDialog.hpp"
|
|
||||||
#include "../slic3r/Utils/CalibUtils.hpp"
|
|
||||||
|
|
||||||
namespace Slic3r { namespace GUI {
|
namespace Slic3r { namespace GUI {
|
||||||
|
|
||||||
wxDECLARE_EVENT(EVT_CALIBRATION_TRAY_SELECTION_CHANGED, SimpleEvent);
|
|
||||||
wxDECLARE_EVENT(EVT_CALIBRATION_NOTIFY_CHANGE_PAGES, SimpleEvent);
|
|
||||||
wxDECLARE_EVENT(EVT_CALIBRATION_TAB_CHANGED, wxCommandEvent);
|
|
||||||
|
|
||||||
enum FilamentSelectMode {
|
class CalibrationWizardPageStep
|
||||||
FSMCheckBoxMode,
|
|
||||||
FSMRadioMode
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
wxString get_calibration_wiki_page(CalibMode cali_mode);
|
|
||||||
|
|
||||||
class FilamentComboBox : public wxPanel
|
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
FilamentComboBox(wxWindow* parent, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize);
|
CalibrationWizardPageStep(CalibrationWizardPage* data) {
|
||||||
~FilamentComboBox() {};
|
page = data;
|
||||||
|
}
|
||||||
void set_select_mode(FilamentSelectMode mode);
|
|
||||||
FilamentSelectMode get_select_mode() { return m_mode; }
|
CalibrationWizardPageStep* prev { nullptr };
|
||||||
void load_tray_from_ams(int id, DynamicPrintConfig& tray);
|
CalibrationWizardPageStep* next { nullptr };
|
||||||
void update_from_preset();
|
CalibrationWizardPage* page { nullptr };
|
||||||
int get_tray_id() { return m_tray_id; }
|
void chain(CalibrationWizardPageStep* step) {
|
||||||
bool is_bbl_filament() { return m_is_bbl_filamnet; }
|
if (!step) return;
|
||||||
std::string get_tray_name() { return m_tray_name; }
|
this->next = step;
|
||||||
CalibrateFilamentComboBox* GetComboBox() { return m_comboBox; }
|
step->prev = this;
|
||||||
CheckBox* GetCheckBox() { return m_checkBox; }
|
}
|
||||||
void SetCheckBox(CheckBox* cb) { m_checkBox = cb; }
|
|
||||||
wxRadioButton* GetRadioBox() { return m_radioBox; }
|
|
||||||
void SetRadioBox(wxRadioButton* btn) { m_radioBox = btn; }
|
|
||||||
virtual bool Show(bool show = true);
|
|
||||||
virtual bool Enable(bool enable);
|
|
||||||
virtual void SetValue(bool value, bool send_event = true);
|
|
||||||
|
|
||||||
protected:
|
|
||||||
int m_tray_id;
|
|
||||||
std::string m_tray_name;
|
|
||||||
bool m_is_bbl_filamnet{ false };
|
|
||||||
|
|
||||||
CheckBox* m_checkBox{nullptr};
|
|
||||||
//RadioBox* m_radioBox;
|
|
||||||
wxRadioButton* m_radioBox{ nullptr };
|
|
||||||
CalibrateFilamentComboBox* m_comboBox{ nullptr };
|
|
||||||
FilamentSelectMode m_mode{ FSMRadioMode };
|
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef std::vector<FilamentComboBox*> FilamentComboBoxList;
|
|
||||||
|
|
||||||
class CalibrationWizard : public wxPanel {
|
class CalibrationWizard : public wxPanel {
|
||||||
public:
|
public:
|
||||||
CalibrationWizard(wxWindow* parent, CalibMode mode, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxTAB_TRAVERSAL);
|
CalibrationWizard(wxWindow* parent, CalibMode mode,
|
||||||
~CalibrationWizard() {};
|
wxWindowID id = wxID_ANY,
|
||||||
CalibrationWizardPage* get_curr_page() { return m_curr_page; }
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
CalibrationWizardPage* get_frist_page() { return m_first_page; }
|
const wxSize& size = wxDefaultSize,
|
||||||
void show_page(CalibrationWizardPage* page);
|
long style = wxTAB_TRAVERSAL);
|
||||||
void update_print_error_info(int code, std::string msg, std::string extra);
|
|
||||||
void show_send_progress_bar(bool show);
|
~CalibrationWizard();
|
||||||
void update_printer();
|
|
||||||
void update_print_progress();
|
void on_cali_job_finished(wxCommandEvent& event);
|
||||||
|
|
||||||
|
virtual void on_cali_job_finished() {}
|
||||||
|
|
||||||
|
CalibrationWizardPageStep* get_curr_step() { return m_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) {
|
||||||
|
m_cali_style = style;
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void set_cali_method(CalibrationMethod method);
|
||||||
|
|
||||||
CalibMode get_calibration_mode() { return m_mode; }
|
CalibMode get_calibration_mode() { return m_mode; }
|
||||||
|
|
||||||
protected:
|
bool save_preset(const std::string &old_preset_name, const std::string &new_preset_name, const std::map<std::string, ConfigOption *> &key_values, std::string& message);
|
||||||
virtual CalibrationWizardPage* create_start_page() { return nullptr; }
|
|
||||||
virtual CalibrationWizardPage* create_presets_page(bool need_custom_range);
|
|
||||||
virtual CalibrationWizardPage* create_print_page();
|
|
||||||
virtual CalibrationWizardPage* create_save_page();
|
|
||||||
virtual void create_save_panel_content(wxBoxSizer* sizer) {}
|
|
||||||
virtual void create_pages() = 0;
|
|
||||||
virtual bool start_calibration(std::vector<int> tray_ids) = 0;
|
|
||||||
virtual bool save_calibration_result() = 0;
|
|
||||||
virtual bool recommend_input_value();
|
|
||||||
virtual void set_save_name() {};
|
|
||||||
virtual void request_calib_result() {};
|
|
||||||
virtual void jump_to_page(PageType page_type);
|
|
||||||
virtual void change_ams_select_mode() {};
|
|
||||||
virtual void init_bitmaps();
|
|
||||||
virtual void check_sync_printer_status() {};
|
|
||||||
|
|
||||||
private:
|
|
||||||
ScalableBitmap m_bitmap_pause;
|
|
||||||
ScalableBitmap m_bitmap_pause_hover;
|
|
||||||
ScalableBitmap m_bitmap_resume;
|
|
||||||
ScalableBitmap m_bitmap_resume_hover;
|
|
||||||
ScalableBitmap m_bitmap_pause_disable;
|
|
||||||
ScalableBitmap m_bitmap_resume_disable;
|
|
||||||
ScalableBitmap m_bitmap_abort;
|
|
||||||
ScalableBitmap m_bitmap_abort_hover;
|
|
||||||
ScalableBitmap m_bitmap_abort_disable;
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
wxString m_wiki_url;
|
void on_cali_go_home();
|
||||||
|
|
||||||
std::map<std::string, PrinterCaliInfo> m_printer_calib_infos;
|
|
||||||
bool is_between_start_and_runing = false;
|
|
||||||
CalibMode m_mode;
|
|
||||||
MachineObject* curr_obj{ nullptr };
|
|
||||||
|
|
||||||
|
protected:
|
||||||
|
/* wx widgets*/
|
||||||
wxScrolledWindow* m_scrolledWindow;
|
wxScrolledWindow* m_scrolledWindow;
|
||||||
wxBoxSizer* m_all_pages_sizer;
|
wxBoxSizer* m_all_pages_sizer;
|
||||||
|
|
||||||
CalibrationWizardPage* m_curr_page{ nullptr };
|
CalibMode m_mode;
|
||||||
CalibrationWizardPage* m_first_page{ nullptr };
|
CalibrationStyle m_cali_style;
|
||||||
|
CalibrationMethod m_cali_method { CalibrationMethod::CALI_METHOD_MANUAL };
|
||||||
|
MachineObject* curr_obj { nullptr };
|
||||||
|
MachineObject* last_obj { nullptr };
|
||||||
|
|
||||||
// preset panel
|
CalibrationWizardPageStep* m_curr_step { nullptr };
|
||||||
wxPanel* m_presets_panel;
|
|
||||||
wxPanel* m_select_ams_mode_panel;
|
|
||||||
//RadioBox* m_ams_radiobox;
|
|
||||||
//RadioBox* m_ext_spool_radiobox;
|
|
||||||
wxRadioButton* m_ams_radiobox;
|
|
||||||
wxRadioButton* m_ext_spool_radiobox;
|
|
||||||
bool m_filament_from_ext_spool{ false };
|
|
||||||
wxPanel* m_muilti_ams_panel;
|
|
||||||
std::vector<AMSItem*> m_ams_item_list;
|
|
||||||
wxPanel* m_filament_list_panel;
|
|
||||||
ScalableButton* m_ams_sync_button;
|
|
||||||
FilamentComboBoxList m_filament_comboBox_list;
|
|
||||||
wxPanel* m_virtual_panel;
|
|
||||||
FilamentComboBox* m_virtual_tray_comboBox;
|
|
||||||
ComboBox* m_comboBox_nozzle_dia;
|
|
||||||
ComboBox* m_comboBox_bed_type;
|
|
||||||
ComboBox* m_comboBox_process;
|
|
||||||
Preset* m_printer_preset{nullptr};
|
|
||||||
//Preset* m_filament_preset{ nullptr };
|
|
||||||
std::map<int, Preset*> m_filament_presets;
|
|
||||||
Preset* m_print_preset{ nullptr };
|
|
||||||
wxStaticText* m_from_text;
|
|
||||||
wxStaticText* m_to_text;
|
|
||||||
wxStaticText* m_step_text;
|
|
||||||
TextInput* m_from_value;
|
|
||||||
TextInput* m_to_value;
|
|
||||||
TextInput* m_step;
|
|
||||||
TextInput* m_nozzle_temp;
|
|
||||||
TextInput* m_bed_temp;
|
|
||||||
TextInput* m_max_volumetric_speed;
|
|
||||||
wxStaticText* m_filaments_incompatible_tips;
|
|
||||||
wxStaticText* m_bed_type_incompatible_tips;
|
|
||||||
wxPanel* m_send_progress_panel;
|
|
||||||
// send bar
|
|
||||||
std::shared_ptr<BBLStatusBarSend> m_send_progress_bar;
|
|
||||||
wxScrolledWindow* m_sw_print_failed_info{ nullptr };
|
|
||||||
int m_print_error_code;
|
|
||||||
std::string m_print_error_msg;
|
|
||||||
std::string m_print_error_extra;
|
|
||||||
Label* m_st_txt_error_code{ nullptr };
|
|
||||||
Label* m_st_txt_error_desc{ nullptr };
|
|
||||||
Label* m_st_txt_extra_info{ nullptr };
|
|
||||||
|
|
||||||
// print panel
|
CalibrationWizardPageStep* start_step { nullptr };
|
||||||
wxPanel* m_print_panel;
|
CalibrationWizardPageStep* preset_step { nullptr };
|
||||||
wxStaticBitmap* m_print_picture;
|
CalibrationWizardPageStep* cali_step { nullptr };
|
||||||
wxStaticText* m_staticText_profile_value;
|
CalibrationWizardPageStep* save_step { nullptr };
|
||||||
wxStaticText* m_printing_stage_value;
|
|
||||||
wxStaticText* m_staticText_progress_percent;
|
CalibrationWizardPageStep* cali_coarse_step { nullptr };
|
||||||
wxStaticText* m_staticText_progress_left_time;
|
CalibrationWizardPageStep* coarse_save_step { nullptr };
|
||||||
wxStaticText* m_staticText_layers;
|
CalibrationWizardPageStep* cali_fine_step { nullptr };
|
||||||
ScalableButton* m_button_pause_resume;
|
CalibrationWizardPageStep* fine_save_step { nullptr };
|
||||||
ScalableButton* m_button_abort;
|
|
||||||
ProgressBar* m_print_gauge_progress; // for print
|
|
||||||
PageButton* m_btn_recali;
|
|
||||||
PageButton* m_btn_next;
|
|
||||||
|
|
||||||
// save panel
|
/* save steps of calibration pages */
|
||||||
wxPanel* m_save_panel;
|
std::vector<CalibrationWizardPageStep*> m_page_steps;
|
||||||
|
|
||||||
void init_printer_calib_info_from_appconfig();
|
SecondaryCheckDialog *go_home_dialog = nullptr;
|
||||||
void save_to_printer_calib_info(PageType page_type);
|
|
||||||
|
|
||||||
// preset
|
|
||||||
void init_presets_selections();
|
|
||||||
void init_nozzle_selections();
|
|
||||||
void init_bed_type_selections();
|
|
||||||
void init_process_selections();
|
|
||||||
void check_has_ams(MachineObject * obj);
|
|
||||||
int get_bed_temp(DynamicPrintConfig* config);
|
|
||||||
FilamentSelectMode get_ams_select_mode() { if (!m_filament_comboBox_list.empty()) return m_filament_comboBox_list[0]->get_select_mode(); return FilamentSelectMode::FSMRadioMode; }
|
|
||||||
void set_ams_select_mode(FilamentSelectMode mode);
|
|
||||||
std::vector<int> get_selected_tray();
|
|
||||||
void set_selected_tray(const std::vector<int>& tray_ids);
|
|
||||||
FilamentComboBoxList get_selected_filament_comboBox();
|
|
||||||
void show_send_failed_info(bool show, int code = 0, wxString description = wxEmptyString, wxString extra = wxEmptyString);
|
|
||||||
void reset_preset_page();
|
|
||||||
|
|
||||||
// print
|
|
||||||
void reset_printing_values();
|
|
||||||
|
|
||||||
// save
|
|
||||||
bool save_presets(Preset* preset, const std::string& config_key, ConfigOption* config_value, const std::string& name, std::string& message);
|
|
||||||
|
|
||||||
// event handlers
|
|
||||||
void on_select_nozzle(wxCommandEvent& evt);
|
|
||||||
void on_select_tray(SimpleEvent& evt);
|
|
||||||
void on_select_bed_type(wxCommandEvent& evt);
|
|
||||||
void on_click_btn_prev(IntEvent& event);
|
|
||||||
void on_click_btn_next(IntEvent& event);
|
|
||||||
void on_subtask_abort(wxCommandEvent& event);
|
|
||||||
void on_subtask_pause_resume(wxCommandEvent& event);
|
|
||||||
void on_choose_ams(wxCommandEvent& event);
|
|
||||||
void on_choose_ext_spool(wxCommandEvent& event);
|
|
||||||
void on_update_ams_filament(bool dialog = true);
|
|
||||||
void on_switch_ams(std::string ams_id);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class HistoryWindow : public DPIDialog {
|
class PressureAdvanceWizard : public CalibrationWizard {
|
||||||
public:
|
|
||||||
HistoryWindow(wxWindow* parent);
|
|
||||||
~HistoryWindow() {};
|
|
||||||
void on_dpi_changed(const wxRect& suggested_rect) {}
|
|
||||||
void create();
|
|
||||||
|
|
||||||
wxPanel* m_history_data_panel;
|
|
||||||
};
|
|
||||||
|
|
||||||
class PressureAdvanceWizard : public CalibrationWizard{
|
|
||||||
public:
|
public:
|
||||||
PressureAdvanceWizard(wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxTAB_TRAVERSAL);
|
PressureAdvanceWizard(wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxTAB_TRAVERSAL);
|
||||||
~PressureAdvanceWizard() {};
|
~PressureAdvanceWizard() {};
|
||||||
protected:
|
protected:
|
||||||
virtual CalibrationWizardPage* create_start_page() override;
|
void create_pages();
|
||||||
void create_history_window();
|
|
||||||
virtual void create_pages() override;
|
|
||||||
virtual void create_save_panel_content(wxBoxSizer* sizer) override;
|
|
||||||
virtual bool start_calibration(std::vector<int> tray_ids) override;
|
|
||||||
virtual bool save_calibration_result() override;
|
|
||||||
virtual bool recommend_input_value() override;
|
|
||||||
virtual void request_calib_result() override;
|
|
||||||
virtual void change_ams_select_mode() override;
|
|
||||||
virtual void init_bitmaps() override;
|
|
||||||
virtual void check_sync_printer_status() override;
|
|
||||||
|
|
||||||
void sync_history_window_data();
|
void on_cali_start();
|
||||||
void sync_save_page_data();
|
|
||||||
void switch_pages(SimpleEvent& evt);
|
|
||||||
private:
|
|
||||||
// history page
|
|
||||||
HistoryWindow* m_history_page{ nullptr };
|
|
||||||
|
|
||||||
// start page
|
void on_cali_save();
|
||||||
CalibrationWizardPage* m_page0{ nullptr };
|
|
||||||
|
|
||||||
// preset page
|
void on_cali_action(wxCommandEvent& evt);
|
||||||
CalibrationWizardPage* m_page1{ nullptr };
|
|
||||||
|
|
||||||
// print page
|
void update(MachineObject* obj) override;
|
||||||
CalibrationWizardPage* m_page2{ nullptr };
|
|
||||||
|
|
||||||
// save page
|
void on_device_connected(MachineObject* obj) override;
|
||||||
CalibrationWizardPage* m_page3{ nullptr };
|
|
||||||
wxStaticBitmap* m_record_picture;
|
|
||||||
wxPanel* m_low_end_save_panel;
|
|
||||||
TextInput* m_k_val;
|
|
||||||
TextInput* m_n_val;
|
|
||||||
|
|
||||||
wxPanel* m_high_end_save_panel;
|
|
||||||
std::vector<PACalibResult> m_calib_results;
|
|
||||||
std::vector<PACalibResult> m_calib_results_history;
|
std::vector<PACalibResult> m_calib_results_history;
|
||||||
wxPanel* m_grid_panel;
|
|
||||||
|
|
||||||
bool is_first_time_get_result = true;
|
|
||||||
bool has_get_result = false;
|
|
||||||
|
|
||||||
int m_cali_version = -1;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class FlowRateWizard : public CalibrationWizard {
|
class FlowRateWizard : public CalibrationWizard {
|
||||||
public:
|
public:
|
||||||
FlowRateWizard(wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxTAB_TRAVERSAL);
|
FlowRateWizard(wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxTAB_TRAVERSAL);
|
||||||
~FlowRateWizard() {};
|
~FlowRateWizard() {};
|
||||||
void reset_reuse_panels();
|
|
||||||
|
void set_cali_method(CalibrationMethod method) override;
|
||||||
|
|
||||||
|
void on_cali_job_finished() override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual CalibrationWizardPage* create_start_page() override;
|
void create_pages();
|
||||||
void create_low_end_pages();
|
|
||||||
void create_high_end_pages();
|
|
||||||
virtual void create_pages() override;
|
|
||||||
virtual void create_save_panel_content(wxBoxSizer* sizer) override;
|
|
||||||
virtual bool start_calibration(std::vector<int> tray_ids) override;
|
|
||||||
virtual bool save_calibration_result() override;
|
|
||||||
virtual bool recommend_input_value() override;
|
|
||||||
virtual void set_save_name() override;
|
|
||||||
virtual void request_calib_result() override;
|
|
||||||
virtual void change_ams_select_mode() override;
|
|
||||||
virtual void init_bitmaps() override;
|
|
||||||
|
|
||||||
void sync_save_page_data();
|
void on_cali_action(wxCommandEvent& evt);
|
||||||
void switch_pages(SimpleEvent& evt);
|
|
||||||
private:
|
|
||||||
// start page
|
|
||||||
CalibrationWizardPage* m_page0{ nullptr };
|
|
||||||
|
|
||||||
// preset page
|
void on_cali_start(CaliPresetStage stage = CaliPresetStage::CALI_MANULA_STAGE_NONE, float cali_value = 0.0f);
|
||||||
CalibrationWizardPage* m_page1{ nullptr };
|
|
||||||
wxPanel* m_choose_step_panel;
|
|
||||||
wxRadioButton* m_complete_radioBox;
|
|
||||||
wxRadioButton* m_fine_radioBox;
|
|
||||||
|
|
||||||
// print page
|
void on_cali_save();
|
||||||
CalibrationWizardPage* m_page2{ nullptr };
|
|
||||||
|
|
||||||
// page 3
|
void update(MachineObject* obj) override;
|
||||||
CalibrationWizardPage* m_low_end_page3{ nullptr };
|
|
||||||
wxStaticBitmap* m_low_record_picture1;
|
|
||||||
ComboBox* m_optimal_block_coarse;
|
|
||||||
wxStaticText* m_coarse_calc_result_text;
|
|
||||||
float m_coarse_calc_result;
|
|
||||||
CheckBox* m_checkBox_skip_calibration;
|
|
||||||
TextInput* m_save_name_input1;
|
|
||||||
|
|
||||||
CalibrationWizardPage* m_high_end_page3{ nullptr };
|
void on_device_connected(MachineObject* obj) override;
|
||||||
std::vector<FlowRatioCalibResult> m_calib_results;
|
|
||||||
wxPanel* m_grid_panel;
|
|
||||||
std::map<int, std::string> m_high_end_save_names;
|
|
||||||
|
|
||||||
// page 4
|
|
||||||
CalibrationWizardPage* m_low_end_page4{ nullptr };
|
|
||||||
wxStaticBitmap* m_low_print_picture2;
|
|
||||||
|
|
||||||
// save page
|
|
||||||
CalibrationWizardPage* m_low_end_page5{ nullptr };
|
|
||||||
wxStaticBitmap* m_low_record_picture2;
|
|
||||||
ComboBox* m_optimal_block_fine;
|
|
||||||
wxStaticText* m_fine_calc_result_text;
|
|
||||||
float m_fine_calc_result;
|
|
||||||
TextInput* m_save_name_input2;
|
|
||||||
std::string m_save_name;
|
|
||||||
bool is_first_time_get_result = true;
|
|
||||||
bool has_get_result = false;
|
|
||||||
|
|
||||||
void reset_print_panel_to_page(CalibrationWizardPage* page, wxBoxSizer* sizer);
|
|
||||||
void reset_send_progress_to_page(CalibrationWizardPage* page, wxBoxSizer* sizer);
|
|
||||||
void on_fine_tune(wxCommandEvent&);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class MaxVolumetricSpeedWizard : public CalibrationWizard {
|
class MaxVolumetricSpeedWizard : public CalibrationWizard {
|
||||||
public:
|
public:
|
||||||
MaxVolumetricSpeedWizard(wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxTAB_TRAVERSAL);
|
MaxVolumetricSpeedWizard(wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxTAB_TRAVERSAL);
|
||||||
~MaxVolumetricSpeedWizard() {};
|
~MaxVolumetricSpeedWizard() {};
|
||||||
|
|
||||||
|
void on_cali_job_finished() override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual CalibrationWizardPage* create_start_page() override;
|
void create_pages();
|
||||||
virtual void create_pages() override;
|
|
||||||
virtual void create_save_panel_content(wxBoxSizer* sizer) override;
|
|
||||||
virtual bool start_calibration(std::vector<int> tray_ids) override;
|
|
||||||
virtual bool save_calibration_result() override;
|
|
||||||
virtual bool recommend_input_value() override;
|
|
||||||
virtual void set_save_name() override;
|
|
||||||
virtual void init_bitmaps() override;
|
|
||||||
private:
|
|
||||||
// start page
|
|
||||||
CalibrationWizardPage* m_page0;
|
|
||||||
|
|
||||||
// preset page
|
void on_cali_action(wxCommandEvent& evt);
|
||||||
CalibrationWizardPage* m_page1;
|
|
||||||
|
|
||||||
// print page
|
void on_cali_start();
|
||||||
CalibrationWizardPage* m_page2;
|
|
||||||
|
|
||||||
// save page
|
void on_cali_save();
|
||||||
CalibrationWizardPage* m_page3;
|
|
||||||
wxStaticBitmap* m_record_picture;
|
void on_device_connected(MachineObject *obj) override;
|
||||||
TextInput* m_optimal_max_speed;
|
|
||||||
wxStaticText* m_calc_result_text;
|
|
||||||
float m_calc_result;
|
|
||||||
TextInput* m_save_name_input;
|
|
||||||
std::string m_save_name;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class TemperatureWizard : public CalibrationWizard {
|
// save printer_type in command event
|
||||||
public:
|
wxDECLARE_EVENT(EVT_DEVICE_CHANGED, wxCommandEvent);
|
||||||
TemperatureWizard(wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxTAB_TRAVERSAL);
|
wxDECLARE_EVENT(EVT_CALIBRATION_JOB_FINISHED, wxCommandEvent);
|
||||||
~TemperatureWizard() {};
|
|
||||||
protected:
|
|
||||||
virtual CalibrationWizardPage* create_start_page() override;
|
|
||||||
virtual void create_pages() override;
|
|
||||||
virtual void create_save_panel_content(wxBoxSizer* sizer) override;
|
|
||||||
virtual bool start_calibration(std::vector<int> tray_ids) override;
|
|
||||||
virtual bool save_calibration_result() override;
|
|
||||||
virtual bool recommend_input_value() override;
|
|
||||||
virtual void set_save_name() override;
|
|
||||||
virtual void init_bitmaps() override;
|
|
||||||
private:
|
|
||||||
// start page
|
|
||||||
CalibrationWizardPage* m_page0;
|
|
||||||
|
|
||||||
// preset page
|
|
||||||
CalibrationWizardPage* m_page1;
|
|
||||||
|
|
||||||
// print page
|
|
||||||
CalibrationWizardPage* m_page2;
|
|
||||||
|
|
||||||
// save page
|
|
||||||
CalibrationWizardPage* m_page3;
|
|
||||||
wxStaticBitmap* m_record_picture;
|
|
||||||
TextInput* m_optimal_temp;
|
|
||||||
TextInput* m_save_name_input;
|
|
||||||
std::string m_save_name;
|
|
||||||
};
|
|
||||||
|
|
||||||
class RetractionWizard : public CalibrationWizard {
|
|
||||||
public:
|
|
||||||
RetractionWizard(wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxTAB_TRAVERSAL);
|
|
||||||
~RetractionWizard() {};
|
|
||||||
protected:
|
|
||||||
virtual CalibrationWizardPage* create_start_page() override;
|
|
||||||
virtual void create_pages() override;
|
|
||||||
virtual void create_save_panel_content(wxBoxSizer* sizer) override;
|
|
||||||
virtual bool start_calibration(std::vector<int> tray_ids) override;
|
|
||||||
virtual bool save_calibration_result() override;
|
|
||||||
virtual bool recommend_input_value() override;
|
|
||||||
virtual void set_save_name() override;
|
|
||||||
virtual void init_bitmaps() override;
|
|
||||||
private:
|
|
||||||
// start page
|
|
||||||
CalibrationWizardPage* m_page0;
|
|
||||||
|
|
||||||
// preset page
|
|
||||||
CalibrationWizardPage* m_page1;
|
|
||||||
|
|
||||||
// print page
|
|
||||||
CalibrationWizardPage* m_page2;
|
|
||||||
|
|
||||||
// save page
|
|
||||||
CalibrationWizardPage* m_page3;
|
|
||||||
wxStaticBitmap* m_record_picture;
|
|
||||||
TextInput* m_optimal_retraction;
|
|
||||||
TextInput* m_save_name_input;
|
|
||||||
std::string m_save_name;
|
|
||||||
};
|
|
||||||
|
|
||||||
}} // namespace Slic3r::GUI
|
}} // namespace Slic3r::GUI
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
404
src/slic3r/GUI/CalibrationWizardCaliPage.cpp
Normal file
|
@ -0,0 +1,404 @@
|
||||||
|
#include "CalibrationWizardCaliPage.hpp"
|
||||||
|
#include "I18N.hpp"
|
||||||
|
#include "Widgets/Label.hpp"
|
||||||
|
|
||||||
|
namespace Slic3r { namespace GUI {
|
||||||
|
|
||||||
|
static const wxString NA_STR = _L("N/A");
|
||||||
|
|
||||||
|
|
||||||
|
CalibrationCaliPage::CalibrationCaliPage(wxWindow* parent, CalibMode cali_mode, CaliPageType cali_type,
|
||||||
|
wxWindowID id, const wxPoint& pos, const wxSize& size, long style)
|
||||||
|
: CalibrationWizardPage(parent, id, pos, size, style)
|
||||||
|
{
|
||||||
|
m_cali_mode = cali_mode;
|
||||||
|
|
||||||
|
m_page_type = cali_type;
|
||||||
|
|
||||||
|
m_top_sizer = new wxBoxSizer(wxVERTICAL);
|
||||||
|
|
||||||
|
create_page(this);
|
||||||
|
|
||||||
|
this->SetSizer(m_top_sizer);
|
||||||
|
m_top_sizer->Fit(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
CalibrationCaliPage::~CalibrationCaliPage()
|
||||||
|
{
|
||||||
|
m_printing_panel->get_pause_resume_button()->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(CalibrationCaliPage::on_subtask_pause_resume), NULL, this);
|
||||||
|
m_printing_panel->get_abort_button()->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(CalibrationCaliPage::on_subtask_abort), NULL, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CalibrationCaliPage::create_page(wxWindow* parent)
|
||||||
|
{
|
||||||
|
m_page_caption = new CaliPageCaption(parent, m_cali_mode);
|
||||||
|
m_page_caption->show_prev_btn(true);
|
||||||
|
m_top_sizer->Add(m_page_caption, 0, wxEXPAND, 0);
|
||||||
|
|
||||||
|
wxArrayString steps;
|
||||||
|
steps.Add(_L("Preset"));
|
||||||
|
steps.Add(_L("Calibration"));
|
||||||
|
steps.Add(_L("Record"));
|
||||||
|
m_step_panel = new CaliPageStepGuide(parent, steps);
|
||||||
|
m_step_panel->set_steps(1);
|
||||||
|
m_top_sizer->Add(m_step_panel, 0, wxEXPAND, 0);
|
||||||
|
|
||||||
|
m_printing_picture = new wxStaticBitmap(parent, wxID_ANY, wxNullBitmap);
|
||||||
|
m_top_sizer->Add(m_printing_picture, 0, wxALIGN_CENTER, 0);
|
||||||
|
m_top_sizer->AddSpacer(FromDIP(20));
|
||||||
|
|
||||||
|
set_cali_img();
|
||||||
|
|
||||||
|
m_printing_panel = new PrintingTaskPanel(parent, PrintingTaskType::CALIBRATION);
|
||||||
|
m_printing_panel->SetDoubleBuffered(true);
|
||||||
|
m_printing_panel->SetSize({ CALIBRATION_PROGRESSBAR_LENGTH, -1 });
|
||||||
|
m_printing_panel->SetMinSize({ CALIBRATION_PROGRESSBAR_LENGTH, -1 });
|
||||||
|
m_printing_panel->enable_pause_resume_button(false, "resume_disable");
|
||||||
|
m_printing_panel->enable_abort_button(false);
|
||||||
|
|
||||||
|
m_top_sizer->Add(m_printing_panel, 0, wxALIGN_CENTER, 0);
|
||||||
|
m_action_panel = new CaliPageActionPanel(parent, m_cali_mode, CaliPageType::CALI_PAGE_CALI);
|
||||||
|
m_top_sizer->Add(m_action_panel, 0, wxEXPAND, 0);
|
||||||
|
|
||||||
|
m_printing_panel->get_pause_resume_button()->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(CalibrationCaliPage::on_subtask_pause_resume), NULL, this);
|
||||||
|
m_printing_panel->get_abort_button()->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(CalibrationCaliPage::on_subtask_abort), NULL, this);
|
||||||
|
|
||||||
|
Layout();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CalibrationCaliPage::on_subtask_pause_resume(wxCommandEvent& event)
|
||||||
|
{
|
||||||
|
DeviceManager* dev = Slic3r::GUI::wxGetApp().getDeviceManager();
|
||||||
|
if (!dev) return;
|
||||||
|
MachineObject* obj = dev->get_selected_machine();
|
||||||
|
if (!obj) return;
|
||||||
|
|
||||||
|
if (obj->can_resume())
|
||||||
|
obj->command_task_resume();
|
||||||
|
else
|
||||||
|
obj->command_task_pause();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CalibrationCaliPage::on_subtask_abort(wxCommandEvent& event)
|
||||||
|
{
|
||||||
|
DeviceManager* dev = Slic3r::GUI::wxGetApp().getDeviceManager();
|
||||||
|
if (!dev) return;
|
||||||
|
MachineObject* obj = dev->get_selected_machine();
|
||||||
|
if (!obj) return;
|
||||||
|
|
||||||
|
if (abort_dlg == nullptr) {
|
||||||
|
abort_dlg = new SecondaryCheckDialog(this->GetParent(), wxID_ANY, _L("Cancel print"));
|
||||||
|
abort_dlg->Bind(EVT_SECONDARY_CHECK_CONFIRM, [this, obj](wxCommandEvent& e) {
|
||||||
|
if (obj) obj->command_task_abort();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
abort_dlg->update_text(_L("Are you sure you want to cancel this print?"));
|
||||||
|
abort_dlg->on_show();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void CalibrationCaliPage::set_cali_img()
|
||||||
|
{
|
||||||
|
if (m_cali_mode == CalibMode::Calib_PA_Line) {
|
||||||
|
m_printing_picture->SetBitmap(create_scaled_bitmap("extrusion_calibration_tips_en", nullptr, 400));
|
||||||
|
}
|
||||||
|
else if (m_cali_mode == CalibMode::Calib_Flow_Rate) {
|
||||||
|
if (m_page_type == CaliPageType::CALI_PAGE_CALI)
|
||||||
|
m_printing_picture->SetBitmap(create_scaled_bitmap("flow_rate_calibration", nullptr, 400));
|
||||||
|
if (m_page_type == CaliPageType::CALI_PAGE_FINE_CALI)
|
||||||
|
m_printing_picture->SetBitmap(create_scaled_bitmap("flow_rate_calibration_fine", nullptr, 400));
|
||||||
|
else
|
||||||
|
m_printing_picture->SetBitmap(create_scaled_bitmap("flow_rate_calibration", nullptr, 400));
|
||||||
|
}
|
||||||
|
else if (m_cali_mode == CalibMode::Calib_Vol_speed_Tower) {
|
||||||
|
m_printing_picture->SetBitmap(create_scaled_bitmap("max_volumetric_speed_calibration", nullptr, 400));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CalibrationCaliPage::update(MachineObject* obj)
|
||||||
|
{
|
||||||
|
static int get_result_count = 0;
|
||||||
|
// enable calibration when finished
|
||||||
|
bool enable_cali = false;
|
||||||
|
if (obj) {
|
||||||
|
if (m_cali_mode == CalibMode::Calib_PA_Line) {
|
||||||
|
if (m_cali_method == CalibrationMethod::CALI_METHOD_AUTO) {
|
||||||
|
if (obj->get_pa_calib_result) {
|
||||||
|
enable_cali = true;
|
||||||
|
} else {
|
||||||
|
if (get_obj_calibration_mode(obj) == m_cali_mode && obj->is_printing_finished()) {
|
||||||
|
// use selected diameter, add a counter to timeout, add a warning tips when get result failed
|
||||||
|
CalibUtils::emit_get_PA_calib_results(get_selected_calibration_nozzle_dia(obj));
|
||||||
|
BOOST_LOG_TRIVIAL(trace) << "CalibUtils::emit_get_PA_calib_results, auto count = " << get_result_count++;
|
||||||
|
} else {
|
||||||
|
;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (m_cali_method == CalibrationMethod::CALI_METHOD_MANUAL) {
|
||||||
|
if (get_obj_calibration_mode(obj) == m_cali_mode && obj->is_printing_finished()) {
|
||||||
|
enable_cali = true;
|
||||||
|
} else {
|
||||||
|
enable_cali = false;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
assert(false);
|
||||||
|
}
|
||||||
|
m_action_panel->enable_button(CaliPageActionType::CALI_ACTION_CALI_NEXT, enable_cali);
|
||||||
|
} else if (m_cali_mode == CalibMode::Calib_Flow_Rate) {
|
||||||
|
if (m_cali_method == CalibrationMethod::CALI_METHOD_AUTO) {
|
||||||
|
if (obj->get_flow_calib_result) {
|
||||||
|
enable_cali = true;
|
||||||
|
} else {
|
||||||
|
if (get_obj_calibration_mode(obj) == m_cali_mode && obj->is_printing_finished()) {
|
||||||
|
// use selected diameter, add a counter to timeout, add a warning tips when get result failed
|
||||||
|
CalibUtils::emit_get_flow_ratio_calib_results(get_selected_calibration_nozzle_dia(obj));
|
||||||
|
} else {
|
||||||
|
;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (m_cali_method == CalibrationMethod::CALI_METHOD_MANUAL) {
|
||||||
|
if (get_obj_calibration_mode(obj) == m_cali_mode && obj->is_printing_finished()) {
|
||||||
|
// use selected diameter, add a counter to timeout, add a warning tips when get result failed
|
||||||
|
CalibUtils::emit_get_flow_ratio_calib_results(get_selected_calibration_nozzle_dia(obj));
|
||||||
|
enable_cali = true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
enable_cali = false;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
assert(false);
|
||||||
|
}
|
||||||
|
m_action_panel->enable_button(CaliPageActionType::CALI_ACTION_NEXT, enable_cali);
|
||||||
|
}
|
||||||
|
else if (m_cali_mode == CalibMode::Calib_Vol_speed_Tower) {
|
||||||
|
if (get_obj_calibration_mode(obj) == m_cali_mode && obj->is_printing_finished()) {
|
||||||
|
enable_cali = true;
|
||||||
|
} else {
|
||||||
|
;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
assert(false);
|
||||||
|
}
|
||||||
|
m_action_panel->enable_button(CaliPageActionType::CALI_ACTION_NEXT, enable_cali);
|
||||||
|
}
|
||||||
|
|
||||||
|
// only display calibration printing status
|
||||||
|
if (get_obj_calibration_mode(obj) == m_cali_mode) {
|
||||||
|
update_subtask(obj);
|
||||||
|
} else {
|
||||||
|
update_subtask(nullptr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CalibrationCaliPage::update_subtask(MachineObject* obj)
|
||||||
|
{
|
||||||
|
if (!obj) return;
|
||||||
|
|
||||||
|
if (obj->is_support_layer_num) {
|
||||||
|
m_printing_panel->update_layers_num(true);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
m_printing_panel->update_layers_num(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (obj->is_system_printing()
|
||||||
|
|| obj->is_in_calibration()) {
|
||||||
|
reset_printing_values();
|
||||||
|
}
|
||||||
|
else if (obj->is_in_printing() || obj->print_status == "FINISH") {
|
||||||
|
if (obj->is_in_prepare() || obj->print_status == "SLICING") {
|
||||||
|
m_printing_panel->get_market_scoring_button()->Hide();
|
||||||
|
m_printing_panel->enable_abort_button(false);
|
||||||
|
m_printing_panel->enable_pause_resume_button(false, "pause_disable");
|
||||||
|
wxString prepare_text;
|
||||||
|
bool show_percent = true;
|
||||||
|
|
||||||
|
if (obj->is_in_prepare()) {
|
||||||
|
prepare_text = wxString::Format(_L("Downloading..."));
|
||||||
|
}
|
||||||
|
else if (obj->print_status == "SLICING") {
|
||||||
|
if (obj->queue_number <= 0) {
|
||||||
|
prepare_text = wxString::Format(_L("Cloud Slicing..."));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
prepare_text = wxString::Format(_L("In Cloud Slicing Queue, there are %s tasks ahead."), std::to_string(obj->queue_number));
|
||||||
|
show_percent = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
prepare_text = wxString::Format(_L("Downloading..."));
|
||||||
|
|
||||||
|
if (obj->gcode_file_prepare_percent >= 0 && obj->gcode_file_prepare_percent <= 100 && show_percent)
|
||||||
|
prepare_text += wxString::Format("(%d%%)", obj->gcode_file_prepare_percent);
|
||||||
|
|
||||||
|
m_printing_panel->update_stage_value(prepare_text, 0);
|
||||||
|
m_printing_panel->update_progress_percent(NA_STR, wxEmptyString);
|
||||||
|
m_printing_panel->update_left_time(NA_STR);
|
||||||
|
m_printing_panel->update_layers_num(true, wxString::Format(_L("Layer: %s"), NA_STR));
|
||||||
|
m_printing_panel->update_subtask_name(wxString::Format("%s", GUI::from_u8(obj->subtask_name)));
|
||||||
|
|
||||||
|
|
||||||
|
if (obj->get_modeltask() && obj->get_modeltask()->design_id > 0) {
|
||||||
|
m_printing_panel->show_profile_info(true, wxString::FromUTF8(obj->get_modeltask()->profile_name));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
m_printing_panel->show_profile_info(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
update_basic_print_data(false, obj->slice_info->weight, obj->slice_info->prediction);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (obj->can_resume()) {
|
||||||
|
m_printing_panel->enable_pause_resume_button(true, "resume");
|
||||||
|
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
m_printing_panel->enable_pause_resume_button(true, "pause");
|
||||||
|
}
|
||||||
|
if (obj->print_status == "FINISH") {
|
||||||
|
|
||||||
|
m_printing_panel->enable_abort_button(false);
|
||||||
|
m_printing_panel->enable_pause_resume_button(false, "resume_disable");
|
||||||
|
|
||||||
|
bool is_market_task = obj->get_modeltask() && obj->get_modeltask()->design_id > 0;
|
||||||
|
if (is_market_task) {
|
||||||
|
m_printing_panel->get_market_scoring_button()->Show();
|
||||||
|
BOOST_LOG_TRIVIAL(info) << "SHOW_SCORE_BTU: design_id [" << obj->get_modeltask()->design_id << "] print_finish [" << m_print_finish << "]";
|
||||||
|
if (!m_print_finish && IsShownOnScreen()) {
|
||||||
|
m_print_finish = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
m_printing_panel->get_market_scoring_button()->Hide();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
m_printing_panel->enable_abort_button(true);
|
||||||
|
m_printing_panel->get_market_scoring_button()->Hide();
|
||||||
|
if (m_print_finish) {
|
||||||
|
m_print_finish = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// update printing stage
|
||||||
|
|
||||||
|
m_printing_panel->update_left_time(obj->mc_left_time);
|
||||||
|
if (obj->subtask_) {
|
||||||
|
m_printing_panel->update_stage_value(obj->get_curr_stage(), obj->subtask_->task_progress);
|
||||||
|
m_printing_panel->update_progress_percent(wxString::Format("%d", obj->subtask_->task_progress), "%");
|
||||||
|
m_printing_panel->update_layers_num(true, wxString::Format(_L("Layer: %d/%d"), obj->curr_layer, obj->total_layers));
|
||||||
|
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
m_printing_panel->update_stage_value(obj->get_curr_stage(), 0);
|
||||||
|
m_printing_panel->update_progress_percent(NA_STR, wxEmptyString);
|
||||||
|
m_printing_panel->update_layers_num(true, wxString::Format(_L("Layer: %s"), NA_STR));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
m_printing_panel->update_subtask_name(wxString::Format("%s", GUI::from_u8(obj->subtask_name)));
|
||||||
|
|
||||||
|
if (obj->get_modeltask() && obj->get_modeltask()->design_id > 0) {
|
||||||
|
m_printing_panel->show_profile_info(wxString::FromUTF8(obj->get_modeltask()->profile_name));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
m_printing_panel->show_profile_info(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
reset_printing_values();
|
||||||
|
}
|
||||||
|
|
||||||
|
this->Layout();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CalibrationCaliPage::update_basic_print_data(bool def, float weight, int prediction)
|
||||||
|
{
|
||||||
|
if (def) {
|
||||||
|
wxString str_prediction = wxString::Format("%s", get_bbl_time_dhms(prediction));
|
||||||
|
wxString str_weight = wxString::Format("%.2fg", weight);
|
||||||
|
|
||||||
|
m_printing_panel->show_priting_use_info(true, str_prediction, str_weight);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
m_printing_panel->show_priting_use_info(false, "0m", "0g");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CalibrationCaliPage::reset_printing_values()
|
||||||
|
{
|
||||||
|
m_printing_panel->enable_pause_resume_button(false, "pause_disable");
|
||||||
|
m_printing_panel->enable_abort_button(false);
|
||||||
|
m_printing_panel->reset_printing_value();
|
||||||
|
m_printing_panel->update_subtask_name(NA_STR);
|
||||||
|
m_printing_panel->show_profile_info(false);
|
||||||
|
m_printing_panel->update_stage_value(wxEmptyString, 0);
|
||||||
|
m_printing_panel->update_progress_percent(NA_STR, wxEmptyString);
|
||||||
|
m_printing_panel->get_market_scoring_button()->Hide();
|
||||||
|
m_printing_panel->update_left_time(NA_STR);
|
||||||
|
m_printing_panel->update_layers_num(true, wxString::Format(_L("Layer: %s"), NA_STR));
|
||||||
|
update_basic_print_data(false);
|
||||||
|
this->Layout();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CalibrationCaliPage::on_device_connected(MachineObject* obj)
|
||||||
|
{
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CalibrationCaliPage::set_cali_method(CalibrationMethod method)
|
||||||
|
{
|
||||||
|
m_cali_method = method;
|
||||||
|
|
||||||
|
wxArrayString auto_steps;
|
||||||
|
auto_steps.Add(_L("Preset"));
|
||||||
|
auto_steps.Add(_L("Calibration"));
|
||||||
|
auto_steps.Add(_L("Record"));
|
||||||
|
|
||||||
|
wxArrayString manual_steps;
|
||||||
|
manual_steps.Add(_L("Preset"));
|
||||||
|
manual_steps.Add(_L("Calibration1"));
|
||||||
|
manual_steps.Add(_L("Calibration2"));
|
||||||
|
manual_steps.Add(_L("Record"));
|
||||||
|
|
||||||
|
if (method == CalibrationMethod::CALI_METHOD_AUTO) {
|
||||||
|
m_step_panel->set_steps_string(auto_steps);
|
||||||
|
m_step_panel->set_steps(1);
|
||||||
|
}
|
||||||
|
else if (method == CalibrationMethod::CALI_METHOD_MANUAL) {
|
||||||
|
if (m_cali_mode == CalibMode::Calib_PA_Line) {
|
||||||
|
m_step_panel->set_steps_string(auto_steps);
|
||||||
|
m_step_panel->set_steps(1);
|
||||||
|
} else {
|
||||||
|
m_step_panel->set_steps_string(manual_steps);
|
||||||
|
if (m_page_type == CaliPageType::CALI_PAGE_CALI)
|
||||||
|
m_step_panel->set_steps(1);
|
||||||
|
else if (m_page_type == CaliPageType::CALI_PAGE_FINE_CALI) {
|
||||||
|
m_step_panel->set_steps(2);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
m_step_panel->set_steps(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
assert(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
float CalibrationCaliPage::get_selected_calibration_nozzle_dia(MachineObject* obj)
|
||||||
|
{
|
||||||
|
// return selected if this is set
|
||||||
|
if (obj->cali_selected_nozzle_dia > 1e-3 && obj->cali_selected_nozzle_dia < 10.0f)
|
||||||
|
return obj->cali_selected_nozzle_dia;
|
||||||
|
|
||||||
|
// return default nozzle if nozzle diameter is set
|
||||||
|
if (obj->nozzle_diameter > 1e-3 && obj->nozzle_diameter < 10.0f)
|
||||||
|
return obj->nozzle_diameter;
|
||||||
|
|
||||||
|
// return 0.4 by default
|
||||||
|
return 0.4;
|
||||||
|
}
|
||||||
|
|
||||||
|
}}
|
46
src/slic3r/GUI/CalibrationWizardCaliPage.hpp
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
#ifndef slic3r_GUI_CalibrationWizardCaliPage_hpp_
|
||||||
|
#define slic3r_GUI_CalibrationWizardCaliPage_hpp_
|
||||||
|
|
||||||
|
#include "CalibrationWizardPage.hpp"
|
||||||
|
#include "StatusPanel.hpp"
|
||||||
|
|
||||||
|
namespace Slic3r { namespace GUI {
|
||||||
|
|
||||||
|
class CalibrationCaliPage : public CalibrationWizardPage
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CalibrationCaliPage(wxWindow* parent,
|
||||||
|
CalibMode cali_mode,
|
||||||
|
CaliPageType cali_type = CaliPageType::CALI_PAGE_CALI,
|
||||||
|
wxWindowID id = wxID_ANY,
|
||||||
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
|
const wxSize& size = wxDefaultSize,
|
||||||
|
long style = wxTAB_TRAVERSAL);
|
||||||
|
~CalibrationCaliPage();
|
||||||
|
|
||||||
|
void create_page(wxWindow* parent);
|
||||||
|
void on_subtask_pause_resume(wxCommandEvent& event);
|
||||||
|
void on_subtask_abort(wxCommandEvent& event);
|
||||||
|
void set_cali_img();
|
||||||
|
void update(MachineObject* obj) override;
|
||||||
|
void update_subtask(MachineObject* obj);
|
||||||
|
void update_basic_print_data(bool def, float weight = 0.0, int prediction = 0);
|
||||||
|
void reset_printing_values();
|
||||||
|
void on_device_connected(MachineObject* obj) override;
|
||||||
|
|
||||||
|
void set_cali_method(CalibrationMethod method) override;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
float get_selected_calibration_nozzle_dia(MachineObject* obj);
|
||||||
|
|
||||||
|
bool m_print_finish {false};
|
||||||
|
wxBoxSizer* m_top_sizer;
|
||||||
|
CaliPageStepGuide* m_step_panel { nullptr };
|
||||||
|
PrintingTaskPanel* m_printing_panel { nullptr };
|
||||||
|
wxStaticBitmap* m_printing_picture;
|
||||||
|
SecondaryCheckDialog* abort_dlg { nullptr };
|
||||||
|
};
|
||||||
|
|
||||||
|
}} // namespace Slic3r::GUI
|
||||||
|
|
||||||
|
#endif
|
|
@ -1,14 +1,124 @@
|
||||||
#include "CalibrationWizardPage.hpp"
|
#include "CalibrationWizardPage.hpp"
|
||||||
#include "I18N.hpp"
|
#include "I18N.hpp"
|
||||||
#include "Widgets/Label.hpp"
|
#include "Widgets/Label.hpp"
|
||||||
|
#include "MsgDialog.hpp"
|
||||||
|
|
||||||
namespace Slic3r { namespace GUI {
|
namespace Slic3r { namespace GUI {
|
||||||
|
|
||||||
wxDEFINE_EVENT(EVT_CALIBRATIONPAGE_PREV, IntEvent);
|
wxDEFINE_EVENT(EVT_CALI_ACTION, wxCommandEvent);
|
||||||
wxDEFINE_EVENT(EVT_CALIBRATIONPAGE_NEXT, IntEvent);
|
wxDEFINE_EVENT(EVT_CALI_TRAY_CHANGED, wxCommandEvent);
|
||||||
|
|
||||||
PageButton::PageButton(wxWindow* parent, wxString text, ButtonType type)
|
|
||||||
: m_type(type),
|
CalibrationStyle get_cali_style(MachineObject* obj)
|
||||||
|
{
|
||||||
|
if (!obj) return CalibrationStyle::CALI_STYLE_DEFAULT;
|
||||||
|
|
||||||
|
if (obj->printer_type == "BL-P001" || obj->printer_type == "BL-P002")
|
||||||
|
return CalibrationStyle::CALI_STYLE_X1;
|
||||||
|
else if (obj->printer_type == "C11" || obj->printer_type == "C12")
|
||||||
|
return CalibrationStyle::CALI_STYLE_P1P;
|
||||||
|
|
||||||
|
return CalibrationStyle::CALI_STYLE_DEFAULT;
|
||||||
|
}
|
||||||
|
|
||||||
|
wxString get_cali_mode_caption_string(CalibMode mode)
|
||||||
|
{
|
||||||
|
if (mode == CalibMode::Calib_PA_Line)
|
||||||
|
return _L("Pressure Advance Calibration");
|
||||||
|
if (mode == CalibMode::Calib_Flow_Rate)
|
||||||
|
return _L("Flow Rate Calibration");
|
||||||
|
if (mode == CalibMode::Calib_Vol_speed_Tower)
|
||||||
|
return _L("Max Volumetric Speed");
|
||||||
|
return "no cali_mode_caption";
|
||||||
|
}
|
||||||
|
|
||||||
|
wxString get_calibration_wiki_page(CalibMode cali_mode)
|
||||||
|
{
|
||||||
|
switch (cali_mode) {
|
||||||
|
case CalibMode::Calib_PA_Line:
|
||||||
|
return wxString("https://wiki.bambulab.com/en/software/bambu-studio/calibration_pa");
|
||||||
|
case CalibMode::Calib_Flow_Rate:
|
||||||
|
return wxString("https://wiki.bambulab.com/en/software/bambu-studio/calibration_flow_rate");
|
||||||
|
case CalibMode::Calib_Vol_speed_Tower:
|
||||||
|
return wxString("https://wiki.bambulab.com/en/software/bambu-studio/calibration_volumetric");
|
||||||
|
case CalibMode::Calib_Temp_Tower:
|
||||||
|
return wxString("https://wiki.bambulab.com/en/software/bambu-studio/calibration_temperature");
|
||||||
|
case CalibMode::Calib_Retraction_tower:
|
||||||
|
return wxString("https://wiki.bambulab.com/en/software/bambu-studio/calibration_retraction");
|
||||||
|
default:
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
CalibrationFilamentMode get_cali_filament_mode(MachineObject* obj, CalibMode mode)
|
||||||
|
{
|
||||||
|
// default
|
||||||
|
if (!obj) return CalibrationFilamentMode::CALI_MODEL_SINGLE;
|
||||||
|
|
||||||
|
|
||||||
|
if (mode == CalibMode::Calib_PA_Line) {
|
||||||
|
if (obj->printer_type == "BL-P001" || obj->printer_type == "BL-P002")
|
||||||
|
return CalibrationFilamentMode::CALI_MODEL_MULITI;
|
||||||
|
else if (obj->printer_type == "C11" || obj->printer_type == "C12")
|
||||||
|
return CalibrationFilamentMode::CALI_MODEL_SINGLE;
|
||||||
|
}
|
||||||
|
else if (mode == CalibMode::Calib_Flow_Rate) {
|
||||||
|
if (obj->printer_type == "BL-P001" || obj->printer_type == "BL-P002")
|
||||||
|
return CalibrationFilamentMode::CALI_MODEL_SINGLE;
|
||||||
|
else if (obj->printer_type == "C11" || obj->printer_type == "C12")
|
||||||
|
return CalibrationFilamentMode::CALI_MODEL_SINGLE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return CalibrationFilamentMode::CALI_MODEL_SINGLE;
|
||||||
|
}
|
||||||
|
|
||||||
|
CalibMode get_obj_calibration_mode(const MachineObject* obj)
|
||||||
|
{
|
||||||
|
CalibrationMethod method;
|
||||||
|
int cali_stage;
|
||||||
|
return get_obj_calibration_mode(obj, method, cali_stage);
|
||||||
|
}
|
||||||
|
|
||||||
|
CalibMode get_obj_calibration_mode(const MachineObject* obj, int& cali_stage)
|
||||||
|
{
|
||||||
|
CalibrationMethod method;
|
||||||
|
return get_obj_calibration_mode(obj, method, cali_stage);
|
||||||
|
}
|
||||||
|
|
||||||
|
CalibMode get_obj_calibration_mode(const MachineObject* obj, CalibrationMethod& method, int& cali_stage)
|
||||||
|
{
|
||||||
|
method = CalibrationMethod::CALI_METHOD_MANUAL;
|
||||||
|
|
||||||
|
if (!obj) return CalibMode::Calib_None;
|
||||||
|
|
||||||
|
if (boost::contains(obj->m_gcode_file, "auto_filament_cali")) {
|
||||||
|
method = CalibrationMethod::CALI_METHOD_AUTO;
|
||||||
|
return CalibMode::Calib_PA_Line;
|
||||||
|
}
|
||||||
|
if (boost::contains(obj->m_gcode_file, "user_cali_manual_pa")) {
|
||||||
|
method = CalibrationMethod::CALI_METHOD_MANUAL;
|
||||||
|
return CalibMode::Calib_PA_Line;
|
||||||
|
}
|
||||||
|
if (boost::contains(obj->m_gcode_file, "extrusion_cali")) {
|
||||||
|
method == CalibrationMethod::CALI_METHOD_MANUAL;
|
||||||
|
return CalibMode::Calib_PA_Line;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (boost::contains(obj->m_gcode_file, "abs_flowcalib_cali")) {
|
||||||
|
method = CalibrationMethod::CALI_METHOD_AUTO;
|
||||||
|
return CalibMode::Calib_Flow_Rate;
|
||||||
|
}
|
||||||
|
|
||||||
|
CalibMode cali_mode = CalibUtils::get_calib_mode_by_name(obj->subtask_name, cali_stage);
|
||||||
|
if (cali_mode != CalibMode::Calib_None) {
|
||||||
|
method = CalibrationMethod::CALI_METHOD_MANUAL;
|
||||||
|
}
|
||||||
|
return cali_mode;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
CaliPageButton::CaliPageButton(wxWindow* parent, CaliPageActionType type, wxString text)
|
||||||
|
: m_action_type(type),
|
||||||
Button(parent, text)
|
Button(parent, text)
|
||||||
{
|
{
|
||||||
StateColor btn_bg_green(std::pair<wxColour, int>(wxColour(206, 206, 206), StateColor::Disabled),
|
StateColor btn_bg_green(std::pair<wxColour, int>(wxColour(206, 206, 206), StateColor::Disabled),
|
||||||
|
@ -33,18 +143,77 @@ PageButton::PageButton(wxWindow* parent, wxString text, ButtonType type)
|
||||||
StateColor btn_text_white(std::pair<wxColour, int>(wxColour(255, 255, 254), StateColor::Disabled),
|
StateColor btn_text_white(std::pair<wxColour, int>(wxColour(255, 255, 254), StateColor::Disabled),
|
||||||
std::pair<wxColour, int>(wxColour(38, 46, 48), StateColor::Enabled));
|
std::pair<wxColour, int>(wxColour(38, 46, 48), StateColor::Enabled));
|
||||||
|
|
||||||
switch (m_type)
|
switch (m_action_type)
|
||||||
{
|
{
|
||||||
case Slic3r::GUI::Back:
|
case CaliPageActionType::CALI_ACTION_MANAGE_RESULT:
|
||||||
case Slic3r::GUI::Recalibrate:
|
this->SetLabel(_L("Manage Result"));
|
||||||
|
break;
|
||||||
|
case CaliPageActionType::CALI_ACTION_MANUAL_CALI:
|
||||||
|
this->SetLabel(_L("Maual Calibration"));
|
||||||
|
this->SetToolTip(_L("Result can be read by human eyes."));
|
||||||
|
break;
|
||||||
|
case CaliPageActionType::CALI_ACTION_AUTO_CALI:
|
||||||
|
this->SetLabel(_L("Auto-Calibration"));
|
||||||
|
this->SetToolTip(_L("We would use Lidar to read the calibration result"));
|
||||||
|
break;
|
||||||
|
case CaliPageActionType::CALI_ACTION_START:
|
||||||
|
this->SetLabel(_L("Start Calibration"));
|
||||||
|
break;
|
||||||
|
case CaliPageActionType::CALI_ACTION_PREV:
|
||||||
|
this->SetLabel(_L("Prev"));
|
||||||
|
break;
|
||||||
|
case CaliPageActionType::CALI_ACTION_RECALI:
|
||||||
|
this->SetLabel(_L("Recalibration"));
|
||||||
|
break;
|
||||||
|
case CaliPageActionType::CALI_ACTION_NEXT:
|
||||||
|
this->SetLabel(_L("Next"));
|
||||||
|
break;
|
||||||
|
case CaliPageActionType::CALI_ACTION_CALI_NEXT:
|
||||||
|
this->SetLabel(_L("Next"));
|
||||||
|
break;
|
||||||
|
case CaliPageActionType::CALI_ACTION_CALI:
|
||||||
|
this->SetLabel(_L("Calibrate"));
|
||||||
|
break;
|
||||||
|
case CaliPageActionType::CALI_ACTION_FLOW_CALI_STAGE_2:
|
||||||
|
this->SetLabel(_L("Calibrate"));
|
||||||
|
break;
|
||||||
|
case CaliPageActionType::CALI_ACTION_PA_SAVE:
|
||||||
|
this->SetLabel(_L("Finish"));
|
||||||
|
break;
|
||||||
|
case CaliPageActionType::CALI_ACTION_FLOW_SAVE:
|
||||||
|
this->SetLabel(_L("Finish"));
|
||||||
|
break;
|
||||||
|
case CaliPageActionType::CALI_ACTION_FLOW_COARSE_SAVE:
|
||||||
|
this->SetLabel(_L("Finish"));
|
||||||
|
break;
|
||||||
|
case CaliPageActionType::CALI_ACTION_FLOW_FINE_SAVE:
|
||||||
|
this->SetLabel(_L("Finish"));
|
||||||
|
break;
|
||||||
|
case CaliPageActionType::CALI_ACTION_COMMON_SAVE:
|
||||||
|
this->SetLabel(_L("Finish"));
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
this->SetLabel("Unknown");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (m_action_type)
|
||||||
|
{
|
||||||
|
case CaliPageActionType::CALI_ACTION_PREV:
|
||||||
|
case CaliPageActionType::CALI_ACTION_RECALI:
|
||||||
SetBackgroundColor(btn_bg_white);
|
SetBackgroundColor(btn_bg_white);
|
||||||
SetBorderColor(btn_bd_white);
|
SetBorderColor(btn_bd_white);
|
||||||
SetTextColor(btn_text_white);
|
SetTextColor(btn_text_white);
|
||||||
break;
|
break;
|
||||||
case Slic3r::GUI::Start:
|
case CaliPageActionType::CALI_ACTION_START:
|
||||||
case Slic3r::GUI::Next:
|
case CaliPageActionType::CALI_ACTION_NEXT:
|
||||||
case Slic3r::GUI::Calibrate:
|
case CaliPageActionType::CALI_ACTION_CALI:
|
||||||
case Slic3r::GUI::Save:
|
case CaliPageActionType::CALI_ACTION_FLOW_CALI_STAGE_2:
|
||||||
|
case CaliPageActionType::CALI_ACTION_PA_SAVE:
|
||||||
|
case CaliPageActionType::CALI_ACTION_FLOW_SAVE:
|
||||||
|
case CaliPageActionType::CALI_ACTION_FLOW_COARSE_SAVE:
|
||||||
|
case CaliPageActionType::CALI_ACTION_FLOW_FINE_SAVE:
|
||||||
|
case CaliPageActionType::CALI_ACTION_COMMON_SAVE:
|
||||||
SetBackgroundColor(btn_bg_green);
|
SetBackgroundColor(btn_bg_green);
|
||||||
SetBorderColor(btn_bd_green);
|
SetBorderColor(btn_bd_green);
|
||||||
SetTextColor(btn_text_green);
|
SetTextColor(btn_text_green);
|
||||||
|
@ -59,102 +228,358 @@ PageButton::PageButton(wxWindow* parent, wxString text, ButtonType type)
|
||||||
SetCornerRadius(FromDIP(12));
|
SetCornerRadius(FromDIP(12));
|
||||||
}
|
}
|
||||||
|
|
||||||
CalibrationWizardPage::CalibrationWizardPage(wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style)
|
|
||||||
|
FilamentComboBox::FilamentComboBox(wxWindow* parent, const wxPoint& pos, const wxSize& size)
|
||||||
|
: wxPanel(parent, wxID_ANY, pos, size, wxTAB_TRAVERSAL)
|
||||||
|
{
|
||||||
|
wxBoxSizer* main_sizer = new wxBoxSizer(wxHORIZONTAL);
|
||||||
|
|
||||||
|
m_comboBox = new CalibrateFilamentComboBox(this);
|
||||||
|
m_comboBox->SetSize(CALIBRATION_FILAMENT_COMBOX_SIZE);
|
||||||
|
m_comboBox->SetMinSize(CALIBRATION_FILAMENT_COMBOX_SIZE);
|
||||||
|
main_sizer->Add(m_comboBox->clr_picker, 0, wxALIGN_CENTER | wxRIGHT, FromDIP(8));
|
||||||
|
main_sizer->Add(m_comboBox, 0, wxALIGN_CENTER);
|
||||||
|
|
||||||
|
this->SetSizer(main_sizer);
|
||||||
|
this->Layout();
|
||||||
|
main_sizer->Fit(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
void FilamentComboBox::set_select_mode(CalibrationFilamentMode mode)
|
||||||
|
{
|
||||||
|
m_mode = mode;
|
||||||
|
if (m_checkBox)
|
||||||
|
m_checkBox->Show(m_mode == CalibrationFilamentMode::CALI_MODEL_MULITI);
|
||||||
|
if (m_radioBox)
|
||||||
|
m_radioBox->Show(m_mode == CalibrationFilamentMode::CALI_MODEL_SINGLE);
|
||||||
|
|
||||||
|
Layout();
|
||||||
|
}
|
||||||
|
|
||||||
|
void FilamentComboBox::load_tray_from_ams(int id, DynamicPrintConfig& tray)
|
||||||
|
{
|
||||||
|
m_comboBox->load_tray(tray);
|
||||||
|
|
||||||
|
m_tray_id = id;
|
||||||
|
m_tray_name = m_comboBox->get_tray_name();
|
||||||
|
m_is_bbl_filamnet = MachineObject::is_bbl_filament(m_comboBox->get_tag_uid());
|
||||||
|
Enable(m_comboBox->is_tray_exist());
|
||||||
|
|
||||||
|
if (m_comboBox->is_tray_exist()) {
|
||||||
|
if (!m_comboBox->is_compatible_with_printer()) {
|
||||||
|
SetValue(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void FilamentComboBox::update_from_preset() { m_comboBox->update(); }
|
||||||
|
|
||||||
|
bool FilamentComboBox::Show(bool show)
|
||||||
|
{
|
||||||
|
return wxPanel::Show(show);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool FilamentComboBox::Enable(bool enable) {
|
||||||
|
if (!enable)
|
||||||
|
SetValue(false);
|
||||||
|
|
||||||
|
if (m_radioBox)
|
||||||
|
m_radioBox->Enable(enable);
|
||||||
|
if (m_checkBox)
|
||||||
|
m_checkBox->Enable(enable);
|
||||||
|
return wxPanel::Enable(enable);
|
||||||
|
}
|
||||||
|
|
||||||
|
void FilamentComboBox::SetValue(bool value, bool send_event) {
|
||||||
|
if (m_radioBox) {
|
||||||
|
if (value == m_radioBox->GetValue()) {
|
||||||
|
if (m_checkBox) {
|
||||||
|
if (value == m_checkBox->GetValue())
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (m_radioBox)
|
||||||
|
m_radioBox->SetValue(value);
|
||||||
|
if (m_checkBox)
|
||||||
|
m_checkBox->SetValue(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
CaliPageCaption::CaliPageCaption(wxWindow* parent, CalibMode cali_mode,
|
||||||
|
wxWindowID id, const wxPoint& pos, const wxSize& size, long style)
|
||||||
: wxPanel(parent, id, pos, size, style)
|
: wxPanel(parent, id, pos, size, style)
|
||||||
{
|
{
|
||||||
SetBackgroundColour(*wxWHITE);
|
init_bitmaps();
|
||||||
|
|
||||||
wxBoxSizer* page_sizer;
|
auto top_sizer = new wxBoxSizer(wxVERTICAL);
|
||||||
page_sizer = new wxBoxSizer(wxVERTICAL);
|
auto caption_sizer = new wxBoxSizer(wxHORIZONTAL);
|
||||||
|
m_prev_btn = new ScalableButton(this, wxID_ANY, "cali_page_caption_prev",
|
||||||
|
wxEmptyString, wxDefaultSize, wxDefaultPosition, wxBU_EXACTFIT | wxNO_BORDER, true, 30);
|
||||||
|
m_prev_btn->SetBackgroundColour(*wxWHITE);
|
||||||
|
caption_sizer->Add(m_prev_btn, 0, wxALIGN_CENTER | wxRIGHT, FromDIP(10));
|
||||||
|
|
||||||
wxBoxSizer* title_sizer;
|
wxString title = get_cali_mode_caption_string(cali_mode);
|
||||||
title_sizer = new wxBoxSizer(wxHORIZONTAL);
|
wxStaticText* title_text = new wxStaticText(this, wxID_ANY, title, wxDefaultPosition, wxDefaultSize, 0);
|
||||||
|
title_text->Wrap(-1);
|
||||||
|
title_text->SetFont(Label::Head_16);
|
||||||
|
caption_sizer->Add(title_text, 0, wxALIGN_CENTER | wxRIGHT, FromDIP(10));
|
||||||
|
|
||||||
m_title = new wxStaticText(this, wxID_ANY, "", wxDefaultPosition, wxDefaultSize, 0);
|
m_help_btn = new ScalableButton(this, wxID_ANY, "cali_page_caption_help",
|
||||||
m_title->Wrap(-1);
|
wxEmptyString, wxDefaultSize, wxDefaultPosition, wxBU_EXACTFIT | wxNO_BORDER, true, 30);
|
||||||
m_title->SetFont(Label::Head_16);
|
m_help_btn->SetBackgroundColour(*wxWHITE);
|
||||||
title_sizer->Add(m_title, 0, wxALL | wxEXPAND, 0);
|
caption_sizer->Add(m_help_btn, 0, wxALIGN_CENTER);
|
||||||
|
|
||||||
title_sizer->AddStretchSpacer();
|
top_sizer->Add(caption_sizer, 1, wxEXPAND);
|
||||||
|
top_sizer->AddSpacer(FromDIP(35));
|
||||||
|
this->SetSizer(top_sizer);
|
||||||
|
top_sizer->Fit(this);
|
||||||
|
|
||||||
page_sizer->Add(title_sizer, 0, wxEXPAND, 0);
|
// hover effect
|
||||||
|
m_prev_btn->Bind(wxEVT_ENTER_WINDOW, [this](auto& e) {
|
||||||
|
m_prev_btn->SetBitmap(m_prev_bmp_hover.bmp());
|
||||||
|
});
|
||||||
|
|
||||||
page_sizer->AddSpacer(FromDIP(20));
|
m_prev_btn->Bind(wxEVT_LEAVE_WINDOW, [this](auto& e) {
|
||||||
|
m_prev_btn->SetBitmap(m_prev_bmp_normal.bmp());
|
||||||
|
});
|
||||||
|
|
||||||
m_top_sizer = new wxBoxSizer(wxHORIZONTAL);
|
// hover effect
|
||||||
m_top_sizer->AddStretchSpacer();
|
m_help_btn->Bind(wxEVT_ENTER_WINDOW, [this](auto& e) {
|
||||||
m_preset_text = new wxStaticText(this, wxID_ANY, _L("Preset"), wxDefaultPosition, wxDefaultSize, 0);
|
m_help_btn->SetBitmap(m_help_bmp_hover.bmp());
|
||||||
m_preset_text->SetFont(::Label::Head_14);
|
});
|
||||||
m_top_sizer->Add(m_preset_text, 0, wxALIGN_CENTER | wxLEFT | wxRIGHT, FromDIP(15));
|
|
||||||
auto line1 = new wxPanel(this, wxID_ANY, wxDefaultPosition, {FromDIP(200), 1});
|
|
||||||
line1->SetBackgroundColour(*wxBLACK);
|
|
||||||
m_top_sizer->Add(line1, 1, wxALIGN_CENTER, 0);
|
|
||||||
m_calibration_text = new wxStaticText(this, wxID_ANY, _L("Calibration"), wxDefaultPosition, wxDefaultSize, 0);
|
|
||||||
m_calibration_text->SetFont(::Label::Head_14);
|
|
||||||
m_top_sizer->Add(m_calibration_text, 0, wxALIGN_CENTER | wxLEFT | wxRIGHT, FromDIP(15));
|
|
||||||
auto line2 = new wxPanel(this, wxID_ANY, wxDefaultPosition, { FromDIP(200), 1});
|
|
||||||
line2->SetBackgroundColour(*wxBLACK);
|
|
||||||
m_top_sizer->Add(line2, 1, wxALIGN_CENTER, 0);
|
|
||||||
m_record_text = new wxStaticText(this, wxID_ANY, _L("Record"), wxDefaultPosition, wxDefaultSize, 0);
|
|
||||||
m_record_text->SetFont(::Label::Head_14);
|
|
||||||
m_top_sizer->Add(m_record_text, 0, wxALIGN_CENTER | wxLEFT | wxRIGHT, FromDIP(15));
|
|
||||||
m_top_sizer->AddStretchSpacer();
|
|
||||||
page_sizer->Add(m_top_sizer, 0, wxEXPAND, 0);
|
|
||||||
|
|
||||||
page_sizer->AddSpacer(FromDIP(40));
|
m_help_btn->Bind(wxEVT_LEAVE_WINDOW, [this](auto& e) {
|
||||||
|
m_help_btn->SetBitmap(m_help_bmp_normal.bmp());
|
||||||
|
});
|
||||||
|
|
||||||
m_content_sizer = new wxBoxSizer(wxVERTICAL);
|
// send event
|
||||||
|
m_prev_btn->Bind(wxEVT_BUTTON, [this](auto& e) {
|
||||||
page_sizer->Add(m_content_sizer, 0, wxALIGN_CENTER, 0);
|
wxCommandEvent event(EVT_CALI_ACTION);
|
||||||
|
event.SetEventObject(m_parent);
|
||||||
page_sizer->AddSpacer(FromDIP(40));
|
event.SetInt((int)(CaliPageActionType::CALI_ACTION_GO_HOME));
|
||||||
|
wxPostEvent(m_parent, event);
|
||||||
m_btn_sizer = new wxBoxSizer(wxHORIZONTAL);
|
});
|
||||||
m_btn_sizer->AddStretchSpacer();
|
|
||||||
m_btn_prev = new PageButton(this, "Back", Back);
|
|
||||||
m_btn_sizer->Add(m_btn_prev, 0);
|
|
||||||
m_btn_sizer->AddSpacer(FromDIP(10));
|
|
||||||
m_btn_next = new PageButton(this, "Next", Next);
|
|
||||||
m_btn_sizer->Add(m_btn_next, 0);
|
|
||||||
m_btn_sizer->AddStretchSpacer();
|
|
||||||
|
|
||||||
page_sizer->Add(m_btn_sizer, 0, wxEXPAND, 0);
|
|
||||||
|
|
||||||
this->SetSizer(page_sizer);
|
|
||||||
this->Layout();
|
|
||||||
page_sizer->Fit(this);
|
|
||||||
|
|
||||||
m_btn_prev->Bind(wxEVT_BUTTON, &CalibrationWizardPage::on_click_prev, this);
|
|
||||||
m_btn_next->Bind(wxEVT_BUTTON, &CalibrationWizardPage::on_click_next, this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CalibrationWizardPage::set_highlight_step_text(PageType page_type) {
|
void CaliPageCaption::init_bitmaps() {
|
||||||
if (page_type == PageType::Start) {
|
m_prev_bmp_normal = ScalableBitmap(this, "cali_page_caption_prev", 30);
|
||||||
m_top_sizer->Clear(true);
|
m_prev_bmp_hover = ScalableBitmap(this, "cali_page_caption_prev_hover", 30);
|
||||||
Layout();
|
m_help_bmp_normal = ScalableBitmap(this, "cali_page_caption_help", 30);
|
||||||
return;
|
m_help_bmp_hover = ScalableBitmap(this, "cali_page_caption_help_hover", 30);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CaliPageCaption::show_prev_btn(bool show)
|
||||||
|
{
|
||||||
|
m_prev_btn->Show(show);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CaliPageCaption::show_help_icon(bool show)
|
||||||
|
{
|
||||||
|
m_help_btn->Show(show);
|
||||||
|
}
|
||||||
|
|
||||||
|
CaliPageStepGuide::CaliPageStepGuide(wxWindow* parent, wxArrayString steps,
|
||||||
|
wxWindowID id, const wxPoint& pos, const wxSize& size, long style)
|
||||||
|
: wxPanel(parent, id, pos, size, style),
|
||||||
|
m_steps(steps)
|
||||||
|
{
|
||||||
|
auto top_sizer = new wxBoxSizer(wxVERTICAL);
|
||||||
|
|
||||||
|
m_step_sizer = new wxBoxSizer(wxHORIZONTAL);
|
||||||
|
m_step_sizer->AddSpacer(FromDIP(90));
|
||||||
|
for (int i = 0; i < m_steps.size(); i++) {
|
||||||
|
wxStaticText* step_text = new wxStaticText(this, wxID_ANY, m_steps[i]);
|
||||||
|
step_text->SetForegroundColour(wxColour(181, 181, 181));
|
||||||
|
m_text_steps.push_back(step_text);
|
||||||
|
m_step_sizer->Add(step_text, 0, wxALIGN_CENTER | wxLEFT | wxRIGHT, FromDIP(15));
|
||||||
|
if (i != m_steps.size() - 1) {
|
||||||
|
auto line = new wxPanel(this, wxID_ANY, wxDefaultPosition, { FromDIP(200), 1 });
|
||||||
|
line->SetBackgroundColour(*wxBLACK);
|
||||||
|
m_step_sizer->Add(line, 1, wxALIGN_CENTER);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
m_preset_text->SetForegroundColour(wxColour(181, 181, 181));
|
m_step_sizer->AddSpacer(FromDIP(90));
|
||||||
m_calibration_text->SetForegroundColour(wxColour(181, 181, 181));
|
|
||||||
m_record_text->SetForegroundColour(wxColour(181, 181, 181));
|
top_sizer->Add(m_step_sizer, 0, wxEXPAND);
|
||||||
if(page_type == PageType::Preset)
|
top_sizer->AddSpacer(FromDIP(30));
|
||||||
m_preset_text->SetForegroundColour(*wxBLACK);
|
this->SetSizer(top_sizer);
|
||||||
if (page_type == PageType::Calibration || page_type == PageType::CoarseSave || page_type == PageType::FineCalibration)
|
top_sizer->Fit(this);
|
||||||
m_calibration_text->SetForegroundColour(*wxBLACK);
|
|
||||||
if (page_type == PageType::Save)
|
|
||||||
m_record_text->SetForegroundColour(*wxBLACK);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CalibrationWizardPage::on_click_prev(wxCommandEvent&)
|
void CaliPageStepGuide::set_steps(int index)
|
||||||
{
|
{
|
||||||
IntEvent e(EVT_CALIBRATIONPAGE_PREV, static_cast<int>(m_btn_prev->GetButtonType()), m_parent);
|
for (wxStaticText* text_step : m_text_steps) {
|
||||||
m_parent->GetEventHandler()->ProcessEvent(e);
|
text_step->SetForegroundColour(wxColour(181, 181, 181));
|
||||||
|
}
|
||||||
|
m_text_steps[index]->SetForegroundColour(*wxBLACK);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CalibrationWizardPage::on_click_next(wxCommandEvent&)
|
void CaliPageStepGuide::set_steps_string(wxArrayString steps)
|
||||||
{
|
{
|
||||||
IntEvent e(EVT_CALIBRATIONPAGE_NEXT, static_cast<int>(m_btn_next->GetButtonType()), m_parent);
|
m_steps.Clear();
|
||||||
m_parent->GetEventHandler()->ProcessEvent(e);
|
m_text_steps.clear();
|
||||||
|
m_step_sizer->Clear(true);
|
||||||
|
m_steps = steps;
|
||||||
|
m_step_sizer->AddSpacer(FromDIP(90));
|
||||||
|
for (int i = 0; i < m_steps.size(); i++) {
|
||||||
|
wxStaticText* step_text = new wxStaticText(this, wxID_ANY, m_steps[i]);
|
||||||
|
step_text->SetForegroundColour(wxColour(181, 181, 181));
|
||||||
|
m_text_steps.push_back(step_text);
|
||||||
|
m_step_sizer->Add(step_text, 0, wxALIGN_CENTER | wxLEFT | wxRIGHT, FromDIP(15));
|
||||||
|
if (i != m_steps.size() - 1) {
|
||||||
|
auto line = new wxPanel(this, wxID_ANY, wxDefaultPosition, { FromDIP(200), 1 });
|
||||||
|
line->SetBackgroundColour(*wxBLACK);
|
||||||
|
m_step_sizer->Add(line, 1, wxALIGN_CENTER);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
m_step_sizer->AddSpacer(FromDIP(90));
|
||||||
|
Layout();
|
||||||
}
|
}
|
||||||
|
|
||||||
}}
|
|
||||||
|
CaliPageActionPanel::CaliPageActionPanel(wxWindow* parent,
|
||||||
|
CalibMode cali_mode,
|
||||||
|
CaliPageType page_type,
|
||||||
|
wxWindowID id, const wxPoint& pos, const wxSize& size, long style)
|
||||||
|
: wxPanel(parent, id, pos, size, style)
|
||||||
|
{
|
||||||
|
m_parent = parent;
|
||||||
|
|
||||||
|
wxWindow* btn_parent = this;
|
||||||
|
|
||||||
|
if (cali_mode == CalibMode::Calib_PA_Line) {
|
||||||
|
if (page_type == CaliPageType::CALI_PAGE_START) {
|
||||||
|
m_action_btns.push_back(new CaliPageButton(btn_parent, CaliPageActionType::CALI_ACTION_MANAGE_RESULT));
|
||||||
|
m_action_btns.push_back(new CaliPageButton(btn_parent, CaliPageActionType::CALI_ACTION_MANUAL_CALI));
|
||||||
|
m_action_btns.push_back(new CaliPageButton(btn_parent, CaliPageActionType::CALI_ACTION_AUTO_CALI));
|
||||||
|
}
|
||||||
|
else if (page_type == CaliPageType::CALI_PAGE_PRESET) {
|
||||||
|
m_action_btns.push_back(new CaliPageButton(btn_parent, CaliPageActionType::CALI_ACTION_CALI));
|
||||||
|
}
|
||||||
|
else if (page_type == CaliPageType::CALI_PAGE_CALI) {
|
||||||
|
m_action_btns.push_back(new CaliPageButton(btn_parent, CaliPageActionType::CALI_ACTION_CALI_NEXT));
|
||||||
|
}
|
||||||
|
else if (page_type == CaliPageType::CALI_PAGE_PA_SAVE) {
|
||||||
|
m_action_btns.push_back(new CaliPageButton(btn_parent, CaliPageActionType::CALI_ACTION_PA_SAVE));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (cali_mode == CalibMode::Calib_Flow_Rate) {
|
||||||
|
if (page_type == CaliPageType::CALI_PAGE_START) {
|
||||||
|
m_action_btns.push_back(new CaliPageButton(btn_parent, CaliPageActionType::CALI_ACTION_MANUAL_CALI));
|
||||||
|
m_action_btns.push_back(new CaliPageButton(btn_parent, CaliPageActionType::CALI_ACTION_AUTO_CALI));
|
||||||
|
}
|
||||||
|
else if (page_type == CaliPageType::CALI_PAGE_PRESET) {
|
||||||
|
m_action_btns.push_back(new CaliPageButton(btn_parent, CaliPageActionType::CALI_ACTION_CALI));
|
||||||
|
}
|
||||||
|
else if (page_type == CaliPageType::CALI_PAGE_CALI) {
|
||||||
|
m_action_btns.push_back(new CaliPageButton(btn_parent, CaliPageActionType::CALI_ACTION_NEXT));
|
||||||
|
}
|
||||||
|
else if (page_type == CaliPageType::CALI_PAGE_COARSE_SAVE) {
|
||||||
|
m_action_btns.push_back(new CaliPageButton(btn_parent, CaliPageActionType::CALI_ACTION_FLOW_COARSE_SAVE));
|
||||||
|
m_action_btns.push_back(new CaliPageButton(btn_parent, CaliPageActionType::CALI_ACTION_FLOW_CALI_STAGE_2));
|
||||||
|
}
|
||||||
|
else if (page_type == CaliPageType::CALI_PAGE_FINE_SAVE) {
|
||||||
|
m_action_btns.push_back(new CaliPageButton(btn_parent, CaliPageActionType::CALI_ACTION_FLOW_FINE_SAVE));
|
||||||
|
}
|
||||||
|
else if (page_type == CaliPageType::CALI_PAGE_FLOW_SAVE) {
|
||||||
|
m_action_btns.push_back(new CaliPageButton(btn_parent, CaliPageActionType::CALI_ACTION_FLOW_SAVE));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (page_type == CaliPageType::CALI_PAGE_START) {
|
||||||
|
m_action_btns.push_back(new CaliPageButton(btn_parent, CaliPageActionType::CALI_ACTION_START));
|
||||||
|
}
|
||||||
|
else if (page_type == CaliPageType::CALI_PAGE_PRESET) {
|
||||||
|
m_action_btns.push_back(new CaliPageButton(btn_parent, CaliPageActionType::CALI_ACTION_CALI));
|
||||||
|
}
|
||||||
|
else if (page_type == CaliPageType::CALI_PAGE_CALI) {
|
||||||
|
m_action_btns.push_back(new CaliPageButton(btn_parent, CaliPageActionType::CALI_ACTION_NEXT));
|
||||||
|
}
|
||||||
|
else if (page_type == CaliPageType::CALI_PAGE_COMMON_SAVE) {
|
||||||
|
m_action_btns.push_back(new CaliPageButton(btn_parent, CaliPageActionType::CALI_ACTION_COMMON_SAVE));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
m_action_btns.push_back(new CaliPageButton(btn_parent, CaliPageActionType::CALI_ACTION_PREV));
|
||||||
|
m_action_btns.push_back(new CaliPageButton(btn_parent, CaliPageActionType::CALI_ACTION_NEXT));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
auto top_sizer = new wxBoxSizer(wxHORIZONTAL);
|
||||||
|
|
||||||
|
top_sizer->Add(0, 0, 1, wxEXPAND, 5);
|
||||||
|
for (int i = 0; i < m_action_btns.size(); i++) {
|
||||||
|
top_sizer->Add(m_action_btns[i], 0, wxALL, 5);
|
||||||
|
|
||||||
|
m_action_btns[i]->Bind(wxEVT_BUTTON,
|
||||||
|
[this, i](wxCommandEvent& evt) {
|
||||||
|
wxCommandEvent event(EVT_CALI_ACTION);
|
||||||
|
event.SetEventObject(m_parent);
|
||||||
|
event.SetInt((int)m_action_btns[i]->get_action_type());
|
||||||
|
wxPostEvent(m_parent, event);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
top_sizer->Add(0, 0, 1, wxEXPAND, 5);
|
||||||
|
|
||||||
|
this->SetSizer(top_sizer);
|
||||||
|
top_sizer->Fit(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CaliPageActionPanel::bind_button(CaliPageActionType action_type, bool is_block)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < m_action_btns.size(); i++) {
|
||||||
|
if (m_action_btns[i]->get_action_type() == action_type) {
|
||||||
|
|
||||||
|
if (is_block) {
|
||||||
|
m_action_btns[i]->Bind(wxEVT_BUTTON,
|
||||||
|
[this](wxCommandEvent& evt) {
|
||||||
|
MessageDialog msg(nullptr, _L("The current firmware version of the printer does not support calibration.\nPlease upgrade the printer firmware."), _L("Calibration not supported"), wxOK | wxICON_WARNING);
|
||||||
|
msg.ShowModal();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
m_action_btns[i]->Bind(wxEVT_BUTTON,
|
||||||
|
[this, i](wxCommandEvent& evt) {
|
||||||
|
wxCommandEvent event(EVT_CALI_ACTION);
|
||||||
|
event.SetEventObject(m_parent);
|
||||||
|
event.SetInt((int)m_action_btns[i]->get_action_type());
|
||||||
|
wxPostEvent(m_parent, event);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void CaliPageActionPanel::show_button(CaliPageActionType action_type, bool show)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < m_action_btns.size(); i++) {
|
||||||
|
if (m_action_btns[i]->get_action_type() == action_type) {
|
||||||
|
m_action_btns[i]->Show(show);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CaliPageActionPanel::enable_button(CaliPageActionType action_type, bool enable)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < m_action_btns.size(); i++) {
|
||||||
|
if (m_action_btns[i]->get_action_type() == action_type) {
|
||||||
|
m_action_btns[i]->Enable(enable);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
CalibrationWizardPage::CalibrationWizardPage(wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style)
|
||||||
|
: wxPanel(parent, id, pos, size, style)
|
||||||
|
, m_parent(parent)
|
||||||
|
{
|
||||||
|
SetBackgroundColour(*wxWHITE);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}}
|
||||||
|
|
|
@ -1,45 +1,206 @@
|
||||||
#ifndef slic3r_GUI_CalibrationWizardPage_hpp_
|
#ifndef slic3r_GUI_CalibrationWizardPage_hpp_
|
||||||
#define slic3r_GUI_CalibrationWizardPage_hpp_
|
#define slic3r_GUI_CalibrationWizardPage_hpp_
|
||||||
|
|
||||||
|
#include "wx/event.h"
|
||||||
#include "Widgets/Button.hpp"
|
#include "Widgets/Button.hpp"
|
||||||
#include "Event.hpp"
|
#include "Widgets/ComboBox.hpp"
|
||||||
|
#include "Widgets/TextInput.hpp"
|
||||||
|
#include "Widgets/AMSControl.hpp"
|
||||||
|
#include "Widgets/ProgressBar.hpp"
|
||||||
|
#include "wxExtensions.hpp"
|
||||||
|
#include "PresetComboBoxes.hpp"
|
||||||
|
|
||||||
|
#include "../slic3r/Utils/CalibUtils.hpp"
|
||||||
|
#include "../../libslic3r/Calib.hpp"
|
||||||
|
|
||||||
namespace Slic3r { namespace GUI {
|
namespace Slic3r { namespace GUI {
|
||||||
|
|
||||||
wxDECLARE_EVENT(EVT_CALIBRATIONPAGE_PREV, IntEvent);
|
|
||||||
wxDECLARE_EVENT(EVT_CALIBRATIONPAGE_NEXT, IntEvent);
|
#define PRESET_GAP FromDIP(25)
|
||||||
|
#define CALIBRATION_COMBOX_SIZE wxSize(FromDIP(500), FromDIP(24))
|
||||||
|
#define CALIBRATION_FILAMENT_COMBOX_SIZE wxSize(FromDIP(250), FromDIP(24))
|
||||||
|
#define CALIBRATION_OPTIMAL_INPUT_SIZE wxSize(FromDIP(300), FromDIP(24))
|
||||||
|
#define CALIBRATION_FROM_TO_INPUT_SIZE wxSize(FromDIP(160), FromDIP(24))
|
||||||
|
#define CALIBRATION_FGSIZER_HGAP FromDIP(50)
|
||||||
|
#define CALIBRATION_TEXT_MAX_LENGTH FromDIP(90) + CALIBRATION_FGSIZER_HGAP + 2 * CALIBRATION_FILAMENT_COMBOX_SIZE.x
|
||||||
|
#define CALIBRATION_PROGRESSBAR_LENGTH FromDIP(690)
|
||||||
|
|
||||||
class CalibrationWizard;
|
class CalibrationWizard;
|
||||||
enum ButtonType
|
|
||||||
|
enum class CalibrationStyle : int
|
||||||
{
|
{
|
||||||
Start,
|
CALI_STYLE_DEFAULT = 0,
|
||||||
Restart,
|
CALI_STYLE_X1,
|
||||||
Back,
|
CALI_STYLE_P1P,
|
||||||
Next,
|
|
||||||
Calibrate,
|
|
||||||
Recalibrate,
|
|
||||||
Save,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class PageButton : public Button
|
CalibrationStyle get_cali_style(MachineObject* obj);
|
||||||
|
|
||||||
|
wxString get_cali_mode_caption_string(CalibMode mode);
|
||||||
|
|
||||||
|
enum CalibrationFilamentMode {
|
||||||
|
/* calibration single filament at once */
|
||||||
|
CALI_MODEL_SINGLE = 0,
|
||||||
|
/* calibration multi filament at once */
|
||||||
|
CALI_MODEL_MULITI,
|
||||||
|
};
|
||||||
|
|
||||||
|
enum CalibrationMethod {
|
||||||
|
CALI_METHOD_MANUAL = 0,
|
||||||
|
CALI_METHOD_AUTO,
|
||||||
|
CALI_METHOD_NONE,
|
||||||
|
};
|
||||||
|
|
||||||
|
wxString get_calibration_wiki_page(CalibMode cali_mode);
|
||||||
|
|
||||||
|
CalibrationFilamentMode get_cali_filament_mode(MachineObject* obj, CalibMode mode);
|
||||||
|
|
||||||
|
CalibMode get_obj_calibration_mode(const MachineObject* obj);
|
||||||
|
|
||||||
|
CalibMode get_obj_calibration_mode(const MachineObject* obj, int& cali_stage);
|
||||||
|
|
||||||
|
CalibMode get_obj_calibration_mode(const MachineObject* obj, CalibrationMethod& method, int& cali_stage);
|
||||||
|
|
||||||
|
|
||||||
|
enum class CaliPageType {
|
||||||
|
CALI_PAGE_START = 0,
|
||||||
|
CALI_PAGE_PRESET,
|
||||||
|
CALI_PAGE_CALI,
|
||||||
|
CALI_PAGE_COARSE_SAVE,
|
||||||
|
CALI_PAGE_FINE_CALI,
|
||||||
|
CALI_PAGE_FINE_SAVE,
|
||||||
|
CALI_PAGE_PA_SAVE,
|
||||||
|
CALI_PAGE_FLOW_SAVE,
|
||||||
|
CALI_PAGE_COMMON_SAVE,
|
||||||
|
};
|
||||||
|
|
||||||
|
class FilamentComboBox : public wxPanel
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
PageButton(wxWindow* parent, wxString text, ButtonType type);
|
FilamentComboBox(wxWindow* parent, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize);
|
||||||
void SetButtonType(ButtonType rhs_type) { m_type = rhs_type; }
|
~FilamentComboBox() {};
|
||||||
ButtonType GetButtonType() { return m_type; }
|
|
||||||
~PageButton() {};
|
void set_select_mode(CalibrationFilamentMode mode);
|
||||||
private:
|
CalibrationFilamentMode get_select_mode() { return m_mode; }
|
||||||
ButtonType m_type;
|
void load_tray_from_ams(int id, DynamicPrintConfig& tray);
|
||||||
|
void update_from_preset();
|
||||||
|
int get_tray_id() { return m_tray_id; }
|
||||||
|
bool is_bbl_filament() { return m_is_bbl_filamnet; }
|
||||||
|
std::string get_tray_name() { return m_tray_name; }
|
||||||
|
CalibrateFilamentComboBox* GetComboBox() { return m_comboBox; }
|
||||||
|
CheckBox* GetCheckBox() { return m_checkBox; }
|
||||||
|
void SetCheckBox(CheckBox* cb) { m_checkBox = cb; }
|
||||||
|
wxRadioButton* GetRadioBox() { return m_radioBox; }
|
||||||
|
void SetRadioBox(wxRadioButton* btn) { m_radioBox = btn; }
|
||||||
|
virtual bool Show(bool show = true);
|
||||||
|
virtual bool Enable(bool enable);
|
||||||
|
virtual void SetValue(bool value, bool send_event = true);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
int m_tray_id { -1 };
|
||||||
|
std::string m_tray_name;
|
||||||
|
bool m_is_bbl_filamnet{ false };
|
||||||
|
|
||||||
|
CheckBox* m_checkBox{ nullptr };
|
||||||
|
wxRadioButton* m_radioBox{ nullptr };
|
||||||
|
CalibrateFilamentComboBox* m_comboBox{ nullptr };
|
||||||
|
CalibrationFilamentMode m_mode { CalibrationFilamentMode::CALI_MODEL_SINGLE };
|
||||||
};
|
};
|
||||||
|
|
||||||
enum class PageType {
|
typedef std::vector<FilamentComboBox*> FilamentComboBoxList;
|
||||||
Start,
|
|
||||||
Preset,
|
class CaliPageCaption : public wxPanel
|
||||||
Calibration,
|
{
|
||||||
CoarseSave,
|
public:
|
||||||
FineCalibration,
|
CaliPageCaption(wxWindow* parent,
|
||||||
Save,
|
CalibMode cali_mode,
|
||||||
Finish,
|
wxWindowID id = wxID_ANY,
|
||||||
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
|
const wxSize& size = wxDefaultSize,
|
||||||
|
long style = wxTAB_TRAVERSAL);
|
||||||
|
|
||||||
|
void show_prev_btn(bool show = true);
|
||||||
|
void show_help_icon(bool show = true);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
ScalableButton* m_prev_btn;
|
||||||
|
ScalableButton* m_help_btn;
|
||||||
|
|
||||||
|
private:
|
||||||
|
void init_bitmaps();
|
||||||
|
|
||||||
|
ScalableBitmap m_prev_bmp_normal;
|
||||||
|
ScalableBitmap m_prev_bmp_hover;
|
||||||
|
ScalableBitmap m_help_bmp_normal;
|
||||||
|
ScalableBitmap m_help_bmp_hover;
|
||||||
|
};
|
||||||
|
|
||||||
|
class CaliPageStepGuide : public wxPanel
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CaliPageStepGuide(wxWindow* parent,
|
||||||
|
wxArrayString steps,
|
||||||
|
wxWindowID id = wxID_ANY,
|
||||||
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
|
const wxSize& size = wxDefaultSize,
|
||||||
|
long style = wxTAB_TRAVERSAL);
|
||||||
|
|
||||||
|
void set_steps(int index);
|
||||||
|
void set_steps_string(wxArrayString steps);
|
||||||
|
protected:
|
||||||
|
wxArrayString m_steps;
|
||||||
|
wxBoxSizer* m_step_sizer;
|
||||||
|
std::vector<wxStaticText*> m_text_steps;
|
||||||
|
};
|
||||||
|
|
||||||
|
enum class CaliPageActionType : int
|
||||||
|
{
|
||||||
|
CALI_ACTION_MANAGE_RESULT = 0,
|
||||||
|
CALI_ACTION_MANUAL_CALI,
|
||||||
|
CALI_ACTION_AUTO_CALI,
|
||||||
|
CALI_ACTION_START,
|
||||||
|
CALI_ACTION_CALI,
|
||||||
|
CALI_ACTION_FLOW_CALI_STAGE_2,
|
||||||
|
CALI_ACTION_RECALI,
|
||||||
|
CALI_ACTION_PREV,
|
||||||
|
CALI_ACTION_NEXT,
|
||||||
|
CALI_ACTION_CALI_NEXT,
|
||||||
|
CALI_ACTION_PA_SAVE,
|
||||||
|
CALI_ACTION_FLOW_SAVE,
|
||||||
|
CALI_ACTION_FLOW_COARSE_SAVE,
|
||||||
|
CALI_ACTION_FLOW_FINE_SAVE,
|
||||||
|
CALI_ACTION_COMMON_SAVE,
|
||||||
|
CALI_ACTION_GO_HOME,
|
||||||
|
CALI_ACTION_COUNT
|
||||||
|
};
|
||||||
|
|
||||||
|
class CaliPageButton : public Button
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CaliPageButton(wxWindow* parent, CaliPageActionType type, wxString text = wxEmptyString);
|
||||||
|
|
||||||
|
CaliPageActionType get_action_type() { return m_action_type; }
|
||||||
|
private:
|
||||||
|
CaliPageActionType m_action_type;
|
||||||
|
};
|
||||||
|
|
||||||
|
class CaliPageActionPanel : public wxPanel
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CaliPageActionPanel(wxWindow* parent,
|
||||||
|
CalibMode cali_mode,
|
||||||
|
CaliPageType page_type,
|
||||||
|
wxWindowID id = wxID_ANY,
|
||||||
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
|
const wxSize& size = wxDefaultSize,
|
||||||
|
long style = wxTAB_TRAVERSAL);
|
||||||
|
|
||||||
|
void bind_button(CaliPageActionType action_type, bool is_block);
|
||||||
|
void show_button(CaliPageActionType action_type, bool show = true);
|
||||||
|
void enable_button(CaliPageActionType action_type, bool enable = true);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
std::vector<CaliPageButton*> m_action_btns;
|
||||||
};
|
};
|
||||||
|
|
||||||
class CalibrationWizardPage : public wxPanel
|
class CalibrationWizardPage : public wxPanel
|
||||||
|
@ -48,6 +209,8 @@ public:
|
||||||
CalibrationWizardPage(wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxTAB_TRAVERSAL);
|
CalibrationWizardPage(wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxTAB_TRAVERSAL);
|
||||||
~CalibrationWizardPage() {};
|
~CalibrationWizardPage() {};
|
||||||
|
|
||||||
|
CaliPageType get_page_type() { return m_page_type; }
|
||||||
|
|
||||||
CalibrationWizardPage* get_prev_page() { return m_prev_page; }
|
CalibrationWizardPage* get_prev_page() { return m_prev_page; }
|
||||||
CalibrationWizardPage* get_next_page() { return m_next_page; }
|
CalibrationWizardPage* get_next_page() { return m_next_page; }
|
||||||
void set_prev_page(CalibrationWizardPage* prev) { m_prev_page = prev; }
|
void set_prev_page(CalibrationWizardPage* prev) { m_prev_page = prev; }
|
||||||
|
@ -59,36 +222,43 @@ public:
|
||||||
return next;
|
return next;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxBoxSizer* get_top_hsizer() { return m_top_sizer; }
|
virtual void update(MachineObject* obj) { curr_obj = obj; }
|
||||||
wxBoxSizer* get_content_vsizer() { return m_content_sizer; }
|
/* device changed and connected */
|
||||||
wxBoxSizer* get_btn_hsizer() { return m_btn_sizer; }
|
virtual void on_device_connected(MachineObject* obj) {}
|
||||||
PageButton* get_prev_btn() { return m_btn_prev; }
|
|
||||||
PageButton* get_next_btn() { return m_btn_next; }
|
|
||||||
PageType get_page_type() { return m_page_type; }
|
|
||||||
|
|
||||||
void set_page_type(PageType type) { m_page_type = type; }
|
virtual void on_reset_page() {}
|
||||||
void set_page_title(wxString title) { m_title->SetLabel(title); }
|
|
||||||
void set_highlight_step_text(PageType page_type);
|
virtual void set_cali_filament_mode(CalibrationFilamentMode mode) {
|
||||||
|
m_cali_filament_mode = mode;
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void set_cali_method(CalibrationMethod method) {
|
||||||
|
m_cali_method = method;
|
||||||
|
if (method == CalibrationMethod::CALI_METHOD_MANUAL) {
|
||||||
|
set_cali_filament_mode(CalibrationFilamentMode::CALI_MODEL_SINGLE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected:
|
||||||
|
CalibMode m_cali_mode;
|
||||||
|
CaliPageType m_page_type;
|
||||||
|
CalibrationFilamentMode m_cali_filament_mode;
|
||||||
|
CalibrationMethod m_cali_method{ CalibrationMethod::CALI_METHOD_MANUAL };
|
||||||
|
MachineObject* curr_obj { nullptr };
|
||||||
|
|
||||||
|
wxWindow* m_parent { nullptr };
|
||||||
|
CaliPageCaption* m_page_caption { nullptr };
|
||||||
|
CaliPageActionPanel* m_action_panel { nullptr };
|
||||||
|
|
||||||
private:
|
private:
|
||||||
wxStaticText* m_title;
|
CalibrationWizardPage* m_prev_page {nullptr};
|
||||||
wxBoxSizer* m_top_sizer;
|
CalibrationWizardPage* m_next_page {nullptr};
|
||||||
wxStaticText* m_preset_text;
|
|
||||||
wxStaticText* m_calibration_text;
|
|
||||||
wxStaticText* m_record_text;
|
|
||||||
wxBoxSizer* m_content_sizer;
|
|
||||||
wxBoxSizer* m_btn_sizer;
|
|
||||||
PageButton* m_btn_prev;
|
|
||||||
PageButton* m_btn_next;
|
|
||||||
PageType m_page_type;
|
|
||||||
|
|
||||||
CalibrationWizardPage* m_prev_page{nullptr};
|
|
||||||
CalibrationWizardPage* m_next_page{nullptr};
|
|
||||||
|
|
||||||
void on_click_prev(wxCommandEvent&);
|
|
||||||
void on_click_next(wxCommandEvent&);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
wxDECLARE_EVENT(EVT_CALI_ACTION, wxCommandEvent);
|
||||||
|
wxDECLARE_EVENT(EVT_CALI_TRAY_CHANGED, wxCommandEvent);
|
||||||
|
|
||||||
|
|
||||||
}} // namespace Slic3r::GUI
|
}} // namespace Slic3r::GUI
|
||||||
|
|
||||||
#endif
|
#endif
|
1408
src/slic3r/GUI/CalibrationWizardPresetPage.cpp
Normal file
259
src/slic3r/GUI/CalibrationWizardPresetPage.hpp
Normal file
|
@ -0,0 +1,259 @@
|
||||||
|
#ifndef slic3r_GUI_CalibrationWizardPresetPage_hpp_
|
||||||
|
#define slic3r_GUI_CalibrationWizardPresetPage_hpp_
|
||||||
|
|
||||||
|
#include "CalibrationWizardPage.hpp"
|
||||||
|
|
||||||
|
namespace Slic3r { namespace GUI {
|
||||||
|
|
||||||
|
enum CaliPresetStage {
|
||||||
|
CALI_MANULA_STAGE_NONE = 0,
|
||||||
|
CALI_MANUAL_STAGE_1,
|
||||||
|
CALI_MANUAL_STAGE_2,
|
||||||
|
};
|
||||||
|
|
||||||
|
class CaliPresetCaliStagePanel : public wxPanel
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CaliPresetCaliStagePanel(wxWindow* parent,
|
||||||
|
wxWindowID id = wxID_ANY,
|
||||||
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
|
const wxSize& size = wxDefaultSize,
|
||||||
|
long style = wxTAB_TRAVERSAL);
|
||||||
|
void create_panel(wxWindow* parent);
|
||||||
|
|
||||||
|
void set_cali_stage(CaliPresetStage stage, float value);
|
||||||
|
void get_cali_stage(CaliPresetStage& stage, float& value);
|
||||||
|
|
||||||
|
void set_flow_ratio_value(wxString flow_ratio);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
CaliPresetStage m_stage;
|
||||||
|
wxBoxSizer* m_top_sizer;
|
||||||
|
wxRadioButton* m_complete_radioBox;
|
||||||
|
wxRadioButton* m_fine_radioBox;
|
||||||
|
TextInput * flow_ratio_input;
|
||||||
|
float m_flow_ratio_value;
|
||||||
|
};
|
||||||
|
|
||||||
|
class CaliPresetWarningPanel : public wxPanel
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CaliPresetWarningPanel(wxWindow* parent,
|
||||||
|
wxWindowID id = wxID_ANY,
|
||||||
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
|
const wxSize& size = wxDefaultSize,
|
||||||
|
long style = wxTAB_TRAVERSAL);
|
||||||
|
|
||||||
|
void create_panel(wxWindow* parent);
|
||||||
|
|
||||||
|
void set_warning(wxString text);
|
||||||
|
protected:
|
||||||
|
wxBoxSizer* m_top_sizer;
|
||||||
|
wxStaticText* m_warning_text;
|
||||||
|
};
|
||||||
|
|
||||||
|
class CaliPresetTipsPanel : public wxPanel
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CaliPresetTipsPanel(wxWindow* parent,
|
||||||
|
wxWindowID id = wxID_ANY,
|
||||||
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
|
const wxSize& size = wxDefaultSize,
|
||||||
|
long style = wxTAB_TRAVERSAL);
|
||||||
|
|
||||||
|
void create_panel(wxWindow* parent);
|
||||||
|
|
||||||
|
void set_params(int nozzle_temp, int bed_temp, float max_volumetric);
|
||||||
|
void get_params(int& nozzle_temp, int& bed_temp, float& max_volumetric);
|
||||||
|
protected:
|
||||||
|
wxBoxSizer* m_top_sizer;
|
||||||
|
TextInput* m_nozzle_temp;
|
||||||
|
TextInput* m_bed_temp;
|
||||||
|
TextInput* m_max_volumetric_speed;
|
||||||
|
};
|
||||||
|
|
||||||
|
class CaliPresetCustomRangePanel : public wxPanel
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CaliPresetCustomRangePanel(wxWindow* parent,
|
||||||
|
int input_value_nums = 3,
|
||||||
|
wxWindowID id = wxID_ANY,
|
||||||
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
|
const wxSize& size = wxDefaultSize,
|
||||||
|
long style = wxTAB_TRAVERSAL);
|
||||||
|
|
||||||
|
void create_panel(wxWindow* parent);
|
||||||
|
|
||||||
|
void set_unit(wxString unit);
|
||||||
|
void set_titles(wxArrayString titles);
|
||||||
|
void set_values(wxArrayString values);
|
||||||
|
wxArrayString get_values();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
wxBoxSizer* m_top_sizer;
|
||||||
|
int m_input_value_nums;
|
||||||
|
std::vector<wxStaticText*> m_title_texts;
|
||||||
|
std::vector<TextInput*> m_value_inputs;
|
||||||
|
};
|
||||||
|
|
||||||
|
enum CaliPresetPageStatus
|
||||||
|
{
|
||||||
|
CaliPresetStatusInit = 0,
|
||||||
|
CaliPresetStatusNormal,
|
||||||
|
CaliPresetStatusSending,
|
||||||
|
};
|
||||||
|
|
||||||
|
class CalibrationPresetPage : public CalibrationWizardPage
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CalibrationPresetPage(wxWindow* parent,
|
||||||
|
CalibMode cali_mode,
|
||||||
|
bool custom_range = false,
|
||||||
|
wxWindowID id = wxID_ANY,
|
||||||
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
|
const wxSize& size = wxDefaultSize,
|
||||||
|
long style = wxTAB_TRAVERSAL);
|
||||||
|
|
||||||
|
void create_page(wxWindow* parent);
|
||||||
|
|
||||||
|
void update(MachineObject* obj) override;
|
||||||
|
|
||||||
|
void on_device_connected(MachineObject* obj) override;
|
||||||
|
|
||||||
|
void update_print_error_info(int code, const std::string& msg, const std::string& extra);
|
||||||
|
|
||||||
|
void show_send_failed_info(bool show, int code = 0, wxString description = wxEmptyString, wxString extra = wxEmptyString);
|
||||||
|
|
||||||
|
void set_cali_filament_mode(CalibrationFilamentMode mode) override;
|
||||||
|
|
||||||
|
void set_cali_method(CalibrationMethod method) override;
|
||||||
|
|
||||||
|
void on_cali_start_job();
|
||||||
|
|
||||||
|
void on_cali_finished_job();
|
||||||
|
|
||||||
|
void init_with_machine(MachineObject* obj);
|
||||||
|
|
||||||
|
void sync_ams_info(MachineObject* obj);
|
||||||
|
|
||||||
|
void select_default_compatible_filament();
|
||||||
|
|
||||||
|
std::vector<FilamentComboBox*> get_selected_filament_combobox();
|
||||||
|
|
||||||
|
// key is tray_id
|
||||||
|
std::map<int, Preset*> get_selected_filaments();
|
||||||
|
|
||||||
|
void get_preset_info(
|
||||||
|
float& nozzle_dia,
|
||||||
|
BedType& plate_type);
|
||||||
|
|
||||||
|
void get_cali_stage(CaliPresetStage& stage, float& value);
|
||||||
|
|
||||||
|
std::shared_ptr<ProgressIndicator> get_sending_progress_bar() {
|
||||||
|
return m_send_progress_bar;
|
||||||
|
}
|
||||||
|
|
||||||
|
Preset* get_printer_preset(MachineObject* obj, float nozzle_value);
|
||||||
|
Preset* get_print_preset();
|
||||||
|
std::string get_print_preset_name();
|
||||||
|
|
||||||
|
wxArrayString get_custom_range_values();
|
||||||
|
|
||||||
|
CaliPresetPageStatus get_page_status() { return m_page_status; }
|
||||||
|
protected:
|
||||||
|
void create_selection_panel(wxWindow* parent);
|
||||||
|
void create_filament_list_panel(wxWindow* parent);
|
||||||
|
void create_ext_spool_panel(wxWindow* parent);
|
||||||
|
void create_sending_panel(wxWindow* parent);
|
||||||
|
|
||||||
|
void init_selection_values();
|
||||||
|
void update_filament_combobox(std::string ams_id = "");
|
||||||
|
|
||||||
|
void on_select_nozzle(wxCommandEvent& evt);
|
||||||
|
void on_select_plate_type(wxCommandEvent& evt);
|
||||||
|
|
||||||
|
void on_choose_ams(wxCommandEvent& event);
|
||||||
|
void on_choose_ext_spool(wxCommandEvent& event);
|
||||||
|
|
||||||
|
void on_select_tray(wxCommandEvent& event);
|
||||||
|
|
||||||
|
void on_switch_ams(std::string ams_id = "");
|
||||||
|
|
||||||
|
void on_recommend_input_value();
|
||||||
|
|
||||||
|
void check_filament_compatible();
|
||||||
|
bool is_filaments_compatiable(const std::vector<Preset*>& prests);
|
||||||
|
bool is_filaments_compatiable(const std::vector<Preset*>& prests,
|
||||||
|
int& bed_temp,
|
||||||
|
std::string& incompatiable_filament_name,
|
||||||
|
std::string& error_tips);
|
||||||
|
|
||||||
|
void update_combobox_filaments(MachineObject* obj);
|
||||||
|
|
||||||
|
float get_nozzle_value();
|
||||||
|
|
||||||
|
void show_status(CaliPresetPageStatus status);
|
||||||
|
|
||||||
|
CaliPageStepGuide* m_step_panel { nullptr };
|
||||||
|
CaliPresetCaliStagePanel* m_cali_stage_panel { nullptr };
|
||||||
|
wxPanel* m_selection_panel { nullptr };
|
||||||
|
wxPanel* m_filament_from_panel { nullptr };
|
||||||
|
wxPanel* m_multi_ams_panel { nullptr };
|
||||||
|
wxPanel* m_filament_list_panel { nullptr };
|
||||||
|
wxPanel* m_ext_spool_panel { nullptr };
|
||||||
|
CaliPresetWarningPanel* m_warning_panel { nullptr };
|
||||||
|
CaliPresetCustomRangePanel* m_custom_range_panel { nullptr };
|
||||||
|
CaliPresetTipsPanel* m_tips_panel { nullptr };
|
||||||
|
wxPanel* m_sending_panel { nullptr };
|
||||||
|
|
||||||
|
wxBoxSizer* m_top_sizer;
|
||||||
|
|
||||||
|
// m_selection_panel widgets
|
||||||
|
ComboBox* m_comboBox_nozzle_dia;
|
||||||
|
ComboBox* m_comboBox_bed_type;
|
||||||
|
ComboBox* m_comboBox_process;
|
||||||
|
|
||||||
|
wxRadioButton* m_ams_radiobox;
|
||||||
|
wxRadioButton* m_ext_spool_radiobox;
|
||||||
|
|
||||||
|
ScalableButton* m_ams_sync_button;
|
||||||
|
FilamentComboBoxList m_filament_comboBox_list;
|
||||||
|
FilamentComboBox* m_virtual_tray_comboBox;
|
||||||
|
|
||||||
|
// m_sending panel widgets
|
||||||
|
std::shared_ptr<BBLStatusBarSend> m_send_progress_bar;
|
||||||
|
wxScrolledWindow* m_sw_print_failed_info { nullptr };
|
||||||
|
Label* m_st_txt_error_code { nullptr };
|
||||||
|
Label* m_st_txt_error_desc { nullptr };
|
||||||
|
Label* m_st_txt_extra_info { nullptr };
|
||||||
|
int m_print_error_code;
|
||||||
|
std::string m_print_error_msg;
|
||||||
|
std::string m_print_error_extra;
|
||||||
|
|
||||||
|
std::vector<AMSItem*> m_ams_item_list;
|
||||||
|
|
||||||
|
// for update filament combobox, key : tray_id
|
||||||
|
std::map<int, DynamicPrintConfig> filament_ams_list;
|
||||||
|
|
||||||
|
CaliPresetPageStatus m_page_status { CaliPresetPageStatus::CaliPresetStatusInit };
|
||||||
|
|
||||||
|
bool m_show_custom_range { false };
|
||||||
|
|
||||||
|
MachineObject* curr_obj { nullptr };
|
||||||
|
};
|
||||||
|
|
||||||
|
class MaxVolumetricSpeedPresetPage : public CalibrationPresetPage
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
MaxVolumetricSpeedPresetPage(wxWindow * parent,
|
||||||
|
CalibMode cali_mode,
|
||||||
|
bool custom_range = false,
|
||||||
|
wxWindowID id = wxID_ANY,
|
||||||
|
const wxPoint &pos = wxDefaultPosition,
|
||||||
|
const wxSize & size = wxDefaultSize,
|
||||||
|
long style = wxTAB_TRAVERSAL);
|
||||||
|
};
|
||||||
|
|
||||||
|
}} // namespace Slic3r::GUI
|
||||||
|
|
||||||
|
#endif
|
1252
src/slic3r/GUI/CalibrationWizardSavePage.cpp
Normal file
284
src/slic3r/GUI/CalibrationWizardSavePage.hpp
Normal file
|
@ -0,0 +1,284 @@
|
||||||
|
#ifndef slic3r_GUI_CalibrationWizardSavePage_hpp_
|
||||||
|
#define slic3r_GUI_CalibrationWizardSavePage_hpp_
|
||||||
|
|
||||||
|
#include "CalibrationWizardPage.hpp"
|
||||||
|
#include "Widgets/TextInput.hpp"
|
||||||
|
|
||||||
|
namespace Slic3r { namespace GUI {
|
||||||
|
|
||||||
|
enum CaliSaveStyle {
|
||||||
|
CALI_SAVE_P1P_STYLE = 0,
|
||||||
|
CALI_SAVE_X1_STYLE,
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
class CalibrationCommonSavePage : public CalibrationWizardPage
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CalibrationCommonSavePage(wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxTAB_TRAVERSAL);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
wxBoxSizer* m_top_sizer;
|
||||||
|
};
|
||||||
|
|
||||||
|
class PAColumnDataPanel : wxPanel {
|
||||||
|
public:
|
||||||
|
PAColumnDataPanel(
|
||||||
|
wxWindow* parent,
|
||||||
|
bool is_failed,
|
||||||
|
wxWindowID id = wxID_ANY,
|
||||||
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
|
const wxSize& size = wxDefaultSize,
|
||||||
|
long style = wxTAB_TRAVERSAL);
|
||||||
|
|
||||||
|
bool is_failed() { return m_is_failed; }
|
||||||
|
int get_col_idx() { return m_col_idx; }
|
||||||
|
wxString get_k_str();
|
||||||
|
wxString get_n_str();
|
||||||
|
wxString get_name();
|
||||||
|
void set_data(wxString k_str, wxString n_str, wxString name);
|
||||||
|
|
||||||
|
private:
|
||||||
|
wxBoxSizer* m_top_sizer;
|
||||||
|
TextInput* m_k_value_input;
|
||||||
|
TextInput* m_n_value_input;
|
||||||
|
ComboBox* m_comboBox_tray_name;
|
||||||
|
int m_col_idx;
|
||||||
|
bool m_is_failed;
|
||||||
|
};
|
||||||
|
|
||||||
|
class CaliSavePresetValuePanel : public wxPanel
|
||||||
|
{
|
||||||
|
protected:
|
||||||
|
wxBoxSizer* m_top_sizer;
|
||||||
|
wxStaticBitmap* m_record_picture;
|
||||||
|
wxStaticText* m_value_title;
|
||||||
|
wxStaticText* m_save_name_title;
|
||||||
|
::TextInput* m_input_value;
|
||||||
|
::TextInput* m_input_name;
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
CaliSavePresetValuePanel(
|
||||||
|
wxWindow* parent,
|
||||||
|
wxWindowID id = wxID_ANY,
|
||||||
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
|
const wxSize& size = wxDefaultSize,
|
||||||
|
long style = wxTAB_TRAVERSAL);
|
||||||
|
|
||||||
|
void create_panel(wxWindow* parent);
|
||||||
|
|
||||||
|
void set_img(const std::string& bmp_name_in);
|
||||||
|
void set_value_title(const wxString& title);
|
||||||
|
void set_save_name_title(const wxString& title);
|
||||||
|
void get_value(double& value);
|
||||||
|
void get_save_name(std::string& name);
|
||||||
|
void set_save_name(const std::string& name);
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
class CaliPASaveAutoPanel : public wxPanel
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CaliPASaveAutoPanel(
|
||||||
|
wxWindow* parent,
|
||||||
|
wxWindowID id = wxID_ANY,
|
||||||
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
|
const wxSize& size = wxDefaultSize,
|
||||||
|
long style = wxTAB_TRAVERSAL);
|
||||||
|
|
||||||
|
void create_panel(wxWindow* parent);
|
||||||
|
|
||||||
|
void set_machine_obj(MachineObject* obj) { m_obj = obj; }
|
||||||
|
|
||||||
|
void sync_cali_result(const std::vector<PACalibResult>& cali_result);
|
||||||
|
void save_to_result_from_widgets(wxWindow* window, bool* out_is_valid);
|
||||||
|
bool get_result(std::vector<PACalibResult>& out_result);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
wxBoxSizer* m_top_sizer;
|
||||||
|
wxPanel* m_grid_panel{ nullptr };
|
||||||
|
std::vector<PACalibResult> m_calib_results;
|
||||||
|
|
||||||
|
MachineObject* m_obj;
|
||||||
|
};
|
||||||
|
|
||||||
|
class CaliPASaveManualPanel : public wxPanel
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CaliPASaveManualPanel(
|
||||||
|
wxWindow* parent,
|
||||||
|
wxWindowID id = wxID_ANY,
|
||||||
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
|
const wxSize& size = wxDefaultSize,
|
||||||
|
long style = wxTAB_TRAVERSAL);
|
||||||
|
void create_panel(wxWindow* parent);
|
||||||
|
void set_save_img();
|
||||||
|
|
||||||
|
void set_machine_obj(MachineObject* obj) { m_obj = obj; }
|
||||||
|
|
||||||
|
void set_default_name(const wxString& name);
|
||||||
|
|
||||||
|
bool get_result(PACalibResult& out_result);
|
||||||
|
|
||||||
|
virtual bool Show(bool show = true) override;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
wxBoxSizer* m_top_sizer;
|
||||||
|
wxStaticBitmap* m_record_picture;
|
||||||
|
::TextInput* m_save_name_input;
|
||||||
|
::TextInput* m_k_val;
|
||||||
|
::TextInput* m_n_val;
|
||||||
|
|
||||||
|
MachineObject* m_obj;
|
||||||
|
};
|
||||||
|
|
||||||
|
class CaliPASaveP1PPanel : public wxPanel
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CaliPASaveP1PPanel(
|
||||||
|
wxWindow* parent,
|
||||||
|
wxWindowID id = wxID_ANY,
|
||||||
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
|
const wxSize& size = wxDefaultSize,
|
||||||
|
long style = wxTAB_TRAVERSAL);
|
||||||
|
void create_panel(wxWindow* parent);
|
||||||
|
void set_save_img();
|
||||||
|
|
||||||
|
bool get_result(float* out_k, float* out_n);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
wxBoxSizer* m_top_sizer;
|
||||||
|
wxStaticBitmap* m_record_picture;
|
||||||
|
::TextInput* m_k_val;
|
||||||
|
::TextInput* m_n_val;
|
||||||
|
};
|
||||||
|
|
||||||
|
class CalibrationPASavePage : public CalibrationCommonSavePage
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CalibrationPASavePage(wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxTAB_TRAVERSAL);
|
||||||
|
|
||||||
|
void create_page(wxWindow* parent);
|
||||||
|
void set_cali_method(CalibrationMethod method) override;
|
||||||
|
// sync widget value from obj cali result
|
||||||
|
void sync_cali_result(MachineObject* obj);
|
||||||
|
bool get_auto_result(std::vector<PACalibResult>& result) { return m_auto_panel->get_result(result); }
|
||||||
|
bool get_manual_result(PACalibResult& result) { return m_manual_panel->get_result(result); }
|
||||||
|
bool get_p1p_result(float* k, float* n) { return m_p1p_panel->get_result(k, n); }
|
||||||
|
|
||||||
|
void show_panels(CalibrationMethod method, const std::string& printer_type);
|
||||||
|
|
||||||
|
void on_device_connected(MachineObject* obj);
|
||||||
|
|
||||||
|
void update(MachineObject* obj) override;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
CaliPageStepGuide* m_step_panel { nullptr };
|
||||||
|
CaliPASaveAutoPanel* m_auto_panel { nullptr };
|
||||||
|
CaliPASaveManualPanel* m_manual_panel { nullptr };
|
||||||
|
CaliPASaveP1PPanel* m_p1p_panel{ nullptr };
|
||||||
|
|
||||||
|
CaliSaveStyle m_save_style;
|
||||||
|
|
||||||
|
std::vector<PACalibResult> m_calib_results_history;
|
||||||
|
};
|
||||||
|
|
||||||
|
class CalibrationFlowX1SavePage : public CalibrationCommonSavePage
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CalibrationFlowX1SavePage(wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxTAB_TRAVERSAL);
|
||||||
|
|
||||||
|
void create_page(wxWindow* parent);
|
||||||
|
|
||||||
|
// sync widget value from cali flow rate result
|
||||||
|
void sync_cali_result(const std::vector<FlowRatioCalibResult>& cali_result);
|
||||||
|
void save_to_result_from_widgets(wxWindow* window, bool* out_is_valid);
|
||||||
|
bool get_result(std::vector<std::pair<wxString, float>>& out_results);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
CaliPageStepGuide* m_step_panel{ nullptr };
|
||||||
|
wxPanel* m_grid_panel{ nullptr };
|
||||||
|
|
||||||
|
std::map<int, std::pair<wxString, float>> m_save_results; // map<tray_id, <name, flow ratio>>
|
||||||
|
};
|
||||||
|
|
||||||
|
class CalibrationFlowCoarseSavePage : public CalibrationCommonSavePage
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CalibrationFlowCoarseSavePage(wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxTAB_TRAVERSAL);
|
||||||
|
|
||||||
|
void create_page(wxWindow* parent);
|
||||||
|
void set_save_img();
|
||||||
|
|
||||||
|
void set_default_name(const wxString& name);
|
||||||
|
|
||||||
|
bool is_skip_fine_calibration();
|
||||||
|
|
||||||
|
void set_curr_flow_ratio(float value);
|
||||||
|
|
||||||
|
bool get_result(float* out_value, wxString* out_name);
|
||||||
|
|
||||||
|
virtual bool Show(bool show = true) override;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
CaliPageStepGuide* m_step_panel{ nullptr };
|
||||||
|
wxStaticBitmap* m_record_picture;
|
||||||
|
ComboBox* m_optimal_block_coarse;
|
||||||
|
TextInput* m_save_name_input;
|
||||||
|
|
||||||
|
bool m_skip_fine_calibration = false;
|
||||||
|
float m_curr_flow_ratio;
|
||||||
|
float m_coarse_flow_ratio;
|
||||||
|
};
|
||||||
|
|
||||||
|
class CalibrationFlowFineSavePage : public CalibrationCommonSavePage
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CalibrationFlowFineSavePage(wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxTAB_TRAVERSAL);
|
||||||
|
|
||||||
|
void create_page(wxWindow* parent);
|
||||||
|
void set_save_img();
|
||||||
|
|
||||||
|
void set_default_name(const wxString& name);
|
||||||
|
|
||||||
|
void set_curr_flow_ratio(float value);
|
||||||
|
|
||||||
|
bool get_result(float* out_value, wxString* out_name);
|
||||||
|
|
||||||
|
virtual bool Show(bool show = true) override;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
CaliPageStepGuide* m_step_panel{ nullptr };
|
||||||
|
wxStaticBitmap* m_record_picture;
|
||||||
|
ComboBox* m_optimal_block_fine;
|
||||||
|
TextInput* m_save_name_input;
|
||||||
|
|
||||||
|
float m_curr_flow_ratio;
|
||||||
|
float m_fine_flow_ratio;
|
||||||
|
};
|
||||||
|
|
||||||
|
class CalibrationMaxVolumetricSpeedSavePage : public CalibrationCommonSavePage
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CalibrationMaxVolumetricSpeedSavePage(wxWindow *parent, wxWindowID id = wxID_ANY,
|
||||||
|
const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize, long style = wxTAB_TRAVERSAL);
|
||||||
|
|
||||||
|
void create_page(wxWindow *parent);
|
||||||
|
void set_save_img();
|
||||||
|
|
||||||
|
bool get_save_result(double &value, std::string &name);
|
||||||
|
|
||||||
|
void set_prest_name(const std::string &name) { m_save_preset_panel->set_save_name(name); };
|
||||||
|
|
||||||
|
virtual bool Show(bool show = true) override;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
CaliPageStepGuide *m_step_panel{nullptr};
|
||||||
|
CaliSavePresetValuePanel *m_save_preset_panel;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
}} // namespace Slic3r::GUI
|
||||||
|
|
||||||
|
#endif
|
304
src/slic3r/GUI/CalibrationWizardStartPage.cpp
Normal file
|
@ -0,0 +1,304 @@
|
||||||
|
#include "CalibrationWizardStartPage.hpp"
|
||||||
|
#include "I18N.hpp"
|
||||||
|
#include "Widgets/Label.hpp"
|
||||||
|
|
||||||
|
namespace Slic3r { namespace GUI {
|
||||||
|
|
||||||
|
|
||||||
|
CalibrationStartPage::CalibrationStartPage(wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style)
|
||||||
|
:CalibrationWizardPage(parent, id, pos, size, style)
|
||||||
|
{
|
||||||
|
m_top_sizer = new wxBoxSizer(wxVERTICAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CalibrationStartPage::create_wiki(wxWindow* parent)
|
||||||
|
{
|
||||||
|
m_wiki_text = new wxStaticText(parent, wxID_ANY, _L("Wiki"));
|
||||||
|
m_wiki_text->SetFont(Label::Head_14);
|
||||||
|
m_wiki_text->SetForegroundColour({ 0, 88, 220 });
|
||||||
|
m_wiki_text->Bind(wxEVT_ENTER_WINDOW, [this](wxMouseEvent& e) {
|
||||||
|
e.Skip();
|
||||||
|
SetCursor(wxCURSOR_HAND);
|
||||||
|
});
|
||||||
|
m_wiki_text->Bind(wxEVT_LEAVE_WINDOW, [this](wxMouseEvent& e) {
|
||||||
|
e.Skip();
|
||||||
|
SetCursor(wxCURSOR_ARROW);
|
||||||
|
});
|
||||||
|
m_wiki_text->Bind(wxEVT_LEFT_UP, [this](wxMouseEvent& e) {
|
||||||
|
if (!m_wiki_url.empty())
|
||||||
|
wxLaunchDefaultBrowser(m_wiki_url);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
void CalibrationStartPage::create_when(wxWindow* parent, wxString title, wxString content)
|
||||||
|
{
|
||||||
|
m_when_title = new wxStaticText(this, wxID_ANY, title);
|
||||||
|
m_when_title->SetFont(Label::Head_14);
|
||||||
|
m_when_title->Wrap(CALIBRATION_TEXT_MAX_LENGTH);
|
||||||
|
|
||||||
|
m_when_content = new wxStaticText(this, wxID_ANY, content);
|
||||||
|
m_when_content->SetFont(Label::Body_14);
|
||||||
|
m_when_content->Wrap(CALIBRATION_TEXT_MAX_LENGTH);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CalibrationStartPage::create_bitmap(wxWindow* parent, const wxBitmap& before_img, const wxBitmap& after_img)
|
||||||
|
{
|
||||||
|
m_images_sizer = new wxBoxSizer(wxHORIZONTAL);
|
||||||
|
m_before_bmp = new wxStaticBitmap(parent, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0);
|
||||||
|
m_before_bmp->SetBitmap(before_img);
|
||||||
|
m_images_sizer->Add(m_before_bmp, 0, wxALL, 0);
|
||||||
|
m_images_sizer->AddSpacer(FromDIP(20));
|
||||||
|
m_after_bmp = new wxStaticBitmap(parent, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxDefaultSize, 0);
|
||||||
|
m_after_bmp->SetBitmap(after_img);
|
||||||
|
m_images_sizer->Add(m_after_bmp, 0, wxALL, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CalibrationStartPage::create_bitmap(wxWindow* parent, std::string before_img, std::string after_img)
|
||||||
|
{
|
||||||
|
wxBitmap before_bmp = create_scaled_bitmap(before_img, nullptr, 400);
|
||||||
|
wxBitmap after_bmp = create_scaled_bitmap(after_img, nullptr, 400);
|
||||||
|
|
||||||
|
create_bitmap(parent, before_bmp, after_bmp);
|
||||||
|
}
|
||||||
|
|
||||||
|
CalibrationPAStartPage::CalibrationPAStartPage(wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style)
|
||||||
|
: CalibrationStartPage(parent, id, pos, size, style)
|
||||||
|
{
|
||||||
|
m_cali_mode = CalibMode::Calib_PA_Line;
|
||||||
|
m_page_type = CaliPageType::CALI_PAGE_START;
|
||||||
|
|
||||||
|
m_wiki_url = get_calibration_wiki_page(m_cali_mode);
|
||||||
|
|
||||||
|
create_page(this);
|
||||||
|
|
||||||
|
this->SetSizer(m_top_sizer);
|
||||||
|
m_top_sizer->Fit(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CalibrationPAStartPage::create_page(wxWindow* parent)
|
||||||
|
{
|
||||||
|
m_page_caption = new CaliPageCaption(parent, CalibMode::Calib_PA_Line);
|
||||||
|
m_page_caption->show_prev_btn(false);
|
||||||
|
m_top_sizer->Add(m_page_caption, 0, wxEXPAND, 0);
|
||||||
|
create_when(parent,
|
||||||
|
_L("When you need Pressure Advance Calibration"),
|
||||||
|
_L("uneven extrusion"));
|
||||||
|
|
||||||
|
m_top_sizer->Add(m_when_title);
|
||||||
|
m_top_sizer->Add(m_when_content);
|
||||||
|
m_top_sizer->AddSpacer(PRESET_GAP);
|
||||||
|
|
||||||
|
create_bitmap(parent, "cali_page_before_pa", "cali_page_after_pa");
|
||||||
|
m_top_sizer->Add(m_images_sizer, 0, wxALL, 0);
|
||||||
|
|
||||||
|
m_top_sizer->AddSpacer(PRESET_GAP);
|
||||||
|
|
||||||
|
auto about_title = new wxStaticText(parent, wxID_ANY, _L("About this calibration"));
|
||||||
|
about_title->SetFont(Label::Head_14);
|
||||||
|
about_title->Wrap(CALIBRATION_TEXT_MAX_LENGTH);
|
||||||
|
m_top_sizer->Add(about_title);
|
||||||
|
auto about_text = new wxStaticText(parent, wxID_ANY, _L("After calibration, the linear compensation factor(K) will be recorded and applied to printing. This factor would be different if device, degree of usage, material, and material family type are different"));
|
||||||
|
about_text->SetFont(Label::Body_14);
|
||||||
|
about_text->Wrap(CALIBRATION_TEXT_MAX_LENGTH);
|
||||||
|
m_top_sizer->Add(about_text);
|
||||||
|
|
||||||
|
|
||||||
|
m_top_sizer->AddSpacer(PRESET_GAP);
|
||||||
|
|
||||||
|
create_wiki(parent);
|
||||||
|
m_top_sizer->Add(m_wiki_text, 0);
|
||||||
|
|
||||||
|
m_action_panel = new CaliPageActionPanel(parent, CalibMode::Calib_PA_Line, CaliPageType::CALI_PAGE_START);
|
||||||
|
|
||||||
|
m_top_sizer->Add(m_action_panel, 0, wxEXPAND, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CalibrationPAStartPage::on_reset_page()
|
||||||
|
{
|
||||||
|
m_action_panel->enable_button(CaliPageActionType::CALI_ACTION_MANAGE_RESULT, false);
|
||||||
|
m_action_panel->enable_button(CaliPageActionType::CALI_ACTION_AUTO_CALI, false);
|
||||||
|
m_action_panel->enable_button(CaliPageActionType::CALI_ACTION_MANUAL_CALI, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CalibrationPAStartPage::on_device_connected(MachineObject* obj)
|
||||||
|
{
|
||||||
|
//enable all button
|
||||||
|
m_action_panel->enable_button(CaliPageActionType::CALI_ACTION_MANAGE_RESULT, true);
|
||||||
|
m_action_panel->enable_button(CaliPageActionType::CALI_ACTION_AUTO_CALI, true);
|
||||||
|
m_action_panel->enable_button(CaliPageActionType::CALI_ACTION_MANUAL_CALI, true);
|
||||||
|
|
||||||
|
if (obj->printer_type == "BL-P001" || obj->printer_type == "BL-P002") {
|
||||||
|
m_action_panel->show_button(CaliPageActionType::CALI_ACTION_MANAGE_RESULT, true);
|
||||||
|
m_action_panel->show_button(CaliPageActionType::CALI_ACTION_AUTO_CALI, true);
|
||||||
|
m_action_panel->show_button(CaliPageActionType::CALI_ACTION_MANUAL_CALI, true);
|
||||||
|
|
||||||
|
if (obj->cali_version <= -1) {
|
||||||
|
m_action_panel->bind_button(CaliPageActionType::CALI_ACTION_MANAGE_RESULT, true);
|
||||||
|
m_action_panel->bind_button(CaliPageActionType::CALI_ACTION_AUTO_CALI, true);
|
||||||
|
m_action_panel->bind_button(CaliPageActionType::CALI_ACTION_MANUAL_CALI, true);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
m_action_panel->bind_button(CaliPageActionType::CALI_ACTION_MANAGE_RESULT, false);
|
||||||
|
m_action_panel->bind_button(CaliPageActionType::CALI_ACTION_MANUAL_CALI, false);
|
||||||
|
m_action_panel->bind_button(CaliPageActionType::CALI_ACTION_MANUAL_CALI, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (obj->printer_type == "C11" || obj->printer_type == "C12") {
|
||||||
|
m_action_panel->show_button(CaliPageActionType::CALI_ACTION_MANAGE_RESULT, false);
|
||||||
|
m_action_panel->show_button(CaliPageActionType::CALI_ACTION_AUTO_CALI, false);
|
||||||
|
m_action_panel->show_button(CaliPageActionType::CALI_ACTION_MANUAL_CALI, true);
|
||||||
|
|
||||||
|
if (obj->cali_version <= -1) {
|
||||||
|
m_action_panel->bind_button(CaliPageActionType::CALI_ACTION_MANUAL_CALI, true);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
m_action_panel->bind_button(CaliPageActionType::CALI_ACTION_MANUAL_CALI, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
CalibrationFlowRateStartPage::CalibrationFlowRateStartPage(wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style)
|
||||||
|
: CalibrationStartPage(parent, id, pos, size, style)
|
||||||
|
{
|
||||||
|
m_cali_mode = CalibMode::Calib_Flow_Rate;
|
||||||
|
|
||||||
|
m_wiki_url = get_calibration_wiki_page(m_cali_mode);
|
||||||
|
|
||||||
|
create_page(this);
|
||||||
|
|
||||||
|
this->SetSizer(m_top_sizer);
|
||||||
|
m_top_sizer->Fit(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CalibrationFlowRateStartPage::create_page(wxWindow* parent)
|
||||||
|
{
|
||||||
|
m_page_caption = new CaliPageCaption(parent, CalibMode::Calib_Flow_Rate);
|
||||||
|
m_page_caption->show_prev_btn(false);
|
||||||
|
m_top_sizer->Add(m_page_caption, 0, wxEXPAND, 0);
|
||||||
|
create_when(parent,
|
||||||
|
_L("When you need Flow Rate Calibration"),
|
||||||
|
_L("Over-extrusion or under extrusion"));
|
||||||
|
|
||||||
|
m_top_sizer->Add(m_when_title);
|
||||||
|
m_top_sizer->Add(m_when_content);
|
||||||
|
m_top_sizer->AddSpacer(PRESET_GAP);
|
||||||
|
|
||||||
|
auto recommend_title = new wxStaticText(parent, wxID_ANY, _L("Flow Rate calibration is recommended when you print with:"));
|
||||||
|
recommend_title->SetFont(Label::Head_14);
|
||||||
|
recommend_title->Wrap(CALIBRATION_TEXT_MAX_LENGTH);
|
||||||
|
m_top_sizer->Add(recommend_title);
|
||||||
|
auto recommend_text1 = new wxStaticText(parent, wxID_ANY, _L("material with significant thermal shrinkage/expansion, such as..."));
|
||||||
|
recommend_text1->Wrap(CALIBRATION_TEXT_MAX_LENGTH);
|
||||||
|
recommend_text1->SetFont(Label::Body_14);
|
||||||
|
m_top_sizer->Add(recommend_text1);
|
||||||
|
auto recommend_text2 = new wxStaticText(parent, wxID_ANY, _L("materials with inaccurate filament diameter"));
|
||||||
|
recommend_text2->Wrap(CALIBRATION_TEXT_MAX_LENGTH);
|
||||||
|
recommend_text2->SetFont(Label::Body_14);
|
||||||
|
m_top_sizer->Add(recommend_text2);
|
||||||
|
|
||||||
|
m_top_sizer->AddSpacer(PRESET_GAP);
|
||||||
|
|
||||||
|
create_bitmap(parent, "cali_page_before_flow", "cali_page_after_flow");
|
||||||
|
|
||||||
|
m_top_sizer->Add(m_images_sizer, 0, wxALL, 0);
|
||||||
|
|
||||||
|
m_top_sizer->AddSpacer(PRESET_GAP);
|
||||||
|
|
||||||
|
create_wiki(parent);
|
||||||
|
m_top_sizer->Add(m_wiki_text, 0);
|
||||||
|
|
||||||
|
m_action_panel = new CaliPageActionPanel(parent, CalibMode::Calib_Flow_Rate, CaliPageType::CALI_PAGE_START);
|
||||||
|
|
||||||
|
m_top_sizer->Add(m_action_panel, 0, wxEXPAND, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CalibrationFlowRateStartPage::on_reset_page()
|
||||||
|
{
|
||||||
|
//disable all button
|
||||||
|
m_action_panel->enable_button(CaliPageActionType::CALI_ACTION_MANAGE_RESULT, false);
|
||||||
|
m_action_panel->enable_button(CaliPageActionType::CALI_ACTION_AUTO_CALI, false);
|
||||||
|
m_action_panel->enable_button(CaliPageActionType::CALI_ACTION_MANUAL_CALI, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CalibrationFlowRateStartPage::on_device_connected(MachineObject* obj)
|
||||||
|
{
|
||||||
|
//enable all button
|
||||||
|
m_action_panel->enable_button(CaliPageActionType::CALI_ACTION_MANAGE_RESULT, true);
|
||||||
|
m_action_panel->enable_button(CaliPageActionType::CALI_ACTION_AUTO_CALI, true);
|
||||||
|
m_action_panel->enable_button(CaliPageActionType::CALI_ACTION_MANUAL_CALI, true);
|
||||||
|
|
||||||
|
if (obj->printer_type == "BL-P001" || obj->printer_type == "BL-P002") {
|
||||||
|
m_action_panel->show_button(CaliPageActionType::CALI_ACTION_MANAGE_RESULT, false);
|
||||||
|
m_action_panel->show_button(CaliPageActionType::CALI_ACTION_AUTO_CALI, true);
|
||||||
|
m_action_panel->show_button(CaliPageActionType::CALI_ACTION_MANUAL_CALI, true);
|
||||||
|
|
||||||
|
if (obj->cali_version <= -1) {
|
||||||
|
m_action_panel->bind_button(CaliPageActionType::CALI_ACTION_AUTO_CALI, true);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
m_action_panel->bind_button(CaliPageActionType::CALI_ACTION_MANUAL_CALI, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (obj->printer_type == "C11" || obj->printer_type == "C12") {
|
||||||
|
m_action_panel->show_button(CaliPageActionType::CALI_ACTION_MANAGE_RESULT, false);
|
||||||
|
m_action_panel->show_button(CaliPageActionType::CALI_ACTION_AUTO_CALI, false);
|
||||||
|
m_action_panel->show_button(CaliPageActionType::CALI_ACTION_MANUAL_CALI, true);
|
||||||
|
|
||||||
|
m_action_panel->bind_button(CaliPageActionType::CALI_ACTION_MANUAL_CALI, false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
CalibrationMaxVolumetricSpeedStartPage::CalibrationMaxVolumetricSpeedStartPage(wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style)
|
||||||
|
: CalibrationStartPage(parent, id, pos, size, style)
|
||||||
|
{
|
||||||
|
m_cali_mode = CalibMode::Calib_Vol_speed_Tower;
|
||||||
|
|
||||||
|
m_wiki_url = get_calibration_wiki_page(m_cali_mode);
|
||||||
|
|
||||||
|
create_page(this);
|
||||||
|
|
||||||
|
this->SetSizer(m_top_sizer);
|
||||||
|
m_top_sizer->Fit(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CalibrationMaxVolumetricSpeedStartPage::create_page(wxWindow* parent)
|
||||||
|
{
|
||||||
|
m_page_caption = new CaliPageCaption(parent, m_cali_mode);
|
||||||
|
m_page_caption->show_prev_btn(false);
|
||||||
|
m_top_sizer->Add(m_page_caption, 0, wxEXPAND, 0);
|
||||||
|
create_when(parent, _L("When you need Max Volumetric Speed Calibration"), _L("Over-extrusion or under extrusion"));
|
||||||
|
|
||||||
|
m_top_sizer->Add(m_when_title);
|
||||||
|
m_top_sizer->Add(m_when_content);
|
||||||
|
m_top_sizer->AddSpacer(PRESET_GAP);
|
||||||
|
|
||||||
|
auto recommend_title = new wxStaticText(parent, wxID_ANY, _L("Max Volumetric Speed calibration is recommended when you print with:"));
|
||||||
|
recommend_title->SetFont(Label::Head_14);
|
||||||
|
recommend_title->Wrap(CALIBRATION_TEXT_MAX_LENGTH);
|
||||||
|
m_top_sizer->Add(recommend_title);
|
||||||
|
auto recommend_text1 = new wxStaticText(parent, wxID_ANY, _L("material with significant thermal shrinkage/expansion, such as..."));
|
||||||
|
recommend_text1->Wrap(CALIBRATION_TEXT_MAX_LENGTH);
|
||||||
|
recommend_text1->SetFont(Label::Body_14);
|
||||||
|
m_top_sizer->Add(recommend_text1);
|
||||||
|
auto recommend_text2 = new wxStaticText(parent, wxID_ANY, _L("materials with inaccurate filament diameter"));
|
||||||
|
recommend_text2->Wrap(CALIBRATION_TEXT_MAX_LENGTH);
|
||||||
|
recommend_text2->SetFont(Label::Body_14);
|
||||||
|
m_top_sizer->Add(recommend_text2);
|
||||||
|
|
||||||
|
m_top_sizer->AddSpacer(PRESET_GAP);
|
||||||
|
|
||||||
|
create_bitmap(parent, "cali_page_before_flow", "cali_page_after_flow");
|
||||||
|
|
||||||
|
m_top_sizer->Add(m_images_sizer, 0, wxALL, 0);
|
||||||
|
|
||||||
|
m_top_sizer->AddSpacer(PRESET_GAP);
|
||||||
|
|
||||||
|
create_wiki(parent);
|
||||||
|
m_top_sizer->Add(m_wiki_text, 0);
|
||||||
|
|
||||||
|
m_action_panel = new CaliPageActionPanel(parent, m_cali_mode, CaliPageType::CALI_PAGE_START);
|
||||||
|
|
||||||
|
m_top_sizer->Add(m_action_panel, 0, wxEXPAND, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
}}
|
80
src/slic3r/GUI/CalibrationWizardStartPage.hpp
Normal file
|
@ -0,0 +1,80 @@
|
||||||
|
#ifndef slic3r_GUI_CalibrationWizardStartPage_hpp_
|
||||||
|
#define slic3r_GUI_CalibrationWizardStartPage_hpp_
|
||||||
|
|
||||||
|
#include "CalibrationWizardPage.hpp"
|
||||||
|
|
||||||
|
namespace Slic3r { namespace GUI {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class CalibrationStartPage : public CalibrationWizardPage
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CalibrationStartPage(wxWindow* parent,
|
||||||
|
wxWindowID id = wxID_ANY,
|
||||||
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
|
const wxSize& size = wxDefaultSize,
|
||||||
|
long style = wxTAB_TRAVERSAL);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
CalibMode m_cali_mode;
|
||||||
|
wxString m_wiki_url;
|
||||||
|
|
||||||
|
wxBoxSizer* m_top_sizer;
|
||||||
|
wxBoxSizer* m_images_sizer;
|
||||||
|
wxStaticText* m_wiki_text;
|
||||||
|
wxStaticText* m_when_title;
|
||||||
|
wxStaticText* m_when_content;
|
||||||
|
wxStaticBitmap* m_before_bmp;
|
||||||
|
wxStaticBitmap* m_after_bmp;
|
||||||
|
|
||||||
|
void create_wiki(wxWindow* parent);
|
||||||
|
void create_when(wxWindow* parent, wxString title, wxString content);
|
||||||
|
void create_bitmap(wxWindow* parent, const wxBitmap& before_img, const wxBitmap& after_img);
|
||||||
|
void create_bitmap(wxWindow* parent, std::string before_img, std::string after_img);
|
||||||
|
};
|
||||||
|
|
||||||
|
class CalibrationPAStartPage : public CalibrationStartPage
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CalibrationPAStartPage(wxWindow* parent,
|
||||||
|
wxWindowID id = wxID_ANY,
|
||||||
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
|
const wxSize& size = wxDefaultSize,
|
||||||
|
long style = wxTAB_TRAVERSAL);
|
||||||
|
|
||||||
|
void create_page(wxWindow* parent);
|
||||||
|
|
||||||
|
void on_reset_page();
|
||||||
|
void on_device_connected(MachineObject* obj);
|
||||||
|
};
|
||||||
|
|
||||||
|
class CalibrationFlowRateStartPage : public CalibrationStartPage
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CalibrationFlowRateStartPage(wxWindow* parent,
|
||||||
|
wxWindowID id = wxID_ANY,
|
||||||
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
|
const wxSize& size = wxDefaultSize,
|
||||||
|
long style = wxTAB_TRAVERSAL);
|
||||||
|
|
||||||
|
void create_page(wxWindow* parent);
|
||||||
|
void on_reset_page();
|
||||||
|
void on_device_connected(MachineObject* obj);
|
||||||
|
};
|
||||||
|
|
||||||
|
class CalibrationMaxVolumetricSpeedStartPage : public CalibrationStartPage
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CalibrationMaxVolumetricSpeedStartPage(wxWindow* parent,
|
||||||
|
wxWindowID id = wxID_ANY,
|
||||||
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
|
const wxSize& size = wxDefaultSize,
|
||||||
|
long style = wxTAB_TRAVERSAL);
|
||||||
|
|
||||||
|
void create_page(wxWindow* parent);
|
||||||
|
};
|
||||||
|
|
||||||
|
}} // namespace Slic3r::GUI
|
||||||
|
|
||||||
|
#endif
|
|
@ -1186,6 +1186,14 @@ bool MachineObject::is_system_printing()
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool MachineObject::check_pa_result_validation(PACalibResult& result)
|
||||||
|
{
|
||||||
|
if (result.k_value < 0 || result.k_value > 10)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
bool MachineObject::is_axis_at_home(std::string axis)
|
bool MachineObject::is_axis_at_home(std::string axis)
|
||||||
{
|
{
|
||||||
if (home_flag < 0)
|
if (home_flag < 0)
|
||||||
|
@ -1248,6 +1256,8 @@ bool MachineObject::is_in_calibration()
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
bool MachineObject::is_calibration_done()
|
bool MachineObject::is_calibration_done()
|
||||||
{
|
{
|
||||||
return calibration_done;
|
return calibration_done;
|
||||||
|
@ -1983,7 +1993,10 @@ int MachineObject::command_set_pa_calibration(const std::vector<PACalibResult>&
|
||||||
|
|
||||||
for (int i = 0; i < pa_calib_values.size(); ++i) {
|
for (int i = 0; i < pa_calib_values.size(); ++i) {
|
||||||
if (pa_calib_values[i].tray_id >= 0)
|
if (pa_calib_values[i].tray_id >= 0)
|
||||||
j["print"]["filaments"][i]["tray_id"] = pa_calib_values[i].tray_id;
|
j["print"]["filaments"][i]["tray_id"] = pa_calib_values[i].tray_id;
|
||||||
|
if (pa_calib_values[i].cali_idx >= 0)
|
||||||
|
j["print"]["filaments"][i]["cali_idx"] = pa_calib_values[i].cali_idx;
|
||||||
|
j["print"]["filaments"][i]["tray_id"] = pa_calib_values[i].tray_id;
|
||||||
j["print"]["filaments"][i]["filament_id"] = pa_calib_values[i].filament_id;
|
j["print"]["filaments"][i]["filament_id"] = pa_calib_values[i].filament_id;
|
||||||
j["print"]["filaments"][i]["setting_id"] = pa_calib_values[i].setting_id;
|
j["print"]["filaments"][i]["setting_id"] = pa_calib_values[i].setting_id;
|
||||||
j["print"]["filaments"][i]["name"] = pa_calib_values[i].name;
|
j["print"]["filaments"][i]["name"] = pa_calib_values[i].name;
|
||||||
|
@ -2016,6 +2029,8 @@ int MachineObject::command_delete_pa_calibration(const PACalibIndexInfo& pa_cali
|
||||||
|
|
||||||
int MachineObject::command_get_pa_calibration_tab(float nozzle_diameter, const std::string &filament_id)
|
int MachineObject::command_get_pa_calibration_tab(float nozzle_diameter, const std::string &filament_id)
|
||||||
{
|
{
|
||||||
|
reset_pa_cali_history_result();
|
||||||
|
|
||||||
if ((printer_type == "BL-P001" || printer_type == "BL-P002")) {
|
if ((printer_type == "BL-P001" || printer_type == "BL-P002")) {
|
||||||
json j;
|
json j;
|
||||||
j["print"]["command"] = "extrusion_cali_get";
|
j["print"]["command"] = "extrusion_cali_get";
|
||||||
|
@ -3852,13 +3867,31 @@ int MachineObject::parse_json(std::string payload)
|
||||||
extrusion_cali_set_hold_start = std::chrono::system_clock::now();
|
extrusion_cali_set_hold_start = std::chrono::system_clock::now();
|
||||||
}
|
}
|
||||||
else if (jj["command"].get<std::string>() == "extrusion_cali_get") {
|
else if (jj["command"].get<std::string>() == "extrusion_cali_get") {
|
||||||
#ifdef CALI_DEBUG
|
reset_pa_cali_history_result();
|
||||||
std::string str = jj.dump();
|
has_get_pa_calib_tab = true;
|
||||||
BOOST_LOG_TRIVIAL(info) << "extrusion_cali_get: " << str;
|
|
||||||
#endif
|
if (jj.contains("nozzle_diameter")) {
|
||||||
if (jj["filaments"].is_array()) {
|
if (jj["nozzle_diameter"].is_number_float()) {
|
||||||
|
pa_calib_tab_nozzle_dia = jj["nozzle_diameter"].get<float>();
|
||||||
|
}
|
||||||
|
else if (jj["nozzle_diameter"].is_string()) {
|
||||||
|
pa_calib_tab_nozzle_dia = stof(jj["nozzle_diameter"].get<std::string>().c_str());
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
assert(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
assert(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (jj.contains("filaments") && jj["filaments"].is_array()) {
|
||||||
try {
|
try {
|
||||||
pa_calib_tab.clear();
|
#ifdef CALI_DEBUG
|
||||||
|
std::string str = jj.dump();
|
||||||
|
BOOST_LOG_TRIVIAL(info) << "extrusion_cali_get: " << str;
|
||||||
|
#endif
|
||||||
|
|
||||||
for (auto it = jj["filaments"].begin(); it != jj["filaments"].end(); it++) {
|
for (auto it = jj["filaments"].begin(); it != jj["filaments"].end(); it++) {
|
||||||
PACalibResult pa_calib_result;
|
PACalibResult pa_calib_result;
|
||||||
pa_calib_result.filament_id = (*it)["filament_id"].get<std::string>();
|
pa_calib_result.filament_id = (*it)["filament_id"].get<std::string>();
|
||||||
|
@ -3882,23 +3915,31 @@ int MachineObject::parse_json(std::string payload)
|
||||||
else if ((*it)["n_coef"].is_string())
|
else if ((*it)["n_coef"].is_string())
|
||||||
pa_calib_result.n_coef = stof((*it)["n_coef"].get<std::string>().c_str());
|
pa_calib_result.n_coef = stof((*it)["n_coef"].get<std::string>().c_str());
|
||||||
|
|
||||||
pa_calib_tab.push_back(pa_calib_result);
|
if (check_pa_result_validation(pa_calib_result))
|
||||||
|
pa_calib_tab.push_back(pa_calib_result);
|
||||||
|
else {
|
||||||
|
BOOST_LOG_TRIVIAL(info) << "pa result is invalid";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
has_get_pa_calib_tab = true;
|
|
||||||
}
|
}
|
||||||
catch (...) {
|
catch (...) {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// notify cali history to update
|
||||||
}
|
}
|
||||||
else if (jj["command"].get<std::string>() == "extrusion_cali_get_result") {
|
else if (jj["command"].get<std::string>() == "extrusion_cali_get_result") {
|
||||||
#ifdef CALI_DEBUG
|
reset_pa_cali_result();
|
||||||
std::string str = jj.dump();
|
get_pa_calib_result = true;
|
||||||
BOOST_LOG_TRIVIAL(info) << "extrusion_cali_get_result: " << str;
|
|
||||||
#endif
|
if (jj.contains("filaments") && jj["filaments"].is_array()) {
|
||||||
if (jj["filaments"].is_array()) {
|
|
||||||
try {
|
try {
|
||||||
pa_calib_results.clear();
|
#ifdef CALI_DEBUG
|
||||||
|
std::string str = jj.dump();
|
||||||
|
BOOST_LOG_TRIVIAL(info) << "extrusion_cali_get_result: " << str;
|
||||||
|
#endif
|
||||||
|
|
||||||
for (auto it = jj["filaments"].begin(); it != jj["filaments"].end(); it++) {
|
for (auto it = jj["filaments"].begin(); it != jj["filaments"].end(); it++) {
|
||||||
PACalibResult pa_calib_result;
|
PACalibResult pa_calib_result;
|
||||||
pa_calib_result.tray_id = (*it)["tray_id"].get<int>();
|
pa_calib_result.tray_id = (*it)["tray_id"].get<int>();
|
||||||
|
@ -3921,23 +3962,35 @@ int MachineObject::parse_json(std::string payload)
|
||||||
else if ((*it)["n_coef"].is_string())
|
else if ((*it)["n_coef"].is_string())
|
||||||
pa_calib_result.n_coef = stof((*it)["n_coef"].get<std::string>().c_str());
|
pa_calib_result.n_coef = stof((*it)["n_coef"].get<std::string>().c_str());
|
||||||
|
|
||||||
if ((*it).contains("confidence"))
|
if (it->contains("confidence")) {
|
||||||
pa_calib_result.confidence = (*it)["confidence"].get<int>();
|
pa_calib_result.confidence = (*it)["confidence"].get<int>();
|
||||||
|
} else {
|
||||||
|
pa_calib_result.confidence = 0;
|
||||||
|
}
|
||||||
|
|
||||||
pa_calib_results.push_back(pa_calib_result);
|
if (check_pa_result_validation(pa_calib_result))
|
||||||
|
pa_calib_results.push_back(pa_calib_result);
|
||||||
|
else {
|
||||||
|
BOOST_LOG_TRIVIAL(info) << "pa result is invalid";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
has_get_pa_calib_result = true;
|
|
||||||
} catch (...) {}
|
} catch (...) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (pa_calib_results.empty()) {
|
||||||
|
BOOST_LOG_TRIVIAL(info) << "no pa calib result";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (jj["command"].get<std::string>() == "flowrate_get_result") {
|
else if (jj["command"].get<std::string>() == "flowrate_get_result") {
|
||||||
#ifdef CALI_DEBUG
|
this->reset_flow_rate_cali_result();
|
||||||
std::string str = jj.dump();
|
|
||||||
BOOST_LOG_TRIVIAL(info) << "flowrate_get_result: " << str;
|
get_flow_calib_result = true;
|
||||||
#endif
|
if (jj.contains("filaments") && jj["filaments"].is_array()) {
|
||||||
if (jj["filaments"].is_array()) {
|
|
||||||
try {
|
try {
|
||||||
flow_ratio_results.clear();
|
#ifdef CALI_DEBUG
|
||||||
|
std::string str = jj.dump();
|
||||||
|
BOOST_LOG_TRIVIAL(info) << "flowrate_get_result: " << str;
|
||||||
|
#endif
|
||||||
for (auto it = jj["filaments"].begin(); it != jj["filaments"].end(); it++) {
|
for (auto it = jj["filaments"].begin(); it != jj["filaments"].end(); it++) {
|
||||||
FlowRatioCalibResult flow_ratio_calib_result;
|
FlowRatioCalibResult flow_ratio_calib_result;
|
||||||
flow_ratio_calib_result.tray_id = (*it)["tray_id"].get<int>();
|
flow_ratio_calib_result.tray_id = (*it)["tray_id"].get<int>();
|
||||||
|
@ -3945,10 +3998,15 @@ int MachineObject::parse_json(std::string payload)
|
||||||
flow_ratio_calib_result.setting_id = (*it)["setting_id"].get<std::string>();
|
flow_ratio_calib_result.setting_id = (*it)["setting_id"].get<std::string>();
|
||||||
flow_ratio_calib_result.nozzle_diameter = stof(jj["nozzle_diameter"].get<std::string>().c_str());
|
flow_ratio_calib_result.nozzle_diameter = stof(jj["nozzle_diameter"].get<std::string>().c_str());
|
||||||
flow_ratio_calib_result.flow_ratio = stof((*it)["flow_ratio"].get<std::string>().c_str());
|
flow_ratio_calib_result.flow_ratio = stof((*it)["flow_ratio"].get<std::string>().c_str());
|
||||||
|
if (it->contains("confidence")) {
|
||||||
|
flow_ratio_calib_result.confidence = (*it)["confidence"].get<int>();
|
||||||
|
} else {
|
||||||
|
flow_ratio_calib_result.confidence = 0;
|
||||||
|
}
|
||||||
|
|
||||||
flow_ratio_results.push_back(flow_ratio_calib_result);
|
flow_ratio_results.push_back(flow_ratio_calib_result);
|
||||||
}
|
}
|
||||||
has_get_flow_ratio_result = true;
|
|
||||||
} catch (...) {}
|
} catch (...) {}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -327,10 +327,26 @@ public:
|
||||||
std::vector<X1CCalibInfo> calib_datas;
|
std::vector<X1CCalibInfo> calib_datas;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class CaliPresetInfo
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
int tray_id;
|
||||||
|
float nozzle_diameter;
|
||||||
|
std::string filament_id;
|
||||||
|
std::string setting_id;
|
||||||
|
std::string name;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
class PACalibResult
|
class PACalibResult
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
int tray_id;
|
enum CalibResult {
|
||||||
|
CALI_RESULT_SUCCESS = 0,
|
||||||
|
CALI_RESULT_PROBLEM = 1,
|
||||||
|
CALI_RESULT_FAILED = 2,
|
||||||
|
};
|
||||||
|
int tray_id;
|
||||||
int cali_idx;
|
int cali_idx;
|
||||||
float nozzle_diameter;
|
float nozzle_diameter;
|
||||||
std::string filament_id;
|
std::string filament_id;
|
||||||
|
@ -338,7 +354,7 @@ public:
|
||||||
std::string name;
|
std::string name;
|
||||||
float k_value;
|
float k_value;
|
||||||
float n_coef;
|
float n_coef;
|
||||||
int confidence = -1;
|
int confidence = -1; // 0: success 1: uncertain 2: failed
|
||||||
};
|
};
|
||||||
|
|
||||||
struct PACalibIndexInfo
|
struct PACalibIndexInfo
|
||||||
|
@ -357,6 +373,7 @@ public:
|
||||||
std::string filament_id;
|
std::string filament_id;
|
||||||
std::string setting_id;
|
std::string setting_id;
|
||||||
float flow_ratio;
|
float flow_ratio;
|
||||||
|
int confidence; // 0: success 1: uncertain 2: failed
|
||||||
};
|
};
|
||||||
|
|
||||||
#define UpgradeNoError 0
|
#define UpgradeNoError 0
|
||||||
|
@ -661,12 +678,37 @@ public:
|
||||||
bool is_support_layer_num { false };
|
bool is_support_layer_num { false };
|
||||||
|
|
||||||
int cali_version = -1;
|
int cali_version = -1;
|
||||||
bool has_get_pa_calib_tab = false;
|
float cali_selected_nozzle_dia { 0.0 };
|
||||||
bool has_get_pa_calib_result = false;
|
// 1: record when start calibration in preset page
|
||||||
bool has_get_flow_ratio_result = false;
|
// 2: reset when start calibration in start page
|
||||||
|
// 3: save tray_id, filament_id, setting_id, and name, nozzle_dia
|
||||||
|
std::vector<CaliPresetInfo> selected_cali_preset;
|
||||||
|
|
||||||
|
bool has_get_pa_calib_tab{ false };
|
||||||
std::vector<PACalibResult> pa_calib_tab;
|
std::vector<PACalibResult> pa_calib_tab;
|
||||||
|
float pa_calib_tab_nozzle_dia;
|
||||||
|
bool get_pa_calib_result { false };
|
||||||
std::vector<PACalibResult> pa_calib_results;
|
std::vector<PACalibResult> pa_calib_results;
|
||||||
|
bool get_flow_calib_result { false };
|
||||||
std::vector<FlowRatioCalibResult> flow_ratio_results;
|
std::vector<FlowRatioCalibResult> flow_ratio_results;
|
||||||
|
void reset_pa_cali_history_result()
|
||||||
|
{
|
||||||
|
pa_calib_tab_nozzle_dia = 0.4f;
|
||||||
|
has_get_pa_calib_tab = false;
|
||||||
|
pa_calib_tab.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
void reset_pa_cali_result() {
|
||||||
|
get_pa_calib_result = false;
|
||||||
|
pa_calib_results.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
void reset_flow_rate_cali_result() {
|
||||||
|
get_flow_calib_result = false;
|
||||||
|
flow_ratio_results.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool check_pa_result_validation(PACalibResult& result);
|
||||||
|
|
||||||
std::vector<int> stage_list_info;
|
std::vector<int> stage_list_info;
|
||||||
int stage_curr = 0;
|
int stage_curr = 0;
|
||||||
|
|
|
@ -1,198 +0,0 @@
|
||||||
#include "EditCalibrationHistoryDialog.hpp"
|
|
||||||
#include "MsgDialog.hpp"
|
|
||||||
#include "GUI_App.hpp"
|
|
||||||
|
|
||||||
namespace Slic3r { namespace GUI {
|
|
||||||
|
|
||||||
#define EDIT_HISTORY_DIALOG_INPUT_SIZE wxSize(FromDIP(160), FromDIP(24))
|
|
||||||
|
|
||||||
static bool validate_input_k_value(wxString k_text, float* output_value)
|
|
||||||
{
|
|
||||||
float default_k = 0.0f;
|
|
||||||
if (k_text.IsEmpty()) {
|
|
||||||
*output_value = default_k;
|
|
||||||
MessageDialog msg_dlg(nullptr, _L("Please input a valid value (K in 0~0.5)"), wxEmptyString, wxICON_WARNING | wxOK);
|
|
||||||
msg_dlg.ShowModal();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
double k_value = 0.0;
|
|
||||||
try {
|
|
||||||
k_text.ToDouble(&k_value);
|
|
||||||
}
|
|
||||||
catch (...) {
|
|
||||||
;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (k_value < 0 || k_value > 0.5) {
|
|
||||||
*output_value = default_k;
|
|
||||||
MessageDialog msg_dlg(nullptr, _L("Please input a valid value (K in 0~0.5)"), wxEmptyString, wxICON_WARNING | wxOK);
|
|
||||||
msg_dlg.ShowModal();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
*output_value = k_value;
|
|
||||||
return true;
|
|
||||||
};
|
|
||||||
|
|
||||||
static bool validate_input_n_value(wxString n_text, float* output_value) {
|
|
||||||
float default_n = 1.0f;
|
|
||||||
if (n_text.IsEmpty()) {
|
|
||||||
*output_value = default_n;
|
|
||||||
MessageDialog msg_dlg(nullptr, _L("Please input a valid value (N in 0.6~2.0)"), wxEmptyString, wxICON_WARNING | wxOK);
|
|
||||||
msg_dlg.ShowModal();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
double n_value = 0.0;
|
|
||||||
try {
|
|
||||||
n_text.ToDouble(&n_value);
|
|
||||||
}
|
|
||||||
catch (...) {
|
|
||||||
;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (n_value < 0.6 || n_value > 2.0) {
|
|
||||||
*output_value = default_n;
|
|
||||||
MessageDialog msg_dlg(nullptr, _L("Please input a valid value (N in 0.6~2.0)"), wxEmptyString, wxICON_WARNING | wxOK);
|
|
||||||
msg_dlg.ShowModal();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
*output_value = n_value;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
EditCalibrationHistoryDialog::EditCalibrationHistoryDialog(wxWindow* parent, wxString k, wxString n, wxString material_name, wxString nozzle_dia)
|
|
||||||
: DPIDialog(parent, wxID_ANY, _L("Edit Pressure Advance"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE)
|
|
||||||
{
|
|
||||||
create(k, n, material_name, nozzle_dia);
|
|
||||||
wxGetApp().UpdateDlgDarkUI(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
EditCalibrationHistoryDialog::~EditCalibrationHistoryDialog() {
|
|
||||||
}
|
|
||||||
|
|
||||||
void EditCalibrationHistoryDialog::create(const wxString& k, const wxString& n, const wxString& material_name, const wxString& nozzle_dia)
|
|
||||||
{
|
|
||||||
this->SetBackgroundColour(*wxWHITE);
|
|
||||||
auto main_sizer = new wxBoxSizer(wxVERTICAL);
|
|
||||||
|
|
||||||
auto top_panel = new wxPanel(this);
|
|
||||||
auto panel_sizer = new wxBoxSizer(wxVERTICAL);
|
|
||||||
top_panel->SetSizer(panel_sizer);
|
|
||||||
|
|
||||||
auto flex_sizer = new wxFlexGridSizer(0, 2, FromDIP(15), FromDIP(30));
|
|
||||||
flex_sizer->SetFlexibleDirection(wxBOTH);
|
|
||||||
flex_sizer->SetNonFlexibleGrowMode(wxFLEX_GROWMODE_SPECIFIED);
|
|
||||||
|
|
||||||
wxStaticText* nozzle_title = new wxStaticText(top_panel, wxID_ANY, _L("Nozzle Diameter"));
|
|
||||||
wxStaticText* nozzle_value = new wxStaticText(top_panel, wxID_ANY, nozzle_dia);
|
|
||||||
flex_sizer->Add(nozzle_title);
|
|
||||||
flex_sizer->Add(nozzle_value);
|
|
||||||
|
|
||||||
wxStaticText* material_name_title = new wxStaticText(top_panel, wxID_ANY, _L("Material"));
|
|
||||||
TextInput* material_name_value = new TextInput(top_panel, material_name, "", "", wxDefaultPosition, EDIT_HISTORY_DIALOG_INPUT_SIZE, wxTE_PROCESS_ENTER);
|
|
||||||
m_material_name = material_name.ToStdString();
|
|
||||||
material_name_value->GetTextCtrl()->Bind(wxEVT_TEXT_ENTER, [this, material_name_value](auto& e) {
|
|
||||||
if (!material_name_value->GetTextCtrl()->GetValue().IsEmpty())
|
|
||||||
m_material_name = material_name_value->GetTextCtrl()->GetValue().ToStdString();
|
|
||||||
});
|
|
||||||
material_name_value->GetTextCtrl()->Bind(wxEVT_KILL_FOCUS, [this, material_name_value](auto& e) {
|
|
||||||
if (!material_name_value->GetTextCtrl()->GetValue().IsEmpty())
|
|
||||||
m_material_name = material_name_value->GetTextCtrl()->GetValue().ToStdString();
|
|
||||||
e.Skip();
|
|
||||||
});
|
|
||||||
flex_sizer->Add(material_name_title);
|
|
||||||
flex_sizer->Add(material_name_value);
|
|
||||||
|
|
||||||
wxStaticText* k_title = new wxStaticText(top_panel, wxID_ANY, _L("K Factor"));
|
|
||||||
TextInput* k_value = new TextInput(top_panel, k, "", "", wxDefaultPosition, EDIT_HISTORY_DIALOG_INPUT_SIZE, wxTE_PROCESS_ENTER);
|
|
||||||
double double_k = 0.0;
|
|
||||||
k_value->GetTextCtrl()->GetValue().ToDouble(&double_k);
|
|
||||||
m_k_value = double_k;
|
|
||||||
k_value->GetTextCtrl()->Bind(wxEVT_TEXT_ENTER, [this, k_value](auto& e) {
|
|
||||||
float k = 0.0f;
|
|
||||||
validate_input_k_value(k_value->GetTextCtrl()->GetValue(), &k);
|
|
||||||
wxString k_str = wxString::Format("%.3f", k);
|
|
||||||
k_value->GetTextCtrl()->SetValue(k_str);
|
|
||||||
m_k_value = k;
|
|
||||||
});
|
|
||||||
k_value->GetTextCtrl()->Bind(wxEVT_KILL_FOCUS, [this, k_value](auto& e) {
|
|
||||||
float k = 0.0f;
|
|
||||||
validate_input_k_value(k_value->GetTextCtrl()->GetValue(), &k);
|
|
||||||
wxString k_str = wxString::Format("%.3f", k);
|
|
||||||
k_value->GetTextCtrl()->SetValue(k_str);
|
|
||||||
m_k_value = k;
|
|
||||||
e.Skip();
|
|
||||||
});
|
|
||||||
flex_sizer->Add(k_title);
|
|
||||||
flex_sizer->Add(k_value);
|
|
||||||
|
|
||||||
// Hide:
|
|
||||||
//wxStaticText* n_title = new wxStaticText(top_panel, wxID_ANY, _L("N Factor"));
|
|
||||||
//TextInput* n_value = new TextInput(top_panel, n, "", "", wxDefaultPosition, EDIT_HISTORY_DIALOG_INPUT_SIZE, wxTE_PROCESS_ENTER);
|
|
||||||
//flex_sizer->Add(n_title);
|
|
||||||
//flex_sizer->Add(n_value);
|
|
||||||
|
|
||||||
panel_sizer->Add(flex_sizer);
|
|
||||||
|
|
||||||
panel_sizer->AddSpacer(FromDIP(25));
|
|
||||||
|
|
||||||
auto btn_sizer = new wxBoxSizer(wxHORIZONTAL);
|
|
||||||
Button* save_btn = new Button(top_panel, _L("Save"));
|
|
||||||
StateColor btn_bg_green(std::pair<wxColour, int>(wxColour(27, 136, 68), StateColor::Pressed),
|
|
||||||
std::pair<wxColour, int>(wxColour(61, 203, 115), StateColor::Hovered),
|
|
||||||
std::pair<wxColour, int>(wxColour(0, 174, 66), StateColor::Normal));
|
|
||||||
save_btn->SetBackgroundColour(*wxWHITE);
|
|
||||||
save_btn->SetBackgroundColor(btn_bg_green);
|
|
||||||
save_btn->SetBorderColor(wxColour(0, 174, 66));
|
|
||||||
save_btn->SetTextColor(wxColour("#FFFFFE"));
|
|
||||||
save_btn->SetMinSize(wxSize(-1, FromDIP(24)));
|
|
||||||
save_btn->SetCornerRadius(FromDIP(12));
|
|
||||||
Button* cancel_btn = new Button(top_panel, _L("Cancel"));
|
|
||||||
cancel_btn->SetBackgroundColour(*wxWHITE);
|
|
||||||
cancel_btn->SetMinSize(wxSize(-1, FromDIP(24)));
|
|
||||||
cancel_btn->SetCornerRadius(FromDIP(12));
|
|
||||||
save_btn->Bind(wxEVT_BUTTON, &EditCalibrationHistoryDialog::on_save, this);
|
|
||||||
cancel_btn->Bind(wxEVT_BUTTON, &EditCalibrationHistoryDialog::on_cancel, this);
|
|
||||||
btn_sizer->AddStretchSpacer();
|
|
||||||
btn_sizer->Add(save_btn);
|
|
||||||
btn_sizer->AddSpacer(FromDIP(20));
|
|
||||||
btn_sizer->Add(cancel_btn);
|
|
||||||
panel_sizer->Add(btn_sizer, 0, wxEXPAND, 0);
|
|
||||||
|
|
||||||
|
|
||||||
main_sizer->Add(top_panel, 1, wxEXPAND | wxALL, FromDIP(20));
|
|
||||||
|
|
||||||
SetSizer(main_sizer);
|
|
||||||
Layout();
|
|
||||||
Fit();
|
|
||||||
CenterOnParent();
|
|
||||||
}
|
|
||||||
|
|
||||||
float EditCalibrationHistoryDialog::get_k_value(){
|
|
||||||
return m_k_value;
|
|
||||||
}
|
|
||||||
|
|
||||||
float EditCalibrationHistoryDialog::get_n_value(){
|
|
||||||
return m_n_value;
|
|
||||||
}
|
|
||||||
|
|
||||||
wxString EditCalibrationHistoryDialog::get_material_name_value() {
|
|
||||||
return m_material_name;
|
|
||||||
}
|
|
||||||
|
|
||||||
void EditCalibrationHistoryDialog::on_save(wxCommandEvent& event) {
|
|
||||||
EndModal(wxID_OK);
|
|
||||||
}
|
|
||||||
|
|
||||||
void EditCalibrationHistoryDialog::on_cancel(wxCommandEvent& event) {
|
|
||||||
EndModal(wxID_CANCEL);
|
|
||||||
}
|
|
||||||
|
|
||||||
void EditCalibrationHistoryDialog::on_dpi_changed(const wxRect& suggested_rect)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
}} // namespace Slic3r::GUI
|
|
|
@ -1,31 +0,0 @@
|
||||||
#ifndef slic3r_EditCalibrationHistoryDialog_hpp_
|
|
||||||
#define slic3r_EditCalibrationHistoryDialog_hpp_
|
|
||||||
|
|
||||||
#include "GUI_Utils.hpp"
|
|
||||||
|
|
||||||
namespace Slic3r { namespace GUI {
|
|
||||||
|
|
||||||
class EditCalibrationHistoryDialog : public DPIDialog
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
EditCalibrationHistoryDialog(wxWindow* parent, wxString k, wxString n, wxString material_name, wxString nozzle_dia);
|
|
||||||
~EditCalibrationHistoryDialog();
|
|
||||||
void on_dpi_changed(const wxRect& suggested_rect) override;
|
|
||||||
float get_k_value();
|
|
||||||
float get_n_value();
|
|
||||||
wxString get_material_name_value();
|
|
||||||
|
|
||||||
protected:
|
|
||||||
void create(const wxString& k, const wxString& n, const wxString& material_name, const wxString& nozzle_dia);
|
|
||||||
virtual void on_save(wxCommandEvent& event);
|
|
||||||
virtual void on_cancel(wxCommandEvent& event);
|
|
||||||
|
|
||||||
protected:
|
|
||||||
float m_k_value;
|
|
||||||
float m_n_value;
|
|
||||||
std::string m_material_name;
|
|
||||||
};
|
|
||||||
|
|
||||||
}} // namespace Slic3r::GUI
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -1,5 +1,6 @@
|
||||||
#include "HMS.hpp"
|
#include "HMS.hpp"
|
||||||
#include "HMSPanel.hpp"
|
#include "HMSPanel.hpp"
|
||||||
|
#include <slic3r/GUI/Widgets/SideTools.hpp>
|
||||||
#include <slic3r/GUI/Widgets/Label.hpp>
|
#include <slic3r/GUI/Widgets/Label.hpp>
|
||||||
#include <slic3r/GUI/I18N.hpp>
|
#include <slic3r/GUI/I18N.hpp>
|
||||||
#include "GUI.hpp"
|
#include "GUI.hpp"
|
||||||
|
@ -231,4 +232,4 @@ bool HMSPanel::Show(bool show)
|
||||||
return wxPanel::Show(show);
|
return wxPanel::Show(show);
|
||||||
}
|
}
|
||||||
|
|
||||||
}}
|
}}
|
||||||
|
|
|
@ -217,15 +217,14 @@ public:
|
||||||
//BBS GUI refactor
|
//BBS GUI refactor
|
||||||
enum TabPosition
|
enum TabPosition
|
||||||
{
|
{
|
||||||
tpHome = 0,
|
tpHome = 0,
|
||||||
tp3DEditor = 1,
|
tp3DEditor = 1,
|
||||||
//tpSettings = 1,
|
tpPreview = 2,
|
||||||
tpPreview = 2,
|
tpMonitor = 3,
|
||||||
tpMonitor = 3,
|
tpProject = 4,
|
||||||
tpProject = 4,
|
tpAuxiliary = 5,
|
||||||
tpCalibration = 5,
|
tpCalibration = 6,
|
||||||
toAuxiliary = 6,
|
toDebugTool = 7,
|
||||||
toDebugTool = 7,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
//BBS: add slice&&print status update logic
|
//BBS: add slice&&print status update logic
|
||||||
|
|
|
@ -160,162 +160,9 @@ MonitorPanel::~MonitorPanel()
|
||||||
{
|
{
|
||||||
m_side_tools = new SideTools(this, wxID_ANY);
|
m_side_tools = new SideTools(this, wxID_ANY);
|
||||||
wxBoxSizer* sizer_side_tools = new wxBoxSizer(wxVERTICAL);
|
wxBoxSizer* sizer_side_tools = new wxBoxSizer(wxVERTICAL);
|
||||||
|
|
||||||
/* auto warning_panel = new wxPanel(this, wxID_ANY);
|
|
||||||
warning_panel->SetBackgroundColour(wxColour(255, 111, 0));
|
|
||||||
warning_panel->SetSize(wxSize(FromDIP(220), FromDIP(25)));
|
|
||||||
warning_panel->SetMinSize(wxSize(FromDIP(220), FromDIP(25)));
|
|
||||||
warning_panel->SetMaxSize(wxSize(FromDIP(220), FromDIP(25)));
|
|
||||||
sizer_side_tools->Add(warning_panel, 0, wxEXPAND, 0);
|
|
||||||
|
|
||||||
wxBoxSizer *sizer_boxh = new wxBoxSizer(wxVERTICAL);
|
|
||||||
wxBoxSizer *sizer_boxv = new wxBoxSizer(wxHORIZONTAL);*/
|
|
||||||
|
|
||||||
m_connection_info = new Button(this, wxEmptyString);
|
|
||||||
m_connection_info->SetBackgroundColor(wxColour(255, 111, 0));
|
|
||||||
m_connection_info->SetBorderColor(wxColour(255, 111, 0));
|
|
||||||
m_connection_info->SetTextColor(*wxWHITE);
|
|
||||||
m_connection_info->SetFont(::Label::Body_13);
|
|
||||||
m_connection_info->SetCornerRadius(0);
|
|
||||||
m_connection_info->SetSize(wxSize(FromDIP(-1), FromDIP(25)));
|
|
||||||
m_connection_info->SetMinSize(wxSize(FromDIP(-1), FromDIP(25)));
|
|
||||||
m_connection_info->SetMaxSize(wxSize(FromDIP(-1), FromDIP(25)));
|
|
||||||
|
|
||||||
|
|
||||||
wxBoxSizer* connection_sizer_V = new wxBoxSizer(wxVERTICAL);
|
|
||||||
wxBoxSizer* connection_sizer_H = new wxBoxSizer(wxHORIZONTAL);
|
|
||||||
|
|
||||||
m_hyperlink = new wxHyperlinkCtrl(m_connection_info, wxID_ANY, _L("Failed to connect to the server"), wxT("https://wiki.bambulab.com/en/software/bambu-studio/failed-to-connect-printer"), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE);
|
|
||||||
m_hyperlink->SetBackgroundColour(wxColour(255, 111, 0));
|
|
||||||
|
|
||||||
m_more_err_open = ScalableBitmap(this, "monitir_err_open", 16);
|
|
||||||
m_more_err_close = ScalableBitmap(this, "monitir_err_close", 16);
|
|
||||||
m_more_button = new ScalableButton(m_connection_info, wxID_ANY, "monitir_err_open");
|
|
||||||
m_more_button->Bind(wxEVT_ENTER_WINDOW, [this](auto& e) {SetCursor(wxCURSOR_HAND); });
|
|
||||||
m_more_button->Bind(wxEVT_LEAVE_WINDOW, [this](auto& e) {SetCursor(wxCURSOR_ARROW); });
|
|
||||||
m_more_button->Bind(wxEVT_LEFT_DOWN, [this](auto& e) {
|
|
||||||
if (!m_more_err_state) {
|
|
||||||
m_more_button->SetBitmap(m_more_err_close.bmp());
|
|
||||||
Freeze();
|
|
||||||
m_side_error_panel->Show();
|
|
||||||
m_more_err_state = true;
|
|
||||||
m_tabpanel->Refresh();
|
|
||||||
m_tabpanel->Layout();
|
|
||||||
Thaw();
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
m_more_button->SetBitmap(m_more_err_open.bmp());
|
|
||||||
Freeze();
|
|
||||||
m_side_error_panel->Hide();
|
|
||||||
m_more_err_state = false;
|
|
||||||
m_tabpanel->Refresh();
|
|
||||||
m_tabpanel->Layout();
|
|
||||||
Thaw();
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
|
|
||||||
connection_sizer_H->Add(m_hyperlink, 0, wxALIGN_CENTER | wxALL, 5);
|
|
||||||
connection_sizer_H->Add(m_more_button, 0, wxALIGN_CENTER | wxALL, 3);
|
|
||||||
connection_sizer_V->Add(connection_sizer_H, 0, wxALIGN_CENTER, 0);
|
|
||||||
|
|
||||||
m_connection_info->SetSizer(connection_sizer_V);
|
|
||||||
m_connection_info->Layout();
|
|
||||||
connection_sizer_V->Fit(m_connection_info);
|
|
||||||
|
|
||||||
m_side_error_panel = new wxWindow(this,wxID_ANY);
|
|
||||||
m_side_error_panel->SetBackgroundColour(wxColour(255,232,214));
|
|
||||||
m_side_error_panel->SetMinSize(wxSize(-1, -1));
|
|
||||||
m_side_error_panel->SetMaxSize(wxSize(-1, -1));
|
|
||||||
|
|
||||||
m_side_error_panel->Hide();
|
|
||||||
m_more_button->Hide();
|
|
||||||
m_connection_info->Hide();
|
|
||||||
|
|
||||||
wxBoxSizer* sizer_print_failed_info = new wxBoxSizer(wxVERTICAL);
|
|
||||||
m_side_error_panel->SetSizer(sizer_print_failed_info);
|
|
||||||
|
|
||||||
wxBoxSizer* sizer_error_code = new wxBoxSizer(wxHORIZONTAL);
|
|
||||||
wxBoxSizer* sizer_error_desc = new wxBoxSizer(wxHORIZONTAL);
|
|
||||||
wxBoxSizer* sizer_extra_info = new wxBoxSizer(wxHORIZONTAL);
|
|
||||||
|
|
||||||
m_link_network_state = new Label(m_side_error_panel, _L("Check cloud service status"), wxALIGN_CENTER_HORIZONTAL|wxST_ELLIPSIZE_END);
|
|
||||||
m_link_network_state->SetMinSize(wxSize(FromDIP(220), -1));
|
|
||||||
m_link_network_state->SetMaxSize(wxSize(FromDIP(220), -1));
|
|
||||||
m_link_network_state->SetForegroundColour(0x00AE42);
|
|
||||||
m_link_network_state->SetFont(::Label::Body_12);
|
|
||||||
m_link_network_state->Bind(wxEVT_LEFT_DOWN, [this](auto& e) {wxGetApp().link_to_network_check(); });
|
|
||||||
m_link_network_state->Bind(wxEVT_ENTER_WINDOW, [this](auto& e) {m_link_network_state->SetCursor(wxCURSOR_HAND); });
|
|
||||||
m_link_network_state->Bind(wxEVT_LEAVE_WINDOW, [this](auto& e) {m_link_network_state->SetCursor(wxCURSOR_ARROW); });
|
|
||||||
|
|
||||||
auto st_title_error_code = new wxStaticText(m_side_error_panel, wxID_ANY, _L("code"),wxDefaultPosition, wxDefaultSize, wxST_ELLIPSIZE_END);
|
|
||||||
auto st_title_error_code_doc = new wxStaticText(m_side_error_panel, wxID_ANY, ": ");
|
|
||||||
m_st_txt_error_code = new Label(m_side_error_panel, wxEmptyString);
|
|
||||||
st_title_error_code->SetForegroundColour(0x909090);
|
|
||||||
st_title_error_code_doc->SetForegroundColour(0x909090);
|
|
||||||
m_st_txt_error_code->SetForegroundColour(0x909090);
|
|
||||||
st_title_error_code->SetFont(::Label::Body_12);
|
|
||||||
st_title_error_code_doc->SetFont(::Label::Body_12);
|
|
||||||
m_st_txt_error_code->SetFont(::Label::Body_12);
|
|
||||||
st_title_error_code->SetMinSize(wxSize(FromDIP(32), -1));
|
|
||||||
st_title_error_code->SetMaxSize(wxSize(FromDIP(32), -1));
|
|
||||||
m_st_txt_error_code->SetMinSize(wxSize(FromDIP(175), -1));
|
|
||||||
m_st_txt_error_code->SetMaxSize(wxSize(FromDIP(175), -1));
|
|
||||||
sizer_error_code->Add(st_title_error_code, 0, wxALL, 0);
|
|
||||||
sizer_error_code->Add(st_title_error_code_doc, 0, wxALL, 0);
|
|
||||||
sizer_error_code->Add(m_st_txt_error_code, 0, wxALL, 0);
|
|
||||||
|
|
||||||
|
|
||||||
auto st_title_error_desc = new wxStaticText(m_side_error_panel, wxID_ANY, wxT("desc"),wxDefaultPosition, wxDefaultSize, wxST_ELLIPSIZE_END);
|
|
||||||
auto st_title_error_desc_doc = new wxStaticText(m_side_error_panel, wxID_ANY, ": ");
|
|
||||||
m_st_txt_error_desc = new Label(m_side_error_panel, wxEmptyString);
|
|
||||||
st_title_error_desc->SetForegroundColour(0x909090);
|
|
||||||
st_title_error_desc_doc->SetForegroundColour(0x909090);
|
|
||||||
m_st_txt_error_desc->SetForegroundColour(0x909090);
|
|
||||||
st_title_error_desc->SetFont(::Label::Body_12);
|
|
||||||
st_title_error_desc_doc->SetFont(::Label::Body_12);
|
|
||||||
m_st_txt_error_desc->SetFont(::Label::Body_12);
|
|
||||||
st_title_error_desc->SetMinSize(wxSize(FromDIP(32), -1));
|
|
||||||
st_title_error_desc->SetMaxSize(wxSize(FromDIP(32), -1));
|
|
||||||
m_st_txt_error_desc->SetMinSize(wxSize(FromDIP(175), -1));
|
|
||||||
m_st_txt_error_desc->SetMaxSize(wxSize(FromDIP(175), -1));
|
|
||||||
sizer_error_desc->Add(st_title_error_desc, 0, wxALL, 0);
|
|
||||||
sizer_error_desc->Add(st_title_error_desc_doc, 0, wxALL, 0);
|
|
||||||
sizer_error_desc->Add(m_st_txt_error_desc, 0, wxALL, 0);
|
|
||||||
|
|
||||||
auto st_title_extra_info = new wxStaticText(m_side_error_panel, wxID_ANY, wxT("info"),wxDefaultPosition, wxDefaultSize, wxST_ELLIPSIZE_END);
|
|
||||||
auto st_title_extra_info_doc = new wxStaticText(m_side_error_panel, wxID_ANY, ": ");
|
|
||||||
m_st_txt_extra_info = new Label(m_side_error_panel, wxEmptyString);
|
|
||||||
st_title_extra_info->SetForegroundColour(0x909090);
|
|
||||||
st_title_extra_info_doc->SetForegroundColour(0x909090);
|
|
||||||
m_st_txt_extra_info->SetForegroundColour(0x909090);
|
|
||||||
st_title_extra_info->SetFont(::Label::Body_12);
|
|
||||||
st_title_extra_info_doc->SetFont(::Label::Body_12);
|
|
||||||
m_st_txt_extra_info->SetFont(::Label::Body_12);
|
|
||||||
st_title_extra_info->SetMinSize(wxSize(FromDIP(32), -1));
|
|
||||||
st_title_extra_info->SetMaxSize(wxSize(FromDIP(32), -1));
|
|
||||||
m_st_txt_extra_info->SetMinSize(wxSize(FromDIP(175), -1));
|
|
||||||
m_st_txt_extra_info->SetMaxSize(wxSize(FromDIP(175), -1));
|
|
||||||
sizer_extra_info->Add(st_title_extra_info, 0, wxALL, 0);
|
|
||||||
sizer_extra_info->Add(st_title_extra_info_doc, 0, wxALL, 0);
|
|
||||||
sizer_extra_info->Add(m_st_txt_extra_info, 0, wxALL, 0);
|
|
||||||
|
|
||||||
sizer_print_failed_info->Add(m_link_network_state, 0, wxALIGN_CENTER, 3);
|
|
||||||
sizer_print_failed_info->Add(sizer_error_code, 0, wxLEFT, 5);
|
|
||||||
sizer_print_failed_info->Add(0, 0, 0, wxTOP, FromDIP(3));
|
|
||||||
sizer_print_failed_info->Add(sizer_error_desc, 0, wxLEFT, 5);
|
|
||||||
sizer_print_failed_info->Add(0, 0, 0, wxTOP, FromDIP(3));
|
|
||||||
sizer_print_failed_info->Add(sizer_extra_info, 0, wxLEFT, 5);
|
|
||||||
|
|
||||||
m_st_txt_error_desc->SetLabel("");
|
|
||||||
m_st_txt_error_desc->Wrap(FromDIP(170));
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
sizer_side_tools->Add(m_connection_info, 0, wxEXPAND, 0);
|
|
||||||
sizer_side_tools->Add(m_side_error_panel, 0, wxEXPAND, 0);
|
|
||||||
sizer_side_tools->Add(m_side_tools, 1, wxEXPAND, 0);
|
sizer_side_tools->Add(m_side_tools, 1, wxEXPAND, 0);
|
||||||
m_tabpanel = new Tabbook(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, sizer_side_tools, wxNB_LEFT | wxTAB_TRAVERSAL | wxNB_NOPAGETHEME);
|
m_tabpanel = new Tabbook(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, sizer_side_tools, wxNB_LEFT | wxTAB_TRAVERSAL | wxNB_NOPAGETHEME);
|
||||||
|
m_side_tools->set_table_panel(m_tabpanel);
|
||||||
m_tabpanel->SetBackgroundColour(wxColour("#FEFFFF"));
|
m_tabpanel->SetBackgroundColour(wxColour("#FEFFFF"));
|
||||||
m_tabpanel->Bind(wxEVT_BOOKCTRL_PAGE_CHANGED, [this](wxBookCtrlEvent& e) {
|
m_tabpanel->Bind(wxEVT_BOOKCTRL_PAGE_CHANGED, [this](wxBookCtrlEvent& e) {
|
||||||
auto page = m_tabpanel->GetCurrentPage();
|
auto page = m_tabpanel->GetCurrentPage();
|
||||||
|
@ -344,24 +191,6 @@ MonitorPanel::~MonitorPanel()
|
||||||
show_status((int)MonitorStatus::MONITOR_NO_PRINTER);
|
show_status((int)MonitorStatus::MONITOR_NO_PRINTER);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MonitorPanel::update_connect_err_info(int code, wxString desc, wxString info)
|
|
||||||
{
|
|
||||||
m_st_txt_error_code->SetLabelText(wxString::Format("%d", code));
|
|
||||||
m_st_txt_error_desc->SetLabelText(desc);
|
|
||||||
m_st_txt_extra_info->SetLabelText(info);
|
|
||||||
|
|
||||||
m_st_txt_error_code->Wrap(FromDIP(175));
|
|
||||||
m_st_txt_error_desc->Wrap(FromDIP(175));
|
|
||||||
m_st_txt_extra_info->Wrap(FromDIP(175));
|
|
||||||
|
|
||||||
if (code == BAMBU_NETWORK_ERR_CONNECTION_TO_PRINTER_FAILED) {
|
|
||||||
m_link_network_state->Hide();
|
|
||||||
}
|
|
||||||
else if(code == BAMBU_NETWORK_ERR_CONNECTION_TO_SERVER_FAILED){
|
|
||||||
m_link_network_state->Show();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void MonitorPanel::set_default()
|
void MonitorPanel::set_default()
|
||||||
{
|
{
|
||||||
obj = nullptr;
|
obj = nullptr;
|
||||||
|
@ -403,7 +232,6 @@ void MonitorPanel::msw_rescale()
|
||||||
|
|
||||||
/* side_tool rescale */
|
/* side_tool rescale */
|
||||||
m_side_tools->msw_rescale();
|
m_side_tools->msw_rescale();
|
||||||
|
|
||||||
m_tabpanel->Rescale();
|
m_tabpanel->Rescale();
|
||||||
//m_status_add_machine_panel->msw_rescale();
|
//m_status_add_machine_panel->msw_rescale();
|
||||||
m_status_info_panel->msw_rescale();
|
m_status_info_panel->msw_rescale();
|
||||||
|
@ -411,11 +239,6 @@ void MonitorPanel::msw_rescale()
|
||||||
m_upgrade_panel->msw_rescale();
|
m_upgrade_panel->msw_rescale();
|
||||||
m_hms_panel->msw_rescale();
|
m_hms_panel->msw_rescale();
|
||||||
|
|
||||||
m_connection_info->SetCornerRadius(0);
|
|
||||||
m_connection_info->SetSize(wxSize(FromDIP(220), FromDIP(25)));
|
|
||||||
m_connection_info->SetMinSize(wxSize(FromDIP(220), FromDIP(25)));
|
|
||||||
m_connection_info->SetMaxSize(wxSize(FromDIP(220), FromDIP(25)));
|
|
||||||
|
|
||||||
Layout();
|
Layout();
|
||||||
Refresh();
|
Refresh();
|
||||||
}
|
}
|
||||||
|
@ -489,41 +312,6 @@ void MonitorPanel::on_size(wxSizeEvent &event)
|
||||||
Refresh();
|
Refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MonitorPanel::update_status(MachineObject* obj)
|
|
||||||
{
|
|
||||||
if (!obj) return;
|
|
||||||
|
|
||||||
/* Update Device Info */
|
|
||||||
m_side_tools->set_current_printer_name(obj->dev_name);
|
|
||||||
|
|
||||||
// update wifi signal image
|
|
||||||
int wifi_signal_val = 0;
|
|
||||||
if (!obj->is_connected() || obj->is_connecting()) {
|
|
||||||
m_side_tools->set_current_printer_signal(WifiSignal::NONE);
|
|
||||||
} else {
|
|
||||||
if (!obj->wifi_signal.empty() && boost::ends_with(obj->wifi_signal, "dBm")) {
|
|
||||||
try {
|
|
||||||
wifi_signal_val = std::stoi(obj->wifi_signal.substr(0, obj->wifi_signal.size() - 3));
|
|
||||||
}
|
|
||||||
catch (...) {
|
|
||||||
;
|
|
||||||
}
|
|
||||||
if (wifi_signal_val > -45) {
|
|
||||||
m_side_tools->set_current_printer_signal(WifiSignal::STRONG);
|
|
||||||
}
|
|
||||||
else if (wifi_signal_val <= -45 && wifi_signal_val >= -60) {
|
|
||||||
m_side_tools->set_current_printer_signal(WifiSignal::MIDDLE);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
m_side_tools->set_current_printer_signal(WifiSignal::WEAK);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
m_side_tools->set_current_printer_signal(WifiSignal::MIDDLE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void MonitorPanel::update_all()
|
void MonitorPanel::update_all()
|
||||||
{
|
{
|
||||||
NetworkAgent* m_agent = wxGetApp().getAgent();
|
NetworkAgent* m_agent = wxGetApp().getAgent();
|
||||||
|
@ -561,13 +349,10 @@ void MonitorPanel::update_all()
|
||||||
}
|
}
|
||||||
|
|
||||||
m_status_info_panel->obj = obj;
|
m_status_info_panel->obj = obj;
|
||||||
m_upgrade_panel->update(obj);
|
|
||||||
|
|
||||||
|
|
||||||
m_status_info_panel->m_media_play_ctrl->SetMachineObject(obj);
|
m_status_info_panel->m_media_play_ctrl->SetMachineObject(obj);
|
||||||
|
m_upgrade_panel->update(obj);
|
||||||
m_media_file_panel->SetMachineObject(obj);
|
m_media_file_panel->SetMachineObject(obj);
|
||||||
|
m_side_tools->update_status(obj);
|
||||||
update_status(obj);
|
|
||||||
|
|
||||||
if (!obj) {
|
if (!obj) {
|
||||||
show_status((int)MONITOR_NO_PRINTER);
|
show_status((int)MONITOR_NO_PRINTER);
|
||||||
|
@ -659,10 +444,7 @@ void MonitorPanel::update_side_panel()
|
||||||
void MonitorPanel::show_status(int status)
|
void MonitorPanel::show_status(int status)
|
||||||
{
|
{
|
||||||
if (!m_initialized) return;
|
if (!m_initialized) return;
|
||||||
|
if (last_status == status)return;
|
||||||
if (last_status == status)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (last_status & (int)MonitorStatus::MONITOR_CONNECTING != 0) {
|
if (last_status & (int)MonitorStatus::MONITOR_CONNECTING != 0) {
|
||||||
NetworkAgent* agent = wxGetApp().getAgent();
|
NetworkAgent* agent = wxGetApp().getAgent();
|
||||||
json j;
|
json j;
|
||||||
|
@ -684,49 +466,14 @@ void MonitorPanel::show_status(int status)
|
||||||
|
|
||||||
BOOST_LOG_TRIVIAL(info) << "monitor: show_status = " << status;
|
BOOST_LOG_TRIVIAL(info) << "monitor: show_status = " << status;
|
||||||
|
|
||||||
if (((status & (int) MonitorStatus::MONITOR_DISCONNECTED) != 0) || ((status & (int) MonitorStatus::MONITOR_DISCONNECTED_SERVER) != 0)) {
|
|
||||||
if ((status & (int)MonitorStatus::MONITOR_DISCONNECTED_SERVER)) {
|
|
||||||
m_hyperlink->SetLabel(_L("Failed to connect to the server"));
|
|
||||||
update_connect_err_info(BAMBU_NETWORK_ERR_CONNECTION_TO_SERVER_FAILED,
|
|
||||||
_L("Failed to connect to cloud service"),
|
|
||||||
_L("Please click on the hyperlink above to view the cloud service status"));
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
m_hyperlink->SetLabel(_L("Failed to connect to the printer"));
|
|
||||||
update_connect_err_info(BAMBU_NETWORK_ERR_CONNECTION_TO_PRINTER_FAILED,
|
|
||||||
_L("Connection to printer failed"),
|
|
||||||
_L("Please check the network connection of the printer and Studio."));
|
|
||||||
}
|
|
||||||
|
|
||||||
m_hyperlink->Show();
|
|
||||||
m_connection_info->SetLabel(wxEmptyString);
|
|
||||||
m_connection_info->SetBackgroundColor(0xFF6F00);
|
|
||||||
m_connection_info->SetBorderColor(0xFF6F00);
|
|
||||||
m_connection_info->Show();
|
|
||||||
m_more_button->Show();
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#if !BBL_RELEASE_TO_PUBLIC
|
#if !BBL_RELEASE_TO_PUBLIC
|
||||||
m_upgrade_panel->update(nullptr);
|
m_upgrade_panel->update(nullptr);
|
||||||
#endif
|
#endif
|
||||||
} else if ((status & (int) MonitorStatus::MONITOR_NORMAL) != 0) {
|
|
||||||
m_connection_info->Hide();
|
|
||||||
m_more_button->Hide();
|
|
||||||
m_side_error_panel->Hide();
|
|
||||||
} else if ((status & (int) MonitorStatus::MONITOR_CONNECTING) != 0) {
|
|
||||||
m_hyperlink->Hide();
|
|
||||||
m_connection_info->SetLabel(_L("Connecting..."));
|
|
||||||
m_connection_info->SetBackgroundColor(0x00AE42);
|
|
||||||
m_connection_info->SetBorderColor(0x00AE42);
|
|
||||||
m_connection_info->Show();
|
|
||||||
m_more_button->Hide();
|
|
||||||
m_side_error_panel->Hide();
|
|
||||||
}
|
|
||||||
|
|
||||||
Freeze();
|
|
||||||
|
|
||||||
|
Freeze();
|
||||||
// update panels
|
// update panels
|
||||||
|
if (m_side_tools) { m_side_tools->show_status(status); };
|
||||||
m_status_info_panel->show_status(status);
|
m_status_info_panel->show_status(status);
|
||||||
m_hms_panel->show_status(status);
|
m_hms_panel->show_status(status);
|
||||||
m_upgrade_panel->show_status(status);
|
m_upgrade_panel->show_status(status);
|
||||||
|
@ -734,31 +481,23 @@ void MonitorPanel::show_status(int status)
|
||||||
|
|
||||||
if ((status & (int)MonitorStatus::MONITOR_NO_PRINTER) != 0) {
|
if ((status & (int)MonitorStatus::MONITOR_NO_PRINTER) != 0) {
|
||||||
set_default();
|
set_default();
|
||||||
m_side_tools->set_none_printer_mode();
|
|
||||||
m_connection_info->Hide();
|
|
||||||
m_side_error_panel->Hide();
|
|
||||||
m_more_button->Hide();
|
|
||||||
m_tabpanel->Refresh();
|
|
||||||
m_tabpanel->Layout();
|
m_tabpanel->Layout();
|
||||||
#if !BBL_RELEASE_TO_PUBLIC
|
} else if (((status & (int)MonitorStatus::MONITOR_NORMAL) != 0)
|
||||||
m_upgrade_panel->update(nullptr);
|
|| ((status & (int)MonitorStatus::MONITOR_DISCONNECTED) != 0)
|
||||||
#endif
|
|| ((status & (int) MonitorStatus::MONITOR_DISCONNECTED_SERVER) != 0)
|
||||||
} else if (((status & (int)MonitorStatus::MONITOR_NORMAL) != 0)
|
|| ((status & (int)MonitorStatus::MONITOR_CONNECTING) != 0) )
|
||||||
|| ((status & (int)MonitorStatus::MONITOR_DISCONNECTED) != 0)
|
{
|
||||||
|| ((status & (int) MonitorStatus::MONITOR_DISCONNECTED_SERVER) != 0)
|
|
||||||
|| ((status & (int)MonitorStatus::MONITOR_CONNECTING) != 0)
|
if (((status & (int) MonitorStatus::MONITOR_DISCONNECTED) != 0)
|
||||||
) {
|
|| ((status & (int) MonitorStatus::MONITOR_DISCONNECTED_SERVER) != 0)
|
||||||
if (((status & (int) MonitorStatus::MONITOR_DISCONNECTED) != 0)
|
|| ((status & (int)MonitorStatus::MONITOR_CONNECTING) != 0))
|
||||||
|| ((status & (int) MonitorStatus::MONITOR_DISCONNECTED_SERVER) != 0)
|
{
|
||||||
|| ((status & (int)MonitorStatus::MONITOR_CONNECTING) != 0)) {
|
|
||||||
m_side_tools->set_current_printer_signal(WifiSignal::NONE);
|
|
||||||
set_default();
|
set_default();
|
||||||
}
|
}
|
||||||
m_tabpanel->Refresh();
|
|
||||||
m_tabpanel->Layout();
|
m_tabpanel->Layout();
|
||||||
}
|
}
|
||||||
Layout();
|
Layout();
|
||||||
Thaw();
|
Thaw();
|
||||||
}
|
}
|
||||||
|
|
||||||
} // GUI
|
} // GUI
|
||||||
|
|
|
@ -83,9 +83,6 @@ private:
|
||||||
MediaFilePanel* m_media_file_panel;
|
MediaFilePanel* m_media_file_panel;
|
||||||
UpgradePanel* m_upgrade_panel;
|
UpgradePanel* m_upgrade_panel;
|
||||||
HMSPanel* m_hms_panel;
|
HMSPanel* m_hms_panel;
|
||||||
Button * m_connection_info{nullptr};
|
|
||||||
wxWindow * m_side_error_panel{nullptr};
|
|
||||||
wxHyperlinkCtrl* m_hyperlink{nullptr};
|
|
||||||
|
|
||||||
/* side tools */
|
/* side tools */
|
||||||
SideTools* m_side_tools{nullptr};
|
SideTools* m_side_tools{nullptr};
|
||||||
|
@ -94,12 +91,6 @@ private:
|
||||||
wxStaticText* m_staticText_printer_name;
|
wxStaticText* m_staticText_printer_name;
|
||||||
wxStaticBitmap* m_bitmap_wifi_signal;
|
wxStaticBitmap* m_bitmap_wifi_signal;
|
||||||
wxBoxSizer * m_side_tools_sizer;
|
wxBoxSizer * m_side_tools_sizer;
|
||||||
|
|
||||||
Label* m_link_network_state;
|
|
||||||
Label* m_st_txt_error_code;
|
|
||||||
Label* m_st_txt_error_desc;
|
|
||||||
Label* m_st_txt_extra_info;
|
|
||||||
|
|
||||||
SelectMachinePopup m_select_machine;
|
SelectMachinePopup m_select_machine;
|
||||||
|
|
||||||
/* images */
|
/* images */
|
||||||
|
@ -110,15 +101,10 @@ private:
|
||||||
wxBitmap m_printer_img;
|
wxBitmap m_printer_img;
|
||||||
wxBitmap m_arrow_img;
|
wxBitmap m_arrow_img;
|
||||||
|
|
||||||
ScalableButton* m_more_button;
|
|
||||||
bool m_more_err_state{false};
|
|
||||||
ScalableBitmap m_more_err_open;
|
|
||||||
ScalableBitmap m_more_err_close;
|
|
||||||
|
|
||||||
int last_wifi_signal = -1;
|
int last_wifi_signal = -1;
|
||||||
wxTimer* m_refresh_timer = nullptr;
|
|
||||||
int last_status;
|
int last_status;
|
||||||
bool m_initialized { false };
|
bool m_initialized { false };
|
||||||
|
wxTimer* m_refresh_timer = nullptr;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
MonitorPanel(wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxTAB_TRAVERSAL);
|
MonitorPanel(wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxTAB_TRAVERSAL);
|
||||||
|
@ -136,7 +122,6 @@ public:
|
||||||
void init_bitmap();
|
void init_bitmap();
|
||||||
void init_timer();
|
void init_timer();
|
||||||
void init_tabpanel();
|
void init_tabpanel();
|
||||||
void update_connect_err_info(int code, wxString desc, wxString info);
|
|
||||||
Tabbook* get_tabpanel() { return m_tabpanel; };
|
Tabbook* get_tabpanel() { return m_tabpanel; };
|
||||||
void set_default();
|
void set_default();
|
||||||
wxWindow* create_side_tools();
|
wxWindow* create_side_tools();
|
||||||
|
@ -152,7 +137,6 @@ public:
|
||||||
void on_size(wxSizeEvent &event);
|
void on_size(wxSizeEvent &event);
|
||||||
|
|
||||||
/* update apis */
|
/* update apis */
|
||||||
void update_status(MachineObject* obj);
|
|
||||||
//void update_ams(MachineObject* obj);
|
//void update_ams(MachineObject* obj);
|
||||||
void update_all();
|
void update_all();
|
||||||
|
|
||||||
|
@ -165,6 +149,7 @@ public:
|
||||||
std::string last_conn_type = "undedefined";
|
std::string last_conn_type = "undedefined";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
} // GUI
|
} // GUI
|
||||||
} // Slic3r
|
} // Slic3r
|
||||||
|
|
||||||
|
|
|
@ -1406,18 +1406,10 @@ void Sidebar::on_bed_type_change(BedType bed_type)
|
||||||
m_bed_type_list->SetSelection(sel_idx);
|
m_bed_type_list->SetSelection(sel_idx);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sidebar::load_ams_list(std::string const &device, MachineObject* obj)
|
std::map<int, DynamicPrintConfig> Sidebar::build_filament_ams_list(MachineObject* obj)
|
||||||
{
|
{
|
||||||
std::map<int, DynamicPrintConfig> filament_ams_list;
|
std::map<int, DynamicPrintConfig> filament_ams_list;
|
||||||
|
if (!obj) return filament_ams_list;
|
||||||
if (!obj) {
|
|
||||||
p->ams_list_device = device;
|
|
||||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << " clear list";
|
|
||||||
wxGetApp().preset_bundle->filament_ams_list = filament_ams_list;
|
|
||||||
for (auto c : p->combos_filament)
|
|
||||||
c->update();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto vt_tray = obj->vt_tray;
|
auto vt_tray = obj->vt_tray;
|
||||||
bool is_support_virtual_tray = obj->is_function_supported(PrinterFunction::FUNC_VIRTUAL_TYAY);
|
bool is_support_virtual_tray = obj->is_function_supported(PrinterFunction::FUNC_VIRTUAL_TYAY);
|
||||||
|
@ -1426,8 +1418,8 @@ void Sidebar::load_ams_list(std::string const &device, MachineObject* obj)
|
||||||
vt_tray_config.set_key_value("filament_id", new ConfigOptionStrings{ vt_tray.setting_id });
|
vt_tray_config.set_key_value("filament_id", new ConfigOptionStrings{ vt_tray.setting_id });
|
||||||
vt_tray_config.set_key_value("tag_uid", new ConfigOptionStrings{ vt_tray.tag_uid });
|
vt_tray_config.set_key_value("tag_uid", new ConfigOptionStrings{ vt_tray.tag_uid });
|
||||||
vt_tray_config.set_key_value("filament_type", new ConfigOptionStrings{ vt_tray.type });
|
vt_tray_config.set_key_value("filament_type", new ConfigOptionStrings{ vt_tray.type });
|
||||||
vt_tray_config.set_key_value("tray_name", new ConfigOptionStrings{std::string("Ext")});
|
vt_tray_config.set_key_value("tray_name", new ConfigOptionStrings{ std::string("Ext") });
|
||||||
vt_tray_config.set_key_value("filament_colour", new ConfigOptionStrings{into_u8(wxColour("#" + vt_tray.color).GetAsString(wxC2S_HTML_SYNTAX))});
|
vt_tray_config.set_key_value("filament_colour", new ConfigOptionStrings{ into_u8(wxColour("#" + vt_tray.color).GetAsString(wxC2S_HTML_SYNTAX)) });
|
||||||
vt_tray_config.set_key_value("filament_exist", new ConfigOptionBools{ true });
|
vt_tray_config.set_key_value("filament_exist", new ConfigOptionBools{ true });
|
||||||
|
|
||||||
filament_ams_list.emplace(VIRTUAL_TRAY_ID, std::move(vt_tray_config));
|
filament_ams_list.emplace(VIRTUAL_TRAY_ID, std::move(vt_tray_config));
|
||||||
|
@ -1438,19 +1430,35 @@ void Sidebar::load_ams_list(std::string const &device, MachineObject* obj)
|
||||||
char n = ams.first.front() - '0' + 'A';
|
char n = ams.first.front() - '0' + 'A';
|
||||||
for (auto tray : ams.second->trayList) {
|
for (auto tray : ams.second->trayList) {
|
||||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__
|
BOOST_LOG_TRIVIAL(info) << __FUNCTION__
|
||||||
<< boost::format(": ams %1% tray %2% id %3% color %4%") % ams.first % tray.first % tray.second->setting_id % tray.second->color;
|
<< boost::format(": ams %1% tray %2% id %3% color %4%") % ams.first % tray.first % tray.second->setting_id % tray.second->color;
|
||||||
char t = tray.first.front() - '0' + '1';
|
char t = tray.first.front() - '0' + '1';
|
||||||
DynamicPrintConfig tray_config;
|
DynamicPrintConfig tray_config;
|
||||||
tray_config.set_key_value("filament_id", new ConfigOptionStrings{tray.second->setting_id});
|
tray_config.set_key_value("filament_id", new ConfigOptionStrings{ tray.second->setting_id });
|
||||||
tray_config.set_key_value("tag_uid", new ConfigOptionStrings{ tray.second->tag_uid });
|
tray_config.set_key_value("tag_uid", new ConfigOptionStrings{ tray.second->tag_uid });
|
||||||
tray_config.set_key_value("filament_type", new ConfigOptionStrings{tray.second->type});
|
tray_config.set_key_value("filament_type", new ConfigOptionStrings{ tray.second->type });
|
||||||
tray_config.set_key_value("tray_name", new ConfigOptionStrings{std::string(1, n) + std::string(1, t)});
|
tray_config.set_key_value("tray_name", new ConfigOptionStrings{ std::string(1, n) + std::string(1, t) });
|
||||||
tray_config.set_key_value("filament_colour", new ConfigOptionStrings{into_u8(wxColour("#" + tray.second->color).GetAsString(wxC2S_HTML_SYNTAX))});
|
tray_config.set_key_value("filament_colour", new ConfigOptionStrings{ into_u8(wxColour("#" + tray.second->color).GetAsString(wxC2S_HTML_SYNTAX)) });
|
||||||
tray_config.set_key_value("filament_exist", new ConfigOptionBools{tray.second->is_exists});
|
tray_config.set_key_value("filament_exist", new ConfigOptionBools{ tray.second->is_exists });
|
||||||
|
|
||||||
filament_ams_list.emplace(((n - 'A') * 4 + t - '1'), std::move(tray_config));
|
filament_ams_list.emplace(((n - 'A') * 4 + t - '1'), std::move(tray_config));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return filament_ams_list;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Sidebar::load_ams_list(std::string const &device, MachineObject* obj)
|
||||||
|
{
|
||||||
|
std::map<int, DynamicPrintConfig> filament_ams_list = build_filament_ams_list(obj);
|
||||||
|
|
||||||
|
if (!obj) {
|
||||||
|
p->ams_list_device = device;
|
||||||
|
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << " clear list";
|
||||||
|
wxGetApp().preset_bundle->filament_ams_list = filament_ams_list;
|
||||||
|
for (auto c : p->combos_filament)
|
||||||
|
c->update();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
p->ams_list_device = device;
|
p->ams_list_device = device;
|
||||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(": %1% items") % filament_ams_list.size();
|
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(": %1% items") % filament_ams_list.size();
|
||||||
wxGetApp().preset_bundle->filament_ams_list = filament_ams_list;
|
wxGetApp().preset_bundle->filament_ams_list = filament_ams_list;
|
||||||
|
@ -10789,9 +10797,11 @@ void Plater::send_calibration_job_finished(wxCommandEvent & evt)
|
||||||
auto calibration_panel = p->main_frame->m_calibration;
|
auto calibration_panel = p->main_frame->m_calibration;
|
||||||
if (calibration_panel) {
|
if (calibration_panel) {
|
||||||
auto curr_wizard = static_cast<CalibrationWizard*>(calibration_panel->get_tabpanel()->GetPage(evt.GetInt()));
|
auto curr_wizard = static_cast<CalibrationWizard*>(calibration_panel->get_tabpanel()->GetPage(evt.GetInt()));
|
||||||
curr_wizard->show_send_progress_bar(false);
|
wxCommandEvent event(EVT_CALIBRATION_JOB_FINISHED);
|
||||||
curr_wizard->show_page(curr_wizard->get_curr_page()->get_next_page());
|
event.SetEventObject(curr_wizard);
|
||||||
|
wxPostEvent(curr_wizard, event);
|
||||||
}
|
}
|
||||||
|
evt.Skip();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Plater::print_job_finished(wxCommandEvent &evt)
|
void Plater::print_job_finished(wxCommandEvent &evt)
|
||||||
|
|
|
@ -127,6 +127,7 @@ public:
|
||||||
// BBS
|
// BBS
|
||||||
void on_bed_type_change(BedType bed_type);
|
void on_bed_type_change(BedType bed_type);
|
||||||
void load_ams_list(std::string const & device, MachineObject* obj);
|
void load_ams_list(std::string const & device, MachineObject* obj);
|
||||||
|
std::map<int, DynamicPrintConfig> build_filament_ams_list(MachineObject* obj);
|
||||||
void sync_ams_list();
|
void sync_ams_list();
|
||||||
|
|
||||||
ObjectList* obj_list();
|
ObjectList* obj_list();
|
||||||
|
@ -331,7 +332,7 @@ public:
|
||||||
void export_gcode(bool prefer_removable);
|
void export_gcode(bool prefer_removable);
|
||||||
void export_gcode_3mf(bool export_all = false);
|
void export_gcode_3mf(bool export_all = false);
|
||||||
void send_gcode_finish(wxString name);
|
void send_gcode_finish(wxString name);
|
||||||
void export_core_3mf();
|
void export_core_3mf();
|
||||||
static TriangleMesh combine_mesh_fff(const ModelObject& mo, int instance_id, std::function<void(const std::string&)> notify_func = {});
|
static TriangleMesh combine_mesh_fff(const ModelObject& mo, int instance_id, std::function<void(const std::string&)> notify_func = {});
|
||||||
void export_stl(bool extended = false, bool selection_only = false);
|
void export_stl(bool extended = false, bool selection_only = false);
|
||||||
//BBS: remove amf
|
//BBS: remove amf
|
||||||
|
|
|
@ -1522,16 +1522,12 @@ void GUI::CalibrateFilamentComboBox::OnSelect(wxCommandEvent &evt)
|
||||||
}
|
}
|
||||||
m_is_compatible = true;
|
m_is_compatible = true;
|
||||||
static_cast<FilamentComboBox*>(m_parent)->Enable(true);
|
static_cast<FilamentComboBox*>(m_parent)->Enable(true);
|
||||||
std::string selected_name = evt.GetString().ToUTF8().data();
|
std::string preset_name = m_collection->get_preset_name_by_alias(evt.GetString().ToUTF8().data());
|
||||||
selected_name = Preset::remove_suffix_modified(selected_name);
|
m_selected_preset = m_collection->find_preset(preset_name);
|
||||||
m_selected_preset = m_collection->find_preset(selected_name);
|
|
||||||
std::string preset_name = m_collection->get_preset_name_by_alias(selected_name);
|
wxCommandEvent e(EVT_CALI_TRAY_CHANGED);
|
||||||
m_selected_preset = m_collection->find_preset(preset_name);
|
e.SetEventObject(m_parent);
|
||||||
SimpleEvent e(EVT_CALIBRATION_TRAY_SELECTION_CHANGED);
|
wxPostEvent(m_parent, e);
|
||||||
auto cali_tab = wxGetApp().mainframe->m_calibration->get_tabpanel();
|
|
||||||
auto calibration_wizard = static_cast<CalibrationWizard*>(cali_tab->GetPage(cali_tab->GetSelection()));
|
|
||||||
e.SetEventObject(calibration_wizard);
|
|
||||||
wxPostEvent(calibration_wizard, e);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Slic3r
|
} // namespace Slic3r
|
||||||
|
|
|
@ -40,15 +40,6 @@ class StepIndicator;
|
||||||
namespace Slic3r {
|
namespace Slic3r {
|
||||||
namespace GUI {
|
namespace GUI {
|
||||||
|
|
||||||
enum MonitorStatus {
|
|
||||||
MONITOR_UNKNOWN = 0,
|
|
||||||
MONITOR_NORMAL = 1 << 1,
|
|
||||||
MONITOR_NO_PRINTER = 1 << 2,
|
|
||||||
MONITOR_DISCONNECTED = 1 << 3,
|
|
||||||
MONITOR_DISCONNECTED_SERVER = 1 << 4,
|
|
||||||
MONITOR_CONNECTING = 1 << 5,
|
|
||||||
};
|
|
||||||
|
|
||||||
enum CameraRecordingStatus {
|
enum CameraRecordingStatus {
|
||||||
RECORDING_NONE,
|
RECORDING_NONE,
|
||||||
RECORDING_OFF_NORMAL,
|
RECORDING_OFF_NORMAL,
|
||||||
|
@ -65,6 +56,79 @@ enum CameraTimelapseStatus {
|
||||||
TIMELAPSE_ON_HOVER,
|
TIMELAPSE_ON_HOVER,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum PrintingTaskType {
|
||||||
|
PRINGINT,
|
||||||
|
CALIBRATION,
|
||||||
|
};
|
||||||
|
|
||||||
|
class PrintingTaskPanel : public wxPanel
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
PrintingTaskPanel(wxWindow* parent, PrintingTaskType type);
|
||||||
|
~PrintingTaskPanel();
|
||||||
|
void create_panel(wxWindow* parent);
|
||||||
|
|
||||||
|
private:
|
||||||
|
MachineObject* m_obj;
|
||||||
|
ScalableBitmap m_thumbnail_placeholder;
|
||||||
|
ScalableBitmap m_bitmap_use_time;
|
||||||
|
ScalableBitmap m_bitmap_use_weight;
|
||||||
|
|
||||||
|
wxPanel * m_panel_printing_title;
|
||||||
|
wxPanel* m_staticline;
|
||||||
|
wxPanel* m_panel_error_txt;
|
||||||
|
|
||||||
|
wxBoxSizer* m_printing_sizer;
|
||||||
|
wxStaticText * m_staticText_printing;
|
||||||
|
wxStaticText* m_staticText_subtask_value;
|
||||||
|
wxStaticText* m_staticText_consumption_of_time;
|
||||||
|
wxStaticText* m_staticText_consumption_of_weight;
|
||||||
|
wxStaticText* m_printing_stage_value;
|
||||||
|
wxStaticText* m_staticText_profile_value;
|
||||||
|
wxStaticText* m_staticText_progress_percent;
|
||||||
|
wxStaticText* m_staticText_progress_percent_icon;
|
||||||
|
wxStaticText* m_staticText_progress_left;
|
||||||
|
wxStaticText* m_staticText_layers;
|
||||||
|
wxStaticBitmap* m_bitmap_thumbnail;
|
||||||
|
wxStaticBitmap* m_bitmap_static_use_time;
|
||||||
|
wxStaticBitmap* m_bitmap_static_use_weight;
|
||||||
|
ScalableButton* m_button_pause_resume;
|
||||||
|
ScalableButton* m_button_abort;
|
||||||
|
Button* m_button_market_scoring;
|
||||||
|
Button* m_button_clean;
|
||||||
|
|
||||||
|
ProgressBar* m_gauge_progress;
|
||||||
|
ErrorMsgStaticText* m_error_text;
|
||||||
|
PrintingTaskType m_type;
|
||||||
|
|
||||||
|
public:
|
||||||
|
void init_bitmaps();
|
||||||
|
void init_scaled_buttons();
|
||||||
|
void error_info_reset();
|
||||||
|
void show_error_msg(wxString msg);
|
||||||
|
void reset_printing_value();
|
||||||
|
void msw_rescale();
|
||||||
|
|
||||||
|
public:
|
||||||
|
void enable_pause_resume_button(bool enable, std::string type);
|
||||||
|
void enable_abort_button(bool enable);
|
||||||
|
void update_subtask_name(wxString name);
|
||||||
|
void update_stage_value(wxString stage, int val);
|
||||||
|
void update_progress_percent(wxString percent, wxString icon);
|
||||||
|
void update_left_time(wxString time);
|
||||||
|
void update_left_time(int mc_left_time);
|
||||||
|
void update_layers_num(bool show, wxString num = wxEmptyString);
|
||||||
|
void show_priting_use_info(bool show, wxString time = wxEmptyString, wxString weight = wxEmptyString);
|
||||||
|
void show_profile_info(bool show, wxString profile = wxEmptyString);
|
||||||
|
|
||||||
|
public:
|
||||||
|
ScalableButton* get_abort_button() {return m_button_abort;};
|
||||||
|
ScalableButton* get_pause_resume_button() {return m_button_pause_resume;};
|
||||||
|
Button* get_market_scoring_button() {return m_button_market_scoring;};
|
||||||
|
Button* get_clean_button() {return m_button_clean;};
|
||||||
|
wxStaticBitmap* get_bitmap_thumbnail() {return m_bitmap_thumbnail;};
|
||||||
|
};
|
||||||
|
|
||||||
class StatusBasePanel : public wxScrolledWindow
|
class StatusBasePanel : public wxScrolledWindow
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
|
@ -208,7 +272,7 @@ protected:
|
||||||
StepIndicator* m_calibration_flow;
|
StepIndicator* m_calibration_flow;
|
||||||
|
|
||||||
wxPanel * m_machine_ctrl_panel;
|
wxPanel * m_machine_ctrl_panel;
|
||||||
wxPanel * m_project_task_panel;
|
PrintingTaskPanel * m_project_task_panel;
|
||||||
|
|
||||||
// Virtual event handlers, override them in your derived class
|
// Virtual event handlers, override them in your derived class
|
||||||
virtual void on_subtask_pause_resume(wxCommandEvent &event) { event.Skip(); }
|
virtual void on_subtask_pause_resume(wxCommandEvent &event) { event.Skip(); }
|
||||||
|
@ -239,7 +303,6 @@ public:
|
||||||
|
|
||||||
void init_bitmaps();
|
void init_bitmaps();
|
||||||
wxBoxSizer *create_monitoring_page();
|
wxBoxSizer *create_monitoring_page();
|
||||||
wxBoxSizer *create_project_task_page(wxWindow *parent);
|
|
||||||
wxBoxSizer *create_machine_control_page(wxWindow *parent);
|
wxBoxSizer *create_machine_control_page(wxWindow *parent);
|
||||||
|
|
||||||
wxBoxSizer *create_temp_axis_group(wxWindow *parent);
|
wxBoxSizer *create_temp_axis_group(wxWindow *parent);
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
#include "UpgradePanel.hpp"
|
#include "UpgradePanel.hpp"
|
||||||
|
#include <slic3r/GUI/Widgets/SideTools.hpp>
|
||||||
#include <slic3r/GUI/Widgets/Label.hpp>
|
#include <slic3r/GUI/Widgets/Label.hpp>
|
||||||
#include <slic3r/GUI/I18N.hpp>
|
#include <slic3r/GUI/I18N.hpp>
|
||||||
#include "GUI.hpp"
|
#include "GUI.hpp"
|
||||||
|
|
|
@ -1,18 +1,23 @@
|
||||||
#include "SideTools.hpp"
|
#include "SideTools.hpp"
|
||||||
|
#include "bambu_networking.hpp"
|
||||||
#include <wx/dcmemory.h>
|
#include <wx/dcmemory.h>
|
||||||
#include <wx/dcgraph.h>
|
#include <wx/dcgraph.h>
|
||||||
#include "Label.hpp"
|
#include "Label.hpp"
|
||||||
#include "StateColor.hpp"
|
#include "StateColor.hpp"
|
||||||
|
#include "../GUI_App.hpp"
|
||||||
#include "../wxExtensions.hpp"
|
#include "../wxExtensions.hpp"
|
||||||
#include "../I18N.hpp"
|
#include "../I18N.hpp"
|
||||||
#include "../GUI.hpp"
|
#include "../GUI.hpp"
|
||||||
|
|
||||||
namespace Slic3r { namespace GUI {
|
namespace Slic3r { namespace GUI {
|
||||||
SideTools::SideTools(wxWindow *parent, wxWindowID id, const wxPoint &pos, const wxSize &size)
|
SideToolsPanel::SideToolsPanel(wxWindow *parent, wxWindowID id, const wxPoint &pos, const wxSize &size)
|
||||||
{
|
{
|
||||||
wxPanel::Create(parent, id, pos, wxSize(0, FromDIP(50)));
|
wxPanel::Create(parent, id, pos, size);
|
||||||
Bind(wxEVT_PAINT, &SideTools::OnPaint, this);
|
|
||||||
|
|
||||||
|
SetMinSize(wxSize(-1, FromDIP(50)));
|
||||||
|
SetMaxSize(wxSize(-1, FromDIP(50)));
|
||||||
|
|
||||||
|
Bind(wxEVT_PAINT, &SideToolsPanel::OnPaint, this);
|
||||||
SetBackgroundColour(wxColour("#FEFFFF"));
|
SetBackgroundColour(wxColour("#FEFFFF"));
|
||||||
|
|
||||||
m_printing_img = ScalableBitmap(this, "printer", 16);
|
m_printing_img = ScalableBitmap(this, "printer", 16);
|
||||||
|
@ -30,33 +35,33 @@ namespace Slic3r { namespace GUI {
|
||||||
m_intetval_timer = new wxTimer();
|
m_intetval_timer = new wxTimer();
|
||||||
m_intetval_timer->SetOwner(this);
|
m_intetval_timer->SetOwner(this);
|
||||||
|
|
||||||
this->Bind(wxEVT_TIMER, &SideTools::stop_interval, this);
|
this->Bind(wxEVT_TIMER, &SideToolsPanel::stop_interval, this);
|
||||||
this->Bind(wxEVT_ENTER_WINDOW, &SideTools::on_mouse_enter, this);
|
this->Bind(wxEVT_ENTER_WINDOW, &SideToolsPanel::on_mouse_enter, this);
|
||||||
this->Bind(wxEVT_LEAVE_WINDOW, &SideTools::on_mouse_leave, this);
|
this->Bind(wxEVT_LEAVE_WINDOW, &SideToolsPanel::on_mouse_leave, this);
|
||||||
this->Bind(wxEVT_LEFT_DOWN, &SideTools::on_mouse_left_down, this);
|
this->Bind(wxEVT_LEFT_DOWN, &SideToolsPanel::on_mouse_left_down, this);
|
||||||
this->Bind(wxEVT_LEFT_UP, &SideTools::on_mouse_left_up, this);
|
this->Bind(wxEVT_LEFT_UP, &SideToolsPanel::on_mouse_left_up, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
SideTools::~SideTools() { delete m_intetval_timer; }
|
SideToolsPanel::~SideToolsPanel() { delete m_intetval_timer; }
|
||||||
|
|
||||||
void SideTools::set_none_printer_mode()
|
void SideToolsPanel::set_none_printer_mode()
|
||||||
{
|
{
|
||||||
m_none_printer = true;
|
m_none_printer = true;
|
||||||
Refresh();
|
Refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SideTools::on_timer(wxTimerEvent &event)
|
void SideToolsPanel::on_timer(wxTimerEvent &event)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void SideTools::set_current_printer_name(std::string dev_name)
|
void SideToolsPanel::set_current_printer_name(std::string dev_name)
|
||||||
{
|
{
|
||||||
m_none_printer = false;
|
m_none_printer = false;
|
||||||
m_dev_name = from_u8(dev_name);
|
m_dev_name = from_u8(dev_name);
|
||||||
Refresh();
|
Refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SideTools::set_current_printer_signal(WifiSignal sign)
|
void SideToolsPanel::set_current_printer_signal(WifiSignal sign)
|
||||||
{
|
{
|
||||||
if (last_printer_signal == sign) return;
|
if (last_printer_signal == sign) return;
|
||||||
|
|
||||||
|
@ -66,36 +71,36 @@ void SideTools::set_current_printer_signal(WifiSignal sign)
|
||||||
Refresh();
|
Refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SideTools::start_interval()
|
void SideToolsPanel::start_interval()
|
||||||
{
|
{
|
||||||
m_intetval_timer->Start(SIDE_TOOL_CLICK_INTERVAL);
|
m_intetval_timer->Start(SIDE_TOOL_CLICK_INTERVAL);
|
||||||
m_is_in_interval = true;
|
m_is_in_interval = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SideTools::stop_interval(wxTimerEvent& event)
|
void SideToolsPanel::stop_interval(wxTimerEvent& event)
|
||||||
{
|
{
|
||||||
m_is_in_interval = false;
|
m_is_in_interval = false;
|
||||||
m_intetval_timer->Stop();
|
m_intetval_timer->Stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool SideTools::is_in_interval()
|
bool SideToolsPanel::is_in_interval()
|
||||||
{
|
{
|
||||||
return m_is_in_interval;
|
return m_is_in_interval;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SideTools::msw_rescale()
|
void SideToolsPanel::msw_rescale()
|
||||||
{
|
{
|
||||||
Refresh();
|
Refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SideTools::OnPaint(wxPaintEvent &event)
|
void SideToolsPanel::OnPaint(wxPaintEvent &event)
|
||||||
{
|
{
|
||||||
wxPaintDC dc(this);
|
wxPaintDC dc(this);
|
||||||
doRender(dc);
|
doRender(dc);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SideTools::render(wxDC &dc)
|
void SideToolsPanel::render(wxDC &dc)
|
||||||
{
|
{
|
||||||
#ifdef __WXMSW__
|
#ifdef __WXMSW__
|
||||||
wxSize size = GetSize();
|
wxSize size = GetSize();
|
||||||
|
@ -116,7 +121,7 @@ void SideTools::render(wxDC &dc)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void SideTools::doRender(wxDC &dc)
|
void SideToolsPanel::doRender(wxDC &dc)
|
||||||
{
|
{
|
||||||
auto left = FromDIP(15);
|
auto left = FromDIP(15);
|
||||||
wxSize size = GetSize();
|
wxSize size = GetSize();
|
||||||
|
@ -208,27 +213,335 @@ void SideTools::doRender(wxDC &dc)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SideTools::on_mouse_left_down(wxMouseEvent &evt)
|
void SideToolsPanel::on_mouse_left_down(wxMouseEvent &evt)
|
||||||
{
|
{
|
||||||
m_click = true;
|
m_click = true;
|
||||||
Refresh();
|
Refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SideTools::on_mouse_left_up(wxMouseEvent &evt)
|
void SideToolsPanel::on_mouse_left_up(wxMouseEvent &evt)
|
||||||
{
|
{
|
||||||
m_click = false;
|
m_click = false;
|
||||||
Refresh();
|
Refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SideTools::on_mouse_enter(wxMouseEvent &evt)
|
void SideToolsPanel::on_mouse_enter(wxMouseEvent &evt)
|
||||||
{
|
{
|
||||||
m_hover = true;
|
m_hover = true;
|
||||||
Refresh();
|
Refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SideTools::on_mouse_leave(wxMouseEvent &evt)
|
void SideToolsPanel::on_mouse_leave(wxMouseEvent &evt)
|
||||||
{
|
{
|
||||||
m_hover = false;
|
m_hover = false;
|
||||||
Refresh();
|
Refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SideTools::SideTools(wxWindow *parent, wxWindowID id, const wxPoint &pos, const wxSize &size)
|
||||||
|
{
|
||||||
|
wxPanel::Create(parent, id, pos, size);
|
||||||
|
SetBackgroundColour(wxColour("#FEFFFF"));
|
||||||
|
|
||||||
|
m_side_tools = new SideToolsPanel(this, wxID_ANY);
|
||||||
|
|
||||||
|
m_connection_info = new Button(this, wxEmptyString);
|
||||||
|
m_connection_info->SetBackgroundColor(wxColour(255, 111, 0));
|
||||||
|
m_connection_info->SetBorderColor(wxColour(255, 111, 0));
|
||||||
|
m_connection_info->SetTextColor(*wxWHITE);
|
||||||
|
m_connection_info->SetFont(::Label::Body_13);
|
||||||
|
m_connection_info->SetCornerRadius(0);
|
||||||
|
m_connection_info->SetSize(wxSize(FromDIP(-1), FromDIP(25)));
|
||||||
|
m_connection_info->SetMinSize(wxSize(FromDIP(-1), FromDIP(25)));
|
||||||
|
m_connection_info->SetMaxSize(wxSize(FromDIP(-1), FromDIP(25)));
|
||||||
|
|
||||||
|
|
||||||
|
wxBoxSizer* connection_sizer_V = new wxBoxSizer(wxVERTICAL);
|
||||||
|
wxBoxSizer* connection_sizer_H = new wxBoxSizer(wxHORIZONTAL);
|
||||||
|
|
||||||
|
m_hyperlink = new wxHyperlinkCtrl(m_connection_info, wxID_ANY, _L("Failed to connect to the server"), wxT("https://wiki.bambulab.com/en/software/bambu-studio/failed-to-connect-printer"), wxDefaultPosition, wxDefaultSize, wxHL_DEFAULT_STYLE);
|
||||||
|
m_hyperlink->SetBackgroundColour(wxColour(255, 111, 0));
|
||||||
|
|
||||||
|
m_more_err_open = ScalableBitmap(this, "monitir_err_open", 16);
|
||||||
|
m_more_err_close = ScalableBitmap(this, "monitir_err_close", 16);
|
||||||
|
m_more_button = new ScalableButton(m_connection_info, wxID_ANY, "monitir_err_open");
|
||||||
|
m_more_button->Bind(wxEVT_ENTER_WINDOW, [this](auto& e) {SetCursor(wxCURSOR_HAND); });
|
||||||
|
m_more_button->Bind(wxEVT_LEAVE_WINDOW, [this](auto& e) {SetCursor(wxCURSOR_ARROW); });
|
||||||
|
m_more_button->Bind(wxEVT_LEFT_DOWN, [this](auto& e) {
|
||||||
|
if (!m_more_err_state) {
|
||||||
|
m_more_button->SetBitmap(m_more_err_close.bmp());
|
||||||
|
Freeze();
|
||||||
|
m_side_error_panel->Show();
|
||||||
|
m_more_err_state = true;
|
||||||
|
m_tabpanel->Refresh();
|
||||||
|
m_tabpanel->Layout();
|
||||||
|
Thaw();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
m_more_button->SetBitmap(m_more_err_open.bmp());
|
||||||
|
Freeze();
|
||||||
|
m_side_error_panel->Hide();
|
||||||
|
m_more_err_state = false;
|
||||||
|
m_tabpanel->Refresh();
|
||||||
|
m_tabpanel->Layout();
|
||||||
|
Thaw();
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
connection_sizer_H->Add(m_hyperlink, 0, wxALIGN_CENTER | wxALL, 5);
|
||||||
|
connection_sizer_H->Add(m_more_button, 0, wxALIGN_CENTER | wxALL, 3);
|
||||||
|
connection_sizer_V->Add(connection_sizer_H, 0, wxALIGN_CENTER, 0);
|
||||||
|
|
||||||
|
m_connection_info->SetSizer(connection_sizer_V);
|
||||||
|
m_connection_info->Layout();
|
||||||
|
connection_sizer_V->Fit(m_connection_info);
|
||||||
|
|
||||||
|
m_side_error_panel = new wxWindow(this, wxID_ANY);
|
||||||
|
m_side_error_panel->SetBackgroundColour(wxColour(255, 232, 214));
|
||||||
|
m_side_error_panel->SetMinSize(wxSize(-1, -1));
|
||||||
|
m_side_error_panel->SetMaxSize(wxSize(-1, -1));
|
||||||
|
|
||||||
|
m_side_error_panel->Hide();
|
||||||
|
m_more_button->Hide();
|
||||||
|
m_connection_info->Hide();
|
||||||
|
|
||||||
|
wxBoxSizer* sizer_print_failed_info = new wxBoxSizer(wxVERTICAL);
|
||||||
|
m_side_error_panel->SetSizer(sizer_print_failed_info);
|
||||||
|
|
||||||
|
wxBoxSizer* sizer_error_code = new wxBoxSizer(wxHORIZONTAL);
|
||||||
|
wxBoxSizer* sizer_error_desc = new wxBoxSizer(wxHORIZONTAL);
|
||||||
|
wxBoxSizer* sizer_extra_info = new wxBoxSizer(wxHORIZONTAL);
|
||||||
|
|
||||||
|
m_link_network_state = new Label(m_side_error_panel, _L("Check cloud service status"), wxALIGN_CENTER_HORIZONTAL | wxST_ELLIPSIZE_END);
|
||||||
|
m_link_network_state->SetMinSize(wxSize(FromDIP(220), -1));
|
||||||
|
m_link_network_state->SetMaxSize(wxSize(FromDIP(220), -1));
|
||||||
|
m_link_network_state->SetForegroundColour(0x00AE42);
|
||||||
|
m_link_network_state->SetFont(::Label::Body_12);
|
||||||
|
m_link_network_state->Bind(wxEVT_LEFT_DOWN, [this](auto& e) {wxGetApp().link_to_network_check(); });
|
||||||
|
m_link_network_state->Bind(wxEVT_ENTER_WINDOW, [this](auto& e) {m_link_network_state->SetCursor(wxCURSOR_HAND); });
|
||||||
|
m_link_network_state->Bind(wxEVT_LEAVE_WINDOW, [this](auto& e) {m_link_network_state->SetCursor(wxCURSOR_ARROW); });
|
||||||
|
|
||||||
|
auto st_title_error_code = new wxStaticText(m_side_error_panel, wxID_ANY, _L("code"), wxDefaultPosition, wxDefaultSize, wxST_ELLIPSIZE_END);
|
||||||
|
auto st_title_error_code_doc = new wxStaticText(m_side_error_panel, wxID_ANY, ": ");
|
||||||
|
m_st_txt_error_code = new Label(m_side_error_panel, wxEmptyString);
|
||||||
|
st_title_error_code->SetForegroundColour(0x909090);
|
||||||
|
st_title_error_code_doc->SetForegroundColour(0x909090);
|
||||||
|
m_st_txt_error_code->SetForegroundColour(0x909090);
|
||||||
|
st_title_error_code->SetFont(::Label::Body_12);
|
||||||
|
st_title_error_code_doc->SetFont(::Label::Body_12);
|
||||||
|
m_st_txt_error_code->SetFont(::Label::Body_12);
|
||||||
|
st_title_error_code->SetMinSize(wxSize(FromDIP(32), -1));
|
||||||
|
st_title_error_code->SetMaxSize(wxSize(FromDIP(32), -1));
|
||||||
|
m_st_txt_error_code->SetMinSize(wxSize(FromDIP(175), -1));
|
||||||
|
m_st_txt_error_code->SetMaxSize(wxSize(FromDIP(175), -1));
|
||||||
|
sizer_error_code->Add(st_title_error_code, 0, wxALL, 0);
|
||||||
|
sizer_error_code->Add(st_title_error_code_doc, 0, wxALL, 0);
|
||||||
|
sizer_error_code->Add(m_st_txt_error_code, 0, wxALL, 0);
|
||||||
|
|
||||||
|
|
||||||
|
auto st_title_error_desc = new wxStaticText(m_side_error_panel, wxID_ANY, wxT("desc"), wxDefaultPosition, wxDefaultSize, wxST_ELLIPSIZE_END);
|
||||||
|
auto st_title_error_desc_doc = new wxStaticText(m_side_error_panel, wxID_ANY, ": ");
|
||||||
|
m_st_txt_error_desc = new Label(m_side_error_panel, wxEmptyString);
|
||||||
|
st_title_error_desc->SetForegroundColour(0x909090);
|
||||||
|
st_title_error_desc_doc->SetForegroundColour(0x909090);
|
||||||
|
m_st_txt_error_desc->SetForegroundColour(0x909090);
|
||||||
|
st_title_error_desc->SetFont(::Label::Body_12);
|
||||||
|
st_title_error_desc_doc->SetFont(::Label::Body_12);
|
||||||
|
m_st_txt_error_desc->SetFont(::Label::Body_12);
|
||||||
|
st_title_error_desc->SetMinSize(wxSize(FromDIP(32), -1));
|
||||||
|
st_title_error_desc->SetMaxSize(wxSize(FromDIP(32), -1));
|
||||||
|
m_st_txt_error_desc->SetMinSize(wxSize(FromDIP(175), -1));
|
||||||
|
m_st_txt_error_desc->SetMaxSize(wxSize(FromDIP(175), -1));
|
||||||
|
sizer_error_desc->Add(st_title_error_desc, 0, wxALL, 0);
|
||||||
|
sizer_error_desc->Add(st_title_error_desc_doc, 0, wxALL, 0);
|
||||||
|
sizer_error_desc->Add(m_st_txt_error_desc, 0, wxALL, 0);
|
||||||
|
|
||||||
|
auto st_title_extra_info = new wxStaticText(m_side_error_panel, wxID_ANY, wxT("info"), wxDefaultPosition, wxDefaultSize, wxST_ELLIPSIZE_END);
|
||||||
|
auto st_title_extra_info_doc = new wxStaticText(m_side_error_panel, wxID_ANY, ": ");
|
||||||
|
m_st_txt_extra_info = new Label(m_side_error_panel, wxEmptyString);
|
||||||
|
st_title_extra_info->SetForegroundColour(0x909090);
|
||||||
|
st_title_extra_info_doc->SetForegroundColour(0x909090);
|
||||||
|
m_st_txt_extra_info->SetForegroundColour(0x909090);
|
||||||
|
st_title_extra_info->SetFont(::Label::Body_12);
|
||||||
|
st_title_extra_info_doc->SetFont(::Label::Body_12);
|
||||||
|
m_st_txt_extra_info->SetFont(::Label::Body_12);
|
||||||
|
st_title_extra_info->SetMinSize(wxSize(FromDIP(32), -1));
|
||||||
|
st_title_extra_info->SetMaxSize(wxSize(FromDIP(32), -1));
|
||||||
|
m_st_txt_extra_info->SetMinSize(wxSize(FromDIP(175), -1));
|
||||||
|
m_st_txt_extra_info->SetMaxSize(wxSize(FromDIP(175), -1));
|
||||||
|
sizer_extra_info->Add(st_title_extra_info, 0, wxALL, 0);
|
||||||
|
sizer_extra_info->Add(st_title_extra_info_doc, 0, wxALL, 0);
|
||||||
|
sizer_extra_info->Add(m_st_txt_extra_info, 0, wxALL, 0);
|
||||||
|
|
||||||
|
sizer_print_failed_info->Add(m_link_network_state, 0, wxALIGN_CENTER, 3);
|
||||||
|
sizer_print_failed_info->Add(sizer_error_code, 0, wxLEFT, 5);
|
||||||
|
sizer_print_failed_info->Add(0, 0, 0, wxTOP, FromDIP(3));
|
||||||
|
sizer_print_failed_info->Add(sizer_error_desc, 0, wxLEFT, 5);
|
||||||
|
sizer_print_failed_info->Add(0, 0, 0, wxTOP, FromDIP(3));
|
||||||
|
sizer_print_failed_info->Add(sizer_extra_info, 0, wxLEFT, 5);
|
||||||
|
|
||||||
|
m_st_txt_error_desc->SetLabel("");
|
||||||
|
m_st_txt_error_desc->Wrap(FromDIP(170));
|
||||||
|
|
||||||
|
wxBoxSizer* m_main_sizer = new wxBoxSizer(wxVERTICAL);
|
||||||
|
m_main_sizer->Add(m_connection_info, 0, wxEXPAND, 0);
|
||||||
|
m_main_sizer->Add(m_side_error_panel, 0, wxEXPAND, 0);
|
||||||
|
m_main_sizer->Add(m_side_tools, 1, wxEXPAND, 0);
|
||||||
|
SetSizer(m_main_sizer);
|
||||||
|
Layout();
|
||||||
|
Fit();
|
||||||
|
}
|
||||||
|
|
||||||
|
void SideTools::msw_rescale()
|
||||||
|
{
|
||||||
|
m_side_tools->msw_rescale();
|
||||||
|
m_connection_info->SetCornerRadius(0);
|
||||||
|
m_connection_info->SetSize(wxSize(FromDIP(220), FromDIP(25)));
|
||||||
|
m_connection_info->SetMinSize(wxSize(FromDIP(220), FromDIP(25)));
|
||||||
|
m_connection_info->SetMaxSize(wxSize(FromDIP(220), FromDIP(25)));
|
||||||
|
}
|
||||||
|
|
||||||
|
bool SideTools::is_in_interval()
|
||||||
|
{
|
||||||
|
return m_side_tools->is_in_interval();
|
||||||
|
}
|
||||||
|
|
||||||
|
void SideTools::set_current_printer_name(std::string dev_name)
|
||||||
|
{
|
||||||
|
m_side_tools->set_current_printer_name(dev_name);
|
||||||
|
}
|
||||||
|
|
||||||
|
void SideTools::set_current_printer_signal(WifiSignal sign)
|
||||||
|
{
|
||||||
|
m_side_tools->set_current_printer_signal(sign);
|
||||||
|
}
|
||||||
|
|
||||||
|
void SideTools::set_none_printer_mode()
|
||||||
|
{
|
||||||
|
m_side_tools->set_none_printer_mode();
|
||||||
|
}
|
||||||
|
|
||||||
|
void SideTools::start_interval()
|
||||||
|
{
|
||||||
|
m_side_tools->start_interval();
|
||||||
|
}
|
||||||
|
|
||||||
|
void SideTools::update_connect_err_info(int code, wxString desc, wxString info)
|
||||||
|
{
|
||||||
|
m_st_txt_error_code->SetLabelText(wxString::Format("%d", code));
|
||||||
|
m_st_txt_error_desc->SetLabelText(desc);
|
||||||
|
m_st_txt_extra_info->SetLabelText(info);
|
||||||
|
|
||||||
|
m_st_txt_error_code->Wrap(FromDIP(175));
|
||||||
|
m_st_txt_error_desc->Wrap(FromDIP(175));
|
||||||
|
m_st_txt_extra_info->Wrap(FromDIP(175));
|
||||||
|
|
||||||
|
if (code == BAMBU_NETWORK_ERR_CONNECTION_TO_PRINTER_FAILED) {
|
||||||
|
m_link_network_state->Hide();
|
||||||
|
}
|
||||||
|
else if (code == BAMBU_NETWORK_ERR_CONNECTION_TO_SERVER_FAILED) {
|
||||||
|
m_link_network_state->Show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void SideTools::update_status(MachineObject* obj)
|
||||||
|
{
|
||||||
|
if (!obj) return;
|
||||||
|
|
||||||
|
/* Update Device Info */
|
||||||
|
m_side_tools->set_current_printer_name(obj->dev_name);
|
||||||
|
|
||||||
|
// update wifi signal image
|
||||||
|
int wifi_signal_val = 0;
|
||||||
|
if (!obj->is_connected() || obj->is_connecting()) {
|
||||||
|
m_side_tools->set_current_printer_signal(WifiSignal::NONE);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (!obj->wifi_signal.empty() && boost::ends_with(obj->wifi_signal, "dBm")) {
|
||||||
|
try {
|
||||||
|
wifi_signal_val = std::stoi(obj->wifi_signal.substr(0, obj->wifi_signal.size() - 3));
|
||||||
|
}
|
||||||
|
catch (...) {
|
||||||
|
;
|
||||||
|
}
|
||||||
|
if (wifi_signal_val > -45) {
|
||||||
|
m_side_tools->set_current_printer_signal(WifiSignal::STRONG);
|
||||||
|
}
|
||||||
|
else if (wifi_signal_val <= -45 && wifi_signal_val >= -60) {
|
||||||
|
m_side_tools->set_current_printer_signal(WifiSignal::MIDDLE);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
m_side_tools->set_current_printer_signal(WifiSignal::WEAK);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
m_side_tools->set_current_printer_signal(WifiSignal::MIDDLE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void SideTools::show_status(int status)
|
||||||
|
{
|
||||||
|
if (((status & (int)MonitorStatus::MONITOR_DISCONNECTED) != 0) || ((status & (int)MonitorStatus::MONITOR_DISCONNECTED_SERVER) != 0)) {
|
||||||
|
if ((status & (int)MonitorStatus::MONITOR_DISCONNECTED_SERVER)) {
|
||||||
|
m_hyperlink->SetLabel(_L("Failed to connect to the server"));
|
||||||
|
update_connect_err_info(BAMBU_NETWORK_ERR_CONNECTION_TO_SERVER_FAILED,
|
||||||
|
_L("Failed to connect to cloud service"),
|
||||||
|
_L("Please click on the hyperlink above to view the cloud service status"));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
m_hyperlink->SetLabel(_L("Failed to connect to the printer"));
|
||||||
|
update_connect_err_info(BAMBU_NETWORK_ERR_CONNECTION_TO_PRINTER_FAILED,
|
||||||
|
_L("Connection to printer failed"),
|
||||||
|
_L("Please check the network connection of the printer and Studio."));
|
||||||
|
}
|
||||||
|
|
||||||
|
m_hyperlink->Show();
|
||||||
|
m_connection_info->SetLabel(wxEmptyString);
|
||||||
|
m_connection_info->SetBackgroundColor(0xFF6F00);
|
||||||
|
m_connection_info->SetBorderColor(0xFF6F00);
|
||||||
|
m_connection_info->Show();
|
||||||
|
m_more_button->Show();
|
||||||
|
|
||||||
|
}
|
||||||
|
else if ((status & (int)MonitorStatus::MONITOR_NORMAL) != 0) {
|
||||||
|
m_connection_info->Hide();
|
||||||
|
m_more_button->Hide();
|
||||||
|
m_side_error_panel->Hide();
|
||||||
|
}
|
||||||
|
else if ((status & (int)MonitorStatus::MONITOR_CONNECTING) != 0) {
|
||||||
|
m_hyperlink->Hide();
|
||||||
|
m_connection_info->SetLabel(_L("Connecting..."));
|
||||||
|
m_connection_info->SetBackgroundColor(0x00AE42);
|
||||||
|
m_connection_info->SetBorderColor(0x00AE42);
|
||||||
|
m_connection_info->Show();
|
||||||
|
m_more_button->Hide();
|
||||||
|
m_side_error_panel->Hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((status & (int)MonitorStatus::MONITOR_NO_PRINTER) != 0) {
|
||||||
|
m_side_tools->set_none_printer_mode();
|
||||||
|
m_connection_info->Hide();
|
||||||
|
m_side_error_panel->Hide();
|
||||||
|
m_more_button->Hide();
|
||||||
|
}
|
||||||
|
else if (((status & (int)MonitorStatus::MONITOR_NORMAL) != 0)
|
||||||
|
|| ((status & (int)MonitorStatus::MONITOR_DISCONNECTED) != 0)
|
||||||
|
|| ((status & (int)MonitorStatus::MONITOR_DISCONNECTED_SERVER) != 0)
|
||||||
|
|| ((status & (int)MonitorStatus::MONITOR_CONNECTING) != 0)
|
||||||
|
) {
|
||||||
|
if (((status & (int)MonitorStatus::MONITOR_DISCONNECTED) != 0)
|
||||||
|
|| ((status & (int)MonitorStatus::MONITOR_DISCONNECTED_SERVER) != 0)
|
||||||
|
|| ((status & (int)MonitorStatus::MONITOR_CONNECTING) != 0)) {
|
||||||
|
m_side_tools->set_current_printer_signal(WifiSignal::NONE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Layout();
|
||||||
|
Fit();
|
||||||
|
}
|
||||||
|
|
||||||
|
SideTools::~SideTools()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
}}
|
}}
|
||||||
|
|
|
@ -4,6 +4,11 @@
|
||||||
#include <wx/dcgraph.h>
|
#include <wx/dcgraph.h>
|
||||||
#include <wx/gdicmn.h>
|
#include <wx/gdicmn.h>
|
||||||
#include <wx/dcclient.h>
|
#include <wx/dcclient.h>
|
||||||
|
#include <wx/hyperlink.h>
|
||||||
|
#include "Button.hpp"
|
||||||
|
#include "Label.hpp"
|
||||||
|
#include "../GUI/Tabbook.hpp"
|
||||||
|
#include "../DeviceManager.hpp"
|
||||||
#include "../wxExtensions.hpp"
|
#include "../wxExtensions.hpp"
|
||||||
|
|
||||||
#define SIDE_TOOLS_GREY900 wxColour(38, 46, 48)
|
#define SIDE_TOOLS_GREY900 wxColour(38, 46, 48)
|
||||||
|
@ -19,11 +24,20 @@ enum WifiSignal {
|
||||||
STRONG,
|
STRONG,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum MonitorStatus {
|
||||||
|
MONITOR_UNKNOWN = 0,
|
||||||
|
MONITOR_NORMAL = 1 << 1,
|
||||||
|
MONITOR_NO_PRINTER = 1 << 2,
|
||||||
|
MONITOR_DISCONNECTED = 1 << 3,
|
||||||
|
MONITOR_DISCONNECTED_SERVER = 1 << 4,
|
||||||
|
MONITOR_CONNECTING = 1 << 5,
|
||||||
|
};
|
||||||
|
|
||||||
#define SIDE_TOOL_CLICK_INTERVAL 20
|
#define SIDE_TOOL_CLICK_INTERVAL 20
|
||||||
|
|
||||||
namespace Slic3r { namespace GUI {
|
namespace Slic3r { namespace GUI {
|
||||||
|
|
||||||
class SideTools : public wxPanel
|
class SideToolsPanel : public wxPanel
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
WifiSignal m_wifi_type{WifiSignal::NONE};
|
WifiSignal m_wifi_type{WifiSignal::NONE};
|
||||||
|
@ -52,8 +66,8 @@ protected:
|
||||||
bool m_is_in_interval {false};
|
bool m_is_in_interval {false};
|
||||||
|
|
||||||
public:
|
public:
|
||||||
SideTools(wxWindow *parent, wxWindowID id = wxID_ANY, const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize);
|
SideToolsPanel(wxWindow *parent, wxWindowID id = wxID_ANY, const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize);
|
||||||
~SideTools();
|
~SideToolsPanel();
|
||||||
|
|
||||||
void set_none_printer_mode();
|
void set_none_printer_mode();
|
||||||
void on_timer(wxTimerEvent &event);
|
void on_timer(wxTimerEvent &event);
|
||||||
|
@ -73,6 +87,43 @@ protected:
|
||||||
void on_mouse_left_down(wxMouseEvent &evt);
|
void on_mouse_left_down(wxMouseEvent &evt);
|
||||||
void on_mouse_left_up(wxMouseEvent &evt);
|
void on_mouse_left_up(wxMouseEvent &evt);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class SideTools : public wxPanel
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
SideTools(wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize);
|
||||||
|
~SideTools();
|
||||||
|
|
||||||
|
private:
|
||||||
|
SideToolsPanel* m_side_tools{ nullptr };
|
||||||
|
Tabbook* m_tabpanel{ nullptr };
|
||||||
|
Label* m_link_network_state{ nullptr };
|
||||||
|
Label* m_st_txt_error_code{ nullptr };
|
||||||
|
Label* m_st_txt_error_desc{ nullptr };
|
||||||
|
Label* m_st_txt_extra_info{ nullptr };
|
||||||
|
wxWindow* m_side_error_panel{ nullptr };
|
||||||
|
Button* m_connection_info{ nullptr };
|
||||||
|
wxHyperlinkCtrl* m_hyperlink{ nullptr };
|
||||||
|
ScalableButton* m_more_button{ nullptr };
|
||||||
|
ScalableBitmap m_more_err_open;
|
||||||
|
ScalableBitmap m_more_err_close;
|
||||||
|
bool m_more_err_state{ false };
|
||||||
|
|
||||||
|
public:
|
||||||
|
void set_table_panel(Tabbook* tb) {m_tabpanel = tb;};
|
||||||
|
void msw_rescale();
|
||||||
|
bool is_in_interval();
|
||||||
|
void set_current_printer_name(std::string dev_name);
|
||||||
|
void set_current_printer_signal(WifiSignal sign);
|
||||||
|
void set_none_printer_mode();
|
||||||
|
void start_interval();
|
||||||
|
void update_status(MachineObject* obj);
|
||||||
|
void update_connect_err_info(int code, wxString desc, wxString info);
|
||||||
|
void show_status(int status);
|
||||||
|
|
||||||
|
public:
|
||||||
|
SideToolsPanel* get_panel() {return m_side_tools;};
|
||||||
|
};
|
||||||
}} // namespace Slic3r::GUI
|
}} // namespace Slic3r::GUI
|
||||||
|
|
||||||
#endif // !slic3r_GUI_SIDETOOLS_hpp_
|
#endif // !slic3r_GUI_SIDETOOLS_hpp_
|
||||||
|
|
|
@ -24,14 +24,102 @@ static std::string MachineBedTypeString[5] = {
|
||||||
"pte"
|
"pte"
|
||||||
};
|
};
|
||||||
|
|
||||||
static std::map<CalibMode, std::string> calib_mode_to_name = {
|
|
||||||
{CalibMode::Calib_Flow_Rate, "flow_rate_calib_mode"},
|
std::string get_calib_mode_name(CalibMode cali_mode, int stage)
|
||||||
{CalibMode::Calib_Temp_Tower, "temp_tower_calib_mode"},
|
{
|
||||||
{CalibMode::Calib_Vol_speed_Tower, "vol_speed_tower_calib_mode"},
|
switch(cali_mode) {
|
||||||
{CalibMode::Calib_VFA_Tower, "vfa_tower_calib_mode"},
|
case CalibMode::Calib_Flow_Rate:
|
||||||
{CalibMode::Calib_Retraction_tower, "retration_tower_calib_mode"}
|
if (stage == 1)
|
||||||
|
return "flow_rate_coarse_calib_mode";
|
||||||
|
else if (stage == 2)
|
||||||
|
return "flow_rate_fine_calib_mode";
|
||||||
|
else
|
||||||
|
return "flow_rate_coarse_calib_mode";
|
||||||
|
case CalibMode::Calib_Temp_Tower:
|
||||||
|
return "temp_tower_calib_mode";
|
||||||
|
case CalibMode::Calib_Vol_speed_Tower:
|
||||||
|
return "vol_speed_tower_calib_mode";
|
||||||
|
case CalibMode::Calib_VFA_Tower:
|
||||||
|
return "vfa_tower_calib_mode";
|
||||||
|
case CalibMode::Calib_Retraction_tower:
|
||||||
|
return "retration_tower_calib_mode";
|
||||||
|
default:
|
||||||
|
assert(false);
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
CalibMode CalibUtils::get_calib_mode_by_name(const std::string name, int& cali_stage)
|
||||||
|
{
|
||||||
|
if (name == "flow_rate_coarse_calib_mode") {
|
||||||
|
cali_stage = 1;
|
||||||
|
return CalibMode::Calib_Flow_Rate;
|
||||||
|
}
|
||||||
|
else if (name == "flow_rate_fine_calib_mode") {
|
||||||
|
cali_stage = 2;
|
||||||
|
return CalibMode::Calib_Flow_Rate;
|
||||||
|
}
|
||||||
|
else if (name == "temp_tower_calib_mode")
|
||||||
|
return CalibMode::Calib_Temp_Tower;
|
||||||
|
else if (name == "vol_speed_tower_calib_mode")
|
||||||
|
return CalibMode::Calib_Vol_speed_Tower;
|
||||||
|
else if (name == "vfa_tower_calib_mode")
|
||||||
|
return CalibMode::Calib_VFA_Tower;
|
||||||
|
else if (name == "retration_tower_calib_mode")
|
||||||
|
return CalibMode::Calib_Retraction_tower;
|
||||||
|
return CalibMode::Calib_None;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CalibUtils::validate_input_k_value(wxString k_text, float* output_value)
|
||||||
|
{
|
||||||
|
float default_k = 0.0f;
|
||||||
|
if (k_text.IsEmpty()) {
|
||||||
|
*output_value = default_k;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
double k_value = 0.0;
|
||||||
|
try {
|
||||||
|
k_text.ToDouble(&k_value);
|
||||||
|
}
|
||||||
|
catch (...) {
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (k_value < 0 || k_value > 0.5) {
|
||||||
|
*output_value = default_k;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
*output_value = k_value;
|
||||||
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
bool CalibUtils::validate_input_flow_ratio(wxString flow_ratio, float* output_value) {
|
||||||
|
float default_flow_ratio = 1.0f;
|
||||||
|
|
||||||
|
if (flow_ratio.IsEmpty()) {
|
||||||
|
*output_value = default_flow_ratio;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
double flow_ratio_value = 0.0;
|
||||||
|
try {
|
||||||
|
flow_ratio.ToDouble(&flow_ratio_value);
|
||||||
|
}
|
||||||
|
catch (...) {
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (flow_ratio_value <= 0.0 || flow_ratio_value >= 2.0) {
|
||||||
|
*output_value = default_flow_ratio;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
*output_value = flow_ratio_value;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
static void cut_model(Model &model, std::array<Vec3d, 4> plane_points, ModelObjectCutAttributes attributes)
|
static void cut_model(Model &model, std::array<Vec3d, 4> plane_points, ModelObjectCutAttributes attributes)
|
||||||
{
|
{
|
||||||
size_t obj_idx = 0;
|
size_t obj_idx = 0;
|
||||||
|
@ -82,17 +170,7 @@ std::array<Vec3d, 4> get_cut_plane_points(const BoundingBoxf3 &bbox, const doubl
|
||||||
return plane_pts;
|
return plane_pts;
|
||||||
}
|
}
|
||||||
|
|
||||||
CalibMode CalibUtils::get_calib_mode_by_name(const std::string &name)
|
void CalibUtils::calib_PA(const X1CCalibInfos& calib_infos, int mode, std::string& error_message)
|
||||||
{
|
|
||||||
for (auto iter = calib_mode_to_name.begin(); iter != calib_mode_to_name.end(); ++iter) {
|
|
||||||
if (iter->second == name) {
|
|
||||||
return iter->first;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return CalibMode::Calib_None;
|
|
||||||
}
|
|
||||||
|
|
||||||
void CalibUtils::calib_PA(const X1CCalibInfos &calib_infos, std::string &error_message, int mode)
|
|
||||||
{
|
{
|
||||||
DeviceManager *dev = Slic3r::GUI::wxGetApp().getDeviceManager();
|
DeviceManager *dev = Slic3r::GUI::wxGetApp().getDeviceManager();
|
||||||
if (!dev)
|
if (!dev)
|
||||||
|
@ -572,7 +650,7 @@ void CalibUtils::calib_VFA(const CalibInfo& calib_info, std::string& error_messa
|
||||||
cut_model(model, plane_pts, ModelObjectCutAttribute::KeepLower);
|
cut_model(model, plane_pts, ModelObjectCutAttribute::KeepLower);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
error_message = "The start, end or step is not valid value.";
|
error_message = L("The start, end or step is not valid value.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -681,7 +759,7 @@ void CalibUtils::process_and_store_3mf(Model* model, const DynamicPrintConfig& f
|
||||||
BuildVolume build_volume(bedfs, print_height);
|
BuildVolume build_volume(bedfs, print_height);
|
||||||
unsigned int count = model->update_print_volume_state(build_volume);
|
unsigned int count = model->update_print_volume_state(build_volume);
|
||||||
if (count == 0) {
|
if (count == 0) {
|
||||||
error_message = "Unable to calibrate: maybe because the set calibration value range is too large, or the step is too small";
|
error_message = L("Unable to calibrate: maybe because the set calibration value range is too large, or the step is too small");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -729,7 +807,7 @@ void CalibUtils::process_and_store_3mf(Model* model, const DynamicPrintConfig& f
|
||||||
success = Slic3r::store_bbs_3mf(store_params);
|
success = Slic3r::store_bbs_3mf(store_params);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CalibUtils::send_to_print(const CalibInfo& calib_info, std::string &error_message)
|
void CalibUtils::send_to_print(const CalibInfo &calib_info, std::string &error_message, int flow_ratio_mode)
|
||||||
{
|
{
|
||||||
std::string dev_id = calib_info.dev_id;
|
std::string dev_id = calib_info.dev_id;
|
||||||
std::string select_ams = calib_info.select_ams;
|
std::string select_ams = calib_info.select_ams;
|
||||||
|
@ -738,35 +816,35 @@ void CalibUtils::send_to_print(const CalibInfo& calib_info, std::string &error_m
|
||||||
|
|
||||||
DeviceManager* dev = Slic3r::GUI::wxGetApp().getDeviceManager();
|
DeviceManager* dev = Slic3r::GUI::wxGetApp().getDeviceManager();
|
||||||
if (!dev) {
|
if (!dev) {
|
||||||
error_message = "Need select printer";
|
error_message = L("Need select printer");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
MachineObject* obj_ = dev->get_selected_machine();
|
MachineObject* obj_ = dev->get_selected_machine();
|
||||||
if (obj_ == nullptr) {
|
if (obj_ == nullptr) {
|
||||||
error_message = "Need select printer";
|
error_message = L("Need select printer");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (obj_->is_in_printing()) {
|
if (obj_->is_in_printing()) {
|
||||||
error_message = "Cannot send the print job when the printer is updating firmware";
|
error_message = L("Cannot send the print job when the printer is updating firmware");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if (obj_->is_system_printing()) {
|
else if (obj_->is_system_printing()) {
|
||||||
error_message = "The printer is executing instructions. Please restart printing after it ends";
|
error_message = L("The printer is executing instructions. Please restart printing after it ends");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if (obj_->is_in_printing()) {
|
else if (obj_->is_in_printing()) {
|
||||||
error_message = "The printer is busy on other print job";
|
error_message = L("The printer is busy on other print job");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if (!obj_->is_function_supported(PrinterFunction::FUNC_PRINT_WITHOUT_SD) && (obj_->get_sdcard_state() == MachineObject::SdcardState::NO_SDCARD)) {
|
else if (!obj_->is_function_supported(PrinterFunction::FUNC_PRINT_WITHOUT_SD) && (obj_->get_sdcard_state() == MachineObject::SdcardState::NO_SDCARD)) {
|
||||||
error_message = "An SD card needs to be inserted before printing.";
|
error_message = L("An SD card needs to be inserted before printing.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (obj_->is_lan_mode_printer()) {
|
if (obj_->is_lan_mode_printer()) {
|
||||||
if (obj_->get_sdcard_state() == MachineObject::SdcardState::NO_SDCARD) {
|
if (obj_->get_sdcard_state() == MachineObject::SdcardState::NO_SDCARD) {
|
||||||
error_message = "An SD card needs to be inserted before printing via LAN.";
|
error_message = L("An SD card needs to be inserted before printing via LAN.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -809,7 +887,9 @@ void CalibUtils::send_to_print(const CalibInfo& calib_info, std::string &error_m
|
||||||
print_job->task_ams_mapping = select_ams;
|
print_job->task_ams_mapping = select_ams;
|
||||||
print_job->task_ams_mapping_info = "";
|
print_job->task_ams_mapping_info = "";
|
||||||
print_job->task_use_ams = select_ams == "[254]" ? false : true;
|
print_job->task_use_ams = select_ams == "[254]" ? false : true;
|
||||||
print_job->m_project_name = calib_mode_to_name[calib_info.params.mode];
|
|
||||||
|
CalibMode cali_mode = calib_info.params.mode;
|
||||||
|
print_job->m_project_name = get_calib_mode_name(cali_mode, flow_ratio_mode);
|
||||||
|
|
||||||
print_job->has_sdcard = obj_->has_sdcard();
|
print_job->has_sdcard = obj_->has_sdcard();
|
||||||
print_job->set_print_config(MachineBedTypeString[bed_type], true, false, false, false, true);
|
print_job->set_print_config(MachineBedTypeString[bed_type], true, false, false, false, true);
|
||||||
|
|
|
@ -28,9 +28,9 @@ public:
|
||||||
CalibUtils(){};
|
CalibUtils(){};
|
||||||
static std::shared_ptr<PrintJob> print_job;
|
static std::shared_ptr<PrintJob> print_job;
|
||||||
|
|
||||||
static CalibMode get_calib_mode_by_name(const std::string &name);
|
static CalibMode get_calib_mode_by_name(const std::string name, int &cali_stage);
|
||||||
|
|
||||||
static void calib_PA(const X1CCalibInfos &calib_infos, std::string &error_message, int mode = 0); // 0: automatic mode; 1: manual mode. default: automatic mode
|
static void calib_PA(const X1CCalibInfos& calib_infos, int mode, std::string& error_message);
|
||||||
|
|
||||||
static void emit_get_PA_calib_results(float nozzle_diameter);
|
static void emit_get_PA_calib_results(float nozzle_diameter);
|
||||||
static bool get_PA_calib_results(std::vector<PACalibResult> &pa_calib_results);
|
static bool get_PA_calib_results(std::vector<PACalibResult> &pa_calib_results);
|
||||||
|
@ -59,9 +59,12 @@ public:
|
||||||
//help function
|
//help function
|
||||||
static int get_selected_calib_idx(const std::vector<PACalibResult> &pa_calib_values, int cali_idx);
|
static int get_selected_calib_idx(const std::vector<PACalibResult> &pa_calib_values, int cali_idx);
|
||||||
|
|
||||||
|
static bool validate_input_k_value(wxString k_text, float* output_value);
|
||||||
|
static bool validate_input_flow_ratio(wxString flow_ratio, float* output_value);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static void process_and_store_3mf(Model* model, const DynamicPrintConfig& full_config, const Calib_Params& params, std::string& error_message);
|
static void process_and_store_3mf(Model* model, const DynamicPrintConfig& full_config, const Calib_Params& params, std::string& error_message);
|
||||||
static void send_to_print(const CalibInfo& calib_info, std::string &error_message);
|
static void send_to_print(const CalibInfo &calib_info, std::string& error_message, int flow_ratio_mode = 0); // 0: none 1: coarse 2: fine
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|