Merge branch 'ys_spe2352'

This commit is contained in:
Lukas Matena 2024-06-20 16:05:35 +02:00
commit 63eb6b7ddc
19 changed files with 125 additions and 64 deletions

View File

@ -648,7 +648,7 @@ void PageWelcome::set_run_reason(ConfigWizard::RunReason run_reason)
}
PageUpdateManager::PageUpdateManager(ConfigWizard* parent_in)
: ConfigWizardPage(parent_in, _L("Manage Configuration Updates"), _L("Configuration Manager"))
: ConfigWizardPage(parent_in, _L("Configuration sources"), _L("Configuration Sources"))
{
this->SetFont(wxGetApp().normal_font());
@ -656,7 +656,7 @@ PageUpdateManager::PageUpdateManager(ConfigWizard* parent_in)
manager = std::make_unique<RepositoryUpdateUIManager>(this, wxGetApp().plater()->get_preset_archive_database(), em);
warning_text = new wxStaticText(this, wxID_ANY, _L("WARNING: Select at least one repository."));
warning_text = new wxStaticText(this, wxID_ANY, _L("WARNING: Select at least one source."));
warning_text->SetFont(wxGetApp().bold_font());
warning_text->Hide();

View File

@ -257,14 +257,14 @@ static std::string to_string(libvgcode::EMoveType type)
switch (type)
{
// TRN: Following strings are labels in the G-code Viewer legend.
case libvgcode::EMoveType::Noop: { return _u8L("Noop"); }
case libvgcode::EMoveType::Noop: { return ("Noop"); }
case libvgcode::EMoveType::Retract: { return _u8L("Retract"); }
case libvgcode::EMoveType::Unretract: { return _u8L("Unretract"); }
case libvgcode::EMoveType::Seam: { return _u8L("Seam"); }
case libvgcode::EMoveType::ToolChange: { return _u8L("Tool Change"); }
case libvgcode::EMoveType::ColorChange: { return _u8L("Color Change"); }
case libvgcode::EMoveType::PausePrint: { return _u8L("Pause Print"); }
case libvgcode::EMoveType::CustomGCode: { return _u8L("Custom GCode"); }
case libvgcode::EMoveType::CustomGCode: { return _u8L("Custom G-code"); }
case libvgcode::EMoveType::Travel: { return _u8L("Travel"); }
case libvgcode::EMoveType::Wipe: { return _u8L("Wipe"); }
case libvgcode::EMoveType::Extrude: { return _u8L("Extrude"); }

View File

@ -3521,8 +3521,8 @@ bool GUI_App::check_updates(const bool invoked_by_user)
if (!plater()->get_preset_archive_database()->extract_archives_with_check(failed_paths)) {
int cnt = std::count(failed_paths.begin(), failed_paths.end(), '\n') + 1;
// TRN: %1% contains paths from which loading failed. They are separated by \n, there is no \n at the end.
failed_paths = GUI::format(_L_PLURAL("It was not possible to extract data from %1%. The repository will not be updated.",
"It was not possible to extract data for following local repositories. They will not be updated.\n\n %1%", cnt), failed_paths);
failed_paths = GUI::format(_L_PLURAL("It was not possible to extract data from %1%. The source will not be updated.",
"It was not possible to extract data for following local sources. They will not be updated.\n\n %1%", cnt), failed_paths);
show_error(nullptr, failed_paths);
}
// then its time for preset_updater sync
@ -3919,7 +3919,7 @@ void GUI_App::search_and_select_filaments(const std::string& material, size_t ex
{
out_message += /*(extruder_count == 1)
? GUI::format(_L("Selected Filament:\n%1%"), filament_preset.preset->name)
: */GUI::format(_L("Extruder %1%: Selected Filament %2%\n"), extruder_index + 1, filament.preset->name);
: */GUI::format(_L("Extruder %1%: Selected filament %2%\n"), extruder_index + 1, filament.preset->name);
return;
}
}
@ -3934,7 +3934,7 @@ void GUI_App::search_and_select_filaments(const std::string& material, size_t ex
&& filament.preset->name.compare(0, 9, "Prusament") == 0
&& select_filament_preset(filament.preset, extruder_index))
{
out_message += GUI::format(_L("Extruder %1%: Selected and installed filament %2%\n"), extruder_index + 1, filament.preset->name);
out_message += GUI::format(_L("Extruder %1%: Installed and selected filament %2%\n"), extruder_index + 1, filament.preset->name);
return;
}
}

View File

@ -11,14 +11,14 @@ namespace GUI {
LoginDialog::LoginDialog(wxWindow* parent, UserAccount* user_account)
// TRN: This is the dialog title.
: DPIDialog(parent, wxID_ANY, _L("Prusa Account"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER)
: DPIDialog(parent, wxID_ANY, ("Prusa Account"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER)
, p_user_account(user_account)
{
const int em = wxGetApp().em_unit();
bool logged = p_user_account->is_logged();
wxBoxSizer* main_sizer = new wxBoxSizer(wxVERTICAL);
// sizer with black border
wxStaticBoxSizer* static_box_sizer = new wxStaticBoxSizer(wxVERTICAL, this, _L("Log into your Prusa Account"));
wxStaticBoxSizer* static_box_sizer = new wxStaticBoxSizer(wxVERTICAL, this, ("Log into your Prusa Account"));
static_box_sizer->SetMinSize(wxSize(em * 30, em * 15));
// avatar
boost::filesystem::path path = p_user_account->get_avatar_path(logged);
@ -26,18 +26,18 @@ LoginDialog::LoginDialog(wxWindow* parent, UserAccount* user_account)
m_avatar_bitmap = new wxStaticBitmap(this, wxID_ANY, logo.bmp(), wxDefaultPosition, wxDefaultSize);
static_box_sizer->Add(m_avatar_bitmap, 0, wxALIGN_CENTER_HORIZONTAL | wxALL, 10);
// username
const wxString username = GUI::format_wxstr("%1%", logged ? from_u8(p_user_account->get_username()) : _L("Anonymous"));
const wxString username = GUI::format_wxstr("%1%", logged ? from_u8(p_user_account->get_username()) : ("Anonymous"));
m_username_label = new wxStaticText(this, wxID_ANY, username, wxDefaultPosition, wxDefaultSize, wxALIGN_CENTER);
m_username_label->SetFont(m_username_label->GetFont().Bold());
static_box_sizer->Add(m_username_label, 0, wxALIGN_CENTER_HORIZONTAL | wxALL, 5);
// login button
m_login_button_id = NewControlId();
m_login_button = new wxButton(this, m_login_button_id, logged ? _L("Log out") : _L("Log in"));
m_login_button = new wxButton(this, m_login_button_id, logged ? ("Log out") : ("Log in"));
static_box_sizer->Add(m_login_button, 0, wxALIGN_CENTER_HORIZONTAL | wxALL, 10);
// TODO: why is m_login_button always hovered?
main_sizer->Add(static_box_sizer, 1, wxEXPAND | wxALL, 10);
// continue button
m_continue_button = new wxButton(this, wxID_OK, logged ? _L("Continue") : _L("Continue without Prusa Account"));
m_continue_button = new wxButton(this, wxID_OK, logged ? ("Continue") : ("Continue without Prusa Account"));
main_sizer->Add(m_continue_button, 0, wxALIGN_CENTER_HORIZONTAL | wxALL, 10);
SetSizerAndFit(main_sizer);
@ -61,7 +61,7 @@ void LoginDialog::update_account()
{
bool logged = p_user_account->is_logged();
const wxString username = GUI::format_wxstr("%1%", logged ? from_u8(p_user_account->get_username()) : _L("Anonymous"));
const wxString username = GUI::format_wxstr("%1%", logged ? from_u8(p_user_account->get_username()) : ("Anonymous"));
m_username_label->SetLabel(username);
boost::filesystem::path path = p_user_account->get_avatar_path(logged);
@ -71,8 +71,8 @@ void LoginDialog::update_account()
m_avatar_bitmap->SetBitmap(logo.bmp());
}
m_login_button->SetLabel(logged ? _L("Log out") : _L("Log in"));
m_continue_button->SetLabel(logged ? _L("Continue") : _L("Continue without Prusa Account"));
m_login_button->SetLabel(logged ? ("Log out") : ("Log in"));
m_continue_button->SetLabel(logged ? ("Continue") : ("Continue without Prusa Account"));
// TODO: resize correctly m_continue_button
//m_continue_button->Fit();

View File

@ -472,7 +472,9 @@ void MainFrame::update_layout()
if (m_layout == ESettingsLayout::Old)
m_tabpanel->InsertNewPage(0, m_plater, _L("Plater"), "", true);
update_topbars();
Layout();
Thaw();
}
@ -596,6 +598,22 @@ static wxString GetTooltipForSettingsButton(PrinterTechnology pt)
return from_u8(tooltip);
}
void MainFrame::update_topbars()
{
if (wxGetApp().is_gcode_viewer())
return;
const bool show_login = !wxGetApp().app_config->has("show_login_button") || wxGetApp().app_config->get_bool("show_login_button");
m_tmp_top_bar->ShowUserAccount(show_login);
m_tabpanel->ShowUserAccount(show_login);
if (!show_login) {
if (auto user_account = wxGetApp().plater()->get_user_account();
user_account && user_account->is_logged())
user_account->do_logout();
}
}
void MainFrame::set_callbacks_for_topbar_menus()
{
m_bar_menus.set_workspaces_menu_callbacks(
@ -605,17 +623,33 @@ void MainFrame::set_callbacks_for_topbar_menus()
);
m_bar_menus.set_account_menu_callbacks(
[]() -> void { wxGetApp().plater()->toggle_remember_user_account_session(); },
[]() -> void { wxGetApp().plater()->act_with_user_account(); },
[this]() -> void {
wxString preferences_item = _L("Show Log in button in application top bar");
wxString msg =
_L("PrusaSlicer will remember your choice.") + "\n\n" +
format_wxstr(_L("Visit \"Preferences\" and check \"%1%\"\nto changes your choice."), preferences_item);
MessageDialog msg_dlg(this, msg, _L("PrusaSlicer: Don't ask me again"), wxOK | wxCANCEL | wxICON_INFORMATION);
if (msg_dlg.ShowModal() == wxID_OK) {
wxGetApp().app_config->set("show_login_button", "0");
m_bar_menus.RemoveHideLoginItem();
update_topbars();
}
},
[]() -> TopBarMenus::UserAccountInfo {
if (auto user_account = wxGetApp().plater()->get_user_account())
return { user_account->is_logged(),
user_account->get_remember_session(),
user_account->get_username(),
user_account->get_avatar_path(true) };
return TopBarMenus::UserAccountInfo();
}
);
// we need "Hide Log in button" menu item only till "show_login_button" wasn't changed
if (wxGetApp().app_config->has("show_login_button"))
m_bar_menus.RemoveHideLoginItem();
}
void MainFrame::init_tabpanel()
@ -1879,7 +1913,7 @@ void MainFrame::export_configbundle(bool export_physical_printers /*= false*/)
wxSecretStore store = wxSecretStore::GetDefault();
wxString errmsg;
if (!store.IsOk(&errmsg)) {
std::string msg = GUI::format("%1% (%2%).", _u8L("Failed to load credentials from the system secret store."), errmsg);
std::string msg = GUI::format("%1% (%2%).", _u8L("Failed to load credentials from the system password store."), errmsg);
BOOST_LOG_TRIVIAL(error) << msg;
show_error(nullptr, msg);
// Do not try again. System store is not reachable.
@ -1890,7 +1924,7 @@ void MainFrame::export_configbundle(bool export_physical_printers /*= false*/)
wxString username;
wxSecretValue password;
if (!store.Load(service, username, password)) {
std::string msg = GUI::format(_u8L("Failed to load credentials from the system secret store for printer %1%."), printer_id);
std::string msg = GUI::format(_u8L("Failed to load credentials from the system password store for printer %1%."), printer_id);
BOOST_LOG_TRIVIAL(error) << msg;
show_error(nullptr, msg);
return false;
@ -2160,6 +2194,8 @@ void MainFrame::update_ui_from_settings()
// m_plater->sidebar().show_export(bp_on);
// m_plater->sidebar().Layout();
update_topbars();
if (m_plater)
m_plater->update_ui_from_settings();
for (auto tab: wxGetApp().tabs_list)

View File

@ -172,6 +172,7 @@ public:
void update_title();
void set_callbacks_for_topbar_menus();
void update_topbars();
void init_tabpanel();
void create_preset_tabs();
void add_created_tab(Tab* panel, const std::string& bmp_name = "");

View File

@ -189,7 +189,7 @@ bool save_secret(const std::string& id, const std::string& opt, const std::strin
const wxString username = boost::nowide::widen(usr);
const wxSecretValue password(boost::nowide::widen(psswd));
if (!store.Save(service, username, password)) {
std::string msg(_u8L("Failed to save credentials to the system secret store."));
std::string msg(_u8L("Failed to save credentials to the system password store."));
BOOST_LOG_TRIVIAL(error) << msg;
show_error(nullptr, msg);
return false;
@ -215,7 +215,7 @@ bool load_secret(const std::string& id, const std::string& opt, std::string& usr
wxString username;
wxSecretValue password;
if (!store.Load(service, username, password)) {
std::string msg(_u8L("Failed to load credentials from the system secret store."));
std::string msg(_u8L("Failed to load credentials from the system password store."));
BOOST_LOG_TRIVIAL(error) << msg;
show_error(nullptr, msg);
return false;

View File

@ -5965,7 +5965,7 @@ bool load_secret(const std::string& id, const std::string& opt, std::string& usr
wxString username;
wxSecretValue password;
if (!store.Load(service, username, password)) {
std::string msg(_u8L("Failed to load credentials from the system secret store."));
std::string msg(_u8L("Failed to load credentials from the system password store."));
BOOST_LOG_TRIVIAL(error) << msg;
show_error(nullptr, msg);
return false;
@ -6965,8 +6965,11 @@ void Plater::act_with_user_account()
if (p->user_account) {
if (p->user_account->is_logged())
p->user_account->do_logout();
else
else {
p->user_account->do_login();
if (!wxGetApp().app_config->has("show_login_button"))
wxGetApp().app_config->set("show_login_button", "1");
}
}
}

View File

@ -135,8 +135,11 @@ void PreferencesDialog::show(const std::string& highlight_opt_key /*= std::strin
downloader->set_path_name(app_config->get("url_downloader_dest"));
downloader->allow(!app_config->has("downloader_url_registered") || app_config->get_bool("downloader_url_registered"));
for (const std::string& opt_key : {"suppress_hyperlinks", "downloader_url_registered"})
for (const std::string& opt_key : {"suppress_hyperlinks", "downloader_url_registered", "show_login_button"})
m_optgroup_other->set_value(opt_key, app_config->get_bool(opt_key));
// by default "Log in" button is visible
if (!app_config->has("show_login_button"))
m_optgroup_other->set_value("show_login_button", true);
for (const std::string& opt_key : { "default_action_on_close_application"
,"default_action_on_new_project"
@ -626,6 +629,11 @@ void PreferencesDialog::build()
//L("If enabled, the descriptions of configuration parameters in settings tabs wouldn't work as hyperlinks. "
// "If disabled, the descriptions of configuration parameters in settings tabs will work as hyperlinks."),
app_config->get_bool("suppress_hyperlinks"));
append_bool_option(m_optgroup_other, "show_login_button",
L("Show \"Log in\" button in application top bar"),
L("If enabled, PrusaSlicer will show up \"Log in\" button in application top bar."),
app_config->get_bool("show_login_button"));
append_bool_option(m_optgroup_other, "downloader_url_registered",
L("Allow downloads from Printables.com"),

View File

@ -33,7 +33,7 @@ bool unzip_repository(const fs::path& source_path, const fs::path& target_path)
mz_zip_archive archive;
mz_zip_zero_struct(&archive);
if (!open_zip_reader(&archive, source_path.string())) {
BOOST_LOG_TRIVIAL(error) << "Couldn't open zipped Archive Repository. " << source_path;
BOOST_LOG_TRIVIAL(error) << "Couldn't open zipped Archive source. " << source_path;
return false;
}
size_t num_files = mz_zip_reader_get_num_files(&archive);
@ -70,21 +70,21 @@ bool extract_repository_header(const pt::ptree& ptree, ArchiveRepository::Reposi
if (const auto name = ptree.get_optional<std::string>("name"); name){
data.name = *name;
} else {
BOOST_LOG_TRIVIAL(error) << "Failed to find \"name\" parameter in repository manifest. Repository is invalid.";
BOOST_LOG_TRIVIAL(error) << "Failed to find \"name\" parameter in source manifest. Source is invalid.";
return false;
}
if (const auto id = ptree.get_optional<std::string>("id"); id) {
data.id = *id;
}
else {
BOOST_LOG_TRIVIAL(error) << "Failed to find \"id\" parameter in repository manifest. Repository is invalid.";
BOOST_LOG_TRIVIAL(error) << "Failed to find \"id\" parameter in source manifest. Source is invalid.";
return false;
}
if (const auto url = ptree.get_optional<std::string>("url"); url) {
data.url = *url;
}
else {
BOOST_LOG_TRIVIAL(error) << "Failed to find \"url\" parameter in repository manifest. Repository is invalid.";
BOOST_LOG_TRIVIAL(error) << "Failed to find \"url\" parameter in source manifest. Source is invalid.";
return false;
}
// optional atributes
@ -140,13 +140,13 @@ bool extract_local_archive_repository( ArchiveRepository::RepositoryManifest& ma
pt::ptree ptree;
pt::read_json(manifest_path.string(), ptree);
if (!extract_repository_header(ptree, manifest_data)) {
BOOST_LOG_TRIVIAL(error) << "Failed to load repository: " << manifest_data.tmp_path;
BOOST_LOG_TRIVIAL(error) << "Failed to load source " << manifest_data.tmp_path;
return false;
}
}
catch (const std::exception& e)
{
BOOST_LOG_TRIVIAL(error) << "Failed to read repository manifest JSON " << manifest_path << ". reason: " << e.what();
BOOST_LOG_TRIVIAL(error) << "Failed to read source manifest JSON " << manifest_path << ". reason: " << e.what();
return false;
}
return true;
@ -353,7 +353,7 @@ bool PresetArchiveDatabase::set_selected_repositories(const std::vector<std::str
if (!archive->is_extracted()) {
// non existent local repo since start selected
msg = GUI::format(
_L("Cannot select local repository from path: %1%. It was not extracted."),
_L("Cannot select local source from path: %1%. It was not extracted."),
archive->get_manifest().source_path
);
return false;
@ -362,7 +362,7 @@ bool PresetArchiveDatabase::set_selected_repositories(const std::vector<std::str
}
assert(!id.empty());
if (auto it = used_set.find(id); it != used_set.end()) {
msg = GUI::format(_L("Cannot select two repositories with the same id: %1% and %2%"), it->second, name);
msg = GUI::format(_L("Cannot select two sources with the same id: %1% and %2%"), it->second, name);
return false;
}
used_set.emplace(id, name);
@ -501,7 +501,7 @@ void PresetArchiveDatabase::load_app_manifest_json()
}
else {
assert(true);
BOOST_LOG_TRIVIAL(error) << "Failed to read Archive Repository Manifest at " << path;
BOOST_LOG_TRIVIAL(error) << "Failed to read Archive Source Manifest at " << path;
}
if (data.empty()) {
return;
@ -546,7 +546,7 @@ void PresetArchiveDatabase::load_app_manifest_json()
std::string uuid = get_next_uuid();
if (!extract_repository_header(subtree.second, manifest)) {
assert(true);
BOOST_LOG_TRIVIAL(error) << "Failed to read one of repository headers.";
BOOST_LOG_TRIVIAL(error) << "Failed to read one of source headers.";
continue;
}
// "selected" flag
@ -876,7 +876,7 @@ bool sync_inner(std::string& manifest)
http
.timeout_max(30)
.on_error([&](std::string body, std::string error, unsigned http_status) {
BOOST_LOG_TRIVIAL(error) << "Failed to get online archive repository manifests: "<< body << " ; " << error << " ; " << http_status;
BOOST_LOG_TRIVIAL(error) << "Failed to get online archive source manifests: "<< body << " ; " << error << " ; " << http_status;
ret = false;
})
.on_complete([&](std::string body, unsigned /* http_status */) {

View File

@ -5515,7 +5515,7 @@ void TabSLAMaterial::update_description_lines()
auto cfg = m_preset_bundle->full_config();
double lh = cfg.opt_float("layer_height");
int zlayers = cfg.opt_int("zcorrection_layers");
m_z_correction_to_mm_description->SetText(GUI::format_wxstr(_L("Current Z correction depth is: %1% mm"), zlayers * lh));
m_z_correction_to_mm_description->SetText(GUI::format_wxstr(_L("The current Z-axis height correction is: %1% mm"), zlayers * lh));
}
Tab::update_description_lines();

View File

@ -492,12 +492,6 @@ TopBarItemsCtrl::TopBarItemsCtrl(wxWindow *parent, TopBarMenus* menus/* = nullpt
m_sizer->SetItemMinSize(1, wxSize(42 * wxGetApp().em_unit(), -1));
this->Bind(wxEVT_UPDATE_UI, [this](wxUpdateUIEvent& evt) {
auto user_account = m_menus->get_user_account_info();
evt.Enable(user_account.is_logged);
evt.Check (user_account.remember_session);
}, m_menus->remember_me_item_id);
update_btns_width();
}
@ -517,6 +511,12 @@ void TopBarItemsCtrl::UpdateMode()
this->Layout();
}
void TopBarItemsCtrl::ShowUserAccount(bool show)
{
m_account_btn->Show(show);
this->Layout();
}
void TopBarItemsCtrl::Rescale()
{
update_margins();

View File

@ -76,6 +76,7 @@ public:
void SetSelection(int sel, bool force = false);
void UpdateMode();
void ShowUserAccount(bool show);
void Rescale();
void OnColorsChanged();
void UpdateModeMarkers();
@ -324,6 +325,11 @@ public:
GetTopBarItemsCtrl()->UpdateMode();
}
void ShowUserAccount(bool show)
{
GetTopBarItemsCtrl()->ShowUserAccount(show);
}
void Rescale()
{
GetTopBarItemsCtrl()->Rescale();

View File

@ -83,12 +83,11 @@ void TopBarMenus::ApplyWorkspacesMenu()
void TopBarMenus::CreateAccountMenu()
{
remember_me_item_id = wxWindow::NewControlId();
append_menu_check_item(&account, remember_me_item_id, _L("Remember me"), "" ,
[this](wxCommandEvent&) { if (m_cb_toggle_remember_session) m_cb_toggle_remember_session(); }, nullptr);
m_login_item = append_menu_item(&account, wxID_ANY, "", "",
[this](wxCommandEvent&) { if (m_cb_act_with_user_account) m_cb_act_with_user_account(); }, "login");
m_hide_login_item = append_menu_item(&account, wxID_ANY, _L("Hide \"Log in\" button"), "",
[this](wxCommandEvent&) { if (m_cb_hide_user_account) m_cb_hide_user_account(); });
}
void TopBarMenus::UpdateAccountMenu()
@ -96,12 +95,20 @@ void TopBarMenus::UpdateAccountMenu()
bool is_logged{ false };
if (m_cb_get_user_account_info)
is_logged = m_cb_get_user_account_info().is_logged;
if (is_logged)
RemoveHideLoginItem();
if (m_login_item) {
m_login_item->SetItemLabel(is_logged ? _L("Prusa Account Log out") : _L("Prusa Account Log in"));
m_login_item->SetItemLabel(is_logged ? _L("Log out") : _L("Log in"));
set_menu_item_bitmap(m_login_item, is_logged ? "logout" : "login");
}
}
void TopBarMenus::RemoveHideLoginItem()
{
if (m_hide_login_item)
account.Remove(m_hide_login_item);
}
void TopBarMenus::Popup(TopBarItemsCtrl* popup_ctrl, wxMenu* menu, wxPoint pos)
{
m_popup_ctrl = popup_ctrl;

View File

@ -12,7 +12,6 @@ class TopBarMenus
public:
struct UserAccountInfo {
bool is_logged { false };
bool remember_session{ false };
std::string user_name;
boost::filesystem::path avatar_path;
};
@ -21,6 +20,7 @@ private:
// Prusa Account menu items
wxMenuItem* m_login_item { nullptr };
wxMenuItem* m_hide_login_item { nullptr };
TopBarItemsCtrl* m_popup_ctrl { nullptr };
@ -28,15 +28,14 @@ private:
std::function<void(int)> m_cb_save_mode { nullptr };
std::function<std::string(int)> m_cb_get_mode_btn_color { nullptr };
std::function<void()> m_cb_toggle_remember_session { nullptr };
std::function<void()> m_cb_act_with_user_account { nullptr };
std::function<void()> m_cb_hide_user_account { nullptr };
std::function<UserAccountInfo()>m_cb_get_user_account_info { nullptr };
public:
wxMenu main;
wxMenu workspaces;
wxMenu account;
wxWindowID remember_me_item_id { wxID_ANY };
TopBarMenus();
~TopBarMenus() = default;
@ -46,6 +45,7 @@ public:
void ApplyWorkspacesMenu();
void CreateAccountMenu();
void UpdateAccountMenu();
void RemoveHideLoginItem();
void Popup(TopBarItemsCtrl* popup_ctrl, wxMenu* menu, wxPoint pos);
void BindEvtClose();
@ -68,12 +68,12 @@ public:
ApplyWorkspacesMenu();
}
void set_account_menu_callbacks(std::function<void()> cb_toggle_remember_session,
std::function<void()> cb_act_with_user_account ,
void set_account_menu_callbacks(std::function<void()> cb_act_with_user_account ,
std::function<void()> cb_hide_user_account ,
std::function<UserAccountInfo()> cb_get_user_account_info )
{
m_cb_toggle_remember_session = cb_toggle_remember_session;
m_cb_act_with_user_account = cb_act_with_user_account;
m_cb_hide_user_account = cb_hide_user_account;
m_cb_get_user_account_info = cb_get_user_account_info;
}

View File

@ -26,7 +26,7 @@ RepositoryUpdateUIManager::RepositoryUpdateUIManager(wxWindow* parent, PresetArc
,m_pad(pad)
,m_main_sizer(new wxBoxSizer(wxVERTICAL))
{
auto online_label = new wxStaticText(m_parent, wxID_ANY, _L("Online Repositories"));
auto online_label = new wxStaticText(m_parent, wxID_ANY, _L("Online sources"));
online_label->SetFont(wxGetApp().bold_font());
m_main_sizer->Add(online_label, 0, wxTOP | wxLEFT, 2 * em);
@ -40,7 +40,7 @@ RepositoryUpdateUIManager::RepositoryUpdateUIManager(wxWindow* parent, PresetArc
m_main_sizer->AddSpacer(em);
auto offline_label = new wxStaticText(m_parent, wxID_ANY, _L("Local Repositories"));
auto offline_label = new wxStaticText(m_parent, wxID_ANY, _L("Local sources"));
offline_label->SetFont(wxGetApp().bold_font());
m_main_sizer->Add(offline_label, 0, wxTOP | wxLEFT, 2 * em);
@ -98,7 +98,7 @@ void RepositoryUpdateUIManager::fill_grids()
// header
// TRN: This string appears in Configuration Wizard in the 'Configuration Manager' step.
for (const wxString& l : std::initializer_list<wxString>{ _L("Use"), "", _L("Name"), _L("Description") }) {
for (const wxString& l : std::initializer_list<wxString>{ "", "", _L("Name"), _L("Description")}) {
auto text = new wxStaticText(m_parent, wxID_ANY, l);
text->SetFont(wxGetApp().bold_font());
add(text);
@ -139,7 +139,7 @@ void RepositoryUpdateUIManager::fill_grids()
// header
for (const wxString& l : std::initializer_list<wxString>{ _L("Use"), _L("Name"), _L("Descrition"), "", _L("Source file"), "", "" }) {
for (const wxString& l : std::initializer_list<wxString>{ "", _L("Name"), _L("Description"), "", _L("Source file"), "", ""}) {
auto text = new wxStaticText(m_parent, wxID_ANY, l);
text->SetFont(wxGetApp().bold_font());
add(text);

View File

@ -92,7 +92,7 @@ bool save_secret(const std::string& opt, const std::string& usr, const std::stri
const wxString username = boost::nowide::widen(usr);
const wxSecretValue password(boost::nowide::widen(psswd));
if (!store.Save(service, username, password)) {
std::string msg(_u8L("Failed to save credentials to the system secret store."));
std::string msg(_u8L("Failed to save credentials to the system password store."));
BOOST_LOG_TRIVIAL(error) << msg;
//show_error(nullptr, msg);
return false;
@ -118,7 +118,7 @@ bool load_secret(const std::string& opt, std::string& usr, std::string& psswd)
wxString username;
wxSecretValue password;
if (!store.Load(service, username, password)) {
std::string msg(_u8L("Failed to load credentials from the system secret store."));
std::string msg(_u8L("Failed to load credentials from the system password store."));
BOOST_LOG_TRIVIAL(error) << msg;
//show_error(nullptr, msg);
return false;

View File

@ -1053,7 +1053,7 @@ bool PresetUpdater::priv::perform_updates(Updates &&updates, const SharedArchive
if (it != repositories.end())
get_or_copy_missing_resource((*it), vp.id, resource, vp.repo_id);
else {
BOOST_LOG_TRIVIAL(error) << "Failed to prepare " << resource << " for " << vp.id << " " << model.id << ": Missing record for repository with repo_id " << vp.repo_id;
BOOST_LOG_TRIVIAL(error) << "Failed to prepare " << resource << " for " << vp.id << " " << model.id << ": Missing record for source with repo_id " << vp.repo_id;
}
}
catch (const std::exception& e)

View File

@ -315,11 +315,11 @@ bool PrusaConnectNew::get_storage(wxArrayString& storage_path, wxArrayString& st
wxString PrusaConnectNew::get_test_ok_msg() const
{
return _L("Test OK.");
return _L("Test passed.");
}
wxString PrusaConnectNew::get_test_failed_msg(wxString& msg) const
{
return _L("Test NOK.");
return _L("Test failed.");
}
std::string PrusaConnectNew::get_team_id(const std::string& data) const