Commit Graph

59 Commits

Author SHA1 Message Date
David Schulz
f0f0cf129a Python: add interpreter selector to editor toolbar
Fixes: PYSIDE-2154
Change-Id: If5e90f5bf2923b61af37ebbfcd35c512b3b07db4
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2023-01-20 10:16:36 +00:00
Kai Köhne
56baf8c058 Remove GPL-3.0+ from license identifiers
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>
2023-01-06 11:15:13 +00:00
hjk
ba80985769 Python: Replace one use of QDirCurrentPath()
Change-Id: I88a04930b8c62a68ee1adb73e1cdd3c433eea4e3
Reviewed-by: David Schulz <david.schulz@qt.io>
2022-11-21 13:09:43 +00:00
Lucie Gérard
a7956df3ca Use SPDX license identifiers
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>
2022-08-26 12:27:18 +00:00
hjk
26dd8aef2a Python: Convert to Tr::tr
Change-Id: I0241053b0d51dbb1a60c43351cbff543fd52573d
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-07-21 08:25:04 +00:00
David Schulz
3b8b247f88 Python: ignore windows store redirectors
Change-Id: Ife5c13549d73156550a7ce4b5436f1e5a19503fa
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-06-20 06:16:08 +00:00
David Schulz
2b428d5de0 Python: prefer python from path when detecting python for document
Change-Id: I794a741fa7257833f0b4efbc25dfae43b8748427
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-06-15 05:44:46 +00:00
David Schulz
02bfd03c22 Python: simplify detect python for document path
Change-Id: I49b943e8b89db32c11b12ee66c0ad3add9a695af
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-06-15 05:44:42 +00:00
David Schulz
99acc9a153 Python: Fix python detection for non project files
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>
2022-06-10 12:47:29 +00:00
hjk
28cfdf388a Promote previously python-specific InterpreterAspect
... 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>
2022-04-27 08:54:22 +00:00
Jarek Kobus
74b1623acd PythonUtils: Connect to QtcProcess::done() signal
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>
2022-04-27 06:26:45 +00:00
David Schulz
bf5114dcee Python: work with Interpreter in PythonRunConfiguration
This saves some unneeded file path conversion and lookups in the
python settings.

Change-Id: I8647858320183dc1da027363b4ab265f6c75e1ae
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-03-28 12:15:37 +00:00
David Schulz
64170a788a Python: extract pythonProjectForFile function to utils
Change-Id: I4055527302cab09f55cd4b06bfd3896accb4832a
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-03-28 09:29:15 +00:00
David Schulz
ff686f5679 Python: move python name cache to utils
Change-Id: I7f6d13a465be6de90aea64e7f19c92bca3ee6c19
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-03-28 09:29:08 +00:00
Eike Ziller
f562ebf239 Mimetypes: Make implementation switchable between new and old
- 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>
2022-02-25 07:19:58 +00:00
Jarek Kobus
48960b5cfc QtcProcess: Extract QtcProcess specific enums into separate header
Change-Id: Ib3498f189000fd8f5501130c0d280b0f5ae83849
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: hjk <hjk@qt.io>
2022-02-18 10:51:55 +00:00
hjk
e2cb64471a Utils: Move QtcProcess constructor setup data to shared setup data
This includes replacing DeviceProcess terminal handling with base
member.

Change-Id: Id1541bfce33c71dddc71b4816ad0b174dce3879c
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2022-02-11 17:33:48 +00:00
Jarek Kobus
e28d2a88b2 PythonUtils: Use QtcProcess in terminal mode instead of ConsoleProcess
Change-Id: Icd8a481a03a2a13f5556327ce5caf661a5d19321
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-01-25 15:07:50 +00:00
Jarek Kobus
c0003c908d ConsoleProcess: Uniform the common interface of QtcProcess
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>
2022-01-20 16:42:50 +00:00
Jarek Kobus
2e3d32cc1b PythonEditor: Fix a leak of console process on shutdown
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>
2022-01-20 11:04:26 +00:00
Jarek Kobus
70b2b2a1d5 ConsoleProcess: Uniform the common interface of QtcProcess
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>
2022-01-20 07:51:04 +00:00
David Schulz
49ac087955 Python: move language client functionality out of utils
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>
2022-01-18 08:14:57 +00:00
David Schulz
a09d4e2918 Python: fix repl workdir
Use the directory that contains the file not the file itself as the
working directory for REPL.

amends 4a42bcd4e8

Change-Id: Ia81efc3ef51a96a79918d358cd446de9f1ea082d
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2022-01-05 10:25:04 +00:00
David Schulz
922cce1634 Python: prefer python-lsp-server
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>
2021-12-10 13:02:40 +00:00
hjk
0061555213 LanguangeClient: Use more FilePath
Change-Id: Ic849da11da646feb804717550d2a8a60d61f332d
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-08-31 15:16:42 +00:00
hjk
7c28c4f744 Utils: Introduce a FilePath constructor from char arrays
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>
2021-08-17 05:34:10 +00:00
hjk
4a42bcd4e8 Utils/ProjectExplorer: Use FilePath for Runnable::workingDirectory
... and in some using code.

