mirror of
				https://github.com/SoftFever/OrcaSlicer.git
				synced 2025-10-30 20:21:12 -06:00 
			
		
		
		
	Added SystemInfo dialog,
a new SLIC3R_BUILD define to be replaced by the build script, a menu item to open the "New Issue" github page.
This commit is contained in:
		
							parent
							
								
									89702a5b4e
								
							
						
					
					
						commit
						70229be9bc
					
				
					 7 changed files with 222 additions and 0 deletions
				
			
		|  | @ -32,6 +32,7 @@ use Slic3r::GUI::Projector; | |||
| use Slic3r::GUI::OptionsGroup; | ||||
| use Slic3r::GUI::OptionsGroup::Field; | ||||
| use Slic3r::GUI::SimpleTab; | ||||
| use Slic3r::GUI::SystemInfo; | ||||
| use Slic3r::GUI::Tab; | ||||
| 
 | ||||
| our $have_OpenGL = eval "use Slic3r::GUI::3DScene; 1"; | ||||
|  | @ -220,6 +221,31 @@ sub about { | |||
|     $about->Destroy; | ||||
| } | ||||
| 
 | ||||
| sub system_info { | ||||
|     my ($self) = @_; | ||||
| 
 | ||||
|     my $slic3r_info = Slic3r::slic3r_info(format => 'html'); | ||||
|     my $copyright_info = Slic3r::copyright_info(format => 'html'); | ||||
|     my $system_info = Slic3r::system_info(format => 'html'); | ||||
|     my $opengl_info; | ||||
|     my $opengl_info_txt = ''; | ||||
|     if (defined($self->{mainframe}) && defined($self->{mainframe}->{plater}) && | ||||
|         defined($self->{mainframe}->{plater}->{canvas3D})) { | ||||
|         $opengl_info = $self->{mainframe}->{plater}->{canvas3D}->opengl_info(format => 'html'); | ||||
|         $opengl_info_txt = $self->{mainframe}->{plater}->{canvas3D}->opengl_info; | ||||
|     } | ||||
|     my $about = Slic3r::GUI::SystemInfo->new( | ||||
|         parent      => undef,  | ||||
|         slic3r_info => $slic3r_info, | ||||
| #        copyright_info => $copyright_info, | ||||
|         system_info => $system_info,  | ||||
|         opengl_info => $opengl_info, | ||||
|         text_info => Slic3r::slic3r_info . Slic3r::system_info . $opengl_info_txt, | ||||
|     ); | ||||
|     $about->ShowModal; | ||||
|     $about->Destroy; | ||||
| } | ||||
| 
 | ||||
| # static method accepting a wxWindow object as first parameter | ||||
| sub catch_error { | ||||
|     my ($self, $cb, $message_dialog) = @_; | ||||
|  |  | |||
|  | @ -1492,6 +1492,49 @@ sub draw_active_object_annotations { | |||
|     glEnable(GL_DEPTH_TEST); | ||||
| } | ||||
| 
 | ||||
| sub opengl_info | ||||
| { | ||||
|     my ($self, %params) = @_; | ||||
|     my %tag = Slic3r::tags($params{format}); | ||||
| 
 | ||||
|     my $gl_version       = glGetString(GL_VERSION); | ||||
|     my $gl_vendor        = glGetString(GL_VENDOR); | ||||
|     my $gl_renderer      = glGetString(GL_RENDERER); | ||||
|     my $glsl_version_ARB = glGetString(GL_SHADING_LANGUAGE_VERSION_ARB) // ''; | ||||
|     my $glsl_version     = glGetString(GL_SHADING_LANGUAGE_VERSION) // $glsl_version_ARB; | ||||
|     $glsl_version .= 'ARB(' . $glsl_version_ARB . ')' if ($glsl_version_ARB ne '' && $glsl_version ne $glsl_version_ARB); | ||||
| 
 | ||||
|     my $out = ''; | ||||
|     $out .= "$tag{h2start}OpenGL installation$tag{h2end}$tag{eol}"; | ||||
|     $out .= "  $tag{bstart}Using POGL$tag{bend} v$OpenGL::BUILD_VERSION$tag{eol}"; | ||||
|     $out .= "  $tag{bstart}GL version:   $tag{bend}${gl_version}$tag{eol}"; | ||||
|     $out .= "  $tag{bstart}vendor:       $tag{bend}${gl_vendor}$tag{eol}"; | ||||
|     $out .= "  $tag{bstart}renderer:     $tag{bend}${gl_renderer}$tag{eol}"; | ||||
|     $out .= "  $tag{bstart}GLSL version: $tag{bend}${glsl_version}$tag{eol}"; | ||||
| 
 | ||||
|     # Check for required OpenGL extensions | ||||
|     $out .= "$tag{h2start}Required extensions (* implemented):$tag{h2end}$tag{eol}"; | ||||
|     my @extensions_required = qw(GL_ARB_shader_objects GL_ARB_fragment_shader GL_ARB_vertex_shader GL_ARB_shading_language_100); | ||||
|     foreach my $ext (sort @extensions_required) { | ||||
|         my $stat = glpCheckExtension($ext); | ||||
|         $out .= sprintf("%s ${ext}$tag{eol}", $stat?' ':'*'); | ||||
|         $out .= sprintf("    ${stat}$tag{eol}") if ($stat && $stat !~ m|^$ext |); | ||||
|     } | ||||
|     # Check for other OpenGL extensions | ||||
|     $out .= "$tag{h2start}Installed extensions (* implemented in the module):$tag{h2end}$tag{eol}"; | ||||
|     my $extensions = glGetString(GL_EXTENSIONS); | ||||
|     my @extensions = split(' ',$extensions); | ||||
|     foreach my $ext (sort @extensions) { | ||||
|         if(! grep(/^$extensions$/, @extensions_required)) { | ||||
|             my $stat = glpCheckExtension($ext); | ||||
|             $out .= sprintf("%s ${ext}$tag{eol}", $stat?' ':'*'); | ||||
|             $out .= sprintf("    ${stat}$tag{eol}") if ($stat && $stat !~ m|^$ext |); | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     return $out; | ||||
| } | ||||
| 
 | ||||
| sub _report_opengl_state | ||||
| { | ||||
|     my ($self, $comment) = @_; | ||||
|  |  | |||
|  | @ -331,6 +331,12 @@ sub _init_menubar { | |||
|             Wx::LaunchDefaultBrowser('http://manual.slic3r.org/'); | ||||
|         }); | ||||
|         $helpMenu->AppendSeparator(); | ||||
|         $self->_append_menu_item($helpMenu, "System Info", 'Show system information', sub { | ||||
|             wxTheApp->system_info; | ||||
|         }); | ||||
|         $self->_append_menu_item($helpMenu, "Report an Issue", 'Report an issue on the Slic3r Prusa Edition', sub { | ||||
|             Wx::LaunchDefaultBrowser('http://github.com/prusa3d/slic3r/issues/new'); | ||||
|         }); | ||||
|         $self->_append_menu_item($helpMenu, "&About Slic3r", 'Show about dialog', sub { | ||||
|             wxTheApp->about; | ||||
|         }); | ||||
|  |  | |||
							
								
								
									
										70
									
								
								lib/Slic3r/GUI/SystemInfo.pm
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										70
									
								
								lib/Slic3r/GUI/SystemInfo.pm
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,70 @@ | |||
| package Slic3r::GUI::SystemInfo; | ||||
| use strict; | ||||
| use warnings; | ||||
| use utf8; | ||||
| 
 | ||||
| use Wx qw(:font :html :misc :dialog :sizer :systemsettings :frame :id wxTheClipboard); | ||||
| use Wx::Event qw(EVT_HTML_LINK_CLICKED EVT_LEFT_DOWN EVT_BUTTON); | ||||
| use Wx::Html; | ||||
| use base 'Wx::Dialog'; | ||||
| 
 | ||||
| sub new { | ||||
|     my ($class, %params) = @_; | ||||
|     my $self = $class->SUPER::new($params{parent}, -1, 'Slic3r Prusa Edition - System Information', wxDefaultPosition, [600, 340],  | ||||
|         wxDEFAULT_DIALOG_STYLE | wxMAXIMIZE_BOX | wxRESIZE_BORDER); | ||||
|     $self->{text_info} = $params{text_info}; | ||||
| 
 | ||||
|     $self->SetBackgroundColour(Wx::wxWHITE); | ||||
|     my $vsizer = Wx::BoxSizer->new(wxVERTICAL); | ||||
|     $self->SetSizer($vsizer); | ||||
| 
 | ||||
|     # text | ||||
|     my $text = | ||||
|         '<html>' . | ||||
|         '<body bgcolor="#ffffff" link="#808080">' . | ||||
|         ($params{slic3r_info} // '') . | ||||
|         ($params{copyright_info} // '') . | ||||
|         ($params{system_info} // '') . | ||||
|         ($params{opengl_info} // '') . | ||||
|         '</body>' . | ||||
|         '</html>'; | ||||
|     my $html = $self->{html} = Wx::HtmlWindow->new($self, -1, wxDefaultPosition, wxDefaultSize, wxHW_SCROLLBAR_AUTO); | ||||
|     my $font = Wx::SystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT); | ||||
| #    my $size = &Wx::wxMSW ? 8 : 10; | ||||
| #    $html->SetFonts($font->GetFaceName, $font->GetFaceName, [$size, $size, $size, $size, $size, $size, $size]); | ||||
|     $html->SetBorders(2); | ||||
|     $html->SetPage($text); | ||||
|     $vsizer->Add($html, 1, wxEXPAND | wxALIGN_LEFT | wxRIGHT | wxBOTTOM, 20); | ||||
|     EVT_HTML_LINK_CLICKED($self, $html, \&link_clicked); | ||||
|      | ||||
|     my $buttons = $self->CreateStdDialogButtonSizer(wxOK); | ||||
|     my $btn_copy_to_clipboard = Wx::Button->new($self, -1, "Copy to Clipboard", wxDefaultPosition, wxDefaultSize); | ||||
|     $buttons->Insert(0, $btn_copy_to_clipboard, 0, wxLEFT, 5); | ||||
|     EVT_BUTTON($self, $btn_copy_to_clipboard, \©_to_clipboard); | ||||
|     $self->SetEscapeId(wxID_CLOSE); | ||||
|     EVT_BUTTON($self, wxID_CLOSE, sub { | ||||
|         $self->EndModal(wxID_CLOSE); | ||||
|         $self->Close; | ||||
|     }); | ||||
| #    $vsizer->Add($buttons, 0, wxEXPAND | wxRIGHT | wxBOTTOM, 3); | ||||
|     $vsizer->Add($buttons, 0, wxEXPAND | wxALL, 3); | ||||
|      | ||||
|     return $self; | ||||
| } | ||||
| 
 | ||||
| sub link_clicked { | ||||
|     my ($self, $event) = @_; | ||||
| 
 | ||||
|     Wx::LaunchDefaultBrowser($event->GetLinkInfo->GetHref); | ||||
|     $event->Skip(0); | ||||
| } | ||||
| 
 | ||||
| sub copy_to_clipboard { | ||||
|     my ($self, $event) = @_; | ||||
|     my $data = $self->{text_info}; | ||||
|     wxTheClipboard->Open; | ||||
|     wxTheClipboard->SetData(Wx::TextDataObject->new($data)); | ||||
|     wxTheClipboard->Close; | ||||
| } | ||||
| 
 | ||||
| 1; | ||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 bubnikv
						bubnikv