wxPython 4.3.2__cp315-cp315-win_amd64.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 (472) hide show
  1. wx/WebView2Loader.dll +0 -0
  2. wx/__init__.py +22 -0
  3. wx/__init__.pyi +10 -0
  4. wx/__version__.py +9 -0
  5. wx/__version__.pyi +15 -0
  6. wx/_adv.cp315-win_amd64.pyd +0 -0
  7. wx/_aui.cp315-win_amd64.pyd +0 -0
  8. wx/_core.cp315-win_amd64.pyd +0 -0
  9. wx/_dataview.cp315-win_amd64.pyd +0 -0
  10. wx/_glcanvas.cp315-win_amd64.pyd +0 -0
  11. wx/_grid.cp315-win_amd64.pyd +0 -0
  12. wx/_html.cp315-win_amd64.pyd +0 -0
  13. wx/_html2.cp315-win_amd64.pyd +0 -0
  14. wx/_media.cp315-win_amd64.pyd +0 -0
  15. wx/_msw.cp315-win_amd64.pyd +0 -0
  16. wx/_propgrid.cp315-win_amd64.pyd +0 -0
  17. wx/_ribbon.cp315-win_amd64.pyd +0 -0
  18. wx/_richtext.cp315-win_amd64.pyd +0 -0
  19. wx/_stc.cp315-win_amd64.pyd +0 -0
  20. wx/_xml.cp315-win_amd64.pyd +0 -0
  21. wx/_xrc.cp315-win_amd64.pyd +0 -0
  22. wx/adv.py +127 -0
  23. wx/adv.pyi +5931 -0
  24. wx/aui.py +70 -0
  25. wx/aui.pyi +4805 -0
  26. wx/core.py +3417 -0
  27. wx/core.pyi +62949 -0
  28. wx/dataview.py +176 -0
  29. wx/dataview.pyi +3828 -0
  30. wx/gizmos.py +18 -0
  31. wx/glcanvas.py +13 -0
  32. wx/glcanvas.pyi +544 -0
  33. wx/grid.py +237 -0
  34. wx/grid.pyi +5678 -0
  35. wx/html.py +38 -0
  36. wx/html.pyi +3283 -0
  37. wx/html2.py +46 -0
  38. wx/html2.pyi +1301 -0
  39. wx/include/wxPython/sip.h +1938 -0
  40. wx/include/wxPython/wxpy_api.h +418 -0
  41. wx/lib/CDate.py +201 -0
  42. wx/lib/ClickableHtmlWindow.py +57 -0
  43. wx/lib/__init__.py +0 -0
  44. wx/lib/activex.py +178 -0
  45. wx/lib/activexwrapper.py +153 -0
  46. wx/lib/agw/__init__.py +128 -0
  47. wx/lib/agw/advancedsplash.py +563 -0
  48. wx/lib/agw/aquabutton.py +1127 -0
  49. wx/lib/agw/artmanager.py +2110 -0
  50. wx/lib/agw/aui/__init__.py +295 -0
  51. wx/lib/agw/aui/aui_constants.py +2616 -0
  52. wx/lib/agw/aui/aui_switcherdialog.py +1232 -0
  53. wx/lib/agw/aui/aui_utilities.py +648 -0
  54. wx/lib/agw/aui/auibar.py +4045 -0
  55. wx/lib/agw/aui/auibook.py +6288 -0
  56. wx/lib/agw/aui/dockart.py +1198 -0
  57. wx/lib/agw/aui/framemanager.py +10485 -0
  58. wx/lib/agw/aui/tabart.py +2749 -0
  59. wx/lib/agw/aui/tabmdi.py +679 -0
  60. wx/lib/agw/balloontip.py +1157 -0
  61. wx/lib/agw/buttonpanel.py +2787 -0
  62. wx/lib/agw/cubecolourdialog.py +3529 -0
  63. wx/lib/agw/customtreectrl.py +9908 -0
  64. wx/lib/agw/data/ShortcutEditor_1.png +0 -0
  65. wx/lib/agw/data/ShortcutEditor_1_thumb.png +0 -0
  66. wx/lib/agw/data/ShortcutEditor_2.png +0 -0
  67. wx/lib/agw/data/ShortcutEditor_2_thumb.png +0 -0
  68. wx/lib/agw/data/ShortcutEditor_3.png +0 -0
  69. wx/lib/agw/data/ShortcutEditor_3_thumb.png +0 -0
  70. wx/lib/agw/data/ShortcutEditor_4.png +0 -0
  71. wx/lib/agw/data/ShortcutEditor_4_thumb.png +0 -0
  72. wx/lib/agw/data/default_help_text.html +105 -0
  73. wx/lib/agw/flatmenu.py +7392 -0
  74. wx/lib/agw/flatnotebook.py +6669 -0
  75. wx/lib/agw/floatspin.py +1820 -0
  76. wx/lib/agw/fmcustomizedlg.py +535 -0
  77. wx/lib/agw/fmresources.py +407 -0
  78. wx/lib/agw/foldpanelbar.py +2282 -0
  79. wx/lib/agw/fourwaysplitter.py +1130 -0
  80. wx/lib/agw/genericmessagedialog.py +1549 -0
  81. wx/lib/agw/gradientbutton.py +731 -0
  82. wx/lib/agw/hyperlink.py +664 -0
  83. wx/lib/agw/hypertreelist.py +5756 -0
  84. wx/lib/agw/infobar.py +885 -0
  85. wx/lib/agw/knobctrl.py +944 -0
  86. wx/lib/agw/labelbook.py +3028 -0
  87. wx/lib/agw/multidirdialog.py +581 -0
  88. wx/lib/agw/peakmeter.py +1028 -0
  89. wx/lib/agw/persist/__init__.py +188 -0
  90. wx/lib/agw/persist/persist_constants.py +283 -0
  91. wx/lib/agw/persist/persist_handlers.py +2614 -0
  92. wx/lib/agw/persist/persistencemanager.py +863 -0
  93. wx/lib/agw/piectrl.py +1082 -0
  94. wx/lib/agw/pybusyinfo.py +399 -0
  95. wx/lib/agw/pycollapsiblepane.py +940 -0
  96. wx/lib/agw/pygauge.py +570 -0
  97. wx/lib/agw/pyprogress.py +916 -0
  98. wx/lib/agw/ribbon/__init__.py +198 -0
  99. wx/lib/agw/ribbon/art.py +219 -0
  100. wx/lib/agw/ribbon/art_aui.py +1283 -0
  101. wx/lib/agw/ribbon/art_default.py +81 -0
  102. wx/lib/agw/ribbon/art_internal.py +248 -0
  103. wx/lib/agw/ribbon/art_msw.py +2735 -0
  104. wx/lib/agw/ribbon/art_osx.py +52 -0
  105. wx/lib/agw/ribbon/bar.py +1259 -0
  106. wx/lib/agw/ribbon/buttonbar.py +1317 -0
  107. wx/lib/agw/ribbon/control.py +205 -0
  108. wx/lib/agw/ribbon/gallery.py +973 -0
  109. wx/lib/agw/ribbon/page.py +946 -0
  110. wx/lib/agw/ribbon/panel.py +1170 -0
  111. wx/lib/agw/ribbon/toolbar.py +1441 -0
  112. wx/lib/agw/rulerctrl.py +1885 -0
  113. wx/lib/agw/scrolledthumbnail.py +2116 -0
  114. wx/lib/agw/shapedbutton.py +1809 -0
  115. wx/lib/agw/shortcuteditor.py +2642 -0
  116. wx/lib/agw/speedmeter.py +1800 -0
  117. wx/lib/agw/supertooltip.py +1443 -0
  118. wx/lib/agw/thumbnailctrl.py +529 -0
  119. wx/lib/agw/toasterbox.py +1327 -0
  120. wx/lib/agw/ultimatelistctrl.py +13671 -0
  121. wx/lib/agw/xlsgrid.py +2111 -0
  122. wx/lib/agw/zoombar.py +1336 -0
  123. wx/lib/analogclock/__init__.py +140 -0
  124. wx/lib/analogclock/analogclock.py +630 -0
  125. wx/lib/analogclock/helpers.py +986 -0
  126. wx/lib/analogclock/lib_setup/__init__.py +0 -0
  127. wx/lib/analogclock/lib_setup/buttontreectrlpanel.py +297 -0
  128. wx/lib/analogclock/lib_setup/fontselect.py +57 -0
  129. wx/lib/analogclock/setup.py +490 -0
  130. wx/lib/analogclock/styles.py +47 -0
  131. wx/lib/anchors.py +103 -0
  132. wx/lib/art/__init__.py +4 -0
  133. wx/lib/art/flagart.py +1583 -0
  134. wx/lib/art/img2pyartprov.py +56 -0
  135. wx/lib/busy.py +152 -0
  136. wx/lib/buttons.py +1140 -0
  137. wx/lib/calendar.py +1596 -0
  138. wx/lib/checkbox.py +837 -0
  139. wx/lib/colourchooser/__init__.py +36 -0
  140. wx/lib/colourchooser/canvas.py +145 -0
  141. wx/lib/colourchooser/intl.py +24 -0
  142. wx/lib/colourchooser/pycolourbox.py +89 -0
  143. wx/lib/colourchooser/pycolourchooser.py +626 -0
  144. wx/lib/colourchooser/pycolourslider.py +98 -0
  145. wx/lib/colourchooser/pypalette.py +208 -0
  146. wx/lib/colourdb.py +740 -0
  147. wx/lib/colourselect.py +385 -0
  148. wx/lib/colourutils.py +118 -0
  149. wx/lib/combotreebox.py +944 -0
  150. wx/lib/delayedresult.py +420 -0
  151. wx/lib/dialogs.py +510 -0
  152. wx/lib/docview.py +3210 -0
  153. wx/lib/dragscroller.py +79 -0
  154. wx/lib/editor/README.txt +77 -0
  155. wx/lib/editor/__init__.py +24 -0
  156. wx/lib/editor/editor.py +974 -0
  157. wx/lib/editor/images.py +15 -0
  158. wx/lib/editor/selection.py +44 -0
  159. wx/lib/embeddedimage.py +76 -0
  160. wx/lib/eventStack.py +136 -0
  161. wx/lib/eventwatcher.py +440 -0
  162. wx/lib/evtmgr.py +521 -0
  163. wx/lib/expando.py +393 -0
  164. wx/lib/fancytext.py +494 -0
  165. wx/lib/filebrowsebutton.py +461 -0
  166. wx/lib/flashwin.py +262 -0
  167. wx/lib/flashwin_old.py +651 -0
  168. wx/lib/floatcanvas/FCEvents.py +53 -0
  169. wx/lib/floatcanvas/FCObjects.py +2910 -0
  170. wx/lib/floatcanvas/FloatCanvas.py +1025 -0
  171. wx/lib/floatcanvas/GUIMode.py +396 -0
  172. wx/lib/floatcanvas/NavCanvas.py +162 -0
  173. wx/lib/floatcanvas/Resources.py +319 -0
  174. wx/lib/floatcanvas/ScreenShot.py +1788 -0
  175. wx/lib/floatcanvas/Utilities/BBox.py +313 -0
  176. wx/lib/floatcanvas/Utilities/Colors.py +137 -0
  177. wx/lib/floatcanvas/Utilities/GUI.py +91 -0
  178. wx/lib/floatcanvas/Utilities/__init__.py +7 -0
  179. wx/lib/floatcanvas/__init__.py +124 -0
  180. wx/lib/foldmenu.py +89 -0
  181. wx/lib/gestures.py +310 -0
  182. wx/lib/gizmos/__init__.py +18 -0
  183. wx/lib/gizmos/dynamicsash.py +1202 -0
  184. wx/lib/gizmos/ledctrl.py +299 -0
  185. wx/lib/gizmos/treelistctrl.py +87 -0
  186. wx/lib/graphics.py +1942 -0
  187. wx/lib/gridmovers.py +516 -0
  188. wx/lib/iewin.py +249 -0
  189. wx/lib/iewin_old.py +894 -0
  190. wx/lib/imagebrowser.py +853 -0
  191. wx/lib/imageutils.py +163 -0
  192. wx/lib/infoframe.py +490 -0
  193. wx/lib/inspection.py +1254 -0
  194. wx/lib/intctrl.py +990 -0
  195. wx/lib/itemspicker.py +256 -0
  196. wx/lib/langlistctrl.py +480 -0
  197. wx/lib/layoutf.py +271 -0
  198. wx/lib/masked/__init__.py +27 -0
  199. wx/lib/masked/combobox.py +839 -0
  200. wx/lib/masked/ctrl.py +108 -0
  201. wx/lib/masked/ipaddrctrl.py +241 -0
  202. wx/lib/masked/maskededit.py +7262 -0
  203. wx/lib/masked/numctrl.py +2000 -0
  204. wx/lib/masked/textctrl.py +465 -0
  205. wx/lib/masked/timectrl.py +1465 -0
  206. wx/lib/mixins/__init__.py +17 -0
  207. wx/lib/mixins/grid.py +47 -0
  208. wx/lib/mixins/gridlabelrenderer.py +277 -0
  209. wx/lib/mixins/imagelist.py +77 -0
  210. wx/lib/mixins/inspection.py +184 -0
  211. wx/lib/mixins/listctrl.py +893 -0
  212. wx/lib/mixins/rubberband.py +403 -0
  213. wx/lib/mixins/treemixin.py +678 -0
  214. wx/lib/msgpanel.py +95 -0
  215. wx/lib/multisash.py +746 -0
  216. wx/lib/myole4ax.idl +178 -0
  217. wx/lib/myole4ax.tlb +0 -0
  218. wx/lib/newevent.py +229 -0
  219. wx/lib/newevent.pyi +25 -0
  220. wx/lib/nvdlg.py +156 -0
  221. wx/lib/ogl/__init__.py +13 -0
  222. wx/lib/ogl/basic.py +3989 -0
  223. wx/lib/ogl/bmpshape.py +86 -0
  224. wx/lib/ogl/canvas.py +467 -0
  225. wx/lib/ogl/composit.py +1576 -0
  226. wx/lib/ogl/diagram.py +230 -0
  227. wx/lib/ogl/divided.py +482 -0
  228. wx/lib/ogl/drawn.py +898 -0
  229. wx/lib/ogl/lines.py +1809 -0
  230. wx/lib/ogl/oglmisc.py +607 -0
  231. wx/lib/pdfviewer/__init__.py +113 -0
  232. wx/lib/pdfviewer/bitmaps/ArrowLeft.png +0 -0
  233. wx/lib/pdfviewer/bitmaps/ArrowRight.png +0 -0
  234. wx/lib/pdfviewer/bitmaps/DirectionH.png +0 -0
  235. wx/lib/pdfviewer/bitmaps/DirectionV.png +0 -0
  236. wx/lib/pdfviewer/bitmaps/PlayerFirst.png +0 -0
  237. wx/lib/pdfviewer/bitmaps/PlayerLast.png +0 -0
  238. wx/lib/pdfviewer/bitmaps/PlayerNext.png +0 -0
  239. wx/lib/pdfviewer/bitmaps/PlayerPrev.png +0 -0
  240. wx/lib/pdfviewer/bitmaps/Printer.png +0 -0
  241. wx/lib/pdfviewer/bitmaps/ReadMe.txt +28 -0
  242. wx/lib/pdfviewer/bitmaps/Save.png +0 -0
  243. wx/lib/pdfviewer/bitmaps/ZoomIn.png +0 -0
  244. wx/lib/pdfviewer/bitmaps/ZoomOut.png +0 -0
  245. wx/lib/pdfviewer/bitmaps/encode_bitmaps.py +37 -0
  246. wx/lib/pdfviewer/buttonpanel.py +285 -0
  247. wx/lib/pdfviewer/images.py +240 -0
  248. wx/lib/pdfviewer/viewer.py +1118 -0
  249. wx/lib/pdfwin.py +295 -0
  250. wx/lib/pdfwin_old.py +789 -0
  251. wx/lib/platebtn.py +789 -0
  252. wx/lib/plot/CHANGELOG.md +150 -0
  253. wx/lib/plot/README.md +16 -0
  254. wx/lib/plot/__init__.py +46 -0
  255. wx/lib/plot/__main__.py +5 -0
  256. wx/lib/plot/examples/__init__.py +0 -0
  257. wx/lib/plot/examples/demo.py +1010 -0
  258. wx/lib/plot/examples/simple_example.py +56 -0
  259. wx/lib/plot/plotcanvas.py +2985 -0
  260. wx/lib/plot/polyobjects.py +1524 -0
  261. wx/lib/plot/utils.py +334 -0
  262. wx/lib/popupctl.py +251 -0
  263. wx/lib/printout.py +1155 -0
  264. wx/lib/progressindicator.py +151 -0
  265. wx/lib/pubsub/LICENSE_BSD_Simple.txt +23 -0
  266. wx/lib/pubsub/README_WxPython.txt +22 -0
  267. wx/lib/pubsub/RELEASE_NOTES.txt +71 -0
  268. wx/lib/pubsub/__init__.py +25 -0
  269. wx/lib/pubsub/core/__init__.py +92 -0
  270. wx/lib/pubsub/core/arg1/__init__.py +16 -0
  271. wx/lib/pubsub/core/arg1/listenerimpl.py +97 -0
  272. wx/lib/pubsub/core/arg1/publisher.py +40 -0
  273. wx/lib/pubsub/core/arg1/publishermixin.py +34 -0
  274. wx/lib/pubsub/core/arg1/topicargspecimpl.py +66 -0
  275. wx/lib/pubsub/core/arg1/topicmgrimpl.py +19 -0
  276. wx/lib/pubsub/core/callables.py +198 -0
  277. wx/lib/pubsub/core/imp2.py +62 -0
  278. wx/lib/pubsub/core/itopicdefnprovider.py +0 -0
  279. wx/lib/pubsub/core/kwargs/__init__.py +16 -0
  280. wx/lib/pubsub/core/kwargs/datamsg.py +27 -0
  281. wx/lib/pubsub/core/kwargs/listenerimpl.py +93 -0
  282. wx/lib/pubsub/core/kwargs/publisher.py +77 -0
  283. wx/lib/pubsub/core/kwargs/publishermixin.py +65 -0
  284. wx/lib/pubsub/core/kwargs/topicargspecimpl.py +216 -0
  285. wx/lib/pubsub/core/kwargs/topicmgrimpl.py +13 -0
  286. wx/lib/pubsub/core/listener.py +40 -0
  287. wx/lib/pubsub/core/listenerbase.py +185 -0
  288. wx/lib/pubsub/core/notificationmgr.py +185 -0
  289. wx/lib/pubsub/core/publisherbase.py +189 -0
  290. wx/lib/pubsub/core/topicargspec.py +77 -0
  291. wx/lib/pubsub/core/topicdefnprovider.py +631 -0
  292. wx/lib/pubsub/core/topicexc.py +72 -0
  293. wx/lib/pubsub/core/topicmgr.py +454 -0
  294. wx/lib/pubsub/core/topicobj.py +472 -0
  295. wx/lib/pubsub/core/topictreetraverser.py +143 -0
  296. wx/lib/pubsub/core/topicutils.py +119 -0
  297. wx/lib/pubsub/core/treeconfig.py +21 -0
  298. wx/lib/pubsub/core/validatedefnargs.py +29 -0
  299. wx/lib/pubsub/core/weakmethod.py +102 -0
  300. wx/lib/pubsub/policies.py +24 -0
  301. wx/lib/pubsub/pub.py +199 -0
  302. wx/lib/pubsub/setuparg1.py +47 -0
  303. wx/lib/pubsub/setupkwargs.py +29 -0
  304. wx/lib/pubsub/utils/__init__.py +27 -0
  305. wx/lib/pubsub/utils/exchandling.py +100 -0
  306. wx/lib/pubsub/utils/misc.py +99 -0
  307. wx/lib/pubsub/utils/notification.py +331 -0
  308. wx/lib/pubsub/utils/topictreeprinter.py +195 -0
  309. wx/lib/pubsub/utils/xmltopicdefnprovider.py +286 -0
  310. wx/lib/pydocview.py +3300 -0
  311. wx/lib/rcsizer.py +227 -0
  312. wx/lib/resizewidget.py +357 -0
  313. wx/lib/scrolledpanel.py +243 -0
  314. wx/lib/sheet.py +350 -0
  315. wx/lib/sized_controls.py +691 -0
  316. wx/lib/softwareupdate.py +355 -0
  317. wx/lib/splitter.py +925 -0
  318. wx/lib/statbmp.py +199 -0
  319. wx/lib/stattext.py +321 -0
  320. wx/lib/throbber.py +424 -0
  321. wx/lib/ticker.py +306 -0
  322. wx/lib/ticker_xrc.py +48 -0
  323. wx/lib/utils.py +89 -0
  324. wx/lib/wordwrap.py +97 -0
  325. wx/lib/wxcairo/__init__.py +139 -0
  326. wx/lib/wxcairo/wx_cairocffi.py +200 -0
  327. wx/lib/wxcairo/wx_pycairo.py +455 -0
  328. wx/lib/wxpTag.py +274 -0
  329. wx/libcairo-2.dll +0 -0
  330. wx/locale/af/LC_MESSAGES/wxstd.mo +0 -0
  331. wx/locale/an/LC_MESSAGES/wxstd.mo +0 -0
  332. wx/locale/ar/LC_MESSAGES/wxstd.mo +0 -0
  333. wx/locale/ca/LC_MESSAGES/wxstd.mo +0 -0
  334. wx/locale/ca@valencia/LC_MESSAGES/wxstd.mo +0 -0
  335. wx/locale/co/LC_MESSAGES/wxstd.mo +0 -0
  336. wx/locale/cs/LC_MESSAGES/wxstd.mo +0 -0
  337. wx/locale/da/LC_MESSAGES/wxstd.mo +0 -0
  338. wx/locale/de/LC_MESSAGES/wxstd.mo +0 -0
  339. wx/locale/el/LC_MESSAGES/wxstd.mo +0 -0
  340. wx/locale/es/LC_MESSAGES/wxstd.mo +0 -0
  341. wx/locale/eu/LC_MESSAGES/wxstd.mo +0 -0
  342. wx/locale/fa_IR/LC_MESSAGES/wxstd.mo +0 -0
  343. wx/locale/fi/LC_MESSAGES/wxstd.mo +0 -0
  344. wx/locale/fr/LC_MESSAGES/wxstd.mo +0 -0
  345. wx/locale/gl_ES/LC_MESSAGES/wxstd.mo +0 -0
  346. wx/locale/hi/LC_MESSAGES/wxstd.mo +0 -0
  347. wx/locale/hr/LC_MESSAGES/wxstd.mo +0 -0
  348. wx/locale/hu/LC_MESSAGES/wxstd.mo +0 -0
  349. wx/locale/id/LC_MESSAGES/wxstd.mo +0 -0
  350. wx/locale/it/LC_MESSAGES/wxstd.mo +0 -0
  351. wx/locale/ja/LC_MESSAGES/wxstd.mo +0 -0
  352. wx/locale/ka/LC_MESSAGES/wxstd.mo +0 -0
  353. wx/locale/ko_KR/LC_MESSAGES/wxstd.mo +0 -0
  354. wx/locale/lt/LC_MESSAGES/wxstd.mo +0 -0
  355. wx/locale/lv/LC_MESSAGES/wxstd.mo +0 -0
  356. wx/locale/ms/LC_MESSAGES/wxstd.mo +0 -0
  357. wx/locale/nb/LC_MESSAGES/wxstd.mo +0 -0
  358. wx/locale/ne/LC_MESSAGES/wxstd.mo +0 -0
  359. wx/locale/nl/LC_MESSAGES/wxstd.mo +0 -0
  360. wx/locale/pl/LC_MESSAGES/wxstd.mo +0 -0
  361. wx/locale/pt/LC_MESSAGES/wxstd.mo +0 -0
  362. wx/locale/pt_BR/LC_MESSAGES/wxstd.mo +0 -0
  363. wx/locale/ro/LC_MESSAGES/wxstd.mo +0 -0
  364. wx/locale/ru/LC_MESSAGES/wxstd.mo +0 -0
  365. wx/locale/sk/LC_MESSAGES/wxstd.mo +0 -0
  366. wx/locale/sl/LC_MESSAGES/wxstd.mo +0 -0
  367. wx/locale/sq/LC_MESSAGES/wxstd.mo +0 -0
  368. wx/locale/sr/LC_MESSAGES/wxstd.mo +0 -0
  369. wx/locale/sv/LC_MESSAGES/wxstd.mo +0 -0
  370. wx/locale/ta/LC_MESSAGES/wxstd.mo +0 -0
  371. wx/locale/tr/LC_MESSAGES/wxstd.mo +0 -0
  372. wx/locale/uk/LC_MESSAGES/wxstd.mo +0 -0
  373. wx/locale/vi/LC_MESSAGES/wxstd.mo +0 -0
  374. wx/locale/zh_CN/LC_MESSAGES/wxstd.mo +0 -0
  375. wx/locale/zh_TW/LC_MESSAGES/wxstd.mo +0 -0
  376. wx/media.py +30 -0
  377. wx/media.pyi +272 -0
  378. wx/msw.py +16 -0
  379. wx/msw.pyi +91 -0
  380. wx/propgrid.py +498 -0
  381. wx/propgrid.pyi +7427 -0
  382. wx/py/CHANGES.txt +796 -0
  383. wx/py/Py.ico +0 -0
  384. wx/py/PyAlaCarte.py +34 -0
  385. wx/py/PyAlaMode.py +34 -0
  386. wx/py/PyAlaModeTest.py +33 -0
  387. wx/py/PyCrust.ico +0 -0
  388. wx/py/PyCrust.py +78 -0
  389. wx/py/PyCrust_16.png +0 -0
  390. wx/py/PyCrust_32.png +0 -0
  391. wx/py/PyFilling.py +35 -0
  392. wx/py/PyShell.py +78 -0
  393. wx/py/PySlices.ico +0 -0
  394. wx/py/PySlices.py +98 -0
  395. wx/py/PySlicesShell.py +94 -0
  396. wx/py/PySlices_16.png +0 -0
  397. wx/py/PySlices_32.png +0 -0
  398. wx/py/PyWrap.py +52 -0
  399. wx/py/README.txt +77 -0
  400. wx/py/__init__.py +20 -0
  401. wx/py/buffer.py +136 -0
  402. wx/py/crust.py +403 -0
  403. wx/py/crustslices.py +403 -0
  404. wx/py/dispatcher.py +259 -0
  405. wx/py/document.py +37 -0
  406. wx/py/editor.py +844 -0
  407. wx/py/editwindow.py +316 -0
  408. wx/py/filling.py +358 -0
  409. wx/py/frame.py +976 -0
  410. wx/py/images.py +212 -0
  411. wx/py/interpreter.py +161 -0
  412. wx/py/introspect.py +402 -0
  413. wx/py/magic.py +98 -0
  414. wx/py/parse.py +134 -0
  415. wx/py/path.py +36 -0
  416. wx/py/pseudo.py +99 -0
  417. wx/py/shell.py +1579 -0
  418. wx/py/sliceshell.py +3805 -0
  419. wx/py/tests/test_interpreter.py +71 -0
  420. wx/py/tests/test_introspect.py +810 -0
  421. wx/py/tests/test_pseudo.py +70 -0
  422. wx/py/tests/test_version.py +36 -0
  423. wx/py/tests/testall.py +22 -0
  424. wx/py/version.py +7 -0
  425. wx/py.typed +0 -0
  426. wx/ribbon.py +48 -0
  427. wx/ribbon.pyi +3099 -0
  428. wx/richtext.py +141 -0
  429. wx/richtext.pyi +13581 -0
  430. wx/siplib.cp315-win_amd64.pyd +0 -0
  431. wx/siplib.pyi +19 -0
  432. wx/stc.py +59 -0
  433. wx/stc.pyi +9918 -0
  434. wx/svg/__init__.py +363 -0
  435. wx/svg/_nanosvg.cp315-win_amd64.pyd +0 -0
  436. wx/tools/__init__.py +18 -0
  437. wx/tools/dbg.py +268 -0
  438. wx/tools/genaxmodule.py +50 -0
  439. wx/tools/helpviewer.py +92 -0
  440. wx/tools/img2img.py +85 -0
  441. wx/tools/img2png.py +54 -0
  442. wx/tools/img2py.py +306 -0
  443. wx/tools/img2xpm.py +54 -0
  444. wx/tools/pywxrc.py +951 -0
  445. wx/tools/wxget.py +254 -0
  446. wx/tools/wxget_docs_demo.py +183 -0
  447. wx/wxbase334u_net_vc140_x64.dll +0 -0
  448. wx/wxbase334u_vc140_x64.dll +0 -0
  449. wx/wxbase334u_xml_vc140_x64.dll +0 -0
  450. wx/wxmsw334u_adv_vc140_x64.dll +0 -0
  451. wx/wxmsw334u_aui_vc140_x64.dll +0 -0
  452. wx/wxmsw334u_core_vc140_x64.dll +0 -0
  453. wx/wxmsw334u_gl_vc140_x64.dll +0 -0
  454. wx/wxmsw334u_html_vc140_x64.dll +0 -0
  455. wx/wxmsw334u_media_vc140_x64.dll +0 -0
  456. wx/wxmsw334u_propgrid_vc140_x64.dll +0 -0
  457. wx/wxmsw334u_qa_vc140_x64.dll +0 -0
  458. wx/wxmsw334u_ribbon_vc140_x64.dll +0 -0
  459. wx/wxmsw334u_richtext_vc140_x64.dll +0 -0
  460. wx/wxmsw334u_stc_vc140_x64.dll +0 -0
  461. wx/wxmsw334u_webview_vc140_x64.dll +0 -0
  462. wx/wxmsw334u_xrc_vc140_x64.dll +0 -0
  463. wx/xml.py +18 -0
  464. wx/xml.pyi +728 -0
  465. wx/xrc.py +68 -0
  466. wx/xrc.pyi +896 -0
  467. wxpython-4.3.2.dist-info/METADATA +71 -0
  468. wxpython-4.3.2.dist-info/RECORD +472 -0
  469. wxpython-4.3.2.dist-info/WHEEL +5 -0
  470. wxpython-4.3.2.dist-info/entry_points.txt +13 -0
  471. wxpython-4.3.2.dist-info/licenses/LICENSE.txt +610 -0
  472. wxpython-4.3.2.dist-info/top_level.txt +1 -0
