mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2026-02-08 09:10:55 -07:00
FIX: partskip button display bug && cavas update bug
Jira: [STUDIO-12687] Change-Id: Ibb42dab945be9b9b4b8b8ac8f2c268960d553325 (cherry picked from commit 15d8fb70c93d243a1592c050302e76867ed6582c)
This commit is contained in:
parent
17ed76a033
commit
1928add5a1
8 changed files with 303 additions and 98 deletions
26
resources/images/partskip_retry.svg
Normal file
26
resources/images/partskip_retry.svg
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
<svg width="200" height="200" viewBox="0 0 200 200" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<g clip-path="url(#clip0_1314_965)">
|
||||
<path d="M151.1 99.8C151.1 114 145.3 126.8 136 136C126.9 145.1 114.3 150.6 100.4 150.6C86.6002 150.6 74.0002 145 64.8002 136C55.5002 126.8 49.7002 114 49.7002 99.8C49.7002 71.7 72.4002 49 100.4 49C128.4 49 151.1 71.8 151.1 99.8Z" fill="#F7F7F7"/>
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M100.4 50C72.9538 50 50.7002 72.251 50.7002 99.8C50.7002 113.721 56.3845 126.267 65.5017 135.287C74.5247 144.113 86.8764 149.6 100.4 149.6C114.032 149.6 126.378 144.208 135.293 135.293L135.297 135.289C144.415 126.269 150.1 113.722 150.1 99.8C150.1 72.3497 127.845 50 100.4 50ZM48.7002 99.8C48.7002 71.149 71.8466 48 100.4 48C128.955 48 152.1 71.2503 152.1 99.8C152.1 114.278 146.186 127.33 136.705 136.71C127.42 145.993 114.568 151.6 100.4 151.6C86.3251 151.6 73.4777 145.888 64.1009 136.715L64.0969 136.711C54.6151 127.331 48.7002 114.278 48.7002 99.8Z" fill="#DBDBDB"/>
|
||||
<path d="M93.3692 54.2109L89.6083 67.4761L98.6108 73.7153L97.9777 88.9569L109.341 68.1032L104.063 63.8865L110.099 54.2109H116.875L137.375 76.5109L138.175 140.911C138.175 143.111 136.375 144.811 134.175 144.811H71.3751C69.175 144.811 67.375 143.011 67.375 140.911V58.111C67.375 55.9109 69.175 54.2109 71.3751 54.2109H93.3692Z" fill="white"/>
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M71.3751 55.2109C69.6939 55.2109 68.375 56.496 68.375 58.111V140.911C68.375 142.442 69.7108 143.811 71.3751 143.811H134.175C135.854 143.811 137.172 142.529 137.175 140.917C137.175 140.915 137.175 140.913 137.175 140.911L136.38 76.906L116.436 55.2109H110.654L105.382 63.6607L109.965 67.3219C110.344 67.6247 110.451 68.1558 110.219 68.5817L98.8558 89.4354C98.6334 89.8436 98.1589 90.0447 97.7108 89.9206C97.2627 89.7965 96.9593 89.38 96.9786 88.9154L97.5888 74.2237L89.0387 68.298C88.6874 68.0545 88.5297 67.6146 88.6463 67.2033L92.0463 55.2109H71.3751ZM66.375 58.111C66.375 55.3259 68.6561 53.2109 71.3751 53.2109H93.3692C93.6826 53.2109 93.9779 53.3579 94.1669 53.6079C94.3559 53.858 94.4168 54.1822 94.3313 54.4837L90.7654 67.0613L99.1804 72.8934C99.4621 73.0886 99.6241 73.4144 99.6099 73.7568L99.1551 84.706L108.061 68.3611L103.438 64.6677C103.042 64.351 102.946 63.7877 103.214 63.3572L109.25 53.6816C109.433 53.3889 109.754 53.2109 110.099 53.2109H116.875C117.155 53.2109 117.422 53.3282 117.611 53.5342L138.111 75.8342C138.278 76.0156 138.372 76.2521 138.375 76.4985L139.175 140.911C139.175 143.696 136.894 145.811 134.175 145.811H71.3751C68.6392 145.811 66.375 143.58 66.375 140.911V58.111Z" fill="#DBDBDB"/>
|
||||
<path d="M146.7 66.4998C148.964 66.4998 150.8 64.6642 150.8 62.3998C150.8 60.1354 148.964 58.2998 146.7 58.2998C144.435 58.2998 142.6 60.1354 142.6 62.3998C142.6 64.6642 144.435 66.4998 146.7 66.4998Z" fill="#EBEBEB"/>
|
||||
<path d="M152.7 50.4999C154.247 50.4999 155.5 49.2463 155.5 47.6999C155.5 46.1535 154.247 44.8999 152.7 44.8999C151.154 44.8999 149.9 46.1535 149.9 47.6999C149.9 49.2463 151.154 50.4999 152.7 50.4999Z" fill="#EBEBEB"/>
|
||||
<path d="M51.3 66.3998C52.8464 66.3998 54.1 65.1462 54.1 63.5998C54.1 62.0534 52.8464 60.7998 51.3 60.7998C49.7536 60.7998 48.5 62.0534 48.5 63.5998C48.5 65.1462 49.7536 66.3998 51.3 66.3998Z" fill="#EBEBEB"/>
|
||||
<path d="M34.2 120.4C37.0719 120.4 39.4 118.072 39.4 115.2C39.4 112.328 37.0719 110 34.2 110C31.3281 110 29 112.328 29 115.2C29 118.072 31.3281 120.4 34.2 120.4Z" fill="#EBEBEB"/>
|
||||
<path d="M89.2291 67.7108H77.1291C76.4291 67.7108 75.8291 67.1108 75.8291 66.4108C75.8291 65.7108 76.4291 65.1108 77.1291 65.1108H89.2291C89.9291 65.1108 90.5291 65.7108 90.5291 66.4108C90.5291 67.1108 89.9291 67.7108 89.2291 67.7108Z" fill="#DBDBDB"/>
|
||||
<path d="M88.7291 74.911H77.1291C76.4291 74.911 75.8291 74.311 75.8291 73.611C75.8291 72.911 76.4291 72.311 77.1291 72.311H88.6291C89.3291 72.311 89.9291 72.911 89.9291 73.611C89.9291 74.311 89.3291 74.911 88.7291 74.911Z" fill="#DBDBDB"/>
|
||||
<path d="M116.029 54.2109V72.0109C116.029 74.5109 118.229 76.5109 120.729 76.5109H136.529" fill="#DBDBDB"/>
|
||||
<path d="M89.9799 48.2657L86.1982 42.5732" stroke="#C2C2C2" stroke-width="2"/>
|
||||
<path d="M100.065 45.4195L100.51 31" stroke="#C2C2C2" stroke-width="2"/>
|
||||
<path d="M109.107 48.4L115.144 35.2974" stroke="#C2C2C2" stroke-width="2"/>
|
||||
<path d="M88.5713 120.379C88.1513 120.379 87.8152 120.211 87.4792 119.959C86.8911 119.371 86.8911 118.363 87.4792 117.775C91.3437 113.994 96.4685 111.894 101.929 111.894C107.39 111.894 112.515 113.994 116.38 117.775C116.968 118.363 116.968 119.371 116.38 119.959C115.791 120.547 114.783 120.547 114.195 119.959C110.919 116.682 106.55 114.918 101.929 114.918C97.3086 114.918 92.94 116.682 89.6635 119.959C89.3274 120.211 88.9914 120.379 88.5713 120.379Z" fill="#C2C2C2"/>
|
||||
<path d="M93.8641 97.8636L95.8804 95.8473C96.4685 95.2592 96.4685 94.2511 95.8804 93.663C95.2923 93.0749 94.2842 93.0749 93.6961 93.663L91.6798 95.6793L89.6635 93.663C89.0754 93.0749 88.0672 93.0749 87.4792 93.663C86.8911 94.2511 86.8911 95.2592 87.4792 95.8473L89.4955 97.8636L87.4792 99.8799C86.8911 100.468 86.8911 101.476 87.4792 102.064C87.8152 102.4 88.1513 102.484 88.5713 102.484C88.9914 102.484 89.3274 102.316 89.6635 102.064L91.6798 100.048L93.6961 102.064C94.0322 102.4 94.3682 102.484 94.7883 102.484C95.2083 102.484 95.5444 102.316 95.8804 102.064C96.4685 101.476 96.4685 100.468 95.8804 99.8799L93.8641 97.8636Z" fill="#C2C2C2"/>
|
||||
<path d="M114.279 97.8636L116.295 95.8473C116.884 95.2592 116.884 94.2511 116.295 93.663C115.707 93.0749 114.699 93.0749 114.111 93.663L112.095 95.6793L110.079 93.663C109.49 93.0749 108.482 93.0749 107.894 93.663C107.306 94.2511 107.306 95.2592 107.894 95.8473L109.91 97.8636L107.894 99.8799C107.306 100.468 107.306 101.476 107.894 102.064C108.23 102.4 108.566 102.484 108.986 102.484C109.406 102.484 109.742 102.316 110.079 102.064L112.095 100.048L114.111 102.064C114.447 102.4 114.783 102.484 115.203 102.484C115.623 102.484 115.959 102.316 116.295 102.064C116.884 101.476 116.884 100.468 116.295 99.8799L114.279 97.8636Z" fill="#C2C2C2"/>
|
||||
</g>
|
||||
<defs>
|
||||
<clipPath id="clip0_1314_965">
|
||||
<rect width="200" height="160" fill="white" transform="translate(0 20)"/>
|
||||
</clipPath>
|
||||
</defs>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 6 KiB |
4
resources/images/print_control_partskip_hover.svg
Normal file
4
resources/images/print_control_partskip_hover.svg
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M7.47995 16.1333H4.89662V18.7167H7.47995V16.1333ZM4.89662 15.1C4.62256 15.1 4.35973 15.2089 4.16594 15.4027C3.97215 15.5964 3.86328 15.8593 3.86328 16.1333V18.7167C3.86328 18.9907 3.97215 19.2536 4.16594 19.4473C4.35973 19.6411 4.62256 19.75 4.89662 19.75H7.47995C7.75401 19.75 8.01684 19.6411 8.21063 19.4473C8.40441 19.2536 8.51328 18.9907 8.51328 18.7167V16.1333C8.51328 15.8593 8.40441 15.5964 8.21063 15.4027C8.01684 15.2089 7.75401 15.1 7.47995 15.1H4.89662ZM13.68 16.1333H11.0966V18.7167H13.68V16.1333ZM11.0966 15.1C10.8226 15.1 10.5597 15.2089 10.3659 15.4027C10.1722 15.5964 10.0633 15.8593 10.0633 16.1333V18.7167C10.0633 18.9907 10.1722 19.2536 10.3659 19.4473C10.5597 19.6411 10.8226 19.75 11.0966 19.75H13.68C13.954 19.75 14.2168 19.6411 14.4106 19.4473C14.6044 19.2536 14.7133 18.9907 14.7133 18.7167V16.1333C14.7133 15.8593 14.6044 15.5964 14.4106 15.4027C14.2168 15.2089 13.954 15.1 13.68 15.1H11.0966ZM19.88 16.1333H17.2966V18.7167H19.88V16.1333ZM17.2966 15.1C17.0226 15.1 16.7597 15.2089 16.5659 15.4027C16.3722 15.5964 16.2633 15.8593 16.2633 16.1333V18.7167C16.2633 18.9907 16.3722 19.2536 16.5659 19.4473C16.7597 19.6411 17.0226 19.75 17.2966 19.75H19.88C20.154 19.75 20.4168 19.6411 20.6106 19.4473C20.8044 19.2536 20.9133 18.9907 20.9133 18.7167V16.1333C20.9133 15.8593 20.8044 15.5964 20.6106 15.4027C20.4168 15.2089 20.154 15.1 19.88 15.1H17.2966ZM6.56752 8.1188C5.34198 9.4549 4.69925 11.038 4.63725 12.0486C4.62437 12.254 4.53042 12.4458 4.37607 12.582C4.22172 12.7181 4.01961 12.7874 3.8142 12.7745C3.6088 12.7616 3.41692 12.6677 3.28078 12.5133C3.14465 12.3589 3.0754 12.1568 3.08828 11.9514C3.17818 10.5151 4.01208 8.60963 5.42362 7.071C6.85582 5.51067 8.95038 4.25 11.6133 4.25C14.2721 4.25 16.4038 5.50757 17.8546 7.06687C19.2817 8.60033 20.1383 10.5244 20.1383 12H18.5883C18.5883 11.0287 17.9683 9.4642 16.72 8.12293C15.4955 6.80647 13.7523 5.8 11.6133 5.8C9.47842 5.8 7.77445 6.80233 6.56752 8.1188Z" fill="#262E30"/>
|
||||
<path d="M20.9133 12H14.7133L20.9133 5.79999V12Z" fill="#262E30"/>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 2.1 KiB |
|
|
@ -230,11 +230,13 @@ PartSkipDialog::PartSkipDialog(wxWindow* parent): DPIDialog(parent, wxID_ANY, _L
|
|||
m_book_second_sizer = new wxBoxSizer( wxVERTICAL );
|
||||
m_book_second_btn_sizer = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
m_retry_label = new Label( m_book_second_panel, _L("Load Skipping Objects Information Failed. \nPlease try again."));
|
||||
m_retry_bitmap = new wxStaticBitmap(m_book_second_panel, -1, create_scaled_bitmap("partskip_retry", m_book_second_panel, 200), wxDefaultPosition, wxDefaultSize);
|
||||
m_retry_label = new Label( m_book_second_panel, _L("Load skipping objects information failed. Please try again."));
|
||||
m_retry_label->Wrap( -1 );
|
||||
m_retry_label->SetBackgroundColour(*wxWHITE);
|
||||
m_book_second_sizer->Add(0, 0, 1, wxEXPAND, 0);
|
||||
m_book_second_sizer->Add(m_retry_label, 0, wxALIGN_CENTER_VERTICAL | wxALIGN_CENTER_HORIZONTAL, 0);
|
||||
m_book_second_sizer->Add(m_retry_bitmap, 0, wxALIGN_CENTER_HORIZONTAL, 0);
|
||||
m_book_second_sizer->Add(m_retry_label, 0, wxALIGN_CENTER_HORIZONTAL, 0);
|
||||
m_book_second_sizer->Add(0, 0, 1, wxEXPAND, 0);
|
||||
|
||||
m_second_retry_btn = new Button(m_book_second_panel, _L("Retry"));
|
||||
|
|
@ -305,6 +307,7 @@ void PartSkipDialog::on_dpi_changed(const wxRect& suggested_rect) {
|
|||
m_canvas->LoadPickImage(m_local_paths[0]);
|
||||
|
||||
m_loading_icon->SetMinSize(wxSize(FromDIP(25), FromDIP(25)));
|
||||
m_retry_bitmap->SetBitmap(create_scaled_bitmap("partskip_retry", m_book_second_panel, 200));
|
||||
|
||||
m_percent_label->SetMinSize(wxSize(FromDIP(56), FromDIP(28)));
|
||||
m_percent_label->SetMaxSize(wxSize(FromDIP(56), FromDIP(28)));
|
||||
|
|
@ -426,8 +429,10 @@ void PartSkipDialog::DownloadPartsFile()
|
|||
m_file_sys->Bind(EVT_STATUS_CHANGED, &PartSkipDialog::OnFileSystemEvent, this);
|
||||
m_file_sys->Bind(EVT_RAMDOWNLOAD, &PartSkipDialog::OnFileSystemResult, this);
|
||||
m_file_sys->Start();
|
||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ <<"part skip: print file system start.";
|
||||
}else{
|
||||
m_file_sys->Retry();
|
||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ <<"part skip: print file system retry.";
|
||||
}
|
||||
} else {
|
||||
m_file_sys->SendExistedFile();
|
||||
|
|
@ -526,8 +531,10 @@ void PartSkipDialog::OnFileSystemEvent(wxCommandEvent &e)
|
|||
if( m_url_state == URL_TCP){
|
||||
m_url_state = URL_TUTK;
|
||||
m_file_sys->Retry();
|
||||
BOOST_LOG_TRIVIAL(info) << "part skip: print file system connnect failed first.";
|
||||
}else{
|
||||
m_file_sys->SendConnectFail();
|
||||
BOOST_LOG_TRIVIAL(info) << "part skip: print file system connnect failed second.";
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
@ -538,6 +545,7 @@ void PartSkipDialog::OnFileSystemEvent(wxCommandEvent &e)
|
|||
boost::shared_ptr fs(wfs.lock());
|
||||
if (!fs) return;
|
||||
fetchUrl(boost::weak_ptr(fs));
|
||||
BOOST_LOG_TRIVIAL(info) << "part skip: fetch url, get parts info files from printer.";
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -550,10 +558,12 @@ void PartSkipDialog::OnFileSystemResult(wxCommandEvent &event){
|
|||
InitDialogUI();
|
||||
SetSimplebookPage(2);
|
||||
m_file_sys->Stop();
|
||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ <<"part skip: on file system result success.";
|
||||
}else{
|
||||
m_url_state = URL_TCP;
|
||||
SetSimplebookPage(1);
|
||||
m_file_sys->Stop();
|
||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ <<"part skip: on file system result failed.";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -670,6 +680,7 @@ bool PartSkipDialog::Show(bool show)
|
|||
|
||||
void PartSkipDialog::InitDialogUI() {
|
||||
m_print_lock = true;
|
||||
BOOST_LOG_TRIVIAL(info) << "part skip: lock parts info from printer.";
|
||||
m_scroll_sizer->Clear(true);
|
||||
m_all_checkbox->SetValue(false);
|
||||
m_parts_state.clear();
|
||||
|
|
@ -684,11 +695,15 @@ void PartSkipDialog::InitDialogUI() {
|
|||
m_canvas->SwitchDrag(false);
|
||||
m_canvas->SetZoomPercent(100);
|
||||
m_canvas->SetOffset(wxPoint(0, 0));
|
||||
|
||||
BOOST_LOG_TRIVIAL(info) << "part skip: load canvas pick image begin.";
|
||||
m_canvas->LoadPickImage(pick_img);
|
||||
BOOST_LOG_TRIVIAL(info) << "part skip: load canvas pick image end.";
|
||||
ModelSettingHelper helper(slice_info);
|
||||
|
||||
if (helper.Parse()) {
|
||||
auto parse_result = helper.GetResults();
|
||||
int plate_idx = m_obj ? m_obj->m_plate_index : 0;
|
||||
auto parse_result = helper.GetPlates()[plate_idx - 1].objects;
|
||||
for (const auto& part : parse_result) {
|
||||
m_parts_state[part.identify_id] = part.state;
|
||||
m_parts_name[part.identify_id] = part.name;
|
||||
|
|
@ -741,31 +756,42 @@ void PartSkipDialog::InitDialogUI() {
|
|||
m_scroll_sizer->Add(line_sizer, 0, wxBOTTOM | wxEXPAND, FromDIP(12));
|
||||
}
|
||||
m_canvas->UpdatePartsInfo(GetPartsInfo());
|
||||
BOOST_LOG_TRIVIAL(info) << "part skip: update canvas parts info.";
|
||||
}
|
||||
|
||||
m_scroll_sizer->Layout();
|
||||
UpdateCountLabel();
|
||||
Refresh();
|
||||
m_print_lock = false;
|
||||
BOOST_LOG_TRIVIAL(info) << "part skip: unlock parts info from printer.";
|
||||
}
|
||||
|
||||
void PartSkipDialog::UpdatePartsStateFromPrinter(MachineObject *obj) {
|
||||
if (m_print_lock) return;
|
||||
if (m_print_lock) {
|
||||
BOOST_LOG_TRIVIAL(info) << "part skip: parts info from printer is locked.";
|
||||
return;
|
||||
}
|
||||
m_obj = obj;
|
||||
if (m_obj) {
|
||||
bool update_flag = false;
|
||||
std::vector<int> partskip_ids = m_obj->m_partskip_ids;
|
||||
for(auto part_id : partskip_ids) {
|
||||
m_parts_state[part_id] = PartState::psSkipped;
|
||||
if(m_parts_state[part_id] != PartState::psSkipped){
|
||||
m_parts_state[part_id] = PartState::psSkipped;
|
||||
update_flag = true;
|
||||
}
|
||||
}
|
||||
if(update_flag){
|
||||
m_canvas->UpdatePartsInfo(GetPartsInfo());
|
||||
UpdateDialogUI();
|
||||
}
|
||||
m_canvas->UpdatePartsInfo(GetPartsInfo());
|
||||
UpdateDialogUI();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void PartSkipDialog::UpdateDialogUI(){
|
||||
if(m_parts_state.size() != m_scroll_sizer->GetItemCount()){
|
||||
BOOST_LOG_TRIVIAL(warning) << "m_parts_state and m_scroll_sizer mismatch.";
|
||||
BOOST_LOG_TRIVIAL(warning) << "part skip: m_parts_state and m_scroll_sizer mismatch.";
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -839,30 +865,47 @@ void PartSkipDialog::OnApplyDialog(wxCommandEvent &event)
|
|||
m_partskip_ids.push_back(part_id);
|
||||
}
|
||||
}
|
||||
|
||||
bool all_skipped = true;
|
||||
for (auto [part_id, part_state] : m_parts_state) {
|
||||
if (part_state == PartState::psUnCheck) all_skipped = false;
|
||||
}
|
||||
|
||||
PartSkipConfirmDialog confirm_dialog(this);
|
||||
confirm_dialog.SetMsgLabel(wxString::Format(_L("Skipping %d objects."), m_partskip_ids.size()));
|
||||
if (all_skipped){
|
||||
confirm_dialog.SetMsgLabel(_L("Skipping all objects."));
|
||||
confirm_dialog.SetTipLabel(_L("The printing job will be stopped. Continue?"));
|
||||
}else{
|
||||
confirm_dialog.SetMsgLabel(wxString::Format(_L("Skipping %d objects."), m_partskip_ids.size()));
|
||||
confirm_dialog.SetTipLabel(_L("This action cannot be undone. Continue?"));
|
||||
}
|
||||
|
||||
if(confirm_dialog.ShowModal() == wxID_OK){
|
||||
if (m_obj) {
|
||||
BOOST_LOG_TRIVIAL(info) << "monitor: skipping "<< m_partskip_ids.size() <<" objects.";
|
||||
|
||||
bool all_skipped = true;
|
||||
for (auto [part_id, part_state] : m_parts_state) {
|
||||
if (part_state == PartState::psUnCheck) all_skipped = false;
|
||||
}
|
||||
BOOST_LOG_TRIVIAL(info) << "part skip: skipping "<< m_partskip_ids.size() <<" objects.";
|
||||
|
||||
if (all_skipped) {
|
||||
m_obj->command_task_abort();
|
||||
BOOST_LOG_TRIVIAL(info) << "part skip: command skip all parts, abort task.";
|
||||
} else {
|
||||
m_obj->command_task_partskip(m_partskip_ids);
|
||||
BOOST_LOG_TRIVIAL(info) << "part skip: command skip " << m_partskip_ids.size() << " parts.";
|
||||
}
|
||||
EndModal(wxID_OK);
|
||||
} else {
|
||||
BOOST_LOG_TRIVIAL(warning) << "machine object is null.";
|
||||
BOOST_LOG_TRIVIAL(warning) << "part skip: machine object is null.";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int PartSkipDialog::GetAllSkippedPartsNum() {
|
||||
int skipped_cnt = 0;
|
||||
for (auto& [part_id, part_state] : m_parts_state) {
|
||||
if (part_state == PartState::psSkipped || part_state == PartState::psChecked)
|
||||
skipped_cnt++;
|
||||
}
|
||||
return skipped_cnt;
|
||||
}
|
||||
|
||||
PartSkipConfirmDialog::PartSkipConfirmDialog(wxWindow *parent) : DPIDialog(parent, wxID_ANY, _L("Skip Objects"), wxDefaultPosition, wxDefaultSize, wxCAPTION | wxCLOSE_BOX)
|
||||
{
|
||||
|
|
@ -886,9 +929,7 @@ PartSkipConfirmDialog::PartSkipConfirmDialog(wxWindow *parent) : DPIDialog(paren
|
|||
m_msg_label->Wrap( -1 );
|
||||
m_msg_label->SetBackgroundColour(*wxWHITE);
|
||||
|
||||
|
||||
|
||||
auto m_tip_label = new Label(this, _L("This action cannot be undone. Continue?"));
|
||||
m_tip_label = new Label(this, _L("This action cannot be undone. Continue?"));
|
||||
m_tip_label->Wrap(-1);
|
||||
m_tip_label->SetBackgroundColour(*wxWHITE);
|
||||
m_tip_label->SetForegroundColour(wxColor(92,92,92));
|
||||
|
|
@ -965,6 +1006,10 @@ void PartSkipConfirmDialog::SetMsgLabel(wxString msg){
|
|||
m_msg_label->SetLabel(msg);
|
||||
}
|
||||
|
||||
void PartSkipConfirmDialog::SetTipLabel(wxString msg){
|
||||
m_tip_label->SetLabel(msg);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
} // namespace Slic3r::GUI
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@ class PartSkipConfirmDialog : public DPIDialog
|
|||
private:
|
||||
protected:
|
||||
Label *m_msg_label;
|
||||
Label *m_tip_label;
|
||||
Button *m_apply_button;
|
||||
|
||||
public:
|
||||
|
|
@ -48,6 +49,7 @@ public:
|
|||
void on_dpi_changed(const wxRect &suggested_rect);
|
||||
Button* GetConfirmButton();
|
||||
void SetMsgLabel(wxString msg);
|
||||
void SetTipLabel(wxString msg);
|
||||
bool Show(bool show);
|
||||
};
|
||||
|
||||
|
|
@ -63,7 +65,7 @@ public:
|
|||
void SetSimplebookPage(int page);
|
||||
void InitSchedule(MachineObject *obj_);
|
||||
void InitDialogUI();
|
||||
|
||||
int GetAllSkippedPartsNum();
|
||||
|
||||
MachineObject *m_obj{nullptr};
|
||||
|
||||
|
|
@ -91,6 +93,8 @@ public:
|
|||
|
||||
Label* m_loading_label;
|
||||
Label* m_retry_label;
|
||||
ScalableBitmap* m_retry_icon;
|
||||
wxStaticBitmap* m_retry_bitmap;
|
||||
|
||||
wxBoxSizer* m_sizer;
|
||||
wxBoxSizer* m_dlg_sizer;
|
||||
|
|
|
|||
|
|
@ -32,9 +32,47 @@ SkipPartCanvas::SkipPartCanvas(wxWindow *parent, const wxGLAttributes& dispAttrs
|
|||
|
||||
void SkipPartCanvas::LoadPickImage(const std::string & path)
|
||||
{
|
||||
auto ParseShapeId = [](cv::Mat image, const std::vector<std::vector<cv::Point>> &contours, const std::vector<cv::Vec4i> &hierarchy, int root_idx) -> uint32_t {
|
||||
cv::Mat mask = cv::Mat::zeros(image.size(), CV_8UC1);
|
||||
|
||||
cv::drawContours(mask, contours, root_idx, 255, cv::FILLED);
|
||||
|
||||
int child = hierarchy[root_idx][2];
|
||||
while (child != -1) {
|
||||
cv::drawContours(mask, contours, child, 0, cv::FILLED);
|
||||
child = hierarchy[child][0];
|
||||
}
|
||||
std::vector<cv::Vec3b> pixels;
|
||||
for (int y = 0; y < image.rows; ++y) {
|
||||
for (int x = 0; x < image.cols; ++x) {
|
||||
if (mask.at<uchar>(y, x)) { pixels.push_back(image.at<cv::Vec3b>(y, x)); }
|
||||
}
|
||||
}
|
||||
|
||||
std::map<cv::Vec3b, int, std::function<bool(const cv::Vec3b &, const cv::Vec3b &)>> colorCount(
|
||||
[](const cv::Vec3b &a, const cv::Vec3b &b) { return std::lexicographical_compare(a.val, a.val + 3, b.val, b.val + 3); });
|
||||
|
||||
for (auto &c : pixels) colorCount[c]++;
|
||||
|
||||
cv::Vec3b main_color;
|
||||
int max_count = 0;
|
||||
int total_count = 0;
|
||||
for (const auto &kv : colorCount) {
|
||||
if (kv.second > max_count) {
|
||||
max_count = kv.second;
|
||||
main_color = kv.first;
|
||||
}
|
||||
total_count += kv.second;
|
||||
}
|
||||
|
||||
SkipIdHelper helper{main_color[2], main_color[1], main_color[0]};
|
||||
helper.reverse();
|
||||
return (max_count * 2 > total_count) ? helper.value : 0;
|
||||
};
|
||||
|
||||
parts_state_.clear();
|
||||
pick_parts_.clear();
|
||||
parts_triangles_.clear();
|
||||
pick_parts_.clear();
|
||||
int preffered_w{FromDIP(400)}, preffered_h{FromDIP(400)};
|
||||
cv::Mat src_image = cv::imread(path, cv::IMREAD_UNCHANGED);
|
||||
cv::cvtColor(src_image, src_image, cv::COLOR_BGRA2BGR); // remove alpha
|
||||
|
|
@ -52,35 +90,64 @@ void SkipPartCanvas::LoadPickImage(const std::string & path)
|
|||
cv::Mat mask; // convery to binary
|
||||
cv::threshold(gray, mask, 0, 255, cv::THRESH_BINARY);
|
||||
std::vector<std::vector<cv::Point>> pick_counters;
|
||||
cv::findContours(mask, pick_counters, cv::RETR_EXTERNAL, cv::CHAIN_APPROX_TC89_KCOS);
|
||||
std::vector<std::vector<FloatPoint>> polygon;
|
||||
for (const auto& counter : pick_counters) {
|
||||
cv::Point center_pos{0,0};
|
||||
for (const auto& pt : counter) {
|
||||
center_pos += pt;
|
||||
std::vector<cv::Vec4i> hierarchy;
|
||||
cv::findContours(mask, pick_counters, hierarchy, cv::RETR_TREE, cv::CHAIN_APPROX_TC89_KCOS);
|
||||
auto compute_depth = [&](int idx) {
|
||||
int depth = 0;
|
||||
while (hierarchy[idx][3] != -1) {
|
||||
depth++;
|
||||
idx = hierarchy[idx][3];
|
||||
}
|
||||
center_pos = center_pos / static_cast<int>(counter.size());
|
||||
auto id = GetIdAtImagePt(wxPoint(center_pos.x, center_pos.y));
|
||||
return depth;
|
||||
};
|
||||
for (int i = 0; i < pick_counters.size(); ++i) {
|
||||
int depth = compute_depth(i);
|
||||
int parent = hierarchy[i][3];
|
||||
if (parent != -1) continue;
|
||||
|
||||
auto id = ParseShapeId(pick_image_, pick_counters, hierarchy, i);
|
||||
if (id > 0) {
|
||||
polygon.clear();
|
||||
polygon.emplace_back(std::vector<FloatPoint>{});
|
||||
for (const auto& pt : counter) {
|
||||
polygon[0].push_back(FloatPoint{pt.x * 1.0f, pt.y * 1.0f});
|
||||
std::vector<FloatPoint> flat_points;
|
||||
std::vector<std::vector<FloatPoint>> polygon;
|
||||
|
||||
// part body
|
||||
{
|
||||
polygon.emplace_back();
|
||||
for (const auto &pt : pick_counters[i]) {
|
||||
FloatPoint fp{pt.x * 1.0f, pt.y * 1.0f};
|
||||
polygon.back().push_back(fp);
|
||||
flat_points.push_back(fp);
|
||||
}
|
||||
int child = hierarchy[i][2];
|
||||
while (child != -1) {
|
||||
polygon.emplace_back();
|
||||
for (const auto &pt : pick_counters[child]) {
|
||||
FloatPoint fp{pt.x * 1.0f, pt.y * 1.0f};
|
||||
polygon.back().push_back(fp);
|
||||
flat_points.push_back(fp);
|
||||
}
|
||||
child = hierarchy[child][0];
|
||||
}
|
||||
std::vector<uint32_t> indices = mapbox::earcut<uint32_t>(polygon);
|
||||
std::vector<FloatPoint> final_counter;
|
||||
for (size_t j = 0; j < indices.size(); j += 3) {
|
||||
final_counter.push_back(flat_points[indices[j]]);
|
||||
final_counter.push_back(flat_points[indices[j + 1]]);
|
||||
final_counter.push_back(flat_points[indices[j + 2]]);
|
||||
}
|
||||
|
||||
parts_triangles_[id].emplace_back(final_counter);
|
||||
}
|
||||
std::vector<uint32_t> indices = mapbox::earcut<uint32_t>(polygon);
|
||||
std::vector<FloatPoint> final_counter{};
|
||||
for (size_t i = 0; i < indices.size(); i += 3) {
|
||||
FloatPoint a = polygon[0][indices[i]];
|
||||
FloatPoint b = polygon[0][indices[i+1]];
|
||||
FloatPoint c = polygon[0][indices[i+2]];
|
||||
final_counter.push_back(FloatPoint{a[0], a[1]});
|
||||
final_counter.push_back(FloatPoint{b[0], b[1]});
|
||||
final_counter.push_back(FloatPoint{c[0], c[1]});
|
||||
// part outlines
|
||||
{
|
||||
pick_parts_[id].emplace_back(pick_counters[i]);
|
||||
int child = hierarchy[i][2];
|
||||
while (child != -1) {
|
||||
pick_parts_[id].emplace_back(pick_counters[child]);
|
||||
child = hierarchy[child][0];
|
||||
}
|
||||
}
|
||||
parts_triangles_.emplace(id, final_counter);
|
||||
pick_parts_.emplace(id, counter);
|
||||
if (parts_state_.find(id) == parts_state_.end())
|
||||
parts_state_.emplace(id, psUnCheck);
|
||||
if (parts_state_.find(id) == parts_state_.end()) parts_state_.emplace(id, psUnCheck);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -220,13 +287,15 @@ void SkipPartCanvas::Render()
|
|||
if (part_info == parts_state_.end() || part_info->second != part_type)
|
||||
continue;
|
||||
glColor3f(1, 1, 1);
|
||||
glBegin(GL_TRIANGLES);
|
||||
for (size_t i = 0; i < contour.second.size(); i += 3) {
|
||||
glVertex2f(contour.second[i][0], contour.second[i][1]);
|
||||
glVertex2f(contour.second[i+1][0], contour.second[i+1][1]);
|
||||
glVertex2f(contour.second[i+2][0], contour.second[i+2][1]);
|
||||
for (const auto &contour_item : contour.second) {
|
||||
glBegin(GL_TRIANGLES);
|
||||
for (size_t i = 0; i < contour_item.size(); i += 3) {
|
||||
glVertex2f(contour_item[i][0], contour_item[i][1]);
|
||||
glVertex2f(contour_item[i + 1][0], contour_item[i + 1][1]);
|
||||
glVertex2f(contour_item[i + 2][0], contour_item[i + 2][1]);
|
||||
}
|
||||
glEnd();
|
||||
}
|
||||
glEnd();
|
||||
}
|
||||
|
||||
for (const auto& contour : pick_parts_) {
|
||||
|
|
@ -237,11 +306,11 @@ void SkipPartCanvas::Render()
|
|||
|
||||
glColor3f(rgb.r(), rgb.g(), rgb.b());
|
||||
glLineWidth(border_w);
|
||||
glBegin(GL_LINE_LOOP);
|
||||
for (const auto& pt : contour.second) {
|
||||
glVertex2f(pt.x, pt.y);
|
||||
for (const auto &contour_item : contour.second) {
|
||||
glBegin(GL_LINE_LOOP);
|
||||
for (const auto &pt : contour_item) { glVertex2f(pt.x, pt.y); }
|
||||
glEnd();
|
||||
}
|
||||
glEnd();
|
||||
}
|
||||
};
|
||||
// draw unchecked shapes
|
||||
|
|
@ -277,11 +346,11 @@ void SkipPartCanvas::Render()
|
|||
continue;
|
||||
glColor3f(bound.r(), bound.g(), bound.b());
|
||||
glLineWidth(border_w);
|
||||
glBegin(GL_LINE_LOOP);
|
||||
for (const auto& pt : contour.second) {
|
||||
glVertex2f(pt.x, pt.y);
|
||||
for (const auto &contour_item : contour.second) {
|
||||
glBegin(GL_LINE_LOOP);
|
||||
for (const auto &pt : contour_item) { glVertex2f(pt.x, pt.y); }
|
||||
glEnd();
|
||||
}
|
||||
glEnd();
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -559,29 +628,41 @@ bool ModelSettingHelper::Parse()
|
|||
return true;
|
||||
}
|
||||
|
||||
std::vector<ObjectInfo> ModelSettingHelper::GetResults() {
|
||||
return context_.objects;
|
||||
}
|
||||
|
||||
void XMLCALL ModelSettingHelper::StartElementHandler(void *userData, const XML_Char *name, const XML_Char **atts)
|
||||
{
|
||||
ModelSettingHelper* self = static_cast<ModelSettingHelper*>(userData);
|
||||
if (strcmp(name, "object") == 0) {
|
||||
ModelSettingHelper *self = static_cast<ModelSettingHelper *>(userData);
|
||||
if (strcmp(name, "plate") == 0) {
|
||||
self->context_.current_plate = PlateInfo(); // start a new plate
|
||||
self->context_.in_plate = true;
|
||||
} else if (strcmp(name, "metadata") == 0 && self->context_.in_plate) {
|
||||
std::string key, value;
|
||||
for (int i = 0; atts[i]; i += 2) {
|
||||
if (strcmp(atts[i], "identify_id") == 0) { self->context_.temp_object.identify_id = atoi(atts[i + 1]); }
|
||||
if (strcmp(atts[i], "name") == 0) { self->context_.temp_object.name = std::string(atts[i + 1]); }
|
||||
if (strcmp(atts[i], "key") == 0) key = atts[i + 1];
|
||||
if (strcmp(atts[i], "value") == 0) value = atts[i + 1];
|
||||
}
|
||||
if (key == "index") { self->context_.current_plate.index = std::stoi(value); }
|
||||
} else if (strcmp(name, "object") == 0 && self->context_.in_plate) {
|
||||
ObjectInfo obj;
|
||||
for (int i = 0; atts[i]; i += 2) {
|
||||
if (strcmp(atts[i], "identify_id") == 0) obj.identify_id = atoi(atts[i + 1]);
|
||||
if (strcmp(atts[i], "name") == 0) obj.name = atts[i + 1];
|
||||
}
|
||||
self->context_.current_plate.objects.push_back(obj);
|
||||
}
|
||||
}
|
||||
|
||||
void XMLCALL ModelSettingHelper::EndElementHandler(void *userData, const XML_Char *name)
|
||||
{
|
||||
ModelSettingHelper* self = static_cast<ModelSettingHelper*>(userData);
|
||||
if (strcmp(name, "object") == 0) {
|
||||
self->context_.objects.push_back(self->context_.temp_object);
|
||||
ModelSettingHelper *self = static_cast<ModelSettingHelper *>(userData);
|
||||
if (strcmp(name, "plate") == 0 && self->context_.in_plate) {
|
||||
self->context_.plates.push_back(self->context_.current_plate);
|
||||
self->context_.current_plate = PlateInfo(); // reset
|
||||
self->context_.in_plate = false;
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<PlateInfo> ModelSettingHelper::GetPlates() { return context_.plates; }
|
||||
|
||||
void ModelSettingHelper::DataHandler(const XML_Char *s, int len)
|
||||
{
|
||||
// do nothing
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@
|
|||
#include <opencv2/opencv.hpp>
|
||||
#include <wx/textctrl.h>
|
||||
#include <vector>
|
||||
#include <stack>
|
||||
#include <expat.h>
|
||||
#include <libslic3r/Color.hpp>
|
||||
#include <boost/thread/mutex.hpp>
|
||||
|
|
@ -85,8 +84,8 @@ protected:
|
|||
private:
|
||||
wxGLContext* context_;
|
||||
cv::Mat pick_image_;
|
||||
std::unordered_map<uint32_t, std::vector<FloatPoint>> parts_triangles_;
|
||||
std::unordered_map<uint32_t, std::vector<cv::Point>> pick_parts_;
|
||||
std::unordered_map < uint32_t, std::vector<std::vector<FloatPoint>>> parts_triangles_;
|
||||
std::unordered_map < uint32_t, std::vector<std::vector<cv::Point>>> pick_parts_;
|
||||
std::unordered_map<uint32_t, PartState> parts_state_;
|
||||
bool gl_inited_{false};
|
||||
int zoom_percent_{100};
|
||||
|
|
@ -131,25 +130,35 @@ public:
|
|||
void log_errors();
|
||||
};
|
||||
|
||||
class ModelSettingHelper : public _BBS_3MF_Base {
|
||||
struct ParseContext{
|
||||
std::vector<ObjectInfo> objects;
|
||||
ObjectInfo temp_object;
|
||||
struct PlateInfo
|
||||
{
|
||||
int index{-1};
|
||||
std::vector<ObjectInfo> objects;
|
||||
};
|
||||
|
||||
class ModelSettingHelper : public _BBS_3MF_Base
|
||||
{
|
||||
struct ParseContext
|
||||
{
|
||||
std::vector<PlateInfo> plates;
|
||||
PlateInfo current_plate;
|
||||
ObjectInfo temp_object;
|
||||
bool in_plate = false;
|
||||
};
|
||||
|
||||
public:
|
||||
ModelSettingHelper(const std::string& path);
|
||||
ModelSettingHelper(const std::string &path);
|
||||
|
||||
bool Parse();
|
||||
std::vector<PlateInfo> GetPlates();
|
||||
|
||||
bool Parse();
|
||||
std::vector<ObjectInfo> GetResults();
|
||||
private:
|
||||
std::string path_;
|
||||
std::string path_;
|
||||
ParseContext context_;
|
||||
|
||||
void static XMLCALL StartElementHandler(void* userData, const XML_Char* name, const XML_Char** atts);
|
||||
void static XMLCALL EndElementHandler(void* userData, const XML_Char* name);
|
||||
void DataHandler(const XML_Char* s, int len);
|
||||
static void XMLCALL StartElementHandler(void *userData, const XML_Char *name, const XML_Char **atts);
|
||||
static void XMLCALL EndElementHandler(void *userData, const XML_Char *name);
|
||||
void DataHandler(const XML_Char *s, int len);
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -269,7 +269,8 @@ void PrintingTaskPanel::create_panel(wxWindow* parent)
|
|||
StateColor white_bg(std::pair<wxColour, int>(wxColour(255, 255, 255), StateColor::Disabled), std::pair<wxColour, int>(wxColour(255, 255, 255), StateColor::Pressed),
|
||||
std::pair<wxColour, int>(wxColour(255, 255, 255), StateColor::Hovered), std::pair<wxColour, int>(wxColour(255, 255, 255), StateColor::Enabled),
|
||||
std::pair<wxColour, int>(wxColour(255, 255, 255), StateColor::Normal));
|
||||
m_button_partskip = new Button(progress_lr_panel, "");
|
||||
|
||||
m_button_partskip = new Button(progress_lr_panel, wxEmptyString, "print_control_partskip_disable", 0, 20, wxID_ANY);
|
||||
m_button_partskip->Enable(false);
|
||||
m_button_partskip->Hide();
|
||||
m_button_partskip->SetBackgroundColor(white_bg);
|
||||
|
|
@ -278,7 +279,7 @@ void PrintingTaskPanel::create_panel(wxWindow* parent)
|
|||
m_button_partskip->SetFont(Label::Body_12);
|
||||
m_button_partskip->SetCornerRadius(0);
|
||||
m_button_partskip->SetToolTip(_L("Parts Skip"));
|
||||
m_button_partskip->Bind(wxEVT_ENTER_WINDOW, [this](auto &e) { m_button_partskip->SetIcon("print_control_partskip"); });
|
||||
m_button_partskip->Bind(wxEVT_ENTER_WINDOW, [this](auto &e) { m_button_partskip->SetIcon("print_control_partskip_hover"); });
|
||||
m_button_partskip->Bind(wxEVT_LEAVE_WINDOW, [this](auto &e) { m_button_partskip->SetIcon("print_control_partskip"); });
|
||||
|
||||
m_button_pause_resume = new ScalableButton(progress_lr_panel, wxID_ANY, "print_control_pause", wxEmptyString, wxDefaultSize, wxDefaultPosition, wxBU_EXACTFIT | wxNO_BORDER,true);
|
||||
|
|
@ -648,15 +649,13 @@ void PrintingTaskPanel::update_machine_object(MachineObject* obj){
|
|||
|
||||
void PrintingTaskPanel::enable_partskip_button(bool enable)
|
||||
{
|
||||
if(m_obj){
|
||||
if( m_obj->is_support_partskip ){
|
||||
m_button_partskip->Show();
|
||||
}else{
|
||||
m_button_partskip->Hide();
|
||||
}
|
||||
int stage = 0;
|
||||
bool in_calibration_mode = false;
|
||||
if( m_obj && (m_obj->print_type == "system" || CalibUtils::get_calib_mode_by_name(m_obj->subtask_name, stage) != CalibMode::Calib_None)){
|
||||
in_calibration_mode = true;
|
||||
}
|
||||
|
||||
if (!enable) {
|
||||
if (!enable || in_calibration_mode) {
|
||||
m_button_partskip->Enable(false);
|
||||
m_button_partskip->SetLabel("");
|
||||
m_button_partskip->SetIcon("print_control_partskip_disable");
|
||||
|
|
@ -1971,6 +1970,19 @@ void StatusPanel::on_market_retry(wxCommandEvent &event)
|
|||
}
|
||||
}
|
||||
|
||||
void StatusPanel::update_partskip_button(MachineObject *obj) {
|
||||
if (!obj) return;
|
||||
|
||||
m_project_task_panel->update_machine_object(obj);
|
||||
auto partskip_button = m_project_task_panel->get_partskip_button();
|
||||
if( obj->is_support_partskip ){
|
||||
partskip_button->Show();
|
||||
}else{
|
||||
partskip_button->Hide();
|
||||
}
|
||||
BOOST_LOG_TRIVIAL(info) << "part skip: is_support_partskip: "<< obj->is_support_partskip;
|
||||
}
|
||||
|
||||
void StatusPanel::on_subtask_partskip(wxCommandEvent &event)
|
||||
{
|
||||
if (m_partskip_dlg == nullptr) {
|
||||
|
|
@ -1979,7 +1991,13 @@ void StatusPanel::on_subtask_partskip(wxCommandEvent &event)
|
|||
|
||||
auto dm = GUI::wxGetApp().getDeviceManager();
|
||||
m_partskip_dlg->InitSchedule(dm->get_selected_machine());
|
||||
m_partskip_dlg->ShowModal();
|
||||
BOOST_LOG_TRIVIAL(info) << "part skip: initial part skip dialog.";
|
||||
if(m_partskip_dlg->ShowModal() == wxID_OK){
|
||||
int cnt = m_partskip_dlg->GetAllSkippedPartsNum();
|
||||
m_project_task_panel->set_part_skipped_count(cnt);
|
||||
m_project_task_panel->set_part_skipped_dirty(5);
|
||||
BOOST_LOG_TRIVIAL(info) << "part skip: prepare to filter printer dirty data.";
|
||||
}
|
||||
}
|
||||
|
||||
void StatusPanel::on_subtask_pause_resume(wxCommandEvent &event)
|
||||
|
|
@ -3126,6 +3144,7 @@ void StatusPanel::update_subtask(MachineObject *obj)
|
|||
}
|
||||
|
||||
update_model_info();
|
||||
update_partskip_button(obj);
|
||||
|
||||
if (obj->is_system_printing()
|
||||
|| obj->is_in_calibration()) {
|
||||
|
|
@ -3267,11 +3286,17 @@ void StatusPanel::update_partskip_subtask(MachineObject *obj){
|
|||
if (!obj) return;
|
||||
if (!obj->subtask_) return;
|
||||
|
||||
m_project_task_panel->update_machine_object(obj);
|
||||
|
||||
auto partskip_button = m_project_task_panel->get_partskip_button();
|
||||
if (partskip_button) {
|
||||
int part_cnt = obj->m_partskip_ids.size();
|
||||
int part_cnt = 0;
|
||||
if(m_project_task_panel->get_part_skipped_dirty() > 0){
|
||||
m_project_task_panel->set_part_skipped_dirty(m_project_task_panel->get_part_skipped_dirty() - 1);
|
||||
part_cnt = m_project_task_panel->get_part_skipped_count();
|
||||
BOOST_LOG_TRIVIAL(info) << "part skip: stop recv printer dirty data.";
|
||||
}else{
|
||||
part_cnt = obj->m_partskip_ids.size();
|
||||
BOOST_LOG_TRIVIAL(info) << "part skip: recv printer normal data.";
|
||||
}
|
||||
if (part_cnt > 0)
|
||||
partskip_button->SetLabel(wxString::Format(_L("(%d)"), part_cnt));
|
||||
else
|
||||
|
|
|
|||
|
|
@ -205,6 +205,10 @@ private:
|
|||
std::vector<ScalableButton *> m_score_star;
|
||||
bool m_star_count_dirty = false;
|
||||
|
||||
// partskip button
|
||||
int m_part_skipped_count{ 0 };
|
||||
int m_part_skipped_dirty{ 0 };
|
||||
|
||||
ProgressBar* m_gauge_progress;
|
||||
Label* m_error_text;
|
||||
PrintingTaskType m_type;
|
||||
|
|
@ -251,6 +255,10 @@ public:
|
|||
std::vector<ScalableButton *> &get_score_star() { return m_score_star; }
|
||||
bool get_star_count_dirty() { return m_star_count_dirty; }
|
||||
void set_star_count_dirty(bool dirty) { m_star_count_dirty = dirty; }
|
||||
int get_part_skipped_count() { return m_part_skipped_count; }
|
||||
void set_part_skipped_count(int count) { m_part_skipped_count = count; }
|
||||
int get_part_skipped_dirty() { return m_part_skipped_dirty; }
|
||||
void set_part_skipped_dirty(int dirty) { m_part_skipped_dirty = dirty; }
|
||||
void set_has_reted_text(bool has_rated);
|
||||
void paint(wxPaintEvent&);
|
||||
};
|
||||
|
|
@ -631,6 +639,9 @@ protected:
|
|||
void update_camera_state(MachineObject* obj);
|
||||
bool show_vcamera = false;
|
||||
|
||||
// partskip button
|
||||
void update_partskip_button(MachineObject* obj);
|
||||
|
||||
public:
|
||||
void update_error_message();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue