427 Commits

Author SHA1 Message Date
Mathieu Pellerin
26308050c4 [processing] Fix script editor dialog wrongly jumping back to line 1 and setting changed to true after saving file 2024-08-16 14:53:53 +07:00
Matthias Kuhn
52f98f8c83
Merge pull request #57834 from m-kuhn/no_pyuic
[plugins] Remove dependency on pyuic
2024-06-30 08:44:08 +02:00
Matthias Kuhn
305cd60593 Copy ui files to output folder
to fix run from build dir
2024-06-30 07:43:35 +02:00
Nyall Dawson
de64e3b8d3 Cleanup Python Console settings layout 2024-06-24 18:40:00 +10:00
Nyall Dawson
5c3d9d21f3 Move Github token setting to new "IDE" options page
This setting doesn't apply to only the Python Console, so it
belongs in a different settings page
2024-06-24 18:40:00 +10:00
Nyall Dawson
c357e651a9 Share on GIST should not require a selection
If no selection, the entire document is shared
2024-06-24 18:40:00 +10:00
Nyall Dawson
8dcb158394 Move "share on gist" logic to QgsCodeEditorWidget
Allows this functionality to be used by other code editors, not
just console script editor
2024-06-24 18:40:00 +10:00
Matthias Kuhn
fd663cc021 [plugins] Remove dependency on pyuic
Eases plugin development and deployment
2024-06-22 14:34:06 +02:00
Nyall Dawson
970196c84a Expose setting for external Python editor
Adds user visible option to set the external Python code editor,
from the Settings - Options - IDE - Python tab.
2024-06-22 06:41:05 +10:00
Nyall Dawson
73ff4adc7e Rename "Python Console" settings page to "Python"
These settings apply outside of the console, eg in the processing
script editor, so using "Python Console" is misleading.
2024-06-22 06:41:05 +10:00
Nyall Dawson
557453bd8f Fix vertical spacing in python console settings 2024-06-22 06:41:05 +10:00
Nyall Dawson
b1947bfa8a Fix console script editor tries to save as ".py.py" 2024-06-18 05:23:57 +10:00
Nyall Dawson
9946a1d739 Move console script editor external file watching logic to QgsCodeEditorWidget
Ensures a consistent behavior between console script editor and
eg processing script editor
2024-06-18 05:23:57 +10:00
Nyall Dawson
d345c68c5a Move responsibility for loading scripts to QgsCodeEditorWidget 2024-06-18 05:23:57 +10:00
Nyall Dawson
9eef4411f6 Small cleanup 2024-06-07 20:46:45 +10:00
Nyall Dawson
6a018f65f5 Move responsibility for opening files in external editor to QgsCodeEditorWidget
This allows the editor to be opened in a proper detached process,
avoiding the editor being closed when QGIS is exited.

Move to a blocklist for terminal text editors instead of the fragile
polling approach (which eg doesn't work if the editor is set to
pycharm)
2024-06-07 20:46:45 +10:00
Nyall Dawson
e42dc886aa Move file path handling for console editor to QgsCodeEditorWidget 2024-06-07 20:46:45 +10:00
Nyall Dawson
4a4c624e3e Fix python script editor "open in external editor" action
When a system has a EDITOR environment variable set to either
an invalid editor, or an editor which requires a terminal (eg
nano/vim), then fallback to the QDesktopServices approach
to opening the script

