mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-05-20 03:43:52 +00:00
FIX:add darkmode of thermalprecondition
jira:[STUDIO-14662] Change-Id: I75998ff04e1073d07e23ff6970dce90627b7b860 (cherry picked from commit 93fc862f7e74c52d7a9cfb75d24ecf0685788341)
This commit is contained in:
@@ -1,11 +1,12 @@
|
|||||||
#include "ThermalPreconditioningDialog.hpp"
|
#include "ThermalPreconditioningDialog.hpp"
|
||||||
#include "I18N.hpp"
|
#include "I18N.hpp"
|
||||||
|
#include "GUI.hpp"
|
||||||
#include "GUI_App.hpp"
|
#include "GUI_App.hpp"
|
||||||
#include "wxExtensions.hpp"
|
#include "wxExtensions.hpp"
|
||||||
#include "DeviceManager.hpp"
|
#include "DeviceManager.hpp"
|
||||||
#include "DeviceCore/DevManager.h"
|
#include "DeviceCore/DevManager.h"
|
||||||
|
|
||||||
namespace Slic3r {
|
namespace Slic3r { namespace GUI {
|
||||||
|
|
||||||
BEGIN_EVENT_TABLE(ThermalPreconditioningDialog, wxDialog)
|
BEGIN_EVENT_TABLE(ThermalPreconditioningDialog, wxDialog)
|
||||||
EVT_BUTTON(wxID_OK, ThermalPreconditioningDialog::on_ok_clicked)
|
EVT_BUTTON(wxID_OK, ThermalPreconditioningDialog::on_ok_clicked)
|
||||||
@@ -19,6 +20,8 @@ ThermalPreconditioningDialog::ThermalPreconditioningDialog(wxWindow* parent, std
|
|||||||
wxIcon icon;
|
wxIcon icon;
|
||||||
icon.CopyFromBitmap(bitmap);
|
icon.CopyFromBitmap(bitmap);
|
||||||
SetIcon(icon);
|
SetIcon(icon);
|
||||||
|
// Apply dark-mode-friendly background for the dialog
|
||||||
|
SetBackgroundColour(StateColor::darkModeColorFor(wxColour(255, 255, 255)));
|
||||||
create_ui();
|
create_ui();
|
||||||
m_refresh_timer = new wxTimer(this);
|
m_refresh_timer = new wxTimer(this);
|
||||||
this->Bind(wxEVT_TIMER, &ThermalPreconditioningDialog::on_timer, this);
|
this->Bind(wxEVT_TIMER, &ThermalPreconditioningDialog::on_timer, this);
|
||||||
@@ -33,19 +36,19 @@ ThermalPreconditioningDialog::ThermalPreconditioningDialog(wxWindow* parent, std
|
|||||||
|
|
||||||
// Set dialog size and position
|
// Set dialog size and position
|
||||||
SetSize(wxSize(FromDIP(400), FromDIP(200)));
|
SetSize(wxSize(FromDIP(400), FromDIP(200)));
|
||||||
|
wxGetApp().UpdateDlgDarkUI(this);
|
||||||
CentreOnScreen();
|
CentreOnScreen();
|
||||||
}
|
}
|
||||||
|
|
||||||
ThermalPreconditioningDialog::~ThermalPreconditioningDialog() {
|
ThermalPreconditioningDialog::~ThermalPreconditioningDialog()
|
||||||
if (m_refresh_timer && m_refresh_timer->IsRunning())
|
|
||||||
{
|
{
|
||||||
|
if (m_refresh_timer && m_refresh_timer->IsRunning()) {
|
||||||
m_refresh_timer->Stop();
|
m_refresh_timer->Stop();
|
||||||
delete m_refresh_timer;
|
delete m_refresh_timer;
|
||||||
m_refresh_timer = nullptr;
|
m_refresh_timer = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void ThermalPreconditioningDialog::create_ui()
|
void ThermalPreconditioningDialog::create_ui()
|
||||||
{
|
{
|
||||||
wxBoxSizer *main_sizer = new wxBoxSizer(wxVERTICAL);
|
wxBoxSizer *main_sizer = new wxBoxSizer(wxVERTICAL);
|
||||||
@@ -55,24 +58,26 @@ void ThermalPreconditioningDialog::create_ui()
|
|||||||
time_font.SetPointSize(14);
|
time_font.SetPointSize(14);
|
||||||
time_font.SetWeight(wxFONTWEIGHT_BOLD);
|
time_font.SetWeight(wxFONTWEIGHT_BOLD);
|
||||||
m_remaining_time_label->SetFont(time_font);
|
m_remaining_time_label->SetFont(time_font);
|
||||||
m_remaining_time_label->SetForegroundColour(wxColour(50, 58, 61));
|
m_remaining_time_label->SetForegroundColour(StateColor::darkModeColorFor(wxColour(50, 58, 61)));
|
||||||
|
|
||||||
// Explanation text
|
// Explanation text
|
||||||
m_explanation_label = new wxStaticText(this, wxID_ANY,
|
m_explanation_label =
|
||||||
|
new wxStaticText(this, wxID_ANY,
|
||||||
_L("The heated bed's thermal preconditioning helps optimize the first layer print quality. Printing will start once preconditioning is complete."),
|
_L("The heated bed's thermal preconditioning helps optimize the first layer print quality. Printing will start once preconditioning is complete."),
|
||||||
wxDefaultPosition, wxDefaultSize, wxALIGN_CENTER);
|
wxDefaultPosition, wxDefaultSize, wxALIGN_CENTER);
|
||||||
m_explanation_label->Wrap(FromDIP(350));
|
m_explanation_label->Wrap(FromDIP(350));
|
||||||
m_explanation_label->SetForegroundColour(wxColour(50, 58, 61));
|
m_explanation_label->SetForegroundColour(StateColor::darkModeColorFor(wxColour(50, 58, 61)));
|
||||||
|
|
||||||
m_ok_button = new wxButton(this, wxID_OK, _L("OK"));
|
m_ok_button = new wxButton(this, wxID_OK, _L("OK"));
|
||||||
#ifdef __WXMAC__
|
#ifdef __WXMAC__
|
||||||
m_ok_button->SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE));
|
m_ok_button->SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE));
|
||||||
m_ok_button->SetForegroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNTEXT));
|
m_ok_button->SetForegroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNTEXT));
|
||||||
#else
|
#else
|
||||||
m_ok_button->SetBackgroundColour(wxColour("#B6F34F"));
|
m_ok_button->SetBackgroundColour(StateColor::darkModeColorFor(wxColour("#B6F34F")));
|
||||||
m_ok_button->SetForegroundColour(wxColour("#000000"));
|
m_ok_button->SetForegroundColour(StateColor::darkModeColorFor(wxColour("#000000")));
|
||||||
#endif
|
|
||||||
m_ok_button->SetMinSize(wxSize(FromDIP(80), FromDIP(32)));
|
m_ok_button->SetMinSize(wxSize(FromDIP(80), FromDIP(32)));
|
||||||
m_ok_button->SetMaxSize(wxSize(FromDIP(80), FromDIP(32)));
|
m_ok_button->SetMaxSize(wxSize(FromDIP(80), FromDIP(32)));
|
||||||
|
#endif
|
||||||
|
|
||||||
// Layout
|
// Layout
|
||||||
main_sizer->Add(0, 0, 1, wxEXPAND);
|
main_sizer->Add(0, 0, 1, wxEXPAND);
|
||||||
@@ -84,10 +89,7 @@ void ThermalPreconditioningDialog::create_ui()
|
|||||||
SetSizer(main_sizer);
|
SetSizer(main_sizer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ThermalPreconditioningDialog::on_ok_clicked(wxCommandEvent& event)
|
void ThermalPreconditioningDialog::on_ok_clicked(wxCommandEvent &event) { EndModal(wxID_OK); }
|
||||||
{
|
|
||||||
EndModal(wxID_OK);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ThermalPreconditioningDialog::update_thermal_remaining_time()
|
void ThermalPreconditioningDialog::update_thermal_remaining_time()
|
||||||
{
|
{
|
||||||
@@ -100,11 +102,10 @@ void ThermalPreconditioningDialog::update_thermal_remaining_time()
|
|||||||
if (remaining_seconds >= 0) {
|
if (remaining_seconds >= 0) {
|
||||||
int minutes = remaining_seconds / 60;
|
int minutes = remaining_seconds / 60;
|
||||||
int seconds = remaining_seconds % 60;
|
int seconds = remaining_seconds % 60;
|
||||||
remaining_time = wxString::Format("Remaining time: %dmin%ds", minutes, seconds);
|
remaining_time = wxString::Format(_L("Remaining time: %dmin%ds"), minutes, seconds);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_remaining_time_label)
|
if (m_remaining_time_label) m_remaining_time_label->SetLabelText(remaining_time);
|
||||||
m_remaining_time_label->SetLabelText(remaining_time);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ThermalPreconditioningDialog::on_timer(wxTimerEvent &event) {
|
void ThermalPreconditioningDialog::on_timer(wxTimerEvent &event) {
|
||||||
@@ -119,4 +120,4 @@ void ThermalPreconditioningDialog::on_timer(wxTimerEvent &event) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Slic3r
|
}} // namespace Slic3r
|
||||||
@@ -11,6 +11,7 @@
|
|||||||
namespace Slic3r {
|
namespace Slic3r {
|
||||||
|
|
||||||
class MachineObject;
|
class MachineObject;
|
||||||
|
namespace GUI {
|
||||||
|
|
||||||
class ThermalPreconditioningDialog : public wxDialog
|
class ThermalPreconditioningDialog : public wxDialog
|
||||||
{
|
{
|
||||||
@@ -18,7 +19,6 @@ public:
|
|||||||
ThermalPreconditioningDialog(wxWindow *parent, std::string dev_id, const wxString &remaining_time);
|
ThermalPreconditioningDialog(wxWindow *parent, std::string dev_id, const wxString &remaining_time);
|
||||||
~ThermalPreconditioningDialog();
|
~ThermalPreconditioningDialog();
|
||||||
|
|
||||||
|
|
||||||
void update_thermal_remaining_time();
|
void update_thermal_remaining_time();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@@ -36,4 +36,5 @@ private:
|
|||||||
DECLARE_EVENT_TABLE()
|
DECLARE_EVENT_TABLE()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
} // namespace GUI
|
||||||
} // namespace Slic3r
|
} // namespace Slic3r
|
||||||
Reference in New Issue
Block a user