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.
Files changed (179) hide show
  1. preditor/__init__.py +315 -0
  2. preditor/__main__.py +13 -0
  3. preditor/about_module.py +165 -0
  4. preditor/cli.py +192 -0
  5. preditor/config.py +318 -0
  6. preditor/constants.py +13 -0
  7. preditor/contexts.py +210 -0
  8. preditor/cores/__init__.py +0 -0
  9. preditor/cores/core.py +20 -0
  10. preditor/dccs/.hab.json +10 -0
  11. preditor/dccs/maya/PrEditor_maya.mod +1 -0
  12. preditor/dccs/maya/README.md +22 -0
  13. preditor/dccs/maya/plug-ins/PrEditor_maya.py +141 -0
  14. preditor/dccs/studiomax/PackageContents.xml +32 -0
  15. preditor/dccs/studiomax/PrEditor-PrEditor_Show.mcr +8 -0
  16. preditor/dccs/studiomax/README.md +17 -0
  17. preditor/dccs/studiomax/preditor.ms +16 -0
  18. preditor/dccs/studiomax/preditor_menu.mnx +7 -0
  19. preditor/debug.py +149 -0
  20. preditor/delayable_engine/__init__.py +302 -0
  21. preditor/delayable_engine/delayables.py +85 -0
  22. preditor/enum.py +728 -0
  23. preditor/excepthooks.py +165 -0
  24. preditor/gui/__init__.py +56 -0
  25. preditor/gui/app.py +163 -0
  26. preditor/gui/codehighlighter.py +289 -0
  27. preditor/gui/completer.py +237 -0
  28. preditor/gui/console.py +605 -0
  29. preditor/gui/console_base.py +911 -0
  30. preditor/gui/dialog.py +181 -0
  31. preditor/gui/drag_tab_bar.py +625 -0
  32. preditor/gui/editor_chooser.py +57 -0
  33. preditor/gui/errordialog.py +69 -0
  34. preditor/gui/find_files.py +137 -0
  35. preditor/gui/fuzzy_search/__init__.py +0 -0
  36. preditor/gui/fuzzy_search/fuzzy_search.py +97 -0
  37. preditor/gui/group_tab_widget/__init__.py +0 -0
  38. preditor/gui/group_tab_widget/group_tab_widget.py +528 -0
  39. preditor/gui/group_tab_widget/grouped_tab_menu.py +35 -0
  40. preditor/gui/group_tab_widget/grouped_tab_models.py +107 -0
  41. preditor/gui/group_tab_widget/grouped_tab_widget.py +223 -0
  42. preditor/gui/group_tab_widget/one_tab_widget.py +96 -0
  43. preditor/gui/level_buttons.py +358 -0
  44. preditor/gui/logger_window_handler.py +77 -0
  45. preditor/gui/logger_window_plugin.py +35 -0
  46. preditor/gui/loggerwindow.py +2405 -0
  47. preditor/gui/newtabwidget.py +69 -0
  48. preditor/gui/output_console.py +11 -0
  49. preditor/gui/qtdesigner/__init__.py +21 -0
  50. preditor/gui/qtdesigner/_log_plugin.py +29 -0
  51. preditor/gui/qtdesigner/console_base_plugin.py +48 -0
  52. preditor/gui/qtdesigner/console_predit_plugin.py +48 -0
  53. preditor/gui/set_text_editor_path_dialog.py +61 -0
  54. preditor/gui/status_label.py +99 -0
  55. preditor/gui/suggest_path_quotes_dialog.py +50 -0
  56. preditor/gui/ui/editor_chooser.ui +93 -0
  57. preditor/gui/ui/errordialog.ui +74 -0
  58. preditor/gui/ui/find_files.ui +140 -0
  59. preditor/gui/ui/loggerwindow.ui +1909 -0
  60. preditor/gui/ui/set_text_editor_path_dialog.ui +189 -0
  61. preditor/gui/ui/suggest_path_quotes_dialog.ui +225 -0
  62. preditor/gui/window.py +161 -0
  63. preditor/gui/workbox_mixin.py +1139 -0
  64. preditor/gui/workbox_text_edit.py +136 -0
  65. preditor/gui/workboxwidget.py +315 -0
  66. preditor/logging_config.py +55 -0
  67. preditor/osystem.py +401 -0
  68. preditor/plugins.py +118 -0
  69. preditor/prefs.py +381 -0
  70. preditor/resource/environment_variables.html +26 -0
  71. preditor/resource/error_mail.html +85 -0
  72. preditor/resource/error_mail_inline.html +41 -0
  73. preditor/resource/img/README.md +17 -0
  74. preditor/resource/img/arrow_forward.png +0 -0
  75. preditor/resource/img/check-bold.png +0 -0
  76. preditor/resource/img/chevron-down.png +0 -0
  77. preditor/resource/img/chevron-up.png +0 -0
  78. preditor/resource/img/close-thick.png +0 -0
  79. preditor/resource/img/comment-edit.png +0 -0
  80. preditor/resource/img/content-copy.png +0 -0
  81. preditor/resource/img/content-cut.png +0 -0
  82. preditor/resource/img/content-duplicate.png +0 -0
  83. preditor/resource/img/content-paste.png +0 -0
  84. preditor/resource/img/content-save.png +0 -0
  85. preditor/resource/img/debug_disabled.png +0 -0
  86. preditor/resource/img/eye-check.png +0 -0
  87. preditor/resource/img/file-plus.png +0 -0
  88. preditor/resource/img/file-remove.png +0 -0
  89. preditor/resource/img/format-align-left.png +0 -0
  90. preditor/resource/img/format-letter-case-lower.png +0 -0
  91. preditor/resource/img/format-letter-case-upper.png +0 -0
  92. preditor/resource/img/format-letter-case.svg +1 -0
  93. preditor/resource/img/information.png +0 -0
  94. preditor/resource/img/logging_critical.png +0 -0
  95. preditor/resource/img/logging_custom.png +0 -0
  96. preditor/resource/img/logging_debug.png +0 -0
  97. preditor/resource/img/logging_error.png +0 -0
  98. preditor/resource/img/logging_info.png +0 -0
  99. preditor/resource/img/logging_not_set.png +0 -0
  100. preditor/resource/img/logging_warning.png +0 -0
  101. preditor/resource/img/marker.png +0 -0
  102. preditor/resource/img/play.png +0 -0
  103. preditor/resource/img/playlist-play.png +0 -0
  104. preditor/resource/img/plus-minus-variant.png +0 -0
  105. preditor/resource/img/preditor.ico +0 -0
  106. preditor/resource/img/preditor.png +0 -0
  107. preditor/resource/img/preditor.psd +0 -0
  108. preditor/resource/img/preditor.svg +44 -0
  109. preditor/resource/img/regex.svg +1 -0
  110. preditor/resource/img/restart.svg +1 -0
  111. preditor/resource/img/skip-forward-outline.png +0 -0
  112. preditor/resource/img/skip-next-outline.png +0 -0
  113. preditor/resource/img/skip-next.png +0 -0
  114. preditor/resource/img/skip-previous.png +0 -0
  115. preditor/resource/img/subdirectory-arrow-right.png +0 -0
  116. preditor/resource/img/text-search-variant.png +0 -0
  117. preditor/resource/img/warning-big.png +0 -0
  118. preditor/resource/lang/python.json +30 -0
  119. preditor/resource/pref_updates/pref_updates.json +17 -0
  120. preditor/resource/settings.ini +25 -0
  121. preditor/resource/stylesheet/Bright.css +76 -0
  122. preditor/resource/stylesheet/Dark.css +210 -0
  123. preditor/scintilla/__init__.py +40 -0
  124. preditor/scintilla/delayables/__init__.py +11 -0
  125. preditor/scintilla/delayables/smart_highlight.py +97 -0
  126. preditor/scintilla/delayables/spell_check.py +174 -0
  127. preditor/scintilla/documenteditor.py +1924 -0
  128. preditor/scintilla/finddialog.py +68 -0
  129. preditor/scintilla/lang/__init__.py +80 -0
  130. preditor/scintilla/lang/config/bash.ini +15 -0
  131. preditor/scintilla/lang/config/batch.ini +14 -0
  132. preditor/scintilla/lang/config/cpp.ini +19 -0
  133. preditor/scintilla/lang/config/css.ini +19 -0
  134. preditor/scintilla/lang/config/eyeonscript.ini +17 -0
  135. preditor/scintilla/lang/config/html.ini +21 -0
  136. preditor/scintilla/lang/config/javascript.ini +24 -0
  137. preditor/scintilla/lang/config/lua.ini +16 -0
  138. preditor/scintilla/lang/config/maxscript.ini +20 -0
  139. preditor/scintilla/lang/config/mel.ini +18 -0
  140. preditor/scintilla/lang/config/mu.ini +22 -0
  141. preditor/scintilla/lang/config/nsi.ini +19 -0
  142. preditor/scintilla/lang/config/perl.ini +19 -0
  143. preditor/scintilla/lang/config/puppet.ini +19 -0
  144. preditor/scintilla/lang/config/python.ini +28 -0
  145. preditor/scintilla/lang/config/ruby.ini +19 -0
  146. preditor/scintilla/lang/config/sql.ini +7 -0
  147. preditor/scintilla/lang/config/xml.ini +21 -0
  148. preditor/scintilla/lang/config/yaml.ini +18 -0
  149. preditor/scintilla/lang/language.py +240 -0
  150. preditor/scintilla/lexers/__init__.py +0 -0
  151. preditor/scintilla/lexers/cpplexer.py +22 -0
  152. preditor/scintilla/lexers/javascriptlexer.py +27 -0
  153. preditor/scintilla/lexers/maxscriptlexer.py +235 -0
  154. preditor/scintilla/lexers/mellexer.py +369 -0
  155. preditor/scintilla/lexers/mulexer.py +33 -0
  156. preditor/scintilla/lexers/pythonlexer.py +42 -0
  157. preditor/scintilla/ui/finddialog.ui +160 -0
  158. preditor/settings.py +71 -0
  159. preditor/stream/__init__.py +72 -0
  160. preditor/stream/console_handler.py +169 -0
  161. preditor/stream/director.py +144 -0
  162. preditor/stream/manager.py +97 -0
  163. preditor/streamhandler_helper.py +46 -0
  164. preditor/utils/__init__.py +191 -0
  165. preditor/utils/call_stack.py +86 -0
  166. preditor/utils/cute.py +106 -0
  167. preditor/utils/stylesheets.py +54 -0
  168. preditor/utils/text_search.py +338 -0
  169. preditor/version.py +34 -0
  170. preditor/weakref.py +363 -0
  171. preditor-2.1.0.dist-info/METADATA +308 -0
  172. preditor-2.1.0.dist-info/RECORD +179 -0
  173. preditor-2.1.0.dist-info/WHEEL +5 -0
  174. preditor-2.1.0.dist-info/entry_points.txt +19 -0
  175. preditor-2.1.0.dist-info/licenses/LICENSE +165 -0
  176. preditor-2.1.0.dist-info/top_level.txt +3 -0
  177. tests/encodings/test_ecoding.py +33 -0
  178. tests/find_files/test_find_files.py +74 -0
  179. tests/ide/test_delayable_engine.py +171 -0