Avoids this button doing nothing.
2024-06-07 20:46:45 +10:00
lpofredc
0547b71180 fix #57590 2024-05-29 12:02:42 +10:00
Nyall Dawson
7f377d0189 Fix exception when closing script editor 2024-05-16 08:44:14 +10:00
Nyall Dawson
1ea04ae712 Add warning methods to QgsCodeEditorWidget
These call the underlying QgsCodeEditor methods to show inline
warnings, but also add corresponding highlights on the scroll bar
2024-05-15 17:12:20 +10:00
Nyall Dawson
5959be560e Fix future imports 2024-05-10 13:56:49 +10:00
Nyall Dawson
eece497f3e Remove redundant coding lines 2024-05-10 13:56:49 +10:00
Nyall Dawson
cd3b7f17bf Fix lint error in type checking 2024-05-10 13:56:49 +10:00
Nyall Dawson
58dafb48f8 Move message bar logic to QgsCodeEditorWidget 2024-05-10 13:56:49 +10:00
Nyall Dawson
64e0fff67f [console] Rely on QgsCodeEditorWidget search functionality
Remove duplicate code searching functionality from console script
editor and just use the standard QgsCodeEditorWidget implementation
2024-05-10 13:56:49 +10:00
Nyall Dawson
4854779200 Use QgsCodeEditorWidget in python console script editor 2024-05-10 13:56:49 +10:00
Nyall Dawson
249cc6d591 [console] Clean up objects a little
- Don't use ambiguous .parent members, use explicit names
- Add some typehints
2024-05-10 13:56:49 +10:00
Nyall Dawson
5b912fab9d Escape filenames correctly 2024-04-18 11:32:28 +10:00
Nyall Dawson
c033ac8ccd Show filename in exceptions raised from Python console scripts
Instead of "", ensure the actual filename (or tab title, for unsaved
scripts) is shown in exceptions
2024-04-18 11:32:28 +10:00
Nyall Dawson
4e874a3c75 [console] Minor cleanups
- Add some typehints
- Avoid creating an unnecessary local variable
2024-03-07 14:17:22 +01:00
Nyall Dawson
fbbe690283 [console] Ensure stored last dir path settings is always a folder
This prevents a bug where the save action in the Python console
keeps defaulting back to the binary QGIS install folder
2024-03-07 14:17:22 +01:00
Nyall Dawson
4dcdddaa02 [console] Don't needlessly store QgsSettings objects
These are cheap to construct by design, so we can avoid
storing them and the messy cross-class access to member
variables
2024-03-07 14:17:22 +01:00
Nyall Dawson
310b9172fb pyqt5to6: raise warnings on fragile addAction calls
The object.addAction variants with multiple arguments have changed
signature in Qt 6. It's safer to explicitly create a QAction first
and then add to an object using:

    my_action=QAction(...)
    obj.addAction(my_action)

It's a considerably less fragile syntax to use in any case!

Fixes errors when trying to show context menu in Python console
on Qt 6 builds
2024-01-31 10:55:33 +10:00
Nyall Dawson
e42abf7dc5 Update python files 2024-01-22 05:46:15 +10:00
Nyall Dawson
c16a1e2b3d Update enums 2024-01-19 19:44:48 +10:00
Nyall Dawson
9fab1623a3 Update deprecated removed enum value 2024-01-19 19:44:48 +10:00
Nyall Dawson
4fc5138a28 Upgrade some enum members which are invisible to python introspection 2024-01-19 19:44:48 +10:00
Nyall Dawson
d7ae0aea25 + should not be used with flags 2024-01-19 19:44:48 +10:00
Nyall Dawson
23df946386 Handle QSci enums in pyqt5 to qt6 2024-01-19 19:44:48 +10:00
Nyall Dawson
77f289d32e Fix incorrect operator for flags 2024-01-19 19:44:48 +10:00
Nyall Dawson
29a87bf0fc Fix enums in console 2024-01-19 19:44:48 +10:00
Nyall Dawson
fcfe98c8ed Some super-safety in overridden stdout/stderr to ensure we don't
try to write to a deleted qwidget
2023-06-14 07:48:13 +10:00
Nyall Dawson
def4acc14a Gracefully restore the system stdout/stderr when the python console
is about to be destroyed
2023-06-14 07:48:13 +10:00
Yoann Quenach de Quivillic
ab98551fec Apply suggestions from code review
Co-authored-by: Étienne Trimaille <gustrimaille@yahoo.fr>
2023-05-26 09:38:25 +10:00
Yoann Quenach de Quivillic
88c3c41638 Improve console help 2023-05-26 09:38:25 +10:00
Yoann Quenach de Quivillic
139ee639c2 Add named constants to designate interpreter states 2023-04-24 10:57:12 +10:00
Yoann Quenach de Quivillic
29016d052e Fix spelling and add license 2023-04-24 10:57:12 +10:00
Yoann Quenach de Quivillic
ea89babbf3 Handle multiple inputs 2023-04-24 10:57:12 +10:00
Yoann Quenach de Quivillic
6257a659b1 Add IPython-style assignment 2023-04-24 10:57:12 +10:00