This commit is contained in:
enricoturri1966 2022-07-19 10:04:07 +02:00
commit 92cf1d6e0c
79 changed files with 3942 additions and 2018 deletions

View file

@ -125,7 +125,9 @@ void CopyrightsDialog::fill_entries()
{ "lib_fts"
, "Forrest Smith" , "https://www.forrestthewoods.com/" },
{ "fast_float"
, "Daniel Lemire, João Paulo Magalhaes and contributors", "https://github.com/fastfloat/fast_float" }
, "Daniel Lemire, João Paulo Magalhaes and contributors", "https://github.com/fastfloat/fast_float" },
{ "CuraEngine (Arachne, etc.)"
, "Ultimaker", "https://github.com/Ultimaker/CuraEngine" }
};
}
@ -152,7 +154,7 @@ wxString CopyrightsDialog::get_html_text()
, text_clr_str
, header_str);
for (auto& entry : m_entries) {
for (const auto& entry : m_entries) {
text += wxString::Format(
"<a href=\"%s\">%s</a><br/>"
, entry.link, entry.lib_name);
@ -276,7 +278,7 @@ AboutDialog::AboutDialog()
"<html>"
"<body bgcolor= %1% link= %2%>"
"<font color=%3%>"
"%4% &copy; 2016-2021 Prusa Research. <br />"
"%4% &copy; 2016-2022 Prusa Research. <br />"
"%5% &copy; 2011-2018 Alessandro Ranellucci. <br />"
"<a href=\"http://slic3r.org/\">Slic3r</a> %6% "
"<a href=\"http://www.gnu.org/licenses/agpl-3.0.html\">%7%</a>."

View file

@ -15,6 +15,7 @@
#include "slic3r/GUI/GUI.hpp"
#include "slic3r/GUI/GUI_App.hpp"
#include "slic3r/GUI/I18N.hpp"
#include "slic3r/GUI/format.hpp"
#include "slic3r/Utils/Bonjour.hpp"
namespace Slic3r {
@ -233,7 +234,49 @@ void BonjourDialog::on_timer_process()
}
}
IPListDialog::IPListDialog(wxWindow* parent, const wxString& hostname, const std::vector<boost::asio::ip::address>& ips, size_t& selected_index)
: wxDialog(parent, wxID_ANY, _(L("Multiple resolved IP addresses")), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER)
, m_list(new wxListView(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLC_REPORT | wxSIMPLE_BORDER))
, m_selected_index (selected_index)
{
const int em = GUI::wxGetApp().em_unit();
m_list->SetMinSize(wxSize(40 * em, 30 * em));
wxBoxSizer* vsizer = new wxBoxSizer(wxVERTICAL);
auto* label = new wxStaticText(this, wxID_ANY, GUI::format_wxstr(_L("There are several IP addresses resolving to hostname %1%.\nPlease select one that should be used."), hostname));
vsizer->Add(label, 0, wxEXPAND | wxTOP | wxLEFT | wxRIGHT, em);
m_list->SetSingleStyle(wxLC_SINGLE_SEL);
m_list->AppendColumn(_(L("Address")), wxLIST_FORMAT_LEFT, 40 * em);
for (size_t i = 0; i < ips.size(); i++)
m_list->InsertItem(i, boost::nowide::widen(ips[i].to_string()));
m_list->Select(0);
vsizer->Add(m_list, 1, wxEXPAND | wxALL, em);
wxBoxSizer* button_sizer = new wxBoxSizer(wxHORIZONTAL);
button_sizer->Add(new wxButton(this, wxID_OK, "OK"), 0, wxALL, em);
button_sizer->Add(new wxButton(this, wxID_CANCEL, "Cancel"), 0, wxALL, em);
vsizer->Add(button_sizer, 0, wxALIGN_CENTER);
SetSizerAndFit(vsizer);
GUI::wxGetApp().UpdateDlgDarkUI(this);
}
IPListDialog::~IPListDialog()
{
}
void IPListDialog::EndModal(int retCode)
{
if (retCode == wxID_OK) {
m_selected_index = (size_t)m_list->GetFirstSelected();
}
wxDialog::EndModal(retCode);
}
}

View file

@ -4,6 +4,7 @@
#include <memory>
#include <wx/dialog.h>
#include <wx/string.h>
#include "libslic3r/PrintConfig.hpp"
@ -11,7 +12,7 @@ class wxListView;
class wxStaticText;
class wxTimer;
class wxTimerEvent;
class address;
namespace Slic3r {
@ -41,12 +42,26 @@ private:
unsigned timer_state;
Slic3r::PrinterTechnology tech;
void on_reply(BonjourReplyEvent &);
virtual void on_reply(BonjourReplyEvent &);
void on_timer(wxTimerEvent &);
void on_timer_process();
};
class IPListDialog : public wxDialog
{
public:
IPListDialog(wxWindow* parent, const wxString& hostname, const std::vector<boost::asio::ip::address>& ips, size_t& selected_index);
IPListDialog(IPListDialog&&) = delete;
IPListDialog(const IPListDialog&) = delete;
IPListDialog& operator=(IPListDialog&&) = delete;
IPListDialog& operator=(const IPListDialog&) = delete;
~IPListDialog();
virtual void EndModal(int retCode) wxOVERRIDE;
private:
wxListView* m_list;
size_t& m_selected_index;
};
}

View file

@ -444,7 +444,7 @@ void HintDatabase::load_hints_from_file(const boost::filesystem::path& path)
};
m_loaded_hints.emplace_back(hint_data);
} else if (dict["hypertext_type"] == "menubar") {
wxString menu(_("&" + dict["hypertext_menubar_menu_name"]));
wxString menu(_(dict["hypertext_menubar_menu_name"]));
wxString item(_(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); } };
m_loaded_hints.emplace_back(hint_data);

View file

@ -1107,7 +1107,11 @@ static wxMenu* generate_help_menu()
else
append_menu_item(helpMenu, wxID_ANY, wxString::Format(_L("&About %s"), GCODEVIEWER_APP_NAME), _L("Show about dialog"),
[](wxCommandEvent&) { Slic3r::GUI::about(); });
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."),
append_menu_item(helpMenu, wxID_ANY, _L("Show Tip of the Day")
#if 0//debug
+ "\tCtrl+Shift+T"
#endif
,_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(false); });
helpMenu->AppendSeparator();
append_menu_item(helpMenu, wxID_ANY, _L("Keyboard Shortcuts") + sep + "&?", _L("Show the list of the keyboard shortcuts"),

View file

@ -1823,7 +1823,7 @@ void NotificationManager::push_upload_job_notification(int id, float filesize,
}
std::string text = PrintHostUploadNotification::get_upload_job_text(id, filename, host);
NotificationData data{ NotificationType::PrintHostUpload, NotificationLevel::ProgressBarNotificationLevel, 10, text };
push_notification_data(std::make_unique<NotificationManager::PrintHostUploadNotification>(data, m_id_provider, m_evt_handler, 0, id, filesize), 0);
push_notification_data(std::make_unique<NotificationManager::PrintHostUploadNotification>(data, m_id_provider, m_evt_handler, 0, id, filesize, filename, host), 0);
}
void NotificationManager::set_upload_job_notification_percentage(int id, const std::string& filename, const std::string& host, float percentage)
{
@ -1832,6 +1832,21 @@ void NotificationManager::set_upload_job_notification_percentage(int id, const s
PrintHostUploadNotification* phun = dynamic_cast<PrintHostUploadNotification*>(notification.get());
if (phun->compare_job_id(id)) {
phun->set_percentage(percentage);
if (phun->get_host() != host)
phun->set_host(host);
wxGetApp().plater()->get_current_canvas3D()->schedule_extra_frame(0);
break;
}
}
}
}
void NotificationManager::set_upload_job_notification_host(int id, const std::string& host)
{
for (std::unique_ptr<PopNotification>& notification : m_pop_notifications) {
if (notification->get_type() == NotificationType::PrintHostUpload) {
PrintHostUploadNotification* phun = dynamic_cast<PrintHostUploadNotification*>(notification.get());
if (phun->compare_job_id(id)) {
phun->set_host(host);
wxGetApp().plater()->get_current_canvas3D()->schedule_extra_frame(0);
break;
}
@ -1845,6 +1860,8 @@ void NotificationManager::upload_job_notification_show_canceled(int id, const st
PrintHostUploadNotification* phun = dynamic_cast<PrintHostUploadNotification*>(notification.get());
if (phun->compare_job_id(id)) {
phun->cancel();
if (phun->get_host() != host)
phun->set_host(host);
wxGetApp().plater()->get_current_canvas3D()->schedule_extra_frame(0);
break;
}
@ -1858,6 +1875,8 @@ void NotificationManager::upload_job_notification_show_error(int id, const std::
PrintHostUploadNotification* phun = dynamic_cast<PrintHostUploadNotification*>(notification.get());
if(phun->compare_job_id(id)) {
phun->error();
if (phun->get_host() != host)
phun->set_host(host);
wxGetApp().plater()->get_current_canvas3D()->schedule_extra_frame(0);
break;
}

View file

@ -203,6 +203,7 @@ public:
// print host upload
void push_upload_job_notification(int id, float filesize, const std::string& filename, const std::string& host, float percentage = 0);
void set_upload_job_notification_percentage(int id, const std::string& filename, const std::string& host, float percentage);
void set_upload_job_notification_host(int id, const std::string& host);
void upload_job_notification_show_canceled(int id, const std::string& filename, const std::string& host);
void upload_job_notification_show_error(int id, const std::string& filename, const std::string& host);
// Download App progress
@ -505,10 +506,12 @@ private:
PB_CANCELLED,
PB_COMPLETED
};
PrintHostUploadNotification(const NotificationData& n, NotificationIDProvider& id_provider, wxEvtHandler* evt_handler, float percentage, int job_id, float filesize)
PrintHostUploadNotification(const NotificationData& n, NotificationIDProvider& id_provider, wxEvtHandler* evt_handler, float percentage, int job_id, float filesize, const std::string& filename, const std::string& host)
:ProgressBarNotification(n, id_provider, evt_handler)
, m_job_id(job_id)
, m_file_size(filesize)
, m_filename(filename)
, m_host(host)
{
m_has_cancel_button = true;
set_percentage(percentage);
@ -519,6 +522,8 @@ private:
void error() { m_uj_state = UploadJobState::PB_ERROR; m_has_cancel_button = false; init(); }
bool compare_job_id(const int other_id) const { return m_job_id == other_id; }
bool compare_text(const std::string& text) const override { return false; }
void set_host(const std::string& host) { m_host = host; update({ NotificationType::PrintHostUpload, NotificationLevel::ProgressBarNotificationLevel, 10, get_upload_job_text(m_id, m_filename, m_host)}); }
std::string get_host() const { return m_host; }
protected:
void init() override;
void count_spaces() override;
@ -536,6 +541,8 @@ private:
float m_file_size;
long m_hover_time{ 0 };
UploadJobState m_uj_state{ UploadJobState::PB_PROGRESS };
std::string m_filename;
std::string m_host;
};
class SlicingProgressNotification : public ProgressBarNotification

View file

@ -708,7 +708,7 @@ wxCoord OG_CustomCtrl::CtrlLine::draw_text(wxDC& dc, wxPoint pos, const wxStr
dc.GetMultiLineTextExtent(out_text, &text_width, &text_height);
pos.y = pos.y + lround((height - text_height) / 2);
if (width > 0)
if (rect_label.GetWidth() == 0)
rect_label = wxRect(pos, wxSize(text_width, text_height));
wxColour old_clr = dc.GetTextForeground();

View file

@ -190,6 +190,7 @@ void PrintHostSendDialog::EndModal(int ret)
wxDEFINE_EVENT(EVT_PRINTHOST_PROGRESS, PrintHostQueueDialog::Event);
wxDEFINE_EVENT(EVT_PRINTHOST_ERROR, PrintHostQueueDialog::Event);
wxDEFINE_EVENT(EVT_PRINTHOST_CANCEL, PrintHostQueueDialog::Event);
wxDEFINE_EVENT(EVT_PRINTHOST_RESOLVE, PrintHostQueueDialog::Event);
PrintHostQueueDialog::Event::Event(wxEventType eventType, int winid, size_t job_id)
: wxEvent(winid, eventType)
@ -218,6 +219,7 @@ PrintHostQueueDialog::PrintHostQueueDialog(wxWindow *parent)
, on_progress_evt(this, EVT_PRINTHOST_PROGRESS, &PrintHostQueueDialog::on_progress, this)
, on_error_evt(this, EVT_PRINTHOST_ERROR, &PrintHostQueueDialog::on_error, this)
, on_cancel_evt(this, EVT_PRINTHOST_CANCEL, &PrintHostQueueDialog::on_cancel, this)
, on_resolve_evt(this, EVT_PRINTHOST_RESOLVE, &PrintHostQueueDialog::on_resolve, this)
{
const auto em = GetTextExtent("m").x;
@ -450,6 +452,17 @@ void PrintHostQueueDialog::on_cancel(Event &evt)
wxGetApp().notification_manager()->upload_job_notification_show_canceled(evt.job_id + 1, boost::nowide::narrow(nm.GetString()), boost::nowide::narrow(hst.GetString()));
}
void PrintHostQueueDialog::on_resolve(Event& evt)
{
wxCHECK_RET(evt.job_id < (size_t)job_list->GetItemCount(), "Out of bounds access to job list");
// wxstring in event is called error, but it should contain new host string.
wxVariant hst(evt.error);
// todo: set variant
job_list->SetValue(hst,evt.job_id,COL_HOST);
wxGetApp().notification_manager()->set_upload_job_notification_host(evt.job_id + 1, boost::nowide::narrow(evt.error));
}
void PrintHostQueueDialog::get_active_jobs(std::vector<std::pair<std::string, std::string>>& ret)
{
int ic = job_list->GetItemCount();

View file

@ -108,6 +108,7 @@ private:
EventGuard on_progress_evt;
EventGuard on_error_evt;
EventGuard on_cancel_evt;
EventGuard on_resolve_evt;
JobState get_state(int idx);
void set_state(int idx, JobState);
@ -115,6 +116,7 @@ private:
void on_progress(Event&);
void on_error(Event&);
void on_cancel(Event&);
void on_resolve(Event&);
// This vector keep adress and filename of uploads. It is used when checking for running uploads during exit.
std::vector<std::pair<std::string, std::string>> upload_names;
void save_user_data(int);
@ -124,7 +126,7 @@ private:
wxDECLARE_EVENT(EVT_PRINTHOST_PROGRESS, PrintHostQueueDialog::Event);
wxDECLARE_EVENT(EVT_PRINTHOST_ERROR, PrintHostQueueDialog::Event);
wxDECLARE_EVENT(EVT_PRINTHOST_CANCEL, PrintHostQueueDialog::Event);
wxDECLARE_EVENT(EVT_PRINTHOST_RESOLVE, PrintHostQueueDialog::Event);
}}
#endif

View file

@ -1571,8 +1571,8 @@ void TabPrint::build()
optgroup->append_single_option_line("max_volumetric_speed", "max-volumetric-speed_127176");
optgroup = page->new_optgroup(L("Pressure equalizer (experimental)"));
optgroup->append_single_option_line("max_volumetric_extrusion_rate_slope_positive");
optgroup->append_single_option_line("max_volumetric_extrusion_rate_slope_negative");
optgroup->append_single_option_line("max_volumetric_extrusion_rate_slope_positive", "pressure-equlizer_331504");
optgroup->append_single_option_line("max_volumetric_extrusion_rate_slope_negative", "pressure-equlizer_331504");
page = add_options_page(L("Multiple Extruders"), "funnel");
optgroup = page->new_optgroup(L("Extruders"));

View file

@ -1300,6 +1300,9 @@ void UnsavedChangesDialog::update_tree(Preset::Type type, PresetCollection* pres
get_string_value(opt_key, old_config), get_string_value(opt_key, new_config), category_icon_map.at(option.category));
}
}
// Revert sort of searcher back
searcher.sort_options_by_label();
}
void UnsavedChangesDialog::on_dpi_changed(const wxRect& suggested_rect)
@ -1709,6 +1712,9 @@ void DiffPresetDialog::update_tree()
Fit();
Refresh();
}
// Revert sort of searcher back
searcher.sort_options_by_label();
}
void DiffPresetDialog::on_dpi_changed(const wxRect&)