Commit Graph

85 Commits

Author SHA1 Message Date
David Schulz
ed6595a66e Python: improve pyside tool detection
Look right next to the used python. For virtual env setups this should
be a lot faster than asking pip for the installed files. Additionally
this should work for pyside devenvs.

Change-Id: I2a8cf6877636785453426c348cfac252645aa4e1
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2023-09-29 09:19:52 +00:00
David Schulz
01cac8299b ProjectExplorer: fix Interpreter::changed emits
Only emit changed if the current interpreter changes.
This is more in line with the other aspects.

This fixes the pyside detection since the changed signal was not
emitted in all relevant code paths.

Change-Id: I53409b17f260b35914e39de894b48d7bd1ce27c0
Reviewed-by: hjk <hjk@qt.io>
2023-08-15 10:44:53 +00:00
hjk
017d7c0e47 ProjectExplorer: Rename kitinformation.{h,cpp} to kitaspects.{h,cpp}
Change-Id: I069bddeb457366210d339edcbb8ffb359a40fab8
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2023-08-15 07:31:03 +00:00
hjk
4cf878aecf Python: Base MainScriptAspect on FilePathAspect
Instead of StringAspect.

Change-Id: Idc5cbe4a28ece5b053eee9f260be9a5f22912f81
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2023-07-13 10:21:57 +00:00
hjk
62795df12a Python: Use aspects more directly in PythonRunConfiguration
Change-Id: Id85348473236bc01ddcc65ec5302c0537c98c526
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2023-07-11 07:13:10 +00:00
hjk
b3df9a4fcf Python: Centralize interpreter specific function in the aspect
... and expose that instead of the PythonRunConfiguration.

This makes the PythonRunConfiguration more the container of aspects,
similar to where the other runconfigs move.

Change-Id: Ibc76b706f2d4d334640ea8f3b91343f9e7c0f566
Reviewed-by: David Schulz <david.schulz@qt.io>
2023-07-07 05:20:48 +00:00
hjk
135a7682f5 ProjectExplorer: Make more aspects directly usable in AspectContainers
Change-Id: I6634c27c8d516411ad84e6cb7c361262ead53124
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2023-07-06 05:23:04 +00:00
hjk
739f835ef1 ProjectExplorer: Remove unusual {Arguments,WorkingDir}Aspect
Follows suite to 2cc4967 to have the user side code more uniform.
Most of the extra verbosity (setMacroExpander) can go away again
when distributing the expander via the "owning" AspectContainer.

Change-Id: I9e80cb235f0a4a9ebee601dd638aefbaa41efc1b
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2023-07-05 12:55:31 +00:00
hjk
914bc626e7 Python: Use a separate PythonInterpreterAspect
... and move interpreter related code there.

Change-Id: I108a4bdfa7c3f2078da164ce13e897a18ebdadde
Reviewed-by: David Schulz <david.schulz@qt.io>
2023-07-04 12:28:40 +00:00
hjk
41fcca5cdd Python: Hide some internals from PythonRunConfiguration API
Change-Id: Ibed21265bf7099b06ea61751fb487b78e8071f34
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: David Schulz <david.schulz@qt.io>
2023-06-27 09:09:32 +00:00
hjk
691c8148a3 ProjectExplorer/RemoteLinux: Consolidate X11ForwardingAspect handling
Change-Id: I7e74f58ab50c84c74ba65f9f64aaa4d0ea73bbb6
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2023-06-26 10:48:08 +00:00
David Schulz
fd04d6afa4 ProjectExplorer: always map working directory path to command device
Change-Id: I0d2d54df118b70c2874b77b4ec2792fb8e114416
Reviewed-by: hjk <hjk@qt.io>
2023-06-23 12:06:36 +00:00
hjk
4a17a26a6d Python: Allow redirecting the display for remote setups
Change-Id: I83baa9c74a1586590147668c9fea661018101776
Reviewed-by: David Schulz <david.schulz@qt.io>
2023-06-23 12:06:22 +00:00
hjk
6c66b900db ProjectExplorer: Merge LocalEnvironmentAspect into EnvironmentAspect
This still has some not quite orthogonal features in one blob function,
but at least it's not a separate class anymore.

A step forward to remote support in places where it could make sense.

Change-Id: Ia02003e4340eb2b5ee92bd48c00006a487527828
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2023-05-25 08:30:33 +00:00
Jarek Kobus
c67dc5e8d4 All Plugins: Use global future synchronizer
Instead of using plugin's own synchronizers. The global
synchronizer does the synchronization just before all the
plugins' destructors run (in sync), so this should be
the right equivalent.

