mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-05-19 11:23:42 +00:00
ENH: add thumbnail for printer and bed type
2. modify ams color style jira: none Change-Id: Ibc4cc21c4bcbd2e3c35f81c574f24786f41b9e62 (cherry picked from commit b391241a0b2bb0445e376ba7d130860293417076)
This commit is contained in:
BIN
resources/images/printer_preview_C13.png
Normal file
BIN
resources/images/printer_preview_C13.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 23 KiB |
BIN
resources/images/printer_preview_O1D.png
Normal file
BIN
resources/images/printer_preview_O1D.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 29 KiB |
@@ -225,6 +225,26 @@ void Plater::show_illegal_characters_warning(wxWindow* parent)
|
|||||||
show_error(parent, _L("Invalid name, the following characters are not allowed:") + " <>:/\\|?*\"");
|
show_error(parent, _L("Invalid name, the following characters are not allowed:") + " <>:/\\|?*\"");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static std::map<BedType, std::string> bed_type_thumbnails = {
|
||||||
|
{BedType::btPC, "bed_cool"},
|
||||||
|
{BedType::btEP, "bed_engineering"},
|
||||||
|
{BedType::btPEI, "bed_pei"},
|
||||||
|
{BedType::btPTE, "bed_high_templ"},
|
||||||
|
{BedType::btSuperTack, "bed_cool_supertack"}
|
||||||
|
};
|
||||||
|
|
||||||
|
// print_model_id
|
||||||
|
static std::map<std::string, std::string> printer_thumbnails = {
|
||||||
|
{"N1", "printer_preview_N1"},
|
||||||
|
{"N2S", "printer_preview_N2S"},
|
||||||
|
{"C11", "printer_preview_C11"},
|
||||||
|
{"C12", "printer_preview_C12"},
|
||||||
|
{"C13", "printer_preview_C13"},
|
||||||
|
{"BL-P001", "printer_preview_BL-P001"},
|
||||||
|
{"BL-P002", "printer_preview_BL-P002"},
|
||||||
|
{"O1D", "printer_preview_O1D"},
|
||||||
|
};
|
||||||
|
|
||||||
enum SlicedInfoIdx
|
enum SlicedInfoIdx
|
||||||
{
|
{
|
||||||
siFilament_m,
|
siFilament_m,
|
||||||
@@ -978,6 +998,13 @@ void ExtruderGroup::update_ams()
|
|||||||
if (ams_n4 * 4 + ams_n1 * 2 <= 8)
|
if (ams_n4 * 4 + ams_n1 * 2 <= 8)
|
||||||
is_upward = false;
|
is_upward = false;
|
||||||
|
|
||||||
|
std::vector<wxColour> colors = {
|
||||||
|
wxColour(255, 110, 100),
|
||||||
|
wxColour(97, 27, 22),
|
||||||
|
wxColour(7, 134, 219),
|
||||||
|
wxColour(170, 111, 252)
|
||||||
|
};
|
||||||
|
|
||||||
bool display_front_ams = !is_upward;
|
bool display_front_ams = !is_upward;
|
||||||
size_t i = 0;
|
size_t i = 0;
|
||||||
for (; i < ams_n4 && i < 4; ++i) {
|
for (; i < ams_n4 && i < 4; ++i) {
|
||||||
@@ -987,7 +1014,11 @@ void ExtruderGroup::update_ams()
|
|||||||
if (show_this_ams) {
|
if (show_this_ams) {
|
||||||
AMSinfo ams_info;
|
AMSinfo ams_info;
|
||||||
ams_info.ams_type = AMSModel::GENERIC_AMS;
|
ams_info.ams_type = AMSModel::GENERIC_AMS;
|
||||||
for (size_t i = 0; i < 4; ++i) ams_info.cans.emplace_back(Caninfo());
|
for (size_t i = 0; i < 4; ++i) {
|
||||||
|
Caninfo can_info;
|
||||||
|
can_info.material_colour = colors[i];
|
||||||
|
ams_info.cans.push_back(can_info);
|
||||||
|
}
|
||||||
ams[i]->Update(ams_info);
|
ams[i]->Update(ams_info);
|
||||||
ams[i]->Refresh();
|
ams[i]->Refresh();
|
||||||
ams[i]->Open();
|
ams[i]->Open();
|
||||||
@@ -1003,7 +1034,9 @@ void ExtruderGroup::update_ams()
|
|||||||
if (show_this_ams) {
|
if (show_this_ams) {
|
||||||
AMSinfo ams_info;
|
AMSinfo ams_info;
|
||||||
ams_info.ams_type = AMSModel::N3S_AMS;
|
ams_info.ams_type = AMSModel::N3S_AMS;
|
||||||
ams_info.cans.emplace_back(Caninfo());
|
Caninfo can_info;
|
||||||
|
can_info.material_colour = wxColour(255, 110, 100);
|
||||||
|
ams_info.cans.push_back(can_info);
|
||||||
ams[i]->Update(ams_info);
|
ams[i]->Update(ams_info);
|
||||||
ams[i]->Refresh();
|
ams[i]->Refresh();
|
||||||
ams[i]->Open();
|
ams[i]->Open();
|
||||||
@@ -1398,6 +1431,11 @@ Sidebar::Sidebar(Plater *parent)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
p->combo_printer_bed->Bind(wxEVT_COMBOBOX, [this](auto &e) {
|
||||||
|
int selection = p->combo_printer_bed->GetSelection();
|
||||||
|
p->image_printer_bed->SetBitmap(create_scaled_bitmap(bed_type_thumbnails[BedType(selection + 1)], this, 48));
|
||||||
|
});
|
||||||
|
|
||||||
{
|
{
|
||||||
auto hovered = std::make_shared<wxWindow *>();
|
auto hovered = std::make_shared<wxWindow *>();
|
||||||
for (wxWindow *w : std::initializer_list<wxWindow *>{p->panel_printer_bed, wiki_bed, p->image_printer_bed, p->combo_printer_bed}) {
|
for (wxWindow *w : std::initializer_list<wxWindow *>{p->panel_printer_bed, wiki_bed, p->image_printer_bed, p->combo_printer_bed}) {
|
||||||
@@ -1933,8 +1971,10 @@ void Sidebar::update_all_preset_comboboxes()
|
|||||||
cb->update();
|
cb->update();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (p->combo_printer)
|
if (p->combo_printer) {
|
||||||
p->combo_printer->update();
|
p->combo_printer->update();
|
||||||
|
update_printer_thumbnail();
|
||||||
|
}
|
||||||
|
|
||||||
// Orca:: show device tab based on vendor type
|
// Orca:: show device tab based on vendor type
|
||||||
p_mainframe->show_device(preset_bundle.use_bbl_device_tab());
|
p_mainframe->show_device(preset_bundle.use_bbl_device_tab());
|
||||||
@@ -2795,6 +2835,17 @@ std::string& Sidebar::get_search_line()
|
|||||||
return p->searcher.search_string();
|
return p->searcher.search_string();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Sidebar::update_printer_thumbnail()
|
||||||
|
{
|
||||||
|
auto& preset_bundle = wxGetApp().preset_bundle;
|
||||||
|
Preset & selected_preset = preset_bundle->printers.get_edited_preset();
|
||||||
|
std::string printer_type = selected_preset.get_current_printer_type(preset_bundle);
|
||||||
|
if (printer_thumbnails.find(printer_type) != printer_thumbnails.end())
|
||||||
|
p->image_printer->SetBitmap(create_scaled_bitmap(printer_thumbnails[printer_type], this, 48));
|
||||||
|
else
|
||||||
|
p->image_printer->SetBitmap(create_scaled_bitmap("printer_placeholder", this, 48));
|
||||||
|
}
|
||||||
|
|
||||||
void Sidebar::auto_calc_flushing_volumes(const int modify_id)
|
void Sidebar::auto_calc_flushing_volumes(const int modify_id)
|
||||||
{
|
{
|
||||||
auto& preset_bundle = wxGetApp().preset_bundle;
|
auto& preset_bundle = wxGetApp().preset_bundle;
|
||||||
@@ -7358,6 +7409,7 @@ void Plater::priv::on_combobox_select(wxCommandEvent &evt)
|
|||||||
PlaterPresetComboBox* preset_combo_box = dynamic_cast<PlaterPresetComboBox*>(evt.GetEventObject());
|
PlaterPresetComboBox* preset_combo_box = dynamic_cast<PlaterPresetComboBox*>(evt.GetEventObject());
|
||||||
if (preset_combo_box) {
|
if (preset_combo_box) {
|
||||||
this->on_select_preset(evt);
|
this->on_select_preset(evt);
|
||||||
|
sidebar->update_printer_thumbnail();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
this->on_select_bed_type(evt);
|
this->on_select_bed_type(evt);
|
||||||
|
|||||||
@@ -210,7 +210,7 @@ public:
|
|||||||
std::vector<PlaterPresetComboBox*>& combos_filament();
|
std::vector<PlaterPresetComboBox*>& combos_filament();
|
||||||
Search::OptionsSearcher& get_searcher();
|
Search::OptionsSearcher& get_searcher();
|
||||||
std::string& get_search_line();
|
std::string& get_search_line();
|
||||||
|
void update_printer_thumbnail();
|
||||||
private:
|
private:
|
||||||
struct priv;
|
struct priv;
|
||||||
std::unique_ptr<priv> p;
|
std::unique_ptr<priv> p;
|
||||||
|
|||||||
Reference in New Issue
Block a user