PrEditor 0.0.0.dev1__py2.py3-none-any.whl → 0.1.0__py2.py3-none-any.whl
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.
Potentially problematic release.
This version of PrEditor might be problematic. Click here for more details.
- PrEditor-0.1.0.dist-info/LICENSE +165 -0
- PrEditor-0.1.0.dist-info/METADATA +212 -0
- PrEditor-0.1.0.dist-info/RECORD +149 -0
- {PrEditor-0.0.0.dev1.dist-info → PrEditor-0.1.0.dist-info}/WHEEL +1 -1
- PrEditor-0.1.0.dist-info/entry_points.txt +18 -0
- PrEditor-0.1.0.dist-info/top_level.txt +1 -0
- preditor/__init__.py +301 -0
- {blurdev → preditor}/__main__.py +13 -13
- preditor/about_module.py +166 -0
- preditor/cli.py +192 -0
- {blurdev → preditor}/contexts.py +119 -119
- preditor/cores/core.py +65 -0
- preditor/dccs/maya/PrEditor_maya.mod +2 -0
- preditor/dccs/maya/plug-ins/PrEditor_maya.py +108 -0
- preditor/debug.py +294 -0
- blurdev/scintilla/delayable_engine.py → preditor/delayable_engine/__init__.py +310 -299
- blurdev/scintilla/delayables/base.py → preditor/delayable_engine/delayables.py +85 -85
- {blurdev → preditor}/enum.py +728 -1003
- {blurdev → preditor}/gui/__init__.py +84 -125
- preditor/gui/app.py +159 -0
- {blurdev → preditor}/gui/codehighlighter.py +209 -219
- {blurdev → preditor}/gui/completer.py +226 -236
- {blurdev → preditor}/gui/console.py +801 -858
- {blurdev → preditor}/gui/dialog.py +200 -216
- preditor/gui/drag_tab_bar.py +190 -0
- preditor/gui/editor_chooser.py +57 -0
- {blurdev → preditor}/gui/errordialog.py +100 -97
- preditor/gui/fuzzy_search/fuzzy_search.py +93 -0
- preditor/gui/group_tab_widget/__init__.py +319 -0
- preditor/gui/group_tab_widget/grouped_tab_menu.py +35 -0
- preditor/gui/group_tab_widget/grouped_tab_models.py +108 -0
- preditor/gui/group_tab_widget/grouped_tab_widget.py +75 -0
- preditor/gui/group_tab_widget/one_tab_widget.py +54 -0
- preditor/gui/level_buttons.py +349 -0
- {blurdev → preditor}/gui/logger_window_handler.py +46 -45
- {blurdev → preditor}/gui/loggerwindow.py +1205 -1417
- {blurdev → preditor}/gui/newtabwidget.py +69 -68
- {blurdev → preditor}/gui/redmine_login_dialog.py +63 -61
- {blurdev → preditor}/gui/set_text_editor_path_dialog.py +59 -57
- preditor/gui/ui/editor_chooser.ui +93 -0
- {blurdev → preditor}/gui/ui/errordialog.ui +81 -81
- {blurdev → preditor}/gui/ui/loggerwindow.ui +1030 -864
- {blurdev → preditor}/gui/ui/redmine_login_dialog.ui +124 -124
- {blurdev → preditor}/gui/ui/set_text_editor_path_dialog.ui +149 -149
- {blurdev → preditor}/gui/window.py +183 -199
- preditor/gui/workbox_mixin.py +357 -0
- preditor/gui/workbox_text_edit.py +117 -0
- preditor/gui/workboxwidget.py +276 -0
- preditor/logging_config.py +52 -0
- preditor/osystem.py +401 -0
- preditor/plugins.py +65 -0
- preditor/prefs.py +74 -0
- {blurdev → preditor}/resource/environment_variables.html +26 -38
- {blurdev → preditor}/resource/error_mail.html +85 -85
- {blurdev → preditor}/resource/error_mail_inline.html +41 -41
- preditor/resource/img/README.md +7 -0
- preditor/resource/img/arrow_forward.png +0 -0
- preditor/resource/img/check-bold.png +0 -0
- preditor/resource/img/chevron-down.png +0 -0
- preditor/resource/img/chevron-up.png +0 -0
- preditor/resource/img/close-thick.png +0 -0
- preditor/resource/img/comment-edit.png +0 -0
- preditor/resource/img/content-copy.png +0 -0
- preditor/resource/img/content-cut.png +0 -0
- preditor/resource/img/content-duplicate.png +0 -0
- preditor/resource/img/content-paste.png +0 -0
- preditor/resource/img/content-save.png +0 -0
- preditor/resource/img/debug_disabled.png +0 -0
- preditor/resource/img/eye-check.png +0 -0
- preditor/resource/img/file-plus.png +0 -0
- preditor/resource/img/file-remove.png +0 -0
- preditor/resource/img/format-align-left.png +0 -0
- preditor/resource/img/format-letter-case-lower.png +0 -0
- preditor/resource/img/format-letter-case-upper.png +0 -0
- preditor/resource/img/information.png +0 -0
- preditor/resource/img/logging_critical.png +0 -0
- preditor/resource/img/logging_custom.png +0 -0
- preditor/resource/img/logging_debug.png +0 -0
- preditor/resource/img/logging_error.png +0 -0
- preditor/resource/img/logging_info.png +0 -0
- preditor/resource/img/logging_not_set.png +0 -0
- preditor/resource/img/logging_warning.png +0 -0
- preditor/resource/img/marker.png +0 -0
- preditor/resource/img/play.png +0 -0
- preditor/resource/img/playlist-play.png +0 -0
- preditor/resource/img/plus-minus-variant.png +0 -0
- preditor/resource/img/preditor.ico +0 -0
- preditor/resource/img/preditor.png +0 -0
- preditor/resource/img/preditor.psd +0 -0
- preditor/resource/img/preditor.svg +44 -0
- preditor/resource/img/restart.svg +1 -0
- preditor/resource/img/skip-forward-outline.png +0 -0
- preditor/resource/img/skip-next-outline.png +0 -0
- preditor/resource/img/skip-next.png +0 -0
- preditor/resource/img/skip-previous.png +0 -0
- preditor/resource/img/subdirectory-arrow-right.png +0 -0
- preditor/resource/img/text-search-variant.png +0 -0
- {blurdev → preditor}/resource/lang/python.json +30 -30
- preditor/resource/settings.ini +25 -0
- {blurdev/resource/stylesheet/logger → preditor/resource/stylesheet}/Bright.css +56 -61
- {blurdev → preditor}/resource/stylesheet/Dark.css +190 -132
- {blurdev → preditor}/scintilla/__init__.py +22 -28
- preditor/scintilla/delayables/__init__.py +11 -0
- {blurdev → preditor}/scintilla/delayables/smart_highlight.py +94 -93
- {blurdev → preditor}/scintilla/delayables/spell_check.py +173 -172
- {blurdev → preditor}/scintilla/documenteditor.py +2039 -2115
- {blurdev → preditor}/scintilla/finddialog.py +68 -81
- {blurdev → preditor}/scintilla/lang/__init__.py +80 -93
- {blurdev → preditor}/scintilla/lang/config/bash.ini +15 -15
- {blurdev → preditor}/scintilla/lang/config/batch.ini +14 -14
- {blurdev → preditor}/scintilla/lang/config/cpp.ini +19 -19
- {blurdev → preditor}/scintilla/lang/config/css.ini +19 -19
- {blurdev → preditor}/scintilla/lang/config/eyeonscript.ini +17 -17
- {blurdev → preditor}/scintilla/lang/config/html.ini +21 -21
- {blurdev → preditor}/scintilla/lang/config/javascript.ini +24 -24
- {blurdev → preditor}/scintilla/lang/config/lua.ini +16 -16
- {blurdev → preditor}/scintilla/lang/config/maxscript.ini +20 -20
- {blurdev → preditor}/scintilla/lang/config/mel.ini +18 -18
- {blurdev → preditor}/scintilla/lang/config/mu.ini +22 -22
- {blurdev → preditor}/scintilla/lang/config/nsi.ini +5 -5
- {blurdev → preditor}/scintilla/lang/config/perl.ini +19 -19
- {blurdev → preditor}/scintilla/lang/config/puppet.ini +19 -19
- {blurdev → preditor}/scintilla/lang/config/python.ini +28 -28
- {blurdev → preditor}/scintilla/lang/config/ruby.ini +19 -19
- {blurdev → preditor}/scintilla/lang/config/sql.ini +7 -7
- {blurdev → preditor}/scintilla/lang/config/xml.ini +21 -21
- {blurdev → preditor}/scintilla/lang/config/yaml.ini +18 -18
- {blurdev → preditor}/scintilla/lang/language.py +240 -250
- preditor/scintilla/lexers/__init__.py +0 -0
- {blurdev → preditor}/scintilla/lexers/cpplexer.py +21 -30
- {blurdev → preditor}/scintilla/lexers/javascriptlexer.py +25 -34
- {blurdev → preditor}/scintilla/lexers/maxscriptlexer.py +234 -253
- {blurdev → preditor}/scintilla/lexers/mellexer.py +368 -376
- {blurdev → preditor}/scintilla/lexers/mulexer.py +32 -41
- {blurdev → preditor}/scintilla/lexers/pythonlexer.py +41 -50
- {blurdev → preditor}/scintilla/ui/finddialog.ui +160 -160
- preditor/settings.py +71 -0
- preditor/stream/__init__.py +80 -0
- preditor/stream/director.py +56 -0
- preditor/stream/manager.py +74 -0
- preditor/streamhandler_helper.py +46 -0
- preditor/utils/__init__.py +0 -0
- preditor/utils/cute.py +30 -0
- preditor/utils/stylesheets.py +54 -0
- {blurdev → preditor}/version.py +5 -5
- preditor/weakref.py +363 -0
- PrEditor-0.0.0.dev1.dist-info/METADATA +0 -51
- PrEditor-0.0.0.dev1.dist-info/RECORD +0 -279
- PrEditor-0.0.0.dev1.dist-info/top_level.txt +0 -1
- blurdev/__init__.py +0 -356
- blurdev/cores/__init__.py +0 -98
- blurdev/cores/application.py +0 -26
- blurdev/cores/core.py +0 -634
- blurdev/debug.py +0 -593
- blurdev/external.py +0 -391
- blurdev/gui/level_buttons.py +0 -585
- blurdev/gui/workboxwidget.py +0 -205
- blurdev/logger.py +0 -238
- blurdev/osystem.py +0 -813
- blurdev/prefs.py +0 -33
- blurdev/protocols/__init__.py +0 -71
- blurdev/protocols/write_std_output_handler.py +0 -83
- blurdev/resource/designer_plugins.xml +0 -9
- blurdev/resource/error_email_old.html +0 -41
- blurdev/resource/img/add.png +0 -0
- blurdev/resource/img/ajax-loader.gif +0 -0
- blurdev/resource/img/application.png +0 -0
- blurdev/resource/img/applications.png +0 -0
- blurdev/resource/img/assburner.png +0 -0
- blurdev/resource/img/assfreezer.png +0 -0
- blurdev/resource/img/bar.gif +0 -0
- blurdev/resource/img/blank.png +0 -0
- blurdev/resource/img/blurdev.png +0 -0
- blurdev/resource/img/calendar_disabled.png +0 -0
- blurdev/resource/img/calendar_enabled.png +0 -0
- blurdev/resource/img/cancel.png +0 -0
- blurdev/resource/img/custom.png +0 -0
- blurdev/resource/img/debug_high.png +0 -0
- blurdev/resource/img/debug_low.png +0 -0
- blurdev/resource/img/debug_mid.png +0 -0
- blurdev/resource/img/debug_off.png +0 -0
- blurdev/resource/img/django.png +0 -0
- blurdev/resource/img/doc.png +0 -0
- blurdev/resource/img/edit.png +0 -0
- blurdev/resource/img/elemental.png +0 -0
- blurdev/resource/img/explore.png +0 -0
- blurdev/resource/img/favorite.png +0 -0
- blurdev/resource/img/file.png +0 -0
- blurdev/resource/img/folder.png +0 -0
- blurdev/resource/img/ide/add.png +0 -0
- blurdev/resource/img/ide/add_note.png +0 -0
- blurdev/resource/img/ide/arrow_down.png +0 -0
- blurdev/resource/img/ide/arrow_up.png +0 -0
- blurdev/resource/img/ide/check.png +0 -0
- blurdev/resource/img/ide/class.png +0 -0
- blurdev/resource/img/ide/clean.png +0 -0
- blurdev/resource/img/ide/clearlog.png +0 -0
- blurdev/resource/img/ide/close.png +0 -0
- blurdev/resource/img/ide/comment_add.png +0 -0
- blurdev/resource/img/ide/comment_remove.png +0 -0
- blurdev/resource/img/ide/comment_toggle.png +0 -0
- blurdev/resource/img/ide/console.png +0 -0
- blurdev/resource/img/ide/copy.png +0 -0
- blurdev/resource/img/ide/copylstrip.png +0 -0
- blurdev/resource/img/ide/cut.png +0 -0
- blurdev/resource/img/ide/edit.png +0 -0
- blurdev/resource/img/ide/find.png +0 -0
- blurdev/resource/img/ide/find_replace.png +0 -0
- blurdev/resource/img/ide/findnext.png +0 -0
- blurdev/resource/img/ide/findprev.png +0 -0
- blurdev/resource/img/ide/folder_find.png +0 -0
- blurdev/resource/img/ide/function.png +0 -0
- blurdev/resource/img/ide/git-bash.png +0 -0
- blurdev/resource/img/ide/git-gui.png +0 -0
- blurdev/resource/img/ide/gitk.png +0 -0
- blurdev/resource/img/ide/goto.png +0 -0
- blurdev/resource/img/ide/goto_def.png +0 -0
- blurdev/resource/img/ide/help.png +0 -0
- blurdev/resource/img/ide/highlighter.png +0 -0
- blurdev/resource/img/ide/lowercase.png +0 -0
- blurdev/resource/img/ide/newfile.png +0 -0
- blurdev/resource/img/ide/newfolder.png +0 -0
- blurdev/resource/img/ide/newproject.png +0 -0
- blurdev/resource/img/ide/newwizard.png +0 -0
- blurdev/resource/img/ide/open.png +0 -0
- blurdev/resource/img/ide/paste.png +0 -0
- blurdev/resource/img/ide/pdb_continue.png +0 -0
- blurdev/resource/img/ide/pdb_down.png +0 -0
- blurdev/resource/img/ide/pdb_next.png +0 -0
- blurdev/resource/img/ide/pdb_step.png +0 -0
- blurdev/resource/img/ide/pdb_up.png +0 -0
- blurdev/resource/img/ide/plus_minus.png +0 -0
- blurdev/resource/img/ide/preferences.png +0 -0
- blurdev/resource/img/ide/project_find.png +0 -0
- blurdev/resource/img/ide/python.png +0 -0
- blurdev/resource/img/ide/pyular.png +0 -0
- blurdev/resource/img/ide/qt.png +0 -0
- blurdev/resource/img/ide/quit.png +0 -0
- blurdev/resource/img/ide/redo.png +0 -0
- blurdev/resource/img/ide/refresh.png +0 -0
- blurdev/resource/img/ide/remove.png +0 -0
- blurdev/resource/img/ide/ruler.png +0 -0
- blurdev/resource/img/ide/run.png +0 -0
- blurdev/resource/img/ide/runall.png +0 -0
- blurdev/resource/img/ide/runallclear.png +0 -0
- blurdev/resource/img/ide/runselected.png +0 -0
- blurdev/resource/img/ide/runselectedclear.png +0 -0
- blurdev/resource/img/ide/save.png +0 -0
- blurdev/resource/img/ide/saveas.png +0 -0
- blurdev/resource/img/ide/sdk.png +0 -0
- blurdev/resource/img/ide/separator.png +0 -0
- blurdev/resource/img/ide/tabbed.png +0 -0
- blurdev/resource/img/ide/tile.png +0 -0
- blurdev/resource/img/ide/toolbar.png +0 -0
- blurdev/resource/img/ide/undo.png +0 -0
- blurdev/resource/img/ide/uppercase.png +0 -0
- blurdev/resource/img/ide/view_as.png +0 -0
- blurdev/resource/img/ide/windowed.png +0 -0
- blurdev/resource/img/ide.ico +0 -0
- blurdev/resource/img/ide.png +0 -0
- blurdev/resource/img/ide48.png +0 -0
- blurdev/resource/img/info.png +0 -0
- blurdev/resource/img/legacy tool.png +0 -0
- blurdev/resource/img/library.png +0 -0
- blurdev/resource/img/logger/about.png +0 -0
- blurdev/resource/img/logger/arrow_forward.png +0 -0
- blurdev/resource/img/logger/clear.png +0 -0
- blurdev/resource/img/logger/close.png +0 -0
- blurdev/resource/img/logger/debug_disabled.png +0 -0
- blurdev/resource/img/logger/debug_high.png +0 -0
- blurdev/resource/img/logger/debug_low.png +0 -0
- blurdev/resource/img/logger/debug_mid.png +0 -0
- blurdev/resource/img/logger/down.png +0 -0
- blurdev/resource/img/logger/find.png +0 -0
- blurdev/resource/img/logger/logging_critical.png +0 -0
- blurdev/resource/img/logger/logging_debug.png +0 -0
- blurdev/resource/img/logger/logging_error.png +0 -0
- blurdev/resource/img/logger/logging_info.png +0 -0
- blurdev/resource/img/logger/logging_not_set.png +0 -0
- blurdev/resource/img/logger/logging_warning.png +0 -0
- blurdev/resource/img/logger/next.png +0 -0
- blurdev/resource/img/logger/play.png +0 -0
- blurdev/resource/img/logger/playlist_play.png +0 -0
- blurdev/resource/img/logger/previous.png +0 -0
- blurdev/resource/img/logger/return.png +0 -0
- blurdev/resource/img/logger/save.png +0 -0
- blurdev/resource/img/logger/subdirectory_arrow_right.png +0 -0
- blurdev/resource/img/logger/up.png +0 -0
- blurdev/resource/img/lovebar.png +0 -0
- blurdev/resource/img/new.png +0 -0
- blurdev/resource/img/new_selected.png +0 -0
- blurdev/resource/img/node.png +0 -0
- blurdev/resource/img/ok.png +0 -0
- blurdev/resource/img/options.png +0 -0
- blurdev/resource/img/packages.png +0 -0
- blurdev/resource/img/preview/add.png +0 -0
- blurdev/resource/img/preview/brush.png +0 -0
- blurdev/resource/img/preview/delete.png +0 -0
- blurdev/resource/img/preview/delte.png +0 -0
- blurdev/resource/img/preview/fill.png +0 -0
- blurdev/resource/img/preview/layers.png +0 -0
- blurdev/resource/img/preview/media.png +0 -0
- blurdev/resource/img/preview/navigate.png +0 -0
- blurdev/resource/img/preview/pencil.png +0 -0
- blurdev/resource/img/preview/select.png +0 -0
- blurdev/resource/img/preview/type.png +0 -0
- blurdev/resource/img/preview/visible.png +0 -0
- blurdev/resource/img/project.png +0 -0
- blurdev/resource/img/python_logger.ico +0 -0
- blurdev/resource/img/python_logger.png +0 -0
- blurdev/resource/img/refresh.png +0 -0
- blurdev/resource/img/remove.png +0 -0
- blurdev/resource/img/reset.png +0 -0
- blurdev/resource/img/richtext/font_bold.png +0 -0
- blurdev/resource/img/richtext/font_italic.png +0 -0
- blurdev/resource/img/richtext/link_image.png +0 -0
- blurdev/resource/img/richtext/spell_check.png +0 -0
- blurdev/resource/img/richtext/unordered_list.png +0 -0
- blurdev/resource/img/save.png +0 -0
- blurdev/resource/img/savesettings.png +0 -0
- blurdev/resource/img/settings.png +0 -0
- blurdev/resource/img/tool.png +0 -0
- blurdev/resource/img/toolbarHandleHorizontal.png +0 -0
- blurdev/resource/img/toolbarHandleVertical.png +0 -0
- blurdev/resource/img/trash.png +0 -0
- blurdev/resource/img/trax.png +0 -0
- blurdev/resource/img/tree.png +0 -0
- blurdev/resource/img/treegrunt.ico +0 -0
- blurdev/resource/img/treegrunt.png +0 -0
- blurdev/resource/img/treegruntedit.png +0 -0
- blurdev/resource/img/user interface.png +0 -0
- blurdev/resource/img/warning.png +0 -0
- blurdev/resource/img/watermark.png +0 -0
- blurdev/resource/sdk/blurdev.sdk +0 -3
- blurdev/resource/settings.ini +0 -82
- blurdev/resource/softimage/BlurApplication.dll +0 -0
- blurdev/resource/softimage/BlurApplication64.dll +0 -0
- blurdev/resource/stylesheet/Carbon.css +0 -35
- blurdev/resource/stylesheet/logger/Dark.css +0 -62
- blurdev/resource/templ/py_comment.templ +0 -1
- blurdev/resource/templ/py_debug_raise_error.templ +0 -7
- blurdev/resource/templ/py_doc_string.templ +0 -10
- blurdev/resource/templ/py_header.templ +0 -9
- blurdev/resource/templ/py_line_comment.templ +0 -1
- blurdev/resource/templ/py_log_to_file.templ +0 -22
- blurdev/resource/templ/py_module_path.templ +0 -1
- blurdev/resource/templ/py_pyqt_core.templ +0 -1
- blurdev/resource/templ/py_pyqt_gui.templ +0 -1
- blurdev/resource/templ/py_splashscreen.templ +0 -6
- blurdev/resource/templ/py_testing_note.templ +0 -1
- blurdev/resource/templ/py_testing_note_end.templ +0 -1
- blurdev/resource/tools_environments.json +0 -72
- blurdev/resource/tools_environments.xml +0 -11
- blurdev/resource/tools_environments_linux.xml +0 -11
- blurdev/resource/tools_environments_offline.xml +0 -7
- blurdev/runtimes/__init__.py +0 -2
- blurdev/runtimes/logger.py +0 -44
- blurdev/scintilla/delayables/__init__.py +0 -9
- blurdev/settings.py +0 -312
- blurdev/utils/error.py +0 -389
- {blurdev/scintilla/lexers → preditor/cores}/__init__.py +0 -0
- {blurdev/utils → preditor/gui/fuzzy_search}/__init__.py +0 -0
- {blurdev → preditor}/resource/img/warning-big.png +0 -0
blurdev/debug.py
DELETED
|
@@ -1,593 +0,0 @@
|
|
|
1
|
-
"""
|
|
2
|
-
.. warning::
|
|
3
|
-
|
|
4
|
-
The python standard library provides a very powerful and flexible logging
|
|
5
|
-
and debugging module --
|
|
6
|
-
`logging <http://docs.python.org/library/logging.html>`_.
|
|
7
|
-
|
|
8
|
-
Only use this module if you are updating an existing tool or library that
|
|
9
|
-
uses it or is part of a larger blur system that uses it.
|
|
10
|
-
|
|
11
|
-
If you are creating a new tool or library, use the
|
|
12
|
-
`logging <http://docs.python.org/library/logging.html>`_ module in the
|
|
13
|
-
standard library instead.
|
|
14
|
-
|
|
15
|
-
.. deprecated:: 2.0
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
The blurdev debug module defines a handful of functions, as well as a single
|
|
19
|
-
enumerated type, and a single class, to help with the creation and printing
|
|
20
|
-
of logging messages.
|
|
21
|
-
|
|
22
|
-
The blurdev debug module defines a single enumerated type -- :data:`DebugLevel`
|
|
23
|
-
-- that is used to discriminate between the various types of logging messages.
|
|
24
|
-
|
|
25
|
-
.. data:: DebugLevel
|
|
26
|
-
|
|
27
|
-
An :class:`enum` used to set different levels of debugging. Current
|
|
28
|
-
values are Low, Medium, and High
|
|
29
|
-
|
|
30
|
-
"""
|
|
31
|
-
|
|
32
|
-
from __future__ import print_function
|
|
33
|
-
from __future__ import absolute_import
|
|
34
|
-
import datetime
|
|
35
|
-
import os
|
|
36
|
-
import sys
|
|
37
|
-
import traceback
|
|
38
|
-
import inspect
|
|
39
|
-
|
|
40
|
-
from Qt import QtCompat
|
|
41
|
-
|
|
42
|
-
import blurdev
|
|
43
|
-
import blurdev.debug
|
|
44
|
-
from blurdev.contexts import ErrorReport
|
|
45
|
-
|
|
46
|
-
from .enum import enum
|
|
47
|
-
import six
|
|
48
|
-
|
|
49
|
-
_currentLevel = int(os.environ.get('BDEV_DEBUG_LEVEL', '0'))
|
|
50
|
-
_debugLogger = None
|
|
51
|
-
_errorReport = []
|
|
52
|
-
|
|
53
|
-
DebugLevel = enum('Low', 'Mid', 'High')
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
class FileLogger:
|
|
57
|
-
def __init__(self, stdhandle, logfile, _print=True, clearLog=True):
|
|
58
|
-
self._stdhandle = stdhandle
|
|
59
|
-
self._logfile = logfile
|
|
60
|
-
self._print = _print
|
|
61
|
-
if clearLog:
|
|
62
|
-
# clear the log file
|
|
63
|
-
self.clear()
|
|
64
|
-
|
|
65
|
-
def clear(self, stamp=False):
|
|
66
|
-
"""Removes the contents of the log file."""
|
|
67
|
-
open(self._logfile, 'w').close()
|
|
68
|
-
if stamp:
|
|
69
|
-
msg = '--------- Date: {today} Version: {version} ---------'
|
|
70
|
-
print(msg.format(today=datetime.datetime.today(), version=sys.version))
|
|
71
|
-
|
|
72
|
-
def flush(self):
|
|
73
|
-
self._stdhandle.flush()
|
|
74
|
-
|
|
75
|
-
def write(self, msg):
|
|
76
|
-
f = open(self._logfile, 'a')
|
|
77
|
-
f.write(msg)
|
|
78
|
-
f.close()
|
|
79
|
-
if self._print:
|
|
80
|
-
self._stdhandle.write(msg)
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
def logToFile(path, stdout=True, stderr=True, useOldStd=True, clearLog=True):
|
|
84
|
-
"""Redirect all stdout and/or stderr output to a log file.
|
|
85
|
-
|
|
86
|
-
Creates a FileLogger class for stdout and stderr and installs itself in python.
|
|
87
|
-
All output will be logged to the file path. Prints the current datetime and
|
|
88
|
-
sys.version info when stdout is True.
|
|
89
|
-
|
|
90
|
-
Args:
|
|
91
|
-
path (str): File path to log output to.
|
|
92
|
-
|
|
93
|
-
stdout (bool): If True(default) override sys.stdout.
|
|
94
|
-
|
|
95
|
-
stderr (bool): If True(default) override sys.stderr.
|
|
96
|
-
|
|
97
|
-
useOldStd (bool): If True, messages will be written to the FileLogger
|
|
98
|
-
and the previous sys.stdout/sys.stderr.
|
|
99
|
-
|
|
100
|
-
clearLog (bool): If True(default) clear the log file when this command is
|
|
101
|
-
called.
|
|
102
|
-
"""
|
|
103
|
-
if stderr:
|
|
104
|
-
sys.stderr = FileLogger(sys.stderr, path, useOldStd, clearLog=clearLog)
|
|
105
|
-
if stdout:
|
|
106
|
-
sys.stdout = FileLogger(sys.stdout, path, useOldStd, clearLog=False)
|
|
107
|
-
if clearLog:
|
|
108
|
-
sys.stdout.clear(stamp=True)
|
|
109
|
-
|
|
110
|
-
from pillar.streamhandler_helper import StreamHandlerHelper
|
|
111
|
-
|
|
112
|
-
# Update any StreamHandler's that were setup using the old stdout/err
|
|
113
|
-
if stdout:
|
|
114
|
-
StreamHandlerHelper.replace_stream(sys.stdout._stdhandle, sys.stdout)
|
|
115
|
-
if stderr:
|
|
116
|
-
StreamHandlerHelper.replace_stream(sys.stderr._stdhandle, sys.stderr)
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
# --------------------------------------------------------------------------------
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
class BlurExcepthook(object):
|
|
123
|
-
"""
|
|
124
|
-
Blur's excepthook override allowing for granular error handling
|
|
125
|
-
customization.
|
|
126
|
-
|
|
127
|
-
Stacked atop the standard library excepthook (by default), catches any
|
|
128
|
-
unhandled exceptions and conditionally passes them to the following custom
|
|
129
|
-
excepthooks:
|
|
130
|
-
|
|
131
|
-
- *`call_base_excepthook`*
|
|
132
|
-
excepthook callable supplied at initialization; if not supplied or
|
|
133
|
-
invalid, executes standard library excepthook.
|
|
134
|
-
|
|
135
|
-
- *`send_exception_email`*
|
|
136
|
-
email notification.
|
|
137
|
-
|
|
138
|
-
- *`send_logger_error`*
|
|
139
|
-
logger console.
|
|
140
|
-
|
|
141
|
-
Arguments:
|
|
142
|
-
ehook (callable): An excepthook callable compatible with signature of
|
|
143
|
-
sys.excepthook; defaults to original startup excepthook
|
|
144
|
-
"""
|
|
145
|
-
|
|
146
|
-
def __init__(self, base_excepthook=None):
|
|
147
|
-
self.base_excepthook = base_excepthook or sys.__excepthook__
|
|
148
|
-
# We can't show the prompt if running headless.
|
|
149
|
-
self.actions = dict(email=True, prompt=not blurdev.core.headless)
|
|
150
|
-
|
|
151
|
-
def __call__(self, *exc_info):
|
|
152
|
-
"""
|
|
153
|
-
Executes overriden execpthook.
|
|
154
|
-
|
|
155
|
-
Checks the results from the core's `shouldReportException` function as
|
|
156
|
-
to if the current exception should be reported. (Why? Nuke, for
|
|
157
|
-
example, uses exceptions to signal tradionally non-exception worthy
|
|
158
|
-
events, such as when a user cancels an Open File dialog window.)
|
|
159
|
-
"""
|
|
160
|
-
self.actions = blurdev.core.shouldReportException(
|
|
161
|
-
*exc_info, actions=self.actions
|
|
162
|
-
)
|
|
163
|
-
|
|
164
|
-
self.call_base_excepthook(exc_info)
|
|
165
|
-
if debugLevel() == 0:
|
|
166
|
-
self.send_exception_email(exc_info)
|
|
167
|
-
self.send_logger_error(exc_info)
|
|
168
|
-
|
|
169
|
-
ErrorReport.clearReports()
|
|
170
|
-
|
|
171
|
-
def call_base_excepthook(self, exc_info):
|
|
172
|
-
"""
|
|
173
|
-
Process base excepthook supplied during object instantiation.
|
|
174
|
-
|
|
175
|
-
A newline is printed pre-traceback to ensure the first line of output
|
|
176
|
-
is not printed in-line with the prompt. This also provides visual
|
|
177
|
-
separation between tracebacks, when recieved consecutively.
|
|
178
|
-
"""
|
|
179
|
-
print("")
|
|
180
|
-
try:
|
|
181
|
-
self.base_excepthook(*exc_info)
|
|
182
|
-
except (TypeError, NameError):
|
|
183
|
-
sys.__excepthook__(*exc_info)
|
|
184
|
-
|
|
185
|
-
def send_exception_email(self, exc_info):
|
|
186
|
-
"""
|
|
187
|
-
Conditionally sends an exception email.
|
|
188
|
-
"""
|
|
189
|
-
if not self.actions.get("email", False):
|
|
190
|
-
return
|
|
191
|
-
|
|
192
|
-
from blurdev.utils.error import ErrorEmail
|
|
193
|
-
|
|
194
|
-
email_addresses = os.getenv('BDEV_ERROR_EMAIL')
|
|
195
|
-
if email_addresses:
|
|
196
|
-
mailer = ErrorEmail(*exc_info)
|
|
197
|
-
mailer.send(email_addresses)
|
|
198
|
-
|
|
199
|
-
def send_logger_error(self, exc_info):
|
|
200
|
-
"""
|
|
201
|
-
Shows logger prompt.
|
|
202
|
-
"""
|
|
203
|
-
if not self.actions.get("prompt", False):
|
|
204
|
-
return
|
|
205
|
-
|
|
206
|
-
from blurdev.gui.loggerwindow import LoggerWindow
|
|
207
|
-
from blurdev.gui.console import ConsoleEdit
|
|
208
|
-
from blurdev.gui.errordialog import ErrorDialog
|
|
209
|
-
|
|
210
|
-
instance = LoggerWindow.instance(create=False)
|
|
211
|
-
|
|
212
|
-
if instance:
|
|
213
|
-
# logger reference deleted, fallback and print to console
|
|
214
|
-
if not QtCompat.isValid(instance):
|
|
215
|
-
print("[LoggerWindow] LoggerWindow object has been deleted.")
|
|
216
|
-
print(traceback)
|
|
217
|
-
return
|
|
218
|
-
|
|
219
|
-
# logger is visible
|
|
220
|
-
if instance.isVisible():
|
|
221
|
-
if instance.uiAutoPromptACT.isChecked():
|
|
222
|
-
instance.console().startInputLine()
|
|
223
|
-
return
|
|
224
|
-
|
|
225
|
-
# error already prompted
|
|
226
|
-
if ConsoleEdit._errorPrompted:
|
|
227
|
-
return
|
|
228
|
-
|
|
229
|
-
# Preemptively marking error as "prompted" (handled) to avoid errors
|
|
230
|
-
# from being raised multiple times due to C++ and/or threading error
|
|
231
|
-
# processing.
|
|
232
|
-
try:
|
|
233
|
-
ConsoleEdit._errorPrompted = True
|
|
234
|
-
errorDialog = ErrorDialog(blurdev.core.rootWindow())
|
|
235
|
-
errorDialog.setText(exc_info)
|
|
236
|
-
errorDialog.exec_()
|
|
237
|
-
|
|
238
|
-
# interruptted until dialog closed
|
|
239
|
-
finally:
|
|
240
|
-
ConsoleEdit._errorPrompted = False
|
|
241
|
-
|
|
242
|
-
@classmethod
|
|
243
|
-
def install(cls, force=False):
|
|
244
|
-
"""
|
|
245
|
-
Install Blur excepthook override, returing previously implemented
|
|
246
|
-
excepthook function.
|
|
247
|
-
|
|
248
|
-
Arguments:
|
|
249
|
-
force (bool): force reinstallation of excepthook override when
|
|
250
|
-
already previously implemented.
|
|
251
|
-
|
|
252
|
-
Returns:
|
|
253
|
-
func: pre-override excepthook function
|
|
254
|
-
"""
|
|
255
|
-
ErrorReport.enabled = True
|
|
256
|
-
prev_excepthook = sys.excepthook
|
|
257
|
-
|
|
258
|
-
if not isinstance(prev_excepthook, BlurExcepthook) or force:
|
|
259
|
-
sys.excepthook = cls(prev_excepthook)
|
|
260
|
-
|
|
261
|
-
return prev_excepthook
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
# --------------------------------------------------------------------------------
|
|
265
|
-
# A pdb that works inside qt and softwares we run qt inside, like 3ds Max
|
|
266
|
-
_blurPdb = None
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
def getPdb():
|
|
270
|
-
"""Creates or returns a instance of pdb that works when normal pdb doesnt.
|
|
271
|
-
|
|
272
|
-
The first time this is called it creates a pdb instance using PdbInput and PdbOutput
|
|
273
|
-
for stdin and stdout. Any future calls to getPdb will return this same pdb. If pdb
|
|
274
|
-
is activated, it will open the blurdev logger in a new instance of python using
|
|
275
|
-
blurdev.external, all pdb output will be routed to this new logger. Commands typed
|
|
276
|
-
in this logger will be passed back to this instance of pdb.
|
|
277
|
-
|
|
278
|
-
Returns:
|
|
279
|
-
pdb.Pdb: Special instance of pdb.
|
|
280
|
-
"""
|
|
281
|
-
global _blurPdb
|
|
282
|
-
if not _blurPdb:
|
|
283
|
-
from blurdev.utils.pdbio import PdbInput, PdbOutput, BlurPdb
|
|
284
|
-
|
|
285
|
-
# Skip these modules because they are not being debugged. Generally this needs
|
|
286
|
-
# to ignore the Logger Window modules because printing causes the next function
|
|
287
|
-
# to run into these making debugging annoying to say the least.
|
|
288
|
-
skip = os.environ['BDEV_PDB_SKIP'].split(',')
|
|
289
|
-
_blurPdb = BlurPdb(stdin=PdbInput(), stdout=PdbOutput(), skip=skip)
|
|
290
|
-
return _blurPdb
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
def set_trace():
|
|
294
|
-
"""Call getPdb().set_trace().
|
|
295
|
-
|
|
296
|
-
Enter the debugger at the calling stack frame. This is useful to hard-code a
|
|
297
|
-
breakpoint at a given point in a program, even if the code is not otherwise being
|
|
298
|
-
debugged (e.g. when an assertion fails).
|
|
299
|
-
"""
|
|
300
|
-
bPdb = getPdb()
|
|
301
|
-
# Use the autoUp feature to step above the call to bPdb.set_trace so the user is at
|
|
302
|
-
# the line that called this function, not inside this function.
|
|
303
|
-
bPdb.stdin.setAutoUp(True)
|
|
304
|
-
bPdb.set_trace()
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
def post_mortem(t=None):
|
|
308
|
-
"""Call getPdb().post_mortem().
|
|
309
|
-
|
|
310
|
-
Enter post-mortem debugging of the given traceback object. If no traceback is given,
|
|
311
|
-
it uses the exception that is currently being handled (for the default to be used,
|
|
312
|
-
this function must be called from within the except of a try/except statement.)
|
|
313
|
-
|
|
314
|
-
See Also:
|
|
315
|
-
blurdev.debug.pm()
|
|
316
|
-
|
|
317
|
-
Args:
|
|
318
|
-
t (traceback): exception to preform a post_mortem on.
|
|
319
|
-
"""
|
|
320
|
-
# Copied from Python 2.7's pdb because post_mortem doesn't support custom pdb.
|
|
321
|
-
# handling the default
|
|
322
|
-
if t is None:
|
|
323
|
-
# sys.exc_info() returns (type, value, traceback) if an exception is
|
|
324
|
-
# being handled, otherwise it returns None
|
|
325
|
-
t = sys.exc_info()[2]
|
|
326
|
-
if t is None:
|
|
327
|
-
raise ValueError(
|
|
328
|
-
"A valid traceback must be passed if no " "exception is being handled"
|
|
329
|
-
)
|
|
330
|
-
|
|
331
|
-
p = getPdb()
|
|
332
|
-
p.reset()
|
|
333
|
-
p.interaction(None, t)
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
def pm():
|
|
337
|
-
"""Calls blurdev.debug.post_mortem passing in sys.last_traceback."""
|
|
338
|
-
post_mortem(sys.last_traceback)
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
# --------------------------------------------------------------------------------
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
def clearErrorReport():
|
|
345
|
-
"""Clears the current report"""
|
|
346
|
-
global _errorReport
|
|
347
|
-
_errorReport = []
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
def debugMsg(msg, level=2, fmt=None):
|
|
351
|
-
"""Prints out a debug message to the stdout if the inputed level is
|
|
352
|
-
greater than or equal to the current debugging level
|
|
353
|
-
|
|
354
|
-
Args: msg (str): message to output level (blurdev.debug.DebugLevel, optional):
|
|
355
|
-
Minimum DebugLevel msg should be printed. Defaults to DebugLevel.Mid. fmt (str
|
|
356
|
-
or None, optional): msg is formatted with this string. Fills in {level} and
|
|
357
|
-
{msg} args. If None, a default string is used.
|
|
358
|
-
"""
|
|
359
|
-
if level <= debugLevel():
|
|
360
|
-
if fmt is None:
|
|
361
|
-
fmt = 'DEBUG ({level}) : {msg}'
|
|
362
|
-
if callable(msg):
|
|
363
|
-
msg = msg()
|
|
364
|
-
print(fmt.format(level=DebugLevel.keyByValue(level), msg=msg))
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
def debugObject(object, msg, level=2, fmt=None):
|
|
368
|
-
"""Uses :func:`debugMsg` to output to the stdout a debug message
|
|
369
|
-
including the reference of where the object calling the method is located.
|
|
370
|
-
|
|
371
|
-
Args: object (object): the object to include in the output message. msg (str):
|
|
372
|
-
message to output level (blurdev.debug.DebugLevel, optional): Minimum DebugLevel
|
|
373
|
-
msg should be printed. Defaults to DebugLevel.Mid. fmt (str or None, optional):
|
|
374
|
-
msg is formatted with this string. Fills in {level} and {msg} args. If None, a
|
|
375
|
-
default string is used.
|
|
376
|
-
"""
|
|
377
|
-
debugMsg(lambda: debugObjectString(object, msg), level, fmt=fmt)
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
def debugObjectString(object, msg):
|
|
381
|
-
import inspect
|
|
382
|
-
|
|
383
|
-
# debug a module
|
|
384
|
-
if inspect.ismodule(object):
|
|
385
|
-
return '[%s module] :: %s' % (object.__name__, msg)
|
|
386
|
-
|
|
387
|
-
# debug a class
|
|
388
|
-
elif inspect.isclass(object):
|
|
389
|
-
return '[%s.%s class] :: %s' % (object.__module__, object.__name__, msg)
|
|
390
|
-
|
|
391
|
-
# debug an instance method
|
|
392
|
-
elif inspect.ismethod(object):
|
|
393
|
-
return '[%s.%s.%s method] :: %s' % (
|
|
394
|
-
object.im_class.__module__,
|
|
395
|
-
object.im_class.__name__,
|
|
396
|
-
object.__name__,
|
|
397
|
-
msg,
|
|
398
|
-
)
|
|
399
|
-
|
|
400
|
-
# debug a function
|
|
401
|
-
elif inspect.isfunction(object):
|
|
402
|
-
return '[%s.%s function] :: %s' % (object.__module__, object.__name__, msg)
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
def debugStubMethod(object, msg, level=2):
|
|
406
|
-
"""Uses :func:`debugObject` to display that a stub method has not been provided
|
|
407
|
-
functionality.
|
|
408
|
-
|
|
409
|
-
Args:
|
|
410
|
-
object (object): the object to include in the output message
|
|
411
|
-
|
|
412
|
-
msg (str): message to output
|
|
413
|
-
|
|
414
|
-
level (blurdev.debug.DebugLevel, optional): Minimum DebugLevel msg should be
|
|
415
|
-
printed. Defaults to DebugLevel.Mid.
|
|
416
|
-
"""
|
|
417
|
-
debugObject(object, 'Missing Functionality: %s' % msg, level)
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
def debugVirtualMethod(cls, object):
|
|
421
|
-
"""Uses :func:`debugObject` to display that a virtual function has not been overloaded
|
|
422
|
-
|
|
423
|
-
Args:
|
|
424
|
-
cls: the class object where the "virtual" method is defined
|
|
425
|
-
object: the "virtual" method include in the output message
|
|
426
|
-
"""
|
|
427
|
-
debugObject(
|
|
428
|
-
object, 'Virtual method has not been overloaded from %s class' % cls.__name__
|
|
429
|
-
)
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
def debugLevel():
|
|
433
|
-
"""Returns the current debugging level"""
|
|
434
|
-
return _currentLevel
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
def errorsReported():
|
|
438
|
-
"""Returns whether or not the error report is empty
|
|
439
|
-
|
|
440
|
-
Returns:
|
|
441
|
-
bool:
|
|
442
|
-
"""
|
|
443
|
-
return len(_errorReport) > 0
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
def isDebugLevel(level):
|
|
447
|
-
"""Checks to see if the current debug level greater than or equal to the inputed level
|
|
448
|
-
|
|
449
|
-
Args:
|
|
450
|
-
level (blurdev.debug.DebugLevel):
|
|
451
|
-
|
|
452
|
-
Returns
|
|
453
|
-
bool: the current debug level is greater than or equal to level
|
|
454
|
-
"""
|
|
455
|
-
if isinstance(level, six.string_types):
|
|
456
|
-
level = DebugLevel.value(str(level))
|
|
457
|
-
return level <= debugLevel()
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
def printCallingFunction(compact=False):
|
|
461
|
-
"""Prints and returns info about the calling function
|
|
462
|
-
|
|
463
|
-
Args:
|
|
464
|
-
compact (bool): If set to True, prints a more compact printout
|
|
465
|
-
|
|
466
|
-
Returns:
|
|
467
|
-
str: Info on the calling function.
|
|
468
|
-
"""
|
|
469
|
-
import inspect
|
|
470
|
-
|
|
471
|
-
current = inspect.currentframe().f_back
|
|
472
|
-
try:
|
|
473
|
-
parent = current.f_back
|
|
474
|
-
except AttributeError:
|
|
475
|
-
print('No Calling function found')
|
|
476
|
-
return
|
|
477
|
-
currentInfo = inspect.getframeinfo(current)
|
|
478
|
-
parentInfo = inspect.getframeinfo(parent)
|
|
479
|
-
if parentInfo[3] is not None:
|
|
480
|
-
context = ', '.join(parentInfo[3]).strip('\t').rstrip()
|
|
481
|
-
else:
|
|
482
|
-
context = 'No context to return'
|
|
483
|
-
if compact:
|
|
484
|
-
output = '# %s Calling Function: %s Filename: %s Line: %i Context: %s' % (
|
|
485
|
-
currentInfo[2],
|
|
486
|
-
parentInfo[2],
|
|
487
|
-
parentInfo[0],
|
|
488
|
-
parentInfo[1],
|
|
489
|
-
context,
|
|
490
|
-
)
|
|
491
|
-
else:
|
|
492
|
-
output = ["Function: '%s' in file '%s'" % (currentInfo[2], currentInfo[0])]
|
|
493
|
-
output.append(
|
|
494
|
-
" Calling Function: '%s' in file '%s'" % (parentInfo[2], parentInfo[0])
|
|
495
|
-
)
|
|
496
|
-
output.append(" Line: '%i'" % parentInfo[1])
|
|
497
|
-
output.append(" Context: '%s'" % context)
|
|
498
|
-
output = '\n'.join(output)
|
|
499
|
-
print(output)
|
|
500
|
-
return output
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
def mroDump(obj, nice=True, joinString='\n'):
|
|
504
|
-
"""Formats inspect.getmro into text.
|
|
505
|
-
|
|
506
|
-
For the given class object or instance of a class, use inspect to return the Method
|
|
507
|
-
Resolution Order.
|
|
508
|
-
|
|
509
|
-
Args: obj (object): The object to return the mro of. This can be a class object or
|
|
510
|
-
instance.1
|
|
511
|
-
|
|
512
|
-
nice (bool): Returns the same module names as help(object) if True, otherwise
|
|
513
|
-
repr(object).
|
|
514
|
-
|
|
515
|
-
joinString (str, optional): The repr of each class is joined by this string.
|
|
516
|
-
|
|
517
|
-
Returns:
|
|
518
|
-
str: A string showing the Method Resolution Order of the given object.
|
|
519
|
-
"""
|
|
520
|
-
import pydoc
|
|
521
|
-
|
|
522
|
-
# getmro requires a class, turn instances into a class
|
|
523
|
-
if not inspect.isclass(obj):
|
|
524
|
-
obj = type(obj)
|
|
525
|
-
classes = inspect.getmro(obj)
|
|
526
|
-
if nice:
|
|
527
|
-
ret = [pydoc.classname(x, obj.__module__) for x in (classes)]
|
|
528
|
-
else:
|
|
529
|
-
ret = [repr(x) for x in (classes)]
|
|
530
|
-
return joinString.join(ret)
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
def reportError(msg, debugLevel=1):
|
|
534
|
-
"""Adds the inputed message to the debug report
|
|
535
|
-
|
|
536
|
-
Args:
|
|
537
|
-
msg (str): the message to add to the debug report.
|
|
538
|
-
|
|
539
|
-
debugLevel (blurdev.debug.DebugLevel, optional): Only adds msg to the debug
|
|
540
|
-
report if debugLevel is this level or higher. Defaults to DebugLevel.Low.
|
|
541
|
-
"""
|
|
542
|
-
if isDebugLevel(debugLevel):
|
|
543
|
-
_errorReport.append(str(msg))
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
def showErrorReport(
|
|
547
|
-
subject='Errors Occurred',
|
|
548
|
-
message='There were errors that occurred. Click the Details button for more info.',
|
|
549
|
-
):
|
|
550
|
-
if not errorsReported():
|
|
551
|
-
from Qt.QtWidgets import QMessageBox
|
|
552
|
-
|
|
553
|
-
QMessageBox.critical(None, subject, message)
|
|
554
|
-
else:
|
|
555
|
-
from blurdev.gui.dialogs.detailreportdialog import DetailReportDialog
|
|
556
|
-
|
|
557
|
-
DetailReportDialog.showReport(
|
|
558
|
-
None, subject, message, '<br>'.join([str(r) for r in _errorReport])
|
|
559
|
-
)
|
|
560
|
-
return True
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
def setDebugLevel(level):
|
|
564
|
-
"""Sets the debug level for the blurdev system module
|
|
565
|
-
|
|
566
|
-
Args:
|
|
567
|
-
level (blurdev.debug.DebugLevel): Value to set the debug level to.
|
|
568
|
-
|
|
569
|
-
Returns:
|
|
570
|
-
bool: The debug level was changed.
|
|
571
|
-
"""
|
|
572
|
-
global _currentLevel
|
|
573
|
-
|
|
574
|
-
# check for the debug value if a string is passed in
|
|
575
|
-
if isinstance(level, six.string_types):
|
|
576
|
-
try:
|
|
577
|
-
# Check if a int value was passed as a string
|
|
578
|
-
level = int(level)
|
|
579
|
-
except ValueError:
|
|
580
|
-
level = DebugLevel.value(str(level))
|
|
581
|
-
|
|
582
|
-
# clear the debug level
|
|
583
|
-
if not level:
|
|
584
|
-
_currentLevel = 0
|
|
585
|
-
return True
|
|
586
|
-
|
|
587
|
-
# assign the debug flag
|
|
588
|
-
if DebugLevel.isValid(level):
|
|
589
|
-
_currentLevel = level
|
|
590
|
-
return True
|
|
591
|
-
else:
|
|
592
|
-
debugObject(setDebugLevel, '%s is not a valid <DebugLevel> value' % level)
|
|
593
|
-
return False
|