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 → preditor}/contexts.py
RENAMED
|
@@ -1,119 +1,119 @@
|
|
|
1
|
-
from __future__ import print_function
|
|
2
|
-
|
|
3
|
-
import logging
|
|
4
|
-
|
|
5
|
-
_LOGGER = logging.getLogger(__name__)
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
class ErrorReport(object):
|
|
9
|
-
"""Allows you to provide additional debug info if a error happens in this context.
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
Sometimes just a traceback does not provide enough information to debug the
|
|
13
|
-
traceback. This class allows you to provide additional information to the error
|
|
14
|
-
report only if it is generated. For example if your treegrunt environment does not
|
|
15
|
-
have a email setup, or the current debug level is not set to Disabled.
|
|
16
|
-
|
|
17
|
-
ErrorReport can be used as a with context, or as a function decorator.
|
|
18
|
-
|
|
19
|
-
Examples:
|
|
20
|
-
This example shows a class using both the with context and a decorated method.
|
|
21
|
-
|
|
22
|
-
from
|
|
23
|
-
class Test(object):
|
|
24
|
-
def __init__(self):
|
|
25
|
-
self.value = None
|
|
26
|
-
def errorInfo(self):
|
|
27
|
-
# The text returned by this function will be included in the error email
|
|
28
|
-
return 'Info about the Test class: {}'.format(self.value)
|
|
29
|
-
def doStuff(self):
|
|
30
|
-
with ErrorReport(self.errorInfo, 'Test.doStuff'):
|
|
31
|
-
self.value = 'doStuff'
|
|
32
|
-
raise RuntimeError("BILL")
|
|
33
|
-
@ErrorReport(errorInfo, 'Test.doMoreStuff')
|
|
34
|
-
def doMoreStuff(self):
|
|
35
|
-
self.value = 'doMoreStuff'
|
|
36
|
-
raise RuntimeError("BOB")
|
|
37
|
-
|
|
38
|
-
Using this class does not initialize the Python Logger, so you don't need to worry
|
|
39
|
-
if your class is running headless and not use this class. However unless you set up
|
|
40
|
-
your own error reporting system the callbacks will not be called and nothing will be
|
|
41
|
-
reported.
|
|
42
|
-
|
|
43
|
-
If you want to set up your own error reporting system you need to set
|
|
44
|
-
`ErrorReport.enabled = True`. Then you will need to call ErrorReport.clearReports()
|
|
45
|
-
any time excepthook is called. This prevents a buildup of all error reports any time
|
|
46
|
-
a exception occurs. It should always be in place when you set enabled == True to
|
|
47
|
-
prevent wasting memory. Calling ErrorReport.generateReport() will return the info
|
|
48
|
-
you should include in your report. Calling generateReport is optional, but must be
|
|
49
|
-
called before calling clearReports.
|
|
50
|
-
|
|
51
|
-
Args:
|
|
52
|
-
callback (function): If a exception happens this function is called and its
|
|
53
|
-
returned value is added to the error email if sent. No arguments are passed
|
|
54
|
-
to this function and it is expected to only return a string.
|
|
55
|
-
title (str, optional): This short string is added to the title of the
|
|
56
|
-
ErrorReport.
|
|
57
|
-
Attributes:
|
|
58
|
-
enabled (bool): If False(the default), then all callbacks are cleared even if
|
|
59
|
-
there is a exception. This is used to prevent these functions from leaking
|
|
60
|
-
memory if there isn't a excepthook calling clearReports.
|
|
61
|
-
"""
|
|
62
|
-
|
|
63
|
-
__reports__ = []
|
|
64
|
-
enabled = False
|
|
65
|
-
|
|
66
|
-
def __init__(self, callback, title=''):
|
|
67
|
-
self._callback = callback
|
|
68
|
-
self._title = title
|
|
69
|
-
|
|
70
|
-
def __call__(self, funct):
|
|
71
|
-
def wrapper(wrappedSelf, *args, **kwargs):
|
|
72
|
-
unbound = self._callback
|
|
73
|
-
self._callback = self._callback.__get__(wrappedSelf)
|
|
74
|
-
try:
|
|
75
|
-
with self:
|
|
76
|
-
return funct(wrappedSelf, *args, **kwargs)
|
|
77
|
-
finally:
|
|
78
|
-
self._callback = unbound
|
|
79
|
-
|
|
80
|
-
return wrapper
|
|
81
|
-
|
|
82
|
-
def __enter__(self):
|
|
83
|
-
type(self).__reports__.append((self._title, self._callback))
|
|
84
|
-
|
|
85
|
-
def __exit__(self, exc_type, exc_val, exc_tb):
|
|
86
|
-
# If exc_type is None, then no exception was raised, so we should remove the
|
|
87
|
-
# callback. If cls.enabled is False, then nothing has set itself up to call
|
|
88
|
-
# clearReports. We need to remove the callback so it doesn't stay in memory.
|
|
89
|
-
if exc_type is None or not type(self).enabled:
|
|
90
|
-
type(self).__reports__.remove((self._title, self._callback))
|
|
91
|
-
|
|
92
|
-
@classmethod
|
|
93
|
-
def clearReports(cls):
|
|
94
|
-
"""Removes all of the currently stored callbacks.
|
|
95
|
-
|
|
96
|
-
This should be called after all error reporting is finished, or if a error
|
|
97
|
-
happened and there is nothing to report it. If you set cls.enabled to True,
|
|
98
|
-
something in excepthook should call this to prevent keeping refrences to
|
|
99
|
-
functions from staying in memory.
|
|
100
|
-
"""
|
|
101
|
-
cls.__reports__ = []
|
|
102
|
-
|
|
103
|
-
@classmethod
|
|
104
|
-
def generateReport(cls, fmt='{result}'):
|
|
105
|
-
"""Executes and returns all of the currently stored callbacks.
|
|
106
|
-
Args:
|
|
107
|
-
|
|
108
|
-
ftm (str, Optional): The results of the callbacks will be inserted into this
|
|
109
|
-
string using str.format into {results}.
|
|
110
|
-
Returns:
|
|
111
|
-
list: A list of tuples for all active ErrorReport classes. The tuples
|
|
112
|
-
contain two strings; the title string, and result of the passed in
|
|
113
|
-
callback function.
|
|
114
|
-
"""
|
|
115
|
-
ret = []
|
|
116
|
-
for title, callback in cls.__reports__:
|
|
117
|
-
result = callback()
|
|
118
|
-
ret.append((title, fmt.format(result=result)))
|
|
119
|
-
return ret
|
|
1
|
+
from __future__ import absolute_import, print_function
|
|
2
|
+
|
|
3
|
+
import logging
|
|
4
|
+
|
|
5
|
+
_LOGGER = logging.getLogger(__name__)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class ErrorReport(object):
|
|
9
|
+
"""Allows you to provide additional debug info if a error happens in this context.
|
|
10
|
+
|
|
11
|
+
PrEditor can send a error email when any python error is raised.
|
|
12
|
+
Sometimes just a traceback does not provide enough information to debug the
|
|
13
|
+
traceback. This class allows you to provide additional information to the error
|
|
14
|
+
report only if it is generated. For example if your treegrunt environment does not
|
|
15
|
+
have a email setup, or the current debug level is not set to Disabled.
|
|
16
|
+
|
|
17
|
+
ErrorReport can be used as a with context, or as a function decorator.
|
|
18
|
+
|
|
19
|
+
Examples:
|
|
20
|
+
This example shows a class using both the with context and a decorated method.
|
|
21
|
+
|
|
22
|
+
from preditor.contexts import ErrorReport
|
|
23
|
+
class Test(object):
|
|
24
|
+
def __init__(self):
|
|
25
|
+
self.value = None
|
|
26
|
+
def errorInfo(self):
|
|
27
|
+
# The text returned by this function will be included in the error email
|
|
28
|
+
return 'Info about the Test class: {}'.format(self.value)
|
|
29
|
+
def doStuff(self):
|
|
30
|
+
with ErrorReport(self.errorInfo, 'Test.doStuff'):
|
|
31
|
+
self.value = 'doStuff'
|
|
32
|
+
raise RuntimeError("BILL")
|
|
33
|
+
@ErrorReport(errorInfo, 'Test.doMoreStuff')
|
|
34
|
+
def doMoreStuff(self):
|
|
35
|
+
self.value = 'doMoreStuff'
|
|
36
|
+
raise RuntimeError("BOB")
|
|
37
|
+
|
|
38
|
+
Using this class does not initialize the Python Logger, so you don't need to worry
|
|
39
|
+
if your class is running headless and not use this class. However unless you set up
|
|
40
|
+
your own error reporting system the callbacks will not be called and nothing will be
|
|
41
|
+
reported.
|
|
42
|
+
|
|
43
|
+
If you want to set up your own error reporting system you need to set
|
|
44
|
+
`ErrorReport.enabled = True`. Then you will need to call ErrorReport.clearReports()
|
|
45
|
+
any time excepthook is called. This prevents a buildup of all error reports any time
|
|
46
|
+
a exception occurs. It should always be in place when you set enabled == True to
|
|
47
|
+
prevent wasting memory. Calling ErrorReport.generateReport() will return the info
|
|
48
|
+
you should include in your report. Calling generateReport is optional, but must be
|
|
49
|
+
called before calling clearReports.
|
|
50
|
+
|
|
51
|
+
Args:
|
|
52
|
+
callback (function): If a exception happens this function is called and its
|
|
53
|
+
returned value is added to the error email if sent. No arguments are passed
|
|
54
|
+
to this function and it is expected to only return a string.
|
|
55
|
+
title (str, optional): This short string is added to the title of the
|
|
56
|
+
ErrorReport.
|
|
57
|
+
Attributes:
|
|
58
|
+
enabled (bool): If False(the default), then all callbacks are cleared even if
|
|
59
|
+
there is a exception. This is used to prevent these functions from leaking
|
|
60
|
+
memory if there isn't a excepthook calling clearReports.
|
|
61
|
+
"""
|
|
62
|
+
|
|
63
|
+
__reports__ = []
|
|
64
|
+
enabled = False
|
|
65
|
+
|
|
66
|
+
def __init__(self, callback, title=''):
|
|
67
|
+
self._callback = callback
|
|
68
|
+
self._title = title
|
|
69
|
+
|
|
70
|
+
def __call__(self, funct):
|
|
71
|
+
def wrapper(wrappedSelf, *args, **kwargs):
|
|
72
|
+
unbound = self._callback
|
|
73
|
+
self._callback = self._callback.__get__(wrappedSelf)
|
|
74
|
+
try:
|
|
75
|
+
with self:
|
|
76
|
+
return funct(wrappedSelf, *args, **kwargs)
|
|
77
|
+
finally:
|
|
78
|
+
self._callback = unbound
|
|
79
|
+
|
|
80
|
+
return wrapper
|
|
81
|
+
|
|
82
|
+
def __enter__(self):
|
|
83
|
+
type(self).__reports__.append((self._title, self._callback))
|
|
84
|
+
|
|
85
|
+
def __exit__(self, exc_type, exc_val, exc_tb):
|
|
86
|
+
# If exc_type is None, then no exception was raised, so we should remove the
|
|
87
|
+
# callback. If cls.enabled is False, then nothing has set itself up to call
|
|
88
|
+
# clearReports. We need to remove the callback so it doesn't stay in memory.
|
|
89
|
+
if exc_type is None or not type(self).enabled:
|
|
90
|
+
type(self).__reports__.remove((self._title, self._callback))
|
|
91
|
+
|
|
92
|
+
@classmethod
|
|
93
|
+
def clearReports(cls):
|
|
94
|
+
"""Removes all of the currently stored callbacks.
|
|
95
|
+
|
|
96
|
+
This should be called after all error reporting is finished, or if a error
|
|
97
|
+
happened and there is nothing to report it. If you set cls.enabled to True,
|
|
98
|
+
something in excepthook should call this to prevent keeping refrences to
|
|
99
|
+
functions from staying in memory.
|
|
100
|
+
"""
|
|
101
|
+
cls.__reports__ = []
|
|
102
|
+
|
|
103
|
+
@classmethod
|
|
104
|
+
def generateReport(cls, fmt='{result}'):
|
|
105
|
+
"""Executes and returns all of the currently stored callbacks.
|
|
106
|
+
Args:
|
|
107
|
+
|
|
108
|
+
ftm (str, Optional): The results of the callbacks will be inserted into this
|
|
109
|
+
string using str.format into {results}.
|
|
110
|
+
Returns:
|
|
111
|
+
list: A list of tuples for all active ErrorReport classes. The tuples
|
|
112
|
+
contain two strings; the title string, and result of the passed in
|
|
113
|
+
callback function.
|
|
114
|
+
"""
|
|
115
|
+
ret = []
|
|
116
|
+
for title, callback in cls.__reports__:
|
|
117
|
+
result = callback()
|
|
118
|
+
ret.append((title, fmt.format(result=result)))
|
|
119
|
+
return ret
|
preditor/cores/core.py
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
from __future__ import absolute_import, print_function
|
|
2
|
+
|
|
3
|
+
from Qt.QtCore import QObject, Signal
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class Core(QObject):
|
|
7
|
+
"""
|
|
8
|
+
The Core class provides all the main shared functionality and signals that need to
|
|
9
|
+
be distributed between different pacakges.
|
|
10
|
+
"""
|
|
11
|
+
|
|
12
|
+
# ----------------------------------------------------------------
|
|
13
|
+
# blurdev signals
|
|
14
|
+
aboutToClearPaths = Signal() # Emitted before environment is changed or reloaded
|
|
15
|
+
|
|
16
|
+
# ----------------------------------------------------------------
|
|
17
|
+
|
|
18
|
+
def __init__(self, objectName=None):
|
|
19
|
+
QObject.__init__(self)
|
|
20
|
+
if objectName is None:
|
|
21
|
+
objectName = 'blurdev'
|
|
22
|
+
QObject.setObjectName(self, objectName)
|
|
23
|
+
|
|
24
|
+
# create custom properties
|
|
25
|
+
self._headless = False
|
|
26
|
+
|
|
27
|
+
# Paths in this variable will be removed in
|
|
28
|
+
# preditor.osystem.subprocessEnvironment
|
|
29
|
+
self._removeFromPATHEnv = set()
|
|
30
|
+
|
|
31
|
+
def shouldReportException(self, exc_type, exc_value, exc_traceback, actions=None):
|
|
32
|
+
"""
|
|
33
|
+
Allow core to control how exceptions are handled. Currently being used
|
|
34
|
+
by `BlurExcepthook`, informing which excepthooks should or should not
|
|
35
|
+
be executed.
|
|
36
|
+
|
|
37
|
+
Args:
|
|
38
|
+
exc_type (type): exception type class object
|
|
39
|
+
exc_value (Exception): class instance of exception parameter
|
|
40
|
+
exc_traceback (traceback): encapsulation of call stack for exception
|
|
41
|
+
actions (dict, optional): default values for the returned dict. A copy
|
|
42
|
+
of this dict is returned with standard defaults applied.
|
|
43
|
+
|
|
44
|
+
Returns:
|
|
45
|
+
dict: Boolean values representing whether to perform excepthook
|
|
46
|
+
action, keyed to the name of the excepthook
|
|
47
|
+
"""
|
|
48
|
+
if actions is None:
|
|
49
|
+
actions = {}
|
|
50
|
+
# Create a shallow copy so we don't modify the passed in dict and don't
|
|
51
|
+
# need to use a default value of None
|
|
52
|
+
actions = actions.copy()
|
|
53
|
+
|
|
54
|
+
# provide the expected default values
|
|
55
|
+
actions.setdefault('email', True)
|
|
56
|
+
# If blurdev is running headless, there is no way to show a gui prompt
|
|
57
|
+
actions.setdefault('prompt', not self.headless)
|
|
58
|
+
return actions
|
|
59
|
+
|
|
60
|
+
@property
|
|
61
|
+
def headless(self):
|
|
62
|
+
"""If true, no Qt gui elements should be used because python is running a
|
|
63
|
+
QCoreApplication.
|
|
64
|
+
"""
|
|
65
|
+
return self._headless
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
from __future__ import absolute_import
|
|
2
|
+
|
|
3
|
+
import maya.mel
|
|
4
|
+
from maya import OpenMayaUI, cmds
|
|
5
|
+
|
|
6
|
+
preditor_menu = None
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def headless():
|
|
10
|
+
"""If true, no Qt gui elements should be used because python is running a
|
|
11
|
+
QCoreApplication."""
|
|
12
|
+
return bool(cmds.about(batch=True))
|
|
13
|
+
|
|
14
|
+
# TODO: This is the old method for detecting batch mode. Remove this once
|
|
15
|
+
# the above about command is vetted as working.
|
|
16
|
+
# basename = os.path.splitext(os.path.basename(sys.executable).lower())[0]
|
|
17
|
+
# return basename in ('mayabatch', 'mayapy')
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def root_window():
|
|
21
|
+
"""Returns the main window of Maya as a Qt object to be used for parenting."""
|
|
22
|
+
from Qt import QtCompat
|
|
23
|
+
|
|
24
|
+
ptr = OpenMayaUI.MQtUtil.mainWindow()
|
|
25
|
+
if ptr is not None:
|
|
26
|
+
pointer = int(ptr)
|
|
27
|
+
return QtCompat.wrapInstance(pointer)
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
def launch(ignored):
|
|
31
|
+
"""Show the PrEditor GUI and bring it into focus if it was minimized."""
|
|
32
|
+
import preditor
|
|
33
|
+
|
|
34
|
+
widget = preditor.launch()
|
|
35
|
+
return widget
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
def initializePlugin(mobject): # noqa: N802
|
|
39
|
+
"""Initialize the script plug-in"""
|
|
40
|
+
global preditor_menu
|
|
41
|
+
|
|
42
|
+
# If running headless, there is no need to build a gui and create the python logger
|
|
43
|
+
if not headless():
|
|
44
|
+
from Qt.QtWidgets import QApplication
|
|
45
|
+
|
|
46
|
+
import preditor
|
|
47
|
+
|
|
48
|
+
maya_ver = cmds.about(version=True).split(" ")[0]
|
|
49
|
+
|
|
50
|
+
# Capture all stderr/out after the plugin is loaded. This makes it so
|
|
51
|
+
# if the PrEditor GUI is shown, it will include all of the output. Also
|
|
52
|
+
# tells PrEditor how to parent itself to the main window and save prefs.
|
|
53
|
+
preditor.configure(
|
|
54
|
+
# Set the core_name so preferences are saved per-maya version.
|
|
55
|
+
"Maya-{}".format(maya_ver),
|
|
56
|
+
# Tell PrEditor how to find the maya root window for parenting
|
|
57
|
+
parent_callback=root_window,
|
|
58
|
+
)
|
|
59
|
+
|
|
60
|
+
# Detect Maya shutting down and ensure PrEditor's prefs are saved
|
|
61
|
+
if QApplication.instance():
|
|
62
|
+
QApplication.instance().aboutToQuit.connect(preditor.shutdown)
|
|
63
|
+
|
|
64
|
+
# Add a new PrEditor menu with an item that launches PrEditor
|
|
65
|
+
gmainwindow = maya.mel.eval("$temp1=$gMainWindow")
|
|
66
|
+
preditor_menu = cmds.menu(label="PrEditor", parent=gmainwindow, tearOff=True)
|
|
67
|
+
cmds.menuItem(
|
|
68
|
+
label="Show",
|
|
69
|
+
command=launch,
|
|
70
|
+
sourceType="python",
|
|
71
|
+
image=preditor.resourcePath('img/preditor.png'),
|
|
72
|
+
parent=preditor_menu,
|
|
73
|
+
)
|
|
74
|
+
|
|
75
|
+
# TODO: Alternatively figure out how to add the launcher menuItem to a
|
|
76
|
+
# pre-existing maya menu like next to the "Script Editor" in
|
|
77
|
+
# "Windows -> General Editors"
|
|
78
|
+
# https://github.com/chadmv/cvwrap/blob/master/scripts/cvwrap/menu.py#L18
|
|
79
|
+
|
|
80
|
+
# menu = 'mainWindowMenu'
|
|
81
|
+
# # Make sure the menu widgets exist first.
|
|
82
|
+
# maya.mel.eval('ChaDeformationsMenu MayaWindow|{0};'.format(menu))
|
|
83
|
+
# items = cmds.menu(menu, q=True, ia=True)
|
|
84
|
+
# # print(items)
|
|
85
|
+
# for item in items:
|
|
86
|
+
# menu_label = cmds.menuItem(item, q=True, label=True)
|
|
87
|
+
# # print(menu_label)
|
|
88
|
+
# if menu_label == "General Editors":
|
|
89
|
+
# # cmds.menuItem(parent=item, divider=True, dividerLabel='PrEditor' )
|
|
90
|
+
# cmds.menuItem(
|
|
91
|
+
# label="PrEditor",
|
|
92
|
+
# command=launch,
|
|
93
|
+
# sourceType='python',
|
|
94
|
+
# image=preditor.resourcePath('img/preditor.png'),
|
|
95
|
+
# parent=item,
|
|
96
|
+
# )
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
def uninitializePlugin(mobject): # noqa: N802
|
|
100
|
+
"""Uninitialize the script plug-in"""
|
|
101
|
+
import preditor
|
|
102
|
+
|
|
103
|
+
# Remove the PrEditor Menu if it exists
|
|
104
|
+
if preditor_menu and cmds.menu(preditor_menu, exists=True):
|
|
105
|
+
cmds.deleteUI(preditor_menu, menu=True)
|
|
106
|
+
|
|
107
|
+
# Close PrEditor making sure to save prefs
|
|
108
|
+
preditor.core.shutdown()
|