mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-07-19 08:52:09 +00:00
Merge branch 'main' into fix/renamed-printer-filament-compat
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
const bundlesById = new Map(); // bundleId -> bundle object
|
||||
const printersByBundle = new Map(); // bundleId -> Map(index -> printerName)
|
||||
const filamentsByBundle = new Map(); // bundleId -> Map(index -> filamentName)
|
||||
const presetsByBundle = new Map(); // bundleId -> Map(index -> presetName)
|
||||
const processesByBundle = new Map(); // bundleId -> Map(index -> presetName)
|
||||
const UPDATE_TOOLTIP = "Update available";
|
||||
const UNAUTHORIZED_TOOLTIP = "Unauthorized bundle";
|
||||
|
||||
@@ -193,7 +193,7 @@ function unpackPayload(payload) {
|
||||
bundlesById.clear();
|
||||
printersByBundle.clear();
|
||||
filamentsByBundle.clear();
|
||||
presetsByBundle.clear();
|
||||
processesByBundle.clear();
|
||||
|
||||
const list = payload?.data || [];
|
||||
for (const bundle of list) {
|
||||
@@ -212,7 +212,7 @@ function unpackPayload(payload) {
|
||||
|
||||
printersByBundle.set(id, new Map((bundle.printers || []).map((name, i) => [i, name])));
|
||||
filamentsByBundle.set(id, new Map((bundle.filaments || []).map((name, i) => [i, name])));
|
||||
presetsByBundle.set(id, new Map((bundle.presets || []).map((name, i) => [i, name])));
|
||||
processesByBundle.set(id, new Map((bundle.processes || []).map((name, i) => [i, name])));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -277,14 +277,14 @@ function renderBottomForBundle(bundleId) {
|
||||
const key = String(bundleId || "");
|
||||
const printers = printersByBundle.get(key) || new Map();
|
||||
const filaments = filamentsByBundle.get(key) || new Map();
|
||||
const presets = presetsByBundle.get(key) || new Map();
|
||||
const processes = processesByBundle.get(key) || new Map();
|
||||
|
||||
// Convert to a flat list of rows { typeLabel, name }
|
||||
const rows = [];
|
||||
|
||||
for (const [, name] of printers) rows.push({ type: "Printer", name });
|
||||
for (const [, name] of filaments) rows.push({ type: "Filament", name });
|
||||
for (const [, name] of presets) rows.push({ type: "Preset", name });
|
||||
for (const [, name] of processes) rows.push({ type: "Process", name });
|
||||
|
||||
bottomList.innerHTML = rows.map((r, idx) => `
|
||||
<div class="row" data-id="${escapeAttr(bundleId)}" data-idx="${idx}">
|
||||
|
||||
@@ -304,6 +304,9 @@ public:
|
||||
|
||||
m_bg_color = StateColor::darkModeColorFor(wxColour("#FFFFFF"));
|
||||
m_fg_color = StateColor::darkModeColorFor(wxColour("#6B6A6A"));
|
||||
m_progress_bg_color = StateColor::darkModeColorFor(wxColour("#DFDFDF"));
|
||||
m_progress_fg_color = StateColor::darkModeColorFor(wxColour("#009688"));
|
||||
m_progress_h = FromDIP(6);
|
||||
bool dark_mode = m_fg_color != wxColour("#6B6A6A");
|
||||
wxSize sz = m_window->GetClientSize();
|
||||
BitmapCache bmp_cache;
|
||||
@@ -333,20 +336,34 @@ public:
|
||||
dc.DrawLabel(m_text_version, rc, wxALIGN_CENTER);
|
||||
|
||||
dc.SetFont(m_font_action);
|
||||
rc.y = c_sz.GetHeight() * 0.88;
|
||||
rc.y = c_sz.GetHeight() * 0.85;
|
||||
rc.height = dc.GetTextExtent(m_text_action).GetHeight();
|
||||
dc.DrawLabel(m_text_action, rc, wxALIGN_CENTER);
|
||||
|
||||
const wxRect progress_rc(0, c_sz.GetHeight() - m_progress_h, c_sz.GetWidth(), m_progress_h);
|
||||
|
||||
dc.SetPen(*wxTRANSPARENT_PEN);
|
||||
dc.SetBrush(wxBrush(m_progress_bg_color));
|
||||
dc.DrawRectangle(progress_rc);
|
||||
|
||||
const int fill_width = progress_rc.GetWidth() * m_progress * 0.01;
|
||||
if (fill_width > 0) {
|
||||
dc.SetBrush(wxBrush(m_progress_fg_color));
|
||||
dc.DrawRectangle(0, progress_rc.GetTop(), fill_width, m_progress_h);
|
||||
}
|
||||
}
|
||||
|
||||
void SetText(const wxString& text)
|
||||
void SetText(const wxString& text, int progress)
|
||||
{
|
||||
if (!text.empty()) {
|
||||
int calc_progress = std::max(m_progress, std::clamp(progress, 0, 100));
|
||||
if (m_text_action != text || m_progress != calc_progress){
|
||||
m_text_action = text;
|
||||
m_progress = calc_progress;
|
||||
m_window->Refresh();
|
||||
m_window->Update();
|
||||
#ifdef __WXOSX__
|
||||
// without this code splash screen wouldn't be updated under OSX
|
||||
wxYield();
|
||||
// without this code splash screen wouldn't be updated under OSX
|
||||
wxYield();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@@ -383,9 +400,13 @@ private:
|
||||
wxBitmap m_logo_bmp;
|
||||
wxColour m_fg_color;
|
||||
wxColour m_bg_color;
|
||||
wxColour m_progress_bg_color;
|
||||
wxColour m_progress_fg_color;
|
||||
|
||||
wxString m_text_version = GUI_App::format_display_version();
|
||||
wxString m_text_action = _L("Loading configuration") + dots;
|
||||
int m_progress = 0;
|
||||
int m_progress_h = 6;
|
||||
|
||||
wxFont m_font_version = Label::Body_16;
|
||||
wxFont m_font_action = Label::Body_16;
|
||||
@@ -2856,7 +2877,7 @@ bool GUI_App::on_init_inner()
|
||||
//BBS use BBL splashScreen
|
||||
scrn = new SplashScreen(splashscreen_pos);
|
||||
wxYield();
|
||||
scrn->SetText(_L("Loading configuration") + dots);
|
||||
scrn->SetText(_L("Loading configuration") + dots, 5);
|
||||
}
|
||||
|
||||
BOOST_LOG_TRIVIAL(info) << "loading systen presets...";
|
||||
@@ -3035,7 +3056,7 @@ bool GUI_App::on_init_inner()
|
||||
// Enable all substitutions (in both user and system profiles), but log the substitutions in user profiles only.
|
||||
// If there are substitutions in system profiles, then a "reconfigure" event shall be triggered, which will force
|
||||
// installation of a compatible system preset, thus nullifying the system preset substitutions.
|
||||
if (scrn) { scrn->SetText(_L("Loading printer & filament profiles") + dots); wxYield(); }
|
||||
if (scrn) { scrn->SetText(_L("Loading printer & filament profiles") + dots, 30); wxYield(); }
|
||||
init_params->preset_substitutions = preset_bundle->load_presets(*app_config, ForwardCompatibilitySubstitutionRule::EnableSystemSilent);
|
||||
}
|
||||
catch (const std::exception& ex) {
|
||||
@@ -3066,7 +3087,7 @@ bool GUI_App::on_init_inner()
|
||||
|
||||
if (scrn) {
|
||||
const auto scrn_txt = _L("Creating main window") + dots;
|
||||
scrn->SetText(scrn_txt);
|
||||
scrn->SetText(scrn_txt, 70);
|
||||
wxYield();
|
||||
}
|
||||
BOOST_LOG_TRIVIAL(info) << "create the main window";
|
||||
@@ -3094,7 +3115,7 @@ bool GUI_App::on_init_inner()
|
||||
plater_->set_printer_technology(ptFFF);
|
||||
}
|
||||
else {
|
||||
if (scrn) { scrn->SetText(_L("Loading current preset") + dots); wxYield(); }
|
||||
if (scrn) { scrn->SetText(_L("Loading current preset") + dots, 85); wxYield(); }
|
||||
load_current_presets();
|
||||
}
|
||||
|
||||
@@ -3108,10 +3129,10 @@ bool GUI_App::on_init_inner()
|
||||
#ifdef __WINDOWS__
|
||||
mainframe->topbar()->SaveNormalRect();
|
||||
#endif
|
||||
if (scrn) { scrn->SetText(_L("Showing main window") + dots); wxYield(); }
|
||||
if (scrn) { scrn->SetText(_L("Showing main window") + dots, 95); wxYield(); }
|
||||
mainframe->Show(true);
|
||||
// Close the splash now that the main UI is visible.
|
||||
if (scrn) { scrn->Destroy(); scrn = nullptr; }
|
||||
if (scrn) { scrn->SetText(_L("Showing main window") + dots, 100); scrn->Destroy(); scrn = nullptr; }
|
||||
BOOST_LOG_TRIVIAL(info) << "main frame firstly shown";
|
||||
|
||||
//#if BBL_HAS_FIRST_PAGE
|
||||
|
||||
@@ -2110,8 +2110,15 @@ Sidebar::Sidebar(Plater *parent)
|
||||
p->m_panel_filament_title->SetBackgroundColor(title_bg);
|
||||
p->m_panel_filament_title->SetBackgroundColor2(0xF1F1F1);
|
||||
p->m_panel_filament_title->Bind(wxEVT_LEFT_UP, [this](wxMouseEvent &e) {
|
||||
if (e.GetPosition().x > (p->m_flushing_volume_btn->IsShown()
|
||||
? p->m_flushing_volume_btn->GetPosition().x : (p->m_bpButton_add_filament->GetPosition().x - FromDIP(30)))) // ORCA exclude area of del button from titlebar collapse/expand feature to fix undesired collapse when user spams del filament button
|
||||
if (!p || !p->m_panel_filament_content || !m_scrolled_sizer || !p->m_bpButton_set_filament || !p->m_flushing_volume_btn || !p->m_bpButton_add_filament || !ams_btn)
|
||||
return;
|
||||
// ORCA exclude area of del button from titlebar collapse/expand feature to fix undesired collapse when user spams del filament button
|
||||
// also block fold/unfold feature when user clicks to spacing between icons
|
||||
int exclude_pt = p->m_bpButton_set_filament->GetPosition().x; // maximum fixed item
|
||||
if (p->m_flushing_volume_btn->IsShown()) exclude_pt = p->m_flushing_volume_btn->GetPosition().x;
|
||||
else if (p->m_bpButton_add_filament->IsShown()) exclude_pt = p->m_bpButton_add_filament->GetPosition().x - FromDIP(30); // reserve spacing for delete button
|
||||
else if (ams_btn->IsShown()) exclude_pt = ams_btn->GetPosition().x;
|
||||
if (e.GetPosition().x > exclude_pt)
|
||||
return;
|
||||
p->m_panel_filament_content->Show(!p->m_panel_filament_content->IsShown());
|
||||
m_scrolled_sizer->Layout();
|
||||
|
||||
@@ -387,7 +387,7 @@ void PresetBundleDialog::ListBundles()
|
||||
|
||||
temp["printers"] = strip_prefix(metadata.printer_presets);
|
||||
temp["filaments"] = strip_prefix(metadata.filament_presets);
|
||||
temp["presets"] = strip_prefix(metadata.print_presets);
|
||||
temp["processes"] = strip_prefix(metadata.print_presets);
|
||||
|
||||
temp["update_available"] = metadata.update_available;
|
||||
temp["unauthorized"] = metadata.unauthorized;
|
||||
|
||||
Reference in New Issue
Block a user