OrcaSlicer latest
OrcaSlicer
Loading...
Searching...
No Matches
Slic3r::GUI::PluginsDialog Class Reference

#include </home/runner/work/OrcaSlicer/OrcaSlicer/src/slic3r/GUI/PluginsDialog.hpp>

Inheritance diagram for Slic3r::GUI::PluginsDialog:
Collaboration diagram for Slic3r::GUI::PluginsDialog:

Public Member Functions

 PluginsDialog (wxWindow *parent, wxWindowID id=wxID_ANY, const wxString &title=wxT(""), const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxSYSTEM_MENU|wxCAPTION|wxCLOSE_BOX|wxMAXIMIZE_BOX|wxRESIZE_BORDER)
 ~PluginsDialog ()
void set_open_terminal_dlg_fn ()
void update_plugin_dialog_ui ()
bool create_webview (const std::string &resource_path, const wxString &title, const wxSize &dialog_size=wxSize(820, 660), const wxSize &min_size=wxSize(640, 640))
void load_url (const wxString &url)
bool run_script (const wxString &script)
void call_web_handler (const nlohmann::json &payload, const wxString &handler=wxT("HandleStudio"))
void EndModal (int retCode) override
float scale_factor () const
float prev_scale_factor () const
void set_scale_factor (float v)
void set_prev_scale_factor (float v)
void set_em_unit (int v)
bool force_rescale () const
int em_unit () const
const wxFont & normal_font () const
void enable_force_rescale ()
int ShowModal ()

Static Public Member Functions

static std::string document_start_injector (const std::string &markup, const char *dom_id, const char *position, const std::string &prelude={}, const std::string &on_inject={})
static std::string theme_user_script ()
static std::string element_defaults_user_script ()
static std::string theme_apply_script ()
static std::string localized_strings_script (const nlohmann::json &strings)

Protected Member Functions

wxWebView * browser () const
wxString build_resource_url (const std::string &resource_path) const
bool handle_common_script_command (const nlohmann::json &payload, int close_return_code=wxID_CANCEL)
void on_dpi_changed (const wxRect &suggested_rect) override
virtual void on_script_message_parse_error (const wxString &payload, const std::exception &error)
virtual bool append_language_to_url () const
void register_theme_user_scripts ()
virtual void add_user_scripts ()
void apply_theme_live ()
virtual void on_sys_color_changed ()

Private Member Functions

void open_plugin_on_cloud (const std::string &sharing_token)
void open_plugin_hub ()
void on_script_message (const nlohmann::json &payload) override
nlohmann::json localized_strings () const override
void handle_web_command (const nlohmann::json &payload)
void restore_z_order ()
void send_plugins ()
void set_plugin_sort (const std::string &sort_key, const std::string &sort_order)
nlohmann::json build_plugins_payload () const
bool get_descriptor (const std::string &plugin_key, Slic3r::PluginDescriptor &descriptor) const
void refresh_plugin_metadata_async (const wxString &title, const wxString &message, bool fetch_cloud)
void prompt_for_missing_plugins ()
void refresh_plugins ()
void toggle_plugin (const std::string &plugin_key, bool enabled)
void toggle_plugin_capability (const std::string &plugin_key, PluginCapabilityType type, const std::string &capability_name, bool enabled)
void handle_plugin_menu_action (const std::string &plugin_key, const std::string &action)
void install_plugin_from_file ()
bool install_plugin_package (const std::string &package_path)
bool install_cloud_plugin (const std::string &uuid, const std::string &version, const wxString &name)
void run_script_plugin_capability (const std::string &plugin_key, const std::string &capability_name)
void send_capability_config (const PluginCapabilityId &id)
void save_capability_config (const PluginCapabilityId &id, const nlohmann::json &config)
void restore_capability_config (const PluginCapabilityId &id)
void show_status (const wxString &message, const char *level)
wxString plugin_display_name (const std::string &plugin_key) const
void resolve_pending_activation ()
void update_plugin (const std::string &plugin_key)
void open_plugin_folder (const Slic3r::PluginDescriptor &plugin)
void delete_local_plugin (const Slic3r::PluginDescriptor &plugin)
void unsubscribe_cloud_plugin (const Slic3r::PluginDescriptor &plugin)
void reload_local_plugin (const std::string &plugin_key, bool clear_cache)
void reinstall_cloud_plugin (const Slic3r::PluginDescriptor &plugin)
template<typename Run, typename OnFinish>
void run_with_dialog (Run &&run, OnFinish &&on_finish, const wxString &title, const wxString &message, int maximum=100, int style=wxPD_APP_MODAL|wxPD_AUTO_HIDE, bool finish_after_dialog_destroyed=false)
template<typename Run>
std::invoke_result_t< std::decay_t< Run > & > run_with_dialog_wait (Run &&run, const wxString &title, const wxString &message, int maximum=100, int style=wxPD_APP_MODAL|wxPD_AUTO_HIDE)
void on_script_message_event (wxWebViewEvent &event)
void on_webview_recreated (wxCommandEvent &event)
void update_em_unit ()
bool is_new_scale_factor () const
void rescale (const wxRect &suggested_rect)

Private Attributes

std::function< void()> m_open_terminal_dlg_fn
std::shared_ptr< std::atomic< bool > > m_alive = std::make_shared<std::atomic<bool>>(true)
PluginSortKey m_plugin_sort_key = PluginSortKey::None
PluginSortOrder m_plugin_sort_order = PluginSortOrder::Asc
std::string m_activating_plugin_key
wxWebView * m_browser {nullptr}
float m_scale_factor
int m_em_unit
wxFont m_normal_font
float m_prev_scale_factor
bool m_can_rescale
bool m_force_rescale
int m_new_font_point_size

Detailed Description

Constructor & Destructor Documentation

◆ PluginsDialog()

Slic3r::GUI::PluginsDialog::PluginsDialog ( wxWindow * parent,
wxWindowID id = wxID_ANY,
const wxString & title = wxT(""),
const wxPoint & pos = wxDefaultPosition,
const wxSize & size = wxDefaultSize,
long style = wxSYSTEM_MENU | wxCAPTION | wxCLOSE_BOX | wxMAXIMIZE_BOX | wxRESIZE_BORDER )
587 : WebViewHostDialog(parent, id, _L("Plugins"), pos, size, style)
588{ create_webview("web/dialog/PluginsDialog/index.html", _L("Plugins"), wxSize(900, 820), wxSize(760, 715)); }
#define _L(s)
Definition OBJ.cpp:34
#define style
Definition WipeTowerDialog.cpp:101
WebViewHostDialog(wxWindow *parent, wxWindowID id=wxID_ANY, const wxString &title=wxT(""), const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxSYSTEM_MENU|wxCAPTION|wxCLOSE_BOX|wxMAXIMIZE_BOX|wxRESIZE_BORDER)
Definition WebViewHostDialog.cpp:161
bool create_webview(const std::string &resource_path, const wxString &title, const wxSize &dialog_size=wxSize(820, 660), const wxSize &min_size=wxSize(640, 640))
Definition WebViewHostDialog.cpp:172

References Slic3r::GUI::WebViewHostDialog::WebViewHostDialog(), _L, Slic3r::GUI::WebViewHostDialog::create_webview(), and style.

Here is the call graph for this function:

◆ ~PluginsDialog()

Slic3r::GUI::PluginsDialog::~PluginsDialog ( )
681{ m_alive->store(false, std::memory_order_release); }
std::shared_ptr< std::atomic< bool > > m_alive
Definition PluginsDialog.hpp:314

References m_alive.

Member Function Documentation

◆ add_user_scripts()

virtual void Slic3r::GUI::WebViewHostDialog::add_user_scripts ( )
inlineprotectedvirtualinherited

Reimplemented in Slic3r::GUI::ColorPickerDialog, and Slic3r::GUI::WebDialog.

95{}

Referenced by register_theme_user_scripts().

Here is the caller graph for this function:

◆ append_language_to_url()

virtual bool Slic3r::GUI::WebViewHostDialog::append_language_to_url ( ) const
inlineprotectedvirtualinherited

Reimplemented in Slic3r::GUI::WebDialog.

84{ return true; }

Referenced by build_resource_url().

Here is the caller graph for this function:

◆ apply_theme_live()

void Slic3r::GUI::WebViewHostDialog::apply_theme_live ( )
protectedinherited
300{
301 if (!m_browser)
302 return;
303 // Update the already-loaded document in place (no reload, no flash) by rewriting the
304 // injected :root variables + data-orca-theme; the whole cascade re-flows from these.
305 // The document-start script keeps the creation-time theme for any later reload, and
306 // these dialogs are not reloaded on a theme toggle (see WebView::RecreateAll).
307 run_script(wxString::FromUTF8(host_theme_apply_js()));
308}
bool run_script(const wxString &script)
Definition WebViewHostDialog.cpp:234
wxWebView * m_browser
Definition WebViewHostDialog.hpp:109
std::string host_theme_apply_js()
Definition WebViewHostDialog.cpp:73

References m_browser, and run_script().

Referenced by on_webview_recreated().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ browser()

◆ build_plugins_payload()

nlohmann::json Slic3r::GUI::PluginsDialog::build_plugins_payload ( ) const
private
794{
795 nlohmann::json response;
796 response["command"] = "list_plugins";
797 response["install_action"] = s_selected_plugin_install_action;
798 response["sort_key"] = to_string(m_plugin_sort_key);
799 response["sort_order"] = to_string(m_plugin_sort_order);
800 response["data"] = nlohmann::json::array();
801
802 const auto rows = PluginManager::instance().get_plugin_descriptors(/*include_invalid=*/true);
803 BOOST_LOG_TRIVIAL(info) << "Prepared " << rows.size() << " plugin rows for Plugins dialog";
804
805 std::vector<PluginDialogItem> items;
806 items.reserve(rows.size());
807
808 for (const PluginDescriptor& row : rows)
809 items.push_back(build_plugin_dialog_item(row));
810
812
813 for (const PluginDialogItem& item : items)
814 response["data"].push_back(build_plugin_payload_item(item));
815
816 return response;
817}
PluginSortKey m_plugin_sort_key
Definition PluginsDialog.hpp:315
PluginSortOrder m_plugin_sort_order
Definition PluginsDialog.hpp:316
std::vector< PluginDescriptor > get_plugin_descriptors(bool include_invalid=false) const
Definition PluginManager.cpp:488
static PluginManager & instance()
Definition PluginManager.cpp:74
std::string s_selected_plugin_install_action
Definition PluginsDialog.cpp:59
nlohmann::json build_plugin_payload_item(const PluginDialogItem &dialog_item)
Definition PluginsDialog.cpp:162
PluginDialogItem build_plugin_dialog_item(const PluginDescriptor &descriptor)
Definition PluginsDialog.cpp:294
void sort_plugin_items_for_dialog(std::vector< PluginItem > &items, PluginSortKey sort_key, PluginSortOrder sort_order)
Definition PluginSort.hpp:199
static std::string to_string(libvgcode::EMoveType type)
Definition GCodeViewer.cpp:377
size_t rows(const T &raster)
Definition MarchingSquares.hpp:171

References Slic3r::PluginManager::get_plugin_descriptors(), Slic3r::PluginManager::instance(), m_plugin_sort_key, m_plugin_sort_order, Slic3r::GUI::sort_plugin_items_for_dialog(), and Slic3r::GUI::to_string().

Referenced by send_plugins().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ build_resource_url()

wxString Slic3r::GUI::WebViewHostDialog::build_resource_url ( const std::string & resource_path) const
protectedinherited
210{
211 wxString target_url = file_url_from_path(boost::filesystem::path(resources_dir()) / resource_path);
212
214 const wxString lang = wxGetApp().current_language_code_safe();
215 if (!lang.empty()) {
216 target_url += wxT("?lang=");
217 target_url += lang;
218 }
219 }
220
221 return target_url;
222}
virtual bool append_language_to_url() const
Definition WebViewHostDialog.hpp:84
wxString file_url_from_path(const boost::filesystem::path &path)
Definition GUI.cpp:569
const std::string & resources_dir()
Definition utils.cpp:296

References append_language_to_url(), Slic3r::GUI::file_url_from_path(), and Slic3r::resources_dir().

Referenced by create_webview().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ call_web_handler()

void Slic3r::GUI::WebViewHostDialog::call_web_handler ( const nlohmann::json & payload,
const wxString & handler = wxT("HandleStudio") )
inherited
243{
244 const wxString payload_text = wxString::FromUTF8(payload.dump(-1, ' ', false, nlohmann::json::error_handler_t::ignore));
245 const wxString script = handler + wxT("(") + payload_text + wxT(")");
246
247 wxGetApp().CallAfter([this, script] { run_script(script); });
248}

References run_script().

Referenced by Slic3r::GUI::SpeedDialWebDialog::handle_web_command(), Slic3r::GUI::PresetBundleDialog::ListBundles(), Slic3r::GUI::ExportPresetBundleDialog::OnRequestPresets(), Slic3r::GUI::WebDialog::push_message(), Slic3r::GUI::TerminalDialog::resolve_and_run(), Slic3r::GUI::PluginsDialog::restore_capability_config(), Slic3r::GUI::PluginsDialog::save_capability_config(), Slic3r::GUI::SpeedDialWebDialog::search_tabs(), Slic3r::GUI::SpeedDialWebDialog::send_actions(), Slic3r::GUI::PluginsConfigDialog::send_capabilities(), Slic3r::GUI::PluginsConfigDialog::send_capability_config(), Slic3r::GUI::PluginsDialog::send_capability_config(), Slic3r::GUI::PluginsDialog::send_plugins(), Slic3r::GUI::PluginsConfigDialog::send_save_error(), Slic3r::GUI::PluginsConfigDialog::show_status(), and Slic3r::GUI::PluginsDialog::show_status().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ create_webview()

bool Slic3r::GUI::WebViewHostDialog::create_webview ( const std::string & resource_path,
const wxString & title,
const wxSize & dialog_size = wxSize(820, 660),
const wxSize & min_size = wxSize(640, 640) )
inherited
176{
177 SetTitle(title);
178 SetMinSize(FromDIP(min_size));
179
180 const wxString target_url = build_resource_url(resource_path);
181 wxBoxSizer* topsizer = new wxBoxSizer(wxVERTICAL);
182
183 // Created empty and loaded below, after the user scripts are added, so the first load already has them.
184 m_browser = WebView::CreateWebView(this, wxEmptyString);
185 if (m_browser == nullptr) {
186 wxLogError("Could not init m_browser");
187 delete topsizer;
188 return false;
189 }
190
191 SetSizer(topsizer);
192 topsizer->Add(m_browser, wxSizerFlags().Expand().Proportion(1));
193
194 SetSize(FromDIP(dialog_size));
195 CenterOnParent();
196
197 Bind(wxEVT_WEBVIEW_SCRIPT_MESSAGE_RECEIVED, &WebViewHostDialog::on_script_message_event, this, m_browser->GetId());
198
199 // Inject the shared host theme contract BEFORE the first load so the page paints in
200 // the app theme with no flash, and re-theme live when the app theme toggles.
202 m_browser->Bind(EVT_WEBVIEW_RECREATED, &WebViewHostDialog::on_webview_recreated, this);
203
204 load_url(target_url);
205 wxGetApp().UpdateDlgDarkUI(this);
206 return true;
207}
void on_webview_recreated(wxCommandEvent &event)
Definition WebViewHostDialog.cpp:310
wxString build_resource_url(const std::string &resource_path) const
Definition WebViewHostDialog.cpp:209
void register_theme_user_scripts()
Definition WebViewHostDialog.cpp:285
void on_script_message_event(wxWebViewEvent &event)
Definition WebViewHostDialog.cpp:274
void load_url(const wxString &url)
Definition WebViewHostDialog.cpp:224
static wxWebView * CreateWebView(wxWindow *parent, wxString const &url)
Definition WebView.cpp:313

References build_resource_url(), WebView::CreateWebView(), load_url(), m_browser, on_script_message_event(), on_webview_recreated(), and register_theme_user_scripts().

Referenced by Slic3r::GUI::ColorPickerDialog::ColorPickerDialog(), Slic3r::GUI::PluginsConfigDialog::PluginsConfigDialog(), Slic3r::GUI::PluginsDialog::PluginsDialog(), Slic3r::GUI::SpeedDialWebDialog::SpeedDialWebDialog(), Slic3r::GUI::TerminalDialog::TerminalDialog(), Slic3r::GUI::WebDialog::WebDialog(), Slic3r::GUI::PresetBundleDialog::create(), and Slic3r::GUI::ExportPresetBundleDialog::Init().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ delete_local_plugin()

void Slic3r::GUI::PluginsDialog::delete_local_plugin ( const Slic3r::PluginDescriptor & plugin)
private
1292{
1293 const wxString plugin_name = from_u8(plugin.name);
1294 const int rc = wxMessageBox(
1295 wxString::Format(plugin.is_cloud_plugin() ?
1296 _L("Delete plugin \"%s\"?\n\nThis removes the local plugin files. The plugin stays in the cloud "
1297 "and can be reinstalled.") :
1298 _L("Delete plugin \"%s\"?\n\nThis permanently removes the plugin folder."),
1299 plugin_name),
1300 kDeletePluginTitle, wxYES_NO | wxNO_DEFAULT | wxICON_WARNING, this);
1302 if (rc != wxYES)
1303 return;
1304
1305 auto state = std::make_shared<PluginOperationState>();
1307 [plugin_key = plugin.plugin_key, cloud_row = as_cloud_only_descriptor(plugin), state]() {
1308 std::string error;
1309 const bool succeeded = PluginManager::instance().delete_plugin(plugin_key, error);
1310 // Keep the cloud row listed so the plugin stays reinstallable without waiting on a cloud fetch.
1311 if (succeeded && cloud_row.is_cloud_plugin())
1312 PluginManager::instance().update_cloud_metadata(std::vector<PluginDescriptor>{cloud_row});
1313 store_plugin_operation_result(state, succeeded, std::move(error));
1314 },
1315 [this, state, plugin_name]() {
1316 std::string error;
1317 if (!take_plugin_operation_result(state, error)) {
1318 show_status(error.empty() ? _L("Failed to delete plugin.") : from_u8(error), "error");
1319 return;
1320 }
1321
1322 send_plugins();
1323 show_status(wxString::Format(_L("Deleted \"%s\"."), plugin_name), "success");
1324 },
1325 _L("Deleting plugin"), _L("Deleting plugin..."));
1326}
void run_with_dialog(Run &&run, OnFinish &&on_finish, const wxString &title, const wxString &message, int maximum=100, int style=wxPD_APP_MODAL|wxPD_AUTO_HIDE, bool finish_after_dialog_destroyed=false)
Definition PluginsDialog.hpp:291
void show_status(const wxString &message, const char *level)
Definition PluginsDialog.cpp:1112
void send_plugins()
Definition PluginsDialog.cpp:784
void restore_z_order()
Definition PluginsDialog.cpp:1022
void update_cloud_metadata(const std::vector< PluginDescriptor > &cloud_list)
Definition PluginManager.cpp:1503
bool delete_plugin(const std::string &plugin_key, std::string &error)
Definition PluginManager.cpp:2020
void store_plugin_operation_result(const std::shared_ptr< PluginOperationState > &state, bool succeeded, std::string error)
Definition PluginsDialog.cpp:401
PluginDescriptor as_cloud_only_descriptor(PluginDescriptor descriptor)
Definition PluginsDialog.cpp:144
bool take_plugin_operation_result(const std::shared_ptr< PluginOperationState > &state, std::string &error)
Definition PluginsDialog.cpp:408
wxString from_u8(const std::string &str)
Definition GUI.cpp:544
std::string plugin_key
Definition PluginDescriptor.hpp:54
bool is_cloud_plugin() const
Definition PluginDescriptor.hpp:82
std::string name
Definition PluginDescriptor.hpp:55

References _L, Slic3r::PluginManager::delete_plugin(), Slic3r::GUI::from_u8(), Slic3r::PluginManager::instance(), Slic3r::PluginDescriptor::is_cloud_plugin(), Slic3r::PluginDescriptor::name, Slic3r::PluginDescriptor::plugin_key, restore_z_order(), run_with_dialog(), send_plugins(), show_status(), and Slic3r::PluginManager::update_cloud_metadata().

Referenced by handle_plugin_menu_action().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ document_start_injector()

std::string Slic3r::GUI::WebViewHostDialog::document_start_injector ( const std::string & markup,
const char * dom_id,
const char * position,
const std::string & prelude = {},
const std::string & on_inject = {} )
staticinherited
135{
136 const std::string literal = nlohmann::json(markup).dump();
137 std::string s;
138 s += "(function(){";
139 // wxWebView's AddUserScript runs in child frames too (including cross-origin
140 // frames on WebView2). Host theme state belongs only to the top-level page.
141 s += "if(window.top!==window.self)return;";
142 s += prelude;
143 s += "var css=" + literal + ";";
144 s += "function inject(){";
145 s += "var root=document.head||document.documentElement;if(!root)return false;";
146 s += "if(!document.getElementById('" + std::string(dom_id) + "'))root.insertAdjacentHTML('" +
147 std::string(position) + "',css);";
148 s += on_inject;
149 s += "return true;}";
150 s += "if(inject())return;";
151 s += "var obs=new MutationObserver(function(){if(inject())obs.disconnect();});";
152 s += "obs.observe(document,{childList:true});})();";
153 return s;
154}

Referenced by element_defaults_user_script(), and theme_user_script().

Here is the caller graph for this function:

◆ element_defaults_user_script()

std::string Slic3r::GUI::WebViewHostDialog::element_defaults_user_script ( )
staticinherited
103{
104 std::string css;
105 css += "<style id=\"orca-plugin-defaults\">";
106 css += "html,body{background:var(--orca-bg);color:var(--orca-fg);"
107 "font-family:var(--orca-font);font-size:13px;}";
108 css += "body{margin:0;}";
109 css += "h1,h2,h3,h4,h5,h6{color:var(--orca-fg);font-weight:600;}";
110 css += "a{color:var(--orca-accent);}";
111 css += "hr{border:0;border-top:1px solid var(--orca-border);}";
112 css += "button{font:inherit;color:var(--orca-accent-fg);background:var(--orca-accent);"
113 "border:1px solid var(--orca-accent);border-radius:4px;padding:5px 14px;cursor:pointer;}";
114 css += "button:hover{filter:brightness(1.1);}";
115 css += "button:disabled{opacity:.5;cursor:default;}";
116 css += "input,select,textarea{font:inherit;color:var(--orca-fg);"
117 "background:var(--orca-bg);border:1px solid var(--orca-border);"
118 "border-radius:4px;padding:4px 8px;}";
119 css += "input:focus,select:focus,textarea:focus{outline:none;border-color:var(--orca-accent);}";
120 css += "table{border-collapse:collapse;}";
121 css += "th,td{text-align:left;padding:6px 10px;border-bottom:1px solid var(--orca-border);}";
122 css += "th{color:var(--orca-muted);font-weight:600;}";
123 css += "::-webkit-scrollbar{width:12px;height:12px;}";
124 css += "::-webkit-scrollbar-thumb{background:var(--orca-border);border-radius:6px;}";
125 css += "::-webkit-scrollbar-track{background:transparent;}";
126 css += "</style>";
127 return document_start_injector(css, "orca-plugin-defaults", "beforeend");
128}
static std::string document_start_injector(const std::string &markup, const char *dom_id, const char *position, const std::string &prelude={}, const std::string &on_inject={})
Definition WebViewHostDialog.cpp:130

References document_start_injector().

Referenced by Slic3r::GUI::WebPanel::WebPanel(), and Slic3r::GUI::WebDialog::add_user_scripts().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ em_unit()

int Slic3r::GUI::DPIAware< wxDialog >::em_unit ( ) const
inlineinherited
203{ return m_em_unit; }
Definition GUI_Utils.hpp:107

Referenced by Slic3r::GUI::AuxiliaryDialog::AuxiliaryDialog(), Slic3r::GUI::CopyrightsDialog::CopyrightsDialog(), Slic3r::GUI::DesignTextDialog::DesignTextDialog(), Slic3r::GUI::EditGCodeDialog::EditGCodeDialog(), Slic3r::GUI::FileArchiveDialog::FileArchiveDialog(), Slic3r::GUI::MsgNoUpdates::MsgNoUpdates(), Slic3r::GUI::MsgUpdateForced::MsgUpdateForced(), Slic3r::GUI::OAuthDialog::OAuthDialog(), Slic3r::GUI::ParamsDialog::ParamsDialog(), Slic3r::GUI::PhysicalPrinterDialog::PhysicalPrinterDialog(), Slic3r::GUI::SettingsDialog::SettingsDialog(), anonymous_namespace{3DPrinterOS.cpp}::TokenAuthDialog::TokenAuthDialog(), anonymous_namespace{3DPrinterOS.cpp}::UploadOptionsDialog::UploadOptionsDialog(), Slic3r::GUI::PublishSettingsDialog::add_row_ui(), Slic3r::GUI::DiffPresetDialog::complete_dialog_creation(), Slic3r::GUI::DiffPresetDialog::create_edit_sizer(), Slic3r::GUI::DiffPresetDialog::create_presets_sizer(), Slic3r::GUI::DiffPresetDialog::create_tree(), Slic3r::GUI::ElegooPrintHostSendDialog::init(), Slic3r::GUI::FlashforgePrintHostSendDialog::init(), Slic3r::GUI::PrintHostSendDialog::init(), Slic3r::GUI::AboutDialog::on_dpi_changed(), Slic3r::GUI::AuxiliaryDialog::on_dpi_changed(), Slic3r::GUI::BedShapeDialog::on_dpi_changed(), Slic3r::GUI::ConfigWizard::on_dpi_changed(), Slic3r::GUI::CopyrightsDialog::on_dpi_changed(), Slic3r::GUI::DiffPresetDialog::on_dpi_changed(), Slic3r::GUI::EditGCodeDialog::on_dpi_changed(), Slic3r::GUI::FileArchiveDialog::on_dpi_changed(), Slic3r::GUI::OAuthDialog::on_dpi_changed(), Slic3r::GUI::ObjectTableDialog::on_dpi_changed(), Slic3r::GUI::ParamsDialog::on_dpi_changed(), Slic3r::GUI::PhysicalPrinterDialog::on_dpi_changed(), Slic3r::GUI::PrintHostQueueDialog::on_dpi_changed(), Slic3r::GUI::PurgeModeDialog::on_dpi_changed(), Slic3r::GUI::SavePresetDialog::on_dpi_changed(), Slic3r::GUI::SendSystemInfoDialog::on_dpi_changed(), Slic3r::GUI::SettingsDialog::on_dpi_changed(), and Slic3r::GUI::UnsavedChangesDialog::on_dpi_changed().

Here is the caller graph for this function:

◆ enable_force_rescale()

void Slic3r::GUI::DPIAware< wxDialog >::enable_force_rescale ( )
inlineinherited
206{ m_force_rescale = true; }

◆ EndModal()

void Slic3r::GUI::DPIDialog::EndModal ( int retCode)
inlineoverrideinherited
306 {
307 if (!dialogStack.empty() && dialogStack.front() != this) {
308 // This is a bug in wxWidgets
309 // when the dialog is not top modal dialog, EndModal() just hide dialog without quit
310 // the modal event loop. And the modal event loop blocks us from bottom widgets.
311 // Solution: let user click it manually or close outside. FIXME
312 BOOST_LOG_TRIVIAL(warning) << "DPIAware::EndModal Error: dialogStack is not empty, but top dialog is not this one. retCode=" << retCode;
313 return;
314 }
315
316 return wxDialog::EndModal(retCode);
317 }
std::deque< wxDialog * > dialogStack
Definition GUI_Utils.cpp:549

References Slic3r::GUI::dialogStack.

Referenced by Slic3r::GUI::CloneDialog::CloneDialog(), Slic3r::GUI::ConfigWizard::ConfigWizard(), Slic3r::GUI::CreatePresetSuccessfulDialog::CreatePresetSuccessfulDialog(), Slic3r::GUI::DeleteConfirmDialog::DeleteConfirmDialog(), Slic3r::GUI::DesignVariableDialog::DesignVariableDialog(), Slic3r::GUI::anonymous_namespace{PrintHostDialogs.cpp}::FlashforgeSlotDialog::FlashforgeSlotDialog(), Slic3r::GUI::GuideFrame::GuideFrame(), Slic3r::GUI::InputIpAddressDialog::InputIpAddressDialog(), Slic3r::GUI::ManualNozzleCountDialog::ManualNozzleCountDialog(), Slic3r::GUI::MsgUpdateConfig::MsgUpdateConfig(), Slic3r::GUI::MsgUpdateForced::MsgUpdateForced(), Slic3r::GUI::MultiChoiceDialog::MultiChoiceDialog(), Slic3r::GUI::NetworkErrorDialog::NetworkErrorDialog(), Slic3r::GUI::NetworkPluginRestartDialog::NetworkPluginRestartDialog(), Slic3r::GUI::PartSkipConfirmDialog::PartSkipConfirmDialog(), Slic3r::GUI::PhysicalPrinterDialog::PhysicalPrinterDialog(), Slic3r::GUI::PlateNameEditDialog::PlateNameEditDialog(), Slic3r::GUI::PlateSettingsDialog::PlateSettingsDialog(), Slic3r::GUI::PublishSettingsDialog::PublishSettingsDialog(), Slic3r::GUI::SelectMachineDialog::SelectMachineDialog(), Slic3r::GUI::SendFailedConfirm::SendFailedConfirm(), Slic3r::GUI::SendSystemInfoDialog::SendSystemInfoDialog(), Slic3r::GUI::ShortcutCaptureDialog::ShortcutCaptureDialog(), Slic3r::GUI::SingleChoiceDialog::SingleChoiceDialog(), StepMeshDialog::StepMeshDialog(), Slic3r::GUI::SyncAmsInfoDialog::SyncAmsInfoDialog(), anonymous_namespace{3DPrinterOS.cpp}::TokenAuthDialog::TokenAuthDialog(), Slic3r::GUI::UpdatePluginDialog::UpdatePluginDialog(), Slic3r::GUI::UpdateVersionDialog::UpdateVersionDialog(), Slic3r::GUI::wgtDeviceNozzleRackUpgradeDlg::wgtDeviceNozzleRackUpgradeDlg(), Slic3r::GUI::SavePresetDialog::accept(), Slic3r::GUI::MsgDialog::add_button(), Slic3r::GUI::TipsDialog::add_button(), Slic3r::GUI::FilamentPickerDialog::BindEvents(), Slic3r::GUI::PluginPickerDialog::build_capability_ui(), Slic3r::GUI::BedShapeDialog::build_dialog(), Slic3r::GUI::PluginPickerDialog::build_ui(), Slic3r::GUI::UnsavedChangesDialog::close(), Slic3r::GUI::FileArchiveDialog::create_btn_sizer(), Slic3r::GUI::ColorDecomposeDialog::create_button_panel(), Slic3r::GUI::MixedFilamentDialog::create_button_panel(), Slic3r::GUI::CreateFilamentPresetDialog::create_dialog_buttons(), Slic3r::GUI::CreatePresetForPrinterDialog::create_dialog_buttons(), Slic3r::GUI::EditFilamentPresetDialog::create_dialog_buttons(), Slic3r::GUI::ExportConfigsDialog::create_dialog_buttons(), Slic3r::GUI::PreferencesDialog::create_item_language_combobox(), Slic3r::GUI::PreferencesDialog::create_item_region_combobox(), Slic3r::GUI::PreferencesDialog::create_items(), Slic3r::GUI::CreatePrinterPresetDialog::create_page1_dialog_buttons(), Slic3r::GUI::CreatePrinterPresetDialog::create_page2_dialog_buttons(), Slic3r::GUI::ExportConfigsDialog::data_init(), Slic3r::GUI::WebDialog::destroy_silently(), Slic3r::GUI::EditFilamentPresetDialog::edit_preset(), Slic3r::GUI::ConnectPrinterDialog::end_modal(), Slic3r::GUI::PrintHostSendDialog::EndModal(), Slic3r::GUI::ColorPickerDialog::finish(), Slic3r::GUI::WebDialog::finish(), Slic3r::GUI::Newer3mfVersionDialog::get_btn_sizer(), Slic3r::GUI::ScoreDialog::get_button_sizer(), Slic3r::GUI::WebViewHostDialog::handle_common_script_command(), Slic3r::GUI::ExportPresetBundleDialog::InitExportData(), Slic3r::GUI::SelectMachineDialog::navigate_to_timelapse_page(), Slic3r::GUI::BindMachineDialog::on_bind_success(), Slic3r::GUI::ConnectPrinterDialog::on_button_confirm(), Slic3r::GUI::RecenterDialog::on_button_confirm(), Slic3r::GUI::BindMachineDialog::on_cancel(), Slic3r::GUI::EditCalibrationHistoryDialog::on_cancel(), Slic3r::GUI::InputIpAddressDialog::on_cancel(), Slic3r::GUI::NewCalibrationHistoryDialog::on_cancel(), Slic3r::GUI::OAuthDialog::on_cancel(), Slic3r::GUI::PingCodeBindDialog::on_cancel(), Slic3r::GUI::SelectMachineDialog::on_cancel(), Slic3r::GUI::SendToPrinterDialog::on_cancel(), Slic3r::GUI::SyncAmsInfoDialog::on_cancel(), Slic3r::GUI::UnBindMachineDialog::on_cancel(), Slic3r::GUI::WebDialog::on_close_window(), Slic3r::GUI::NetworkPluginDownloadDialog::on_dont_ask(), Slic3r::GUI::NetworkPluginDownloadDialog::on_download(), Slic3r::GUI::EditDevNameDialog::on_edit_name(), Slic3r::GUI::ConfirmBeforeSendDialog::on_hide(), Slic3r::GUI::PrivacyUpdateDialog::on_hide(), Slic3r::GUI::ShortcutCaptureDialog::on_key(), Slic3r::GUI::TextureImportDialog::on_ok_clicked(), Slic3r::GUI::FileArchiveDialog::on_open_button(), Slic3r::GUI::NetworkPluginDownloadDialog::on_remind_later(), Slic3r::GUI::ProjectDropDialog::on_select_cancel(), Slic3r::GUI::SavePresetDialog::on_select_cancel(), Slic3r::GUI::ProjectDropDialog::on_select_ok(), Slic3r::GUI::SendMultiMachinePage::on_send(), Slic3r::GUI::NetworkPluginDownloadDialog::on_skip(), Slic3r::GUI::TextureImportDialog::on_skip_clicked(), Slic3r::GUI::NetworkPluginDownloadDialog::on_skip_version(), Slic3r::GUI::Cornering_Test_Dlg::on_start(), Slic3r::GUI::FlowRateCalibrationDialog::on_start(), Slic3r::GUI::Input_Shaping_Damp_Test_Dlg::on_start(), Slic3r::GUI::Input_Shaping_Freq_Test_Dlg::on_start(), Slic3r::GUI::MaxVolumetricSpeed_Test_Dlg::on_start(), Slic3r::GUI::PA_Calibration_Dlg::on_start(), Slic3r::GUI::Retraction_Test_Dlg::on_start(), Slic3r::GUI::Temp_Calibration_Dlg::on_start(), Slic3r::GUI::VFA_Test_Dlg::on_start(), Slic3r::GUI::CalibrationDialog::on_start_calibration(), Slic3r::GUI::UnBindMachineDialog::on_unbind_printer(), Slic3r::GUI::PartSkipDialog::OnApplyDialog(), anonymous_namespace{3DPrinterOS.cpp}::TokenAuthDialog::OnCancel(), Slic3r::GUI::AboutDialog::onCloseDialog(), Slic3r::GUI::CopyrightsDialog::onCloseDialog(), Slic3r::GUI::MultiNozzleSyncDialog::OnRackStatusReadingFinished(), Slic3r::GUI::GuideFrame::OnScriptMessage(), Slic3r::GUI::InputIpAddressDialog::OnTimer(), Slic3r::GUI::KBShortcutsDialog::open_mouse_preferences(), Slic3r::GUI::TroubleshootDialog::PackAll(), Slic3r::GUI::TroubleshootDialog::RebuildSystemProfiles(), Slic3r::GUI::SpeedDialWebDialog::run_action(), Slic3r::GUI::OAuthDialog::Show(), Slic3r::GUI::MultiNozzleSyncDialog::UpdateButton(), and Slic3r::GUI::CreatePrinterPresetDialog::validate_input_valid().

◆ force_rescale()

bool Slic3r::GUI::DPIAware< wxDialog >::force_rescale ( ) const
inlineinherited
201{ return m_force_rescale; }

◆ get_descriptor()

bool Slic3r::GUI::PluginsDialog::get_descriptor ( const std::string & plugin_key,
Slic3r::PluginDescriptor & descriptor ) const
private
820{
821 PluginManager& manager = PluginManager::instance();
822 if (manager.try_get_valid_plugin_descriptor(plugin_key, descriptor))
823 return true;
824 return manager.try_get_plugin_descriptor(plugin_key, descriptor) && descriptor.is_invalid_package();
825}
bool is_invalid_package() const
Definition PluginDescriptor.hpp:93

References Slic3r::PluginManager::instance(), Slic3r::PluginDescriptor::is_invalid_package(), Slic3r::PluginManager::try_get_plugin_descriptor(), and Slic3r::PluginManager::try_get_valid_plugin_descriptor().

Referenced by handle_plugin_menu_action(), plugin_display_name(), resolve_pending_activation(), toggle_plugin(), toggle_plugin_capability(), and update_plugin().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ handle_common_script_command()

bool Slic3r::GUI::WebViewHostDialog::handle_common_script_command ( const nlohmann::json & payload,
int close_return_code = wxID_CANCEL )
protectedinherited
251{
252 const std::string command = payload.value("command", "");
253 if (command == "close_page") {
254 if (IsModal())
255 EndModal(close_return_code);
256 else
257 Close();
258 return true;
259 }
260
261 return false;
262}
void EndModal(int retCode) override
Definition GUI_Utils.hpp:305

References Slic3r::GUI::DPIDialog::EndModal().

Referenced by Slic3r::GUI::ExportPresetBundleDialog::on_script_message(), Slic3r::GUI::PluginsConfigDialog::on_script_message(), Slic3r::GUI::PluginsDialog::on_script_message(), Slic3r::GUI::PresetBundleDialog::on_script_message(), Slic3r::GUI::SpeedDialWebDialog::on_script_message(), Slic3r::GUI::TerminalDialog::on_script_message(), and Slic3r::GUI::WebDialog::on_script_message().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ handle_plugin_menu_action()

void Slic3r::GUI::PluginsDialog::handle_plugin_menu_action ( const std::string & plugin_key,
const std::string & action )
private
995{
996 PluginDescriptor row_data;
997 if (!get_descriptor(plugin_key, row_data))
998 return;
999
1000 const PluginDialogItem dialog_item = build_plugin_dialog_item(row_data);
1001
1002 const PluginContextAction* context_action = find_context_action(dialog_item.available_actions, action);
1003 if (!context_action || !context_action->enabled)
1004 return;
1005
1006 if (action == "open_folder") {
1007 open_plugin_folder(row_data);
1008 } else if (action == "delete_plugin") {
1009 delete_local_plugin(row_data);
1010 } else if (action == "unsubscribe_plugin") {
1011 unsubscribe_cloud_plugin(row_data);
1012 } else if (action == "reload_plugin") {
1013 reload_local_plugin(plugin_key, /*clear_cache=*/false);
1014 } else if (action == "clear_cache_reload_plugin") {
1015 reload_local_plugin(plugin_key, /*clear_cache=*/true);
1016 } else if (action == "reinstall_plugin") {
1017 if (row_data.is_cloud_plugin())
1018 reinstall_cloud_plugin(row_data);
1019 }
1020}
void open_plugin_folder(const Slic3r::PluginDescriptor &plugin)
Definition PluginsDialog.cpp:1262
void unsubscribe_cloud_plugin(const Slic3r::PluginDescriptor &plugin)
Definition PluginsDialog.cpp:1328
void reload_local_plugin(const std::string &plugin_key, bool clear_cache)
Definition PluginsDialog.cpp:1359
void reinstall_cloud_plugin(const Slic3r::PluginDescriptor &plugin)
Definition PluginsDialog.cpp:1423
bool get_descriptor(const std::string &plugin_key, Slic3r::PluginDescriptor &descriptor) const
Definition PluginsDialog.cpp:819
void delete_local_plugin(const Slic3r::PluginDescriptor &plugin)
Definition PluginsDialog.cpp:1291
const PluginContextAction * find_context_action(const PluginAvailableActions &available_actions, const std::string &action_id)
Definition PluginsDialog.cpp:371

References delete_local_plugin(), get_descriptor(), Slic3r::PluginDescriptor::is_cloud_plugin(), open_plugin_folder(), reinstall_cloud_plugin(), reload_local_plugin(), and unsubscribe_cloud_plugin().

Referenced by handle_web_command().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ handle_web_command()

void Slic3r::GUI::PluginsDialog::handle_web_command ( const nlohmann::json & payload)
private
735{
736 const std::string command = payload.value("command", "");
737 if (command == "request_plugins") {
738 send_plugins();
739 } else if (command == "refresh_plugins") {
741 } else if (command == "toggle_plugin") {
742 toggle_plugin(payload.value("plugin_key", ""), payload.value("enabled", false));
743 } else if (command == "toggle_plugin_capability") {
744 toggle_plugin_capability(payload.value("plugin_key", ""), plugin_capability_type_from_string(payload.value("capability_type", "")),
745 payload.value("capability_name", ""), payload.value("enabled", false));
746 } else if (command == "install_local_plugin") {
748 } else if (command == "plugin_menu_action") {
749 handle_plugin_menu_action(payload.value("plugin_key", ""), payload.value("action", ""));
750 } else if (command == "run_script_plugin_capability") {
751 run_script_plugin_capability(payload.value("plugin_key", ""), payload.value("capability_name", ""));
752 } else if (command == "open_terminal") {
754 } else if (command == "update_plugin") {
755 update_plugin(payload.value("plugin_key", ""));
756 } else if (command == "open_plugin_on_cloud") {
757 open_plugin_on_cloud(payload.value("sharing_token", ""));
758 } else if (command == "open_plugin_hub") {
760 } else if (command == "set_plugin_sort") {
761 set_plugin_sort(payload.value("sort_key", ""), payload.value("sort_order", ""));
762 } else if (command == "get_capability_config" || command == "save_capability_config" || command == "restore_capability_config") {
763 const PluginCapabilityId id{plugin_capability_type_from_string(payload.value("capability_type", "")),
764 payload.value("capability_name", ""), payload.value("plugin_key", "")};
765 if (command == "get_capability_config") {
767 return;
768 }
769 if (command == "restore_capability_config") {
771 return;
772 }
773
774 // `config` is a JSON string from the default editor's textarea, or an already-structured
775 // value from a capability's custom UI. Both land here; save_capability_config sorts it out.
776 save_capability_config(id, payload.contains("config") ? payload.at("config") : nlohmann::json::object());
777 } else if (command == "set_plugin_install_action") {
778 const std::string action = payload.value("action", "");
779 if (action == "explore" || action == "install-local")
781 }
782}
void send_capability_config(const PluginCapabilityId &id)
Definition PluginsDialog.cpp:1129
void toggle_plugin_capability(const std::string &plugin_key, PluginCapabilityType type, const std::string &capability_name, bool enabled)
Definition PluginsDialog.cpp:960
std::function< void()> m_open_terminal_dlg_fn
Definition PluginsDialog.hpp:313
void open_plugin_on_cloud(const std::string &sharing_token)
Definition PluginsDialog.cpp:1274
void open_plugin_hub()
Definition PluginsDialog.cpp:1289
void run_script_plugin_capability(const std::string &plugin_key, const std::string &capability_name)
Definition PluginsDialog.cpp:1158
void set_plugin_sort(const std::string &sort_key, const std::string &sort_order)
Definition PluginsDialog.cpp:786
void save_capability_config(const PluginCapabilityId &id, const nlohmann::json &config)
Definition PluginsDialog.cpp:1131
void refresh_plugins()
Definition PluginsDialog.cpp:860
void install_plugin_from_file()
Definition PluginsDialog.cpp:1032
void toggle_plugin(const std::string &plugin_key, bool enabled)
Definition PluginsDialog.cpp:867
void handle_plugin_menu_action(const std::string &plugin_key, const std::string &action)
Definition PluginsDialog.cpp:994
void update_plugin(const std::string &plugin_key)
Definition PluginsDialog.cpp:1227
void restore_capability_config(const PluginCapabilityId &id)
Definition PluginsDialog.cpp:1140
PluginCapabilityType plugin_capability_type_from_string(std::string_view value)
Definition PythonPluginInterface.hpp:72

References handle_plugin_menu_action(), install_plugin_from_file(), m_open_terminal_dlg_fn, open_plugin_hub(), open_plugin_on_cloud(), Slic3r::plugin_capability_type_from_string(), refresh_plugins(), restore_capability_config(), run_script_plugin_capability(), save_capability_config(), send_capability_config(), send_plugins(), set_plugin_sort(), toggle_plugin(), toggle_plugin_capability(), and update_plugin().

Referenced by on_script_message().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ install_cloud_plugin()

bool Slic3r::GUI::PluginsDialog::install_cloud_plugin ( const std::string & uuid,
const std::string & version,
const wxString & name )
private
1080{
1081 if (plugin_key.empty())
1082 return false;
1083
1084 BOOST_LOG_TRIVIAL(info) << "Downloading cloud plugin. plugin_key=" << plugin_key << " name=" << into_u8(name);
1085
1086 std::string error;
1087
1088 bool downloaded = false;
1089 try {
1090 downloaded = run_with_dialog_wait(
1091 [plugin_key, &error, version]() {
1092 return PluginManager::instance().download_and_install_cloud_plugin(plugin_key, version, error);
1093 },
1094 _L("Downloading plugin"), _L("Downloading") + ": " + name);
1095 } catch (const std::exception& ex) {
1096 error = ex.what();
1097 } catch (...) {
1098 error = _u8L("Unknown error");
1099 }
1100
1101 if (!downloaded) {
1102 BOOST_LOG_TRIVIAL(error) << "Cloud plugin download failed. plugin_key=" << plugin_key << " error=" << error;
1103 PluginManager::instance().set_plugin_error(plugin_key, error);
1104 show_status(error.empty() ? _L("Plugin download failed.") : from_u8(error), "error");
1105 return false;
1106 }
1107
1108 BOOST_LOG_TRIVIAL(info) << "Cloud plugin downloaded successfully. plugin_key=" << plugin_key;
1109 return true;
1110}
std::invoke_result_t< std::decay_t< Run > & > run_with_dialog_wait(Run &&run, const wxString &title, const wxString &message, int maximum=100, int style=wxPD_APP_MODAL|wxPD_AUTO_HIDE)
Definition PluginsDialog.hpp:304
bool download_and_install_cloud_plugin(const std::string &plugin_key, const std::string &version, std::string &error)
Definition PluginManager.cpp:1727
bool set_plugin_error(const std::string &plugin_key, std::string error)
Definition PluginManager.cpp:1396
std::string into_u8(const wxString &str)
Definition GUI.cpp:549
#define _u8L(s)
Definition I18N.hpp:11

References _L, _u8L, Slic3r::PluginManager::download_and_install_cloud_plugin(), Slic3r::GUI::from_u8(), Slic3r::PluginManager::instance(), Slic3r::GUI::into_u8(), run_with_dialog_wait(), Slic3r::PluginManager::set_plugin_error(), and show_status().

Referenced by reinstall_cloud_plugin(), and toggle_plugin().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ install_plugin_from_file()

void Slic3r::GUI::PluginsDialog::install_plugin_from_file ( )
private
1033{
1034 wxFileDialog dialog(this, _L("Select plugin package"), wxEmptyString, wxEmptyString, _L("Plugin files (*.py;*.whl)|*.py;*.whl"),
1035 wxFD_OPEN | wxFD_FILE_MUST_EXIST);
1036
1037 const int rc = dialog.ShowModal();
1039 if (rc != wxID_OK)
1040 return;
1041
1042 if (!install_plugin_package(dialog.GetPath().ToUTF8().data())) {
1043 BOOST_LOG_TRIVIAL(warning) << __FUNCTION__ << ": Failed to install plugin package.";
1044 }
1045}
bool install_plugin_package(const std::string &package_path)
Definition PluginsDialog.cpp:1047

References _L, install_plugin_package(), and restore_z_order().

Referenced by handle_web_command().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ install_plugin_package()

bool Slic3r::GUI::PluginsDialog::install_plugin_package ( const std::string & package_path)
private
1048{
1049 if (package_path.empty())
1050 return false;
1051 BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << ": Installing local plugin package from path: " << package_path;
1052
1053 const boost::filesystem::path package_file(package_path);
1054 wxString message;
1055 const bool installed = install_local_plugin_package(package_file, this, message);
1056 // The helper's overwrite prompt and progress dialog can push this webview behind; re-raise it
1057 // once, after both have closed (the speed-dial path parents to the mainframe instead).
1059
1060 // The shared helper reports a user-cancelled overwrite with an empty message: stay silent.
1061 if (message.IsEmpty()) {
1062 send_plugins();
1063 return false;
1064 }
1065
1066 if (!installed) {
1067 BOOST_LOG_TRIVIAL(warning) << __FUNCTION__ << ": Failed to install plugin package.";
1068 show_status(message, "warn");
1069 send_plugins();
1070 return false;
1071 }
1072
1073 show_status(message, "success");
1075 send_plugins();
1076 return true;
1077}
void prompt_for_missing_plugins()
Definition PluginsDialog.cpp:835
bool install_local_plugin_package(const boost::filesystem::path &package_file, wxWindow *parent, wxString &message)
Definition PluginsDialog.cpp:486

References Slic3r::GUI::install_local_plugin_package(), prompt_for_missing_plugins(), restore_z_order(), send_plugins(), and show_status().

Referenced by install_plugin_from_file().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ is_new_scale_factor()

bool Slic3r::GUI::DPIAware< wxDialog >::is_new_scale_factor ( ) const
inlineprivateinherited
262{ return fabs(m_scale_factor - m_prev_scale_factor) > 0.001; }

◆ load_url()

void Slic3r::GUI::WebViewHostDialog::load_url ( const wxString & url)
inherited
225{
226 if (!m_browser)
227 return;
228
229 BOOST_LOG_TRIVIAL(trace) << __FUNCTION__ << " enter, url=" << into_u8(url);
231 m_browser->SetFocus();
232}
static void LoadUrl(wxWebView *webView, wxString const &url)
Definition WebView.cpp:480
void trace(unsigned int level, const char *message)
Definition utils.cpp:247

References Slic3r::GUI::into_u8(), WebView::LoadUrl(), m_browser, and Slic3r::trace().

Referenced by create_webview().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ localized_strings()

nlohmann::json Slic3r::GUI::PluginsDialog::localized_strings ( ) const
overrideprivatevirtual

Reimplemented from Slic3r::GUI::WebViewHostDialog.

591{
592 return {
593 {"search_plugins", _u8L("Search plugins")},
594 {"clear", _u8L("Clear")},
595 {"clear_search", _u8L("Clear search")},
596 {"match_case", _u8L("Match case")},
597 {"match_whole_word", _u8L("Match whole word")},
598 {"refresh", _u8L("Refresh")},
599 {"install_options", _u8L("More plugin install options")},
600 {"install_plugin", _u8L("Install plugin")},
601 {"install_local_plugin", _u8L("Install local plugin")},
602 {"activate", _u8L("Activate")},
603 {"sort_by_name", _u8L("Sort by name")},
604 {"name", _u8L("Name")},
605 {"sort_by_version", _u8L("Sort by version")},
606 {"plugin_version", _u8L("Plugin Version")},
607 {"sort_by_source", _u8L("Sort by source")},
608 {"source", _u8L("Source")},
609 {"sort_by_status", _u8L("Sort by status")},
610 {"status", _u8L_CONTEXT("Status", "Plugin")},
611 {"resize_hint", _u8L("Drag to resize; double-click to reset")},
612 {"resize_list", _u8L("Resize the plugin list")},
613 {"details_label", _u8L("Plugin details")},
614 {"tab_info", _u8L("Plugin Info")},
615 {"description", _u8L("Description")},
616 {"tab_config", _u8L("Config")},
617 {"tab_changelog", _u8L("Changelog")},
618 {"tab_diagnostics", _u8L("Diagnostics")},
619 {"types", _u8L("Types")},
620 {"author", _u8L("Author")},
621 {"installed_version", _u8L("Installed Version")},
622 {"latest_version", _u8L("Latest Version")},
623 {"update_available", _u8L("Update available")},
624 {"update_title", _u8L("Update to the latest version")},
625 {"update", _u8L("Update")},
626 {"no_description", _u8L("No description available")},
627 {"config_select_plugin", _u8L("Select a plugin to configure its capabilities")},
628 {"configurable_capabilities", _u8L("Configurable capabilities")},
629 {"config_json_label", _u8L("Capability configuration (JSON)")},
630 {"config_frame_title", _u8L("Plugin configuration")},
631 {"restore_title", _u8L("Discard the settings saved for this capability and restore the plugin's defaults")},
632 {"restore_defaults", _u8L("Restore defaults")},
633 {"save", _u8L("Save")},
634 {"changelog_label", _u8L("Plugin changelog")},
635 {"version", _u8L("Version")},
636 {"date", _u8L("Date")},
637 {"changes", _u8L("Changes")},
638 {"no_changelog", _u8L("No changelog available")},
639 {"no_issues", _u8L("No issues detected")},
640 {"no_plugins", _u8L("No plugins found")},
641 {"no_match", _u8L("No plugins match \"%s\"")},
642 {"source_mine", _u8L("Mine")},
643 {"source_subscribed", _u8L_CONTEXT("Subscribed", "Plugin")},
644 {"source_orphaned", _u8L("Orphaned")},
645 {"source_local", _u8L_CONTEXT("Local", "Plugin")},
646 {"mixed_capabilities", _u8L("Some plugin capabilities are enabled")},
647 {"collapse_named", _u8L("Collapse %s capabilities")},
648 {"expand_named", _u8L("Expand %s capabilities")},
649 {"collapse", _u8L("Collapse capabilities")},
650 {"expand", _u8L("Expand capabilities")},
651 {"open_in_browser", _u8L("Open this plugin in your browser")},
652 {"capability_count", _u8L("Capabilities: %s")},
653 {"capabilities", _u8L_CONTEXT("Capabilities", "Plugin")},
654 {"run_named", _u8L("Run \"%s\"")},
655 {"enable_named", _u8L("Enable %s")},
656 {"not_available", _u8L("N/A")},
657 {"unauthorized", _u8L("Unauthorized for updates")},
658 {"not_installed", _u8L("Not installed")},
659 {"config_loading", _u8L("Loading the plugin…")},
660 {"config_no_capabilities", _u8L("This plugin exposes no capabilities")},
661 {"config_activate", _u8L("Activate this plugin to configure its capabilities")},
662 {"invalid_json", _u8L("Invalid JSON")},
663 {"view_on_cloud", _u8L("View on OrcaCloud <a>here</a>")},
664 {"status_activated", _u8L("Activated")},
665 {"status_loading", _u8L("Loading")},
666 {"status_error", _u8L("Error")},
667 {"status_runtime_error", _u8L("Runtime error")},
668 {"status_inactive", _u8L("Inactive")},
669 {"status_activated_desc", _u8L("This plugin is active and ready to be used.")},
670 {"status_loading_desc", _u8L("This plugin is still loading.")},
671 {"status_error_desc", _u8L("This plugin is blocked until its error is fixed.")},
672 {"status_runtime_error_desc", _u8L("This plugin is loaded but a capability reported an error.")},
673 {"status_inactive_desc", _u8L("This plugin is inactive. Activate it to install or load it.")},
674 {"select_plugin", _u8L("Select a plugin to view its status and details.")},
675 {"orphaned_note", _u8L("Orphaned: This plugin is no longer subscribed or available in OrcaCloud. The local copy remains installed and can still be used.")},
676 {"newer_version_note", _u8L("A newer plugin version is available.")},
677 {"unauthorized_note", _u8L("Cloud updates are unavailable because this plugin is unauthorized for updates.")},
678 };
679}
#define _u8L_CONTEXT(s, ctx)
Definition I18N.hpp:16

References _u8L, and _u8L_CONTEXT.

◆ localized_strings_script()

std::string Slic3r::GUI::WebViewHostDialog::localized_strings_script ( const nlohmann::json & strings)
staticinherited
157{
158 return "window.ORCA_UI_STRINGS = " + strings.dump(-1, ' ', false, nlohmann::json::error_handler_t::ignore) + ";";
159}

Referenced by Slic3r::GUI::GuideFrame::GuideFrame(), WipingDialog::WipingDialog(), Slic3r::GUI::add_page_strings(), Slic3r::GUI::ProjectPanel::create_browser(), Slic3r::GUI::WebViewPanel::create_browser(), and register_theme_user_scripts().

Here is the caller graph for this function:

◆ normal_font()

◆ on_dpi_changed()

void Slic3r::GUI::WebViewHostDialog::on_dpi_changed ( const wxRect & suggested_rect)
overrideprotectedvirtualinherited

Implements Slic3r::GUI::DPIAware< wxDialog >.

265{
266 Refresh();
267}

◆ on_script_message()

void Slic3r::GUI::PluginsDialog::on_script_message ( const nlohmann::json & payload)
overrideprivatevirtual

Implements Slic3r::GUI::WebViewHostDialog.

718{
719 if (handle_common_script_command(payload))
720 return;
721
722 // Defer command handling out of the webview script-message callback: GTK and macOS
723 // deliver it synchronously inside the native webview callback (see ui_create_window
724 // in PluginHostUi.cpp), and window work on that stack is the crash class fixed in
725 // b779a7bfed/f2ccbfc8b5. Deferring here keeps every command handler in THIS dialog off
726 // that stack; it is not a guarantee for other WebViewHostDialog subclasses, which each
727 // have to defer for themselves (PluginsConfigDialog does; others still do not).
728 wxGetApp().CallAfter([this, alive = m_alive, payload]() {
729 if (alive->load(std::memory_order_acquire))
730 handle_web_command(payload);
731 });
732}
void handle_web_command(const nlohmann::json &payload)
Definition PluginsDialog.cpp:734
bool handle_common_script_command(const nlohmann::json &payload, int close_return_code=wxID_CANCEL)
Definition WebViewHostDialog.cpp:250

References Slic3r::GUI::WebViewHostDialog::handle_common_script_command(), handle_web_command(), and m_alive.

Here is the call graph for this function:

◆ on_script_message_event()

void Slic3r::GUI::WebViewHostDialog::on_script_message_event ( wxWebViewEvent & event)
privateinherited
275{
276 const wxString payload = event.GetString();
277
278 try {
279 on_script_message(nlohmann::json::parse(payload.utf8_string()));
280 } catch (const std::exception& e) {
282 }
283}
virtual void on_script_message_parse_error(const wxString &payload, const std::exception &error)
Definition WebViewHostDialog.cpp:269
virtual void on_script_message(const nlohmann::json &payload)=0

References on_script_message(), and on_script_message_parse_error().

Referenced by create_webview().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ on_script_message_parse_error()

void Slic3r::GUI::WebViewHostDialog::on_script_message_parse_error ( const wxString & payload,
const std::exception & error )
protectedvirtualinherited
270{
271 BOOST_LOG_TRIVIAL(trace) << __FUNCTION__ << "; payload=" << into_u8(payload) << "; error=" << error.what();
272}

References Slic3r::GUI::into_u8(), and Slic3r::trace().

Referenced by on_script_message_event().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ on_sys_color_changed()

◆ on_webview_recreated()

void Slic3r::GUI::WebViewHostDialog::on_webview_recreated ( wxCommandEvent & event)
privateinherited
311{
312 // Handled: do NOT Skip(), so WebView::RecreateAll skips the redundant reload.
314}
void apply_theme_live()
Definition WebViewHostDialog.cpp:299

References apply_theme_live().

Referenced by create_webview().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ open_plugin_folder()

void Slic3r::GUI::PluginsDialog::open_plugin_folder ( const Slic3r::PluginDescriptor & plugin)
private
1263{
1264 const boost::filesystem::path plugin_folder = resolve_plugin_root_from_descriptor(plugin);
1265
1266 if (plugin_folder.empty()) {
1267 show_status(_L("Plugin folder could not be determined."), "warn");
1268 return;
1269 }
1270
1271 desktop_open_any_folder(plugin_folder.string());
1272}
void desktop_open_any_folder(const std::string &path)
Definition GUI.cpp:626
boost::filesystem::path resolve_plugin_root_from_descriptor(const PluginDescriptor &descriptor)
Definition PluginFsUtils.cpp:53

References _L, Slic3r::GUI::desktop_open_any_folder(), Slic3r::resolve_plugin_root_from_descriptor(), and show_status().

Referenced by handle_plugin_menu_action().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ open_plugin_hub()

void Slic3r::GUI::PluginsDialog::open_plugin_hub ( )
private
void open_plugin_hub()
Definition PluginsDialog.cpp:468

References Slic3r::GUI::open_plugin_hub().

Referenced by handle_web_command().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ open_plugin_on_cloud()

void Slic3r::GUI::PluginsDialog::open_plugin_on_cloud ( const std::string & sharing_token)
private
1275{
1276 if (sharing_token.empty())
1277 return;
1278
1279 if (!wxGetApp().getAgent())
1280 return;
1281
1282 auto orca_agent = std::dynamic_pointer_cast<OrcaCloudServiceAgent>(wxGetApp().getAgent()->get_cloud_agent());
1283 if (!orca_agent)
1284 return;
1285
1286 wxLaunchDefaultBrowser(wxString::FromUTF8(orca_agent->get_cloud_base_url() + "/p/" + sharing_token));
1287}

Referenced by handle_web_command().

Here is the caller graph for this function:

◆ plugin_display_name()

wxString Slic3r::GUI::PluginsDialog::plugin_display_name ( const std::string & plugin_key) const
private
1122{
1123 PluginDescriptor descriptor;
1124 if (get_descriptor(plugin_key, descriptor) && !descriptor.name.empty())
1125 return from_u8(descriptor.name);
1126 return from_u8(plugin_key);
1127}

References Slic3r::GUI::from_u8(), get_descriptor(), and Slic3r::PluginDescriptor::name.

Referenced by prompt_for_missing_plugins(), reinstall_cloud_plugin(), reload_local_plugin(), resolve_pending_activation(), and toggle_plugin().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ prev_scale_factor()

float Slic3r::GUI::DPIAware< wxDialog >::prev_scale_factor ( ) const
inlineinherited
196{ return m_prev_scale_factor; }

◆ prompt_for_missing_plugins()

void Slic3r::GUI::PluginsDialog::prompt_for_missing_plugins ( )
private
836{
837 PluginManager& manager = PluginManager::instance();
838 const std::vector<PluginDescriptor> missing = manager.get_missing_plugin_descriptors();
839 if (missing.empty())
840 return;
841
842 wxString names;
843 std::vector<std::string> keys;
844 keys.reserve(missing.size());
845 for (const PluginDescriptor& plugin : missing) {
846 keys.push_back(plugin.plugin_key);
847 names += "\n- ";
848 names += plugin_display_name(plugin.plugin_key);
849 }
850
851 const int result = wxMessageBox(
852 wxString::Format(_L("The following installed plugins were not found on disk:\n%s\n\nRemove them from OrcaSlicer?"), names),
853 _L("Missing Plugins"), wxYES_NO | wxNO_DEFAULT | wxICON_WARNING, this);
855
856 if (result == wxYES)
857 manager.remove_missing_plugins(keys);
858}
wxString plugin_display_name(const std::string &plugin_key) const
Definition PluginsDialog.cpp:1121

References _L, Slic3r::PluginManager::get_missing_plugin_descriptors(), Slic3r::PluginManager::instance(), plugin_display_name(), Slic3r::PluginManager::remove_missing_plugins(), and restore_z_order().

Referenced by install_plugin_package(), and refresh_plugin_metadata_async().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ refresh_plugin_metadata_async()

void Slic3r::GUI::PluginsDialog::refresh_plugin_metadata_async ( const wxString & title,
const wxString & message,
bool fetch_cloud )
private
828{
829 run_with_dialog([fetch_cloud]() { refresh_plugin_metadata_blocking(fetch_cloud); }, [this]() {
831 send_plugins();
832 }, title, message);
833}
void refresh_plugin_metadata_blocking(bool fetch_cloud)
Definition PluginsDialog.cpp:433

