mirror of
https://github.com/4ian/GDevelop.git
synced 2025-10-15 10:19:04 +00:00
Removed any use of wxProgressDialog on Mac OS X (Freeze the app due to the call to YieldFor while running SFML canvas)
This commit is contained in:
@@ -68,7 +68,7 @@ bool ProjectResourcesCopier::CopyAllResourcesTo(gd::Project & originalProject, A
|
||||
{
|
||||
if ( !it->first.empty() )
|
||||
{
|
||||
#if !defined(GD_NO_WX_GUI)
|
||||
#if !defined(GD_NO_WX_GUI) && !defined(MACOS) //wxProgressDialog can freeze on MacOS with SFML running
|
||||
if ( optionalProgressDialog )
|
||||
{
|
||||
if ( !optionalProgressDialog->Update(i/static_cast<float>(resourcesNewFilename.size())*100.0f, _("Exporting ")+it->second) )
|
||||
|
43
Core/GDCore/IDE/wxTools/ShowFolder.cpp
Normal file
43
Core/GDCore/IDE/wxTools/ShowFolder.cpp
Normal file
@@ -0,0 +1,43 @@
|
||||
/*
|
||||
* GDevelop Core
|
||||
* Copyright 2008-2015 Florian Rival (Florian.Rival@gmail.com). All rights reserved.
|
||||
* This project is released under the MIT License.
|
||||
*/
|
||||
#if defined(GD_IDE_ONLY) && !defined(GD_NO_WX_GUI)
|
||||
#include <iomanip>
|
||||
#include "GDCore/Tools/Localization.h"
|
||||
#include "ShowFolder.h"
|
||||
#include <wx/utils.h>
|
||||
#include <wx/log.h>
|
||||
|
||||
namespace gd
|
||||
{
|
||||
|
||||
/**
|
||||
* \brief Open a folder with the file explorer/finder.
|
||||
*
|
||||
* \ingroup IDE
|
||||
* \ingroup wxTools
|
||||
*/
|
||||
void GD_CORE_API ShowFolder(wxString path)
|
||||
{
|
||||
#if defined(WINDOWS)
|
||||
wxExecute("explorer.exe \""+path+"\"");
|
||||
#elif defined(MACOS)
|
||||
system(std::string("open \""+path+"\"").c_str());
|
||||
#elif defined(LINUX)
|
||||
int returnCode = system(std::string("xdg-open \""+path+"\"").c_str());
|
||||
|
||||
if (returnCode != 0) {
|
||||
wxString error = _("Oops, it seems that the folder couldn't be displayed. Open your file explorer and go to:\n\n");
|
||||
error += path;
|
||||
wxLogWarning(error);
|
||||
}
|
||||
#else
|
||||
#warning gd::ShowFolder is not available for your system.
|
||||
#endif
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endif
|
32
Core/GDCore/IDE/wxTools/ShowFolder.h
Normal file
32
Core/GDCore/IDE/wxTools/ShowFolder.h
Normal file
@@ -0,0 +1,32 @@
|
||||
/*
|
||||
* GDevelop Core
|
||||
* Copyright 2008-2015 Florian Rival (Florian.Rival@gmail.com). All rights reserved.
|
||||
* This project is released under the MIT License.
|
||||
*/
|
||||
#if defined(GD_IDE_ONLY) && !defined(GD_NO_WX_GUI)
|
||||
#ifndef GDCORE_SHOWFOLDER_H
|
||||
#define GDCORE_SHOWFOLDER_H
|
||||
#include <iomanip>
|
||||
#include "GDCore/Tools/Localization.h"
|
||||
#include <wx/utils.h>
|
||||
#include <wx/log.h>
|
||||
|
||||
namespace gd
|
||||
{
|
||||
|
||||
/**
|
||||
* \brief Open a folder in the system file explorer.
|
||||
*
|
||||
* On Windows, explorer.exe is used.
|
||||
* On MacOS, "open" is called.
|
||||
* On Linux, "xdg-open" is called.
|
||||
*
|
||||
* \ingroup IDE
|
||||
* \ingroup wxTools
|
||||
*/
|
||||
void GD_CORE_API ShowFolder(wxString path);
|
||||
|
||||
}
|
||||
|
||||
#endif // GDCORE_SHOWFOLDER_H
|
||||
#endif
|
@@ -30,6 +30,7 @@
|
||||
#include <fstream>
|
||||
|
||||
#include "GDCore/IDE/SkinHelper.h"
|
||||
#include "GDCore/IDE/wxTools/ShowFolder.h"
|
||||
#include "GDCore/PlatformDefinition/Project.h"
|
||||
#include "GDCore/PlatformDefinition/Layout.h"
|
||||
#include "GDCore/PlatformDefinition/ExternalEvents.h"
|
||||
@@ -212,13 +213,7 @@ public:
|
||||
staticText1->SetLabel(_("Compilation finished")); staticText2->SetLabel(_("Compiled project is now available in the export folder."));
|
||||
if ( wxMessageBox(_("Compilation achieved. Do you want to open the folder where the project has been compiled\?"), _("Compilation finished"), wxYES_NO) == wxYES )
|
||||
{
|
||||
#if defined(WINDOWS)
|
||||
wxExecute("explorer.exe \""+string(destinationDirectory.mb_str())+"\"");
|
||||
#elif defined(LINUX)
|
||||
system(string("xdg-open \""+string(destinationDirectory.mb_str())+"\"").c_str());
|
||||
#elif defined(MACOS)
|
||||
system(string("open \""+string(destinationDirectory.mb_str())+"\"").c_str());
|
||||
#endif
|
||||
gd::ShowFolder(gd::ToString(destinationDirectory));
|
||||
}
|
||||
}
|
||||
virtual void OnMessage(std::string message, std::string message2) { staticText1->SetLabel(message); staticText2->SetLabel(message2); };
|
||||
|
@@ -28,6 +28,7 @@
|
||||
#include "GDCore/PlatformDefinition/ExternalEvents.h"
|
||||
#include "GDCore/PlatformDefinition/SourceFile.h"
|
||||
#include "GDCore/IDE/wxTools/RecursiveMkDir.h"
|
||||
#include "GDCore/IDE/wxTools/ShowFolder.h"
|
||||
#include "GDCore/IDE/ProjectResourcesCopier.h"
|
||||
#include "GDCore/IDE/ProjectStripper.h"
|
||||
#include "GDCore/CommonTools.h"
|
||||
@@ -499,7 +500,7 @@ bool Exporter::ExportWholeProject(gd::Project & project, std::string exportDir,
|
||||
bool exportToZipFile = exportForCocoonJS;
|
||||
|
||||
{
|
||||
#if !defined(GD_NO_WX_GUI)
|
||||
#if !defined(GD_NO_WX_GUI) && !defined(MACOS) //wxProgressDialog can freeze on MacOS with SFML running
|
||||
wxProgressDialog progressDialog(_("Export in progress ( 1/2 )"), _("Exporting the project..."));
|
||||
#endif
|
||||
|
||||
@@ -519,13 +520,13 @@ bool Exporter::ExportWholeProject(gd::Project & project, std::string exportDir,
|
||||
gd::Project exportedProject = project;
|
||||
|
||||
//Export the resources ( before generating events as some resources filenames may be updated )
|
||||
#if !defined(GD_NO_WX_GUI)
|
||||
#if !defined(GD_NO_WX_GUI) && !defined(MACOS) //wxProgressDialog can freeze on MacOS with SFML running
|
||||
ExportResources(fs, exportedProject, exportDir, &progressDialog);
|
||||
#else
|
||||
ExportResources(fs, exportedProject, exportDir, NULL);
|
||||
#endif
|
||||
|
||||
#if !defined(GD_NO_WX_GUI)
|
||||
#if !defined(GD_NO_WX_GUI) && !defined(MACOS) //wxProgressDialog can freeze on MacOS with SFML running
|
||||
progressDialog.SetTitle(_("Export in progress ( 2/2 )"));
|
||||
progressDialog.Update(50, _("Exporting events..."));
|
||||
#endif
|
||||
@@ -544,14 +545,14 @@ bool Exporter::ExportWholeProject(gd::Project & project, std::string exportDir,
|
||||
return false;
|
||||
}
|
||||
|
||||
#if !defined(GD_NO_WX_GUI)
|
||||
#if !defined(GD_NO_WX_GUI) && !defined(MACOS) //wxProgressDialog can freeze on MacOS with SFML running
|
||||
progressDialog.Update(60, _("Preparing the project..."));
|
||||
#endif
|
||||
|
||||
//Strip the project (*after* generating events as the events may use stripped things like objects groups...)...
|
||||
gd::ProjectStripper::StripProject(exportedProject);
|
||||
|
||||
#if !defined(GD_NO_WX_GUI)
|
||||
#if !defined(GD_NO_WX_GUI) && !defined(MACOS) //wxProgressDialog can freeze on MacOS with SFML running
|
||||
progressDialog.Update(70, _("Exporting files..."));
|
||||
#endif
|
||||
|
||||
@@ -560,7 +561,7 @@ bool Exporter::ExportWholeProject(gd::Project & project, std::string exportDir,
|
||||
"gdjs.projectData", false);
|
||||
includesFiles.push_back(fs.GetTempDir()+"/GDTemporaries/JSCodeTemp/data.js");
|
||||
|
||||
#if !defined(GD_NO_WX_GUI)
|
||||
#if !defined(GD_NO_WX_GUI) && !defined(MACOS) //wxProgressDialog can freeze on MacOS with SFML running
|
||||
progressDialog.Update(80, minify ? _("Exporting files and minifying them...") : _("Exporting files..."));
|
||||
#endif
|
||||
|
||||
@@ -581,7 +582,9 @@ bool Exporter::ExportWholeProject(gd::Project & project, std::string exportDir,
|
||||
if ( exportToZipFile )
|
||||
{
|
||||
#if !defined(GD_NO_WX_GUI)
|
||||
#if !defined(MACOS) //wxProgressDialog can freeze on MacOS with SFML running
|
||||
progressDialog.Update(90, _("Creating the zip file..."));
|
||||
#endif
|
||||
|
||||
//Getting all the files to includes in the directory
|
||||
wxArrayString files;
|
||||
@@ -606,7 +609,9 @@ bool Exporter::ExportWholeProject(gd::Project & project, std::string exportDir,
|
||||
gd::LogWarning(_("Unable to finalize the creation of the zip file!\n\nThe exported project won't be put in a zip file."));
|
||||
else
|
||||
{
|
||||
#if !defined(MACOS) //wxProgressDialog can freeze on MacOS with SFML running
|
||||
progressDialog.Update(95, _("Cleaning files..."));
|
||||
#endif
|
||||
|
||||
fs.ClearDir(exportDir);
|
||||
fs.CopyFile(gd::ToString(zipTempName), exportDir+"/packaged_game.zip");
|
||||
@@ -635,20 +640,7 @@ bool Exporter::ExportWholeProject(gd::Project & project, std::string exportDir,
|
||||
if ( wxMessageBox(_("Compilation achieved. Do you want to open the folder where the project has been compiled\?"),
|
||||
_("Compilation finished"), wxYES_NO) == wxYES )
|
||||
{
|
||||
int returnCode = 0;
|
||||
#if defined(WINDOWS)
|
||||
wxExecute("explorer.exe \""+exportDir+"\"");
|
||||
#elif defined(LINUX)
|
||||
returnCode = system(std::string("xdg-open \""+exportDir+"\"").c_str());
|
||||
#elif defined(MACOS)
|
||||
returnCode = system(std::string("open \""+exportDir+"\"").c_str());
|
||||
#endif
|
||||
|
||||
if (returnCode != 0) {
|
||||
wxString error = _("Oops, it seems that the folder couldn't be displayed. Open your file explorer and go to:\n\n");
|
||||
error += exportDir;
|
||||
wxLogWarning(error);
|
||||
}
|
||||
gd::ShowFolder(exportDir);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@@ -20,6 +20,7 @@
|
||||
#include <wx/busyinfo.h>
|
||||
#include <fstream>
|
||||
#include "GDCore/Tools/HelpFileAccess.h"
|
||||
#include "GDCore/IDE/wxTools/ShowFolder.h"
|
||||
#include "GDCore/IDE/SkinHelper.h"
|
||||
#include "GDCore/PlatformDefinition/ExternalEvents.h"
|
||||
#include "GDCore/PlatformDefinition/Platform.h"
|
||||
@@ -1274,14 +1275,7 @@ void ProjectManager::OnOpenProjectFolderSelected(wxCommandEvent& event)
|
||||
gdTreeItemProjectData * data;
|
||||
if ( !GetGameOfSelectedItem(game, data) ) return;
|
||||
|
||||
std::string dir = gd::ToString(wxFileName::FileName(game->GetProjectFile()).GetPath());
|
||||
#if defined(WINDOWS)
|
||||
wxExecute("explorer.exe \""+dir+"\"");
|
||||
#elif defined(LINUX)
|
||||
system(std::string("xdg-open \""+dir+"\"").c_str());
|
||||
#elif defined(MACOS)
|
||||
system(std::string("open \""+dir+"\"").c_str());
|
||||
#endif
|
||||
gd::ShowFolder(wxFileName::FileName(game->GetProjectFile()).GetPath());
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user