mirror of
				https://github.com/SoftFever/OrcaSlicer.git
				synced 2025-10-30 20:21:12 -06:00 
			
		
		
		
	NEW: add ams option when sending a printing job
Change-Id: If75b9da926c1d9a9e59f3e16b3d491a6e0bdb2e6 Signed-off-by: Stone Li <stone.li@bambulab.com>
This commit is contained in:
		
							parent
							
								
									09e0e4fcca
								
							
						
					
					
						commit
						0ed5b956ae
					
				
					 9 changed files with 299 additions and 5 deletions
				
			
		
							
								
								
									
										110
									
								
								resources/images/disable_ams_demo_icon.svg
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										110
									
								
								resources/images/disable_ams_demo_icon.svg
									
										
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							| After Width: | Height: | Size: 153 KiB | 
							
								
								
									
										4
									
								
								resources/images/enable_ams.svg
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										4
									
								
								resources/images/enable_ams.svg
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,4 @@ | |||
| <svg width="16" height="17" viewBox="0 0 16 17" fill="none" xmlns="http://www.w3.org/2000/svg"> | ||||
| <circle cx="8" cy="8.5" r="7.5" stroke="#CECECE"/> | ||||
| <path d="M8.43066 10.5674H6.90625C6.91081 10.1436 6.94727 9.78809 7.01562 9.50098C7.08398 9.20931 7.19792 8.94499 7.35742 8.70801C7.52148 8.47103 7.73796 8.22038 8.00684 7.95605C8.21647 7.75553 8.4056 7.56641 8.57422 7.38867C8.74284 7.20638 8.87728 7.01497 8.97754 6.81445C9.0778 6.60938 9.12793 6.37467 9.12793 6.11035C9.12793 5.82324 9.08008 5.57943 8.98438 5.37891C8.88867 5.17839 8.7474 5.02572 8.56055 4.9209C8.37826 4.81608 8.15039 4.76367 7.87695 4.76367C7.64909 4.76367 7.4349 4.80924 7.23438 4.90039C7.03385 4.98698 6.87207 5.1237 6.74902 5.31055C6.62598 5.49284 6.5599 5.73438 6.55078 6.03516H4.90332C4.91243 5.46094 5.04915 4.97786 5.31348 4.58594C5.5778 4.19401 5.93327 3.90007 6.37988 3.7041C6.8265 3.50814 7.32552 3.41016 7.87695 3.41016C8.48763 3.41016 9.00944 3.51497 9.44238 3.72461C9.87533 3.92969 10.2057 4.23047 10.4336 4.62695C10.666 5.01888 10.7822 5.49284 10.7822 6.04883C10.7822 6.44987 10.7025 6.81445 10.543 7.14258C10.3835 7.46615 10.1761 7.76921 9.9209 8.05176C9.66569 8.32975 9.38997 8.60775 9.09375 8.88574C8.83854 9.11816 8.66536 9.37109 8.57422 9.64453C8.48307 9.91341 8.43522 10.221 8.43066 10.5674ZM6.76953 12.7002C6.76953 12.4541 6.85384 12.2467 7.02246 12.0781C7.19108 11.9049 7.42122 11.8184 7.71289 11.8184C8.00456 11.8184 8.2347 11.9049 8.40332 12.0781C8.57194 12.2467 8.65625 12.4541 8.65625 12.7002C8.65625 12.9463 8.57194 13.1559 8.40332 13.3291C8.2347 13.4977 8.00456 13.582 7.71289 13.582C7.42122 13.582 7.19108 13.4977 7.02246 13.3291C6.85384 13.1559 6.76953 12.9463 6.76953 12.7002Z" fill="#00AE42"/> | ||||
| </svg> | ||||
| After Width: | Height: | Size: 1.7 KiB | 
|  | @ -514,4 +514,101 @@ void MappingItem::doRender(wxDC &dc) | |||
|     }  | ||||
| } | ||||
| 
 | ||||