wx/py/shell.py ADDED
@@ -0,0 +1,1579 @@
1
+ """Shell is an interactive text control in which a user types in
2
+ commands to be sent to the interpreter. This particular shell is
3
+ based on wxPython's wxStyledTextCtrl.
4
+
5
+ Sponsored by Orbtech - Your source for Python programming expertise."""
6
+
7
+ __author__ = "Patrick K. O'Brien <pobrien@orbtech.com>"
8
+
9
+ import wx
10
+ from wx import stc
11
+
12
+ import keyword
13
+ import os
14
+ import sys
15
+ import time
16
+ from functools import cmp_to_key
17
+
18
+ from .buffer import Buffer
19
+ from . import dispatcher
20
+ from . import editwindow
21
+ from . import frame
22
+ from .pseudo import PseudoFileIn
23
+ from .pseudo import PseudoFileOut
24
+ from .pseudo import PseudoFileErr
25
+ from .version import VERSION
26
+ from .magic import magic
27
+ from .path import ls,cd,pwd,sx
28
+
29
+ sys.ps3 = '<-- ' # Input prompt.
30
+ USE_MAGIC=True
31
+ # Force updates from long-running commands after this many seconds
32
+ PRINT_UPDATE_MAX_TIME=2
33
+
34
+ NAVKEYS = (wx.WXK_END, wx.WXK_LEFT, wx.WXK_RIGHT,
35
+ wx.WXK_UP, wx.WXK_DOWN, wx.WXK_PAGEUP, wx.WXK_PAGEDOWN)
36
+
37
+
38
+ class ShellFrame(frame.Frame, frame.ShellFrameMixin):
39
+ """Frame containing the shell component."""
40
+
41
+ name = 'Shell Frame'
42
+
43
+ def __init__(self, parent=None, id=-1, title='PyShell',
44
+ pos=wx.DefaultPosition, size=wx.DefaultSize,
45
+ style=wx.DEFAULT_FRAME_STYLE, locals=None,
46
+ InterpClass=None,
47
+ config=None, dataDir=None,
48
+ *args, **kwds):
49
+ """Create ShellFrame instance."""
50
+ frame.Frame.__init__(self, parent, id, title, pos, size, style)
51
+ frame.ShellFrameMixin.__init__(self, config, dataDir)
52
+
53
+ if size == wx.DefaultSize:
54
+ self.SetSize((750, 525))
55
+
56
+ intro = 'PyShell %s - The Flakiest Python Shell' % VERSION
57
+ self.SetStatusText(intro.replace('\n', ', '))
58
+ self.shell = Shell(parent=self, id=-1, introText=intro,
59
+ locals=locals, InterpClass=InterpClass,
60
+ startupScript=self.startupScript,
61
+ execStartupScript=self.execStartupScript,
62
+ *args, **kwds)
63
+
64
+ # Override the shell so that status messages go to the status bar.
65
+ self.shell.setStatusText = self.SetStatusText
66
+
67
+ self.shell.SetFocus()
68
+ self.LoadSettings()
69
+
70
+
71
+ def OnClose(self, event):
72
+ """Event handler for closing."""
73
+ # This isn't working the way I want, but I'll leave it for now.
74
+ if self.shell.waiting:
75
+ if event.CanVeto():
76
+ event.Veto(True)
77
+ else:
78
+ self.SaveSettings()
79
+ self.shell.destroy()
80
+ self.Destroy()
81
+
82
+ def OnAbout(self, event):
83
+ """Display an About window."""
84
+ title = 'About PyShell'
85
+ text = 'PyShell %s\n\n' % VERSION + \
86
+ 'Yet another Python shell, only flakier.\n\n' + \
87
+ 'Half-baked by Patrick K. O\'Brien,\n' + \
88
+ 'the other half is still in the oven.\n\n' + \
89
+ 'Platform: %s\n' % sys.platform + \
90
+ 'Python Version: %s\n' % sys.version.split()[0] + \
91
+ 'wxPython Version: %s\n' % wx.VERSION_STRING + \
92
+ ('\t(%s)\n' % ", ".join(wx.PlatformInfo[1:]))
93
+ dialog = wx.MessageDialog(self, text, title,
94
+ wx.OK | wx.ICON_INFORMATION)
95
+ dialog.ShowModal()
96
+ dialog.Destroy()
97
+
98
+
99
+ def OnHelp(self, event):
100
+ """Show a help dialog."""
101
+ frame.ShellFrameMixin.OnHelp(self, event)
102
+
103
+
104
+ def LoadSettings(self):
105
+ if self.config is not None:
106
+ frame.ShellFrameMixin.LoadSettings(self)
107
+ frame.Frame.LoadSettings(self, self.config)
108
+ self.shell.LoadSettings(self.config)
109
+
110
+ def SaveSettings(self, force=False):
111
+ if self.config is not None:
112
+ frame.ShellFrameMixin.SaveSettings(self)
113
+ if self.autoSaveSettings or force:
114
+ frame.Frame.SaveSettings(self, self.config)
115
+ self.shell.SaveSettings(self.config)
116
+
117
+ def DoSaveSettings(self):
118
+ if self.config is not None:
119
+ self.SaveSettings(force=True)
120
+ self.config.Flush()
121
+
122
+
123
+
124
+
125
+ HELP_TEXT = """\
126
+ * Key bindings:
127
+ Home Go to the beginning of the command or line.
128
+ Shift+Home Select to the beginning of the command or line.
129
+ Shift+End Select to the end of the line.
130
+ End Go to the end of the line.
131
+ Ctrl+C Copy selected text, removing prompts.
132
+ Ctrl+Shift+C Copy selected text, retaining prompts.
133
+ Alt+C Copy to the clipboard, including prefixed prompts.
134
+ Ctrl+X Cut selected text.
135
+ Ctrl+V Paste from clipboard.
136
+ Ctrl+Shift+V Paste and run multiple commands from clipboard.
137
+ Ctrl+Up Arrow Retrieve Previous History item.
138
+ Alt+P Retrieve Previous History item.
139
+ Ctrl+Down Arrow Retrieve Next History item.
140
+ Alt+N Retrieve Next History item.
141
+ Shift+Up Arrow Insert Previous History item.
142
+ Shift+Down Arrow Insert Next History item.
143
+ F8 Command-completion of History item.
144
+ (Type a few characters of a previous command and press F8.)
145
+ Ctrl+Enter Insert new line into multiline command.
146
+ Ctrl+] Increase font size.
147
+ Ctrl+[ Decrease font size.
148
+ Ctrl+= Default font size.
149
+ Ctrl-Space Show Auto Completion.
150
+ Ctrl-Alt-Space Show Call Tip.
151
+ Shift+Enter Complete Text from History.
152
+ Ctrl+F Search
153
+ F3 Search next
154
+ Ctrl+H "hide" lines containing selection / "unhide"
155
+ F12 on/off "free-edit" mode
156
+ """
157
+
158
+ class ShellFacade:
159
+ """Simplified interface to all shell-related functionality.
160
+
161
+ This is a semi-transparent facade, in that all attributes of other
162
+ are accessible, even though only some are visible to the user."""
163
+
164
+ name = 'Shell Interface'
165
+
166
+ def __init__(self, other):
167
+ """Create a ShellFacade instance."""
168
+ d = self.__dict__
169
+ d['other'] = other
170
+ d['helpText'] = HELP_TEXT
171
+
172
+ def help(self):
173
+ """Display some useful information about how to use the shell."""
174
+ self.write(self.helpText)
175
+
176
+ def __getattr__(self, name):
177
+ if hasattr(self.other, name):
178
+ return getattr(self.other, name)
179
+ else:
180
+ raise AttributeError(name)
181
+
182
+ def __setattr__(self, name, value):
183
+ if name in self.__dict__:
184
+ self.__dict__[name] = value
185
+ elif hasattr(self.other, name):
186
+ setattr(self.other, name, value)
187
+ else:
188
+ raise AttributeError(name)
189
+
190
+ def _getAttributeNames(self):
191
+ """Return list of magic attributes to extend introspection."""
192
+ list = [
193
+ 'about',
194
+ 'ask',
195
+ 'autoCallTip',
196
+ 'autoComplete',
197
+ 'autoCompleteAutoHide',
198
+ 'autoCompleteCaseInsensitive',
199
+ 'autoCompleteIncludeDouble',
200
+ 'autoCompleteIncludeMagic',
201
+ 'autoCompleteIncludeSingle',
202
+ 'callTipInsert',
203
+ 'clear',
204
+ 'pause',
205
+ 'prompt',
206
+ 'quit',
207
+ 'redirectStderr',
208
+ 'redirectStdin',
209
+ 'redirectStdout',
210
+ 'run',
211
+ 'runfile',
212
+ 'wrap',
213
+ 'zoom',
214
+ ]
215
+ list.sort()
216
+ return list
217
+
218
+
219
+ #DNM
220
+ DISPLAY_TEXT="""
221
+ Author: %r
222
+ Py Version: %s
223
+ Python Version: %s
224
+ wxPython Version: %s
225
+ wxPython PlatformInfo: %s
226
+ Platform: %s"""
227
+
228
+ class Shell(editwindow.EditWindow):
229
+ """Shell based on StyledTextCtrl."""
230
+
231
+ name = 'Shell'
232
+
233
+ def __init__(self, parent, id=-1, pos=wx.DefaultPosition,
234
+ size=wx.DefaultSize, style=wx.CLIP_CHILDREN,
235
+ introText='', locals=None, InterpClass=None,
236
+ startupScript=None, execStartupScript=True,
237
+ useStockId=True,
238
+ *args, **kwds):
239
+ """Create Shell instance."""
240
+ editwindow.EditWindow.__init__(self, parent, id, pos, size, style)
241
+ self.wrap()
242
+ if locals is None:
243
+ import __main__
244
+ locals = __main__.__dict__
245
+
246
+ # Grab these so they can be restored by self.redirect* methods.
247
+ self.stdin = sys.stdin
248
+ self.stdout = sys.stdout
249
+ self.stderr = sys.stderr
250
+
251
+ # Import a default interpreter class if one isn't provided.
252
+ if InterpClass is None:
253
+ from .interpreter import Interpreter
254
+ else:
255
+ Interpreter = InterpClass
256
+
257
+ # Create a replacement for stdin.
258
+ self.reader = PseudoFileIn(self.readline, self.readlines)
259
+ self.reader.input = ''
260
+ self.reader.isreading = False
261
+
262
+ # Set up the interpreter.
263
+ self.interp = Interpreter(locals=locals,
264
+ rawin=self.raw_input,
265
+ stdin=self.reader,
266
+ stdout=PseudoFileOut(self.writeOut),
267
+ stderr=PseudoFileErr(self.writeErr),
268
+ *args, **kwds)
269
+
270
+ # Set up the buffer.
271
+ self.buffer = Buffer()
272
+
273
+ # Find out for which keycodes the interpreter will autocomplete.
274
+ self.autoCompleteKeys = self.interp.getAutoCompleteKeys()
275
+
276
+ # Keep track of the last non-continuation prompt positions.
277
+ self.promptPosStart = 0
278
+ self.promptPosEnd = 0
279
+
280
+ # Keep track of multi-line commands.
281
+ self.more = False
282
+
283
+ # For use with forced updates during long-running scripts
284
+ self.lastUpdate=None
285
+
286
+ # Create the command history. Commands are added into the
287
+ # front of the list (ie. at index 0) as they are entered.
288
+ # self.historyIndex is the current position in the history; it
289
+ # gets incremented as you retrieve the previous command,
290
+ # decremented as you retrieve the next, and reset when you hit
291
+ # Enter. self.historyIndex == -1 means you're on the current
292
+ # command, not in the history.
293
+ self.history = []
294
+ self.historyIndex = -1
295
+
296
+ #seb add mode for "free edit"
297
+ self.noteMode = 0
298
+ self.MarkerDefine(0,stc.STC_MARK_ROUNDRECT) # marker for hidden
299
+ self.searchTxt = ""
300
+
301
+ # Assign handlers for keyboard events.
302
+ self.Bind(wx.EVT_CHAR, self.OnChar)
303
+ self.Bind(wx.EVT_KEY_DOWN, self.OnKeyDown)
304
+
305
+ # Assign handler for the context menu
306
+ self.Bind(wx.EVT_CONTEXT_MENU, self.OnContextMenu)
307
+
308
+ # add the option to not use the stock IDs; otherwise the context menu
309
+ # may not work on Mac without adding the proper IDs to the menu bar
310
+ if useStockId:
311
+ self.ID_CUT = wx.ID_CUT
312
+ self.ID_COPY = wx.ID_COPY
313
+ self.ID_PASTE = wx.ID_PASTE
314
+ self.ID_SELECTALL = wx.ID_SELECTALL
315
+ self.ID_CLEAR = wx.ID_CLEAR
316
+ self.ID_UNDO = wx.ID_UNDO
317
+ self.ID_REDO = wx.ID_REDO
318
+ else:
319
+ self.ID_CUT = wx.NewIdRef()
320
+ self.ID_COPY = wx.NewIdRef()
321
+ self.ID_PASTE = wx.NewIdRef()
322
+ self.ID_SELECTALL = wx.NewIdRef()
323
+ self.ID_CLEAR = wx.NewIdRef()
324
+ self.ID_UNDO = wx.NewIdRef()
325
+ self.ID_REDO = wx.NewIdRef()
326
+
327
+ # Assign handlers for edit events
328
+ self.Bind(wx.EVT_MENU, lambda evt: self.Cut(), id=self.ID_CUT)
329
+ self.Bind(wx.EVT_MENU, lambda evt: self.Copy(), id=self.ID_COPY)
330
+ self.Bind(wx.EVT_MENU, lambda evt: self.CopyWithPrompts(), id=frame.ID_COPY_PLUS)
331
+ self.Bind(wx.EVT_MENU, lambda evt: self.Paste(), id=self.ID_PASTE)
332
+ self.Bind(wx.EVT_MENU, lambda evt: self.PasteAndRun(), id=frame.ID_PASTE_PLUS)
333
+ self.Bind(wx.EVT_MENU, lambda evt: self.SelectAll(), id=self.ID_SELECTALL)
334
+ self.Bind(wx.EVT_MENU, lambda evt: self.Clear(), id=self.ID_CLEAR)
335
+ self.Bind(wx.EVT_MENU, lambda evt: self.Undo(), id=self.ID_UNDO)
336
+ self.Bind(wx.EVT_MENU, lambda evt: self.Redo(), id=self.ID_REDO)
337
+
338
+ self.Bind(wx.EVT_UPDATE_UI, lambda evt: evt.Enable(self.CanCut()), id=self.ID_CUT)
339
+ self.Bind(wx.EVT_UPDATE_UI, lambda evt: evt.Enable(self.CanCut()), id=self.ID_CLEAR)
340
+ self.Bind(wx.EVT_UPDATE_UI, lambda evt: evt.Enable(self.CanCopy()), id=self.ID_COPY)
341
+ self.Bind(wx.EVT_UPDATE_UI, lambda evt: evt.Enable(self.CanCopy()), id=frame.ID_COPY_PLUS)
342
+ self.Bind(wx.EVT_UPDATE_UI, lambda evt: evt.Enable(self.CanPaste()), id=self.ID_PASTE)
343
+ self.Bind(wx.EVT_UPDATE_UI, lambda evt: evt.Enable(self.CanPaste()), id=frame.ID_PASTE_PLUS)
344
+ self.Bind(wx.EVT_UPDATE_UI, lambda evt: evt.Enable(self.CanUndo()), id=self.ID_UNDO)
345
+ self.Bind(wx.EVT_UPDATE_UI, lambda evt: evt.Enable(self.CanRedo()), id=self.ID_REDO)
346
+
347
+ # Assign handler for idle time.
348
+ self.waiting = False
349
+ self.Bind(wx.EVT_IDLE, self.OnIdle)
350
+
351
+ # Display the introductory banner information.
352
+ self.showIntro(introText)
353
+
354
+ # Assign some pseudo keywords to the interpreter's namespace.
355
+ self.setBuiltinKeywords()
356
+
357
+ # Add 'shell' to the interpreter's local namespace.
358
+ self.setLocalShell()
359
+
360
+ ## NOTE: See note at bottom of this file...
361
+ ## #seb: File drag and drop
362
+ ## self.SetDropTarget( FileDropTarget(self) )
363
+
364
+ # Do this last so the user has complete control over their
365
+ # environment. They can override anything they want.
366
+ if execStartupScript:
367
+ if startupScript is None:
368
+ startupScript = os.environ.get('PYTHONSTARTUP')
369
+ self.execStartupScript(startupScript)
370
+ else:
371
+ self.prompt()
372
+
373
+ wx.CallAfter(self.ScrollToLine, 0)
374
+
375
+
376
+ def clearHistory(self):
377
+ self.history = []
378
+ self.historyIndex = -1
379
+ dispatcher.send(signal="Shell.clearHistory")
380
+
381
+
382
+ def destroy(self):
383
+ del self.interp
384
+
385
+ def setFocus(self):
386
+ """Set focus to the shell."""
387
+ self.SetFocus()
388
+
389
+ def OnIdle(self, event):
390
+ """Free the CPU to do other things."""
391
+ if self.waiting:
392
+ time.sleep(0.05)
393
+ event.Skip()
394
+
395
+ def showIntro(self, text=''):
396
+ """Display introductory text in the shell."""
397
+ if text:
398
+ self.write(text)
399
+ try:
400
+ if self.interp.introText:
401
+ if text and not text.endswith(os.linesep):
402
+ self.write(os.linesep)
403
+ self.write(self.interp.introText)
404
+ except AttributeError:
405
+ pass
406
+
407
+ def setBuiltinKeywords(self):
408
+ """Create pseudo keywords as part of builtins.
409
+
410
+ This sets "close", "exit" and "quit" to a helpful string.
411
+ """
412
+ import builtins
413
+ builtins.close = builtins.exit = builtins.quit = \
414
+ 'Click on the close button to leave the application.'
415
+ builtins.cd = cd
416
+ builtins.ls = ls
417
+ builtins.pwd = pwd
418
+ builtins.sx = sx
419
+
420
+
421
+ def quit(self):
422
+ """Quit the application."""
423
+ # XXX Good enough for now but later we want to send a close event.
424
+ # In the close event handler we can make sure they want to
425
+ # quit. Other applications, like PythonCard, may choose to
426
+ # hide rather than quit so we should just post the event and
427
+ # let the surrounding app decide what it wants to do.
428
+ self.write('Click on the close button to leave the application.')
429
+
430
+
431
+ def setLocalShell(self):
432
+ """Add 'shell' to locals as reference to ShellFacade instance."""
433
+ self.interp.locals['shell'] = ShellFacade(other=self)
434
+
435
+
436
+ def execStartupScript(self, startupScript):
437
+ """Execute the user's PYTHONSTARTUP script if they have one."""
438
+ if startupScript and os.path.isfile(startupScript):
439
+ text = 'Startup script executed: ' + startupScript
440
+ self.push('print(%r)' % text)
441
+ self.push('with open(%r, "r") as f:\n'
442
+ ' exec(f.read())\n' % (startupScript))
443
+ self.interp.startupScript = startupScript
444
+ else:
445
+ self.push('')
446
+
447
+
448
+ def about(self):
449
+ """Display information about Py."""
450
+ #DNM
451
+ text = DISPLAY_TEXT % \
452
+ (__author__, VERSION,
453
+ sys.version.split()[0], wx.VERSION_STRING, str(wx.PlatformInfo),
454
+ sys.platform)
455
+ self.write(text.strip())
456
+
457
+
458
+ def OnChar(self, event):
459
+ """Keypress event handler.
460
+
461
+ Only receives an event if OnKeyDown calls event.Skip() for the
462
+ corresponding event."""
463
+
464
+ if self.noteMode:
465
+ event.Skip()
466
+ return
467
+
468
+ # Prevent modification of previously submitted
469
+ # commands/responses.
470
+ if not self.CanEdit():
471
+ return
472
+ key = event.GetKeyCode()
473
+ currpos = self.GetCurrentPos()
474
+ stoppos = self.promptPosEnd
475
+ # Return (Enter) needs to be ignored in this handler.
476
+ if key in [wx.WXK_RETURN, wx.WXK_NUMPAD_ENTER]:
477
+ pass
478
+ elif key in self.autoCompleteKeys:
479
+ # Usually the dot (period) key activates auto completion.
480
+ # Get the command between the prompt and the cursor. Add
481
+ # the autocomplete character to the end of the command.
482
+ if self.AutoCompActive():
483
+ self.AutoCompCancel()
484
+ command = self.GetTextRange(stoppos, currpos) + chr(key)
485
+ self.write(chr(key))
486
+ if self.autoComplete:
487
+ self.autoCompleteShow(command)
488
+ elif key == ord('('):
489
+ # The left paren activates a call tip and cancels an
490
+ # active auto completion.
491
+ if self.AutoCompActive():
492
+ self.AutoCompCancel()
493
+ # Get the command between the prompt and the cursor. Add
494
+ # the '(' to the end of the command.
495
+ self.ReplaceSelection('')
496
+ command = self.GetTextRange(stoppos, currpos) + '('
497
+ self.write('(')
498
+ self.autoCallTipShow(command, self.GetCurrentPos() == self.GetTextLength())
499
+ else:
500
+ # Allow the normal event handling to take place.
501
+ event.Skip()
502
+
503
+
504
+ def OnKeyDown(self, event):
505
+ """Key down event handler."""
506
+
507
+ key = event.GetKeyCode()
508
+ # If the auto-complete window is up let it do its thing.
509
+ if self.AutoCompActive():
510
+ event.Skip()
511
+ return
512
+
513
+ # Prevent modification of previously submitted
514
+ # commands/responses.
515
+ controlDown = event.ControlDown()
516
+ rawControlDown = event.RawControlDown()
517
+ altDown = event.AltDown()
518
+ shiftDown = event.ShiftDown()
519
+ currpos = self.GetCurrentPos()
520
+ endpos = self.GetTextLength()
521
+ selecting = self.GetSelectionStart() != self.GetSelectionEnd()
522
+
523
+ if (rawControlDown or controlDown) and shiftDown and key in (ord('F'), ord('f')):
524
+ li = self.GetCurrentLine()
525
+ m = self.MarkerGet(li)
526
+ if m & 1<<0:
527
+ startP = self.PositionFromLine(li)
528
+ self.MarkerDelete(li, 0)
529
+ maxli = self.GetLineCount()
530
+ li += 1 # li stayed visible as header-line
531
+ li0 = li
532
+ while li<maxli and self.GetLineVisible(li) == 0:
533
+ li += 1
534
+ endP = self.GetLineEndPosition(li-1)
535
+ self.ShowLines(li0, li-1)
536
+ # select reappearing text to allow "hide again"
537
+ self.SetSelection( startP, endP )
538
+ return
539
+ startP,endP = self.GetSelection()
540
+ endP-=1
541
+ startL = self.LineFromPosition(startP)
542
+ endL = self.LineFromPosition(endP)
543
+
544
+ # never hide last prompt
545
+ if endL == self.LineFromPosition(self.promptPosEnd):
546
+ endL -= 1
547
+
548
+ m = self.MarkerGet(startL)
549
+ self.MarkerAdd(startL, 0)
550
+ self.HideLines(startL+1,endL)
551
+ self.SetCurrentPos( startP ) # to ensure caret stays visible !
552
+
553
+ if key == wx.WXK_F12: #seb
554
+ if self.noteMode:
555
+ # self.promptPosStart not used anyway - or ?
556
+ self.promptPosEnd = \
557
+ self.PositionFromLine( self.GetLineCount()-1 ) + \
558
+ len(str(sys.ps1))
559
+ self.GotoLine(self.GetLineCount())
560
+ self.GotoPos(self.promptPosEnd)
561
+ self.prompt() #make sure we have a prompt
562
+ self.SetCaretForeground("black")
563
+ self.SetCaretWidth(1) #default
564
+ self.SetCaretPeriod(500) #default
565
+ else:
566
+ self.SetCaretForeground("red")
567
+ self.SetCaretWidth(4)
568
+ self.SetCaretPeriod(0) #steady
569
+
570
+ self.noteMode = not self.noteMode
571
+ return
572
+ if self.noteMode:
573
+ event.Skip()
574
+ return
575
+
576
+ # Return (Enter) is used to submit a command to the
577
+ # interpreter.
578
+ if (not (rawControlDown or controlDown) and not shiftDown and not altDown) and \
579
+ key in [wx.WXK_RETURN, wx.WXK_NUMPAD_ENTER]:
580
+ if self.CallTipActive():
581
+ self.CallTipCancel()
582
+ self.processLine()
583
+
584
+ # Complete Text (from already typed words)
585
+ elif shiftDown and key in [wx.WXK_RETURN, wx.WXK_NUMPAD_ENTER]:
586
+ self.OnShowCompHistory()
587
+
588
+ # Ctrl+Return (Ctrl+Enter) is used to insert a line break.
589
+ elif (rawControlDown or controlDown) and key in [wx.WXK_RETURN, wx.WXK_NUMPAD_ENTER]:
590
+ if self.CallTipActive():
591
+ self.CallTipCancel()
592
+ if currpos == endpos:
593
+ self.processLine()
594
+ else:
595
+ self.insertLineBreak()
596
+
597
+ # Let Ctrl-Alt-* get handled normally.
598
+ elif (rawControlDown or controlDown) and altDown:
599
+ event.Skip()
600
+
601
+ # Clear the current, unexecuted command.
602
+ elif key == wx.WXK_ESCAPE:
603
+ if self.CallTipActive():
604
+ event.Skip()
605
+ else:
606
+ self.clearCommand()
607
+
608
+ # Clear the current command
609
+ elif key == wx.WXK_BACK and (rawControlDown or controlDown) and shiftDown:
610
+ self.clearCommand()
611
+
612
+ # Increase font size.
613
+ elif (rawControlDown or controlDown) and key in (ord(']'), wx.WXK_NUMPAD_ADD):
614
+ dispatcher.send(signal='FontIncrease')
615
+
616
+ # Decrease font size.
617
+ elif (rawControlDown or controlDown) and key in (ord('['), wx.WXK_NUMPAD_SUBTRACT):
618
+ dispatcher.send(signal='FontDecrease')
619
+
620
+ # Default font size.
621
+ elif (rawControlDown or controlDown) and key in (ord('='), wx.WXK_NUMPAD_DIVIDE):
622
+ dispatcher.send(signal='FontDefault')
623
+
624
+ # Cut to the clipboard.
625
+ elif ((rawControlDown or controlDown) and key in (ord('X'), ord('x'))) \
626
+ or (shiftDown and key == wx.WXK_DELETE):
627
+ self.Cut()
628
+
629
+ # Copy to the clipboard.
630
+ elif (rawControlDown or controlDown) and not shiftDown \
631
+ and key in (ord('C'), ord('c'), wx.WXK_INSERT):
632
+ self.Copy()
633
+
634
+ # Copy to the clipboard, including prompts.
635
+ elif (rawControlDown or controlDown) and shiftDown \
636
+ and key in (ord('C'), ord('c'), wx.WXK_INSERT):
637
+ self.CopyWithPrompts()
638
+
639
+ # Copy to the clipboard, including prefixed prompts.
640
+ elif altDown and not controlDown \
641
+ and key in (ord('C'), ord('c'), wx.WXK_INSERT):
642
+ self.CopyWithPromptsPrefixed()
643
+
644
+ # Home needs to be aware of the prompt.
645
+ elif (rawControlDown or controlDown) and key == wx.WXK_HOME:
646
+ home = self.promptPosEnd
647
+ if currpos > home:
648
+ self.SetCurrentPos(home)
649
+ if not selecting and not shiftDown:
650
+ self.SetAnchor(home)
651
+ self.EnsureCaretVisible()
652
+ else:
653
+ event.Skip()
654
+
655
+ # Home needs to be aware of the prompt.
656
+ elif key == wx.WXK_HOME:
657
+ home = self.promptPosEnd
658
+ if currpos > home:
659
+ [line_str,line_len] = self.GetCurLine()
660
+ pos=self.GetCurrentPos()
661
+ if line_str[:4] in [sys.ps1,sys.ps2,sys.ps3]:
662
+ self.SetCurrentPos(pos+4-line_len)
663
+ #self.SetCurrentPos(home)
664
+ if not selecting and not shiftDown:
665
+ self.SetAnchor(pos+4-line_len)
666
+ self.EnsureCaretVisible()
667
+ else:
668
+ event.Skip()
669
+ else:
670
+ event.Skip()
671
+
672
+ #
673
+ # The following handlers modify text, so we need to see if
674
+ # there is a selection that includes text prior to the prompt.
675
+ #
676
+ # Don't modify a selection with text prior to the prompt.
677
+ elif selecting and key not in NAVKEYS and not self.CanEdit():
678
+ pass
679
+
680
+ # Paste from the clipboard.
681
+ elif ((rawControlDown or controlDown) and not shiftDown and key in (ord('V'), ord('v'))) \
682
+ or (shiftDown and not controlDown and key == wx.WXK_INSERT):
683
+ self.Paste()
684
+
685
+ # manually invoke AutoComplete and Calltips
686
+ elif (rawControlDown or controlDown) and key == wx.WXK_SPACE:
687
+ self.OnCallTipAutoCompleteManually(shiftDown)
688
+
689
+ # Paste from the clipboard, run commands.
690
+ elif (rawControlDown or controlDown) and shiftDown and key in (ord('V'), ord('v')):
691
+ self.PasteAndRun()
692
+
693
+ # Replace with the previous command from the history buffer.
694
+ elif ((rawControlDown or controlDown) and not shiftDown and key == wx.WXK_UP) \
695
+ or (altDown and key in (ord('P'), ord('p'))):
696
+ self.OnHistoryReplace(step=+1)
697
+
698
+ # Replace with the next command from the history buffer.
699
+ elif ((rawControlDown or controlDown) and not shiftDown and key == wx.WXK_DOWN) \
700
+ or (altDown and key in (ord('N'), ord('n'))):
701
+ self.OnHistoryReplace(step=-1)
702
+
703
+ # Insert the previous command from the history buffer.
704
+ elif ((rawControlDown or controlDown) and shiftDown and key == wx.WXK_UP) and self.CanEdit():
705
+ self.OnHistoryInsert(step=+1)
706
+
707
+ # Insert the next command from the history buffer.
708
+ elif ((rawControlDown or controlDown) and shiftDown and key == wx.WXK_DOWN) and self.CanEdit():
709
+ self.OnHistoryInsert(step=-1)
710
+
711
+ # Search up the history for the text in front of the cursor.
712
+ elif key == wx.WXK_F8:
713
+ self.OnHistorySearch()
714
+
715
+ # Don't backspace over the latest non-continuation prompt.
716
+ elif key == wx.WXK_BACK:
717
+ if selecting and self.CanEdit():
718
+ event.Skip()
719
+ elif currpos > self.promptPosEnd:
720
+ event.Skip()
721
+
722
+ # Only allow these keys after the latest prompt.
723
+ elif key in (wx.WXK_TAB, wx.WXK_DELETE):
724
+ if self.CanEdit():
725
+ event.Skip()
726
+
727
+ # Don't toggle between insert mode and overwrite mode.
728
+ elif key == wx.WXK_INSERT:
729
+ pass
730
+
731
+ # Don't allow line deletion.
732
+ elif controlDown and key in (ord('L'), ord('l')):
733
+ # TODO : Allow line deletion eventually...
734
+ #event.Skip()
735
+ pass
736
+
737
+ # Don't allow line transposition.
738
+ elif controlDown and key in (ord('T'), ord('t')):
739
+ # TODO : Allow line transposition eventually...
740
+ # TODO : Will have to adjust markers accordingly and test if allowed...
741
+ #event.Skip()
742
+ pass
743
+
744
+ # Basic navigation keys should work anywhere.
745
+ elif key in NAVKEYS:
746
+ event.Skip()
747
+
748
+ # Protect the readonly portion of the shell.
749
+ elif not self.CanEdit():
750
+ pass
751
+
752
+ else:
753
+ event.Skip()
754
+
755
+
756
+ def OnShowCompHistory(self):
757
+ """Show possible autocompletion Words from already typed words."""
758
+
759
+ #copy from history
760
+ his = self.history[:]
761
+
762
+ #put together in one string
763
+ joined = " ".join (his)
764
+ import re
765
+
766
+ #sort out only "good" words
767
+ newlist = re.split(r"[ \.\[\]=}(\)\,0-9\"]", joined)
768
+
769
+ #length > 1 (mix out "trash")
770
+ thlist = []
771
+ for i in newlist:
772
+ if len (i) > 1:
773
+ thlist.append (i)
774
+
775
+ #unique (no duplicate words
776
+ #oneliner from german python forum => unique list
777
+ unlist = [thlist[i] for i in range(len(thlist)) if thlist[i] not in thlist[:i]]
778
+
779
+ #sort lowercase
780
+ def _cmp(a,b):
781
+ return ((a > b) - (a < b))
782
+ unlist.sort(key=cmp_to_key(lambda a, b: _cmp(a.lower(), b.lower())))
783
+
784
+ #this is more convenient, isn't it?
785
+ self.AutoCompSetIgnoreCase(True)
786
+
787
+ #join again together in a string
788
+ stringlist = " ".join(unlist)
789
+
790
+ #pos von 0 noch ausrechnen
791
+
792
+ #how big is the offset?
793
+ cpos = self.GetCurrentPos() - 1
794
+ while chr (self.GetCharAt (cpos)).isalnum():
795
+ cpos -= 1
796
+
797
+ #the most important part
798
+ self.AutoCompShow(self.GetCurrentPos() - cpos -1, stringlist)
799
+
800
+
801
+ def clearCommand(self):
802
+ """Delete the current, unexecuted command."""
803
+ startpos = self.promptPosEnd
804
+ endpos = self.GetTextLength()
805
+ self.SetSelection(startpos, endpos)
806
+ self.ReplaceSelection('')
807
+ self.more = False
808
+
809
+ def OnHistoryReplace(self, step):
810
+ """Replace with the previous/next command from the history buffer."""
811
+ self.clearCommand()
812
+ self.replaceFromHistory(step)
813
+
814
+ def replaceFromHistory(self, step):
815
+ """Replace selection with command from the history buffer."""
816
+ ps2 = str(sys.ps2)
817
+ self.ReplaceSelection('')
818
+ newindex = self.historyIndex + step
819
+ if -1 <= newindex <= len(self.history):
820
+ self.historyIndex = newindex
821
+ if 0 <= newindex <= len(self.history)-1:
822
+ command = self.history[self.historyIndex]
823
+ command = command.replace('\n', os.linesep + ps2)
824
+ self.ReplaceSelection(command)
825
+
826
+ def OnHistoryInsert(self, step):
827
+ """Insert the previous/next command from the history buffer."""
828
+ if not self.CanEdit():
829
+ return
830
+ startpos = self.GetCurrentPos()
831
+ self.replaceFromHistory(step)
832
+ endpos = self.GetCurrentPos()
833
+ self.SetSelection(endpos, startpos)
834
+
835
+ def OnHistorySearch(self):
836
+ """Search up the history buffer for the text in front of the cursor."""
837
+ if not self.CanEdit():
838
+ return
839
+ startpos = self.GetCurrentPos()
840
+ # The text up to the cursor is what we search for.
841
+ numCharsAfterCursor = self.GetTextLength() - startpos
842
+ searchText = self.getCommand(rstrip=False)
843
+ if numCharsAfterCursor > 0:
844
+ searchText = searchText[:-numCharsAfterCursor]
845
+ if not searchText:
846
+ return
847
+ # Search upwards from the current history position and loop
848
+ # back to the beginning if we don't find anything.
849
+ if (self.historyIndex <= -1) \
850
+ or (self.historyIndex >= len(self.history)-2):
851
+ searchOrder = range(len(self.history))
852
+ else:
853
+ ls = list(range(len(self.history)))
854
+ searchOrder = ls[self.historyIndex+1:] + ls[:self.historyIndex]
855
+ for i in searchOrder:
856
+ command = self.history[i]
857
+ if command[:len(searchText)] == searchText:
858
+ # Replace the current selection with the one we found.
859
+ self.ReplaceSelection(command[len(searchText):])
860
+ endpos = self.GetCurrentPos()
861
+ self.SetSelection(endpos, startpos)
862
+ # We've now warped into middle of the history.
863
+ self.historyIndex = i
864
+ break
865
+
866
+ def setStatusText(self, text):
867
+ """Display status information."""
868
+
869
+ # This method will likely be replaced by the enclosing app to
870
+ # do something more interesting, like write to a status bar.
871
+ print(text)
872
+
873
+ def insertLineBreak(self):
874
+ """Insert a new line break."""
875
+ if self.CanEdit():
876
+ self.write(os.linesep)
877
+ self.more = True
878
+ self.prompt()
879
+
880
+ def processLine(self):
881
+ """Process the line of text at which the user hit Enter."""
882
+
883
+ # The user hit ENTER and we need to decide what to do. They
884
+ # could be sitting on any line in the shell.
885
+
886
+ thepos = self.GetCurrentPos()
887
+ startpos = self.promptPosEnd
888
+ endpos = self.GetTextLength()
889
+ ps2 = str(sys.ps2)
890
+ # If they hit RETURN inside the current command, execute the
891
+ # command.
892
+ if self.CanEdit():
893
+ self.SetCurrentPos(endpos)
894
+ self.interp.more = False
895
+ command = self.GetTextRange(startpos, endpos)
896
+ lines = command.split(os.linesep + ps2)
897
+ lines = [line.rstrip() for line in lines]
898
+ command = '\n'.join(lines)
899
+ if self.reader.isreading:
900
+ if not command:
901
+ # Match the behavior of the standard Python shell
902
+ # when the user hits return without entering a
903
+ # value.
904
+ command = '\n'
905
+ self.reader.input = command
906
+ self.write(os.linesep)
907
+ else:
908
+ self.push(command)
909
+ wx.CallLater(1, self.EnsureCaretVisible)
910
+ # Or replace the current command with the other command.
911
+ else:
912
+ # If the line contains a command (even an invalid one).
913
+ if self.getCommand(rstrip=False):
914
+ command = self.getMultilineCommand()
915
+ self.clearCommand()
916
+ self.write(command)
917
+ # Otherwise, put the cursor back where we started.
918
+ else:
919
+ self.SetCurrentPos(thepos)
920
+ self.SetAnchor(thepos)
921
+
922
+ def getMultilineCommand(self, rstrip=True):
923
+ """Extract a multi-line command from the editor.
924
+
925
+ The command may not necessarily be valid Python syntax."""
926
+ # XXX Need to extract real prompts here. Need to keep track of
927
+ # the prompt every time a command is issued.
928
+ ps1 = str(sys.ps1)
929
+ ps1size = len(ps1)
930
+ ps2 = str(sys.ps2)
931
+ ps2size = len(ps2)
932
+ # This is a total hack job, but it works.
933
+ text = self.GetCurLine()[0]
934
+ line = self.GetCurrentLine()
935
+ while text[:ps2size] == ps2 and line > 0:
936
+ line -= 1
937
+ self.GotoLine(line)
938
+ text = self.GetCurLine()[0]
939
+ if text[:ps1size] == ps1:
940
+ line = self.GetCurrentLine()
941
+ self.GotoLine(line)
942
+ startpos = self.GetCurrentPos() + ps1size
943
+ line += 1
944
+ self.GotoLine(line)
945
+ while self.GetCurLine()[0][:ps2size] == ps2 and line < self.LineCount:
946
+ line += 1
947
+ self.GotoLine(line)
948
+ stoppos = self.GetCurrentPos()
949
+ command = self.GetTextRange(startpos, stoppos)
950
+ command = command.replace(os.linesep + ps2, '\n')
951
+ command = command.rstrip()
952
+ command = command.replace('\n', os.linesep + ps2)
953
+ else:
954
+ command = ''
955
+ if rstrip:
956
+ command = command.rstrip()
957
+ return command
958
+
959
+ def getCommand(self, text=None, rstrip=True):
960
+ """Extract a command from text which may include a shell prompt.
961
+
962
+ The command may not necessarily be valid Python syntax."""
963
+ if not text:
964
+ text = self.GetCurLine()[0]
965
+ # Strip the prompt off the front leaving just the command.
966
+ command = self.lstripPrompt(text)
967
+ if command == text:
968
+ command = '' # Real commands have prompts.
969
+ if rstrip:
970
+ command = command.rstrip()
971
+ return command
972
+
973
+ def lstripPrompt(self, text):
974
+ """Return text without a leading prompt."""
975
+ ps1 = str(sys.ps1)
976
+ ps1size = len(ps1)
977
+ ps2 = str(sys.ps2)
978
+ ps2size = len(ps2)
979
+ # Strip the prompt off the front of text.
980
+ if text[:ps1size] == ps1:
981
+ text = text[ps1size:]
982
+ elif text[:ps2size] == ps2:
983
+ text = text[ps2size:]
984
+ return text
985
+
986
+ def push(self, command, silent = False):
987
+ """Send command to the interpreter for execution."""
988
+ if not silent:
989
+ self.write(os.linesep)
990
+
991
+ #DNM
992
+ if USE_MAGIC:
993
+ command=magic(command)
994
+
995
+ busy = wx.BusyCursor()
996
+ self.waiting = True
997
+ self.lastUpdate=None
998
+ self.more = self.interp.push(command)
999
+ self.lastUpdate=None
1000
+ self.waiting = False
1001
+ del busy
1002
+ if not self.more:
1003
+ self.addHistory(command.rstrip())
1004
+ if not silent:
1005
+ self.prompt()
1006
+
1007
+ def addHistory(self, command):
1008
+ """Add command to the command history."""
1009
+ # Reset the history position.
1010
+ self.historyIndex = -1
1011
+ # Insert this command into the history, unless it's a blank
1012
+ # line or the same as the last command.
1013
+ if command != '' \
1014
+ and (len(self.history) == 0 or command != self.history[0]):
1015
+ self.history.insert(0, command)
1016
+ dispatcher.send(signal="Shell.addHistory", command=command)
1017
+
1018
+ def write(self, text):
1019
+ """Display text in the shell.
1020
+
1021
+ Replace line endings with OS-specific endings."""
1022
+ text = self.fixLineEndings(text)
1023
+ self.AddText(text)
1024
+ self.EnsureCaretVisible()
1025
+
1026
+ if self.waiting:
1027
+ if self.lastUpdate==None:
1028
+ self.lastUpdate=time.time()
1029
+ if time.time()-self.lastUpdate > PRINT_UPDATE_MAX_TIME:
1030
+ self.Update()
1031
+ self.lastUpdate=time.time()
1032
+
1033
+ def fixLineEndings(self, text):
1034
+ """Return text with line endings replaced by OS-specific endings."""
1035
+ lines = text.split('\r\n')
1036
+ for l in range(len(lines)):
1037
+ chunks = lines[l].split('\r')
1038
+ for c in range(len(chunks)):
1039
+ chunks[c] = os.linesep.join(chunks[c].split('\n'))
1040
+ lines[l] = os.linesep.join(chunks)
1041
+ text = os.linesep.join(lines)
1042
+ return text
1043
+
1044
+ def prompt(self):
1045
+ """Display proper prompt for the context: ps1, ps2 or ps3.
1046
+
1047
+ If this is a continuation line, autoindent as necessary."""
1048
+ isreading = self.reader.isreading
1049
+ skip = False
1050
+ if isreading:
1051
+ prompt = str(sys.ps3)
1052
+ elif self.more:
1053
+ prompt = str(sys.ps2)
1054
+ else:
1055
+ prompt = str(sys.ps1)
1056
+ pos = self.GetCurLine()[1]
1057
+ if pos > 0:
1058
+ if isreading:
1059
+ skip = True
1060
+ else:
1061
+ self.write(os.linesep)
1062
+ if not self.more:
1063
+ self.promptPosStart = self.GetCurrentPos()
1064
+ if not skip:
1065
+ self.write(prompt)
1066
+ if not self.more:
1067
+ self.promptPosEnd = self.GetCurrentPos()
1068
+ # Keep the undo feature from undoing previous responses.
1069
+ self.EmptyUndoBuffer()
1070
+
1071
+ if self.more:
1072
+ line_num=self.GetCurrentLine()
1073
+ currentLine=self.GetLine(line_num)
1074
+ previousLine=self.GetLine(line_num-1)[len(prompt):]
1075
+ pstrip=previousLine.strip()
1076
+ lstrip=previousLine.lstrip()
1077
+
1078
+ # Get the first alnum word:
1079
+ first_word=[]
1080
+ for i in pstrip:
1081
+ if i.isalnum():
1082
+ first_word.append(i)
1083
+ else:
1084
+ break
1085
+ first_word = ''.join(first_word)
1086
+
1087
+ if pstrip == '':
1088
+ # because it is all whitespace!
1089
+ indent=previousLine.strip('\n').strip('\r')
1090
+ else:
1091
+ indent=previousLine[:(len(previousLine)-len(lstrip))]
1092
+ if pstrip[-1]==':' and \
1093
+ first_word in ['if','else','elif','for','while','with',
1094
+ 'def','class','try','except','finally']:
1095
+ indent+=' '*4
1096
+
1097
+ self.write(indent)
1098
+ self.EnsureCaretVisible()
1099
+ self.ScrollToColumn(0)
1100
+
1101
+ def readline(self):
1102
+ """Replacement for stdin.readline()."""
1103
+ input = ''
1104
+ reader = self.reader
1105
+ reader.isreading = True
1106
+ self.prompt()
1107
+ try:
1108
+ while not reader.input:
1109
+ wx.GetApp().Yield(onlyIfNeeded=True)
1110
+ input = reader.input
1111
+ finally:
1112
+ reader.input = ''
1113
+ reader.isreading = False
1114
+ input = str(input) # In case of Unicode.
1115
+ return input
1116
+
1117
+ def readlines(self):
1118
+ """Replacement for stdin.readlines()."""
1119
+ lines = []
1120
+ while lines[-1:] != ['\n']:
1121
+ lines.append(self.readline())
1122
+ return lines
1123
+
1124
+ def raw_input(self, prompt=''):
1125
+ """Return string based on user input."""
1126
+ if prompt:
1127
+ self.write(prompt)
1128
+ return self.readline()
1129
+
1130
+ def ask(self, prompt='Please enter your response:'):
1131
+ """Get response from the user using a dialog box."""
1132
+ dialog = wx.TextEntryDialog(None, prompt,
1133
+ 'Input Dialog (Raw)', '')
1134
+ try:
1135
+ if dialog.ShowModal() == wx.ID_OK:
1136
+ text = dialog.GetValue()
1137
+ return text
1138
+ finally:
1139
+ dialog.Destroy()
1140
+ return ''
1141
+
1142
+ def pause(self):
1143
+ """Halt execution pending a response from the user."""
1144
+ self.ask('Press enter to continue:')
1145
+
1146
+ def clear(self):
1147
+ """Delete all text from the shell."""
1148
+ self.ClearAll()
1149
+
1150
+ def run(self, command, prompt=True, verbose=True):
1151
+ """Execute command as if it was typed in directly.
1152
+ >>> shell.run('print("this")')
1153
+ >>> print("this")
1154
+ this
1155
+ >>>
1156
+ """
1157
+ # Go to the very bottom of the text.
1158
+ endpos = self.GetTextLength()
1159
+ self.SetCurrentPos(endpos)
1160
+ command = command.rstrip()
1161
+ if prompt: self.prompt()
1162
+ if verbose: self.write(command)
1163
+ self.push(command)
1164
+
1165
+ def runfile(self, filename):
1166
+ """Execute all commands in file as if they were typed into the
1167
+ shell."""
1168
+ self.prompt()
1169
+ with open(filename) as file_:
1170
+ for command in file_:
1171
+ if command[:6] == 'shell.':
1172
+ # Run shell methods silently.
1173
+ self.run(command, prompt=False, verbose=False)
1174
+ else:
1175
+ self.run(command, prompt=False, verbose=True)
1176
+
1177
+ def autoCompleteShow(self, command, offset = 0):
1178
+ """Display auto-completion popup list."""
1179
+ self.AutoCompSetAutoHide(self.autoCompleteAutoHide)
1180
+ self.AutoCompSetIgnoreCase(self.autoCompleteCaseInsensitive)
1181
+ list = self.interp.getAutoCompleteList(command,
1182
+ includeMagic=self.autoCompleteIncludeMagic,
1183
+ includeSingle=self.autoCompleteIncludeSingle,
1184
+ includeDouble=self.autoCompleteIncludeDouble)
1185
+ if list:
1186
+ options = ' '.join(list)
1187
+ #offset = 0
1188
+ self.AutoCompShow(offset, options)
1189
+
1190
+ def autoCallTipShow(self, command, insertcalltip = True, forceCallTip = False):
1191
+ """Display argument spec and docstring in a popup window."""
1192
+ if self.CallTipActive():
1193
+ self.CallTipCancel()
1194
+ (name, argspec, tip) = self.interp.getCallTip(command)
1195
+ if tip:
1196
+ dispatcher.send(signal='Shell.calltip', sender=self, calltip=tip)
1197
+ if not self.autoCallTip and not forceCallTip:
1198
+ return
1199
+ startpos = self.GetCurrentPos()
1200
+ if argspec and insertcalltip and self.callTipInsert:
1201
+ self.write(argspec + ')')
1202
+ endpos = self.GetCurrentPos()
1203
+ self.SetSelection(startpos, endpos)
1204
+ if tip:
1205
+ tippos = startpos - (len(name) + 1)
1206
+ fallback = startpos - self.GetColumn(startpos)
1207
+ # In case there isn't enough room, only go back to the
1208
+ # fallback.
1209
+ tippos = max(tippos, fallback)
1210
+ self.CallTipShow(tippos, tip)
1211
+
1212
+ def OnCallTipAutoCompleteManually (self, shiftDown):
1213
+ """AutoComplete and Calltips manually."""
1214
+ if self.AutoCompActive():
1215
+ self.AutoCompCancel()
1216
+ currpos = self.GetCurrentPos()
1217
+ stoppos = self.promptPosEnd
1218
+
1219
+ cpos = currpos
1220
+ #go back until '.' is found
1221
+ pointavailpos = -1
1222
+ while cpos >= stoppos:
1223
+ if self.GetCharAt(cpos) == ord ('.'):
1224
+ pointavailpos = cpos
1225
+ break
1226
+ cpos -= 1
1227
+
1228
+ #word from non whitespace until '.'
1229
+ if pointavailpos != -1:
1230
+ #look backward for first whitespace char
1231
+ textbehind = self.GetTextRange (pointavailpos + 1, currpos)
1232
+ pointavailpos += 1
1233
+
1234
+ if not shiftDown:
1235
+ #call AutoComplete
1236
+ stoppos = self.promptPosEnd
1237
+ textbefore = self.GetTextRange(stoppos, pointavailpos)
1238
+ self.autoCompleteShow(textbefore, len (textbehind))
1239
+ else:
1240
+ #call CallTips
1241
+ cpos = pointavailpos
1242
+ begpos = -1
1243
+ while cpos > stoppos:
1244
+ if chr(self.GetCharAt(cpos)).isspace():
1245
+ begpos = cpos
1246
+ break
1247
+ cpos -= 1
1248
+ if begpos == -1:
1249
+ begpos = cpos
1250
+ ctips = self.GetTextRange (begpos, currpos)
1251
+ ctindex = ctips.find ('(')
1252
+ if ctindex != -1 and not self.CallTipActive():
1253
+ #insert calltip, if current pos is '(', otherwise show it only
1254
+ self.autoCallTipShow(ctips[:ctindex + 1],
1255
+ self.GetCharAt(currpos - 1) == ord('(') and \
1256
+ self.GetCurrentPos() == self.GetTextLength(),
1257
+ True)
1258
+
1259
+
1260
+ def writeOut(self, text):
1261
+ """Replacement for stdout."""
1262
+ self.write(text)
1263
+
1264
+ def writeErr(self, text):
1265
+ """Replacement for stderr."""
1266
+ self.write(text)
1267
+
1268
+ def redirectStdin(self, redirect=True):
1269
+ """If redirect is true then sys.stdin will come from the shell."""
1270
+ if redirect:
1271
+ sys.stdin = self.reader
1272
+ else:
1273
+ sys.stdin = self.stdin
1274
+
1275
+ def redirectStdout(self, redirect=True):
1276
+ """If redirect is true then sys.stdout will go to the shell."""
1277
+ if redirect:
1278
+ sys.stdout = PseudoFileOut(self.writeOut)
1279
+ else:
1280
+ sys.stdout = self.stdout
1281
+
1282
+ def redirectStderr(self, redirect=True):
1283
+ """If redirect is true then sys.stderr will go to the shell."""
1284
+ if redirect:
1285
+ sys.stderr = PseudoFileErr(self.writeErr)
1286
+ else:
1287
+ sys.stderr = self.stderr
1288
+
1289
+ def CanCut(self):
1290
+ """Return true if text is selected and can be cut."""
1291
+ if self.GetSelectionStart() != self.GetSelectionEnd() \
1292
+ and self.GetSelectionStart() >= self.promptPosEnd \
1293
+ and self.GetSelectionEnd() >= self.promptPosEnd:
1294
+ return True
1295
+ else:
1296
+ return False
1297
+
1298
+ def CanPaste(self):
1299
+ """Return true if a paste should succeed."""
1300
+ if self.CanEdit() and editwindow.EditWindow.CanPaste(self):
1301
+ return True
1302
+ else:
1303
+ return False
1304
+
1305
+ def CanEdit(self):
1306
+ """Return true if editing should succeed."""
1307
+ if self.GetSelectionStart() != self.GetSelectionEnd():
1308
+ if self.GetSelectionStart() >= self.promptPosEnd \
1309
+ and self.GetSelectionEnd() >= self.promptPosEnd:
1310
+ return True
1311
+ else:
1312
+ return False
1313
+ else:
1314
+ return self.GetCurrentPos() >= self.promptPosEnd
1315
+
1316
+ def Cut(self):
1317
+ """Remove selection and place it on the clipboard."""
1318
+ if self.CanCut() and self.CanCopy():
1319
+ if self.AutoCompActive():
1320
+ self.AutoCompCancel()
1321
+ if self.CallTipActive():
1322
+ self.CallTipCancel()
1323
+ self.Copy()
1324
+ self.ReplaceSelection('')
1325
+
1326
+ def Copy(self):
1327
+ """Copy selection and place it on the clipboard."""
1328
+ if self.CanCopy():
1329
+ ps1 = str(sys.ps1)
1330
+ ps2 = str(sys.ps2)
1331
+ command = self.GetSelectedText()
1332
+ command = command.replace(os.linesep + ps2, os.linesep)
1333
+ command = command.replace(os.linesep + ps1, os.linesep)
1334
+ command = self.lstripPrompt(text=command)
1335
+ data = wx.TextDataObject(command)
1336
+ self._clip(data)
1337
+
1338
+ def CopyWithPrompts(self):
1339
+ """Copy selection, including prompts, and place it on the clipboard."""
1340
+ if self.CanCopy():
1341
+ command = self.GetSelectedText()
1342
+ data = wx.TextDataObject(command)
1343
+ self._clip(data)
1344
+
1345
+ def CopyWithPromptsPrefixed(self):
1346
+ """Copy selection, including prompts prefixed with four
1347
+ spaces, and place it on the clipboard."""
1348
+ if self.CanCopy():
1349
+ command = self.GetSelectedText()
1350
+ spaces = ' ' * 4
1351
+ command = spaces + command.replace(os.linesep,
1352
+ os.linesep + spaces)
1353
+ data = wx.TextDataObject(command)
1354
+ self._clip(data)
1355
+
1356
+ def _clip(self, data):
1357
+ if wx.TheClipboard.Open():
1358
+ wx.TheClipboard.UsePrimarySelection(False)
1359
+ wx.TheClipboard.SetData(data)
1360
+ wx.TheClipboard.Flush()
1361
+ wx.TheClipboard.Close()
1362
+
1363
+ def Paste(self):
1364
+ """Replace selection with clipboard contents."""
1365
+ if self.CanPaste() and wx.TheClipboard.Open():
1366
+ ps2 = str(sys.ps2)
1367
+ if wx.TheClipboard.IsSupported(wx.DataFormat(wx.DF_UNICODETEXT)):
1368
+ data = wx.TextDataObject()
1369
+ if wx.TheClipboard.GetData(data):
1370
+ self.ReplaceSelection('')
1371
+ command = data.GetText()
1372
+ command = command.rstrip()
1373
+ command = self.fixLineEndings(command)
1374
+ command = self.lstripPrompt(text=command)
1375
+ command = command.replace(os.linesep + ps2, '\n')
1376
+ command = command.replace(os.linesep, '\n')
1377
+ command = command.replace('\n', os.linesep + ps2)
1378
+ self.write(command)
1379
+ wx.TheClipboard.Close()
1380
+
1381
+
1382
+ def PasteAndRun(self):
1383
+ """Replace selection with clipboard contents, run commands."""
1384
+ text = ''
1385
+ if wx.TheClipboard.Open():
1386
+ if wx.TheClipboard.IsSupported(wx.DataFormat(wx.DF_UNICODETEXT)):
1387
+ data = wx.TextDataObject()
1388
+ if wx.TheClipboard.GetData(data):
1389
+ text = data.GetText()
1390
+ wx.TheClipboard.Close()
1391
+ if text:
1392
+ self.Execute(text)
1393
+
1394
+
1395
+ def Execute(self, text):
1396
+ """Replace selection with text and run commands."""
1397
+ ps1 = str(sys.ps1)
1398
+ ps2 = str(sys.ps2)
1399
+ endpos = self.GetTextLength()
1400
+ self.SetCurrentPos(endpos)
1401
+ startpos = self.promptPosEnd
1402
+ self.SetSelection(startpos, endpos)
1403
+ self.ReplaceSelection('')
1404
+ text = text.lstrip()
1405
+ text = self.fixLineEndings(text)
1406
+ text = self.lstripPrompt(text)
1407
+ text = text.replace(os.linesep + ps1, '\n')
1408
+ text = text.replace(os.linesep + ps2, '\n')
1409
+ text = text.replace(os.linesep, '\n')
1410
+ lines = text.split('\n')
1411
+ commands = []
1412
+ command = ''
1413
+ for line in lines:
1414
+ if line.strip() == ps2.strip():
1415
+ # If we are pasting from something like a
1416
+ # web page that drops the trailing space
1417
+ # from the ps2 prompt of a blank line.
1418
+ line = ''
1419
+ lstrip = line.lstrip()
1420
+ if line.strip() != '' and lstrip == line and \
1421
+ lstrip[:4] not in ['else','elif'] and \
1422
+ lstrip[:6] != 'except' and \
1423
+ lstrip[:7] != 'finally':
1424
+ # New command.
1425
+ if command:
1426
+ # Add the previous command to the list.
1427
+ commands.append(command)
1428
+ # Start a new command, which may be multiline.
1429
+ command = line
1430
+ else:
1431
+ # Multiline command. Add to the command.
1432
+ command += '\n'
1433
+ command += line
1434
+ commands.append(command)
1435
+ for command in commands:
1436
+ command = command.replace('\n', os.linesep + ps2)
1437
+ self.write(command)
1438
+ self.processLine()
1439
+
1440
+
1441
+ def wrap(self, wrap=True):
1442
+ """Sets whether text is word wrapped."""
1443
+ self.SetWrapMode(wrap)
1444
+
1445
+ def zoom(self, points=0):
1446
+ """Set the zoom level.
1447
+
1448
+ This number of points is added to the size of all fonts. It
1449
+ may be positive to magnify or negative to reduce."""
1450
+ self.SetZoom(points)
1451
+
1452
+
1453
+
1454
+ def LoadSettings(self, config):
1455
+ self.autoComplete = \
1456
+ config.ReadBool('Options/AutoComplete', True)
1457
+ self.autoCompleteIncludeMagic = \
1458
+ config.ReadBool('Options/AutoCompleteIncludeMagic', True)
1459
+ self.autoCompleteIncludeSingle = \
1460
+ config.ReadBool('Options/AutoCompleteIncludeSingle', True)
1461
+ self.autoCompleteIncludeDouble = \
1462
+ config.ReadBool('Options/AutoCompleteIncludeDouble', True)
1463
+
1464
+ self.autoCallTip = config.ReadBool('Options/AutoCallTip', True)
1465
+ self.callTipInsert = config.ReadBool('Options/CallTipInsert', True)
1466
+ self.SetWrapMode(config.ReadBool('View/WrapMode', True))
1467
+
1468
+ self.lineNumbers = config.ReadBool('View/ShowLineNumbers', True)
1469
+ self.setDisplayLineNumbers (self.lineNumbers)
1470
+ zoom = config.ReadInt('View/Zoom/Shell', -99)
1471
+ if zoom != -99:
1472
+ self.SetZoom(zoom)
1473
+
1474
+
1475
+ def SaveSettings(self, config):
1476
+ config.WriteBool('Options/AutoComplete', self.autoComplete)
1477
+ config.WriteBool('Options/AutoCompleteIncludeMagic',
1478
+ self.autoCompleteIncludeMagic)
1479
+ config.WriteBool('Options/AutoCompleteIncludeSingle',
1480
+ self.autoCompleteIncludeSingle)
1481
+ config.WriteBool('Options/AutoCompleteIncludeDouble',
1482
+ self.autoCompleteIncludeDouble)
1483
+ config.WriteBool('Options/AutoCallTip', self.autoCallTip)
1484
+ config.WriteBool('Options/CallTipInsert', self.callTipInsert)
1485
+ config.WriteBool('View/WrapMode', self.GetWrapMode())
1486
+ config.WriteBool('View/ShowLineNumbers', self.lineNumbers)
1487
+ config.WriteInt('View/Zoom/Shell', self.GetZoom())
1488
+
1489
+ def GetContextMenu(self):
1490
+ """
1491
+ Create and return a context menu for the shell.
1492
+ This is used instead of the scintilla default menu
1493
+ in order to correctly respect our immutable buffer.
1494
+ """
1495
+ menu = wx.Menu()
1496
+ menu.Append(self.ID_UNDO, "Undo")
1497
+ menu.Append(self.ID_REDO, "Redo")
1498
+
1499
+ menu.AppendSeparator()
1500
+
1501
+ menu.Append(self.ID_CUT, "Cut")
1502
+ menu.Append(self.ID_COPY, "Copy")
1503
+ menu.Append(frame.ID_COPY_PLUS, "Copy With Prompts")
1504
+ menu.Append(self.ID_PASTE, "Paste")
1505
+ menu.Append(frame.ID_PASTE_PLUS, "Paste And Run")
1506
+ menu.Append(self.ID_CLEAR, "Clear")
1507
+
1508
+ menu.AppendSeparator()
1509
+
1510
+ menu.Append(self.ID_SELECTALL, "Select All")
1511
+ return menu
1512
+
1513
+ def OnContextMenu(self, evt):
1514
+ menu = self.GetContextMenu()
1515
+ self.PopupMenu(menu)
1516
+
1517
+
1518
+
1519
+
1520
+ ## NOTE: The DnD of file names is disabled until we can figure out how
1521
+ ## best to still allow DnD of text.
1522
+
1523
+
1524
+ ## #seb : File drag and drop
1525
+ ## class FileDropTarget(wx.FileDropTarget):
1526
+ ## def __init__(self, obj):
1527
+ ## wx.FileDropTarget.__init__(self)
1528
+ ## self.obj = obj
1529
+ ## def OnDropFiles(self, x, y, filenames):
1530
+ ## if len(filenames) == 1:
1531
+ ## txt = 'r\"%s\"' % filenames[0]
1532
+ ## else:
1533
+ ## txt = '( '
1534
+ ## for f in filenames:
1535
+ ## txt += 'r\"%s\" , ' % f
1536
+ ## txt += ')'
1537
+ ## self.obj.AppendText(txt)
1538
+ ## pos = self.obj.GetCurrentPos()
1539
+ ## self.obj.SetCurrentPos( pos )
1540
+ ## self.obj.SetSelection( pos, pos )
1541
+
1542
+
1543
+
1544
+ ## class TextAndFileDropTarget(wx.DropTarget):
1545
+ ## def __init__(self, shell):
1546
+ ## wx.DropTarget.__init__(self)
1547
+ ## self.shell = shell
1548
+ ## self.compdo = wx.DataObjectComposite()
1549
+ ## self.textdo = wx.TextDataObject()
1550
+ ## self.filedo = wx.FileDataObject()
1551
+ ## self.compdo.Add(self.textdo)
1552
+ ## self.compdo.Add(self.filedo, True)
1553
+
1554
+ ## self.SetDataObject(self.compdo)
1555
+
1556
+ ## def OnDrop(self, x, y):
1557
+ ## return True
1558
+
1559
+ ## def OnData(self, x, y, result):
1560
+ ## self.GetData()
1561
+ ## if self.textdo.GetTextLength() > 1:
1562
+ ## text = self.textdo.GetText()
1563
+ ## # *** Do something with the dragged text here...
1564
+ ## self.textdo.SetText('')
1565
+ ## else:
1566
+ ## filenames = str(self.filename.GetFilenames())
1567
+ ## if len(filenames) == 1:
1568
+ ## txt = 'r\"%s\"' % filenames[0]
1569
+ ## else:
1570
+ ## txt = '( '
1571
+ ## for f in filenames:
1572
+ ## txt += 'r\"%s\" , ' % f
1573
+ ## txt += ')'
1574
+ ## self.shell.AppendText(txt)
1575
+ ## pos = self.shell.GetCurrentPos()
1576
+ ## self.shell.SetCurrentPos( pos )
1577
+ ## self.shell.SetSelection( pos, pos )
1578
+
1579
+ ## return result