PrEditor 2.0.0__tar.gz → 2.1.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.1.0}/PKG-INFO +1 -1
- {preditor-2.0.0 → preditor-2.1.0}/PrEditor.egg-info/PKG-INFO +1 -1
- {preditor-2.0.0 → preditor-2.1.0}/examples/output_console.py +94 -13
- {preditor-2.0.0 → preditor-2.1.0}/examples/output_console.ui +94 -12
- {preditor-2.0.0 → preditor-2.1.0}/preditor/contexts.py +93 -2
- {preditor-2.0.0 → preditor-2.1.0}/preditor/excepthooks.py +3 -13
- {preditor-2.0.0 → preditor-2.1.0}/preditor/gui/app.py +9 -6
- {preditor-2.0.0 → preditor-2.1.0}/preditor/gui/console.py +4 -1
- {preditor-2.0.0 → preditor-2.1.0}/preditor/gui/console_base.py +162 -2
- {preditor-2.0.0 → preditor-2.1.0}/preditor/gui/loggerwindow.py +40 -0
- preditor-2.1.0/preditor/gui/output_console.py +11 -0
- {preditor-2.0.0 → preditor-2.1.0}/preditor/gui/ui/loggerwindow.ui +104 -38
- {preditor-2.0.0 → preditor-2.1.0}/preditor/stream/console_handler.py +28 -18
- {preditor-2.0.0 → preditor-2.1.0}/preditor/stream/manager.py +2 -5
- {preditor-2.0.0 → preditor-2.1.0}/preditor/utils/__init__.py +58 -0
- {preditor-2.0.0 → preditor-2.1.0}/preditor/version.py +3 -3
- preditor-2.0.0/preditor/gui/output_console.py +0 -5
- {preditor-2.0.0 → preditor-2.1.0}/.coveragerc +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/.github/ISSUE_TEMPLATE/BUG_REPORT.md +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/.github/ISSUE_TEMPLATE/FEATURE_REQUEST.md +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/.github/PULL_REQUEST_TEMPLATE.md +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/.github/workflows/release.yml +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/.github/workflows/static-analysis-and-test.yml +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/.gitignore +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/.pre-commit-config.yaml +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/CODE_OF_CONDUCT.md +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/CONTRIBUTING.md +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/LICENSE +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/MANIFEST.in +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/PrEditor.egg-info/SOURCES.txt +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/PrEditor.egg-info/dependency_links.txt +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/PrEditor.egg-info/entry_points.txt +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/PrEditor.egg-info/requires.txt +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/PrEditor.egg-info/top_level.txt +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/README.md +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/examples/add_to_app.py +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/examples/output_capture_and_show.py +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/preditor/__init__.py +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/preditor/__main__.py +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/preditor/about_module.py +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/preditor/cli.py +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/preditor/config.py +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/preditor/constants.py +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/preditor/cores/__init__.py +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/preditor/cores/core.py +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/preditor/dccs/.hab.json +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/preditor/dccs/maya/PrEditor_maya.mod +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/preditor/dccs/maya/README.md +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/preditor/dccs/maya/plug-ins/PrEditor_maya.py +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/preditor/dccs/studiomax/PackageContents.xml +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/preditor/dccs/studiomax/PrEditor-PrEditor_Show.mcr +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/preditor/dccs/studiomax/README.md +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/preditor/dccs/studiomax/preditor.ms +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/preditor/dccs/studiomax/preditor_menu.mnx +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/preditor/debug.py +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/preditor/delayable_engine/__init__.py +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/preditor/delayable_engine/delayables.py +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/preditor/enum.py +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/preditor/gui/__init__.py +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/preditor/gui/codehighlighter.py +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/preditor/gui/completer.py +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/preditor/gui/dialog.py +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/preditor/gui/drag_tab_bar.py +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/preditor/gui/editor_chooser.py +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/preditor/gui/errordialog.py +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/preditor/gui/find_files.py +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/preditor/gui/fuzzy_search/__init__.py +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/preditor/gui/fuzzy_search/fuzzy_search.py +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/preditor/gui/group_tab_widget/__init__.py +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/preditor/gui/group_tab_widget/group_tab_widget.py +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/preditor/gui/group_tab_widget/grouped_tab_menu.py +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/preditor/gui/group_tab_widget/grouped_tab_models.py +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/preditor/gui/group_tab_widget/grouped_tab_widget.py +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/preditor/gui/group_tab_widget/one_tab_widget.py +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/preditor/gui/level_buttons.py +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/preditor/gui/logger_window_handler.py +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/preditor/gui/logger_window_plugin.py +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/preditor/gui/newtabwidget.py +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/preditor/gui/qtdesigner/__init__.py +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/preditor/gui/qtdesigner/_log_plugin.py +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/preditor/gui/qtdesigner/console_base_plugin.py +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/preditor/gui/qtdesigner/console_predit_plugin.py +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/preditor/gui/set_text_editor_path_dialog.py +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/preditor/gui/status_label.py +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/preditor/gui/suggest_path_quotes_dialog.py +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/preditor/gui/ui/editor_chooser.ui +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/preditor/gui/ui/errordialog.ui +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/preditor/gui/ui/find_files.ui +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/preditor/gui/ui/set_text_editor_path_dialog.ui +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/preditor/gui/ui/suggest_path_quotes_dialog.ui +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/preditor/gui/window.py +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/preditor/gui/workbox_mixin.py +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/preditor/gui/workbox_text_edit.py +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/preditor/gui/workboxwidget.py +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/preditor/logging_config.py +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/preditor/osystem.py +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/preditor/plugins.py +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/preditor/prefs.py +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/preditor/resource/environment_variables.html +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/preditor/resource/error_mail.html +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/preditor/resource/error_mail_inline.html +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/preditor/resource/img/README.md +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/preditor/resource/img/arrow_forward.png +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/preditor/resource/img/check-bold.png +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/preditor/resource/img/chevron-down.png +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/preditor/resource/img/chevron-up.png +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/preditor/resource/img/close-thick.png +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/preditor/resource/img/comment-edit.png +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/preditor/resource/img/content-copy.png +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/preditor/resource/img/content-cut.png +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/preditor/resource/img/content-duplicate.png +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/preditor/resource/img/content-paste.png +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/preditor/resource/img/content-save.png +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/preditor/resource/img/debug_disabled.png +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/preditor/resource/img/eye-check.png +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/preditor/resource/img/file-plus.png +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/preditor/resource/img/file-remove.png +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/preditor/resource/img/format-align-left.png +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/preditor/resource/img/format-letter-case-lower.png +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/preditor/resource/img/format-letter-case-upper.png +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/preditor/resource/img/format-letter-case.svg +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/preditor/resource/img/information.png +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/preditor/resource/img/logging_critical.png +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/preditor/resource/img/logging_custom.png +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/preditor/resource/img/logging_debug.png +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/preditor/resource/img/logging_error.png +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/preditor/resource/img/logging_info.png +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/preditor/resource/img/logging_not_set.png +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/preditor/resource/img/logging_warning.png +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/preditor/resource/img/marker.png +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/preditor/resource/img/play.png +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/preditor/resource/img/playlist-play.png +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/preditor/resource/img/plus-minus-variant.png +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/preditor/resource/img/preditor.ico +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/preditor/resource/img/preditor.png +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/preditor/resource/img/preditor.psd +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/preditor/resource/img/preditor.svg +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/preditor/resource/img/regex.svg +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/preditor/resource/img/restart.svg +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/preditor/resource/img/skip-forward-outline.png +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/preditor/resource/img/skip-next-outline.png +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/preditor/resource/img/skip-next.png +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/preditor/resource/img/skip-previous.png +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/preditor/resource/img/subdirectory-arrow-right.png +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/preditor/resource/img/text-search-variant.png +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/preditor/resource/img/warning-big.png +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/preditor/resource/lang/python.json +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/preditor/resource/pref_updates/pref_updates.json +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/preditor/resource/settings.ini +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/preditor/resource/stylesheet/Bright.css +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/preditor/resource/stylesheet/Dark.css +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/preditor/scintilla/__init__.py +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/preditor/scintilla/delayables/__init__.py +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/preditor/scintilla/delayables/smart_highlight.py +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/preditor/scintilla/delayables/spell_check.py +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/preditor/scintilla/documenteditor.py +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/preditor/scintilla/finddialog.py +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/preditor/scintilla/lang/__init__.py +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/preditor/scintilla/lang/config/bash.ini +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/preditor/scintilla/lang/config/batch.ini +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/preditor/scintilla/lang/config/cpp.ini +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/preditor/scintilla/lang/config/css.ini +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/preditor/scintilla/lang/config/eyeonscript.ini +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/preditor/scintilla/lang/config/html.ini +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/preditor/scintilla/lang/config/javascript.ini +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/preditor/scintilla/lang/config/lua.ini +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/preditor/scintilla/lang/config/maxscript.ini +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/preditor/scintilla/lang/config/mel.ini +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/preditor/scintilla/lang/config/mu.ini +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/preditor/scintilla/lang/config/nsi.ini +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/preditor/scintilla/lang/config/perl.ini +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/preditor/scintilla/lang/config/puppet.ini +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/preditor/scintilla/lang/config/python.ini +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/preditor/scintilla/lang/config/ruby.ini +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/preditor/scintilla/lang/config/sql.ini +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/preditor/scintilla/lang/config/xml.ini +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/preditor/scintilla/lang/config/yaml.ini +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/preditor/scintilla/lang/language.py +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/preditor/scintilla/lexers/__init__.py +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/preditor/scintilla/lexers/cpplexer.py +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/preditor/scintilla/lexers/javascriptlexer.py +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/preditor/scintilla/lexers/maxscriptlexer.py +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/preditor/scintilla/lexers/mellexer.py +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/preditor/scintilla/lexers/mulexer.py +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/preditor/scintilla/lexers/pythonlexer.py +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/preditor/scintilla/ui/finddialog.ui +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/preditor/settings.py +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/preditor/stream/__init__.py +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/preditor/stream/director.py +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/preditor/streamhandler_helper.py +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/preditor/utils/call_stack.py +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/preditor/utils/cute.py +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/preditor/utils/stylesheets.py +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/preditor/utils/text_search.py +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/preditor/weakref.py +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/pyproject.toml +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/requirements-cli.txt +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/requirements-dev.txt +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/requirements-qsci5.txt +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/requirements-qsci6.txt +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/requirements-shortcut.txt +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/requirements.txt +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/setup.cfg +0 -0
- {preditor-2.0.0 → preditor-2.1.0}/tox.ini +0 -0
|
@@ -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>
|
|
@@ -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]
|
|
@@ -5,7 +5,7 @@ import traceback
|
|
|
5
5
|
|
|
6
6
|
from Qt import QtCompat
|
|
7
7
|
|
|
8
|
-
from . import config, plugins
|
|
8
|
+
from . import config, plugins, utils
|
|
9
9
|
from .contexts import ErrorReport
|
|
10
10
|
from .weakref import WeakList
|
|
11
11
|
|
|
@@ -49,9 +49,7 @@ class PreditorExceptHook(object):
|
|
|
49
49
|
# prevent showing the traceback normally. This last ditch method prints
|
|
50
50
|
# the traceback to the original stderr stream so it can be debugged.
|
|
51
51
|
# Without this you might get little to no output to work with.
|
|
52
|
-
|
|
53
|
-
traceback.print_exc(file=sys.__stderr__)
|
|
54
|
-
print(" PrEditor excepthooks failed ".center(79, "-"), file=sys.__stderr__)
|
|
52
|
+
utils.ShellPrint(True).print_exc("PrEditor excepthooks failed")
|
|
55
53
|
|
|
56
54
|
def default_excepthooks(self):
|
|
57
55
|
"""Returns default excepthooks handlers.
|
|
@@ -90,15 +88,7 @@ class PreditorExceptHook(object):
|
|
|
90
88
|
try:
|
|
91
89
|
callback(*exc_info)
|
|
92
90
|
except Exception:
|
|
93
|
-
|
|
94
|
-
" PrEditor excepthook callback failed ".center(79, "-"),
|
|
95
|
-
file=sys.__stderr__,
|
|
96
|
-
)
|
|
97
|
-
traceback.print_exc(file=sys.__stderr__)
|
|
98
|
-
print(
|
|
99
|
-
" PrEditor excepthook callback failed ".center(79, "-"),
|
|
100
|
-
file=sys.__stderr__,
|
|
101
|
-
)
|
|
91
|
+
utils.ShellPrint(True).print_exc("PrEditor excepthook callback failed")
|
|
102
92
|
|
|
103
93
|
def ask_to_show_logger(self, *exc_info):
|
|
104
94
|
"""Show a dialog asking the user how to handle the error."""
|
|
@@ -117,12 +117,15 @@ class App(object):
|
|
|
117
117
|
if root_window is None:
|
|
118
118
|
windows = []
|
|
119
119
|
dialogs = []
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
120
|
+
|
|
121
|
+
hasTopLevelWidgets = hasattr(QApplication.instance(), "topLevelWidgets")
|
|
122
|
+
if hasTopLevelWidgets:
|
|
123
|
+
for w in inst.topLevelWidgets():
|
|
124
|
+
if w.parent() is None:
|
|
125
|
+
if isinstance(w, QMainWindow):
|
|
126
|
+
windows.append(w)
|
|
127
|
+
elif isinstance(w, QDialog):
|
|
128
|
+
dialogs.append(w)
|
|
126
129
|
if windows:
|
|
127
130
|
root_window = windows[0]
|
|
128
131
|
elif dialogs:
|
|
@@ -136,8 +136,11 @@ class ConsolePrEdit(ConsoleBase):
|
|
|
136
136
|
|
|
137
137
|
def clear(self):
|
|
138
138
|
"""clears the text in the editor"""
|
|
139
|
-
super().clear()
|
|
139
|
+
super(ConsoleBase, self).clear()
|
|
140
140
|
self.startInputLine()
|
|
141
|
+
# Note: Don't use the regular `super()` call here as it would result
|
|
142
|
+
# in multiple calls to repaint, just call the base Qt class's clear.
|
|
143
|
+
self.maybeRepaint(force=True)
|
|
141
144
|
|
|
142
145
|
def clearToLastPrompt(self):
|
|
143
146
|
# store the current cursor position so we can restore when we are done
|