FIX: [MAK-2011 MAK-1988] Fix synchronization issues

Jira: MAK-2011 MAK-1988

Change-Id: I411bd185c8cb9f314b74ca91ad5fa303562ed4e3
This commit is contained in:
maosheng.wei 2023-09-18 18:09:11 +08:00 committed by Lane.Wei
parent f2396b839c
commit cb45ffc73a
5 changed files with 52 additions and 16 deletions

View file

@ -1,6 +1,6 @@
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M4 6C4 5.44772 4.44772 5 5 5H19C19.5523 5 20 5.44772 20 6V18C20 18.5523 19.5523 19 19 19H5C4.44772 19 4 18.5523 4 18V6Z" fill="#BBBBBB"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M3.5 6C3.5 5.17157 4.17157 4.5 5 4.5H19C19.8284 4.5 20.5 5.17157 20.5 6V18C20.5 18.8284 19.8284 19.5 19 19.5H5C4.17157 19.5 3.5 18.8284 3.5 18V6ZM5 5.5C4.72386 5.5 4.5 5.72386 4.5 6V18C4.5 18.2761 4.72386 18.5 5 18.5H19C19.2761 18.5 19.5 18.2761 19.5 18V6C19.5 5.72386 19.2761 5.5 19 5.5H5Z" fill="#AAAAAA"/>
<path d="M4 6C4 5.44772 4.44772 5 5 5H19C19.5523 5 20 5.44772 20 6V18C20 18.5523 19.5523 19 19 19H5C4.44772 19 4 18.5523 4 18V6Z" fill="#595959"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M3.5 6C3.5 5.17157 4.17157 4.5 5 4.5H19C19.8284 4.5 20.5 5.17157 20.5 6V18C20.5 18.8284 19.8284 19.5 19 19.5H5C4.17157 19.5 3.5 18.8284 3.5 18V6ZM5 5.5C4.72386 5.5 4.5 5.72386 4.5 6V18C4.5 18.2761 4.72386 18.5 5 18.5H19C19.2761 18.5 19.5 18.2761 19.5 18V6C19.5 5.72386 19.2761 5.5 19 5.5H5Z" fill="#353535"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M13.7306 10.7569L13.6702 10.839L10.785 15.3585L9.11563 12.7417C9.08006 12.686 9.03769 12.6355 8.98968 12.5916L8.91359 12.5306C8.60675 12.3169 8.20115 12.3785 7.96379 12.6596L7.90343 12.7417L5.62234 16.3167C5.54257 16.4418 5.5 16.5887 5.5 16.7389C5.5 17.1269 5.77789 17.4471 6.13706 17.4941L6.22844 17.5H17.7715C17.9153 17.5 18.0559 17.4555 18.1755 17.3722C18.4824 17.1584 18.584 16.7436 18.4269 16.4065L18.3776 16.3167L14.8824 10.839C14.8291 10.7554 14.7604 10.6836 14.6804 10.6279C14.3736 10.4142 13.968 10.4758 13.7306 10.7569Z" fill="#F8F8F8"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M8.5 7C7.67157 7 7 7.67157 7 8.5C7 9.32843 7.67157 10 8.5 10C9.32843 10 10 9.32843 10 8.5C10 7.67157 9.32843 7 8.5 7Z" fill="#F8F8F8"/>
</svg>

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.4 KiB

View file

@ -0,0 +1,6 @@
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M4 6C4 5.44772 4.44772 5 5 5H19C19.5523 5 20 5.44772 20 6V18C20 18.5523 19.5523 19 19 19H5C4.44772 19 4 18.5523 4 18V6Z" fill="white" fill-opacity="0.24"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M3.5 6C3.5 5.17157 4.17157 4.5 5 4.5H19C19.8284 4.5 20.5 5.17157 20.5 6V18C20.5 18.8284 19.8284 19.5 19 19.5H5C4.17157 19.5 3.5 18.8284 3.5 18V6ZM5 5.5C4.72386 5.5 4.5 5.72386 4.5 6V18C4.5 18.2761 4.72386 18.5 5 18.5H19C19.2761 18.5 19.5 18.2761 19.5 18V6C19.5 5.72386 19.2761 5.5 19 5.5H5Z" fill="white" fill-opacity="0.4"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M13.7306 10.7569L13.6702 10.839L10.785 15.3585L9.11563 12.7417C9.08006 12.686 9.03769 12.6355 8.98968 12.5916L8.91359 12.5306C8.60675 12.3169 8.20115 12.3785 7.96379 12.6596L7.90343 12.7417L5.62234 16.3167C5.54257 16.4418 5.5 16.5887 5.5 16.7389C5.5 17.1269 5.77789 17.4471 6.13706 17.4941L6.22844 17.5H17.7715C17.9153 17.5 18.0559 17.4555 18.1755 17.3722C18.4824 17.1584 18.584 16.7436 18.4269 16.4065L18.3776 16.3167L14.8824 10.839C14.8291 10.7554 14.7604 10.6836 14.6804 10.6279C14.3736 10.4142 13.968 10.4758 13.7306 10.7569Z" fill="white" fill-opacity="0.4"/>
<path fill-rule="evenodd" clip-rule="evenodd" d="M8.5 7C7.67157 7 7 7.67157 7 8.5C7 9.32843 7.67157 10 8.5 10C9.32843 10 10 9.32843 10 8.5C10 7.67157 9.32843 7 8.5 7Z" fill="white" fill-opacity="0.4"/>
</svg>

After

Width:  |  Height:  |  Size: 1.4 KiB

View file

@ -4328,7 +4328,7 @@ int MachineObject::parse_json(std::string payload)
if (it->contains("confidence")) {
flow_ratio_calib_result.confidence = (*it)["confidence"].get<int>();
} else {
flow_ratio_calib_result.confidence = 0;
flow_ratio_calib_result.confidence = 0;
}
flow_ratio_results.push_back(flow_ratio_calib_result);

View file

@ -442,9 +442,14 @@ void PrintingTaskPanel::create_panel(wxWindow* parent)
m_score_subtask_info->SetBackgroundColour(*wxWHITE);
wxBoxSizer * static_score_sizer = new wxBoxSizer(wxVERTICAL);
wxStaticText *static_score_text = new wxStaticText(m_score_subtask_info, wxID_ANY, "How do you like this printing file?", wxDefaultPosition, wxDefaultSize, 0);
wxStaticText *static_score_text = new wxStaticText(m_score_subtask_info, wxID_ANY, _L("How do you like this printing file?"), wxDefaultPosition, wxDefaultSize, 0);
static_score_text->Wrap(-1);
static_score_sizer->Add(static_score_text, 1, wxEXPAND | wxALL, FromDIP(10));
m_has_rated_prompt = new wxStaticText(m_score_subtask_info, wxID_ANY, _L("(The model has already been rated. Your rating will overwrite the previous rating.)"), wxDefaultPosition, wxDefaultSize, 0);
m_has_rated_prompt->Wrap(-1);
m_has_rated_prompt->SetForegroundColour(*wxRED);
m_has_rated_prompt->SetFont(::Label::Body_10);
m_has_rated_prompt->Hide();
m_star_count = 0;
wxBoxSizer *static_score_star_sizer = new wxBoxSizer(wxHORIZONTAL);
@ -475,7 +480,7 @@ void PrintingTaskPanel::create_panel(wxWindow* parent)
std::pair<wxColour, int>(wxColour(61, 203, 115), StateColor::Hovered), std::pair<wxColour, int>(AMS_CONTROL_BRAND_COLOUR, StateColor::Normal));
StateColor btn_bd_green(std::pair<wxColour, int>(AMS_CONTROL_WHITE_COLOUR, StateColor::Disabled), std::pair<wxColour, int>(AMS_CONTROL_BRAND_COLOUR, StateColor::Enabled));
m_button_market_scoring = new Button(m_score_subtask_info, _L("Rating"));
m_button_market_scoring = new Button(m_score_subtask_info, _L("Rate"));
m_button_market_scoring->SetBackgroundColor(btn_bg_green);
m_button_market_scoring->SetBorderColor(btn_bd_green);
m_button_market_scoring->SetTextColor(wxColour("#FFFFFE"));
@ -487,6 +492,7 @@ void PrintingTaskPanel::create_panel(wxWindow* parent)
static_score_star_sizer->Add(0, 0, 1, wxEXPAND, 0);
static_score_star_sizer->Add(m_button_market_scoring, 0, wxEXPAND | wxRIGHT, FromDIP(10));
static_score_sizer->Add(static_score_star_sizer, 0, wxEXPAND, FromDIP(10));
static_score_sizer->Add(m_has_rated_prompt, 1, wxEXPAND | wxALL, FromDIP(10));
m_score_subtask_info->SetSizer(static_score_sizer);
m_score_subtask_info->Layout();
@ -507,6 +513,17 @@ void PrintingTaskPanel::create_panel(wxWindow* parent)
parent->Fit();
}
void PrintingTaskPanel::set_has_reted_text(bool has_rated)
{
if (has_rated) {
m_has_rated_prompt->Show();
} else {
m_has_rated_prompt->Hide();
}
Layout();
Fit();
}
void PrintingTaskPanel::msw_rescale()
{
m_panel_printing_title->SetSize(wxSize(-1, FromDIP(PAGE_TITLE_HEIGHT)));
@ -1700,6 +1717,8 @@ void StatusPanel::on_market_scoring(wxCommandEvent &event) {
if (ret == wxID_OK) {
m_score_data->rating_id = -1;
m_project_task_panel->set_star_count_dirty(false);
m_print_finish = false;
return;
}
if (m_score_data != nullptr) {
@ -1736,7 +1755,8 @@ void StatusPanel::on_market_scoring(wxCommandEvent &event) {
if (ret == wxID_OK) {
m_score_data->rating_id = -1;
m_project_task_panel->set_star_count_dirty(false);
m_print_finish = false;
return;
}
if (m_score_data != nullptr) {
@ -2817,7 +2837,12 @@ void StatusPanel::update_subtask(MachineObject *obj)
BOOST_LOG_TRIVIAL(info) << "Initialize scores";
m_project_task_panel->set_star_count_dirty(true);
m_print_finish = true;
if (0 != star_count) { m_project_task_panel->get_market_scoring_button()->Enable(true); }
if (0 != star_count) {
m_project_task_panel->get_market_scoring_button()->Enable(true);
m_project_task_panel->set_has_reted_text(true);
} else {
m_project_task_panel->set_has_reted_text(false);
}
}
}
}
@ -2888,7 +2913,10 @@ bool StatusPanel::model_score_is_update()
m_last_result = m_rating_result;
return true;
}
} catch (...) {}
} catch (...) {
BOOST_LOG_TRIVIAL(info) << "m_last_result first initial";
m_last_result = m_rating_result;
}
return false;
}
@ -4308,12 +4336,12 @@ wxBoxSizer* ScoreDialog::get_comment_text_sizer() {
void ScoreDialog::create_comment_text(const wxString& comment) {
m_comment_text = new wxTextCtrl(this, wxID_ANY, "", wxDefaultPosition, wxSize(FromDIP(492), FromDIP(104)), wxTE_MULTILINE);
if (wxGetApp().dark_mode()) {
m_comment_text->SetForegroundColour(wxColor(*wxWHITE));
} else
m_comment_text->SetForegroundColour(wxColor(*wxBLACK));
if (!comment.empty()) {
m_comment_text->SetValue(comment);
if (wxGetApp().dark_mode()) {
m_comment_text->SetForegroundColour(wxColor(*wxWHITE));
} else
m_comment_text->SetForegroundColour(wxColor(*wxBLACK));
}
m_comment_text->SetHint(_L("Rate this print"));
m_comment_text->SetBackgroundColour(*wxWHITE);
@ -4332,18 +4360,18 @@ void ScoreDialog::create_comment_text(const wxString& comment) {
wxBoxSizer *ScoreDialog::get_photo_btn_sizer() {
wxBoxSizer * m_photo_sizer = new wxBoxSizer(wxHORIZONTAL);
ScalableBitmap little_photo = ScalableBitmap(this, "single_little_photo", 20);
wxStaticBitmap *little_photo_img = new wxStaticBitmap(this, wxID_ANY, little_photo.bmp(), wxDefaultPosition, wxSize(FromDIP(20), FromDIP(20)), 0);
ScalableBitmap little_photo = wxGetApp().dark_mode() ? ScalableBitmap(this, "single_little_photo_dark", 20) : ScalableBitmap(this, "single_little_photo", 20);
wxStaticBitmap *little_photo_img = new wxStaticBitmap(this, wxID_ANY, little_photo.bmp(), wxDefaultPosition, wxSize(FromDIP(20), FromDIP(20)), 0);
m_photo_sizer->Add(little_photo_img, 0, wxEXPAND | wxLEFT, FromDIP(24));
m_add_photo = new Label(this, _L("Add Photo"));
m_add_photo->SetBackgroundColour(*wxWHITE);
m_add_photo->SetForegroundColour(wxColor("#898989"));
//m_add_photo->SetForegroundColour(wxColor("#898989"));
m_add_photo->SetSize(wxSize(-1, FromDIP(20)));
m_photo_sizer->Add(m_add_photo, 0, wxEXPAND | wxLEFT, FromDIP(12));
m_delete_photo = new Label(this, _L("Delete Photo"));
m_delete_photo->SetBackgroundColour(*wxWHITE);
m_delete_photo->SetForegroundColour(wxColor("#898989"));
//m_delete_photo->SetForegroundColour(wxColor("#898989"));
m_delete_photo->SetSize(wxSize(-1, FromDIP(20)));
m_photo_sizer->Add(m_delete_photo, 0, wxEXPAND | wxLEFT, FromDIP(12));
m_delete_photo->Hide();

View file

@ -179,6 +179,7 @@ private:
wxStaticText* m_staticText_progress_percent_icon;
wxStaticText* m_staticText_progress_left;
wxStaticText* m_staticText_layers;
wxStaticText * m_has_rated_prompt;
wxStaticBitmap* m_bitmap_thumbnail;
wxStaticBitmap* m_bitmap_static_use_time;
wxStaticBitmap* m_bitmap_static_use_weight;
@ -230,6 +231,7 @@ 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; }
void set_has_reted_text(bool has_rated);
};