refactor: centralize printer compatibility checks

This commit is contained in:
peachismomo
2026-09-23 03:06:15 +08:00
parent 99a1cd1b74
commit c492436228
11 changed files with 30 additions and 87 deletions
+1 -14
View File
@@ -3,7 +3,6 @@
#include "GUI_App.hpp"
#include "MainFrame.hpp"
#include "DeviceCore/DevConfigUtil.h"
namespace Slic3r {
namespace GUI {
@@ -52,7 +51,7 @@ void DeviceItem::sync_state()
state_printable = 6;
}
if (is_blocking_printing(obj_)) {
if (wxGetApp().is_blocking_printing(obj_)) {
state_printable = 5;
}
@@ -105,18 +104,6 @@ void DeviceItem::unselected()
}
}
bool DeviceItem::is_blocking_printing(MachineObject* obj_)
{
DeviceManager* dev = Slic3r::GUI::wxGetApp().getDeviceManager();
if (!dev) return true;
std::string source_model = "";
PresetBundle* preset_bundle = wxGetApp().preset_bundle;
source_model = preset_bundle->printers.get_edited_preset().get_printer_type(preset_bundle);
return !DevPrinterConfigUtil::is_printer_model_compatible(source_model, *obj_);
}
void DeviceItem::update_item(const DeviceItem* item)
{
// Except for the selected status, everything else is updated