References prompt_for_missing_plugins(), Slic3r::GUI::refresh_plugin_metadata_blocking(), run_with_dialog(), and send_plugins().

Referenced by refresh_plugins().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ refresh_plugins()

void Slic3r::GUI::PluginsDialog::refresh_plugins ( )
private
861{
862 BOOST_LOG_TRIVIAL(info) << "Refreshing plugins from Plugins dialog";
863
864 refresh_plugin_metadata_async(_L("Refreshing"), _L("Refreshing plugins data"), kFetchCloudMeta);
865}
void refresh_plugin_metadata_async(const wxString &title, const wxString &message, bool fetch_cloud)
Definition PluginsDialog.cpp:827

References _L, and refresh_plugin_metadata_async().

Referenced by handle_web_command().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ register_theme_user_scripts()

void Slic3r::GUI::WebViewHostDialog::register_theme_user_scripts ( )
protectedinherited
286{
287 if (!m_browser)
288 return;
289 // Added once, at creation. Deliberately no RemoveAllUserScripts() here: the "wx"
290 // script message handler is registered separately (AddScriptMessageHandler), but on
291 // some backends RemoveAllUserScripts() drops it too, which would break
292 // window.wx.postMessage / HandleStudio. Live re-theme goes through apply_theme_live().
293 m_browser->AddUserScript(wxString::FromUTF8(theme_user_script()));
294 if (const nlohmann::json strings = localized_strings(); !strings.is_null())
295 m_browser->AddUserScript(wxString::FromUTF8(localized_strings_script(strings)));
297}
static std::string theme_user_script()
Definition WebViewHostDialog.cpp:93
static std::string localized_strings_script(const nlohmann::json &strings)
Definition WebViewHostDialog.cpp:156
virtual void add_user_scripts()
Definition WebViewHostDialog.hpp:95
virtual nlohmann::json localized_strings() const
Definition WebViewHostDialog.hpp:99

References add_user_scripts(), localized_strings(), localized_strings_script(), m_browser, and theme_user_script().

Referenced by create_webview().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ reinstall_cloud_plugin()

void Slic3r::GUI::PluginsDialog::reinstall_cloud_plugin ( const Slic3r::PluginDescriptor & plugin)
private
1424{
1425 const std::string plugin_key = plugin.plugin_key;
1426 if (plugin_key.empty())
1427 return;
1428
1429 PluginManager& manager = PluginManager::instance();
1430 const bool was_loaded = PluginManager::instance().is_plugin_loaded(plugin_key);
1431
1432 std::string error;
1433 if (plugin.has_local_package()) {
1434 if (!manager.delete_plugin(plugin_key, error)) {
1435 show_status(error.empty() ? _L("Failed to delete plugin.") : from_u8(error), "error");
1436 send_plugins();
1437 return;
1438 }
1439
1440 manager.update_cloud_metadata(std::vector<PluginDescriptor>{as_cloud_only_descriptor(plugin)});
1441 }
1442
1443 if (!install_cloud_plugin(plugin_key, plugin.version, from_u8(plugin.name))) {
1444 send_plugins();
1445 return;
1446 }
1447
1448 if (was_loaded) {
1449 std::pair<bool, std::string> reload_result{false, ""};
1450 try {
1451 reload_result = run_with_dialog_wait(
1452 [plugin_key]() -> std::pair<bool, std::string> {
1453 PluginManager& manager = PluginManager::instance();
1454 manager.load_plugin(plugin_key);
1455 std::string error;
1456 if (!manager.wait_for_plugin_load(plugin_key, std::chrono::minutes(5), error) || !manager.is_plugin_loaded(plugin_key))
1457 return {false, error.empty() ? _u8L("Plugin failed to load.") : error};
1458 return {true, {}};
1459 },
1460 _L("Reloading plugin"), _L("Reloading plugin"));
1461 } catch (const std::exception& ex) {
1462 reload_result = {false, ex.what()};
1463 } catch (...) {
1464 reload_result = {false, _u8L("Unknown plugin reload error.")};
1465 }
1466
1467 if (!reload_result.first) {
1468 show_status(reload_result.second.empty() ? _L("Failed to reload plugin.") : from_u8(reload_result.second), "warn");
1469 send_plugins();
1470 return;
1471 }
1472 }
1473
1474 send_plugins();
1475 show_status(wxString::Format(_L("Reloaded \"%s\"."), plugin_display_name(plugin_key)), "success");
1476}
bool install_cloud_plugin(const std::string &uuid, const std::string &version, const wxString &name)
Definition PluginsDialog.cpp:1079
bool is_plugin_loaded(const std::string &plugin_key) const
Definition PluginManager.cpp:674
std::string version
Definition PluginDescriptor.hpp:58
bool has_local_package() const
Definition PluginDescriptor.hpp:84

References _L, _u8L, Slic3r::PluginManager::delete_plugin(), Slic3r::from_u8(), Slic3r::GUI::from_u8(), Slic3r::PluginDescriptor::has_local_package(), install_cloud_plugin(), Slic3r::PluginManager::instance(), Slic3r::PluginManager::is_plugin_loaded(), Slic3r::PluginManager::load_plugin(), Slic3r::PluginDescriptor::name, plugin_display_name(), Slic3r::PluginDescriptor::plugin_key, reinstall_cloud_plugin(), run_with_dialog_wait(), send_plugins(), show_status(), Slic3r::PluginManager::update_cloud_metadata(), Slic3r::PluginDescriptor::version, and Slic3r::PluginManager::wait_for_plugin_load().

Referenced by handle_plugin_menu_action(), and reinstall_cloud_plugin().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ reload_local_plugin()

void Slic3r::GUI::PluginsDialog::reload_local_plugin ( const std::string & plugin_key,
bool clear_cache )
private
1360{
1361 if (plugin_key.empty())
1362 return;
1363
1364 const bool was_loaded = PluginManager::instance().is_plugin_loaded(plugin_key);
1365 std::pair<bool, std::string> reload_result{false, ""};
1366 try {
1367 reload_result = run_with_dialog_wait(
1368 [plugin_key, was_loaded, clear_cache]() -> std::pair<bool, std::string> {
1369 PluginManager& manager = PluginManager::instance();
1370
1371 boost::filesystem::path cache_dir;
1372 if (clear_cache) {
1373 PluginDescriptor descriptor;
1374 if (!manager.try_get_plugin_descriptor(plugin_key, descriptor))
1375 return {false, _u8L("Plugin not found.")};
1376
1377 boost::filesystem::path resolved_root;
1378 std::string resolve_error;
1380 _u8L("Refusing to clear a plugin cache outside the local plugin directory."),
1381 resolved_root, resolve_error))
1382 return {false, resolve_error};
1383 cache_dir = resolved_root / "__whl_extracted__";
1384 }
1385
1386 if (!manager.unload_plugin(plugin_key))
1387 return {false, _u8L("Failed to unload plugin.")};
1388
1389 if (clear_cache) {
1390 boost::system::error_code ec;
1391 boost::filesystem::remove_all(cache_dir, ec);
1392 if (ec)
1393 return {false, GUI::format(_u8L("Failed to clear plugin cache: %1%"), ec.message())};
1394 }
1395
1396 manager.load_plugin(plugin_key, false);
1397 std::string error;
1398 if (!manager.wait_for_plugin_load(plugin_key, std::chrono::minutes(5), error) || !manager.is_plugin_loaded(plugin_key))
1399 return {false, error.empty() ? _u8L("Plugin failed to load.") : error};
1400
1401 if (!was_loaded && !manager.unload_plugin(plugin_key))
1402 return {false, _u8L("Plugin reloaded, but failed to restore the inactive state.")};
1403
1404 return {true, {}};
1405 },
1406 _L("Reloading plugin"), _L("Reloading plugin"));
1407 } catch (const std::exception& ex) {
1408 reload_result = {false, ex.what()};
1409 } catch (...) {
1410 reload_result = {false, _u8L("Unknown plugin reload error.")};
1411 }
1412
1413 if (!reload_result.first) {
1414 show_status(reload_result.second.empty() ? _L("Failed to reload plugin.") : from_u8(reload_result.second), "warn");
1415 send_plugins();
1416 return;
1417 }
1418
1419 send_plugins();
1420 show_status(wxString::Format(_L("Reloaded \"%s\"."), plugin_display_name(plugin_key)), "success");
1421}
std::string format(const char *fmt, TArgs &&... args)
Definition format.hpp:36
std::string get_orca_plugins_dir()
Definition PluginFsUtils.cpp:41
bool resolve_allowed_plugin_root(const PluginDescriptor &descriptor, const std::vector< std::string > &allowed_dirs, const std::string &out_of_scope_error, boost::filesystem::path &resolved_root, std::string &error)
Definition PluginFsUtils.cpp:85

References _L, _u8L, Slic3r::GUI::format(), Slic3r::from_u8(), Slic3r::get_orca_plugins_dir(), Slic3r::PluginManager::instance(), Slic3r::PluginManager::is_plugin_loaded(), Slic3r::PluginManager::load_plugin(), plugin_display_name(), reload_local_plugin(), Slic3r::resolve_allowed_plugin_root(), run_with_dialog_wait(), send_plugins(), show_status(), Slic3r::PluginManager::try_get_plugin_descriptor(), Slic3r::PluginManager::unload_plugin(), and Slic3r::PluginManager::wait_for_plugin_load().

Referenced by handle_plugin_menu_action(), and reload_local_plugin().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ rescale()

void Slic3r::GUI::DPIAware< wxDialog >::rescale ( const wxRect & suggested_rect)
inlineprivateinherited
265 {
266 this->Freeze();
267
268 m_force_rescale = false;
269
270 // set normal application font as a current window font
271 m_normal_font = this->GetFont();
272
274
275 // rescale missed controls sizes and images
277
278 this->Layout();
279 this->Thaw();
280
281 // reset previous scale factor from current scale factor value
283 }
virtual void on_dpi_changed(const wxRect &suggested_rect)=0
void update_em_unit()
Definition GUI_Utils.hpp:249

◆ resolve_pending_activation()

void Slic3r::GUI::PluginsDialog::resolve_pending_activation ( )
private
697{
698 if (m_activating_plugin_key.empty())
699 return;
700
701 PluginManager& manager = PluginManager::instance();
702 if (manager.is_plugin_load_in_progress(m_activating_plugin_key))
703 return; // Still loading: keep the "Activating..." message until the load resolves.
704
705 const std::string plugin_key = m_activating_plugin_key;
707
708 // Mirror the row's status precedence (Error before Activated) so the message matches the list.
709 PluginDescriptor descriptor;
710 if (get_descriptor(plugin_key, descriptor) && descriptor.has_error())
711 show_status(wxString::Format(_L("Failed to activate \"%s\"."), plugin_display_name(plugin_key)), "error");
712 else if (manager.is_plugin_loaded(plugin_key))
713 show_status(wxString::Format(_L("Activated \"%s\"."), plugin_display_name(plugin_key)), "success");
714 // Otherwise it ended up inactive (toggled off or cancelled mid-load): stay silent.
715}
std::string m_activating_plugin_key
Definition PluginsDialog.hpp:320

References _L, get_descriptor(), Slic3r::PluginDescriptor::has_error(), Slic3r::PluginManager::instance(), Slic3r::PluginManager::is_plugin_load_in_progress(), Slic3r::PluginManager::is_plugin_loaded(), m_activating_plugin_key, plugin_display_name(), and show_status().

Referenced by update_plugin_dialog_ui().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ restore_capability_config()

void Slic3r::GUI::PluginsDialog::restore_capability_config ( const PluginCapabilityId & id)
private
1141{
1142 // Destructive, so confirm first. The confirmation stays here rather than in PluginConfig: it needs
1143 // a parent window.
1144 const int rc = wxMessageBox(wxString::Format(_L("Restore the default configuration for \"%s\"?\n\n"
1145 "This discards the settings currently saved for this capability."),
1146 from_u8(id.name)),
1147 _L("Restore defaults"), wxYES_NO | wxNO_DEFAULT | wxICON_WARNING, this);
1148 if (rc != wxYES)
1149 return;
1150
1151 const nlohmann::json response = PluginConfig::restore_config_response(id);
1152 call_web_handler(response);
1153
1154 if (response.value("ok", false))
1155 show_status(_L("Default configuration restored."), "success");
1156}
void call_web_handler(const nlohmann::json &payload, const wxString &handler=wxT("HandleStudio"))
Definition WebViewHostDialog.cpp:242
static nlohmann::json restore_config_response(const PluginCapabilityId &id)
Definition PluginConfig.cpp:665

References _L, Slic3r::GUI::WebViewHostDialog::call_web_handler(), Slic3r::GUI::from_u8(), Slic3r::PluginConfig::restore_config_response(), and show_status().

Referenced by handle_web_command().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ restore_z_order()

void Slic3r::GUI::PluginsDialog::restore_z_order ( )
private
1023{
1024 // Deferred so it runs on a clean stack after the modal has fully torn down; the
1025 // alive guard covers the dialog being destroyed while the CallAfter is queued.
1026 wxGetApp().CallAfter([this, alive = m_alive]() {
1027 if (alive->load(std::memory_order_acquire) && IsShown())
1028 Raise();
1029 });
1030}

References m_alive.

Referenced by delete_local_plugin(), install_plugin_from_file(), install_plugin_package(), prompt_for_missing_plugins(), run_with_dialog(), run_with_dialog_wait(), and unsubscribe_cloud_plugin().

Here is the caller graph for this function:

◆ run_script()

bool Slic3r::GUI::WebViewHostDialog::run_script ( const wxString & script)
inherited
235{
236 if (!m_browser)
237 return false;
238
239 return WebView::RunScript(m_browser, script);
240}
static bool RunScript(wxWebView *webView, wxString const &msg)
Definition WebView.cpp:491

References m_browser, and WebView::RunScript().

Referenced by apply_theme_live(), call_web_handler(), Slic3r::GUI::ColorPickerDialog::focus_webview(), Slic3r::GUI::ColorPickerDialog::handle_web_command(), and Slic3r::GUI::ColorPickerDialog::send_initial_state().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ run_script_plugin_capability()

void Slic3r::GUI::PluginsDialog::run_script_plugin_capability ( const std::string & plugin_key,
const std::string & capability_name )
private
1159{
1160 PluginManager& manager = PluginManager::instance();
1161
1162 auto complete_with_error = [this, &manager, plugin_key](const std::string& plugin_error, const wxString& status_message) {
1163 const std::string normalized_error = plugin_error.empty() ? _u8L("Script plugin failed.") : plugin_error;
1164 if (!manager.set_plugin_error(plugin_key, normalized_error))
1165 BOOST_LOG_TRIVIAL(warning) << "Failed to record plugin error. plugin_key=" << plugin_key;
1166
1167 if (!manager.unload_plugin(plugin_key))
1168 BOOST_LOG_TRIVIAL(error) << "Failed to unload plugin after script error. plugin_key=" << plugin_key;
1169
1170 send_plugins();
1171
1172 // The row already shows "Error" and the Diagnostics tab holds the full text, so report in the
1173 // footer status bar instead of a modal box.
1174 const wxString message = status_message.empty() ? from_u8(normalized_error) : status_message;
1175 show_status(message, "error");
1176 };
1177
1178 // Always runs on the GUI thread. For a started invocation (sync `def execute` or `async def`)
1179 // the runtime delivers it later; it is called inline here only when the launch itself failed.
1180 auto finish = [this, alive = m_alive, plugin_key, &manager, complete_with_error](const ScriptCompletion& completion) {
1181 if (!alive->load())
1182 return;
1183
1184 // Cancelled by PluginManager (unload/shutdown): expected termination. Report neither an
1185 // error nor a normal success, and do not touch the plugin's error/state.
1186 if (completion.cancelled)
1187 return;
1188
1189 if (!completion.error.empty()) {
1190 complete_with_error(completion.error, wxString());
1191 return;
1192 }
1193
1194 const ExecutionResult& result = completion.result;
1195
1196 BOOST_LOG_TRIVIAL(info) << "Script plugin execution completed. plugin_key=" << plugin_key
1197 << " status=" << static_cast<int>(result.status) << " message=" << result.message
1198 << " data=" << result.data;
1199
1200 const bool failed = result.status == PluginResult::RecoverableError || result.status == PluginResult::FatalError;
1201 if (failed) {
1202 complete_with_error(result.message, wxString());
1203 return;
1204 }
1205
1206 manager.clear_plugin_error(plugin_key);
1207 send_plugins();
1208
1209 const bool skipped = result.status == PluginResult::Skipped;
1210 const wxString fallback = skipped ? _L("Script plugin skipped.") : _L("Script plugin finished.");
1211 const wxString message = result.message.empty() ? fallback : from_u8(result.message);
1212 show_status(message, skipped ? "info" : "success");
1213 };
1214
1215 PluginManager::ScriptLaunchResult launch;
1216 {
1217 wxBusyCursor busy;
1218 launch = manager.launch_script_capability(plugin_key, capability_name, finish);
1219 }
1220
1221 // Every started invocation — a synchronous `def execute` included — completes later through
1222 // `finish`; only a launch failure is reported inline. Return without blocking.
1223 if (!launch.launched_async)
1224 finish(launch.outcome);
1225}
@ RecoverableError
Definition PythonPluginInterface.hpp:105
@ Skipped
Definition PythonPluginInterface.hpp:105
@ FatalError
Definition PythonPluginInterface.hpp:105

References _L, _u8L, Slic3r::PluginManager::clear_plugin_error(), Slic3r::ExecutionResult::data, Slic3r::FatalError, Slic3r::GUI::from_u8(), Slic3r::PluginManager::instance(), Slic3r::PluginManager::launch_script_capability(), Slic3r::PluginManager::ScriptLaunchResult::launched_async, m_alive, Slic3r::ExecutionResult::message, Slic3r::PluginManager::ScriptLaunchResult::outcome, Slic3r::RecoverableError, send_plugins(), Slic3r::PluginManager::set_plugin_error(), show_status(), Slic3r::Skipped, Slic3r::ExecutionResult::status, and Slic3r::PluginManager::unload_plugin().

Referenced by handle_web_command().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ run_with_dialog()

template<typename Run, typename OnFinish>
void Slic3r::GUI::PluginsDialog::run_with_dialog ( Run && run,
OnFinish && on_finish,
const wxString & title,
const wxString & message,
int maximum = 100,
int style = wxPD_APP_MODAL | wxPD_AUTO_HIDE,
bool finish_after_dialog_destroyed = false )
inlineprivate
298 {
299 detail::run_off_thread_with_progress(std::forward<Run>(run), std::forward<OnFinish>(on_finish), this, title, message, maximum, style,
300 m_alive, finish_after_dialog_destroyed, [this] { restore_z_order(); });
301 }
void run_off_thread_with_progress(Run &&run, OnFinish &&on_finish, wxWindow *parent, const wxString &title, const wxString &message, int maximum, int style, std::shared_ptr< std::atomic< bool > > alive, bool finish_after_dialog_destroyed, std::function< void()> restore)
Definition PluginsDialog.hpp:69

References m_alive, restore_z_order(), Slic3r::GUI::detail::run_off_thread_with_progress(), and style.

Referenced by delete_local_plugin(), refresh_plugin_metadata_async(), and unsubscribe_cloud_plugin().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ run_with_dialog_wait()

template<typename Run>
std::invoke_result_t< std::decay_t< Run > & > Slic3r::GUI::PluginsDialog::run_with_dialog_wait ( Run && run,
const wxString & title,
const wxString & message,
int maximum = 100,
int style = wxPD_APP_MODAL | wxPD_AUTO_HIDE )
inlineprivate
309 {
310 return detail::run_wait_with_progress(std::forward<Run>(run), this, title, message, maximum, style, m_alive, [this] { restore_z_order(); });
311 }
std::invoke_result_t< std::decay_t< Run > & > run_wait_with_progress(Run &&run, wxWindow *parent, const wxString &title, const wxString &message, int maximum, int style, std::shared_ptr< std::atomic< bool > > alive, std::function< void()> restore)
Definition PluginsDialog.hpp:132

References m_alive, restore_z_order(), Slic3r::GUI::detail::run_wait_with_progress(), and style.

Referenced by install_cloud_plugin(), reinstall_cloud_plugin(), reload_local_plugin(), and update_plugin().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ save_capability_config()

void Slic3r::GUI::PluginsDialog::save_capability_config ( const PluginCapabilityId & id,
const nlohmann::json & config )
private
1132{
1133 const nlohmann::json response = PluginConfig::save_config_response(id, config);
1134 call_web_handler(response);
1135
1136 if (response.value("ok", false))
1137 show_status(_L("Configuration saved."), "success");
1138}
static nlohmann::json save_config_response(const PluginCapabilityId &id, const nlohmann::json &config)
Definition PluginConfig.cpp:618

References _L, Slic3r::GUI::WebViewHostDialog::call_web_handler(), Slic3r::PluginConfig::save_config_response(), and show_status().

Referenced by handle_web_command().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ scale_factor()

float Slic3r::GUI::DPIAware< wxDialog >::scale_factor ( ) const
inlineinherited
195{ return m_scale_factor; }

◆ send_capability_config()

void Slic3r::GUI::PluginsDialog::send_capability_config ( const PluginCapabilityId & id)
private
static nlohmann::json get_config_response(const PluginCapabilityId &id)
Definition PluginConfig.cpp:560

References Slic3r::GUI::WebViewHostDialog::call_web_handler(), and Slic3r::PluginConfig::get_config_response().

Referenced by handle_web_command().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ send_plugins()

void Slic3r::GUI::PluginsDialog::send_plugins ( )
private
nlohmann::json build_plugins_payload() const
Definition PluginsDialog.cpp:793

References build_plugins_payload(), and Slic3r::GUI::WebViewHostDialog::call_web_handler().

Referenced by delete_local_plugin(), handle_web_command(), install_plugin_package(), refresh_plugin_metadata_async(), reinstall_cloud_plugin(), reload_local_plugin(), run_script_plugin_capability(), set_plugin_sort(), toggle_plugin(), toggle_plugin_capability(), unsubscribe_cloud_plugin(), update_plugin(), and update_plugin_dialog_ui().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ set_em_unit()

void Slic3r::GUI::DPIAware< wxDialog >::set_em_unit ( int v)
inlineinherited
200{ m_em_unit = v; }

◆ set_open_terminal_dlg_fn()

void Slic3r::GUI::PluginsDialog::set_open_terminal_dlg_fn ( )
684{
685 m_open_terminal_dlg_fn = [] { wxGetApp().open_terminal_dialog(); };
686}

References m_open_terminal_dlg_fn.

◆ set_plugin_sort()

void Slic3r::GUI::PluginsDialog::set_plugin_sort ( const std::string & sort_key,
const std::string & sort_order )
private
787{
790 send_plugins();
791}
PluginSortOrder plugin_sort_order_from_string(const std::string &sort_order, PluginSortOrder fallback)
Definition PluginSort.hpp:68
PluginSortKey plugin_sort_key_from_string(const std::string &sort_key, PluginSortKey fallback)
Definition PluginSort.hpp:53

References m_plugin_sort_key, m_plugin_sort_order, Slic3r::GUI::plugin_sort_key_from_string(), Slic3r::GUI::plugin_sort_order_from_string(), and send_plugins().

Referenced by handle_web_command().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ set_prev_scale_factor()

void Slic3r::GUI::DPIAware< wxDialog >::set_prev_scale_factor ( float v)
inlineinherited

◆ set_scale_factor()

void Slic3r::GUI::DPIAware< wxDialog >::set_scale_factor ( float v)
inlineinherited
198{ m_scale_factor = v; }

◆ show_status()

void Slic3r::GUI::PluginsDialog::show_status ( const wxString & message,
const char * level )
private
1113{
1114 nlohmann::json payload;
1115 payload["command"] = "status_message";
1116 payload["level"] = level;
1117 payload["message"] = into_u8(message);
1118 call_web_handler(payload);
1119}

References Slic3r::GUI::WebViewHostDialog::call_web_handler(), and Slic3r::GUI::into_u8().

Referenced by delete_local_plugin(), install_cloud_plugin(), install_plugin_package(), open_plugin_folder(), reinstall_cloud_plugin(), reload_local_plugin(), resolve_pending_activation(), restore_capability_config(), run_script_plugin_capability(), save_capability_config(), toggle_plugin(), toggle_plugin_capability(), unsubscribe_cloud_plugin(), and update_plugin().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ShowModal()

◆ theme_apply_script()

std::string Slic3r::GUI::WebViewHostDialog::theme_apply_script ( )
staticinherited
88{ return host_theme_apply_js(); }

Referenced by Slic3r::GUI::WebPanel::apply_theme().

Here is the caller graph for this function:

◆ theme_user_script()

std::string Slic3r::GUI::WebViewHostDialog::theme_user_script ( )
staticinherited
94{
95 const std::string style = "<style id=\"orca-host-theme-vars\">" + host_theme_vars_css() + "</style>";
97 style, "orca-host-theme-vars", "afterbegin",
98 "window.__orcaHostThemed=true;var theme=\"" + host_theme_name() + "\";",
99 "if(document.documentElement)document.documentElement.setAttribute('data-orca-theme',theme);");
100}
std::string host_theme_vars_css()
Definition WebViewHostDialog.cpp:40
std::string host_theme_name()
Definition WebViewHostDialog.cpp:35

References document_start_injector(), and style.

Referenced by Slic3r::GUI::WebPanel::WebPanel(), and register_theme_user_scripts().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ toggle_plugin()

