summaryrefslogtreecommitdiff
path: root/src/plugins/python/pythonutils.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Utils: Add TerminalMode::DetachedMarcus Tillmanns2023-05-041-16/+16
| | | | | Change-Id: Ic36845d3469719e17f24602ce80f3e6cfc984fbf Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* Utils: Rename qtcprocess.{cpp,h} -> process.{cpp,h}Jarek Kobus2023-05-041-1/+1
| | | | | | | | Follows QtcProcess -> Process rename. Change-Id: I97235a9a40cb7fd52944515b7ab878d96528f919 Reviewed-by: hjk <hjk@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Utils: Rename QtcProcess -> ProcessJarek Kobus2023-05-041-5/+5
| | | | | | | | Task-number: QTCREATORBUG-29102 Change-Id: Ibc264f9db6a32206e4097766ee3f7d0b35225a5c Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: hjk <hjk@qt.io>
* Python: add create venv actionDavid Schulz2023-03-211-0/+21
| | | | | | | | | The action can be triggered from the interpreter chooser of the editor toolbar. Change-Id: Ie23b68a3790525ea02883ef359b357a0d317b2f5 Reviewed-by: Christian Stenger <christian.stenger@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
* ProjectExplorer: Move some not-fully-session related bitshjk2023-03-011-5/+5
| | | | | | | | | | | | | | | ... out of SessionManager. The idea is to later move SessionManager into the Core plugin, which both is sensible conceptually and also prerequisite to merge the Bookmark plugin into TextEditor plugin. Currently, only the interface is split, as the load/save implemetations are non-mechanical to disentangle. Change-Id: I31631db3094ea192825a2ccaa6add6188662940b Reviewed-by: Eike Ziller <eike.ziller@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
* Python: add interpreter selector to editor toolbarDavid Schulz2023-01-201-0/+15
| | | | | | Fixes: PYSIDE-2154 Change-Id: If5e90f5bf2923b61af37ebbfcd35c512b3b07db4 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* Remove GPL-3.0+ from license identifiersKai Köhne2023-01-061-1/+1
| | | | | | | | | | | | | | | Since we also license under GPL-3.0 WITH Qt-GPL-exception-1.0, this applies only to a hypothetical newer version of GPL, that doesn't exist yet. If such a version emerges, we can still decide to relicense... While at it, replace (deprecated) GPL-3.0 with more explicit GPL-3.0-only Change was done by running find . -type f -exec perl -pi -e "s/LicenseRef-Qt-Commercial OR GPL-3.0\+ OR GPL-3.0 WITH Qt-GPL-exception-1.0/LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0/g" {} \; Change-Id: I5097e6ce8d10233993ee30d7e25120e2659eb10b Reviewed-by: Eike Ziller <eike.ziller@qt.io>
* Python: Replace one use of QDirCurrentPath()hjk2022-11-211-1/+1
| | | | | Change-Id: I88a04930b8c62a68ee1adb73e1cdd3c433eea4e3 Reviewed-by: David Schulz <david.schulz@qt.io>
* Use SPDX license identifiersLucie Gérard2022-08-261-24/+2
| | | | | | | | | Replace the current license disclaimer in files by a SPDX-License-Identifier. Task-number: QTBUG-67283 Change-Id: I708fd1f9f2b73d60f57cc3568646929117825813 Reviewed-by: Eike Ziller <eike.ziller@qt.io>
* Python: Convert to Tr::trhjk2022-07-211-6/+4
| | | | | | Change-Id: I0241053b0d51dbb1a60c43351cbff543fd52573d Reviewed-by: Eike Ziller <eike.ziller@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
* Python: ignore windows store redirectorsDavid Schulz2022-06-201-6/+15
| | | | | Change-Id: Ife5c13549d73156550a7ce4b5436f1e5a19503fa Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* Python: prefer python from path when detecting python for documentDavid Schulz2022-06-151-5/+15
| | | | | Change-Id: I794a741fa7257833f0b4efbc25dfae43b8748427 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* Python: simplify detect python for document pathDavid Schulz2022-06-151-12/+8
| | | | | Change-Id: I49b943e8b89db32c11b12ee66c0ad3add9a695af Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* Python: Fix python detection for non project filesDavid Schulz2022-06-101-2/+2
| | | | | | | | Do not return an empty file path if we cannot find a python venv for a file path, but also consider the configured interpreters. Change-Id: I5a7f06e394fb925f9a00143fc5f0797e8754534b Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* Promote previously python-specific InterpreterAspecthjk2022-04-271-7/+8
| | | | | | | | ... and drop PythonRunConfiguration, which is a plain RunConfiguration now. Change-Id: I540cb738180fc1424f730d6d1998886915ce527b Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: David Schulz <david.schulz@qt.io>
* PythonUtils: Connect to QtcProcess::done() signalJarek Kobus2022-04-271-11/+10
| | | | | | | | Instead of connecting to errorOccurred() and finished() signals. Change-Id: I02fefe01cfc4be6ef996c7c8b98b36137217504e Reviewed-by: David Schulz <david.schulz@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
* Python: work with Interpreter in PythonRunConfigurationDavid Schulz2022-03-281-1/+1
| | | | | | | | This saves some unneeded file path conversion and lookups in the python settings. Change-Id: I8647858320183dc1da027363b4ab265f6c75e1ae Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* Python: extract pythonProjectForFile function to utilsDavid Schulz2022-03-281-0/+11
| | | | | Change-Id: I4055527302cab09f55cd4b06bfd3896accb4832a Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* Python: move python name cache to utilsDavid Schulz2022-03-281-0/+19
| | | | | Change-Id: I7f6d13a465be6de90aea64e7f19c92bca3ee6c19 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* Mimetypes: Make implementation switchable between new and oldEike Ziller2022-02-251-1/+1
| | | | | | | | | | | | | | | | | | - configure with QTC_USE_NEW_MIMEDATABASE to switch to the new one in utils/mimetypes2/ - added utils/mimeutils.h header for the Qt Creator specific static wrappers, that also includes the "public" headers for MimeType et al from the new or old implementation, depending on configuration - change all utils/mimetypes/ includes to utils/mimeutils.h - move the implementation for the wrappers to utils/mimetypes(2)/mimeutils.cpp - also move the MimeDatabase declaration in the "old" implementation back to utils/mimetypes/mimedatabase.h Change-Id: Ie8de229c035d6cd9a5e4739dc0fa78d9c17228e3 Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
* QtcProcess: Extract QtcProcess specific enums into separate headerJarek Kobus2022-02-181-1/+1
| | | | | | Change-Id: Ib3498f189000fd8f5501130c0d280b0f5ae83849 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: hjk <hjk@qt.io>
* Utils: Move QtcProcess constructor setup data to shared setup datahjk2022-02-111-1/+2
| | | | | | | | This includes replacing DeviceProcess terminal handling with base member. Change-Id: Id1541bfce33c71dddc71b4816ad0b174dce3879c Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
* PythonUtils: Use QtcProcess in terminal mode instead of ConsoleProcessJarek Kobus2022-01-251-4/+4
| | | | | | Change-Id: Icd8a481a03a2a13f5556327ce5caf661a5d19321 Reviewed-by: hjk <hjk@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* ConsoleProcess: Uniform the common interface of QtcProcessJarek Kobus2022-01-201-1/+1
| | | | | | | | | | | This is a preliminary step before merging ConsoleProcess into QtcProcess. Rename command() to commandLine(). Return const references from commandLine() and from environment(). Change-Id: Iacbf48030d00f8dbba053ece70bd460924f96041 Reviewed-by: hjk <hjk@qt.io>
* PythonEditor: Fix a leak of console process on shutdownJarek Kobus2022-01-201-3/+3
| | | | | | | | | | | | | | | Give a parent for console process in order to delete it on shutdown. In case the console process was started and the user closed the Creator we were leaking console process instance together with its process. Connect to ConsoleProcess::finished() instead of stubStopped(). There is no point to keep the console open when the process finished (it forces the user to manually close the stub window by pressing enter). Change-Id: I3f14e940f39b32e11bde276e80f3cb630b13d8f7 Reviewed-by: hjk <hjk@qt.io>
* ConsoleProcess: Uniform the common interface of QtcProcessJarek Kobus2022-01-201-3/+3
| | | | | | | | | | | This is a preliminary step before merging ConsoleProcess into QtcProcess. Remove processError() signal, use errorOccurred() instead. Change-Id: If11064944228c82a9099fffdba942c4276690085 Reviewed-by: hjk <hjk@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
* Python: move language client functionality out of utilsDavid Schulz2022-01-181-421/+4
| | | | | | | | There will be more lsp specific functionality so moving it into its own space is reasonable. Change-Id: Ic87d437182d68673b53f662c804707138fef5b6c Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* Python: fix repl workdirDavid Schulz2022-01-051-1/+1
| | | | | | | | | | Use the directory that contains the file not the file itself as the working directory for REPL. amends 4a42bcd4e8d2c73be426775597e8a58f5df6a3a8 Change-Id: Ia81efc3ef51a96a79918d358cd446de9f1ea082d Reviewed-by: Eike Ziller <eike.ziller@qt.io>
* Python: prefer python-lsp-serverDavid Schulz2021-12-101-5/+5
| | | | | | | | python-language-server is dead... long live python-lsp-server. Task-number: QTCREATORBUG-26230 Change-Id: I9343f231c732b135bc4f8a704a29541c48cc36ba Reviewed-by: Eike Ziller <eike.ziller@qt.io>
* LanguangeClient: Use more FilePathhjk2021-08-311-1/+1
| | | | | Change-Id: Ic849da11da646feb804717550d2a8a60d61f332d Reviewed-by: David Schulz <david.schulz@qt.io>
* Utils: Introduce a FilePath constructor from char arrayshjk2021-08-171-3/+1
| | | | | | | | | | | | Similar to QT_RESTRICTED_CAST_FROM_ASCII to avoid the need for decorations in user code. At the same time, drop some convenience constructors and functions in CommandLine and Icon essentially serving the same purpose. Change-Id: Ida4e5ac19c2da0a4298a97b2a8e1511d56bbb79d Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* Utils/ProjectExplorer: Use FilePath for Runnable::workingDirectoryhjk2021-08-061-3/+3
| | | | | | | ... and in some using code. Change-Id: I231ea56628908f7d305d13f07eabe8803fe8a791 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* Python: Fix UI textLeena Miettinen2021-07-051-1/+1
| | | | | | Task-number: QTCREATORBUG-25915 Change-Id: I4f317e9bf091bd68fc6d76ded9e5db4d989c71cb Reviewed-by: David Schulz <david.schulz@qt.io>
* All: Replace most SynchronousProcess by QtcProcesshjk2021-06-231-3/+3
| | | | | Change-Id: I0bf22fef2cd4a7297ef5a1e9aa9c3e2b9348ba42 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* Protect the access to module path for executable cacheJarek Kobus2021-06-161-0/+2
| | | | | | | | | | | | | The getPylsModulePath() may be called concurrently: PyLSConfigureAssistant::openDocumentWithPython() -> runAsync -> checkPythonLanguageServer() -> getPylsModulePath(), so protect the access to the static cache by mutex. Amends: 54f2ebf91d76d05d0202de5263939fc4ba227fed Change-Id: Ia88a9e680b092bcc7cf62338387775521d497835 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* Utils: Drop QProcess specific parameters from QtcProcess::finished()hjk2021-06-141-3/+4
| | | | | | | | | | | Mid-term plan is to concentrate on use of QtcProcess::result() instead which is a bit more system-agnostic. There's quite a bit of potential for downstream cleanup by re-using QtcProcess::exitMessage() now. Change-Id: I3806b3f5933d96e64b7cfb18cc6c52823fddcbcd Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* Utils: add FilePath::completeBaseNameDavid Schulz2021-06-041-3/+2
| | | | | | | Removing some FilePath::toFileInfo() calls again. Change-Id: I6610beebf2c30754fde525b71f4c4a34ceb5e30b Reviewed-by: hjk <hjk@qt.io>
* Utils: Rename QtcProcess::Result::Finished to FinishedWithSuccesshjk2021-06-021-1/+1
| | | | | | | | | | | | To make clear that this is not just any finish. Also change FinishedError to FinishedWithError, to create symmetry. Also adapt enum member description to reality. Change-Id: I13e05391eb86fdb24e2ae660f14dfddb282e1104 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* Utils: Move QProcess base to QtcProcessPrivatehjk2021-06-021-5/+5
| | | | | Change-Id: I4c6811d42e051fadfcf32edb664ff3bc09e692e6 Reviewed-by: David Schulz <david.schulz@qt.io>
* Utils: Remove CommandLine argument from QtcProcess::run{,Blocking}hjk2021-05-191-6/+8
| | | | | | | | | | | Makes run() more similar to what start() looks like. Also add some asserts to make sure run() and related functions are only called on SyncronousProcesses, as these are currently the only ones where this works. Change-Id: Idee6076c3f40a484db5c17f5bb348698cc83d220 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* Utils: Make process results accessible through QtcProcess objecthjk2021-05-141-10/+10
| | | | | | | | | | | | | | | | The result is fully stored in the object anyway. Using the extra SynchronousProcessResponse structure only causes copies of the data and complicates access on the user side in a lot of cases. The result bits are now also accessible individually. There's obvious room for follow-up changes on the topic, e.g. ShellCommand::runCommand's parameter list could shrink to just a SynchronousProcess parameter. Change-Id: I45aa7eb23832340be06905929280c012e1217263 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
* Do QFutureWatcher::setFuture() after connecting to watcher's signalsJarek Kobus2021-05-121-1/+1
| | | | | | | | | | | Otherwise we may have race condition. Reference: documentation for QFutureWatcher::setFuture() and the implementation of QFutureInterfaceBasePrivate::connectOutputInterface( QFutureCallOutInterface *interface). Change-Id: I5b483baaf1b844871a162f47ce7683e9ff495acb Reviewed-by: Eike Ziller <eike.ziller@qt.io>
* Utils: Merge {synchronous,qtc}process.{h,cpp} file pairshjk2021-05-101-1/+0
| | | | | | | | Mechanical to prepare merging the actual classes. Adapting #includes. Change-Id: I77a2c28129287778bc870c30cb890cd26bc2e62b Reviewed-by: Christian Stenger <christian.stenger@qt.io>
* Utils: Make SynchronousProcess use Utils::Environment for environmentshjk2021-05-051-1/+4
| | | | | | | | Makes the interface more similar to QtcProcess. Change-Id: I58e57d9fdb7c37eb0d2a5c5eef8643d6be97c3cc Reviewed-by: Christian Stenger <christian.stenger@qt.io> Reviewed-by: Orgad Shaneh <orgads@gmail.com>
* Python: Replace a use of SynchronousProcesshjk2021-05-041-3/+5
| | | | | Change-Id: I93ce9a3224c88c69c3b0ef46f1416645ffca1e1e Reviewed-by: David Schulz <david.schulz@qt.io>
* Python: Be less disrupting with the messages paneEike Ziller2020-12-171-8/+10
| | | | | | | | | Only pop it open directly after explicit interaction Task-number: QTCREATORBUG-24430 Change-Id: I55025a901cb3d694994614bae21204ab9da49fc0 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> Reviewed-by: hjk <hjk@qt.io>
* Fix warnings about possible detach of temporary objectsJarek Kobus2020-11-161-1/+1
| | | | | | | | | Calling first() or last() on temporary container may unnecessarily detach the container. Fix it by calling constFirst() and constLast(). Change-Id: I2460efd5dbee1534eec8a514d9bff2a947bfddf9 Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
* Python: Fix UI text capitalizationLeena Miettinen2020-07-021-1/+1
| | | | | Change-Id: Ie180d6e8b8af35c7bb79c9f8a371262b219ce65e Reviewed-by: David Schulz <david.schulz@qt.io>
* Move InfoBar to UtilsEike Ziller2020-06-181-12/+12
| | | | | | | | | The only reason it was required to be in Core plugin, was its use of Id, which now is available in Utils. Change-Id: I66ce863c24924e6448d339b3422538a7fe167336 Reviewed-by: Alessandro Portale <alessandro.portale@qt.io> Reviewed-by: Orgad Shaneh <orgads@gmail.com>
* Various places: performance-for-range-copyAlessandro Portale2020-06-151-2/+2
| | | | | Change-Id: I475990d32a5211d31a77782667a2dfedba134137 Reviewed-by: hjk <hjk@qt.io>