mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-07-23 19:02:10 +00:00
Troubleshoot Center Dialog (#12416)
* init * update translations * clarify warning for rebuild * auto fill issue field on github with gathered system information * add detection for linux package type * fix build errors * update * update * improve reading windows version * add multi file support for zip and use timestamp on exported zip name * fix errors * fix errorz * fix URL encoding * fix CPU info * use home or desktop as default location * fix distro name on flatpak * improve detecting local build on linux * check package type on all platforms * optimize margins * improve monitor detection * add support for adding text file to zip and add system info on export * exclude user related info from config * improve exporting profile info * fix linux monitor info * update * update detecting monitor info * Update TroubleshootDialog.cpp * Update TroubleshootDialog.cpp * Update TroubleshootDialog.cpp * revert scaling and resolution detection for linux * include project file to zip and notify after saving zip successfully saved * improve monitor info on mac * update * improve packing selection menu * update * Update TroubleshootDialog.cpp * Update TroubleshootDialog.cpp * Update TroubleshootDialog.cpp * Update TroubleshootDialog.cpp * update * update * make hash clickable * fix compatible process counting * export profiles overview instead copying to clipboard * auto restart app after cleaning system folder --------- Co-authored-by: Noisyfox <timemanager.rick@gmail.com>
This commit is contained in:
@@ -194,6 +194,7 @@ std::string debug_out_path(const char *name, ...);
|
||||
// smaller level means less log. level=5 means saving all logs.
|
||||
void set_log_path_and_level(const std::string& file, unsigned int level);
|
||||
void flush_logs();
|
||||
boost::filesystem::path get_log_file_name();
|
||||
|
||||
// A special type for strings encoded in the local Windows 8-bit code page.
|
||||
// This type is only needed for Perl bindings to relay to Perl that the string is raw, not UTF-8 encoded.
|
||||
|
||||
@@ -392,6 +392,14 @@ void flush_logs()
|
||||
return;
|
||||
}
|
||||
|
||||
// ORCA
|
||||
boost::filesystem::path get_log_file_name()
|
||||
{
|
||||
if (g_log_sink)
|
||||
return g_log_sink->locked_backend()->get_current_file_name();
|
||||
return {};
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
// The following helpers are borrowed from the LLVM project https://github.com/llvm
|
||||
namespace WindowsSupport
|
||||
|
||||
@@ -466,6 +466,8 @@ set(SLIC3R_GUI_SOURCES
|
||||
GUI/TextLines.hpp
|
||||
GUI/TickCode.cpp
|
||||
GUI/TickCode.hpp
|
||||
GUI/TroubleshootDialog.cpp
|
||||
GUI/TroubleshootDialog.hpp
|
||||
GUI/UnsavedChangesDialog.cpp
|
||||
GUI/UnsavedChangesDialog.hpp
|
||||
GUI/UpdateDialogs.cpp
|
||||
|
||||
@@ -116,6 +116,7 @@
|
||||
#include "ParamsDialog.hpp"
|
||||
#include "KBShortcutsDialog.hpp"
|
||||
#include "DownloadProgressDialog.hpp"
|
||||
#include "TroubleshootDialog.hpp"
|
||||
|
||||
#include "BitmapCache.hpp"
|
||||
#include "Notebook.hpp"
|
||||
@@ -4116,6 +4117,12 @@ void GUI_App::keyboard_shortcuts()
|
||||
dlg.ShowModal();
|
||||
}
|
||||
|
||||
void GUI_App::troubleshoot()
|
||||
{
|
||||
TroubleshootDialog dlg;
|
||||
if (dlg.ShowModal() == wxID_REMOVE)
|
||||
wxGetApp().mainframe->Close(false);
|
||||
}
|
||||
|
||||
void GUI_App::ShowUserGuide() {
|
||||
// BBS:Show NewUser Guide
|
||||
|
||||
@@ -467,6 +467,7 @@ public:
|
||||
void recreate_GUI(const wxString& message);
|
||||
void system_info();
|
||||
void keyboard_shortcuts();
|
||||
void troubleshoot();
|
||||
void load_project(wxWindow *parent, wxString& input_file) const;
|
||||
void import_model(wxWindow *parent, wxArrayString& input_files) const;
|
||||
void import_zip(wxWindow* parent, wxString& input_file) const;
|
||||
|
||||
@@ -2546,10 +2546,24 @@ static wxMenu* generate_help_menu()
|
||||
append_menu_item(helpMenu, wxID_ANY, _L("Setup Wizard"), _L("Setup Wizard"), [](wxCommandEvent &) {wxGetApp().ShowUserGuide();});
|
||||
|
||||
helpMenu->AppendSeparator();
|
||||
|
||||
// Open Config Folder
|
||||
append_menu_item(helpMenu, wxID_ANY, _L("Show Configuration Folder"), _L("Show Configuration Folder"),
|
||||
[](wxCommandEvent&) { Slic3r::GUI::desktop_open_datadir_folder(); });
|
||||
|
||||
helpMenu->AppendSeparator();
|
||||
|
||||
// Troubleshoot center
|
||||
append_menu_item(helpMenu, wxID_ANY, _L("Troubleshoot Center"), "",
|
||||
[](wxCommandEvent&) { wxGetApp().troubleshoot(); });
|
||||
|
||||
append_menu_item(helpMenu, wxID_ANY, _L("Open Network Test"), _L("Open Network Test"), [](wxCommandEvent&) {
|
||||
NetworkTestDialog dlg(wxGetApp().mainframe);
|
||||
dlg.ShowModal();
|
||||
});
|
||||
|
||||
helpMenu->AppendSeparator();
|
||||
|
||||
append_menu_item(helpMenu, wxID_ANY, _L("Show Tip of the Day"), _L("Show Tip of the Day"), [](wxCommandEvent&) {
|
||||
wxGetApp().plater()->get_dailytips()->open();
|
||||
wxGetApp().plater()->get_current_canvas3D()->set_as_dirty();
|
||||
@@ -2568,11 +2582,6 @@ static wxMenu* generate_help_menu()
|
||||
return true;
|
||||
});
|
||||
|
||||
append_menu_item(helpMenu, wxID_ANY, _L("Open Network Test"), _L("Open Network Test"), [](wxCommandEvent&) {
|
||||
NetworkTestDialog dlg(wxGetApp().mainframe);
|
||||
dlg.ShowModal();
|
||||
});
|
||||
|
||||
// About
|
||||
#ifndef __APPLE__
|
||||
wxString about_title = wxString::Format(_L("&About %s"), SLIC3R_APP_FULL_NAME);
|
||||
|
||||
1399
src/slic3r/GUI/TroubleshootDialog.cpp
Normal file
1399
src/slic3r/GUI/TroubleshootDialog.cpp
Normal file
File diff suppressed because it is too large
Load Diff
201
src/slic3r/GUI/TroubleshootDialog.hpp
Normal file
201
src/slic3r/GUI/TroubleshootDialog.hpp
Normal file
@@ -0,0 +1,201 @@
|
||||
#ifndef slic3r_GUI_TroublesootDialog_hpp_
|
||||
#define slic3r_GUI_TroublesootDialog_hpp_
|
||||
|
||||
#include <wx/wx.h>
|
||||
#include <wx/zipstrm.h>
|
||||
#include <wx/dir.h>
|
||||
#include <wx/dcbuffer.h>
|
||||
|
||||
#include "GUI_Utils.hpp"
|
||||
#include "wxExtensions.hpp"
|
||||
|
||||
#include "Widgets/Label.hpp"
|
||||
#include "Widgets/ComboBox.hpp"
|
||||
|
||||
#include <vector>
|
||||
#include <list>
|
||||
#include <map>
|
||||
|
||||
namespace Slic3r {
|
||||
namespace GUI {
|
||||
|
||||
class TroubleshootDialog : public DPIDialog
|
||||
{
|
||||
|
||||
#define DESIGN_COMBOBOX_SIZE wxSize(FromDIP(120), -1)
|
||||
|
||||
public:
|
||||
TroubleshootDialog();
|
||||
//~TroubleshootDialog();
|
||||
|
||||
private:
|
||||
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;
|
||||
|
||||
protected:
|
||||
wxFlexGridSizer* create_item_loaded_profiles();
|
||||
ComboBox* create_item_log_level_combo();
|
||||
|
||||
wxString GetTimestamp();
|
||||
|
||||
wxString GetSysInfoAll();
|
||||
//wxString GetConfigStr();
|
||||
wxString GetProfilesOverview();
|
||||
wxString GetOStype();
|
||||
wxString GetOSinfo();
|
||||
#ifdef __WINDOWS__
|
||||
wxString GetWinVersion();
|
||||
wxString GetWinDisplayVersion();
|
||||
#elif defined(__LINUX__)
|
||||
wxString GetLinuxDistroName();
|
||||
wxString GetLinuxDisplayServer();
|
||||
#endif
|
||||
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);
|
||||
|
||||
#ifdef __WINDOWS__
|
||||
static wxString get_cpu_info_from_registry();
|
||||
#else
|
||||
static std::map<std::string, std::string> parse_lscpu_etc(const std::string& name, char delimiter);
|
||||
#endif
|
||||
|
||||
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;
|
||||
};
|
||||
|
||||
class CenteredMultiLinePanel : public wxPanel
|
||||
{
|
||||
static constexpr double m_block_gap = 0.55;
|
||||
static constexpr double m_line_height = 1.15;
|
||||
std::vector<wxString> m_lines;
|
||||
|
||||
public:
|
||||
CenteredMultiLinePanel(wxWindow* parent, const std::vector<wxString>& lines = {})
|
||||
: wxPanel(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL | wxFULL_REPAINT_ON_RESIZE)
|
||||
{
|
||||
SetFont(Label::Body_14);
|
||||
SetBackgroundStyle(wxBG_STYLE_PAINT);
|
||||
Bind(wxEVT_PAINT, &CenteredMultiLinePanel::OnPaint, this);
|
||||
Bind(wxEVT_SIZE, &CenteredMultiLinePanel::OnSize, this);
|
||||
|
||||
SetText(lines);
|
||||
}
|
||||
|
||||
void SetText(const std::vector<wxString>& lines)
|
||||
{
|
||||
if(!lines.empty()){
|
||||
m_lines = lines;
|
||||
Refresh();
|
||||
UpdateMinSize();
|
||||
}
|
||||
}
|
||||
private:
|
||||
std::vector<wxString> Wrap(wxDC& dc, const wxString& text, int maxW)
|
||||
{
|
||||
std::vector<wxString> out;
|
||||
wxString cur;
|
||||
for (const auto& word : wxSplit(text, ' ', true)) {
|
||||
wxString trial = cur.empty() ? word : cur + " " + word;
|
||||
wxCoord w, h;
|
||||
dc.GetTextExtent(trial, &w, &h);
|
||||
if (w <= maxW)
|
||||
cur = trial;
|
||||
else if (!cur.empty()){
|
||||
out.push_back(cur);
|
||||
cur = word;
|
||||
}
|
||||
else
|
||||
out.push_back(word);
|
||||
}
|
||||
if (!cur.empty())
|
||||
out.push_back(cur);
|
||||
return out;
|
||||
}
|
||||
|
||||
void OnPaint(wxPaintEvent&)
|
||||
{
|
||||
wxAutoBufferedPaintDC dc(this);
|
||||
dc.Clear();
|
||||
|
||||
int cWidth = GetClientSize().GetWidth();
|
||||
if (m_lines.empty() || cWidth < 50) return;
|
||||
|
||||
dc.SetTextForeground(GetForegroundColour());
|
||||
|
||||
int y = 0;
|
||||
for (size_t i = 0; i < m_lines.size(); ++i) {
|
||||
wxCoord tw, th;
|
||||
for (auto& line : Wrap(dc, m_lines[i], cWidth)) {
|
||||
line.Trim();
|
||||
line.Trim(false);
|
||||
dc.GetTextExtent(line, &tw, &th);
|
||||
dc.DrawText(line, (cWidth - tw) / 2, y);
|
||||
y += static_cast<int>(th * m_line_height);
|
||||
}
|
||||
if (i < m_lines.size() - 1)
|
||||
y += static_cast<int>(th * m_block_gap);
|
||||
}
|
||||
}
|
||||
|
||||
void UpdateMinSize()
|
||||
{
|
||||
if (m_lines.empty() || !GetParent()) {
|
||||
SetMinSize(wxDefaultSize);
|
||||
return;
|
||||
}
|
||||
wxClientDC dc(this);
|
||||
int cWidth = GetClientSize().GetWidth();
|
||||
|
||||
int y = 0;
|
||||
for (size_t i = 0; i < m_lines.size(); ++i) {
|
||||
wxCoord th;
|
||||
for (auto& line : Wrap(dc, m_lines[i], cWidth)) {
|
||||
dc.GetTextExtent(line, nullptr, &th);
|
||||
y += static_cast<int>(th * m_line_height);
|
||||
}
|
||||
if (i < m_lines.size() - 1)
|
||||
y += static_cast<int>(th * m_block_gap);
|
||||
}
|
||||
|
||||
if(GetMinSize().GetHeight() != y){
|
||||
SetMinSize(wxSize(-1, y));
|
||||
if(GetParent())
|
||||
GetParent()->Layout();
|
||||
}
|
||||
}
|
||||
|
||||
void OnSize(wxSizeEvent& e)
|
||||
{
|
||||
Refresh();
|
||||
UpdateMinSize();
|
||||
e.Skip();
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace GUI
|
||||
} // namespace Slic3r
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user