mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-09-28 03:11:47 +00:00
Compare commits
5
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5298e49dd2 | ||
|
|
4964f49765 | ||
|
|
ea471dc82d | ||
|
|
bd65cce3f4 | ||
|
|
d976d9eb0c |
@@ -990,6 +990,7 @@ EmbossStyles Emboss::get_font_list_by_enumeration() {
|
|||||||
std::vector<std::wstring> font_names;
|
std::vector<std::wstring> font_names;
|
||||||
EnumFontFamilies(hDC, (LPCTSTR) NULL, EnumFamCallBack,
|
EnumFontFamilies(hDC, (LPCTSTR) NULL, EnumFamCallBack,
|
||||||
(LPARAM) &font_names);
|
(LPARAM) &font_names);
|
||||||
|
ReleaseDC(NULL, hDC);
|
||||||
|
|
||||||
EmbossStyles font_list;
|
EmbossStyles font_list;
|
||||||
for (const std::wstring &font_name : font_names) {
|
for (const std::wstring &font_name : font_names) {
|
||||||
|
|||||||
+5
-10
@@ -2504,8 +2504,7 @@ void GCode::do_export(Print* print, const char* path, GCodeProcessorResult* resu
|
|||||||
|
|
||||||
{
|
{
|
||||||
LifecycleEventContext ctx;
|
LifecycleEventContext ctx;
|
||||||
ctx.id = std::to_string(print->model().id().id);
|
ctx.name = std::to_string(print->model().id().id);
|
||||||
ctx.name = print->get_model_name();
|
|
||||||
ctx.code = LifecycleEvtCode::Ok;
|
ctx.code = LifecycleEvtCode::Ok;
|
||||||
ctx.msg = path;
|
ctx.msg = path;
|
||||||
ctx.cancellation_check = [print]() { return print->canceled(); };
|
ctx.cancellation_check = [print]() { return print->canceled(); };
|
||||||
@@ -2557,8 +2556,7 @@ void GCode::do_export(Print* print, const char* path, GCodeProcessorResult* resu
|
|||||||
}
|
}
|
||||||
{
|
{
|
||||||
LifecycleEventContext ctx;
|
LifecycleEventContext ctx;
|
||||||
ctx.id = std::to_string(print->model().id().id);
|
ctx.name = std::to_string(print->model().id().id);
|
||||||
ctx.name = print->get_model_name();
|
|
||||||
ctx.code = LifecycleEvtCode::Error;
|
ctx.code = LifecycleEvtCode::Error;
|
||||||
ctx.msg = std::string(path) + "\n" + err_msg;
|
ctx.msg = std::string(path) + "\n" + err_msg;
|
||||||
ctx.cancellation_check = [print]() { return print->canceled(); };
|
ctx.cancellation_check = [print]() { return print->canceled(); };
|
||||||
@@ -2582,8 +2580,7 @@ void GCode::do_export(Print* print, const char* path, GCodeProcessorResult* resu
|
|||||||
boost::nowide::remove(path_tmp.c_str());
|
boost::nowide::remove(path_tmp.c_str());
|
||||||
{
|
{
|
||||||
LifecycleEventContext ctx;
|
LifecycleEventContext ctx;
|
||||||
ctx.id = std::to_string(print->model().id().id);
|
ctx.name = std::to_string(print->model().id().id);
|
||||||
ctx.name = print->get_model_name();
|
|
||||||
ctx.code = LifecycleEvtCode::Error;
|
ctx.code = LifecycleEvtCode::Error;
|
||||||
ctx.msg = std::string(path) + "\n" + ex.what();
|
ctx.msg = std::string(path) + "\n" + ex.what();
|
||||||
ctx.cancellation_check = [print]() { return print->canceled(); };
|
ctx.cancellation_check = [print]() { return print->canceled(); };
|
||||||
@@ -2696,8 +2693,7 @@ void GCode::do_export(Print* print, const char* path, GCodeProcessorResult* resu
|
|||||||
if (ret) {
|
if (ret) {
|
||||||
{
|
{
|
||||||
LifecycleEventContext ctx;
|
LifecycleEventContext ctx;
|
||||||
ctx.id = std::to_string(print->model().id().id);
|
ctx.name = std::to_string(print->model().id().id);
|
||||||
ctx.name = print->get_model_name();
|
|
||||||
ctx.code = LifecycleEvtCode::Error;
|
ctx.code = LifecycleEvtCode::Error;
|
||||||
ctx.msg = std::string(path) + "\nFailed to rename the output G-code file: " + ret.message();
|
ctx.msg = std::string(path) + "\nFailed to rename the output G-code file: " + ret.message();
|
||||||
ctx.cancellation_check = [print]() { return print->canceled(); };
|
ctx.cancellation_check = [print]() { return print->canceled(); };
|
||||||
@@ -2716,8 +2712,7 @@ void GCode::do_export(Print* print, const char* path, GCodeProcessorResult* resu
|
|||||||
|
|
||||||
{
|
{
|
||||||
LifecycleEventContext ctx;
|
LifecycleEventContext ctx;
|
||||||
ctx.id = std::to_string(print->model().id().id);
|
ctx.name = std::to_string(print->model().id().id);
|
||||||
ctx.name = print->get_model_name();
|
|
||||||
ctx.code = LifecycleEvtCode::Ok;
|
ctx.code = LifecycleEvtCode::Ok;
|
||||||
ctx.msg = path;
|
ctx.msg = path;
|
||||||
ctx.cancellation_check = [print]() { return print->canceled(); };
|
ctx.cancellation_check = [print]() { return print->canceled(); };
|
||||||
|
|||||||
+5
-10
@@ -2717,8 +2717,7 @@ void Print::process(long long *time_cost_with_cache, bool use_cache)
|
|||||||
|
|
||||||
{
|
{
|
||||||
LifecycleEventContext ctx;
|
LifecycleEventContext ctx;
|
||||||
ctx.id = std::to_string(m_model.id().id);
|
ctx.name = std::to_string(m_model.id().id);
|
||||||
ctx.name = get_model_name();
|
|
||||||
ctx.code = LifecycleEvtCode::Ok;
|
ctx.code = LifecycleEvtCode::Ok;
|
||||||
ctx.cancellation_check = [this]() { return canceled(); };
|
ctx.cancellation_check = [this]() { return canceled(); };
|
||||||
fire_lifecycle_event(LifecycleEvent::SliceStarted, ctx);
|
fire_lifecycle_event(LifecycleEvent::SliceStarted, ctx);
|
||||||
@@ -3345,8 +3344,7 @@ void Print::process(long long *time_cost_with_cache, bool use_cache)
|
|||||||
|
|
||||||
{
|
{
|
||||||
LifecycleEventContext ctx;
|
LifecycleEventContext ctx;
|
||||||
ctx.id = std::to_string(m_model.id().id);
|
ctx.name = std::to_string(m_model.id().id);
|
||||||
ctx.name = get_model_name();
|
|
||||||
ctx.code = LifecycleEvtCode::Ok;
|
ctx.code = LifecycleEvtCode::Ok;
|
||||||
ctx.cancellation_check = [this]() { return canceled(); };
|
ctx.cancellation_check = [this]() { return canceled(); };
|
||||||
fire_lifecycle_event(LifecycleEvent::SliceGeometryFinished, ctx);
|
fire_lifecycle_event(LifecycleEvent::SliceGeometryFinished, ctx);
|
||||||
@@ -4952,8 +4950,7 @@ void Print::export_gcode_from_previous_file(const std::string& file, GCodeProces
|
|||||||
{
|
{
|
||||||
{
|
{
|
||||||
LifecycleEventContext ctx;
|
LifecycleEventContext ctx;
|
||||||
ctx.id = std::to_string(m_model.id().id);
|
ctx.name = std::to_string(m_model.id().id);
|
||||||
ctx.name = get_model_name();
|
|
||||||
ctx.code = LifecycleEvtCode::Ok;
|
ctx.code = LifecycleEvtCode::Ok;
|
||||||
ctx.msg = file;
|
ctx.msg = file;
|
||||||
ctx.cancellation_check = [this]() { return canceled(); };
|
ctx.cancellation_check = [this]() { return canceled(); };
|
||||||
@@ -4983,8 +4980,7 @@ void Print::export_gcode_from_previous_file(const std::string& file, GCodeProces
|
|||||||
BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << boost::format(": found errors when process gcode file %1%") %file.c_str();
|
BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << boost::format(": found errors when process gcode file %1%") %file.c_str();
|
||||||
{
|
{
|
||||||
LifecycleEventContext ctx;
|
LifecycleEventContext ctx;
|
||||||
ctx.id = std::to_string(m_model.id().id);
|
ctx.name = std::to_string(m_model.id().id);
|
||||||
ctx.name = get_model_name();
|
|
||||||
ctx.code = LifecycleEvtCode::Error;
|
ctx.code = LifecycleEvtCode::Error;
|
||||||
ctx.msg = file + "\n" + ex.what();
|
ctx.msg = file + "\n" + ex.what();
|
||||||
ctx.cancellation_check = [this]() { return canceled(); };
|
ctx.cancellation_check = [this]() { return canceled(); };
|
||||||
@@ -4998,8 +4994,7 @@ void Print::export_gcode_from_previous_file(const std::string& file, GCodeProces
|
|||||||
|
|
||||||
{
|
{
|
||||||
LifecycleEventContext ctx;
|
LifecycleEventContext ctx;
|
||||||
ctx.id = std::to_string(m_model.id().id);
|
ctx.name = std::to_string(m_model.id().id);
|
||||||
ctx.name = get_model_name();
|
|
||||||
ctx.code = LifecycleEvtCode::Ok;
|
ctx.code = LifecycleEvtCode::Ok;
|
||||||
ctx.msg = file;
|
ctx.msg = file;
|
||||||
ctx.cancellation_check = [this]() { return canceled(); };
|
ctx.cancellation_check = [this]() { return canceled(); };
|
||||||
|
|||||||
@@ -819,7 +819,7 @@ AmsMapingPopup::AmsMapingPopup(wxWindow *parent, bool use_in_sync_dialog) :
|
|||||||
|
|
||||||
m_scrolled_window = new wxScrolledWindow(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxVSCROLL | wxHSCROLL);
|
m_scrolled_window = new wxScrolledWindow(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxVSCROLL | wxHSCROLL);
|
||||||
m_scrolled_window->SetBackgroundColour(*wxWHITE);
|
m_scrolled_window->SetBackgroundColour(*wxWHITE);
|
||||||
m_scrolled_window->SetScrollRate(0, FromDIP(10));
|
m_scrolled_window->SetScrollRate(0, FromDIP(20));
|
||||||
|
|
||||||
wxBoxSizer *title_sizer_h= new wxBoxSizer(wxHORIZONTAL);
|
wxBoxSizer *title_sizer_h= new wxBoxSizer(wxHORIZONTAL);
|
||||||
wxBoxSizer *title_sizer_v = new wxBoxSizer(wxVERTICAL);
|
wxBoxSizer *title_sizer_v = new wxBoxSizer(wxVERTICAL);
|
||||||
@@ -1000,13 +1000,13 @@ AmsMapingPopup::AmsMapingPopup(wxWindow *parent, bool use_in_sync_dialog) :
|
|||||||
show_pos.x = screen_size.GetLeft();
|
show_pos.x = screen_size.GetLeft();
|
||||||
m_scrolled_window->SetMaxSize(wxSize(screen_size.GetWidth(), popup_height));
|
m_scrolled_window->SetMaxSize(wxSize(screen_size.GetWidth(), popup_height));
|
||||||
m_scrolled_window->SetMinSize(wxSize(screen_size.GetWidth(), popup_height));
|
m_scrolled_window->SetMinSize(wxSize(screen_size.GetWidth(), popup_height));
|
||||||
m_scrolled_window->SetScrollRate(FromDIP(10), FromDIP(10));
|
m_scrolled_window->SetScrollRate(FromDIP(10), FromDIP(20));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_scrolled_window->SetMaxSize(wxSize(popup_width, popup_height));
|
m_scrolled_window->SetMaxSize(wxSize(popup_width, popup_height));
|
||||||
m_scrolled_window->SetMinSize(wxSize(popup_width, popup_height));
|
m_scrolled_window->SetMinSize(wxSize(popup_width, popup_height));
|
||||||
m_scrolled_window->SetScrollRate(0, FromDIP(10));
|
m_scrolled_window->SetScrollRate(0, FromDIP(20));
|
||||||
}
|
}
|
||||||
|
|
||||||
//Vertical Direction Processing
|
//Vertical Direction Processing
|
||||||
@@ -2117,7 +2117,7 @@ void AmsReplaceMaterialDialog::create()
|
|||||||
identical_filament->SetForegroundColour(StateColor::darkModeColorFor(wxColour("#009688"))); // Orca: accent teal (not brand green)
|
identical_filament->SetForegroundColour(StateColor::darkModeColorFor(wxColour("#009688"))); // Orca: accent teal (not brand green)
|
||||||
|
|
||||||
m_scrollview_groups = new wxScrolledWindow(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHSCROLL | wxVSCROLL);
|
m_scrollview_groups = new wxScrolledWindow(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHSCROLL | wxVSCROLL);
|
||||||
m_scrollview_groups->SetScrollRate(5, 5);
|
m_scrollview_groups->SetScrollRate(5, FromDIP(20));
|
||||||
//m_scrollview_groups->SetMinSize(wxSize(400, 400));
|
//m_scrollview_groups->SetMinSize(wxSize(400, 400));
|
||||||
//m_scrollview_groups->SetMaxSize(wxSize(400, 400));
|
//m_scrollview_groups->SetMaxSize(wxSize(400, 400));
|
||||||
m_scrollview_sizer = new wxBoxSizer(wxVERTICAL);
|
m_scrollview_sizer = new wxBoxSizer(wxVERTICAL);
|
||||||
|
|||||||
@@ -606,7 +606,7 @@ AuFolderPanel::AuFolderPanel(wxWindow *parent, AuxiliaryFolderType type, wxWindo
|
|||||||
wxBoxSizer *sizer_main = new wxBoxSizer(wxVERTICAL);
|
wxBoxSizer *sizer_main = new wxBoxSizer(wxVERTICAL);
|
||||||
|
|
||||||
m_scrolledWindow = new wxScrolledWindow(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHSCROLL | wxVSCROLL);
|
m_scrolledWindow = new wxScrolledWindow(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHSCROLL | wxVSCROLL);
|
||||||
m_scrolledWindow->SetScrollRate(5, 5);
|
m_scrolledWindow->SetScrollRate(5, FromDIP(20));
|
||||||
wxBoxSizer *sizer_body = new wxBoxSizer(wxVERTICAL);
|
wxBoxSizer *sizer_body = new wxBoxSizer(wxVERTICAL);
|
||||||
wxBoxSizer *sizer_top = new wxBoxSizer(wxHORIZONTAL);
|
wxBoxSizer *sizer_top = new wxBoxSizer(wxHORIZONTAL);
|
||||||
|
|
||||||
|
|||||||
@@ -558,7 +558,7 @@ PingCodeBindDialog::~PingCodeBindDialog() {
|
|||||||
//show bind failed info
|
//show bind failed info
|
||||||
m_sw_bind_failed_info = new wxScrolledWindow(this, wxID_ANY, wxDefaultPosition, wxSize(FromDIP(450), FromDIP(300)), wxVSCROLL);
|
m_sw_bind_failed_info = new wxScrolledWindow(this, wxID_ANY, wxDefaultPosition, wxSize(FromDIP(450), FromDIP(300)), wxVSCROLL);
|
||||||
m_sw_bind_failed_info->SetBackgroundColour(*wxWHITE);
|
m_sw_bind_failed_info->SetBackgroundColour(*wxWHITE);
|
||||||
m_sw_bind_failed_info->SetScrollRate(5, 5);
|
m_sw_bind_failed_info->SetScrollRate(5, FromDIP(20));
|
||||||
m_sw_bind_failed_info->SetMinSize(wxSize(FromDIP(450), FromDIP(90)));
|
m_sw_bind_failed_info->SetMinSize(wxSize(FromDIP(450), FromDIP(90)));
|
||||||
m_sw_bind_failed_info->SetMaxSize(wxSize(FromDIP(450), FromDIP(90)));
|
m_sw_bind_failed_info->SetMaxSize(wxSize(FromDIP(450), FromDIP(90)));
|
||||||
|
|
||||||
|
|||||||
@@ -3521,7 +3521,7 @@ DesignPanel::DesignPanel(wxWindow* parent)
|
|||||||
cards->Show(m_box_mate, false, true);
|
cards->Show(m_box_mate, false, true);
|
||||||
|
|
||||||
m_form->FitInside();
|
m_form->FitInside();
|
||||||
m_form->SetScrollRate(0, 10); // vertical only, like Prepare's sidebar: never scroll labels out
|
m_form->SetScrollRate(0, FromDIP(20)); // vertical only, like Prepare's sidebar: never scroll labels out
|
||||||
m_form->SetMinSize(wxSize(264, -1));
|
m_form->SetMinSize(wxSize(264, -1));
|
||||||
|
|
||||||
// Right column: a small view toolbar over the live 3D viewport that mirrors
|
// Right column: a small view toolbar over the live 3D viewport that mirrors
|
||||||
|
|||||||
@@ -115,7 +115,7 @@ HistoryWindow::HistoryWindow(wxWindow* parent, const std::vector<PACalibResult>&
|
|||||||
auto main_sizer = new wxBoxSizer(wxVERTICAL);
|
auto main_sizer = new wxBoxSizer(wxVERTICAL);
|
||||||
|
|
||||||
auto scroll_window = new wxScrolledWindow(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHSCROLL | wxVSCROLL);
|
auto scroll_window = new wxScrolledWindow(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHSCROLL | wxVSCROLL);
|
||||||
scroll_window->SetScrollRate(5, 5);
|
scroll_window->SetScrollRate(5, FromDIP(20));
|
||||||
scroll_window->SetBackgroundColour(*wxWHITE);
|
scroll_window->SetBackgroundColour(*wxWHITE);
|
||||||
scroll_window->SetMinSize(HISTORY_WINDOW_SIZE);
|
scroll_window->SetMinSize(HISTORY_WINDOW_SIZE);
|
||||||
scroll_window->SetSize(HISTORY_WINDOW_SIZE);
|
scroll_window->SetSize(HISTORY_WINDOW_SIZE);
|
||||||
|
|||||||
@@ -207,7 +207,7 @@ SelectMObjectPopup::SelectMObjectPopup(wxWindow* parent)
|
|||||||
m_scrolledWindow = new wxScrolledWindow(this, wxID_ANY, wxDefaultPosition, SELECT_MACHINE_LIST_SIZE, wxHSCROLL | wxVSCROLL);
|
m_scrolledWindow = new wxScrolledWindow(this, wxID_ANY, wxDefaultPosition, SELECT_MACHINE_LIST_SIZE, wxHSCROLL | wxVSCROLL);
|
||||||
m_scrolledWindow->SetBackgroundColour(*wxWHITE);
|
m_scrolledWindow->SetBackgroundColour(*wxWHITE);
|
||||||
m_scrolledWindow->SetMinSize(SELECT_MACHINE_LIST_SIZE);
|
m_scrolledWindow->SetMinSize(SELECT_MACHINE_LIST_SIZE);
|
||||||
m_scrolledWindow->SetScrollRate(0, 5);
|
m_scrolledWindow->SetScrollRate(0, SELECT_MACHINE_ITEM_SIZE.y);
|
||||||
auto m_sizxer_scrolledWindow = new wxBoxSizer(wxVERTICAL);
|
auto m_sizxer_scrolledWindow = new wxBoxSizer(wxVERTICAL);
|
||||||
m_scrolledWindow->SetSizer(m_sizxer_scrolledWindow);
|
m_scrolledWindow->SetSizer(m_sizxer_scrolledWindow);
|
||||||
m_scrolledWindow->Layout();
|
m_scrolledWindow->Layout();
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ CalibrationWizard::CalibrationWizard(wxWindow* parent, CalibMode mode, wxWindowI
|
|||||||
wxBoxSizer* main_sizer = new wxBoxSizer(wxVERTICAL);
|
wxBoxSizer* main_sizer = new wxBoxSizer(wxVERTICAL);
|
||||||
|
|
||||||
m_scrolledWindow = new wxScrolledWindow(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHSCROLL | wxVSCROLL);
|
m_scrolledWindow = new wxScrolledWindow(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHSCROLL | wxVSCROLL);
|
||||||
m_scrolledWindow->SetScrollRate(5, 5);
|
m_scrolledWindow->SetScrollRate(5, FromDIP(20));
|
||||||
m_scrolledWindow->SetBackgroundColour(*wxWHITE);
|
m_scrolledWindow->SetBackgroundColour(*wxWHITE);
|
||||||
|
|
||||||
wxBoxSizer* padding_sizer = new wxBoxSizer(wxHORIZONTAL);
|
wxBoxSizer* padding_sizer = new wxBoxSizer(wxHORIZONTAL);
|
||||||
|
|||||||
@@ -834,7 +834,7 @@ void CaliPageSendingPanel::create(wxWindow* parent)
|
|||||||
|
|
||||||
m_sw_print_failed_info = new wxScrolledWindow(parent, wxID_ANY, wxDefaultPosition, wxSize(FromDIP(380), FromDIP(125)), wxVSCROLL);
|
m_sw_print_failed_info = new wxScrolledWindow(parent, wxID_ANY, wxDefaultPosition, wxSize(FromDIP(380), FromDIP(125)), wxVSCROLL);
|
||||||
m_sw_print_failed_info->SetBackgroundColour(*wxWHITE);
|
m_sw_print_failed_info->SetBackgroundColour(*wxWHITE);
|
||||||
m_sw_print_failed_info->SetScrollRate(0, 5);
|
m_sw_print_failed_info->SetScrollRate(0, FromDIP(20));
|
||||||
m_sw_print_failed_info->SetMinSize(wxSize(FromDIP(380), FromDIP(125)));
|
m_sw_print_failed_info->SetMinSize(wxSize(FromDIP(380), FromDIP(125)));
|
||||||
m_sw_print_failed_info->SetMaxSize(wxSize(FromDIP(380), FromDIP(125)));
|
m_sw_print_failed_info->SetMaxSize(wxSize(FromDIP(380), FromDIP(125)));
|
||||||
|
|
||||||
|
|||||||
@@ -2710,7 +2710,7 @@ ConfigWizard::ConfigWizard(wxWindow *parent)
|
|||||||
SetSizerAndFit(vsizer);
|
SetSizerAndFit(vsizer);
|
||||||
|
|
||||||
// We can now enable scrolling on hscroll
|
// We can now enable scrolling on hscroll
|
||||||
p->hscroll->SetScrollRate(30, 30);
|
p->hscroll->SetScrollRate(30, FromDIP(20));
|
||||||
|
|
||||||
on_window_geometry(this, [this]() {
|
on_window_geometry(this, [this]() {
|
||||||
p->init_dialog_size();
|
p->init_dialog_size();
|
||||||
|
|||||||
@@ -699,7 +699,7 @@ CreateFilamentPresetDialog::CreateFilamentPresetDialog(wxWindow *parent)
|
|||||||
m_scrolled_preset_panel = new wxScrolledWindow(this, wxID_ANY);
|
m_scrolled_preset_panel = new wxScrolledWindow(this, wxID_ANY);
|
||||||
m_scrolled_preset_panel->SetMaxSize(wxSize(-1, FromDIP(350)));
|
m_scrolled_preset_panel->SetMaxSize(wxSize(-1, FromDIP(350)));
|
||||||
m_scrolled_preset_panel->SetBackgroundColour(*wxWHITE);
|
m_scrolled_preset_panel->SetBackgroundColour(*wxWHITE);
|
||||||
m_scrolled_preset_panel->SetScrollRate(5, 5);
|
m_scrolled_preset_panel->SetScrollRate(5, FromDIP(20));
|
||||||
m_scrolled_sizer = new wxBoxSizer(wxVERTICAL);
|
m_scrolled_sizer = new wxBoxSizer(wxVERTICAL);
|
||||||
m_scrolled_sizer->Add(create_item(FilamentOptionType::PRESET_FOR_PRINTER), 0, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, FromDIP(5));
|
m_scrolled_sizer->Add(create_item(FilamentOptionType::PRESET_FOR_PRINTER), 0, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, FromDIP(5));
|
||||||
m_scrolled_sizer->Add(0, 0, 0, wxTOP, FromDIP(5));
|
m_scrolled_sizer->Add(0, 0, 0, wxTOP, FromDIP(5));
|
||||||
@@ -1593,7 +1593,7 @@ CreatePrinterPresetDialog::CreatePrinterPresetDialog(wxWindow *parent)
|
|||||||
|
|
||||||
m_page1 = new wxScrolledWindow(this, wxID_ANY, wxDefaultPosition, wxDefaultSize);
|
m_page1 = new wxScrolledWindow(this, wxID_ANY, wxDefaultPosition, wxDefaultSize);
|
||||||
m_page1->SetBackgroundColour(*wxWHITE);
|
m_page1->SetBackgroundColour(*wxWHITE);
|
||||||
m_page1->SetScrollRate(5, 5);
|
m_page1->SetScrollRate(5, FromDIP(20));
|
||||||
m_page2 = new wxPanel(this, wxID_ANY, wxDefaultPosition, wxDefaultSize); m_page2->SetBackgroundColour(*wxWHITE);
|
m_page2 = new wxPanel(this, wxID_ANY, wxDefaultPosition, wxDefaultSize); m_page2->SetBackgroundColour(*wxWHITE);
|
||||||
|
|
||||||
create_printer_page1(m_page1);
|
create_printer_page1(m_page1);
|
||||||
@@ -2652,7 +2652,7 @@ wxBoxSizer *CreatePrinterPresetDialog::create_presets_template_item(wxWindow *pa
|
|||||||
wxBoxSizer *vertical_sizer = new wxBoxSizer(wxVERTICAL);
|
wxBoxSizer *vertical_sizer = new wxBoxSizer(wxVERTICAL);
|
||||||
|
|
||||||
m_scrolled_preset_window = new wxScrolledWindow(parent);
|
m_scrolled_preset_window = new wxScrolledWindow(parent);
|
||||||
m_scrolled_preset_window->SetScrollRate(5, 5);
|
m_scrolled_preset_window->SetScrollRate(5, FromDIP(20));
|
||||||
m_scrolled_preset_window->SetBackgroundColour(*wxWHITE);
|
m_scrolled_preset_window->SetBackgroundColour(*wxWHITE);
|
||||||
//m_scrolled_preset_window->SetMinSize(wxSize(FromDIP(1500), FromDIP(-1)));
|
//m_scrolled_preset_window->SetMinSize(wxSize(FromDIP(1500), FromDIP(-1)));
|
||||||
m_scrolled_preset_window->SetMaxSize(wxSize(FromDIP(1500), FromDIP(-1)));
|
m_scrolled_preset_window->SetMaxSize(wxSize(FromDIP(1500), FromDIP(-1)));
|
||||||
@@ -4297,7 +4297,7 @@ wxBoxSizer *ExportConfigsDialog::create_select_printer(wxWindow *parent)
|
|||||||
optionSizer->SetMinSize(OPTION_SIZE);
|
optionSizer->SetMinSize(OPTION_SIZE);
|
||||||
horizontal_sizer->Add(optionSizer, 0, wxEXPAND | wxALL, FromDIP(10));
|
horizontal_sizer->Add(optionSizer, 0, wxEXPAND | wxALL, FromDIP(10));
|
||||||
m_scrolled_preset_window = new wxScrolledWindow(parent);
|
m_scrolled_preset_window = new wxScrolledWindow(parent);
|
||||||
m_scrolled_preset_window->SetScrollRate(5, 5);
|
m_scrolled_preset_window->SetScrollRate(5, FromDIP(20));
|
||||||
m_scrolled_preset_window->SetBackgroundColour(*wxWHITE);
|
m_scrolled_preset_window->SetBackgroundColour(*wxWHITE);
|
||||||
m_scrolled_preset_window->SetMaxSize(wxSize(FromDIP(660), FromDIP(400)));
|
m_scrolled_preset_window->SetMaxSize(wxSize(FromDIP(660), FromDIP(400)));
|
||||||
m_scrolled_preset_window->SetSize(wxSize(FromDIP(660), FromDIP(400)));
|
m_scrolled_preset_window->SetSize(wxSize(FromDIP(660), FromDIP(400)));
|
||||||
@@ -4736,7 +4736,7 @@ wxBoxSizer *EditFilamentPresetDialog::create_preset_tree_sizer()
|
|||||||
{
|
{
|
||||||
wxBoxSizer *filament_preset_tree_sizer = new wxBoxSizer(wxHORIZONTAL);
|
wxBoxSizer *filament_preset_tree_sizer = new wxBoxSizer(wxHORIZONTAL);
|
||||||
m_preset_tree_window = new wxScrolledWindow(this);
|
m_preset_tree_window = new wxScrolledWindow(this);
|
||||||
m_preset_tree_window->SetScrollRate(5, 5);
|
m_preset_tree_window->SetScrollRate(5, FromDIP(20));
|
||||||
m_preset_tree_window->SetBackgroundColour(PRINTER_LIST_COLOUR);
|
m_preset_tree_window->SetBackgroundColour(PRINTER_LIST_COLOUR);
|
||||||
m_preset_tree_window->SetMinSize(wxSize(-1, FromDIP(400)));
|
m_preset_tree_window->SetMinSize(wxSize(-1, FromDIP(400)));
|
||||||
m_preset_tree_window->SetMaxSize(wxSize(-1, FromDIP(300)));
|
m_preset_tree_window->SetMaxSize(wxSize(-1, FromDIP(300)));
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ DeviceErrorDialog::DeviceErrorDialog(MachineObject* obj, wxWindow* parent, wxWin
|
|||||||
m_line_top->SetBackgroundColour(wxColour(166, 169, 170));
|
m_line_top->SetBackgroundColour(wxColour(166, 169, 170));
|
||||||
|
|
||||||
m_scroll_area = new wxScrolledWindow(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxVSCROLL);
|
m_scroll_area = new wxScrolledWindow(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxVSCROLL);
|
||||||
m_scroll_area->SetScrollRate(0, 5);
|
m_scroll_area->SetScrollRate(0, FromDIP(20));
|
||||||
m_scroll_area->SetBackgroundColour(*wxWHITE);
|
m_scroll_area->SetBackgroundColour(*wxWHITE);
|
||||||
m_scroll_area->SetMinSize(wxSize(FromDIP(320), FromDIP(250)));
|
m_scroll_area->SetMinSize(wxSize(FromDIP(320), FromDIP(250)));
|
||||||
|
|
||||||
|
|||||||
@@ -456,8 +456,9 @@ void GLModel::init_from(const indexed_triangle_set& its)
|
|||||||
data.reserve_vertices(3 * its.indices.size());
|
data.reserve_vertices(3 * its.indices.size());
|
||||||
data.reserve_indices(3 * its.indices.size());
|
data.reserve_indices(3 * its.indices.size());
|
||||||
|
|
||||||
// Read user preference: smooth normals enabled
|
// CLI thumbnail generation can initialize models without a wx application.
|
||||||
const bool smooth_normals_enabled = wxGetApp().app_config != nullptr && wxGetApp().app_config->get_bool(SETTING_OPENGL_PHONG_SMOOTH_NORMALS);
|
const bool smooth_normals_enabled = wxApp::GetInstance() != nullptr && wxGetApp().app_config != nullptr &&
|
||||||
|
wxGetApp().app_config->get_bool(SETTING_OPENGL_PHONG_SMOOTH_NORMALS);
|
||||||
|
|
||||||
if (smooth_normals_enabled) {
|
if (smooth_normals_enabled) {
|
||||||
// Use per-corner smooth normals (via IGL)
|
// Use per-corner smooth normals (via IGL)
|
||||||
|
|||||||
@@ -2764,12 +2764,12 @@ ObjectTablePanel::ObjectTablePanel( wxWindow* parent, wxWindowID id, const wxPoi
|
|||||||
//m_object_grid->AssignTable(m_object_grid_table);
|
//m_object_grid->AssignTable(m_object_grid_table);
|
||||||
|
|
||||||
m_side_window = new wxScrolledWindow(this, wxID_ANY, wxDefaultPosition, wxSize(FromDIP(440),FromDIP(480)), wxVSCROLL);
|
m_side_window = new wxScrolledWindow(this, wxID_ANY, wxDefaultPosition, wxSize(FromDIP(440),FromDIP(480)), wxVSCROLL);
|
||||||
m_side_window->SetScrollRate( 0, 5 );
|
m_side_window->SetScrollRate(0, FromDIP(20));
|
||||||
m_page_sizer = new wxBoxSizer(wxVERTICAL);
|
m_page_sizer = new wxBoxSizer(wxVERTICAL);
|
||||||
//m_page_top_sizer = new wxBoxSizer(wxHORIZONTAL);
|
//m_page_top_sizer = new wxBoxSizer(wxHORIZONTAL);
|
||||||
m_side_window->SetBackgroundColour(wxColour(0xff, 0xff, 0xff));
|
m_side_window->SetBackgroundColour(wxColour(0xff, 0xff, 0xff));
|
||||||
m_side_window->SetSizer(m_page_sizer);
|
m_side_window->SetSizer(m_page_sizer);
|
||||||
m_side_window->SetScrollbars(1, 20, 1, 2);
|
m_side_window->SetScrollbars(1, FromDIP(20), 1, 2);
|
||||||
//m_side_window->ShowScrollbars(wxSHOW_SB_NEVER, wxSHOW_SB_NEVER);
|
//m_side_window->ShowScrollbars(wxSHOW_SB_NEVER, wxSHOW_SB_NEVER);
|
||||||
|
|
||||||
//m_side_window->EnableScrolling(false, true);
|
//m_side_window->EnableScrolling(false, true);
|
||||||
|
|||||||
@@ -247,7 +247,9 @@ int get_dpi_for_window(const wxWindow *window)
|
|||||||
|
|
||||||
const HDC hdc = GetDC(hwnd);
|
const HDC hdc = GetDC(hwnd);
|
||||||
if (hdc == NULL) { return DPI_DEFAULT; }
|
if (hdc == NULL) { return DPI_DEFAULT; }
|
||||||
return GetDeviceCaps(hdc, LOGPIXELSX);
|
const int dpi = GetDeviceCaps(hdc, LOGPIXELSX);
|
||||||
|
ReleaseDC(hwnd, hdc); // GetDC's handle must be released, unlike GetWindowDC's
|
||||||
|
return dpi;
|
||||||
}
|
}
|
||||||
#elif defined __linux__
|
#elif defined __linux__
|
||||||
// TODO
|
// TODO
|
||||||
|
|||||||
@@ -171,7 +171,7 @@ HMSPanel::HMSPanel(wxWindow *parent, wxWindowID id, const wxPoint &pos, const wx
|
|||||||
|
|
||||||
m_scrolledWindow = new wxScrolledWindow(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxVSCROLL);
|
m_scrolledWindow = new wxScrolledWindow(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxVSCROLL);
|
||||||
m_scrolledWindow->SetBackgroundColour(*wxWHITE);
|
m_scrolledWindow->SetBackgroundColour(*wxWHITE);
|
||||||
m_scrolledWindow->SetScrollRate(5, 5);
|
m_scrolledWindow->SetScrollRate(5, FromDIP(20));
|
||||||
|
|
||||||
m_top_sizer = new wxBoxSizer(wxVERTICAL);
|
m_top_sizer = new wxBoxSizer(wxVERTICAL);
|
||||||
|
|
||||||
|
|||||||
@@ -211,7 +211,7 @@ wxPanel* KBShortcutsDialog::create_page(wxWindow* parent, const Page& page)
|
|||||||
wxGetApp().UpdateDarkUI(scrollable_panel);
|
wxGetApp().UpdateDarkUI(scrollable_panel);
|
||||||
const wxColour page_colour = StateColor::darkModeColorFor(*wxWHITE);
|
const wxColour page_colour = StateColor::darkModeColorFor(*wxWHITE);
|
||||||
scrollable_panel->SetBackgroundColour(page_colour);
|
scrollable_panel->SetBackgroundColour(page_colour);
|
||||||
scrollable_panel->SetScrollRate(0, 20);
|
scrollable_panel->SetScrollRate(0, FromDIP(20));
|
||||||
const int page_width = FromDIP(PAGE_WIDTH);
|
const int page_width = FromDIP(PAGE_WIDTH);
|
||||||
scrollable_panel->SetInitialSize(wxSize(page_width, FromDIP(450)));
|
scrollable_panel->SetInitialSize(wxSize(page_width, FromDIP(450)));
|
||||||
|
|
||||||
|
|||||||
@@ -1125,7 +1125,7 @@ wxBoxSizer* MixedFilamentDialog::create_recommendation_grid()
|
|||||||
outer->Add(title_sizer, 0, wxEXPAND | wxBOTTOM, FromDIP(4));
|
outer->Add(title_sizer, 0, wxEXPAND | wxBOTTOM, FromDIP(4));
|
||||||
|
|
||||||
m_recommendation_scroll = new wxScrolledWindow(this, wxID_ANY, wxDefaultPosition, wxSize(-1, FromDIP(116)));
|
m_recommendation_scroll = new wxScrolledWindow(this, wxID_ANY, wxDefaultPosition, wxSize(-1, FromDIP(116)));
|
||||||
m_recommendation_scroll->SetScrollRate(0, 5);
|
m_recommendation_scroll->SetScrollRate(0, FromDIP(20));
|
||||||
m_recommendation_scroll->SetBackgroundColour(StateColor::darkModeColorFor(wxColour("#F8F8F8")));
|
m_recommendation_scroll->SetBackgroundColour(StateColor::darkModeColorFor(wxColour("#F8F8F8")));
|
||||||
|
|
||||||
m_recommendation_grid = new wxWrapSizer(wxHORIZONTAL, wxREMOVE_LEADING_SPACES);
|
m_recommendation_grid = new wxWrapSizer(wxHORIZONTAL, wxREMOVE_LEADING_SPACES);
|
||||||
|
|||||||
@@ -194,9 +194,10 @@ Button* MsgDialog::add_button(wxWindowID btn_id, bool set_focus /*= false*/, con
|
|||||||
bd->button = btn;
|
bd->button = btn;
|
||||||
//bd->type = type;
|
//bd->type = type;
|
||||||
|
|
||||||
mb->id = wxString::Format("%d", m_buttons.size());
|
// m_buttons.size() is a size_t, which does not match the %d conversion
|
||||||
|
mb->id = wxString(std::to_string(m_buttons.size()));
|
||||||
mb->buttondata = bd;
|
mb->buttondata = bd;
|
||||||
m_buttons[ wxString::Format("%d", m_buttons.size())] = mb;
|
m_buttons[ wxString(std::to_string(m_buttons.size()))] = mb;
|
||||||
return btn;
|
return btn;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -398,7 +399,7 @@ static void add_msg_content(wxWindow *parent,
|
|||||||
}
|
}
|
||||||
wxScrolledWindow *scrolledWindow = new wxScrolledWindow(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxVSCROLL);
|
wxScrolledWindow *scrolledWindow = new wxScrolledWindow(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxVSCROLL);
|
||||||
scrolledWindow->SetBackgroundColour(*wxWHITE);
|
scrolledWindow->SetBackgroundColour(*wxWHITE);
|
||||||
scrolledWindow->SetScrollRate(0, 20);
|
scrolledWindow->SetScrollRate(0, scrolledWindow->FromDIP(20));
|
||||||
scrolledWindow->EnableScrolling(false, true);
|
scrolledWindow->EnableScrolling(false, true);
|
||||||
wxBoxSizer *sizer_scrolled = new wxBoxSizer(wxHORIZONTAL);
|
wxBoxSizer *sizer_scrolled = new wxBoxSizer(wxHORIZONTAL);
|
||||||
Label *wrapped_text = new Label(scrolledWindow, font, msg, LB_AUTO_WRAP, wxSize(info_width, -1));
|
Label *wrapped_text = new Label(scrolledWindow, font, msg, LB_AUTO_WRAP, wxSize(info_width, -1));
|
||||||
|
|||||||
@@ -398,7 +398,7 @@ MultiMachineManagerPage::MultiMachineManagerPage(wxWindow* parent)
|
|||||||
|
|
||||||
m_machine_list = new wxScrolledWindow(m_main_panel, wxID_ANY, wxDefaultPosition, wxDefaultSize);
|
m_machine_list = new wxScrolledWindow(m_main_panel, wxID_ANY, wxDefaultPosition, wxDefaultSize);
|
||||||
m_machine_list->SetBackgroundColour(*wxWHITE);
|
m_machine_list->SetBackgroundColour(*wxWHITE);
|
||||||
m_machine_list->SetScrollRate(0, 5);
|
m_machine_list->SetScrollRate(0, FromDIP(DEVICE_ITEM_MAX_HEIGHT));
|
||||||
m_machine_list->SetMinSize(wxSize(FromDIP(DEVICE_ITEM_MAX_WIDTH), 10 * FromDIP(DEVICE_ITEM_MAX_HEIGHT)));
|
m_machine_list->SetMinSize(wxSize(FromDIP(DEVICE_ITEM_MAX_WIDTH), 10 * FromDIP(DEVICE_ITEM_MAX_HEIGHT)));
|
||||||
m_machine_list->SetMaxSize(wxSize(FromDIP(DEVICE_ITEM_MAX_WIDTH), 10 * FromDIP(DEVICE_ITEM_MAX_HEIGHT)));
|
m_machine_list->SetMaxSize(wxSize(FromDIP(DEVICE_ITEM_MAX_WIDTH), 10 * FromDIP(DEVICE_ITEM_MAX_HEIGHT)));
|
||||||
|
|
||||||
|
|||||||
@@ -323,7 +323,7 @@ MultiMachinePickPage::MultiMachinePickPage(Plater* plater /*= nullptr*/)
|
|||||||
scroll_macine_list->SetMinSize(wxSize(FromDIP(400), FromDIP(10 * 30)));
|
scroll_macine_list->SetMinSize(wxSize(FromDIP(400), FromDIP(10 * 30)));
|
||||||
scroll_macine_list->SetMaxSize(wxSize(FromDIP(400), FromDIP(10 * 30)));
|
scroll_macine_list->SetMaxSize(wxSize(FromDIP(400), FromDIP(10 * 30)));
|
||||||
scroll_macine_list->SetBackgroundColour(*wxWHITE);
|
scroll_macine_list->SetBackgroundColour(*wxWHITE);
|
||||||
scroll_macine_list->SetScrollRate(0, 5);
|
scroll_macine_list->SetScrollRate(0, FromDIP(DEVICE_ITEM_MAX_HEIGHT));
|
||||||
|
|
||||||
sizer_machine_list = new wxBoxSizer(wxVERTICAL);
|
sizer_machine_list = new wxBoxSizer(wxVERTICAL);
|
||||||
scroll_macine_list->SetSizer(sizer_machine_list);
|
scroll_macine_list->SetSizer(sizer_machine_list);
|
||||||
|
|||||||
@@ -675,7 +675,7 @@ LocalTaskManagerPage::LocalTaskManagerPage(wxWindow* parent)
|
|||||||
|
|
||||||
m_task_list = new wxScrolledWindow(m_main_panel, wxID_ANY, wxDefaultPosition, wxDefaultSize);
|
m_task_list = new wxScrolledWindow(m_main_panel, wxID_ANY, wxDefaultPosition, wxDefaultSize);
|
||||||
m_task_list->SetBackgroundColour(*wxWHITE);
|
m_task_list->SetBackgroundColour(*wxWHITE);
|
||||||
m_task_list->SetScrollRate(0, 5);
|
m_task_list->SetScrollRate(0, FromDIP(DEVICE_ITEM_MAX_HEIGHT));
|
||||||
m_task_list->SetMinSize(wxSize(FromDIP(CLOUD_TASK_ITEM_MAX_WIDTH), FromDIP(DEVICE_ITEM_MAX_HEIGHT)));
|
m_task_list->SetMinSize(wxSize(FromDIP(CLOUD_TASK_ITEM_MAX_WIDTH), FromDIP(DEVICE_ITEM_MAX_HEIGHT)));
|
||||||
m_task_list->SetMaxSize(wxSize(FromDIP(CLOUD_TASK_ITEM_MAX_WIDTH), 10 * FromDIP(DEVICE_ITEM_MAX_HEIGHT)));
|
m_task_list->SetMaxSize(wxSize(FromDIP(CLOUD_TASK_ITEM_MAX_WIDTH), 10 * FromDIP(DEVICE_ITEM_MAX_HEIGHT)));
|
||||||
|
|
||||||
@@ -1056,7 +1056,7 @@ CloudTaskManagerPage::CloudTaskManagerPage(wxWindow* parent)
|
|||||||
|
|
||||||
m_task_list = new wxScrolledWindow(m_main_panel, wxID_ANY, wxDefaultPosition, wxDefaultSize);
|
m_task_list = new wxScrolledWindow(m_main_panel, wxID_ANY, wxDefaultPosition, wxDefaultSize);
|
||||||
m_task_list->SetBackgroundColour(*wxWHITE);
|
m_task_list->SetBackgroundColour(*wxWHITE);
|
||||||
m_task_list->SetScrollRate(0, 5);
|
m_task_list->SetScrollRate(0, FromDIP(DEVICE_ITEM_MAX_HEIGHT));
|
||||||
m_task_list->SetMinSize(wxSize(FromDIP(CLOUD_TASK_ITEM_MAX_WIDTH), FromDIP(DEVICE_ITEM_MAX_HEIGHT)));
|
m_task_list->SetMinSize(wxSize(FromDIP(CLOUD_TASK_ITEM_MAX_WIDTH), FromDIP(DEVICE_ITEM_MAX_HEIGHT)));
|
||||||
m_task_list->SetMaxSize(wxSize(FromDIP(CLOUD_TASK_ITEM_MAX_WIDTH), 10 * FromDIP(DEVICE_ITEM_MAX_HEIGHT)));
|
m_task_list->SetMaxSize(wxSize(FromDIP(CLOUD_TASK_ITEM_MAX_WIDTH), 10 * FromDIP(DEVICE_ITEM_MAX_HEIGHT)));
|
||||||
|
|
||||||
|
|||||||
@@ -355,7 +355,7 @@ ObjColorPanel::ObjColorPanel(wxWindow *parent, Slic3r::ObjDialogInOut &in_out, c
|
|||||||
//new color table
|
//new color table
|
||||||
m_scrolledWindow = new wxScrolledWindow(m_page_simple, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxVSCROLL);
|
m_scrolledWindow = new wxScrolledWindow(m_page_simple, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxVSCROLL);
|
||||||
m_scrolledWindow->SetBackgroundColour(*wxWHITE);
|
m_scrolledWindow->SetBackgroundColour(*wxWHITE);
|
||||||
m_scrolledWindow->SetScrollRate(0, 20);
|
m_scrolledWindow->SetScrollRate(0, FromDIP(20));
|
||||||
m_scrolledWindow->EnableScrolling(false, true);
|
m_scrolledWindow->EnableScrolling(false, true);
|
||||||
m_scrolledWindow->ShowScrollbars(wxScrollbarVisibility::wxSHOW_SB_NEVER, wxScrollbarVisibility::wxSHOW_SB_DEFAULT);
|
m_scrolledWindow->ShowScrollbars(wxScrollbarVisibility::wxSHOW_SB_NEVER, wxScrollbarVisibility::wxSHOW_SB_DEFAULT);
|
||||||
draw_new_table();
|
draw_new_table();
|
||||||
|
|||||||
@@ -391,7 +391,7 @@ ParamsPanel::ParamsPanel( wxWindow* parent, wxWindowID id, const wxPoint& pos, c
|
|||||||
m_page_sizer = new wxBoxSizer(wxVERTICAL);
|
m_page_sizer = new wxBoxSizer(wxVERTICAL);
|
||||||
|
|
||||||
m_page_view->SetSizer(m_page_sizer);
|
m_page_view->SetSizer(m_page_sizer);
|
||||||
m_page_view->SetScrollbars(1, 20, 1, 2);
|
m_page_view->SetScrollbars(1, FromDIP(20), 1, 2);
|
||||||
//m_page_view->SetScrollRate( 5, 5 );
|
//m_page_view->SetScrollRate( 5, 5 );
|
||||||
|
|
||||||
if (m_mode_region)
|
if (m_mode_region)
|
||||||
|
|||||||
@@ -148,7 +148,7 @@ PartSkipDialog::PartSkipDialog(wxWindow *parent) : DPIDialog(parent, wxID_ANY, _
|
|||||||
m_line->SetBackgroundColour(wxColor(238, 238, 238));
|
m_line->SetBackgroundColour(wxColor(238, 238, 238));
|
||||||
|
|
||||||
m_list_view = new wxScrolledWindow(m_book_third_panel, wxID_ANY, wxDefaultPosition, wxSize(267, -1), wxHSCROLL | wxVSCROLL);
|
m_list_view = new wxScrolledWindow(m_book_third_panel, wxID_ANY, wxDefaultPosition, wxSize(267, -1), wxHSCROLL | wxVSCROLL);
|
||||||
m_list_view->SetScrollRate(5, 5);
|
m_list_view->SetScrollRate(5, FromDIP(30));
|
||||||
m_list_view->SetMinSize(wxSize(FromDIP(267), FromDIP(378)));
|
m_list_view->SetMinSize(wxSize(FromDIP(267), FromDIP(378)));
|
||||||
m_list_view->SetMaxSize(wxSize(FromDIP(267), FromDIP(378)));
|
m_list_view->SetMaxSize(wxSize(FromDIP(267), FromDIP(378)));
|
||||||
m_list_view->SetBackgroundColour(*wxWHITE);
|
m_list_view->SetBackgroundColour(*wxWHITE);
|
||||||
|
|||||||
@@ -3049,8 +3049,7 @@ Sidebar::Sidebar(Plater *parent)
|
|||||||
|
|
||||||
// add filament content
|
// add filament content
|
||||||
p->m_panel_filament_content = new wxScrolledWindow(p->m_filament_area_wrapper, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
|
p->m_panel_filament_content = new wxScrolledWindow(p->m_filament_area_wrapper, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
|
||||||
p->m_panel_filament_content->SetScrollbars(0, 100, 1, 2);
|
p->m_panel_filament_content->SetScrollRate(0, FromDIP(20));
|
||||||
p->m_panel_filament_content->SetScrollRate(0, 5);
|
|
||||||
//p->m_panel_filament_content->SetMaxSize(wxSize{-1, FromDIP(174)});
|
//p->m_panel_filament_content->SetMaxSize(wxSize{-1, FromDIP(174)});
|
||||||
p->m_panel_filament_content->SetBackgroundColour(wxColour(255, 255, 255));
|
p->m_panel_filament_content->SetBackgroundColour(wxColour(255, 255, 255));
|
||||||
|
|
||||||
@@ -3142,8 +3141,7 @@ Sidebar::Sidebar(Plater *parent)
|
|||||||
// 3) Mixed filament rows, in their own scroll area so a long mixed list does not
|
// 3) Mixed filament rows, in their own scroll area so a long mixed list does not
|
||||||
// push the physical filament list off screen.
|
// push the physical filament list off screen.
|
||||||
p->m_mixed_scroll_area = new wxScrolledWindow(p->m_filament_area_wrapper, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL);
|
p->m_mixed_scroll_area = new wxScrolledWindow(p->m_filament_area_wrapper, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL);
|
||||||
p->m_mixed_scroll_area->SetScrollbars(0, 100, 1, 2);
|
p->m_mixed_scroll_area->SetScrollRate(0, FromDIP(20));
|
||||||
p->m_mixed_scroll_area->SetScrollRate(0, 5);
|
|
||||||
p->m_mixed_scroll_area->SetBackgroundColour(StateColor::darkModeColorFor(*wxWHITE));
|
p->m_mixed_scroll_area->SetBackgroundColour(StateColor::darkModeColorFor(*wxWHITE));
|
||||||
{
|
{
|
||||||
auto* mix_scroll_sizer = new wxBoxSizer(wxVERTICAL);
|
auto* mix_scroll_sizer = new wxBoxSizer(wxVERTICAL);
|
||||||
@@ -12802,6 +12800,8 @@ void Plater::priv::on_process_completed(SlicingProcessCompletedEvent &evt)
|
|||||||
notification_manager->set_slicing_progress_export_possible();
|
notification_manager->set_slicing_progress_export_possible();
|
||||||
|
|
||||||
// Reset the "export G-code path" name, so that the automatic background processing will be enabled again.
|
// Reset the "export G-code path" name, so that the automatic background processing will be enabled again.
|
||||||
|
const std::string lifecycle_job_name = this->background_process.fff_print() ?
|
||||||
|
this->background_process.fff_print()->output_filename() : std::string();
|
||||||
this->background_process.reset_export();
|
this->background_process.reset_export();
|
||||||
// This bool stops showing export finished notification even when process_completed_with_error is false
|
// This bool stops showing export finished notification even when process_completed_with_error is false
|
||||||
bool has_error = false;
|
bool has_error = false;
|
||||||
@@ -12848,18 +12848,8 @@ void Plater::priv::on_process_completed(SlicingProcessCompletedEvent &evt)
|
|||||||
|
|
||||||
{
|
{
|
||||||
Slic3r::LifecycleEventContext ctx;
|
Slic3r::LifecycleEventContext ctx;
|
||||||
if (const PrintBase* print = this->background_process.current_print()) {
|
ctx.name = lifecycle_job_name;
|
||||||
const Model& model = print->model();
|
ctx.code = evt.cancelled() ? Slic3r::LifecycleEvtCode::Warn : (has_error ? Slic3r::LifecycleEvtCode::Error : Slic3r::LifecycleEvtCode::Ok);
|
||||||
ctx.id = std::to_string(model.id().id);
|
|
||||||
if (model.model_info)
|
|
||||||
ctx.name = model.model_info->model_name;
|
|
||||||
} else {
|
|
||||||
// Realistically Printbase* print will never be null because select_technology already asserts an active print
|
|
||||||
// and the worker thread asserts it before processing.
|
|
||||||
BOOST_LOG_TRIVIAL(warning) << __FUNCTION__ << ": slicing completed without an active print; lifecycle event has no model ID";
|
|
||||||
}
|
|
||||||
ctx.code = evt.cancelled() ? Slic3r::LifecycleEvtCode::Warn :
|
|
||||||
(has_error ? Slic3r::LifecycleEvtCode::Error : Slic3r::LifecycleEvtCode::Ok);
|
|
||||||
ctx.msg = evt.cancelled() ? "cancelled" : (has_error ? lifecycle_error_msg : std::string());
|
ctx.msg = evt.cancelled() ? "cancelled" : (has_error ? lifecycle_error_msg : std::string());
|
||||||
Slic3r::fire_lifecycle_event(Slic3r::LifecycleEvent::SlicingJobComplete, ctx);
|
Slic3r::fire_lifecycle_event(Slic3r::LifecycleEvent::SlicingJobComplete, ctx);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1475,7 +1475,7 @@ void PreferencesDialog::create()
|
|||||||
app_config = get_app_config();
|
app_config = get_app_config();
|
||||||
|
|
||||||
m_parent = new MyscrolledWindow(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxVSCROLL);
|
m_parent = new MyscrolledWindow(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxVSCROLL);
|
||||||
m_parent->SetScrollRate(5, 5);
|
m_parent->SetScrollRate(0, FromDIP(20));
|
||||||
m_parent->SetBackgroundColour(*wxWHITE);
|
m_parent->SetBackgroundColour(*wxWHITE);
|
||||||
|
|
||||||
m_sizer_body = new wxBoxSizer(wxVERTICAL);
|
m_sizer_body = new wxBoxSizer(wxVERTICAL);
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ PrintOptionsDialog::PrintOptionsDialog(wxWindow* parent)
|
|||||||
|
|
||||||
|
|
||||||
m_scrollwindow = new wxScrolledWindow(this, wxID_ANY);
|
m_scrollwindow = new wxScrolledWindow(this, wxID_ANY);
|
||||||
m_scrollwindow->SetScrollRate(0, FromDIP(10));
|
m_scrollwindow->SetScrollRate(0, FromDIP(20));
|
||||||
m_scrollwindow->SetBackgroundColour(*wxWHITE);
|
m_scrollwindow->SetBackgroundColour(*wxWHITE);
|
||||||
m_scrollwindow->SetMinSize(wxSize(FromDIP(480), wxDefaultCoord));
|
m_scrollwindow->SetMinSize(wxSize(FromDIP(480), wxDefaultCoord));
|
||||||
m_scrollwindow->SetMaxSize(wxSize(FromDIP(480), wxDefaultCoord));
|
m_scrollwindow->SetMaxSize(wxSize(FromDIP(480), wxDefaultCoord));
|
||||||
|
|||||||
@@ -1225,7 +1225,7 @@ size_t PublishSettingsDialog::category_index_for(
|
|||||||
}
|
}
|
||||||
|
|
||||||
category.scroll = new wxScrolledWindow(category.page, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxVSCROLL);
|
category.scroll = new wxScrolledWindow(category.page, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxVSCROLL);
|
||||||
category.scroll->SetScrollRate(0, 10);
|
category.scroll->SetScrollRate(0, FromDIP(20));
|
||||||
category.scroll->SetBackgroundColour(GetBackgroundColour());
|
category.scroll->SetBackgroundColour(GetBackgroundColour());
|
||||||
category.list_sizer = new wxBoxSizer(wxVERTICAL);
|
category.list_sizer = new wxBoxSizer(wxVERTICAL);
|
||||||
category.scroll->SetSizer(category.list_sizer);
|
category.scroll->SetSizer(category.list_sizer);
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ ReleaseNoteDialog::ReleaseNoteDialog(Plater *plater /*= nullptr*/)
|
|||||||
m_sizer_right->Add(0, 0, 1, wxTOP, FromDIP(15));
|
m_sizer_right->Add(0, 0, 1, wxTOP, FromDIP(15));
|
||||||
|
|
||||||
m_vebview_release_note = new wxScrolledWindow(this, wxID_ANY, wxDefaultPosition, wxSize(FromDIP(560), FromDIP(430)), wxVSCROLL);
|
m_vebview_release_note = new wxScrolledWindow(this, wxID_ANY, wxDefaultPosition, wxSize(FromDIP(560), FromDIP(430)), wxVSCROLL);
|
||||||
m_vebview_release_note->SetScrollRate(5, 5);
|
m_vebview_release_note->SetScrollRate(5, FromDIP(20));
|
||||||
m_vebview_release_note->SetBackgroundColour(wxColour(0xF8, 0xF8, 0xF8));
|
m_vebview_release_note->SetBackgroundColour(wxColour(0xF8, 0xF8, 0xF8));
|
||||||
m_vebview_release_note->SetMaxSize(wxSize(FromDIP(560), FromDIP(430)));
|
m_vebview_release_note->SetMaxSize(wxSize(FromDIP(560), FromDIP(430)));
|
||||||
|
|
||||||
@@ -142,7 +142,7 @@ UpdatePluginDialog::UpdatePluginDialog(wxWindow* parent /*= nullptr*/)
|
|||||||
operation_tips->SetMaxSize(wxSize(FromDIP(260), -1));
|
operation_tips->SetMaxSize(wxSize(FromDIP(260), -1));
|
||||||
|
|
||||||
m_vebview_release_note = new wxScrolledWindow(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxVSCROLL);
|
m_vebview_release_note = new wxScrolledWindow(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxVSCROLL);
|
||||||
m_vebview_release_note->SetScrollRate(5, 5);
|
m_vebview_release_note->SetScrollRate(5, FromDIP(20));
|
||||||
m_vebview_release_note->SetBackgroundColour(wxColour(0xF8, 0xF8, 0xF8));
|
m_vebview_release_note->SetBackgroundColour(wxColour(0xF8, 0xF8, 0xF8));
|
||||||
m_vebview_release_note->SetMinSize(wxSize(FromDIP(260), FromDIP(150)));
|
m_vebview_release_note->SetMinSize(wxSize(FromDIP(260), FromDIP(150)));
|
||||||
m_vebview_release_note->SetMaxSize(wxSize(FromDIP(260), FromDIP(150)));
|
m_vebview_release_note->SetMaxSize(wxSize(FromDIP(260), FromDIP(150)));
|
||||||
@@ -277,7 +277,7 @@ UpdateVersionDialog::UpdateVersionDialog(wxWindow *parent)
|
|||||||
m_simplebook_release_note->SetBackgroundColour(wxColour(0xF8, 0xF8, 0xF8));
|
m_simplebook_release_note->SetBackgroundColour(wxColour(0xF8, 0xF8, 0xF8));
|
||||||
|
|
||||||
m_scrollwindows_release_note = new wxScrolledWindow(m_simplebook_release_note, wxID_ANY, wxDefaultPosition, wxSize(FromDIP(560), FromDIP(430)), wxVSCROLL);
|
m_scrollwindows_release_note = new wxScrolledWindow(m_simplebook_release_note, wxID_ANY, wxDefaultPosition, wxSize(FromDIP(560), FromDIP(430)), wxVSCROLL);
|
||||||
m_scrollwindows_release_note->SetScrollRate(5, 5);
|
m_scrollwindows_release_note->SetScrollRate(5, FromDIP(20));
|
||||||
m_scrollwindows_release_note->SetBackgroundColour(wxColour(0xF8, 0xF8, 0xF8));
|
m_scrollwindows_release_note->SetBackgroundColour(wxColour(0xF8, 0xF8, 0xF8));
|
||||||
|
|
||||||
//webview
|
//webview
|
||||||
@@ -538,7 +538,7 @@ SecondaryCheckDialog::SecondaryCheckDialog(wxWindow* parent, wxWindowID id, cons
|
|||||||
m_sizer_right->Add(0, 0, 1, wxTOP, FromDIP(15));
|
m_sizer_right->Add(0, 0, 1, wxTOP, FromDIP(15));
|
||||||
|
|
||||||
m_vebview_release_note = new wxScrolledWindow(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxVSCROLL);
|
m_vebview_release_note = new wxScrolledWindow(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxVSCROLL);
|
||||||
m_vebview_release_note->SetScrollRate(0, 5);
|
m_vebview_release_note->SetScrollRate(0, FromDIP(20));
|
||||||
m_vebview_release_note->SetBackgroundColour(*wxWHITE);
|
m_vebview_release_note->SetBackgroundColour(*wxWHITE);
|
||||||
m_vebview_release_note->SetMinSize(wxSize(FromDIP(400), FromDIP(380)));
|
m_vebview_release_note->SetMinSize(wxSize(FromDIP(400), FromDIP(380)));
|
||||||
m_sizer_right->Add(m_vebview_release_note, 0, wxEXPAND | wxRIGHT | wxLEFT, FromDIP(15));
|
m_sizer_right->Add(m_vebview_release_note, 0, wxEXPAND | wxRIGHT | wxLEFT, FromDIP(15));
|
||||||
@@ -823,7 +823,7 @@ PrintErrorDialog::PrintErrorDialog(wxWindow* parent, wxWindowID id, const wxStri
|
|||||||
m_sizer_right->Add(0, 0, 1, wxTOP, FromDIP(5));
|
m_sizer_right->Add(0, 0, 1, wxTOP, FromDIP(5));
|
||||||
|
|
||||||
m_vebview_release_note = new wxScrolledWindow(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxVSCROLL);
|
m_vebview_release_note = new wxScrolledWindow(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxVSCROLL);
|
||||||
m_vebview_release_note->SetScrollRate(0, 5);
|
m_vebview_release_note->SetScrollRate(0, FromDIP(20));
|
||||||
m_vebview_release_note->SetBackgroundColour(*wxWHITE);
|
m_vebview_release_note->SetBackgroundColour(*wxWHITE);
|
||||||
m_vebview_release_note->SetMinSize(wxSize(FromDIP(320), FromDIP(250)));
|
m_vebview_release_note->SetMinSize(wxSize(FromDIP(320), FromDIP(250)));
|
||||||
m_sizer_right->Add(m_vebview_release_note, 0, wxEXPAND | wxRIGHT | wxLEFT, FromDIP(15));
|
m_sizer_right->Add(m_vebview_release_note, 0, wxEXPAND | wxRIGHT | wxLEFT, FromDIP(15));
|
||||||
@@ -1122,7 +1122,7 @@ ConfirmBeforeSendDialog::ConfirmBeforeSendDialog(wxWindow* parent, wxWindowID id
|
|||||||
m_sizer_right->Add(0, 0, 1, wxTOP, FromDIP(15));
|
m_sizer_right->Add(0, 0, 1, wxTOP, FromDIP(15));
|
||||||
|
|
||||||
m_vebview_release_note = new wxScrolledWindow(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxVSCROLL);
|
m_vebview_release_note = new wxScrolledWindow(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxVSCROLL);
|
||||||
m_vebview_release_note->SetScrollRate(0, 5);
|
m_vebview_release_note->SetScrollRate(0, FromDIP(20));
|
||||||
m_vebview_release_note->SetBackgroundColour(*wxWHITE);
|
m_vebview_release_note->SetBackgroundColour(*wxWHITE);
|
||||||
m_vebview_release_note->SetMinSize(wxSize(FromDIP(400), FromDIP(380)));
|
m_vebview_release_note->SetMinSize(wxSize(FromDIP(400), FromDIP(380)));
|
||||||
m_sizer_right->Add(m_vebview_release_note, 0, wxEXPAND | wxRIGHT | wxLEFT, FromDIP(15));
|
m_sizer_right->Add(m_vebview_release_note, 0, wxEXPAND | wxRIGHT | wxLEFT, FromDIP(15));
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ SafetyOptionsDialog::SafetyOptionsDialog(wxWindow* parent)
|
|||||||
SetSize(FromDIP(480),FromDIP(320));
|
SetSize(FromDIP(480),FromDIP(320));
|
||||||
|
|
||||||
m_scrollwindow = new wxScrolledWindow(this, wxID_ANY);
|
m_scrollwindow = new wxScrolledWindow(this, wxID_ANY);
|
||||||
m_scrollwindow->SetScrollRate(0, FromDIP(10));
|
m_scrollwindow->SetScrollRate(0, FromDIP(20));
|
||||||
m_scrollwindow->SetBackgroundColour(*wxWHITE);
|
m_scrollwindow->SetBackgroundColour(*wxWHITE);
|
||||||
m_scrollwindow->SetMinSize(wxSize(FromDIP(480), wxDefaultCoord));
|
m_scrollwindow->SetMinSize(wxSize(FromDIP(480), wxDefaultCoord));
|
||||||
m_scrollwindow->SetMaxSize(wxSize(FromDIP(480), wxDefaultCoord));
|
m_scrollwindow->SetMaxSize(wxSize(FromDIP(480), wxDefaultCoord));
|
||||||
|
|||||||
@@ -148,7 +148,7 @@ SelectMachineDialog::SelectMachineDialog(Plater *plater)
|
|||||||
|
|
||||||
wxBoxSizer* m_scroll_sizer = new wxBoxSizer(wxVERTICAL);
|
wxBoxSizer* m_scroll_sizer = new wxBoxSizer(wxVERTICAL);
|
||||||
m_scroll_area = new wxScrolledWindow(this);
|
m_scroll_area = new wxScrolledWindow(this);
|
||||||
m_scroll_area->SetScrollRate(0, 20);
|
m_scroll_area->SetScrollRate(0, FromDIP(20));
|
||||||
m_scroll_area->SetBackgroundColour(m_colour_def_color);
|
m_scroll_area->SetBackgroundColour(m_colour_def_color);
|
||||||
m_scroll_area->SetMinSize(wxSize(FromDIP(700), FromDIP(600)));
|
m_scroll_area->SetMinSize(wxSize(FromDIP(700), FromDIP(600)));
|
||||||
m_scroll_area->SetMaxSize(wxSize(FromDIP(700), FromDIP(600)));
|
m_scroll_area->SetMaxSize(wxSize(FromDIP(700), FromDIP(600)));
|
||||||
@@ -707,7 +707,7 @@ SelectMachineDialog::SelectMachineDialog(Plater *plater)
|
|||||||
//show bind failed info
|
//show bind failed info
|
||||||
m_sw_print_failed_info = new wxScrolledWindow(this, wxID_ANY, wxDefaultPosition, wxSize(SELECT_MACHINE_DIALOG_SIMBOOK_SIZE2.x, FromDIP(125)), wxVSCROLL);
|
m_sw_print_failed_info = new wxScrolledWindow(this, wxID_ANY, wxDefaultPosition, wxSize(SELECT_MACHINE_DIALOG_SIMBOOK_SIZE2.x, FromDIP(125)), wxVSCROLL);
|
||||||
m_sw_print_failed_info->SetBackgroundColour(*wxWHITE);
|
m_sw_print_failed_info->SetBackgroundColour(*wxWHITE);
|
||||||
m_sw_print_failed_info->SetScrollRate(0, 5);
|
m_sw_print_failed_info->SetScrollRate(0, FromDIP(20));
|
||||||
m_sw_print_failed_info->SetMinSize(wxSize(SELECT_MACHINE_DIALOG_SIMBOOK_SIZE2.x, FromDIP(125)));
|
m_sw_print_failed_info->SetMinSize(wxSize(SELECT_MACHINE_DIALOG_SIMBOOK_SIZE2.x, FromDIP(125)));
|
||||||
m_sw_print_failed_info->SetMaxSize(wxSize(SELECT_MACHINE_DIALOG_SIMBOOK_SIZE2.x, FromDIP(125)));
|
m_sw_print_failed_info->SetMaxSize(wxSize(SELECT_MACHINE_DIALOG_SIMBOOK_SIZE2.x, FromDIP(125)));
|
||||||
|
|
||||||
|
|||||||
@@ -327,7 +327,7 @@ SelectMachinePopup::SelectMachinePopup(wxWindow *parent)
|
|||||||
m_scrolledWindow = new wxScrolledWindow(this, wxID_ANY, wxDefaultPosition, SELECT_MACHINE_LIST_SIZE, wxHSCROLL | wxVSCROLL);
|
m_scrolledWindow = new wxScrolledWindow(this, wxID_ANY, wxDefaultPosition, SELECT_MACHINE_LIST_SIZE, wxHSCROLL | wxVSCROLL);
|
||||||
m_scrolledWindow->SetBackgroundColour(*wxWHITE);
|
m_scrolledWindow->SetBackgroundColour(*wxWHITE);
|
||||||
m_scrolledWindow->SetMinSize(SELECT_MACHINE_LIST_SIZE);
|
m_scrolledWindow->SetMinSize(SELECT_MACHINE_LIST_SIZE);
|
||||||
m_scrolledWindow->SetScrollRate(0, 5);
|
m_scrolledWindow->SetScrollRate(0, SELECT_MACHINE_ITEM_SIZE.y);
|
||||||
auto m_sizxer_scrolledWindow = new wxBoxSizer(wxVERTICAL);
|
auto m_sizxer_scrolledWindow = new wxBoxSizer(wxVERTICAL);
|
||||||
m_scrolledWindow->SetSizer(m_sizxer_scrolledWindow);
|
m_scrolledWindow->SetSizer(m_sizxer_scrolledWindow);
|
||||||
m_scrolledWindow->Layout();
|
m_scrolledWindow->Layout();
|
||||||
|
|||||||
@@ -278,7 +278,7 @@ SendMultiMachinePage::SendMultiMachinePage(Plater* plater)
|
|||||||
|
|
||||||
m_main_scroll = new ScrolledWindow(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxVSCROLL);
|
m_main_scroll = new ScrolledWindow(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxVSCROLL);
|
||||||
m_main_scroll->SetBackgroundColour(*wxWHITE);
|
m_main_scroll->SetBackgroundColour(*wxWHITE);
|
||||||
m_main_scroll->SetScrollRate(5, 5);
|
m_main_scroll->SetScrollRate(5, FromDIP(20));
|
||||||
|
|
||||||
m_sizer_body = new wxBoxSizer(wxVERTICAL);
|
m_sizer_body = new wxBoxSizer(wxVERTICAL);
|
||||||
m_main_page = create_page();
|
m_main_page = create_page();
|
||||||
@@ -1353,7 +1353,7 @@ wxPanel* SendMultiMachinePage::create_page()
|
|||||||
|
|
||||||
scroll_macine_list = new wxScrolledWindow(main_page, wxID_ANY, wxDefaultPosition, wxSize(FromDIP(800), FromDIP(300)), wxHSCROLL | wxVSCROLL);
|
scroll_macine_list = new wxScrolledWindow(main_page, wxID_ANY, wxDefaultPosition, wxSize(FromDIP(800), FromDIP(300)), wxHSCROLL | wxVSCROLL);
|
||||||
scroll_macine_list->SetBackgroundColour(*wxWHITE);
|
scroll_macine_list->SetBackgroundColour(*wxWHITE);
|
||||||
scroll_macine_list->SetScrollRate(5, 5);
|
scroll_macine_list->SetScrollRate(5, FromDIP(SEND_ITEM_MAX_HEIGHT));
|
||||||
scroll_macine_list->SetMinSize(wxSize(FromDIP(DEVICE_ITEM_MAX_WIDTH), 10 * FromDIP(SEND_ITEM_MAX_HEIGHT)));
|
scroll_macine_list->SetMinSize(wxSize(FromDIP(DEVICE_ITEM_MAX_WIDTH), 10 * FromDIP(SEND_ITEM_MAX_HEIGHT)));
|
||||||
scroll_macine_list->SetMaxSize(wxSize(FromDIP(DEVICE_ITEM_MAX_WIDTH), 10 * FromDIP(SEND_ITEM_MAX_HEIGHT)));
|
scroll_macine_list->SetMaxSize(wxSize(FromDIP(DEVICE_ITEM_MAX_WIDTH), 10 * FromDIP(SEND_ITEM_MAX_HEIGHT)));
|
||||||
|
|
||||||
|
|||||||
@@ -384,7 +384,7 @@ SendToPrinterDialog::SendToPrinterDialog(Plater *plater)
|
|||||||
//show bind failed info
|
//show bind failed info
|
||||||
m_sw_print_failed_info = new wxScrolledWindow(this, wxID_ANY, wxDefaultPosition, wxSize(FromDIP(380), FromDIP(125)), wxVSCROLL);
|
m_sw_print_failed_info = new wxScrolledWindow(this, wxID_ANY, wxDefaultPosition, wxSize(FromDIP(380), FromDIP(125)), wxVSCROLL);
|
||||||
m_sw_print_failed_info->SetBackgroundColour(*wxWHITE);
|
m_sw_print_failed_info->SetBackgroundColour(*wxWHITE);
|
||||||
m_sw_print_failed_info->SetScrollRate(0, 5);
|
m_sw_print_failed_info->SetScrollRate(0, FromDIP(20));
|
||||||
m_sw_print_failed_info->SetMinSize(wxSize(FromDIP(380), FromDIP(125)));
|
m_sw_print_failed_info->SetMinSize(wxSize(FromDIP(380), FromDIP(125)));
|
||||||
m_sw_print_failed_info->SetMaxSize(wxSize(FromDIP(380), FromDIP(125)));
|
m_sw_print_failed_info->SetMaxSize(wxSize(FromDIP(380), FromDIP(125)));
|
||||||
|
|
||||||
|
|||||||
@@ -1302,7 +1302,7 @@ void PrintingTaskPanel::set_star_count(int star_count)
|
|||||||
StatusBasePanel::StatusBasePanel(wxWindow *parent, wxWindowID id, const wxPoint &pos, const wxSize &size, long style, const wxString &name)
|
StatusBasePanel::StatusBasePanel(wxWindow *parent, wxWindowID id, const wxPoint &pos, const wxSize &size, long style, const wxString &name)
|
||||||
: wxScrolledWindow(parent, id, pos, size, wxHSCROLL | wxVSCROLL)
|
: wxScrolledWindow(parent, id, pos, size, wxHSCROLL | wxVSCROLL)
|
||||||
{
|
{
|
||||||
this->SetScrollRate(25, 25);
|
SetScrollRate(25, FromDIP(20));
|
||||||
Slic3r::DeviceManager* dev = Slic3r::GUI::wxGetApp().getDeviceManager();
|
Slic3r::DeviceManager* dev = Slic3r::GUI::wxGetApp().getDeviceManager();
|
||||||
if (!dev) return;
|
if (!dev) return;
|
||||||
obj = dev->get_selected_machine();
|
obj = dev->get_selected_machine();
|
||||||
|
|||||||
@@ -700,7 +700,7 @@ SyncAmsInfoDialog::SyncAmsInfoDialog(wxWindow *parent, SyncInfo &info) :
|
|||||||
//wxBoxSizer *m_scroll_sizer = new wxBoxSizer(wxVERTICAL);
|
//wxBoxSizer *m_scroll_sizer = new wxBoxSizer(wxVERTICAL);
|
||||||
m_scrolledWindow = new wxScrolledWindow(m_show_page, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxVSCROLL);
|
m_scrolledWindow = new wxScrolledWindow(m_show_page, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxVSCROLL);
|
||||||
m_scrolledWindow->SetBackgroundColour(*wxWHITE);
|
m_scrolledWindow->SetBackgroundColour(*wxWHITE);
|
||||||
m_scrolledWindow->SetScrollRate(0, 20);
|
m_scrolledWindow->SetScrollRate(0, FromDIP(20));
|
||||||
m_scrolledWindow->SetMinSize(wxSize(-1, SyncAmsInfoDialogHeightMAX));
|
m_scrolledWindow->SetMinSize(wxSize(-1, SyncAmsInfoDialogHeightMAX));
|
||||||
m_scrolledWindow->SetMaxSize(wxSize(-1, SyncAmsInfoDialogHeightMAX));
|
m_scrolledWindow->SetMaxSize(wxSize(-1, SyncAmsInfoDialogHeightMAX));
|
||||||
m_scrolledWindow->EnableScrolling(false,true);
|
m_scrolledWindow->EnableScrolling(false,true);
|
||||||
|
|||||||
@@ -534,7 +534,7 @@ public:
|
|||||||
|
|
||||||
m_content = new wxScrolledWindow(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxVSCROLL);
|
m_content = new wxScrolledWindow(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxVSCROLL);
|
||||||
m_content->SetBackgroundColour(pop_bg);
|
m_content->SetBackgroundColour(pop_bg);
|
||||||
m_content->SetScrollRate(0, FromDIP(5));
|
m_content->SetScrollRate(0, FromDIP(20));
|
||||||
auto* outer = new wxBoxSizer(wxVERTICAL);
|
auto* outer = new wxBoxSizer(wxVERTICAL);
|
||||||
|
|
||||||
const int pop_w = std::max(FromDIP(213), popup_width);
|
const int pop_w = std::max(FromDIP(213), popup_width);
|
||||||
@@ -2274,7 +2274,7 @@ void TextureImportDialog::build_mapping_panel(wxWindow* parent, wxSizer* sizer)
|
|||||||
|
|
||||||
m_mapping_scroll = new wxScrolledWindow(parent, wxID_ANY, wxDefaultPosition,
|
m_mapping_scroll = new wxScrolledWindow(parent, wxID_ANY, wxDefaultPosition,
|
||||||
wxSize(-1, FromDIP(300)));
|
wxSize(-1, FromDIP(300)));
|
||||||
m_mapping_scroll->SetScrollRate(0, FromDIP(10));
|
m_mapping_scroll->SetScrollRate(0, FromDIP(20));
|
||||||
m_mapping_scroll->SetBackgroundColour(StateColor::darkModeColorFor(*wxWHITE));
|
m_mapping_scroll->SetBackgroundColour(StateColor::darkModeColorFor(*wxWHITE));
|
||||||
m_mapping_scroll->Bind(wxEVT_MOUSEWHEEL, &TextureImportDialog::dismiss_filament_popup_on_wheel, this);
|
m_mapping_scroll->Bind(wxEVT_MOUSEWHEEL, &TextureImportDialog::dismiss_filament_popup_on_wheel, this);
|
||||||
|
|
||||||
@@ -4335,7 +4335,7 @@ void TextureImportDialog::on_dpi_changed(const wxRect&)
|
|||||||
|
|
||||||
if (m_mapping_scroll) {
|
if (m_mapping_scroll) {
|
||||||
m_mapping_scroll->SetMinSize(wxSize(-1, FromDIP(300)));
|
m_mapping_scroll->SetMinSize(wxSize(-1, FromDIP(300)));
|
||||||
m_mapping_scroll->SetScrollRate(0, FromDIP(10));
|
m_mapping_scroll->SetScrollRate(0, FromDIP(20));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_btn_skip) {
|
if (m_btn_skip) {
|
||||||
|
|||||||
@@ -942,7 +942,7 @@ void UnsavedChangesDialog::build(Preset::Type type, PresetCollection *dependent_
|
|||||||
m_sizer_tab->Add(m_table_top, 1, 0, 0);
|
m_sizer_tab->Add(m_table_top, 1, 0, 0);
|
||||||
|
|
||||||
m_scrolledWindow = new wxScrolledWindow(m_panel_tab, wxID_ANY, wxDefaultPosition, UNSAVE_CHANGE_DIALOG_SCROLL_WINDOW_SIZE, wxNO_BORDER|wxVSCROLL);
|
m_scrolledWindow = new wxScrolledWindow(m_panel_tab, wxID_ANY, wxDefaultPosition, UNSAVE_CHANGE_DIALOG_SCROLL_WINDOW_SIZE, wxNO_BORDER|wxVSCROLL);
|
||||||
m_scrolledWindow->SetScrollRate(0, 5);
|
m_scrolledWindow->SetScrollRate(0, FromDIP(20));
|
||||||
m_scrolledWindow->SetBackgroundColour(GREY200);
|
m_scrolledWindow->SetBackgroundColour(GREY200);
|
||||||
m_sizer_bottom = new wxBoxSizer(wxVERTICAL);
|
m_sizer_bottom = new wxBoxSizer(wxVERTICAL);
|
||||||
m_sizer_bottom->Add(m_scrolledWindow, 1, wxEXPAND, 0);
|
m_sizer_bottom->Add(m_scrolledWindow, 1, wxEXPAND, 0);
|
||||||
|
|||||||
@@ -130,7 +130,7 @@ MsgUpdateConfig::MsgUpdateConfig(const std::vector<Update> &updates, bool force_
|
|||||||
m_sizer_right->Add(0, 0, 1, wxTOP, FromDIP(15));
|
m_sizer_right->Add(0, 0, 1, wxTOP, FromDIP(15));
|
||||||
|
|
||||||
auto m_scrollwindw_release_note = new wxScrolledWindow(this, wxID_ANY, wxDefaultPosition, wxSize(FromDIP(560), FromDIP(430)),wxVSCROLL);
|
auto m_scrollwindw_release_note = new wxScrolledWindow(this, wxID_ANY, wxDefaultPosition, wxSize(FromDIP(560), FromDIP(430)),wxVSCROLL);
|
||||||
m_scrollwindw_release_note->SetScrollRate(0, 5);
|
m_scrollwindw_release_note->SetScrollRate(0, FromDIP(20));
|
||||||
m_scrollwindw_release_note->SetBackgroundColour(wxColour(0xF8, 0xF8, 0xF8));
|
m_scrollwindw_release_note->SetBackgroundColour(wxColour(0xF8, 0xF8, 0xF8));
|
||||||
m_scrollwindw_release_note->SetMaxSize(wxSize(FromDIP(560), FromDIP(430)));
|
m_scrollwindw_release_note->SetMaxSize(wxSize(FromDIP(560), FromDIP(430)));
|
||||||
m_scrollwindw_release_note->SetWindowStyle(wxVSCROLL);
|
m_scrollwindw_release_note->SetWindowStyle(wxVSCROLL);
|
||||||
|
|||||||
@@ -1629,7 +1629,7 @@ UpgradePanel::UpgradePanel(wxWindow *parent, wxWindowID id, const wxPoint &pos,
|
|||||||
auto m_main_sizer = new wxBoxSizer(wxVERTICAL);
|
auto m_main_sizer = new wxBoxSizer(wxVERTICAL);
|
||||||
|
|
||||||
m_scrolledWindow = new wxScrolledWindow(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxVSCROLL);
|
m_scrolledWindow = new wxScrolledWindow(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxVSCROLL);
|
||||||
m_scrolledWindow->SetScrollRate(5, 25);
|
m_scrolledWindow->SetScrollRate(5, FromDIP(20));
|
||||||
|
|
||||||
m_machine_list_sizer = new wxBoxSizer(wxVERTICAL);
|
m_machine_list_sizer = new wxBoxSizer(wxVERTICAL);
|
||||||
|
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ CheckList::CheckList(
|
|||||||
|
|
||||||
s_sizer = new wxBoxSizer(wxVERTICAL);
|
s_sizer = new wxBoxSizer(wxVERTICAL);
|
||||||
m_scroll_area = new wxScrolledWindow(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, scroll_style);
|
m_scroll_area = new wxScrolledWindow(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, scroll_style);
|
||||||
m_scroll_area->SetScrollRate(0, 10);
|
m_scroll_area->SetScrollRate(0, FromDIP(20));
|
||||||
m_scroll_area->SetSizer(s_sizer);
|
m_scroll_area->SetSizer(s_sizer);
|
||||||
m_scroll_area->SetBackgroundColour(parent->GetBackgroundColour());
|
m_scroll_area->SetBackgroundColour(parent->GetBackgroundColour());
|
||||||
m_scroll_area->Bind(wxEVT_RIGHT_DOWN, &CheckList::ShowMenu, this);
|
m_scroll_area->Bind(wxEVT_RIGHT_DOWN, &CheckList::ShowMenu, this);
|
||||||
|
|||||||
@@ -199,7 +199,7 @@ bool ProgressDialog::Create(const wxString &title, const wxString &message, int
|
|||||||
m_sizer_main->Add(m_simplebook, 1, wxEXPAND | wxLEFT | wxRIGHT, FromDIP(28));
|
m_sizer_main->Add(m_simplebook, 1, wxEXPAND | wxLEFT | wxRIGHT, FromDIP(28));
|
||||||
} else {
|
} else {
|
||||||
m_msg_scrolledWindow = new wxScrolledWindow( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxVSCROLL );
|
m_msg_scrolledWindow = new wxScrolledWindow( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxVSCROLL );
|
||||||
m_msg_scrolledWindow->SetScrollRate(0,5);
|
m_msg_scrolledWindow->SetScrollRate(0, FromDIP(20));
|
||||||
wxBoxSizer* m_msg_sizer= new wxBoxSizer(wxVERTICAL);
|
wxBoxSizer* m_msg_sizer= new wxBoxSizer(wxVERTICAL);
|
||||||
|
|
||||||
m_msg = new wxStaticText(m_msg_scrolledWindow, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(PROGRESSDIALOG_SIMPLEBOOK_SIZE.x, -1), 0);
|
m_msg = new wxStaticText(m_msg_scrolledWindow, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(PROGRESSDIALOG_SIMPLEBOOK_SIZE.x, -1), 0);
|
||||||
|
|||||||
@@ -1222,7 +1222,7 @@ ImageTransientPopup::ImageTransientPopup( wxWindow *parent, bool scrolled, wxBit
|
|||||||
m_panel->SetSize(300, 300);
|
m_panel->SetSize(300, 300);
|
||||||
|
|
||||||
// And also actually enable them.
|
// And also actually enable them.
|
||||||
m_panel->SetScrollRate(10, 10);
|
m_panel->SetScrollRate(10, FromDIP(20));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
#include <boost/optional.hpp>
|
#include <boost/optional.hpp>
|
||||||
#include <boost/log/trivial.hpp>
|
#include <boost/log/trivial.hpp>
|
||||||
#include <boost/filesystem.hpp>
|
#include <boost/filesystem.hpp>
|
||||||
|
#include <nlohmann/json.hpp>
|
||||||
|
|
||||||
#include <wx/string.h>
|
#include <wx/string.h>
|
||||||
#include <wx/app.h>
|
#include <wx/app.h>
|
||||||
@@ -115,10 +116,67 @@ std::string PrintHost::get_print_host_webui(DynamicPrintConfig* config)
|
|||||||
return webui_url;
|
return webui_url;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
|
||||||
|
// Moonraker (Klipper's API server) reports a raised exception as { "error": { "code", "message", "traceback" } }
|
||||||
|
// under every host type that connects to it, often with the cause only in the traceback. Returns the reason to show,
|
||||||
|
// or empty for any other body.
|
||||||
|
std::string moonraker_error_reason(const std::string &body)
|
||||||
|
{
|
||||||
|
const auto root = nlohmann::json::parse(body, nullptr, false);
|
||||||
|
const auto err = root.find("error");
|
||||||
|
if (err == root.end())
|
||||||
|
return {};
|
||||||
|
const auto message = err->find("message");
|
||||||
|
const auto traceback = err->find("traceback");
|
||||||
|
if (message == err->end() || traceback == err->end() || !message->is_string() || !traceback->is_string())
|
||||||
|
return {};
|
||||||
|
|
||||||
|
const auto &msg = message->get_ref<const std::string &>();
|
||||||
|
const auto &tb = traceback->get_ref<const std::string &>();
|
||||||
|
if (msg.empty())
|
||||||
|
return {};
|
||||||
|
const auto end = tb.find_last_not_of(" \t\r\n");
|
||||||
|
if (end == std::string::npos)
|
||||||
|
return msg;
|
||||||
|
|
||||||
|
// Chained exceptions each start a new traceback; the one that failed the request is the last.
|
||||||
|
const auto header = tb.rfind("Traceback (most recent call last):", end);
|
||||||
|
|
||||||
|
// Tornado renders a raised HTTPError as "HTTP <code>: <reason>[ (<detail>)]", and the detail may span lines.
|
||||||
|
const auto code = err->find("code");
|
||||||
|
if (code != err->end() && code->is_number_integer()) {
|
||||||
|
const std::string marker = "HTTP " + std::to_string(code->get<int>()) + ": ";
|
||||||
|
const auto pos = tb.rfind(marker, end);
|
||||||
|
if (pos != std::string::npos && (header == std::string::npos || pos > header) && pos + marker.size() <= end) {
|
||||||
|
const std::string reason = tb.substr(pos + marker.size(), end + 1 - pos - marker.size());
|
||||||
|
// An HTTPError whose detail equals its reason, like HTTPError(401, "Unauthorized"), renders the phrase twice.
|
||||||
|
return reason == msg + " (" + msg + ")" ? msg : reason;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Any other exception's type and message are everything from the first unindented line after its frames.
|
||||||
|
auto begin = (header == std::string::npos) ? std::string::npos : tb.find('\n', header);
|
||||||
|
while (begin != std::string::npos && begin < end) {
|
||||||
|
++begin;
|
||||||
|
if (tb[begin] != ' ' && tb[begin] != '\r' && tb[begin] != '\n')
|
||||||
|
break;
|
||||||
|
begin = tb.find('\n', begin);
|
||||||
|
}
|
||||||
|
if (begin == std::string::npos || begin > end) {
|
||||||
|
const auto nl = tb.rfind('\n', end);
|
||||||
|
begin = (nl == std::string::npos) ? 0 : nl + 1;
|
||||||
|
}
|
||||||
|
return msg + " (" + tb.substr(begin, end + 1 - begin) + ")";
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace
|
||||||
|
|
||||||
wxString PrintHost::format_error(const std::string &body, const std::string &error, unsigned status) const
|
wxString PrintHost::format_error(const std::string &body, const std::string &error, unsigned status) const
|
||||||
{
|
{
|
||||||
if (status != 0) {
|
if (status != 0) {
|
||||||
auto wxbody = wxString::FromUTF8(body.data());
|
const std::string reason = moonraker_error_reason(body);
|
||||||
|
auto wxbody = wxString::FromUTF8(reason.empty() ? body : reason);
|
||||||
return wxString::Format("HTTP %u: %s", status, wxbody);
|
return wxString::Format("HTTP %u: %s", status, wxbody);
|
||||||
} else {
|
} else {
|
||||||
if (error.find("curl:Timeout was reached") != std::string::npos) {
|
if (error.find("curl:Timeout was reached") != std::string::npos) {
|
||||||
|
|||||||
@@ -15,9 +15,6 @@
|
|||||||
#include "libslic3r/Layer.hpp"
|
#include "libslic3r/Layer.hpp"
|
||||||
#include "libslic3r/Model.hpp"
|
#include "libslic3r/Model.hpp"
|
||||||
#include "libslic3r/GCodeReader.hpp"
|
#include "libslic3r/GCodeReader.hpp"
|
||||||
#include "libslic3r/GCode/GCodeProcessor.hpp"
|
|
||||||
#include "libslic3r/Exception.hpp"
|
|
||||||
#include "libslic3r/LifecycleEvents.hpp"
|
|
||||||
|
|
||||||
#include "test_helpers.hpp"
|
#include "test_helpers.hpp"
|
||||||
#include "test_utils.hpp"
|
#include "test_utils.hpp"
|
||||||
@@ -25,10 +22,7 @@
|
|||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <iterator>
|
#include <iterator>
|
||||||
#include <memory>
|
|
||||||
#include <string_view>
|
#include <string_view>
|
||||||
#include <utility>
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
using namespace Slic3r;
|
using namespace Slic3r;
|
||||||
using namespace Slic3r::Test;
|
using namespace Slic3r::Test;
|
||||||
@@ -230,88 +224,8 @@ std::string resolved_output_name(Model& model, const std::string& format, const
|
|||||||
return print.output_filename(filename_base);
|
return print.output_filename(filename_base);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct ScopedLifecycleHook
|
|
||||||
{
|
|
||||||
explicit ScopedLifecycleHook(LifecycleHookFn hook) { set_lifecycle_hook_fn(std::move(hook)); }
|
|
||||||
~ScopedLifecycleHook() { set_lifecycle_hook_fn(nullptr); }
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
TEST_CASE("Slicing lifecycle events identify the model", "[Print][LifecycleEvents]")
|
|
||||||
{
|
|
||||||
struct ObservedEvent {
|
|
||||||
LifecycleEvent event;
|
|
||||||
std::string id;
|
|
||||||
std::string name;
|
|
||||||
};
|
|
||||||
std::vector<ObservedEvent> events;
|
|
||||||
ScopedLifecycleHook hook([&](LifecycleEvent event, const LifecycleEventContext& ctx) {
|
|
||||||
events.push_back({ event, ctx.id, ctx.name });
|
|
||||||
});
|
|
||||||
|
|
||||||
Print print;
|
|
||||||
Model model;
|
|
||||||
ModelInfo info;
|
|
||||||
info.model_name = "Lifecycle test model";
|
|
||||||
model.model_info = std::make_shared<ModelInfo>(std::move(info));
|
|
||||||
init_print({cube(20)}, print, model);
|
|
||||||
|
|
||||||
print.process();
|
|
||||||
ScopedTemporaryFile temp(".gcode");
|
|
||||||
print.export_gcode(temp.string(), nullptr, nullptr);
|
|
||||||
GCodeProcessorResult result;
|
|
||||||
print.export_gcode_from_previous_file(temp.string(), &result);
|
|
||||||
|
|
||||||
const std::string expected_id = std::to_string(print.model().id().id);
|
|
||||||
const std::vector<LifecycleEvent> expected_events = {
|
|
||||||
LifecycleEvent::SliceStarted,
|
|
||||||
LifecycleEvent::SliceGeometryFinished,
|
|
||||||
LifecycleEvent::GCodeExportStarted,
|
|
||||||
LifecycleEvent::GCodeExportFinished,
|
|
||||||
LifecycleEvent::GCodeExportStarted,
|
|
||||||
LifecycleEvent::GCodeExportFinished,
|
|
||||||
};
|
|
||||||
REQUIRE(events.size() == expected_events.size());
|
|
||||||
for (size_t i = 0; i < expected_events.size(); ++i) {
|
|
||||||
CHECK(events[i].event == expected_events[i]);
|
|
||||||
CHECK(events[i].id == expected_id);
|
|
||||||
CHECK(events[i].name == "Lifecycle test model");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_CASE("Slicing lifecycle event name is empty without model metadata", "[Print][LifecycleEvents]")
|
|
||||||
{
|
|
||||||
std::string event_id;
|
|
||||||
std::string event_name = "unset";
|
|
||||||
ScopedLifecycleHook hook([&](LifecycleEvent event, const LifecycleEventContext& ctx) {
|
|
||||||
if (event == LifecycleEvent::SliceStarted) {
|
|
||||||
event_id = ctx.id;
|
|
||||||
event_name = ctx.name;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
Print print;
|
|
||||||
Model model;
|
|
||||||
init_print({cube(20)}, print, model);
|
|
||||||
print.process();
|
|
||||||
|
|
||||||
CHECK(event_id == std::to_string(print.model().id().id));
|
|
||||||
CHECK(event_name.empty());
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_CASE("Output filenames with numeric statistics fail before slicing finishes", "[Print][Regression]")
|
|
||||||
{
|
|
||||||
DynamicPrintConfig config = DynamicPrintConfig::full_print_config();
|
|
||||||
config.set_key_value("filename_format", new ConfigOptionString("{int(total_weight*10) / 10.0}"));
|
|
||||||
|
|
||||||
Print print;
|
|
||||||
Model model;
|
|
||||||
init_print({cube(20)}, print, model, config);
|
|
||||||
|
|
||||||
CHECK_THROWS_AS(print.output_filename(), PlaceholderParserError);
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_CASE("Print: {first_object_name} names the first printable object on the plate", "[Print]")
|
TEST_CASE("Print: {first_object_name} names the first printable object on the plate", "[Print]")
|
||||||
{
|
{
|
||||||
Model model;
|
Model model;
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ add_executable(${_TEST_NAME}_tests
|
|||||||
test_plugin_install.cpp
|
test_plugin_install.cpp
|
||||||
test_plugin_lifecycle.cpp
|
test_plugin_lifecycle.cpp
|
||||||
test_plugin_printer_agent.cpp
|
test_plugin_printer_agent.cpp
|
||||||
|
test_printhost.cpp
|
||||||
test_slicing_pipeline_bindings.cpp
|
test_slicing_pipeline_bindings.cpp
|
||||||
test_slicing_pipeline_config.cpp
|
test_slicing_pipeline_config.cpp
|
||||||
test_plugin_sort.cpp
|
test_plugin_sort.cpp
|
||||||
|
|||||||
@@ -0,0 +1,213 @@
|
|||||||
|
#include <catch2/catch_all.hpp>
|
||||||
|
|
||||||
|
#include <nlohmann/json.hpp>
|
||||||
|
|
||||||
|
#include "slic3r/Utils/PrintHost.hpp"
|
||||||
|
|
||||||
|
using namespace Slic3r;
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
|
||||||
|
class TestPrintHost : public PrintHost
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
using PrintHost::format_error;
|
||||||
|
|
||||||
|
const char* get_name() const override { return "Test"; }
|
||||||
|
bool test(wxString&) const override { return true; }
|
||||||
|
wxString get_test_ok_msg() const override { return {}; }
|
||||||
|
wxString get_test_failed_msg(wxString&) const override { return {}; }
|
||||||
|
bool upload(PrintHostUpload, ProgressFn, ErrorFn, InfoFn) const override { return true; }
|
||||||
|
bool has_auto_discovery() const override { return false; }
|
||||||
|
bool can_test() const override { return false; }
|
||||||
|
PrintHostPostUploadActions get_post_upload_actions() const override { return {}; }
|
||||||
|
std::string get_host() const override { return {}; }
|
||||||
|
};
|
||||||
|
|
||||||
|
std::string format_error(const std::string& body, const std::string& error, unsigned status)
|
||||||
|
{
|
||||||
|
return TestPrintHost().format_error(body, error, status).ToStdString();
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string envelope(int code, const std::string& message, const std::string& traceback)
|
||||||
|
{
|
||||||
|
return nlohmann::json{{"error", {{"code", code}, {"message", message}, {"traceback", traceback}}}}.dump();
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string moonraker_error(int code, const std::string& message, const std::string& detail = {})
|
||||||
|
{
|
||||||
|
std::string line = "tornado.web.HTTPError: HTTP " + std::to_string(code) + ": " + message;
|
||||||
|
if (!detail.empty())
|
||||||
|
line += " (" + detail + ")";
|
||||||
|
return envelope(code, message, "Traceback (most recent call last):\n ...\n" + line + "\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
// A real Moonraker body for uploading a file that is being printed.
|
||||||
|
constexpr const char* k_busy_file_403 =
|
||||||
|
R"JSON({"error": {"code": 403, "message": "Forbidden", "traceback": "Traceback (most recent call last):\n\n File \"/home/lava/moonraker/moonraker/components/file_manager/file_manager.py\", line 1017, in _finish_gcode_upload\n can_start = self._handle_operation_check(check_path)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\nmoonraker.utils.exceptions.ServerError: File currently in use\n\nDuring handling of the above exception, another exception occurred:\n\nTraceback (most recent call last):\n\n File \"/home/lava/moonraker/moonraker/components/application.py\", line 1069, in post\n raise tornado.web.HTTPError(\ntornado.web.HTTPError: HTTP 403: Forbidden (File is loaded, upload not permitted)\n"}})JSON";
|
||||||
|
|
||||||
|
} // namespace
|
||||||
|
|
||||||
|
TEST_CASE("A Klipper upload error shows its reason instead of a Python traceback", "[PrintHost][Regression]")
|
||||||
|
{
|
||||||
|
const std::string msg = format_error(k_busy_file_403, "", 403);
|
||||||
|
INFO("actual: " << msg);
|
||||||
|
|
||||||
|
CHECK(msg == "HTTP 403: Forbidden (File is loaded, upload not permitted)");
|
||||||
|
CHECK_THAT(msg, !Catch::Matchers::ContainsSubstring("Traceback"));
|
||||||
|
CHECK_THAT(msg, !Catch::Matchers::ContainsSubstring("file_manager.py"));
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_CASE("The specific cause is recovered from a file endpoint's traceback", "[PrintHost]")
|
||||||
|
{
|
||||||
|
SECTION("a plain detail")
|
||||||
|
{
|
||||||
|
const std::string body = moonraker_error(403, "Forbidden", "File is loaded, upload not permitted");
|
||||||
|
CHECK(format_error(body, "", 403) == "HTTP 403: Forbidden (File is loaded, upload not permitted)");
|
||||||
|
}
|
||||||
|
|
||||||
|
SECTION("a detail whose own parentheses nest (a filename)")
|
||||||
|
{
|
||||||
|
const std::string detail = "Directory does not exist (/home/pi/gcodes/plate (1).gcode)";
|
||||||
|
const std::string body = moonraker_error(400, "Bad Request", detail);
|
||||||
|
CHECK(format_error(body, "", 400) == "HTTP 400: Bad Request (" + detail + ")");
|
||||||
|
}
|
||||||
|
|
||||||
|
SECTION("a detail that contains the reason phrase")
|
||||||
|
{
|
||||||
|
const std::string body = moonraker_error(403, "Forbidden", "Forbidden zone: access denied");
|
||||||
|
CHECK(format_error(body, "", 403) == "HTTP 403: Forbidden (Forbidden zone: access denied)");
|
||||||
|
}
|
||||||
|
|
||||||
|
SECTION("a detail that spans lines")
|
||||||
|
{
|
||||||
|
const std::string detail = "Move out of range\nX=250.000 Y=10.000";
|
||||||
|
const std::string body = moonraker_error(400, "Bad Request", detail);
|
||||||
|
CHECK(format_error(body, "", 400) == "HTTP 400: Bad Request (" + detail + ")");
|
||||||
|
}
|
||||||
|
|
||||||
|
SECTION("a detail that only repeats the reason phrase is dropped")
|
||||||
|
{
|
||||||
|
const std::string body = moonraker_error(401, "Unauthorized", "Unauthorized");
|
||||||
|
CHECK(format_error(body, "", 401) == "HTTP 401: Unauthorized");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_CASE("An unhandled exception shows its type and message", "[PrintHost]")
|
||||||
|
{
|
||||||
|
const std::string frame = "Traceback (most recent call last):\n"
|
||||||
|
" File \"/home/pi/moonraker/moonraker/components/file_manager/file_manager.py\", line 1, in write\n"
|
||||||
|
" self._write(data)\n";
|
||||||
|
|
||||||
|
SECTION("a one-line message")
|
||||||
|
{
|
||||||
|
const std::string body = envelope(500, "Internal Server Error", frame + "OSError: [Errno 28] No space left on device\n");
|
||||||
|
CHECK(format_error(body, "", 500) == "HTTP 500: Internal Server Error (OSError: [Errno 28] No space left on device)");
|
||||||
|
}
|
||||||
|
|
||||||
|
SECTION("a message that spans lines")
|
||||||
|
{
|
||||||
|
const std::string body = envelope(500, "Internal Server Error", frame + "ServerError: Klippy request failed\n see klippy.log\n");
|
||||||
|
CHECK(format_error(body, "", 500) == "HTTP 500: Internal Server Error (ServerError: Klippy request failed\n see klippy.log)");
|
||||||
|
}
|
||||||
|
|
||||||
|
SECTION("raised while handling an HTTPError with the same code")
|
||||||
|
{
|
||||||
|
const std::string traceback = frame + "tornado.web.HTTPError: HTTP 500: Internal Server Error (Database locked)\n\n"
|
||||||
|
"During handling of the above exception, another exception occurred:\n\n" +
|
||||||
|
frame + "OSError: [Errno 5] Input/output error\n";
|
||||||
|
const std::string body = envelope(500, "Internal Server Error", traceback);
|
||||||
|
CHECK(format_error(body, "", 500) == "HTTP 500: Internal Server Error (OSError: [Errno 5] Input/output error)");
|
||||||
|
}
|
||||||
|
|
||||||
|
SECTION("a traceback with no header")
|
||||||
|
{
|
||||||
|
const std::string body = envelope(500, "Internal Server Error", "OSError: [Errno 5] Input/output error");
|
||||||
|
CHECK(format_error(body, "", 500) == "HTTP 500: Internal Server Error (OSError: [Errno 5] Input/output error)");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_CASE("A reason already complete in message is shown unchanged", "[PrintHost]")
|
||||||
|
{
|
||||||
|
SECTION("message is the whole reason, no trailing detail")
|
||||||
|
{
|
||||||
|
const std::string body = moonraker_error(503, "Klippy is not ready");
|
||||||
|
CHECK(format_error(body, "", 503) == "HTTP 503: Klippy is not ready");
|
||||||
|
}
|
||||||
|
|
||||||
|
SECTION("a message that itself contains parentheses is not duplicated")
|
||||||
|
{
|
||||||
|
const std::string reason = "Requested blocks (0-5) are unavailable";
|
||||||
|
const std::string body = moonraker_error(400, reason);
|
||||||
|
CHECK(format_error(body, "", 400) == "HTTP 400: " + reason);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_CASE("A Moonraker error with no usable detail shows just the reason phrase", "[PrintHost]")
|
||||||
|
{
|
||||||
|
struct Case
|
||||||
|
{
|
||||||
|
const char* name;
|
||||||
|
const char* body;
|
||||||
|
unsigned status;
|
||||||
|
const char* expected;
|
||||||
|
};
|
||||||
|
|
||||||
|
const auto c = GENERATE(
|
||||||
|
Case{"an empty traceback", R"JSON({"error": {"code": 500, "message": "Internal Server Error", "traceback": ""}})JSON", 500,
|
||||||
|
"HTTP 500: Internal Server Error"},
|
||||||
|
Case{"a traceback of only whitespace", R"JSON({"error": {"code": 500, "message": "Internal Server Error", "traceback": "\n \n"}})JSON",
|
||||||
|
500, "HTTP 500: Internal Server Error"});
|
||||||
|
|
||||||
|
DYNAMIC_SECTION(c.name) { CHECK(format_error(c.body, "", c.status) == c.expected); }
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_CASE("A percent sign in the reason is not a format specifier", "[PrintHost]")
|
||||||
|
{
|
||||||
|
const std::string body = moonraker_error(507, "Insufficient Storage", "disk 100% full");
|
||||||
|
CHECK(format_error(body, "", 507) == "HTTP 507: Insufficient Storage (disk 100% full)");
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_CASE("Error bodies that are not a Moonraker envelope are left unchanged", "[PrintHost]")
|
||||||
|
{
|
||||||
|
SECTION("OctoPrint's string-valued error member")
|
||||||
|
{
|
||||||
|
const std::string body = R"JSON({"error": "File not found"})JSON";
|
||||||
|
CHECK(format_error(body, "", 404) == "HTTP 404: " + body);
|
||||||
|
}
|
||||||
|
|
||||||
|
SECTION("PrusaLink's top-level message, not under error")
|
||||||
|
{
|
||||||
|
const std::string body = R"JSON({"title": "Conflict", "message": "Printer is printing"})JSON";
|
||||||
|
CHECK(format_error(body, "", 409) == "HTTP 409: " + body);
|
||||||
|
}
|
||||||
|
|
||||||
|
SECTION("a body that is not JSON")
|
||||||
|
{
|
||||||
|
const std::string html = "<html><head><title>502 Bad Gateway</title></head></html>";
|
||||||
|
CHECK(format_error(html, "", 502) == "HTTP 502: " + html);
|
||||||
|
}
|
||||||
|
|
||||||
|
SECTION("an error object with no traceback")
|
||||||
|
{
|
||||||
|
const std::string body = R"JSON({"error": {"code": 500, "message": "Internal Server Error"}})JSON";
|
||||||
|
CHECK(format_error(body, "", 500) == "HTTP 500: " + body);
|
||||||
|
}
|
||||||
|
|
||||||
|
SECTION("an error object whose traceback is null")
|
||||||
|
{
|
||||||
|
const std::string body = R"JSON({"error": {"code": 500, "message": "Internal Server Error", "traceback": null}})JSON";
|
||||||
|
CHECK(format_error(body, "", 500) == "HTTP 500: " + body);
|
||||||
|
}
|
||||||
|
|
||||||
|
SECTION("an envelope whose reason phrase is empty")
|
||||||
|
{
|
||||||
|
const std::string body = envelope(403, "", "Traceback (most recent call last):\nOSError: denied\n");
|
||||||
|
CHECK(format_error(body, "", 403) == "HTTP 403: " + body);
|
||||||
|
}
|
||||||
|
|
||||||
|
SECTION("a transport error with no HTTP status")
|
||||||
|
{
|
||||||
|
CHECK(format_error("", "curl:Could not connect", 0) == "curl:Could not connect");
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user