-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Code: Adding new option to GUI CLI
Gilbert edited this page May 7, 2018
·
5 revisions
-
https://github.com/alexrj/Slic3r/blob/master/xs/src/libslic3r/PrintConfig.hpp
- Basic definition with type.
-
https://github.com/alexrj/Slic3r/blob/master/xs/src/libslic3r/PrintConfig.cpp
- Default values
-
https://github.com/alexrj/Slic3r/blob/master/slic3r.pl#L250
- Usage instructions for CLI
-
https://github.com/alexrj/Slic3r/blob/master/lib/Slic3r/GUI/PresetEditor.pm
- GUI enable/disable routines
-
https://github.com/alexrj/Slic3r/blob/master/lib/Slic3r/Config.pm
- Configuration validation processing
-
https://github.com/alexrj/Slic3r/blob/master/lib/Slic3r/GUI/Preferences.pm
- GUI panel that controls the Preferences dialog.
- Once an option has been added to the PrintConfig, and populated it is available in under the config object in Perl.
An example for how to add a new GUI Preferences dialog option.
- Add the item and its default value to lib/Slic3r/GUI.pm, specifically the
our $Settings
variable. - Add a new line in lib/Slic3r/GUI/Preferences.pm
$optgroup->append_single_option_line(Slic3r::GUI::OptionsGroup::Option->new(
opt_id => 'view_mode', # this needs to match the name chosen in $Settings
type => 'select', # option type, use a different type if desired
label => '3D View Mode', # Label text
tooltip => 'Choose between orthographic view in 3D (default) and a less accurate perspective view (artsy).', # tooltop text
labels => ['Orthographic','Perspective'], # this is for a select box, it's an array of values
values => ['ortho','perspective'], # these are the values that a selectbox can take.
default => $Slic3r::GUI::Settings->{_}{}, # this is a reference to what you put in GUI.pm
width => 130, # change this if the box is too small.
));
- You can now reference the new setting as $Slic3r::GUI::Settings->{_}{name} (where name is whatever you called it) elsewhere in the program.