Feature/merge bs1.91 (#5394)

* fixed logic error in PLA jamming gcode for P1S

* Fix use after free bug in LinesBucketQueue::emplace_back_bucket
I found a use after free bug in LinesBucketQueue::emplace_back_bucket. This was found by enabling address sanitizer.
The LinesBucketQueue class has two related members:
std::vector<LinesBucket> line_buckets;
std::priority_queue<LinesBucket *, std::vector<LinesBucket *>, LinesBucketPtrComp> line_bucket_ptr_queue;
line_bucket_ptr_queue holds pointers into line_buckets. However, since items are inserted into line_buckets one at a time, existing pointers that were stored inside line_bucket_ptr_queue become invalid. Specifically:
void LinesBucketQueue::emplace_back_bucket(ExtrusionLayers &&els, const void *objPtr, Point offset)
{
    auto oldSize = line_buckets.capacity();
    line_buckets.emplace_back(std::move(els), objPtr, offset); <--- Causes a reallocation, making previous pointers invalid
    line_bucket_ptr_queue.push(&line_buckets.back()); <-- priority queue compares against old, now invalid pointers
    ...

The proposed fix is to calculate the required number of entries in ConflictChecker::find_inter_of_lines_in_diff_objs, and then calling line_buckets.reserve(count). This ensures that sufficient buffer is allocated up front and the pointers are stable as items are added.

* Updated to fix the handling of the capacity change, and removed the code I previously added to reserve upfront since it is not really needed

* Remove accidentally added whitespace

* Removed unused method

* ENH:add mz_zip_reader_extract_to_file_w api

to solove plugin install failed problem by special wide char
jira: none
Change-Id: Ic7d3efe3fdf852387650abf9df65803da9e46a60
(cherry picked from commit b68ad03717a63675fef2f3ef73d4058bf311adea)

* FIX: PrinterFileSystem report real connect error

Change-Id: I99d6ff7f6dcb1f53ccf59854f5f19d0bd39fa9fc
Jira: none

* rename preference name

* FIX:Relax restrictions on importing obj files

jira: none
Change-Id: I61a0156a8424a5f59922956918d37d38e2c3306a

* FIX: [6469] popup dialog too mach when reload object

Jira: 6469

Change-Id: I4097e3a3b018c7a676fea93bf63f8f778bb3148b

* FIX:fixed incorrect display of printer options page on Linux

jira:[STUDIO-6220]

Change-Id: Id1f084658b0b340b7f17ab97ba82c0fd3ae83fae

* FIX: handle exception of dividing by zero in arranging

jira: none
Change-Id: I0d20464dbe81a80293539100f06d72dee456a27b
(cherry picked from commit 94746ae9bf7f467243849570450567b4fdc78e3a)

* ENH:delete no use code

jira: none
Change-Id: I40e7ffa7ea47bb3cd4039eef9f6c28c604eb3abc

* FIX: PrinterFileSystem::FileRemoved

Change-Id: I891aaa8d58ff379dc1ebd8581064865a33388f74

* FIX: resend ttcode to printer on -90 error

Change-Id: I96dc45102a2759a9f1a0002f42c3a91b2c6b2d75
Jira: STUDIO-5947
(cherry picked from commit 97d687b7c88f8cd51b8eddd39120349d8eac42b1)

* FIX: fix some issue in multi machine

JIRA: STUDIO-6934 STUDIO-6888
1. Fix the issue of incomplete display caused by excessively long file names
2. Fix the issue of icon display being too large
3. Fix the issue of garbled Chinese characters in the task list

Change-Id: I36bc10bf2067f44aaa7e3651b58e526ea323c8ad

* FIX: Incorrect multiplier, when the multiplier is set to below 1

github: #3987 #3805
1. In some languages that use commas as decimal points, setting multiplier below 1 will resolve to 0
2. Unable to save multiplier correctly

Change-Id: I62bc55e270929ebb5e910eb79c6f97106e842b93

* Arrange

* FIX: wrong wipe tower when open 3mf file

1.wipe tower pos in 3mf was overwritten by default pos when opening 3mf
with a different printer profile.This patch fix it

jira: STUDIO-5890

Signed-off-by: xun.zhang <xun.zhang@bambulab.com>
Change-Id: I12e5d4b80a0ad86194db0682c1763ba4a9492521

* ENH: update A1 machine gcode

1.Adjust the y position of the A1 extrusion compensation line

jira:NEW

Signed-off-by: xun.zhang <xun.zhang@bambulab.com>
Change-Id: Iea690a0184ae10a47f53e1532272c31fc0a04cfa

* FIX: minor spelling mistake in gcode

github:#3477

Signed-off-by: xun.zhang <xun.zhang@bambulab.com>
Change-Id: Id3201bf8b8125ce060e2cac102ab2525877e27c1

* FIX: slice crash with height_range

github: 3917
Change-Id: Icdf83013213b47935b7a795ed75cc3d49057665d

* FIX: ERROR_RES_BUSY text

Change-Id: Ifde1a7b0c6ab915eb226c2072c46edd40f60cf9a
Jira: STUDIO-6436

* ENH:Unable to send printing without selecting a device

jira:[STUDIO-6850]

Change-Id: Ic537579727fd1618af364db93fce8fbbe4cd635a

* FIX:add exit_gizmo before slice model

jira: STUDIO-5531
Change-Id: Icddc9d73b3d91bb68e9768d13e48cbae0680e58e

* FIX: PrinterFileSystem report real connect error

Change-Id: Id6750cfa2a98fe8325ba677dabb606a0a701b495

* FIX: add can slice judgement in slice all plates processing

jira: STUDIO-6325

Change-Id: Ic7fb8cef000c03210bb77289a570ee6b60b6083e

* FIX:Fixed error in displaying the name of Bambu filaments

Change-Id: Ib42194c07b6eefe793eec81a588debc9d622d951

* FIX: text hidden in calibration tab

jira: STUDIO-6264

Change-Id: I24fbc590638a3213d948a973422e010486113923

* FIX: logic error in PLA fan control

github PR: #3948

Signed-off-by: xun.zhang <xun.zhang@bambulab.com>
Change-Id: I28e4a673e590e83d151e92cc82caab45012aeabe

* FIX:upgrade cluster algorithm to remove duplicate labels

jira: none
Change-Id: I4d68d8cd8e080932c7c308bc8f69e27546ffe309

* FIX: can not parse json float in ES on macOS

jira: STUDIO-5889

Change-Id: I622f4b474c378d77b0e43d67a320f023be2d5811

* ENH:Clear the value of the previous nozzle type

jira:[for nozzle check]

Change-Id: I9a932b833fb07de6cb0a91abe6372b0e91f273f1

* ENH: update A1 gcode

1.Modify the width of extrusion compensation line

jira:NEW

Signed-off-by: xun.zhang <xun.zhang@bambulab.com>
Change-Id: I90543758c866d74f2154e3135d7569109def84b8

* FIX: the height range is not valid in assemble object

github: 3876
Change-Id: Id38672bbf0c01bc9b9f0a3e2bf1052d945b45131

* FIX: calibration page text hidden in linux

jira: STUDIO-6264

Change-Id: If210abf64057eb2e9c2c5b11d41fa33f18684c72

* ENH:clear nozzle information

jira:[STUDIO-7050]

Change-Id: I15ca4973d09132ddb5cb5a56bedd795ba6976b27

* update plugin version

---------

Signed-off-by: xun.zhang <xun.zhang@bambulab.com>
Co-authored-by: afriede <me@afriede.dev>
Co-authored-by: Momin Al-Ghosien <momin@sanestudios.com>
Co-authored-by: zhou.xu <zhou.xu@bambulab.com>
Co-authored-by: chunmao.guo <chunmao.guo@bambulab.com>
Co-authored-by: maosheng.wei <maosheng.wei@bambulab.com>
Co-authored-by: tao wang <tao.wang@bambulab.com>
Co-authored-by: Arthur <arthur.tang@bambulab.com>
Co-authored-by: Kunlong Ma <kunlong.ma@bambulab.com>
Co-authored-by: xun.zhang <xun.zhang@bambulab.com>
Co-authored-by: zhimin.zeng <zhimin.zeng@bambulab.com>
Co-authored-by: liz.li <liz.li@bambulab.com>
This commit is contained in:
SoftFever 2024-05-19 21:22:14 +08:00 committed by GitHub
parent 6e701454fd
commit ad341ec9e6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
62 changed files with 579 additions and 189 deletions

View file

@ -800,7 +800,7 @@ void AMSMaterialsSetting::Popup(wxString filament, wxString sn, wxString temp_mi
int selection_idx = -1, idx = 0;
wxArrayString filament_items;
wxString bambu_filament_name;
std::set<std::string> filament_id_set;
PresetBundle * preset_bundle = wxGetApp().preset_bundle;
@ -854,6 +854,8 @@ void AMSMaterialsSetting::Popup(wxString filament, wxString sn, wxString temp_mi
if (filament_it->filament_id == ams_filament_id) {
selection_idx = idx;
bambu_filament_name = filament_it->alias;
// update if nozzle_temperature_range is found
ConfigOption *opt_min = filament_it->config.option("nozzle_temperature_range_low");
@ -893,7 +895,13 @@ void AMSMaterialsSetting::Popup(wxString filament, wxString sn, wxString temp_mi
if (!m_is_third) {
m_comboBox_filament->Hide();
m_readonly_filament->Show();
m_readonly_filament->SetLabel("Bambu " + filament);
if (bambu_filament_name.empty()) {
m_readonly_filament->SetLabel("Bambu " + filament);
}
else {
m_readonly_filament->SetLabel(bambu_filament_name);
}
m_input_nozzle_min->GetTextCtrl()->SetValue(temp_min);
m_input_nozzle_max->GetTextCtrl()->SetValue(temp_max);
}

View file

@ -16,10 +16,12 @@ void CalibrationStartPage::create_when(wxWindow* parent, wxString title, wxStrin
m_when_title = new Label(this, title);
m_when_title->SetFont(Label::Head_14);
m_when_title->Wrap(CALIBRATION_START_PAGE_TEXT_MAX_LENGTH);
m_when_title->SetMinSize({CALIBRATION_START_PAGE_TEXT_MAX_LENGTH, -1});
m_when_content = new Label(this, content);;
m_when_content->SetFont(Label::Body_14);
m_when_content->Wrap(CALIBRATION_START_PAGE_TEXT_MAX_LENGTH);
m_when_content->SetMinSize({CALIBRATION_START_PAGE_TEXT_MAX_LENGTH, -1});
}
void CalibrationStartPage::create_about(wxWindow* parent, wxString title, wxString content)
@ -27,10 +29,12 @@ void CalibrationStartPage::create_about(wxWindow* parent, wxString title, wxStri
m_about_title = new Label(this, title);
m_about_title->SetFont(Label::Head_14);
m_about_title->Wrap(CALIBRATION_START_PAGE_TEXT_MAX_LENGTH);
m_about_title->SetMinSize({CALIBRATION_START_PAGE_TEXT_MAX_LENGTH, -1});
m_about_content = new Label(this, content);
m_about_content->SetFont(Label::Body_14);
m_about_content->Wrap(CALIBRATION_START_PAGE_TEXT_MAX_LENGTH);
m_about_content->SetMinSize({CALIBRATION_START_PAGE_TEXT_MAX_LENGTH, -1});
}
void CalibrationStartPage::create_bitmap(wxWindow* parent, const wxBitmap& before_img, const wxBitmap& after_img)
@ -77,6 +81,7 @@ CalibrationPAStartPage::CalibrationPAStartPage(wxWindow* parent, wxWindowID id,
create_page(this);
this->SetSizer(m_top_sizer);
Layout();
m_top_sizer->Fit(this);
}
@ -124,8 +129,8 @@ void CalibrationPAStartPage::create_page(wxWindow* parent)
#ifdef __linux__
wxGetApp().CallAfter([this]() {
m_when_content->SetMinSize(m_when_content->GetSize() + wxSize{ 0, wxWindow::GetCharHeight() / 2 });
m_about_content->SetMinSize(m_about_content->GetSize() + wxSize{ 0, wxWindow::GetCharHeight() / 2 });
m_when_content->SetMinSize(m_when_content->GetSize() + wxSize{ 0, wxWindow::GetCharHeight() });
m_about_content->SetMinSize(m_about_content->GetSize() + wxSize{ 0, wxWindow::GetCharHeight() });
Layout();
Fit();
});
@ -200,6 +205,7 @@ CalibrationFlowRateStartPage::CalibrationFlowRateStartPage(wxWindow* parent, wxW
create_page(this);
this->SetSizer(m_top_sizer);
Layout();
m_top_sizer->Fit(this);
}
@ -231,6 +237,7 @@ void CalibrationFlowRateStartPage::create_page(wxWindow* parent)
auto extra_text = new Label(parent, _L("In addition, Flow Rate Calibration is crucial for foaming materials like LW-PLA used in RC planes. These materials expand greatly when heated, and calibration provides a useful reference flow rate."));
extra_text->SetFont(Label::Body_14);
extra_text->Wrap(CALIBRATION_START_PAGE_TEXT_MAX_LENGTH);
extra_text->SetMinSize({CALIBRATION_START_PAGE_TEXT_MAX_LENGTH, -1});
m_top_sizer->Add(extra_text);
m_top_sizer->AddSpacer(PRESET_GAP);
@ -245,6 +252,7 @@ void CalibrationFlowRateStartPage::create_page(wxWindow* parent)
auto auto_cali_title = new Label(parent, _L("Auto-Calibration"));
auto_cali_title->SetFont(Label::Head_14);
auto_cali_title->Wrap(CALIBRATION_START_PAGE_TEXT_MAX_LENGTH);
auto_cali_title->SetMinSize({CALIBRATION_START_PAGE_TEXT_MAX_LENGTH, -1});
auto auto_cali_content = new Label(this,
_L("Auto Flow Rate Calibration utilizes Bambu Lab's Micro-Lidar technology, directly measuring the calibration patterns. However, please be advised that the efficacy and accuracy of this method may be compromised with specific types of materials. Particularly, filaments that are transparent or semi-transparent, sparkling-particled, or have a high-reflective finish may not be suitable for this calibration and can produce less-than-desirable results.\
@ -252,6 +260,7 @@ void CalibrationFlowRateStartPage::create_page(wxWindow* parent)
\n\nCaution: Flow Rate Calibration is an advanced process, to be attempted only by those who fully understand its purpose and implications. Incorrect usage can lead to sub-par prints or printer damage. Please make sure to carefully read and understand the process before doing it."));
auto_cali_content->SetFont(Label::Body_14);
auto_cali_content->Wrap(CALIBRATION_START_PAGE_TEXT_MAX_LENGTH);
auto_cali_content->SetMinSize({CALIBRATION_START_PAGE_TEXT_MAX_LENGTH, -1});
m_top_sizer->Add(auto_cali_title);
m_top_sizer->Add(auto_cali_content);
@ -262,9 +271,10 @@ void CalibrationFlowRateStartPage::create_page(wxWindow* parent)
m_top_sizer->Add(m_action_panel, 0, wxEXPAND, 0);
#ifdef __linux__
wxGetApp().CallAfter([this, auto_cali_content]() {
m_when_content->SetMinSize(m_when_content->GetSize() + wxSize{ 0, wxWindow::GetCharHeight() / 2 });
auto_cali_content->SetMinSize(auto_cali_content->GetSize() + wxSize{ 0, wxWindow::GetCharHeight() / 2 });
wxGetApp().CallAfter([this, auto_cali_content, extra_text]() {
m_when_content->SetMinSize(m_when_content->GetSize() + wxSize{ 0, wxWindow::GetCharHeight() });
auto_cali_content->SetMinSize(auto_cali_content->GetSize() + wxSize{ 0, wxWindow::GetCharHeight() });
extra_text->SetMinSize(extra_text->GetSize() + wxSize{ 0, wxWindow::GetCharHeight() });
Layout();
Fit();
});
@ -332,6 +342,7 @@ CalibrationMaxVolumetricSpeedStartPage::CalibrationMaxVolumetricSpeedStartPage(w
create_page(this);
this->SetSizer(m_top_sizer);
Layout();
m_top_sizer->Fit(this);
}

View file

@ -3300,7 +3300,7 @@ void CreatePresetSuccessfulDialog::on_dpi_changed(const wxRect &suggested_rect)
}
ExportConfigsDialog::ExportConfigsDialog(wxWindow *parent)
: DPIDialog(parent ? parent : nullptr, wxID_ANY, _L("Export Configs"), wxDefaultPosition, wxDefaultSize, wxCAPTION | wxCLOSE_BOX)
: DPIDialog(parent ? parent : nullptr, wxID_ANY, _L("Export Preset Bundle"), wxDefaultPosition, wxDefaultSize, wxCAPTION | wxCLOSE_BOX)
{
m_exprot_type.preset_bundle = _L("Printer config bundle(.orca_printer)");
m_exprot_type.filament_bundle = _L("Filament bundle(.orca_filament)");

View file

@ -2660,8 +2660,6 @@ static ENUM enum_index_of(char const *key, char const **enum_names, int enum_cou
int MachineObject::parse_json(std::string payload, bool key_field_only)
{
CNumericLocalesSetter locales_setter;
parse_msg_count++;
std::chrono::system_clock::time_point clock_start = std::chrono::system_clock::now();
this->set_online_state(true);
@ -2676,6 +2674,7 @@ int MachineObject::parse_json(std::string payload, bool key_field_only)
bool restored_json = false;
json j;
json j_pre = json::parse(payload);
CNumericLocalesSetter locales_setter;
if (j_pre.empty()) {
return 0;
}
@ -3511,6 +3510,9 @@ int MachineObject::parse_json(std::string payload, bool key_field_only)
}
}
}
else {
nozzle_type = "";
}
}
catch (...) {
;

View file

@ -2137,6 +2137,13 @@ void GLCanvas3D::deselect_all()
post_event(SimpleEvent(EVT_GLCANVAS_OBJECT_SELECT));
}
void GLCanvas3D::exit_gizmo() {
if (m_gizmos.get_current_type() != GLGizmosManager::Undefined) {
m_gizmos.reset_all_states();
m_gizmos.update_data();
}
}
void GLCanvas3D::set_selected_visible(bool visible)
{
for (unsigned int i : m_selection.get_volume_idxs()) {
@ -7726,24 +7733,26 @@ void GLCanvas3D::_render_imgui_select_plate_toolbar()
m_sel_plate_toolbar.m_items[i]->slice_state = IMToolbarItem::SliceState::SLICED;
else
m_sel_plate_toolbar.m_items[i]->slice_state = IMToolbarItem::SliceState::SLICE_FAILED;
continue;
}
if (plate_list.get_plate(i)->get_slicing_percent() < 0.0f)
m_sel_plate_toolbar.m_items[i]->slice_state = IMToolbarItem::SliceState::UNSLICED;
else
m_sel_plate_toolbar.m_items[i]->slice_state = IMToolbarItem::SliceState::SLICING;
else {
if (!plate_list.get_plate(i)->can_slice())
m_sel_plate_toolbar.m_items[i]->slice_state = IMToolbarItem::SliceState::SLICE_FAILED;
else {
if (plate_list.get_plate(i)->get_slicing_percent() < 0.0f)
m_sel_plate_toolbar.m_items[i]->slice_state = IMToolbarItem::SliceState::UNSLICED;
else
m_sel_plate_toolbar.m_items[i]->slice_state = IMToolbarItem::SliceState::SLICING;
}
}
}
}
if (m_sel_plate_toolbar.show_stats_item) {
all_plates_stats_item->percent = 0.0f;
size_t sliced_plates_cnt = 0;
bool slice_failed = false;
for (auto plate : plate_list.get_nonempty_plate_list()) {
if (plate->is_slice_result_valid() && plate->is_slice_result_ready_for_print())
sliced_plates_cnt++;
if (plate->is_slice_result_valid() && !plate->is_slice_result_ready_for_print())
slice_failed = true;
}
all_plates_stats_item->percent = (float)(sliced_plates_cnt) / (float)(plate_list.get_nonempty_plate_list().size()) * 100.0f;
@ -7754,8 +7763,13 @@ void GLCanvas3D::_render_imgui_select_plate_toolbar()
else if (all_plates_stats_item->percent < 100.0f)
all_plates_stats_item->slice_state = IMToolbarItem::SliceState::SLICING;
if (slice_failed)
all_plates_stats_item->slice_state = IMToolbarItem::SliceState::SLICE_FAILED;
for (auto toolbar_item : m_sel_plate_toolbar.m_items) {
if(toolbar_item->slice_state == IMToolbarItem::SliceState::SLICE_FAILED) {
all_plates_stats_item->slice_state = IMToolbarItem::SliceState::SLICE_FAILED;
all_plates_stats_item->selected = false;
break;
}
}
// Changing parameters does not invalid all plates, need extra logic to validate
bool gcode_result_valid = true;

View file

@ -905,6 +905,7 @@ public:
void select_all();
void deselect_all();
void exit_gizmo();
void set_selected_visible(bool visible);
void delete_selected();
void ensure_on_bed(unsigned int object_idx, bool allow_negative_z);

View file

@ -1421,13 +1421,17 @@ int GUI_App::install_plugin(std::string name, std::string package_name, InstallP
mz_bool res = mz_zip_reader_extract_to_file(&archive, stat.m_file_index, dest_zip_file.c_str(), 0);
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(", extract %1% from plugin zip %2%\n") % dest_file % stat.m_filename;
if (res == 0) {
mz_zip_error zip_error = mz_zip_get_last_error(&archive);
BOOST_LOG_TRIVIAL(error) << "[install_plugin]Archive read error:" << mz_zip_get_error_string(zip_error) << std::endl;
close_zip_reader(&archive);
if (pro_fn) {
pro_fn(InstallStatusUnzipFailed, 0, cancel);
#ifdef WIN32
std::wstring new_dest_zip_file = boost::locale::conv::utf_to_utf<wchar_t>(dest_path.generic_string());
res = mz_zip_reader_extract_to_file_w(&archive, stat.m_file_index, new_dest_zip_file.c_str(), 0);
#endif
if (res == 0) {
mz_zip_error zip_error = mz_zip_get_last_error(&archive);
BOOST_LOG_TRIVIAL(error) << "[install_plugin]Archive read error:" << mz_zip_get_error_string(zip_error) << std::endl;
close_zip_reader(&archive);
if (pro_fn) { pro_fn(InstallStatusUnzipFailed, 0, cancel); }
return InstallStatusUnzipFailed;
}
return InstallStatusUnzipFailed;
}
else {
if (pro_fn) {

View file

@ -154,6 +154,12 @@ void View3D::deselect_all()
m_canvas->deselect_all();
}
void View3D::exit_gizmo()
{
if (m_canvas != nullptr)
m_canvas->exit_gizmo();
}
void View3D::delete_selected()
{
if (m_canvas != nullptr)

View file

@ -63,6 +63,7 @@ public:
void select_all();
void deselect_all();
void exit_gizmo();
void delete_selected();
void center_selected();
void center_selected_plate(const int plate_idx);

View file

@ -1550,7 +1550,8 @@ wxBoxSizer* MainFrame::create_side_tools()
m_slice_btn->Bind(wxEVT_BUTTON, [this](wxCommandEvent& event)
{
//this->m_plater->select_view_3D("Preview");
m_plater->update(false, true);
m_plater->exit_gizmo();
m_plater->update(true, true);
if (m_slice_select == eSliceAll)
wxPostEvent(m_plater, SimpleEvent(EVT_GLTOOLBAR_SLICE_ALL));
else
@ -2344,7 +2345,7 @@ void MainFrame::init_menubar_as_editor()
[this](wxCommandEvent&) { if (m_plater) m_plater->export_gcode(false); }, "menu_export_gcode", nullptr,
[this]() {return can_export_gcode(); }, this);
append_menu_item(
export_menu, wxID_ANY, _L("Export &Configs") + dots /* + "\tCtrl+E"*/, _L("Export current configuration to files"),
export_menu, wxID_ANY, _L("Export Preset Bundle") + dots /* + "\tCtrl+E"*/, _L("Export current configuration to files"),
[this](wxCommandEvent &) { export_config(); },
"menu_export_config", nullptr,
[]() { return true; }, this);

View file

@ -578,11 +578,11 @@ void MediaPlayCtrl::onStateChanged(wxMediaEvent &event)
m_failed_code = m_media_ctrl->GetLastError();
if (size.GetWidth() >= 320) {
m_last_state = state;
m_failed_code = 0;
SetStatus(_L("Playing..."), false);
m_failed_retry = 0;
m_failed_code = 0;
m_disable_lan = false;
boost::unique_lock lock(m_mutex);
m_tasks.push_back("<play>");

View file

@ -721,5 +721,47 @@ void MultiMachineManagerPage::page_num_enter_evt()
update_page_number();
}
void MultiMachineManagerPage::msw_rescale()
{
m_printer_name->Rescale();
m_printer_name->SetMinSize(wxSize(FromDIP(DEVICE_LEFT_DEV_NAME), FromDIP(DEVICE_ITEM_MAX_HEIGHT)));
m_printer_name->SetMaxSize(wxSize(FromDIP(DEVICE_LEFT_DEV_NAME), FromDIP(DEVICE_ITEM_MAX_HEIGHT)));
m_task_name->Rescale();
m_task_name->SetMinSize(wxSize(FromDIP(DEVICE_LEFT_DEV_NAME), FromDIP(DEVICE_ITEM_MAX_HEIGHT)));
m_task_name->SetMaxSize(wxSize(FromDIP(DEVICE_LEFT_DEV_NAME), FromDIP(DEVICE_ITEM_MAX_HEIGHT)));
m_status->Rescale();
m_status->SetMinSize(wxSize(FromDIP(DEVICE_LEFT_PRO_INFO), FromDIP(DEVICE_ITEM_MAX_HEIGHT)));
m_status->SetMaxSize(wxSize(FromDIP(DEVICE_LEFT_PRO_INFO), FromDIP(DEVICE_ITEM_MAX_HEIGHT)));
m_action->Rescale();
m_action->SetMinSize(wxSize(FromDIP(DEVICE_LEFT_PRO_NAME), FromDIP(DEVICE_ITEM_MAX_HEIGHT)));
m_action->SetMaxSize(wxSize(FromDIP(DEVICE_LEFT_PRO_NAME), FromDIP(DEVICE_ITEM_MAX_HEIGHT)));
m_button_add->Rescale();
m_button_add->SetMinSize(wxSize(FromDIP(90), FromDIP(36)));
m_button_add->SetMaxSize(wxSize(FromDIP(90), FromDIP(36)));
btn_last_page->Rescale();
btn_last_page->SetMinSize(wxSize(FromDIP(20), FromDIP(20)));
btn_last_page->SetMaxSize(wxSize(FromDIP(20), FromDIP(20)));
btn_next_page->Rescale();
btn_next_page->SetMinSize(wxSize(FromDIP(20), FromDIP(20)));
btn_next_page->SetMaxSize(wxSize(FromDIP(20), FromDIP(20)));
m_page_num_enter->Rescale();
m_page_num_enter->SetMinSize(wxSize(FromDIP(25), FromDIP(25)));
m_page_num_enter->SetMaxSize(wxSize(FromDIP(25), FromDIP(25)));
m_button_edit->Rescale();
m_button_edit->SetMinSize(wxSize(FromDIP(90), FromDIP(36)));
m_button_edit->SetMaxSize(wxSize(FromDIP(90), FromDIP(36)));
for (const auto& item : m_device_items) {
item->Refresh();
}
Fit();
Layout();
Refresh();
}
} // namespace GUI
} // namespace Slic3r

View file

@ -60,6 +60,8 @@ public:
void page_num_enter_evt();
void msw_rescale();
private:
std::vector<ObjState> m_state_objs;
std::vector<MultiMachineItem*> m_device_items;

View file

@ -40,6 +40,17 @@ void MultiMachinePage::on_sys_color_changed()
void MultiMachinePage::msw_rescale()
{
m_tabpanel->Rescale();
if (m_local_task_manager)
m_local_task_manager->msw_rescale();
if (m_cloud_task_manager)
m_cloud_task_manager->msw_rescale();
if (m_machine_manager)
m_machine_manager->msw_rescale();
this->Fit();
this->Layout();
this->Refresh();
}
bool MultiMachinePage::Show(bool show)

View file

@ -776,7 +776,7 @@ void LocalTaskManagerPage::refresh_user_device(bool clear)
MultiTaskItem* mtitem = new MultiTaskItem(m_task_list, nullptr, 0);
mtitem->task_obj = task_state_info;
mtitem->m_project_name = wxString::FromUTF8(task_state_info->get_task_name());
mtitem->m_dev_name = task_state_info->get_device_name();
mtitem->m_dev_name = wxString::FromUTF8(task_state_info->get_device_name());
mtitem->m_dev_id = task_state_info->params().dev_id;
mtitem->m_send_time = task_state_info->get_sent_time();
mtitem->state_local_task = task_state_info->state();
@ -855,6 +855,41 @@ void LocalTaskManagerPage::cancel_all(wxCommandEvent& evt)
}
}
void LocalTaskManagerPage::msw_rescale()
{
m_select_checkbox->Rescale();
m_select_checkbox->SetMinSize(wxSize(FromDIP(TASK_LEFT_PRINTABLE), FromDIP(DEVICE_ITEM_MAX_HEIGHT)));
m_select_checkbox->SetMaxSize(wxSize(FromDIP(TASK_LEFT_PRINTABLE), FromDIP(DEVICE_ITEM_MAX_HEIGHT)));
m_task_name->Rescale();
m_task_name->SetMinSize(wxSize(FromDIP(TASK_LEFT_PRO_NAME), FromDIP(DEVICE_ITEM_MAX_HEIGHT)));
m_task_name->SetMaxSize(wxSize(FromDIP(TASK_LEFT_PRO_NAME), FromDIP(DEVICE_ITEM_MAX_HEIGHT)));
m_printer_name->Rescale();
m_printer_name->SetMinSize(wxSize(FromDIP(TASK_LEFT_DEV_NAME), FromDIP(DEVICE_ITEM_MAX_HEIGHT)));
m_printer_name->SetMaxSize(wxSize(FromDIP(TASK_LEFT_DEV_NAME), FromDIP(DEVICE_ITEM_MAX_HEIGHT)));
m_status->Rescale();
m_status->SetMinSize(wxSize(FromDIP(TASK_LEFT_PRO_STATE), FromDIP(DEVICE_ITEM_MAX_HEIGHT)));
m_status->SetMaxSize(wxSize(FromDIP(TASK_LEFT_PRO_STATE), FromDIP(DEVICE_ITEM_MAX_HEIGHT)));
m_info->Rescale();
m_info->SetMinSize(wxSize(FromDIP(TASK_LEFT_PRO_INFO), FromDIP(DEVICE_ITEM_MAX_HEIGHT)));
m_info->SetMaxSize(wxSize(FromDIP(TASK_LEFT_PRO_INFO), FromDIP(DEVICE_ITEM_MAX_HEIGHT)));
m_send_time->Rescale();
m_send_time->SetMinSize(wxSize(FromDIP(TASK_LEFT_SEND_TIME), FromDIP(DEVICE_ITEM_MAX_HEIGHT)));
m_send_time->SetMaxSize(wxSize(FromDIP(TASK_LEFT_SEND_TIME), FromDIP(DEVICE_ITEM_MAX_HEIGHT)));
m_action->Rescale();
m_action->SetMinSize(wxSize(FromDIP(TASK_LEFT_PRO_INFO), FromDIP(DEVICE_ITEM_MAX_HEIGHT)));
m_action->SetMaxSize(wxSize(FromDIP(TASK_LEFT_PRO_INFO), FromDIP(DEVICE_ITEM_MAX_HEIGHT)));
btn_stop_all->Rescale();
for (auto it = m_task_items.begin(); it != m_task_items.end(); ++it) {
it->second->Refresh();
}
Fit();
Layout();
Refresh();
}
CloudTaskManagerPage::CloudTaskManagerPage(wxWindow* parent)
: wxPanel(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL)
{
@ -1214,7 +1249,7 @@ void CloudTaskManagerPage::refresh_user_device(bool clear)
//mtitem->task_obj = task_state_info;
mtitem->m_job_id = task_state_info.get_job_id();
mtitem->m_project_name = wxString::FromUTF8(task_state_info.get_task_name());
mtitem->m_dev_name = task_state_info.get_device_name();
mtitem->m_dev_name = wxString::FromUTF8(task_state_info.get_device_name());
mtitem->m_dev_id = task_state_info.params().dev_id;
mtitem->m_send_time = utc_time_to_date(task_state_info.start_time);
@ -1432,5 +1467,52 @@ void CloudTaskManagerPage::page_num_enter_evt()
Layout();*/
}
void CloudTaskManagerPage::msw_rescale()
{
btn_last_page->Rescale();
btn_last_page->SetMinSize(wxSize(FromDIP(20), FromDIP(20)));
btn_last_page->SetMaxSize(wxSize(FromDIP(20), FromDIP(20)));
btn_next_page->Rescale();
btn_next_page->SetMinSize(wxSize(FromDIP(20), FromDIP(20)));
btn_next_page->SetMaxSize(wxSize(FromDIP(20), FromDIP(20)));
m_page_num_enter->Rescale();
m_page_num_enter->SetMinSize(wxSize(FromDIP(25), FromDIP(25)));
m_page_num_enter->SetMaxSize(wxSize(FromDIP(25), FromDIP(25)));
m_select_checkbox->Rescale();
m_select_checkbox->SetMinSize(wxSize(FromDIP(TASK_LEFT_PRINTABLE), FromDIP(DEVICE_ITEM_MAX_HEIGHT)));
m_select_checkbox->SetMaxSize(wxSize(FromDIP(TASK_LEFT_PRINTABLE), FromDIP(DEVICE_ITEM_MAX_HEIGHT)));
m_task_name->Rescale();
m_task_name->SetMinSize(wxSize(FromDIP(TASK_LEFT_PRO_NAME), FromDIP(DEVICE_ITEM_MAX_HEIGHT)));
m_task_name->SetMaxSize(wxSize(FromDIP(TASK_LEFT_PRO_NAME), FromDIP(DEVICE_ITEM_MAX_HEIGHT)));
m_printer_name->Rescale();
m_printer_name->SetMinSize(wxSize(FromDIP(TASK_LEFT_DEV_NAME), FromDIP(DEVICE_ITEM_MAX_HEIGHT)));
m_printer_name->SetMaxSize(wxSize(FromDIP(TASK_LEFT_DEV_NAME), FromDIP(DEVICE_ITEM_MAX_HEIGHT)));
m_status->Rescale();
m_status->SetMinSize(wxSize(FromDIP(TASK_LEFT_PRO_STATE), FromDIP(DEVICE_ITEM_MAX_HEIGHT)));
m_status->SetMaxSize(wxSize(FromDIP(TASK_LEFT_PRO_STATE), FromDIP(DEVICE_ITEM_MAX_HEIGHT)));
m_info->Rescale();
m_info->SetMinSize(wxSize(FromDIP(TASK_LEFT_PRO_INFO), FromDIP(DEVICE_ITEM_MAX_HEIGHT)));
m_info->SetMaxSize(wxSize(FromDIP(TASK_LEFT_PRO_INFO), FromDIP(DEVICE_ITEM_MAX_HEIGHT)));
m_send_time->Rescale();
m_send_time->SetMinSize(wxSize(FromDIP(TASK_LEFT_SEND_TIME), FromDIP(DEVICE_ITEM_MAX_HEIGHT)));
m_send_time->SetMaxSize(wxSize(FromDIP(TASK_LEFT_SEND_TIME), FromDIP(DEVICE_ITEM_MAX_HEIGHT)));
m_action->Rescale();
m_action->SetMinSize(wxSize(FromDIP(TASK_LEFT_PRO_INFO), FromDIP(DEVICE_ITEM_MAX_HEIGHT)));
m_action->SetMaxSize(wxSize(FromDIP(TASK_LEFT_PRO_INFO), FromDIP(DEVICE_ITEM_MAX_HEIGHT)));
btn_pause_all->Rescale();
btn_continue_all->Rescale();
btn_stop_all->Rescale();
for (auto it = m_task_items.begin(); it != m_task_items.end(); ++it) {
it->second->Refresh();
}
Fit();
Layout();
Refresh();
}
} // namespace GUI
} // namespace Slic3r

View file

@ -85,6 +85,7 @@ public:
void refresh_user_device(bool clear = false);
bool Show(bool show);
void cancel_all(wxCommandEvent& evt);
void msw_rescale();
private:
SortItem m_sort;
@ -143,6 +144,8 @@ public:
void enable_buttons(bool enable);
void page_num_enter_evt();
void msw_rescale();
private:
SortItem m_sort;
bool device_name_big{ true };

View file

@ -2372,6 +2372,7 @@ struct Plater::priv
void select_all();
void deselect_all();
void exit_gizmo();
void remove(size_t obj_idx);
bool delete_object_from_model(size_t obj_idx, bool refresh_immediately = true); //BBS
void delete_all_objects_from_model();
@ -3926,6 +3927,16 @@ std::vector<size_t> Plater::priv::load_files(const std::vector<fs::path>& input_
//always load config
{
// BBS: save the wipe tower pos in file here, will be used later
ConfigOptionFloats* wipe_tower_x_opt = config.opt<ConfigOptionFloats>("wipe_tower_x");
ConfigOptionFloats* wipe_tower_y_opt = config.opt<ConfigOptionFloats>("wipe_tower_y");
std::optional<ConfigOptionFloats>file_wipe_tower_x;
std::optional<ConfigOptionFloats>file_wipe_tower_y;
if (wipe_tower_x_opt)
file_wipe_tower_x = *wipe_tower_x_opt;
if (wipe_tower_y_opt)
file_wipe_tower_y = *wipe_tower_y_opt;
preset_bundle->load_config_model(filename.string(), std::move(config), file_version);
ConfigOption* bed_type_opt = preset_bundle->project_config.option("curr_bed_type");
@ -4001,6 +4012,17 @@ std::vector<size_t> Plater::priv::load_files(const std::vector<fs::path>& input_
// when for extruder colors are used filament colors
q->on_filaments_change(preset_bundle->filament_presets.size());
is_project_file = true;
//BBS: rewrite wipe tower pos stored in 3mf file , the code above should be seriously reconsidered
{
DynamicConfig& proj_cfg = wxGetApp().preset_bundle->project_config;
ConfigOptionFloats* wipe_tower_x = proj_cfg.opt<ConfigOptionFloats>("wipe_tower_x");
ConfigOptionFloats* wipe_tower_y = proj_cfg.opt<ConfigOptionFloats>("wipe_tower_y");
if (file_wipe_tower_x)
*wipe_tower_x = *file_wipe_tower_x;
if (file_wipe_tower_y)
*wipe_tower_y = *file_wipe_tower_y;
}
}
}
if (!silence) wxGetApp().app_config->update_config_dir(path.parent_path().string());
@ -4771,6 +4793,11 @@ void Plater::priv::deselect_all()
view3D->deselect_all();
}
void Plater::priv::exit_gizmo()
{
view3D->exit_gizmo();
}
void Plater::priv::remove(size_t obj_idx)
{
if (view3D->is_layers_editing_enabled())
@ -5970,7 +5997,8 @@ void Plater::priv::reload_from_disk()
for (auto [src, dest] : replace_paths) {
for (auto [obj_idx, vol_idx] : selected_volumes) {
if (boost::algorithm::iequals(model.objects[obj_idx]->volumes[vol_idx]->source.input_file, src.string()))
replace_volume_with_stl(obj_idx, vol_idx, dest, "");
// When an error occurs, either the dest parsing error occurs, or the number of objects in the dest is greater than 1 and cannot be replaced, and cannot be replaced in this loop.
if (!replace_volume_with_stl(obj_idx, vol_idx, dest, "")) break;
}
}
#else
@ -10659,6 +10687,7 @@ void Plater::remove_curr_plate_all() { p->remove_curr_plate_all(); }
void Plater::select_all() { p->select_all(); }
void Plater::deselect_all() { p->deselect_all(); }
void Plater::exit_gizmo() { p->exit_gizmo(); }
void Plater::remove(size_t obj_idx) { p->remove(obj_idx); }
void Plater::reset(bool apply_presets_change) { p->reset(apply_presets_change); }
@ -12003,7 +12032,7 @@ int Plater::start_next_slice()
this->p->view3D->reload_scene(false);
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(": update_background_process returns %1%")%state;
if (p->partplate_list.get_curr_plate()->is_apply_result_invalid()) {
if (!p->partplate_list.get_curr_plate()->can_slice()) {
p->process_completed_with_error = p->partplate_list.get_curr_plate_index();
BOOST_LOG_TRIVIAL(warning) << __FUNCTION__ << boost::format(": found invalidated apply in update_background_process.");
return -1;

View file

@ -378,6 +378,7 @@ public:
void select_all();
void deselect_all();
void exit_gizmo();
void remove(size_t obj_idx);
void reset(bool apply_presets_change = false);
void reset_with_confirm();

View file

@ -217,7 +217,7 @@ wxBoxSizer* PrintOptionsDialog::create_settings_group(wxWindow* parent)
// ai monitoring with levels
line_sizer = new wxBoxSizer(wxHORIZONTAL);
m_cb_ai_monitoring = new CheckBox(parent);
text_ai_monitoring = new wxStaticText(parent, wxID_ANY, _L("Enable AI monitoring of printing"));
text_ai_monitoring = new Label(parent, _L("Enable AI monitoring of printing"));
text_ai_monitoring->SetFont(Label::Body_14);
line_sizer->Add(FromDIP(5), 0, 0, 0);
line_sizer->Add(m_cb_ai_monitoring, 0, wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(5));
@ -227,7 +227,7 @@ wxBoxSizer* PrintOptionsDialog::create_settings_group(wxWindow* parent)
line_sizer->Add(FromDIP(5), 0, 0, 0);
line_sizer = new wxBoxSizer(wxHORIZONTAL);
text_ai_monitoring_caption = new wxStaticText(parent, wxID_ANY, _L("Sensitivity of pausing is"));
text_ai_monitoring_caption = new Label(parent, _L("Sensitivity of pausing is"));
text_ai_monitoring_caption->SetFont(Label::Body_14);
text_ai_monitoring_caption->SetForegroundColour(STATIC_TEXT_CAPTION_COL);
text_ai_monitoring_caption->Wrap(-1);
@ -255,7 +255,7 @@ wxBoxSizer* PrintOptionsDialog::create_settings_group(wxWindow* parent)
// detection of build plate position
line_sizer = new wxBoxSizer(wxHORIZONTAL);
m_cb_plate_mark = new CheckBox(parent);
text_plate_mark = new wxStaticText(parent, wxID_ANY, _L("Enable detection of build plate position"));
text_plate_mark = new Label(parent, _L("Enable detection of build plate position"));
text_plate_mark->SetFont(Label::Body_14);
line_sizer->Add(FromDIP(5), 0, 0, 0);
line_sizer->Add(m_cb_plate_mark, 0, wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(5));
@ -282,7 +282,7 @@ wxBoxSizer* PrintOptionsDialog::create_settings_group(wxWindow* parent)
// detection of first layer
line_sizer = new wxBoxSizer(wxHORIZONTAL);
m_cb_first_layer = new CheckBox(parent);
text_first_layer = new wxStaticText(parent, wxID_ANY, _L("First Layer Inspection"));
text_first_layer = new Label(parent, _L("First Layer Inspection"));
text_first_layer->SetFont(Label::Body_14);
line_sizer->Add(FromDIP(5), 0, 0, 0);
line_sizer->Add(m_cb_first_layer, 0, wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(5));
@ -298,7 +298,7 @@ wxBoxSizer* PrintOptionsDialog::create_settings_group(wxWindow* parent)
// auto-recovery from step loss
line_sizer = new wxBoxSizer(wxHORIZONTAL);
m_cb_auto_recovery = new CheckBox(parent);
text_auto_recovery = new wxStaticText(parent, wxID_ANY, _L("Auto-recovery from step loss"));
text_auto_recovery = new Label(parent, _L("Auto-recovery from step loss"));
text_auto_recovery->SetFont(Label::Body_14);
line_sizer->Add(FromDIP(5), 0, 0, 0);
line_sizer->Add(m_cb_auto_recovery, 0, wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(5));
@ -315,7 +315,7 @@ wxBoxSizer* PrintOptionsDialog::create_settings_group(wxWindow* parent)
//Allow prompt sound
line_sizer = new wxBoxSizer(wxHORIZONTAL);
m_cb_sup_sound = new CheckBox(parent);
text_sup_sound = new wxStaticText(parent, wxID_ANY, _L("Allow Prompt Sound"));
text_sup_sound = new Label(parent, _L("Allow Prompt Sound"));
text_sup_sound->SetFont(Label::Body_14);
line_sizer->Add(FromDIP(5), 0, 0, 0);
line_sizer->Add(m_cb_sup_sound, 0, wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(5));
@ -332,7 +332,7 @@ wxBoxSizer* PrintOptionsDialog::create_settings_group(wxWindow* parent)
//filament tangle detect
line_sizer = new wxBoxSizer(wxHORIZONTAL);
m_cb_filament_tangle = new CheckBox(parent);
text_filament_tangle = new wxStaticText(parent, wxID_ANY, _L("Filament Tangle Detect"));
text_filament_tangle = new Label(parent, _L("Filament Tangle Detect"));
text_filament_tangle->SetFont(Label::Body_14);
line_sizer->Add(FromDIP(5), 0, 0, 0);
line_sizer->Add(m_cb_filament_tangle, 0, wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(5));
@ -349,7 +349,7 @@ wxBoxSizer* PrintOptionsDialog::create_settings_group(wxWindow* parent)
//nozzle blob detect
line_sizer = new wxBoxSizer(wxHORIZONTAL);
m_cb_nozzle_blob = new CheckBox(parent);
text_nozzle_blob = new wxStaticText(parent, wxID_ANY, _L("Nozzle Clumping Detection"));
text_nozzle_blob = new Label(parent, _L("Nozzle Clumping Detection"));
text_nozzle_blob->SetFont(Label::Body_14);
line_sizer->Add(FromDIP(5), 0, 0, 0);
line_sizer->Add(m_cb_nozzle_blob, 0, wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(5));
@ -589,10 +589,17 @@ bool PrinterPartsDialog::Show(bool show)
nozzle_diameter_checkbox->Clear();
if (type.empty()) {
nozzle_type_checkbox->SetValue(wxEmptyString);
nozzle_diameter_checkbox->SetValue(wxEmptyString);
nozzle_type_checkbox->Disable();
nozzle_diameter_checkbox->Disable();
return DPIDialog::Show(show);
}
else {
nozzle_type_checkbox->Enable();
nozzle_diameter_checkbox->Enable();
}
last_nozzle_type = type;

View file

@ -50,17 +50,17 @@ protected:
CheckBox* m_cb_sup_sound;
CheckBox* m_cb_filament_tangle;
CheckBox* m_cb_nozzle_blob;
wxStaticText* text_first_layer;
wxStaticText* text_ai_monitoring;
wxStaticText* text_ai_monitoring_caption;
Label* text_first_layer;
Label* text_ai_monitoring;
Label* text_ai_monitoring_caption;
ComboBox* ai_monitoring_level_list;
wxStaticText* text_plate_mark;
wxStaticText* text_plate_mark_caption;
wxStaticText* text_auto_recovery;
wxStaticText* text_sup_sound;
wxStaticText* text_filament_tangle;
wxStaticText* text_nozzle_blob;
wxStaticText* text_nozzle_blob_caption;
Label* text_plate_mark;
Label* text_plate_mark_caption;
Label* text_auto_recovery;
Label* text_sup_sound;
Label* text_filament_tangle;
Label* text_nozzle_blob;
Label* text_nozzle_blob_caption;
StaticLine* line1;
StaticLine* line2;
StaticLine* line3;

View file

@ -46,7 +46,7 @@ static wxBitmap default_thumbnail;
static std::map<int, std::string> error_messages = {
{PrinterFileSystem::ERROR_PIPE, L("Reconnecting the printer, the operation cannot be completed immediately, please try again later.")},
{PrinterFileSystem::ERROR_RES_BUSY, L("Over 4 systems/handy are using remote access, you can close some and try again.")},
{PrinterFileSystem::ERROR_RES_BUSY, L("The device cannot handle more conversations. Please retry later.")},
{PrinterFileSystem::FILE_NO_EXIST, L("File does not exist.")},
{PrinterFileSystem::FILE_CHECK_ERR, L("File checksum error. Please retry.")},
{PrinterFileSystem::FILE_TYPE_ERR, L("Not supported on the current printer version.")},
@ -73,7 +73,7 @@ PrinterFileSystem::PrinterFileSystem()
wxString path = "D:\\work\\pic\\";
for (int i = 0; i < 10; ++i) {
auto name = wxString::Format(L"gcode-%02d.3mf", i + 1);
m_file_list.push_back({name.ToUTF8().data(), "", time.GetTicks(), 26937, i < 5 ? FF_DOWNLOAD : 0, default_thumbnail, i * 34 - 35});
m_file_list.push_back({name.ToUTF8().data(), "", time.GetTicks(), 26937, i < 5 ? FF_DOWNLOAD : 0, default_thumbnail});
std::ifstream ifs((path + name).ToUTF8().data(), std::ios::binary);
if (ifs)
ParseThumbnail(m_file_list.back(), ifs);
@ -84,7 +84,7 @@ PrinterFileSystem::PrinterFileSystem()
for (int i = 0; i < 100; ++i) {
auto name = wxString::Format(L"img-%03d.jpg", i + 1);
wxImage im(path + name);
m_file_list.push_back({name.ToUTF8().data(), "", time.GetTicks(), 26937, i < 20 ? FF_DOWNLOAD : 0, i > 3 ? im : default_thumbnail, i * 10 - 40 - 1});
m_file_list.push_back({name.ToUTF8().data(), "", time.GetTicks(), 26937, i < 20 ? FF_DOWNLOAD : 0, i > 3 ? im : default_thumbnail});
time.Add(wxDateSpan::Days(-1));
}
m_file_list[0].thumbnail = default_thumbnail;
@ -958,13 +958,13 @@ void PrinterFileSystem::FileRemoved(std::pair<FileType, std::string> type, size_
if (file_index.second == size_t(-1))
return;
if (&file_index.first == &m_file_list) {
auto removeFromGroup = [](std::vector<size_t> &group, size_t index, int total) {
auto removeFromGroup = [](std::vector<size_t> &group, size_t index, size_t total) {
for (auto iter = group.begin(); iter != group.end(); ++iter) {
size_t index2 = -1;
if (*iter < index) continue;
if (*iter == index) {
auto iter2 = iter + 1;
if (iter2 == group.end() ? index == total - 1 : *iter2 == index + 1) {
if (index + 1 == (iter2 == group.end() ? total : *iter2)) {
index2 = std::distance(group.begin(), iter);
}
++iter;
@ -978,11 +978,11 @@ void PrinterFileSystem::FileRemoved(std::pair<FileType, std::string> type, size_
};
size_t index2 = removeFromGroup(m_group_month, index, m_file_list.size());
if (index2 < m_group_month.size()) {
int index3 = removeFromGroup(m_group_year, index, m_group_month.size());
int index3 = removeFromGroup(m_group_year, index2, m_group_month.size());
if (index3 < m_group_year.size()) {
m_group_year.erase(m_group_year.begin() + index3);
if (m_group_mode == G_YEAR)
m_group_flags.erase(m_group_flags.begin() + index2);
m_group_flags.erase(m_group_flags.begin() + index3);
}
m_group_month.erase(m_group_month.begin() + index2);
if (m_group_mode == G_MONTH)
@ -1295,7 +1295,7 @@ void PrinterFileSystem::Reconnect(boost::unique_lock<boost::mutex> &l, int resul
}
wxLogMessage("PrinterFileSystem::Reconnect Failed");
m_status = Status::Failed;
SendChangedEvent(EVT_STATUS_CHANGED, m_status, "", url.size() < 2 ? 1 : 0);
SendChangedEvent(EVT_STATUS_CHANGED, m_status, "", url.size() < 2 ? 1 : m_last_error);
m_cond.timed_wait(l, boost::posix_time::seconds(10));
}
m_status = Status::ListSyncing;

View file

@ -322,7 +322,38 @@ void SendMultiMachinePage::prepare(int plate_idx)
void SendMultiMachinePage::on_dpi_changed(const wxRect& suggested_rect)
{
m_select_checkbox->Rescale();
m_printer_name->Rescale();
m_printer_name->SetMinSize(wxSize(FromDIP(SEND_LEFT_DEV_NAME), FromDIP(SEND_ITEM_MAX_HEIGHT)));
m_printer_name->SetMaxSize(wxSize(FromDIP(SEND_LEFT_DEV_NAME), FromDIP(SEND_ITEM_MAX_HEIGHT)));
m_device_status->Rescale();
m_device_status->SetMinSize(wxSize(FromDIP(SEND_LEFT_DEV_STATUS), FromDIP(SEND_ITEM_MAX_HEIGHT)));
m_device_status->SetMaxSize(wxSize(FromDIP(SEND_LEFT_DEV_STATUS), FromDIP(SEND_ITEM_MAX_HEIGHT)));
m_ams->Rescale();
m_ams->SetMinSize(wxSize(FromDIP(TASK_LEFT_SEND_TIME), FromDIP(SEND_ITEM_MAX_HEIGHT)));
m_ams->SetMaxSize(wxSize(FromDIP(TASK_LEFT_SEND_TIME), FromDIP(SEND_ITEM_MAX_HEIGHT)));
m_refresh_button->Rescale();
m_refresh_button->SetMinSize(wxSize(FromDIP(50), FromDIP(SEND_ITEM_MAX_HEIGHT)));
m_refresh_button->SetMaxSize(wxSize(FromDIP(50), FromDIP(SEND_ITEM_MAX_HEIGHT)));
m_rename_button->msw_rescale();
print_time->msw_rescale();
print_weight->msw_rescale();
timeimg->SetBitmap(print_time->bmp());
weightimg->SetBitmap(print_weight->bmp());
m_button_add->Rescale();
m_button_add->SetMinSize(wxSize(FromDIP(90), FromDIP(36)));
m_button_add->SetMaxSize(wxSize(FromDIP(90), FromDIP(36)));
m_button_send->Rescale();
m_button_send->SetMinSize(wxSize(FromDIP(120), FromDIP(40)));
m_button_send->SetMinSize(wxSize(FromDIP(120), FromDIP(40)));
for (auto it = m_device_items.begin(); it != m_device_items.end(); ++it) {
it->second->Refresh();
}
Fit();
Layout();
Refresh();
}
void SendMultiMachinePage::on_sys_color_changed()
@ -654,6 +685,13 @@ void SendMultiMachinePage::on_send(wxCommandEvent& event)
}
}
if (print_params.size() <= 0) {
MessageDialog msg_wingow(nullptr, _L("There is no device available to send printing."), "", wxICON_WARNING | wxOK);
msg_wingow.ShowModal();
return;
}
if (wxGetApp().getTaskManager()) {
TaskSettings settings;
@ -672,6 +710,15 @@ void SendMultiMachinePage::on_send(wxCommandEvent& event)
settings.sending_interval = std::stoi(app_config->get("sending_interval")) * 60;
settings.max_sending_at_same_time = std::stoi(app_config->get("max_send"));
if (settings.max_sending_at_same_time <= 0) {
MessageDialog msg_wingow(nullptr, _L("The number of printers in use simultaneously cannot be equal to 0."), "", wxICON_WARNING | wxOK);
msg_wingow.ShowModal();
return;
}
wxGetApp().getTaskManager()->start_print(print_params, &settings);
}
catch (...)
@ -943,15 +990,18 @@ wxPanel* SendMultiMachinePage::create_page()
m_title_sizer = new wxBoxSizer(wxHORIZONTAL);
m_rename_switch_panel = new wxSimplebook(m_title_panel);
m_rename_switch_panel->SetMinSize(wxSize(FromDIP(240), FromDIP(25)));
m_rename_switch_panel->SetMaxSize(wxSize(FromDIP(240), FromDIP(25)));
m_rename_normal_panel = new wxPanel(m_rename_switch_panel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL);
m_rename_normal_panel->SetBackgroundColour(*wxWHITE);
rename_sizer_v = new wxBoxSizer(wxVERTICAL);
rename_sizer_h = new wxBoxSizer(wxHORIZONTAL);
m_task_name = new wxStaticText(m_rename_normal_panel, wxID_ANY, wxT("MyLabel"), wxDefaultPosition, wxDefaultSize, wxST_ELLIPSIZE_END);
m_task_name = new wxStaticText(m_rename_normal_panel, wxID_ANY, wxT("MyLabel"), wxDefaultPosition, wxDefaultSize, wxST_ELLIPSIZE_END | wxALIGN_CENTRE);
m_task_name->SetFont(::Label::Body_13);
m_task_name->SetMaxSize(wxSize(FromDIP(390), -1));
m_task_name->SetMinSize(wxSize(FromDIP(200), -1));
m_task_name->SetMaxSize(wxSize(FromDIP(200), -1));
m_rename_button = new ScalableButton(m_rename_normal_panel, wxID_ANY, "ams_editable");
m_rename_button->SetBackgroundColour(*wxWHITE);
rename_sizer_h->Add(m_task_name, 0, wxALIGN_CENTER, 0);

View file

@ -144,8 +144,6 @@ private:
wxPanel* m_title_panel{ nullptr };
wxBoxSizer* m_title_sizer{ nullptr };
wxBoxSizer* m_text_sizer{ nullptr };
ScalableBitmap* m_print_time{ nullptr };
wxStaticBitmap* m_time_img{ nullptr };
wxStaticText* m_stext_time{ nullptr };
wxStaticText* m_stext_weight{ nullptr };
wxStaticBitmap* timeimg{ nullptr };

View file

@ -581,21 +581,18 @@ WipingPanel::WipingPanel(wxWindow* parent, const std::vector<float>& matrix, con
auto on_apply_text_modify = [this](wxEvent& e) {
wxString str = m_flush_multiplier_ebox->GetValue();
str.Replace(",", ".");
double multiplier = 1.f;
if (str.ToDouble(&multiplier)) {
if (multiplier < g_min_flush_multiplier || multiplier > g_max_flush_multiplier) {
str = wxString::Format(("%.2f"), multiplier < g_min_flush_multiplier ? g_min_flush_multiplier : g_max_flush_multiplier);
m_flush_multiplier_ebox->SetValue(str);
MessageDialog dlg(nullptr,
wxString::Format(_L("The multiplier should be in range [%.2f, %.2f]."), g_min_flush_multiplier, g_max_flush_multiplier),
_L("Warning"), wxICON_WARNING | wxOK);
dlg.ShowModal();
}
for (unsigned int i = 0; i < m_number_of_extruders; ++i) {
for (unsigned int j = 0; j < m_number_of_extruders; ++j) {
edit_boxes[i][j]->SetValue(to_string(int(m_matrix[m_number_of_extruders * j + i] * multiplier)));
}
float multiplier = wxAtof(str);
if (multiplier < g_min_flush_multiplier || multiplier > g_max_flush_multiplier) {
str = wxString::Format(("%.2f"), multiplier < g_min_flush_multiplier ? g_min_flush_multiplier : g_max_flush_multiplier);
m_flush_multiplier_ebox->SetValue(str);
MessageDialog dlg(nullptr,
wxString::Format(_L("The multiplier should be in range [%.2f, %.2f]."), g_min_flush_multiplier, g_max_flush_multiplier),
_L("Warning"), wxICON_WARNING | wxOK);
dlg.ShowModal();
}
for (unsigned int i = 0; i < m_number_of_extruders; ++i) {
for (unsigned int j = 0; j < m_number_of_extruders; ++j) {
edit_boxes[i][j]->SetValue(to_string(int(m_matrix[m_number_of_extruders * j + i] * multiplier)));
}
}
@ -610,9 +607,7 @@ WipingPanel::WipingPanel(wxWindow* parent, const std::vector<float>& matrix, con
param_sizer->Add(flush_multiplier_title, 0, wxALIGN_CENTER | wxALL, 0);
param_sizer->AddSpacer(FromDIP(5));
m_flush_multiplier_ebox = new wxTextCtrl(m_page_advanced, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(FromDIP(50), -1), wxTE_PROCESS_ENTER);
char flush_multi_str[32] = { 0 };
snprintf(flush_multi_str, sizeof(flush_multi_str), "%.2f", flush_multiplier);
m_flush_multiplier_ebox->SetValue(flush_multi_str);
m_flush_multiplier_ebox->SetValue(wxString::Format(("%.2f"), flush_multiplier));
m_flush_multiplier_ebox->SetValidator(wxTextValidator(wxFILTER_NUMERIC));
param_sizer->Add(m_flush_multiplier_ebox, 0, wxALIGN_CENTER | wxALL, 0);
param_sizer->AddStretchSpacer(1);
@ -622,13 +617,10 @@ WipingPanel::WipingPanel(wxWindow* parent, const std::vector<float>& matrix, con
m_flush_multiplier_ebox->Bind(wxEVT_KILL_FOCUS, on_apply_text_modify);
m_flush_multiplier_ebox->Bind(wxEVT_COMMAND_TEXT_UPDATED, [this](wxCommandEvent&) {
wxString str = m_flush_multiplier_ebox->GetValue();
str.Replace(",", ".");
double multiplier = 1.f;
if (str.ToDouble(&multiplier)) {
if (multiplier < g_min_flush_multiplier || multiplier > g_max_flush_multiplier) {
str = wxString::Format(("%.2f"), multiplier < g_min_flush_multiplier ? g_min_flush_multiplier : g_max_flush_multiplier);
m_flush_multiplier_ebox->SetValue(str);
}
float multiplier = wxAtof(str);
if (multiplier < g_min_flush_multiplier || multiplier > g_max_flush_multiplier) {
str = wxString::Format(("%.2f"), multiplier < g_min_flush_multiplier ? g_min_flush_multiplier : g_max_flush_multiplier);
m_flush_multiplier_ebox->SetValue(str);
}
m_flush_multiplier_ebox->SetInsertionPointEnd();
});

View file

@ -61,12 +61,7 @@ public:
if (m_flush_multiplier_ebox == nullptr)
return 1.f;
wxString str = m_flush_multiplier_ebox->GetValue();
str.Replace(",", ".");
double multiplier = 1.f;
str.ToDouble(&multiplier);
return multiplier;
return wxAtof(m_flush_multiplier_ebox->GetValue());
}
private:

View file

@ -58,6 +58,7 @@ wxMediaCtrl2::wxMediaCtrl2(wxWindow *parent)
void wxMediaCtrl2::Load(wxURI url)
{
#ifdef __WIN32__
InvalidateBestSize();
if (m_imp == nullptr) {
static bool notified = false;
if (!notified) CallAfter([] {