Hint notification

changes in hints.ini
Hint notification: Just one button in Help menu.
Hint notification: New naming - Tip of the day
Notifications: no scrolling.
Hint notification: fadeout colors.
This commit is contained in:
David Kocik 2021-08-11 17:14:47 +02:00
parent fc1054c61d
commit 4df2c969a5
6 changed files with 23 additions and 61 deletions

View File

@ -103,6 +103,7 @@ documentation_link = https://help.prusa3d.com/en/article/reload-from-disk_120427
text = Different layer height for each model\nDid you know that you can print each model on the plater with a different layer height? Right-click the model in the 3D view, choose Layers and Perimeters and adjust the values in the right panel. Read more in the documentation. text = Different layer height for each model\nDid you know that you can print each model on the plater with a different layer height? Right-click the model in the 3D view, choose Layers and Perimeters and adjust the values in the right panel. Read more in the documentation.
hypertext_type = link hypertext_type = link
documentation_link = https://help.prusa3d.com/en/article/per-model-settings_1674 documentation_link = https://help.prusa3d.com/en/article/per-model-settings_1674
disabled_tags = SLA
[hint:Solid infill threshold area] [hint:Solid infill threshold area]
text = Solid infill threshold area\nDid you know that you can make parts of your model with a small cross-section be filled with solid infill automatically? Set the<a>Solid infill threshold area.</a>(Expert mode only.) text = Solid infill threshold area\nDid you know that you can make parts of your model with a small cross-section be filled with solid infill automatically? Set the<a>Solid infill threshold area.</a>(Expert mode only.)
@ -176,11 +177,13 @@ disabled_tags = SLA; simple
text = Insert Pause\nDid you know that you can schedule the print to pause at a specific layer? Right-click the layer slider in the Preview and select Add pause print (M601). This can be used to insert magnets, weights or nuts into your prints. Read more in the documentation. text = Insert Pause\nDid you know that you can schedule the print to pause at a specific layer? Right-click the layer slider in the Preview and select Add pause print (M601). This can be used to insert magnets, weights or nuts into your prints. Read more in the documentation.
hypertext_type = link hypertext_type = link
documentation_link = https://help.prusa3d.com/en/article/insert-pause-or-custom-g-code-at-layer_120490#insert-pause-at-layer documentation_link = https://help.prusa3d.com/en/article/insert-pause-or-custom-g-code-at-layer_120490#insert-pause-at-layer
disabled_tags = SLA
[hint:Insert Custom G-code] [hint:Insert Custom G-code]
text = Insert Custom G-code\nDid you know that you can insert a custom G-code at a specific layer? Right-click the layer in the Preview and select Add custom G-code. With this function you can, for example, create a temperature tower. Read more in the documentation. text = Insert Custom G-code\nDid you know that you can insert a custom G-code at a specific layer? Right-click the layer in the Preview and select Add custom G-code. With this function you can, for example, create a temperature tower. Read more in the documentation.
hypertext_type = link hypertext_type = link
documentation_link = https://help.prusa3d.com/en/article/insert-pause-or-custom-g-code-at-layer_120490#insert-custom-g-code-at-layer documentation_link = https://help.prusa3d.com/en/article/insert-pause-or-custom-g-code-at-layer_120490#insert-custom-g-code-at-layer
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. Read more in the documentation. 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. Read more in the documentation.
@ -204,6 +207,7 @@ hypertext_preferences_page = 2
text = Adaptive infills\nDid you know that you can use the Adaptive cubic and Support cubic infills to decrease the print time and lower the filament consumption? Read more in the documentation. text = Adaptive infills\nDid you know that you can use the Adaptive cubic and Support cubic infills to decrease the print time and lower the filament consumption? Read more in the documentation.
hypertext_type = link hypertext_type = link
documentation_link = https://help.prusa3d.com/en/article/infill-patterns_177130 documentation_link = https://help.prusa3d.com/en/article/infill-patterns_177130
disabled_tags = SLA
[hint:Fullscreen mode] [hint:Fullscreen mode]
text = Fullscreen mode\nDid you know that you can switch PrusaSlicer to fullscreen mode? Use the <b>F11</b> hotkey. text = Fullscreen mode\nDid you know that you can switch PrusaSlicer to fullscreen mode? Use the <b>F11</b> hotkey.

View File

@ -662,11 +662,7 @@ void NotificationManager::HintNotification::render_close_button(ImGuiWrapper& im
close(); close();
} }
ImGui::PopStyleColor(); ImGui::PopStyleColor(5);
ImGui::PopStyleColor();
ImGui::PopStyleColor();
ImGui::PopStyleColor();
ImGui::PopStyleColor();
//render_right_arrow_button(imgui, win_size_x, win_size_y, win_pos_x, win_pos_y); //render_right_arrow_button(imgui, win_size_x, win_size_y, win_pos_x, win_pos_y);
@ -722,11 +718,7 @@ void NotificationManager::HintNotification::render_preferences_button(ImGuiWrapp
wxGetApp().open_preferences(2); wxGetApp().open_preferences(2);
} }
ImGui::PopStyleColor(); ImGui::PopStyleColor(5);
ImGui::PopStyleColor();
ImGui::PopStyleColor();
ImGui::PopStyleColor();
ImGui::PopStyleColor();
// preferences button is in place of minimize button // preferences button is in place of minimize button
m_minimize_b_visible = true; m_minimize_b_visible = true;
} }
@ -758,11 +750,7 @@ void NotificationManager::HintNotification::render_right_arrow_button(ImGuiWrapp
retrieve_data(); retrieve_data();
} }
ImGui::PopStyleColor(); ImGui::PopStyleColor(5);
ImGui::PopStyleColor();
ImGui::PopStyleColor();
ImGui::PopStyleColor();
ImGui::PopStyleColor();
} }
void NotificationManager::HintNotification::render_logo(ImGuiWrapper& imgui, const float win_size_x, const float win_size_y, const float win_pos_x, const float win_pos_y) void NotificationManager::HintNotification::render_logo(ImGuiWrapper& imgui, const float win_size_x, const float win_size_y, const float win_pos_x, const float win_pos_y)
{ {
@ -788,11 +776,7 @@ void NotificationManager::HintNotification::render_logo(ImGuiWrapper& imgui, con
{ {
} }
ImGui::PopStyleColor(); ImGui::PopStyleColor(5);
ImGui::PopStyleColor();
ImGui::PopStyleColor();
ImGui::PopStyleColor();
ImGui::PopStyleColor();
} }
void NotificationManager::HintNotification::render_documentation_button(ImGuiWrapper& imgui, const float win_size_x, const float win_size_y, const float win_pos_x, const float win_pos_y) void NotificationManager::HintNotification::render_documentation_button(ImGuiWrapper& imgui, const float win_size_x, const float win_size_y, const float win_pos_x, const float win_pos_y)
{ {
@ -846,11 +830,7 @@ void NotificationManager::HintNotification::render_documentation_button(ImGuiWra
open_documentation(); open_documentation();
} }
ImGui::PopStyleColor(); ImGui::PopStyleColor(5);
ImGui::PopStyleColor();
ImGui::PopStyleColor();
ImGui::PopStyleColor();
ImGui::PopStyleColor();
} }
void NotificationManager::HintNotification::open_documentation() void NotificationManager::HintNotification::open_documentation()

View File

@ -99,8 +99,8 @@ protected:
float m_close_b_y { 0 }; float m_close_b_y { 0 };
float m_close_b_w { 0 }; float m_close_b_w { 0 };
// hover of buttons // hover of buttons
size_t m_docu_hover_time { 0 }; long m_docu_hover_time { 0 };
size_t m_prefe_hover_time{ 0 }; long m_prefe_hover_time{ 0 };
}; };
} //namespace Slic3r } //namespace Slic3r

View File

@ -1078,9 +1078,7 @@ static wxMenu* generate_help_menu()
else else
append_menu_item(helpMenu, wxID_ANY, wxString::Format(_L("&About %s"), GCODEVIEWER_APP_NAME), _L("Show about dialog"), append_menu_item(helpMenu, wxID_ANY, wxString::Format(_L("&About %s"), GCODEVIEWER_APP_NAME), _L("Show about dialog"),
[](wxCommandEvent&) { Slic3r::GUI::about(); }); [](wxCommandEvent&) { Slic3r::GUI::about(); });
append_menu_item(helpMenu, wxID_ANY, _L("Next Hint notification"), _L("Opens another Hint notification."), append_menu_item(helpMenu, wxID_ANY, _L("Show Tip of the day"), _L("Opens Tip of the day notification in bottom right corner or shows another tip if already opened."),
[](wxCommandEvent&) { wxGetApp().plater()->get_notification_manager()->push_hint_notification(true); });
append_menu_item(helpMenu, wxID_ANY, _L("Reopen Hint notification"), _L("Opens Hint notification in bottom right corner."),
[](wxCommandEvent&) { wxGetApp().plater()->get_notification_manager()->push_hint_notification(false); }); [](wxCommandEvent&) { wxGetApp().plater()->get_notification_manager()->push_hint_notification(false); });
helpMenu->AppendSeparator(); helpMenu->AppendSeparator();
append_menu_item(helpMenu, wxID_ANY, _L("Keyboard Shortcuts") + sep + "&?", _L("Show the list of the keyboard shortcuts"), append_menu_item(helpMenu, wxID_ANY, _L("Keyboard Shortcuts") + sep + "&?", _L("Show the list of the keyboard shortcuts"),

View File

@ -218,6 +218,7 @@ void NotificationManager::PopNotification::render(GLCanvas3D& canvas, float init
if (m_state == EState::FadingOut) { if (m_state == EState::FadingOut) {
push_style_color(ImGuiCol_WindowBg, ImGui::GetStyleColorVec4(ImGuiCol_WindowBg), true, m_current_fade_opacity); push_style_color(ImGuiCol_WindowBg, ImGui::GetStyleColorVec4(ImGuiCol_WindowBg), true, m_current_fade_opacity);
push_style_color(ImGuiCol_Text, ImGui::GetStyleColorVec4(ImGuiCol_Text), true, m_current_fade_opacity); push_style_color(ImGuiCol_Text, ImGui::GetStyleColorVec4(ImGuiCol_Text), true, m_current_fade_opacity);
push_style_color(ImGuiCol_ButtonHovered, ImGui::GetStyleColorVec4(ImGuiCol_ButtonHovered), true, m_current_fade_opacity);
fading_pop = true; fading_pop = true;
} }
@ -229,7 +230,7 @@ void NotificationManager::PopNotification::render(GLCanvas3D& canvas, float init
m_id = m_id_provider.allocate_id(); m_id = m_id_provider.allocate_id();
std::string name = "!!Ntfctn" + std::to_string(m_id); std::string name = "!!Ntfctn" + std::to_string(m_id);
if (imgui.begin(name, ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoScrollbar)) { if (imgui.begin(name, ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoScrollWithMouse)) {
ImVec2 win_size = ImGui::GetWindowSize(); ImVec2 win_size = ImGui::GetWindowSize();
render_left_sign(imgui); render_left_sign(imgui);
@ -245,7 +246,7 @@ void NotificationManager::PopNotification::render(GLCanvas3D& canvas, float init
ImGui::PopStyleColor(); ImGui::PopStyleColor();
if (fading_pop) if (fading_pop)
ImGui::PopStyleColor(2); ImGui::PopStyleColor(3);
} }
bool NotificationManager::PopNotification::push_background_color() bool NotificationManager::PopNotification::push_background_color()
{ {
@ -440,9 +441,7 @@ void NotificationManager::PopNotification::render_hypertext(ImGuiWrapper& imgui,
close(); close();
} }
} }
ImGui::PopStyleColor(); ImGui::PopStyleColor(3);
ImGui::PopStyleColor();
ImGui::PopStyleColor();
//hover color //hover color
ImVec4 orange_color = ImVec4(.99f, .313f, .0f, 1.0f); ImVec4 orange_color = ImVec4(.99f, .313f, .0f, 1.0f);
@ -501,11 +500,7 @@ void NotificationManager::PopNotification::render_close_button(ImGuiWrapper& img
{ {
close(); close();
} }
ImGui::PopStyleColor(); ImGui::PopStyleColor(5);
ImGui::PopStyleColor();
ImGui::PopStyleColor();
ImGui::PopStyleColor();
ImGui::PopStyleColor();
} }
void NotificationManager::PopNotification::render_left_sign(ImGuiWrapper& imgui) void NotificationManager::PopNotification::render_left_sign(ImGuiWrapper& imgui)
@ -545,11 +540,7 @@ void NotificationManager::PopNotification::render_minimize_button(ImGuiWrapper&
m_multiline = false; m_multiline = false;
} }
ImGui::PopStyleColor(); ImGui::PopStyleColor(5);
ImGui::PopStyleColor();
ImGui::PopStyleColor();
ImGui::PopStyleColor();
ImGui::PopStyleColor();
m_minimize_b_visible = true; m_minimize_b_visible = true;
} }
bool NotificationManager::PopNotification::on_text_click() bool NotificationManager::PopNotification::on_text_click()
@ -790,11 +781,7 @@ void NotificationManager::ExportFinishedNotification::render_eject_button(ImGuiW
wxPostEvent(m_evt_handler, EjectDriveNotificationClickedEvent(EVT_EJECT_DRIVE_NOTIFICAION_CLICKED)); wxPostEvent(m_evt_handler, EjectDriveNotificationClickedEvent(EVT_EJECT_DRIVE_NOTIFICAION_CLICKED));
close(); close();
} }
ImGui::PopStyleColor(); ImGui::PopStyleColor(5);
ImGui::PopStyleColor();
ImGui::PopStyleColor();
ImGui::PopStyleColor();
ImGui::PopStyleColor();
} }
bool NotificationManager::ExportFinishedNotification::on_text_click() bool NotificationManager::ExportFinishedNotification::on_text_click()
{ {
@ -1054,11 +1041,7 @@ void NotificationManager::PrintHostUploadNotification::render_cancel_button(ImGu
{ {
wxGetApp().printhost_job_queue().cancel(m_job_id - 1); wxGetApp().printhost_job_queue().cancel(m_job_id - 1);
} }
ImGui::PopStyleColor(); ImGui::PopStyleColor(5);
ImGui::PopStyleColor();
ImGui::PopStyleColor();
ImGui::PopStyleColor();
ImGui::PopStyleColor();
} }
//------UpdatedItemsInfoNotification------- //------UpdatedItemsInfoNotification-------
void NotificationManager::UpdatedItemsInfoNotification::count_spaces() void NotificationManager::UpdatedItemsInfoNotification::count_spaces()
@ -1096,7 +1079,7 @@ void NotificationManager::UpdatedItemsInfoNotification::add_type(InfoItemType ty
case InfoItemType::MmuSegmentation: text += _utf8("multimaterial painting.\n"); break; case InfoItemType::MmuSegmentation: text += _utf8("multimaterial painting.\n"); break;
case InfoItemType::VariableLayerHeight: text += _utf8("variable layer height.\n"); break; case InfoItemType::VariableLayerHeight: text += _utf8("variable layer height.\n"); break;
case InfoItemType::Sinking: text += _utf8("Partial sinking.\n"); break; case InfoItemType::Sinking: text += _utf8("Partial sinking.\n"); break;
default: text.clear(); break; default: BOOST_LOG_TRIVIAL(error) << "Unknown InfoItemType: " << (*it).second; break;
} }
} }
NotificationData data { get_data().type, get_data().level , get_data().duration, text }; NotificationData data { get_data().type, get_data().level , get_data().duration, text };
@ -1380,10 +1363,7 @@ void NotificationManager::push_hint_notification(bool open_next)
{ {
for (std::unique_ptr<PopNotification>& notification : m_pop_notifications) { for (std::unique_ptr<PopNotification>& notification : m_pop_notifications) {
if (notification->get_type() == NotificationType::DidYouKnowHint) { if (notification->get_type() == NotificationType::DidYouKnowHint) {
if (open_next) (dynamic_cast<HintNotification*>(notification.get()))->open_next();
(dynamic_cast<HintNotification*>(notification.get()))->open_next();
else
notification->set_hovered();
return; return;
} }
} }

View File

@ -342,7 +342,7 @@ void PreferencesDialog::build(size_t selected_tab)
m_optgroup_gui->append_single_option_line(option); m_optgroup_gui->append_single_option_line(option);
#endif #endif
def.label = L("Show \"Did you know\" hints after start"); def.label = L("Show \"Tip of the day\" notification after start");
def.type = coBool; def.type = coBool;
def.tooltip = L("If enabled, useful hints are displayed at startup."); def.tooltip = L("If enabled, useful hints are displayed at startup.");
def.set_default_value(new ConfigOptionBool{ app_config->get("show_hints") == "1" }); def.set_default_value(new ConfigOptionBool{ app_config->get("show_hints") == "1" });