mirror of
				https://github.com/SoftFever/OrcaSlicer.git
				synced 2025-11-02 20:51:23 -07:00 
			
		
		
		
	FIX: [STUDIO-3329] show/hide thirdparty calibrate button
Change-Id: Ie5a7cd454b50617af8c8bf9c78fecc60386e4e9d (cherry picked from commit 1a98981f8b0a854f431d9430355b4fc5d2bb4fb1)
This commit is contained in:
		
							parent
							
								
									1b0cd88899
								
							
						
					
					
						commit
						2a24eb55b8
					
				
					 5 changed files with 38 additions and 10 deletions
				
			
		| 
						 | 
				
			
			@ -382,6 +382,15 @@ void BBLTopbar::SaveNormalRect()
 | 
			
		|||
    m_normalRect = m_frame->GetRect();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void BBLTopbar::ShowCalibrationButton(bool show)
 | 
			
		||||
{
 | 
			
		||||
    m_calib_item->GetSizerItem()->Show(show);
 | 
			
		||||
    m_sizer->Layout();
 | 
			
		||||
    if (!show)
 | 
			
		||||
        m_calib_item->GetSizerItem()->SetDimension({-1000, 0}, {0, 0});
 | 
			
		||||
    Refresh();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void BBLTopbar::OnModelStoreClicked(wxAuiToolBarEvent& event)
 | 
			
		||||
{
 | 
			
		||||
    //GUI::wxGetApp().load_url(wxString(wxGetApp().app_config->get_web_host_url() + MODEL_STORE_URL));
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -54,6 +54,8 @@ public:
 | 
			
		|||
 | 
			
		||||
    void SaveNormalRect();
 | 
			
		||||
 | 
			
		||||
    void ShowCalibrationButton(bool show = true);
 | 
			
		||||
 | 
			
		||||
private:
 | 
			
		||||
    wxFrame* m_frame;
 | 
			
		||||
    wxAuiToolBarItem* m_file_menu_item;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -868,6 +868,18 @@ void MainFrame::show_publish_button(bool show)
 | 
			
		|||
    Layout();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void MainFrame::show_calibration_button(bool show)
 | 
			
		||||
{
 | 
			
		||||
#ifdef __APPLE__
 | 
			
		||||
    bool shown = m_menubar->FindMenu(_L("Calibration"));
 | 
			
		||||
    if (shown == show) return;
 | 
			
		||||
    if (show) m_menubar->Insert(3, m_calib_menu, wxString::Format("&%s", _L("Calibration")));
 | 
			
		||||
    else m_menubar->Remove(3);
 | 
			
		||||
#else
 | 
			
		||||
    topbar()->ShowCalibrationButton(show);
 | 
			
		||||
#endif
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void MainFrame::update_title_colour_after_set_title()
 | 
			
		||||
{
 | 
			
		||||
#ifdef __APPLE__
 | 
			
		||||
| 
						 | 
				
			
			@ -2753,11 +2765,11 @@ void MainFrame::init_menubar_as_editor()
 | 
			
		|||
    //    m_menubar->Append(publishMenu, wxString::Format("&%s", _L("3D Models")));
 | 
			
		||||
 | 
			
		||||
        // SoftFever calibrations
 | 
			
		||||
    auto calib_menu = new wxMenu();
 | 
			
		||||
    m_calib_menu = new wxMenu();
 | 
			
		||||
 | 
			
		||||
    // Temp
 | 
			
		||||
    append_menu_item(
 | 
			
		||||
        calib_menu, wxID_ANY, _L("Temperature"), _L("Temperature"),
 | 
			
		||||
        m_calib_menu, wxID_ANY, _L("Temperature"), _L("Temperature"),
 | 
			
		||||
        [this](wxCommandEvent &) {
 | 
			
		||||
            if (!m_temp_calib_dlg)
 | 
			
		||||
                m_temp_calib_dlg = new Temp_Calibration_Dlg((wxWindow *) this, wxID_ANY, m_plater);
 | 
			
		||||
| 
						 | 
				
			
			@ -2794,14 +2806,14 @@ void MainFrame::init_menubar_as_editor()
 | 
			
		|||
            ;
 | 
			
		||||
        },
 | 
			
		||||
        this);
 | 
			
		||||
    append_submenu(calib_menu, flowrate_menu, wxID_ANY, _L("Flow rate"), _L("Flow rate"), "", [this]() {
 | 
			
		||||
    append_submenu(m_calib_menu, flowrate_menu, wxID_ANY, _L("Flow rate"), _L("Flow rate"), "", [this]() {
 | 
			
		||||
        return m_plater->is_view3D_shown();
 | 
			
		||||
        ;
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    // PA
 | 
			
		||||
    append_menu_item(
 | 
			
		||||
        calib_menu, wxID_ANY, _L("Pressure advance"), _L("Pressure advance"),
 | 
			
		||||
        m_calib_menu, wxID_ANY, _L("Pressure advance"), _L("Pressure advance"),
 | 
			
		||||
        [this](wxCommandEvent &) {
 | 
			
		||||
            m_pa_calib_dlg = new PA_Calibration_Dlg((wxWindow *) this, wxID_ANY, m_plater);
 | 
			
		||||
            m_pa_calib_dlg->ShowModal();
 | 
			
		||||
| 
						 | 
				
			
			@ -2815,7 +2827,7 @@ void MainFrame::init_menubar_as_editor()
 | 
			
		|||
 | 
			
		||||
    // Retraction
 | 
			
		||||
    append_menu_item(
 | 
			
		||||
        calib_menu, wxID_ANY, _L("Retraction test"), _L("Retraction test"),
 | 
			
		||||
        m_calib_menu, wxID_ANY, _L("Retraction test"), _L("Retraction test"),
 | 
			
		||||
        [this](wxCommandEvent &) {
 | 
			
		||||
            if (!m_retraction_calib_dlg) m_retraction_calib_dlg = new Retraction_Test_Dlg((wxWindow *) this, wxID_ANY, m_plater);
 | 
			
		||||
            m_retraction_calib_dlg->ShowModal();
 | 
			
		||||
| 
						 | 
				
			
			@ -2829,7 +2841,7 @@ void MainFrame::init_menubar_as_editor()
 | 
			
		|||
 | 
			
		||||
    // Tolerance Test
 | 
			
		||||
    append_menu_item(
 | 
			
		||||
        calib_menu, wxID_ANY, _L("Orca Tolerance Test"), _L("Orca Tolerance Test"),
 | 
			
		||||
        m_calib_menu, wxID_ANY, _L("Orca Tolerance Test"), _L("Orca Tolerance Test"),
 | 
			
		||||
        [this](wxCommandEvent &) {
 | 
			
		||||
            m_plater->new_project();
 | 
			
		||||
            m_plater->add_model(false, Slic3r::resources_dir() + "/calib/tolerance_test/OrcaToleranceTest.stl");
 | 
			
		||||
| 
						 | 
				
			
			@ -2868,13 +2880,13 @@ void MainFrame::init_menubar_as_editor()
 | 
			
		|||
        },
 | 
			
		||||
        this);
 | 
			
		||||
 | 
			
		||||
    append_submenu(calib_menu, advance_menu, wxID_ANY, _L("More..."), _L("More calibrations"), "", [this]() {
 | 
			
		||||
    append_submenu(m_calib_menu, advance_menu, wxID_ANY, _L("More..."), _L("More calibrations"), "", [this]() {
 | 
			
		||||
        return m_plater->is_view3D_shown();
 | 
			
		||||
        ;
 | 
			
		||||
    });
 | 
			
		||||
    // help
 | 
			
		||||
    append_menu_item(
 | 
			
		||||
        calib_menu, wxID_ANY, _L("Tutorial"), _L("Calibration help"),
 | 
			
		||||
        m_calib_menu, wxID_ANY, _L("Tutorial"), _L("Calibration help"),
 | 
			
		||||
        [this](wxCommandEvent &) { wxLaunchDefaultBrowser("https://github.com/SoftFever/OrcaSlicer/wiki/Calibration", wxBROWSER_NEW_WINDOW); }, "", nullptr,
 | 
			
		||||
        [this]() {
 | 
			
		||||
            return m_plater->is_view3D_shown();
 | 
			
		||||
| 
						 | 
				
			
			@ -2882,8 +2894,6 @@ void MainFrame::init_menubar_as_editor()
 | 
			
		|||
        },
 | 
			
		||||
        this);
 | 
			
		||||
 | 
			
		||||
    m_menubar->Append(calib_menu, wxString::Format("&%s", _L("Calibration")));
 | 
			
		||||
 | 
			
		||||
    if (helpMenu)
 | 
			
		||||
        m_menubar->Append(helpMenu, wxString::Format("&%s", _L("Help")));
 | 
			
		||||
    SetMenuBar(m_menubar);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -95,6 +95,7 @@ class MainFrame : public DPIFrame
 | 
			
		|||
 | 
			
		||||
    wxMenuBar*  m_menubar{ nullptr };
 | 
			
		||||
    //wxMenu* publishMenu{ nullptr };
 | 
			
		||||
    wxMenu *    m_calib_menu{nullptr};
 | 
			
		||||
 | 
			
		||||
#if 0
 | 
			
		||||
    wxMenuItem* m_menu_item_repeat { nullptr }; // doesn't used now
 | 
			
		||||
| 
						 | 
				
			
			@ -250,6 +251,7 @@ public:
 | 
			
		|||
    void        set_max_recent_count(int max);
 | 
			
		||||
 | 
			
		||||
    void        show_publish_button(bool show);
 | 
			
		||||
    void        show_calibration_button(bool show);
 | 
			
		||||
 | 
			
		||||
	void        update_title_colour_after_set_title();
 | 
			
		||||
    void        show_option(bool show);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -2408,6 +2408,8 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame)
 | 
			
		|||
        // Preset change event
 | 
			
		||||
        sidebar->Bind(wxEVT_COMBOBOX, &priv::on_combobox_select, this);
 | 
			
		||||
        sidebar->Bind(EVT_OBJ_LIST_OBJECT_SELECT, [this](wxEvent&) { priv::selection_changed(); });
 | 
			
		||||
        bool isBBL = wxGetApp().preset_bundle->printers.get_edited_preset().is_bbl_vendor_preset(wxGetApp().preset_bundle);
 | 
			
		||||
        main_frame->show_calibration_button(!isBBL);
 | 
			
		||||
        // BBS: should bind BACKGROUND_PROCESS event to plater
 | 
			
		||||
        q->Bind(EVT_SCHEDULE_BACKGROUND_PROCESS, [this](SimpleEvent&) { this->schedule_background_process(); });
 | 
			
		||||
        // jump to found option from SearchDialog
 | 
			
		||||
| 
						 | 
				
			
			@ -5726,6 +5728,9 @@ void Plater::priv::on_select_preset(wxCommandEvent &evt)
 | 
			
		|||
        //wxWindowUpdateLocker noUpdates1(sidebar->print_panel());
 | 
			
		||||
        wxWindowUpdateLocker noUpdates2(sidebar->filament_panel());
 | 
			
		||||
        wxGetApp().get_tab(preset_type)->select_preset(preset_name);
 | 
			
		||||
 | 
			
		||||
        bool isBBL = wxGetApp().preset_bundle->printers.get_edited_preset().is_bbl_vendor_preset(wxGetApp().preset_bundle);
 | 
			
		||||
        main_frame->show_calibration_button(!isBBL);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // update plater with new config
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue