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.

Files changed (363) hide show
  1. PrEditor-0.1.0.dist-info/LICENSE +165 -0
  2. PrEditor-0.1.0.dist-info/METADATA +212 -0
  3. PrEditor-0.1.0.dist-info/RECORD +149 -0
  4. {PrEditor-0.0.0.dev1.dist-info → PrEditor-0.1.0.dist-info}/WHEEL +1 -1
  5. PrEditor-0.1.0.dist-info/entry_points.txt +18 -0
  6. PrEditor-0.1.0.dist-info/top_level.txt +1 -0
  7. preditor/__init__.py +301 -0
  8. {blurdev → preditor}/__main__.py +13 -13
  9. preditor/about_module.py +166 -0
  10. preditor/cli.py +192 -0
  11. {blurdev → preditor}/contexts.py +119 -119
  12. preditor/cores/core.py +65 -0
  13. preditor/dccs/maya/PrEditor_maya.mod +2 -0
  14. preditor/dccs/maya/plug-ins/PrEditor_maya.py +108 -0
  15. preditor/debug.py +294 -0
  16. blurdev/scintilla/delayable_engine.py → preditor/delayable_engine/__init__.py +310 -299
  17. blurdev/scintilla/delayables/base.py → preditor/delayable_engine/delayables.py +85 -85
  18. {blurdev → preditor}/enum.py +728 -1003
  19. {blurdev → preditor}/gui/__init__.py +84 -125
  20. preditor/gui/app.py +159 -0
  21. {blurdev → preditor}/gui/codehighlighter.py +209 -219
  22. {blurdev → preditor}/gui/completer.py +226 -236
  23. {blurdev → preditor}/gui/console.py +801 -858
  24. {blurdev → preditor}/gui/dialog.py +200 -216
  25. preditor/gui/drag_tab_bar.py +190 -0
  26. preditor/gui/editor_chooser.py +57 -0
  27. {blurdev → preditor}/gui/errordialog.py +100 -97
  28. preditor/gui/fuzzy_search/fuzzy_search.py +93 -0
  29. preditor/gui/group_tab_widget/__init__.py +319 -0
  30. preditor/gui/group_tab_widget/grouped_tab_menu.py +35 -0
  31. preditor/gui/group_tab_widget/grouped_tab_models.py +108 -0
  32. preditor/gui/group_tab_widget/grouped_tab_widget.py +75 -0
  33. preditor/gui/group_tab_widget/one_tab_widget.py +54 -0
  34. preditor/gui/level_buttons.py +349 -0
  35. {blurdev → preditor}/gui/logger_window_handler.py +46 -45
  36. {blurdev → preditor}/gui/loggerwindow.py +1205 -1417
  37. {blurdev → preditor}/gui/newtabwidget.py +69 -68
  38. {blurdev → preditor}/gui/redmine_login_dialog.py +63 -61
  39. {blurdev → preditor}/gui/set_text_editor_path_dialog.py +59 -57
  40. preditor/gui/ui/editor_chooser.ui +93 -0
  41. {blurdev → preditor}/gui/ui/errordialog.ui +81 -81
  42. {blurdev → preditor}/gui/ui/loggerwindow.ui +1030 -864
  43. {blurdev → preditor}/gui/ui/redmine_login_dialog.ui +124 -124
  44. {blurdev → preditor}/gui/ui/set_text_editor_path_dialog.ui +149 -149
  45. {blurdev → preditor}/gui/window.py +183 -199
  46. preditor/gui/workbox_mixin.py +357 -0
  47. preditor/gui/workbox_text_edit.py +117 -0
  48. preditor/gui/workboxwidget.py +276 -0
  49. preditor/logging_config.py +52 -0
  50. preditor/osystem.py +401 -0
  51. preditor/plugins.py +65 -0
  52. preditor/prefs.py +74 -0
  53. {blurdev → preditor}/resource/environment_variables.html +26 -38
  54. {blurdev → preditor}/resource/error_mail.html +85 -85
  55. {blurdev → preditor}/resource/error_mail_inline.html +41 -41
  56. preditor/resource/img/README.md +7 -0
  57. preditor/resource/img/arrow_forward.png +0 -0
  58. preditor/resource/img/check-bold.png +0 -0
  59. preditor/resource/img/chevron-down.png +0 -0
  60. preditor/resource/img/chevron-up.png +0 -0
  61. preditor/resource/img/close-thick.png +0 -0
  62. preditor/resource/img/comment-edit.png +0 -0
  63. preditor/resource/img/content-copy.png +0 -0
  64. preditor/resource/img/content-cut.png +0 -0
  65. preditor/resource/img/content-duplicate.png +0 -0
  66. preditor/resource/img/content-paste.png +0 -0
  67. preditor/resource/img/content-save.png +0 -0
  68. preditor/resource/img/debug_disabled.png +0 -0
  69. preditor/resource/img/eye-check.png +0 -0
  70. preditor/resource/img/file-plus.png +0 -0
  71. preditor/resource/img/file-remove.png +0 -0
  72. preditor/resource/img/format-align-left.png +0 -0
  73. preditor/resource/img/format-letter-case-lower.png +0 -0
  74. preditor/resource/img/format-letter-case-upper.png +0 -0
  75. preditor/resource/img/information.png +0 -0
  76. preditor/resource/img/logging_critical.png +0 -0
  77. preditor/resource/img/logging_custom.png +0 -0
  78. preditor/resource/img/logging_debug.png +0 -0
  79. preditor/resource/img/logging_error.png +0 -0
  80. preditor/resource/img/logging_info.png +0 -0
  81. preditor/resource/img/logging_not_set.png +0 -0
  82. preditor/resource/img/logging_warning.png +0 -0
  83. preditor/resource/img/marker.png +0 -0
  84. preditor/resource/img/play.png +0 -0
  85. preditor/resource/img/playlist-play.png +0 -0
  86. preditor/resource/img/plus-minus-variant.png +0 -0
  87. preditor/resource/img/preditor.ico +0 -0
  88. preditor/resource/img/preditor.png +0 -0
  89. preditor/resource/img/preditor.psd +0 -0
  90. preditor/resource/img/preditor.svg +44 -0
  91. preditor/resource/img/restart.svg +1 -0
  92. preditor/resource/img/skip-forward-outline.png +0 -0
  93. preditor/resource/img/skip-next-outline.png +0 -0
  94. preditor/resource/img/skip-next.png +0 -0
  95. preditor/resource/img/skip-previous.png +0 -0
  96. preditor/resource/img/subdirectory-arrow-right.png +0 -0
  97. preditor/resource/img/text-search-variant.png +0 -0
  98. {blurdev → preditor}/resource/lang/python.json +30 -30
  99. preditor/resource/settings.ini +25 -0
  100. {blurdev/resource/stylesheet/logger → preditor/resource/stylesheet}/Bright.css +56 -61
  101. {blurdev → preditor}/resource/stylesheet/Dark.css +190 -132
  102. {blurdev → preditor}/scintilla/__init__.py +22 -28
  103. preditor/scintilla/delayables/__init__.py +11 -0
  104. {blurdev → preditor}/scintilla/delayables/smart_highlight.py +94 -93
  105. {blurdev → preditor}/scintilla/delayables/spell_check.py +173 -172
  106. {blurdev → preditor}/scintilla/documenteditor.py +2039 -2115
  107. {blurdev → preditor}/scintilla/finddialog.py +68 -81
  108. {blurdev → preditor}/scintilla/lang/__init__.py +80 -93
  109. {blurdev → preditor}/scintilla/lang/config/bash.ini +15 -15
  110. {blurdev → preditor}/scintilla/lang/config/batch.ini +14 -14
  111. {blurdev → preditor}/scintilla/lang/config/cpp.ini +19 -19
  112. {blurdev → preditor}/scintilla/lang/config/css.ini +19 -19
  113. {blurdev → preditor}/scintilla/lang/config/eyeonscript.ini +17 -17
  114. {blurdev → preditor}/scintilla/lang/config/html.ini +21 -21
  115. {blurdev → preditor}/scintilla/lang/config/javascript.ini +24 -24
  116. {blurdev → preditor}/scintilla/lang/config/lua.ini +16 -16
  117. {blurdev → preditor}/scintilla/lang/config/maxscript.ini +20 -20
  118. {blurdev → preditor}/scintilla/lang/config/mel.ini +18 -18
  119. {blurdev → preditor}/scintilla/lang/config/mu.ini +22 -22
  120. {blurdev → preditor}/scintilla/lang/config/nsi.ini +5 -5
  121. {blurdev → preditor}/scintilla/lang/config/perl.ini +19 -19
  122. {blurdev → preditor}/scintilla/lang/config/puppet.ini +19 -19
  123. {blurdev → preditor}/scintilla/lang/config/python.ini +28 -28
  124. {blurdev → preditor}/scintilla/lang/config/ruby.ini +19 -19
  125. {blurdev → preditor}/scintilla/lang/config/sql.ini +7 -7
  126. {blurdev → preditor}/scintilla/lang/config/xml.ini +21 -21
  127. {blurdev → preditor}/scintilla/lang/config/yaml.ini +18 -18
  128. {blurdev → preditor}/scintilla/lang/language.py +240 -250
  129. preditor/scintilla/lexers/__init__.py +0 -0
  130. {blurdev → preditor}/scintilla/lexers/cpplexer.py +21 -30
  131. {blurdev → preditor}/scintilla/lexers/javascriptlexer.py +25 -34
  132. {blurdev → preditor}/scintilla/lexers/maxscriptlexer.py +234 -253
  133. {blurdev → preditor}/scintilla/lexers/mellexer.py +368 -376
  134. {blurdev → preditor}/scintilla/lexers/mulexer.py +32 -41
  135. {blurdev → preditor}/scintilla/lexers/pythonlexer.py +41 -50
  136. {blurdev → preditor}/scintilla/ui/finddialog.ui +160 -160
  137. preditor/settings.py +71 -0
  138. preditor/stream/__init__.py +80 -0
  139. preditor/stream/director.py +56 -0
  140. preditor/stream/manager.py +74 -0
  141. preditor/streamhandler_helper.py +46 -0
  142. preditor/utils/__init__.py +0 -0
  143. preditor/utils/cute.py +30 -0
  144. preditor/utils/stylesheets.py +54 -0
  145. {blurdev → preditor}/version.py +5 -5
  146. preditor/weakref.py +363 -0
  147. PrEditor-0.0.0.dev1.dist-info/METADATA +0 -51
  148. PrEditor-0.0.0.dev1.dist-info/RECORD +0 -279
  149. PrEditor-0.0.0.dev1.dist-info/top_level.txt +0 -1
  150. blurdev/__init__.py +0 -356
  151. blurdev/cores/__init__.py +0 -98
  152. blurdev/cores/application.py +0 -26
  153. blurdev/cores/core.py +0 -634
  154. blurdev/debug.py +0 -593
  155. blurdev/external.py +0 -391
  156. blurdev/gui/level_buttons.py +0 -585
  157. blurdev/gui/workboxwidget.py +0 -205
  158. blurdev/logger.py +0 -238
  159. blurdev/osystem.py +0 -813
  160. blurdev/prefs.py +0 -33
  161. blurdev/protocols/__init__.py +0 -71
  162. blurdev/protocols/write_std_output_handler.py +0 -83
  163. blurdev/resource/designer_plugins.xml +0 -9
  164. blurdev/resource/error_email_old.html +0 -41
  165. blurdev/resource/img/add.png +0 -0
  166. blurdev/resource/img/ajax-loader.gif +0 -0
  167. blurdev/resource/img/application.png +0 -0
  168. blurdev/resource/img/applications.png +0 -0
  169. blurdev/resource/img/assburner.png +0 -0
  170. blurdev/resource/img/assfreezer.png +0 -0
  171. blurdev/resource/img/bar.gif +0 -0
  172. blurdev/resource/img/blank.png +0 -0
  173. blurdev/resource/img/blurdev.png +0 -0
  174. blurdev/resource/img/calendar_disabled.png +0 -0
  175. blurdev/resource/img/calendar_enabled.png +0 -0
  176. blurdev/resource/img/cancel.png +0 -0
  177. blurdev/resource/img/custom.png +0 -0
  178. blurdev/resource/img/debug_high.png +0 -0
  179. blurdev/resource/img/debug_low.png +0 -0
  180. blurdev/resource/img/debug_mid.png +0 -0
  181. blurdev/resource/img/debug_off.png +0 -0
  182. blurdev/resource/img/django.png +0 -0
  183. blurdev/resource/img/doc.png +0 -0
  184. blurdev/resource/img/edit.png +0 -0
  185. blurdev/resource/img/elemental.png +0 -0
  186. blurdev/resource/img/explore.png +0 -0
  187. blurdev/resource/img/favorite.png +0 -0
  188. blurdev/resource/img/file.png +0 -0
  189. blurdev/resource/img/folder.png +0 -0
  190. blurdev/resource/img/ide/add.png +0 -0
  191. blurdev/resource/img/ide/add_note.png +0 -0
  192. blurdev/resource/img/ide/arrow_down.png +0 -0
  193. blurdev/resource/img/ide/arrow_up.png +0 -0
  194. blurdev/resource/img/ide/check.png +0 -0
  195. blurdev/resource/img/ide/class.png +0 -0
  196. blurdev/resource/img/ide/clean.png +0 -0
  197. blurdev/resource/img/ide/clearlog.png +0 -0
  198. blurdev/resource/img/ide/close.png +0 -0
  199. blurdev/resource/img/ide/comment_add.png +0 -0
  200. blurdev/resource/img/ide/comment_remove.png +0 -0
  201. blurdev/resource/img/ide/comment_toggle.png +0 -0
  202. blurdev/resource/img/ide/console.png +0 -0
  203. blurdev/resource/img/ide/copy.png +0 -0
  204. blurdev/resource/img/ide/copylstrip.png +0 -0
  205. blurdev/resource/img/ide/cut.png +0 -0
  206. blurdev/resource/img/ide/edit.png +0 -0
  207. blurdev/resource/img/ide/find.png +0 -0
  208. blurdev/resource/img/ide/find_replace.png +0 -0
  209. blurdev/resource/img/ide/findnext.png +0 -0
  210. blurdev/resource/img/ide/findprev.png +0 -0
  211. blurdev/resource/img/ide/folder_find.png +0 -0
  212. blurdev/resource/img/ide/function.png +0 -0
  213. blurdev/resource/img/ide/git-bash.png +0 -0
  214. blurdev/resource/img/ide/git-gui.png +0 -0
  215. blurdev/resource/img/ide/gitk.png +0 -0
  216. blurdev/resource/img/ide/goto.png +0 -0
  217. blurdev/resource/img/ide/goto_def.png +0 -0
  218. blurdev/resource/img/ide/help.png +0 -0
  219. blurdev/resource/img/ide/highlighter.png +0 -0
  220. blurdev/resource/img/ide/lowercase.png +0 -0
  221. blurdev/resource/img/ide/newfile.png +0 -0
  222. blurdev/resource/img/ide/newfolder.png +0 -0
  223. blurdev/resource/img/ide/newproject.png +0 -0
  224. blurdev/resource/img/ide/newwizard.png +0 -0
  225. blurdev/resource/img/ide/open.png +0 -0
  226. blurdev/resource/img/ide/paste.png +0 -0
  227. blurdev/resource/img/ide/pdb_continue.png +0 -0
  228. blurdev/resource/img/ide/pdb_down.png +0 -0
  229. blurdev/resource/img/ide/pdb_next.png +0 -0
  230. blurdev/resource/img/ide/pdb_step.png +0 -0
  231. blurdev/resource/img/ide/pdb_up.png +0 -0
  232. blurdev/resource/img/ide/plus_minus.png +0 -0
  233. blurdev/resource/img/ide/preferences.png +0 -0
  234. blurdev/resource/img/ide/project_find.png +0 -0
  235. blurdev/resource/img/ide/python.png +0 -0
  236. blurdev/resource/img/ide/pyular.png +0 -0
  237. blurdev/resource/img/ide/qt.png +0 -0
  238. blurdev/resource/img/ide/quit.png +0 -0
  239. blurdev/resource/img/ide/redo.png +0 -0
  240. blurdev/resource/img/ide/refresh.png +0 -0
  241. blurdev/resource/img/ide/remove.png +0 -0
  242. blurdev/resource/img/ide/ruler.png +0 -0
  243. blurdev/resource/img/ide/run.png +0 -0
  244. blurdev/resource/img/ide/runall.png +0 -0
  245. blurdev/resource/img/ide/runallclear.png +0 -0
  246. blurdev/resource/img/ide/runselected.png +0 -0
  247. blurdev/resource/img/ide/runselectedclear.png +0 -0
  248. blurdev/resource/img/ide/save.png +0 -0
  249. blurdev/resource/img/ide/saveas.png +0 -0
  250. blurdev/resource/img/ide/sdk.png +0 -0
  251. blurdev/resource/img/ide/separator.png +0 -0
  252. blurdev/resource/img/ide/tabbed.png +0 -0
  253. blurdev/resource/img/ide/tile.png +0 -0
  254. blurdev/resource/img/ide/toolbar.png +0 -0
  255. blurdev/resource/img/ide/undo.png +0 -0
  256. blurdev/resource/img/ide/uppercase.png +0 -0
  257. blurdev/resource/img/ide/view_as.png +0 -0
  258. blurdev/resource/img/ide/windowed.png +0 -0
  259. blurdev/resource/img/ide.ico +0 -0
  260. blurdev/resource/img/ide.png +0 -0
  261. blurdev/resource/img/ide48.png +0 -0
  262. blurdev/resource/img/info.png +0 -0
  263. blurdev/resource/img/legacy tool.png +0 -0
  264. blurdev/resource/img/library.png +0 -0
  265. blurdev/resource/img/logger/about.png +0 -0
  266. blurdev/resource/img/logger/arrow_forward.png +0 -0
  267. blurdev/resource/img/logger/clear.png +0 -0
  268. blurdev/resource/img/logger/close.png +0 -0
  269. blurdev/resource/img/logger/debug_disabled.png +0 -0
  270. blurdev/resource/img/logger/debug_high.png +0 -0
  271. blurdev/resource/img/logger/debug_low.png +0 -0
  272. blurdev/resource/img/logger/debug_mid.png +0 -0
  273. blurdev/resource/img/logger/down.png +0 -0
  274. blurdev/resource/img/logger/find.png +0 -0
  275. blurdev/resource/img/logger/logging_critical.png +0 -0
  276. blurdev/resource/img/logger/logging_debug.png +0 -0
  277. blurdev/resource/img/logger/logging_error.png +0 -0
  278. blurdev/resource/img/logger/logging_info.png +0 -0
  279. blurdev/resource/img/logger/logging_not_set.png +0 -0
  280. blurdev/resource/img/logger/logging_warning.png +0 -0
  281. blurdev/resource/img/logger/next.png +0 -0
  282. blurdev/resource/img/logger/play.png +0 -0
  283. blurdev/resource/img/logger/playlist_play.png +0 -0
  284. blurdev/resource/img/logger/previous.png +0 -0
  285. blurdev/resource/img/logger/return.png +0 -0
  286. blurdev/resource/img/logger/save.png +0 -0
  287. blurdev/resource/img/logger/subdirectory_arrow_right.png +0 -0
  288. blurdev/resource/img/logger/up.png +0 -0
  289. blurdev/resource/img/lovebar.png +0 -0
  290. blurdev/resource/img/new.png +0 -0
  291. blurdev/resource/img/new_selected.png +0 -0
  292. blurdev/resource/img/node.png +0 -0
  293. blurdev/resource/img/ok.png +0 -0
  294. blurdev/resource/img/options.png +0 -0
  295. blurdev/resource/img/packages.png +0 -0
  296. blurdev/resource/img/preview/add.png +0 -0
  297. blurdev/resource/img/preview/brush.png +0 -0
  298. blurdev/resource/img/preview/delete.png +0 -0
  299. blurdev/resource/img/preview/delte.png +0 -0
  300. blurdev/resource/img/preview/fill.png +0 -0
  301. blurdev/resource/img/preview/layers.png +0 -0
  302. blurdev/resource/img/preview/media.png +0 -0
  303. blurdev/resource/img/preview/navigate.png +0 -0
  304. blurdev/resource/img/preview/pencil.png +0 -0
  305. blurdev/resource/img/preview/select.png +0 -0
  306. blurdev/resource/img/preview/type.png +0 -0
  307. blurdev/resource/img/preview/visible.png +0 -0
  308. blurdev/resource/img/project.png +0 -0
  309. blurdev/resource/img/python_logger.ico +0 -0
  310. blurdev/resource/img/python_logger.png +0 -0
  311. blurdev/resource/img/refresh.png +0 -0
  312. blurdev/resource/img/remove.png +0 -0
  313. blurdev/resource/img/reset.png +0 -0
  314. blurdev/resource/img/richtext/font_bold.png +0 -0
  315. blurdev/resource/img/richtext/font_italic.png +0 -0
  316. blurdev/resource/img/richtext/link_image.png +0 -0
  317. blurdev/resource/img/richtext/spell_check.png +0 -0
  318. blurdev/resource/img/richtext/unordered_list.png +0 -0
  319. blurdev/resource/img/save.png +0 -0
  320. blurdev/resource/img/savesettings.png +0 -0
  321. blurdev/resource/img/settings.png +0 -0
  322. blurdev/resource/img/tool.png +0 -0
  323. blurdev/resource/img/toolbarHandleHorizontal.png +0 -0
  324. blurdev/resource/img/toolbarHandleVertical.png +0 -0
  325. blurdev/resource/img/trash.png +0 -0
  326. blurdev/resource/img/trax.png +0 -0
  327. blurdev/resource/img/tree.png +0 -0
  328. blurdev/resource/img/treegrunt.ico +0 -0
  329. blurdev/resource/img/treegrunt.png +0 -0
  330. blurdev/resource/img/treegruntedit.png +0 -0
  331. blurdev/resource/img/user interface.png +0 -0
  332. blurdev/resource/img/warning.png +0 -0
  333. blurdev/resource/img/watermark.png +0 -0
  334. blurdev/resource/sdk/blurdev.sdk +0 -3
  335. blurdev/resource/settings.ini +0 -82
  336. blurdev/resource/softimage/BlurApplication.dll +0 -0
  337. blurdev/resource/softimage/BlurApplication64.dll +0 -0
  338. blurdev/resource/stylesheet/Carbon.css +0 -35
  339. blurdev/resource/stylesheet/logger/Dark.css +0 -62
  340. blurdev/resource/templ/py_comment.templ +0 -1
  341. blurdev/resource/templ/py_debug_raise_error.templ +0 -7
  342. blurdev/resource/templ/py_doc_string.templ +0 -10
  343. blurdev/resource/templ/py_header.templ +0 -9
  344. blurdev/resource/templ/py_line_comment.templ +0 -1
  345. blurdev/resource/templ/py_log_to_file.templ +0 -22
  346. blurdev/resource/templ/py_module_path.templ +0 -1
  347. blurdev/resource/templ/py_pyqt_core.templ +0 -1
  348. blurdev/resource/templ/py_pyqt_gui.templ +0 -1
  349. blurdev/resource/templ/py_splashscreen.templ +0 -6
  350. blurdev/resource/templ/py_testing_note.templ +0 -1
  351. blurdev/resource/templ/py_testing_note_end.templ +0 -1
  352. blurdev/resource/tools_environments.json +0 -72
  353. blurdev/resource/tools_environments.xml +0 -11
  354. blurdev/resource/tools_environments_linux.xml +0 -11
  355. blurdev/resource/tools_environments_offline.xml +0 -7
  356. blurdev/runtimes/__init__.py +0 -2
  357. blurdev/runtimes/logger.py +0 -44
  358. blurdev/scintilla/delayables/__init__.py +0 -9
  359. blurdev/settings.py +0 -312
  360. blurdev/utils/error.py +0 -389
  361. {blurdev/scintilla/lexers → preditor/cores}/__init__.py +0 -0
  362. {blurdev/utils → preditor/gui/fuzzy_search}/__init__.py +0 -0
  363. {blurdev → preditor}/resource/img/warning-big.png +0 -0
