forked from qt-creator/qt-creator
Python: check for pyside tools after installation
Change-Id: Icf9ae0ec08a78efc51216daa3304e76f8e812d5f Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -106,6 +106,10 @@ void PySideInstaller::installPyside(const Utils::FilePath &python,
|
||||
|
||||
auto install = new PipInstallTask(python);
|
||||
connect(install, &PipInstallTask::finished, install, &QObject::deleteLater);
|
||||
connect(install, &PipInstallTask::finished, this, [=](bool success){
|
||||
if (success)
|
||||
emit pySideInstalled(python, pySide);
|
||||
});
|
||||
install->setPackage(PipPackage(pySide));
|
||||
install->run();
|
||||
}
|
||||
|
@@ -40,13 +40,17 @@ namespace Internal {
|
||||
|
||||
class PySideInstaller : public QObject
|
||||
{
|
||||
Q_DECLARE_TR_FUNCTIONS(Python::Internal::PySideInstaller)
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
static PySideInstaller *instance();
|
||||
static void checkPySideInstallation(const Utils::FilePath &python,
|
||||
TextEditor::TextDocument *document);
|
||||
|
||||
|
||||
signals:
|
||||
void pySideInstalled(const Utils::FilePath &python, const QString &pySide);
|
||||
|
||||
private:
|
||||
PySideInstaller();
|
||||
|
||||
|
@@ -202,6 +202,12 @@ PythonRunConfiguration::PythonRunConfiguration(Target *target, Id id)
|
||||
setRunnableModifier([](Runnable &r) {
|
||||
r.workingDirectory = r.workingDirectory.onDevice(r.command.executable());
|
||||
});
|
||||
|
||||
connect(PySideInstaller::instance(), &PySideInstaller::pySideInstalled, this,
|
||||
[this](const FilePath &python) {
|
||||
if (python == aspect<InterpreterAspect>()->currentInterpreter().command)
|
||||
checkForPySide(python);
|
||||
});
|
||||
}
|
||||
|
||||
PythonRunConfiguration::~PythonRunConfiguration()
|
||||
@@ -209,9 +215,8 @@ PythonRunConfiguration::~PythonRunConfiguration()
|
||||
qDeleteAll(m_extraCompilers);
|
||||
}
|
||||
|
||||
void PythonRunConfiguration::currentInterpreterChanged()
|
||||
void PythonRunConfiguration::checkForPySide(const FilePath &python)
|
||||
{
|
||||
const FilePath python = aspect<InterpreterAspect>()->currentInterpreter().command;
|
||||
BuildStepList *buildSteps = target()->activeBuildConfiguration()->buildSteps();
|
||||
|
||||
Utils::FilePath pySideProjectPath;
|
||||
@@ -255,6 +260,12 @@ void PythonRunConfiguration::currentInterpreterChanged()
|
||||
|
||||
if (auto pySideBuildStep = buildSteps->firstOfType<PySideBuildStep>())
|
||||
pySideBuildStep->updatePySideProjectPath(pySideProjectPath);
|
||||
}
|
||||
|
||||
void PythonRunConfiguration::currentInterpreterChanged()
|
||||
{
|
||||
const FilePath python = aspect<InterpreterAspect>()->currentInterpreter().command;
|
||||
checkForPySide(python);
|
||||
|
||||
for (FilePath &file : project()->files(Project::AllFiles)) {
|
||||
if (auto document = TextEditor::TextDocument::textDocumentForFilePath(file)) {
|
||||
|
@@ -43,6 +43,7 @@ public:
|
||||
QList<PySideUicExtraCompiler *> extraCompilers() const;
|
||||
|
||||
private:
|
||||
void checkForPySide(const Utils::FilePath &python);
|
||||
void updateExtraCompilers();
|
||||
Utils::FilePath m_pySideUicPath;
|
||||
|
||||
|
Reference in New Issue
Block a user