Skip to content

Commit

Permalink
fix cooling crash & more fixes & update to it translation
Browse files Browse the repository at this point in the history
  • Loading branch information
supermerill committed Dec 31, 2023
2 parents 5baf04a + 70a1ffa commit da69166
Show file tree
Hide file tree
Showing 11 changed files with 11,935 additions and 6,173 deletions.
4,586 changes: 4,412 additions & 174 deletions resources/localization/it/Slic3r.po

Large diffs are not rendered by default.

4,808 changes: 335 additions & 4,473 deletions resources/localization/it/TODO.po

Large diffs are not rendered by default.

8,553 changes: 7,087 additions & 1,466 deletions resources/localization/it/it_database.po

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions resources/localization/it/settings.ini
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ data = Slic3r.po
data = TODO.po
data = it_database.po
data = PrusaSlicer_it.po
data = SuperSlicerITAnew.po

# optional: output all the knowledge base into a file, to be reused in the future.
database_out = it_database.po
Expand Down
44 changes: 3 additions & 41 deletions src/libslic3r/AppConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -662,54 +662,16 @@ void AppConfig::init_ui_layout() {
} else {
get_versions(data_dir_path, datadir_map);
}
// TODO test the version of the datadir_map layout to see if compatible


//copy all resources that aren't in datadir or newer
std::string current_name = get("ui_layout");
bool find_current = false;
std::string error_message;
for (const auto& layout : resources_map) {
auto it_datadir_layout = datadir_map.find(layout.first);
if (it_datadir_layout != datadir_map.end()) {
// compare version
if (it_datadir_layout->second.version < layout.second.version) {
//erase and copy
for (boost::filesystem::directory_entry& file : boost::filesystem::directory_iterator(it_datadir_layout->second.path)) {
boost::filesystem::remove_all(file.path());
}
for (boost::filesystem::directory_entry& file : boost::filesystem::directory_iterator(layout.second.path)) {
if (copy_file_inner(file.path(), it_datadir_layout->second.path / file.path().filename(), error_message))
throw FileIOError(error_message);
}
//update for saving
it_datadir_layout->second.version = layout.second.version;
it_datadir_layout->second.description = layout.second.description;
} else if (it_datadir_layout->second.version == layout.second.version) {
//if same verison, only erase files more recent
//this is useful when there is many rapid changes, to test modifications.
for (boost::filesystem::directory_entry& resources_file : boost::filesystem::directory_iterator(layout.second.path)) {
boost::filesystem::path datadir_path = it_datadir_layout->second.path / resources_file.path().filename();
std::time_t resources_last_mod = boost::filesystem::last_write_time(resources_file.path());
std::time_t datadir_last_mod = boost::filesystem::last_write_time(datadir_path);
if (datadir_last_mod < resources_last_mod) {
boost::filesystem::remove_all(datadir_path);
if (copy_file_inner(resources_file.path(), datadir_path, error_message))
throw FileIOError(error_message);
}
}

}
} else {
// Doesn't exists, copy
boost::filesystem::create_directory(data_dir_path / layout.second.path.filename());
for (boost::filesystem::directory_entry& file : boost::filesystem::directory_iterator(layout.second.path)) {
if (copy_file_inner(file.path(), data_dir_path / layout.second.path.filename() / file.path().filename(), error_message))
throw FileIOError(error_message);
}
//update for saving
datadir_map[layout.first] = layout.second;
datadir_map[layout.first].path = data_dir_path / layout.second.path.filename();
}
// don't use the datadir version, the one in my resources is the one adapated to my version.
datadir_map[layout.first] = layout.second;
}

//save installed
Expand Down
55 changes: 48 additions & 7 deletions src/libslic3r/PerimeterGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,45 @@ ProcessSurfaceResult PerimeterGenerator::process_arachne(int& loop_number, const
this->layer->height, *this->object_config, *this->print_config);
std::vector<Arachne::VariableWidthLines> perimeters = wallToolPaths.getToolPaths();