| AmsMapingTipPopup::AmsMapingTipPopup(wxWindow *parent)  | ||||
|     :wxPopupTransientWindow(parent, wxBORDER_NONE) | ||||
| { | ||||
|     SetBackgroundColour(*wxWHITE); | ||||
|     wxBoxSizer *m_sizer_main = new wxBoxSizer(wxVERTICAL); | ||||
| 
 | ||||
|     m_sizer_main->Add(0, 0, 1, wxTOP, FromDIP(28)); | ||||
| 
 | ||||
|     wxBoxSizer *m_sizer_body = new wxBoxSizer(wxHORIZONTAL); | ||||
| 
 | ||||
|     m_sizer_body->Add(0, 0, 0, wxEXPAND | wxLEFT, FromDIP(20)); | ||||
| 
 | ||||
|     m_panel_enable_ams = new wxPanel(this, wxID_ANY, wxDefaultPosition, wxSize(200, -1), wxTAB_TRAVERSAL); | ||||
|     m_panel_enable_ams->SetBackgroundColour(*wxWHITE); | ||||
|     wxBoxSizer *sizer_enable_ams = new wxBoxSizer(wxVERTICAL); | ||||
| 
 | ||||
|     m_title_enable_ams = new wxStaticText(m_panel_enable_ams, wxID_ANY, _L("Enable AMS"), wxDefaultPosition, wxDefaultSize, 0); | ||||
|     m_title_enable_ams->SetBackgroundColour(*wxWHITE); | ||||
|     m_title_enable_ams->Wrap(-1); | ||||
|     sizer_enable_ams->Add(m_title_enable_ams, 0, 0, 0); | ||||
| 
 | ||||
|     m_tip_enable_ams = new wxStaticText(m_panel_enable_ams, wxID_ANY, _L("Print with filaments in the AMS"), wxDefaultPosition, wxDefaultSize, 0); | ||||
|     m_tip_enable_ams->SetBackgroundColour(*wxWHITE); | ||||
|     m_tip_enable_ams->Wrap(-1); | ||||
|     sizer_enable_ams->Add(m_tip_enable_ams, 0, wxTOP, 8); | ||||
| 
 | ||||
|     wxBoxSizer *sizer_enable_ams_img; | ||||
|     sizer_enable_ams_img = new wxBoxSizer(wxVERTICAL); | ||||
| 
 | ||||
|     auto img_enable_ams = new wxStaticBitmap(m_panel_enable_ams, wxID_ANY, create_scaled_bitmap("monitor_upgrade_ams", this, 108), wxDefaultPosition, | ||||
|                                              wxSize(FromDIP(118), FromDIP(108)), 0); | ||||
|     sizer_enable_ams_img->Add(img_enable_ams, 0, wxALIGN_CENTER_HORIZONTAL, 0); | ||||
| 
 | ||||
|     sizer_enable_ams->Add(sizer_enable_ams_img, 1, wxEXPAND | wxTOP, FromDIP(20)); | ||||
| 
 | ||||
|     m_panel_enable_ams->SetSizer(sizer_enable_ams); | ||||
|     m_panel_enable_ams->Layout(); | ||||
|     m_sizer_body->Add(m_panel_enable_ams, 0, 0, 0); | ||||
| 
 | ||||
|     m_split_lines = new wxPanel(this, wxID_ANY, wxDefaultPosition, wxSize(1, FromDIP(150)), wxTAB_TRAVERSAL); | ||||
|     m_split_lines->SetBackgroundColour(wxColour(238, 238, 238)); | ||||
| 
 | ||||
|     m_sizer_body->Add(m_split_lines, 0, wxALIGN_CENTER_VERTICAL | wxLEFT | wxRIGHT, FromDIP(10)); | ||||
| 
 | ||||
|     m_panel_disable_ams = new wxPanel(this, wxID_ANY, wxDefaultPosition, wxSize(200, -1), wxTAB_TRAVERSAL); | ||||
|     m_panel_disable_ams->SetBackgroundColour(*wxWHITE); | ||||
|     wxBoxSizer *sizer_disable_ams; | ||||
|     sizer_disable_ams = new wxBoxSizer(wxVERTICAL); | ||||
| 
 | ||||
|     m_title_disable_ams = new wxStaticText(m_panel_disable_ams, wxID_ANY, _L("Disable AMS"), wxDefaultPosition, wxDefaultSize, 0); | ||||
|     m_title_disable_ams->SetBackgroundColour(*wxWHITE); | ||||
|     m_title_disable_ams->Wrap(-1); | ||||
|     sizer_disable_ams->Add(m_title_disable_ams, 0, 0, 0); | ||||
| 
 | ||||
|     m_tip_disable_ams = new wxStaticText(m_panel_disable_ams, wxID_ANY, _L("Print with the filament mounted on the back of chassis"), wxDefaultPosition, wxDefaultSize, 0); | ||||
|     m_tip_disable_ams->SetBackgroundColour(*wxWHITE); | ||||
|     m_tip_disable_ams->Wrap(-1); | ||||
|     sizer_disable_ams->Add(m_tip_disable_ams, 0, wxTOP, FromDIP(8)); | ||||
| 
 | ||||
|     wxBoxSizer *sizer_disable_ams_img; | ||||
|     sizer_disable_ams_img = new wxBoxSizer(wxVERTICAL); | ||||
| 
 | ||||
|     auto img_disable_ams = new wxStaticBitmap(m_panel_disable_ams, wxID_ANY, create_scaled_bitmap("disable_ams_demo_icon", this, 95), wxDefaultPosition, | ||||
|                                               wxSize(FromDIP(95), FromDIP(109)), 0); | ||||
|     sizer_disable_ams_img->Add(img_disable_ams, 0, wxALIGN_CENTER_HORIZONTAL, 0); | ||||
| 
 | ||||
|     sizer_disable_ams->Add(sizer_disable_ams_img, 1, wxEXPAND | wxTOP, FromDIP(20)); | ||||
| 
 | ||||
|     m_panel_disable_ams->SetSizer(sizer_disable_ams); | ||||
|     m_panel_disable_ams->Layout(); | ||||
|     m_sizer_body->Add(m_panel_disable_ams, 0, 0, 0); | ||||
| 
 | ||||
|     m_sizer_body->Add(0, 0, 0, wxEXPAND | wxRIGHT, FromDIP(20)); | ||||
| 
 | ||||
|     m_sizer_main->Add(m_sizer_body, 0, wxEXPAND, 0); | ||||
| 
 | ||||
|     m_sizer_main->Add(0, 0, 0, wxEXPAND | wxTOP, FromDIP(28)); | ||||
| 
 | ||||
|     this->SetSizer(m_sizer_main); | ||||
|     this->Layout(); | ||||
|     this->Fit(); | ||||
|     Bind(wxEVT_PAINT, &AmsMapingTipPopup::paintEvent, this); | ||||
| } | ||||
| 
 | ||||
