409 Commits

Author SHA1 Message Date
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
Yoann Quenach de Quivillic
73e9596064 Run system commands with ! 2023-04-24 10:57:12 +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
6612506d7b Remove outdated code 2023-03-30 12:40:06 +10:00
Nyall Dawson
1822998bda [feature][console] Allow Python console to be toggled between a dock
widget and a full main window dialog

Adds the same toggle button as we use for 3d map canvases and attribute
tables to make it super-easy to switch the Python console to a full
main window.
2023-03-30 12:40:06 +10:00
Nyall Dawson
03e1d90b39 Immediately write out the console history file BEFORE running commands
This prevents loss of history when a user enters a Python command
which results in a QGIS crash
2023-03-28 15:04:39 +10:00
Nyall Dawson
b9b06b057a Don't add 'exec(Path(...))' entries to console history when running scripts
These just clutter the history
2023-03-28 15:04:39 +10:00
Denis Rouzaud
4e10546b4b follow-up refctoring settings for code editor 2023-03-21 09:44:19 +10:00
Nyall Dawson
56ce8ca673 Add reset buttons to numeric controls 2023-03-20 16:06:24 +10:00
Nyall Dawson
a6b4742e97 Use settings registry for new settings 2023-03-20 16:06:24 +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
4c74bd99c8 Populate combo box in code rather than in ui 2023-03-17 10:52:08 +10: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