mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-09-26 11:53:12 +08:00
Create Printables tab
This commit is contained in:
parent
da79ad4937
commit
e8de4b7199
@ -803,6 +803,7 @@ void MainFrame::create_preset_tabs()
|
|||||||
|
|
||||||
m_connect_webview = new ConnectWebViewPanel(m_tabpanel);
|
m_connect_webview = new ConnectWebViewPanel(m_tabpanel);
|
||||||
m_printer_webview = new PrinterWebViewPanel(m_tabpanel, L"");
|
m_printer_webview = new PrinterWebViewPanel(m_tabpanel, L"");
|
||||||
|
m_printables_webview = new WebViewPanel(m_tabpanel, GUI::from_u8("https://www.printables.com"), { "_prusaSlicer" });
|
||||||
// new created tabs have to be hidden by default
|
// new created tabs have to be hidden by default
|
||||||
m_connect_webview->Hide();
|
m_connect_webview->Hide();
|
||||||
m_printer_webview->Hide();
|
m_printer_webview->Hide();
|
||||||
@ -849,6 +850,33 @@ void MainFrame::show_connect_tab(const wxString& url)
|
|||||||
m_connect_webview->load_url(url);
|
m_connect_webview->load_url(url);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainFrame::add_printables_webview_tab()
|
||||||
|
{
|
||||||
|
if (m_printables_webview_added) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
int n = m_tabpanel->FindPage(m_connect_webview) + 1;
|
||||||
|
wxWindow* page = m_printables_webview;
|
||||||
|
const wxString text(L"Printables");
|
||||||
|
const std::string bmp_name = "";
|
||||||
|
bool bSelect = false;
|
||||||
|
m_tabpanel->InsertNewPage(n, page, text, bmp_name, bSelect);
|
||||||
|
m_printables_webview->load_default_url_delayed();
|
||||||
|
m_printables_webview_added = true;
|
||||||
|
}
|
||||||
|
void MainFrame::remove_printables_webview_tab()
|
||||||
|
{
|
||||||
|
if (!m_printables_webview_added) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
int n = m_tabpanel->FindPage(m_printables_webview);
|
||||||
|
if (m_tabpanel->GetSelection() == n)
|
||||||
|
m_tabpanel->SetSelection(0);
|
||||||
|
m_tabpanel->RemovePage(size_t(n));
|
||||||
|
m_printables_webview_added = false;
|
||||||
|
}
|
||||||
|
|
||||||
void MainFrame::show_printer_webview_tab(DynamicPrintConfig* dpc)
|
void MainFrame::show_printer_webview_tab(DynamicPrintConfig* dpc)
|
||||||
{
|
{
|
||||||
// if physical printer is selected
|
// if physical printer is selected
|
||||||
|
@ -47,6 +47,7 @@ class PreferencesDialog;
|
|||||||
class GalleryDialog;
|
class GalleryDialog;
|
||||||
class ConnectWebViewPanel;
|
class ConnectWebViewPanel;
|
||||||
class PrinterWebViewPanel;
|
class PrinterWebViewPanel;
|
||||||
|
class WebViewPanel;
|
||||||
|
|
||||||
enum QuickSlice
|
enum QuickSlice
|
||||||
{
|
{
|
||||||
@ -98,10 +99,12 @@ class MainFrame : public DPIFrame
|
|||||||
size_t m_last_selected_tab;
|
size_t m_last_selected_tab;
|
||||||
Search::OptionsSearcher m_searcher;
|
Search::OptionsSearcher m_searcher;
|
||||||
|
|
||||||
ConnectWebViewPanel* m_connect_webview{ nullptr };
|
ConnectWebViewPanel* m_connect_webview{ nullptr };
|
||||||
bool m_connect_webview_added{ false };
|
bool m_connect_webview_added{ false };
|
||||||
PrinterWebViewPanel* m_printer_webview{ nullptr };
|
WebViewPanel* m_printables_webview{ nullptr };
|
||||||
bool m_printer_webview_added{ false };
|
bool m_printables_webview_added{ false };
|
||||||
|
PrinterWebViewPanel* m_printer_webview{ nullptr };
|
||||||
|
bool m_printer_webview_added{ false };
|
||||||
|
|
||||||
std::string get_base_name(const wxString &full_name, const char *extension = nullptr) const;
|
std::string get_base_name(const wxString &full_name, const char *extension = nullptr) const;
|
||||||
std::string get_dir_name(const wxString &full_name) const;
|
std::string get_dir_name(const wxString &full_name) const;
|
||||||
@ -218,6 +221,9 @@ public:
|
|||||||
void remove_connect_webview_tab();
|
void remove_connect_webview_tab();
|
||||||
void show_connect_tab(const wxString &url);
|
void show_connect_tab(const wxString &url);
|
||||||
|
|
||||||
|
void add_printables_webview_tab();
|
||||||
|
void remove_printables_webview_tab();
|
||||||
|
|
||||||
void show_printer_webview_tab(DynamicPrintConfig* dpc);
|
void show_printer_webview_tab(DynamicPrintConfig* dpc);
|
||||||
|
|
||||||
void add_printer_webview_tab(const wxString& url);
|
void add_printer_webview_tab(const wxString& url);
|
||||||
|
@ -921,6 +921,7 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame)
|
|||||||
this->notification_manager->close_notification_of_type(NotificationType::UserAccountID);
|
this->notification_manager->close_notification_of_type(NotificationType::UserAccountID);
|
||||||
this->notification_manager->push_notification(NotificationType::UserAccountID, NotificationManager::NotificationLevel::ImportantNotificationLevel, text);
|
this->notification_manager->push_notification(NotificationType::UserAccountID, NotificationManager::NotificationLevel::ImportantNotificationLevel, text);
|
||||||
this->main_frame->remove_connect_webview_tab();
|
this->main_frame->remove_connect_webview_tab();
|
||||||
|
this->main_frame->remove_printables_webview_tab();
|
||||||
this->main_frame->refresh_account_menu(true);
|
this->main_frame->refresh_account_menu(true);
|
||||||
// Update sidebar printer status
|
// Update sidebar printer status
|
||||||
sidebar->update_printer_presets_combobox();
|
sidebar->update_printer_presets_combobox();
|
||||||
@ -946,6 +947,7 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame)
|
|||||||
this->notification_manager->push_notification(NotificationType::UserAccountID, NotificationManager::NotificationLevel::ImportantNotificationLevel, text);
|
this->notification_manager->push_notification(NotificationType::UserAccountID, NotificationManager::NotificationLevel::ImportantNotificationLevel, text);
|
||||||
}
|
}
|
||||||
this->main_frame->add_connect_webview_tab();
|
this->main_frame->add_connect_webview_tab();
|
||||||
|
this->main_frame->add_printables_webview_tab();
|
||||||
// Update User name in TopBar
|
// Update User name in TopBar
|
||||||
this->main_frame->refresh_account_menu();
|
this->main_frame->refresh_account_menu();
|
||||||
wxGetApp().update_wizard_login_page();
|
wxGetApp().update_wizard_login_page();
|
||||||
@ -959,6 +961,7 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame)
|
|||||||
this->notification_manager->close_notification_of_type(NotificationType::UserAccountID);
|
this->notification_manager->close_notification_of_type(NotificationType::UserAccountID);
|
||||||
this->notification_manager->push_notification(NotificationType::UserAccountID, NotificationManager::NotificationLevel::WarningNotificationLevel, _u8L("Failed to connect to Prusa Account."));
|
this->notification_manager->push_notification(NotificationType::UserAccountID, NotificationManager::NotificationLevel::WarningNotificationLevel, _u8L("Failed to connect to Prusa Account."));
|
||||||
this->main_frame->remove_connect_webview_tab();
|
this->main_frame->remove_connect_webview_tab();
|
||||||
|
this->main_frame->remove_printables_webview_tab();
|
||||||
// Update User name in TopBar
|
// Update User name in TopBar
|
||||||
this->main_frame->refresh_account_menu(true);
|
this->main_frame->refresh_account_menu(true);
|
||||||
// Update sidebar printer status
|
// Update sidebar printer status
|
||||||
@ -972,6 +975,7 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame)
|
|||||||
this->notification_manager->close_notification_of_type(NotificationType::UserAccountID);
|
this->notification_manager->close_notification_of_type(NotificationType::UserAccountID);
|
||||||
this->notification_manager->push_notification(NotificationType::UserAccountID, NotificationManager::NotificationLevel::WarningNotificationLevel, _u8L("Failed to connect to Prusa Account."));
|
this->notification_manager->push_notification(NotificationType::UserAccountID, NotificationManager::NotificationLevel::WarningNotificationLevel, _u8L("Failed to connect to Prusa Account."));
|
||||||
this->main_frame->remove_connect_webview_tab();
|
this->main_frame->remove_connect_webview_tab();
|
||||||
|
this->main_frame->remove_printables_webview_tab();
|
||||||
// Update User name in TopBar
|
// Update User name in TopBar
|
||||||
this->main_frame->refresh_account_menu(true);
|
this->main_frame->refresh_account_menu(true);
|
||||||
// Update sidebar printer status
|
// Update sidebar printer status
|
||||||
|
Loading…
x
Reference in New Issue
Block a user