PrEditor 2.0.0__tar.gz → 2.2.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {preditor-2.0.0 → preditor-2.2.0}/.github/workflows/static-analysis-and-test.yml +3 -1
- {preditor-2.0.0 → preditor-2.2.0}/PKG-INFO +1 -3
- {preditor-2.0.0 → preditor-2.2.0}/PrEditor.egg-info/PKG-INFO +1 -3
- {preditor-2.0.0 → preditor-2.2.0}/PrEditor.egg-info/SOURCES.txt +0 -1
- {preditor-2.0.0 → preditor-2.2.0}/PrEditor.egg-info/requires.txt +0 -2
- {preditor-2.0.0 → preditor-2.2.0}/examples/output_console.py +94 -13
- {preditor-2.0.0 → preditor-2.2.0}/examples/output_console.ui +94 -12
- {preditor-2.0.0 → preditor-2.2.0}/preditor/about_module.py +1 -3
- {preditor-2.0.0 → preditor-2.2.0}/preditor/cli.py +2 -2
- {preditor-2.0.0 → preditor-2.2.0}/preditor/contexts.py +93 -2
- {preditor-2.0.0 → preditor-2.2.0}/preditor/enum.py +6 -10
- {preditor-2.0.0 → preditor-2.2.0}/preditor/excepthooks.py +3 -13
- {preditor-2.0.0 → preditor-2.2.0}/preditor/gui/app.py +9 -6
- {preditor-2.0.0 → preditor-2.2.0}/preditor/gui/console.py +5 -3
- {preditor-2.0.0 → preditor-2.2.0}/preditor/gui/console_base.py +162 -2
- {preditor-2.0.0 → preditor-2.2.0}/preditor/gui/drag_tab_bar.py +1 -2
- {preditor-2.0.0 → preditor-2.2.0}/preditor/gui/loggerwindow.py +41 -16
- preditor-2.2.0/preditor/gui/output_console.py +11 -0
- {preditor-2.0.0 → preditor-2.2.0}/preditor/gui/ui/loggerwindow.ui +104 -39
- {preditor-2.0.0 → preditor-2.2.0}/preditor/osystem.py +5 -4
- {preditor-2.0.0 → preditor-2.2.0}/preditor/prefs.py +5 -7
- {preditor-2.0.0 → preditor-2.2.0}/preditor/scintilla/lang/language.py +1 -5
- {preditor-2.0.0 → preditor-2.2.0}/preditor/scintilla/lexers/maxscriptlexer.py +2 -5
- {preditor-2.0.0 → preditor-2.2.0}/preditor/settings.py +1 -5
- {preditor-2.0.0 → preditor-2.2.0}/preditor/stream/console_handler.py +28 -18
- {preditor-2.0.0 → preditor-2.2.0}/preditor/stream/manager.py +2 -5
- {preditor-2.0.0 → preditor-2.2.0}/preditor/utils/__init__.py +58 -0
- {preditor-2.0.0 → preditor-2.2.0}/preditor/utils/text_search.py +1 -3
- {preditor-2.0.0 → preditor-2.2.0}/preditor/version.py +3 -3
- {preditor-2.0.0 → preditor-2.2.0}/pyproject.toml +33 -0
- {preditor-2.0.0 → preditor-2.2.0}/requirements.txt +0 -2
- {preditor-2.0.0 → preditor-2.2.0}/tox.ini +13 -3
- preditor-2.0.0/preditor/gui/output_console.py +0 -5
- preditor-2.0.0/preditor/resource/environment_variables.html +0 -26
- {preditor-2.0.0 → preditor-2.2.0}/.coveragerc +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/.github/ISSUE_TEMPLATE/BUG_REPORT.md +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/.github/ISSUE_TEMPLATE/FEATURE_REQUEST.md +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/.github/PULL_REQUEST_TEMPLATE.md +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/.github/workflows/release.yml +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/.gitignore +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/.pre-commit-config.yaml +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/CODE_OF_CONDUCT.md +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/CONTRIBUTING.md +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/LICENSE +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/MANIFEST.in +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/PrEditor.egg-info/dependency_links.txt +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/PrEditor.egg-info/entry_points.txt +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/PrEditor.egg-info/top_level.txt +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/README.md +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/examples/add_to_app.py +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/examples/output_capture_and_show.py +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/preditor/__init__.py +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/preditor/__main__.py +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/preditor/config.py +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/preditor/constants.py +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/preditor/cores/__init__.py +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/preditor/cores/core.py +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/preditor/dccs/.hab.json +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/preditor/dccs/maya/PrEditor_maya.mod +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/preditor/dccs/maya/README.md +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/preditor/dccs/maya/plug-ins/PrEditor_maya.py +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/preditor/dccs/studiomax/PackageContents.xml +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/preditor/dccs/studiomax/PrEditor-PrEditor_Show.mcr +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/preditor/dccs/studiomax/README.md +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/preditor/dccs/studiomax/preditor.ms +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/preditor/dccs/studiomax/preditor_menu.mnx +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/preditor/debug.py +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/preditor/delayable_engine/__init__.py +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/preditor/delayable_engine/delayables.py +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/preditor/gui/__init__.py +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/preditor/gui/codehighlighter.py +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/preditor/gui/completer.py +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/preditor/gui/dialog.py +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/preditor/gui/editor_chooser.py +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/preditor/gui/errordialog.py +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/preditor/gui/find_files.py +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/preditor/gui/fuzzy_search/__init__.py +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/preditor/gui/fuzzy_search/fuzzy_search.py +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/preditor/gui/group_tab_widget/__init__.py +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/preditor/gui/group_tab_widget/group_tab_widget.py +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/preditor/gui/group_tab_widget/grouped_tab_menu.py +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/preditor/gui/group_tab_widget/grouped_tab_models.py +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/preditor/gui/group_tab_widget/grouped_tab_widget.py +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/preditor/gui/group_tab_widget/one_tab_widget.py +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/preditor/gui/level_buttons.py +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/preditor/gui/logger_window_handler.py +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/preditor/gui/logger_window_plugin.py +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/preditor/gui/newtabwidget.py +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/preditor/gui/qtdesigner/__init__.py +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/preditor/gui/qtdesigner/_log_plugin.py +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/preditor/gui/qtdesigner/console_base_plugin.py +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/preditor/gui/qtdesigner/console_predit_plugin.py +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/preditor/gui/set_text_editor_path_dialog.py +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/preditor/gui/status_label.py +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/preditor/gui/suggest_path_quotes_dialog.py +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/preditor/gui/ui/editor_chooser.ui +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/preditor/gui/ui/errordialog.ui +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/preditor/gui/ui/find_files.ui +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/preditor/gui/ui/set_text_editor_path_dialog.ui +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/preditor/gui/ui/suggest_path_quotes_dialog.ui +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/preditor/gui/window.py +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/preditor/gui/workbox_mixin.py +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/preditor/gui/workbox_text_edit.py +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/preditor/gui/workboxwidget.py +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/preditor/logging_config.py +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/preditor/plugins.py +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/preditor/resource/error_mail.html +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/preditor/resource/error_mail_inline.html +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/preditor/resource/img/README.md +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/preditor/resource/img/arrow_forward.png +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/preditor/resource/img/check-bold.png +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/preditor/resource/img/chevron-down.png +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/preditor/resource/img/chevron-up.png +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/preditor/resource/img/close-thick.png +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/preditor/resource/img/comment-edit.png +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/preditor/resource/img/content-copy.png +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/preditor/resource/img/content-cut.png +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/preditor/resource/img/content-duplicate.png +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/preditor/resource/img/content-paste.png +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/preditor/resource/img/content-save.png +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/preditor/resource/img/debug_disabled.png +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/preditor/resource/img/eye-check.png +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/preditor/resource/img/file-plus.png +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/preditor/resource/img/file-remove.png +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/preditor/resource/img/format-align-left.png +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/preditor/resource/img/format-letter-case-lower.png +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/preditor/resource/img/format-letter-case-upper.png +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/preditor/resource/img/format-letter-case.svg +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/preditor/resource/img/information.png +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/preditor/resource/img/logging_critical.png +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/preditor/resource/img/logging_custom.png +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/preditor/resource/img/logging_debug.png +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/preditor/resource/img/logging_error.png +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/preditor/resource/img/logging_info.png +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/preditor/resource/img/logging_not_set.png +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/preditor/resource/img/logging_warning.png +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/preditor/resource/img/marker.png +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/preditor/resource/img/play.png +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/preditor/resource/img/playlist-play.png +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/preditor/resource/img/plus-minus-variant.png +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/preditor/resource/img/preditor.ico +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/preditor/resource/img/preditor.png +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/preditor/resource/img/preditor.psd +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/preditor/resource/img/preditor.svg +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/preditor/resource/img/regex.svg +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/preditor/resource/img/restart.svg +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/preditor/resource/img/skip-forward-outline.png +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/preditor/resource/img/skip-next-outline.png +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/preditor/resource/img/skip-next.png +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/preditor/resource/img/skip-previous.png +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/preditor/resource/img/subdirectory-arrow-right.png +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/preditor/resource/img/text-search-variant.png +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/preditor/resource/img/warning-big.png +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/preditor/resource/lang/python.json +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/preditor/resource/pref_updates/pref_updates.json +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/preditor/resource/settings.ini +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/preditor/resource/stylesheet/Bright.css +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/preditor/resource/stylesheet/Dark.css +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/preditor/scintilla/__init__.py +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/preditor/scintilla/delayables/__init__.py +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/preditor/scintilla/delayables/smart_highlight.py +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/preditor/scintilla/delayables/spell_check.py +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/preditor/scintilla/documenteditor.py +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/preditor/scintilla/finddialog.py +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/preditor/scintilla/lang/__init__.py +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/preditor/scintilla/lang/config/bash.ini +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/preditor/scintilla/lang/config/batch.ini +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/preditor/scintilla/lang/config/cpp.ini +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/preditor/scintilla/lang/config/css.ini +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/preditor/scintilla/lang/config/eyeonscript.ini +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/preditor/scintilla/lang/config/html.ini +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/preditor/scintilla/lang/config/javascript.ini +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/preditor/scintilla/lang/config/lua.ini +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/preditor/scintilla/lang/config/maxscript.ini +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/preditor/scintilla/lang/config/mel.ini +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/preditor/scintilla/lang/config/mu.ini +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/preditor/scintilla/lang/config/nsi.ini +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/preditor/scintilla/lang/config/perl.ini +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/preditor/scintilla/lang/config/puppet.ini +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/preditor/scintilla/lang/config/python.ini +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/preditor/scintilla/lang/config/ruby.ini +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/preditor/scintilla/lang/config/sql.ini +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/preditor/scintilla/lang/config/xml.ini +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/preditor/scintilla/lang/config/yaml.ini +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/preditor/scintilla/lexers/__init__.py +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/preditor/scintilla/lexers/cpplexer.py +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/preditor/scintilla/lexers/javascriptlexer.py +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/preditor/scintilla/lexers/mellexer.py +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/preditor/scintilla/lexers/mulexer.py +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/preditor/scintilla/lexers/pythonlexer.py +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/preditor/scintilla/ui/finddialog.ui +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/preditor/stream/__init__.py +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/preditor/stream/director.py +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/preditor/streamhandler_helper.py +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/preditor/utils/call_stack.py +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/preditor/utils/cute.py +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/preditor/utils/stylesheets.py +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/preditor/weakref.py +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/requirements-cli.txt +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/requirements-dev.txt +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/requirements-qsci5.txt +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/requirements-qsci6.txt +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/requirements-shortcut.txt +0 -0
- {preditor-2.0.0 → preditor-2.2.0}/setup.cfg +0 -0
|
@@ -35,6 +35,8 @@ jobs:
|
|
|
35
35
|
- name: Format with black
|
|
36
36
|
run: tox -e black
|
|
37
37
|
|
|
38
|
+
- name: Check imports with deptry
|
|
39
|
+
run: tox -e deptry
|
|
38
40
|
|
|
39
41
|
test:
|
|
40
42
|
# We want to run on external PRs, but not on our own internal PRs as they'll
|
|
@@ -47,7 +49,7 @@ jobs:
|
|
|
47
49
|
strategy:
|
|
48
50
|
matrix:
|
|
49
51
|
os: ['ubuntu-latest', 'windows-latest']
|
|
50
|
-
python: ['3.8', '3.9', '3.10', '3.11']
|
|
52
|
+
python: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13']
|
|
51
53
|
# Works around the depreciation of python 3.7 for ubuntu
|
|
52
54
|
# https://github.com/actions/setup-python/issues/544
|
|
53
55
|
include:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: PrEditor
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.2.0
|
|
4
4
|
Summary: A python REPL and Editor and console based on Qt.
|
|
5
5
|
Author-email: Blur Studio <opensource@blur.com>
|
|
6
6
|
License: LGPL-3.0
|
|
@@ -19,8 +19,6 @@ Requires-Python: >=3.7
|
|
|
19
19
|
Description-Content-Type: text/markdown
|
|
20
20
|
License-File: LICENSE
|
|
21
21
|
Requires-Dist: charset-normalizer
|
|
22
|
-
Requires-Dist: configparser>=4.0.2
|
|
23
|
-
Requires-Dist: future>=0.18.2
|
|
24
22
|
Requires-Dist: importlib-metadata>=4.8.3
|
|
25
23
|
Requires-Dist: Qt.py>=1.4.4
|
|
26
24
|
Requires-Dist: signalslot>=0.1.2
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: PrEditor
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.2.0
|
|
4
4
|
Summary: A python REPL and Editor and console based on Qt.
|
|
5
5
|
Author-email: Blur Studio <opensource@blur.com>
|
|
6
6
|
License: LGPL-3.0
|
|
@@ -19,8 +19,6 @@ Requires-Python: >=3.7
|
|
|
19
19
|
Description-Content-Type: text/markdown
|
|
20
20
|
License-File: LICENSE
|
|
21
21
|
Requires-Dist: charset-normalizer
|
|
22
|
-
Requires-Dist: configparser>=4.0.2
|
|
23
|
-
Requires-Dist: future>=0.18.2
|
|
24
22
|
Requires-Dist: importlib-metadata>=4.8.3
|
|
25
23
|
Requires-Dist: Qt.py>=1.4.4
|
|
26
24
|
Requires-Dist: signalslot>=0.1.2
|
|
@@ -102,7 +102,6 @@ preditor/gui/ui/find_files.ui
|
|
|
102
102
|
preditor/gui/ui/loggerwindow.ui
|
|
103
103
|
preditor/gui/ui/set_text_editor_path_dialog.ui
|
|
104
104
|
preditor/gui/ui/suggest_path_quotes_dialog.ui
|
|
105
|
-
preditor/resource/environment_variables.html
|
|
106
105
|
preditor/resource/error_mail.html
|
|
107
106
|
preditor/resource/error_mail_inline.html
|
|
108
107
|
preditor/resource/settings.ini
|
|
@@ -6,21 +6,28 @@
|
|
|
6
6
|
|
|
7
7
|
import logging
|
|
8
8
|
import sys
|
|
9
|
+
from argparse import ArgumentParser
|
|
9
10
|
|
|
10
11
|
import Qt
|
|
11
12
|
from Qt.QtCore import QDateTime
|
|
12
13
|
from Qt.QtWidgets import QApplication, QMainWindow
|
|
13
14
|
|
|
14
15
|
import preditor
|
|
16
|
+
from preditor.contexts import OverrideConsoleStreams
|
|
15
17
|
|
|
16
18
|
logger_a = logging.getLogger("logger_a")
|
|
17
19
|
logger_a_child = logging.getLogger("logger_a.child")
|
|
18
20
|
logger_b = logging.getLogger("logger_b")
|
|
19
21
|
logger_c = logging.getLogger("logger_c")
|
|
20
22
|
|
|
23
|
+
# Define a custom logging level name. This should be discouraged but logging
|
|
24
|
+
# supports it so PrEditor should as well.
|
|
25
|
+
SUPER_INFO_LEVEL = logging.INFO - 5
|
|
26
|
+
logging.addLevelName(SUPER_INFO_LEVEL, "SUPER_INFO")
|
|
27
|
+
|
|
21
28
|
|
|
22
29
|
class ExampleApp(QMainWindow):
|
|
23
|
-
def __init__(self, parent=None):
|
|
30
|
+
def __init__(self, parent=None, init_preditor=True):
|
|
24
31
|
super().__init__(parent=parent)
|
|
25
32
|
# Use a .ui file to simplify the example code setup.
|
|
26
33
|
Qt.QtCompat.loadUi(__file__.replace(".py", ".ui"), self)
|
|
@@ -29,6 +36,13 @@ class ExampleApp(QMainWindow):
|
|
|
29
36
|
self.uiClearBTN.released.connect(self.clear_all)
|
|
30
37
|
self.uiAllLoggingDebugBTN.released.connect(self.all_logging_level_debug)
|
|
31
38
|
self.uiAllLoggingWarningBTN.released.connect(self.all_logging_level_warning)
|
|
39
|
+
self.uiAllLoggingPrintBTN.released.connect(self.all_logging_print)
|
|
40
|
+
self.uiAllLoggingRaiseBTN.released.connect(self.all_logging_raise)
|
|
41
|
+
self.uiAllLoggingChangeHandlersBTN.released.connect(
|
|
42
|
+
self.all_logging_change_handlers
|
|
43
|
+
)
|
|
44
|
+
self.uiUsePrEditorStyleCHK.toggled.connect(self.set_stdout_style)
|
|
45
|
+
self.uiRemovePrEditorStyleBTN.released.connect(self.clear_stdout_style)
|
|
32
46
|
self.uiLoggingCriticalBTN.released.connect(self.level_critical)
|
|
33
47
|
self.uiLoggingErrorBTN.released.connect(self.level_error)
|
|
34
48
|
self.uiLoggingWarningBTN.released.connect(self.level_warning)
|
|
@@ -40,12 +54,15 @@ class ExampleApp(QMainWindow):
|
|
|
40
54
|
self.uiSendLoggingBTN.released.connect(self.send_logging)
|
|
41
55
|
|
|
42
56
|
# 1. Create the preditor instance and connect to the console's controllers
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
57
|
+
if init_preditor:
|
|
58
|
+
plog = preditor.instance(parent=self, create=True)
|
|
59
|
+
preditor.connect_preditor(self)
|
|
60
|
+
self.uiAllLog.controller = plog
|
|
61
|
+
self.uiSelectLog.controller = plog
|
|
62
|
+
self.uiStdout.controller = plog
|
|
63
|
+
self.uiStderr.controller = plog
|
|
64
|
+
else:
|
|
65
|
+
self.setWindowTitle(f"{self.windowTitle()} - No PrEditor")
|
|
49
66
|
|
|
50
67
|
# 2. Configure the various OutputConsole widgets.
|
|
51
68
|
# Note: this can be done in the .ui file, but for this example we will
|
|
@@ -54,6 +71,10 @@ class ExampleApp(QMainWindow):
|
|
|
54
71
|
# See this method for how to configure uiAllLog to show all logging
|
|
55
72
|
# messages of all levels
|
|
56
73
|
self.all_logging_level_warning()
|
|
74
|
+
# Configure the default logging formatter for this widget.
|
|
75
|
+
self.uiAllLog.logging_formatter_str = (
|
|
76
|
+
"<<%(levelname)s| %(name)s: Line: %(lineno)d>> %(message)s"
|
|
77
|
+
)
|
|
57
78
|
|
|
58
79
|
# Configure uiSelectLog to show logging messages from specific handlers
|
|
59
80
|
self.uiSelectLog.logging_handlers = [
|
|
@@ -72,6 +93,24 @@ class ExampleApp(QMainWindow):
|
|
|
72
93
|
# Configure uiStderr to only show stderr text
|
|
73
94
|
self.uiStderr.stream_echo_stderr = True
|
|
74
95
|
|
|
96
|
+
def all_logging_change_handlers(self):
|
|
97
|
+
"""Demonstrate temporarily changing logging_handlers for uiAllLog.
|
|
98
|
+
|
|
99
|
+
This changes uiAllLog to only show a subset of loggers not all of them.
|
|
100
|
+
It sends the same logging messages as the "Send Logging Message" Button,
|
|
101
|
+
but due to the updated filtering it shows very different results.
|
|
102
|
+
"""
|
|
103
|
+
handlers = [
|
|
104
|
+
# Only show logger_a warnings
|
|
105
|
+
"logger_a_child,level=WARNING",
|
|
106
|
+
# And enable showing a custom logging level message. This is normally
|
|
107
|
+
# hidden unless the logging level is set to debug or SUPER_INFO.
|
|
108
|
+
# Note that we can pass SUPER_INFO because of the `addLevelName` call.
|
|
109
|
+
"logger_c,level=SUPER_INFO",
|
|
110
|
+
]
|
|
111
|
+
with OverrideConsoleStreams(self.uiAllLog, logging_handlers=handlers):
|
|
112
|
+
self.send_logging()
|
|
113
|
+
|
|
75
114
|
def all_logging_level_debug(self):
|
|
76
115
|
"""Update this widget to show up to debug messages for all loggers.
|
|
77
116
|
Hide the PyQt loggers as they just clutter the output for this demo.
|
|
@@ -80,6 +119,7 @@ class ExampleApp(QMainWindow):
|
|
|
80
119
|
"root,level=DEBUG",
|
|
81
120
|
"PyQt5,level=CRITICAL",
|
|
82
121
|
"PyQt6,level=CRITICAL",
|
|
122
|
+
"logger_b,fmt=[%(levelname)s:%(name)s] %(message)s",
|
|
83
123
|
]
|
|
84
124
|
|
|
85
125
|
def all_logging_level_warning(self):
|
|
@@ -92,8 +132,22 @@ class ExampleApp(QMainWindow):
|
|
|
92
132
|
# logging messages created when first showing the PrEditor instance.
|
|
93
133
|
"PyQt5,level=CRITICAL",
|
|
94
134
|
"PyQt6,level=CRITICAL",
|
|
135
|
+
# Replace the default logging_formatter_str formatter only for logger_b
|
|
136
|
+
"logger_b,fmt=[%(levelname)s:%(name)s] %(message)s",
|
|
95
137
|
]
|
|
96
138
|
|
|
139
|
+
def all_logging_print(self):
|
|
140
|
+
"""Show temporarily enabling showing prints inside multiple consoles."""
|
|
141
|
+
with OverrideConsoleStreams([self.uiAllLog, self.uiSelectLog], stdout=True):
|
|
142
|
+
print("This print is also shown in All logging and Select Logging.")
|
|
143
|
+
print("This print is NOT shown in All logging and Select Logging.")
|
|
144
|
+
|
|
145
|
+
def all_logging_raise(self):
|
|
146
|
+
"""Show temporarily enabling showing tracebacks in uiAllLog."""
|
|
147
|
+
with OverrideConsoleStreams(self.uiAllLog, tracebacks=True):
|
|
148
|
+
print("This print is NOT shown in All logging.")
|
|
149
|
+
raise RuntimeError("This Exception is also shown in All logging.")
|
|
150
|
+
|
|
97
151
|
def clear_all(self):
|
|
98
152
|
"""Clear the text from all consoles"""
|
|
99
153
|
self.uiAllLog.clear()
|
|
@@ -101,6 +155,11 @@ class ExampleApp(QMainWindow):
|
|
|
101
155
|
self.uiStdout.clear()
|
|
102
156
|
self.uiStderr.clear()
|
|
103
157
|
|
|
158
|
+
def clear_stdout_style(self):
|
|
159
|
+
"""Reset uiStdout's style to not use PrEditor's style."""
|
|
160
|
+
self.uiUsePrEditorStyleCHK.setChecked(False)
|
|
161
|
+
self.uiStdout.setStyleSheet(None)
|
|
162
|
+
|
|
104
163
|
def level_critical(self):
|
|
105
164
|
logging.root.setLevel(logging.CRITICAL)
|
|
106
165
|
|
|
@@ -128,6 +187,14 @@ class ExampleApp(QMainWindow):
|
|
|
128
187
|
def raise_exception(self):
|
|
129
188
|
raise RuntimeError(self.message_time())
|
|
130
189
|
|
|
190
|
+
def set_stdout_style(self, state):
|
|
191
|
+
"""Enable/disable uiStdout using PrEditor's style.
|
|
192
|
+
|
|
193
|
+
Note: Disabling it doesn't clear the style, just prevent it from being
|
|
194
|
+
automatically updated when changed in PrEditor.
|
|
195
|
+
"""
|
|
196
|
+
self.uiStdout.use_console_stylesheet = state
|
|
197
|
+
|
|
131
198
|
def send_logging(self):
|
|
132
199
|
logger_a.critical("A critical msg for logger_a")
|
|
133
200
|
logger_a.error("A error msg for logger_a")
|
|
@@ -140,23 +207,37 @@ class ExampleApp(QMainWindow):
|
|
|
140
207
|
logger_b.debug("A debug msg for logger_b")
|
|
141
208
|
logger_c.warning("A warning msg for logger_c")
|
|
142
209
|
logger_c.debug("A debug msg for logger_c")
|
|
210
|
+
logger_c.log(
|
|
211
|
+
SUPER_INFO_LEVEL,
|
|
212
|
+
"A custom logging level msg for logger_c that is normally hidden "
|
|
213
|
+
"unless using debug or the custom level.",
|
|
214
|
+
)
|
|
143
215
|
logging.root.warning("A warning msg for logging.root")
|
|
144
216
|
logging.root.debug("A debug msg for logging.root")
|
|
145
217
|
|
|
146
218
|
|
|
147
219
|
if __name__ == '__main__':
|
|
220
|
+
parser = ArgumentParser("Example of using OutputConsole features.")
|
|
221
|
+
parser.add_argument(
|
|
222
|
+
"--no-preditor",
|
|
223
|
+
action="store_true",
|
|
224
|
+
help="Don't init and install the PrEditor console.",
|
|
225
|
+
)
|
|
226
|
+
args = parser.parse_args()
|
|
227
|
+
|
|
148
228
|
# Configure PrEditor for this application, start capturing all text output
|
|
149
229
|
# from stderr/stdout so once PrEditor is launched, it can show this text.
|
|
150
230
|
# This does not initialize any QtGui/QtWidgets.
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
231
|
+
if not args.no_preditor:
|
|
232
|
+
preditor.configure(
|
|
233
|
+
# This is the name used to store PrEditor preferences and workboxes
|
|
234
|
+
# specific to this application.
|
|
235
|
+
'output_console',
|
|
236
|
+
)
|
|
156
237
|
|
|
157
238
|
# Create a Gui Application allowing the user to show PrEditor
|
|
158
239
|
app = QApplication(sys.argv)
|
|
159
|
-
main_gui = ExampleApp()
|
|
240
|
+
main_gui = ExampleApp(init_preditor=not args.no_preditor)
|
|
160
241
|
|
|
161
242
|
main_gui.show()
|
|
162
243
|
app.exec_()
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
<rect>
|
|
7
7
|
<x>0</x>
|
|
8
8
|
<y>0</y>
|
|
9
|
-
<width>
|
|
9
|
+
<width>861</width>
|
|
10
10
|
<height>941</height>
|
|
11
11
|
</rect>
|
|
12
12
|
</property>
|
|
@@ -26,25 +26,46 @@
|
|
|
26
26
|
</property>
|
|
27
27
|
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
|
28
28
|
<item>
|
|
29
|
-
<widget class="OutputConsole" name="uiAllLog"
|
|
29
|
+
<widget class="OutputConsole" name="uiAllLog">
|
|
30
|
+
<property name="use_console_stylesheet" stdset="0">
|
|
31
|
+
<bool>true</bool>
|
|
32
|
+
</property>
|
|
33
|
+
</widget>
|
|
30
34
|
</item>
|
|
31
35
|
<item>
|
|
32
|
-
<layout class="
|
|
33
|
-
<item>
|
|
36
|
+
<layout class="QGridLayout" name="gridLayout">
|
|
37
|
+
<item row="0" column="0">
|
|
34
38
|
<widget class="QPushButton" name="uiAllLoggingWarningBTN">
|
|
35
39
|
<property name="text">
|
|
36
40
|
<string>Warning</string>
|
|
37
41
|
</property>
|
|
38
42
|
</widget>
|
|
39
43
|
</item>
|
|
40
|
-
<item>
|
|
44
|
+
<item row="0" column="1">
|
|
41
45
|
<widget class="QPushButton" name="uiAllLoggingDebugBTN">
|
|
42
46
|
<property name="text">
|
|
43
47
|
<string>Debug</string>
|
|
44
48
|
</property>
|
|
45
49
|
</widget>
|
|
46
50
|
</item>
|
|
47
|
-
<item>
|
|
51
|
+
<item row="2" column="0" colspan="2">
|
|
52
|
+
<widget class="Line" name="line">
|
|
53
|
+
<property name="orientation">
|
|
54
|
+
<enum>Qt::Horizontal</enum>
|
|
55
|
+
</property>
|
|
56
|
+
</widget>
|
|
57
|
+
</item>
|
|
58
|
+
<item row="3" column="0" colspan="2">
|
|
59
|
+
<widget class="QPushButton" name="uiAllLoggingRaiseBTN">
|
|
60
|
+
<property name="toolTip">
|
|
61
|
+
<string><html><head/><body><p>Uses preditor.contexts.OverrideConsoleStreams to temporarily enable showing tracebacks in all logging and raises an exception. This enables showing errors in that console but errors raised elsewhere won't be shown in that console.</p></body></html></string>
|
|
62
|
+
</property>
|
|
63
|
+
<property name="text">
|
|
64
|
+
<string>Raise and show Exception</string>
|
|
65
|
+
</property>
|
|
66
|
+
</widget>
|
|
67
|
+
</item>
|
|
68
|
+
<item row="1" column="0" colspan="2">
|
|
48
69
|
<widget class="QLabel" name="label_2">
|
|
49
70
|
<property name="text">
|
|
50
71
|
<string>Set the logging level filter for this widget. This is affected by the global logging levels set at the bottom of this UI, so to see debug output you must set both to debug.</string>
|
|
@@ -54,7 +75,27 @@
|
|
|
54
75
|
</property>
|
|
55
76
|
</widget>
|
|
56
77
|
</item>
|
|
57
|
-
<item>
|
|
78
|
+
<item row="4" column="0">
|
|
79
|
+
<widget class="QPushButton" name="uiAllLoggingPrintBTN">
|
|
80
|
+
<property name="toolTip">
|
|
81
|
+
<string><html><head/><body><p>Uses preditor.contexts.OverrideConsoleStreams to temporarily enable showing stdout(prints). It also shows the print in Select Logging.</p></body></html></string>
|
|
82
|
+
</property>
|
|
83
|
+
<property name="text">
|
|
84
|
+
<string>Show print</string>
|
|
85
|
+
</property>
|
|
86
|
+
</widget>
|
|
87
|
+
</item>
|
|
88
|
+
<item row="4" column="1">
|
|
89
|
+
<widget class="QPushButton" name="uiAllLoggingChangeHandlersBTN">
|
|
90
|
+
<property name="toolTip">
|
|
91
|
+
<string><html><head/><body><p>Sends the same logging messages as the &quot;Send Logging Messages&quot; button.</p><p>However it uses preditor.contexts.OverrideConsoleStreams to temporarily replace logging handlers for uiAllLog. This results in very different output being shown.</p><p>If you use the bottom Debug button to set the global logging level to debug you will also see the SUPER_INFO log message.</p></body></html></string>
|
|
92
|
+
</property>
|
|
93
|
+
<property name="text">
|
|
94
|
+
<string>Logging Handlers</string>
|
|
95
|
+
</property>
|
|
96
|
+
</widget>
|
|
97
|
+
</item>
|
|
98
|
+
<item row="5" column="1">
|
|
58
99
|
<spacer name="verticalSpacer">
|
|
59
100
|
<property name="orientation">
|
|
60
101
|
<enum>Qt::Vertical</enum>
|
|
@@ -62,7 +103,7 @@
|
|
|
62
103
|
<property name="sizeHint" stdset="0">
|
|
63
104
|
<size>
|
|
64
105
|
<width>20</width>
|
|
65
|
-
<height>
|
|
106
|
+
<height>0</height>
|
|
66
107
|
</size>
|
|
67
108
|
</property>
|
|
68
109
|
</spacer>
|
|
@@ -77,7 +118,11 @@
|
|
|
77
118
|
</property>
|
|
78
119
|
<layout class="QVBoxLayout" name="verticalLayout_4">
|
|
79
120
|
<item>
|
|
80
|
-
<widget class="OutputConsole" name="uiSelectLog"
|
|
121
|
+
<widget class="OutputConsole" name="uiSelectLog">
|
|
122
|
+
<property name="logging_formatter_str" stdset="0">
|
|
123
|
+
<string><<%(levelname)s| %(name)s: Line: %(lineno)d>> %(message)s</string>
|
|
124
|
+
</property>
|
|
125
|
+
</widget>
|
|
81
126
|
</item>
|
|
82
127
|
</layout>
|
|
83
128
|
</widget>
|
|
@@ -85,9 +130,46 @@
|
|
|
85
130
|
<property name="title">
|
|
86
131
|
<string>Stdout</string>
|
|
87
132
|
</property>
|
|
88
|
-
<layout class="
|
|
89
|
-
<item>
|
|
90
|
-
<widget class="
|
|
133
|
+
<layout class="QGridLayout" name="gridLayout_2">
|
|
134
|
+
<item row="1" column="1">
|
|
135
|
+
<widget class="QPushButton" name="uiRemovePrEditorStyleBTN">
|
|
136
|
+
<property name="toolTip">
|
|
137
|
+
<string><html><head/><body><p>Reset stylesheet to empty and disable Use PrEditor Style Sheet.</p></body></html></string>
|
|
138
|
+
</property>
|
|
139
|
+
<property name="text">
|
|
140
|
+
<string>Remove Style Sheet</string>
|
|
141
|
+
</property>
|
|
142
|
+
</widget>
|
|
143
|
+
</item>
|
|
144
|
+
<item row="1" column="0">
|
|
145
|
+
<widget class="QCheckBox" name="uiUsePrEditorStyleCHK">
|
|
146
|
+
<property name="toolTip">
|
|
147
|
+
<string><html><head/><body><p>Enable using the stylesheet from the PrEditor instances Options -&gt; Style menu. This OutputConsole doesn't have it enabled by default so it doesn't have the stylesheet applied. Checking this will load the style sheet. If you then uncheck it, the style sheet won't be cleared but it will no longer respect the PrEditor Options -&gt; Style changes.</p></body></html></string>
|
|
148
|
+
</property>
|
|
149
|
+
<property name="text">
|
|
150
|
+
<string>Use PrEditor Style Sheet</string>
|
|
151
|
+
</property>
|
|
152
|
+
</widget>
|
|
153
|
+
</item>
|
|
154
|
+
<item row="1" column="2">
|
|
155
|
+
<spacer name="horizontalSpacer">
|
|
156
|
+
<property name="orientation">
|
|
157
|
+
<enum>Qt::Horizontal</enum>
|
|
158
|
+
</property>
|
|
159
|
+
<property name="sizeHint" stdset="0">
|
|
160
|
+
<size>
|
|
161
|
+
<width>40</width>
|
|
162
|
+
<height>20</height>
|
|
163
|
+
</size>
|
|
164
|
+
</property>
|
|
165
|
+
</spacer>
|
|
166
|
+
</item>
|
|
167
|
+
<item row="0" column="0" colspan="3">
|
|
168
|
+
<widget class="OutputConsole" name="uiStdout">
|
|
169
|
+
<property name="use_console_stylesheet" stdset="0">
|
|
170
|
+
<bool>false</bool>
|
|
171
|
+
</property>
|
|
172
|
+
</widget>
|
|
91
173
|
</item>
|
|
92
174
|
</layout>
|
|
93
175
|
</widget>
|
|
@@ -5,12 +5,10 @@ import os
|
|
|
5
5
|
import sys
|
|
6
6
|
import textwrap
|
|
7
7
|
|
|
8
|
-
from future.utils import with_metaclass
|
|
9
|
-
|
|
10
8
|
import preditor
|
|
11
9
|
|
|
12
10
|
|
|
13
|
-
class AboutModule(
|
|
11
|
+
class AboutModule(object, metaclass=abc.ABCMeta):
|
|
14
12
|
"""Base class for the `preditor.plug.about_module` entry point. Create a
|
|
15
13
|
subclass of this method and expose the class object to the entry point.
|
|
16
14
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
from __future__ import absolute_import
|
|
2
2
|
|
|
3
3
|
import logging
|
|
4
|
+
import shutil
|
|
4
5
|
import sys
|
|
5
|
-
from distutils.spawn import find_executable
|
|
6
6
|
|
|
7
7
|
import click
|
|
8
8
|
from click.core import ParameterSource
|
|
@@ -129,7 +129,7 @@ def shortcut(path, public, name, target, args, description):
|
|
|
129
129
|
|
|
130
130
|
# Resolve the full path to the preditor exe.
|
|
131
131
|
if target in ("preditor", "preditorw"):
|
|
132
|
-
target =
|
|
132
|
+
target = shutil.which(target)
|
|
133
133
|
|
|
134
134
|
parameter_source = click.get_current_context().get_parameter_source('name')
|
|
135
135
|
if parameter_source == ParameterSource.DEFAULT:
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
from __future__ import absolute_import
|
|
1
|
+
from __future__ import absolute_import
|
|
2
2
|
|
|
3
3
|
import logging
|
|
4
|
+
from contextlib import contextmanager
|
|
5
|
+
from typing import List, Tuple
|
|
4
6
|
|
|
5
7
|
_LOGGER = logging.getLogger(__name__)
|
|
6
8
|
|
|
@@ -60,7 +62,7 @@ class ErrorReport(object):
|
|
|
60
62
|
memory if there isn't a excepthook calling clearReports.
|
|
61
63
|
"""
|
|
62
64
|
|
|
63
|
-
__reports__ = []
|
|
65
|
+
__reports__: List[Tuple[str, str]] = []
|
|
64
66
|
enabled = False
|
|
65
67
|
|
|
66
68
|
def __init__(self, callback, title=''):
|
|
@@ -117,3 +119,92 @@ class ErrorReport(object):
|
|
|
117
119
|
result = callback()
|
|
118
120
|
ret.append((title, fmt.format(result=result)))
|
|
119
121
|
return ret
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
@contextmanager
|
|
125
|
+
def OverrideConsoleStreams(
|
|
126
|
+
consoles,
|
|
127
|
+
tracebacks=None,
|
|
128
|
+
stdout=None,
|
|
129
|
+
stderr=None,
|
|
130
|
+
result=None,
|
|
131
|
+
logging_handlers=None,
|
|
132
|
+
):
|
|
133
|
+
"""Override a Console's stream and logging_handlers settings.
|
|
134
|
+
|
|
135
|
+
This is useful if you don't want to show tracebacks or output for un-related code.
|
|
136
|
+
|
|
137
|
+
Example:
|
|
138
|
+
|
|
139
|
+
console = OutputConsole()
|
|
140
|
+
with OverrideConsoleStreams(console, tracebacks=True)
|
|
141
|
+
# A traceback raised here would show in console
|
|
142
|
+
do_work_you_only_want_to_show_tracebacks_in_console()
|
|
143
|
+
raise RuntimeError("This traceback will not be shown in console")
|
|
144
|
+
"""
|
|
145
|
+
# If a single console was passed, convert it into a list
|
|
146
|
+
try:
|
|
147
|
+
iter(consoles)
|
|
148
|
+
except TypeError:
|
|
149
|
+
consoles = [consoles]
|
|
150
|
+
|
|
151
|
+
# Store the current state and apply changes to the consoles
|
|
152
|
+
current = []
|
|
153
|
+
for console in consoles:
|
|
154
|
+
current.append(
|
|
155
|
+
(
|
|
156
|
+
console,
|
|
157
|
+
None if tracebacks is None else console.stream_echo_tracebacks,
|
|
158
|
+
None if stdout is None else console.stream_echo_stdout,
|
|
159
|
+
None if stderr is None else console.stream_echo_stderr,
|
|
160
|
+
None if result is None else console.stream_echo_result,
|
|
161
|
+
None if logging_handlers is None else console.logging_handlers,
|
|
162
|
+
)
|
|
163
|
+
)
|
|
164
|
+
|
|
165
|
+
if tracebacks is not None:
|
|
166
|
+
# Enable/disable traceback display override
|
|
167
|
+
console.stream_echo_tracebacks = tracebacks
|
|
168
|
+
if tracebacks:
|
|
169
|
+
# traceback display is enabled, make it automatically remove
|
|
170
|
+
# itself if an exception is raised by the sys.excepthook handler.
|
|
171
|
+
console._write_error_self_destruct = True
|
|
172
|
+
if stdout is not None:
|
|
173
|
+
console.stream_echo_stdout = stdout
|
|
174
|
+
if stderr is not None:
|
|
175
|
+
console.stream_echo_stderr = stderr
|
|
176
|
+
if result is not None:
|
|
177
|
+
console.stream_echo_result = result
|
|
178
|
+
if logging_handlers is not None:
|
|
179
|
+
console.logging_handlers = logging_handlers
|
|
180
|
+
|
|
181
|
+
# NOTE: This code is a horrible abomination of necessity.
|
|
182
|
+
try:
|
|
183
|
+
yield
|
|
184
|
+
except Exception:
|
|
185
|
+
# This is syntactically needed, we don't need to capture the exception,
|
|
186
|
+
# but the else requires it. We need raise any un-handled exceptions
|
|
187
|
+
# encountered to allow sys.excepthook to process normally.
|
|
188
|
+
# This prevents the else code from removing the traceback print overriding
|
|
189
|
+
# because the else/finally are processed before sys.excepthook is.
|
|
190
|
+
raise
|
|
191
|
+
else:
|
|
192
|
+
# Only called when exception was not raised. Restore the original traceback
|
|
193
|
+
# and disable the self destructing flag its not needed anymore.
|
|
194
|
+
for item in current:
|
|
195
|
+
if tracebacks is not None:
|
|
196
|
+
item[0].stream_echo_tracebacks = item[1]
|
|
197
|
+
if tracebacks:
|
|
198
|
+
item[0]._write_error_self_destruct = False
|
|
199
|
+
finally:
|
|
200
|
+
# Always remove non-traceback options. This is handled before excepthook
|
|
201
|
+
# so we can just use the simplicity of a normal try/finally statement.
|
|
202
|
+
for item in current:
|
|
203
|
+
if stdout is not None:
|
|
204
|
+
item[0].stream_echo_stdout = item[2]
|
|
205
|
+
if stderr is not None:
|
|
206
|
+
item[0].stream_echo_stderr = item[3]
|
|
207
|
+
if result is not None:
|
|
208
|
+
item[0].stream_echo_result = item[4]
|
|
209
|
+
if logging_handlers is not None:
|
|
210
|
+
item[0].logging_handlers = item[5]
|
|
@@ -2,12 +2,8 @@ from __future__ import absolute_import
|
|
|
2
2
|
|
|
3
3
|
import abc
|
|
4
4
|
import re
|
|
5
|
-
from builtins import str as text
|
|
6
5
|
from numbers import Number
|
|
7
6
|
|
|
8
|
-
from future.utils import iteritems, with_metaclass
|
|
9
|
-
from past.builtins import long
|
|
10
|
-
|
|
11
7
|
# =============================================================================
|
|
12
8
|
# CLASSES
|
|
13
9
|
# =============================================================================
|
|
@@ -79,7 +75,7 @@ class _MetaEnumGroup(type):
|
|
|
79
75
|
# =============================================================================
|
|
80
76
|
|
|
81
77
|
|
|
82
|
-
class Enum(
|
|
78
|
+
class Enum(object, metaclass=abc.ABCMeta):
|
|
83
79
|
"""A basic enumerator class.
|
|
84
80
|
|
|
85
81
|
Enumerators are named values that act as identifiers. Typically, a
|
|
@@ -204,9 +200,9 @@ class Enum(with_metaclass(abc.ABCMeta, object)):
|
|
|
204
200
|
return False
|
|
205
201
|
if isinstance(value, Enum):
|
|
206
202
|
return self.number == value.number
|
|
207
|
-
if isinstance(value,
|
|
203
|
+
if isinstance(value, int):
|
|
208
204
|
return self.number == value
|
|
209
|
-
if isinstance(value, str)
|
|
205
|
+
if isinstance(value, str):
|
|
210
206
|
if self._compareStr(value):
|
|
211
207
|
return True
|
|
212
208
|
return False
|
|
@@ -296,7 +292,7 @@ class Enum(with_metaclass(abc.ABCMeta, object)):
|
|
|
296
292
|
# =============================================================================
|
|
297
293
|
|
|
298
294
|
|
|
299
|
-
class EnumGroup(
|
|
295
|
+
class EnumGroup(object, metaclass=_MetaEnumGroup):
|
|
300
296
|
"""A container class for collecting, organizing, and accessing Enums.
|
|
301
297
|
|
|
302
298
|
An EnumGroup class is a container for Enum objects. It provides
|
|
@@ -428,7 +424,7 @@ class EnumGroup(with_metaclass(_MetaEnumGroup, object)):
|
|
|
428
424
|
raise ValueError('Enums given as ordered arguments must have a label.')
|
|
429
425
|
for e in args:
|
|
430
426
|
setattr(cls, cls._labelToVarName(e.label), e)
|
|
431
|
-
for n, e in
|
|
427
|
+
for n, e in kwargs.items():
|
|
432
428
|
setattr(cls, n, e)
|
|
433
429
|
# reset All and Nothing -- this is necessary so that All is regenerated
|
|
434
430
|
# and so that Nothing is not included when finding the member Enums.
|
|
@@ -585,7 +581,7 @@ class EnumGroup(with_metaclass(_MetaEnumGroup, object)):
|
|
|
585
581
|
orderedEnums = sorted(
|
|
586
582
|
[
|
|
587
583
|
(k, v)
|
|
588
|
-
for k, v in
|
|
584
|
+
for k, v in cls.__dict__.items()
|
|
589
585
|
if isinstance(v, Enum) and k not in ('All', 'Nothing')
|
|
590
586
|
],
|
|
591
587
|
key=lambda i: i[1]._creationOrder,
|