Change-Id: I8d09c9ea4a11b7a703684ad5319191ce310d992e
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2023-04-25 13:45:39 +00:00
Eike Ziller
2bc37de42b Merge remote-tracking branch 'origin/10.0'
Conflicts:
	src/plugins/python/pipsupport.cpp
	src/plugins/qtsupport/exampleslistmodel.cpp
	src/plugins/qtsupport/examplesparser.cpp
	tests/auto/examples/tst_examples.cpp

Change-Id: I00273622423fa99d41621969f6ecbbdaa0e18664
2023-04-13 15:59:08 +02:00
Jarek Kobus
031f51794a Python: Don't leak running futures on shutdown
This patch fixes the following assert on shutdown:
"Shutting down while process /testenv/bin/python is running\"\n".

Change-Id: I4c32ead5e4952b69ffc6037739fd417a632eda1a
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: David Schulz <david.schulz@qt.io>
2023-04-04 13:20:06 +00:00
hjk
305ccfe259 Utils: Replace FilePath::onDevice() by new FilePath::withMappedPath()
Basically a.onDevice(b) == b.withNewMappedPath(a), matching the order
of b.withNewPath(a).

Whether the (curretly docker-specific) path mapping is useful /there/, and
whether some of the calls are needed at all is dubious. I added some
FIXME and changed a few cases directly.

Change-Id: I7514736ce922f632f1f737bc496f6783389a42b6
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2023-04-04 06:56:55 +00:00
David Schulz
471e67d1a6 Python: collect pip package info in another thread
Change-Id: I70a9066fddf812ce9bde5467913bb2bad98e2d0e
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2023-01-27 06:27:35 +00:00
David Schulz
f7f9d5d405 Python: Fix crash on switching interpreters in run configuration
This happens if the project contains ui files, pyside with pyside uic
and the python language server is installed. It is caused by pointers to
already deleted extra compilers in the pyls language client.

Change-Id: I877f20292c9c850c151fa94149b5a46d4836c3de
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2023-01-16 13:13:01 +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
Jarek Kobus
02f384115e Remove unused includes of QBoxLayout
Change-Id: I74204eaf70dbcb31a8bd13609bef35459c8c6b5f
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: hjk <hjk@qt.io>
2022-11-18 15:29:29 +00:00
Jarek Kobus
1a70403f94 Remove unused includes of QFormLayout
Change-Id: Ia877cb57037342f2a7b332b29d9cb45e9b01c4bc
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>
2022-11-18 07:33:29 +00:00
David Schulz
af7b0802a8 Python: fix PySide project tool detection
The tool moved to the PySide6-Essentials module.

Change-Id: I204d2025bc51b6c5cffe82cba66878d077f03b72
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-10-24 09:17:46 +00:00
David Schulz
f012f1b245 Python: try to find interpreter on device for run configuration
If the default interpreter is not on the run device of the kit try to
find any interpreter on that device and use it as the default
interpreter for this run configuration.

Change-Id: I52985281f0f1d2ac88759169400d64121299f95d
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-10-20 12:46:44 +00:00
Marc Mutz
8eb4d52342 Port from qAsConst() to std::as_const()
We've been requiring C++17 since Qt 6.0, and our qAsConst use finally
starts to bother us (QTBUG-99313), so time to port away from it
now.

Since qAsConst has exactly the same semantics as std::as_const (down
to rvalue treatment, constexpr'ness and noexcept'ness), there's really
nothing more to it than a global search-and-replace.

Task-number: QTBUG-99313
Change-Id: I88edd91395849574436299b8badda21bb93bea39
Reviewed-by: hjk <hjk@qt.io>
2022-10-07 13:47:53 +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
e74999cced Python: check for pyside tools after installation
Change-Id: Icf9ae0ec08a78efc51216daa3304e76f8e812d5f
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-06-20 13:11:07 +00:00
David Schulz
ca47064020 Python: Fix scripts path to global/venv pyside installations
... when checking for pyside tools.

Change-Id: I1aaac9dd9da76f08ada031cc88761dba36c4e3b6
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-06-20 13:10:56 +00:00
David Schulz
a750961f4d Python: make sure working dir is on python device
Task-number: QTCREATORBUG-27536
Change-Id: If9c8f88f2a871ec71b200020689a4ae9df1e8a6a
Reviewed-by: hjk <hjk@qt.io>
2022-06-15 12:11:36 +00:00
David Schulz
ff8495b0a2 Python: fix pyside tool detection
pip might return an incomplete list of files on Windows for
installations. So we need to manually check the Scripts
folder for the tools we are looking for.

