PrEditor 2.1.0__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.
- preditor/__init__.py +315 -0
- preditor/__main__.py +13 -0
- preditor/about_module.py +165 -0
- preditor/cli.py +192 -0
- preditor/config.py +318 -0
- preditor/constants.py +13 -0
- preditor/contexts.py +210 -0
- preditor/cores/__init__.py +0 -0
- preditor/cores/core.py +20 -0
- preditor/dccs/.hab.json +10 -0
- preditor/dccs/maya/PrEditor_maya.mod +1 -0
- preditor/dccs/maya/README.md +22 -0
- preditor/dccs/maya/plug-ins/PrEditor_maya.py +141 -0
- preditor/dccs/studiomax/PackageContents.xml +32 -0
- preditor/dccs/studiomax/PrEditor-PrEditor_Show.mcr +8 -0
- preditor/dccs/studiomax/README.md +17 -0
- preditor/dccs/studiomax/preditor.ms +16 -0
- preditor/dccs/studiomax/preditor_menu.mnx +7 -0
- preditor/debug.py +149 -0
- preditor/delayable_engine/__init__.py +302 -0
- preditor/delayable_engine/delayables.py +85 -0
- preditor/enum.py +728 -0
- preditor/excepthooks.py +165 -0
- preditor/gui/__init__.py +56 -0
- preditor/gui/app.py +163 -0
- preditor/gui/codehighlighter.py +289 -0
- preditor/gui/completer.py +237 -0
- preditor/gui/console.py +605 -0
- preditor/gui/console_base.py +911 -0
- preditor/gui/dialog.py +181 -0
- preditor/gui/drag_tab_bar.py +625 -0
- preditor/gui/editor_chooser.py +57 -0
- preditor/gui/errordialog.py +69 -0
- preditor/gui/find_files.py +137 -0
- preditor/gui/fuzzy_search/__init__.py +0 -0
- preditor/gui/fuzzy_search/fuzzy_search.py +97 -0
- preditor/gui/group_tab_widget/__init__.py +0 -0
- preditor/gui/group_tab_widget/group_tab_widget.py +528 -0
- preditor/gui/group_tab_widget/grouped_tab_menu.py +35 -0
- preditor/gui/group_tab_widget/grouped_tab_models.py +107 -0
- preditor/gui/group_tab_widget/grouped_tab_widget.py +223 -0
- preditor/gui/group_tab_widget/one_tab_widget.py +96 -0
- preditor/gui/level_buttons.py +358 -0
- preditor/gui/logger_window_handler.py +77 -0
- preditor/gui/logger_window_plugin.py +35 -0
- preditor/gui/loggerwindow.py +2405 -0
- preditor/gui/newtabwidget.py +69 -0
- preditor/gui/output_console.py +11 -0
- preditor/gui/qtdesigner/__init__.py +21 -0
- preditor/gui/qtdesigner/_log_plugin.py +29 -0
- preditor/gui/qtdesigner/console_base_plugin.py +48 -0
- preditor/gui/qtdesigner/console_predit_plugin.py +48 -0
- preditor/gui/set_text_editor_path_dialog.py +61 -0
- preditor/gui/status_label.py +99 -0
- preditor/gui/suggest_path_quotes_dialog.py +50 -0
- preditor/gui/ui/editor_chooser.ui +93 -0
- preditor/gui/ui/errordialog.ui +74 -0
- preditor/gui/ui/find_files.ui +140 -0
- preditor/gui/ui/loggerwindow.ui +1909 -0
- preditor/gui/ui/set_text_editor_path_dialog.ui +189 -0
- preditor/gui/ui/suggest_path_quotes_dialog.ui +225 -0
- preditor/gui/window.py +161 -0
- preditor/gui/workbox_mixin.py +1139 -0
- preditor/gui/workbox_text_edit.py +136 -0
- preditor/gui/workboxwidget.py +315 -0
- preditor/logging_config.py +55 -0
- preditor/osystem.py +401 -0
- preditor/plugins.py +118 -0
- preditor/prefs.py +381 -0
- preditor/resource/environment_variables.html +26 -0
- preditor/resource/error_mail.html +85 -0
- preditor/resource/error_mail_inline.html +41 -0
- preditor/resource/img/README.md +17 -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/format-letter-case.svg +1 -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/regex.svg +1 -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
- preditor/resource/img/warning-big.png +0 -0
- preditor/resource/lang/python.json +30 -0
- preditor/resource/pref_updates/pref_updates.json +17 -0
- preditor/resource/settings.ini +25 -0
- preditor/resource/stylesheet/Bright.css +76 -0
- preditor/resource/stylesheet/Dark.css +210 -0
- preditor/scintilla/__init__.py +40 -0
- preditor/scintilla/delayables/__init__.py +11 -0
- preditor/scintilla/delayables/smart_highlight.py +97 -0
- preditor/scintilla/delayables/spell_check.py +174 -0
- preditor/scintilla/documenteditor.py +1924 -0
- preditor/scintilla/finddialog.py +68 -0
- preditor/scintilla/lang/__init__.py +80 -0
- preditor/scintilla/lang/config/bash.ini +15 -0
- preditor/scintilla/lang/config/batch.ini +14 -0
- preditor/scintilla/lang/config/cpp.ini +19 -0
- preditor/scintilla/lang/config/css.ini +19 -0
- preditor/scintilla/lang/config/eyeonscript.ini +17 -0
- preditor/scintilla/lang/config/html.ini +21 -0
- preditor/scintilla/lang/config/javascript.ini +24 -0
- preditor/scintilla/lang/config/lua.ini +16 -0
- preditor/scintilla/lang/config/maxscript.ini +20 -0
- preditor/scintilla/lang/config/mel.ini +18 -0
- preditor/scintilla/lang/config/mu.ini +22 -0
- preditor/scintilla/lang/config/nsi.ini +19 -0
- preditor/scintilla/lang/config/perl.ini +19 -0
- preditor/scintilla/lang/config/puppet.ini +19 -0
- preditor/scintilla/lang/config/python.ini +28 -0
- preditor/scintilla/lang/config/ruby.ini +19 -0
- preditor/scintilla/lang/config/sql.ini +7 -0
- preditor/scintilla/lang/config/xml.ini +21 -0
- preditor/scintilla/lang/config/yaml.ini +18 -0
- preditor/scintilla/lang/language.py +240 -0
- preditor/scintilla/lexers/__init__.py +0 -0
- preditor/scintilla/lexers/cpplexer.py +22 -0
- preditor/scintilla/lexers/javascriptlexer.py +27 -0
- preditor/scintilla/lexers/maxscriptlexer.py +235 -0
- preditor/scintilla/lexers/mellexer.py +369 -0
- preditor/scintilla/lexers/mulexer.py +33 -0
- preditor/scintilla/lexers/pythonlexer.py +42 -0
- preditor/scintilla/ui/finddialog.ui +160 -0
- preditor/settings.py +71 -0
- preditor/stream/__init__.py +72 -0
- preditor/stream/console_handler.py +169 -0
- preditor/stream/director.py +144 -0
- preditor/stream/manager.py +97 -0
- preditor/streamhandler_helper.py +46 -0
- preditor/utils/__init__.py +191 -0
- preditor/utils/call_stack.py +86 -0
- preditor/utils/cute.py +106 -0
- preditor/utils/stylesheets.py +54 -0
- preditor/utils/text_search.py +338 -0
- preditor/version.py +34 -0
- preditor/weakref.py +363 -0
- preditor-2.1.0.dist-info/METADATA +308 -0
- preditor-2.1.0.dist-info/RECORD +179 -0
- preditor-2.1.0.dist-info/WHEEL +5 -0
- preditor-2.1.0.dist-info/entry_points.txt +19 -0
- preditor-2.1.0.dist-info/licenses/LICENSE +165 -0
- preditor-2.1.0.dist-info/top_level.txt +3 -0
- tests/encodings/test_ecoding.py +33 -0
- tests/find_files/test_find_files.py +74 -0
- tests/ide/test_delayable_engine.py +171 -0
preditor/gui/dialog.py
ADDED
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
from __future__ import absolute_import
|
|
2
|
+
|
|
3
|
+
from Qt.QtCore import Qt
|
|
4
|
+
from Qt.QtWidgets import QDialog
|
|
5
|
+
|
|
6
|
+
from .. import config, relativePath
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class Dialog(QDialog):
|
|
10
|
+
_instance = None
|
|
11
|
+
|
|
12
|
+
@classmethod
|
|
13
|
+
def instance(cls, parent=None):
|
|
14
|
+
"""If you only want to have one instance of a dialog, use this method instead
|
|
15
|
+
of creating a new dialog. It will only create a new instance of the class if
|
|
16
|
+
the class variable _instance is none.
|
|
17
|
+
|
|
18
|
+
Args:
|
|
19
|
+
parent (QWidget, optional):The parent widget
|
|
20
|
+
|
|
21
|
+
Returns:
|
|
22
|
+
Dialog:
|
|
23
|
+
"""
|
|
24
|
+
if not cls._instance:
|
|
25
|
+
cls._instance = cls(parent=parent)
|
|
26
|
+
# protect the memory
|
|
27
|
+
cls._instance.setAttribute(Qt.WidgetAttribute.WA_DeleteOnClose, False)
|
|
28
|
+
return cls._instance
|
|
29
|
+
|
|
30
|
+
def __init__(
|
|
31
|
+
self,
|
|
32
|
+
parent=None,
|
|
33
|
+
flags=Qt.WindowType.WindowMinMaxButtonsHint
|
|
34
|
+
| Qt.WindowType.WindowCloseButtonHint,
|
|
35
|
+
):
|
|
36
|
+
# if there is no root, create
|
|
37
|
+
if not parent:
|
|
38
|
+
parent = config.root_window()
|
|
39
|
+
|
|
40
|
+
# create a QDialog
|
|
41
|
+
if flags:
|
|
42
|
+
QDialog.__init__(self, parent, flags)
|
|
43
|
+
else:
|
|
44
|
+
QDialog.__init__(self, parent)
|
|
45
|
+
|
|
46
|
+
# INFO
|
|
47
|
+
#
|
|
48
|
+
# As far as we can tell, the purpose for this class is keeping live
|
|
49
|
+
# references to the subclasses so they don't get garbage collected, all while
|
|
50
|
+
# getting around having to actively maintain a list of running dialogs.
|
|
51
|
+
#
|
|
52
|
+
# Generally, setting WA_DeleteOnClose to False, and keeping the _instance
|
|
53
|
+
# variable around will do the trick for pseudo-singleton dialogs. (created with
|
|
54
|
+
# instance=True)
|
|
55
|
+
#
|
|
56
|
+
# However, for non-instanced dialogs where multiples are allowed, deleteOnClose
|
|
57
|
+
# is set to True and no _instance variable is set. Because there are no live
|
|
58
|
+
# references to the dialog, it is closed and garbage collected almost
|
|
59
|
+
# immediately in certain programs (xsi, maya).
|
|
60
|
+
#
|
|
61
|
+
# The current workaround is to manually set WA_DeleteOnClose to False, however
|
|
62
|
+
# this causes any subclasses to stick around in memory even when the
|
|
63
|
+
# window/dialog is closed. So you also have to manually set WA_DeleteOnClose to
|
|
64
|
+
# True in the sub-classed .closeEvent() method before you call super()
|
|
65
|
+
#
|
|
66
|
+
# It is completely possible to write some code that would automatically handle
|
|
67
|
+
# this, and it is CERTAINLY something we can/will be doing in the future, but
|
|
68
|
+
# for now we're not quite sure how that would affect the production tools.
|
|
69
|
+
# Technically this is a problem, but there are currently no consequences from an
|
|
70
|
+
# artist standpoint because we have more than enough memory to hold all those
|
|
71
|
+
# dead dialogs
|
|
72
|
+
|
|
73
|
+
# set the delete attribute to clean up the window once it is closed
|
|
74
|
+
self.setAttribute(Qt.WidgetAttribute.WA_DeleteOnClose, True)
|
|
75
|
+
|
|
76
|
+
# set this property to true to properly handle tracking events to control
|
|
77
|
+
# keyboard overrides
|
|
78
|
+
self.setMouseTracking(True)
|
|
79
|
+
|
|
80
|
+
# If this value is set to False calling setGeometry on this dialog will not
|
|
81
|
+
# adjust the geometry to ensure the dialog is on a valid screen.
|
|
82
|
+
self.checkScreenGeo = True
|
|
83
|
+
# attempt to set the dialog icon
|
|
84
|
+
import os
|
|
85
|
+
import sys
|
|
86
|
+
|
|
87
|
+
from Qt.QtGui import QIcon
|
|
88
|
+
|
|
89
|
+
try:
|
|
90
|
+
path = relativePath(
|
|
91
|
+
os.path.abspath(sys.modules[self.__class__.__module__].__file__),
|
|
92
|
+
'img/icon.png',
|
|
93
|
+
)
|
|
94
|
+
if os.path.exists(path):
|
|
95
|
+
self.setWindowIcon(QIcon(path))
|
|
96
|
+
except (AttributeError, KeyError):
|
|
97
|
+
pass
|
|
98
|
+
|
|
99
|
+
def _shouldDisableAccelerators(self, old, now):
|
|
100
|
+
"""Used to enable typing in DCC's that require it(Max 2018).
|
|
101
|
+
|
|
102
|
+
Args:
|
|
103
|
+
old (QWidget or None): The QWidget that lost focus.
|
|
104
|
+
new (QWidget or None): The QWidget that gained focus.
|
|
105
|
+
|
|
106
|
+
Returns:
|
|
107
|
+
bool: If accelerators should be disabled.
|
|
108
|
+
"""
|
|
109
|
+
# By default we always want to disable accelerators.
|
|
110
|
+
return True
|
|
111
|
+
|
|
112
|
+
def closeEvent(self, event):
|
|
113
|
+
# ensure this object gets deleted
|
|
114
|
+
wwidget = None
|
|
115
|
+
if self.testAttribute(Qt.WidgetAttribute.WA_DeleteOnClose):
|
|
116
|
+
# collect the win widget to uncache it
|
|
117
|
+
if self.parent() and self.parent().inherits('QWinWidget'):
|
|
118
|
+
wwidget = self.parent()
|
|
119
|
+
|
|
120
|
+
QDialog.closeEvent(self, event)
|
|
121
|
+
|
|
122
|
+
# uncache the win widget if necessary
|
|
123
|
+
if wwidget:
|
|
124
|
+
from .winwidget import WinWidget
|
|
125
|
+
|
|
126
|
+
WinWidget.uncache(wwidget)
|
|
127
|
+
|
|
128
|
+
def exec_(self):
|
|
129
|
+
# do not use the DeleteOnClose attribute when executing a dialog as often times
|
|
130
|
+
# a user will be accessing information from the dialog instance after it closes.
|
|
131
|
+
# This function properly transfers ownership of the dialog instance back to
|
|
132
|
+
# Python anyway
|
|
133
|
+
|
|
134
|
+
self.setAttribute(Qt.WidgetAttribute.WA_DeleteOnClose, False)
|
|
135
|
+
|
|
136
|
+
# execute the dialog
|
|
137
|
+
return super().exec()
|
|
138
|
+
|
|
139
|
+
def setGeometry(self, *args):
|
|
140
|
+
"""
|
|
141
|
+
Sets the dialog's geometry, It will also check if the geometry is visible on any
|
|
142
|
+
monitors. If it is not it will move the dialog so it is visible. This can be
|
|
143
|
+
disabled by setting self.checkScreenGeo to False
|
|
144
|
+
"""
|
|
145
|
+
super(Dialog, self).setGeometry(*args)
|
|
146
|
+
if self.checkScreenGeo:
|
|
147
|
+
from ..utils.cute import ensureWindowIsVisible
|
|
148
|
+
|
|
149
|
+
ensureWindowIsVisible(self)
|
|
150
|
+
|
|
151
|
+
def shutdown(self):
|
|
152
|
+
# use a @classmethod to make inheritance magically work
|
|
153
|
+
self._shutdown(self)
|
|
154
|
+
|
|
155
|
+
@classmethod
|
|
156
|
+
def _shutdown(cls, this):
|
|
157
|
+
"""
|
|
158
|
+
If this item is the class instance properly close it and remove it from memory
|
|
159
|
+
so it can be recreated.
|
|
160
|
+
"""
|
|
161
|
+
# allow the global instance to be cleared
|
|
162
|
+
if this == cls._instance:
|
|
163
|
+
cls._instance = None
|
|
164
|
+
this.setAttribute(Qt.WidgetAttribute.WA_DeleteOnClose, True)
|
|
165
|
+
try:
|
|
166
|
+
this.close()
|
|
167
|
+
except RuntimeError:
|
|
168
|
+
pass
|
|
169
|
+
|
|
170
|
+
@classmethod
|
|
171
|
+
def instance_shutdown(cls):
|
|
172
|
+
"""Call shutdown on this class instance only if the class was instantiated.
|
|
173
|
+
|
|
174
|
+
Returns:
|
|
175
|
+
bool: if cls.instance().shutdown() needed to be called.
|
|
176
|
+
"""
|
|
177
|
+
instance = cls._instance
|
|
178
|
+
if instance:
|
|
179
|
+
instance.shutdown()
|
|
180
|
+
return True
|
|
181
|
+
return False
|