NEW:DailyTips
Change-Id: I510e96652c9a0c9fe422546b09b2d035d9e46a23
This commit is contained in:
parent
c9499b7401
commit
81da77d1e0
|
@ -0,0 +1,124 @@
|
|||
# THIS DOCUMENT CONTAINS DATA FOR HINTS NOTIFICATIONS
|
||||
#
|
||||
# Each notification is divided by
|
||||
# [hint:*name of notification*]
|
||||
#
|
||||
# Each notification MUST have text var in format:
|
||||
# text = Headline of hint\nBody of hint.
|
||||
# Headline is divided by new line (\n) from body.
|
||||
# Headline is automaticaly printed as Bold.
|
||||
# Body can contain bold marks: <b>text to be bold</b> (currently rendered as different color, not bold due to font limitations)
|
||||
# Body can contain hypertext: <a>hypertext text</a>
|
||||
# Hypertext must be max one per notification and must be closed by </a>
|
||||
#
|
||||
# Notification can have documentation link
|
||||
#
|
||||
# If notification contains hypertext, it needs to be specified by hypertext_type var.
|
||||
# each type needs to be supported with one or more additional vars.
|
||||
# These types are possible:
|
||||
#
|
||||
# Settings highlight (like search feature)
|
||||
# hypertext_type = settings
|
||||
# hypertext_settings_opt = name_of_settings (hover over settings value and copy last line of hover text)
|
||||
# hypertext_settings_type = 1 (1 - 5 according to settings tab - to be channged to name of tabs instead of numbers)
|
||||
# hypertext_settings_category = Infill (name of panel - written on left in settings)
|
||||
#
|
||||
# Plater top toolbar highlight
|
||||
# hypertext_type = plater
|
||||
# hypertext_plater_item = nameofbutton (internal name of GLToolbar items)
|
||||
#
|
||||
# Plater gizmos (left) toolbar highlight
|
||||
# hypertext_type = gizmo
|
||||
# hypertext_gizmo_item = name (name of svg icon of gizmo in resources without .svg suffix)
|
||||
#
|
||||
# Open preferences (might add item to highlight)
|
||||
# hypertext_type = preferences
|
||||
# hypertext_preferences_page = name of the prefernces tab
|
||||
# hypertext_preferences_item = show_collapse_button (name of variable saved in prusaslicer.ini connected to the setting in preferences)
|
||||
#
|
||||
# Open gallery (no aditional var)
|
||||
# hypertext_type = gallery
|
||||
#
|
||||
#Open top menubar item
|
||||
#hypertext_menubar_menu_name = (Name in english visible as menu name: File, )
|
||||
#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
|
||||
# enabled_tags = ...
|
||||
# disabled_tags = ...
|
||||
# supported tags are: simple; advanced; expert; FFF; MMU; SLA; Windows; Linux; OSX;
|
||||
# and all filament types: PLA; PET; ABS; ASA; FLEX; HIPS; EDGE; NGEN; NYLON; PVA; PC; PP; PEI; PEEK; PEKK; POM; PSU; PVDF; SCAFF;
|
||||
# Tags are case sensitive.
|
||||
# FFF is affirmative for both one or more extruder printers.
|
||||
# Algorithm shows hint only if ALL enabled tags are affirmative. (so never do enabled_tags = FFF; SLA;)
|
||||
# Algorithm shows hint only if not in all disabled tags.
|
||||
# if there are both disabled and preferred, only preferred that are not in disabled are valid.
|
||||
#
|
||||
#
|
||||
# Notifications shows in random order, already shown notifications are saved at cache/hints.cereal (as binary - human non-readable)
|
||||
# You can affect random ordering by seting weigh
|
||||
# weight = 5
|
||||
# Weight must be larger or equal to 1. Default weight is 1.
|
||||
# Weight defines probability as weight : sum_of_all_weights.
|
||||
|
||||
[hint:3D Scene Operations]
|
||||
text = 3D Scene Operations\nDid you know how to control view and object/part selection with mouse and touchpanel in the 3D scene?
|
||||
documentation_link = https://wiki.bambulab.com/en/home
|
||||
|
||||
[hint:Cut Tool]
|
||||
text = Cut Tool\nDid you know that you can cut a model at any angle and position with the cutting tool?
|
||||
documentation_link = https://wiki.bambulab.com/en/software/bambu-studio/cut-tool
|
||||
|
||||
[hint:Fix Model]
|
||||
text = Fix Model\nDid you know that you can fix a corrupted 3D model to avoid a lot of slicing problems?
|
||||
documentation_link = https://wiki.bambulab.com/en/software/bambu-studio/repair-model
|
||||
|
||||
[hint:Timelapse]
|
||||
text = Timelapse\nDid you know that you can generate a timelapse video during each print?
|
||||
documentation_link = https://wiki.bambulab.com/en/software/bambu-studio/Timelapse
|
||||
|
||||
[hint:Auto-Arrange]
|
||||
text = Auto-Arrange\nDid you know that you can right-click the Arrange icon to adjust the size of the gap between objects and to allow automatic rotations?
|
||||
documentation_link = https://wiki.bambulab.com/en/software/bambu-studio/auto-arranging
|
||||
|
||||
[hint:Auto-Orient]
|
||||
text = Auto-Orient\nDid you know that you can rotate objects to an optimal orientation for printing by a simple click?
|
||||
documentation_link = https://wiki.bambulab.com/en/software/bambu-studio/auto-orientation
|
||||
|
||||
[hint:Lay on Face]
|
||||
text = Lay on Face\nDid you know that you can quickly orient a model so that one of its faces sits on the print bed? Select the "Place on face" function or press the <b>F</b> key.
|
||||
documentation_link = https://wiki.bambulab.com/en/software/bambu-studio/lay-on-face
|
||||
|
||||
[hint:Object List]
|
||||
text = Object List\nDid you know that you can view all objects/parts in a list and change settings for each object/part?
|
||||
documentation_link = https://wiki.bambulab.com/en/software/bambu-studio/object-list
|
||||
|
||||
[hint:Search Functionality]
|
||||
text = Search Functionality\nDid you know that you use the Search tool to quickly find a specific Bambu Studio setting? Or use the familiar shortcut <b>Ctrl+F</b>.
|
||||
|
||||
[hint:Simplify Model]
|
||||
text = Simplify Model\nDid you know that you can reduce the number of triangles in a mesh using the Simplify mesh feature? Right-click the model and select Simplify model. Read more in the documentation.
|
||||
documentation_link = https://wiki.bambulab.com/en/software/bambu-studio/simplify-model
|
||||
|
||||
[hint:Slicing Parameter Table]
|
||||
text = Slicing Parameter Table\nDid you know that you can view all objects/parts on a table and change settings for each object/part?
|
||||
documentation_link = https://wiki.bambulab.com/en/software/bambu-studio/parameter-table
|
||||
|
||||
[hint:Split to Objects/Parts]
|
||||
text = Split to Objects/Parts\nDid you know that you can split a big object into small ones for easy colorizing or printing?
|
||||
documentation_link = https://wiki.bambulab.com/en/software/bambu-studio/new-page
|
||||
|
||||
[hint:Subtract a Part]
|
||||
text = Subtract a Part\nDid you know that you can subtract one mesh from another using the Negative part modifier? That way you can, for example, create easily resizable holes directly in Bambu Studio. Read more in the documentation.
|
||||
documentation_link = https://wiki.bambulab.com/en/software/bambu-studio/subtract-a-part
|
||||
|
||||
[hint:STEP]
|
||||
text = STEP\nDid you know that you can improve your print quality by slicing a STEP file instead of an STL?\nBambu Studio supports slicing STEP files, providing smoother results than a lower resolution STL. Give it a try!
|
||||
documentation_link= https://wiki.bambulab.com/en/software/bambu-studio/step
|
||||
|
||||
#[hint:]
|
||||
#text =
|
||||
#hypertext =
|
||||
#follow_text =
|
||||
|
|
@ -170,10 +170,10 @@ void AppConfig::set_defaults()
|
|||
set_bool("reverse_mouse_wheel_zoom", false);
|
||||
#endif
|
||||
|
||||
#ifdef SUPPORT_SHOW_HINTS
|
||||
//#ifdef SUPPORT_SHOW_HINTS
|
||||
if (get("show_hints").empty())
|
||||
set_bool("show_hints", true);
|
||||
#endif
|
||||
//#endif
|
||||
|
||||
|
||||
#ifdef _WIN32
|
||||
|
|
|
@ -211,6 +211,8 @@ set(SLIC3R_GUI_SOURCES
|
|||
GUI/MonitorBasePanel.h
|
||||
GUI/UpgradePanel.cpp
|
||||
GUI/UpgradePanel.hpp
|
||||
GUI/HintNotification.hpp
|
||||
GUI/HintNotification.cpp
|
||||
GUI/HMSPanel.hpp
|
||||
GUI/HMSPanel.cpp
|
||||
GUI/MonitorPage.cpp
|
||||
|
|
|
@ -1050,9 +1050,9 @@ void GUI_App::post_init()
|
|||
}*/
|
||||
|
||||
// BBS: to be checked
|
||||
#if SUPPORT_SHOW_HINTS
|
||||
#if 1
|
||||
// show "Did you know" notification
|
||||
if (app_config->get("show_hints") == "1" && ! is_gcode_viewer())
|
||||
if (app_config->get("show_hints") == "true" && ! is_gcode_viewer())
|
||||
plater_->get_notification_manager()->push_hint_notification(true);
|
||||
#endif
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,122 @@
|
|||
#ifndef slic3r_GUI_HintNotification_hpp_
|
||||
#define slic3r_GUI_HintNotification_hpp_
|
||||
|
||||
#include "NotificationManager.hpp"
|
||||
|
||||
namespace Slic3r {namespace GUI {
|
||||
|
||||
// Database of hints updatable
|
||||
struct HintData
|
||||
{
|
||||
std::string id_string;
|
||||
std::string text;
|
||||
size_t weight;
|
||||
bool was_displayed;
|
||||
std::string hypertext;
|
||||
std::string follow_text;
|
||||
std::string disabled_tags;
|
||||
std::string enabled_tags;
|
||||
bool runtime_disable; // if true - hyperlink will check before every click if not in disabled mode
|
||||
std::string documentation_link;
|
||||
std::function<void(void)> callback{ nullptr };
|
||||
};
|
||||
|
||||
class HintDatabase
|
||||
{
|
||||
public:
|
||||
static HintDatabase& get_instance()
|
||||
{
|
||||
static HintDatabase instance; // Guaranteed to be destroyed.
|
||||
// Instantiated on first use.
|
||||
return instance;
|
||||
}
|
||||
private:
|
||||
HintDatabase()
|
||||
: m_hint_id(0)
|
||||
{}
|
||||
public:
|
||||
~HintDatabase();
|
||||
HintDatabase(HintDatabase const&) = delete;
|
||||
void operator=(HintDatabase const&) = delete;
|
||||
|
||||
// return true if HintData filled;
|
||||
HintData* get_hint(bool new_hint = true);
|
||||
size_t get_count() {
|
||||
if (!m_initialized)
|
||||
return 0;
|
||||
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:
|
||||
void init();
|
||||
void load_hints_from_file(const boost::filesystem::path& path);
|
||||
bool is_used(const std::string& id);
|
||||
void set_used(const std::string& id);
|
||||
void clear_used();
|
||||
// Returns position in m_loaded_hints with next hint chosed randomly with weights
|
||||
size_t get_next();
|
||||
size_t m_hint_id;
|
||||
bool m_initialized{ false };
|
||||
std::vector<HintData> m_loaded_hints;
|
||||
bool m_sorted_hints{ false };
|
||||
std::vector<std::string> m_used_ids;
|
||||
bool m_used_ids_loaded{ false };
|
||||
};
|
||||
// Notification class - shows current Hint ("Did you know")
|
||||
class NotificationManager::HintNotification : public NotificationManager::PopNotification
|
||||
{
|
||||
public:
|
||||
HintNotification(const NotificationData& n, NotificationIDProvider& id_provider, wxEvtHandler* evt_handler, bool new_hint)
|
||||
: PopNotification(n, id_provider, evt_handler)
|
||||
{
|
||||
retrieve_data(new_hint);
|
||||
}
|
||||
virtual void init() override;
|
||||
void open_next() { retrieve_data(); }
|
||||
protected:
|
||||
virtual void set_next_window_size(ImGuiWrapper& imgui) override;
|
||||
virtual void count_spaces() override;
|
||||
virtual void count_lines() override;
|
||||
virtual bool on_text_click() override;
|
||||
virtual void render_text(ImGuiWrapper& imgui,
|
||||
const float win_size_x, const float win_size_y,
|
||||
const float win_pos_x, const float win_pos_y) override;
|
||||
virtual void render_close_button(ImGuiWrapper& imgui,
|
||||
const float win_size_x, const float win_size_y,
|
||||
const float win_pos_x, const float win_pos_y) override;
|
||||
virtual void render_minimize_button(ImGuiWrapper& imgui,
|
||||
const float win_pos_x, const float win_pos_y) override {}
|
||||
void render_preferences_button(ImGuiWrapper& imgui,
|
||||
const float win_pos_x, const float win_pos_y);
|
||||
void render_right_arrow_button(ImGuiWrapper& imgui,
|
||||
const float win_size_x, const float win_size_y,
|
||||
const float win_pos_x, const float win_pos_y);
|
||||
void 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 render_logo(ImGuiWrapper& imgui,
|
||||
const float win_size_x, const float win_size_y,
|
||||
const float win_pos_x, const float win_pos_y);
|
||||
// recursion counter -1 tells to retrieve same hint as last time
|
||||
void retrieve_data(bool new_hint = true);
|
||||
void open_documentation();
|
||||
|
||||
bool m_has_hint_data{ false };
|
||||
std::function<void(void)> m_hypertext_callback;
|
||||
std::string m_disabled_tags;
|
||||
std::string m_enabled_tags;
|
||||
bool m_runtime_disable;
|
||||
std::string m_documentation_link;
|
||||
float m_close_b_y{ 0 };
|
||||
float m_close_b_w{ 0 };
|
||||
// hover of buttons
|
||||
long m_docu_hover_time{ 0 };
|
||||
long m_prefe_hover_time{ 0 };
|
||||
};
|
||||
|
||||
} //namespace Slic3r
|
||||
} //namespace GUI
|
||||
|
||||
#endif //slic3r_GUI_HintNotification_hpp_
|
|
@ -1635,6 +1635,10 @@ static wxMenu* generate_help_menu()
|
|||
append_menu_item(helpMenu, wxID_ANY, about_title, about_title,
|
||||
[](wxCommandEvent&) { Slic3r::GUI::about(); });
|
||||
#endif
|
||||
append_menu_item(helpMenu, wxID_ANY, _L("Show Tip of the Day"), _L("Show Tip of the Day"), [](wxCommandEvent&) {
|
||||
wxGetApp().plater()->get_notification_manager()->push_hint_notification(false);
|
||||
wxGetApp().plater()->get_current_canvas3D()->set_as_dirty();
|
||||
});
|
||||
|
||||
append_menu_item(helpMenu, wxID_ANY, _L("Open Network Test"), _L("Open Network Test"), [](wxCommandEvent&) {
|
||||
NetworkTestDialog dlg(wxGetApp().mainframe);
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#include "NotificationManager.hpp"
|
||||
|
||||
#include "HintNotification.hpp"
|
||||
#include "GUI.hpp"
|
||||
#include "ImGuiWrapper.hpp"
|
||||
#include "wxExtensions.hpp"
|
||||
|
@ -1787,7 +1788,27 @@ int NotificationManager::progress_indicator_get_range() const
|
|||
|
||||
void NotificationManager::push_hint_notification(bool open_next)
|
||||
{
|
||||
for (std::unique_ptr<PopNotification>& notification : m_pop_notifications) {
|
||||
if (notification->get_type() == NotificationType::DidYouKnowHint) {
|
||||
(dynamic_cast<HintNotification*>(notification.get()))->open_next();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
NotificationData data{ NotificationType::DidYouKnowHint, NotificationLevel::HintNotificationLevel, 300, "" };
|
||||
// from user - open now
|
||||
if (!open_next) {
|
||||
push_notification_data(std::make_unique<NotificationManager::HintNotification>(data, m_id_provider, m_evt_handler, open_next), 0);
|
||||
stop_delayed_notifications_of_type(NotificationType::DidYouKnowHint);
|
||||
// at startup - delay for half a second to let other notification pop up, than try every 30 seconds
|
||||
// show only if no notifications are shown
|
||||
}
|
||||
else {
|
||||
auto condition = [&self = std::as_const(*this)]() {
|
||||
return self.get_notification_count() == 0;
|
||||
};
|
||||
push_delayed_notification_data(std::make_unique<NotificationManager::HintNotification>(data, m_id_provider, m_evt_handler, open_next), condition, 500, 30000);
|
||||
}
|
||||
}
|
||||
|
||||
bool NotificationManager::is_hint_notification_open()
|
||||
|
|
|
@ -688,6 +688,8 @@ wxWindow* PreferencesDialog::create_general_page()
|
|||
std::vector<wxString> Units = {_L("Metric"), _L("Imperial")};
|
||||
auto item_currency = create_item_combobox(_L("Units"), page, _L("Units"), "use_inches", Units);
|
||||
|
||||
auto item_hints = create_item_checkbox(_L("Show \"Tip of the day\" notification after start"), page, _L("If enabled, useful hints are displayed at startup."), 50, "show_hints");
|
||||
|
||||
auto title_sync_settings = create_item_title(_L("User sync"), page, _L("User sync"));
|
||||
auto item_user_sync = create_item_checkbox(_L("Auto sync user presets(Printer/Filament/Process)"), page, _L("User Sync"), 50, "sync_user_preset");
|
||||
|
||||
|
@ -713,6 +715,7 @@ wxWindow* PreferencesDialog::create_general_page()
|
|||
sizer_page->Add(item_language, 0, wxTOP, FromDIP(3));
|
||||
sizer_page->Add(item_region, 0, wxTOP, FromDIP(3));
|
||||
sizer_page->Add(item_currency, 0, wxTOP, FromDIP(3));
|
||||
sizer_page->Add(item_hints, 0, wxTOP, FromDIP(3));
|
||||
sizer_page->Add(title_sync_settings, 0, wxTOP | wxEXPAND, FromDIP(20));
|
||||
sizer_page->Add(item_user_sync, 0, wxTOP, FromDIP(3));
|
||||
#ifdef _WIN32
|
||||
|
|
Loading…
Reference in New Issue