Change-Id: I40778607fd2f2015059744f17a539ca381b85560
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-06-03 07:35:13 +00:00
David Schulz
b9034e8426 Python: support python 3 mime type in language client
Change-Id: I9319442aecc61e854aaeb0778b959086a70d431b
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-06-02 13:29:17 +00:00
David Schulz
b9627ddba7 Python: add pyside uic extra compiler
To be able to autocomplete code from .ui forms we need to feed the
python language server the compiled form. The uic extra compiler
generates a temporary ui_name.py file for uncompiled or unsaved ui
files. These files are inside a folder that gets appended to the python
path environment variable for the python language server.

Change-Id: I9f48d2012162f33986639315189c41e0a7e0dad2
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-06-02 09:09:22 +00:00
David Schulz
3ad82a66f9 Python: move pyside detection to runconfig
Change-Id: I781c4d005ced0c884081616696eae7f738f38c6f
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-05-31 05:59:45 +00:00
hjk
2837f4d777 ProjectExplorer: Pass macroexpander (again) to WorkingDirectoryAspect
Broke with 8dacb123e0.

Probably calls for a more centralized approach again. Later.

Change-Id: Ibf52487d68d7938d4b5dfb38f1f0a5b0e1a97bc3
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-05-30 14:45:47 +00:00
hjk
8dacb123e0 Utils: Pass MacroExpander to ArgumentsAspect constructor
In the past we wanted to keep the aspect constructor simple but
it turned out that exceptions were needed and accumulating, so those
are likely here to stay.

By passing also the MacroExpander to the ArgumentsAspect constructor
allows other single-purpose warts like the ProjectConfiguration::doPostInit()
machinery can be removed.

Change-Id: I148b0ca1ab0740270eecd0d3134620de65a86d4f
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2022-05-20 07:06:10 +00:00
David Schulz
fbefd45b94 Python: add pyside build configuration
Task-number: QTCREATORBUG-27219
Change-Id: I19340c57789933c7104ec5d6fec628ed810c5f3e
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-05-03 08:55:11 +00:00
hjk
0da130c4ef Python: Apply 'static' pattern for singleton members
Plus some cosmetics.

Change-Id: Ia2c8f425f0491fbe6a0bbf2e508857a5550e4d38
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: David Schulz <david.schulz@qt.io>
2022-04-27 08:55:02 +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
hjk
5da8695dca ProjectExplorer: Pass envAspect directly to WorkingDirectory constructor
This trades a now necessary order of setup for the now removed
"acquaintSiblings" facility.

Change-Id: I85058578b792e210f24573e2ab4e3a40a8813a11
Reviewed-by: David Schulz <david.schulz@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-04-22 11:53:59 +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
7cb3a726d4 Python: add PySide installation check on document open
Checks if the document imports PySide and whether the selected python
interpreter can find a PySide installation. If not show a global info
bar that can install PySide via pip like the python lsp server.

Task-number: PYSIDE-1742
Change-Id: I02c0d5f6eb268f3d8826d4fb9d9ec3c7c48b8638
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-03-28 12:15:15 +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
Eike Ziller
195abefe7d EditorManager: Remove QString openEditor(At) overloads
In favor of the FilePath/Link ones.

Change-Id: I5caf9e0f8de304ff4ee12329557aa50a6f3a0c69
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-11-02 08:11:14 +00:00
hjk
8e40db5580 Python: Fix setting current interpreter
There was a vicious cycle started when loading a runconfig pointing
to an interpreter with an id that was not present in the combobox.

Amends 9decfcb151.

Change-Id: I77595795eb825bde55919c8d8dd632f3bf397578
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-06-23 05:59:59 +00:00
David Schulz
9decfcb151 Python: fix opening repl for project files
The python interpreter aspect relyed on having a combo box setup when
looking up the current interpreter. This combo box is just initialized
when the widget is shown since recently. Using the current id that is
valid all the time instead to get the correct interpreter.

Change-Id: I0a6bde46864c44c9408d0d7331164b49da65c7df
Reviewed-by: hjk <hjk@qt.io>
2021-06-10 08:59:05 +00:00
hjk
d5dec08893 Utils: Pass settings key to BaseAspect::saveToMap
Makes the code on the user side somewhat more symmetric and is a
bit more flexible, even if that's not used right now.

Change-Id: I29a5182463ead0e4a39fcb51ecf4fdd5adf2a203
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-03-12 11:30:22 +00:00
Alessandro Portale
72d91dc94a Use qAsConst with non-const Qt containers in range-loops
... in various places

Change-Id: Ic6c0c1b9437a1ed402105c7a14a1f5f9454a68d4
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2021-02-17 14:43:29 +00:00
Orgad Shaneh
3122a1bfc5 Aspects: Remove some more default values
Change-Id: Iadee8b8f1eeb3ff009a667d45a51f6f5a94329ca
Reviewed-by: hjk <hjk@qt.io>
2020-11-10 08:06:51 +00:00