mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-05-17 19:16:50 +08:00
Added menu command Configuration/Language to standalone gcode viewer
This commit is contained in:
parent
f16ef0643c
commit
21366f56e7
@ -1530,7 +1530,7 @@ bool GLCanvas3D::init()
|
|||||||
if (m_initialized)
|
if (m_initialized)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
if ((m_canvas == nullptr) || (m_context == nullptr))
|
if (m_canvas == nullptr || m_context == nullptr)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
glsafe(::glClearColor(1.0f, 1.0f, 1.0f, 1.0f));
|
glsafe(::glClearColor(1.0f, 1.0f, 1.0f, 1.0f));
|
||||||
@ -1580,8 +1580,7 @@ bool GLCanvas3D::init()
|
|||||||
m_layers_editing.init();
|
m_layers_editing.init();
|
||||||
|
|
||||||
#if ENABLE_GCODE_VIEWER
|
#if ENABLE_GCODE_VIEWER
|
||||||
if (!m_main_toolbar.is_enabled())
|
if (!m_main_toolbar.is_enabled()) {
|
||||||
{
|
|
||||||
if (!m_gcode_viewer.init())
|
if (!m_gcode_viewer.init())
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -5128,7 +5127,7 @@ bool GLCanvas3D::_set_current()
|
|||||||
|
|
||||||
void GLCanvas3D::_resize(unsigned int w, unsigned int h)
|
void GLCanvas3D::_resize(unsigned int w, unsigned int h)
|
||||||
{
|
{
|
||||||
if ((m_canvas == nullptr) && (m_context == nullptr))
|
if (m_canvas == nullptr && m_context == nullptr)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
auto *imgui = wxGetApp().imgui();
|
auto *imgui = wxGetApp().imgui();
|
||||||
|
@ -647,8 +647,8 @@ void GUI_App::init_app_config()
|
|||||||
#endif // ENABLE_GCODE_VIEWER
|
#endif // ENABLE_GCODE_VIEWER
|
||||||
|
|
||||||
// load settings
|
// load settings
|
||||||
app_conf_exists = app_config->exists();
|
m_app_conf_exists = app_config->exists();
|
||||||
if (app_conf_exists) {
|
if (m_app_conf_exists) {
|
||||||
std::string error = app_config->load();
|
std::string error = app_config->load();
|
||||||
#if ENABLE_GCODE_APP_CONFIG
|
#if ENABLE_GCODE_APP_CONFIG
|
||||||
if (!error.empty()) {
|
if (!error.empty()) {
|
||||||
@ -1079,6 +1079,10 @@ void GUI_App::check_printer_presets()
|
|||||||
|
|
||||||
void GUI_App::recreate_GUI(const wxString& msg_name)
|
void GUI_App::recreate_GUI(const wxString& msg_name)
|
||||||
{
|
{
|
||||||
|
#if ENABLE_GCODE_APP_CONFIG
|
||||||
|
m_is_recreating_gui = true;
|
||||||
|
#endif // ENABLE_GCODE_APP_CONFIG
|
||||||
|
|
||||||
mainframe->shutdown();
|
mainframe->shutdown();
|
||||||
|
|
||||||
wxProgressDialog dlg(msg_name, msg_name, 100, nullptr, wxPD_AUTO_HIDE);
|
wxProgressDialog dlg(msg_name, msg_name, 100, nullptr, wxPD_AUTO_HIDE);
|
||||||
@ -1087,6 +1091,9 @@ void GUI_App::recreate_GUI(const wxString& msg_name)
|
|||||||
|
|
||||||
MainFrame *old_main_frame = mainframe;
|
MainFrame *old_main_frame = mainframe;
|
||||||
mainframe = new MainFrame();
|
mainframe = new MainFrame();
|
||||||
|
#if ENABLE_GCODE_APP_CONFIG
|
||||||
|
if (is_editor())
|
||||||
|
#endif // ENABLE_GCODE_APP_CONFIG
|
||||||
// hide settings tabs after first Layout
|
// hide settings tabs after first Layout
|
||||||
mainframe->select_tab(size_t(0));
|
mainframe->select_tab(size_t(0));
|
||||||
// Propagate model objects to object list.
|
// Propagate model objects to object list.
|
||||||
@ -1118,6 +1125,10 @@ void GUI_App::recreate_GUI(const wxString& msg_name)
|
|||||||
// // Run the config wizard, don't offer the "reset user profile" checkbox.
|
// // Run the config wizard, don't offer the "reset user profile" checkbox.
|
||||||
// config_wizard_startup(true);
|
// config_wizard_startup(true);
|
||||||
// });
|
// });
|
||||||
|
|
||||||
|
#if ENABLE_GCODE_APP_CONFIG
|
||||||
|
m_is_recreating_gui = false;
|
||||||
|
#endif // ENABLE_GCODE_APP_CONFIG
|
||||||
}
|
}
|
||||||
|
|
||||||
void GUI_App::system_info()
|
void GUI_App::system_info()
|
||||||
@ -1487,8 +1498,14 @@ void GUI_App::add_config_menu(wxMenuBar *menu)
|
|||||||
Bind(wxEVT_UPDATE_UI, [this](wxUpdateUIEvent& evt) { if (get_mode() == comExpert) evt.Check(true); }, config_id_base + ConfigMenuModeExpert);
|
Bind(wxEVT_UPDATE_UI, [this](wxUpdateUIEvent& evt) { if (get_mode() == comExpert) evt.Check(true); }, config_id_base + ConfigMenuModeExpert);
|
||||||
|
|
||||||
local_menu->AppendSubMenu(mode_menu, _L("Mode"), wxString::Format(_L("%s View Mode"), SLIC3R_APP_NAME));
|
local_menu->AppendSubMenu(mode_menu, _L("Mode"), wxString::Format(_L("%s View Mode"), SLIC3R_APP_NAME));
|
||||||
|
#if ENABLE_GCODE_APP_CONFIG
|
||||||
|
}
|
||||||
|
#endif // ENABLE_GCODE_APP_CONFIG
|
||||||
local_menu->AppendSeparator();
|
local_menu->AppendSeparator();
|
||||||
local_menu->Append(config_id_base + ConfigMenuLanguage, _L("&Language"));
|
local_menu->Append(config_id_base + ConfigMenuLanguage, _L("&Language"));
|
||||||
|
#if ENABLE_GCODE_APP_CONFIG
|
||||||
|
if (is_editor()) {
|
||||||
|
#endif // ENABLE_GCODE_APP_CONFIG
|
||||||
local_menu->AppendSeparator();
|
local_menu->AppendSeparator();
|
||||||
local_menu->Append(config_id_base + ConfigMenuFlashFirmware, _L("Flash printer &firmware"), _L("Upload a firmware image into an Arduino based printer"));
|
local_menu->Append(config_id_base + ConfigMenuFlashFirmware, _L("Flash printer &firmware"), _L("Upload a firmware image into an Arduino based printer"));
|
||||||
// TODO: for when we're able to flash dictionaries
|
// TODO: for when we're able to flash dictionaries
|
||||||
@ -1567,11 +1584,19 @@ void GUI_App::add_config_menu(wxMenuBar *menu)
|
|||||||
// the dialog needs to be destroyed before the call to switch_language()
|
// the dialog needs to be destroyed before the call to switch_language()
|
||||||
// or sometimes the application crashes into wxDialogBase() destructor
|
// or sometimes the application crashes into wxDialogBase() destructor
|
||||||
// so we put it into an inner scope
|
// so we put it into an inner scope
|
||||||
|
#if ENABLE_GCODE_APP_CONFIG
|
||||||
|
wxString title = is_editor() ? wxString(SLIC3R_APP_NAME) : wxString(GCODEVIEWER_APP_NAME);
|
||||||
|
title += " - " + _L("Language selection");
|
||||||
|
#endif // ENABLE_GCODE_APP_CONFIG
|
||||||
wxMessageDialog dialog(nullptr,
|
wxMessageDialog dialog(nullptr,
|
||||||
_L("Switching the language will trigger application restart.\n"
|
_L("Switching the language will trigger application restart.\n"
|
||||||
"You will lose content of the plater.") + "\n\n" +
|
"You will lose content of the plater.") + "\n\n" +
|
||||||
_L("Do you want to proceed?"),
|
_L("Do you want to proceed?"),
|
||||||
|
#if ENABLE_GCODE_APP_CONFIG
|
||||||
|
title,
|
||||||
|
#else
|
||||||
wxString(SLIC3R_APP_NAME) + " - " + _L("Language selection"),
|
wxString(SLIC3R_APP_NAME) + " - " + _L("Language selection"),
|
||||||
|
#endif // ENABLE_GCODE_APP_CONFIG
|
||||||
wxICON_QUESTION | wxOK | wxCANCEL);
|
wxICON_QUESTION | wxOK | wxCANCEL);
|
||||||
if (dialog.ShowModal() == wxID_CANCEL)
|
if (dialog.ShowModal() == wxID_CANCEL)
|
||||||
return;
|
return;
|
||||||
@ -1948,7 +1973,7 @@ void GUI_App::window_pos_sanitize(wxTopLevelWindow* window)
|
|||||||
|
|
||||||
bool GUI_App::config_wizard_startup()
|
bool GUI_App::config_wizard_startup()
|
||||||
{
|
{
|
||||||
if (!app_conf_exists || preset_bundle->printers.size() <= 1) {
|
if (!m_app_conf_exists || preset_bundle->printers.size() <= 1) {
|
||||||
run_wizard(ConfigWizard::RR_DATA_EMPTY);
|
run_wizard(ConfigWizard::RR_DATA_EMPTY);
|
||||||
return true;
|
return true;
|
||||||
} else if (get_app_config()->legacy_datadir()) {
|
} else if (get_app_config()->legacy_datadir()) {
|
||||||
@ -1966,7 +1991,6 @@ bool GUI_App::config_wizard_startup()
|
|||||||
|
|
||||||
void GUI_App::check_updates(const bool verbose)
|
void GUI_App::check_updates(const bool verbose)
|
||||||
{
|
{
|
||||||
|
|
||||||
PresetUpdater::UpdateResult updater_result;
|
PresetUpdater::UpdateResult updater_result;
|
||||||
try {
|
try {
|
||||||
updater_result = preset_updater->config_update(app_config->orig_version(), verbose);
|
updater_result = preset_updater->config_update(app_config->orig_version(), verbose);
|
||||||
@ -1974,10 +1998,9 @@ void GUI_App::check_updates(const bool verbose)
|
|||||||
mainframe->Close();
|
mainframe->Close();
|
||||||
}
|
}
|
||||||
else if (updater_result == PresetUpdater::R_INCOMPAT_CONFIGURED) {
|
else if (updater_result == PresetUpdater::R_INCOMPAT_CONFIGURED) {
|
||||||
app_conf_exists = true;
|
m_app_conf_exists = true;
|
||||||
}
|
}
|
||||||
else if(verbose && updater_result == PresetUpdater::R_NOOP)
|
else if (verbose && updater_result == PresetUpdater::R_NOOP) {
|
||||||
{
|
|
||||||
MsgNoUpdates dlg;
|
MsgNoUpdates dlg;
|
||||||
dlg.ShowModal();
|
dlg.ShowModal();
|
||||||
}
|
}
|
||||||
@ -1985,9 +2008,8 @@ void GUI_App::check_updates(const bool verbose)
|
|||||||
catch (const std::exception & ex) {
|
catch (const std::exception & ex) {
|
||||||
show_error(nullptr, ex.what());
|
show_error(nullptr, ex.what());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// static method accepting a wxWindow object as first parameter
|
// static method accepting a wxWindow object as first parameter
|
||||||
// void warning_catcher{
|
// void warning_catcher{
|
||||||
// my($self, $message_dialog) = @_;
|
// my($self, $message_dialog) = @_;
|
||||||
|
@ -106,9 +106,12 @@ private:
|
|||||||
#endif // ENABLE_GCODE_VIEWER
|
#endif // ENABLE_GCODE_VIEWER
|
||||||
|
|
||||||
bool m_initialized { false };
|
bool m_initialized { false };
|
||||||
bool app_conf_exists{ false };
|
bool m_app_conf_exists{ false };
|
||||||
#if ENABLE_GCODE_VIEWER
|
#if ENABLE_GCODE_VIEWER
|
||||||
EAppMode m_app_mode{ EAppMode::Editor };
|
EAppMode m_app_mode{ EAppMode::Editor };
|
||||||
|
#if ENABLE_GCODE_APP_CONFIG
|
||||||
|
bool m_is_recreating_gui{ false };
|
||||||
|
#endif // ENABLE_GCODE_APP_CONFIG
|
||||||
#endif // ENABLE_GCODE_VIEWER
|
#endif // ENABLE_GCODE_VIEWER
|
||||||
|
|
||||||
wxColour m_color_label_modified;
|
wxColour m_color_label_modified;
|
||||||
@ -184,6 +187,9 @@ public:
|
|||||||
EAppMode get_app_mode() const { return m_app_mode; }
|
EAppMode get_app_mode() const { return m_app_mode; }
|
||||||
bool is_editor() const { return m_app_mode == EAppMode::Editor; }
|
bool is_editor() const { return m_app_mode == EAppMode::Editor; }
|
||||||
bool is_gcode_viewer() const { return m_app_mode == EAppMode::GCodeViewer; }
|
bool is_gcode_viewer() const { return m_app_mode == EAppMode::GCodeViewer; }
|
||||||
|
#if ENABLE_GCODE_APP_CONFIG
|
||||||
|
bool is_recreating_gui() const { return m_is_recreating_gui; }
|
||||||
|
#endif // ENABLE_GCODE_APP_CONFIG
|
||||||
#endif // ENABLE_GCODE_VIEWER
|
#endif // ENABLE_GCODE_VIEWER
|
||||||
|
|
||||||
static std::string get_gl_info(bool format_as_html, bool extensions);
|
static std::string get_gl_info(bool format_as_html, bool extensions);
|
||||||
|
@ -1212,8 +1212,12 @@ void Preview::update_double_slider_from_canvas(wxKeyEvent & event)
|
|||||||
void Preview::load_print_as_fff(bool keep_z_range)
|
void Preview::load_print_as_fff(bool keep_z_range)
|
||||||
{
|
{
|
||||||
#if ENABLE_GCODE_VIEWER
|
#if ENABLE_GCODE_VIEWER
|
||||||
|
#if ENABLE_GCODE_APP_CONFIG
|
||||||
|
if (wxGetApp().mainframe == nullptr || wxGetApp().is_recreating_gui())
|
||||||
|
#else
|
||||||
if (wxGetApp().mainframe == nullptr)
|
if (wxGetApp().mainframe == nullptr)
|
||||||
// avoid proessing while mainframe is being constructed
|
#endif // ENABLE_GCODE_APP_CONFIG
|
||||||
|
// avoid processing while mainframe is being constructed
|
||||||
return;
|
return;
|
||||||
#endif // ENABLE_GCODE_VIEWER
|
#endif // ENABLE_GCODE_VIEWER
|
||||||
|
|
||||||
|
@ -203,9 +203,6 @@ DPIFrame(NULL, wxID_ANY, "", wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_S
|
|||||||
sizer->Add(m_main_sizer, 1, wxEXPAND);
|
sizer->Add(m_main_sizer, 1, wxEXPAND);
|
||||||
SetSizer(sizer);
|
SetSizer(sizer);
|
||||||
// initialize layout from config
|
// initialize layout from config
|
||||||
#if ENABLE_GCODE_VIEWER
|
|
||||||
if (wxGetApp().is_editor())
|
|
||||||
#endif // ENABLE_GCODE_VIEWER
|
|
||||||
update_layout();
|
update_layout();
|
||||||
sizer->SetSizeHints(this);
|
sizer->SetSizeHints(this);
|
||||||
Fit();
|
Fit();
|
||||||
|
@ -5418,7 +5418,7 @@ void Plater::on_config_change(const DynamicPrintConfig &config)
|
|||||||
p->reset_gcode_toolpaths();
|
p->reset_gcode_toolpaths();
|
||||||
#endif // ENABLE_GCODE_VIEWER
|
#endif // ENABLE_GCODE_VIEWER
|
||||||
}
|
}
|
||||||
else if ((opt_key == "bed_shape") || (opt_key == "bed_custom_texture") || (opt_key == "bed_custom_model")) {
|
else if (opt_key == "bed_shape" || opt_key == "bed_custom_texture" || opt_key == "bed_custom_model") {
|
||||||
bed_shape_changed = true;
|
bed_shape_changed = true;
|
||||||
update_scheduled = true;
|
update_scheduled = true;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user