mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-10-26 18:21:18 -06:00
Merge branch 'master' of https://github.com/prusa3d/PrusaSlicer
This commit is contained in:
commit
2cc2c02a9c
15 changed files with 405 additions and 104 deletions
|
|
@ -98,9 +98,10 @@ void AppConfig::load()
|
|||
pt::read_ini(ifs, tree);
|
||||
} catch (pt::ptree_error& ex) {
|
||||
// Error while parsing config file. We'll customize the error message and rethrow to be displayed.
|
||||
throw std::runtime_error(wxString::Format(_(L("Error parsing config file, it is probably corrupted. "
|
||||
"Try to manualy delete the file. Your user profiles will not be affected.\n\n%s\n\n%s")),
|
||||
AppConfig::config_path(), ex.what()).ToStdString());
|
||||
throw std::runtime_error(
|
||||
_utf8(L("Error parsing PrusaSlicer config file, it is probably corrupted. "
|
||||
"Try to manualy delete the file to recover from the error. Your user profiles will not be affected.")) +
|
||||
"\n\n" + AppConfig::config_path() + "\n\n" + ex.what());
|
||||
}
|
||||
|
||||
// 2) Parse the property_tree, extract the sections and key / value pairs.
|
||||
|
|
|
|||
|
|
@ -293,6 +293,20 @@ bool GUI_App::on_init_inner()
|
|||
config_wizard_startup(app_conf_exists);
|
||||
preset_updater->slic3r_update_notify();
|
||||
preset_updater->sync(preset_bundle);
|
||||
const GLCanvas3DManager::GLInfo &glinfo = GLCanvas3DManager::get_gl_info();
|
||||
if (! glinfo.is_version_greater_or_equal_to(2, 0)) {
|
||||
// Complain about the OpenGL version.
|
||||
wxString message = wxString::Format(
|
||||
_(L("PrusaSlicer requires OpenGL 2.0 capable graphics driver to run correctly, \n"
|
||||
"while OpenGL version %s, render %s, vendor %s was detected.")), wxString(glinfo.get_version()), wxString(glinfo.get_renderer()), wxString(glinfo.get_vendor()));
|
||||
message += "\n";
|
||||
message += _(L("You may need to update your graphics card driver."));
|
||||
#ifdef _WIN32
|
||||
message += "\n";
|
||||
message += _(L("As a workaround, you may run PrusaSlicer with a software rendered 3D graphics by running prusa-slicer.exe with the --sw_renderer parameter."));
|
||||
#endif
|
||||
wxMessageBox(message, wxString("PrusaSlicer - ") + _(L("Unsupported OpenGL version")), wxOK | wxICON_ERROR);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -153,8 +153,8 @@ ObjectManipulation::ObjectManipulation(wxWindow* parent) :
|
|||
|
||||
auto manifold_warning_icon = [this](wxWindow* parent) {
|
||||
m_fix_throught_netfab_bitmap = new wxStaticBitmap(parent, wxID_ANY, wxNullBitmap);
|
||||
auto sizer = new wxBoxSizer(wxHORIZONTAL);
|
||||
sizer->Add(m_fix_throught_netfab_bitmap);
|
||||
// auto sizer = new wxBoxSizer(wxHORIZONTAL);
|
||||
// sizer->Add(m_fix_throught_netfab_bitmap);
|
||||
|
||||
if (is_windows10())
|
||||
m_fix_throught_netfab_bitmap->Bind(wxEVT_CONTEXT_MENU, [this](wxCommandEvent &e)
|
||||
|
|
@ -167,17 +167,19 @@ ObjectManipulation::ObjectManipulation(wxWindow* parent) :
|
|||
update_warning_icon_state(wxGetApp().obj_list()->get_mesh_errors_list());
|
||||
});
|
||||
|
||||
return sizer;
|
||||
// return sizer;
|
||||
return m_fix_throught_netfab_bitmap;
|
||||
};
|
||||
|
||||
line.append_widget(manifold_warning_icon);
|
||||
// line.append_widget(manifold_warning_icon);
|
||||
line.near_label_widget = manifold_warning_icon;
|
||||
def.label = "";
|
||||
def.gui_type = "legend";
|
||||
def.tooltip = L("Object name");
|
||||
#ifdef __APPLE__
|
||||
def.width = 19;
|
||||
def.width = 20;
|
||||
#else
|
||||
def.width = 21;
|
||||
def.width = 22;
|
||||
#endif
|
||||
def.set_default_value(new ConfigOptionString{ " " });
|
||||
line.append_option(Option(def, "object_name"));
|
||||
|
|
@ -392,10 +394,19 @@ ObjectManipulation::ObjectManipulation(wxWindow* parent) :
|
|||
|
||||
// call back for a rescale of button "Set uniform scale"
|
||||
m_og->rescale_near_label_widget = [this](wxWindow* win) {
|
||||
// rescale lock icon
|
||||
auto *ctrl = dynamic_cast<LockButton*>(win);
|
||||
if (ctrl == nullptr)
|
||||
if (ctrl != nullptr) {
|
||||
ctrl->msw_rescale();
|
||||
return;
|
||||
ctrl->msw_rescale();
|
||||
}
|
||||
|
||||
if (win == m_fix_throught_netfab_bitmap)
|
||||
return;
|
||||
|
||||
// rescale "place" of the empty icon (to correct layout of the "Size" and "Scale")
|
||||
if (dynamic_cast<wxStaticBitmap*>(win) != nullptr)
|
||||
win->SetMinSize(create_scaled_bitmap(m_parent, "one_layer_lock_on.png").GetSize());
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -685,6 +696,7 @@ void ObjectManipulation::emulate_kill_focus()
|
|||
void ObjectManipulation::update_warning_icon_state(const wxString& tooltip)
|
||||
{
|
||||
m_fix_throught_netfab_bitmap->SetBitmap(tooltip.IsEmpty() ? wxNullBitmap : m_manifold_warning_bmp.bmp());
|
||||
m_fix_throught_netfab_bitmap->SetMinSize(tooltip.IsEmpty() ? wxSize(0,0) : m_manifold_warning_bmp.bmp().GetSize());
|
||||
m_fix_throught_netfab_bitmap->SetToolTip(tooltip);
|
||||
}
|
||||
|
||||
|
|
@ -919,7 +931,10 @@ void ObjectManipulation::msw_rescale()
|
|||
{
|
||||
msw_rescale_word_local_combo(m_word_local_combo);
|
||||
m_manifold_warning_bmp.msw_rescale();
|
||||
m_fix_throught_netfab_bitmap->SetBitmap(m_manifold_warning_bmp.bmp());
|
||||
|
||||
const wxString& tooltip = m_fix_throught_netfab_bitmap->GetToolTipText();
|
||||
m_fix_throught_netfab_bitmap->SetBitmap(tooltip.IsEmpty() ? wxNullBitmap : m_manifold_warning_bmp.bmp());
|
||||
m_fix_throught_netfab_bitmap->SetMinSize(tooltip.IsEmpty() ? wxSize(0, 0) : m_manifold_warning_bmp.bmp().GetSize());
|
||||
|
||||
m_mirror_bitmap_on.msw_rescale();
|
||||
m_mirror_bitmap_off.msw_rescale();
|
||||
|
|
|
|||
|
|
@ -64,6 +64,12 @@ public:
|
|||
m_prev_scale_factor = m_scale_factor;
|
||||
m_normal_font = get_default_font_for_dpi(dpi);
|
||||
|
||||
/* Because of default window font is a primary display font,
|
||||
* We should set correct font for window before getting em_unit value.
|
||||
*/
|
||||
#ifndef __WXOSX__ // Don't call SetFont under OSX to avoid name cutting in ObjectList
|
||||
this->SetFont(m_normal_font);
|
||||
#endif
|
||||
// initialize default width_unit according to the width of the one symbol ("m") of the currently active font of this window.
|
||||
m_em_unit = std::max<size_t>(10, this->GetTextExtent("m").x - 1);
|
||||
|
||||
|
|
@ -72,6 +78,8 @@ public:
|
|||
this->Bind(EVT_DPI_CHANGED, [this](const DpiChangedEvent &evt) {
|
||||
m_scale_factor = (float)evt.dpi / (float)DPI_DEFAULT;
|
||||
|
||||
m_new_font_point_size = get_default_font_for_dpi(evt.dpi).GetPointSize();
|
||||
|
||||
if (!m_can_rescale)
|
||||
return;
|
||||
|
||||
|
|
@ -124,6 +132,8 @@ private:
|
|||
float m_prev_scale_factor;
|
||||
bool m_can_rescale{ true };
|
||||
|
||||
int m_new_font_point_size;
|
||||
|
||||
// void recalc_font()
|
||||
// {
|
||||
// wxClientDC dc(this);
|
||||
|
|
@ -135,14 +145,22 @@ private:
|
|||
// check if new scale is differ from previous
|
||||
bool is_new_scale_factor() const { return fabs(m_scale_factor - m_prev_scale_factor) > 0.001; }
|
||||
|
||||
// function for a font scaling of the window
|
||||
void scale_win_font(wxWindow *window, const int font_point_size)
|
||||
{
|
||||
wxFont new_font(window->GetFont());
|
||||
new_font.SetPointSize(font_point_size);
|
||||
window->SetFont(new_font);
|
||||
}
|
||||
|
||||
// recursive function for scaling fonts for all controls in Window
|
||||
void scale_controls_fonts(wxWindow *window, const float scale_f)
|
||||
void scale_controls_fonts(wxWindow *window, const int font_point_size)
|
||||
{
|
||||
auto children = window->GetChildren();
|
||||
|
||||
for (auto child : children) {
|
||||
scale_controls_fonts(child, scale_f);
|
||||
child->SetFont(child->GetFont().Scaled(scale_f));
|
||||
scale_controls_fonts(child, font_point_size);
|
||||
scale_win_font(child, font_point_size);
|
||||
}
|
||||
|
||||
window->Layout();
|
||||
|
|
@ -151,18 +169,18 @@ private:
|
|||
void rescale(const wxRect &suggested_rect)
|
||||
{
|
||||
this->Freeze();
|
||||
const float relative_scale_factor = m_scale_factor / m_prev_scale_factor;
|
||||
|
||||
// rescale fonts of all controls
|
||||
scale_controls_fonts(this, relative_scale_factor);
|
||||
this->SetFont(this->GetFont().Scaled(relative_scale_factor));
|
||||
scale_controls_fonts(this, m_new_font_point_size);
|
||||
// rescale current window font
|
||||
scale_win_font(this, m_new_font_point_size);
|
||||
|
||||
|
||||
// rescale normal_font value
|
||||
m_normal_font = m_normal_font.Scaled(relative_scale_factor);
|
||||
// set normal application font as a current window font
|
||||
m_normal_font = this->GetFont();
|
||||
|
||||
// An analog of em_unit value from GUI_App.
|
||||
m_em_unit = std::max<size_t>(10, 10 * m_scale_factor);
|
||||
// update em_unit value for new window font
|
||||
m_em_unit = std::max<size_t>(10, this->GetTextExtent("m").x - 1);
|
||||
|
||||
// rescale missed controls sizes and images
|
||||
on_dpi_changed(suggested_rect);
|
||||
|
|
|
|||
|
|
@ -39,10 +39,12 @@ DPIFrame(NULL, wxID_ANY, "", wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_S
|
|||
{
|
||||
// Fonts were created by the DPIFrame constructor for the monitor, on which the window opened.
|
||||
wxGetApp().update_fonts(this);
|
||||
/*
|
||||
#ifndef __WXOSX__ // Don't call SetFont under OSX to avoid name cutting in ObjectList
|
||||
this->SetFont(this->normal_font());
|
||||
#endif
|
||||
|
||||
// Font is already set in DPIFrame constructor
|
||||
*/
|
||||
// Load the icon either from the exe, or from the ico file.
|
||||
#if _WIN32
|
||||
{
|
||||
|
|
|
|||
|
|
@ -500,7 +500,8 @@ const std::vector<std::string>& Preset::sla_material_options()
|
|||
if (s_opts.empty()) {
|
||||
s_opts = {
|
||||
"initial_layer_height",
|
||||
"exposure_time", "initial_exposure_time",
|
||||
"exposure_time",
|
||||
"initial_exposure_time",
|
||||
"material_correction",
|
||||
"material_notes",
|
||||
"default_sla_material_profile",
|
||||
|
|
@ -526,6 +527,8 @@ const std::vector<std::string>& Preset::sla_printer_options()
|
|||
"relative_correction",
|
||||
"absolute_correction",
|
||||
"gamma_correction",
|
||||
"min_exposure_time", "max_exposure_time",
|
||||
"min_initial_exposure_time", "max_initial_exposure_time",
|
||||
"print_host", "printhost_apikey", "printhost_cafile",
|
||||
"printer_notes",
|
||||
"inherits"
|
||||
|
|
|
|||
|
|
@ -838,7 +838,7 @@ static wxString support_combo_value_for_config(const DynamicPrintConfig &config,
|
|||
|
||||
static wxString pad_combo_value_for_config(const DynamicPrintConfig &config)
|
||||
{
|
||||
return config.opt_bool("pad_enable") ? (config.opt_bool("pad_zero_elevation") ? _("Around object") : _("Below object")) : _("None");
|
||||
return config.opt_bool("pad_enable") ? (config.opt_bool("pad_zero_elevation") ? _("Around object") : _("Below object")) : _("None");
|
||||
}
|
||||
|
||||
void Tab::on_value_change(const std::string& opt_key, const boost::any& value)
|
||||
|
|
@ -860,8 +860,8 @@ void Tab::on_value_change(const std::string& opt_key, const boost::any& value)
|
|||
(opt_key == "supports_enable" || opt_key == "support_buildplate_only"))
|
||||
og_freq_chng_params->set_value("support", support_combo_value_for_config(*m_config, is_fff));
|
||||
|
||||
if (! is_fff && (opt_key == "pad_enable" || opt_key == "pad_zero_elevation"))
|
||||
og_freq_chng_params->set_value("pad", pad_combo_value_for_config(*m_config));
|
||||
if (! is_fff && (opt_key == "pad_enable" || opt_key == "pad_zero_elevation"))
|
||||
og_freq_chng_params->set_value("pad", pad_combo_value_for_config(*m_config));
|
||||
|
||||
if (opt_key == "brim_width")
|
||||
{
|
||||
|
|
@ -998,7 +998,7 @@ void Tab::update_frequently_changed_parameters()
|
|||
|
||||
og_freq_chng_params->set_value("support", support_combo_value_for_config(*m_config, is_fff));
|
||||
if (! is_fff)
|
||||
og_freq_chng_params->set_value("pad", pad_combo_value_for_config(*m_config));
|
||||
og_freq_chng_params->set_value("pad", pad_combo_value_for_config(*m_config));
|
||||
|
||||
const std::string updated_value_key = is_fff ? "fill_density" : "pad_enable";
|
||||
|
||||
|
|
@ -1772,13 +1772,13 @@ void TabFilament::reload_config()
|
|||
|
||||
void TabFilament::update_volumetric_flow_preset_hints()
|
||||
{
|
||||
wxString text;
|
||||
try {
|
||||
text = from_u8(PresetHints::maximum_volumetric_flow_description(*m_preset_bundle));
|
||||
} catch (std::exception &ex) {
|
||||
text = _(L("Volumetric flow hints not available\n\n")) + from_u8(ex.what());
|
||||
}
|
||||
m_volumetric_speed_description_line->SetText(text);
|
||||
wxString text;
|
||||
try {
|
||||
text = from_u8(PresetHints::maximum_volumetric_flow_description(*m_preset_bundle));
|
||||
} catch (std::exception &ex) {
|
||||
text = _(L("Volumetric flow hints not available\n\n")) + from_u8(ex.what());
|
||||
}
|
||||
m_volumetric_speed_description_line->SetText(text);
|
||||
}
|
||||
|
||||
void TabFilament::update()
|
||||
|
|
@ -1788,9 +1788,9 @@ void TabFilament::update()
|
|||
|
||||
m_update_cnt++;
|
||||
|
||||
wxString text = from_u8(PresetHints::cooling_description(m_presets->get_edited_preset()));
|
||||
m_cooling_description_line->SetText(text);
|
||||
this->update_volumetric_flow_preset_hints();
|
||||
wxString text = from_u8(PresetHints::cooling_description(m_presets->get_edited_preset()));
|
||||
m_cooling_description_line->SetText(text);
|
||||
this->update_volumetric_flow_preset_hints();
|
||||
Layout();
|
||||
|
||||
bool cooling = m_config->opt_bool("cooling", 0);
|
||||
|
|
@ -1812,8 +1812,8 @@ void TabFilament::update()
|
|||
|
||||
void TabFilament::OnActivate()
|
||||
{
|
||||
this->update_volumetric_flow_preset_hints();
|
||||
Tab::OnActivate();
|
||||
this->update_volumetric_flow_preset_hints();
|
||||
Tab::OnActivate();
|
||||
}
|
||||
|
||||
wxSizer* Tab::description_line_widget(wxWindow* parent, ogStaticText* *StaticText)
|
||||
|
|
@ -2290,6 +2290,12 @@ void TabPrinter::build_sla()
|
|||
optgroup->append_single_option_line("absolute_correction");
|
||||
optgroup->append_single_option_line("gamma_correction");
|
||||
|
||||
optgroup = page->new_optgroup(_(L("Exposure")));
|
||||
optgroup->append_single_option_line("min_exposure_time");
|
||||
optgroup->append_single_option_line("max_exposure_time");
|
||||
optgroup->append_single_option_line("min_initial_exposure_time");
|
||||
optgroup->append_single_option_line("max_initial_exposure_time");
|
||||
|
||||
optgroup = page->new_optgroup(_(L("Print Host upload")));
|
||||
build_printhost(optgroup.get());
|
||||
|
||||
|
|
@ -2560,7 +2566,7 @@ void TabPrinter::build_unregular_pages()
|
|||
optgroup = page->new_optgroup(_(L("Preview")));
|
||||
|
||||
auto reset_to_filament_color = [this, extruder_idx](wxWindow* parent) {
|
||||
add_scaled_button(parent, &m_reset_to_filament_color, "undo",
|
||||
add_scaled_button(parent, &m_reset_to_filament_color, "undo",
|
||||
_(L("Reset to Filament Color")), wxBU_LEFT | wxBU_EXACTFIT);
|
||||
ScalableButton* btn = m_reset_to_filament_color;
|
||||
btn->SetFont(Slic3r::GUI::wxGetApp().normal_font());
|
||||
|
|
@ -2571,7 +2577,7 @@ void TabPrinter::build_unregular_pages()
|
|||
{
|
||||
std::vector<std::string> colors = static_cast<const ConfigOptionStrings*>(m_config->option("extruder_colour"))->values;
|
||||
colors[extruder_idx] = "";
|
||||
|
||||
|
||||
DynamicPrintConfig new_conf = *m_config;
|
||||
new_conf.set_key_value("extruder_colour", new ConfigOptionStrings(colors));
|
||||
load_config(new_conf);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue