mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-21 21:58:03 -06:00
NEW: [STUDIO-4036 STUDIO-4073] create filament and printer dialog
Jira: 4036 4073 Change-Id: I073ee4a2af4c86332e6d052f5d7322c9f2784184 (cherry picked from commit f4ec32929e1e6ebecd87e2e709636a43be497265)
This commit is contained in:
parent
131161f29b
commit
743f485fad
15 changed files with 3040 additions and 15 deletions
10
resources/images/create_success.svg
Normal file
10
resources/images/create_success.svg
Normal file
|
@ -0,0 +1,10 @@
|
|||
<svg width="24" height="25" viewBox="0 0 24 25" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<g clip-path="url(#clip0_13578_18912)">
|
||||
<path d="M12 1.86133C14.7848 1.86133 17.4555 2.96757 19.4246 4.93671C21.3938 6.90584 22.5 9.57656 22.5 12.3613C22.5 15.1461 21.3938 17.8168 19.4246 19.7859C17.4555 21.7551 14.7848 22.8613 12 22.8613C9.21523 22.8613 6.54451 21.7551 4.57538 19.7859C2.60625 17.8168 1.5 15.1461 1.5 12.3613C1.5 9.57656 2.60625 6.90584 4.57538 4.93671C6.54451 2.96757 9.21523 1.86133 12 1.86133ZM12 24.3613C15.1826 24.3613 18.2348 23.097 20.4853 20.8466C22.7357 18.5962 24 15.5439 24 12.3613C24 9.17873 22.7357 6.12648 20.4853 3.87605C18.2348 1.62561 15.1826 0.361328 12 0.361328C8.8174 0.361328 5.76516 1.62561 3.51472 3.87605C1.26428 6.12648 0 9.17873 0 12.3613C0 15.5439 1.26428 18.5962 3.51472 20.8466C5.76516 23.097 8.8174 24.3613 12 24.3613ZM17.0297 9.89102C17.3203 9.60039 17.3203 9.12227 17.0297 8.83164C16.7391 8.54102 16.2609 8.54102 15.9703 8.83164L10.5 14.302L8.02969 11.8316C7.73906 11.541 7.26094 11.541 6.97031 11.8316C6.67969 12.1223 6.67969 12.6004 6.97031 12.891L9.97031 15.891C10.2609 16.1816 10.7391 16.1816 11.0297 15.891L17.0297 9.89102Z" fill="#00AE42"/>
|
||||
</g>
|
||||
<defs>
|
||||
<clipPath id="clip0_13578_18912">
|
||||
<rect width="24" height="24" fill="white" transform="translate(0 0.361328)"/>
|
||||
</clipPath>
|
||||
</defs>
|
||||
</svg>
|
After Width: | Height: | Size: 1.3 KiB |
4
resources/images/step_1.svg
Normal file
4
resources/images/step_1.svg
Normal file
|
@ -0,0 +1,4 @@
|
|||
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<circle cx="10" cy="10" r="10" fill="#00AE42"/>
|
||||
<path d="M7.386 7.762V6.474L10.368 4.738H11.32V15H10.06V6.236L7.386 7.762Z" fill="white"/>
|
||||
</svg>
|
After Width: | Height: | Size: 242 B |
4
resources/images/step_2.svg
Normal file
4
resources/images/step_2.svg
Normal file
|
@ -0,0 +1,4 @@
|
|||
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<circle cx="10" cy="10" r="10" fill="#00AE42"/>
|
||||
<path d="M8.604 13.894H13.238V15H6.7V14.202L10.018 10.506C10.6433 9.81533 11.0727 9.274 11.306 8.882C11.5393 8.48067 11.656 8.04667 11.656 7.58C11.656 6.98267 11.4927 6.52067 11.166 6.194C10.8393 5.86733 10.4287 5.704 9.934 5.704C9.43 5.704 8.98667 5.87667 8.604 6.222C8.22133 6.558 7.946 7.006 7.778 7.566L6.77 6.992C6.97533 6.22667 7.38133 5.634 7.988 5.214C8.59467 4.78467 9.27133 4.57 10.018 4.57C10.5593 4.57 11.054 4.68667 11.502 4.92C11.95 5.144 12.3047 5.48 12.566 5.928C12.8367 6.36667 12.972 6.89867 12.972 7.524C12.972 8.13067 12.8227 8.70467 12.524 9.246C12.2253 9.78733 11.7027 10.4687 10.956 11.29L8.604 13.894Z" fill="white"/>
|
||||
</svg>
|
After Width: | Height: | Size: 793 B |
4
resources/images/step_2_ready.svg
Normal file
4
resources/images/step_2_ready.svg
Normal file
|
@ -0,0 +1,4 @@
|
|||
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<circle cx="10" cy="10" r="10" fill="#CECECE"/>
|
||||
<path d="M8.604 13.894H13.238V15H6.7V14.202L10.018 10.506C10.6433 9.81533 11.0727 9.274 11.306 8.882C11.5393 8.48067 11.656 8.04667 11.656 7.58C11.656 6.98267 11.4927 6.52067 11.166 6.194C10.8393 5.86733 10.4287 5.704 9.934 5.704C9.43 5.704 8.98667 5.87667 8.604 6.222C8.22133 6.558 7.946 7.006 7.778 7.566L6.77 6.992C6.97533 6.22667 7.38133 5.634 7.988 5.214C8.59467 4.78467 9.27133 4.57 10.018 4.57C10.5593 4.57 11.054 4.68667 11.502 4.92C11.95 5.144 12.3047 5.48 12.566 5.928C12.8367 6.36667 12.972 6.89867 12.972 7.524C12.972 8.13067 12.8227 8.70467 12.524 9.246C12.2253 9.78733 11.7027 10.4687 10.956 11.29L8.604 13.894Z" fill="#262E30"/>
|
||||
</svg>
|
After Width: | Height: | Size: 795 B |
4
resources/images/step_is_ok.svg
Normal file
4
resources/images/step_is_ok.svg
Normal file
|
@ -0,0 +1,4 @@
|
|||
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<circle cx="10" cy="10" r="10" fill="#DBFDE7"/>
|
||||
<path d="M15.874 6.75361C16.0401 6.92314 16.0401 7.20205 15.874 7.37158L8.58827 14.8091C8.4222 14.9786 8.14899 14.9786 7.98292 14.8091L4.12577 10.8716C3.9597 10.7021 3.9597 10.4231 4.12577 10.2536C4.29185 10.0841 4.56506 10.0841 4.73113 10.2536L8.2856 13.8821L15.2686 6.75361C15.4347 6.58408 15.7079 6.58408 15.874 6.75361Z" fill="black"/>
|
||||
</svg>
|
After Width: | Height: | Size: 491 B |
|
@ -2065,7 +2065,7 @@ Preset& PresetCollection::load_preset(const std::string &path, const std::string
|
|||
return preset;
|
||||
}
|
||||
|
||||
bool PresetCollection::clone_presets(std::vector<Preset const *> const &presets, std::vector<std::string> &failures, std::function<void(Preset &)> modifier)
|
||||
bool PresetCollection::clone_presets(std::vector<Preset const *> const &presets, std::vector<std::string> &failures, std::function<void(Preset &)> modifier, bool force_rewritten)
|
||||
{
|
||||
std::vector<Preset> new_presets;
|
||||
for (auto curr_preset : presets) {
|
||||
|
@ -2095,26 +2095,32 @@ bool PresetCollection::clone_presets(std::vector<Preset const *> const &presets,
|
|||
preset.config.option<ConfigOptionString>("printer_settings_id", true)->value = preset.name;
|
||||
preset.updated_time = (long long) Slic3r::Utils::get_current_time_utc();
|
||||
}
|
||||
if (!failures.empty())
|
||||
if (!failures.empty() && !force_rewritten)
|
||||
return false;
|
||||
lock();
|
||||
for (auto preset : new_presets) {
|
||||
auto it = this->find_preset_internal(preset.name);
|
||||
assert(it == m_presets.end() || it->name != preset.name);
|
||||
Preset & new_preset = *m_presets.insert(it, preset);
|
||||
new_preset.save(nullptr);
|
||||
assert((it == m_presets.end() || it->name != preset.name) || force_rewritten);
|
||||
if (it == m_presets.end() || it->name != preset.name) {
|
||||
Preset &new_preset = *m_presets.insert(it, preset);
|
||||
new_preset.save(nullptr);
|
||||
} else if (force_rewritten) {
|
||||
*it = preset;
|
||||
(*it).save(nullptr);
|
||||
}
|
||||
}
|
||||
unlock();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool PresetCollection::clone_presets_for_printer(std::vector<Preset const *> const &presets, std::vector<std::string> &failures, std::string const &printer)
|
||||
bool PresetCollection::clone_presets_for_printer(std::vector<Preset const *> const &presets, std::vector<std::string> &failures, std::string const &printer, bool force_rewritten)
|
||||
{
|
||||
return clone_presets(presets, failures, [printer](Preset &preset) {
|
||||
preset.name = preset.alias + " @ " + printer;
|
||||
preset.alias = preset.name;
|
||||
auto *compatible_printers = dynamic_cast<ConfigOptionStrings*>(preset.config.option("compatible_printers"));
|
||||
compatible_printers->values = std::vector<std::string>{ printer };
|
||||
});
|
||||
}, force_rewritten);
|
||||
}
|
||||
|
||||
bool PresetCollection::create_presets_from_template_for_printer(std::vector<std::string> const &templates, std::vector<std::string> &failures, std::string const &printer)
|
||||
|
@ -2125,13 +2131,15 @@ bool PresetCollection::create_presets_from_template_for_printer(std::vector<std:
|
|||
bool PresetCollection::clone_presets_for_filament(std::vector<Preset const *> const &presets,
|
||||
std::vector<std::string> & failures,
|
||||
std::string const & filament_name,
|
||||
std::string const & filament_id)
|
||||
std::string const & filament_id,
|
||||
bool force_rewritten)
|
||||
{
|
||||
return clone_presets(presets, failures, [filament_name, filament_id](Preset &preset) {
|
||||
preset.name = filament_name + " " + preset.name.substr(preset.name.find_last_of('@'));
|
||||
preset.alias = filament_name;
|
||||
preset.filament_id = filament_id;
|
||||
});
|
||||
},
|
||||
force_rewritten);
|
||||
}
|
||||
|
||||
std::map<std::string, std::vector<Preset const *>> PresetCollection::get_filament_presets() const
|
||||
|
|
|
@ -449,10 +449,10 @@ public:
|
|||
Preset& load_preset(const std::string &path, const std::string &name, const DynamicPrintConfig &config, bool select = true, Semver file_version = Semver(), bool is_custom_defined = false);
|
||||
Preset& load_preset(const std::string &path, const std::string &name, DynamicPrintConfig &&config, bool select = true, Semver file_version = Semver(), bool is_custom_defined = false);
|
||||
|
||||
bool clone_presets(std::vector<Preset const *> const &presets, std::vector<std::string> &failures, std::function<void(Preset &)> modifier);
|
||||
bool clone_presets_for_printer(std::vector<Preset const *> const &presets, std::vector<std::string> &failures, std::string const &printer);
|
||||
bool clone_presets(std::vector<Preset const *> const &presets, std::vector<std::string> &failures, std::function<void(Preset &)> modifier, bool force_rewritten = false);
|
||||
bool clone_presets_for_printer(std::vector<Preset const *> const &presets, std::vector<std::string> &failures, std::string const &printer, bool force_rewritten = false);
|
||||
bool create_presets_from_template_for_printer(std::vector<std::string> const &templates, std::vector<std::string> &failures, std::string const &printer);
|
||||
bool clone_presets_for_filament(std::vector<Preset const *> const &presets, std::vector<std::string> &failures, std::string const &filament_name, std::string const &filament_id);
|
||||
bool clone_presets_for_filament(std::vector<Preset const *> const &presets, std::vector<std::string> &failures, std::string const &filament_name, std::string const &filament_id, bool force_rewritten = false);
|
||||
|
||||
std::map<std::string, std::vector<Preset const *>> get_filament_presets() const;
|
||||
|
||||
|
|
|
@ -1202,7 +1202,6 @@ VendorProfile PresetBundle::get_custom_vendor_models() const
|
|||
iter_model = vendor.models.emplace(vendor.models.end(), VendorProfile::PrinterModel{});
|
||||
iter_model->name = model;
|
||||
}
|
||||
iter_model->variants.push_back(variant);
|
||||
}
|
||||
return vendor;
|
||||
}
|
||||
|
|
|
@ -416,6 +416,8 @@ set(SLIC3R_GUI_SOURCES
|
|||
GUI/Calibration.cpp
|
||||
GUI/PrintOptionsDialog.hpp
|
||||
GUI/PrintOptionsDialog.cpp
|
||||
GUI/CreatePresetsDialog.hpp
|
||||
GUI/CreatePresetsDialog.cpp
|
||||
Utils/json_diff.hpp
|
||||
Utils/json_diff.cpp
|
||||
GUI/KBShortcutsDialog.hpp
|
||||
|
|
2677
src/slic3r/GUI/CreatePresetsDialog.cpp
Normal file
2677
src/slic3r/GUI/CreatePresetsDialog.cpp
Normal file
File diff suppressed because it is too large
Load diff
248
src/slic3r/GUI/CreatePresetsDialog.hpp
Normal file
248
src/slic3r/GUI/CreatePresetsDialog.hpp
Normal file
|
@ -0,0 +1,248 @@
|
|||
#ifndef slic3r_CreatePresetsDialog_hpp_
|
||||
#define slic3r_CreatePresetsDialog_hpp_
|
||||
|
||||
#include "libslic3r/Preset.hpp"
|
||||
#include "wxExtensions.hpp"
|
||||
#include "GUI_Utils.hpp"
|
||||
#include "Widgets/Label.hpp"
|
||||
#include "Widgets/TextInput.hpp"
|
||||
#include "Widgets/Button.hpp"
|
||||
#include "Widgets/RadioBox.hpp"
|
||||
#include "Widgets/CheckBox.hpp"
|
||||
#include "Widgets/ComboBox.hpp"
|
||||
|
||||
namespace Slic3r {
|
||||
namespace GUI {
|
||||
|
||||
class CreateFilamentPresetDialog : public DPIDialog
|
||||
{
|
||||
public:
|
||||
CreateFilamentPresetDialog(wxWindow *parent);
|
||||
~CreateFilamentPresetDialog();
|
||||
|
||||
protected:
|
||||
enum FilamentOptionType {
|
||||
VENDOR = 0,
|
||||
TYPE,
|
||||
SERIAL,
|
||||
FILAMENT_PRESET,
|
||||
PRESET_FOR_PRINTER,
|
||||
FILAMENT_NAME_COUNT
|
||||
};
|
||||
|
||||
protected:
|
||||
void on_dpi_changed(const wxRect &suggested_rect) override;
|
||||
wxBoxSizer *create_item(FilamentOptionType option_type);
|
||||
wxBoxSizer *create_vendor_item();
|
||||
wxBoxSizer *create_type_item();
|
||||
wxBoxSizer *create_serial_item();
|
||||
wxBoxSizer *create_filament_preset_item();
|
||||
wxBoxSizer *create_filament_preset_for_printer_item();
|
||||
wxBoxSizer *create_button_item();
|
||||
|
||||
private:
|
||||
void clear_filament_preset_map();
|
||||
wxArrayString get_filament_preset_choices();
|
||||
wxBoxSizer * create_radio_item(wxString title, wxWindow *parent, wxString tooltip, std::vector<std::pair<RadioBox *, wxString>> &radiobox_list);
|
||||
void select_curr_radiobox(std::vector<std::pair<RadioBox *, wxString>> &radiobox_list, int btn_idx);
|
||||
wxString curr_create_filament_type();
|
||||
void get_filament_presets_by_machine();
|
||||
void get_all_filament_presets();
|
||||
|
||||
private:
|
||||
struct CreateType
|
||||
{
|
||||
wxString base_filament;
|
||||
wxString base_filament_preset;
|
||||
};
|
||||
|
||||
private:
|
||||
std::vector<std::pair<RadioBox *, wxString>> m_create_type_btns;
|
||||
std::vector<std::pair<CheckBox *, Preset *>> m_filament_preset;
|
||||
std::unordered_map<CheckBox *, Preset *> m_machint_filament_preset;
|
||||
std::unordered_map<std::string, std::vector<Preset *>> m_filament_choice_map;
|
||||
std::unordered_map<std::string, std::string> m_public_name_to_filament_id_map;
|
||||
std::unordered_map<std::string, Preset *> m_all_presets_map;
|
||||
CreateType m_create_type;
|
||||
Button * m_button_create = nullptr;
|
||||
Button * m_button_cancel = nullptr;
|
||||
ComboBox * m_filament_vendor_combobox = nullptr;
|
||||
ComboBox * m_filament_type_combobox = nullptr;
|
||||
ComboBox * m_exist_vendor_combobox = nullptr;
|
||||
ComboBox * m_filament_preset_combobox = nullptr;
|
||||
TextInput * m_filament_custom_vendor_input = nullptr;
|
||||
wxGridSizer * m_filament_presets_sizer = nullptr;
|
||||
wxPanel * m_filament_preset_panel = nullptr;
|
||||
TextInput * m_filament_serial_input = nullptr;
|
||||
|
||||
};
|
||||
|
||||
class CreatePrinterPresetDialog : public DPIDialog
|
||||
{
|
||||
public:
|
||||
CreatePrinterPresetDialog(wxWindow *parent);
|
||||
~CreatePrinterPresetDialog();
|
||||
|
||||
protected:
|
||||
void on_dpi_changed(const wxRect &suggested_rect) override;
|
||||
|
||||
/******************************************************** Control Construction *****************************************************/
|
||||
wxBoxSizer *create_step_switch_item();
|
||||
//Create Printer Page1
|
||||
void create_printer_page1(wxWindow *parent);
|
||||
wxBoxSizer *create_type_item(wxWindow *parent);
|
||||
wxBoxSizer *create_printer_item(wxWindow *parent);
|
||||
wxBoxSizer *create_nozzle_diameter_item(wxWindow *parent);
|
||||
wxBoxSizer *create_bed_shape_item(wxWindow *parent);
|
||||
wxBoxSizer *create_bed_size_item(wxWindow *parent);
|
||||
wxBoxSizer *create_origin_item(wxWindow *parent);
|
||||
wxBoxSizer *create_hot_bed_stl_item(wxWindow *parent);
|
||||
wxBoxSizer *create_hot_bed_svg_item(wxWindow *parent);
|
||||
wxBoxSizer *create_max_print_height_item(wxWindow *parent);
|
||||
wxBoxSizer *create_page1_btns_item(wxWindow *parent);
|
||||
|
||||
|
||||
//Improt Presets Page2
|
||||
void create_printer_page2(wxWindow *parent);
|
||||
wxBoxSizer *create_printer_preset_item(wxWindow *parent);
|
||||
wxBoxSizer *create_presets_item(wxWindow *parent);
|
||||
wxBoxSizer *create_presets_template_item(wxWindow *parent);
|
||||
wxBoxSizer *create_page2_btns_item(wxWindow *parent);
|
||||
|
||||
void show_page1();
|
||||
void show_page2();
|
||||
|
||||
/********************************************************** Data Interaction *******************************************************/
|
||||
bool data_init();
|
||||
void select_curr_radiobox(std::vector<std::pair<RadioBox *, wxString>> &radiobox_list, int btn_idx);
|
||||
void select_all_preset_template(std::vector<std::pair<CheckBox *, Preset *>> &preset_templates);
|
||||
void deselect_all_preset_template(std::vector<std::pair<CheckBox *, Preset *>> &preset_templates);
|
||||
void update_presets_list();
|
||||
void on_preset_model_value_change(wxCommandEvent &e);
|
||||
void clear_preset_combobox();
|
||||
void save_preset_config(Preset *preset);
|
||||
bool validate_input_valid();
|
||||
wxArrayString printer_preset_sort_with_nozzle_diameter(const VendorProfile &vendor_profile, float nozzle_diameter);
|
||||
|
||||
wxBoxSizer *create_radio_item(wxString title, wxWindow *parent, wxString tooltip, std::vector<std::pair<RadioBox *, wxString>> &radiobox_list);
|
||||
|
||||
wxString curr_create_preset_type();
|
||||
wxString curr_create_printer_type();
|
||||
|
||||
private:
|
||||
std::vector<std::pair<RadioBox *, wxString>> m_create_type_btns;
|
||||
std::vector<std::pair<RadioBox *, wxString>> m_create_presets_btns;
|
||||
std::vector<std::pair<CheckBox *, Preset *>> m_filament_preset;
|
||||
std::vector<std::pair<CheckBox *, Preset *>> m_process_preset;
|
||||
std::vector<wxString> m_create_printer_type;
|
||||
std::vector<wxString> m_create_presets_type;
|
||||
VendorProfile m_printer_preset_vendor_selected;
|
||||
Slic3r::VendorProfile::PrinterModel m_printer_preset_model_selected;
|
||||
bool rewritten = false;
|
||||
Preset * m_printer_preset = nullptr;
|
||||
wxStaticBitmap * m_step_1 = nullptr;
|
||||
wxStaticBitmap * m_step_2 = nullptr;
|
||||
Button * m_button_OK = nullptr;
|
||||
Button * m_button_create = nullptr;
|
||||
Button * m_button_page1_cancel = nullptr;
|
||||
Button * m_button_page2_cancel = nullptr;
|
||||
Button * m_button_page2_back = nullptr;
|
||||
Button * m_button_bed_stl = nullptr;
|
||||
Button * m_button_bed_svg = nullptr;
|
||||
wxWindow * m_page1 = nullptr;
|
||||
wxWindow * m_page2 = nullptr;
|
||||
ComboBox * m_select_vendor = nullptr;
|
||||
ComboBox * m_select_model = nullptr;
|
||||
ComboBox * m_select_printer = nullptr;
|
||||
CheckBox * m_can_not_find_vendor_combox = nullptr;
|
||||
wxStaticText * m_can_not_find_vendor_text = nullptr;
|
||||
wxTextCtrl * m_custom_vendor_model = nullptr;
|
||||
ComboBox * m_nozzle_diameter = nullptr;
|
||||
ComboBox * m_printer_vendor = nullptr;
|
||||
ComboBox * m_printer_model = nullptr;
|
||||
TextInput * m_bed_size_x_input = nullptr;
|
||||
TextInput * m_bed_size_y_input = nullptr;
|
||||
TextInput * m_bed_origin_x_input = nullptr;
|
||||
TextInput * m_bed_origin_y_input = nullptr;
|
||||
TextInput * m_print_height_input = nullptr;
|
||||
wxGridSizer * m_filament_preset_template_sizer = nullptr;
|
||||
wxGridSizer * m_process_preset_template_sizer = nullptr;
|
||||
wxPanel * m_filament_preset_panel = nullptr;
|
||||
wxPanel * m_process_preset_panel = nullptr;
|
||||
wxPanel * m_preset_template_panel = nullptr;
|
||||
|
||||
};
|
||||
|
||||
enum SuccessType {
|
||||
PRINTER = 0,
|
||||
FILAMENT
|
||||
};
|
||||
|
||||
class CreatePresetSuccessfulDialog : public DPIDialog
|
||||
{
|
||||
public:
|
||||
CreatePresetSuccessfulDialog(wxWindow *parent, const SuccessType &create_success_type);
|
||||
~CreatePresetSuccessfulDialog();
|
||||
|
||||
protected:
|
||||
void on_dpi_changed(const wxRect &suggested_rect) override;
|
||||
|
||||
private:
|
||||
Button *m_button_ok = nullptr;
|
||||
Button *m_button_cancel = nullptr;
|
||||
};
|
||||
|
||||
class ExportConfigsDialog : public DPIDialog
|
||||
{
|
||||
public:
|
||||
ExportConfigsDialog(wxWindow *parent);
|
||||
~ExportConfigsDialog();//to do: delete preset
|
||||
|
||||
protected:
|
||||
void on_dpi_changed(const wxRect &suggested_rect) override;
|
||||
wxBoxSizer *create_txport_config_item(wxWindow* parent);
|
||||
wxBoxSizer *create_button_item(wxWindow *parent);
|
||||
wxBoxSizer *create_select_printer(wxWindow *parent);
|
||||
|
||||
wxBoxSizer *create_radio_item(wxString title, wxWindow *parent, wxString tooltip, std::vector<std::pair<RadioBox *, wxString>> &radiobox_list);
|
||||
|
||||
struct ExportType
|
||||
{
|
||||
wxString preset_bundle;
|
||||
wxString printer_preset;
|
||||
wxString filament_preset;
|
||||
wxString process_preset;
|
||||
};
|
||||
|
||||
enum ExportCase {
|
||||
INITIALIZE_FAIL = 0,
|
||||
ADD_FILE_FAIL,
|
||||
FINALIZE_FAIL,
|
||||
OPEN_ZIP_WRITTEN_FILE,
|
||||
EXPORT_SUCCESS,
|
||||
};
|
||||
|
||||
private:
|
||||
void data_init();
|
||||
void select_curr_radiobox(std::vector<std::pair<RadioBox *, wxString>> &radiobox_list, int btn_idx);
|
||||
ExportCase archive_preset_bundle_to_file(const wxString &path);
|
||||
ExportCase archive_printer_preset_to_file(const wxString &path);
|
||||
ExportCase archive_filament_preset_to_file(const wxString &path);
|
||||
ExportCase archive_process_preset_to_file(const wxString &path);
|
||||
|
||||
private:
|
||||
std::vector<std::pair<RadioBox *, wxString>> m_export_type_btns;
|
||||
std::vector<std::pair<CheckBox *, Preset *>> m_preset;
|
||||
std::unordered_map<std::string, Preset *> m_printer_presets;
|
||||
std::unordered_map<std::string, std::vector<Preset *>> m_filament_presets;
|
||||
std::unordered_map<std::string, std::vector<Preset *>> m_process_presets;
|
||||
ExportType m_exprot_type;
|
||||
wxGridSizer * m_preset_sizer = nullptr;
|
||||
wxWindow * m_presets_window = nullptr;
|
||||
Button * m_button_ok = nullptr;
|
||||
Button * m_button_cancel = nullptr;
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
#endif
|
|
@ -3128,6 +3128,10 @@ struct ConfigsOverwriteConfirmDialog : MessageDialog
|
|||
|
||||
void MainFrame::export_config()
|
||||
{
|
||||
ExportConfigsDialog export_configs_dlg(nullptr);
|
||||
export_configs_dlg.ShowModal();
|
||||
return;
|
||||
|
||||
// Generate a cummulative configuration for the selected print, filaments and printer.
|
||||
wxDirDialog dlg(this, _L("Choose a directory"),
|
||||
from_u8(!m_last_config.IsEmpty() ? get_dir_name(m_last_config) : wxGetApp().app_config->get_last_dir()), wxDD_DEFAULT_STYLE | wxDD_DIR_MUST_EXIST);
|
||||
|
|
|
@ -564,10 +564,45 @@ Sidebar::Sidebar(Plater *parent)
|
|||
wxGetApp().run_wizard(ConfigWizard::RR_USER, ConfigWizard::SP_PRINTERS);
|
||||
});
|
||||
|
||||
StateColor create_printer_bg_col(std::pair<wxColour, int>(wxColour(219, 253, 231), StateColor::Pressed), std::pair<wxColour, int>(wxColour(238, 238, 238), StateColor::Hovered),
|
||||
std::pair<wxColour, int>(wxColour(238, 238, 238), StateColor::Normal));
|
||||
|
||||
StateColor create_printer_fg_col(std::pair<wxColour, int>(wxColour(107, 107, 106), StateColor::Pressed),
|
||||
std::pair<wxColour, int>(wxColour(107, 107, 106), StateColor::Hovered),
|
||||
std::pair<wxColour, int>(wxColour(107, 107, 106), StateColor::Normal));
|
||||
|
||||
StateColor create_printer_bd_col(std::pair<wxColour, int>(wxColour(0, 174, 66), StateColor::Pressed), std::pair<wxColour, int>(wxColour(0, 174, 66), StateColor::Hovered),
|
||||
std::pair<wxColour, int>(wxColour(172, 172, 172), StateColor::Normal));
|
||||
|
||||
auto create_printer_preset_btn = new Button(p->m_panel_printer_title, _L("Create Printer"));
|
||||
create_printer_preset_btn->SetFont(Label::Body_10);
|
||||
create_printer_preset_btn->SetPaddingSize(wxSize(FromDIP(8), FromDIP(3)));
|
||||
create_printer_preset_btn->SetCornerRadius(FromDIP(8));
|
||||
create_printer_preset_btn->SetBackgroundColor(create_printer_bg_col);
|
||||
create_printer_preset_btn->SetBorderColor(create_printer_bd_col);
|
||||
create_printer_preset_btn->SetTextColor(create_printer_fg_col);
|
||||
create_printer_preset_btn->Bind(wxEVT_BUTTON, [this](wxCommandEvent &e) {
|
||||
//CreateFilamentPresetDialog dlg(p->m_panel_printer_title);
|
||||
CreatePrinterPresetDialog dlg(p->m_panel_printer_title);
|
||||
int res = dlg.ShowModal();
|
||||
if (wxID_OK == res) {
|
||||
wxGetApp().mainframe->update_side_preset_ui();
|
||||
update_all_preset_comboboxes();
|
||||
CreatePresetSuccessfulDialog success_dlg(p->m_panel_filament_title, SuccessType::PRINTER);
|
||||
int res = success_dlg.ShowModal();
|
||||
if (res == wxID_OK) {
|
||||
p->editing_filament = -1;
|
||||
if (p->combo_printer->switch_to_tab())
|
||||
p->editing_filament = 0;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
wxBoxSizer* h_sizer_title = new wxBoxSizer(wxHORIZONTAL);
|
||||
h_sizer_title->Add(p->m_printer_icon, 0, wxALIGN_CENTRE | wxLEFT | wxRIGHT, em);
|
||||
h_sizer_title->Add(p->m_text_printer_settings, 0, wxALIGN_CENTER);
|
||||
h_sizer_title->AddStretchSpacer();
|
||||
h_sizer_title->Add(create_printer_preset_btn, 0, wxRIGHT | wxALIGN_CENTER, FromDIP(10));
|
||||
h_sizer_title->Add(p->m_printer_setting, 0, wxALIGN_CENTER);
|
||||
h_sizer_title->Add(15 * em / 10, 0, 0, 0, 0);
|
||||
h_sizer_title->SetMinSize(-1, 3 * em);
|
||||
|
@ -788,6 +823,31 @@ Sidebar::Sidebar(Plater *parent)
|
|||
wxPostEvent(parent, SimpleEvent(EVT_SCHEDULE_BACKGROUND_PROCESS, parent));
|
||||
}
|
||||
}));
|
||||
auto create_filament_preset_btn = new Button(p->m_panel_filament_title, _L("Create Filament"));
|
||||
create_filament_preset_btn->SetFont(Label::Body_10);
|
||||
create_filament_preset_btn->SetPaddingSize(wxSize(FromDIP(8), FromDIP(3)));
|
||||
create_filament_preset_btn->SetCornerRadius(FromDIP(8));
|
||||
create_filament_preset_btn->SetBackgroundColor(flush_bg_col);
|
||||
create_filament_preset_btn->SetBorderColor(flush_bd_col);
|
||||
create_filament_preset_btn->SetTextColor(flush_fg_col);
|
||||
create_filament_preset_btn->Bind(wxEVT_BUTTON, [this](wxCommandEvent &e) {
|
||||
CreateFilamentPresetDialog dlg(p->m_panel_filament_title);
|
||||
//CreatePrinterPresetDialog dlg(p->m_panel_filament_title);
|
||||
int res = dlg.ShowModal();
|
||||
if (wxID_OK == res) {
|
||||
wxGetApp().mainframe->update_side_preset_ui();
|
||||
update_ui_from_settings();
|
||||
update_all_preset_comboboxes();
|
||||
CreatePresetSuccessfulDialog success_dlg(p->m_panel_filament_title, SuccessType::FILAMENT);
|
||||
int res = success_dlg.ShowModal();
|
||||
/*if (res == wxID_OK) {
|
||||
p->editing_filament = 0;
|
||||
p->combos_filament[0]->switch_to_tab();
|
||||
}*/
|
||||
}
|
||||
});
|
||||
|
||||
bSizer39->Add(create_filament_preset_btn, 0, wxALIGN_CENTER_VERTICAL | wxLEFT, FromDIP(5));
|
||||
bSizer39->Add(p->m_flushing_volume_btn, 0, wxALIGN_CENTER_VERTICAL | wxLEFT, FromDIP(5));
|
||||
bSizer39->Hide(p->m_flushing_volume_btn);
|
||||
bSizer39->Add(FromDIP(10), 0, 0, 0, 0 );
|
||||
|
|
|
@ -25,6 +25,7 @@
|
|||
#include "libslic3r/PrintBase.hpp"
|
||||
#include "libslic3r/Calib.hpp"
|
||||
#include "libslic3r/FlushVolCalc.hpp"
|
||||
#include "CreatePresetsDialog.hpp"
|
||||
|
||||
#define FILAMENT_SYSTEM_COLORS_NUM 16
|
||||
|
||||
|
|
|
@ -3682,7 +3682,7 @@ void SelectMachineDialog::set_default_normal()
|
|||
auto dialogSize = this->GetSize();
|
||||
|
||||
#ifdef __WINDOWS__
|
||||
if (screenSize.y < dialogSize.y) {
|
||||
if (screenSize.GetHeight() < dialogSize.GetHeight()) {
|
||||
m_need_adaptation_screen = true;
|
||||
m_scrollable_view->SetScrollRate(0, 5);
|
||||
m_scrollable_view->SetSize(wxSize(-1, FromDIP(220)));
|
||||
|
@ -3843,7 +3843,7 @@ void SelectMachineDialog::set_default_from_sdcard()
|
|||
auto dialogSize = this->GetSize();
|
||||
|
||||
#ifdef __WINDOWS__
|
||||
if (screenSize.y < dialogSize.y) {
|
||||
if (screenSize.GetHeight() < dialogSize.GetHeight()) {
|
||||
m_need_adaptation_screen = true;
|
||||
m_scrollable_view->SetScrollRate(0, 5);
|
||||
m_scrollable_view->SetSize(wxSize(-1, FromDIP(220)));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue