mirror of
				https://github.com/SoftFever/OrcaSlicer.git
				synced 2025-10-30 20:21:12 -06:00 
			
		
		
		
	Merge branch 'master' of https://github.com/prusa3d/Slic3r into et_multivolume_models
This commit is contained in:
		
						commit
						7121a1177a
					
				
					 6 changed files with 87 additions and 8 deletions
				
			
		|  | @ -65,9 +65,9 @@ PrinterPicker::PrinterPicker(wxWindow *parent, const VendorProfile &vendor, wxSt | |||
| 
 | ||||
|     auto *sizer = new wxBoxSizer(wxVERTICAL); | ||||
| 
 | ||||
|     const auto font_title = GetFont().MakeBold().Scaled(1.3); | ||||
|     const auto font_title = GetFont().MakeBold().Scaled(1.3f); | ||||
|     const auto font_name = GetFont().MakeBold(); | ||||
|     const auto font_alt_nozzle = GetFont().Scaled(0.9); | ||||
|     const auto font_alt_nozzle = GetFont().Scaled(0.9f); | ||||
| 
 | ||||
|     // wxGrid appends widgets by rows, but we need to construct them in columns.
 | ||||
|     // These vectors are used to hold the elements so that they can be appended in the right order.
 | ||||
|  | @ -789,7 +789,7 @@ void ConfigWizardIndex::on_mouse_move(wxMouseEvent &evt) | |||
| 
 | ||||
|     const ssize_t item_hover_new = pos.y / item_height(); | ||||
| 
 | ||||
|     if (item_hover_new < items.size() && item_hover_new != item_hover) { | ||||
| 	if (item_hover_new < ssize_t(items.size()) && item_hover_new != item_hover) { | ||||
|         item_hover = item_hover_new; | ||||
|         Refresh(); | ||||
|     } | ||||
|  |  | |||
|  | @ -105,6 +105,11 @@ wxFrame(NULL, wxID_ANY, SLIC3R_BUILD, wxDefaultPosition, wxDefaultSize, wxDEFAUL | |||
|         event.Skip(); | ||||
|     }); | ||||
| 
 | ||||
|     Bind(wxEVT_ACTIVATE, [this](wxActivateEvent& event) { | ||||
|         if (m_plater != nullptr && event.GetActive()) | ||||
|             m_plater->on_activate(); | ||||
|     }); | ||||
| 
 | ||||
|     wxGetApp().persist_window_geometry(this); | ||||
| 
 | ||||
|     update_ui_from_settings();    // FIXME (?)
 | ||||
|  |  | |||
|  | @ -968,6 +968,7 @@ struct Plater::priv | |||
|     std::atomic<bool>           arranging; | ||||
|     std::atomic<bool>           rotoptimizing; | ||||
|     bool                        delayed_scene_refresh; | ||||
|     std::string                 delayed_error_message; | ||||
| 
 | ||||
|     wxTimer                     background_process_timer; | ||||
| 
 | ||||
|  | @ -1966,6 +1967,8 @@ unsigned int Plater::priv::update_background_process(bool force_validation) | |||
|     this->background_process_timer.Stop(); | ||||
|     // Update the "out of print bed" state of ModelInstances.
 | ||||
|     this->update_print_volume_state(); | ||||
|     // The delayed error message is no more valid.
 | ||||
|     this->delayed_error_message.clear(); | ||||
|     // Apply new config to the possibly running background task.
 | ||||
|     bool               was_running = this->background_process.running(); | ||||
|     Print::ApplyStatus invalidated = this->background_process.apply(this->q->model(), wxGetApp().preset_bundle->full_config()); | ||||
|  | @ -2004,8 +2007,18 @@ unsigned int Plater::priv::update_background_process(bool force_validation) | |||
|                 return_state |= UPDATE_BACKGROUND_PROCESS_RESTART; | ||||
|         } else { | ||||
|             // The print is not valid.
 | ||||
|             // The error returned from the Print needs to be translated into the local language.
 | ||||
|             GUI::show_error(this->q, _(err)); | ||||
|             // Only show the error message immediately, if the top level parent of this window is active.
 | ||||
|             auto p = dynamic_cast<wxWindow*>(this->q); | ||||
|             while (p->GetParent()) | ||||
|                 p = p->GetParent(); | ||||
|             auto *top_level_wnd = dynamic_cast<wxTopLevelWindow*>(p); | ||||
|             if (top_level_wnd && top_level_wnd->IsActive()) { | ||||
|                 // The error returned from the Print needs to be translated into the local language.
 | ||||
|                 GUI::show_error(this->q, _(err)); | ||||
|             } else { | ||||
|                 // Show the error message once the main window gets activated.
 | ||||
|                 this->delayed_error_message = _(err); | ||||
|             } | ||||
|             return_state |= UPDATE_BACKGROUND_PROCESS_INVALID; | ||||
|         } | ||||
|     } | ||||
|  | @ -3116,6 +3129,24 @@ void Plater::on_config_change(const DynamicPrintConfig &config) | |||
|         this->p->schedule_background_process(); | ||||
| } | ||||
| 
 | ||||
| void Plater::on_activate() | ||||
| { | ||||
|     wxWindow *focus_window = wxWindow::FindFocus(); | ||||
|     if (focus_window == nullptr) { | ||||
| 		// Activating the main frame, and no window has keyboard focus.
 | ||||
| 		// Set the keyboard focus to the visible Canvas3D.
 | ||||
|         if (this->p->view3D->IsShown()) | ||||
| 			this->p->view3D->get_wxglcanvas()->SetFocus(); | ||||
| 		else if (this->p->preview->IsShown()) | ||||
| 			this->p->preview->get_wxglcanvas()->SetFocus(); | ||||
|     } | ||||
|     if (! this->p->delayed_error_message.empty()) { | ||||
| 		std::string msg = std::move(this->p->delayed_error_message); | ||||
| 		this->p->delayed_error_message.clear(); | ||||
|         GUI::show_error(this, msg); | ||||
| 	} | ||||
| } | ||||
| 
 | ||||
| const wxString& Plater::get_project_filename() const | ||||
| { | ||||
|     return p->project_filename; | ||||
|  |  | |||
|  | @ -156,6 +156,8 @@ public: | |||
| 
 | ||||
|     void on_extruders_change(int extruders_count); | ||||
|     void on_config_change(const DynamicPrintConfig &config); | ||||
|     // On activating the parent window.
 | ||||
|     void on_activate(); | ||||
| 
 | ||||
|     void update_object_menu(); | ||||
| 
 | ||||
|  |  | |||
|  | @ -15,6 +15,7 @@ | |||
| 
 | ||||
| #include "GUI.hpp" | ||||
| #include "GUI_App.hpp" | ||||
| #include "AppConfig.hpp" | ||||
| #include "MsgDialog.hpp" | ||||
| #include "I18N.hpp" | ||||
| #include "../Utils/PrintHost.hpp" | ||||
|  | @ -24,10 +25,12 @@ namespace fs = boost::filesystem; | |||
| namespace Slic3r { | ||||
| namespace GUI { | ||||
| 
 | ||||
| static const char *CONFIG_KEY_PATH  = "printhost_path"; | ||||
| static const char *CONFIG_KEY_PRINT = "printhost_print"; | ||||
| 
 | ||||
| PrintHostSendDialog::PrintHostSendDialog(const fs::path &path) | ||||
|     : MsgDialog(nullptr, _(L("Send G-Code to printer host")), _(L("Upload to Printer Host with the following filename:")), wxID_NONE) | ||||
|     , txt_filename(new wxTextCtrl(this, wxID_ANY, path.filename().wstring())) | ||||
|     , txt_filename(new wxTextCtrl(this, wxID_ANY)) | ||||
|     , box_print(new wxCheckBox(this, wxID_ANY, _(L("Start printing after upload")))) | ||||
| { | ||||
| #ifdef __APPLE__ | ||||
|  | @ -44,11 +47,30 @@ PrintHostSendDialog::PrintHostSendDialog(const fs::path &path) | |||
| 
 | ||||
|     btn_sizer->Add(CreateStdDialogButtonSizer(wxOK | wxCANCEL)); | ||||
| 
 | ||||
|     txt_filename->SetFocus(); | ||||
|     const AppConfig *app_config = wxGetApp().app_config; | ||||
|     box_print->SetValue(app_config->get("recent", CONFIG_KEY_PRINT) == "1"); | ||||
| 
 | ||||
|     wxString recent_path = from_u8(app_config->get("recent", CONFIG_KEY_PATH)); | ||||
|     if (recent_path.Length() > 0 && recent_path[recent_path.Length() - 1] != '/') { | ||||
|         recent_path += '/'; | ||||
|     } | ||||
|     const auto recent_path_len = recent_path.Length(); | ||||
|     recent_path += path.filename().wstring(); | ||||
|     wxString stem(path.stem().wstring()); | ||||
|     txt_filename->SetSelection(0, stem.Length()); | ||||
|     const auto stem_len = stem.Length(); | ||||
| 
 | ||||
|     txt_filename->SetValue(recent_path); | ||||
|     txt_filename->SetFocus(); | ||||
| 
 | ||||
|     Fit(); | ||||
| 
 | ||||
|     Bind(wxEVT_SHOW, [=](const wxShowEvent &) { | ||||
|         // Another similar case where the function only works with EVT_SHOW + CallAfter,
 | ||||
|         // this time on Mac.
 | ||||
|         CallAfter([=]() { | ||||
|             txt_filename->SetSelection(recent_path_len, recent_path_len + stem_len); | ||||
|         }); | ||||
|     }); | ||||
| } | ||||
| 
 | ||||
| fs::path PrintHostSendDialog::filename() const | ||||
|  | @ -61,6 +83,24 @@ bool PrintHostSendDialog::start_print() const | |||
|     return box_print->GetValue(); | ||||
| } | ||||
| 
 | ||||
| void PrintHostSendDialog::EndModal(int ret) | ||||
| { | ||||
|     if (ret == wxID_OK) { | ||||
|         // Persist path and print settings
 | ||||
|         wxString path = txt_filename->GetValue(); | ||||
|         int last_slash = path.Find('/', true); | ||||
|         if (last_slash != wxNOT_FOUND) { | ||||
|             path = path.SubString(0, last_slash); | ||||
|             wxGetApp().app_config->set("recent", CONFIG_KEY_PATH, into_u8(path)); | ||||
|         } | ||||
| 
 | ||||
|         bool print = box_print->GetValue(); | ||||
|         GUI::get_app_config()->set("recent", CONFIG_KEY_PRINT, print ? "1" : "0"); | ||||
|     } | ||||
| 
 | ||||
|     MsgDialog::EndModal(ret); | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| wxDEFINE_EVENT(EVT_PRINTHOST_PROGRESS, PrintHostQueueDialog::Event); | ||||
|  |  | |||
|  | @ -33,6 +33,7 @@ public: | |||
|     boost::filesystem::path filename() const; | ||||
|     bool start_print() const; | ||||
| 
 | ||||
|     virtual void EndModal(int ret) override; | ||||
| private: | ||||
|     wxTextCtrl *txt_filename; | ||||
|     wxCheckBox *box_print; | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Enrico Turri
						Enrico Turri