mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-22 14:13:57 -06:00
Removes bottom status bar.
StatusBar class calls are commented out and replaced with notifications. SlicicingProgress notification shows progress of slicing, ProgressIndicator notification handles other progress information, like arrange objects etc.
This commit is contained in:
parent
3db4804e47
commit
b9dab7540e
23 changed files with 908 additions and 292 deletions
|
@ -1208,6 +1208,8 @@ void Sidebar::update_sliced_info_sizer()
|
|||
wxString t_est = std::isnan(ps.estimated_print_time) ? "N/A" : get_time_dhms(float(ps.estimated_print_time));
|
||||
p->sliced_info->SetTextAndShow(siEstimatedTime, t_est, _L("Estimated printing time") + ":");
|
||||
|
||||
p->plater->get_notification_manager()->set_slicing_complete_print_time(_utf8("Estimated printing time: ") + boost::nowide::narrow(t_est), p->plater->is_sidebar_collapsed());
|
||||
|
||||
// Hide non-SLA sliced info parameters
|
||||
p->sliced_info->SetTextAndShow(siFilament_m, "N/A");
|
||||
p->sliced_info->SetTextAndShow(siFilament_mm3, "N/A");
|
||||
|
@ -1296,10 +1298,7 @@ void Sidebar::update_sliced_info_sizer()
|
|||
new_label += format_wxstr("\n - %1%", _L("normal mode"));
|
||||
info_text += format_wxstr("\n%1%", short_time(ps.estimated_normal_print_time));
|
||||
|
||||
// uncomment next line to not disappear slicing finished notif when colapsing sidebar before time estimate
|
||||
//if (p->plater->is_sidebar_collapsed())
|
||||
p->plater->get_notification_manager()->set_slicing_complete_large(p->plater->is_sidebar_collapsed());
|
||||
p->plater->get_notification_manager()->set_slicing_complete_print_time("Estimated printing time: " + ps.estimated_normal_print_time);
|
||||
p->plater->get_notification_manager()->set_slicing_complete_print_time(_utf8("Estimated printing time: ") + ps.estimated_normal_print_time, p->plater->is_sidebar_collapsed());
|
||||
|
||||
}
|
||||
if (ps.estimated_silent_print_time != "N/A") {
|
||||
|
@ -1502,7 +1501,7 @@ struct Plater::priv
|
|||
GLToolbar view_toolbar;
|
||||
GLToolbar collapse_toolbar;
|
||||
Preview *preview;
|
||||
NotificationManager* notification_manager { nullptr };
|
||||
std::shared_ptr<NotificationManager> notification_manager;
|
||||
|
||||
ProjectDirtyStateManager dirty_state;
|
||||
|
||||
|
@ -1523,10 +1522,10 @@ struct Plater::priv
|
|||
public:
|
||||
Jobs(priv *_m) : m(_m)
|
||||
{
|
||||
m_arrange_id = add_job(std::make_unique<ArrangeJob>(m->statusbar(), m->q));
|
||||
m_fill_bed_id = add_job(std::make_unique<FillBedJob>(m->statusbar(), m->q));
|
||||
m_rotoptimize_id = add_job(std::make_unique<RotoptimizeJob>(m->statusbar(), m->q));
|
||||
m_sla_import_id = add_job(std::make_unique<SLAImportJob>(m->statusbar(), m->q));
|
||||
m_arrange_id = add_job(std::make_unique<ArrangeJob>(m->notification_manager, m->q));
|
||||
m_fill_bed_id = add_job(std::make_unique<FillBedJob>(m->notification_manager, m->q));
|
||||
m_rotoptimize_id = add_job(std::make_unique<RotoptimizeJob>(m->notification_manager, m->q));
|
||||
m_sla_import_id = add_job(std::make_unique<SLAImportJob>(m->notification_manager, m->q));
|
||||
}
|
||||
|
||||
void arrange()
|
||||
|
@ -1637,7 +1636,7 @@ struct Plater::priv
|
|||
void apply_free_camera_correction(bool apply = true);
|
||||
void update_ui_from_settings();
|
||||
void update_main_toolbar_tooltips();
|
||||
std::shared_ptr<ProgressStatusBar> statusbar();
|
||||
// std::shared_ptr<ProgressStatusBar> statusbar();
|
||||
std::string get_config(const std::string &key) const;
|
||||
BoundingBoxf bed_shape_bb() const;
|
||||
BoundingBox scaled_bed_shape_bb() const;
|
||||
|
@ -1788,6 +1787,8 @@ struct Plater::priv
|
|||
// extension should contain the leading dot, i.e.: ".3mf"
|
||||
wxString get_project_filename(const wxString& extension = wxEmptyString) const;
|
||||
void set_project_filename(const wxString& filename);
|
||||
// Call after plater and Canvas#D is initialized
|
||||
void init_notification_manager();
|
||||
|
||||
// Caching last value of show_action_buttons parameter for show_action_buttons(), so that a callback which does not know this state will not override it.
|
||||
mutable bool ready_to_slice = { false };
|
||||
|
@ -1797,6 +1798,7 @@ struct Plater::priv
|
|||
std::string last_output_dir_path;
|
||||
bool inside_snapshot_capture() { return m_prevent_snapshots != 0; }
|
||||
bool process_completed_with_error { false };
|
||||
|
||||
private:
|
||||
bool layers_height_allowed() const;
|
||||
|
||||
|
@ -1845,6 +1847,7 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame)
|
|||
"support_material_contact_distance", "support_material_bottom_contact_distance", "raft_layers"
|
||||
}))
|
||||
, sidebar(new Sidebar(q))
|
||||
, notification_manager(std::make_shared<NotificationManager>(q))
|
||||
, m_ui_jobs(this)
|
||||
, delayed_scene_refresh(false)
|
||||
, view_toolbar(GLToolbar::Radio, "View")
|
||||
|
@ -2012,7 +2015,8 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame)
|
|||
});
|
||||
#endif /* _WIN32 */
|
||||
|
||||
notification_manager = new NotificationManager(this->q);
|
||||
//notification_manager = new NotificationManager(this->q);
|
||||
|
||||
if (wxGetApp().is_editor()) {
|
||||
this->q->Bind(EVT_EJECT_DRIVE_NOTIFICAION_CLICKED, [this](EjectDriveNotificationClickedEvent&) { this->q->eject_drive(); });
|
||||
this->q->Bind(EVT_EXPORT_GCODE_NOTIFICAION_CLICKED, [this](ExportGcodeNotificationClickedEvent&) { this->q->export_gcode(true); });
|
||||
|
@ -2022,12 +2026,12 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame)
|
|||
this->show_action_buttons(this->ready_to_slice);
|
||||
notification_manager->close_notification_of_type(NotificationType::ExportFinished);
|
||||
notification_manager->push_notification(NotificationType::CustomNotification,
|
||||
NotificationManager::NotificationLevel::RegularNotification,
|
||||
NotificationManager::NotificationLevel::RegularNotificationLevel,
|
||||
format(_L("Successfully unmounted. The device %s(%s) can now be safely removed from the computer."), evt.data.first.name, evt.data.first.path)
|
||||
);
|
||||
} else {
|
||||
notification_manager->push_notification(NotificationType::CustomNotification,
|
||||
NotificationManager::NotificationLevel::ErrorNotification,
|
||||
NotificationManager::NotificationLevel::ErrorNotificationLevel,
|
||||
format(_L("Ejecting of device %s(%s) has failed."), evt.data.first.name, evt.data.first.path)
|
||||
);
|
||||
}
|
||||
|
@ -2074,8 +2078,7 @@ Plater::priv::~priv()
|
|||
{
|
||||
if (config != nullptr)
|
||||
delete config;
|
||||
if (notification_manager != nullptr)
|
||||
delete notification_manager;
|
||||
notification_manager->deactivate_loaded_hints();
|
||||
}
|
||||
|
||||
void Plater::priv::update(unsigned int flags)
|
||||
|
@ -2150,6 +2153,8 @@ void Plater::priv::collapse_sidebar(bool collapse)
|
|||
new_tooltip += " [Shift+Tab]";
|
||||
int id = collapse_toolbar.get_item_id("collapse_sidebar");
|
||||
collapse_toolbar.set_tooltip(id, new_tooltip);
|
||||
|
||||
notification_manager->set_sidebar_collapsed(collapse);
|
||||
}
|
||||
|
||||
|
||||
|
@ -2177,10 +2182,11 @@ void Plater::priv::update_main_toolbar_tooltips()
|
|||
view3D->get_canvas3d()->update_tooltip_for_settings_item_in_main_toolbar();
|
||||
}
|
||||
|
||||
std::shared_ptr<ProgressStatusBar> Plater::priv::statusbar()
|
||||
{
|
||||
return main_frame->m_statusbar;
|
||||
}
|
||||
//std::shared_ptr<ProgressStatusBar> Plater::priv::statusbar()
|
||||
//{
|
||||
// return nullptr;
|
||||
// return main_frame->m_statusbar;
|
||||
//}
|
||||
|
||||
std::string Plater::priv::get_config(const std::string &key) const
|
||||
{
|
||||
|
@ -2325,7 +2331,7 @@ std::vector<size_t> Plater::priv::load_files(const std::vector<fs::path>& input_
|
|||
for (std::string& name : names)
|
||||
notif_text += "\n - " + name;
|
||||
notification_manager->push_notification(NotificationType::CustomNotification,
|
||||
NotificationManager::NotificationLevel::RegularNotification, notif_text);
|
||||
NotificationManager::NotificationLevel::RegularNotificationLevel, notif_text);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2467,7 +2473,7 @@ std::vector<size_t> Plater::priv::load_files(const std::vector<fs::path>& input_
|
|||
if (load_model) {
|
||||
wxGetApp().app_config->update_skein_dir(input_files[input_files.size() - 1].parent_path().make_preferred().string());
|
||||
// XXX: Plater.pm had @loaded_files, but didn't seem to fill them with the filenames...
|
||||
statusbar()->set_status_text(_L("Loaded"));
|
||||
// statusbar()->set_status_text(_L("Loaded"));
|
||||
}
|
||||
|
||||
// automatic selection of added objects
|
||||
|
@ -2880,7 +2886,7 @@ void Plater::priv::split_object()
|
|||
// If we splited object which is contain some parts/modifiers then all non-solid parts (modifiers) were deleted
|
||||
if (current_model_object->volumes.size() > 1 && current_model_object->volumes.size() != new_objects.size())
|
||||
notification_manager->push_notification(NotificationType::CustomNotification,
|
||||
NotificationManager::NotificationLevel::RegularNotification,
|
||||
NotificationManager::NotificationLevel::RegularNotificationLevel,
|
||||
_u8L("All non-solid parts (modifiers) were deleted"));
|
||||
|
||||
Plater::TakeSnapshot snapshot(q, _L("Split to Objects"));
|
||||
|
@ -2956,7 +2962,7 @@ void Plater::priv::process_validation_warning(const std::string& warning) const
|
|||
|
||||
notification_manager->push_notification(
|
||||
NotificationType::ValidateWarning,
|
||||
NotificationManager::NotificationLevel::WarningNotification,
|
||||
NotificationManager::NotificationLevel::WarningNotificationLevel,
|
||||
_u8L("WARNING:") + "\n" + text, hypertext, action_fn
|
||||
);
|
||||
}
|
||||
|
@ -3002,6 +3008,8 @@ unsigned int Plater::priv::update_background_process(bool force_validation, bool
|
|||
// In SLA mode, we need to reload the 3D scene every time to show the support structures.
|
||||
if (printer_technology == ptSLA || (printer_technology == ptFFF && config->opt_bool("wipe_tower")))
|
||||
return_state |= UPDATE_BACKGROUND_PROCESS_REFRESH_SCENE;
|
||||
|
||||
notification_manager->set_slicing_progress_hidden();
|
||||
}
|
||||
|
||||
if ((invalidated != Print::APPLY_STATUS_UNCHANGED || force_validation) && ! background_process.empty()) {
|
||||
|
@ -3074,9 +3082,9 @@ unsigned int Plater::priv::update_background_process(bool force_validation, bool
|
|||
else
|
||||
{
|
||||
// Background data is valid.
|
||||
if ((return_state & UPDATE_BACKGROUND_PROCESS_RESTART) != 0 ||
|
||||
(return_state & UPDATE_BACKGROUND_PROCESS_REFRESH_SCENE) != 0 )
|
||||
this->statusbar()->set_status_text(_L("Ready to slice"));
|
||||
// if ((return_state & UPDATE_BACKGROUND_PROCESS_RESTART) != 0 ||
|
||||
// (return_state & UPDATE_BACKGROUND_PROCESS_REFRESH_SCENE) != 0 )
|
||||
// this->statusbar()->set_status_text(_L("Ready to slice"));
|
||||
|
||||
sidebar->set_btn_label(ActionButtonType::abExport, _(label_btn_export));
|
||||
sidebar->set_btn_label(ActionButtonType::abSendGCode, _(label_btn_send));
|
||||
|
@ -3113,10 +3121,10 @@ bool Plater::priv::restart_background_process(unsigned int state)
|
|||
(state & UPDATE_BACKGROUND_PROCESS_RESTART) != 0 ) ) {
|
||||
// The print is valid and it can be started.
|
||||
if (this->background_process.start()) {
|
||||
this->statusbar()->set_cancel_callback([this]() {
|
||||
this->statusbar()->set_status_text(_L("Cancelling"));
|
||||
this->background_process.stop();
|
||||
});
|
||||
// this->statusbar()->set_cancel_callback([this]() {
|
||||
// this->statusbar()->set_status_text(_L("Cancelling"));
|
||||
// this->background_process.stop();
|
||||
// });
|
||||
if (!show_warning_dialog)
|
||||
on_slicing_began();
|
||||
return true;
|
||||
|
@ -3753,9 +3761,9 @@ void Plater::priv::on_slicing_update(SlicingStatusEvent &evt)
|
|||
return;
|
||||
}
|
||||
|
||||
this->statusbar()->set_progress(evt.status.percent);
|
||||
this->statusbar()->set_status_text(_(evt.status.text) + wxString::FromUTF8("…"));
|
||||
//notification_manager->set_progress_bar_percentage("Slicing progress", (float)evt.status.percent / 100.0f);
|
||||
// this->statusbar()->set_progress(evt.status.percent);
|
||||
// this->statusbar()->set_status_text(_(evt.status.text) + wxString::FromUTF8("…"));
|
||||
notification_manager->set_slicing_progress_percentage(evt.status.text, (float)evt.status.percent / 100.0f);
|
||||
}
|
||||
if (evt.status.flags & (PrintBase::SlicingStatus::RELOAD_SCENE | PrintBase::SlicingStatus::RELOAD_SLA_SUPPORT_POINTS)) {
|
||||
switch (this->printer_technology) {
|
||||
|
@ -3806,7 +3814,6 @@ void Plater::priv::on_slicing_update(SlicingStatusEvent &evt)
|
|||
|
||||
void Plater::priv::on_slicing_completed(wxCommandEvent & evt)
|
||||
{
|
||||
notification_manager->push_slicing_complete_notification(evt.GetInt(), is_sidebar_collapsed());
|
||||
switch (this->printer_technology) {
|
||||
case ptFFF:
|
||||
this->update_fff_scene();
|
||||
|
@ -3829,8 +3836,8 @@ void Plater::priv::on_export_began(wxCommandEvent& evt)
|
|||
void Plater::priv::on_slicing_began()
|
||||
{
|
||||
clear_warnings();
|
||||
notification_manager->close_notification_of_type(NotificationType::SlicingComplete);
|
||||
notification_manager->close_notification_of_type(NotificationType::SignDetected);
|
||||
notification_manager->close_notification_of_type(NotificationType::ExportFinished);
|
||||
}
|
||||
void Plater::priv::add_warning(const Slic3r::PrintStateBase::Warning& warning, size_t oid)
|
||||
{
|
||||
|
@ -3895,8 +3902,9 @@ void Plater::priv::on_process_completed(SlicingProcessCompletedEvent &evt)
|
|||
// At this point of time the thread should be either finished or canceled,
|
||||
// so the following call just confirms, that the produced data were consumed.
|
||||
this->background_process.stop();
|
||||
this->statusbar()->reset_cancel_callback();
|
||||
this->statusbar()->stop_busy();
|
||||
// this->statusbar()->reset_cancel_callback();
|
||||
// this->statusbar()->stop_busy();
|
||||
notification_manager->set_slicing_progress_export_possible();
|
||||
|
||||
// Reset the "export G-code path" name, so that the automatic background processing will be enabled again.
|
||||
this->background_process.reset_export();
|
||||
|
@ -3913,7 +3921,7 @@ void Plater::priv::on_process_completed(SlicingProcessCompletedEvent &evt)
|
|||
show_error(q, message.first, message.second);
|
||||
} else
|
||||
notification_manager->push_slicing_error_notification(message.first);
|
||||
this->statusbar()->set_status_text(from_u8(message.first));
|
||||
// this->statusbar()->set_status_text(from_u8(message.first));
|
||||
if (evt.invalidate_plater())
|
||||
{
|
||||
const wxString invalid_str = _L("Invalid data");
|
||||
|
@ -3923,8 +3931,10 @@ void Plater::priv::on_process_completed(SlicingProcessCompletedEvent &evt)
|
|||
}
|
||||
has_error = true;
|
||||
}
|
||||
if (evt.cancelled())
|
||||
this->statusbar()->set_status_text(_L("Cancelled"));
|
||||
if (evt.cancelled()) {
|
||||
// this->statusbar()->set_status_text(_L("Cancelled"));
|
||||
this->notification_manager->set_slicing_progress_percentage(_utf8("Slicing Cancelled."), -1);
|
||||
}
|
||||
|
||||
this->sidebar->show_sliced_info_sizer(evt.success());
|
||||
|
||||
|
@ -4128,6 +4138,20 @@ void Plater::priv::set_project_filename(const wxString& filename)
|
|||
wxGetApp().mainframe->add_to_recent_projects(filename);
|
||||
}
|
||||
|
||||
void Plater::priv::init_notification_manager()
|
||||
{
|
||||
if (!notification_manager)
|
||||
return;
|
||||
notification_manager->init();
|
||||
|
||||
auto cancel_callback = [this]() {
|
||||
this->background_process.stop();
|
||||
};
|
||||
notification_manager->init_slicing_progress_notification(cancel_callback);
|
||||
notification_manager->set_fff(printer_technology == ptFFF);
|
||||
notification_manager->init_progress_indicator();
|
||||
}
|
||||
|
||||
void Plater::priv::set_current_canvas_as_dirty()
|
||||
{
|
||||
if (current_panel == view3D)
|
||||
|
@ -5566,7 +5590,7 @@ void Plater::export_stl(bool extended, bool selection_only)
|
|||
}
|
||||
|
||||
Slic3r::store_stl(path_u8.c_str(), &mesh, true);
|
||||
p->statusbar()->set_status_text(format_wxstr(_L("STL file exported to %s"), path));
|
||||
// p->statusbar()->set_status_text(format_wxstr(_L("STL file exported to %s"), path));
|
||||
}
|
||||
|
||||
void Plater::export_amf()
|
||||
|
@ -5583,10 +5607,10 @@ void Plater::export_amf()
|
|||
bool full_pathnames = wxGetApp().app_config->get("export_sources_full_pathnames") == "1";
|
||||
if (Slic3r::store_amf(path_u8.c_str(), &p->model, export_config ? &cfg : nullptr, full_pathnames)) {
|
||||
// Success
|
||||
p->statusbar()->set_status_text(format_wxstr(_L("AMF file exported to %s"), path));
|
||||
// p->statusbar()->set_status_text(format_wxstr(_L("AMF file exported to %s"), path));
|
||||
} else {
|
||||
// Failure
|
||||
p->statusbar()->set_status_text(format_wxstr(_L("Error exporting AMF file %s"), path));
|
||||
// p->statusbar()->set_status_text(format_wxstr(_L("Error exporting AMF file %s"), path));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5625,12 +5649,12 @@ bool Plater::export_3mf(const boost::filesystem::path& output_path)
|
|||
bool ret = Slic3r::store_3mf(path_u8.c_str(), &p->model, export_config ? &cfg : nullptr, full_pathnames, &thumbnail_data);
|
||||
if (ret) {
|
||||
// Success
|
||||
p->statusbar()->set_status_text(format_wxstr(_L("3MF file exported to %s"), path));
|
||||
// p->statusbar()->set_status_text(format_wxstr(_L("3MF file exported to %s"), path));
|
||||
p->set_project_filename(path);
|
||||
}
|
||||
else {
|
||||
// Failure
|
||||
p->statusbar()->set_status_text(format_wxstr(_L("Error exporting 3MF file %s"), path));
|
||||
// p->statusbar()->set_status_text(format_wxstr(_L("Error exporting 3MF file %s"), path));
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
@ -6204,6 +6228,8 @@ bool Plater::set_printer_technology(PrinterTechnology printer_technology)
|
|||
|
||||
p->sidebar->get_searcher().set_printer_technology(printer_technology);
|
||||
|
||||
p->notification_manager->set_fff(printer_technology == ptFFF);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -6224,7 +6250,7 @@ void Plater::clear_before_change_mesh(int obj_idx)
|
|||
// snapshot_time is captured by copy so the lambda knows where to undo/redo to.
|
||||
get_notification_manager()->push_notification(
|
||||
NotificationType::CustomSupportsAndSeamRemovedAfterRepair,
|
||||
NotificationManager::NotificationLevel::RegularNotification,
|
||||
NotificationManager::NotificationLevel::RegularNotificationLevel,
|
||||
_u8L("Custom supports, seams and multimaterial painting were "
|
||||
"removed after repairing the mesh."));
|
||||
// _u8L("Undo the repair"),
|
||||
|
@ -6237,7 +6263,7 @@ void Plater::clear_before_change_mesh(int obj_idx)
|
|||
// else
|
||||
// notification_manager->push_notification(
|
||||
// NotificationType::CustomSupportsAndSeamRemovedAfterRepair,
|
||||
// NotificationManager::NotificationLevel::RegularNotification,
|
||||
// NotificationManager::NotificationLevel::RegularNotificationLevel,
|
||||
// _u8L("Cannot undo to before the mesh repair!"));
|
||||
// return true;
|
||||
// });
|
||||
|
@ -6503,14 +6529,14 @@ Mouse3DController& Plater::get_mouse3d_controller()
|
|||
return p->mouse3d_controller;
|
||||
}
|
||||
|
||||
const NotificationManager* Plater::get_notification_manager() const
|
||||
std::shared_ptr<NotificationManager> Plater::get_notification_manager()
|
||||
{
|
||||
return p->notification_manager;
|
||||
}
|
||||
|
||||
NotificationManager* Plater::get_notification_manager()
|
||||
void Plater::init_notification_manager()
|
||||
{
|
||||
return p->notification_manager;
|
||||
p->init_notification_manager();
|
||||
}
|
||||
|
||||
bool Plater::can_delete() const { return p->can_delete(); }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue