Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/prusa3d/PrusaSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYuSanka <yusanka@gmail.com>2022-04-13 19:13:58 +0300
committerYuSanka <yusanka@gmail.com>2022-04-13 19:15:46 +0300
commit09512c086ba3306538f93c1909933ebb5c772e09 (patch)
tree5a20f23b776f7a4ed7d3f6a7d660f45f707ae8e2
parent3ce2d3a700ef215b37faef273f54be5619b9d642 (diff)
Fix for SPE-1220:et_raycast_picking
* Added check of the visibility for selected presets when Configuration is loaded from SLA archive or from the G-code. * SLAImportDialog: * MSW specific: added dark mode * Center on parent
-rw-r--r--src/slic3r/GUI/Jobs/SLAImportDialog.hpp15
-rw-r--r--src/slic3r/GUI/Jobs/SLAImportJob.cpp1
-rw-r--r--src/slic3r/GUI/MainFrame.cpp2
-rw-r--r--src/slic3r/GUI/Plater.cpp91
-rw-r--r--src/slic3r/GUI/Plater.hpp1
5 files changed, 62 insertions, 48 deletions
diff --git a/src/slic3r/GUI/Jobs/SLAImportDialog.hpp b/src/slic3r/GUI/Jobs/SLAImportDialog.hpp
index 7dbecff2a..15cab9ed1 100644
--- a/src/slic3r/GUI/Jobs/SLAImportDialog.hpp
+++ b/src/slic3r/GUI/Jobs/SLAImportDialog.hpp
@@ -54,6 +54,7 @@ public:
inp_choices.size(), inp_choices.data(), wxCB_READONLY | wxCB_DROPDOWN);
szchoices->Add(m_import_dropdown);
+ szchoices->AddStretchSpacer(1);
szchoices->Add(new wxStaticText(this, wxID_ANY, _L("Quality") + ": "), 0, wxALIGN_CENTER | wxALL, 5);
static const std::vector<wxString> qual_choices = {
@@ -65,7 +66,7 @@ public:
m_quality_dropdown = new wxComboBox(
this, wxID_ANY, qual_choices[0], wxDefaultPosition, wxDefaultSize,
qual_choices.size(), qual_choices.data(), wxCB_READONLY | wxCB_DROPDOWN);
- szchoices->Add(m_quality_dropdown);
+ szchoices->Add(m_quality_dropdown, 1);
m_import_dropdown->Bind(wxEVT_COMBOBOX, [this](wxCommandEvent &) {
if (get_selection() == Sel::profileOnly)
@@ -73,14 +74,20 @@ public:
else m_quality_dropdown->Enable();
});
- szvert->Add(szchoices, 0, wxALL, 5);
- szvert->AddStretchSpacer(1);
+ szvert->Add(szchoices, 1, wxEXPAND | wxALL, 5);
auto szbtn = new wxBoxSizer(wxHORIZONTAL);
- szbtn->Add(new wxButton{this, wxID_CANCEL});
+ szbtn->Add(new wxButton{this, wxID_CANCEL}, 0, wxRIGHT, 5);
szbtn->Add(new wxButton{this, wxID_OK});
szvert->Add(szbtn, 0, wxALIGN_RIGHT | wxALL, 5);
SetSizerAndFit(szvert);
+ wxGetApp().UpdateDlgDarkUI(this);
+ }
+
+ int ShowModal() override
+ {
+ CenterOnParent();
+ return wxDialog::ShowModal();
}
Sel get_selection() const override
diff --git a/src/slic3r/GUI/Jobs/SLAImportJob.cpp b/src/slic3r/GUI/Jobs/SLAImportJob.cpp
index 96702d158..b7dc64d52 100644
--- a/src/slic3r/GUI/Jobs/SLAImportJob.cpp
+++ b/src/slic3r/GUI/Jobs/SLAImportJob.cpp
@@ -139,6 +139,7 @@ void SLAImportJob::finalize(bool canceled, std::exception_ptr &eptr)
config += std::move(p->profile);
wxGetApp().preset_bundle->load_config_model(name, std::move(config));
+ p->plater->check_selected_presets_visibility(ptSLA);
wxGetApp().load_current_presets();
}
diff --git a/src/slic3r/GUI/MainFrame.cpp b/src/slic3r/GUI/MainFrame.cpp
index ec4d012b2..af285e46e 100644
--- a/src/slic3r/GUI/MainFrame.cpp
+++ b/src/slic3r/GUI/MainFrame.cpp
@@ -1821,6 +1821,8 @@ bool MainFrame::load_config_file(const std::string &path)
show_error(this, ex.what());
return false;
}
+
+ m_plater->check_selected_presets_visibility(ptFFF);
wxGetApp().load_current_presets();
return true;
}
diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp
index 4218c9393..457b434d0 100644
--- a/src/slic3r/GUI/Plater.cpp
+++ b/src/slic3r/GUI/Plater.cpp
@@ -2336,6 +2336,52 @@ std::string Plater::priv::get_config(const std::string &key) const
return wxGetApp().app_config->get(key);
}
+// After loading of the presets from project, check if they are visible.
+// Set them to visible if they are not.
+void Plater::check_selected_presets_visibility(PrinterTechnology loaded_printer_technology)
+{
+ auto update_selected_preset_visibility = [](PresetCollection& presets, std::vector<std::string>& names) {
+ if (!presets.get_selected_preset().is_visible) {
+ assert(presets.get_selected_preset().name == presets.get_edited_preset().name);
+ presets.get_selected_preset().is_visible = true;
+ presets.get_edited_preset().is_visible = true;
+ names.emplace_back(presets.get_selected_preset().name);
+ }
+ };
+
+ std::vector<std::string> names;
+ PresetBundle* preset_bundle = wxGetApp().preset_bundle;
+ if (loaded_printer_technology == ptFFF) {
+ update_selected_preset_visibility(preset_bundle->prints, names);
+ for (const std::string& filament : preset_bundle->filament_presets) {
+ Preset* preset = preset_bundle->filaments.find_preset(filament);
+ if (preset && !preset->is_visible) {
+ preset->is_visible = true;
+ names.emplace_back(preset->name);
+ if (preset->name == preset_bundle->filaments.get_edited_preset().name)
+ preset_bundle->filaments.get_selected_preset().is_visible = true;
+ }
+ }
+ }
+ else {
+ update_selected_preset_visibility(preset_bundle->sla_prints, names);
+ update_selected_preset_visibility(preset_bundle->sla_materials, names);
+ }
+ update_selected_preset_visibility(preset_bundle->printers, names);
+
+ preset_bundle->update_compatible(PresetSelectCompatibleType::Never);
+
+ // show notification about temporarily installed presets
+ if (!names.empty()) {
+ std::string notif_text = into_u8(_L_PLURAL("The preset below was temporarily installed on the active instance of PrusaSlicer",
+ "The presets below were temporarily installed on the active instance of PrusaSlicer", names.size())) + ":";
+ for (std::string& name : names)
+ notif_text += "\n - " + name;
+ get_notification_manager()->push_notification(NotificationType::CustomNotification,
+ NotificationManager::NotificationLevel::PrintInfoNotificationLevel, notif_text);
+ }
+}
+
std::vector<size_t> Plater::priv::load_files(const std::vector<fs::path>& input_files, bool load_model, bool load_config, bool imperial_units/* = false*/)
{
if (input_files.empty()) { return std::vector<size_t>(); }
@@ -2435,50 +2481,7 @@ std::vector<size_t> Plater::priv::load_files(const std::vector<fs::path>& input_
Preset::normalize(config);
PresetBundle* preset_bundle = wxGetApp().preset_bundle;
preset_bundle->load_config_model(filename.string(), std::move(config));
- {
- // After loading of the presets from project, check if they are visible.
- // Set them to visible if they are not.
-
- auto update_selected_preset_visibility = [](PresetCollection& presets, std::vector<std::string>& names) {
- if (!presets.get_selected_preset().is_visible) {
- assert(presets.get_selected_preset().name == presets.get_edited_preset().name);
- presets.get_selected_preset().is_visible = true;
- presets.get_edited_preset().is_visible = true;
- names.emplace_back(presets.get_selected_preset().name);
- }
- };
-
- std::vector<std::string> names;
- if (loaded_printer_technology == ptFFF) {
- update_selected_preset_visibility(preset_bundle->prints, names);
- for (const std::string& filament : preset_bundle->filament_presets) {
- Preset* preset = preset_bundle->filaments.find_preset(filament);
- if (preset && !preset->is_visible) {
- preset->is_visible = true;
- names.emplace_back(preset->name);
- if (preset->name == preset_bundle->filaments.get_edited_preset().name)
- preset_bundle->filaments.get_selected_preset().is_visible = true;
- }
- }
- }
- else {
- update_selected_preset_visibility(preset_bundle->sla_prints, names);
- update_selected_preset_visibility(preset_bundle->sla_materials, names);
- }
- update_selected_preset_visibility(preset_bundle->printers, names);
-
- preset_bundle->update_compatible(PresetSelectCompatibleType::Never);
-
- // show notification about temporarily installed presets
- if (!names.empty()) {
- std::string notif_text = into_u8(_L_PLURAL("The preset below was temporarily installed on the active instance of PrusaSlicer",
- "The presets below were temporarily installed on the active instance of PrusaSlicer", names.size())) + ":";
- for (std::string& name : names)
- notif_text += "\n - " + name;
- notification_manager->push_notification(NotificationType::CustomNotification,
- NotificationManager::NotificationLevel::PrintInfoNotificationLevel, notif_text);
- }
- }
+ q->check_selected_presets_visibility(loaded_printer_technology);
if (loaded_printer_technology == ptFFF)
CustomGCode::update_custom_gcode_per_print_z_from_config(model.custom_gcode_per_print_z, &preset_bundle->project_config);
diff --git a/src/slic3r/GUI/Plater.hpp b/src/slic3r/GUI/Plater.hpp
index 124725018..ff27834ce 100644
--- a/src/slic3r/GUI/Plater.hpp
+++ b/src/slic3r/GUI/Plater.hpp
@@ -175,6 +175,7 @@ public:
std::vector<size_t> load_files(const std::vector<std::string>& input_files, bool load_model = true, bool load_config = true, bool imperial_units = false);
// to be called on drag and drop
bool load_files(const wxArrayString& filenames);
+ void check_selected_presets_visibility(PrinterTechnology loaded_printer_technology);
const wxString& get_last_loaded_gcode() const { return m_last_loaded_gcode; }