ENH:synced some N1 codes

jira:[sync]

Change-Id: I94aed7f068e76cb28459ec77448c89f922134414
This commit is contained in:
tao wang 2023-09-14 14:28:39 +08:00 committed by Lane.Wei
parent 95a235ee8a
commit b048992715
8 changed files with 47 additions and 26 deletions

View file

@ -192,8 +192,8 @@ void AMSSetting::create()
wxPanel* m_panel_img = new wxPanel(m_panel_body, wxID_ANY, wxDefaultPosition, wxDefaultSize); wxPanel* m_panel_img = new wxPanel(m_panel_body, wxID_ANY, wxDefaultPosition, wxDefaultSize);
m_panel_img->SetBackgroundColour(AMS_SETTING_GREY200); m_panel_img->SetBackgroundColour(AMS_SETTING_GREY200);
wxBoxSizer *m_sizer_img = new wxBoxSizer(wxVERTICAL); wxBoxSizer *m_sizer_img = new wxBoxSizer(wxVERTICAL);
auto img = new wxStaticBitmap(m_panel_img, wxID_ANY, create_scaled_bitmap("ams_icon", nullptr, 126), wxDefaultPosition, wxDefaultSize); ams_img = new wxStaticBitmap(m_panel_img, wxID_ANY, create_scaled_bitmap("ams_icon", nullptr, 126), wxDefaultPosition, wxDefaultSize);
m_sizer_img->Add(img, 0, wxALIGN_CENTER | wxTOP, 26); m_sizer_img->Add(ams_img, 0, wxALIGN_CENTER | wxTOP, 26);
m_sizer_img->Add(0, 0, 0, wxTOP, 18); m_sizer_img->Add(0, 0, 0, wxTOP, 18);
m_panel_img->SetSizer(m_sizer_img); m_panel_img->SetSizer(m_sizer_img);
m_panel_img->Layout(); m_panel_img->Layout();
@ -262,6 +262,19 @@ void AMSSetting::update_insert_material_read_mode(bool selected)
Fit(); Fit();
} }
void AMSSetting::update_image(std::string ams_type)
{
if (ams_type == m_current_ams_type) return;
if (ams_type == "generic") {
ams_img->SetBitmap(create_scaled_bitmap("monitor_upgrade_f1", nullptr, 126));
}
else {
ams_img->SetBitmap(create_scaled_bitmap("ams_icon", nullptr, 126));
}
m_current_ams_type = ams_type;
Layout();
}
void AMSSetting::update_starting_read_mode(bool selected) void AMSSetting::update_starting_read_mode(bool selected)
{ {
m_checkbox_starting_auto_read->SetValue(selected); m_checkbox_starting_auto_read->SetValue(selected);

View file

@ -28,6 +28,7 @@ public:
void create(); void create();
void update_insert_material_read_mode(bool selected); void update_insert_material_read_mode(bool selected);
void update_image(std::string ams_type);
void update_starting_read_mode(bool selected); void update_starting_read_mode(bool selected);
void update_remain_mode(bool selected); void update_remain_mode(bool selected);
void update_switch_filament(bool selected); void update_switch_filament(bool selected);
@ -46,6 +47,7 @@ protected:
void on_dpi_changed(const wxRect &suggested_rect) override; void on_dpi_changed(const wxRect &suggested_rect) override;
protected: protected:
std::string m_current_ams_type;
wxPanel * m_panel_body; wxPanel * m_panel_body;
CheckBox * m_checkbox_Insert_material_auto_read; CheckBox * m_checkbox_Insert_material_auto_read;
wxStaticText *m_title_Insert_material_auto_read; wxStaticText *m_title_Insert_material_auto_read;
@ -68,7 +70,7 @@ protected:
wxStaticText *m_tip_ams_img; wxStaticText *m_tip_ams_img;
Button * m_button_auto_demarcate; Button * m_button_auto_demarcate;
wxStaticBitmap* ams_img;
wxBoxSizer *m_sizer_Insert_material_tip_inline; wxBoxSizer *m_sizer_Insert_material_tip_inline;
wxBoxSizer *m_sizer_starting_tip_inline; wxBoxSizer *m_sizer_starting_tip_inline;
wxBoxSizer *m_sizer_remain_inline; wxBoxSizer *m_sizer_remain_inline;

View file

@ -1551,6 +1551,7 @@ void MachineObject::parse_version_func()
is_support_tunnel_mqtt = true; is_support_tunnel_mqtt = true;
is_support_ams_humidity = false; is_support_ams_humidity = false;
is_support_1080dpi = true; is_support_1080dpi = true;
ams_support_remain = false;
} }
} }

