mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-07-27 04:42:33 +00:00
ENH: update printer view
jira: [STUDIO-12075] Change-Id: I3b18940513b2628a45fb51d707921607ac1511a3 (cherry picked from commit acbc1fa3406563872ab4a4f79546fb7f530aef4b) (cherry picked from commit 79f0f1a1fbede91df82175e6b8fe22457a622229)
This commit is contained in:
BIN
resources/images/printer_preview_N7.png
Normal file
BIN
resources/images/printer_preview_N7.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 3.1 KiB |
44
resources/images/printer_thumbnail_N7.svg
Normal file
44
resources/images/printer_thumbnail_N7.svg
Normal file
File diff suppressed because one or more lines are too long
|
After Width: | Height: | Size: 35 KiB |
@@ -253,20 +253,6 @@ static std::map<BedType, std::string> bed_type_thumbnails = {
|
|||||||
{BedType::btSuperTack, "bed_cool_supertack"}
|
{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"},
|
|
||||||
{"O1E", "printer_preview_O1E"},
|
|
||||||
{"O1S", "printer_preview_O1S"}
|
|
||||||
};
|
|
||||||
|
|
||||||
enum SlicedInfoIdx
|
enum SlicedInfoIdx
|
||||||
{
|
{
|
||||||
siFilament_m,
|
siFilament_m,
|
||||||
@@ -3569,14 +3555,24 @@ std::string& Sidebar::get_search_line()
|
|||||||
return p->searcher.search_string();
|
return p->searcher.search_string();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static std::map<std::string, std::string> printer_thumbnails = {};
|
||||||
|
|
||||||
void Sidebar::update_printer_thumbnail()
|
void Sidebar::update_printer_thumbnail()
|
||||||
{
|
{
|
||||||
auto& preset_bundle = wxGetApp().preset_bundle;
|
auto& preset_bundle = wxGetApp().preset_bundle;
|
||||||
Preset & selected_preset = preset_bundle->printers.get_edited_preset();
|
Preset & selected_preset = preset_bundle->printers.get_edited_preset();
|
||||||
std::string printer_type = selected_preset.get_current_printer_type(preset_bundle);
|
std::string printer_type = selected_preset.get_current_printer_type(preset_bundle);
|
||||||
if (printer_thumbnails.find(printer_type) != printer_thumbnails.end())
|
if (printer_thumbnails.find(printer_type) != printer_thumbnails.end()) // Use known cache first
|
||||||
p->image_printer->SetBitmap(create_scaled_bitmap(printer_thumbnails[printer_type], this, 48));
|
p->image_printer->SetBitmap(create_scaled_bitmap(printer_thumbnails[printer_type], this, 48));
|
||||||
else {
|
else {
|
||||||
|
try {
|
||||||
|
// No cache, try dedicated printer preview
|
||||||
|
p->image_printer->SetBitmap(create_scaled_bitmap("printer_preview_" + printer_type, this, 48));
|
||||||
|
// Success, cache it
|
||||||
|
printer_thumbnails[printer_type] = "printer_preview_" + printer_type;
|
||||||
|
return;
|
||||||
|
} catch (...) {}
|
||||||
|
|
||||||
// Orca: try to use the printer model cover as the thumbnail
|
// Orca: try to use the printer model cover as the thumbnail
|
||||||
const auto model_name = selected_preset.config.opt_string("printer_model");
|
const auto model_name = selected_preset.config.opt_string("printer_model");
|
||||||
std::string cover_file = model_name + "_cover.png";
|
std::string cover_file = model_name + "_cover.png";
|
||||||
|
|||||||
Reference in New Issue
Block a user