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
|
@@ -1,41 +1,32 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
return self.highlightedKeywords
|
|
34
|
-
|
|
35
|
-
output = super(MuLexer, self).keywords(style)
|
|
36
|
-
# for some reason, CPP lexer uses comment style for
|
|
37
|
-
# its keywords
|
|
38
|
-
if style == self.Comment:
|
|
39
|
-
output += MU_KEYWORDS
|
|
40
|
-
|
|
41
|
-
return output
|
|
1
|
+
from __future__ import absolute_import
|
|
2
|
+
|
|
3
|
+
from PyQt5.Qsci import QsciLexerCPP
|
|
4
|
+
from Qt.QtGui import QColor
|
|
5
|
+
|
|
6
|
+
MU_KEYWORDS = """
|
|
7
|
+
method string Color use require module for_each let global function nil void
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class MuLexer(QsciLexerCPP):
|
|
12
|
+
# Items in this list will be highlighted using the color for self.KeywordSet2
|
|
13
|
+
highlightedKeywords = ''
|
|
14
|
+
|
|
15
|
+
def defaultPaper(self, style):
|
|
16
|
+
if style == self.CommentLine:
|
|
17
|
+
# Set the highlight color for this lexer
|
|
18
|
+
return QColor(155, 255, 155)
|
|
19
|
+
return super(MuLexer, self).defaultPaper(style)
|
|
20
|
+
|
|
21
|
+
def keywords(self, style):
|
|
22
|
+
# Words to be highlighted
|
|
23
|
+
if style == self.CommentLine and self.highlightedKeywords:
|
|
24
|
+
return self.highlightedKeywords
|
|
25
|
+
|
|
26
|
+
output = super(MuLexer, self).keywords(style)
|
|
27
|
+
# for some reason, CPP lexer uses comment style for
|
|
28
|
+
# its keywords
|
|
29
|
+
if style == self.Comment:
|
|
30
|
+
output += MU_KEYWORDS
|
|
31
|
+
|
|
32
|
+
return output
|
|
@@ -1,50 +1,41 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
#
|
|
9
|
-
#
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
super(PythonLexer, self).
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
' issubclass print super bin file iter property tuple bool filter len '
|
|
43
|
-
'range type bytearray float list raw_input unichr'
|
|
44
|
-
' callable format locals reduce unicode chr frozenset long reload vars '
|
|
45
|
-
'classmethod getattr map repr xrange cmp globals max'
|
|
46
|
-
' reversed zip compile hasattr memoryview round complex hash min set '
|
|
47
|
-
'apply delattr help next setattr buffer dict hex object'
|
|
48
|
-
' slice coerce dir id oct sorted intern __import__'
|
|
49
|
-
)
|
|
50
|
-
return ret
|
|
1
|
+
from __future__ import absolute_import
|
|
2
|
+
|
|
3
|
+
from PyQt5.Qsci import QsciLexerPython
|
|
4
|
+
from Qt.QtGui import QColor
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class PythonLexer(QsciLexerPython):
|
|
8
|
+
# Items in this list will be highlighted using the color for
|
|
9
|
+
# self.HighlightedIdentifier
|
|
10
|
+
highlightedKeywords = ''
|
|
11
|
+
|
|
12
|
+
def __init__(self, *args):
|
|
13
|
+
super(PythonLexer, self).__init__(*args)
|
|
14
|
+
|
|
15
|
+
# set the indentation warning
|
|
16
|
+
self.setIndentationWarning(self.Inconsistent)
|
|
17
|
+
|
|
18
|
+
def defaultPaper(self, style):
|
|
19
|
+
if style == self.HighlightedIdentifier:
|
|
20
|
+
# Set the highlight color for this lexer
|
|
21
|
+
return QColor(155, 255, 155)
|
|
22
|
+
return super(PythonLexer, self).defaultPaper(style)
|
|
23
|
+
|
|
24
|
+
def keywords(self, keyset):
|
|
25
|
+
# Words to be highlighted
|
|
26
|
+
if keyset == 2 and self.highlightedKeywords:
|
|
27
|
+
return self.highlightedKeywords
|
|
28
|
+
ret = super(PythonLexer, self).keywords(keyset)
|
|
29
|
+
if keyset == 1:
|
|
30
|
+
ret += (
|
|
31
|
+
' True False abs divmod input open staticmethod all enumerate int ord '
|
|
32
|
+
'str any eval isinstance pow sum basestring execfile'
|
|
33
|
+
' issubclass print super bin file iter property tuple bool filter len '
|
|
34
|
+
'range type bytearray float list raw_input unichr'
|
|
35
|
+
' callable format locals reduce unicode chr frozenset long reload vars '
|
|
36
|
+
'classmethod getattr map repr xrange cmp globals max'
|
|
37
|
+
' reversed zip compile hasattr memoryview round complex hash min set '
|
|
38
|
+
'apply delattr help next setattr buffer dict hex object'
|
|
39
|
+
' slice coerce dir id oct sorted intern __import__'
|
|
40
|
+
)
|
|
41
|
+
return ret
|
|
@@ -1,160 +1,160 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<ui version="4.0">
|
|
3
|
-
<class>dialog</class>
|
|
4
|
-
<widget class="QDialog" name="dialog">
|
|
5
|
-
<property name="geometry">
|
|
6
|
-
<rect>
|
|
7
|
-
<x>0</x>
|
|
8
|
-
<y>0</y>
|
|
9
|
-
<width>436</width>
|
|
10
|
-
<height>170</height>
|
|
11
|
-
</rect>
|
|
12
|
-
</property>
|
|
13
|
-
<property name="windowTitle">
|
|
14
|
-
<string>Find</string>
|
|
15
|
-
</property>
|
|
16
|
-
<layout class="QGridLayout" name="gridLayout">
|
|
17
|
-
<item row="0" column="4">
|
|
18
|
-
<widget class="QPushButton" name="uiFindNextBTN">
|
|
19
|
-
<property name="minimumSize">
|
|
20
|
-
<size>
|
|
21
|
-
<width>118</width>
|
|
22
|
-
<height>0</height>
|
|
23
|
-
</size>
|
|
24
|
-
</property>
|
|
25
|
-
<property name="maximumSize">
|
|
26
|
-
<size>
|
|
27
|
-
<width>118</width>
|
|
28
|
-
<height>16777215</height>
|
|
29
|
-
</size>
|
|
30
|
-
</property>
|
|
31
|
-
<property name="text">
|
|
32
|
-
<string>Find Next</string>
|
|
33
|
-
</property>
|
|
34
|
-
<property name="autoDefault">
|
|
35
|
-
<bool>true</bool>
|
|
36
|
-
</property>
|
|
37
|
-
</widget>
|
|
38
|
-
</item>
|
|
39
|
-
<item row="1" column="4">
|
|
40
|
-
<widget class="QPushButton" name="uiFindPrevBTN">
|
|
41
|
-
<property name="minimumSize">
|
|
42
|
-
<size>
|
|
43
|
-
<width>118</width>
|
|
44
|
-
<height>0</height>
|
|
45
|
-
</size>
|
|
46
|
-
</property>
|
|
47
|
-
<property name="maximumSize">
|
|
48
|
-
<size>
|
|
49
|
-
<width>118</width>
|
|
50
|
-
<height>16777215</height>
|
|
51
|
-
</size>
|
|
52
|
-
</property>
|
|
53
|
-
<property name="text">
|
|
54
|
-
<string>Find Prev</string>
|
|
55
|
-
</property>
|
|
56
|
-
</widget>
|
|
57
|
-
</item>
|
|
58
|
-
<item row="2" column="4">
|
|
59
|
-
<spacer name="verticalSpacer">
|
|
60
|
-
<property name="orientation">
|
|
61
|
-
<enum>Qt::Vertical</enum>
|
|
62
|
-
</property>
|
|
63
|
-
<property name="sizeHint" stdset="0">
|
|
64
|
-
<size>
|
|
65
|
-
<width>115</width>
|
|
66
|
-
<height>62</height>
|
|
67
|
-
</size>
|
|
68
|
-
</property>
|
|
69
|
-
</spacer>
|
|
70
|
-
</item>
|
|
71
|
-
<item row="3" column="0">
|
|
72
|
-
<widget class="QCheckBox" name="uiFindWholeWordsCHK">
|
|
73
|
-
<property name="text">
|
|
74
|
-
<string>Match Whole Word</string>
|
|
75
|
-
</property>
|
|
76
|
-
</widget>
|
|
77
|
-
</item>
|
|
78
|
-
<item row="3" column="1">
|
|
79
|
-
<widget class="QCheckBox" name="uiCaseSensitiveCHK">
|
|
80
|
-
<property name="text">
|
|
81
|
-
<string>Case Sensitive</string>
|
|
82
|
-
</property>
|
|
83
|
-
</widget>
|
|
84
|
-
</item>
|
|
85
|
-
<item row="3" column="3">
|
|
86
|
-
<spacer name="horizontalSpacer">
|
|
87
|
-
<property name="orientation">
|
|
88
|
-
<enum>Qt::Horizontal</enum>
|
|
89
|
-
</property>
|
|
90
|
-
<property name="sizeHint" stdset="0">
|
|
91
|
-
<size>
|
|
92
|
-
<width>32</width>
|
|
93
|
-
<height>20</height>
|
|
94
|
-
</size>
|
|
95
|
-
</property>
|
|
96
|
-
</spacer>
|
|
97
|
-
</item>
|
|
98
|
-
<item row="3" column="4">
|
|
99
|
-
<widget class="QPushButton" name="uiCloseBTN">
|
|
100
|
-
<property name="minimumSize">
|
|
101
|
-
<size>
|
|
102
|
-
<width>118</width>
|
|
103
|
-
<height>0</height>
|
|
104
|
-
</size>
|
|
105
|
-
</property>
|
|
106
|
-
<property name="maximumSize">
|
|
107
|
-
<size>
|
|
108
|
-
<width>118</width>
|
|
109
|
-
<height>16777215</height>
|
|
110
|
-
</size>
|
|
111
|
-
</property>
|
|
112
|
-
<property name="text">
|
|
113
|
-
<string>Close</string>
|
|
114
|
-
</property>
|
|
115
|
-
</widget>
|
|
116
|
-
</item>
|
|
117
|
-
<item row="3" column="2">
|
|
118
|
-
<widget class="QCheckBox" name="uiQRegExpCHK">
|
|
119
|
-
<property name="toolTip">
|
|
120
|
-
<string><html><head/><body><p>Use Qt's QRegExp engine to find using regular expressions instead of a plain text find.</p></body></html></string>
|
|
121
|
-
</property>
|
|
122
|
-
<property name="text">
|
|
123
|
-
<string>QRegExp</string>
|
|
124
|
-
</property>
|
|
125
|
-
</widget>
|
|
126
|
-
</item>
|
|
127
|
-
<item row="0" column="0" rowspan="3" colspan="4">
|
|
128
|
-
<widget class="QPlainTextEdit" name="uiSearchTXT"/>
|
|
129
|
-
</item>
|
|
130
|
-
</layout>
|
|
131
|
-
</widget>
|
|
132
|
-
<tabstops>
|
|
133
|
-
<tabstop>uiSearchTXT</tabstop>
|
|
134
|
-
<tabstop>uiFindNextBTN</tabstop>
|
|
135
|
-
<tabstop>uiFindPrevBTN</tabstop>
|
|
136
|
-
<tabstop>uiFindWholeWordsCHK</tabstop>
|
|
137
|
-
<tabstop>uiCaseSensitiveCHK</tabstop>
|
|
138
|
-
<tabstop>uiQRegExpCHK</tabstop>
|
|
139
|
-
<tabstop>uiCloseBTN</tabstop>
|
|
140
|
-
</tabstops>
|
|
141
|
-
<resources/>
|
|
142
|
-
<connections>
|
|
143
|
-
<connection>
|
|
144
|
-
<sender>uiCloseBTN</sender>
|
|
145
|
-
<signal>clicked()</signal>
|
|
146
|
-
<receiver>dialog</receiver>
|
|
147
|
-
<slot>reject()</slot>
|
|
148
|
-
<hints>
|
|
149
|
-
<hint type="sourcelabel">
|
|
150
|
-
<x>322</x>
|
|
151
|
-
<y>154</y>
|
|
152
|
-
</hint>
|
|
153
|
-
<hint type="destinationlabel">
|
|
154
|
-
<x>284</x>
|
|
155
|
-
<y>172</y>
|
|
156
|
-
</hint>
|
|
157
|
-
</hints>
|
|
158
|
-
</connection>
|
|
159
|
-
</connections>
|
|
160
|
-
</ui>
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<ui version="4.0">
|
|
3
|
+
<class>dialog</class>
|
|
4
|
+
<widget class="QDialog" name="dialog">
|
|
5
|
+
<property name="geometry">
|
|
6
|
+
<rect>
|
|
7
|
+
<x>0</x>
|
|
8
|
+
<y>0</y>
|
|
9
|
+
<width>436</width>
|
|
10
|
+
<height>170</height>
|
|
11
|
+
</rect>
|
|
12
|
+
</property>
|
|
13
|
+
<property name="windowTitle">
|
|
14
|
+
<string>Find</string>
|
|
15
|
+
</property>
|
|
16
|
+
<layout class="QGridLayout" name="gridLayout">
|
|
17
|
+
<item row="0" column="4">
|
|
18
|
+
<widget class="QPushButton" name="uiFindNextBTN">
|
|
19
|
+
<property name="minimumSize">
|
|
20
|
+
<size>
|
|
21
|
+
<width>118</width>
|
|
22
|
+
<height>0</height>
|
|
23
|
+
</size>
|
|
24
|
+
</property>
|
|
25
|
+
<property name="maximumSize">
|
|
26
|
+
<size>
|
|
27
|
+
<width>118</width>
|
|
28
|
+
<height>16777215</height>
|
|
29
|
+
</size>
|
|
30
|
+
</property>
|
|
31
|
+
<property name="text">
|
|
32
|
+
<string>Find Next</string>
|
|
33
|
+
</property>
|
|
34
|
+
<property name="autoDefault">
|
|
35
|
+
<bool>true</bool>
|
|
36
|
+
</property>
|
|
37
|
+
</widget>
|
|
38
|
+
</item>
|
|
39
|
+
<item row="1" column="4">
|
|
40
|
+
<widget class="QPushButton" name="uiFindPrevBTN">
|
|
41
|
+
<property name="minimumSize">
|
|
42
|
+
<size>
|
|
43
|
+
<width>118</width>
|
|
44
|
+
<height>0</height>
|
|
45
|
+
</size>
|
|
46
|
+
</property>
|
|
47
|
+
<property name="maximumSize">
|
|
48
|
+
<size>
|
|
49
|
+
<width>118</width>
|
|
50
|
+
<height>16777215</height>
|
|
51
|
+
</size>
|
|
52
|
+
</property>
|
|
53
|
+
<property name="text">
|
|
54
|
+
<string>Find Prev</string>
|
|
55
|
+
</property>
|
|
56
|
+
</widget>
|
|
57
|
+
</item>
|
|
58
|
+
<item row="2" column="4">
|
|
59
|
+
<spacer name="verticalSpacer">
|
|
60
|
+
<property name="orientation">
|
|
61
|
+
<enum>Qt::Vertical</enum>
|
|
62
|
+
</property>
|
|
63
|
+
<property name="sizeHint" stdset="0">
|
|
64
|
+
<size>
|
|
65
|
+
<width>115</width>
|
|
66
|
+
<height>62</height>
|
|
67
|
+
</size>
|
|
68
|
+
</property>
|
|
69
|
+
</spacer>
|
|
70
|
+
</item>
|
|
71
|
+
<item row="3" column="0">
|
|
72
|
+
<widget class="QCheckBox" name="uiFindWholeWordsCHK">
|
|
73
|
+
<property name="text">
|
|
74
|
+
<string>Match Whole Word</string>
|
|
75
|
+
</property>
|
|
76
|
+
</widget>
|
|
77
|
+
</item>
|
|
78
|
+
<item row="3" column="1">
|
|
79
|
+
<widget class="QCheckBox" name="uiCaseSensitiveCHK">
|
|
80
|
+
<property name="text">
|
|
81
|
+
<string>Case Sensitive</string>
|
|
82
|
+
</property>
|
|
83
|
+
</widget>
|
|
84
|
+
</item>
|
|
85
|
+
<item row="3" column="3">
|
|
86
|
+
<spacer name="horizontalSpacer">
|
|
87
|
+
<property name="orientation">
|
|
88
|
+
<enum>Qt::Horizontal</enum>
|
|
89
|
+
</property>
|
|
90
|
+
<property name="sizeHint" stdset="0">
|
|
91
|
+
<size>
|
|
92
|
+
<width>32</width>
|
|
93
|
+
<height>20</height>
|
|
94
|
+
</size>
|
|
95
|
+
</property>
|
|
96
|
+
</spacer>
|
|
97
|
+
</item>
|
|
98
|
+
<item row="3" column="4">
|
|
99
|
+
<widget class="QPushButton" name="uiCloseBTN">
|
|
100
|
+
<property name="minimumSize">
|
|
101
|
+
<size>
|
|
102
|
+
<width>118</width>
|
|
103
|
+
<height>0</height>
|
|
104
|
+
</size>
|
|
105
|
+
</property>
|
|
106
|
+
<property name="maximumSize">
|
|
107
|
+
<size>
|
|
108
|
+
<width>118</width>
|
|
109
|
+
<height>16777215</height>
|
|
110
|
+
</size>
|
|
111
|
+
</property>
|
|
112
|
+
<property name="text">
|
|
113
|
+
<string>Close</string>
|
|
114
|
+
</property>
|
|
115
|
+
</widget>
|
|
116
|
+
</item>
|
|
117
|
+
<item row="3" column="2">
|
|
118
|
+
<widget class="QCheckBox" name="uiQRegExpCHK">
|
|
119
|
+
<property name="toolTip">
|
|
120
|
+
<string><html><head/><body><p>Use Qt's QRegExp engine to find using regular expressions instead of a plain text find.</p></body></html></string>
|
|
121
|
+
</property>
|
|
122
|
+
<property name="text">
|
|
123
|
+
<string>QRegExp</string>
|
|
124
|
+
</property>
|
|
125
|
+
</widget>
|
|
126
|
+
</item>
|
|
127
|
+
<item row="0" column="0" rowspan="3" colspan="4">
|
|
128
|
+
<widget class="QPlainTextEdit" name="uiSearchTXT"/>
|
|
129
|
+
</item>
|
|
130
|
+
</layout>
|
|
131
|
+
</widget>
|
|
132
|
+
<tabstops>
|
|
133
|
+
<tabstop>uiSearchTXT</tabstop>
|
|
134
|
+
<tabstop>uiFindNextBTN</tabstop>
|
|
135
|
+
<tabstop>uiFindPrevBTN</tabstop>
|
|
136
|
+
<tabstop>uiFindWholeWordsCHK</tabstop>
|
|
137
|
+
<tabstop>uiCaseSensitiveCHK</tabstop>
|
|
138
|
+
<tabstop>uiQRegExpCHK</tabstop>
|
|
139
|
+
<tabstop>uiCloseBTN</tabstop>
|
|
140
|
+
</tabstops>
|
|
141
|
+
<resources/>
|
|
142
|
+
<connections>
|
|
143
|
+
<connection>
|
|
144
|
+
<sender>uiCloseBTN</sender>
|
|
145
|
+
<signal>clicked()</signal>
|
|
146
|
+
<receiver>dialog</receiver>
|
|
147
|
+
<slot>reject()</slot>
|
|
148
|
+
<hints>
|
|
149
|
+
<hint type="sourcelabel">
|
|
150
|
+
<x>322</x>
|
|
151
|
+
<y>154</y>
|
|
152
|
+
</hint>
|
|
153
|
+
<hint type="destinationlabel">
|
|
154
|
+
<x>284</x>
|
|
155
|
+
<y>172</y>
|
|
156
|
+
</hint>
|
|
157
|
+
</hints>
|
|
158
|
+
</connection>
|
|
159
|
+
</connections>
|
|
160
|
+
</ui>
|
preditor/settings.py
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
#!/usr/bin/env python
|
|
2
|
+
from __future__ import absolute_import, print_function
|
|
3
|
+
|
|
4
|
+
import os
|
|
5
|
+
import sys
|
|
6
|
+
|
|
7
|
+
try:
|
|
8
|
+
import configparser
|
|
9
|
+
except Exception:
|
|
10
|
+
import ConfigParser as configparser # noqa: N813
|
|
11
|
+
|
|
12
|
+
# define the default environment variables
|
|
13
|
+
OS_TYPE = ''
|
|
14
|
+
if os.name == 'posix':
|
|
15
|
+
OS_TYPE = 'Linux'
|
|
16
|
+
elif os.name == 'nt':
|
|
17
|
+
OS_TYPE = 'Windows'
|
|
18
|
+
elif os.name == 'osx':
|
|
19
|
+
OS_TYPE = 'MacOS'
|
|
20
|
+
|
|
21
|
+
# The sections to add from settings.ini
|
|
22
|
+
# The order matters. Add from most specific to least specific.
|
|
23
|
+
# Example: Add Windows Offline, then Windows, then Default.
|
|
24
|
+
# Environment variables that exist in os.environ will not be added.
|
|
25
|
+
_SECTIONS_TO_ADD = []
|
|
26
|
+
if os.getenv('BDEV_OFFLINE') == '1':
|
|
27
|
+
_SECTIONS_TO_ADD.append('{} Offline'.format(OS_TYPE))
|
|
28
|
+
_SECTIONS_TO_ADD += [OS_TYPE, 'Default']
|
|
29
|
+
|
|
30
|
+
_currentEnv = ''
|
|
31
|
+
defaults = {}
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def environStr(value):
|
|
35
|
+
if sys.version_info[0] > 2:
|
|
36
|
+
# Python 3 requires a unicode value. aka str(), which these values already are
|
|
37
|
+
return value
|
|
38
|
+
# Python 2 requires str object, not unicode
|
|
39
|
+
return value.encode('utf8')
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def addConfigSection(config_parser, section):
|
|
43
|
+
"""
|
|
44
|
+
Add a config section to os.environ for a section.
|
|
45
|
+
|
|
46
|
+
Does not add options that already exist in os.environ.
|
|
47
|
+
|
|
48
|
+
Args:
|
|
49
|
+
config_parser (configparser.RawConfigParser): The parser to read from.
|
|
50
|
+
Must already be read.
|
|
51
|
+
section (str): The section name to add.
|
|
52
|
+
"""
|
|
53
|
+
|
|
54
|
+
for option in config_parser.options(section):
|
|
55
|
+
if option.upper() not in os.environ:
|
|
56
|
+
value = config_parser.get(section, option)
|
|
57
|
+
if value == 'None':
|
|
58
|
+
value = ''
|
|
59
|
+
# In python2.7 on windows you can't pass unicode values to
|
|
60
|
+
# subprocess.Popen's env argument. This is the reason we are calling str()
|
|
61
|
+
os.environ[environStr(option.upper())] = environStr(value)
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
# load the default environment from the settings INI
|
|
65
|
+
config = configparser.RawConfigParser()
|
|
66
|
+
config.read(os.path.join(os.path.dirname(__file__), 'resource', 'settings.ini'))
|
|
67
|
+
for section in _SECTIONS_TO_ADD:
|
|
68
|
+
addConfigSection(config, section)
|
|
69
|
+
|
|
70
|
+
# store the blurdev path in the environment
|
|
71
|
+
os.environ['BDEV_PATH'] = environStr(os.path.dirname(__file__))
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
""" A system for capturing stream output and later inserting the captured output into a
|
|
2
|
+
gui, and allowing that GUI to directly capture any new output written to the streams.
|
|
3
|
+
|
|
4
|
+
A use case for this is to attach a Manager's as early as possible to ``sys.stdout``
|
|
5
|
+
and ``sys.stderr`` process, before any GUI's are created. Then later you initialize a
|
|
6
|
+
GUI python console that should show all python output that has already been written.
|
|
7
|
+
Any future writes are delivered directly to the gui using a callback mechanism.
|
|
8
|
+
|
|
9
|
+
Example::
|
|
10
|
+
|
|
11
|
+
# Startup script or plugin for DCC runs this as early as possible.
|
|
12
|
+
from preditor.stream import install_to_std
|
|
13
|
+
|
|
14
|
+
manager = install_to_std()
|
|
15
|
+
# Startup script exits and DCC continues to load eventually creating the main gui.
|
|
16
|
+
|
|
17
|
+
# From a menu a user chooses to show a custom console(A gui that replicates a
|
|
18
|
+
# python interactive console inside the DCC).
|
|
19
|
+
console = PythonConsole()
|
|
20
|
+
|
|
21
|
+
# We will want to see all the previous writes made by python, so replay them
|
|
22
|
+
# in the console so it can properly handle stdout and stderr writes.
|
|
23
|
+
for msg, state in manager:
|
|
24
|
+
console.write(msg, state)
|
|
25
|
+
|
|
26
|
+
# Make it so any future writes are automatically added to the console.
|
|
27
|
+
manager.add_callback(console.write)
|
|
28
|
+
|
|
29
|
+
# Optionally, disable storing data in the buffer. buffer.write calls will now
|
|
30
|
+
# directly write to console so there is no reason to duplicate the data to the
|
|
31
|
+
# buffer.
|
|
32
|
+
manager.append_writes = False
|
|
33
|
+
"""
|
|
34
|
+
from __future__ import absolute_import, print_function
|
|
35
|
+
|
|
36
|
+
import sys
|
|
37
|
+
|
|
38
|
+
STDERR = 1
|
|
39
|
+
STDIN = 2
|
|
40
|
+
STDOUT = 3
|
|
41
|
+
|
|
42
|
+
from .director import Director # noqa: E402
|
|
43
|
+
from .manager import Manager # noqa: E402
|
|
44
|
+
|
|
45
|
+
"""Set when :py:attr:``install_to_std`` is called. This stores the installed Manager
|
|
46
|
+
so it can be accessed to install callbacks.
|
|
47
|
+
"""
|
|
48
|
+
active = None
|
|
49
|
+
|
|
50
|
+
__all__ = [
|
|
51
|
+
"active",
|
|
52
|
+
"Director",
|
|
53
|
+
"install_to_std",
|
|
54
|
+
"Manager",
|
|
55
|
+
"STDERR",
|
|
56
|
+
"STDIN",
|
|
57
|
+
"STDOUT",
|
|
58
|
+
]
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
def install_to_std(out=True, err=True):
|
|
62
|
+
"""Replaces ``sys.stdout`` and ``sys.stderr`` with :py:class:`Director`'s
|
|
63
|
+
using the returned :py:class:`Manager`. This manager is stored as the ``active``
|
|
64
|
+
variable and can be accessed later. This can be called more than once, and it will
|
|
65
|
+
simply return the already installed Manager.
|
|
66
|
+
|
|
67
|
+
Args:
|
|
68
|
+
out (bool, optional): Enables replacement of ``sys.stdout`` on first call.
|
|
69
|
+
err (bool, optional): Enables replacement of ``sys.stderr`` on first call.
|
|
70
|
+
"""
|
|
71
|
+
global active
|
|
72
|
+
|
|
73
|
+
if active is None:
|
|
74
|
+
active = Manager()
|
|
75
|
+
if out:
|
|
76
|
+
sys.stdout = Director(active, STDOUT)
|
|
77
|
+
if err:
|
|
78
|
+
sys.stderr = Director(active, STDERR)
|
|
79
|
+
|
|
80
|
+
return active
|