mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-05-17 02:22:17 +00:00
FIX: update the extruder image in status panel
jira: [STUDIO-10732] Change-Id: I5437c4ef1538f0022f97c7ef7fb40ec2242328ed (cherry picked from commit f5c49c89a80e508a442440218b068446d1e9e797)
This commit is contained in:
@@ -615,10 +615,17 @@ bool MachineObject::get_printer_is_enclosed() const
|
||||
return DeviceManager::get_printer_is_enclosed(printer_type);
|
||||
}
|
||||
|
||||
bool MachineObject::is_series_n() const { return DeviceManager::get_printer_series(printer_type) == "series_n"; };
|
||||
bool MachineObject::is_series_p() const { return DeviceManager::get_printer_series(printer_type) == "series_p1p"; };
|
||||
bool MachineObject::is_series_x() const { return DeviceManager::get_printer_series(printer_type) == "series_x1"; };
|
||||
bool MachineObject::is_series_o() const { return DeviceManager::get_printer_series(printer_type) == "series_o"; };
|
||||
bool MachineObject::is_series_n(const std::string& series_str) { return series_str == "series_n"; }
|
||||
bool MachineObject::is_series_p(const std::string& series_str) { return series_str == "series_p1p";}
|
||||
bool MachineObject::is_series_x(const std::string& series_str) { return series_str == "series_x1"; }
|
||||
bool MachineObject::is_series_o(const std::string& series_str) { return series_str == "series_o"; }
|
||||
|
||||
bool MachineObject::is_series_n() const { return is_series_n(DeviceManager::get_printer_series(printer_type)); }
|
||||
bool MachineObject::is_series_p() const { return is_series_p(DeviceManager::get_printer_series(printer_type)); }
|
||||
bool MachineObject::is_series_x() const { return is_series_x(DeviceManager::get_printer_series(printer_type)); }
|
||||
bool MachineObject::is_series_o() const { return is_series_o(DeviceManager::get_printer_series(printer_type)); }
|
||||
|
||||
std::string MachineObject::get_printer_series_str() const{ return DeviceManager::get_printer_series(printer_type);};
|
||||
|
||||
void MachineObject::reload_printer_settings()
|
||||
{
|
||||
|
||||
@@ -632,11 +632,18 @@ public:
|
||||
bool get_printer_is_enclosed() const;
|
||||
|
||||
// check printer device series
|
||||
static bool is_series_n(const std::string& series_str);
|
||||
static bool is_series_p(const std::string& series_str);
|
||||
static bool is_series_x(const std::string& series_str);
|
||||
static bool is_series_o(const std::string& series_str);
|
||||
|
||||
bool is_series_n() const;
|
||||
bool is_series_p() const;
|
||||
bool is_series_x() const;
|
||||
bool is_series_o() const;
|
||||
|
||||
std::string get_printer_series_str() const;
|
||||
|
||||
void reload_printer_settings();
|
||||
|
||||
std::string printer_thumbnail_img;
|
||||
|
||||
@@ -3251,7 +3251,7 @@ void StatusPanel::update_ams(MachineObject *obj)
|
||||
ExtderData data = obj->m_extder_data;
|
||||
|
||||
// must select a current can
|
||||
m_ams_control->UpdateAms(ams_info, ext_info, data, dev_id, false);
|
||||
m_ams_control->UpdateAms(obj->get_printer_series_str(), ams_info, ext_info, data, dev_id, false);
|
||||
|
||||
last_tray_exist_bits = obj->tray_exist_bits;
|
||||
last_ams_exist_bits = obj->ams_exist_bits;
|
||||
|
||||
@@ -913,7 +913,7 @@ std::vector<AMSinfo> AMSControl::GenerateSimulateData() {
|
||||
}
|
||||
|
||||
|
||||
void AMSControl::UpdateAms(std::vector<AMSinfo> ams_info, std::vector<AMSinfo>ext_info, ExtderData data, std::string dev_id, bool is_reset, bool test)
|
||||
void AMSControl::UpdateAms(const std::string& series_name, std::vector<AMSinfo> ams_info, std::vector<AMSinfo>ext_info, ExtderData data, std::string dev_id, bool is_reset, bool test)
|
||||
{
|
||||
if (!test){
|
||||
// update item
|
||||
@@ -1082,6 +1082,9 @@ void AMSControl::UpdateAms(std::vector<AMSinfo> ams_info, std::vector<AMSinfo>ex
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*update ams extruder*/
|
||||
m_extruder->updateNozzleNum(m_extder_data.total_extder_count, series_name);
|
||||
}
|
||||
|
||||
void AMSControl::AddAmsPreview(AMSinfo info, AMSModel type)
|
||||
|
||||
@@ -152,7 +152,7 @@ public:
|
||||
void CreateAmsDoubleNozzle();
|
||||
void CreateAmsSingleNozzle();
|
||||
void ClearAms();
|
||||
void UpdateAms(std::vector<AMSinfo> ams_info, std::vector<AMSinfo> ext_info, ExtderData data, std::string dev_id, bool is_reset = true, bool test = false);
|
||||
void UpdateAms(const std::string& series_name, std::vector<AMSinfo> ams_info, std::vector<AMSinfo> ext_info, ExtderData data, std::string dev_id, bool is_reset = true, bool test = false);
|
||||
std::vector<AMSinfo> GenerateSimulateData();
|
||||
|
||||
void AddAms(AMSinfo info, AMSPanelPos pos = AMSPanelPos::LEFT_PANEL);
|
||||
|
||||
@@ -766,9 +766,10 @@ void AMSextruder::OnAmsLoading(bool load, int nozzle_id, wxColour col /*= AMS_CO
|
||||
}
|
||||
}
|
||||
|
||||
void AMSextruder::updateNozzleNum(int nozzle_num)
|
||||
void AMSextruder::updateNozzleNum(int nozzle_num, const string& series_name)
|
||||
{
|
||||
if (m_nozzle_num == nozzle_num) return;
|
||||
if (m_nozzle_num == nozzle_num && m_series_name == series_name) return;
|
||||
m_series_name = series_name;
|
||||
m_nozzle_num = nozzle_num;
|
||||
this->DestroyChildren();
|
||||
|
||||
@@ -786,7 +787,19 @@ void AMSextruder::updateNozzleNum(int nozzle_num)
|
||||
}
|
||||
else
|
||||
{
|
||||
m_left_extruder = new AMSextruderImage(this, wxID_ANY, "single_nozzle", AMS_EXTRUDER_SINGLE_NOZZLE_BITMAP_SIZE);
|
||||
if (MachineObject::is_series_n(m_series_name))
|
||||
{
|
||||
m_left_extruder = new AMSextruderImage(this, wxID_ANY, "single_nozzle_n", AMS_EXTRUDER_SINGLE_NOZZLE_BITMAP_SIZE);
|
||||
}
|
||||
else if(MachineObject::is_series_x(m_series_name) || MachineObject::is_series_p(m_series_name))
|
||||
{
|
||||
m_left_extruder = new AMSextruderImage(this, wxID_ANY, "single_nozzle_xp", AMS_EXTRUDER_SINGLE_NOZZLE_BITMAP_SIZE);
|
||||
}
|
||||
else
|
||||
{
|
||||
m_left_extruder = new AMSextruderImage(this, wxID_ANY, "single_nozzle_xp", AMS_EXTRUDER_SINGLE_NOZZLE_BITMAP_SIZE);
|
||||
}
|
||||
|
||||
m_left_extruder->setShowState(true);
|
||||
m_right_extruder->setShowState(false);
|
||||
m_bitmap_sizer->Add(m_left_extruder, 0, wxALIGN_LEFT | wxALIGN_TOP, 0);
|
||||
@@ -794,6 +807,7 @@ void AMSextruder::updateNozzleNum(int nozzle_num)
|
||||
}
|
||||
|
||||
SetSizer(m_bitmap_sizer);
|
||||
Layout();
|
||||
Refresh();
|
||||
}
|
||||
|
||||
|
||||
@@ -398,7 +398,9 @@ private:
|
||||
class AMSextruder : public wxWindow
|
||||
{
|
||||
private:
|
||||
int m_nozzle_num = -1;
|
||||
int m_nozzle_num = -1;
|
||||
string m_series_name;
|
||||
|
||||
public:
|
||||
void TurnOn(wxColour col);
|
||||
void TurnOff();
|
||||
@@ -407,7 +409,7 @@ public:
|
||||
void msw_rescale();
|
||||
void has_ams(bool hams) {m_has_vams = hams; Refresh();};
|
||||
void no_ams_mode(bool mode) {m_none_ams_mode = mode; Refresh();};
|
||||
void updateNozzleNum(int nozzle_num);
|
||||
void updateNozzleNum(int nozzle_num, const std::string& series_name = string());
|
||||
|
||||
bool m_none_ams_mode{true};
|
||||
bool m_has_vams{false};
|
||||
|
||||
Reference in New Issue
Block a user