Skip to content

Commit

Permalink
Support for SimplyPrint cloud integration (#4525)
Browse files Browse the repository at this point in the history
* Make httpserver more generic and reusable

* Add OAuthJob

* Fix issue caused by the fact that the backing widget of the `TextCtrl` is no longer `wxTextCtrl`

* Implement login and token refresh

* Implement file upload

* Try fix build error

* Support BBL printers

* Show error message if user hasn't done OAuth

* Fix typo

* Update error message

* Disable unsupported options when SimplyPrint is selected
  • Loading branch information
Noisyfox committed Mar 23, 2024
1 parent f3b3e92 commit e29bbac
Show file tree
Hide file tree
Showing 27 changed files with 1,068 additions and 221 deletions.
3 changes: 2 additions & 1 deletion src/libslic3r/Preset.cpp
Expand Up @@ -874,7 +874,7 @@ static std::vector<std::string> s_Preset_printer_options {
"nozzle_type", "nozzle_hrc","auxiliary_fan", "nozzle_volume","upward_compatible_machine", "z_hop_types", "retract_lift_enforce","support_chamber_temp_control","support_air_filtration","printer_structure",
"best_object_pos","head_wrap_detect_zone",
//SoftFever
"host_type", "print_host", "printhost_apikey",
"host_type", "print_host", "printhost_apikey", "bbl_use_printhost",
"print_host_webui",
"printhost_cafile","printhost_port","printhost_authorization_type",
"printhost_user", "printhost_password", "printhost_ssl_ignore_revoke", "thumbnails", "thumbnails_format",
Expand Down Expand Up @@ -2941,6 +2941,7 @@ static std::vector<std::string> s_PhysicalPrinter_opts {
"preset_name", // temporary option to compatibility with older Slicer
"preset_names",
"printer_technology",
"bbl_use_printhost",
"host_type",
"print_host",
"print_host_webui",
Expand Down
7 changes: 7 additions & 0 deletions src/libslic3r/PresetBundle.cpp
Expand Up @@ -344,6 +344,13 @@ VendorType PresetBundle::get_current_vendor_type()
return t;
}

bool PresetBundle::use_bbl_network()
{
const auto cfg = printers.get_edited_preset().config;
const bool use_bbl_network = is_bbl_vendor() && !cfg.opt_bool("bbl_use_printhost");
return use_bbl_network;
}

//BBS: load project embedded presets
PresetsConfigSubstitutions PresetBundle::load_project_embedded_presets(std::vector<Preset*> project_presets, ForwardCompatibilitySubstitutionRule substitution_rule)
{
Expand Down
1 change: 1 addition & 0 deletions src/libslic3r/PresetBundle.hpp
Expand Up @@ -97,6 +97,7 @@ class PresetBundle
VendorType get_current_vendor_type();
// Vendor related handy functions
bool is_bbl_vendor() { return get_current_vendor_type() == VendorType::Marlin_BBL; }
bool use_bbl_network();

//BBS: project embedded preset logic
PresetsConfigSubstitutions load_project_embedded_presets(std::vector<Preset*> project_presets, ForwardCompatibilitySubstitutionRule substitution_rule);
Expand Down
12 changes: 11 additions & 1 deletion src/libslic3r/PrintConfig.cpp
Expand Up @@ -104,7 +104,8 @@ static t_config_enum_values s_keys_map_PrintHostType {
{ "repetier", htRepetier },
{ "mks", htMKS },
{ "obico", htObico },
{ "flashforge", htFlashforge}
{ "flashforge", htFlashforge },
{ "simplyprint", htSimplyPrint },
};
CONFIG_OPTION_ENUM_DEFINE_STATIC_MAPS(PrintHostType)

Expand Down Expand Up @@ -542,6 +543,13 @@ void PrintConfigDef::init_common_params()
def->mode = comDevelop;
def->set_default_value(new ConfigOptionStrings());

def = this->add("bbl_use_printhost", coBool);
def->label = L("Use 3rd-party print host");
def->tooltip = L("Allow controlling BambuLab's printer through 3rd party print hosts");
def->mode = comAdvanced;
def->cli = ConfigOptionDef::nocli;
def->set_default_value(new ConfigOptionBool(false));

def = this->add("print_host", coString);
def->label = L("Hostname, IP or URL");
def->tooltip = L("Orca Slicer can upload G-code files to a printer host. This field should contain "
Expand Down Expand Up @@ -3068,6 +3076,7 @@ def = this->add("filament_loading_speed", coFloats);
def->enum_values.push_back("mks");
def->enum_values.push_back("obico");
def->enum_values.push_back("flashforge");
def->enum_values.push_back("simplyprint");
def->enum_labels.push_back("PrusaLink");
def->enum_labels.push_back("PrusaConnect");
def->enum_labels.push_back("Octo/Klipper");
Expand All @@ -3078,6 +3087,7 @@ def = this->add("filament_loading_speed", coFloats);
def->enum_labels.push_back("MKS");
def->enum_labels.push_back("Obico");
def->enum_labels.push_back("Flashforge");
def->enum_labels.push_back("SimplyPrint");
def->mode = comAdvanced;
def->cli = ConfigOptionDef::nocli;
def->set_default_value(new ConfigOptionEnum<PrintHostType>(htOctoPrint));
Expand Down
2 changes: 1 addition & 1 deletion src/libslic3r/PrintConfig.hpp
Expand Up @@ -59,7 +59,7 @@ enum class FuzzySkinType {
};

enum PrintHostType {
htPrusaLink, htPrusaConnect, htOctoPrint, htDuet, htFlashAir, htAstroBox, htRepetier, htMKS, htObico, htFlashforge
htPrusaLink, htPrusaConnect, htOctoPrint, htDuet, htFlashAir, htAstroBox, htRepetier, htMKS, htObico, htFlashforge, htSimplyPrint
};

enum AuthorizationType {
Expand Down
11 changes: 9 additions & 2 deletions src/slic3r/CMakeLists.txt
Expand Up @@ -528,10 +528,17 @@ set(SLIC3R_GUI_SOURCES
Utils/CalibUtils.hpp
GUI/PrinterCloudAuthDialog.cpp
GUI/PrinterCloudAuthDialog.hpp
Utils/Obico.cpp
Utils/Obico.cpp
Utils/Obico.hpp
Utils/Flashforge.cpp
Utils/Flashforge.hpp

GUI/OAuthDialog.cpp
GUI/OAuthDialog.hpp
GUI/Jobs/OAuthJob.cpp
GUI/Jobs/OAuthJob.hpp
Utils/SimplyPrint.cpp
Utils/SimplyPrint.hpp
)

if (WIN32)
Expand Down Expand Up @@ -637,4 +644,4 @@ if (UNIX AND NOT APPLE)
endif ()

# Add a definition so that we can tell we are compiling slic3r.
target_compile_definitions(libslic3r_gui PRIVATE SLIC3R_CURRENTLY_COMPILING_GUI_MODULE)
target_compile_definitions(libslic3r_gui PRIVATE SLIC3R_CURRENTLY_COMPILING_GUI_MODULE)

0 comments on commit e29bbac

Please sign in to comment.