@@ -0,0 +1,69 @@
1
+ from __future__ import absolute_import
2
+
3
+ import os
4
+ import traceback
5
+
6
+ from Qt.QtCore import Qt
7
+ from Qt.QtGui import QColor, QPixmap
8
+
9
+ from .. import __file__ as pfile
10
+ from ..utils.cute import QtPropertyInit
11
+ from . import Dialog, loadUi
12
+
13
+
14
+ class ErrorDialog(Dialog):
15
+ # These Qt Properties can be customized using style sheets.
16
+ errorMessageColor = QtPropertyInit('_errorMessageColor', QColor(Qt.GlobalColor.red))
17
+
18
+ def __init__(self, parent):
19
+ super(ErrorDialog, self).__init__(parent)
20
+
21
+ loadUi(__file__, self)
22
+
23
+ self.parent_ = parent
24
+ self.setWindowTitle('Error Occurred')
25
+ self.uiErrorLBL.setTextFormat(Qt.TextFormat.RichText)
26
+ self.uiIconLBL.setPixmap(
27
+ QPixmap(
28
+ os.path.join(
29
+ os.path.dirname(pfile),
30
+ 'resource',
31
+ 'img',
32
+ 'warning-big.png',
33
+ )
34
+ ).scaledToHeight(64, Qt.TransformationMode.SmoothTransformation)
35
+ )
36
+
37
+ self.uiLoggerBTN.clicked.connect(self.show_logger)
38
+ self.uiIgnoreBTN.clicked.connect(self.close)
39
+
40
+ def setText(self, exc_info):
41
+ self.traceback_msg = "".join(traceback.format_exception(*exc_info))
42
+ msg = (
43
+ 'The following error has occurred:<br>'
44
+ '<br><font color=%(color)s>%(text)s</font>'
45
+ )
46
+ self.uiErrorLBL.setText(
47
+ msg
48
+ % {
49
+ 'text': self.traceback_msg.split('\n')[-2],
50
+ 'color': self.errorMessageColor.name(),
51
+ }
52
+ )
53
+
54
+ def show_logger(self):
55
+ """Create/show the main PrEditor instance with the full traceback."""
56
+ from .. import launch
57
+
58
+ launch()
59
+ self.close()
60
+
61
+ @classmethod
62
+ def show_prompt(cls, *exc_info):
63
+ """Return False to this dialog should not be shown on an exception.
64
+
65
+ This is useful for applications like Nuke which uses exceptions to signal
66
+ traditionally non-exception worthy events, such as when a user cancels
67
+ an Open File dialog window.
68
+ """
69
+ return True
@@ -0,0 +1,137 @@
1
+ from __future__ import absolute_import, print_function
2
+
3
+ from Qt.QtCore import Qt, Slot
4
+ from Qt.QtGui import QIcon, QKeySequence
5
+ from Qt.QtWidgets import QApplication, QShortcut, QWidget
6
+
7
+ from .. import resourcePath
8
+ from ..utils.text_search import RegexTextSearch, SimpleTextSearch
9
+ from . import loadUi
10
+
11
+
12
+ class FindFiles(QWidget):
13
+ def __init__(self, parent=None, managers=None, console=None):
14
+ super(FindFiles, self).__init__(parent=parent)
15
+ if managers is None:
16
+ managers = []
17
+ self.managers = managers
18
+ self.console = console
19
+ self.finder = None
20
+ self.match_files_count = 0
21
+
22
+ loadUi(__file__, self)
23
+
24
+ # Set the icons
25
+ self.uiCaseSensitiveBTN.setIcon(
26
+ QIcon(resourcePath("img/format-letter-case.svg"))
27
+ )
28
+ self.uiCloseBTN.setIcon(QIcon(resourcePath('img/close-thick.png')))
29
+ self.uiRegexBTN.setIcon(QIcon(resourcePath("img/regex.svg")))
30
+
31
+ # Create shortcuts
32
+ self.uiCloseSCT = QShortcut(
33
+ QKeySequence(Qt.Key.Key_Escape),
34
+ self,
35
+ context=Qt.ShortcutContext.WidgetWithChildrenShortcut,
36
+ )
37
+
38
+ self.uiCloseSCT.activated.connect(self.hide)
39
+
40
+ self.uiCaseSensitiveSCT = QShortcut(
41
+ QKeySequence(Qt.KeyboardModifier.AltModifier | Qt.Key.Key_C),
42
+ self,
43
+ context=Qt.ShortcutContext.WidgetWithChildrenShortcut,
44
+ )
45
+ self.uiCaseSensitiveSCT.activated.connect(self.uiCaseSensitiveBTN.toggle)
46
+
47
+ self.uiRegexSCT = QShortcut(
48
+ QKeySequence(Qt.KeyboardModifier.AltModifier | Qt.Key.Key_R),
49
+ self,
50
+ context=Qt.ShortcutContext.WidgetWithChildrenShortcut,
51
+ )
52
+ self.uiRegexSCT.activated.connect(self.uiRegexBTN.toggle)
53
+
54
+ def activate(self):
55
+ """Called to make this widget ready for the user to interact with."""
56
+ self.show()
57
+ self.uiFindTXT.setFocus()
58
+
59
+ @Slot()
60
+ def find(self):
61
+ find_text = self.uiFindTXT.text()
62
+ context = self.uiContextSPN.value()
63
+ # Create an instance of the TextSearch to use for this search
64
+ if self.uiRegexBTN.isChecked():
65
+ TextSearch = RegexTextSearch
66
+ else:
67
+ TextSearch = SimpleTextSearch
68
+ self.finder = TextSearch(
69
+ find_text, self.uiCaseSensitiveBTN.isChecked(), context=context
70
+ )
71
+ self.finder.callback_matching = self.insert_found_text
72
+ self.finder.callback_non_matching = self.insert_text
73
+
74
+ # Start fresh output line.
75
+ window = self.parent().window() if self.parent() else None
76
+ if window:
77
+ window.console().startPrompt("")
78
+
79
+ self.insert_text(self.finder.title())
80
+
81
+ self.match_files_count = 0
82
+ for manager in self.managers:
83
+ for (
84
+ editor,
85
+ group_name,
86
+ tab_name,
87
+ _group_index,
88
+ _tab_index,
89
+ ) in manager.all_widgets():
90
+ path = "/".join((group_name, tab_name))
91
+ self.find_in_editor(editor, path)
92
+
93
+ self.insert_text(
94
+ '\n{} matches in {} workboxes\n'.format(
95
+ self.finder.match_count, self.match_files_count
96
+ )
97
+ )
98
+
99
+ # If user has Auto-prompt chosen, do so now.
100
+ if window:
101
+ if window.uiAutoPromptCHK.isChecked():
102
+ window.console().startInputLine()
103
+
104
+ def find_in_editor(self, editor, path):
105
+ # Ensure the editor text is loaded and get its raw text
106
+ editor.__show__()
107
+ text = editor.__text__()
108
+ workbox_name = editor.__workbox_name__()
109
+
110
+ # Use the finder to check for matches
111
+ found = self.finder.search_text(text, path, workbox_name)
112
+ if found:
113
+ self.match_files_count += 1
114
+
115
+ def insert_found_text(self, text, workbox_id, line_num, tool_tip):
116
+ href = ', {}, {}'.format(workbox_id, line_num)
117
+ cursor = self.console.textCursor()
118
+ # Insert hyperlink
119
+ fmt = cursor.charFormat()
120
+ fmt.setAnchor(True)
121
+ fmt.setAnchorHref(href)
122
+ fmt.setFontUnderline(True)
123
+ fmt.setToolTip(tool_tip)
124
+ cursor.insertText(text, fmt)
125
+ # Show the updated text output
126
+ QApplication.instance().processEvents()
127
+
128
+ def insert_text(self, text):
129
+ cursor = self.console.textCursor()
130
+ fmt = cursor.charFormat()
131
+ fmt.setAnchor(False)
132
+ fmt.setAnchorHref('')
133
+ fmt.setFontUnderline(False)
134
+ fmt.setToolTip('')
135
+ cursor.insertText(text, fmt)
136
+ # Show the updated text output
137
+ QApplication.instance().processEvents()
File without changes
@@ -0,0 +1,97 @@
1
+ from __future__ import absolute_import
2
+
3
+ from functools import partial
4
+
5
+ from Qt.QtCore import QModelIndex, QPoint, Qt, Signal
6
+ from Qt.QtWidgets import QFrame, QLineEdit, QListView, QShortcut, QVBoxLayout
7
+
8
+ from ..group_tab_widget.grouped_tab_models import GroupTabFuzzyFilterProxyModel
9
+
10
+
11
+ class FuzzySearch(QFrame):
12
+ canceled = Signal("QModelIndex")
13
+ """Passes the original QModelIndex for the tab that was selected when the
14
+ widget was first shown. This lets you reset back to the orignal state."""
15
+ highlighted = Signal("QModelIndex")
16
+ """Emitted when the user navitages to the given index, but hasn't selected."""
17
+ selected = Signal("QModelIndex")
18
+ """Emitted when the user selects a item."""
19
+
20
+ def __init__(self, model, parent=None, **kwargs):
21
+ super(FuzzySearch, self).__init__(parent=parent, **kwargs)
22
+ self.y_offset = 100
23
+ self.setMinimumSize(400, 200)
24
+ self.uiCloseSCT = QShortcut(
25
+ Qt.Key.Key_Escape,
26
+ self,
27
+ context=Qt.ShortcutContext.WidgetWithChildrenShortcut,
28
+ )
29
+ self.uiCloseSCT.activated.connect(self._canceled)
30
+
31
+ self.uiUpSCT = QShortcut(
32
+ Qt.Key.Key_Up, self, context=Qt.ShortcutContext.WidgetWithChildrenShortcut
33
+ )
34
+ self.uiUpSCT.activated.connect(partial(self.increment_selection, -1))
35
+ self.uiDownSCT = QShortcut(
36
+ Qt.Key.Key_Down, self, context=Qt.ShortcutContext.WidgetWithChildrenShortcut
37
+ )
38
+ self.uiDownSCT.activated.connect(partial(self.increment_selection, 1))
39
+
40
+ lyt = QVBoxLayout(self)
41
+ self.uiLineEDIT = QLineEdit(parent=self)
42
+ self.uiLineEDIT.textChanged.connect(self.update_completer)
43
+ self.uiLineEDIT.returnPressed.connect(self.activated)
44
+ lyt.addWidget(self.uiLineEDIT)
45
+ self.uiResultsLIST = QListView(self)
46
+ self.uiResultsLIST.activated.connect(self.activated)
47
+ self.proxy_model = GroupTabFuzzyFilterProxyModel(self)
48
+ self.proxy_model.setSourceModel(model)
49
+ self.uiResultsLIST.setModel(self.proxy_model)
50
+ lyt.addWidget(self.uiResultsLIST)
51
+
52
+ self.original_model_index = model.original_model_index
53
+
54
+ def activated(self):
55
+ current = self.uiResultsLIST.currentIndex()
56
+ self.selected.emit(current)
57
+ self.hide()
58
+
59
+ def increment_selection(self, direction):
60
+ current = self.uiResultsLIST.currentIndex()
61
+ col = 0
62
+ row = 0
63
+ if current.isValid():
64
+ col = current.column()
65
+ row = current.row() + direction
66
+ new = self.uiResultsLIST.model().index(row, col)
67
+ self.uiResultsLIST.setCurrentIndex(new)
68
+ self.highlighted.emit(new)
69
+
70
+ def update_completer(self, wildcard):
71
+ if wildcard:
72
+ if not self.uiResultsLIST.currentIndex().isValid():
73
+ new = self.uiResultsLIST.model().index(0, 0)
74
+ self.uiResultsLIST.setCurrentIndex(new)
75
+ else:
76
+ self.uiResultsLIST.clearSelection()
77
+ self.uiResultsLIST.setCurrentIndex(QModelIndex())
78
+ self.proxy_model.setFuzzySearch(wildcard)
79
+ self.highlighted.emit(self.uiResultsLIST.currentIndex())
80
+
81
+ def _canceled(self):
82
+ # Restore the original tab as the user didn't choose the new tab
83
+ self.canceled.emit(self.original_model_index)
84
+ self.hide()
85
+
86
+ def reposition(self):
87
+ pgeo = self.parent().geometry()
88
+ geo = self.geometry()
89
+ center = QPoint(pgeo.width() // 2, 0)
90
+ geo.moveCenter(center)
91
+ geo.setY(self.y_offset)
92
+ self.setGeometry(geo)
93
+
94
+ def popup(self):
95
+ self.show()
96
+ self.reposition()
97
+ self.uiLineEDIT.setFocus(Qt.FocusReason.PopupFocusReason)
File without changes