preditor/__init__.py ADDED
@@ -0,0 +1,301 @@
1
+ from __future__ import absolute_import, print_function
2
+
3
+ import logging # noqa: E402
4
+ import os # noqa: E402
5
+ import sys # noqa: E402
6
+
7
+ from Qt.QtCore import Qt # noqa: E402
8
+
9
+ from . import osystem # noqa: E402
10
+ from .plugins import Plugins # noqa: E402
11
+ from .version import version as __version__ # noqa: E402,F401
12
+
13
+ DEFAULT_CORE_NAME = "PrEditor"
14
+ """The default name to use for the core name."""
15
+
16
+ _global_config = {}
17
+
18
+ core = None # create a managed Core instance
19
+ """
20
+ The blurdev managed :class:`Core` object from the :mod:`blurdev.cores` module.
21
+ """
22
+
23
+ # Create the root blurdev module logging object.
24
+ _logger = logging.getLogger(__name__)
25
+
26
+ # Add a NullHandler to suppress the "No handlers could be found for _logger"
27
+ # warnings from being printed to stderr. Studiomax and possibly other DCC's
28
+ # tend to treat any text written to stderr as a error when running headless.
29
+ # We also don't want this warning showing up in production anyway.
30
+ _logger.addHandler(logging.NullHandler())
31
+
32
+ plugins = Plugins()
33
+
34
+
35
+ def about_preditor(instance=None):
36
+ """Useful info about installed packages generated by plugins.
37
+
38
+ Args:
39
+ instance (LoggerWindow, optional): Used by the AboutModule plugins
40
+ to access the current instance of a Preditor GUI.
41
+ """
42
+ from .about_module import AboutModule
43
+
44
+ return AboutModule.generate(instance=instance)
45
+
46
+
47
+ def init():
48
+ os.environ['BDEV_EMAILINFO_PREDITOR_VERSION'] = __version__
49
+ pythonw_print_bugfix()
50
+ global core
51
+ # create the core
52
+ if not core:
53
+ from .cores.core import Core
54
+
55
+ objectName = None
56
+ _exe = os.path.basename(sys.executable).lower()
57
+ # Treat designer as a seperate core so it gets its own prefrences.
58
+ if 'designer' in _exe:
59
+ objectName = 'designer'
60
+ elif 'assfreezer' in _exe:
61
+ objectName = 'assfreezer'
62
+ core = Core(objectName=objectName)
63
+
64
+ for plugin in plugins.initialize():
65
+ plugin()
66
+
67
+
68
+ def configure(name, parent_callback=None, excepthook=True, logging=True, streams=True):
69
+ """Global configuration of PrEditor. Nothing is done if called more than once.
70
+
71
+ Args:
72
+ name (str): The core_name to use for the global instance of PrEditor.
73
+ Once this has been set, you can call `launch` without passing name
74
+ to access the main instance.
75
+ parent_callback (callable, optional): Callback that returns a QWidget
76
+ to use as the parent of the LoggerWindow when its first created.
77
+ This can be used by DCC's to set the parent to their main window.
78
+ excepthook (bool, optional): Replaces `sys.excepthook` with a interactive
79
+ exception handler that prompts the user to show PrEditor when an
80
+ python exception is raised.
81
+ logging (bool, optional): Restore the python logging configuration that
82
+ was recorded the last time PrEditor prefs were saved.
83
+ streams (bool, optional): Install the stream manager to capture any
84
+ stdout/stderr text written. Later when calling launch, the
85
+ LoggerWindow will show all of the captured text. This lets you only
86
+ create the LoggerWindow IF you need to, but when you do it will have
87
+ all of the std stream text written after this call.
88
+ """
89
+ # Once this has been set, configure should not do anything
90
+ if 'core_name' in _global_config:
91
+ return
92
+
93
+ # Store the core_name,.
94
+ _global_config['core_name'] = name
95
+ if parent_callback:
96
+ _global_config['parent_callback'] = parent_callback
97
+
98
+ if streams:
99
+ # Install the stream manager to capture output
100
+ from preditor.stream import install_to_std
101
+
102
+ install_to_std()
103
+
104
+ if logging:
105
+ from .logging_config import LoggingConfig
106
+
107
+ cfg = LoggingConfig(core_name=name)
108
+ cfg.load()
109
+
110
+ if excepthook:
111
+ import preditor.debug
112
+
113
+ preditor.debug.BlurExcepthook.install()
114
+
115
+
116
+ def launch(run_workbox=False, app_id=None, name=None, standalone=False):
117
+ """Launches the preditor gui creating the QApplication instance if not
118
+ already created.
119
+
120
+ Args:
121
+ modal (bool, optional): If True, preditor's gui will be created as a
122
+ modal window (ie. blocks current code execution while its shown).
123
+ run_workbox (bool, optional): After preditor's gui is shown, run its
124
+ current workbox text.
125
+ app_id (str, optional): Set the QApplication's applicationName to this
126
+ value. This is normally only used when launching a standalone
127
+ instance of the PrEditor gui.
128
+ standalone (bool, optional): Launch PrEditor in standalone mode. This
129
+ enables extra options that only make sense when it is running as
130
+ its own app, not inside of another app.
131
+
132
+ Returns:
133
+ preditor.gui.loggerwindow.LoggerWindow: The instance of the PrEditor
134
+ gui that was created.
135
+ """
136
+ if name is None:
137
+ # If the name wasn't passed we will get it from the name stored when
138
+ # configure was called.
139
+ if 'core_name' not in _global_config:
140
+ raise RuntimeError(
141
+ "You call configure before calling launch if not passing name"
142
+ )
143
+ name = _global_config['core_name']
144
+ else:
145
+ # A name was provided, call configure to ensure it has been called
146
+ configure(name=name)
147
+
148
+ from .gui.app import App
149
+ from .gui.loggerwindow import LoggerWindow
150
+
151
+ # Check if we can actually run the PrEditor gui and setup Qt if required
152
+ app = App(name=app_id)
153
+ widget = LoggerWindow.instance(
154
+ run_workbox=run_workbox, name=name, standalone=standalone
155
+ )
156
+
157
+ # Show the PrEditor instance and make sure it regains focus and visibility
158
+ widget.show()
159
+ # If the instance was already shown, raise it to the top and make
160
+ # it regain focus.
161
+ widget.activateWindow()
162
+ widget.raise_()
163
+ widget.setWindowState(widget.windowState() & ~Qt.WindowMinimized | Qt.WindowActive)
164
+ widget.console().setFocus()
165
+ app.start()
166
+
167
+ return widget
168
+
169
+
170
+ def prefPath(relpath, coreName=''):
171
+ # use the core
172
+ if not coreName and core:
173
+ coreName = core.objectName()
174
+ basepath = os.path.join(
175
+ osystem.expandvars(os.environ['BDEV_PATH_PREFS']), 'app_%s/' % coreName
176
+ )
177
+ return os.path.normpath(os.path.join(basepath, relpath))
178
+
179
+
180
+ def pythonw_print_bugfix():
181
+ """
182
+ When running pythonw print statements and file handles tend to have problems
183
+ so, if its pythonw and stderr and stdout haven't been redirected, redirect them
184
+ to os.devnull.
185
+ """
186
+ if os.path.basename(sys.executable) == 'pythonw.exe':
187
+ if sys.stdout == sys.__stdout__:
188
+ sys.stdout = open(os.devnull, 'w')
189
+ if sys.stderr == sys.__stderr__:
190
+ sys.stderr = open(os.devnull, 'w')
191
+
192
+
193
+ def relativePath(path, additional=''):
194
+ """
195
+ Replaces the last element in the path with the passed in additional path.
196
+ :param path: Source path. Generally a file name.
197
+ :param additional: Additional folder/file path appended to the path.
198
+ :return str: The modified path
199
+ """
200
+ return os.path.join(os.path.dirname(path), additional)
201
+
202
+
203
+ def resourcePath(relpath=''):
204
+ """Returns the full path to the file inside the preditor/resource folder
205
+
206
+ Args:
207
+ relpath (str, optional): The additional path added to the
208
+ preditor/resource folder path.
209
+
210
+ Returns:
211
+ str: The modified path
212
+ """
213
+ return os.path.join(relativePath(__file__), 'resource', relpath)
214
+
215
+
216
+ def root_window():
217
+ # If a parent widget callback was configured, use it
218
+ if 'parent_callback' in _global_config:
219
+ return _global_config['parent_callback']()
220
+
221
+ # Otherwise, attempt to find the top level widget from Qt
222
+ from .gui.app import App
223
+
224
+ return App.root_window()
225
+
226
+
227
+ def connect_preditor(
228
+ parent, sequence='F2', text='Show PrEditor', obj_name='uiShowPreditorACT', name=None
229
+ ):
230
+ """Creates a QAction that shows the PrEditor gui with a keyboard shortcut.
231
+ This will automatically call `preditor.configure` if name is provided,
232
+ capturing any `sys.stdout` and `sys.stderr` writes after this call. This does
233
+ not initialize the PrEditor gui instance until the action is actually called.
234
+
235
+ Args:
236
+ parent: The parent widget, normally a window
237
+ sequence (str, optional): A string representing the keyboard shortcut
238
+ associated with the QAction.
239
+ text (str, optional): The display text for the QAction.
240
+ obj_name (str, optional): Set the QAction's objectName to this value.
241
+
242
+ Returns:
243
+ QAction: The created QAction
244
+ """
245
+ from Qt.QtGui import QKeySequence
246
+ from Qt.QtWidgets import QAction
247
+
248
+ if name:
249
+ # Set the core_name if provided
250
+ configure(name)
251
+
252
+ # Create shortcut for launching the PrEditor gui.
253
+ action = QAction(text, parent)
254
+ action.setObjectName(obj_name)
255
+ action.triggered.connect(launch)
256
+ action.setShortcut(QKeySequence(sequence))
257
+ parent.addAction(action)
258
+ return action
259
+
260
+
261
+ def instance(parent=None, run_workbox=False, create=True):
262
+ """Returns the existing instance of the PrEditor gui creating it on first call.
263
+
264
+ Args:
265
+ parent (QWidget, optional): If the instance hasn't been created yet, create
266
+ it and parent it to this object.
267
+ run_workbox (bool, optional): If the instance hasn't been created yet, this
268
+ will execute the active workbox's code once fully initialized.
269
+ create (bool, optional): Returns None if the instance has not been created.
270
+
271
+ Returns:
272
+ Returns a fully initialized instance of the PrEditor gui. If called more
273
+ than once, the same instance will be returned. If create is False, it may
274
+ return None.
275
+ """
276
+ from .gui.loggerwindow import LoggerWindow
277
+
278
+ return LoggerWindow.instance(parent=parent, run_workbox=run_workbox, create=create)
279
+
280
+
281
+ def shutdown():
282
+ """Fully close and cleanup the PrEditor gui if it was created.
283
+
284
+ Call this when shutting down your application to ensure any unsaved changes
285
+ to the PrEditor gui are saved and the instance is actually closed instead
286
+ of just hidden.
287
+
288
+ If the PrEditor gui was never created, this does nothing so its safe to call
289
+ even if the user never showed the gui. It also won't add extra time creating
290
+ the gui just so it can "save any changes".
291
+
292
+ Returns:
293
+ bool: If a shutdown was required
294
+ """
295
+ from .gui.loggerwindow import LoggerWindow
296
+
297
+ return LoggerWindow.instance_shutdown()
298
+
299
+
300
+ # initialize the core
301
+ init()
@@ -1,13 +1,13 @@
1
- """ Enables support for calling the blurdev cli using `python -m blurdev`
2
- """
3
-
4
- from __future__ import absolute_import
5
-
6
- import sys
7
- import blurdev.cli
8
-
9
- if __name__ == '__main__':
10
- # prog_name prevents __main__.py from being shown as the command name in the help
11
- # text. We don't know the exact command the user passed so we provide a generic
12
- # `python -m blurdev` command.
13
- sys.exit(blurdev.cli.main(prog_name="python -m blurdev"))
1
+ """ Enables support for calling the preditor cli using `python -m preditor`
2
+ """
3
+ from __future__ import absolute_import
4
+
5
+ import sys
6
+
7
+ import preditor.cli
8
+
9
+ if __name__ == '__main__':
10
+ # prog_name prevents __main__.py from being shown as the command name in the help
11
+ # text. We don't know the exact command the user passed so we provide a generic
12
+ # `python -m preditor` command.
13
+ sys.exit(preditor.cli.cli(prog_name="python -m preditor"))
@@ -0,0 +1,166 @@
1
+ from __future__ import absolute_import
2
+
3
+ import abc
4
+ import os
5
+ import sys
6
+ import textwrap
7
+
8
+ import six
9
+ from future.utils import with_metaclass
10
+
11
+ import preditor
12
+
13
+
14
+ class AboutModule(with_metaclass(abc.ABCMeta, object)):
15
+ """Base class for the `preditor.plug.about_module` entry point. Create a
16
+ subclass of this method and expose the class object to the entry point.
17
+
18
+ Properties:
19
+ instance: If provided, the instance of PrEditor to generate text for.
20
+ """
21
+
22
+ indent = " "
23
+ """Use this to indent new lines for text"""
24
+
25
+ def __init__(self, instance=None):
26
+ self.instance = instance
27
+
28
+ @classmethod
29
+ def generate(cls, instance=None):
30
+ """Generates the output text for all plugins.
31
+
32
+ Outputs this for each plugin:
33
+
34
+ {name}: {version}
35
+ {indent}{text line 1}
36
+ {indent}{text line ...}
37
+
38
+ Name is the name of each entry point. If duplicates are found, a logging
39
+ warning is generated. Each line of `self.text()` is indented
40
+ """
41
+ ret = []
42
+ for name, plugin in preditor.plugins.about_module():
43
+ version = "Unknown"
44
+ if isinstance(plugin, str):
45
+ text = plugin
46
+ else:
47
+ try:
48
+ plug = plugin(instance=instance)
49
+ if not plug.enabled():
50
+ continue
51
+ version = plug.version()
52
+ text = plug.text()
53
+ except Exception as error:
54
+ text = "Error processing: {}".format(error)
55
+ if six.PY3:
56
+ text = textwrap.indent(text, cls.indent)
57
+ else:
58
+ text = ['{}{}'.format(cls.indent, line) for line in text.split('\n')]
59
+ text = "\n".join(text)
60
+
61
+ # Build the output string including the version information if provided.
62
+ if version is not None:
63
+ ret.append("{}: {}\n{}".format(name, version, text))
64
+ else:
65
+ ret.append("{}:\n{}".format(name, text))
66
+
67
+ return '\n'.join(ret)
68
+
69
+ def enabled(self):
70
+ """The plugin can use this to disable reporting by generate."""
71
+ return True
72
+
73
+ @abc.abstractmethod
74
+ def text(self):
75
+ """Returns info about this plugin. This can have multiple lines, and
76
+ each line will be indented to provide visual distinction between plugins.
77
+ """
78
+
79
+ @abc.abstractmethod
80
+ def version(self):
81
+ """Returns The version as a string to show next to name."""
82
+
83
+
84
+ class AboutPreditor(AboutModule):
85
+ """About module used to show info about PrEditor."""
86
+
87
+ def text(self):
88
+ """Return the path PrEditor was loaded from for quick debugging."""
89
+ ret = []
90
+ # Include the core_name of the current PrEditor gui instance if possible
91
+ if self.instance:
92
+ ret.append("Core Name: {}".format(self.instance.name))
93
+ # THe path to the PrEditor package
94
+ ret.append("Path: {}".format(os.path.dirname(preditor.__file__)))
95
+ return "\n".join(ret)
96
+
97
+ def version(self):
98
+ return preditor.__version__
99
+
100
+
101
+ class AboutQt(AboutModule):
102
+ """Info about Qt modules being used."""
103
+
104
+ def text(self):
105
+ """Return the path PrEditor was loaded from for quick debugging."""
106
+ from Qt import QtCore, __binding__, __version__
107
+
108
+ ret = ['Qt.py: {}, binding: {}'.format(__version__, __binding__)]
109
+
110
+ # Attempt to get a version for QtSiteConfig if defined
111
+ try:
112
+ import QtSiteConfig
113
+
114
+ ret.append('QtSiteConfig: {}'.format(QtSiteConfig.__version__))
115
+ except (ImportError, AttributeError):
116
+ pass
117
+
118
+ # Add info for all Qt5 bindings that have been imported
119
+ if 'PyQt5.QtCore' in sys.modules:
120
+ ret.append('PyQt5: {}'.format(sys.modules['PyQt5.QtCore'].PYQT_VERSION_STR))
121
+ if 'PySide2.QtCore' in sys.modules:
122
+ ret.append('PySide2: {}'.format(sys.modules['PySide2.QtCore'].qVersion()))
123
+
124
+ # Add qt library paths for plugin debugging
125
+ for i, path in enumerate(QtCore.QCoreApplication.libraryPaths()):
126
+ if i == 0:
127
+ ret.append('Library Paths: {}'.format(path))
128
+ else:
129
+ ret.append(' {}'.format(path))
130
+
131
+ return "\n".join(ret)
132
+
133
+ def version(self):
134
+ from Qt import __qt_version__
135
+
136
+ return __qt_version__
137
+
138
+
139
+ class AboutPython(AboutModule):
140
+ """Info about the current instance of python."""
141
+
142
+ def text(self):
143
+ """Return the path PrEditor was loaded from for quick debugging."""
144
+ ret = sys.version
145
+ # Windows doesn't add a newline before the compiler info, and it can end
146
+ # up being a little long for QMessageBox's with short file paths. Add
147
+ # the newline like is present on linux
148
+ ret = ret.replace(") [", ")\n[")
149
+ return ret
150
+
151
+ def version(self):
152
+ return '{}.{}.{}'.format(*sys.version_info[:3])
153
+
154
+
155
+ class AboutExe(AboutModule):
156
+ """The value of sys.executable, disabled if not set."""
157
+
158
+ def enabled(self):
159
+ return bool(sys.executable)
160
+
161
+ def text(self):
162
+ return sys.executable
163
+
164
+ def version(self):
165
+ """No version is returned for this class."""
166
+ return None
preditor/cli.py ADDED
@@ -0,0 +1,192 @@
1
+ from __future__ import absolute_import
2
+
3
+ import logging
4
+ import sys
5
+ from distutils.spawn import find_executable
6
+
7
+ import click
8
+ from click.core import ParameterSource
9
+ from click_default_group import DefaultGroup
10
+
11
+ import preditor
12
+ import preditor.prefs
13
+ from preditor.settings import OS_TYPE
14
+
15
+ # No one wants to actually type `--help`
16
+ CONTEXT_SETTINGS = dict(help_option_names=["-h", "--help"])
17
+
18
+ logger = logging.getLogger(__name__)
19
+
20
+
21
+ def get_app_id(name, is_default):
22
+ """Returns the name to use for the app_id of windows shortcuts.
23
+ This allows for taskbar/start menu pinning.
24
+ """
25
+ if is_default:
26
+ # If not using a custom name, just use it for the app_id
27
+ return name
28
+ # Otherwise use a prefix of the name provided by the user
29
+ return "PrEditor - {}".format(name)
30
+
31
+
32
+ @click.group(
33
+ cls=DefaultGroup,
34
+ default='launch',
35
+ default_if_no_args=True,
36
+ context_settings=CONTEXT_SETTINGS,
37
+ )
38
+ def cli():
39
+ """PrEditor is a Qt based python console and code editor. It runs in many
40
+ DCC's like Maya, Houdini, Nuke, and 3ds Max.
41
+
42
+ To see help for launching the PrEditor gui, use `preditor launch -h`.
43
+ """
44
+ pass
45
+
46
+
47
+ # launch
48
+ @cli.command()
49
+ @click.option(
50
+ "-n",
51
+ "--name",
52
+ default=preditor.DEFAULT_CORE_NAME,
53
+ envvar="PREDITOR_NAME",
54
+ help="Name to save preferences with. This allows you to open multiple "
55
+ "instances with their own code and settings.",
56
+ )
57
+ @click.option(
58
+ '-r',
59
+ '--run-workbox',
60
+ is_flag=True,
61
+ help='After the logger is shown, run the current workbox text.',
62
+ )
63
+ def launch(name, run_workbox):
64
+ """Run the PrEditor console's gui."""
65
+ # Check if the user passed the name or it was the default
66
+ parameter_source = click.get_current_context().get_parameter_source('name')
67
+ app_id = get_app_id(name, parameter_source == ParameterSource.DEFAULT)
68
+
69
+ preditor.launch(run_workbox=run_workbox, app_id=app_id, name=name, standalone=True)
70
+
71
+
72
+ # shortcut
73
+ @cli.command()
74
+ @click.argument("path")
75
+ @click.option(
76
+ "-p",
77
+ "--public",
78
+ is_flag=True,
79
+ help='If using "start-menu" or "desktop" for path, create the shortcut '
80
+ 'in the public location not the user location. This may require '
81
+ 'administrative privileges.',
82
+ )
83
+ @click.option(
84
+ "-n",
85
+ "--name",
86
+ default=preditor.DEFAULT_CORE_NAME,
87
+ envvar="PREDITOR_NAME",
88
+ help="Name to save preferences with. This allows you to open multiple "
89
+ "instances with their own code and settings.",
90
+ )
91
+ @click.option(
92
+ "--target",
93
+ default="preditorw",
94
+ help='The command the shortcut will run. "preditor" or "preditorw" are '
95
+ 'converted to the full path to the exe.',
96
+ )
97
+ @click.option(
98
+ '--args',
99
+ default="",
100
+ help="The command the shortcut will run.",
101
+ )
102
+ @click.option(
103
+ '--description',
104
+ default='Opens PrEditor',
105
+ help="The description to give the shortcut.",
106
+ )
107
+ def shortcut(path, public, name, target, args, description):
108
+ """Create a shortcut to launch PrEditor.
109
+
110
+ Path is a the full path of the shortcut to create. On windows you can
111
+ pass "start-menu" to create the shortcut in the start menu.
112
+ """
113
+
114
+ if OS_TYPE != "Windows":
115
+ click.echo("Creating a shortcut is currently only supported on Windows.")
116
+ sys.exit(1)
117
+
118
+ try:
119
+ from casement.shortcut import Shortcut
120
+ except ImportError:
121
+ click.echo(
122
+ "Unable to import casement use `pip install casement` to enable "
123
+ "creating shortcuts on windows."
124
+ )
125
+ sys.exit(1)
126
+
127
+ if path in ("desktop", "start-menu"):
128
+ path = [path]
129
+
130
+ # Resolve the full path to the preditor exe.
131
+ if target in ("preditor", "preditorw"):
132
+ target = find_executable(target)
133
+
134
+ parameter_source = click.get_current_context().get_parameter_source('name')
135
+ if parameter_source == ParameterSource.DEFAULT:
136
+ app_id = name
137
+ else:
138
+ # Strip off the leading "launch " command argument if it was passed
139
+ if args.startswith('launch '):
140
+ args = args[7:]
141
+ # Pass the name to the launched PrEditor instance
142
+ args = 'launch --name "{}" {}'.format(name, args)
143
+ app_id = name = get_app_id(name, parameter_source == ParameterSource.DEFAULT)
144
+
145
+ Shortcut.create(
146
+ name,
147
+ args,
148
+ target=target,
149
+ # icon=None,
150
+ icon_source=preditor.resourcePath('img/preditor.ico'),
151
+ icon_filename="preditor",
152
+ path=path,
153
+ description=description,
154
+ common=int(public),
155
+ app_id=app_id,
156
+ )
157
+
158
+
159
+ # prefs
160
+ @cli.group()
161
+ def prefs():
162
+ """PrEditor preference management."""
163
+ pass
164
+
165
+
166
+ @prefs.command()
167
+ def backup():
168
+ """Backup all of preferences inside a zip file."""
169
+ zip_path = preditor.prefs.backup()
170
+ click.echo('PrEditor Preferences backed up to "{}"'.format(zip_path))
171
+
172
+
173
+ @prefs.command()
174
+ @click.argument("name", default="", required=False)
175
+ def browse(name):
176
+ """Open a file explorer to the preference directory. Optionally pass the
177
+ name of a specific preference.
178
+ """
179
+ preditor.prefs.browse(name)
180
+
181
+
182
+ @prefs.command()
183
+ def list():
184
+ """List the core_names for existing preferences."""
185
+ click.echo("Existing pref names:")
186
+ click.echo("--------------------")
187
+ for pref in preditor.prefs.existing():
188
+ click.echo(pref)
189
+
190
+
191
+ if __name__ == '__main__':
192
+ cli()