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
@@ -1,236 +1,226 @@
1
- ##
2
- # \namespace blurapi.gui.windows.loggerwindow.completer
3
- #
4
- # \remarks Custom Python completer for the logger
5
- #
6
- # \author beta@blur.com
7
- # \author Blur Studio
8
- # \date 01/15/08
9
- #
10
-
11
- from __future__ import absolute_import
12
- import inspect
13
- import re
14
- import sys
15
-
16
- from enum import Enum
17
-
18
- from Qt.QtCore import Qt, QRegExp, QSortFilterProxyModel, QStringListModel
19
- from Qt.QtGui import QCursor, QTextCursor
20
- from Qt.QtWidgets import QCompleter, QToolTip
21
-
22
-
23
- class CompleterMode(Enum):
24
- """
25
- Enum which defines the available Completer Modes
26
-
27
- STARTS_WITH - (Default) Matches completions which start with the typed input
28
- regex = "^SampleInput.*"
29
- OUTER_FUZZY - Matches completions which contain, but don't necessarily
30
- start with, the typed input
31
- regex = ".*SampleInput.*"
32
- FULL_FUZZY - Matches completions which contain the characters of the typed input,
33
- in order, regardless of other characters intermixed
34
- regex = ".*S.*a.*m.*p.*l.*e.*I.*n.*p.*u.*t.*"
35
-
36
- Matches respect case-sensitivity, which is set separately
37
- """
38
-
39
- STARTS_WITH = 0
40
- OUTER_FUZZY = 1
41
- FULL_FUZZY = 2
42
-
43
- def displayName(self):
44
- return self.name.replace('_', ' ').title()
45
-
46
- def toolTip(self):
47
- toolTipMap = {
48
- 'STARTS_WITH': "'all' matches 'allowtabs', does not match 'findallnames'",
49
- 'OUTER_FUZZY': "'all' matches 'getallobjs', does not match 'anylonglist'",
50
- 'FULL_FUZZY': "'all' matches 'getallobjs', also matches 'anylonglist'",
51
- }
52
- return toolTipMap.get(self.name, "")
53
-
54
-
55
- class PythonCompleter(QCompleter):
56
- def __init__(self, widget):
57
- super(QCompleter, self).__init__(widget)
58
-
59
- # use the python model for information
60
-
61
- self._enabled = True
62
-
63
- # update this completer
64
- self.setWidget(widget)
65
-
66
- self.setCaseSensitive()
67
- self.setCompleterMode()
68
- self.buildCompleter()
69
-
70
- self.wasCompleting = False
71
- self.wasCompletingCounter = 0
72
- self.wasCompletingCounterMax = 1
73
-
74
- def setCaseSensitive(self, caseSensitive=True):
75
- """Set case sensitivity for completions"""
76
- self._sensitivity = Qt.CaseSensitive if caseSensitive else Qt.CaseInsensitive
77
- self.buildCompleter()
78
-
79
- def caseSensitive(self):
80
- """Return current case sensitivity state for completions"""
81
- caseSensitive = self._sensitivity == Qt.CaseSensitive
82
- return caseSensitive
83
-
84
- def setCompleterMode(self, completerMode=CompleterMode.STARTS_WITH):
85
- """Set completer mode"""
86
- self._completerMode = completerMode
87
-
88
- def completerMode(self):
89
- """Return current completer mode"""
90
- return self._completerMode
91
-
92
- def buildCompleter(self):
93
- """
94
- Build the completer to allow for wildcards and set
95
- case sensitivity to use
96
- """
97
- model = QStringListModel()
98
- self.filterModel = QSortFilterProxyModel(self.parent())
99
- self.filterModel.setSourceModel(model)
100
- self.filterModel.setFilterCaseSensitivity(self._sensitivity)
101
- self.setModel(self.filterModel)
102
- self.setCompletionMode(QCompleter.UnfilteredPopupCompletion)
103
-
104
- def currentObject(self, scope=None, docMode=False):
105
- if self._enabled:
106
- word = self.textUnderCursor()
107
-
108
- # determine if we are in docMode or not
109
- if word.endswith('(') and not docMode:
110
- return (None, '')
111
-
112
- word = word.rstrip('(')
113
- split = word.split('.')
114
-
115
- # make sure there is more than 1 item for this symbol
116
- if len(split) > 1 or docMode:
117
- if not docMode:
118
- symbol = '.'.join(split[:-1])
119
- prefix = split[-1]
120
- else:
121
- symbol = word
122
- prefix = ''
123
-
124
- # try to evaluate the object to pull out the keys
125
- object = None
126
- try:
127
- object = eval(symbol, scope)
128
- except Exception:
129
- pass
130
-
131
- if object is None:
132
- if symbol in sys.modules:
133
- object = sys.modules[symbol]
134
-
135
- return (object, prefix)
136
- return (None, '')
137
-
138
- def enabled(self):
139
- return self._enabled
140
-
141
- def hideDocumentation(self):
142
- QToolTip.hideText()
143
-
144
- def refreshList(self, scope=None):
145
- """refreshes the string list based on the cursor word"""
146
- object, prefix = self.currentObject(scope)
147
-
148
- # Only show hidden method/variable names if the hidden character '_' is typed
149
- # in.
150
- try:
151
- if prefix.startswith('_'):
152
- keys = [key for key in dir(object) if key.startswith('_')]
153
- else:
154
- keys = [key for key in dir(object) if not key.startswith('_')]
155
- except AttributeError:
156
- keys = []
157
- keys.sort()
158
- self.model().sourceModel().setStringList(keys)
159
-
160
- regExStr = ""
161
- if self._completerMode == CompleterMode.STARTS_WITH:
162
- regExStr = "^{}.*".format(prefix)
163
- if self._completerMode == CompleterMode.OUTER_FUZZY:
164
- regExStr = ".*{}.*".format(prefix)
165
- if self._completerMode == CompleterMode.FULL_FUZZY:
166
- regExStr = ".*".join(prefix)
167
-
168
- regexp = QRegExp(regExStr, self._sensitivity)
169
- self.filterModel.setFilterRegExp(regexp)
170
-
171
- def clear(self):
172
- self.popup().hide()
173
- self.hideDocumentation()
174
-
175
- self.wasCompletingCounter = 0
176
- self.wasCompleting = False
177
-
178
- def showDocumentation(self, pos=None, scope=None):
179
- # hide the existing popup widget
180
- self.popup().hide()
181
-
182
- # create the default position
183
- if pos is None:
184
- pos = QCursor.pos()
185
-
186
- # collect the object
187
- object, prefix = self.currentObject(scope, docMode=True)
188
-
189
- # not all objects allow `if object`, so catch any errors
190
- # Specifically, numpy arrays fail with ValueError here
191
- try:
192
- if object:
193
- docs = inspect.getdoc(object)
194
- if docs:
195
- QToolTip.showText(pos, docs)
196
- except Exception:
197
- pass
198
-
199
- def setEnabled(self, state):
200
- self._enabled = state
201
-
202
- def textUnderCursor(self, useParens=False):
203
- """pulls out the text underneath the cursor of this items widget"""
204
-
205
- cursor = self.widget().textCursor()
206
- cursor.select(QTextCursor.WordUnderCursor)
207
-
208
- # grab the selected word
209
- word = cursor.selectedText()
210
- block = cursor.block().text()
211
-
212
- # lookup previous words using '.'
213
- pos = cursor.position() - cursor.block().position() - len(word) - 1
214
-
215
- while -1 < pos:
216
- char = block[pos]
217
- if not re.match(r"^[a-zA-Z0-9_\.\(\)'\"]$", char):
218
- break
219
- word = char + word
220
- pos -= 1
221
-
222
- # If the word starts with a opening parentheses, remove it if there is not a
223
- # matching closing one.
224
- if word and word[0] == '(':
225
- count = 0
226
- # use a simple instance count to check if the opening parentheses is closed
227
- for char in word:
228
- if char == '(':
229
- count += 1
230
- elif char == ')':
231
- count -= 1
232
- if count:
233
- # the opening parentheses is not closed, remove it
234
- word = word[1:]
235
-
236
- return str(word)
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)