Change-Id: I231ea56628908f7d305d13f07eabe8803fe8a791
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-08-06 12:51:24 +00:00
Leena Miettinen
db053c49ad Python: Fix UI text
Task-number: QTCREATORBUG-25915
Change-Id: I4f317e9bf091bd68fc6d76ded9e5db4d989c71cb
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-07-05 06:35:44 +00:00
hjk
430e81facd All: Replace most SynchronousProcess by QtcProcess
Change-Id: I0bf22fef2cd4a7297ef5a1e9aa9c3e2b9348ba42
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-06-23 07:55:31 +00:00
Jarek Kobus
d4c36f43b0 Protect the access to module path for executable cache
The getPylsModulePath() may be called concurrently:
PyLSConfigureAssistant::openDocumentWithPython() ->
runAsync -> checkPythonLanguageServer() ->
getPylsModulePath(), so protect the access to the
static cache by mutex.

Amends: 54f2ebf91d

Change-Id: Ia88a9e680b092bcc7cf62338387775521d497835
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-06-16 11:41:58 +00:00
hjk
fe7d6f0def Utils: Drop QProcess specific parameters from QtcProcess::finished()
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>
2021-06-14 13:31:05 +00:00
David Schulz
5ec611b68e Utils: add FilePath::completeBaseName
Removing some FilePath::toFileInfo() calls again.

Change-Id: I6610beebf2c30754fde525b71f4c4a34ceb5e30b
Reviewed-by: hjk <hjk@qt.io>
2021-06-04 07:07:07 +00:00
hjk
0ba4338467 Utils: Rename QtcProcess::Result::Finished to FinishedWithSuccess
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>
2021-06-02 14:16:36 +00:00
hjk
08040e4e94 Utils: Move QProcess base to QtcProcessPrivate
Change-Id: I4c6811d42e051fadfcf32edb664ff3bc09e692e6
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-06-02 13:21:08 +00:00
hjk
90ad902486 Utils: Remove CommandLine argument from QtcProcess::run{,Blocking}
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>
2021-05-19 13:01:51 +00:00
hjk
55f768e1b0 Utils: Make process results accessible through QtcProcess object
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>
2021-05-14 13:19:01 +00:00
Jarek Kobus
da27ac457f Do QFutureWatcher::setFuture() after connecting to watcher's signals
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>
2021-05-12 22:09:03 +00:00
hjk
c23cdd9262 Utils: Merge {synchronous,qtc}process.{h,cpp} file pairs
Mechanical to prepare merging the actual classes.
Adapting #includes.

Change-Id: I77a2c28129287778bc870c30cb890cd26bc2e62b
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-05-10 09:47:51 +00:00
hjk
5813c7e8c2 Utils: Make SynchronousProcess use Utils::Environment for environments
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>
2021-05-05 12:14:31 +00:00
hjk
4c375e31a3 Python: Replace a use of SynchronousProcess
Change-Id: I93ce9a3224c88c69c3b0ef46f1416645ffca1e1e
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-05-04 09:55:47 +00:00
Eike Ziller
9f8a48b245 Python: Be less disrupting with the messages pane
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>
2020-12-17 08:59:24 +00:00
Jarek Kobus
eaba657d90 Fix warnings about possible detach of temporary objects
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>
2020-11-16 22:11:46 +00:00
Leena Miettinen
58bcf2878b Python: Fix UI text capitalization
Change-Id: Ie180d6e8b8af35c7bb79c9f8a371262b219ce65e
Reviewed-by: David Schulz <david.schulz@qt.io>
2020-07-02 09:26:20 +00:00
Eike Ziller
7c5ed6f7d9 Move InfoBar to Utils
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>
2020-06-18 06:39:54 +00:00
Alessandro Portale
0be309bcf1 Various places: performance-for-range-copy
Change-Id: I475990d32a5211d31a77782667a2dfedba134137
Reviewed-by: hjk <hjk@qt.io>
2020-06-15 05:58:46 +00:00
David Schulz
8f5109b6ee LSP: Robustify open documents
Use Client::openDocument if you just want to open a document and
activate it if it is not already used in another client.

Use LanguageClientManager::openDocumentWithClient if you want to make
sure a document is opened _and_ activated for a specific client.

Change-Id: I6b790f15e17335ce2dc8981a04d2cd571b22b66b
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2020-05-14 09:51:26 +00:00
Eike Ziller
3b5fc296f2 Python editor: Add buttons & actions for opening REPL
Opens interactive Python, optionally with the current file imported, for
testing and experimentation.

Change-Id: Ieb120e3698bdba77a1445c40fe7fda533773a0cf
Reviewed-by: David Schulz <david.schulz@qt.io>
2020-03-19 13:04:48 +00:00
David Schulz
5a2de2609e Python: detect language server for python asynchron
Change-Id: I775e4cc21dc443b9ec6af81fabef9cf2bfd4e7d2
Fixes: QTCREATORBUG-23599
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2020-02-20 05:42:17 +00:00
hjk
783967f550 Python: Move PyLSConfigureAssistant connection to the plugin
Change-Id: I2d3aecd10d8da7e7272ebca61c0fbeacbc257bd5
Reviewed-by: David Schulz <david.schulz@qt.io>
2020-02-12 10:09:13 +00:00
David Schulz
dee41be2ab Python: install pyls with [all] tag on windows
Pylint caused some troubles on windows, but since 0.31.0 it is disabled
by default, so we can safely install the complete python language server
on all platforms now.

Change-Id: I2f7047e71308040c41d996679d19868c4e6fe73a
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2020-01-13 08:02:16 +00:00