View file

@ -310,6 +310,9 @@ std::map<std::string, std::vector<json>> ProjectPanel::Reload(wxString aux_path)
pfile_obj["filename"] = wxGetApp().url_encode(file_path_obj.filename().string().c_str()); pfile_obj["filename"] = wxGetApp().url_encode(file_path_obj.filename().string().c_str());
pfile_obj["size"] = formatBytes((unsigned long)filelen); pfile_obj["size"] = formatBytes((unsigned long)filelen);
std::string file_extension = file_path_obj.extension().string();
boost::algorithm::to_lower(file_extension);
//image //image
if (file_extension == ".jpg" || if (file_extension == ".jpg" ||
file_extension == ".jpeg" || file_extension == ".jpeg" ||

View file

@ -1543,10 +1543,10 @@ wxWindow *SelectMachineDialog::create_ams_checkbox(wxString title, wxWindow *par
sizer_checkbox->Add(text, 0, wxALIGN_CENTER, 0); sizer_checkbox->Add(text, 0, wxALIGN_CENTER, 0);
enable_ams = new ScalableBitmap(this, "enable_ams", 16); enable_ams = new ScalableBitmap(this, "enable_ams", 16);
auto img_ams_tip = new wxStaticBitmap(checkbox, wxID_ANY, enable_ams->bmp(), wxDefaultPosition, wxSize(FromDIP(16), FromDIP(16)), 0); img_ams_tip = new wxStaticBitmap(checkbox, wxID_ANY, enable_ams->bmp(), wxDefaultPosition, wxSize(FromDIP(16), FromDIP(16)), 0);
sizer_checkbox->Add(img_ams_tip, 0, wxALIGN_CENTER | wxLEFT, FromDIP(5)); sizer_checkbox->Add(img_ams_tip, 0, wxALIGN_CENTER | wxLEFT, FromDIP(5));
img_ams_tip->Bind(wxEVT_ENTER_WINDOW, [this, img_ams_tip](auto& e) { img_ams_tip->Bind(wxEVT_ENTER_WINDOW, [this](auto& e) {
wxPoint img_pos = img_ams_tip->ClientToScreen(wxPoint(0, 0)); wxPoint img_pos = img_ams_tip->ClientToScreen(wxPoint(0, 0));
wxPoint popup_pos(img_pos.x, img_pos.y + img_ams_tip->GetRect().height); wxPoint popup_pos(img_pos.x, img_pos.y + img_ams_tip->GetRect().height);
m_mapping_tip_popup.Position(popup_pos, wxSize(0, 0)); m_mapping_tip_popup.Position(popup_pos, wxSize(0, 0));
@ -1563,7 +1563,6 @@ wxWindow *SelectMachineDialog::create_ams_checkbox(wxString title, wxWindow *par
img_ams_tip->Bind(wxEVT_LEAVE_WINDOW, [this](wxMouseEvent& e) { img_ams_tip->Bind(wxEVT_LEAVE_WINDOW, [this](wxMouseEvent& e) {
m_mapping_tip_popup.Dismiss(); m_mapping_tip_popup.Dismiss();
}); });
ams_tip = img_ams_tip;
checkbox->SetSizer(sizer_checkbox); checkbox->SetSizer(sizer_checkbox);
checkbox->Layout(); checkbox->Layout();
@ -1683,7 +1682,7 @@ void SelectMachineDialog::update_select_layout(MachineObject *obj)
Fit(); Fit();
} }
void SelectMachineDialog::prepare_mode() void SelectMachineDialog::prepare_mode(bool refresh_button)
{ {
// disable combobox // disable combobox
m_comboBox_printer->Enable(); m_comboBox_printer->Enable();
@ -1698,7 +1697,9 @@ void SelectMachineDialog::prepare_mode()
if (wxIsBusy()) if (wxIsBusy())
wxEndBusyCursor(); wxEndBusyCursor();
Enable_Send_Button(true); if (refresh_button) {
Enable_Send_Button(true);
}
m_status_bar->reset(); m_status_bar->reset();
if (m_simplebook->GetSelection() != 0) { if (m_simplebook->GetSelection() != 0) {
@ -2016,12 +2017,6 @@ void SelectMachineDialog::show_status(PrintDialogStatus status, std::vector<wxSt
else else
m_comboBox_printer->Enable(); m_comboBox_printer->Enable();
// m_panel_warn m_simplebook
if (status == PrintDialogStatus::PrintStatusSending) {
sending_mode();
} else {
prepare_mode();
}
// other // other
if (status == PrintDialogStatus::PrintStatusInit) { if (status == PrintDialogStatus::PrintStatusInit) {
@ -2164,6 +2159,14 @@ void SelectMachineDialog::show_status(PrintDialogStatus status, std::vector<wxSt
Enable_Send_Button(false); Enable_Send_Button(false);
Enable_Refresh_Button(true); Enable_Refresh_Button(true);
} }
// m_panel_warn m_simplebook
if (status == PrintDialogStatus::PrintStatusSending) {
sending_mode();
}
else {
prepare_mode(false);
}
} }
void SelectMachineDialog::init_timer() void SelectMachineDialog::init_timer()
@ -2947,7 +2950,6 @@ void SelectMachineDialog::on_timer(wxTimerEvent &event)
if (!obj_ if (!obj_
|| obj_->amsList.empty() || obj_->amsList.empty()
|| obj_->ams_exist_bits == 0 || obj_->ams_exist_bits == 0
|| !obj_->m_is_support_show_bak
|| !obj_->ams_support_auto_switch_filament_flag || !obj_->ams_support_auto_switch_filament_flag
|| !obj_->ams_auto_switch_filament_flag || !obj_->ams_auto_switch_filament_flag
|| !obj_->is_function_supported(PrinterFunction::FUNC_FILAMENT_BACKUP) || !obj_->is_function_supported(PrinterFunction::FUNC_FILAMENT_BACKUP)
@ -3036,6 +3038,8 @@ void SelectMachineDialog::update_ams_check(MachineObject* obj)
&& obj->ams_support_use_ams && obj->ams_support_use_ams
&& obj->has_ams()) { && obj->has_ams()) {
select_use_ams->Show(); select_use_ams->Show();
if (obj->printer_type == "N1") {img_ams_tip->Hide();}
else {img_ams_tip->Show();}
} else { } else {
select_use_ams->Hide(); select_use_ams->Hide();
} }
@ -3350,7 +3354,7 @@ void SelectMachineDialog::on_dpi_changed(const wxRect &suggested_rect)
enable_ams_mapping->msw_rescale(); enable_ams_mapping->msw_rescale();
amsmapping_tip->SetBitmap(enable_ams_mapping->bmp()); amsmapping_tip->SetBitmap(enable_ams_mapping->bmp());
enable_ams->msw_rescale(); enable_ams->msw_rescale();
ams_tip->SetBitmap(enable_ams->bmp()); img_ams_tip->SetBitmap(enable_ams->bmp());
m_button_refresh->SetMinSize(SELECT_MACHINE_DIALOG_BUTTON_SIZE); m_button_refresh->SetMinSize(SELECT_MACHINE_DIALOG_BUTTON_SIZE);
m_button_refresh->SetCornerRadius(FromDIP(12)); m_button_refresh->SetCornerRadius(FromDIP(12));

View file

@ -385,7 +385,7 @@ protected:
ScalableBitmap * print_weight{nullptr}; ScalableBitmap * print_weight{nullptr};
wxStaticBitmap * amsmapping_tip{nullptr}; wxStaticBitmap * amsmapping_tip{nullptr};
ScalableBitmap * enable_ams_mapping{nullptr}; ScalableBitmap * enable_ams_mapping{nullptr};
wxStaticBitmap * ams_tip{nullptr}; wxStaticBitmap * img_ams_tip{nullptr};
wxStaticBitmap * img_ams_backup{nullptr}; wxStaticBitmap * img_ams_backup{nullptr};
ScalableBitmap * enable_ams{nullptr}; ScalableBitmap * enable_ams{nullptr};
@ -400,7 +400,7 @@ public:
void check_fcous_state(wxWindow* window); void check_fcous_state(wxWindow* window);
void popup_filament_backup(); void popup_filament_backup();
void update_select_layout(MachineObject *obj); void update_select_layout(MachineObject *obj);
void prepare_mode(); void prepare_mode(bool refresh_button = true);
void sending_mode(); void sending_mode();
void finish_mode(); void finish_mode();
void sync_ams_mapping_result(std::vector<FilamentInfo>& result); void sync_ams_mapping_result(std::vector<FilamentInfo>& result);

View file

@ -2383,7 +2383,7 @@ void StatusPanel::update_ams(MachineObject *obj)
show_ams_group(true); show_ams_group(true);
if (!obj->m_is_support_show_bak || !is_support_filament_backup || !obj->ams_support_auto_switch_filament_flag) { if (!is_support_filament_backup || !obj->ams_support_auto_switch_filament_flag) {
m_ams_control->show_auto_refill(false); m_ams_control->show_auto_refill(false);
} }
else { else {
@ -3240,6 +3240,7 @@ void StatusPanel::on_ams_setting_click(SimpleEvent &event)
if (obj) { if (obj) {
m_ams_setting_dlg->update_insert_material_read_mode(obj->ams_insert_flag); m_ams_setting_dlg->update_insert_material_read_mode(obj->ams_insert_flag);
m_ams_setting_dlg->update_starting_read_mode(obj->ams_power_on_flag); m_ams_setting_dlg->update_starting_read_mode(obj->ams_power_on_flag);
m_ams_setting_dlg->update_image(obj->printer_type == "N1"?"generic":"f1");
std::string ams_id = m_ams_control->GetCurentShowAms(); std::string ams_id = m_ams_control->GetCurentShowAms();
if (obj->amsList.size() == 0) { if (obj->amsList.size() == 0) {
/* wxString txt = _L("AMS settings are not supported for external spool"); /* wxString txt = _L("AMS settings are not supported for external spool");

View file

@ -2832,13 +2832,10 @@ void AMSControl::EnterNoneAMSMode(bool support_vt_load)
m_extruder->no_ams_mode(true); m_extruder->no_ams_mode(true);
m_button_ams_setting->Hide(); m_button_ams_setting->Hide();
m_button_guide->Hide(); m_button_guide->Hide();
if (support_vt_load) {
m_button_extruder_feed->Show(); m_button_extruder_feed->Show();
m_button_extruder_back->Show(); m_button_extruder_back->Show();
} else {
m_button_extruder_feed->Hide();
m_button_extruder_back->Hide();
}
ShowFilamentTip(false); ShowFilamentTip(false);
m_amswin->Layout(); m_amswin->Layout();