Skip to content

Commit

Permalink
Move the recompute dialog to after Gui opens instead of per document …
Browse files Browse the repository at this point in the history
…signal.
  • Loading branch information
bgbsww authored and chennes committed Sep 19, 2024
1 parent 0be29b1 commit f82bfd5
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
6 changes: 2 additions & 4 deletions src/Gui/Application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -378,8 +378,6 @@ Application::Application(bool GUIenabled)
std::bind(&Gui::Application::slotRelabelDocument, this, sp::_1));
App::GetApplication().signalShowHidden.connect(
std::bind(&Gui::Application::slotShowHidden, this, sp::_1));
App::GetApplication().signalFinishRestoreDocument.connect(
std::bind(&Gui::Application::slotFinishRestoreDocument, this, sp::_1));
// NOLINTEND
// install the last active language
ParameterGrp::handle hPGrp = App::GetApplication().GetUserParameter().GetGroup("BaseApp");
Expand Down Expand Up @@ -634,6 +632,7 @@ void Application::open(const char* FileName, const char* Module)
Command::doCommand(Command::App,
"FreeCAD.openDocument('%s')",
unicodepath.c_str());
Gui::Application::checkForRecomputes();
}
}
else {
Expand Down Expand Up @@ -979,8 +978,7 @@ void Application::slotShowHidden(const App::Document& Doc)
signalShowHidden(*doc->second);
}

void Application::slotFinishRestoreDocument([[maybe_unused]] const App::Document& Doc) {
// Quietly gnore the doc parameter and check across all documents.
void Application::checkForRecomputes() {
std::vector<App::Document *> docs;
for (auto doc: App::GetApplication().getDocuments()) {
if (doc->testStatus(App::Document::RecomputeOnRestore)) {
Expand Down
5 changes: 2 additions & 3 deletions src/Gui/Application.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ class GuiExport Application
void exportTo(const char* FileName, const char* DocName, const char* Module);
/// Reload a partial opened document
App::Document *reopen(App::Document *doc);
/// Prompt about recomputing if needed
static void checkForRecomputes();
//@}


Expand Down Expand Up @@ -131,8 +133,6 @@ class GuiExport Application
boost::signals2::signal<void ()> signalRefreshWorkbenches;
/// signal on show hidden items
boost::signals2::signal<void (const Gui::Document&)> signalShowHidden;
/// signal on document restore complete
boost::signals2::signal<void (const Gui::Document&)> signalFinishRestoreDocument;
/// signal on activating view
boost::signals2::signal<void (const Gui::MDIView*)> signalActivateView;
/// signal on entering in edit mode
Expand All @@ -153,7 +153,6 @@ class GuiExport Application
void slotRenameDocument(const App::Document&);
void slotActiveDocument(const App::Document&);
void slotShowHidden(const App::Document&);
void slotFinishRestoreDocument(const App::Document&);
void slotNewObject(const ViewProvider&);
void slotDeletedObject(const ViewProvider&);
void slotChangedObject(const ViewProvider&, const App::Property& Prop);
Expand Down
2 changes: 2 additions & 0 deletions src/Mod/Start/Gui/StartView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,7 @@ void StartView::openExistingFile() const
{
auto originalDocument = Gui::Application::Instance->activeDocument();
Gui::Application::Instance->commandManager().runCommandByName("Std_Open");
Gui::Application::checkForRecomputes();
if (Gui::Application::Instance->activeDocument() != originalDocument) {
// Only run this if the user chose a new document to open (that is, they didn't cancel the
// open file dialog)
Expand Down Expand Up @@ -436,6 +437,7 @@ void StartView::fileCardSelected(const QModelIndex& index)
auto command = std::string("FreeCAD.loadFile('") + escapedstr + "')";
try {
Base::Interpreter().runString(command.c_str());
Gui::Application::checkForRecomputes();
postStart(PostStartBehavior::doNotSwitchWorkbench);
}
catch (Base::PyException& e) {
Expand Down

0 comments on commit f82bfd5

Please sign in to comment.