Merge branch 'main' into fix/login-crash

This commit is contained in:
SoftFever
2026-10-14 01:16:35 +08:00
committed by GitHub
182 changed files with 100423 additions and 17635 deletions
+76 -7
View File
@@ -1109,6 +1109,8 @@ void GUI_App::post_init()
}
this->check_new_version_sf();
if (!cw_showed)
this->check_legacy_user_filament_presets(false);
const auto cloud_provider = get_printer_cloud_provider();
if (is_user_login(cloud_provider) && !app_config->get_stealth_mode()) {
// this->check_privacy_version(0);
@@ -3549,6 +3551,10 @@ bool GUI_App::on_init_inner()
}
// BBS if load user preset failed
// Let the libslic3r know the callback, which will translate messages on demand.
// Installed before the presets load so that their load errors are translated too.
Slic3r::I18N::set_translate_callback(libslic3r_translate_callback);
//if (loaded_preset_result != 0) {
try {
// Enable all substitutions (in both user and system profiles), but log the substitutions in user profiles only.
@@ -3566,9 +3572,6 @@ bool GUI_App::on_init_inner()
register_win32_device_notification_event();
#endif // WIN32
// Let the libslic3r know the callback, which will translate messages on demand.
Slic3r::I18N::set_translate_callback(libslic3r_translate_callback);
#if defined(__WXGTK__) && wxHAS_EGL
// Configure GL backend before any wxGLCanvas is created.
// On X11, prefer GLX for maximum driver compatibility.
@@ -6811,6 +6814,71 @@ void GUI_App::reload_settings()
}
}
void GUI_App::check_legacy_user_filament_presets(bool by_user)
{
if (!by_user && app_config->get_bool("legacy_user_filament_presets_dont_remind"))
return;
const std::vector<LegacyUserFilamentPreset> legacy_presets = preset_bundle->legacy_user_filament_presets();
if (legacy_presets.empty()) {
if (by_user)
MessageDialog(mainframe, _L("All your filament presets are available on the printers they were made for."),
_L("Migrate Filament Presets"), wxOK | wxICON_INFORMATION).ShowModal();
return;
}
wxString message = _L("OrcaSlicer 2.5.0 restructured many system filament presets to fix incorrect profiles and prepare "
"for future features. As a result, the presets below no longer show on some printers they were made "
"for. Sorry for the trouble; this is a one-time fix.\n\n"
"Add those printers back to your presets now? Your presets are backed up first. You can also do this "
"later from Help > Migrate Filament Presets.") + "\n";
for (const LegacyUserFilamentPreset &legacy : legacy_presets) {
message += "\n" + format_wxstr(_L("%1% (based on %2%)"), legacy.preset, legacy.parent);
for (const std::string &printer : legacy.printers)
message += "\n " + from_u8(printer);
}
RichMessageDialog dlg(mainframe, message, _L("Migrate Filament Presets"), wxYES | wxNO | wxICON_QUESTION);
if (!by_user)
dlg.ShowCheckBox(_L("Don't remind me again"));
const bool migrate = dlg.ShowModal() == wxID_YES;
if (dlg.IsCheckBoxChecked())
app_config->set_bool("legacy_user_filament_presets_dont_remind", true);
if (!migrate)
return;
const PresetBundle::LegacyUserFilamentPresetMigration migration = preset_bundle->migrate_legacy_user_filament_presets(legacy_presets);
const std::string &backup = migration.backup;
const std::vector<std::string> &failed = migration.failed;
if (backup.empty()) {
show_error(mainframe, _L("Your presets could not be backed up, so they were not migrated."));
return;
}
if (!migration.locked) {
// The lock is also refused for a while after a miss, and when the lock file itself cannot be opened.
show_error(mainframe, _L("The user presets folder could not be locked, so nothing was migrated. Another OrcaSlicer "
"instance may be saving presets; try again later from Help > Migrate Filament Presets."));
return;
}
if (failed.size() == legacy_presets.size()) {
show_error(mainframe, format_wxstr(_L("Your filament presets could not be migrated. A backup of your presets was saved to:\n%1%"), backup));
return;
}
preset_bundle->update_compatible(PresetSelectCompatibleType::Never);
mainframe->update_side_preset_ui();
for (auto tab : tabs_list) {
tab->reload_config();
tab->update_changed_ui();
}
message = format_wxstr(_L("Your filament presets were migrated. Select them again in the filament list where you used them.\n\n"
"A backup of your presets was saved to:\n%1%"), backup);
if (!failed.empty()) {
message += "\n\n" + _L("These presets could not be migrated:");
for (const std::string &name : failed)
message += "\n" + from_u8(name);
}
MessageDialog(mainframe, message, _L("Migrate Filament Presets"), wxOK | (failed.empty() ? wxICON_INFORMATION : wxICON_WARNING)).ShowModal();
}
//BBS reload when logout
void GUI_App::remove_user_presets()
{
@@ -8577,22 +8645,23 @@ void GUI_App::refresh_plugins()
// and report completion through the notification manager -- the speed dial needs no dialog.
std::thread([]() {
wxString error;
bool unknown_error = false;
try {
refresh_plugin_metadata_blocking(/*fetch_cloud=*/true);
} catch (const std::exception& ex) {
error = from_u8(ex.what());
} catch (...) {
error = "Unknown error"; // plain literal: wx translation isn't safe off the UI thread
unknown_error = true; // translated in CallAfter: wx translation isn't safe off the UI thread
}
if (!wxTheApp)
return;
wxTheApp->CallAfter([error]() {
wxTheApp->CallAfter([error, unknown_error]() {
if (wxGetApp().is_closing())
return;
Plater* plater = wxGetApp().plater();
if (plater == nullptr)
return;
if (error.IsEmpty())
if (error.IsEmpty() && !unknown_error)
plater->get_notification_manager()->push_notification(
NotificationType::CustomNotification,
NotificationManager::NotificationLevel::RegularNotificationLevel,
@@ -8601,7 +8670,7 @@ void GUI_App::refresh_plugins()
plater->get_notification_manager()->push_notification(
NotificationType::CustomNotification,
NotificationManager::NotificationLevel::ErrorNotificationLevel,
into_u8(wxString::Format(_L("Failed to refresh plugins: %s"), error)));
into_u8(wxString::Format(_L("Failed to refresh plugins: %s"), unknown_error ? _L("Unknown error") : error)));
});
}).detach();
}