#if _DEBUG
for (auto periemter : perimeters) {
for (Arachne::ExtrusionLine &extrusion : periemter) {
if (extrusion.isZeroLength())
continue;
for (Slic3r::Arachne::ExtrusionJunction &junction : extrusion.junctions) {
Point pt = junction.p;
assert(unscaled(pt.x()) < 10000 && unscaled(pt.x()) > -10000);
assert(unscaled(pt.y()) < 10000 && unscaled(pt.y()) > -10000);
}
}
}
#endif
// hack to fix points that go to the moon. https://github.com/supermerill/SuperSlicer/issues/4032
// get max dist possible
BoundingBox bb;
for (ExPolygon &expo : last) bb.merge(expo.contour.points);
const coordf_t max_dist = bb.min.distance_to_square(bb.max);
//detect astray points and delete them
for (Arachne::VariableWidthLines &perimeter : perimeters) {
for (auto it_extrusion = perimeter.begin(); it_extrusion != perimeter.end();) {
Point last_point = bb.min;
for (auto it_junction = it_extrusion->junctions.begin(); it_junction != it_extrusion->junctions.end();) {
coordf_t dist = it_junction->p.distance_to_square(last_point);
if (dist > max_dist) {
it_junction = it_extrusion->junctions.erase(it_junction);
} else {
last_point = it_junction->p;
++it_junction;
}
}
if (it_extrusion->junctions.size() < 2) {
it_extrusion = perimeter.erase(it_extrusion);
} else {
++it_extrusion;
}
}
}