| void AmsMapingTipPopup::paintEvent(wxPaintEvent &evt) | ||||
| { | ||||
|     wxPaintDC dc(this); | ||||
|     dc.SetPen(wxColour(0xAC, 0xAC, 0xAC)); | ||||
|     dc.SetBrush(*wxTRANSPARENT_BRUSH); | ||||
|     dc.DrawRoundedRectangle(0, 0, GetSize().x, GetSize().y, 0); | ||||
| } | ||||
| 
 | ||||
| void AmsMapingTipPopup::OnDismiss() {} | ||||
| 
 | ||||
| bool AmsMapingTipPopup::ProcessLeftDown(wxMouseEvent &event) {  | ||||
|     return wxPopupTransientWindow::ProcessLeftDown(event); } | ||||
| 
 | ||||
| }} // namespace Slic3r::GUI
 | ||||
|  |  | |||
|  | @ -137,6 +137,27 @@ public: | |||
|     void paintEvent(wxPaintEvent &evt); | ||||
| }; | ||||
| 
 | ||||
| class AmsMapingTipPopup : public wxPopupTransientWindow | ||||
| { | ||||
| public: | ||||
|     AmsMapingTipPopup(wxWindow *parent); | ||||
|     ~AmsMapingTipPopup(){}; | ||||
|     void paintEvent(wxPaintEvent &evt); | ||||
| 
 | ||||
|     virtual void OnDismiss() wxOVERRIDE; | ||||
|     virtual bool ProcessLeftDown(wxMouseEvent &event) wxOVERRIDE; | ||||
| 
 | ||||
| public: | ||||
|     wxPanel *        m_panel_enable_ams; | ||||
|     wxStaticText *   m_title_enable_ams; | ||||
|     wxStaticText *   m_tip_enable_ams; | ||||
|     wxPanel *        m_split_lines; | ||||
|     wxPanel *        m_panel_disable_ams; | ||||
|     wxStaticText *   m_title_disable_ams; | ||||
|     wxStaticText *   m_tip_disable_ams; | ||||
| }; | ||||
| 
 | ||||
| 
 | ||||
| wxDECLARE_EVENT(EVT_SET_FINISH_MAPPING, wxCommandEvent); | ||||
| 
 | ||||
| }} // namespace Slic3r::GUI
 | ||||
|  |  | |||
|  | @ -152,6 +152,7 @@ void PrintJob::process() | |||
|     params.task_record_timelapse= this->task_record_timelapse; | ||||
|     params.ams_mapping          = this->task_ams_mapping; | ||||
|     params.connection_type      = this->connection_type; | ||||
|     params.task_use_ams         = this->task_use_ams; | ||||
| 
 | ||||
|     // local print access
 | ||||
|     params.dev_ip = m_dev_ip; | ||||
|  |  | |||
|  | @ -50,6 +50,7 @@ public: | |||
|     std::string connection_type; | ||||
|     bool        cloud_print_only { false }; | ||||
|     bool        has_sdcard { false }; | ||||
|     bool        task_use_ams { true }; | ||||
| 
 | ||||
|     void set_print_config(std::string bed_type, bool bed_leveling, bool flow_cali, bool vabration_cali, bool record_timelapse, bool layer_inspect)  | ||||
|     { | ||||
|  |  | |||
|  | @ -822,6 +822,7 @@ SelectMachineDialog::SelectMachineDialog(Plater *plater) | |||
|     : DPIDialog(static_cast<wxWindow *>(wxGetApp().mainframe), wxID_ANY, _L("Send print job to"), wxDefaultPosition, wxDefaultSize, wxCAPTION | wxCLOSE_BOX) | ||||
|     , m_plater(plater), m_export_3mf_cancel(false) | ||||
|     , m_mapping_popup(AmsMapingPopup(this)) | ||||
|     , m_mapping_tip_popup(AmsMapingTipPopup(this)) | ||||
| { | ||||
| #ifdef __WINDOWS__ | ||||
|     SetDoubleBuffered(true); | ||||
|  | @ -928,13 +929,15 @@ SelectMachineDialog::SelectMachineDialog(Plater *plater) | |||
|     m_sizer_select = new wxGridSizer(1, 2, 0, 0); | ||||
|     select_bed     = create_item_checkbox(_L("Bed Leveling"), this, _L("Bed Leveling"), "bed_leveling"); | ||||
|     select_flow    = create_item_checkbox(_L("Flow Calibration"), this, _L("Flow Calibration"), "flow_cali"); | ||||
| 
 | ||||
| 
 | ||||
|     select_bed->Show(true); | ||||
|     select_flow->Show(true); | ||||
|     select_use_ams = create_ams_checkbox(_L("Enable AMS"), this, _L("Enable AMS")); | ||||
| 
 | ||||
|     m_sizer_select->Add(select_bed); | ||||
|     m_sizer_select->Add(select_flow); | ||||
|     m_sizer_select->Add(select_use_ams); | ||||
| 
 | ||||
|     select_bed->Show(true); | ||||
|     select_flow->Show(true); | ||||
|     select_use_ams->Show(true); | ||||
| 
 | ||||
|     // line schedule
 | ||||
|     m_line_schedule = new wxPanel(this, wxID_ANY, wxDefaultPosition, wxSize(-1, 1)); | ||||
|  | @ -1046,6 +1049,52 @@ SelectMachineDialog::SelectMachineDialog(Plater *plater) | |||
|     Centre(wxBOTH); | ||||
| } | ||||
| 
 | ||||
| wxWindow *SelectMachineDialog::create_ams_checkbox(wxString title, wxWindow *parent, wxString tooltip) | ||||
| { | ||||
|     auto checkbox = new wxWindow(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL); | ||||
|     checkbox->SetBackgroundColour(m_colour_def_color); | ||||
| 
 | ||||
|     wxBoxSizer *sizer_checkbox = new wxBoxSizer(wxHORIZONTAL); | ||||
|     wxBoxSizer *sizer_check    = new wxBoxSizer(wxVERTICAL); | ||||
| 
 | ||||
|     ams_check = new ::CheckBox(checkbox); | ||||
| 
 | ||||
|     sizer_check->Add(ams_check, 0, wxBOTTOM | wxEXPAND | wxTOP, FromDIP(5)); | ||||
| 
 | ||||
|     sizer_checkbox->Add(sizer_check, 0, wxEXPAND, FromDIP(5)); | ||||
|     sizer_checkbox->Add(0, 0, 0, wxEXPAND | wxLEFT, FromDIP(11)); | ||||
| 
 | ||||
|     auto text = new wxStaticText(checkbox, wxID_ANY, title, wxDefaultPosition, wxDefaultSize, 0); | ||||
|     text->SetFont(::Label::Body_13); | ||||
|     text->SetForegroundColour(wxColour(107, 107, 107)); | ||||
|     text->Wrap(-1); | ||||
|     sizer_checkbox->Add(text, 0, wxALIGN_CENTER, FromDIP(5)); | ||||
| 
 | ||||
|     auto img_ams_tip = new wxStaticBitmap(checkbox, wxID_ANY, create_scaled_bitmap("enable_ams", this, 16), wxDefaultPosition, wxSize(FromDIP(16), FromDIP(16)), 0); | ||||
|     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) { | ||||
|         wxPoint pos = img_ams_tip->ClientToScreen(wxPoint(0, 0)); | ||||
|         pos.y += img_ams_tip->GetRect().height; | ||||
|         m_mapping_tip_popup.Position(pos, wxSize(0, 0)); | ||||
|         m_mapping_tip_popup.Popup(); | ||||
|     }); | ||||
| 
 | ||||
|     img_ams_tip->Bind(wxEVT_LEAVE_WINDOW, [this, img_ams_tip](auto &e) { | ||||
|         m_mapping_tip_popup.Dismiss(); | ||||
|     }); | ||||
| 
 | ||||
|     checkbox->SetSizer(sizer_checkbox); | ||||
|     checkbox->Layout(); | ||||
|     sizer_checkbox->Fit(checkbox); | ||||
| 
 | ||||
|     checkbox->SetToolTip(tooltip); | ||||
|     text->SetToolTip(tooltip); | ||||
| 
 | ||||
|     text->Bind(wxEVT_LEFT_DOWN, [this](wxMouseEvent &) { ams_check->SetValue(ams_check->GetValue() ? false : true); }); | ||||
|     return checkbox; | ||||
| } | ||||
| 
 | ||||
| wxWindow *SelectMachineDialog::create_item_checkbox(wxString title, wxWindow *parent, wxString tooltip, std::string param) | ||||
| { | ||||
|     auto checkbox = new wxWindow(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL); | ||||
|  | @ -1614,6 +1663,12 @@ void SelectMachineDialog::on_ok(wxCommandEvent &event) | |||
|         false, | ||||
|         true); | ||||
| 
 | ||||
|     if (obj_->has_ams()) { | ||||
|         m_print_job->task_use_ams = ams_check->GetValue(); | ||||
|     } else { | ||||
|         m_print_job->task_use_ams = false; | ||||
|     } | ||||
| 
 | ||||
|     m_print_job->on_success([this]() { finish_mode(); }); | ||||
| 
 | ||||
|     wxCommandEvent evt(m_plater->get_print_finished_event()); | ||||
|  | @ -2067,6 +2122,7 @@ void SelectMachineDialog::set_default() | |||
|     // checkbox default values
 | ||||
|     m_checkbox_list["bed_leveling"]->SetValue(true); | ||||
|     m_checkbox_list["flow_cali"]->SetValue(true); | ||||
|     ams_check->SetValue(true); | ||||
| 
 | ||||
|     // thumbmail
 | ||||
|     //wxBitmap bitmap;
 | ||||
|  |  | |||
|  | @ -319,6 +319,8 @@ protected: | |||
| 
 | ||||
|     wxWindow *select_bed{nullptr}; | ||||
|     wxWindow *select_flow{nullptr}; | ||||
|     wxWindow *select_use_ams{nullptr}; | ||||
|     CheckBox *ams_check{nullptr}; | ||||
| 
 | ||||
| 
 | ||||
|     void stripWhiteSpace(std::string& str); | ||||
|  | @ -329,6 +331,7 @@ protected: | |||
| 
 | ||||
| public: | ||||
|     SelectMachineDialog(Plater *plater = nullptr); | ||||
|     wxWindow *create_ams_checkbox(wxString title, wxWindow *parent, wxString tooltip); | ||||
|     ~SelectMachineDialog(); | ||||
| 
 | ||||
|     wxWindow *create_item_checkbox(wxString title, wxWindow *parent, wxString tooltip, std::string param); | ||||
|  | @ -361,6 +364,7 @@ protected: | |||
|     wxPanel *                    m_panel_status{nullptr}; | ||||
|     wxButton *                   m_button_cancel{nullptr}; | ||||
|     AmsMapingPopup               m_mapping_popup{nullptr}; | ||||
|     AmsMapingTipPopup            m_mapping_tip_popup{nullptr}; | ||||
| 
 | ||||
|     std::string                  m_print_info; | ||||
|     int                          timeout_count = 0; | ||||
|  |  | |||
|  | @ -1472,7 +1472,7 @@ AMSControl::AMSControl(wxWindow *parent, wxWindowID id, const wxPoint &pos, cons | |||
|     m_button_ams_setting->SetBackgroundColor(btn_bg_white); | ||||
|     m_button_ams_setting->SetBorderColor(btn_bd_white); | ||||
|     m_button_ams_setting->SetFont(Label::Body_13); | ||||
|     m_button_ams_setting->Hide(); | ||||
|     //m_button_ams_setting->Hide();
 | ||||
|     m_sizer_right_bottom->Add(m_button_ams_setting, 0, wxTOP, FromDIP(20)); | ||||
|     m_sizer_right->Add(m_sizer_right_bottom, 0, wxEXPAND, FromDIP(5)); | ||||
|     m_sizer_bottom->Add(m_sizer_right, 0, wxEXPAND, FromDIP(5)); | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Stone Li
						Stone Li