Skip to content

Commit 90017e5

Browse files
YuSankalukasmatena
authored andcommitted
Fix for #12920 - Prusa Slicer 2.8 rc 2 / iCCP: known incorrect sRGB profile
(SPE-2485)
1 parent 33bafd2 commit 90017e5

File tree

2 files changed

+45
-0
lines changed

2 files changed

+45
-0
lines changed

src/slic3r/GUI/GUI_App.cpp

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1256,6 +1256,10 @@ bool GUI_App::on_init_inner()
12561256
// Set initialization of image handlers before any UI actions - See GH issue #7469
12571257
wxInitAllImageHandlers();
12581258

1259+
// Set our own gui log as an active target
1260+
m_log_gui = new LogGui();
1261+
wxLog::SetActiveTarget(m_log_gui);
1262+
12591263
#if defined(_WIN32) && ! defined(_WIN64)
12601264
// Win32 32bit build.
12611265
if (wxPlatformInfo::Get().GetArchName().substr(0, 2) == "64") {
@@ -4146,5 +4150,31 @@ void GUI_App::show_printer_webview_tab()
41464150
mainframe->show_printer_webview_tab(preset_bundle->physical_printers.get_selected_printer_config());
41474151
}
41484152

4153+
4154+
4155+
bool LogGui::ignorred_message(const wxString& msg)
4156+
{
4157+
for(const wxString& err : std::initializer_list<wxString>{ wxString("cHRM chunk does not match sRGB"),
4158+
wxString("known incorrect sRGB profile") }) {
4159+
if (msg.Contains(err))
4160+
return true;
4161+
}
4162+
return false;
4163+
}
4164+
4165+
void LogGui::DoLogText(const wxString& msg)
4166+
{
4167+
if (ignorred_message(msg))
4168+
return;
4169+
wxLogGui::DoLogText(msg);
4170+
}
4171+
4172+
void LogGui::DoLogRecord(wxLogLevel level, const wxString& msg, const wxLogRecordInfo& info)
4173+
{
4174+
if (ignorred_message(msg))
4175+
return;
4176+
wxLogGui::DoLogRecord(level, msg, info);
4177+
}
4178+
41494179
} // GUI
41504180
} //Slic3r

src/slic3r/GUI/GUI_App.hpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,20 @@ static wxString dots("…", wxConvUTF8);
119119
#define SUPPORTS_MARKUP
120120
#endif
121121

122+
123+
// A wrapper class to allow ignoring some known warnings
124+
// and not bothering users with redundant messages.
125+
// see https://github.com/prusa3d/PrusaSlicer/issues/12920
126+
class LogGui : public wxLogGui
127+
{
128+
protected:
129+
void DoLogText(const wxString& msg) override;
130+
void DoLogRecord(wxLogLevel level, const wxString& msg, const wxLogRecordInfo& info) override;
131+
132+
private:
133+
bool ignorred_message(const wxString& msg);
134+
};
135+
122136
class GUI_App : public wxApp
123137
{
124138
public:
@@ -181,6 +195,7 @@ class GUI_App : public wxApp
181195
size_t m_instance_hash_int;
182196

183197
Search::OptionsSearcher* m_searcher{ nullptr };
198+
LogGui* m_log_gui { nullptr };
184199

185200
public:
186201
bool OnInit() override;

0 commit comments

Comments
 (0)