mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-06-22 22:31:10 +08:00
Merge branch 'dk_notifications'
This commit is contained in:
commit
b45ae0170b
@ -40,8 +40,8 @@
|
|||||||
# hypertext_type = gallery
|
# hypertext_type = gallery
|
||||||
#
|
#
|
||||||
#Open top menubar item
|
#Open top menubar item
|
||||||
#hypertext_menubar_menu_id = 4 (0 - 5, index of menu from left: File = 0, Edit = 1...)
|
#hypertext_menubar_menu_name = (Name in english visible as menu name: File, )
|
||||||
#hypertext_menubar_item_id = 1 (index of item, starting at 0, Including separators! In Window: 0 = Plater Tab, 1 = SEPARATOR, 2 = Print Setting Tab...)
|
#hypertext_menubar_item_name = (Name of item in english, if there are three dots at the end of name, put name without three dots)
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
# Each notification can have disabled and enabled modes and techs - divided by ; and space
|
# Each notification can have disabled and enabled modes and techs - divided by ; and space
|
||||||
@ -196,9 +196,9 @@ disabled_tags = SLA
|
|||||||
[hint:Configuration snapshots]
|
[hint:Configuration snapshots]
|
||||||
text = Configuration snapshots\nDid you know that roll back to a complete backup of all system and user profiles? You can view and move back and forth between snapshots using the Configuration - Configuration snapshots menu.
|
text = Configuration snapshots\nDid you know that roll back to a complete backup of all system and user profiles? You can view and move back and forth between snapshots using the Configuration - Configuration snapshots menu.
|
||||||
documentation_link = https://help.prusa3d.com/en/article/configuration-snapshots_1776
|
documentation_link = https://help.prusa3d.com/en/article/configuration-snapshots_1776
|
||||||
#hypertext_type = menubar
|
hypertext_type = menubar
|
||||||
#hypertext_menubar_menu_id = 4
|
hypertext_menubar_menu_name = Configuration
|
||||||
#hypertext_menubar_item_id = 1
|
hypertext_menubar_item_name = Configuration Snapshots
|
||||||
|
|
||||||
[hint:Minimum wall thickness]
|
[hint:Minimum wall thickness]
|
||||||
text = Minimum wall thickness\nDid you know that instead of the number of top and bottom layers, you can define the<a>Minimum shell thickness</a>in millimeters? This feature is especially useful when using the variable layer height function.
|
text = Minimum wall thickness\nDid you know that instead of the number of top and bottom layers, you can define the<a>Minimum shell thickness</a>in millimeters? This feature is especially useful when using the variable layer height function.
|
||||||
|
@ -242,6 +242,13 @@ HintDatabase::~HintDatabase()
|
|||||||
write_used_binary(m_used_ids);
|
write_used_binary(m_used_ids);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
void HintDatabase::uninit()
|
||||||
|
{
|
||||||
|
if (m_initialized) {
|
||||||
|
write_used_binary(m_used_ids);
|
||||||
|
}
|
||||||
|
m_initialized = false;
|
||||||
|
}
|
||||||
void HintDatabase::init()
|
void HintDatabase::init()
|
||||||
{
|
{
|
||||||
load_hints_from_file(std::move(boost::filesystem::path(resources_dir()) / "data" / "hints.ini"));
|
load_hints_from_file(std::move(boost::filesystem::path(resources_dir()) / "data" / "hints.ini"));
|
||||||
@ -379,9 +386,9 @@ void HintDatabase::load_hints_from_file(const boost::filesystem::path& path)
|
|||||||
wxGetApp().obj_list()->load_shape_object_from_gallery(); }
|
wxGetApp().obj_list()->load_shape_object_from_gallery(); }
|
||||||
};
|
};
|
||||||
m_loaded_hints.emplace_back(hint_data);
|
m_loaded_hints.emplace_back(hint_data);
|
||||||
} /*else if (dict["hypertext_type"] == "menubar") {
|
} else if (dict["hypertext_type"] == "menubar") {
|
||||||
int menu = std::atoi(dict["hypertext_menubar_menu_id"].c_str());
|
wxString menu(_L("&" + dict["hypertext_menubar_menu_name"]));
|
||||||
int item = std::atoi(dict["hypertext_menubar_item_id"].c_str());
|
wxString item(_L(dict["hypertext_menubar_item_name"]));
|
||||||
HintData hint_data{ id_string, text1, weight, was_displayed, hypertext_text, follow_text, disabled_tags, enabled_tags, true, documentation_link, [menu, item]() { wxGetApp().mainframe->open_menubar_item(menu, item); } };
|
HintData hint_data{ id_string, text1, weight, was_displayed, hypertext_text, follow_text, disabled_tags, enabled_tags, true, documentation_link, [menu, item]() { wxGetApp().mainframe->open_menubar_item(menu, item); } };
|
||||||
m_loaded_hints.emplace_back(hint_data);
|
m_loaded_hints.emplace_back(hint_data);
|
||||||
}*/
|
}*/
|
||||||
|
@ -47,6 +47,9 @@ public:
|
|||||||
return 0;
|
return 0;
|
||||||
return m_loaded_hints.size();
|
return m_loaded_hints.size();
|
||||||
}
|
}
|
||||||
|
// resets m_initiailized to false and writes used if was initialized
|
||||||
|
// used when reloading in runtime - like change language
|
||||||
|
void uninit();
|
||||||
private:
|
private:
|
||||||
void init();
|
void init();
|
||||||
void load_hints_from_file(const boost::filesystem::path& path);
|
void load_hints_from_file(const boost::filesystem::path& path);
|
||||||
|
@ -1480,29 +1480,34 @@ void MainFrame::init_menubar_as_editor()
|
|||||||
if (plater()->printer_technology() == ptSLA)
|
if (plater()->printer_technology() == ptSLA)
|
||||||
update_menubar();
|
update_menubar();
|
||||||
}
|
}
|
||||||
/*
|
|
||||||
void MainFrame::open_menubar_item(int menu_index, int item_index)
|
void MainFrame::open_menubar_item(const wxString& menu_name,const wxString& item_name)
|
||||||
{
|
{
|
||||||
if (m_menubar == nullptr)
|
if (m_menubar == nullptr)
|
||||||
return;
|
return;
|
||||||
|
// Get menu object from menubar
|
||||||
|
int menu_index = m_menubar->FindMenu(menu_name);
|
||||||
wxMenu* menu = m_menubar->GetMenu(menu_index);
|
wxMenu* menu = m_menubar->GetMenu(menu_index);
|
||||||
if (menu == nullptr) {
|
if (menu == nullptr) {
|
||||||
BOOST_LOG_TRIVIAL(error) << "Mainframe open_menubar_item function couldn't find menu: " << menu_index;
|
BOOST_LOG_TRIVIAL(error) << "Mainframe open_menubar_item function couldn't find menu: " << menu_name;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
wxMenuItemList items = menu->GetMenuItems();
|
// Get item id from menu
|
||||||
if (items.size() <= item_index) {
|
int item_id = menu->FindItem(item_name);
|
||||||
BOOST_LOG_TRIVIAL(error) << "Mainframe open_menubar_item function couldn't find item: " << item_index;
|
if (item_id == wxNOT_FOUND)
|
||||||
|
{
|
||||||
|
// try adding three dots char
|
||||||
|
item_id = menu->FindItem(item_name + dots);
|
||||||
|
}
|
||||||
|
if (item_id == wxNOT_FOUND)
|
||||||
|
{
|
||||||
|
BOOST_LOG_TRIVIAL(error) << "Mainframe open_menubar_item function couldn't find item: " << item_name;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
wxMenuItem* item = items[item_index];
|
// wxEVT_MENU will trigger item
|
||||||
if (item == nullptr) {
|
wxPostEvent((wxEvtHandler*)menu, wxCommandEvent(wxEVT_MENU, item_id));
|
||||||
BOOST_LOG_TRIVIAL(error) << "Mainframe open_menubar_item function couldn't find item: " << item_index;
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
wxPostEvent((wxEvtHandler*)menu, wxCommandEvent(wxEVT_MENU, item->GetId()));
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
void MainFrame::init_menubar_as_gcodeviewer()
|
void MainFrame::init_menubar_as_gcodeviewer()
|
||||||
{
|
{
|
||||||
wxMenu* fileMenu = new wxMenu;
|
wxMenu* fileMenu = new wxMenu;
|
||||||
|
@ -158,8 +158,8 @@ public:
|
|||||||
void init_menubar_as_editor();
|
void init_menubar_as_editor();
|
||||||
void init_menubar_as_gcodeviewer();
|
void init_menubar_as_gcodeviewer();
|
||||||
void update_menubar();
|
void update_menubar();
|
||||||
// Open item in menu by menu and item index (visible order of items including separators)
|
// Open item in menu by menu and item name (in actual language)
|
||||||
//void open_menubar_item(int menu_index, int item_index);
|
void open_menubar_item(const wxString& menu_name,const wxString& item_name);
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
void show_tabs_menu(bool show);
|
void show_tabs_menu(bool show);
|
||||||
#endif
|
#endif
|
||||||
|
@ -1107,6 +1107,10 @@ NotificationManager::NotificationManager(wxEvtHandler* evt_handler) :
|
|||||||
m_evt_handler(evt_handler)
|
m_evt_handler(evt_handler)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
NotificationManager::~NotificationManager()
|
||||||
|
{
|
||||||
|
HintDatabase::get_instance().uninit();
|
||||||
|
}
|
||||||
void NotificationManager::push_notification(const NotificationType type, int timestamp)
|
void NotificationManager::push_notification(const NotificationType type, int timestamp)
|
||||||
{
|
{
|
||||||
auto it = std::find_if(std::begin(basic_notifications), std::end(basic_notifications),
|
auto it = std::find_if(std::begin(basic_notifications), std::end(basic_notifications),
|
||||||
|
@ -121,6 +121,7 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
NotificationManager(wxEvtHandler* evt_handler);
|
NotificationManager(wxEvtHandler* evt_handler);
|
||||||
|
~NotificationManager();
|
||||||
|
|
||||||
// Push a prefabricated notification from basic_notifications (see the table at the end of this file).
|
// Push a prefabricated notification from basic_notifications (see the table at the end of this file).
|
||||||
void push_notification(const NotificationType type, int timestamp = 0);
|
void push_notification(const NotificationType type, int timestamp = 0);
|
||||||
|
@ -2073,6 +2073,8 @@ Plater::priv::~priv()
|
|||||||
{
|
{
|
||||||
if (config != nullptr)
|
if (config != nullptr)
|
||||||
delete config;
|
delete config;
|
||||||
|
if (notification_manager != nullptr)
|
||||||
|
delete notification_manager;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Plater::priv::update(unsigned int flags)
|
void Plater::priv::update(unsigned int flags)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user