mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-05-16 10:02:12 +00:00
FIX:reslove mac compatibility question
jira:[STUDIO-14604][STUDIO-14660][STUDIO-14662] Change-Id: I71833726fb3533960e38f87324b7d3da566730d7 (cherry picked from commit 7e6a18c81d92517e5f421569d103502e44c703a5)
This commit is contained in:
@@ -719,7 +719,17 @@ void PrintingTaskPanel::create_panel(wxWindow* parent)
|
||||
bSizer_text->Add(0, 0, 0, wxLEFT, FromDIP(20));
|
||||
bSizer_text->Add(m_staticText_progress_left, 0, wxALIGN_CENTER_VERTICAL | wxALL, 0);
|
||||
|
||||
m_printing_stage_value = new wxStaticText(penel_finish_time, wxID_ANY, "", wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT | wxST_ELLIPSIZE_END);
|
||||
m_printing_stage_panel = new wxPanel(penel_finish_time);
|
||||
wxBoxSizer *printingstage_vertical_sizer = new wxBoxSizer(wxVERTICAL);
|
||||
wxBoxSizer *printingstage_horizontal_sizer = new wxBoxSizer(wxHORIZONTAL);
|
||||
|
||||
m_printing_stage_underline = new wxPanel(m_printing_stage_panel);
|
||||
m_printing_stage_underline->SetMaxSize(wxSize(-1, FromDIP(1)));
|
||||
m_printing_stage_underline->SetMinSize(wxSize(-1, FromDIP(1)));
|
||||
m_printing_stage_underline->SetBackgroundColour(wxColour(146, 146, 146));
|
||||
m_printing_stage_underline->Hide();
|
||||
|
||||
m_printing_stage_value = new wxStaticText(m_printing_stage_panel, wxID_ANY, "", wxDefaultPosition, wxDefaultSize, wxALIGN_LEFT | wxST_ELLIPSIZE_END);
|
||||
m_printing_stage_value->Wrap(-1);
|
||||
m_printing_stage_value->SetMaxSize(wxSize(FromDIP(800), -1));
|
||||
#ifdef __WXOSX_MAC__
|
||||
@@ -736,15 +746,13 @@ void PrintingTaskPanel::create_panel(wxWindow* parent)
|
||||
MachineObject *obj = dev_manager ? dev_manager->get_selected_machine() : nullptr;
|
||||
if (obj && obj->stage_curr == 58) {
|
||||
m_printing_stage_value->SetCursor(wxCursor(wxCURSOR_HAND));
|
||||
wxFont font = m_printing_stage_value->GetFont();
|
||||
font.SetUnderlined(true);
|
||||
m_printing_stage_value->SetFont(font);
|
||||
m_printing_stage_underline->Show();
|
||||
} else {
|
||||
m_printing_stage_value->SetCursor(wxCursor(wxCURSOR_ARROW));
|
||||
wxFont font = m_printing_stage_value->GetFont();
|
||||
font.SetUnderlined(false);
|
||||
m_printing_stage_value->SetFont(font);
|
||||
m_printing_stage_underline->Hide();
|
||||
}
|
||||
m_printing_stage_panel->Layout();
|
||||
Layout();
|
||||
event.Skip();
|
||||
});
|
||||
m_printing_stage_value->Bind(wxEVT_LEAVE_WINDOW, [this](wxMouseEvent &event) {
|
||||
@@ -752,10 +760,10 @@ void PrintingTaskPanel::create_panel(wxWindow* parent)
|
||||
MachineObject *obj = dev_manager ? dev_manager->get_selected_machine() : nullptr;
|
||||
if (obj && obj->stage_curr == 58) {
|
||||
m_printing_stage_value->SetCursor(wxCURSOR_ARROW);
|
||||
wxFont font = m_printing_stage_value->GetFont();
|
||||
font.SetUnderlined(false);
|
||||
m_printing_stage_value->SetFont(font);
|
||||
m_printing_stage_underline->Hide();
|
||||
}
|
||||
m_printing_stage_panel->Layout();
|
||||
Layout();
|
||||
event.Skip();
|
||||
});
|
||||
|
||||
@@ -765,8 +773,9 @@ void PrintingTaskPanel::create_panel(wxWindow* parent)
|
||||
|
||||
|
||||
// Create question button
|
||||
m_question_button = new ScalableButton(penel_finish_time, wxID_ANY, "thermal_question", wxEmptyString, wxDefaultSize, wxDefaultPosition, wxBU_EXACTFIT | wxNO_BORDER, true);
|
||||
m_question_button = new ScalableButton(m_printing_stage_panel, wxID_ANY, "thermal_question", wxEmptyString, wxDefaultSize, wxDefaultPosition, wxBU_EXACTFIT | wxNO_BORDER, true);
|
||||
m_question_button->SetToolTip(_L("Click to view thermal preconditioning explanation"));
|
||||
m_question_button->SetBackgroundColour(wxColour(255, 255, 255));
|
||||
m_question_button->Hide(); // Hide by default
|
||||
m_question_button->Bind(wxEVT_LEFT_UP, &PrintingTaskPanel::on_stage_clicked, this);
|
||||
m_question_button->Bind(wxEVT_ENTER_WINDOW, [this](wxMouseEvent &event) {
|
||||
@@ -774,11 +783,7 @@ void PrintingTaskPanel::create_panel(wxWindow* parent)
|
||||
MachineObject *obj = dev_manager ? dev_manager->get_selected_machine() : nullptr;
|
||||
if (obj && obj->stage_curr == 58) {
|
||||
m_question_button->SetCursor(wxCursor(wxCURSOR_HAND));
|
||||
if (m_printing_stage_value) {
|
||||
wxFont f = m_printing_stage_value->GetFont();
|
||||
f.SetUnderlined(true);
|
||||
m_printing_stage_value->SetFont(f);
|
||||
}
|
||||
m_printing_stage_underline->Show();
|
||||
}
|
||||
event.Skip();
|
||||
});
|
||||
@@ -787,23 +792,24 @@ void PrintingTaskPanel::create_panel(wxWindow* parent)
|
||||
MachineObject *obj = dev_manager ? dev_manager->get_selected_machine() : nullptr;
|
||||
if (obj && obj->stage_curr == 58) {
|
||||
m_question_button->SetCursor(wxCURSOR_ARROW);
|
||||
if (m_printing_stage_value) {
|
||||
wxFont f = m_printing_stage_value->GetFont();
|
||||
f.SetUnderlined(false);
|
||||
m_printing_stage_value->SetFont(f);
|
||||
}
|
||||
m_printing_stage_underline->Hide();
|
||||
event.Skip();
|
||||
}
|
||||
});
|
||||
|
||||
printingstage_horizontal_sizer->Add(m_printing_stage_value, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL, 0);
|
||||
printingstage_horizontal_sizer->Add(m_question_button, 0, wxALIGN_CENTER_VERTICAL | wxLEFT, FromDIP(5));
|
||||
printingstage_vertical_sizer->Add(printingstage_horizontal_sizer, 0, wxALIGN_CENTER_VERTICAL, 0);
|
||||
printingstage_vertical_sizer->Add(m_printing_stage_underline, 0, wxEXPAND |wxALIGN_TOP, 0);
|
||||
m_printing_stage_panel->SetSizer(printingstage_vertical_sizer);
|
||||
|
||||
// Orca: display the end time of the print
|
||||
m_staticText_progress_end = new wxStaticText(penel_finish_time, wxID_ANY, L("N/A"), wxDefaultPosition, wxDefaultSize, 0);
|
||||
m_staticText_progress_end->Wrap(-1);
|
||||
m_staticText_progress_end->SetFont(
|
||||
wxFont(12, wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_NORMAL, false, wxT("HarmonyOS Sans SC")));
|
||||
m_staticText_progress_end->SetForegroundColour(wxColour(146, 146, 146));
|
||||
bSizer_finish_time->Add(m_printing_stage_value, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL, 0);
|
||||
bSizer_finish_time->Add(m_question_button, 0, wxALIGN_CENTER_VERTICAL | wxLEFT, FromDIP(5));
|
||||
bSizer_finish_time->Add(m_printing_stage_panel, 0, wxALIGN_LEFT | wxALIGN_CENTER_VERTICAL, 0);
|
||||
bSizer_finish_time->Add(0, 0, 1, wxEXPAND, 0);
|
||||
bSizer_finish_time->Add(m_staticText_progress_end, 0, wxLEFT | wxEXPAND, 0);
|
||||
// penel_finish_time->SetMaxSize(wxSize(FromDIP(600), -1));
|
||||
@@ -818,7 +824,6 @@ void PrintingTaskPanel::create_panel(wxWindow* parent)
|
||||
progress_left_sizer->Add(m_gauge_progress, 0, wxEXPAND | wxTOP | wxBOTTOM, FromDIP(10));
|
||||
|
||||
|
||||
|
||||
progress_left_sizer->Add(penel_finish_time, 0, wxEXPAND |wxALL, 0);
|
||||
// progress_left_sizer->SetMaxSize(wxSize(FromDIP(600), -1));
|
||||
|
||||
@@ -1154,20 +1159,14 @@ void PrintingTaskPanel::update_stage_value_with_machine(wxString stage, int val,
|
||||
m_gauge_progress->SetValue(val);
|
||||
m_printing_stage_value->SetLabelText(stage);
|
||||
|
||||
|
||||
if (obj && obj->stage_curr == 58) {
|
||||
// Show English text for thermal preconditioning
|
||||
m_printing_stage_value->SetForegroundColour(wxColour(146, 146, 146)); // Gray color, indicates clickable
|
||||
m_printing_stage_value->SetCursor(wxCursor(wxCURSOR_HAND));
|
||||
m_question_button->Show(); // Show question button
|
||||
} else {
|
||||
m_printing_stage_value->SetForegroundColour(STAGE_TEXT_COL);
|
||||
m_printing_stage_value->SetCursor(wxCURSOR_ARROW);
|
||||
wxFont font = m_printing_stage_value->GetFont();
|
||||
font.SetUnderlined(false);
|
||||
m_printing_stage_value->SetFont(font);
|
||||
m_question_button->Hide(); // Hide question button
|
||||
m_printing_stage_underline->Hide();
|
||||
}
|
||||
m_printing_stage_panel->Layout();
|
||||
Layout();
|
||||
}
|
||||
|
||||
void PrintingTaskPanel::on_stage_clicked(wxMouseEvent &event)
|
||||
|
||||
@@ -304,6 +304,9 @@ private:
|
||||
wxPanel * m_score_subtask_info;
|
||||
wxPanel * m_score_staticline;
|
||||
wxPanel * m_request_failed_panel;
|
||||
wxPanel *m_printing_stage_underline;
|
||||
wxPanel *m_printing_stage_panel;
|
||||
|
||||
// score page
|
||||
int m_star_count;
|
||||
std::vector<ScalableButton *> m_score_star;
|
||||
|
||||
@@ -14,16 +14,15 @@ END_EVENT_TABLE()
|
||||
ThermalPreconditioningDialog::ThermalPreconditioningDialog(wxWindow* parent, std::string dev_id,const wxString& remaining_time)
|
||||
: wxDialog(parent, wxID_ANY, _L("Thermal Preconditioning for first layer optimization"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER)
|
||||
, m_dev_id(dev_id)
|
||||
, m_refresh_timer(this)
|
||||
{
|
||||
wxBitmap bitmap = create_scaled_bitmap("thermal_preconditioning_title", this, 16);
|
||||
wxIcon icon;
|
||||
icon.CopyFromBitmap(bitmap);
|
||||
SetIcon(icon);
|
||||
create_ui();
|
||||
|
||||
Bind(wxEVT_TIMER, &ThermalPreconditioningDialog::on_timer, this);
|
||||
m_refresh_timer.Start(1000);
|
||||
m_refresh_timer = new wxTimer(this);
|
||||
this->Bind(wxEVT_TIMER, &ThermalPreconditioningDialog::on_timer, this);
|
||||
m_refresh_timer->Start(1000);
|
||||
|
||||
// Set remaining time
|
||||
if (!remaining_time.IsEmpty()) {
|
||||
@@ -37,6 +36,16 @@ ThermalPreconditioningDialog::ThermalPreconditioningDialog(wxWindow* parent, std
|
||||
CentreOnScreen();
|
||||
}
|
||||
|
||||
ThermalPreconditioningDialog::~ThermalPreconditioningDialog() {
|
||||
if (m_refresh_timer && m_refresh_timer->IsRunning())
|
||||
{
|
||||
m_refresh_timer->Stop();
|
||||
delete m_refresh_timer;
|
||||
m_refresh_timer = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void ThermalPreconditioningDialog::create_ui()
|
||||
{
|
||||
wxBoxSizer* main_sizer = new wxBoxSizer(wxVERTICAL);
|
||||
@@ -54,11 +63,16 @@ void ThermalPreconditioningDialog::create_ui()
|
||||
m_explanation_label->Wrap(FromDIP(350));
|
||||
m_explanation_label->SetForegroundColour(wxColour(50, 58, 61));
|
||||
|
||||
// OK button
|
||||
m_ok_button = new wxButton(this, wxID_OK, _L("OK"));
|
||||
#ifdef __WXMAC__
|
||||
m_ok_button->SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE));
|
||||
m_ok_button->SetForegroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNTEXT));
|
||||
#else
|
||||
m_ok_button->SetBackgroundColour(wxColour("#B6F34F"));
|
||||
m_ok_button->SetForegroundColour(wxColour("#000000"));
|
||||
#endif
|
||||
m_ok_button->SetMinSize(wxSize(FromDIP(80), FromDIP(32)));
|
||||
m_ok_button->SetMaxSize(wxSize(FromDIP(80), FromDIP(32)));
|
||||
|
||||
// Layout
|
||||
main_sizer->Add(0, 0, 1, wxEXPAND);
|
||||
@@ -81,14 +95,16 @@ void ThermalPreconditioningDialog::update_thermal_remaining_time()
|
||||
if (!dev) return;
|
||||
MachineObject * m_obj = dev->get_my_machine(m_dev_id);
|
||||
|
||||
int remaining_seconds = m_obj->get_stage_remaining_seconds();
|
||||
int remaining_seconds = m_obj->get_stage_remaining_seconds();
|
||||
wxString remaining_time;
|
||||
if (remaining_seconds >= 0) {
|
||||
int minutes = remaining_seconds/60;
|
||||
int seconds = remaining_seconds % 60;
|
||||
remaining_time = wxString::Format("Remaining time: %dmin%ds", minutes, seconds);
|
||||
}
|
||||
set_remaining_time_text(remaining_time);
|
||||
|
||||
if (m_remaining_time_label)
|
||||
m_remaining_time_label->SetLabelText(remaining_time);
|
||||
}
|
||||
|
||||
void ThermalPreconditioningDialog::on_timer(wxTimerEvent &event) {
|
||||
@@ -96,10 +112,10 @@ void ThermalPreconditioningDialog::on_timer(wxTimerEvent &event) {
|
||||
if (!dev) return;
|
||||
MachineObject *m_obj = dev->get_my_machine(m_dev_id);
|
||||
|
||||
if (IsShown() && m_obj && m_obj->stage_curr == 58) {
|
||||
if (IsShown() && m_obj && m_obj->stage_curr == 58) {
|
||||
update_thermal_remaining_time();
|
||||
} else {
|
||||
m_refresh_timer.Stop();
|
||||
m_refresh_timer->Stop();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#include <wx/sizer.h>
|
||||
#include <wx/statbmp.h>
|
||||
|
||||
|
||||
namespace Slic3r {
|
||||
|
||||
class MachineObject;
|
||||
@@ -15,10 +16,8 @@ class ThermalPreconditioningDialog : public wxDialog
|
||||
{
|
||||
public:
|
||||
ThermalPreconditioningDialog(wxWindow *parent, std::string dev_id, const wxString &remaining_time);
|
||||
~ThermalPreconditioningDialog() = default;
|
||||
~ThermalPreconditioningDialog() ;
|
||||
|
||||
// Allow external updates of remaining time text
|
||||
void set_remaining_time_text(const wxString& text) { if (m_remaining_time_label) m_remaining_time_label->SetLabelText(text); }
|
||||
|
||||
void update_thermal_remaining_time();
|
||||
|
||||
@@ -28,7 +27,7 @@ private:
|
||||
void on_timer(wxTimerEvent &event);
|
||||
|
||||
std::string m_dev_id;
|
||||
wxTimer m_refresh_timer;
|
||||
wxTimer* m_refresh_timer;
|
||||
wxStaticText* m_remaining_time_label;
|
||||
wxStaticText* m_explanation_label;
|
||||
wxButton* m_ok_button;
|
||||
|
||||
Reference in New Issue
Block a user