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/gui/level_buttons.py
DELETED
|
@@ -1,585 +0,0 @@
|
|
|
1
|
-
# standard library imports
|
|
2
|
-
from __future__ import absolute_import
|
|
3
|
-
from functools import partial
|
|
4
|
-
import logging
|
|
5
|
-
|
|
6
|
-
# third-party imports
|
|
7
|
-
from Qt.QtCore import QSignalMapper
|
|
8
|
-
from Qt.QtGui import QIcon
|
|
9
|
-
from Qt.QtWidgets import QAction, QMenu, QToolButton
|
|
10
|
-
|
|
11
|
-
# blur imports
|
|
12
|
-
import blurdev
|
|
13
|
-
from blurdev.enum import Enum, EnumGroup
|
|
14
|
-
from blurdev.logger import LoggerWithSignals
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
class Level(Enum):
|
|
18
|
-
|
|
19
|
-
"""
|
|
20
|
-
Custom `Enum` representing an information level.
|
|
21
|
-
|
|
22
|
-
Attributes:
|
|
23
|
-
cached_icon(None): Used to cache the created icon from `get_icon` for
|
|
24
|
-
future use.
|
|
25
|
-
icon_name(str): Name of source icon file to use when creating icon via
|
|
26
|
-
`get_icon`.
|
|
27
|
-
"""
|
|
28
|
-
|
|
29
|
-
cached_icon = None
|
|
30
|
-
icon_name = "dot"
|
|
31
|
-
|
|
32
|
-
@property
|
|
33
|
-
def name(self):
|
|
34
|
-
"""
|
|
35
|
-
Override of `name` property allowing for the return of a "friendly
|
|
36
|
-
name" to be used in place of the inferred name from the `Enum` instance
|
|
37
|
-
name.
|
|
38
|
-
|
|
39
|
-
Returns:
|
|
40
|
-
str: Name of `Enum` instance.
|
|
41
|
-
"""
|
|
42
|
-
return getattr(self, "friendly_name", super(Level, self).name)
|
|
43
|
-
|
|
44
|
-
@property
|
|
45
|
-
def icon(self):
|
|
46
|
-
"""
|
|
47
|
-
Icon representing the level. On first access, the icon is created via
|
|
48
|
-
the `get_icon`-method and cached for later use.
|
|
49
|
-
|
|
50
|
-
Returns:
|
|
51
|
-
QIcon:
|
|
52
|
-
"""
|
|
53
|
-
if not self.cached_icon:
|
|
54
|
-
self.cached_icon = self.get_icon(self.icon_name, self.level)
|
|
55
|
-
return self.cached_icon
|
|
56
|
-
|
|
57
|
-
def get_icon(self, name, level):
|
|
58
|
-
"""
|
|
59
|
-
Retrieves the icon of `name` and level.
|
|
60
|
-
|
|
61
|
-
Args:
|
|
62
|
-
name (str): Icon to retrieve QIcon for.
|
|
63
|
-
level (str): Level name to apply.
|
|
64
|
-
|
|
65
|
-
Returns:
|
|
66
|
-
QIcon: Correct instantiated QIcon.
|
|
67
|
-
"""
|
|
68
|
-
return QIcon(
|
|
69
|
-
blurdev.resourcePath(
|
|
70
|
-
'img/logger/{name}_{level}.png'.format(name=name, level=level)
|
|
71
|
-
)
|
|
72
|
-
)
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
class LoggerLevel(Level):
|
|
76
|
-
"""A Logger level `Enum` using the 'format_align_left' icon."""
|
|
77
|
-
|
|
78
|
-
icon_name = "logging"
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
class DebugLevel(Level):
|
|
82
|
-
"""A Debug level `Enum` using the 'bug_report' icon."""
|
|
83
|
-
|
|
84
|
-
icon_name = "debug"
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
class LoggerLevels(EnumGroup):
|
|
88
|
-
"""
|
|
89
|
-
Logger levels with their implementation level name and number & custom
|
|
90
|
-
icon level.
|
|
91
|
-
"""
|
|
92
|
-
|
|
93
|
-
Disabled = LoggerLevel(
|
|
94
|
-
friendly_name="Not Set / Inherited", label="NOTSET", number=0, level="not_set"
|
|
95
|
-
)
|
|
96
|
-
Critical = LoggerLevel(label="CRITICAL", number=50, level="critical")
|
|
97
|
-
Error = LoggerLevel(label="ERROR", number=40, level="error")
|
|
98
|
-
Warning = LoggerLevel(label="WARNING", number=30, level="warning")
|
|
99
|
-
Info = LoggerLevel(label="INFO", number=20, level="info")
|
|
100
|
-
Debug = LoggerLevel(label="DEBUG", number=10, level="debug")
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
class DebugLevels(EnumGroup):
|
|
104
|
-
"""
|
|
105
|
-
Debug levels with their implementation level name and number & custom
|
|
106
|
-
icon level.
|
|
107
|
-
"""
|
|
108
|
-
|
|
109
|
-
Disabled = DebugLevel(label="", number=0, level="disabled")
|
|
110
|
-
Low = DebugLevel(label="Low", number=1, level="low")
|
|
111
|
-
Mid = DebugLevel(label="Mid", number=2, level="mid")
|
|
112
|
-
High = DebugLevel(label="High", number=4, level="high")
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
class DebugLevelButton(QToolButton):
|
|
116
|
-
|
|
117
|
-
"""
|
|
118
|
-
A drop down button to set blurdev's debug level.
|
|
119
|
-
"""
|
|
120
|
-
|
|
121
|
-
def __init__(self, parent=None):
|
|
122
|
-
"""
|
|
123
|
-
Creates the default debug level menu actions for updating blurdev's
|
|
124
|
-
debug level.
|
|
125
|
-
|
|
126
|
-
Args:
|
|
127
|
-
parent (QWidget, optional): The parent widget for this button.
|
|
128
|
-
"""
|
|
129
|
-
super(QToolButton, self).__init__(parent=parent)
|
|
130
|
-
self.setPopupMode(QToolButton.InstantPopup)
|
|
131
|
-
|
|
132
|
-
# create & set menu
|
|
133
|
-
self.setMenu(QMenu(parent=self))
|
|
134
|
-
|
|
135
|
-
# `setLevel` signal mapper
|
|
136
|
-
self._signal_mapper = QSignalMapper(self)
|
|
137
|
-
self._signal_mapper.mapped[str].connect(self.setLevel)
|
|
138
|
-
|
|
139
|
-
self._initializeDebugActions()
|
|
140
|
-
|
|
141
|
-
def _initializeDebugActions(self):
|
|
142
|
-
"""
|
|
143
|
-
Creates actions that control the blurdev debug level.
|
|
144
|
-
"""
|
|
145
|
-
for debug_level in DebugLevels:
|
|
146
|
-
action = QAction(debug_level.icon, debug_level.name, self)
|
|
147
|
-
action.setCheckable(True)
|
|
148
|
-
|
|
149
|
-
# explain action in tooltip (ex: "Set debug level to Mid")
|
|
150
|
-
action.setToolTip("Set debug level to {}".format(debug_level.name))
|
|
151
|
-
|
|
152
|
-
# when clicked/activated set debug level
|
|
153
|
-
self._signal_mapper.setMapping(action, debug_level.label)
|
|
154
|
-
action.triggered.connect(self._signal_mapper.map)
|
|
155
|
-
|
|
156
|
-
self.menu().addAction(action)
|
|
157
|
-
|
|
158
|
-
self.refresh()
|
|
159
|
-
|
|
160
|
-
def refresh(self):
|
|
161
|
-
"""
|
|
162
|
-
Triggers an update of the debug tool bar button's various display
|
|
163
|
-
elements so as to represent the current debug level. This includes the
|
|
164
|
-
button's icon & tooltip, as well as the check-state of the debug level
|
|
165
|
-
menu actions.
|
|
166
|
-
"""
|
|
167
|
-
level = DebugLevels.fromValue(blurdev.debug.debugLevel())
|
|
168
|
-
|
|
169
|
-
self.setIcon(level)
|
|
170
|
-
self.setCheckedAction(level)
|
|
171
|
-
self.setToolTip(level)
|
|
172
|
-
|
|
173
|
-
def setCheckedAction(self, level):
|
|
174
|
-
"""
|
|
175
|
-
Updates the debug button's menu actions to check the currently active
|
|
176
|
-
debug level.
|
|
177
|
-
|
|
178
|
-
Args:
|
|
179
|
-
level (DebugLevel): Debug level to check in debug menu.
|
|
180
|
-
"""
|
|
181
|
-
for action in self.actions():
|
|
182
|
-
action.setChecked(action.text() == level.name)
|
|
183
|
-
|
|
184
|
-
def setIcon(self, level):
|
|
185
|
-
"""
|
|
186
|
-
Updates the debug button's icon to display the current debug level
|
|
187
|
-
blurdev is set to.
|
|
188
|
-
|
|
189
|
-
Args:
|
|
190
|
-
level (DebugLevel): Debug level to change icon to represent.
|
|
191
|
-
"""
|
|
192
|
-
super(QToolButton, self).setIcon(level.icon)
|
|
193
|
-
|
|
194
|
-
def setLevel(self, level):
|
|
195
|
-
"""
|
|
196
|
-
Sets blurdev's debug level.
|
|
197
|
-
|
|
198
|
-
Args:
|
|
199
|
-
level (str): Name of debug level to set blurdev to.
|
|
200
|
-
"""
|
|
201
|
-
blurdev.debug.setDebugLevel(level)
|
|
202
|
-
self.refresh()
|
|
203
|
-
|
|
204
|
-
def setToolTip(self, level):
|
|
205
|
-
"""
|
|
206
|
-
Updates the debug menu's tooltip to explain what the current debug
|
|
207
|
-
level is set to.
|
|
208
|
-
|
|
209
|
-
Args:
|
|
210
|
-
level (DebugLevel): Debug level to reflect in tooltip.
|
|
211
|
-
"""
|
|
212
|
-
tool_tip = "Current debug level: {}".format(level.name)
|
|
213
|
-
super(QToolButton, self).setToolTip(tool_tip)
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
class LoggingLevelButton(QToolButton):
|
|
217
|
-
|
|
218
|
-
"""
|
|
219
|
-
A drop down button to set logger levels for all loggers known to Python's
|
|
220
|
-
native logging implementation.
|
|
221
|
-
|
|
222
|
-
The logger menus present in the tool bar button have level-changing actions
|
|
223
|
-
as well a sub-menus for any descendant loggers.
|
|
224
|
-
"""
|
|
225
|
-
|
|
226
|
-
def __init__(self, parent=None):
|
|
227
|
-
"""
|
|
228
|
-
Creates the root logger menu this button displays when clicked.
|
|
229
|
-
Additionally, any pre-existing loggers and their menus are added.
|
|
230
|
-
|
|
231
|
-
The `logger_created` signal emitted by the `LoggerWithSignals` is
|
|
232
|
-
connected to the `createLoggerMenu`-method ensuring any newly
|
|
233
|
-
initialized loggers have a menu created.
|
|
234
|
-
|
|
235
|
-
Args:
|
|
236
|
-
parent (QWidget, optional): The parent widget for this button.
|
|
237
|
-
"""
|
|
238
|
-
super(QToolButton, self).__init__(parent=parent)
|
|
239
|
-
self.setPopupMode(QToolButton.InstantPopup)
|
|
240
|
-
|
|
241
|
-
# create root logger menu
|
|
242
|
-
root = logging.getLogger("")
|
|
243
|
-
root_menu = LoggingLevelMenu(name="", logger=root, parent=self)
|
|
244
|
-
self.setMenu(root_menu)
|
|
245
|
-
|
|
246
|
-
# track created logger menus; pre-populated with root logger menu
|
|
247
|
-
self.loggerMenus = {"": root_menu}
|
|
248
|
-
self._prexistingLoggerMenusInitialized = False
|
|
249
|
-
|
|
250
|
-
# pre-spawn of the root menu, create logger menus & refresh tree
|
|
251
|
-
root_menu.aboutToShow.connect(self.onMenuShow)
|
|
252
|
-
|
|
253
|
-
# automatically create logger menu on logger init
|
|
254
|
-
LoggerWithSignals.logger_created.connect(self.createLoggerMenu)
|
|
255
|
-
|
|
256
|
-
def onMenuShow(self):
|
|
257
|
-
"""
|
|
258
|
-
When the menu associated with this toolbar button is activated, the
|
|
259
|
-
logger menus for any loggers that existed before the instantiation of
|
|
260
|
-
this button will be created (once). The underlying the menu also be
|
|
261
|
-
updated ensuring the logger menus within represent their current level
|
|
262
|
-
state.
|
|
263
|
-
|
|
264
|
-
Note: Triggering a refresh for every `aboutToShow` signal is necessary
|
|
265
|
-
because when a logger is initialized via `logging.getLogger` the
|
|
266
|
-
logger menu will be created as part of the overridden Logger class
|
|
267
|
-
`__init__` method (from `LoggerWithSignals`), before the parent has
|
|
268
|
-
been set. This results in an incorrect effective logging level as
|
|
269
|
-
it cannot inherit the level of its ancestor (new loggers default to
|
|
270
|
-
NOTSET).
|
|
271
|
-
"""
|
|
272
|
-
if not self._prexistingLoggerMenusInitialized:
|
|
273
|
-
self._initializeLoggerMenus()
|
|
274
|
-
self._prexistingLoggerMenusInitialized = True
|
|
275
|
-
|
|
276
|
-
self.menu().refresh()
|
|
277
|
-
|
|
278
|
-
def _initializeLoggerMenus(self):
|
|
279
|
-
"""
|
|
280
|
-
Creates logger menus for all loggers that currently exist.
|
|
281
|
-
|
|
282
|
-
While looping through the logger dict, if the logger is merely a
|
|
283
|
-
placeholder it will be initialized so it can be added to the menu
|
|
284
|
-
hierarchy. This ensures all ancestors exist for appropriate parenting
|
|
285
|
-
when descendants are added.
|
|
286
|
-
|
|
287
|
-
Note: A logger present in the logger dict will be of class
|
|
288
|
-
`logging.PlaceHolder` if the logger has not been initialized
|
|
289
|
-
(accessed via `logging.getLogger`) and lies in-between an ancestor
|
|
290
|
-
and one of its descendants that has been initialized.
|
|
291
|
-
"""
|
|
292
|
-
logger_dict = list(logging.root.manager.loggerDict.items())
|
|
293
|
-
for name, logger in sorted(logger_dict, key=lambda x: x[0].lower()):
|
|
294
|
-
if isinstance(logger, logging.PlaceHolder):
|
|
295
|
-
logger = logging.getLogger(name)
|
|
296
|
-
self.createLoggerMenu(logger=logger)
|
|
297
|
-
|
|
298
|
-
def createLoggerMenu(self, logger=None, **kwargs):
|
|
299
|
-
"""
|
|
300
|
-
Creates a `LoggingLevelMenu` instance for the specified logger and adds
|
|
301
|
-
it to the appropriate ancestor.
|
|
302
|
-
|
|
303
|
-
During initialization each logger menu traverses its ancestry
|
|
304
|
-
"top-down" ensuring menus exist for each ancestral logger. This ensures
|
|
305
|
-
there are no parenting issues when adding the logger menu to the
|
|
306
|
-
hierarchy.
|
|
307
|
-
|
|
308
|
-
Args:
|
|
309
|
-
logger (logging.Logger/LoggerWithSignals): Logger to create
|
|
310
|
-
`LoggingLevelMenu` with. Present as a keyword argument due to
|
|
311
|
-
requirement as slot a for signal to accept `**kwargs`.
|
|
312
|
-
**kwargs: Unused. An implementation detail of `signalslot`, the
|
|
313
|
-
keyword unpacking operator must be present in the signature of
|
|
314
|
-
any slots connected to `signalslot` signals.
|
|
315
|
-
"""
|
|
316
|
-
if not logger:
|
|
317
|
-
return
|
|
318
|
-
|
|
319
|
-
parent = self.menu()
|
|
320
|
-
|
|
321
|
-
# iterate through parent logger names to ensure they exist
|
|
322
|
-
split_name = logger.name.split(".")
|
|
323
|
-
for index in range(1, len(split_name) + 1):
|
|
324
|
-
logger_name = ".".join(split_name[0:index])
|
|
325
|
-
|
|
326
|
-
# use pre-existing menu
|
|
327
|
-
menu = self.loggerMenus.get(logger_name)
|
|
328
|
-
if not menu:
|
|
329
|
-
|
|
330
|
-
# create new menu & add to parent
|
|
331
|
-
menu = LoggingLevelMenu(name=logger_name, logger=logger, parent=parent)
|
|
332
|
-
parent.addChildMenu(menu)
|
|
333
|
-
|
|
334
|
-
# track creation of menu
|
|
335
|
-
self.loggerMenus[logger_name] = menu
|
|
336
|
-
|
|
337
|
-
# set parent for subsequent loop iterations
|
|
338
|
-
parent = menu
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
class LoggingLevelMenu(QMenu):
|
|
342
|
-
|
|
343
|
-
"""
|
|
344
|
-
Custom menu for Python Loggers.
|
|
345
|
-
|
|
346
|
-
Provides an interface for changing logger levels via menu actions. Also
|
|
347
|
-
displays the presently set level by highlighting the relevant menu action
|
|
348
|
-
and via the menu's icon (which displays the logger's effective level,
|
|
349
|
-
potentially inherited from its ancestor).
|
|
350
|
-
|
|
351
|
-
The display of the logger's current level remains accurate post-level
|
|
352
|
-
change by connecting to signals present in the overridden Logger-class
|
|
353
|
-
`LoggerWithSignals`.
|
|
354
|
-
|
|
355
|
-
Descendant loggers' menus are also added and nested below the level menu
|
|
356
|
-
actions, if present. If the level is updated in this or any ancestor menus,
|
|
357
|
-
the descendant menus will have their `refresh` method executed.
|
|
358
|
-
"""
|
|
359
|
-
|
|
360
|
-
def __init__(self, name="", logger=None, parent=None):
|
|
361
|
-
"""
|
|
362
|
-
Creates the default level menu actions for updating the logger's level
|
|
363
|
-
and, as long as the associated logger is of class type
|
|
364
|
-
`LoggerWithSignals`, the `refresh` method is connected to the
|
|
365
|
-
`level_changed` signal ensuring the present level is always correct.
|
|
366
|
-
|
|
367
|
-
Args:
|
|
368
|
-
name (str): Name of Logger this menu will represent.
|
|
369
|
-
logger (logging.Logger/LoggerWithSignals): Logger this menu will
|
|
370
|
-
represent and control via actions that modify the logger's
|
|
371
|
-
set level.
|
|
372
|
-
parent (QToolButton/QMenu): `QMenu` or `QToolButton` this menu will
|
|
373
|
-
be parented to.
|
|
374
|
-
"""
|
|
375
|
-
super(QMenu, self).__init__(title=name.split(".")[-1], parent=parent)
|
|
376
|
-
|
|
377
|
-
self.name = name or "root"
|
|
378
|
-
self.logger = logger
|
|
379
|
-
|
|
380
|
-
self._initializeLevelActions()
|
|
381
|
-
|
|
382
|
-
# refresh root at init to represent current level in toolbar
|
|
383
|
-
if self.name == "root":
|
|
384
|
-
self.refresh()
|
|
385
|
-
|
|
386
|
-
def _initializeLevelActions(self):
|
|
387
|
-
"""
|
|
388
|
-
Creates actions that control the logging level of the menu's associated
|
|
389
|
-
logger.
|
|
390
|
-
|
|
391
|
-
An invisible separator is appended to the end of the action list for
|
|
392
|
-
future use in instances where descendant logger menus are added to the
|
|
393
|
-
action list.
|
|
394
|
-
"""
|
|
395
|
-
for logger_level in LoggerLevels:
|
|
396
|
-
action = QAction(logger_level.icon, logger_level.name, self)
|
|
397
|
-
action.setCheckable(True)
|
|
398
|
-
|
|
399
|
-
# tooltip example: "Set 'blurdev.debug' to level Warning")
|
|
400
|
-
action.setToolTip(
|
|
401
|
-
"Set '{}' to level {}".format(self.logger.name, logger_level.name)
|
|
402
|
-
)
|
|
403
|
-
|
|
404
|
-
# when clicked/activated set associated loggers level
|
|
405
|
-
action.triggered.connect(
|
|
406
|
-
partial(self.setLevel, getattr(logging, logger_level.label))
|
|
407
|
-
)
|
|
408
|
-
self.addAction(action)
|
|
409
|
-
|
|
410
|
-
# append a separator to the end of the level action list to provide
|
|
411
|
-
# visual distinction between level actions and descendant logger menus
|
|
412
|
-
separator = QAction("Separator", self)
|
|
413
|
-
separator.setSeparator(True)
|
|
414
|
-
separator.setVisible(False) # invisible until descendants added
|
|
415
|
-
self.addAction(separator)
|
|
416
|
-
|
|
417
|
-
def addChildMenu(self, menu):
|
|
418
|
-
"""
|
|
419
|
-
Inserts the `LoggingLevelMenu` provided into the bottom section of the
|
|
420
|
-
parent's action list, in alphabetical order.
|
|
421
|
-
|
|
422
|
-
The list of logging level menus at the end of the instance's action
|
|
423
|
-
list is preceded by a separator (as long as there are descendant menus
|
|
424
|
-
present).
|
|
425
|
-
|
|
426
|
-
Args:
|
|
427
|
-
menu (LoggingLevelMenu): Logger QMenu to insert into action list.
|
|
428
|
-
"""
|
|
429
|
-
current_actions = self.actions()
|
|
430
|
-
current_names = list(map(lambda x: x.text(), current_actions))
|
|
431
|
-
|
|
432
|
-
# ensure separator is visible
|
|
433
|
-
separator_index = current_names.index("Separator")
|
|
434
|
-
separator_action = current_actions[separator_index]
|
|
435
|
-
separator_action.setVisible(True)
|
|
436
|
-
|
|
437
|
-
child_menus_index_start = separator_index + 1
|
|
438
|
-
child_menus = current_actions[child_menus_index_start:]
|
|
439
|
-
|
|
440
|
-
# no children yet, add to bottom of menu
|
|
441
|
-
if not child_menus:
|
|
442
|
-
self.addMenu(menu)
|
|
443
|
-
return
|
|
444
|
-
|
|
445
|
-
# add new menu name to current list & sort
|
|
446
|
-
child_menu_names = list(map(lambda x: x.text(), child_menus))
|
|
447
|
-
child_menu_names.append(menu.title())
|
|
448
|
-
sorted_child_names = sorted(child_menu_names, key=lambda x: x.lower())
|
|
449
|
-
|
|
450
|
-
# find insert index in updated name list
|
|
451
|
-
index = sorted_child_names.index(menu.title()) + child_menus_index_start
|
|
452
|
-
|
|
453
|
-
# ensure we append to end if index greater than action list
|
|
454
|
-
if index >= len(current_actions):
|
|
455
|
-
self.addMenu(menu)
|
|
456
|
-
|
|
457
|
-
# otherwise, add menu after preceding action/menu
|
|
458
|
-
else:
|
|
459
|
-
before_action = current_actions[index]
|
|
460
|
-
self.insertMenu(before_action, menu)
|
|
461
|
-
|
|
462
|
-
def childMenus(self):
|
|
463
|
-
"""
|
|
464
|
-
Returns a list of descendant logger menus that may be present in the
|
|
465
|
-
logger menu's action list. May return an empty list denoting no
|
|
466
|
-
descendant menus exist.
|
|
467
|
-
|
|
468
|
-
Returns:
|
|
469
|
-
list: Descendant `LoggingLevelMenu`s.
|
|
470
|
-
"""
|
|
471
|
-
child_menus = []
|
|
472
|
-
current_actions = self.actions()
|
|
473
|
-
current_names = list(map(lambda x: x.text(), current_actions))
|
|
474
|
-
|
|
475
|
-
# determine start of child menus
|
|
476
|
-
separator_index = current_names.index("Separator")
|
|
477
|
-
child_menus_index_start = separator_index + 1
|
|
478
|
-
|
|
479
|
-
child_menus = current_actions[child_menus_index_start:]
|
|
480
|
-
|
|
481
|
-
return child_menus
|
|
482
|
-
|
|
483
|
-
def refresh(self, **kwargs):
|
|
484
|
-
"""
|
|
485
|
-
Triggers an update of the logger menu's various display elements so as
|
|
486
|
-
to represent the logger's present level.
|
|
487
|
-
|
|
488
|
-
The menu's icon is updated to reflected the effective logging level,
|
|
489
|
-
inherited from the closest ancestor with a set level if the logger is
|
|
490
|
-
set to `NOTSET`.
|
|
491
|
-
|
|
492
|
-
The menu's tooltip and checked action in the action menu are derivative
|
|
493
|
-
of the logger's native level.
|
|
494
|
-
|
|
495
|
-
Any descendant logger menus are also refreshed so as to represent the
|
|
496
|
-
most current logger state (such as level inheritance).
|
|
497
|
-
|
|
498
|
-
Args:
|
|
499
|
-
**kwargs: Unused. An implementation detail of `signalslot`, the
|
|
500
|
-
keyword unpacking operator must be present in the signature of
|
|
501
|
-
any slots connected to `signalslot` signals.
|
|
502
|
-
"""
|
|
503
|
-
effective_level = self.logger.getEffectiveLevel()
|
|
504
|
-
effective_level_name = logging.getLevelName(effective_level)
|
|
505
|
-
|
|
506
|
-
level_num = self.logger.level
|
|
507
|
-
level_name = logging.getLevelName(level_num)
|
|
508
|
-
|
|
509
|
-
# icon represents the effective level
|
|
510
|
-
self.setIcon(effective_level_name)
|
|
511
|
-
|
|
512
|
-
# level actions & tooltip represent logger's level (or lack of)
|
|
513
|
-
self.setCheckedAction(level_name)
|
|
514
|
-
self.setToolTip(level_name)
|
|
515
|
-
|
|
516
|
-
# refresh children
|
|
517
|
-
for child_logger_menu in self.childMenus():
|
|
518
|
-
child_logger_menu.menu().refresh()
|
|
519
|
-
|
|
520
|
-
def setCheckedAction(self, level):
|
|
521
|
-
"""
|
|
522
|
-
Updates the logger menu's actions to check the currently active logging
|
|
523
|
-
level.
|
|
524
|
-
|
|
525
|
-
Args:
|
|
526
|
-
level (str): Logging level to check in logger action menu.
|
|
527
|
-
"""
|
|
528
|
-
level_enum = LoggerLevels.fromLabel(level)
|
|
529
|
-
for action in self.actions():
|
|
530
|
-
action.setChecked(action.text() == level_enum.name)
|
|
531
|
-
|
|
532
|
-
def setIcon(self, level):
|
|
533
|
-
"""
|
|
534
|
-
Updates the logger menu's icon to display the current level the logger
|
|
535
|
-
has is set to.
|
|
536
|
-
|
|
537
|
-
If the updated logger is the root logger, the logging level toolbar
|
|
538
|
-
button's icon is updated instead.
|
|
539
|
-
|
|
540
|
-
Args:
|
|
541
|
-
level (str): Logging level to change icon to represent.
|
|
542
|
-
"""
|
|
543
|
-
level_enum = LoggerLevels.fromLabel(level)
|
|
544
|
-
super(LoggingLevelMenu, self).setIcon(level_enum.icon)
|
|
545
|
-
|
|
546
|
-
if self.name == "root":
|
|
547
|
-
self.parent().setIcon(level_enum.icon)
|
|
548
|
-
|
|
549
|
-
def setLevel(self, level):
|
|
550
|
-
"""
|
|
551
|
-
Sets the logger this menu object represents to the level supplied.
|
|
552
|
-
|
|
553
|
-
If the logger represented is not an instance of LoggerWithSignals,
|
|
554
|
-
the refresh method is manually executed as the logger does not have
|
|
555
|
-
signal necessary to automatically inform the menu to refresh.
|
|
556
|
-
|
|
557
|
-
Args:
|
|
558
|
-
level (str): Logging level to set logger to.
|
|
559
|
-
"""
|
|
560
|
-
self.logger.setLevel(level)
|
|
561
|
-
|
|
562
|
-
# non-overridden logger classes require manual refresh
|
|
563
|
-
if not isinstance(self.logger, LoggerWithSignals):
|
|
564
|
-
self.refresh()
|
|
565
|
-
|
|
566
|
-
def setToolTip(self, level):
|
|
567
|
-
"""
|
|
568
|
-
Updates the logger menu's tooltip to explain what the current level is
|
|
569
|
-
set to.
|
|
570
|
-
|
|
571
|
-
If the updated logger is the root logger, the logging level toolbar
|
|
572
|
-
button's tooltip is updated instead.
|
|
573
|
-
|
|
574
|
-
Args:
|
|
575
|
-
level (str): Logging level to reflect in tooltip.
|
|
576
|
-
"""
|
|
577
|
-
level_enum = LoggerLevels.fromLabel(level)
|
|
578
|
-
|
|
579
|
-
tool_tip_text = "Logger '{}' current level: {}"
|
|
580
|
-
tool_tip = tool_tip_text.format(self.logger.name, level_enum.name)
|
|
581
|
-
|
|
582
|
-
if self.name == "root":
|
|
583
|
-
self.parent().setToolTip(tool_tip)
|
|
584
|
-
else:
|
|
585
|
-
super(LoggingLevelMenu, self).setToolTip(tool_tip)
|