OrcaSlicer latest
OrcaSlicer
Loading...
Searching...
No Matches
Slic3r::GUI::TroubleshootDialog Class Reference

#include </home/runner/work/OrcaSlicer/OrcaSlicer/src/slic3r/GUI/TroubleshootDialog.hpp>

Inheritance diagram for Slic3r::GUI::TroubleshootDialog:
Collaboration diagram for Slic3r::GUI::TroubleshootDialog:

Public Member Functions

 TroubleshootDialog ()
void EndModal (int retCode) override
float scale_factor () const
float prev_scale_factor () const
void set_scale_factor (float v)
void set_prev_scale_factor (float v)
void set_em_unit (int v)
bool force_rescale () const
int em_unit () const
const wxFont & normal_font () const
void enable_force_rescale ()
int ShowModal ()

Protected Member Functions

wxFlexGridSizer * create_item_loaded_profiles ()
ComboBox * create_item_log_level_combo ()
wxString GetTimestamp ()
wxString GetSysInfoAll ()
wxString GetProfilesOverview ()
wxString GetOStype ()
wxString GetOSinfo ()
wxString GetPackageType ()
wxString GetCPUinfo ()
wxString GetGPUinfo ()
wxString GetRAMinfo ()
wxString GetMONinfo ()
void PackAll ()
void RebuildSystemProfiles ()
bool RestartApplication ()
void ClearLogs ()
void UpdateLogsStorage ()
void BrowseFolder (std::string path)
bool ExportAsJson (const wxString &json_data, const wxString &export_name=wxEmptyString)
bool ExportAsZip (const std::vector< wxString > &sources, const wxString &export_name)
bool AddToZip (wxZipOutputStream &zip, const wxString &fullPathOrTextData, const wxString &rootDir)
bool SaveAsZip (const std::vector< wxString > &sourcePaths, const wxString &zipFullPath)
void on_dpi_changed (const wxRect &suggested_rect) override
virtual void on_sys_color_changed ()

Static Protected Member Functions

static std::map< std::string, std::string > parse_lscpu_etc (const std::string &name, char delimiter)

Private Member Functions

void update_em_unit ()
bool is_new_scale_factor () const
void rescale (const wxRect &suggested_rect)

Private Attributes

ScalableBitmap m_logo
wxStaticBitmap * m_header_logo
Label * m_logs_storage
int m_printers__act
int m_printers__usr
int m_filaments_act
int m_filaments_usr
int m_processes_act
int m_processes_usr
bool m_sys_panel_mode = true
float m_scale_factor
int m_em_unit
wxFont m_normal_font
float m_prev_scale_factor
bool m_can_rescale
bool m_force_rescale
int m_new_font_point_size

Detailed Description

Constructor & Destructor Documentation

◆ TroubleshootDialog()

Slic3r::GUI::TroubleshootDialog::TroubleshootDialog ( )
168 : DPIDialog(static_cast<wxWindow*>(wxGetApp().mainframe), wxID_ANY, _L("Troubleshoot Center"),
169 wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE)
170{
171 SetFont(wxGetApp().normal_font());
172 SetBackgroundColour(*wxWHITE);
173
174 auto data_dir = boost::filesystem::path(Slic3r::data_dir());
175 auto app_config = wxGetApp().app_config;
176 bool is_dark = app_config->get("dark_color_mode") == "1";
177
178 // LEFT SIZER //////////////////////
179
180 // HEADER
181 m_logo = ScalableBitmap(this, is_dark ? "OrcaSlicer_horizontal_dark" : "OrcaSlicer_horizontal_light", 64);
182 m_header_logo = new wxStaticBitmap(this, wxID_ANY, m_logo.bmp());
183 auto logo_line = new wxPanel(this, wxID_ANY, wxDefaultPosition, wxSize(-1, FromDIP(2)));
184 logo_line->SetBackgroundColour(StateColor::darkModeColorFor(wxColour("#009687")));
185 auto version = new Label(this, wxString(SoftFever_VERSION), wxALIGN_CENTRE_HORIZONTAL);
186 wxFont version_font = GetFont();
187 version_font = version_font.Scaled(1.65f); // SetPointSize(18) not works on macOS because it uses a 72 PPI reference
188 version->SetFont(version_font);
189 version->SetForegroundColour(StateColor::darkModeColorFor(wxColour("#363636")));
190
191 auto build = new Button(this, wxString(build_commit_label));
193 auto hash_url = "https://github.com/OrcaSlicer/OrcaSlicer/commit/" + wxString(build_commit_hash);
194 build->SetToolTip(hash_url);
195 build->Bind(wxEVT_BUTTON, [hash_url](wxCommandEvent &e) {
196 wxLaunchDefaultBrowser(hash_url);
197 });
198
199 // SYSTEM INFO
200 auto sys_info_lines = [this](bool show_sys) {
201 if(!show_sys)
202 return std::vector<wxString>{GetOStype()};
203 return std::vector<wxString>{
204 GetOSinfo(),
205#ifdef __LINUX__
206 GetPackageType() + GetAppDisplayBackend(),
207#else
209#endif
210 GetCPUinfo(),
211 GetRAMinfo() + " RAM",
212 GetGPUinfo(),
213 GetMONinfo()
214 };
215 };
216
217 auto* sys_panel = new CenteredMultiLinePanel(this, sys_info_lines(true));
218 sys_panel->SetBackgroundColour(*wxWHITE);
219 sys_panel->SetForegroundColour(StateColor::darkModeColorFor(wxColour("#363636")));
220
221 auto sys_less_btn = new Button(this, _L("Hide"));
222 sys_less_btn->SetStyle(ButtonStyle::Regular, ButtonType::Window);
223 sys_less_btn->SetToolTip(_L("Show/Hide system information"));
224
225 auto sys_copy_btn = new Button(this, _L("Copy"));
226 sys_copy_btn->SetStyle(ButtonStyle::Regular, ButtonType::Window);
227 sys_copy_btn->SetToolTip(_L("Copy system information to clipboard"));
228
229 sys_copy_btn->Bind(wxEVT_BUTTON, [this](wxCommandEvent &e) {
230 wxClipboardLocker lock;
231 if (!lock)
232 return false;
233 return wxTheClipboard->SetData(new wxTextDataObject(GetSysInfoAll()));
234 });
235
236 sys_less_btn->Bind(wxEVT_BUTTON, [this, sys_panel, sys_less_btn, sys_info_lines](wxCommandEvent &e) {
238 sys_panel->SetText(sys_info_lines(m_sys_panel_mode));
239 sys_less_btn->SetLabel(m_sys_panel_mode ? _L("Hide") : _L("Show"));
240 Layout();
241 Fit();
242 });
243
244 auto wiki_btn = new Button(this, "", "toolbar_wiki", 0, 15);
245 auto wiki_url = "https://www.orcaslicer.com/wiki/troubleshoot_center";
246 wiki_btn->SetToolTip(_L("Wiki Guide") + "\n" + wiki_url);
247 wiki_btn->SetStyle(ButtonStyle::Confirm, ButtonType::Circle);
248 wiki_btn->SetCanFocus(false);
249 wiki_btn->Bind(wxEVT_LEFT_DOWN, ([wiki_url](auto& e) {wxLaunchDefaultBrowser(wiki_url);}));
250
251 auto video_btn = new Button(this, "", "toolbar_video_guide", 0, 15);
252 auto video_url = "https://www.youtube.com/watch?v=CFzt8W7OCx0";
253 video_btn->SetToolTip(_L("Video Guide") + "\n" + video_url);
254 video_btn->SetStyle(ButtonStyle::Confirm, ButtonType::Circle);
255 video_btn->SetCanFocus(false);
256 video_btn->Bind(wxEVT_LEFT_DOWN, ([video_url](auto& e) {wxLaunchDefaultBrowser(video_url);}));
257
258 // RIGHT SIZER //////////////////////
259
260 auto create_title = [this](wxString title) {
261 auto line = new StaticLine(this, false, title);
262 line->SetFont(Label::Head_16);
263 line->SetForegroundColour(StateColor::darkModeColorFor(wxColour("#363636")));
264 return line;
265 };
266
267 auto create_label = [this](wxString title, wxString tooltip, Label** label_out = nullptr) {
268 wxBoxSizer *sizer = new wxBoxSizer(wxHORIZONTAL);
269 auto label = new Label(this, title, LB_AUTO_WRAP, wxSize(FromDIP(275),-1)); // 400 - 120 - 5
270 label->SetForegroundColour(StateColor::darkModeColorFor(wxColour("#363636")));
271 label->SetToolTip(tooltip);
272 sizer->Add(label, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT, FromDIP(15));
273
274 if (label_out) *label_out = label;
275
276 return sizer;
277 };
278
279 auto create_btn = [this](wxString title, wxString tooltip) {
280 auto btn = new Button(this, title);
281 btn->SetToolTip(tooltip);
283 return btn;
284 };
285
286 // INFORMATION
287 auto create_info_line = [this](wxString title) {
288 auto info = new Label(this, title);
289 info->SetForegroundColour(StateColor::darkModeColorFor(wxColour("#363636")));
290 info->SetMaxSize(wxSize(FromDIP(400),-1));
291 info->Wrap(FromDIP(400));
292 return info;
293 };
294
295 auto info_desc_1 = create_info_line(_L("We need information for diagnosing source of the issue. Check wiki page for detailed guide."));
296 auto info_desc_2 = create_info_line(_L("Pack button collects project file and logs of current session onto a ZIP archive."));
297 auto info_desc_3 = create_info_line(_L("Any additional visual examples like images or screen recordings might be helpful while reporting the issue."));
298 wxBoxSizer *info_desc_sizer = new wxBoxSizer(wxVERTICAL);
299 info_desc_sizer->Add(info_desc_1, 0, wxEXPAND | wxBOTTOM, FromDIP(8));
300 info_desc_sizer->Add(info_desc_2, 0, wxEXPAND | wxBOTTOM, FromDIP(8));
301 info_desc_sizer->Add(info_desc_3, 0, wxEXPAND);
302
303 auto link_report = new HyperLink(this, _L("Report issue") + " ");
304 link_report->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent &e) {
305 auto encodeStr = [](const wxString& text) {
306 wxString out;
307 const wxScopedCharBuffer utf8 = text.utf8_str();
308 for (const unsigned char* p = (const unsigned char*)utf8.data(); *p; ++p) {
309 unsigned char c = *p;
310 if (isalnum(c) || c == '-' || c == '_' || c == '.' || c == '~')
311 out += (wxChar)c;
312 else
313 out += wxString::Format(wxT("%%%02X"), c);
314 }
315 return out;
316 };
317
318 wxString url = "https://github.com/OrcaSlicer/OrcaSlicer/issues/new?template=bug_report.yml";
319 wxString os = GetOStype();
320 if(!os.IsEmpty())
321 url += "&os_type=%22" + os +"%22";
322 url += "&version=" + encodeStr(wxString(SoftFever_VERSION));
323 url += "&os_version=" + encodeStr(GetOSinfo());
324 wxLaunchDefaultBrowser(url);
325 });
326
327 auto pack_btn = new Button(this, _L("Pack") + "...");
328 pack_btn->SetStyle(ButtonStyle::Regular, ButtonType::Parameter);
329 pack_btn->Bind(wxEVT_BUTTON, [this](wxCommandEvent &e) {
330 PackAll();
331 });
332
333 // PROFILES
334 auto prf_sys_cache_tip = _L("Cleans and rebuilds system profiles cache on next launch.");
335 auto prf_sys_cache_szr = create_label(_L("Clean system profiles cache"), prf_sys_cache_tip);
336 auto prf_sys_cache_btn = create_btn(_L("Clean"), prf_sys_cache_tip);
337 prf_sys_cache_btn->Bind(wxEVT_BUTTON, [this](wxCommandEvent &e) {
339 });
340 prf_sys_cache_szr->Add(prf_sys_cache_btn, 0, wxALIGN_CENTER_VERTICAL);
341
342 auto prf_loaded_szr = create_label(_L("Loaded profiles overview"), _L("This section shows information for loaded profiles."));
343 auto prf_loaded_btn = create_btn(_L("Export") + dots, _L("Exports detailed overview of loaded profiles in json format."));
344 prf_loaded_btn->Bind(wxEVT_BUTTON, [this](wxCommandEvent &e) {
345 return ExportAsJson(GetProfilesOverview(),"ProfilesOverview");
346 });
347 prf_loaded_szr->Add(prf_loaded_btn, 0, wxALIGN_CENTER_VERTICAL);
348
349 auto profiles_loaded = create_item_loaded_profiles();
350
351 // MORE
352 auto cfg_folder_szr = create_label(_L("Configurations folder"), "");
353 auto cfg_folder_btn = create_btn(_L("Browse") + "...", _L("Opens configurations folder."));
354 cfg_folder_btn->Bind(wxEVT_BUTTON, [this, data_dir](wxCommandEvent &e) {
355 BrowseFolder(data_dir.string());
356 });
357 cfg_folder_szr->Add(cfg_folder_btn, 0, wxALIGN_CENTER_VERTICAL);
358
359 auto log_level_szr = create_label(_L("Log level"), "");
360 log_level_szr->Add(create_item_log_level_combo(), 0, wxALIGN_CENTER_VERTICAL);
361
362 auto log_pack_szr = create_label(_L("Stored logs"), _L("Packs all stored logs onto a ZIP archive."));
363 auto log_pack_btn = create_btn(_L("Pack") + "...", "");
364 log_pack_btn->Bind(wxEVT_BUTTON, [this](wxCommandEvent &e) {
365 auto data_dir = boost::filesystem::path(Slic3r::data_dir());
366 ExportAsZip({wxString((data_dir / "log").string())}, "OrcaSlicer_Logs_" + GetTimestamp());
367 });
368 log_pack_szr->Add(log_pack_btn, 0, wxALIGN_CENTER_VERTICAL);
369
370 auto log_clear_szr = create_label("-", "", &m_logs_storage);
371 auto log_clear_btn = create_btn(_L("Clear"), "");
372 log_clear_btn->Bind(wxEVT_BUTTON, [this](wxCommandEvent &e) {
373 ClearLogs();
374 });
375 log_clear_szr->Add(log_clear_btn, 0, wxALIGN_CENTER_VERTICAL);
376
378
379 // LAYOUT //////////////////////
380 wxBoxSizer *left_sizer = new wxBoxSizer(wxVERTICAL);
381
382 wxBoxSizer *sys_btn_sizer = new wxBoxSizer(wxHORIZONTAL);
383 sys_btn_sizer->Add(sys_less_btn, 0, wxLEFT | wxRIGHT, FromDIP(5));
384 sys_btn_sizer->AddStretchSpacer();
385 sys_btn_sizer->Add(sys_copy_btn, 0, wxLEFT | wxRIGHT, FromDIP(5));
386
387 wxBoxSizer *link_btn_sizer = new wxBoxSizer(wxHORIZONTAL);
388 link_btn_sizer->Add(wiki_btn);
389 link_btn_sizer->Add(video_btn, 0, wxLEFT, FromDIP(10));
390
391 left_sizer->Add(m_header_logo , 0, wxEXPAND | wxALIGN_CENTER);
392 left_sizer->Add(logo_line , 0, wxEXPAND | wxTOP, FromDIP(12));
393 left_sizer->Add(version , 0, wxEXPAND | wxTOP, FromDIP(6));
394 left_sizer->Add(build , 0, wxALIGN_CENTER | wxTOP, FromDIP(4));
395 left_sizer->Add(sys_panel , 0, wxEXPAND | wxTOP, FromDIP(15));
396 left_sizer->AddStretchSpacer();
397 left_sizer->Add(sys_btn_sizer , 0, wxEXPAND | wxTOP, FromDIP(15));
398 left_sizer->Add(link_btn_sizer , 0, wxALIGN_CENTER | wxTOP, FromDIP(15));
399
400 wxBoxSizer *right_sizer = new wxBoxSizer(wxVERTICAL);
401
402 wxBoxSizer *pack_btn_sizer = new wxBoxSizer(wxHORIZONTAL);
403 pack_btn_sizer->Add(link_report , 0, wxRIGHT, FromDIP(5));
404 pack_btn_sizer->AddStretchSpacer();
405 pack_btn_sizer->Add(pack_btn);
406
407 right_sizer->Add(create_title(_L("Information")), 0, wxEXPAND);
408 right_sizer->Add(info_desc_sizer , 0, wxEXPAND | wxTOP, FromDIP(5));
409 right_sizer->Add(pack_btn_sizer , 0, wxEXPAND | wxTOP, FromDIP(12));
410
411 right_sizer->Add(create_title(_L("Profiles")) , 0, wxEXPAND | wxTOP, FromDIP(12));
412 right_sizer->Add(prf_sys_cache_szr , 0, wxEXPAND | wxTOP, FromDIP(8));
413 right_sizer->Add(prf_loaded_szr , 0, wxEXPAND | wxTOP, FromDIP(5));
414 right_sizer->Add(profiles_loaded , 0, wxEXPAND | wxTOP, FromDIP(5));
415
416 right_sizer->Add(create_title(_L("More")) , 0, wxEXPAND | wxTOP, FromDIP(12));
417 right_sizer->Add(cfg_folder_szr , 0, wxEXPAND | wxTOP, FromDIP(8));
418 right_sizer->Add(log_level_szr , 0, wxEXPAND | wxTOP, FromDIP(5));
419 right_sizer->Add(log_pack_szr , 0, wxEXPAND | wxTOP, FromDIP(5));
420 right_sizer->Add(log_clear_szr , 0, wxEXPAND | wxTOP, FromDIP(5));
421
422 wxBoxSizer *m_sizer = new wxBoxSizer(wxHORIZONTAL);
423 m_sizer->Add(left_sizer , 0, wxEXPAND | wxTOP | wxBOTTOM | wxLEFT , FromDIP(15));
424 m_sizer->AddSpacer(FromDIP(20));
425 m_sizer->Add(right_sizer, 0, wxEXPAND | wxTOP | wxBOTTOM | wxRIGHT, FromDIP(15));
426
427 SetSizerAndFit(m_sizer);
428 Layout();
429 Fit();
430 CenterOnParent();
431 wxGetApp().UpdateDlgDarkUI(this);
432}
@ Confirm
Definition Button.hpp:25
@ Regular
Definition Button.hpp:24
@ Circle
Definition Button.hpp:37
@ Parameter
Definition Button.hpp:34
@ Window
Definition Button.hpp:32
#define LB_AUTO_WRAP
Definition Label.hpp:12
#define _L(s)
Definition OBJ.cpp:34
static bool is_dark()
Definition TextureImportDialog.cpp:85
static wxFont Head_16
Definition Label.hpp:43
const wxFont & normal_font() const
Definition GUI_Utils.hpp:205
wxStaticBitmap * m_header_logo
Definition TroubleshootDialog.hpp:44
wxString GetCPUinfo()
Definition TroubleshootDialog.cpp:831
void ClearLogs()
Definition TroubleshootDialog.cpp:1156
wxString GetSysInfoAll()
Definition TroubleshootDialog.cpp:440
wxString GetTimestamp()
Definition TroubleshootDialog.cpp:434
ComboBox * create_item_log_level_combo()
Definition TroubleshootDialog.cpp:147
void PackAll()
Definition TroubleshootDialog.cpp:991
ScalableBitmap m_logo
Definition TroubleshootDialog.hpp:43
Label * m_logs_storage
Definition TroubleshootDialog.hpp:45
wxString GetMONinfo()
Definition TroubleshootDialog.cpp:904
bool ExportAsJson(const wxString &json_data, const wxString &export_name=wxEmptyString)
Definition TroubleshootDialog.cpp:1280
void BrowseFolder(std::string path)
Definition TroubleshootDialog.cpp:1214
bool ExportAsZip(const std::vector< wxString > &sources, const wxString &export_name)
Definition TroubleshootDialog.cpp:1323
wxString GetOStype()
Definition TroubleshootDialog.cpp:622
wxString GetPackageType()
Definition TroubleshootDialog.cpp:778
void UpdateLogsStorage()
Definition TroubleshootDialog.cpp:1193
void RebuildSystemProfiles()
Definition TroubleshootDialog.cpp:1039
bool m_sys_panel_mode
Definition TroubleshootDialog.hpp:52
wxString GetProfilesOverview()
Definition TroubleshootDialog.cpp:482
wxString GetOSinfo()
Definition TroubleshootDialog.cpp:635
wxString GetRAMinfo()
Definition TroubleshootDialog.cpp:888
wxString GetGPUinfo()
Definition TroubleshootDialog.cpp:894
wxFlexGridSizer * create_item_loaded_profiles()
Definition TroubleshootDialog.cpp:105
static wxColour darkModeColorFor(wxColour const &color)
Definition StateColor.cpp:219
const char *const build_commit_label
Definition BuildCommit.cpp:7
wxMouseEvent
Definition CameraPopup.cpp:47
static wxString dots("...", wxConvUTF8)
const char *const build_commit_hash
Definition BuildCommit.cpp:6
const std::string & data_dir()
Definition utils.cpp:365
@ lock
Definition GLGizmoEmboss.cpp:209

References _L, BrowseFolder(), Slic3r::GUI::build_commit_hash, Slic3r::GUI::build_commit_label, Circle, ClearLogs(), Confirm, create_item_loaded_profiles(), create_item_log_level_combo(), StateColor::darkModeColorFor(), Slic3r::data_dir(), Slic3r::GUI::dots(), ExportAsJson(), ExportAsZip(), GetCPUinfo(), GetGPUinfo(), GetMONinfo(), GetOSinfo(), GetOStype(), GetPackageType(), GetProfilesOverview(), GetRAMinfo(), GetSysInfoAll(), GetTimestamp(), Label::Head_16, is_dark(), LB_AUTO_WRAP, m_header_logo, m_logo, m_logs_storage, m_sys_panel_mode, Slic3r::GUI::DPIAware< wxDialog >::normal_font(), PackAll(), Parameter, RebuildSystemProfiles(), Regular, UpdateLogsStorage(), Window, and Slic3r::GUI::wxMouseEvent.

Here is the call graph for this function:

Member Function Documentation

◆ AddToZip()

bool Slic3r::GUI::TroubleshootDialog::AddToZip ( wxZipOutputStream & zip,
const wxString & fullPathOrTextData,
const wxString & rootDir )
protected
1357{
1358 if (fullPathOrTextData.StartsWith(wxT("TxtData:"))) { // add text to zip
1359 // Format: "TxtData:<filename>|<content>"
1360 wxString payload = fullPathOrTextData.Mid(8); // strip "TxtData:"
1361 int sep = payload.Find('|');
1362 if (sep == wxNOT_FOUND)
1363 return false;
1364 wxString entryName = payload.Left(sep);
1365 wxString content = payload.Mid(sep + 1);
1366
1367 if (!zip.PutNextEntry(entryName))
1368 return false;
1369 wxScopedCharBuffer buf = content.utf8_str();
1370 zip.Write(buf.data(), buf.length());
1371 return zip.CloseEntry();
1372 }
1373
1374 wxString relPath = fullPathOrTextData.Mid(rootDir.length());
1375 if (relPath.StartsWith(wxFileName::GetPathSeparator()))
1376 relPath = relPath.Mid(1);
1377 relPath.Replace(wxFileName::GetPathSeparator(), wxT("/"));
1378 if (wxDirExists(fullPathOrTextData)) {
1379 if (!relPath.IsEmpty()) {
1380 if (!relPath.EndsWith(wxT("/")))
1381 relPath += wxT("/");
1382 if (!zip.PutNextDirEntry(relPath))
1383 return false;
1384 }
1385
1386 wxDir dir(fullPathOrTextData);
1387 if (!dir.IsOpened())
1388 return false;
1389
1390 wxString filename;
1391 bool cont = dir.GetFirst(&filename, wxEmptyString, wxDIR_FILES | wxDIR_DIRS | wxDIR_HIDDEN);
1392 while (cont) {
1393 wxString childPath = fullPathOrTextData;
1394 if (!wxEndsWithPathSeparator(childPath))
1395 childPath += wxFileName::GetPathSeparator();
1396 childPath += filename;
1397
1398 if (!AddToZip(zip, childPath, rootDir))
1399 return false;
1400
1401 cont = dir.GetNext(&filename);
1402 }
1403 }
1404 else if (wxFileExists(fullPathOrTextData)) {
1405 wxFileInputStream in(fullPathOrTextData);
1406 if (!in.IsOk())
1407 return false;
1408 if (!zip.PutNextEntry(relPath))
1409 return false;
1410 zip.Write(in);
1411 if (!zip.CloseEntry())
1412 return false;
1413 }
1414 else
1415 return false;
1416
1417 return true;
1418}
bool AddToZip(wxZipOutputStream &zip, const wxString &fullPathOrTextData, const wxString &rootDir)
Definition TroubleshootDialog.cpp:1356
static const wxString sep
Definition MainFrame.cpp:2828

References AddToZip(), and Slic3r::GUI::sep.

Referenced by AddToZip(), and SaveAsZip().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ BrowseFolder()

void Slic3r::GUI::TroubleshootDialog::BrowseFolder ( std::string path)
protected
1215{
1216 wxString wxpath = wxString::FromUTF8(path);
1217
1218 if (!wxpath.IsEmpty() && !wxFileName::IsPathSeparator(wxpath.Last()))
1219 wxpath += wxFileName::GetPathSeparator();
1220
1221 if (wxLaunchDefaultApplication(wxpath))
1222 return;
1223
1224 auto ShellQuote = [](const wxString& arg) {
1225 #ifdef __WXMSW__
1226 wxString result = "\"";
1227 for (wxChar c : arg) {
1228 if (c == '"') result += '\\';
1229 result += c;
1230 }
1231 result += "\"";
1232 return result;
1233 #else
1234 wxString result = "'";
1235 for (wxChar c : arg) {
1236 if (c == '\'')
1237 result += wxString("'\\''");
1238 else
1239 result += c;
1240 }
1241 result += "'";
1242 return result;
1243 #endif
1244 };
1245
1246 #ifdef _WIN32
1247 ::wxExecute(L"explorer.exe " + ShellQuote(wxpath), wxEXEC_ASYNC);
1248 #elif defined(__APPLE__)
1249 ::wxExecute(wxString::Format("open %s", ShellQuote(wxpath)), wxEXEC_ASYNC);
1250 #else
1251 const char* argv[] = { "xdg-open", nullptr, nullptr };
1252
1253 wxString utf8_path = wxpath.ToUTF8();
1254 argv[1] = utf8_path.c_str();
1255
1256 if (wxGetEnv("APPIMAGE", nullptr)) {
1257 wxEnvVariableHashMap env_vars;
1258 wxGetEnvMap(&env_vars);
1259
1260 env_vars.erase("APPIMAGE");
1261 env_vars.erase("APPDIR");
1262 env_vars.erase("LD_LIBRARY_PATH");
1263 env_vars.erase("LD_PRELOAD");
1264 env_vars.erase("UNION_PRELOAD");
1265
1266 wxExecuteEnv exec_env;
1267 exec_env.env = std::move(env_vars);
1268
1269 wxString owd;
1270 if (wxGetEnv("OWD", &owd))
1271 exec_env.cwd = std::move(owd);
1272
1273 ::wxExecute(const_cast<char**>(argv), wxEXEC_ASYNC, nullptr, &exec_env);
1274 }
1275 else
1276 ::wxExecute(const_cast<char**>(argv), wxEXEC_ASYNC);
1277 #endif
1278}
#define L(s)
Definition ExtrusionEntity.cpp:25

References BrowseFolder(), and L.

Referenced by TroubleshootDialog(), and BrowseFolder().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ClearLogs()

void Slic3r::GUI::TroubleshootDialog::ClearLogs ( )
protected
1157{
1158 // Same method with GUI_App::post_init() only LOG_FILES_MAX_NUM replaced with 1
1159 auto data_dir = boost::filesystem::path(Slic3r::data_dir());
1160 auto log_folder = data_dir / "log";
1161 if (boost::filesystem::exists(log_folder)) {
1162 std::vector<std::pair<time_t, std::string>> files_vec;
1163 for (auto& it : boost::filesystem::directory_iterator(log_folder)) {
1164 auto temp_path = it.path();
1165 try {
1166 if (it.status().type() == boost::filesystem::regular_file) {
1167 std::time_t lw_t = boost::filesystem::last_write_time(temp_path) ;
1168 files_vec.push_back({ lw_t, temp_path.filename().string() });
1169 }
1170 } catch (const std::exception &) {
1171 }
1172 }
1173 std::sort(files_vec.begin(), files_vec.end(), [](
1174 std::pair<time_t, std::string> &a, std::pair<time_t, std::string> &b) {
1175 return a.first > b.first;
1176 });
1177
1178 while (files_vec.size() > 1) {
1179 auto full_path = log_folder / boost::filesystem::path(files_vec[files_vec.size() - 1].second);
1180 BOOST_LOG_TRIVIAL(info) << "delete log file over " << LOG_FILES_MAX_NUM << ", filename: "<< files_vec[files_vec.size() - 1].second;
1181 try {
1182 boost::filesystem::remove(full_path);
1183 }
1184 catch (const std::exception& ex) {
1185 BOOST_LOG_TRIVIAL(error) << "failed to delete log file: "<< files_vec[files_vec.size() - 1].second << ". Error: " << ex.what();
1186 }
1187 files_vec.pop_back();
1188 }
1189 }
1191}
#define LOG_FILES_MAX_NUM
Definition GUI_App.hpp:51

References ClearLogs(), Slic3r::data_dir(), LOG_FILES_MAX_NUM, and UpdateLogsStorage().

Referenced by TroubleshootDialog(), and ClearLogs().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ create_item_loaded_profiles()

wxFlexGridSizer * Slic3r::GUI::TroubleshootDialog::create_item_loaded_profiles ( )
protected
106{
107 auto create_label = [this](wxString title, wxFont font = Label::Body_14) {
108 auto label = new Label(this, font, title);
109 label->SetForegroundColour(StateColor::darkModeColorFor(wxColour("#363636")));
110 return label;
111 };
112
113 auto g_sizer = new wxFlexGridSizer(1, 6, FromDIP(3), FromDIP(15));
114
115 g_sizer->AddSpacer(0);
116 g_sizer->Add(create_label(_L("Active"), Label::Body_12), 0, wxALIGN_CENTER);
117 g_sizer->AddSpacer(0);
118 g_sizer->Add(create_label(_L("System"), Label::Body_12), 0, wxALIGN_CENTER);
119 g_sizer->AddSpacer(0);
120 g_sizer->Add(create_label(_L("User"), Label::Body_12) , 0, wxALIGN_CENTER);
121
122 auto gen_stats = GetProfilesOverview();
123 gen_stats = ""; // clear mem. not needed after generating m_..._act, m_..._usr variables
124
125 auto add_sizer = [g_sizer, create_label](PresetCollection* col, wxString label, int in_use, int user) {
126 int sys = 0;
127 for (auto it = col->begin(); it != col->end(); it++) {
128 if (it->is_system)
129 sys++;
130 }
131 g_sizer->Add(create_label(label));
132 g_sizer->Add(create_label(wxString::Format("%d", in_use)), 0, wxALIGN_CENTER);
133 g_sizer->Add(create_label("/", Label::Body_12) , 0, wxALIGN_CENTER);
134 g_sizer->Add(create_label(wxString::Format("%d", sys )), 0, wxALIGN_CENTER);
135 g_sizer->Add(create_label("+", Label::Body_12) , 0, wxALIGN_CENTER);
136 g_sizer->Add(create_label(wxString::Format("%d", user )), 0, wxALIGN_CENTER);
137 };
138
139 auto preset_bundle = wxGetApp().preset_bundle;
140 add_sizer(&preset_bundle->printers , _L("Printers") , m_printers__act, m_printers__usr);
141 add_sizer(&preset_bundle->filaments, _L("Filaments"), m_filaments_act, m_filaments_usr);
142 add_sizer(&preset_bundle->prints , _L("Processes"), m_processes_act, m_processes_usr);
143
144 return g_sizer;
145}
static wxFont Body_12
Definition Label.hpp:55
static wxFont Body_14
Definition Label.hpp:53
int m_filaments_usr
Definition TroubleshootDialog.hpp:49
int m_processes_act
Definition TroubleshootDialog.hpp:50
int m_processes_usr
Definition TroubleshootDialog.hpp:51
int m_printers__usr
Definition TroubleshootDialog.hpp:47
int m_printers__act
Definition TroubleshootDialog.hpp:46
int m_filaments_act
Definition TroubleshootDialog.hpp:48

References _L, Label::Body_12, Label::Body_14, StateColor::darkModeColorFor(), GetProfilesOverview(), m_filaments_act, m_filaments_usr, m_printers__act, m_printers__usr, m_processes_act, and m_processes_usr.

Referenced by TroubleshootDialog().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ create_item_log_level_combo()

ComboBox * Slic3r::GUI::TroubleshootDialog::create_item_log_level_combo ( )
protected
148{
149 auto combobox = new ComboBox(this, wxID_ANY, wxEmptyString, wxDefaultPosition, DESIGN_COMBOBOX_SIZE, 0, nullptr, wxCB_READONLY);
150
151 for (const auto& item : std::vector<wxString>{_L("fatal"), _L("error"), _L("warning"), _L("info"), _L("debug"), _L("trace")})
152 combobox->Append(item);
153
154 auto severity_level = wxGetApp().app_config->get("log_severity_level");
155 if (!severity_level.empty()) { combobox->SetValue(severity_level); }
156
157 combobox->GetDropDown().Bind(wxEVT_COMBOBOX, [](wxCommandEvent &e) {
158 auto level = Slic3r::get_string_logging_level(e.GetSelection());
160 wxGetApp().app_config->set("log_severity_level",level);
161 e.Skip();
162 });
163
164 return combobox;
165}
#define DESIGN_COMBOBOX_SIZE
Definition ExportPresetBundleDialog.hpp:32
void set_logging_level(unsigned int level)
Definition utils.cpp:171
std::string get_string_logging_level(unsigned level)
Definition utils.cpp:208
unsigned int level_string_to_boost(std::string level)
Definition utils.cpp:195

References _L, DESIGN_COMBOBOX_SIZE, Slic3r::get_string_logging_level(), Slic3r::level_string_to_boost(), and Slic3r::set_logging_level().

Referenced by TroubleshootDialog().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ em_unit()

int Slic3r::GUI::DPIAware< wxDialog >::em_unit ( ) const
inlineinherited
203{ return m_em_unit; }
Definition GUI_Utils.hpp:107

Referenced by Slic3r::GUI::AuxiliaryDialog::AuxiliaryDialog(), Slic3r::GUI::CopyrightsDialog::CopyrightsDialog(), Slic3r::GUI::DesignTextDialog::DesignTextDialog(), Slic3r::GUI::EditGCodeDialog::EditGCodeDialog(), Slic3r::GUI::FileArchiveDialog::FileArchiveDialog(), Slic3r::GUI::MsgNoUpdates::MsgNoUpdates(), Slic3r::GUI::MsgUpdateForced::MsgUpdateForced(), Slic3r::GUI::OAuthDialog::OAuthDialog(), Slic3r::GUI::ParamsDialog::ParamsDialog(), Slic3r::GUI::PhysicalPrinterDialog::PhysicalPrinterDialog(), Slic3r::GUI::SettingsDialog::SettingsDialog(), anonymous_namespace{3DPrinterOS.cpp}::TokenAuthDialog::TokenAuthDialog(), anonymous_namespace{3DPrinterOS.cpp}::UploadOptionsDialog::UploadOptionsDialog(), Slic3r::GUI::PublishSettingsDialog::add_row_ui(), Slic3r::GUI::DiffPresetDialog::complete_dialog_creation(), Slic3r::GUI::DiffPresetDialog::create_edit_sizer(), Slic3r::GUI::DiffPresetDialog::create_presets_sizer(), Slic3r::GUI::DiffPresetDialog::create_tree(), Slic3r::GUI::ElegooPrintHostSendDialog::init(), Slic3r::GUI::FlashforgePrintHostSendDialog::init(), Slic3r::GUI::PrintHostSendDialog::init(), Slic3r::GUI::AboutDialog::on_dpi_changed(), Slic3r::GUI::AuxiliaryDialog::on_dpi_changed(), Slic3r::GUI::BedShapeDialog::on_dpi_changed(), Slic3r::GUI::ConfigWizard::on_dpi_changed(), Slic3r::GUI::CopyrightsDialog::on_dpi_changed(), Slic3r::GUI::DiffPresetDialog::on_dpi_changed(), Slic3r::GUI::EditGCodeDialog::on_dpi_changed(), Slic3r::GUI::FileArchiveDialog::on_dpi_changed(), Slic3r::GUI::OAuthDialog::on_dpi_changed(), Slic3r::GUI::ObjectTableDialog::on_dpi_changed(), Slic3r::GUI::ParamsDialog::on_dpi_changed(), Slic3r::GUI::PhysicalPrinterDialog::on_dpi_changed(), Slic3r::GUI::PrintHostQueueDialog::on_dpi_changed(), Slic3r::GUI::PurgeModeDialog::on_dpi_changed(), Slic3r::GUI::SavePresetDialog::on_dpi_changed(), Slic3r::GUI::SendSystemInfoDialog::on_dpi_changed(), Slic3r::GUI::SettingsDialog::on_dpi_changed(), and Slic3r::GUI::UnsavedChangesDialog::on_dpi_changed().

Here is the caller graph for this function:

◆ enable_force_rescale()

void Slic3r::GUI::DPIAware< wxDialog >::enable_force_rescale ( )
inlineinherited
206{ m_force_rescale = true; }

◆ EndModal()

void Slic3r::GUI::DPIDialog::EndModal ( int retCode)
inlineoverrideinherited
306 {
307 if (!dialogStack.empty() && dialogStack.front() != this) {
308 // This is a bug in wxWidgets
309 // when the dialog is not top modal dialog, EndModal() just hide dialog without quit
310 // the modal event loop. And the modal event loop blocks us from bottom widgets.
311 // Solution: let user click it manually or close outside. FIXME
312 BOOST_LOG_TRIVIAL(warning) << "DPIAware::EndModal Error: dialogStack is not empty, but top dialog is not this one. retCode=" << retCode;
313 return;
314 }
315
316 return wxDialog::EndModal(retCode);
317 }
std::deque< wxDialog * > dialogStack
Definition GUI_Utils.cpp:549

References Slic3r::GUI::dialogStack.

Referenced by Slic3r::GUI::CloneDialog::CloneDialog(), Slic3r::GUI::ConfigWizard::ConfigWizard(), Slic3r::GUI::CreatePresetSuccessfulDialog::CreatePresetSuccessfulDialog(), Slic3r::GUI::DeleteConfirmDialog::DeleteConfirmDialog(), Slic3r::GUI::DesignVariableDialog::DesignVariableDialog(), Slic3r::GUI::anonymous_namespace{PrintHostDialogs.cpp}::FlashforgeSlotDialog::FlashforgeSlotDialog(), Slic3r::GUI::GuideFrame::GuideFrame(), Slic3r::GUI::InputIpAddressDialog::InputIpAddressDialog(), Slic3r::GUI::ManualNozzleCountDialog::ManualNozzleCountDialog(), Slic3r::GUI::MsgUpdateConfig::MsgUpdateConfig(), Slic3r::GUI::MsgUpdateForced::MsgUpdateForced(), Slic3r::GUI::MultiChoiceDialog::MultiChoiceDialog(), Slic3r::GUI::NetworkErrorDialog::NetworkErrorDialog(), Slic3r::GUI::NetworkPluginRestartDialog::NetworkPluginRestartDialog(), Slic3r::GUI::PartSkipConfirmDialog::PartSkipConfirmDialog(), Slic3r::GUI::PhysicalPrinterDialog::PhysicalPrinterDialog(), Slic3r::GUI::PlateNameEditDialog::PlateNameEditDialog(), Slic3r::GUI::PlateSettingsDialog::PlateSettingsDialog(), Slic3r::GUI::PublishSettingsDialog::PublishSettingsDialog(), Slic3r::GUI::SelectMachineDialog::SelectMachineDialog(), Slic3r::GUI::SendFailedConfirm::SendFailedConfirm(), Slic3r::GUI::SendSystemInfoDialog::SendSystemInfoDialog(), Slic3r::GUI::ShortcutCaptureDialog::ShortcutCaptureDialog(), Slic3r::GUI::SingleChoiceDialog::SingleChoiceDialog(), StepMeshDialog::StepMeshDialog(), Slic3r::GUI::SyncAmsInfoDialog::SyncAmsInfoDialog(), anonymous_namespace{3DPrinterOS.cpp}::TokenAuthDialog::TokenAuthDialog(), Slic3r::GUI::UpdatePluginDialog::UpdatePluginDialog(), Slic3r::GUI::UpdateVersionDialog::UpdateVersionDialog(), Slic3r::GUI::wgtDeviceNozzleRackUpgradeDlg::wgtDeviceNozzleRackUpgradeDlg(), Slic3r::GUI::SavePresetDialog::accept(), Slic3r::GUI::MsgDialog::add_button(), Slic3r::GUI::TipsDialog::add_button(), Slic3r::GUI::FilamentPickerDialog::BindEvents(), Slic3r::GUI::PluginPickerDialog::build_capability_ui(), Slic3r::GUI::BedShapeDialog::build_dialog(), Slic3r::GUI::PluginPickerDialog::build_ui(), Slic3r::GUI::UnsavedChangesDialog::close(), Slic3r::GUI::FileArchiveDialog::create_btn_sizer(), Slic3r::GUI::ColorDecomposeDialog::create_button_panel(), Slic3r::GUI::MixedFilamentDialog::create_button_panel(), Slic3r::GUI::CreateFilamentPresetDialog::create_dialog_buttons(), Slic3r::GUI::CreatePresetForPrinterDialog::create_dialog_buttons(), Slic3r::GUI::EditFilamentPresetDialog::create_dialog_buttons(), Slic3r::GUI::ExportConfigsDialog::create_dialog_buttons(), Slic3r::GUI::PreferencesDialog::create_item_language_combobox(), Slic3r::GUI::PreferencesDialog::create_item_region_combobox(), Slic3r::GUI::PreferencesDialog::create_items(), Slic3r::GUI::CreatePrinterPresetDialog::create_page1_dialog_buttons(), Slic3r::GUI::CreatePrinterPresetDialog::create_page2_dialog_buttons(), Slic3r::GUI::ExportConfigsDialog::data_init(), Slic3r::GUI::WebDialog::destroy_silently(), Slic3r::GUI::EditFilamentPresetDialog::edit_preset(), Slic3r::GUI::ConnectPrinterDialog::end_modal(), Slic3r::GUI::PrintHostSendDialog::EndModal(), Slic3r::GUI::ColorPickerDialog::finish(), Slic3r::GUI::WebDialog::finish(), Slic3r::GUI::Newer3mfVersionDialog::get_btn_sizer(), Slic3r::GUI::ScoreDialog::get_button_sizer(), Slic3r::GUI::WebViewHostDialog::handle_common_script_command(), Slic3r::GUI::ExportPresetBundleDialog::InitExportData(), Slic3r::GUI::SelectMachineDialog::navigate_to_timelapse_page(), Slic3r::GUI::BindMachineDialog::on_bind_success(), Slic3r::GUI::ConnectPrinterDialog::on_button_confirm(), Slic3r::GUI::RecenterDialog::on_button_confirm(), Slic3r::GUI::BindMachineDialog::on_cancel(), Slic3r::GUI::EditCalibrationHistoryDialog::on_cancel(), Slic3r::GUI::InputIpAddressDialog::on_cancel(), Slic3r::GUI::NewCalibrationHistoryDialog::on_cancel(), Slic3r::GUI::OAuthDialog::on_cancel(), Slic3r::GUI::PingCodeBindDialog::on_cancel(), Slic3r::GUI::SelectMachineDialog::on_cancel(), Slic3r::GUI::SendToPrinterDialog::on_cancel(), Slic3r::GUI::SyncAmsInfoDialog::on_cancel(), Slic3r::GUI::UnBindMachineDialog::on_cancel(), Slic3r::GUI::WebDialog::on_close_window(), Slic3r::GUI::NetworkPluginDownloadDialog::on_dont_ask(), Slic3r::GUI::NetworkPluginDownloadDialog::on_download(), Slic3r::GUI::EditDevNameDialog::on_edit_name(), Slic3r::GUI::ConfirmBeforeSendDialog::on_hide(), Slic3r::GUI::PrivacyUpdateDialog::on_hide(), Slic3r::GUI::ShortcutCaptureDialog::on_key(), Slic3r::GUI::TextureImportDialog::on_ok_clicked(), Slic3r::GUI::FileArchiveDialog::on_open_button(), Slic3r::GUI::NetworkPluginDownloadDialog::on_remind_later(), Slic3r::GUI::ProjectDropDialog::on_select_cancel(), Slic3r::GUI::SavePresetDialog::on_select_cancel(), Slic3r::GUI::ProjectDropDialog::on_select_ok(), Slic3r::GUI::SendMultiMachinePage::on_send(), Slic3r::GUI::NetworkPluginDownloadDialog::on_skip(), Slic3r::GUI::TextureImportDialog::on_skip_clicked(), Slic3r::GUI::NetworkPluginDownloadDialog::on_skip_version(), Slic3r::GUI::Cornering_Test_Dlg::on_start(), Slic3r::GUI::FlowRateCalibrationDialog::on_start(), Slic3r::GUI::Input_Shaping_Damp_Test_Dlg::on_start(), Slic3r::GUI::Input_Shaping_Freq_Test_Dlg::on_start(), Slic3r::GUI::MaxVolumetricSpeed_Test_Dlg::on_start(), Slic3r::GUI::PA_Calibration_Dlg::on_start(), Slic3r::GUI::Retraction_Test_Dlg::on_start(), Slic3r::GUI::Temp_Calibration_Dlg::on_start(), Slic3r::GUI::VFA_Test_Dlg::on_start(), Slic3r::GUI::CalibrationDialog::on_start_calibration(), Slic3r::GUI::UnBindMachineDialog::on_unbind_printer(), Slic3r::GUI::PartSkipDialog::OnApplyDialog(), anonymous_namespace{3DPrinterOS.cpp}::TokenAuthDialog::OnCancel(), Slic3r::GUI::AboutDialog::onCloseDialog(), Slic3r::GUI::CopyrightsDialog::onCloseDialog(), Slic3r::GUI::MultiNozzleSyncDialog::OnRackStatusReadingFinished(), Slic3r::GUI::GuideFrame::OnScriptMessage(), Slic3r::GUI::InputIpAddressDialog::OnTimer(), Slic3r::GUI::KBShortcutsDialog::open_mouse_preferences(), Slic3r::GUI::TroubleshootDialog::PackAll(), Slic3r::GUI::TroubleshootDialog::RebuildSystemProfiles(), Slic3r::GUI::SpeedDialWebDialog::run_action(), Slic3r::GUI::OAuthDialog::Show(), Slic3r::GUI::MultiNozzleSyncDialog::UpdateButton(), and Slic3r::GUI::CreatePrinterPresetDialog::validate_input_valid().

◆ ExportAsJson()

bool Slic3r::GUI::TroubleshootDialog::ExportAsJson ( const wxString & json_data,
const wxString & export_name = wxEmptyString )
protected
1281{
1282 wxString home = wxGetHomeDir();
1283
1284 wxFileName desktop(home, "");
1285 desktop.AppendDir("Desktop");
1286 wxString defaultPath = wxDirExists(desktop.GetPath()) ? desktop.GetPath() : home;
1287
1288 wxFileDialog dialog(this, _L("Choose where to save the exported JSON file"), defaultPath,
1289 export_name.IsEmpty() ? "export.json" : export_name + ".json",
1290 _L("JSON files (*.json)|*.json"),
1291 wxFD_SAVE | wxFD_OVERWRITE_PROMPT
1292 );
1293
1294 if (dialog.ShowModal() != wxID_OK)
1295 return false;
1296
1297 wxString jsonPath = dialog.GetPath();
1298
1299 wxFile file(jsonPath, wxFile::write);
1300 if (!file.IsOpened()) {
1301 MessageDialog(this, _L("Export failed\nPlease check write permissions or file in use by another application"),
1302 wxString(SLIC3R_APP_FULL_NAME), wxICON_WARNING | wxOK
1303 ).ShowModal();
1304 return false;
1305 }
1306
1307 bool success = file.Write(json_data, wxConvUTF8);
1308 file.Close();
1309
1310 if (!success) {
1311 wxRemoveFile(jsonPath);
1312 MessageDialog(this, _L("Export failed\nPlease check write permissions or file in use by another application"),
1313 wxString(SLIC3R_APP_FULL_NAME), wxICON_WARNING | wxOK
1314 ).ShowModal();
1315 return false;
1316 }
1317
1318 MessageDialog(this, _L("Export successful"), wxString(SLIC3R_APP_FULL_NAME), wxICON_INFORMATION | wxOK).ShowModal();
1319
1320 return true;
1321}
#define SLIC3R_APP_FULL_NAME
Definition libslic3r.h:11

References _L, ExportAsJson(), Slic3r::GUI::DPIAware< P >::ShowModal(), and SLIC3R_APP_FULL_NAME.

Referenced by TroubleshootDialog(), and ExportAsJson().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ExportAsZip()

bool Slic3r::GUI::TroubleshootDialog::ExportAsZip ( const std::vector< wxString > & sources,
const wxString & export_name )
protected
1324{
1325 wxString home = wxGetHomeDir();
1326
1327 wxFileName desktop(home, "");
1328 desktop.AppendDir("Desktop");
1329 wxString defaultPath = wxDirExists(desktop.GetPath()) ? desktop.GetPath() : home;
1330
1331 wxDirDialog dialog(this, _L("Choose where to save the exported ZIP file"), defaultPath, wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST);
1332 wxString destDir = (dialog.ShowModal() == wxID_OK) ? dialog.GetPath() : "";
1333 if (destDir.IsEmpty())
1334 return false;
1335 wxString baseName = export_name.IsEmpty() ? wxFileName(sources[0]).GetFullName() : export_name;
1336 wxString zipPath = wxFileName(destDir, baseName + ".zip").GetFullPath();
1337 if (wxFileExists(zipPath)) {
1338 MessageDialog msg(this, _L("File already exists. Overwrite?"),
1339 wxString(SLIC3R_APP_FULL_NAME), wxICON_QUESTION | wxYES_NO
1340 );
1341 if (msg.ShowModal() != wxID_YES)
1342 return false;
1343 }
1344 if (!SaveAsZip(sources, zipPath)) {
1345 MessageDialog(this, _L("Export failed\nPlease check write permissions or file in use by another application"),
1346 wxString(SLIC3R_APP_FULL_NAME), wxICON_WARNING | wxOK
1347 ).ShowModal();
1348 return false;
1349 }
1350 else {
1351 MessageDialog(this, _L("Export successful"), wxString(SLIC3R_APP_FULL_NAME), wxICON_INFORMATION | wxOK).ShowModal();
1352 }
1353 return true;
1354}
bool SaveAsZip(const std::vector< wxString > &sourcePaths, const wxString &zipFullPath)
Definition TroubleshootDialog.cpp:1420

References _L, ExportAsZip(), SaveAsZip(), Slic3r::GUI::DPIAware< P >::ShowModal(), and SLIC3R_APP_FULL_NAME.

Referenced by TroubleshootDialog(), ExportAsZip(), and PackAll().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ force_rescale()

bool Slic3r::GUI::DPIAware< wxDialog >::force_rescale ( ) const
inlineinherited
201{ return m_force_rescale; }

◆ GetCPUinfo()

wxString Slic3r::GUI::TroubleshootDialog::GetCPUinfo ( )
protected
832{
833 wxString info;
834#ifdef __WINDOWS__
835 info = get_cpu_info_from_registry();
836#elif __APPLE__
837 std::map<std::string, std::string> cpu_info = parse_lscpu_etc("sysctl -a", ':');
838 info = wxString(cpu_info["machdep.cpu.brand_string"]);
839#else // linux/BSD
840 std::map<std::string, std::string> cpu_info = parse_lscpu_etc("cat /proc/cpuinfo", ':');
841 info = wxString(cpu_info["model name"]);
842#endif
843 info.Trim();
844 return info;
845}
static std::map< std::string, std::string > parse_lscpu_etc(const std::string &name, char delimiter)
Definition TroubleshootDialog.cpp:861

References GetCPUinfo(), and parse_lscpu_etc().

Referenced by TroubleshootDialog(), and GetCPUinfo().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetGPUinfo()

wxString Slic3r::GUI::TroubleshootDialog::GetGPUinfo ( )
protected
895{
897#if !SLIC3R_OPENGL_ES
898 return gl_info.get_renderer() + " GLSL:" + gl_info.get_glsl_version() + (gl_info.is_core_profile() ? " Core" : " Compatibility");
899#else
900 return gl_info.get_renderer() + " GLSL:" + gl_info.get_glsl_version() + " ES";
901#endif
902}
static const GLInfo & get_gl_info()
Definition OpenGLManager.hpp:106
py::object gl_info()
Definition PluginHostApp.cpp:95

References Slic3r::GUI::OpenGLManager::get_gl_info(), and GetGPUinfo().

Referenced by TroubleshootDialog(), and GetGPUinfo().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetMONinfo()

wxString Slic3r::GUI::TroubleshootDialog::GetMONinfo ( )
protected
905{
906 wxString m_str;
907 int d_count = wxDisplay::GetCount();
908 if (d_count <= 0)
909 return "Unknown";
910 double scale = 1.0;
911
912#if defined(__LINUX__)
913 for (int i = 0; i < d_count; ++i) {
914 wxDisplay disp(i);
915 if (!disp.IsOk()) continue;
916
917 scale = disp.GetScaleFactor();
918 wxRect rc = disp.GetGeometry();
919
920 wxString d_str = wxString::Format("%dx%d-%.0f%%", rc.width, rc.height, scale * 100.0);
921
922 m_str += ((i > 0) ? " " : "") + d_str;
923 }
924#elif defined(__APPLE__)
925 std::vector<CGDirectDisplayID> cgDisplays;
926 uint32_t displayCount = 0;
927 CGGetActiveDisplayList(0, nullptr, &displayCount);
928 if (displayCount > 0) {
929 cgDisplays.resize(displayCount);
930 CGGetActiveDisplayList(displayCount, cgDisplays.data(), &displayCount);
931 }
932 for (int i = 0; i < d_count; ++i) {
933 wxDisplay disp(i);
934 if (!disp.IsOk()) continue;
935 scale = disp.GetScaleFactor();
936 wxRect rc = disp.GetGeometry();
937 int physW = static_cast<int>(std::round(rc.width * scale));
938 int physH = static_cast<int>(std::round(rc.height * scale));
939 const char* type = "L-"; // Logical fallback. only visible when cant get native res
940
941 CGDirectDisplayID cgDispID = (i < static_cast<int>(cgDisplays.size())) ? cgDisplays[i] : CGMainDisplayID();
942
943 CFArrayRef allModes = CGDisplayCopyAllDisplayModes(cgDispID, nullptr);
944 if (allModes) {
945 CFIndex count = CFArrayGetCount(allModes);
946 for (CFIndex m = 0; m < count; ++m) {
947 CGDisplayModeRef mode = (CGDisplayModeRef)CFArrayGetValueAtIndex(allModes, m);
948 if (CGDisplayModeGetIOFlags(mode) & kDisplayModeNativeFlag) {
949 size_t pw = CGDisplayModeGetPixelWidth(mode);
950 size_t ph = CGDisplayModeGetPixelHeight(mode);
951 if (pw >= 800 && ph >= 600 && pw <= 16384 && ph <= 16384) {
952 physW = static_cast<int>(pw);
953 physH = static_cast<int>(ph);
954 type = ""; // Native
955 }
956 break;
957 }
958 }
959 CFRelease(allModes);
960 }
961
962 wxString d_str = wxString::Format("%dx%d-%s%.0f%%", physW, physH, type, scale * 100.0);
963 m_str += ((i > 0) ? " " : "") + d_str;
964 }
965#elif defined(__WINDOWS__)
966 for (int i = 0; i < d_count; ++i) {
967 wxDisplay disp(i);
968 if (!disp.IsOk()) continue;
969
970 scale = disp.GetScaleFactor();
971 wxRect rc = disp.GetGeometry();
972
973 wxString d_str = wxString::Format("%dx%d-%.0f%%", rc.width, rc.height, scale * 100.0);
974
975 m_str += ((i > 0) ? " " : "") + d_str;
976 }
977
978 UINT dpi = 96;
979 HMODULE hUser = GetModuleHandleW(L"user32.dll");
980 if (hUser) {
981 auto fn = reinterpret_cast<UINT(WINAPI*)()>(GetProcAddress(hUser, "GetDpiForSystem"));
982 if (fn)
983 dpi = fn();
984 }
985 double text_scale = dpi / 96.0;
986 m_str += wxString::Format(" TextScaling-%.0f%%", text_scale * 100.0);
987#endif
988 return m_str;
989}
static unsigned int count
Definition AuxiliaryDataViewModel.cpp:246
int scale(const int val)
Definition WipeTowerDialog.cpp:58

References count, GetMONinfo(), L, and scale().

Referenced by TroubleshootDialog(), and GetMONinfo().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetOSinfo()

wxString Slic3r::GUI::TroubleshootDialog::GetOSinfo ( )
protected
636{
637 wxString result;
638#ifdef __WINDOWS__
639 result = GetWinVersion();
640#elif defined(__LINUX__)
641 result = GetLinuxDistroName() + " " + GetLinuxDisplayServer();
642#elif defined(__APPLE__)
643 result = wxGetOsDescription(); // returns "macOS Version 26.3 (Build 25D125)"
644 result.Replace("Version ", ""); // simplify naming
645 result.Replace("Build ", "Build-"); // dash for wrapping build info on next line
646
647 // No public API for naming
648 auto GetMacOSName = [](const wxString& ver) -> wxString {
649 if (ver.StartsWith("26")) return "Tahoe";
650 if (ver.StartsWith("15")) return "Sequoia";
651 if (ver.StartsWith("14")) return "Sonoma";
652 if (ver.StartsWith("13")) return "Ventura";
653 if (ver.StartsWith("12")) return "Monterey";
654 if (ver.StartsWith("11")) return "Big Sur";
655 return "";
656 };
657
658 wxRegEx reVer("([0-9]+\\.[0-9]+)");
659 if (reVer.Matches(result)) {
660 wxString ver = reVer.GetMatch(result, 1);
661 wxString name = GetMacOSName(ver);
662 if (!name.IsEmpty())
663 result.Replace("(Build-", name + " (Build-");
664 }
665#endif
666 return result;
667}

References GetOSinfo().

Referenced by TroubleshootDialog(), and GetOSinfo().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetOStype()

wxString Slic3r::GUI::TroubleshootDialog::GetOStype ( )
protected
623{
624 wxString os = "";
625 #ifdef __WINDOWS__
626 os = "Windows";
627 #elif defined(__LINUX__)
628 os = "Linux";
629 #elif defined(__APPLE__)
630 os = "macOS";
631 #endif
632 return os;
633}

References GetOStype().

Referenced by TroubleshootDialog(), and GetOStype().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetPackageType()

wxString Slic3r::GUI::TroubleshootDialog::GetPackageType ( )
protected
779{
780 wxString result;
781#ifdef __WINDOWS__
782 wxString path = wxStandardPaths::Get().GetExecutablePath();
783 wxString dir = wxPathOnly(path);
784
785 if (path.Contains("OrcaSlicer\\build"))
786 return "Local Build";
787
788 if (wxFileExists(dir + "\\Uninstall.exe"))
789 return "Installed";
790
791 return "Portable";
792#elif defined(__LINUX__)
793 if (wxGetEnv("APPIMAGE" , nullptr)) return "AppImage";
794 if (wxGetEnv("FLATPAK_ID", nullptr)) return "Flatpak";
795 //if (wxGetEnv("SNAP" , nullptr)) return "Snap";
796 if (wxFileExists("/.flatpak-info")) return "Flatpak";
797 //if (wxFileExists("/usr/bin/dpkg")) return "Debian/Ubuntu (deb)";
798 //if (wxFileExists("/usr/bin/rpm")) return "RPM-based (rpm)";
799 //if (wxFileExists("/usr/bin/pacman")) return "Arch (pacman)";
800
801 wxString path = wxStandardPaths::Get().GetExecutablePath();
802 if (path.Contains("OrcaSlicer/build")) return "Local Build";
803 //if (path.StartsWith("/usr/local")) return "Compiled (local)";
804 if (path.StartsWith("/opt")) return "Third-party";
805
806 return "Native Package"; // (deb/rpm/etc)
807#elif defined(__APPLE__)
808 wxString path = wxStandardPaths::Get().GetExecutablePath();
809 wxString dir = wxPathOnly(path);
810
811 if (path.Contains("OrcaSlicer/build"))
812 return "Local Build";
813
814 //if (wxDirExists(dir + "/../_MASReceipt"))
815 // return "Mac App Store";
816
817 if (path.Contains("/Cellar/") || wxGetEnv("HOMEBREW_PREFIX", nullptr))
818 return "Homebrew";
819
820 if (path.StartsWith("/Volumes/OrcaSlicer")) // running from .dmg
821 return "Temporary";
822
823 if (path.StartsWith("/Applications"))
824 return "Applications";
825
826 return "Custom"; // running from Downloads, Desktop or custom folder
827#endif
828 return result;
829}

References GetPackageType().

Referenced by TroubleshootDialog(), and GetPackageType().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetProfilesOverview()

wxString Slic3r::GUI::TroubleshootDialog::GetProfilesOverview ( )
protected
483{
484 using ojson = nlohmann::ordered_json;
485
486 auto preset_bundle = wxGetApp().preset_bundle;
487 auto app_config = wxGetApp().app_config;
488 auto vendors = app_config->vendors();
489
490 ojson root = ojson::object();
491
495
496 { // OVERVIEW
497 root["Overview"] = "";
498 }
499 { // PRINTERS - enabled
500 ojson arr = ojson::array();
501 for (const auto& [vendor_name, models] : vendors)
502 for (const auto& [model_name, _] : models){
503 arr.push_back(model_name);
505 }
506 root["printers_enabled"] = arr;
507 }
508 { // PRINTERS - user defined
509 ojson arr = ojson::array();
510 for (auto it = preset_bundle->printers.begin(); it != preset_bundle->printers.end(); ++it) {
511 if (!it->is_user()) continue;
512 ojson entry;
513 entry["name"] = it->name;
514 entry["inherits"] = it->inherits();
515 arr.push_back(entry);
517 }
518 root["printers_user"] = arr;
519 }
520 { // FILAMENTS - enabled
521 if(app_config->has_section("filaments")){
522 auto filaments = app_config->get_section("filaments");
523 if(!filaments.empty()){
524 ojson arr = ojson::array();
525 for (const auto& filament : app_config->get_section("filaments")){
526 arr.push_back(filament.first);
528 }
529 root["filaments_enabled"] = arr;
530 }
531 }
532 }
533 { // FILAMENTS - user defined
534 ojson arr = ojson::array();
535 for (auto it = preset_bundle->filaments.begin(); it != preset_bundle->filaments.end(); ++it) {
536 if (!it->is_user()) continue;
537 ojson entry;
538 entry["name"] = it->name;
539 entry["inherits"] = it->inherits();
540 auto *compatible_printers = dynamic_cast<const ConfigOptionStrings*>(it->config.option("compatible_printers"));
541 if(compatible_printers != nullptr && !compatible_printers->values.empty()){
542 ojson c_arr = ojson::array();
543 for (const auto& c_item : compatible_printers->values)
544 c_arr.push_back(c_item);
545 entry["compatible_printers"] = c_arr;
546 }
547 auto *compatible_processes = dynamic_cast<const ConfigOptionStrings*>(it->config.option("compatible_prints"));
548 if(compatible_processes != nullptr && !compatible_processes->values.empty()){
549 ojson c_arr = ojson::array();
550 for (const auto& c_item : compatible_processes->values)
551 c_arr.push_back(c_item);
552 entry["compatible_processes"] = c_arr;
553 }
554 arr.push_back(entry);
556 }
557 root["filaments_user"] = arr;
558 }
559 { // PROCESSES - enabled, grouped by compatible printer
560 ojson obj = ojson::object();
561 for (auto it = preset_bundle->printers.begin(); it != preset_bundle->printers.end(); ++it) {
562 if (!it->is_visible || !it->is_compatible)
563 continue;
564 ojson arr = ojson::array();
565 for (auto jt = preset_bundle->prints.begin(); jt != preset_bundle->prints.end(); ++jt) {
566 if (!jt->is_visible || jt->is_user() || !jt->loaded) continue;
567 auto *compatible_printers = dynamic_cast<const ConfigOptionStrings*>(jt->config.option("compatible_printers"));
568 bool is_compatible = false;
569 if (compatible_printers == nullptr || compatible_printers->values.empty()) {
570 is_compatible = false;
571 }
572 else {
573 for (const auto& p : compatible_printers->values) {
574 if (p == it->name) {
575 is_compatible = true;
576 break;
577 }
578 }
579 }
580 if (!is_compatible)
581 continue;
582 arr.push_back(jt->name);
584 }
585 if (!arr.empty())
586 obj[it->name] = arr;
587 }
588 root["processes_enabled"] = obj;
589 }
590 { // PROCESSES - user defined
591 ojson arr = ojson::array();
592 for (auto it = preset_bundle->prints.begin(); it != preset_bundle->prints.end(); ++it) {
593 if (!it->is_user()) continue;
594 ojson entry;
595 entry["name"] = it->name;
596 entry["inherits"] = it->inherits();
597 auto *compatible_printers = dynamic_cast<const ConfigOptionStrings*>(it->config.option("compatible_printers"));
598 if(compatible_printers != nullptr && !compatible_printers->values.empty()){
599 ojson c_arr = ojson::array();
600 for (const auto& c_item : compatible_printers->values)
601 c_arr.push_back(c_item);
602 entry["compatible_printers"] = c_arr;
603 }
604 arr.push_back(entry);
606 }
607 root["processes_user"] = arr;
608 }
609 { // OVERVIEW
610 ojson entry;
611 entry["printers__act"] = m_printers__act;
612 entry["printers__usr"] = m_printers__usr;
613 entry["filaments_act"] = m_filaments_act;
614 entry["filaments_usr"] = m_filaments_usr;
615 entry["processes_act"] = m_processes_act;
616 entry["processes_usr"] = m_processes_usr;
617 root["Overview"] = entry;
618 }
619 return wxString::FromUTF8(root.dump(4));
620}
#define _(s)
Definition 3mf.cpp:306

References _, GetProfilesOverview(), m_filaments_act, m_filaments_usr, m_printers__act, m_printers__usr, m_processes_act, and m_processes_usr.

Referenced by TroubleshootDialog(), create_item_loaded_profiles(), and GetProfilesOverview().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetRAMinfo()

wxString Slic3r::GUI::TroubleshootDialog::GetRAMinfo ( )
protected
889{
890 size_t n = std::round(Slic3r::total_physical_memory() / 107374182.40);
891 return std::to_string(n / 10) + "." + std::to_string(n % 10) + " GB";
892}
size_t total_physical_memory()
Definition utils.cpp:1819

References GetRAMinfo(), and Slic3r::total_physical_memory().

Referenced by TroubleshootDialog(), and GetRAMinfo().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetSysInfoAll()

wxString Slic3r::GUI::TroubleshootDialog::GetSysInfoAll ( )
protected
441{
442 wxString package = GetPackageType();
443#ifdef __LINUX__
444 package += GetAppDisplayBackend();
445#endif
446
447 wxString info;
448 info += "Version : " + wxString(SoftFever_VERSION) + "\n"
449 + "Build : " + wxString(build_commit_label) + "\n"
450 + "Package : " + package + "\n"
451 + "Platform : " + GetOSinfo() + "\n"
452 + "Processor : " + GetCPUinfo() + "\n"
453 + "Memory : " + GetRAMinfo() + "RAM" + "\n"
454 + "Renderer : " + GetGPUinfo() + "\n"
455 + "Monitors : " + GetMONinfo();
456 return info;
457};

References Slic3r::GUI::build_commit_label.

Referenced by TroubleshootDialog().

Here is the caller graph for this function:

◆ GetTimestamp()

wxString Slic3r::GUI::TroubleshootDialog::GetTimestamp ( )
protected
435{
436 wxDateTime now = wxDateTime::Now();
437 return now.Format("%Y%m%d_%H%M"); // %S
438}

Referenced by TroubleshootDialog(), and PackAll().

Here is the caller graph for this function:

◆ is_new_scale_factor()

bool Slic3r::GUI::DPIAware< wxDialog >::is_new_scale_factor ( ) const
inlineprivateinherited
262{ return fabs(m_scale_factor - m_prev_scale_factor) > 0.001; }

◆ normal_font()

◆ on_dpi_changed()

void Slic3r::GUI::TroubleshootDialog::on_dpi_changed ( const wxRect & suggested_rect)
overrideprotectedvirtual

Implements Slic3r::GUI::DPIAware< wxDialog >.

1460{
1461 m_logo.msw_rescale();
1462 m_header_logo->SetBitmap(m_logo.bmp());
1463
1464 auto processCtrls = [&](auto&& self, wxWindow* win) -> void {
1465 if (!win)
1466 return;
1467
1468 if (Button* btn = dynamic_cast<Button*>(win))
1469 btn->Rescale();
1470
1471 if (ComboBox* combo = dynamic_cast<ComboBox*>(win))
1472 combo->Rescale();
1473
1474 wxWindowList children = win->GetChildren();
1475 for (auto child : children)
1476 self(self, child);
1477 };
1478
1479 processCtrls(processCtrls, this);
1480
1481 Layout();
1482 Fit();
1483 Refresh();
1484}

References m_header_logo, m_logo, and on_dpi_changed().

Referenced by on_dpi_changed().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ on_sys_color_changed()

◆ PackAll()

void Slic3r::GUI::TroubleshootDialog::PackAll ( )
protected
992{
993 std::vector<wxString> include_zip;
994 //auto data_dir = boost::filesystem::path(Slic3r::data_dir());
995 //include_zip.emplace_back(wxString((data_dir / "log").string()));
996
997 // Collect logs for current session. does not includes debug_network_...
998 boost::filesystem::path current_log = get_log_file_name();
999 if (!current_log.empty()){
1000 boost::filesystem::path base = current_log.parent_path() / current_log.stem(); // removes ".0"
1001 std::vector<boost::filesystem::path> result;
1002 for (int n = 0; ; ++n) {
1003 auto candidate = boost::filesystem::path(base.string() + "." + std::to_string(n));
1004 if (!boost::filesystem::exists(candidate))
1005 break;
1006 include_zip.emplace_back(wxString(candidate.string()));
1007 }
1008 }
1009
1010 auto project_name = wxGetApp().plater()->get_project_filename(".3mf");
1011 if(!project_name.IsEmpty()){
1012 if (wxGetApp().plater()->is_project_dirty()) {
1013 auto res = MessageDialog(this,
1014 _L("The current project has unsaved changes. Would you like to save before continuing\?") +
1015 "\n\n" +
1016 _L("Select NO to close dialog and review project."),
1017 wxString(SLIC3R_APP_FULL_NAME) + " - " + _L("Save"), wxYES_NO | wxCANCEL | wxYES_DEFAULT | wxCENTRE
1018 ).ShowModal();
1019 if (res == wxID_YES)
1020 wxGetApp().plater()->save_project();
1021 else {
1022 if (res == wxID_NO)
1023 EndModal(wxID_CLOSE);
1024 return;
1025 }
1026 }
1027 include_zip.emplace_back(project_name);
1028 }
1029
1030 if (project_name.IsEmpty()){
1031 MessageDialog(this, _L("No project file on current session. Only logs will be included to package"),
1032 wxString(SLIC3R_APP_FULL_NAME), wxOK | wxICON_WARNING | wxCENTRE
1033 ).ShowModal();
1034 }
1035
1036 ExportAsZip(include_zip, "OrcaSlicer_PackedDebugInfo_" + GetTimestamp());
1037}
void EndModal(int retCode) override
Definition GUI_Utils.hpp:305
static Plater * plater()
Definition GUI_Factories.cpp:400
boost::filesystem::path get_log_file_name()
Definition utils.cpp:489

References _L, Slic3r::GUI::DPIDialog::EndModal(), ExportAsZip(), Slic3r::get_log_file_name(), GetTimestamp(), PackAll(), Slic3r::GUI::plater(), Slic3r::GUI::DPIAware< P >::ShowModal(), and SLIC3R_APP_FULL_NAME.

Referenced by TroubleshootDialog(), and PackAll().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ parse_lscpu_etc()

std::map< std::string, std::string > Slic3r::GUI::TroubleshootDialog::parse_lscpu_etc ( const std::string & name,
char delimiter )
staticprotected
862{
863 std::map<std::string, std::string> out;
864 constexpr size_t max_len = 1000;
865 char cline[max_len] = "";
866 FILE* fp = popen(name.data(), "r");
867 if (fp != NULL) {
868 while (fgets(cline, max_len, fp) != NULL) {
869 std::string line(cline);
870 line.erase(std::remove_if(line.begin(), line.end(),
871 [](char c) { return c == '\"' || c == '\r' || c == '\n'; }),
872 line.end());
873 size_t pos = line.find(delimiter);
874 if (pos < line.size() - 1) {
875 std::string key = line.substr(0, pos);
876 std::string value = line.substr(pos + 1);
877 boost::trim_all(key); // remove leading and trailing spaces
878 boost::trim_all(value);
879 out.emplace(key, value);
880 }
881 }
882 pclose(fp);
883 }
884 return out;
885}
Vec3d pos(const Pt &p)
Definition ReprojectPointsOnMesh.hpp:16

References parse_lscpu_etc().

Referenced by GetCPUinfo(), and parse_lscpu_etc().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ prev_scale_factor()

float Slic3r::GUI::DPIAware< wxDialog >::prev_scale_factor ( ) const
inlineinherited
196{ return m_prev_scale_factor; }

◆ RebuildSystemProfiles()

void Slic3r::GUI::TroubleshootDialog::RebuildSystemProfiles ( )
protected
1040{
1041 if (wxGetApp().plater()->is_project_dirty()) {
1042 auto res = MessageDialog(this,
1043 _L("The current project has unsaved changes. Would you like to save before continuing\?") +
1044 "\n\n" +
1045 _L("Select NO to close dialog and review project."),
1046 wxString(SLIC3R_APP_FULL_NAME) + " - " + _L("Save"), wxYES_NO | wxCANCEL | wxYES_DEFAULT | wxCENTRE
1047 ).ShowModal();
1048 if (res == wxID_YES)
1049 wxGetApp().plater()->save_project();
1050 else {
1051 if (res == wxID_NO)
1052 EndModal(wxID_CLOSE);
1053 return;
1054 }
1055 }
1056
1057 MessageDialog msg(this,
1058 _L("Restart Required") + "\n" +
1059 _L("Please make sure any instances of OrcaSlicer are not running") + "\n" +
1060 _L("Do you want to continue?")
1061 , wxString(SLIC3R_APP_FULL_NAME), wxICON_QUESTION | wxOK | wxCANCEL
1062 );
1063 if (msg.ShowModal() == wxID_OK){
1064 auto sys_folder = boost::filesystem::path(Slic3r::data_dir()) / "system";
1065 if (boost::filesystem::exists(sys_folder)) {
1066 bool is_deletable = true;
1067 try {
1068 for (const auto& entry : boost::filesystem::recursive_directory_iterator(sys_folder)) {
1069 if (boost::filesystem::is_regular_file(entry.path())) {
1070 std::ofstream file(entry.path().string(), std::ios::in | std::ios::out);
1071 if (!file.is_open()) {
1072 BOOST_LOG_TRIVIAL(warning) << "File is locked: " << entry.path().string();
1073 is_deletable = false;
1074 }
1075 file.close();
1076 }
1077 }
1078 }
1079 catch (const std::exception& e) {
1080 is_deletable = false;
1081 BOOST_LOG_TRIVIAL(warning) << e.what();
1082 }
1083 if (!is_deletable) {
1084 MessageDialog(this, _L("System folder cannot be deleted because some files are in use by another application. Please close any applications using these files and try again."),
1085 wxString(SLIC3R_APP_FULL_NAME), wxOK | wxICON_WARNING | wxCENTRE
1086 ).ShowModal();
1087 return;
1088 }
1089 try {
1090 boost::filesystem::remove_all(sys_folder);
1091 EndModal(wxID_REMOVE);
1093 }
1094 catch (const std::exception& e) {
1095 BOOST_LOG_TRIVIAL(warning) << "Failed to delete system folder..." << e.what();
1096 MessageDialog(this, _L("Failed to delete system folder..."),
1097 wxString(SLIC3R_APP_FULL_NAME) + " - " + _L("Error"), wxOK | wxICON_WARNING | wxCENTRE
1098 ).ShowModal();
1099 }
1100 }
1101 }
1102}
bool RestartApplication()
Definition TroubleshootDialog.cpp:1104

References _L, Slic3r::data_dir(), Slic3r::GUI::DPIDialog::EndModal(), Slic3r::GUI::plater(), RebuildSystemProfiles(), RestartApplication(), Slic3r::GUI::DPIAware< P >::ShowModal(), and SLIC3R_APP_FULL_NAME.

Referenced by TroubleshootDialog(), and RebuildSystemProfiles().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ rescale()

void Slic3r::GUI::DPIAware< wxDialog >::rescale ( const wxRect & suggested_rect)
inlineprivateinherited
265 {
266 this->Freeze();
267
268 m_force_rescale = false;
269
270 // set normal application font as a current window font
271 m_normal_font = this->GetFont();
272
274
275 // rescale missed controls sizes and images
277
278 this->Layout();
279 this->Thaw();
280
281 // reset previous scale factor from current scale factor value
283 }
virtual void on_dpi_changed(const wxRect &suggested_rect)=0
void update_em_unit()
Definition GUI_Utils.hpp:249

◆ RestartApplication()

bool Slic3r::GUI::TroubleshootDialog::RestartApplication ( )
protected
1105{
1106 wxString execPath = wxStandardPaths::Get().GetExecutablePath();
1107 if (execPath.IsEmpty()) {
1108 MessageDialog(this,
1109 _L("Failed to determine executable path."),
1110 wxString(SLIC3R_APP_FULL_NAME),
1111 wxICON_WARNING | wxOK
1112 ).ShowModal();
1113 return false;
1114 }
1115
1116 // Reconstruct original argv if you need to forward launch arguments,
1117 // e.g. "--datadir", profile flags, etc.
1118 // wxString args = "--some-flag";
1119 // wxString cmd = wxString::Format(R"("%s" %s)", execPath, args);
1120
1121#ifdef __WXMSW__
1122 wxString cmd = wxString::Format(R"("%s")", execPath);
1123
1124 // CreateProcess needs a mutable buffer for lpCommandLine
1125 std::vector<wchar_t> cmdBuf(cmd.wc_str(), cmd.wc_str() + cmd.length() + 1);
1126
1127 STARTUPINFO si = { sizeof(si) };
1128 PROCESS_INFORMATION pi = {};
1129 if (!CreateProcess(nullptr, cmdBuf.data(), nullptr, nullptr, FALSE, 0, nullptr, nullptr, &si, &pi)) {
1130 MessageDialog(this, _L("Failed to launch a new instance."), wxString(SLIC3R_APP_FULL_NAME), wxICON_WARNING | wxOK).ShowModal();
1131 return false;
1132 }
1133 CloseHandle(pi.hProcess);
1134 CloseHandle(pi.hThread);
1135#else
1136 // macOS / Linux — wxExecute with ASYNC so it doesn't block
1137 wxString cmd = wxString::Format(R"("%s")", execPath);
1138 long pid = wxExecute(cmd, wxEXEC_ASYNC);
1139 if (pid == 0) {
1140 MessageDialog(this,
1141 _L("Failed to launch a new instance."),
1142 wxString(SLIC3R_APP_FULL_NAME),
1143 wxICON_WARNING | wxOK
1144 ).ShowModal();
1145 return false;
1146 }
1147#endif
1148 wxMilliSleep(500);
1149
1150 // Close this instance cleanly
1151 wxGetApp().GetTopWindow()->Close(true); // triggers EVT_CLOSE, runs cleanup
1152
1153 return true;
1154}

References _L, RestartApplication(), Slic3r::GUI::DPIAware< P >::ShowModal(), and SLIC3R_APP_FULL_NAME.

Referenced by RebuildSystemProfiles(), and RestartApplication().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SaveAsZip()

bool Slic3r::GUI::TroubleshootDialog::SaveAsZip ( const std::vector< wxString > & sourcePaths,
const wxString & zipFullPath )
protected
1421{
1422 wxFileOutputStream out(zipFullPath);
1423 if (!out.IsOk())
1424 return false;
1425 wxZipOutputStream zip(out);
1426 if (!zip.IsOk()) {
1427 out.Close();
1428 return false;
1429 }
1430 bool success = true;
1431 for (const auto& sourcePath : sourcePaths) {
1432 if (sourcePath.StartsWith(wxT("TxtData:"))) {
1433 wxString rootDir; // unused for virtual entries
1434 if (!AddToZip(zip, sourcePath, rootDir)) {
1435 success = false;
1436 break;
1437 }
1438 continue;
1439 }
1440 if (!wxDirExists(sourcePath) && !wxFileExists(sourcePath)) {
1441 success = false;
1442 break;
1443 }
1444 wxString rootDir = wxFileName(sourcePath).GetPath();
1445 if (!wxEndsWithPathSeparator(rootDir))
1446 rootDir += wxFileName::GetPathSeparator();
1447 if (!AddToZip(zip, sourcePath, rootDir)) {
1448 success = false;
1449 break;
1450 }
1451 }
1452 if (!zip.Close()) success = false;
1453 if (!out.Close()) success = false;
1454 if (!success)
1455 wxRemoveFile(zipFullPath);
1456 return success;
1457}

References AddToZip(), and SaveAsZip().

Referenced by ExportAsZip(), and SaveAsZip().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ scale_factor()

float Slic3r::GUI::DPIAware< wxDialog >::scale_factor ( ) const
inlineinherited
195{ return m_scale_factor; }

◆ set_em_unit()

void Slic3r::GUI::DPIAware< wxDialog >::set_em_unit ( int v)
inlineinherited
200{ m_em_unit = v; }

◆ set_prev_scale_factor()

void Slic3r::GUI::DPIAware< wxDialog >::set_prev_scale_factor ( float v)
inlineinherited

◆ set_scale_factor()

void Slic3r::GUI::DPIAware< wxDialog >::set_scale_factor ( float v)
inlineinherited
198{ m_scale_factor = v; }

◆ ShowModal()

◆ update_em_unit()

void Slic3r::GUI::DPIAware< wxDialog >::update_em_unit ( )
inlineprivateinherited
250 {
251 // Linux specific issue : get_dpi_for_window(this) still doesn't responce to the Display's scale in new wxWidgets(3.1.3).
252 // So, calculate the m_em_unit value from the font size, as before
253#if !defined(__WXGTK__)
255#else
256 // initialize default width_unit according to the width of the one symbol ("m") of the currently active font of this window.
257 m_em_unit = std::max<size_t>(10, this->GetTextExtent("m").x - 1);
258#endif // __WXGTK__
259 }

◆ UpdateLogsStorage()

void Slic3r::GUI::TroubleshootDialog::UpdateLogsStorage ( )
protected
1194{
1195 boost::filesystem::path logs_path = boost::filesystem::path(Slic3r::data_dir()) / "log";
1196
1197 uintmax_t total_bytes = 0;
1198 int file_count = 0;
1199 if (boost::filesystem::exists(logs_path) && boost::filesystem::is_directory(logs_path)) {
1200 for (const auto& entry : boost::filesystem::recursive_directory_iterator(logs_path)) {
1201 if (boost::filesystem::is_regular_file(entry.path())){
1202 total_bytes += boost::filesystem::file_size(entry.path());
1203 file_count++;
1204 }
1205 }
1206 }
1207
1208 bool is_mb = total_bytes >= 1024 * 1024;
1209 // TRN Number of log files, then their total size and its unit (KB or MB).
1210 wxString label = total_bytes > 0 ? wxString::Format(_L_PLURAL("%d log (%.2f %s)", "%d logs (%.2f %s)", file_count), file_count, total_bytes / (1024.0 * (is_mb ? 1024.0 : 1.0)), is_mb ? "MB" : "KB") : "";
1211 m_logs_storage->SetLabel(label);
1212}
#define _L_PLURAL(s, plural, n)
Definition I18N.hpp:96

References _L_PLURAL, Slic3r::data_dir(), m_logs_storage, and UpdateLogsStorage().

Referenced by TroubleshootDialog(), ClearLogs(), and UpdateLogsStorage().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ m_can_rescale

bool Slic3r::GUI::DPIAware< wxDialog >::m_can_rescale
privateinherited
235{ true };

◆ m_em_unit

int Slic3r::GUI::DPIAware< wxDialog >::m_em_unit
privateinherited

◆ m_filaments_act

int Slic3r::GUI::TroubleshootDialog::m_filaments_act
private

◆ m_filaments_usr

int Slic3r::GUI::TroubleshootDialog::m_filaments_usr
private

◆ m_force_rescale

bool Slic3r::GUI::DPIAware< wxDialog >::m_force_rescale
privateinherited
236{ false };

◆ m_header_logo

wxStaticBitmap* Slic3r::GUI::TroubleshootDialog::m_header_logo
private

◆ m_logo

ScalableBitmap Slic3r::GUI::TroubleshootDialog::m_logo
private

◆ m_logs_storage

Label* Slic3r::GUI::TroubleshootDialog::m_logs_storage
private

◆ m_new_font_point_size

int Slic3r::GUI::DPIAware< wxDialog >::m_new_font_point_size
privateinherited

◆ m_normal_font

wxFont Slic3r::GUI::DPIAware< wxDialog >::m_normal_font
privateinherited

◆ m_prev_scale_factor

float Slic3r::GUI::DPIAware< wxDialog >::m_prev_scale_factor
privateinherited

◆ m_printers__act

int Slic3r::GUI::TroubleshootDialog::m_printers__act
private

◆ m_printers__usr

int Slic3r::GUI::TroubleshootDialog::m_printers__usr
private

◆ m_processes_act

int Slic3r::GUI::TroubleshootDialog::m_processes_act
private

◆ m_processes_usr

int Slic3r::GUI::TroubleshootDialog::m_processes_usr
private

◆ m_scale_factor

float Slic3r::GUI::DPIAware< wxDialog >::m_scale_factor
privateinherited

◆ m_sys_panel_mode

bool Slic3r::GUI::TroubleshootDialog::m_sys_panel_mode = true
private

Referenced by TroubleshootDialog().


The documentation for this class was generated from the following files: