Paths to resources / icons / images are set.
This commit is contained in:
parent
9a5796794e
commit
6b2a4ffe03
6 changed files with 55 additions and 31 deletions
|
@ -2612,6 +2612,14 @@ CLIConfigDef::CLIConfigDef()
|
|||
def->cli = "cut";
|
||||
def->default_value = new ConfigOptionFloat(0);
|
||||
|
||||
def = this->add("datadir", coString);
|
||||
def->label = L("User data directory");
|
||||
def->tooltip = L("Load and store settings at the given directory. "
|
||||
"This is useful for maintaining different profiles or including "
|
||||
"configurations from a network storage.");
|
||||
def->cli = "datadir";
|
||||
def->default_value = new ConfigOptionString();
|
||||
|
||||
def = this->add("export_3mf", coBool);
|
||||
def->label = L("Export 3MF");
|
||||
def->tooltip = L("Slice the model and export slices as 3MF.");
|
||||
|
@ -2632,9 +2640,10 @@ CLIConfigDef::CLIConfigDef()
|
|||
|
||||
def = this->add("gui", coBool);
|
||||
def->label = L("Use GUI");
|
||||
def->tooltip = L("Start the Slic3r GUI.");
|
||||
def->tooltip = L("Forces the GUI launch instead of command line slicing "
|
||||
"(if you supply a model file, it will be loaded into the plater)");
|
||||
def->cli = "gui";
|
||||
def->default_value = new ConfigOptionBool(false);
|
||||
def->default_value = new ConfigOptionBool(true);
|
||||
|
||||
def = this->add("info", coBool);
|
||||
def->label = L("Output Model Info");
|
||||
|
@ -2647,6 +2656,12 @@ CLIConfigDef::CLIConfigDef()
|
|||
def->tooltip = L("Load configuration from the specified file. It can be used more than once to load options from multiple files.");
|
||||
def->cli = "load";
|
||||
def->default_value = new ConfigOptionStrings();
|
||||
|
||||
def = this->add("no_gui", coBool);
|
||||
def->label = L("Do not use GUI");
|
||||
def->tooltip = L("Forces the command line slicing instead of gui. This takes precedence over --gui if both are present.");
|
||||
def->cli = "no-gui";
|
||||
def->default_value = new ConfigOptionBool(false);
|
||||
|
||||
def = this->add("output", coString);
|
||||
def->label = L("Output File");
|
||||
|
|
|
@ -982,11 +982,13 @@ class CLIConfig : public virtual ConfigBase, public StaticConfig
|
|||
{
|
||||
public:
|
||||
ConfigOptionFloat cut;
|
||||
ConfigOptionString datadir;
|
||||
ConfigOptionBool export_3mf;
|
||||
ConfigOptionBool gui;
|
||||
ConfigOptionBool info;
|
||||
ConfigOptionBool help;
|
||||
ConfigOptionStrings load;
|
||||
ConfigOptionBool no_gui;
|
||||
ConfigOptionString output;
|
||||
ConfigOptionFloat rotate;
|
||||
ConfigOptionFloat rotate_x;
|
||||
|
@ -1008,11 +1010,13 @@ public:
|
|||
ConfigOption* optptr(const t_config_option_key &opt_key, bool create = false) override
|
||||
{
|
||||
OPT_PTR(cut);
|
||||
OPT_PTR(datadir);
|
||||
OPT_PTR(export_3mf);
|
||||
OPT_PTR(gui);
|
||||
OPT_PTR(help);
|
||||
OPT_PTR(info);
|
||||
OPT_PTR(load);
|
||||
OPT_PTR(no_gui);
|
||||
OPT_PTR(output);
|
||||
OPT_PTR(rotate);
|
||||
OPT_PTR(rotate_x);
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#include "TriangleMesh.hpp"
|
||||
#include "Format/3mf.hpp"
|
||||
#include "libslic3r.h"
|
||||
#include "Utils.hpp"
|
||||
#include <cstdio>
|
||||
#include <string>
|
||||
#include <cstring>
|
||||
|
@ -30,6 +31,7 @@ using namespace Slic3r;
|
|||
int main(int argc, char **argv)
|
||||
{
|
||||
// Convert arguments to UTF-8 (needed on Windows). argv then points to memory owned by a.
|
||||
//FIXME On Windows, we want to receive the arguments as 16bit characters!
|
||||
boost::nowide::args a(argc, argv);
|
||||
|
||||
// parse all command line options into a DynamicConfig
|
||||
|
@ -41,29 +43,38 @@ int main(int argc, char **argv)
|
|||
return 0;
|
||||
}
|
||||
|
||||
boost::filesystem::path path_to_binary = boost::filesystem::system_complete(argv[0]);
|
||||
boost::filesystem::path path_resources = path_to_binary.parent_path();
|
||||
path_resources /= (path_to_binary.stem().string() == "slic3r-gui") ?
|
||||
// Running from the build directory:
|
||||
"../../resources" :
|
||||
// Running from an installation directory:
|
||||
#if APPLE
|
||||
'/../Resources'
|
||||
#else
|
||||
"resources"
|
||||
#endif
|
||||
;
|
||||
set_resources_dir(path_resources.string());
|
||||
set_var_dir((path_resources / "icons").string());
|
||||
set_local_dir((path_resources / "localization").string());
|
||||
|
||||
// apply command line options to a more handy CLIConfig
|
||||
CLIConfig cli_config;
|
||||
cli_config.apply(config, true);
|
||||
|
||||
set_local_dir(cli_config.datadir.value);
|
||||
|
||||
DynamicPrintConfig print_config;
|
||||
|
||||
if ((argc == 1 || cli_config.gui.value) && ! cli_config.no_gui.value && ! cli_config.help.value && cli_config.save.value.empty()) {
|
||||
#if 1
|
||||
GUI::GUI_App *gui = new GUI::GUI_App();
|
||||
GUI::GUI_App::SetInstance(gui);
|
||||
wxEntry(argc, argv);
|
||||
#endif
|
||||
|
||||
#ifdef USE_WX
|
||||
if (cli_config.gui) {
|
||||
GUI::App *gui = new GUI::App();
|
||||
GUI::App::SetInstance(gui);
|
||||
GUI::GUI_App *gui = new GUI::GUI_App();
|
||||
GUI::GUI_App::SetInstance(gui);
|
||||
wxEntry(argc, argv);
|
||||
}
|
||||
#else
|
||||
if (cli_config.gui) {
|
||||
std::cout << "GUI support has not been built." << "\n";
|
||||
}
|
||||
#endif
|
||||
}
|
||||
// load config files supplied via --load
|
||||
for (const std::string &file : cli_config.load.values) {
|
||||
if (!boost::filesystem::exists(file)) {
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
#include <boost/lexical_cast.hpp>
|
||||
#include <boost/algorithm/string.hpp>
|
||||
#include <boost/filesystem.hpp>
|
||||
|
||||
#include <wx/stdpaths.h>
|
||||
#include <wx/imagpng.h>
|
||||
|
@ -40,17 +41,10 @@ bool GUI_App::OnInit()
|
|||
// Unix: ~/ .Slic3r
|
||||
// Windows : "C:\Users\username\AppData\Roaming\Slic3r" or "C:\Documents and Settings\username\Application Data\Slic3r"
|
||||
// Mac : "~/Library/Application Support/Slic3r"
|
||||
datadir.empty() ?
|
||||
Slic3r::set_data_dir(wxStandardPaths::Get().GetUserDataDir().ToStdString()) :
|
||||
Slic3r::set_data_dir(datadir);
|
||||
if (data_dir().empty())
|
||||
Slic3r::set_data_dir(wxStandardPaths::Get().GetUserDataDir().ToUTF8().data());
|
||||
// set_wxapp(this); // #ys_FIXME
|
||||
|
||||
// #ys_FIXME temporary workaround
|
||||
if (var_dir().empty())
|
||||
set_var_dir("c:\\src\\Slic3r_TMP\\resources\\icons");
|
||||
if (localization_dir().empty())
|
||||
set_local_dir("c:\\src\\Slic3r_TMP\\resources\\localization");
|
||||
|
||||
app_config = new AppConfig();
|
||||
// set_app_config(app_config);// #ys_FIXME
|
||||
preset_bundle = new PresetBundle();
|
||||
|
|
|
@ -42,8 +42,6 @@ class Tab;
|
|||
|
||||
class GUI_App : public wxApp
|
||||
{
|
||||
// Datadir provided on the command line.
|
||||
std::string datadir = "";
|
||||
bool no_plater{ true };
|
||||
bool app_conf_exists{ false };
|
||||
|
||||
|
|
|
@ -57,12 +57,14 @@ wxFrame(NULL, wxID_ANY, "FORK_NAME-VERSION", wxDefaultPosition, wxDefaultSize, w
|
|||
m_statusbar->set_status_text(_(L("Version ")) +
|
||||
"Slic3r_VERSION" + // Slic3r::VERSION +
|
||||
_(L(" - Remember to check for updates at http://github.com/prusa3d/slic3r/releases")));
|
||||
// Make the global status bar and its progress indicator available in C++
|
||||
m_appController->set_global_progress_indicator(m_statusbar);
|
||||
|
||||
// m_appController->set_model(m_plater->model);
|
||||
// m_appController->set_print(m_plater->print);
|
||||
// m_plater->appController = m_appController;
|
||||
// m_appController->set_model(m_plater->model);
|
||||
// m_appController->set_print(m_plater->print);
|
||||
// m_plater->appController = m_appController;
|
||||
GUI::set_gui_appctl();
|
||||
|
||||
// Make the global status bar and its progress indicator available in C++
|
||||
m_appController->set_global_progress_indicator(m_statusbar);
|
||||
|
||||
m_loaded = true;
|
||||
|
||||
|
|
Loading…
Reference in a new issue