mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-14 01:36:14 +08:00
Mockup of UI notification when http communication performs retry.
This commit is contained in:
parent
7188239a1a
commit
2d12c61ea0
@ -144,6 +144,8 @@ enum class NotificationType
|
||||
WipeTowerNozzleDiameterDiffer,
|
||||
// Notification about using supports with different nozzle diameters.
|
||||
SupportNozzleDiameterDiffer,
|
||||
// Transient error on Prusa Account communication - user is informed and has option to cancel (logout)
|
||||
AccountTransientRetry,
|
||||
};
|
||||
|
||||
class NotificationManager
|
||||
|
@ -1078,6 +1078,22 @@ void Plater::priv::init()
|
||||
}
|
||||
this->q->printables_to_connect_gcode(into_u8(evt.GetString()));
|
||||
});
|
||||
|
||||
this->q->Bind(EVT_UA_RETRY_NOTIFY, [this](UserAccountFailEvent& evt) {
|
||||
this->notification_manager->close_notification_of_type(NotificationType::AccountTransientRetry);
|
||||
this->notification_manager->push_notification(NotificationType::AccountTransientRetry
|
||||
, NotificationManager::NotificationLevel::RegularNotificationLevel
|
||||
, evt.data
|
||||
, _u8L("Stop now.")
|
||||
, [this](wxEvtHandler* ) {
|
||||
this->user_account->do_logout();
|
||||
return true;
|
||||
});
|
||||
|
||||
});
|
||||
this->q->Bind(EVT_UA_CLOSE_RETRY_NOTIFICATION, [this](SimpleEvent& evt) {
|
||||
this->notification_manager->close_notification_of_type(NotificationType::AccountTransientRetry);
|
||||
});
|
||||
}
|
||||
|
||||
wxGetApp().other_instance_message_handler()->init(this->q);
|
||||
|
@ -315,7 +315,7 @@ void UserAccountCommunication::set_username(const std::string& username)
|
||||
BOOST_LOG_TRIVIAL(error) << "Failed to write tokens to the secret store.";
|
||||
}
|
||||
} else {
|
||||
//#ifdef __linux__
|
||||
#ifdef __linux__
|
||||
// If we can't store the tokens in secret store, store them in file with chmod 600
|
||||
boost::filesystem::path target(boost::filesystem::path(Slic3r::data_dir()) / "UserAccount.dat") ;
|
||||
std::string data = "||||";
|
||||
|
@ -32,6 +32,8 @@ wxDEFINE_EVENT(EVT_UA_RACE_LOST, UserAccountFailEvent);
|
||||
wxDEFINE_EVENT(EVT_UA_PRUSACONNECT_PRINTER_DATA_FAIL, UserAccountFailEvent);
|
||||
wxDEFINE_EVENT(EVT_UA_REFRESH_TIME, UserAccountTimeEvent);
|
||||
wxDEFINE_EVENT(EVT_UA_ENQUEUED_REFRESH, SimpleEvent);
|
||||
wxDEFINE_EVENT(EVT_UA_RETRY_NOTIFY, UserAccountFailEvent);
|
||||
wxDEFINE_EVENT(EVT_UA_CLOSE_RETRY_NOTIFICATION, SimpleEvent);
|
||||
|
||||
void UserActionPost::perform(/*UNUSED*/ wxEvtHandler* evt_handler, /*UNUSED*/ const std::string& access_token, UserActionSuccessFn success_callback, UserActionFailFn fail_callback, const std::string& input) const
|
||||
{
|
||||
|
@ -32,6 +32,9 @@ wxDECLARE_EVENT(EVT_UA_RACE_LOST, UserAccountFailEvent); // Hard fail - clears a
|
||||
wxDECLARE_EVENT(EVT_UA_PRUSACONNECT_PRINTER_DATA_FAIL, UserAccountFailEvent); // Failed to get data for printer to select, soft fail, action does not repeat
|
||||
wxDECLARE_EVENT(EVT_UA_REFRESH_TIME, UserAccountTimeEvent);
|
||||
wxDECLARE_EVENT(EVT_UA_ENQUEUED_REFRESH, SimpleEvent);
|
||||
wxDECLARE_EVENT(EVT_UA_RETRY_NOTIFY, UserAccountFailEvent); // Not fail yet, just retry attempt. string is message to ui.
|
||||
wxDECLARE_EVENT(EVT_UA_CLOSE_RETRY_NOTIFICATION, SimpleEvent);
|
||||
|
||||
|
||||
typedef std::function<void(const std::string& body)> UserActionSuccessFn;
|
||||
typedef std::function<void(const std::string& body)> UserActionFailFn;
|
||||
|
Loading…
x
Reference in New Issue
Block a user