mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-05-16 18:12:10 +00:00
ENH: page faults when device page idle
jira: [none] Change-Id: I4dc95ae6332b81e571fb5ef09c75dcf01e77170e (cherry picked from commit cefe973772c7f7045713470d61cc85221574d9c5)
This commit is contained in:
@@ -1004,7 +1004,7 @@ void PrintingTaskPanel::show_error_msg(wxString msg)
|
||||
|
||||
void PrintingTaskPanel::reset_printing_value()
|
||||
{
|
||||
this->set_thumbnail_img(m_thumbnail_placeholder.bmp());
|
||||
this->set_thumbnail_img(m_thumbnail_placeholder.bmp(), m_thumbnail_placeholder.name());
|
||||
this->set_plate_index(-1);
|
||||
}
|
||||
|
||||
@@ -1182,8 +1182,15 @@ void PrintingTaskPanel::show_profile_info(bool show, wxString profile /*= wxEmpt
|
||||
}
|
||||
}
|
||||
|
||||
void PrintingTaskPanel::set_thumbnail_img(const wxBitmap& bmp)
|
||||
// the API will buff the bmp and bmp_name
|
||||
// when bmp_name is empty, the API will replace the image on force
|
||||
void PrintingTaskPanel::set_thumbnail_img(const wxBitmap& bmp, const std::string& bmp_name)
|
||||
{
|
||||
if (!bmp_name.empty() && m_thumbnail_bmp_display_name == bmp_name) {
|
||||
return;
|
||||
}
|
||||
|
||||
m_thumbnail_bmp_display_name = bmp_name;
|
||||
m_thumbnail_bmp_display = bmp;
|
||||
Refresh();
|
||||
}
|
||||
@@ -2156,7 +2163,6 @@ void StatusBasePanel::show_ams_group(bool show)
|
||||
m_ams_control->Fit();
|
||||
Layout();
|
||||
Fit();
|
||||
wxGetApp().mainframe->m_monitor->get_status_panel()->Layout();
|
||||
wxGetApp().mainframe->m_monitor->Layout();
|
||||
}
|
||||
|
||||
@@ -2166,7 +2172,6 @@ void StatusBasePanel::show_ams_group(bool show)
|
||||
m_ams_control->Fit();
|
||||
Layout();
|
||||
Fit();
|
||||
wxGetApp().mainframe->m_monitor->get_status_panel()->Layout();
|
||||
wxGetApp().mainframe->m_monitor->Layout();
|
||||
}
|
||||
}
|
||||
@@ -2217,6 +2222,7 @@ void StatusPanel::update_camera_state(MachineObject* obj)
|
||||
m_bitmap_sdcard_img->SetToolTip(_L("Storage"));
|
||||
}
|
||||
m_last_sdcard = sdcard_state;
|
||||
m_panel_monitoring_title->Layout();
|
||||
}
|
||||
|
||||
//recording
|
||||
@@ -2229,8 +2235,11 @@ void StatusPanel::update_camera_state(MachineObject* obj)
|
||||
}
|
||||
m_last_recording = obj->is_recording() ? 1 : 0;
|
||||
}
|
||||
if (!m_bitmap_recording_img->IsShown())
|
||||
|
||||
if (!m_bitmap_recording_img->IsShown()) {
|
||||
m_bitmap_recording_img->Show();
|
||||
m_panel_monitoring_title->Layout();
|
||||
}
|
||||
|
||||
/*if (m_bitmap_recording_img->IsShown())
|
||||
m_bitmap_recording_img->Hide();*/
|
||||
@@ -2245,11 +2254,16 @@ void StatusPanel::update_camera_state(MachineObject* obj)
|
||||
}
|
||||
m_last_timelapse = obj->is_timelapse() ? 1 : 0;
|
||||
}
|
||||
if (!m_bitmap_timelapse_img->IsShown())
|
||||
|
||||
if (!m_bitmap_timelapse_img->IsShown()) {
|
||||
m_bitmap_timelapse_img->Show();
|
||||
m_panel_monitoring_title->Layout();
|
||||
}
|
||||
} else {
|
||||
if (m_bitmap_timelapse_img->IsShown())
|
||||
if (m_bitmap_timelapse_img->IsShown()) {
|
||||
m_bitmap_timelapse_img->Hide();
|
||||
m_panel_monitoring_title->Layout();
|
||||
}
|
||||
}
|
||||
|
||||
//vcamera
|
||||
@@ -2262,11 +2276,16 @@ void StatusPanel::update_camera_state(MachineObject* obj)
|
||||
}
|
||||
m_last_vcamera = m_media_play_ctrl->IsStreaming() ? 1 : 0;
|
||||
}
|
||||
if (!m_bitmap_vcamera_img->IsShown())
|
||||
|
||||
if (!m_bitmap_vcamera_img->IsShown()) {
|
||||
m_bitmap_vcamera_img->Show();
|
||||
m_panel_monitoring_title->Layout();
|
||||
}
|
||||
} else {
|
||||
if (m_bitmap_vcamera_img->IsShown())
|
||||
if (m_bitmap_vcamera_img->IsShown()) {
|
||||
m_bitmap_vcamera_img->Hide();
|
||||
m_panel_monitoring_title->Layout();
|
||||
}
|
||||
}
|
||||
|
||||
//camera setting
|
||||
@@ -2274,8 +2293,6 @@ void StatusPanel::update_camera_state(MachineObject* obj)
|
||||
bool show_vcamera = m_media_play_ctrl->IsStreaming();
|
||||
m_camera_popup->update(show_vcamera);
|
||||
}
|
||||
|
||||
m_panel_monitoring_title->Layout();
|
||||
}
|
||||
|
||||
StatusPanel::StatusPanel(wxWindow *parent, wxWindowID id, const wxPoint &pos, const wxSize &size, long style, const wxString &name)
|
||||
@@ -2614,7 +2631,7 @@ void StatusPanel::on_webrequest_state(wxWebRequestEvent &evt)
|
||||
wxImage img(*evt.GetResponse().GetStream());
|
||||
img_list.insert(std::make_pair(m_request_url, img));
|
||||
wxImage resize_img = img.Scale(m_project_task_panel->get_bitmap_thumbnail()->GetSize().x, m_project_task_panel->get_bitmap_thumbnail()->GetSize().y, wxIMAGE_QUALITY_HIGH);
|
||||
m_project_task_panel->set_thumbnail_img(resize_img);
|
||||
m_project_task_panel->set_thumbnail_img(resize_img, "");
|
||||
m_project_task_panel->set_brightness_value(get_brightness_value(resize_img));
|
||||
}
|
||||
if (obj) {
|
||||
@@ -2628,7 +2645,7 @@ void StatusPanel::on_webrequest_state(wxWebRequestEvent &evt)
|
||||
case wxWebRequest::State_Failed:
|
||||
case wxWebRequest::State_Cancelled:
|
||||
case wxWebRequest::State_Unauthorized: {
|
||||
m_project_task_panel->set_thumbnail_img(m_thumbnail_brokenimg.bmp());
|
||||
m_project_task_panel->set_thumbnail_img(m_thumbnail_brokenimg.bmp(), m_thumbnail_brokenimg.name());
|
||||
m_project_task_panel->set_plate_index(-1);
|
||||
task_thumbnail_state = ThumbnailState::BROKEN_IMG;
|
||||
break;
|
||||
@@ -2787,7 +2804,6 @@ void StatusPanel::update(MachineObject *obj)
|
||||
|
||||
if (m_panel_control_title) {
|
||||
m_panel_control_title->Layout();
|
||||
m_panel_control_title->Refresh();
|
||||
}
|
||||
|
||||
if (!obj->dev_connection_type.empty()) {
|
||||
@@ -3620,7 +3636,7 @@ void StatusPanel::update_subtask(MachineObject *obj)
|
||||
}
|
||||
}
|
||||
if (calib_bitmap != nullptr)
|
||||
m_project_task_panel->set_thumbnail_img(*calib_bitmap);
|
||||
m_project_task_panel->set_thumbnail_img(*calib_bitmap, "");
|
||||
}
|
||||
|
||||
m_project_task_panel->show_layers_num(obj->is_support_layer_num);
|
||||
@@ -3760,8 +3776,6 @@ void StatusPanel::update_subtask(MachineObject *obj)
|
||||
} else {
|
||||
reset_printing_values();
|
||||
}
|
||||
|
||||
Layout();
|
||||
}
|
||||
|
||||
void StatusPanel::update_partskip_subtask(MachineObject *obj){
|
||||
@@ -3818,7 +3832,7 @@ void StatusPanel::update_cloud_subtask(MachineObject *obj)
|
||||
if (m_current_print_mode != PrintingTaskType::CALIBRATION ||(m_calib_mode == CalibMode::Calib_Flow_Rate && m_calib_method == CalibrationMethod::CALI_METHOD_MANUAL)) {
|
||||
img = it->second;
|
||||
wxImage resize_img = img.Scale(m_project_task_panel->get_bitmap_thumbnail()->GetSize().x, m_project_task_panel->get_bitmap_thumbnail()->GetSize().y);
|
||||
m_project_task_panel->set_thumbnail_img(resize_img);
|
||||
m_project_task_panel->set_thumbnail_img(resize_img, "");
|
||||
m_project_task_panel->set_brightness_value(get_brightness_value(resize_img));
|
||||
}
|
||||
if (this->obj) {
|
||||
@@ -3847,7 +3861,7 @@ void StatusPanel::update_sdcard_subtask(MachineObject *obj)
|
||||
update_calib_bitmap();
|
||||
if (m_current_print_mode != PrintingTaskType::CALIBRATION) {
|
||||
m_project_task_panel->get_bitmap_thumbnail()->SetBitmap(m_thumbnail_sdcard.bmp());
|
||||
m_project_task_panel->set_thumbnail_img(m_thumbnail_sdcard.bmp());
|
||||
m_project_task_panel->set_thumbnail_img(m_thumbnail_sdcard.bmp(), m_thumbnail_sdcard.name());
|
||||
}
|
||||
task_thumbnail_state = ThumbnailState::SDCARD_THUMBNAIL;
|
||||
m_load_sdcard_thumbnail = true;
|
||||
|
||||
@@ -264,6 +264,7 @@ public:
|
||||
private:
|
||||
MachineObject* m_obj{nullptr};
|
||||
ScalableBitmap m_thumbnail_placeholder;
|
||||
std::string m_thumbnail_bmp_display_name;
|
||||
wxBitmap m_thumbnail_bmp_display;
|
||||
ScalableBitmap m_bitmap_use_time;
|
||||
ScalableBitmap m_bitmap_use_weight;
|
||||
@@ -336,7 +337,7 @@ public:
|
||||
void update_layers_num(bool show, wxString num = wxEmptyString);
|
||||
void show_priting_use_info(bool show, wxString time = wxEmptyString, wxString weight = wxEmptyString);
|
||||
void show_profile_info(bool show, wxString profile = wxEmptyString);
|
||||
void set_thumbnail_img(const wxBitmap& bmp);
|
||||
void set_thumbnail_img(const wxBitmap& bmp, const std::string& bmp_name);
|
||||
void set_brightness_value(int value) { m_brightness_value = value; }
|
||||
void set_plate_index(int plate_idx = -1);
|
||||
void market_scoring_show();
|
||||
|
||||
@@ -63,9 +63,11 @@ bool Button::Create(wxWindow* parent, wxString text, wxString icon, long style,
|
||||
|
||||
void Button::SetLabel(const wxString& label)
|
||||
{
|
||||
wxWindow::SetLabel(label);
|
||||
messureSize();
|
||||
Refresh();
|
||||
if (label != wxWindow::GetLabel()) {
|
||||
wxWindow::SetLabel(label);
|
||||
messureSize();
|
||||
Refresh();
|
||||
}
|
||||
}
|
||||
|
||||
bool Button::SetFont(const wxFont& font)
|
||||
|
||||
@@ -31,8 +31,10 @@ CheckBox::CheckBox(wxWindow *parent, int id)
|
||||
|
||||
void CheckBox::SetValue(bool value)
|
||||
{
|
||||
wxBitmapToggleButton::SetValue(value);
|
||||
update();
|
||||
if (wxBitmapToggleButton::GetValue() != value) {
|
||||
wxBitmapToggleButton::SetValue(value);
|
||||
update();
|
||||
}
|
||||
}
|
||||
|
||||
void CheckBox::SetHalfChecked(bool value)
|
||||
|
||||
@@ -51,6 +51,16 @@ public:
|
||||
// single color
|
||||
StateColor(unsigned long color);
|
||||
|
||||
// operator==
|
||||
bool operator==(StateColor const& other) const{
|
||||
return statesList_ == other.statesList_ && colors_ == other.colors_ && takeFocusedAsHovered_ == other.takeFocusedAsHovered_;
|
||||
};
|
||||
|
||||
// operator!=
|
||||
bool operator!=(StateColor const& other) const{
|
||||
return !(*this == other);
|
||||
};
|
||||
|
||||
public:
|
||||
void append(wxColour const & color, int states);
|
||||
|
||||
|
||||
@@ -66,9 +66,11 @@ void StaticBox::SetBorderWidth(int width)
|
||||
|
||||
void StaticBox::SetBorderColor(StateColor const &color)
|
||||
{
|
||||
border_color = color;
|
||||
state_handler.update_binds();
|
||||
Refresh();
|
||||
if (border_color != color) {
|
||||
border_color = color;
|
||||
state_handler.update_binds();
|
||||
Refresh();
|
||||
}
|
||||
}
|
||||
|
||||
void StaticBox::SetBorderColorNormal(wxColor const &color)
|
||||
@@ -118,11 +120,13 @@ wxColor StaticBox::GetParentBackgroundColor(wxWindow* parent)
|
||||
|
||||
void StaticBox::ShowBadge(bool show)
|
||||
{
|
||||
if (show)
|
||||
if (show && badge.name() != "badge") {
|
||||
badge = ScalableBitmap(this, "badge", 18);
|
||||
else
|
||||
Refresh();
|
||||
} else if (!show && !badge.name().empty()) {
|
||||
badge = ScalableBitmap {};
|
||||
Refresh();
|
||||
Refresh();
|
||||
}
|
||||
}
|
||||
|
||||
void StaticBox::eraseEvent(wxEraseEvent& evt)
|
||||
|
||||
@@ -9,11 +9,13 @@ StaticGroup::StaticGroup(wxWindow *parent, wxWindowID id, const wxString &label)
|
||||
|
||||
void StaticGroup::ShowBadge(bool show)
|
||||
{
|
||||
if (show)
|
||||
if (show && badge.name() != "badge") {
|
||||
badge = ScalableBitmap(this, "badge", 18);
|
||||
else
|
||||
Refresh();
|
||||
} else if (!show && !badge.name().empty()) {
|
||||
badge = ScalableBitmap{};
|
||||
Refresh();
|
||||
Refresh();
|
||||
}
|
||||
}
|
||||
|
||||
void StaticGroup::DrawBorderAndLabel(wxDC& dc)
|
||||
|
||||
@@ -51,9 +51,11 @@ void StepCtrlBase::SelectItem(int item)
|
||||
|
||||
void StepCtrlBase::Idle()
|
||||
{
|
||||
step = -1;
|
||||
sendStepCtrlEvent();
|
||||
Refresh();
|
||||
if (step != -1) {
|
||||
step = -1;
|
||||
sendStepCtrlEvent();
|
||||
Refresh();
|
||||
}
|
||||
}
|
||||
|
||||
bool StepCtrlBase::SetTipFont(wxFont const& font)
|
||||
|
||||
@@ -62,9 +62,10 @@ void SwitchButton::SetThumbColor(StateColor const& color)
|
||||
|
||||
void SwitchButton::SetValue(bool value)
|
||||
{
|
||||
if (value != GetValue())
|
||||
wxBitmapToggleButton::SetValue(value);
|
||||
update();
|
||||
if (value != GetValue()) {
|
||||
wxBitmapToggleButton::SetValue(value);
|
||||
update();
|
||||
}
|
||||
}
|
||||
|
||||
bool SwitchButton::SetBackgroundColour(const wxColour& colour)
|
||||
@@ -212,17 +213,30 @@ SwitchBoard::SwitchBoard(wxWindow *parent, wxString leftL, wxString right, wxSiz
|
||||
void SwitchBoard::updateState(wxString target)
|
||||
{
|
||||
if (target.empty()) {
|
||||
if (!switch_left && !switch_right) {
|
||||
return;
|
||||
}
|
||||
|
||||
switch_left = false;
|
||||
switch_right = false;
|
||||
} else {
|
||||
if (target == "left") {
|
||||
if (switch_left && !switch_right) {
|
||||
return;
|
||||
}
|
||||
|
||||
switch_left = true;
|
||||
switch_right = false;
|
||||
} else if (target == "right") {
|
||||
if (!switch_left && switch_right) {
|
||||
return;
|
||||
}
|
||||
|
||||
switch_left = false;
|
||||
switch_right = true;
|
||||
}
|
||||
}
|
||||
|
||||
Refresh();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user