mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-02 06:30:38 +08:00
Fixed an update of Searcher on UI recreation.
Bug was caused by fa86a3d0, when instance of searcher was moved to GuiApp and as result wasn't recreate on UI recreation. Searcher instance is in MainFrame now.
This commit is contained in:
parent
c857ae8db5
commit
8c2f6d7b7d
@ -1099,7 +1099,7 @@ void GUI_App::check_and_update_searcher(ConfigOptionMode mode /*= comExpert*/)
|
|||||||
if (tab->supports_printer_technology(print_tech))
|
if (tab->supports_printer_technology(print_tech))
|
||||||
search_inputs.emplace_back(Search::InputInfo{ tab->get_config(), tab->type() });
|
search_inputs.emplace_back(Search::InputInfo{ tab->get_config(), tab->type() });
|
||||||
|
|
||||||
m_searcher.check_and_update(print_tech, mode, search_inputs);
|
m_searcher->check_and_update(print_tech, mode, search_inputs);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GUI_App::jump_to_option(const std::string& opt_key, Preset::Type type, const std::wstring& category)
|
void GUI_App::jump_to_option(const std::string& opt_key, Preset::Type type, const std::wstring& category)
|
||||||
@ -1109,7 +1109,7 @@ void GUI_App::jump_to_option(const std::string& opt_key, Preset::Type type, cons
|
|||||||
|
|
||||||
void GUI_App::jump_to_option(size_t selected)
|
void GUI_App::jump_to_option(size_t selected)
|
||||||
{
|
{
|
||||||
const Search::Option& opt = m_searcher.get_option(selected);
|
const Search::Option& opt = m_searcher->get_option(selected);
|
||||||
if (opt.type == Preset::TYPE_PREFERENCES)
|
if (opt.type == Preset::TYPE_PREFERENCES)
|
||||||
open_preferences(opt.opt_key(), into_u8(opt.group));
|
open_preferences(opt.opt_key(), into_u8(opt.group));
|
||||||
else
|
else
|
||||||
@ -1128,12 +1128,12 @@ void GUI_App::jump_to_option(const std::string& composite_key)
|
|||||||
|
|
||||||
// Regularly searcher is sorted in respect to the options labels,
|
// Regularly searcher is sorted in respect to the options labels,
|
||||||
// so resort searcher before get an option
|
// so resort searcher before get an option
|
||||||
m_searcher.sort_options_by_key();
|
m_searcher->sort_options_by_key();
|
||||||
const Search::Option& opt = m_searcher.get_option(opt_key, tab->type());
|
const Search::Option& opt = m_searcher->get_option(opt_key, tab->type());
|
||||||
tab->activate_option(opt_key, into_u8(opt.category));
|
tab->activate_option(opt_key, into_u8(opt.category));
|
||||||
|
|
||||||
// Revert sort of searcher back
|
// Revert sort of searcher back
|
||||||
m_searcher.sort_options_by_label();
|
m_searcher->sort_options_by_label();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1142,7 +1142,7 @@ void GUI_App::jump_to_option(const std::string& composite_key)
|
|||||||
void GUI_App::show_search_dialog()
|
void GUI_App::show_search_dialog()
|
||||||
{
|
{
|
||||||
check_and_update_searcher(get_mode());
|
check_and_update_searcher(get_mode());
|
||||||
m_searcher.show_dialog();
|
m_searcher->show_dialog();
|
||||||
}
|
}
|
||||||
|
|
||||||
static int get_app_font_pt_size(const AppConfig* app_config)
|
static int get_app_font_pt_size(const AppConfig* app_config)
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
#include "ConfigWizard.hpp"
|
#include "ConfigWizard.hpp"
|
||||||
#include "OpenGLManager.hpp"
|
#include "OpenGLManager.hpp"
|
||||||
#include "libslic3r/Preset.hpp"
|
#include "libslic3r/Preset.hpp"
|
||||||
#include "Search.hpp"
|
#include "I18N.hpp"
|
||||||
|
|
||||||
#include <wx/app.h>
|
#include <wx/app.h>
|
||||||
#include <wx/colour.h>
|
#include <wx/colour.h>
|
||||||
@ -40,6 +40,10 @@ class PrintHostJobQueue;
|
|||||||
class Model;
|
class Model;
|
||||||
class AppUpdater;
|
class AppUpdater;
|
||||||
|
|
||||||
|
namespace Search {
|
||||||
|
class OptionsSearcher;
|
||||||
|
}
|
||||||
|
|
||||||
namespace GUI{
|
namespace GUI{
|
||||||
|
|
||||||
class RemovableDriveManager;
|
class RemovableDriveManager;
|
||||||
@ -176,7 +180,7 @@ private:
|
|||||||
std::string m_instance_hash_string;
|
std::string m_instance_hash_string;
|
||||||
size_t m_instance_hash_int;
|
size_t m_instance_hash_int;
|
||||||
|
|
||||||
Search::OptionsSearcher m_searcher;
|
Search::OptionsSearcher* m_searcher{ nullptr };
|
||||||
|
|
||||||
public:
|
public:
|
||||||
bool OnInit() override;
|
bool OnInit() override;
|
||||||
@ -191,7 +195,8 @@ public:
|
|||||||
bool is_recreating_gui() const { return m_is_recreating_gui; }
|
bool is_recreating_gui() const { return m_is_recreating_gui; }
|
||||||
std::string logo_name() const { return is_editor() ? "PrusaSlicer" : "PrusaSlicer-gcodeviewer"; }
|
std::string logo_name() const { return is_editor() ? "PrusaSlicer" : "PrusaSlicer-gcodeviewer"; }
|
||||||
|
|
||||||
Search::OptionsSearcher& searcher() noexcept { return m_searcher; }
|
Search::OptionsSearcher& searcher() noexcept { return *m_searcher; }
|
||||||
|
void set_searcher(Search::OptionsSearcher* searcher) { m_searcher = searcher; }
|
||||||
void check_and_update_searcher(ConfigOptionMode mode = comExpert);
|
void check_and_update_searcher(ConfigOptionMode mode = comExpert);
|
||||||
void jump_to_option(size_t selected);
|
void jump_to_option(size_t selected);
|
||||||
void jump_to_option(const std::string& opt_key, Preset::Type type, const std::wstring& category);
|
void jump_to_option(const std::string& opt_key, Preset::Type type, const std::wstring& category);
|
||||||
|
@ -166,6 +166,8 @@ DPIFrame(NULL, wxID_ANY, "", wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_S
|
|||||||
// Load the icon either from the exe, or from the ico file.
|
// Load the icon either from the exe, or from the ico file.
|
||||||
SetIcon(main_frame_icon(wxGetApp().get_app_mode()));
|
SetIcon(main_frame_icon(wxGetApp().get_app_mode()));
|
||||||
|
|
||||||
|
wxGetApp().set_searcher(&m_searcher);
|
||||||
|
|
||||||
// initialize tabpanel and menubar
|
// initialize tabpanel and menubar
|
||||||
init_tabpanel();
|
init_tabpanel();
|
||||||
if (wxGetApp().is_gcode_viewer())
|
if (wxGetApp().is_gcode_viewer())
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
#include "GUI_Utils.hpp"
|
#include "GUI_Utils.hpp"
|
||||||
#include "Event.hpp"
|
#include "Event.hpp"
|
||||||
#include "UnsavedChangesDialog.hpp"
|
#include "UnsavedChangesDialog.hpp"
|
||||||
|
#include "Search.hpp"
|
||||||
|
|
||||||
class wxBookCtrlBase;
|
class wxBookCtrlBase;
|
||||||
class wxProgressDialog;
|
class wxProgressDialog;
|
||||||
@ -93,6 +94,7 @@ class MainFrame : public DPIFrame
|
|||||||
wxSizer* m_main_sizer{ nullptr };
|
wxSizer* m_main_sizer{ nullptr };
|
||||||
|
|
||||||
size_t m_last_selected_tab;
|
size_t m_last_selected_tab;
|
||||||
|
Search::OptionsSearcher m_searcher;
|
||||||
|
|
||||||
std::string get_base_name(const wxString &full_name, const char *extension = nullptr) const;
|
std::string get_base_name(const wxString &full_name, const char *extension = nullptr) const;
|
||||||
std::string get_dir_name(const wxString &full_name) const;
|
std::string get_dir_name(const wxString &full_name) const;
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
#include "OG_CustomCtrl.hpp"
|
#include "OG_CustomCtrl.hpp"
|
||||||
#include "GLCanvas3D.hpp"
|
#include "GLCanvas3D.hpp"
|
||||||
#include "ConfigWizard.hpp"
|
#include "ConfigWizard.hpp"
|
||||||
|
#include "Search.hpp"
|
||||||
|
|
||||||
#include "Widgets/SpinInput.hpp"
|
#include "Widgets/SpinInput.hpp"
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user