Changed the G-code export and send to OctoPrint GUI code

to store the G-code next to the project file if it exists,
and to process the project name with the PlaceholderParser.
This commit is contained in:
bubnikv 2019-05-17 16:27:00 +02:00
parent e358dd9c01
commit 04397c7948
10 changed files with 55 additions and 31 deletions

View file

@ -318,8 +318,10 @@ public:
const PlaceholderParser& placeholder_parser() const { return m_placeholder_parser; }
PlaceholderParser& placeholder_parser() { return m_placeholder_parser; }
virtual std::string output_filename() const = 0;
std::string output_filepath(const std::string &path) const;
virtual std::string output_filename(const std::string &filename_base = std::string()) const = 0;
// If the filename_base is set, it is used as the input for the template processing. In that case the path is expected to be the directory (may be empty).
// If filename_set is empty, than the path may be a file or directory. If it is a file, then the macro will not be processed.
std::string output_filepath(const std::string &path, const std::string &filename_base = std::string()) const;
protected:
friend class PrintObjectBase;
@ -334,9 +336,9 @@ protected:
void throw_if_canceled() const { if (m_cancel_status) throw CanceledException(); }
// To be called by this->output_filename() with the format string pulled from the configuration layer.
std::string output_filename(const std::string &format, const std::string &default_ext, const DynamicConfig *config_override = nullptr) const;
std::string output_filename(const std::string &format, const std::string &default_ext, const std::string &filename_base, const DynamicConfig *config_override = nullptr) const;
// Update "scale", "input_filename", "input_filename_base" placeholders from the current printable ModelObjects.
void update_object_placeholders(DynamicConfig &config) const;
void update_object_placeholders(DynamicConfig &config, const std::string &default_ext) const;
Model m_model;