// only_one_perimeter_top, from orca
if (!out_shell.empty()) {
// Combine outer shells
Expand Down Expand Up @@ -1686,7 +1725,8 @@ ProcessSurfaceResult PerimeterGenerator::process_classic(int& loop_number, const
//remove too small gaps that are too hard to fill.
//ie one that are smaller than an extrusion with width of min and a length of max.
if (expoly.area() > minarea) {
ExPolygons expoly_after_shrink_test = offset_ex(ExPolygons{ expoly }, double(-min * 0.5));
const coordf_t offset_test = min * 0.5;
ExPolygons expoly_after_shrink_test = offset_ex(ExPolygons{expoly}, -offset_test);
//if the shrink split the area in multipe bits
if (expoly_after_shrink_test.size() > 1) {
//remove too small bits
Expand All @@ -1695,22 +1735,23 @@ ProcessSurfaceResult PerimeterGenerator::process_classic(int& loop_number, const
expoly_after_shrink_test.erase(expoly_after_shrink_test.begin() + exp_idx);
exp_idx--;
} else {
ExPolygons wider = offset_ex(ExPolygons{ expoly_after_shrink_test[exp_idx] }, min * 0.5);
ExPolygons wider = offset_ex(ExPolygons{ expoly_after_shrink_test[exp_idx] }, offset_test);
if (wider.empty() || wider[0].area() < minarea) {
expoly_after_shrink_test.erase(expoly_after_shrink_test.begin() + exp_idx);
exp_idx--;
}
}
}
//maybe some areas are a just bit too thin, try with just a little more offset to remove them.
ExPolygons expoly_after_shrink_test2 = offset_ex(ExPolygons{ expoly }, double(-min * 0.8));
const coordf_t offset_test_2 = min * 0.8;
ExPolygons expoly_after_shrink_test2 = offset_ex(ExPolygons{expoly}, -offset_test_2);
for (int exp_idx = 0; exp_idx < expoly_after_shrink_test2.size(); exp_idx++) {
if (expoly_after_shrink_test2[exp_idx].area() < (SCALED_EPSILON * SCALED_EPSILON * 4)) {
expoly_after_shrink_test2.erase(expoly_after_shrink_test2.begin() + exp_idx);
exp_idx--;

} else {
ExPolygons wider = offset_ex(ExPolygons{ expoly_after_shrink_test2[exp_idx] }, min * 0.5);
ExPolygons wider = offset_ex(ExPolygons{ expoly_after_shrink_test2[exp_idx] }, offset_test_2);
if (wider.empty() || wider[0].area() < minarea) {
expoly_after_shrink_test2.erase(expoly_after_shrink_test2.begin() + exp_idx);
exp_idx--;
Expand All @@ -1719,15 +1760,15 @@ ProcessSurfaceResult PerimeterGenerator::process_classic(int& loop_number, const
}
//it's better if there are significantly less extrusions
if (expoly_after_shrink_test.size() / 1.42 > expoly_after_shrink_test2.size()) {
expoly_after_shrink_test2 = offset_ex(expoly_after_shrink_test2, double(min * 0.8));
expoly_after_shrink_test2 = offset_ex(expoly_after_shrink_test2, offset_test_2);
//insert with move instead of copy
std::move(expoly_after_shrink_test2.begin(), expoly_after_shrink_test2.end(), std::back_inserter(gaps_ex));
} else {
expoly_after_shrink_test = offset_ex(expoly_after_shrink_test, double(min * 0.8));
expoly_after_shrink_test = offset_ex(expoly_after_shrink_test, offset_test);
std::move(expoly_after_shrink_test.begin(), expoly_after_shrink_test.end(), std::back_inserter(gaps_ex));
}
} else {
expoly_after_shrink_test = offset_ex(expoly_after_shrink_test, double(min * 0.8));
expoly_after_shrink_test = offset_ex(expoly_after_shrink_test, offset_test);
std::move(expoly_after_shrink_test.begin(), expoly_after_shrink_test.end(), std::back_inserter(gaps_ex));
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/libslic3r/PrintConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3149,7 +3149,7 @@ void PrintConfigDef::init_fff_params()
"\nThis could be combined with extra permeters on odd layers."
"\nWorks as absolute spacing or a % of the spacing."
"\nset 0 to disable");
def->sidetext = L("mm of %");
def->sidetext = L("mm or %");
def->mode = comExpert | comSuSi;
def->set_default_value(new ConfigOptionFloatOrPercent(false, 0));

Expand Down
2 changes: 1 addition & 1 deletion src/slic3r/GUI/DoubleSlider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1191,7 +1191,7 @@ void Control::draw_ruler(wxDC& dc)
break;
// short ticks from the last tick to the end of current sequence
//note: first sequence can be empty.
if(!std::isnan(short_tick));
if(!std::isnan(short_tick))
draw_short_ticks(dc, short_tick, tick);
if (sequence < m_ruler.count() - 1) sequence++;
}
Expand Down
6 changes: 4 additions & 2 deletions src/slic3r/GUI/GUI_App.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2581,8 +2581,9 @@ void GUI_App::add_config_menu(wxMenuBar *menu)
// the dialog needs to be destroyed before the call to recreate_GUI()
// or sometimes the application crashes into wxDialogBase() destructor
// so we put it into an inner scope
PreferencesDialog dlg(mainframe);
dlg.ShowModal();
PreferencesDialog dlg(mainframe);
try{
dlg.ShowModal();
app_layout_changed = dlg.settings_layout_changed();
if (dlg.seq_top_layer_only_changed())
this->plater_->refresh_print();
Expand All @@ -2603,6 +2604,7 @@ void GUI_App::add_config_menu(wxMenuBar *menu)
associate_gcode_files();
}
#endif // _WIN32
} catch (std::exception e) {}
}
if (app_layout_changed) {
// hide full main_sizer for mainFrame
Expand Down
47 changes: 41 additions & 6 deletions src/slic3r/GUI/Preferences.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include "libslic3r/AppConfig.hpp"

#include <wx/notebook.h>
#include <wx/scrolwin.h>
#include "Notebook.hpp"
#include "ButtonsDescription.hpp"
#include "OG_CustomCtrl.hpp"
Expand Down Expand Up @@ -49,7 +50,7 @@ namespace GUI {

PreferencesDialog::PreferencesDialog(wxWindow* parent, int selected_tab, const std::string& highlight_opt_key) :
DPIDialog(parent, wxID_ANY, _L("Preferences"), wxDefaultPosition,
wxDefaultSize, wxDEFAULT_DIALOG_STYLE)
wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER )
{
#ifdef __WXOSX__
isOSX = true;
Expand All @@ -58,16 +59,18 @@ PreferencesDialog::PreferencesDialog(wxWindow* parent, int selected_tab, const s
if (!highlight_opt_key.empty())
init_highlighter(highlight_opt_key);
}

static std::shared_ptr<ConfigOptionsGroup>create_options_tab(const wxString& title, wxBookCtrlBase* tabs)
{
wxPanel* tab = new wxPanel(tabs, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxBK_LEFT | wxTAB_TRAVERSAL);
//set inside a scrollable panel
wxScrolledWindow *tab = new wxScrolledWindow(tabs, wxID_ANY, wxDefaultPosition, wxDefaultSize,
wxBK_LEFT | wxTAB_TRAVERSAL | wxVSCROLL);
tabs->AddPage(tab, title);
tab->SetFont(wxGetApp().normal_font());

wxBoxSizer* sizer = new wxBoxSizer(wxVERTICAL);
sizer->SetSizeHints(tab);
tab->SetSizer(sizer);
tab->SetScrollRate(0, 5);

std::shared_ptr<ConfigOptionsGroup> optgroup = std::make_shared<ConfigOptionsGroup>(tab);
optgroup->title_width = 40;
Expand Down Expand Up @@ -880,6 +883,7 @@ void PreferencesDialog::build(size_t selected_tab)

SetSizer(sizer);
sizer->SetSizeHints(this);
this->layout();
this->CenterOnParent();
}

Expand Down Expand Up @@ -1053,10 +1057,41 @@ void PreferencesDialog::on_dpi_changed(const wxRect &suggested_rect)

void PreferencesDialog::layout()
{
const int em = em_unit();

const int em = em_unit();
SetMinSize(wxSize(47 * em, 28 * em));
Fit();

// Fit(); is SetSize(GetBestSize) but GetBestSize doesn't work for scroll pane. we need GetBestVirtualSize over all scroll panes
wxSize best_size = this->GetBestSize();
// Get ScrollPanels for each tab
assert(!this->GetChildren().empty());
assert(!this->GetChildren().front()->GetChildren().empty());
if(this->GetChildren().empty() || this->GetChildren().front()->GetChildren().empty()) return;
std::vector<wxPanel*> panels;
for (auto c : this->GetChildren().front()->GetChildren()) {
if (wxPanel *panel = dynamic_cast<wxPanel *>(c); panel)
panels.push_back(panel);
}

if (!panels.empty()) {
// get a size where all tabs fit into
wxSize biggest_virtual_size = panels.front()->GetBestVirtualSize();
for (wxPanel *tab : panels) {
wxSize current_size = tab->GetBestVirtualSize();
biggest_virtual_size.x = std::max(biggest_virtual_size.x, current_size.x);
biggest_virtual_size.y = std::max(biggest_virtual_size.y, current_size.y);
}
best_size = biggest_virtual_size;
//best_size += tab_inset;
}
// add space for buttons and insets of the main panel
best_size += wxSize(3 * em, 12 * em);
// also reduce size to fit in screen if needed
wxDisplay display(wxDisplay::GetFromWindow(this));
wxRect screen = display.GetClientArea();
best_size.x = std::min(best_size.x, screen.width);
best_size.y = std::min(best_size.y, screen.height);
// apply
SetSize(best_size);

Refresh();
}
Expand Down
4 changes: 2 additions & 2 deletions version.inc
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ set(SLIC3R_APP_KEY "SuperSlicer")
set(SLIC3R_APP_CMD "superslicer")
# versions
set(SLIC3R_VERSION "2.5.59")
set(SLIC3R_VERSION_FULL "2.5.59.5")
set(SLIC3R_VERSION_FULL "2.5.59.6")
set(SLIC3R_BUILD_ID "${SLIC3R_APP_KEY}_${SLIC3R_VERSION_FULL}+UNKNOWN")
set(SLIC3R_RC_VERSION "2,5,59,5")
set(SLIC3R_RC_VERSION "2,5,59,6")
set(SLIC3R_RC_VERSION_DOTS "${SLIC3R_VERSION_FULL}")

# Same as the slicer name but for gcodeviewer
Expand Down

0 comments on commit da69166

Please sign in to comment.