205 Commits

Author SHA1 Message Date
Denis Rouzaud
0f032e5f2d run pre-commit on all files 2024-11-29 15:38:02 +01:00
Yoann Quenach de Quivillic
ff2f1f0e3f Remove python parameter and add context menu actions 2024-11-14 09:54:48 +10:00
Yoann Quenach de Quivillic
25480e872c Interactive Help on F1 2024-11-14 09:54:48 +10:00
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
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
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
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
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
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
d7ae0aea25 + should not be used with flags 2024-01-19 19:44:48 +10:00
Nyall Dawson
29a87bf0fc Fix enums in console 2024-01-19 19:44:48 +10:00
Yoann Quenach de Quivillic
d798fd0732 Use embedded messageBar in showMessage 2023-04-18 14:55:32 +10:00
Nyall Dawson
895a68faee Expose 'Search Selection in PyQGIS docs' action for all python code editors 2023-04-06 08:32:41 +10:00
Nyall Dawson
1c2aead582 Remove duplicate code 2023-03-20 16:06:24 +10:00
Matthias Kuhn
e5d6ade348
Merge pull request #51912 from YoannQDQ/python-console-__file__-available--#49191 2023-03-18 14:56:20 +01:00
Yoann Quenach de Quivillic
d2d7c5b422 Use native levenshtein distance 2023-03-17 10:52:08 +10:00
Yoann Quenach de Quivillic
5040a3b263 Fix flake8 2023-03-17 10:52:08 +10:00
Yoann Quenach de Quivillic
8db1026ed2 Use pushWarning instead of pushMessage 2023-03-17 10:52:08 +10:00
Yoann Quenach de Quivillic
53c7b8011b Fallback to difflib if levenshtein unavailable 2023-03-17 10:52:08 +10:00
Yoann Quenach de Quivillic
04a8436187 Conditional import 2023-03-17 10:52:08 +10:00
Yoann Quenach de Quivillic
311c1b14d2 Fix infinite loop 2023-03-17 10:52:08 +10:00
Yoann Quenach de Quivillic
364bb96850 Change wording format->reformat 2023-03-17 10:52:08 +10:00
Yoann Quenach de Quivillic
6523f0c58c Keep cursor position after formatting 2023-03-17 10:52:08 +10:00
Yoann Quenach de Quivillic
0f84e095b7 Add isort (sort imports) 2023-03-17 10:52:08 +10:00
Yoann Quenach de Quivillic
63a48983d9 Add black formatter 2023-03-17 10:52:08 +10:00
Yoann Quenach de Quivillic
3c97906bbf Add formatting options 2023-03-17 10:52:08 +10:00
Yoann Quenach de Quivillic
ef6de1ff2c Add format code action in Python Console Editor 2023-03-17 10:52:08 +10:00
Yoann Quenach de Quivillic
1f25b41d79 Fix duplicated newline on save (windows) 2023-03-13 14:49:32 +10:00
Yoann Quenach de Quivillic
a1a43e5362 Fixes #49191 make "__file__" available to scripts 2023-03-03 15:57:24 +01:00
Yoann Quenach de Quivillic
43c415d109 Fix focus switch on close tab 2023-03-03 12:17:01 +10:00
Yoann Quenach de Quivillic
fc3847def7 Fix bug introduced by #51913 - Proxy EditorTab attributes to Editor 2023-03-03 12:17:01 +10:00
Yoann Quenach de Quivillic
9c56921cca Clean up code and fix shortcuts 2023-02-21 14:27:36 +10:00