void Slic3r::GUI::PluginsDialog::toggle_plugin ( const std::string & plugin_key,
bool enabled )
private
868{
869 if (plugin_key.empty())
870 return;
871
872 BOOST_LOG_TRIVIAL(info) << "Toggle plugin request. plugin_key=" << plugin_key << " enabled=" << enabled;
873
874 PluginDescriptor row_data;
875 if (!get_descriptor(plugin_key, row_data)) {
876 send_plugins();
877 return;
878 }
879
880 PluginDialogItem dialog_item = build_plugin_dialog_item(row_data);
881 PluginAvailableActions available_actions = dialog_item.available_actions;
882
883 PluginManager& manager = PluginManager::instance();
884 if (!enabled) {
885 if (!manager.unload_plugin(plugin_key)) {
886 BOOST_LOG_TRIVIAL(error) << "Failed to unload plugin from Plugins dialog: " << plugin_key;
887 show_status(_L("Failed to unload plugin."), "warn");
888 send_plugins();
889 return;
890 }
891
892 BOOST_LOG_TRIVIAL(info) << "Plugin unloaded from Plugins dialog: " << plugin_key;
893 // A user-disabled plugin has no meaningful error state.
894 if (!manager.clear_plugin_error(plugin_key))
895 BOOST_LOG_TRIVIAL(warning) << "Failed to clear plugin error for " << plugin_key << " (failed to find)";
896 // A prior activation of this plugin is moot now; drop it so no stale "Activated" arrives later.
897 if (m_activating_plugin_key == plugin_key)
899 send_plugins();
900 show_status(wxString::Format(_L("Deactivated \"%s\"."), plugin_display_name(plugin_key)), "success");
901 return;
902 }
903
904 if (!available_actions.can_toggle) {
905 if (dialog_item.unauthorized && available_actions.toggle_installs_cloud_plugin == false && row_data.has_local_package() == false) {
906 const std::string install_error = _u8L("Unauthorized cloud plugins cannot be installed.");
907 manager.set_plugin_error(plugin_key, install_error);
908 show_status(from_u8(install_error), "warn");
909 }
910 send_plugins();
911 return;
912 }
913
914 if (available_actions.toggle_installs_cloud_plugin) {
915 if (!install_cloud_plugin(row_data.plugin_key, row_data.version, from_u8(row_data.name))) {
916 BOOST_LOG_TRIVIAL(warning) << "Cloud plugin install was not completed for " << plugin_key;
917 send_plugins();
918 return;
919 }
920
921 BOOST_LOG_TRIVIAL(info) << "Cloud plugin installed locally from Plugins dialog: " << plugin_key;
922 // download_and_install_cloud_plugin already updated the descriptor, so no rescan is needed here.
923 if (!get_descriptor(plugin_key, row_data)) {
924 send_plugins();
925 return;
926 }
927 dialog_item = build_plugin_dialog_item(row_data);
928 if (dialog_item.has_error) {
929 send_plugins();
930 return;
931 }
932 }
933
934 if (manager.is_plugin_loaded(plugin_key)) {
935 send_plugins();
936 return;
937 }
938
939 PluginDescriptor valid_descriptor;
940 if (!manager.try_get_valid_plugin_descriptor(plugin_key, valid_descriptor)) {
941 show_status(_L("Plugin manifest was not found."), "warn");
942 send_plugins();
943 return;
944 }
945
946 if (manager.is_plugin_load_in_progress(plugin_key)) {
947 send_plugins();
948 return;
949 }
950
951 BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << ": Starting plugin load from web dialog: " << plugin_key;
952 manager.load_plugin(plugin_key);
953 send_plugins();
954 // Loading is asynchronous: show a pending message now; resolve_pending_activation() turns it into
955 // Activated/Failed once the loader's completion callback runs update_plugin_dialog_ui().
956 m_activating_plugin_key = plugin_key;
957 show_status(wxString::Format(_L("Activating \"%s\"..."), plugin_display_name(plugin_key)), "info");
958}

References _L, _u8L, Slic3r::PluginManager::clear_plugin_error(), Slic3r::GUI::from_u8(), get_descriptor(), Slic3r::PluginDescriptor::has_local_package(), install_cloud_plugin(), Slic3r::PluginManager::instance(), Slic3r::PluginManager::is_plugin_load_in_progress(), Slic3r::PluginManager::is_plugin_loaded(), Slic3r::PluginManager::load_plugin(), m_activating_plugin_key, Slic3r::PluginDescriptor::name, plugin_display_name(), Slic3r::PluginDescriptor::plugin_key, send_plugins(), Slic3r::PluginManager::set_plugin_error(), show_status(), Slic3r::PluginManager::try_get_valid_plugin_descriptor(), Slic3r::PluginManager::unload_plugin(), and Slic3r::PluginDescriptor::version.

Referenced by handle_web_command().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ toggle_plugin_capability()

void Slic3r::GUI::PluginsDialog::toggle_plugin_capability ( const std::string & plugin_key,
PluginCapabilityType type,
const std::string & capability_name,
bool enabled )
private
964{
965 if (plugin_key.empty() || capability_name.empty() || type == PluginCapabilityType::Unknown)
966 return;
967
968 PluginDescriptor row_data;
969 if (!get_descriptor(plugin_key, row_data)) {
970 send_plugins();
971 return;
972 }
973
974 if (!PluginManager::instance().get_plugin_capability({type, capability_name, plugin_key}, /*only_enabled=*/false)) {
975 BOOST_LOG_TRIVIAL(warning) << "Cannot toggle missing plugin capability: " << plugin_key << " | " << capability_name;
976 send_plugins();
977 return;
978 }
979
980 PluginManager& manager = PluginManager::instance();
981 if (enabled) {
982 BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << ": Enabling plugin capability: " << plugin_key << " | " << capability_name;
983 manager.set_capability_enabled({type, capability_name, plugin_key}, true);
984 } else {
985 // check if the capability is currently in use here.
986 BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << ": Disabling plugin capability: " << plugin_key << " | " << capability_name;
987 manager.set_capability_enabled({type, capability_name, plugin_key}, false);
988 }
989
990 send_plugins();
991 show_status(wxString::Format(enabled ? _L("Enabled \"%s\".") : _L("Disabled \"%s\"."), from_u8(capability_name)), "success");
992}
@ Unknown
Definition PythonPluginInterface.hpp:17

References _L, Slic3r::GUI::from_u8(), get_descriptor(), Slic3r::PluginManager::instance(), send_plugins(), Slic3r::PluginManager::set_capability_enabled(), show_status(), and Slic3r::Unknown.

Referenced by handle_web_command().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ unsubscribe_cloud_plugin()

void Slic3r::GUI::PluginsDialog::unsubscribe_cloud_plugin ( const Slic3r::PluginDescriptor & plugin)
private
1329{
1330 const wxString plugin_name = from_u8(plugin.name);
1331 const int rc = wxMessageBox(
1332 wxString::Format(_L("Unsubscribe plugin \"%s\"?\n\nThis will stop tracking the plugin and delete any local plugin files."),
1333 plugin_name),
1334 kUnsubscribeTitle, wxYES_NO | wxNO_DEFAULT | wxICON_WARNING, this);
1336 if (rc != wxYES)
1337 return;
1338
1339 auto state = std::make_shared<PluginOperationState>();
1341 [plugin_key = plugin.plugin_key, state]() {
1342 std::string error;
1343 const bool succeeded = PluginManager::instance().delete_and_unsubscribe_cloud_plugin(plugin_key, error);
1344 store_plugin_operation_result(state, succeeded, std::move(error));
1345 },
1346 [this, state, plugin_name]() {
1347 std::string error;
1348 if (!take_plugin_operation_result(state, error)) {
1349 show_status(error.empty() ? _L("Failed to unsubscribe plugin.") : from_u8(error), "error");
1350 return;
1351 }
1352
1353 send_plugins();
1354 show_status(wxString::Format(_L("Unsubscribed \"%s\"."), plugin_name), "success");
1355 },
1356 _L("Unsubscribing plugin"), _L("Deleting local files and unsubscribing plugin..."));
1357}

References _L, Slic3r::GUI::from_u8(), Slic3r::PluginDescriptor::name, Slic3r::PluginDescriptor::plugin_key, restore_z_order(), run_with_dialog(), send_plugins(), and show_status().

Referenced by handle_plugin_menu_action().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ update_em_unit()

void Slic3r::GUI::DPIAware< wxDialog >::update_em_unit ( )
inlineprivateinherited
250 {
251 // Linux specific issue : get_dpi_for_window(this) still doesn't responce to the Display's scale in new wxWidgets(3.1.3).
252 // So, calculate the m_em_unit value from the font size, as before
253#if !defined(__WXGTK__)
255#else
256 // initialize default width_unit according to the width of the one symbol ("m") of the currently active font of this window.
257 m_em_unit = std::max<size_t>(10, this->GetTextExtent("m").x - 1);
258#endif // __WXGTK__
259 }

◆ update_plugin()

void Slic3r::GUI::PluginsDialog::update_plugin ( const std::string & plugin_key)
private
1228{
1229 if (plugin_key.empty())
1230 return;
1231
1232 BOOST_LOG_TRIVIAL(info) << "Updating cloud plugin. plugin_key=" << plugin_key;
1233
1234 PluginDescriptor descriptor;
1235 const wxString name = get_descriptor(plugin_key, descriptor) ? from_u8(descriptor.name) : from_u8(plugin_key);
1236
1237 // update_cloud_plugin unloads the old plugin, deletes its local package and reinstalls the latest
1238 // version; all of that is off-main-thread work, so run it on the worker behind a progress dialog.
1239 std::string error;
1240 bool updated = false;
1241 try {
1242 updated = run_with_dialog_wait([plugin_key, &error]() { return PluginManager::instance().update_cloud_plugin(plugin_key, error); },
1243 _L("Updating plugin"), _L("Updating") + ": " + name);
1244 } catch (const std::exception& ex) {
1245 error = ex.what();
1246 } catch (...) {
1247 error = _u8L("Unknown error");
1248 }
1249
1250 if (!updated) {
1251 BOOST_LOG_TRIVIAL(error) << "Cloud plugin update failed. plugin_key=" << plugin_key << " error=" << error;
1252 show_status(error.empty() ? _L("Failed to update plugin.") : from_u8(error), "error");
1253 send_plugins();
1254 return;
1255 }
1256
1257 // update_cloud_plugin already updated the in-memory descriptor, so a UI refresh is enough here.
1258 send_plugins();
1259 show_status(wxString::Format(_L("Updated \"%s\"."), name), "success");
1260}
bool update_cloud_plugin(const std::string &plugin_key, std::string &error, std::string version="")
Definition PluginManager.cpp:1806

References _L, _u8L, Slic3r::GUI::from_u8(), get_descriptor(), Slic3r::PluginManager::instance(), Slic3r::PluginDescriptor::name, run_with_dialog_wait(), send_plugins(), show_status(), and Slic3r::PluginManager::update_cloud_plugin().

Referenced by handle_web_command().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ update_plugin_dialog_ui()

void Slic3r::GUI::PluginsDialog::update_plugin_dialog_ui ( )
689{
690 // Called after the any metadata is already updated, for example from the
691 // cloud-plugin state callback. Do not fetch here or the callback can re-enter.
692 send_plugins();
694}
void resolve_pending_activation()
Definition PluginsDialog.cpp:696

References resolve_pending_activation(), and send_plugins().

Referenced by Slic3r::GUI::GUI_App::init_plugin_gui_wiring().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ m_activating_plugin_key

std::string Slic3r::GUI::PluginsDialog::m_activating_plugin_key
private

◆ m_alive

std::shared_ptr<std::atomic<bool> > Slic3r::GUI::PluginsDialog::m_alive = std::make_shared<std::atomic<bool>>(true)
private

◆ m_browser

wxWebView* Slic3r::GUI::WebViewHostDialog::m_browser {nullptr}
privateinherited

◆ m_can_rescale

bool Slic3r::GUI::DPIAware< wxDialog >::m_can_rescale
privateinherited
235{ true };

◆ m_em_unit

int Slic3r::GUI::DPIAware< wxDialog >::m_em_unit
privateinherited

◆ m_force_rescale

bool Slic3r::GUI::DPIAware< wxDialog >::m_force_rescale
privateinherited
236{ false };

◆ m_new_font_point_size

int Slic3r::GUI::DPIAware< wxDialog >::m_new_font_point_size
privateinherited

◆ m_normal_font

wxFont Slic3r::GUI::DPIAware< wxDialog >::m_normal_font
privateinherited

◆ m_open_terminal_dlg_fn

std::function<void()> Slic3r::GUI::PluginsDialog::m_open_terminal_dlg_fn
private

◆ m_plugin_sort_key

PluginSortKey Slic3r::GUI::PluginsDialog::m_plugin_sort_key = PluginSortKey::None
private

◆ m_plugin_sort_order

PluginSortOrder Slic3r::GUI::PluginsDialog::m_plugin_sort_order = PluginSortOrder::Asc
private

◆ m_prev_scale_factor

float Slic3r::GUI::DPIAware< wxDialog >::m_prev_scale_factor
privateinherited

◆ m_scale_factor

float Slic3r::GUI::DPIAware< wxDialog >::m_scale_factor
privateinherited

The documentation for this class was generated from the following files: