PrEditor 1.0.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.

Potentially problematic release.


This version of PrEditor might be problematic. Click here for more details.

Files changed (158) hide show
  1. preditor/__init__.py +322 -0
  2. preditor/__main__.py +13 -0
  3. preditor/about_module.py +161 -0
  4. preditor/cli.py +192 -0
  5. preditor/config.py +302 -0
  6. preditor/contexts.py +119 -0
  7. preditor/cores/__init__.py +0 -0
  8. preditor/cores/core.py +20 -0
  9. preditor/dccs/maya/PrEditor_maya.mod +2 -0
  10. preditor/dccs/maya/plug-ins/PrEditor_maya.py +110 -0
  11. preditor/debug.py +144 -0
  12. preditor/delayable_engine/__init__.py +302 -0
  13. preditor/delayable_engine/delayables.py +85 -0
  14. preditor/enum.py +728 -0
  15. preditor/excepthooks.py +131 -0
  16. preditor/gui/__init__.py +93 -0
  17. preditor/gui/app.py +160 -0
  18. preditor/gui/codehighlighter.py +209 -0
  19. preditor/gui/completer.py +226 -0
  20. preditor/gui/console.py +867 -0
  21. preditor/gui/dialog.py +178 -0
  22. preditor/gui/drag_tab_bar.py +190 -0
  23. preditor/gui/editor_chooser.py +57 -0
  24. preditor/gui/errordialog.py +68 -0
  25. preditor/gui/find_files.py +125 -0
  26. preditor/gui/fuzzy_search/__init__.py +0 -0
  27. preditor/gui/fuzzy_search/fuzzy_search.py +93 -0
  28. preditor/gui/group_tab_widget/__init__.py +325 -0
  29. preditor/gui/group_tab_widget/grouped_tab_menu.py +35 -0
  30. preditor/gui/group_tab_widget/grouped_tab_models.py +108 -0
  31. preditor/gui/group_tab_widget/grouped_tab_widget.py +78 -0
  32. preditor/gui/group_tab_widget/one_tab_widget.py +54 -0
  33. preditor/gui/level_buttons.py +343 -0
  34. preditor/gui/logger_window_handler.py +48 -0
  35. preditor/gui/logger_window_plugin.py +32 -0
  36. preditor/gui/loggerwindow.py +1385 -0
  37. preditor/gui/newtabwidget.py +69 -0
  38. preditor/gui/set_text_editor_path_dialog.py +59 -0
  39. preditor/gui/status_label.py +99 -0
  40. preditor/gui/suggest_path_quotes_dialog.py +50 -0
  41. preditor/gui/ui/editor_chooser.ui +93 -0
  42. preditor/gui/ui/errordialog.ui +74 -0
  43. preditor/gui/ui/find_files.ui +140 -0
  44. preditor/gui/ui/loggerwindow.ui +1105 -0
  45. preditor/gui/ui/set_text_editor_path_dialog.ui +189 -0
  46. preditor/gui/ui/suggest_path_quotes_dialog.ui +225 -0
  47. preditor/gui/window.py +161 -0
  48. preditor/gui/workbox_mixin.py +389 -0
  49. preditor/gui/workbox_text_edit.py +137 -0
  50. preditor/gui/workboxwidget.py +298 -0
  51. preditor/logging_config.py +52 -0
  52. preditor/osystem.py +401 -0
  53. preditor/plugins.py +118 -0
  54. preditor/prefs.py +74 -0
  55. preditor/resource/environment_variables.html +26 -0
  56. preditor/resource/error_mail.html +85 -0
  57. preditor/resource/error_mail_inline.html +41 -0
  58. preditor/resource/img/README.md +17 -0
  59. preditor/resource/img/arrow_forward.png +0 -0
  60. preditor/resource/img/check-bold.png +0 -0
  61. preditor/resource/img/chevron-down.png +0 -0
  62. preditor/resource/img/chevron-up.png +0 -0
  63. preditor/resource/img/close-thick.png +0 -0
  64. preditor/resource/img/comment-edit.png +0 -0
  65. preditor/resource/img/content-copy.png +0 -0
  66. preditor/resource/img/content-cut.png +0 -0
  67. preditor/resource/img/content-duplicate.png +0 -0
  68. preditor/resource/img/content-paste.png +0 -0
  69. preditor/resource/img/content-save.png +0 -0
  70. preditor/resource/img/debug_disabled.png +0 -0
  71. preditor/resource/img/eye-check.png +0 -0
  72. preditor/resource/img/file-plus.png +0 -0
  73. preditor/resource/img/file-remove.png +0 -0
  74. preditor/resource/img/format-align-left.png +0 -0
  75. preditor/resource/img/format-letter-case-lower.png +0 -0
  76. preditor/resource/img/format-letter-case-upper.png +0 -0
  77. preditor/resource/img/format-letter-case.svg +1 -0
  78. preditor/resource/img/information.png +0 -0
  79. preditor/resource/img/logging_critical.png +0 -0
  80. preditor/resource/img/logging_custom.png +0 -0
  81. preditor/resource/img/logging_debug.png +0 -0
  82. preditor/resource/img/logging_error.png +0 -0
  83. preditor/resource/img/logging_info.png +0 -0
  84. preditor/resource/img/logging_not_set.png +0 -0
  85. preditor/resource/img/logging_warning.png +0 -0
  86. preditor/resource/img/marker.png +0 -0
  87. preditor/resource/img/play.png +0 -0
  88. preditor/resource/img/playlist-play.png +0 -0
  89. preditor/resource/img/plus-minus-variant.png +0 -0
  90. preditor/resource/img/preditor.ico +0 -0
  91. preditor/resource/img/preditor.png +0 -0
  92. preditor/resource/img/preditor.psd +0 -0
  93. preditor/resource/img/preditor.svg +44 -0
  94. preditor/resource/img/regex.svg +1 -0
  95. preditor/resource/img/restart.svg +1 -0
  96. preditor/resource/img/skip-forward-outline.png +0 -0
  97. preditor/resource/img/skip-next-outline.png +0 -0
  98. preditor/resource/img/skip-next.png +0 -0
  99. preditor/resource/img/skip-previous.png +0 -0
  100. preditor/resource/img/subdirectory-arrow-right.png +0 -0
  101. preditor/resource/img/text-search-variant.png +0 -0
  102. preditor/resource/img/warning-big.png +0 -0
  103. preditor/resource/lang/python.json +30 -0
  104. preditor/resource/settings.ini +25 -0
  105. preditor/resource/stylesheet/Bright.css +65 -0
  106. preditor/resource/stylesheet/Dark.css +199 -0
  107. preditor/scintilla/__init__.py +22 -0
  108. preditor/scintilla/delayables/__init__.py +11 -0
  109. preditor/scintilla/delayables/smart_highlight.py +94 -0
  110. preditor/scintilla/delayables/spell_check.py +173 -0
  111. preditor/scintilla/documenteditor.py +2038 -0
  112. preditor/scintilla/finddialog.py +68 -0
  113. preditor/scintilla/lang/__init__.py +80 -0
  114. preditor/scintilla/lang/config/bash.ini +15 -0
  115. preditor/scintilla/lang/config/batch.ini +14 -0
  116. preditor/scintilla/lang/config/cpp.ini +19 -0
  117. preditor/scintilla/lang/config/css.ini +19 -0
  118. preditor/scintilla/lang/config/eyeonscript.ini +17 -0
  119. preditor/scintilla/lang/config/html.ini +21 -0
  120. preditor/scintilla/lang/config/javascript.ini +24 -0
  121. preditor/scintilla/lang/config/lua.ini +16 -0
  122. preditor/scintilla/lang/config/maxscript.ini +20 -0
  123. preditor/scintilla/lang/config/mel.ini +18 -0
  124. preditor/scintilla/lang/config/mu.ini +22 -0
  125. preditor/scintilla/lang/config/nsi.ini +19 -0
  126. preditor/scintilla/lang/config/perl.ini +19 -0
  127. preditor/scintilla/lang/config/puppet.ini +19 -0
  128. preditor/scintilla/lang/config/python.ini +28 -0
  129. preditor/scintilla/lang/config/ruby.ini +19 -0
  130. preditor/scintilla/lang/config/sql.ini +7 -0
  131. preditor/scintilla/lang/config/xml.ini +21 -0
  132. preditor/scintilla/lang/config/yaml.ini +18 -0
  133. preditor/scintilla/lang/language.py +240 -0
  134. preditor/scintilla/lexers/__init__.py +0 -0
  135. preditor/scintilla/lexers/cpplexer.py +21 -0
  136. preditor/scintilla/lexers/javascriptlexer.py +25 -0
  137. preditor/scintilla/lexers/maxscriptlexer.py +234 -0
  138. preditor/scintilla/lexers/mellexer.py +368 -0
  139. preditor/scintilla/lexers/mulexer.py +32 -0
  140. preditor/scintilla/lexers/pythonlexer.py +41 -0
  141. preditor/scintilla/ui/finddialog.ui +160 -0
  142. preditor/settings.py +71 -0
  143. preditor/stream/__init__.py +80 -0
  144. preditor/stream/director.py +73 -0
  145. preditor/stream/manager.py +74 -0
  146. preditor/streamhandler_helper.py +46 -0
  147. preditor/utils/__init__.py +0 -0
  148. preditor/utils/cute.py +30 -0
  149. preditor/utils/stylesheets.py +54 -0
  150. preditor/utils/text_search.py +342 -0
  151. preditor/version.py +21 -0
  152. preditor/weakref.py +363 -0
  153. preditor-1.0.0.dist-info/METADATA +224 -0
  154. preditor-1.0.0.dist-info/RECORD +158 -0
  155. preditor-1.0.0.dist-info/WHEEL +5 -0
  156. preditor-1.0.0.dist-info/entry_points.txt +18 -0
  157. preditor-1.0.0.dist-info/licenses/LICENSE +165 -0
  158. preditor-1.0.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,226 @@
1
+ from __future__ import absolute_import
2
+
3
+ import inspect
4
+ import re
5
+ import sys
6
+ from enum import Enum
7
+
8
+ from Qt.QtCore import QRegExp, QSortFilterProxyModel, QStringListModel, Qt
9
+ from Qt.QtGui import QCursor, QTextCursor
10
+ from Qt.QtWidgets import QCompleter, QToolTip
11
+
12
+
13
+ class CompleterMode(Enum):
14
+ """
15
+ Enum which defines the available Completer Modes
16
+
17
+ STARTS_WITH - (Default) Matches completions which start with the typed input
18
+ regex = "^SampleInput.*"
19
+ OUTER_FUZZY - Matches completions which contain, but don't necessarily
20
+ start with, the typed input
21
+ regex = ".*SampleInput.*"
22
+ FULL_FUZZY - Matches completions which contain the characters of the typed input,
23
+ in order, regardless of other characters intermixed
24
+ regex = ".*S.*a.*m.*p.*l.*e.*I.*n.*p.*u.*t.*"
25
+
26
+ Matches respect case-sensitivity, which is set separately
27
+ """
28
+
29
+ STARTS_WITH = 0
30
+ OUTER_FUZZY = 1
31
+ FULL_FUZZY = 2
32
+
33
+ def displayName(self):
34
+ return self.name.replace('_', ' ').title()
35
+
36
+ def toolTip(self):
37
+ toolTipMap = {
38
+ 'STARTS_WITH': "'all' matches 'allowtabs', does not match 'findallnames'",
39
+ 'OUTER_FUZZY': "'all' matches 'getallobjs', does not match 'anylonglist'",
40
+ 'FULL_FUZZY': "'all' matches 'getallobjs', also matches 'anylonglist'",
41
+ }
42
+ return toolTipMap.get(self.name, "")
43
+
44
+
45
+ class PythonCompleter(QCompleter):
46
+ def __init__(self, widget):
47
+ super(PythonCompleter, self).__init__(widget)
48
+
49
+ # use the python model for information
50
+
51
+ self._enabled = True
52
+
53
+ # update this completer
54
+ self.setWidget(widget)
55
+
56
+ self.setCaseSensitive()
57
+ self.setCompleterMode()
58
+ self.buildCompleter()
59
+
60
+ self.wasCompleting = False
61
+ self.wasCompletingCounter = 0
62
+ self.wasCompletingCounterMax = 1
63
+
64
+ def setCaseSensitive(self, caseSensitive=True):
65
+ """Set case sensitivity for completions"""
66
+ self._sensitivity = Qt.CaseSensitive if caseSensitive else Qt.CaseInsensitive
67
+ self.buildCompleter()
68
+
69
+ def caseSensitive(self):
70
+ """Return current case sensitivity state for completions"""
71
+ caseSensitive = self._sensitivity == Qt.CaseSensitive
72
+ return caseSensitive
73
+
74
+ def setCompleterMode(self, completerMode=CompleterMode.STARTS_WITH):
75
+ """Set completer mode"""
76
+ self._completerMode = completerMode
77
+
78
+ def completerMode(self):
79
+ """Return current completer mode"""
80
+ return self._completerMode
81
+
82
+ def buildCompleter(self):
83
+ """
84
+ Build the completer to allow for wildcards and set
85
+ case sensitivity to use
86
+ """
87
+ model = QStringListModel()
88
+ self.filterModel = QSortFilterProxyModel(self.parent())
89
+ self.filterModel.setSourceModel(model)
90
+ self.filterModel.setFilterCaseSensitivity(self._sensitivity)
91
+ self.setModel(self.filterModel)
92
+ self.setCompletionMode(QCompleter.UnfilteredPopupCompletion)
93
+
94
+ def currentObject(self, scope=None, docMode=False):
95
+ if self._enabled:
96
+ word = self.textUnderCursor()
97
+
98
+ # determine if we are in docMode or not
99
+ if word.endswith('(') and not docMode:
100
+ return (None, '')
101
+
102
+ word = word.rstrip('(')
103
+ split = word.split('.')
104
+
105
+ # make sure there is more than 1 item for this symbol
106
+ if len(split) > 1 or docMode:
107
+ if not docMode:
108
+ symbol = '.'.join(split[:-1])
109
+ prefix = split[-1]
110
+ else:
111
+ symbol = word
112
+ prefix = ''
113
+
114
+ # try to evaluate the object to pull out the keys
115
+ object = None
116
+ try:
117
+ object = eval(symbol, scope)
118
+ except Exception:
119
+ pass
120
+
121
+ if object is None:
122
+ if symbol in sys.modules:
123
+ object = sys.modules[symbol]
124
+
125
+ return (object, prefix)
126
+ return (None, '')
127
+
128
+ def enabled(self):
129
+ return self._enabled
130
+
131
+ def hideDocumentation(self):
132
+ QToolTip.hideText()
133
+
134
+ def refreshList(self, scope=None):
135
+ """refreshes the string list based on the cursor word"""
136
+ object, prefix = self.currentObject(scope)
137
+
138
+ # Only show hidden method/variable names if the hidden character '_' is typed
139
+ # in.
140
+ try:
141
+ if prefix.startswith('_'):
142
+ keys = [key for key in dir(object) if key.startswith('_')]
143
+ else:
144
+ keys = [key for key in dir(object) if not key.startswith('_')]
145
+ except AttributeError:
146
+ keys = []
147
+ keys.sort()
148
+ self.model().sourceModel().setStringList(keys)
149
+
150
+ regExStr = ""
151
+ if self._completerMode == CompleterMode.STARTS_WITH:
152
+ regExStr = "^{}.*".format(prefix)
153
+ if self._completerMode == CompleterMode.OUTER_FUZZY:
154
+ regExStr = ".*{}.*".format(prefix)
155
+ if self._completerMode == CompleterMode.FULL_FUZZY:
156
+ regExStr = ".*".join(prefix)
157
+
158
+ regexp = QRegExp(regExStr, self._sensitivity)
159
+ self.filterModel.setFilterRegExp(regexp)
160
+
161
+ def clear(self):
162
+ self.popup().hide()
163
+ self.hideDocumentation()
164
+
165
+ self.wasCompletingCounter = 0
166
+ self.wasCompleting = False
167
+
168
+ def showDocumentation(self, pos=None, scope=None):
169
+ # hide the existing popup widget
170
+ self.popup().hide()
171
+
172
+ # create the default position
173
+ if pos is None:
174
+ pos = QCursor.pos()
175
+
176
+ # collect the object
177
+ object, prefix = self.currentObject(scope, docMode=True)
178
+
179
+ # not all objects allow `if object`, so catch any errors
180
+ # Specifically, numpy arrays fail with ValueError here
181
+ try:
182
+ if object:
183
+ docs = inspect.getdoc(object)
184
+ if docs:
185
+ QToolTip.showText(pos, docs)
186
+ except Exception:
187
+ pass
188
+
189
+ def setEnabled(self, state):
190
+ self._enabled = state
191
+
192
+ def textUnderCursor(self, useParens=False):
193
+ """pulls out the text underneath the cursor of this items widget"""
194
+
195
+ cursor = self.widget().textCursor()
196
+ cursor.select(QTextCursor.WordUnderCursor)
197
+
198
+ # grab the selected word
199
+ word = cursor.selectedText()
200
+ block = cursor.block().text()
201
+
202
+ # lookup previous words using '.'
203
+ pos = cursor.position() - cursor.block().position() - len(word) - 1
204
+
205
+ while -1 < pos:
206
+ char = block[pos]
207
+ if not re.match(r"^[a-zA-Z0-9_\.\(\)'\"]$", char):
208
+ break
209
+ word = char + word
210
+ pos -= 1
211
+
212
+ # If the word starts with a opening parentheses, remove it if there is not a
213
+ # matching closing one.
214
+ if word and word[0] == '(':
215
+ count = 0
216
+ # use a simple instance count to check if the opening parentheses is closed
217
+ for char in word:
218
+ if char == '(':
219
+ count += 1
220
+ elif char == ')':
221
+ count -= 1
222
+ if count:
223
+ # the opening parentheses is not closed, remove it
224
+ word = word[1:]
225
+
226
+ return str(word)