Merge branch 'master' of https://github.com/prusa3d/PrusaSlicer into et_splitted_vbuffer

This commit is contained in:
enricoturri1966 2020-12-10 11:55:30 +01:00
commit 98515e4fa1
9 changed files with 58 additions and 12 deletions

View file

@ -65,6 +65,7 @@
#include "NotificationManager.hpp"
#include "UnsavedChangesDialog.hpp"
#include "SavePresetDialog.hpp"
#include "PrintHostDialogs.hpp"
#include "BitmapCache.hpp"
@ -1707,6 +1708,33 @@ bool GUI_App::check_unsaved_changes(const wxString &header)
return true;
}
bool GUI_App::check_print_host_queue()
{
wxString dirty;
std::vector<std::pair<std::string, std::string>> jobs;
// Get ongoing jobs from dialog
mainframe->m_printhost_queue_dlg->get_active_jobs(jobs);
if (jobs.empty())
return true;
// Show dialog
wxString job_string = wxString();
for (const auto& job : jobs) {
job_string += (boost::format(" %1% : %2% \n") % job.first % job.second).str();
}
wxString message;
message += _(L("The uploads are still ongoing")) + ":\n\n" + job_string +"\n" + _(L("Stop them and continue anyway?"));
wxMessageDialog dialog(mainframe,
message,
wxString(SLIC3R_APP_NAME) + " - " + _(L("Ongoing uploads")),
wxICON_QUESTION | wxYES_NO | wxNO_DEFAULT);
if (dialog.ShowModal() == wxID_YES)
return true;
// TODO: If already shown, bring forward
mainframe->m_printhost_queue_dlg->Show();
return false;
}
bool GUI_App::checked_tab(Tab* tab)
{
bool ret = true;

View file

@ -205,6 +205,7 @@ public:
void add_config_menu(wxMenuBar *menu);
bool check_unsaved_changes(const wxString &header = wxString());
bool check_print_host_queue();
bool checked_tab(Tab* tab);
void load_current_presets(bool check_printer_presets = true);

View file

@ -209,6 +209,10 @@ DPIFrame(NULL, wxID_ANY, "", wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_S
event.Veto();
return;
}
if (event.CanVeto() && !wxGetApp().check_print_host_queue()) {
event.Veto();
return;
}
this->shutdown();
// propagate event
event.Skip();

View file

@ -79,7 +79,7 @@ class MainFrame : public DPIFrame
wxMenuItem* m_menu_item_reslice_now { nullptr };
wxSizer* m_main_sizer{ nullptr };
PrintHostQueueDialog *m_printhost_queue_dlg;
size_t m_last_selected_tab;
@ -187,11 +187,12 @@ public:
PrintHostQueueDialog* printhost_queue_dlg() { return m_printhost_queue_dlg; }
Plater* m_plater { nullptr };
wxNotebook* m_tabpanel { nullptr };
SettingsDialog m_settings_dialog;
wxWindow* m_plater_page{ nullptr };
wxProgressDialog* m_progress_dialog { nullptr };
Plater* m_plater { nullptr };
wxNotebook* m_tabpanel { nullptr };
SettingsDialog m_settings_dialog;
wxWindow* m_plater_page{ nullptr };
wxProgressDialog* m_progress_dialog { nullptr };
PrintHostQueueDialog* m_printhost_queue_dlg;
std::shared_ptr<ProgressStatusBar> m_statusbar;
#ifdef __APPLE__

View file

@ -230,6 +230,7 @@ void PrintHostQueueDialog::append_job(const PrintHostJob &job)
fields.push_back(wxVariant(job.upload_data.upload_path.string()));
fields.push_back(wxVariant(""));
job_list->AppendItem(fields, static_cast<wxUIntPtr>(ST_NEW));
upload_names.emplace_back(job.printhost->get_host(), job.upload_data.upload_path.string());
}
void PrintHostQueueDialog::on_dpi_changed(const wxRect &suggested_rect)
@ -317,6 +318,17 @@ void PrintHostQueueDialog::on_cancel(Event &evt)
on_list_select();
}
void PrintHostQueueDialog::get_active_jobs(std::vector<std::pair<std::string, std::string>>& ret)
{
int ic = job_list->GetItemCount();
for (size_t i = 0; i < ic; i++)
{
auto item = job_list->RowToItem(i);
auto data = job_list->GetItemData(item);
JobState st = static_cast<JobState>(data);
if(st == JobState::ST_NEW || st == JobState::ST_PROGRESS)
ret.emplace_back(upload_names[i]);
}
//job_list->data
}
}}

View file

@ -64,7 +64,7 @@ public:
PrintHostQueueDialog(wxWindow *parent);
void append_job(const PrintHostJob &job);
void get_active_jobs(std::vector<std::pair<std::string, std::string>>& ret);
protected:
void on_dpi_changed(const wxRect &suggested_rect) override;
@ -103,13 +103,14 @@ private:
void on_progress(Event&);
void on_error(Event&);
void on_cancel(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;
};
wxDECLARE_EVENT(EVT_PRINTHOST_PROGRESS, PrintHostQueueDialog::Event);
wxDECLARE_EVENT(EVT_PRINTHOST_ERROR, PrintHostQueueDialog::Event);
wxDECLARE_EVENT(EVT_PRINTHOST_CANCEL, PrintHostQueueDialog::Event);
}}
#endif

View file

@ -1208,6 +1208,7 @@ FullCompareDialog::FullCompareDialog(const wxString& option_name, const wxString
}
}
} // namespace Slic3r::GUI

View file

@ -270,7 +270,6 @@ public:
~FullCompareDialog() {}
};
}
}

View file

@ -275,5 +275,4 @@ void PrintHostJobQueue::cancel(size_t id)
p->channel_cancels.push(id);
}
}