mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-05-22 12:38:08 +08:00
Paths to resources / icons / images are set.
This commit is contained in:
parent
9a5796794e
commit
6b2a4ffe03
@ -2612,6 +2612,14 @@ CLIConfigDef::CLIConfigDef()
|
|||||||
def->cli = "cut";
|
def->cli = "cut";
|
||||||
def->default_value = new ConfigOptionFloat(0);
|
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 = this->add("export_3mf", coBool);
|
||||||
def->label = L("Export 3MF");
|
def->label = L("Export 3MF");
|
||||||
def->tooltip = L("Slice the model and export slices as 3MF.");
|
def->tooltip = L("Slice the model and export slices as 3MF.");
|
||||||
@ -2632,9 +2640,10 @@ CLIConfigDef::CLIConfigDef()
|
|||||||
|
|
||||||
def = this->add("gui", coBool);
|
def = this->add("gui", coBool);
|
||||||
def->label = L("Use GUI");
|
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->cli = "gui";
|
||||||
def->default_value = new ConfigOptionBool(false);
|
def->default_value = new ConfigOptionBool(true);
|
||||||
|
|
||||||
def = this->add("info", coBool);
|
def = this->add("info", coBool);
|
||||||
def->label = L("Output Model Info");
|
def->label = L("Output Model Info");
|
||||||
@ -2648,6 +2657,12 @@ CLIConfigDef::CLIConfigDef()
|
|||||||
def->cli = "load";
|
def->cli = "load";
|
||||||
def->default_value = new ConfigOptionStrings();
|
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 = this->add("output", coString);
|
||||||
def->label = L("Output File");
|
def->label = L("Output File");
|
||||||
def->tooltip = L("The file where the output will be written (if not specified, it will be based on the input file).");
|
def->tooltip = L("The file where the output will be written (if not specified, it will be based on the input file).");
|
||||||
|
@ -982,11 +982,13 @@ class CLIConfig : public virtual ConfigBase, public StaticConfig
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ConfigOptionFloat cut;
|
ConfigOptionFloat cut;
|
||||||
|
ConfigOptionString datadir;
|
||||||
ConfigOptionBool export_3mf;
|
ConfigOptionBool export_3mf;
|
||||||
ConfigOptionBool gui;
|
ConfigOptionBool gui;
|
||||||
ConfigOptionBool info;
|
ConfigOptionBool info;
|
||||||
ConfigOptionBool help;
|
ConfigOptionBool help;
|
||||||
ConfigOptionStrings load;
|
ConfigOptionStrings load;
|
||||||
|
ConfigOptionBool no_gui;
|
||||||
ConfigOptionString output;
|
ConfigOptionString output;
|
||||||
ConfigOptionFloat rotate;
|
ConfigOptionFloat rotate;
|
||||||
ConfigOptionFloat rotate_x;
|
ConfigOptionFloat rotate_x;
|
||||||
@ -1008,11 +1010,13 @@ public:
|
|||||||
ConfigOption* optptr(const t_config_option_key &opt_key, bool create = false) override
|
ConfigOption* optptr(const t_config_option_key &opt_key, bool create = false) override
|
||||||
{
|
{
|
||||||
OPT_PTR(cut);
|
OPT_PTR(cut);
|
||||||
|
OPT_PTR(datadir);
|
||||||
OPT_PTR(export_3mf);
|
OPT_PTR(export_3mf);
|
||||||
OPT_PTR(gui);
|
OPT_PTR(gui);
|
||||||
OPT_PTR(help);
|
OPT_PTR(help);
|
||||||
OPT_PTR(info);
|
OPT_PTR(info);
|
||||||
OPT_PTR(load);
|
OPT_PTR(load);
|
||||||
|
OPT_PTR(no_gui);
|
||||||
OPT_PTR(output);
|
OPT_PTR(output);
|
||||||
OPT_PTR(rotate);
|
OPT_PTR(rotate);
|
||||||
OPT_PTR(rotate_x);
|
OPT_PTR(rotate_x);
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
#include "TriangleMesh.hpp"
|
#include "TriangleMesh.hpp"
|
||||||
#include "Format/3mf.hpp"
|
#include "Format/3mf.hpp"
|
||||||
#include "libslic3r.h"
|
#include "libslic3r.h"
|
||||||
|
#include "Utils.hpp"
|
||||||
#include <cstdio>
|
#include <cstdio>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
@ -30,6 +31,7 @@ using namespace Slic3r;
|
|||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
// Convert arguments to UTF-8 (needed on Windows). argv then points to memory owned by a.
|
// 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);
|
boost::nowide::args a(argc, argv);
|
||||||
|
|
||||||
// parse all command line options into a DynamicConfig
|
// parse all command line options into a DynamicConfig
|
||||||
@ -41,29 +43,38 @@ int main(int argc, char **argv)
|
|||||||
return 0;
|
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
|
// apply command line options to a more handy CLIConfig
|
||||||
CLIConfig cli_config;
|
CLIConfig cli_config;
|
||||||
cli_config.apply(config, true);
|
cli_config.apply(config, true);
|
||||||
|
set_local_dir(cli_config.datadir.value);
|
||||||
|
|
||||||
DynamicPrintConfig print_config;
|
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
|
#if 1
|
||||||
GUI::GUI_App *gui = new GUI::GUI_App();
|
GUI::GUI_App *gui = new GUI::GUI_App();
|
||||||
GUI::GUI_App::SetInstance(gui);
|
GUI::GUI_App::SetInstance(gui);
|
||||||
wxEntry(argc, argv);
|
wxEntry(argc, argv);
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef USE_WX
|
|
||||||
if (cli_config.gui) {
|
|
||||||
GUI::App *gui = new GUI::App();
|
|
||||||
GUI::App::SetInstance(gui);
|
|
||||||
wxEntry(argc, argv);
|
|
||||||
}
|
|
||||||
#else
|
#else
|
||||||
if (cli_config.gui) {
|
|
||||||
std::cout << "GUI support has not been built." << "\n";
|
std::cout << "GUI support has not been built." << "\n";
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
// load config files supplied via --load
|
// load config files supplied via --load
|
||||||
for (const std::string &file : cli_config.load.values) {
|
for (const std::string &file : cli_config.load.values) {
|
||||||
if (!boost::filesystem::exists(file)) {
|
if (!boost::filesystem::exists(file)) {
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
#include <boost/lexical_cast.hpp>
|
#include <boost/lexical_cast.hpp>
|
||||||
#include <boost/algorithm/string.hpp>
|
#include <boost/algorithm/string.hpp>
|
||||||
|
#include <boost/filesystem.hpp>
|
||||||
|
|
||||||
#include <wx/stdpaths.h>
|
#include <wx/stdpaths.h>
|
||||||
#include <wx/imagpng.h>
|
#include <wx/imagpng.h>
|
||||||
@ -40,17 +41,10 @@ bool GUI_App::OnInit()
|
|||||||
// Unix: ~/ .Slic3r
|
// Unix: ~/ .Slic3r
|
||||||
// Windows : "C:\Users\username\AppData\Roaming\Slic3r" or "C:\Documents and Settings\username\Application Data\Slic3r"
|
// Windows : "C:\Users\username\AppData\Roaming\Slic3r" or "C:\Documents and Settings\username\Application Data\Slic3r"
|
||||||
// Mac : "~/Library/Application Support/Slic3r"
|
// Mac : "~/Library/Application Support/Slic3r"
|
||||||
datadir.empty() ?
|
if (data_dir().empty())
|
||||||
Slic3r::set_data_dir(wxStandardPaths::Get().GetUserDataDir().ToStdString()) :
|
Slic3r::set_data_dir(wxStandardPaths::Get().GetUserDataDir().ToUTF8().data());
|
||||||
Slic3r::set_data_dir(datadir);
|
|
||||||
// set_wxapp(this); // #ys_FIXME
|
// 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();
|
app_config = new AppConfig();
|
||||||
// set_app_config(app_config);// #ys_FIXME
|
// set_app_config(app_config);// #ys_FIXME
|
||||||
preset_bundle = new PresetBundle();
|
preset_bundle = new PresetBundle();
|
||||||
|
@ -42,8 +42,6 @@ class Tab;
|
|||||||
|
|
||||||
class GUI_App : public wxApp
|
class GUI_App : public wxApp
|
||||||
{
|
{
|
||||||
// Datadir provided on the command line.
|
|
||||||
std::string datadir = "";
|
|
||||||
bool no_plater{ true };
|
bool no_plater{ true };
|
||||||
bool app_conf_exists{ false };
|
bool app_conf_exists{ false };
|
||||||
|
|
||||||
|
@ -57,13 +57,15 @@ wxFrame(NULL, wxID_ANY, "FORK_NAME-VERSION", wxDefaultPosition, wxDefaultSize, w
|
|||||||
m_statusbar->set_status_text(_(L("Version ")) +
|
m_statusbar->set_status_text(_(L("Version ")) +
|
||||||
"Slic3r_VERSION" + // Slic3r::VERSION +
|
"Slic3r_VERSION" + // Slic3r::VERSION +
|
||||||
_(L(" - Remember to check for updates at http://github.com/prusa3d/slic3r/releases")));
|
_(L(" - Remember to check for updates at http://github.com/prusa3d/slic3r/releases")));
|
||||||
|
|
||||||
|
// 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++
|
// Make the global status bar and its progress indicator available in C++
|
||||||
m_appController->set_global_progress_indicator(m_statusbar);
|
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_loaded = true;
|
m_loaded = true;
|
||||||
|
|
||||||
// initialize layout
|
// initialize layout
|
||||||
|
Loading…
x
Reference in New Issue
Block a user