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
@@ -0,0 +1,1025 @@
1
+ #----------------------------------------------------------------------------
2
+ # Name: FloatCanvas.py
3
+ # Purpose:
4
+ #
5
+ # Author:
6
+ #
7
+ # Created:
8
+ # Version:
9
+ # Date:
10
+ # Licence:
11
+ # Tags: phoenix-port, unittest, documented, py3-port
12
+ #----------------------------------------------------------------------------
13
+ """
14
+ This is the main module of the floatcanvas package, it contains the :class:`~lib.floatcanvas.FloatCanvas.FloatCanvas`
15
+ and all the all the different objects which are sub-classed from :class:`~lib.floatcanvas.FloatCanvas.DrawObject`.
16
+
17
+ In the following very simple sample ``self`` is a frame, but it could be another
18
+ container type control::
19
+
20
+ from wx.lib.floatcanvas import FloatCanvas
21
+
22
+ self.Canvas = FloatCanvas.FloatCanvas(self, -1,
23
+ size=(500, 500),
24
+ ProjectionFun=None,
25
+ Debug=0,
26
+ BackgroundColor="White",
27
+ )
28
+
29
+
30
+ # add a circle
31
+ cir = FloatCanvas.Circle((10, 10), 100)
32
+ self.Canvas.AddObject(cir)
33
+
34
+ # add a rectangle
35
+ rect = FloatCanvas.Rectangle((110, 10), (100, 100), FillColor='Red')
36
+ self.Canvas.AddObject(rect)
37
+
38
+ self.Canvas.Draw()
39
+
40
+
41
+ Many samples are available in the `wxPhoenix/samples/floatcanvas` folder.
42
+
43
+ """
44
+
45
+ import sys
46
+ mac = sys.platform.startswith("darwin")
47
+
48
+ import numpy as np
49
+ try:
50
+ from time import process_time as clock
51
+ except ImportError:
52
+ from time import clock
53
+ import wx
54
+
55
+ from .FCObjects import *
56
+
57
+ from .Utilities import BBox
58
+ from . import GUIMode
59
+
60
+
61
+ ## Custom Exceptions:
62
+
63
+ class FloatCanvasError(Exception):
64
+ """Custom FloatCanvas exception."""
65
+ pass
66
+
67
+ ## Import all EVT_* event types and event binders
68
+ from .FCEvents import *
69
+
70
+
71
+ class _MouseEvent(wx.PyCommandEvent):
72
+
73
+ """
74
+ This event class takes a regular wxWindows mouse event as a parameter,
75
+ and wraps it so that there is access to all the original methods. This
76
+ is similar to subclassing, but you can't subclass a wxWindows event
77
+
78
+ The goal is to be able to it just like a regular mouse event.
79
+
80
+ It adds the method:
81
+
82
+ GetCoords() , which returns an (x,y) tuple in world coordinates.
83
+
84
+ Another difference is that it is a CommandEvent, which propagates up
85
+ the window hierarchy until it is handled.
86
+
87
+ """
88
+
89
+ def __init__(self, EventType, NativeEvent, WinID, Coords = None):
90
+ super(_MouseEvent, self).__init__()
91
+
92
+ self.SetEventType( EventType )
93
+ self._NativeEvent = NativeEvent
94
+ self.Coords = Coords
95
+
96
+ def GetCoords(self):
97
+ return self.Coords
98
+
99
+ def __getattr__(self, name):
100
+ d = self._getAttrDict()
101
+ if name in d:
102
+ return d[name]
103
+ return getattr(self._NativeEvent, name)
104
+
105
+
106
+ #---------------------------------------------------------------------------
107
+ class FloatCanvas(wx.Panel):
108
+ """
109
+ The main class of the floatcanvas package :class:`~lib.floatcanvas.FloatCanvas`.
110
+
111
+ """
112
+
113
+ def __init__(self, parent, id = -1,
114
+ size = wx.DefaultSize,
115
+ ProjectionFun = None,
116
+ BackgroundColor = "WHITE",
117
+ Debug = False,
118
+ **kwargs):
119
+
120
+ """
121
+ Default class constructor.
122
+
123
+ :param wx.Window `parent`: parent window. Must not be ``None``;
124
+ :param integer `id`: window identifier. A value of -1 indicates a default value;
125
+ :param `size`: a tuple or :class:`wx.Size`
126
+ :param `ProjectionFun`: This allows you to change the transform from
127
+ world to pixel coordinates. We can point to :meth:`~lib.floatcanvas.FloatCanvas.FloatCanvas.FlatEarthProjection`
128
+ for an example -- though that should really be a class method, or even
129
+ better, simply a function in the module. There is a tiny bit on info
130
+ in the error message in FloatCanvas.SetProjectionFun()
131
+
132
+ (Note: this really should get re-factored to allow more generic
133
+ projections...)
134
+ :param string `BackgroundColor`: any value accepted by :class:`wx.Brush`
135
+ :param `Debug`: activate debug, currently it prints some debugging
136
+ information, could be improved.
137
+
138
+ """
139
+
140
+ wx.Panel.__init__( self, parent, id, wx.DefaultPosition, size, **kwargs)
141
+
142
+ ComputeFontScale()
143
+ self.InitAll()
144
+
145
+ self.BackgroundBrush = wx.Brush(BackgroundColor, wx.SOLID)
146
+
147
+ self.Debug = Debug
148
+
149
+ self.Bind(wx.EVT_PAINT, self.OnPaint)
150
+ self.Bind(wx.EVT_SIZE, self.OnSize)
151
+
152
+ self.Bind(wx.EVT_LEFT_DOWN, self.LeftDownEvent)
153
+ self.Bind(wx.EVT_LEFT_UP, self.LeftUpEvent)
154
+ self.Bind(wx.EVT_LEFT_DCLICK, self.LeftDoubleClickEvent)
155
+ self.Bind(wx.EVT_MIDDLE_DOWN, self.MiddleDownEvent)
156
+ self.Bind(wx.EVT_MIDDLE_UP, self.MiddleUpEvent)
157
+ self.Bind(wx.EVT_MIDDLE_DCLICK, self.MiddleDoubleClickEvent)
158
+ self.Bind(wx.EVT_RIGHT_DOWN, self.RightDownEvent)
159
+ self.Bind(wx.EVT_RIGHT_UP, self.RightUpEvent)
160
+ self.Bind(wx.EVT_RIGHT_DCLICK, self.RightDoubleCLickEvent)
161
+ self.Bind(wx.EVT_MOTION, self.MotionEvent)
162
+ self.Bind(wx.EVT_MOUSEWHEEL, self.WheelEvent)
163
+ self.Bind(wx.EVT_KEY_DOWN, self.KeyDownEvent)
164
+ self.Bind(wx.EVT_KEY_UP, self.KeyUpEvent)
165
+
166
+
167
+ ## CHB: I'm leaving these out for now.
168
+ #self.Bind(wx.EVT_ENTER_WINDOW, self. )
169
+ #self.Bind(wx.EVT_LEAVE_WINDOW, self. )
170
+
171
+ self.SetProjectionFun(ProjectionFun)
172
+
173
+ self.GUIMode = None # making sure the arrribute exists
174
+ self.SetMode(GUIMode.GUIMouse()) # make the default Mouse Mode.
175
+
176
+ # timer to give a delay when re-sizing so that buffers aren't re-built too many times.
177
+ self.SizeTimer = wx.PyTimer(self.OnSizeTimer)
178
+
179
+ # self.InitializePanel()
180
+ # self.MakeNewBuffers()
181
+
182
+ # self.CreateCursors()
183
+
184
+
185
+ def InitAll(self):
186
+ """
187
+ Sets everything in the Canvas to default state.
188
+
189
+ It can be used to reset the Canvas
190
+
191
+ """
192
+
193
+ self.HitColorGenerator = None
194
+ self.UseHitTest = False
195
+
196
+ self.NumBetweenBlits = 500
197
+
198
+ ## create the Hit Test Dicts:
199
+ self.HitDict = None
200
+ self._HTdc = None
201
+
202
+ self._DrawList = []
203
+ self._ForeDrawList = []
204
+ self.InitializePanel()
205
+ self.MakeNewBuffers()
206
+ self.BoundingBox = BBox.NullBBox()
207
+ self.BoundingBoxDirty = False
208
+ self.MinScale = None
209
+ self.MaxScale = None
210
+ self.ViewPortCenter= np.array( (0,0), float)
211
+
212
+ self.SetProjectionFun(None)
213
+
214
+ self.MapProjectionVector = np.array( (1,1), float) # No Projection to start!
215
+ self.TransformVector = np.array( (1,-1), float) # default Transformation
216
+
217
+ self.Scale = 1
218
+ self.ObjectUnderMouse = None
219
+
220
+ self.GridUnder = None
221
+ self.GridOver = None
222
+
223
+ self._BackgroundDirty = True
224
+
225
+ def SetProjectionFun(self, ProjectionFun):
226
+ """
227
+ Set a custom projection function
228
+
229
+ :param `ProjectionFun`: valid entries are ``FlatEarth``, ``None``
230
+ or a callable object that takes the ``ViewPortCenter`` and returns
231
+ ``MapProjectionVector``
232
+
233
+ """
234
+ if ProjectionFun == 'FlatEarth':
235
+ self.ProjectionFun = self.FlatEarthProjection
236
+ elif callable(ProjectionFun):
237
+ self.ProjectionFun = ProjectionFun
238
+ elif ProjectionFun is None:
239
+ self.ProjectionFun = lambda x=None: np.array( (1,1), float)
240
+ else:
241
+ raise FloatCanvasError('Projectionfun must be either:'
242
+ ' "FlatEarth", None, or a callable object '
243
+ '(function, for instance) that takes the '
244
+ 'ViewPortCenter and returns a MapProjectionVector')
245
+
246
+ def FlatEarthProjection(self, CenterPoint):
247
+ """
248
+ Compute the scaling array for the flat-earth projection
249
+
250
+ :param `CenterPoint`: center point of viewport (lon, lat) -- the
251
+ longitude is scaled to the latitude of this point. a 2-tuple, or a
252
+ (2,) `NumPy <http://www.numpy.org/>`_ array of point coordinates
253
+
254
+ :returns : a (2,) numpy array that scales world coordinates. This
255
+ scaling is applied when converting to-from world to pixel coordinates.
256
+
257
+ """
258
+ MaxLatitude = 75 # these were determined essentially arbitrarily
259
+ MinLatitude = -75
260
+ Lat = min(CenterPoint[1],MaxLatitude)
261
+ Lat = max(Lat,MinLatitude)
262
+ return np.array((np.cos(np.pi*Lat/180),1),float)
263
+
264
+ def SetMode(self, Mode):
265
+ """
266
+ Set the GUImode to any of the available mode.
267
+
268
+ :param `Mode`: a valid GUI Mode, out of the box valid modes
269
+ are subclassed from :class:`~lib.floatcanvas.GUIMode.GUIBase` or a mode
270
+ can also be user defined.
271
+ """
272
+ # Set mode
273
+ if self.GUIMode is not None:
274
+ self.GUIMode.UnSet() # this lets the old mode clean up.
275
+ Mode.Canvas = self # make sure the mode is linked to this canvas
276
+ self.GUIMode = Mode
277
+ self.SetCursor(self.GUIMode.Cursor)
278
+
279
+ def MakeHitDict(self):
280
+ """Initialize the Hit dictionary."""
281
+ ##fixme: Should this just be None if nothing has been bound?
282
+ self.HitDict = {EVT_FC_LEFT_DOWN: {},
283
+ EVT_FC_LEFT_UP: {},
284
+ EVT_FC_LEFT_DCLICK: {},
285
+ EVT_FC_MIDDLE_DOWN: {},
286
+ EVT_FC_MIDDLE_UP: {},
287
+ EVT_FC_MIDDLE_DCLICK: {},
288
+ EVT_FC_RIGHT_DOWN: {},
289
+ EVT_FC_RIGHT_UP: {},
290
+ EVT_FC_RIGHT_DCLICK: {},
291
+ EVT_FC_ENTER_OBJECT: {},
292
+ EVT_FC_LEAVE_OBJECT: {},
293
+ }
294
+
295
+ def _RaiseMouseEvent(self, Event, EventType):
296
+ """
297
+ This is called in various other places to raise a Mouse Event.
298
+ """
299
+ pt = self.PixelToWorld( Event.GetPosition() )
300
+ evt = _MouseEvent(EventType, Event, self.GetId(), pt)
301
+ self.GetEventHandler().ProcessEvent(evt)
302
+
303
+ if wx.__version__ >= "2.8":
304
+ HitTestBitmapDepth = 32
305
+ #print("Using hit test code for 2.8")
306
+ def GetHitTestColor(self, xy):
307
+ """
308
+ Get the hit test colour
309
+
310
+ :param `xy`: the position to get the hit test colour for
311
+ """
312
+ if self._ForegroundHTBitmap:
313
+ pdata = wx.AlphaPixelData(self._ForegroundHTBitmap)
314
+ else:
315
+ pdata = wx.AlphaPixelData(self._HTBitmap)
316
+ if not pdata:
317
+ raise RuntimeError("Trouble Accessing Hit Test bitmap")
318
+ pacc = pdata.GetPixels()
319
+ pacc.MoveTo(pdata, xy[0], xy[1])
320
+ return pacc.Get()[:3]
321
+ else:
322
+ HitTestBitmapDepth = 24
323
+ #print("using pre-2.8 hit test code")
324
+ def GetHitTestColor(self, xy ):
325
+ """
326
+ Get the hit test colour
327
+
328
+ :param `xy`: the position to get the hit test colour for
329
+ """
330
+ dc = wx.MemoryDC()
331
+ if self._ForegroundHTBitmap:
332
+ dc.SelectObject(self._ForegroundHTBitmap)
333
+ else:
334
+ dc.SelectObject(self._HTBitmap)
335
+ hitcolor = dc.GetPixel( xy )
336
+ return hitcolor.Get()
337
+
338
+ def UnBindAll(self):
339
+ """Removes all bindings to Objects."""
340
+ self.HitDict = None
341
+
342
+ def _CallHitCallback(self, Object, xy, HitEvent):
343
+ """
344
+ A little book keeping to be done when a callback is called.
345
+ """
346
+ Object.HitCoords = self.PixelToWorld( xy )
347
+ Object.HitCoordsPixel = xy
348
+ Object.CallBackFuncs[HitEvent](Object)
349
+
350
+ def HitTest(self, event, HitEvent):
351
+ """Check if any objects in the dict for this event."""
352
+ if self.HitDict:
353
+ if HitEvent in self.HitDict:
354
+ xy = event.GetPosition()
355
+ color = self.GetHitTestColor( xy )
356
+ if color in self.HitDict[ HitEvent ]:
357
+ Object = self.HitDict[ HitEvent ][color]
358
+ self._CallHitCallback(Object, xy, HitEvent)
359
+ return True
360
+ return False
361
+
362
+
363
+ def MouseOverTest(self, event):
364
+ """Check if mouse is over an object."""
365
+ ##fixme: Can this be cleaned up?
366
+ if (self.HitDict and
367
+ (self.HitDict[EVT_FC_ENTER_OBJECT ] or
368
+ self.HitDict[EVT_FC_LEAVE_OBJECT ] )
369
+ ):
370
+ xy = event.GetPosition()
371
+ color = self.GetHitTestColor( xy )
372
+ OldObject = self.ObjectUnderMouse
373
+ ObjectCallbackCalled = False
374
+ if color in self.HitDict[ EVT_FC_ENTER_OBJECT ]:
375
+ Object = self.HitDict[ EVT_FC_ENTER_OBJECT][color]
376
+ if (OldObject is None):
377
+ try:
378
+ self._CallHitCallback(Object, xy, EVT_FC_ENTER_OBJECT)
379
+ ObjectCallbackCalled = True
380
+ except KeyError:
381
+ pass # this means the enter event isn't bound for that object
382
+ elif OldObject == Object: # the mouse is still on the same object
383
+ pass
384
+ ## Is the mouse on a different object as it was...
385
+ elif not (Object == OldObject):
386
+ # call the leave object callback
387
+ try:
388
+ self._CallHitCallback(OldObject, xy, EVT_FC_LEAVE_OBJECT)
389
+ ObjectCallbackCalled = True
390
+ except KeyError:
391
+ pass # this means the leave event isn't bound for that object
392
+ try:
393
+ self._CallHitCallback(Object, xy, EVT_FC_ENTER_OBJECT)
394
+ ObjectCallbackCalled = True
395
+ except KeyError:
396
+ pass # this means the enter event isn't bound for that object
397
+ ## set the new object under mouse
398
+ self.ObjectUnderMouse = Object
399
+ elif color in self.HitDict[ EVT_FC_LEAVE_OBJECT ]:
400
+ Object = self.HitDict[ EVT_FC_LEAVE_OBJECT][color]
401
+ self.ObjectUnderMouse = Object
402
+ else:
403
+ # no objects under mouse bound to mouse-over events
404
+ self.ObjectUnderMouse = None
405
+ if OldObject:
406
+ try:
407
+ ## Add the hit coords to the Object
408
+ self._CallHitCallback(OldObject, xy, EVT_FC_LEAVE_OBJECT)
409
+ ObjectCallbackCalled = True
410
+ except KeyError:
411
+ pass # this means the leave event isn't bound for that object
412
+ return ObjectCallbackCalled
413
+ return False
414
+
415
+ ## fixme: There is a lot of repeated code here
416
+ ## Is there a better way?
417
+ ## probably -- shouldn't there always be a GUIMode?
418
+ ## there could be a null GUI Mode, and use that instead of None
419
+ def LeftDoubleClickEvent(self, event):
420
+ """Left double click event."""
421
+ if self.GUIMode:
422
+ self.GUIMode.OnLeftDouble(event)
423
+ event.Skip()
424
+
425
+ def MiddleDownEvent(self, event):
426
+ """Middle down event."""
427
+ if self.GUIMode:
428
+ self.GUIMode.OnMiddleDown(event)
429
+ event.Skip()
430
+
431
+ def MiddleUpEvent(self, event):
432
+ """Middle up event."""
433
+ if self.GUIMode:
434
+ self.GUIMode.OnMiddleUp(event)
435
+ event.Skip()
436
+
437
+ def MiddleDoubleClickEvent(self, event):
438
+ """Middle double click event."""
439
+ if self.GUIMode:
440
+ self.GUIMode.OnMiddleDouble(event)
441
+ event.Skip()
442
+
443
+ def RightDoubleCLickEvent(self, event):
444
+ """Right double click event."""
445
+ if self.GUIMode:
446
+ self.GUIMode.OnRightDouble(event)
447
+ event.Skip()
448
+
449
+ def WheelEvent(self, event):
450
+ """Wheel event."""
451
+ if self.GUIMode:
452
+ self.GUIMode.OnWheel(event)
453
+ event.Skip()
454
+
455
+ def LeftDownEvent(self, event):
456
+ """Left down event."""
457
+ if self.GUIMode:
458
+ self.GUIMode.OnLeftDown(event)
459
+ event.Skip()
460
+
461
+ def LeftUpEvent(self, event):
462
+ """Left up event."""
463
+ if self.HasCapture():
464
+ self.ReleaseMouse()
465
+ if self.GUIMode:
466
+ self.GUIMode.OnLeftUp(event)
467
+ event.Skip()
468
+
469
+ def MotionEvent(self, event):
470
+ """Motion event."""
471
+ if self.GUIMode:
472
+ self.GUIMode.OnMove(event)
473
+ event.Skip()
474
+
475
+ def RightDownEvent(self, event):
476
+ """Right down event."""
477
+ if self.GUIMode:
478
+ self.GUIMode.OnRightDown(event)
479
+ event.Skip()
480
+
481
+ def RightUpEvent(self, event):
482
+ """Right up event."""
483
+ if self.GUIMode:
484
+ self.GUIMode.OnRightUp(event)
485
+ event.Skip()
486
+
487
+ def KeyDownEvent(self, event):
488
+ """Key down event."""
489
+ if self.GUIMode:
490
+ self.GUIMode.OnKeyDown(event)
491
+ event.Skip()
492
+
493
+ def KeyUpEvent(self, event):
494
+ """Key up event."""
495
+ if self.GUIMode:
496
+ self.GUIMode.OnKeyUp(event)
497
+ event.Skip()
498
+
499
+ def MakeNewBuffers(self):
500
+ """Make a new buffer."""
501
+ ##fixme: this looks like tortured logic!
502
+ self._BackgroundDirty = True
503
+ # Make new offscreen bitmap:
504
+ self._Buffer = wx.Bitmap(*self.PanelSize)
505
+ if self._ForeDrawList:
506
+ self._ForegroundBuffer = wx.Bitmap(*self.PanelSize)
507
+ if self.UseHitTest:
508
+ self.MakeNewForegroundHTBitmap()
509
+ else:
510
+ self._ForegroundHTBitmap = None
511
+ else:
512
+ self._ForegroundBuffer = None
513
+ self._ForegroundHTBitmap = None
514
+
515
+ if self.UseHitTest:
516
+ self.MakeNewHTBitmap()
517
+ else:
518
+ self._HTBitmap = None
519
+ self._ForegroundHTBitmap = None
520
+
521
+ def MakeNewHTBitmap(self):
522
+ """
523
+ Off screen Bitmap used for Hit tests on background objects
524
+
525
+ """
526
+ self._HTBitmap = wx.Bitmap(self.PanelSize[0],
527
+ self.PanelSize[1],
528
+ depth=self.HitTestBitmapDepth)
529
+
530
+ def MakeNewForegroundHTBitmap(self):
531
+ ## Note: the foreground and background HT bitmaps are in separate functions
532
+ ## so that they can be created separate --i.e. when a foreground is
533
+ ## added after the background is drawn
534
+ """
535
+ Off screen Bitmap used for Hit tests on foreground objects
536
+
537
+ """
538
+ self._ForegroundHTBitmap = wx.Bitmap(self.PanelSize[0],
539
+ self.PanelSize[1],
540
+ depth=self.HitTestBitmapDepth)
541
+
542
+ def OnSize(self, event=None):
543
+ """On size handler."""
544
+ self.InitializePanel()
545
+ self.SizeTimer.Start(50, oneShot=True)
546
+
547
+ def OnSizeTimer(self, event=None):
548
+ """On size timer handler."""
549
+ self.MakeNewBuffers()
550
+ self.Draw()
551
+
552
+ def InitializePanel(self):
553
+ """Initialize the panel."""
554
+ PanelSize = np.array(self.GetClientSize(), np.int32)
555
+ self.PanelSize = np.maximum(PanelSize, (2,2)) ## OS-X sometimes gives a Size event when the panel is size (0,0)
556
+ self.HalfPanelSize = self.PanelSize / 2 # lrk: added for speed in WorldToPixel
557
+ self.AspectRatio = float(self.PanelSize[0]) / self.PanelSize[1]
558
+
559
+ def OnPaint(self, event):
560
+ """On paint handler."""
561
+ dc = wx.PaintDC(self)
562
+ if self._ForegroundBuffer:
563
+ dc.DrawBitmap(self._ForegroundBuffer,0,0)
564
+ else:
565
+ dc.DrawBitmap(self._Buffer,0,0)
566
+ ## this was so that rubber band boxes and the like could get drawn here
567
+ ## but it looks like a wx.ClientDC is a better bet still.
568
+ #try:
569
+ # self.GUIMode.DrawOnTop(dc)
570
+ #except AttributeError:
571
+ # pass
572
+
573
+ def Draw(self, Force=False):
574
+ """
575
+
576
+ Canvas.Draw(Force=False)
577
+
578
+ Re-draws the canvas.
579
+
580
+ Note that the buffer will not be re-drawn unless something has
581
+ changed. If you change a DrawObject directly, then the canvas
582
+ will not know anything has changed. In this case, you can force
583
+ a re-draw by passing int True for the Force flag:
584
+
585
+ Canvas.Draw(Force=True)
586
+
587
+ There is a main buffer set up to double buffer the screen, so
588
+ you can get quick re-draws when the window gets uncovered.
589
+
590
+ If there are any objects in self._ForeDrawList, then the
591
+ background gets drawn to a new buffer, and the foreground
592
+ objects get drawn on top of it. The final result if blitted to
593
+ the screen, and stored for future Paint events. This is done so
594
+ that you can have a complicated background, but have something
595
+ changing on the foreground, without having to wait for the
596
+ background to get re-drawn. This can be used to support simple
597
+ animation, for instance.
598
+
599
+ """
600
+
601
+ if np.any(self.PanelSize <= 2 ):
602
+ # it's possible for this to get called before being properly initialized.
603
+ return
604
+ if self.Debug: start = clock()
605
+ ScreenDC = wx.ClientDC(self)
606
+ ViewPortWorld = np.array(( self.PixelToWorld((0,0)),
607
+ self.PixelToWorld(self.PanelSize) )
608
+ )
609
+ self.ViewPortBB = np.array( ( np.minimum.reduce(ViewPortWorld),
610
+ np.maximum.reduce(ViewPortWorld) ) )
611
+
612
+ dc = wx.MemoryDC()
613
+ dc.SelectObject(self._Buffer)
614
+ if self._BackgroundDirty or Force:
615
+ dc.SetBackground(self.BackgroundBrush)
616
+ dc.Clear()
617
+ if self._HTBitmap is not None:
618
+ HTdc = wx.MemoryDC()
619
+ HTdc.SelectObject(self._HTBitmap)
620
+ HTdc.Clear()
621
+ else:
622
+ HTdc = None
623
+ if self.GridUnder is not None:
624
+ self.GridUnder._Draw(dc, self)
625
+ self._DrawObjects(dc, self._DrawList, ScreenDC, self.ViewPortBB, HTdc)
626
+ self._BackgroundDirty = False
627
+ del HTdc
628
+
629
+ if self._ForeDrawList:
630
+ ## If an object was just added to the Foreground, there might not yet be a buffer
631
+ if self._ForegroundBuffer is None:
632
+ self._ForegroundBuffer = wx.Bitmap(self.PanelSize[0],
633
+ self.PanelSize[1])
634
+
635
+ dc = wx.MemoryDC() ## I got some strange errors (linewidths wrong) if I didn't make a new DC here
636
+ dc.SelectObject(self._ForegroundBuffer)
637
+ dc.DrawBitmap(self._Buffer,0,0)
638
+ if self._ForegroundHTBitmap is not None:
639
+ ForegroundHTdc = wx.MemoryDC()
640
+ ForegroundHTdc.SelectObject( self._ForegroundHTBitmap)
641
+ ForegroundHTdc.Clear()
642
+ if self._HTBitmap is not None:
643
+ #Draw the background HT buffer to the foreground HT buffer
644
+ ForegroundHTdc.DrawBitmap(self._HTBitmap, 0, 0)
645
+ else:
646
+ ForegroundHTdc = None
647
+ self._DrawObjects(dc,
648
+ self._ForeDrawList,
649
+ ScreenDC,
650
+ self.ViewPortBB,
651
+ ForegroundHTdc)
652
+ if self.GridOver is not None:
653
+ self.GridOver._Draw(dc, self)
654
+ ScreenDC.Blit(0, 0, self.PanelSize[0],self.PanelSize[1], dc, 0, 0)
655
+ # If the canvas is in the middle of a zoom or move,
656
+ # the Rubber Band box needs to be re-drawn
657
+ ##fixme: maybe GUIModes should never be None, and rather have a Do-nothing GUI-Mode.
658
+ if self.GUIMode is not None:
659
+ self.GUIMode.UpdateScreen()
660
+
661
+ if self.Debug:
662
+ print("Drawing took %f seconds of CPU time"%(clock()-start))
663
+ if self._HTBitmap is not None:
664
+ self._HTBitmap.SaveFile('junk.png', wx.BITMAP_TYPE_PNG)
665
+
666
+ ## Clear the font cache. If you don't do this, the X font server
667
+ ## starts to take up Massive amounts of memory This is mostly a
668
+ ## problem with very large fonts, that you get with scaled text
669
+ ## when zoomed in.
670
+ DrawObject.FontList = {}
671
+
672
+ def _ShouldRedraw(DrawList, ViewPortBB):
673
+ # lrk: Returns the objects that should be redrawn
674
+ ## fixme: should this check be moved into the object?
675
+ BB2 = ViewPortBB
676
+ redrawlist = []
677
+ for Object in DrawList:
678
+ if Object.BoundingBox.Overlaps(BB2):
679
+ redrawlist.append(Object)
680
+ return redrawlist
681
+ _ShouldRedraw = staticmethod(_ShouldRedraw)
682
+
683
+ def MoveImage(self, shift, CoordType, ReDraw=True):
684
+ """
685
+ Move the image in the window.
686
+
687
+ :param tuple `shift`: is an (x, y) tuple defining amount to shift in
688
+ each direction
689
+ :param string `CoordType`: defines what coordinates to use, valid entries
690
+ are:
691
+
692
+ ============== ======================================================
693
+ Coordtype Description
694
+ ============== ======================================================
695
+ `Panel` shift the image by some fraction of the size of the
696
+ displayed image
697
+ `Pixel` shift the image by some number of pixels
698
+ `World` shift the image by an amount of floating point world
699
+ coordinates
700
+ ============== ======================================================
701
+
702
+ """
703
+ shift = np.asarray(shift,float)
704
+ if CoordType.lower() == 'panel':# convert from panel coordinates
705
+ shift = shift * np.array((-1,1),float) *self.PanelSize/self.TransformVector
706
+ elif CoordType.lower() == 'pixel': # convert from pixel coordinates
707
+ shift = shift/self.TransformVector
708
+ elif CoordType.lower() == 'world': # No conversion
709
+ pass
710
+ else:
711
+ raise FloatCanvasError('CoordType must be either "Panel", "Pixel", or "World"')
712
+
713
+ self.ViewPortCenter = self.ViewPortCenter + shift
714
+ self.MapProjectionVector = self.ProjectionFun(self.ViewPortCenter)
715
+ self.TransformVector = np.array((self.Scale,-self.Scale),float) * self.MapProjectionVector
716
+ self._BackgroundDirty = True
717
+ if ReDraw:
718
+ self.Draw()
719
+
720
+ def Zoom(self, factor, center = None, centerCoords="World", keepPointInPlace=False):
721
+ """
722
+ Zoom(factor, center) changes the amount of zoom of the image by factor.
723
+ If factor is greater than one, the image gets larger.
724
+ If factor is less than one, the image gets smaller.
725
+ :param factor: amount to zoom in or out If factor is greater than one,
726
+ the image gets larger. If factor is less than one, the
727
+ image gets smaller.
728
+ :param center: a tuple of (x,y) coordinates of the center of the viewport,
729
+ after zooming. If center is not given, the center will stay the same.
730
+
731
+ :param centerCoords: flag indicating whether the center given is in pixel or world
732
+ coords. Options are: "World" or "Pixel"
733
+ :param keepPointInPlace: boolean flag. If False, the center point is what's given.
734
+ If True, the image is shifted so that the given center point
735
+ is kept in the same pixel space. This facilitates keeping the
736
+ same point under the mouse when zooming with the scroll wheel.
737
+ """
738
+ if center is None:
739
+ center = self.ViewPortCenter
740
+ centerCoords = 'World' #override input if they don't give a center point.
741
+
742
+ if centerCoords.lower() == "pixel":
743
+ oldpoint = self.PixelToWorld( center )
744
+ elif centerCoords.lower() == 'world':
745
+ oldpoint = np.array(center, float)
746
+ else:
747
+ raise FloatCanvasError('centerCoords must be either "World" or "Pixel"')
748
+
749
+ self.Scale = self.Scale*factor
750
+ if keepPointInPlace:
751
+ self.SetToNewScale(False)
752
+
753
+ if centerCoords.lower() == "pixel":
754
+ newpoint = self.PixelToWorld( center )
755
+ else:
756
+ newpoint = np.array(center, float)
757
+ delta = (newpoint - oldpoint)
758
+ self.MoveImage(-delta, 'World')
759
+ else:
760
+ self.ViewPortCenter = oldpoint
761
+ self.SetToNewScale()
762
+
763
+ def ZoomToBB(self, NewBB=None, DrawFlag=True):
764
+
765
+ """
766
+
767
+ Zooms the image to the bounding box given, or to the bounding
768
+ box of all the objects on the canvas, if none is given.
769
+
770
+ """
771
+ if NewBB is not None:
772
+ BoundingBox = NewBB
773
+ else:
774
+ if self.BoundingBoxDirty:
775
+ self._ResetBoundingBox()
776
+ BoundingBox = self.BoundingBox
777
+ if (BoundingBox is not None) and (not BoundingBox.IsNull()):
778
+ self.ViewPortCenter = np.array(((BoundingBox[0,0]+BoundingBox[1,0])/2,
779
+ (BoundingBox[0,1]+BoundingBox[1,1])/2 ),np.float64)
780
+ self.MapProjectionVector = self.ProjectionFun(self.ViewPortCenter)
781
+ # Compute the new Scale
782
+ BoundingBox = BoundingBox*self.MapProjectionVector # this does need to make a copy!
783
+ try:
784
+ self.Scale = min(abs(self.PanelSize[0] / (BoundingBox[1,0]-BoundingBox[0,0])),
785
+ abs(self.PanelSize[1] / (BoundingBox[1,1]-BoundingBox[0,1])) )*0.95
786
+ except ZeroDivisionError: # this will happen if the BB has zero width or height
787
+ try: #width == 0
788
+ self.Scale = (self.PanelSize[0] / (BoundingBox[1,0]-BoundingBox[0,0]))*0.95
789
+ except ZeroDivisionError:
790
+ try: # height == 0
791
+ self.Scale = (self.PanelSize[1] / (BoundingBox[1,1]-BoundingBox[0,1]))*0.95
792
+ except ZeroDivisionError: #zero size! (must be a single point)
793
+ self.Scale = 1
794
+
795
+ if DrawFlag:
796
+ self._BackgroundDirty = True
797
+ else:
798
+ # Reset the shifting and scaling to defaults when there is no BB
799
+ self.ViewPortCenter= np.array( (0,0), float)
800
+ self.Scale= 1
801
+ self.SetToNewScale(DrawFlag=DrawFlag)
802
+
803
+ def SetToNewScale(self, DrawFlag=True):
804
+ """
805
+ Set to the new scale
806
+
807
+ :param boolean `DrawFlag`: draw the canvas
808
+
809
+ """
810
+ Scale = self.Scale
811
+ if self.MinScale is not None:
812
+ Scale = max(Scale, self.MinScale)
813
+ if self.MaxScale is not None:
814
+ Scale = min(Scale, self.MaxScale)
815
+ self.MapProjectionVector = self.ProjectionFun(self.ViewPortCenter)
816
+ self.TransformVector = np.array((Scale,-Scale),float) * self.MapProjectionVector
817
+ self.Scale = Scale
818
+ self._BackgroundDirty = True
819
+ if DrawFlag:
820
+ self.Draw()
821
+
822
+ def RemoveObjects(self, Objects):
823
+ """"
824
+ Remove objects from canvas
825
+
826
+ :param list `Objects`: a list of :class:`DrawObjects` to remove
827
+
828
+ """
829
+ for Object in Objects:
830
+ self.RemoveObject(Object, ResetBB=False)
831
+ self.BoundingBoxDirty = True
832
+
833
+ def RemoveObject(self, Object, ResetBB=True):
834
+ """"
835
+ Remove object from canvas
836
+
837
+ :param DrawObject `Object`: a :class:`DrawObjects` to remove
838
+ :param boolean `ResetBB`: reset the bounding box
839
+
840
+ """
841
+ ##fixme: Using the list.remove method is kind of slow
842
+ if Object.InForeground:
843
+ self._ForeDrawList.remove(Object)
844
+ if not self._ForeDrawList:
845
+ self._ForegroundBuffer = None
846
+ self._ForegroundHTdc = None
847
+ else:
848
+ self._DrawList.remove(Object)
849
+ self._BackgroundDirty = True
850
+ if ResetBB:
851
+ self.BoundingBoxDirty = True
852
+
853
+ def ClearAll(self, ResetBB=True):
854
+ """
855
+ ClearAll(ResetBB=True)
856
+
857
+ Removes all DrawObjects from the Canvas
858
+
859
+ If ResetBB is set to False, the original bounding box will remain
860
+
861
+ """
862
+ self._DrawList = []
863
+ self._ForeDrawList = []
864
+ self._BackgroundDirty = True
865
+ self.HitColorGenerator = None
866
+ self.UseHitTest = False
867
+ if ResetBB:
868
+ self._ResetBoundingBox()
869
+ self.MakeNewBuffers()
870
+ self.HitDict = None
871
+
872
+ def _ResetBoundingBox(self):
873
+ SetToNull=False
874
+ if self._DrawList or self._ForeDrawList:
875
+ bblist = []
876
+ for obj in self._DrawList + self._ForeDrawList:
877
+ if not obj.BoundingBox.IsNull():
878
+ bblist.append(obj.BoundingBox)
879
+ if bblist: # if there are only NullBBoxes in DrawLists
880
+ self.BoundingBox = BBox.fromBBArray(bblist)
881
+ else:
882
+ SetToNull = True
883
+ if self.BoundingBox.Width == 0 or self.BoundingBox.Height == 0:
884
+ SetToNull=True
885
+ else:
886
+ SetToNull=True
887
+ if SetToNull:
888
+ self.BoundingBox = BBox.NullBBox()
889
+ self.ViewPortCenter= np.array( (0,0), float)
890
+ self.TransformVector = np.array( (1,-1), float)
891
+ self.MapProjectionVector = np.array( (1,1), float)
892
+ self.Scale = 1
893
+ self.BoundingBoxDirty = False
894
+
895
+ def PixelToWorld(self, Points):
896
+ """
897
+ Converts coordinates from Pixel coordinates to world coordinates.
898
+
899
+ Points is a tuple of (x,y) coordinates, or a list of such tuples,
900
+ or a NX2 Numpy array of x,y coordinates.
901
+
902
+ """
903
+ return (((np.asarray(Points, float) -
904
+ (self.PanelSize/2))/self.TransformVector) +
905
+ self.ViewPortCenter)
906
+
907
+ def WorldToPixel(self,Coordinates):
908
+ """
909
+ This function will get passed to the drawing functions of the objects,
910
+ to transform from world to pixel coordinates.
911
+ Coordinates should be a NX2 array of (x,y) coordinates, or
912
+ a 2-tuple, or sequence of 2-tuples.
913
+ """
914
+ #Note: this can be called by users code for various reasons, so N.asarray is needed.
915
+ return (((np.asarray(Coordinates,float) -
916
+ self.ViewPortCenter)*self.TransformVector)+
917
+ (self.HalfPanelSize)).astype('i')
918
+
919
+ def ScaleWorldToPixel(self,Lengths):
920
+ """
921
+ This function will get passed to the drawing functions of the objects,
922
+ to Change a length from world to pixel coordinates.
923
+
924
+ Lengths should be a NX2 array of (x,y) coordinates, or
925
+ a 2-tuple, or sequence of 2-tuples.
926
+ """
927
+ return ( (np.asarray(Lengths, float)*self.TransformVector) ).astype('i')
928
+
929
+ def ScalePixelToWorld(self,Lengths):
930
+ """
931
+ This function computes a pair of x.y lengths,
932
+ to change then from pixel to world coordinates.
933
+
934
+ Lengths should be a NX2 array of (x,y) coordinates, or
935
+ a 2-tuple, or sequence of 2-tuples.
936
+ """
937
+ return (np.asarray(Lengths,float) / self.TransformVector)
938
+
939
+ def AddObject(self, obj):
940
+ """
941
+ Add an object to the canvas
942
+
943
+ :param DrawObject `obj`: the object to add
944
+
945
+ :return: DrawObject
946
+
947
+ """
948
+ # put in a reference to the Canvas, so remove and other stuff can work
949
+ obj._Canvas = self
950
+ if obj.InForeground:
951
+ self._ForeDrawList.append(obj)
952
+ self.UseForeground = True
953
+ else:
954
+ self._DrawList.append(obj)
955
+ self._BackgroundDirty = True
956
+ self.BoundingBoxDirty = True
957
+ return obj
958
+
959
+ def AddObjects(self, Objects):
960
+ """
961
+ Add objects to the canvas
962
+
963
+ :param list `Objects`: a list of :class:`DrawObject`
964
+
965
+ """
966
+ for Object in Objects:
967
+ self.AddObject(Object)
968
+
969
+ def _DrawObjects(self, dc, DrawList, ScreenDC, ViewPortBB, HTdc=None):
970
+ """
971
+ This is a convenience function;
972
+
973
+ This function takes the list of objects and draws them to specified
974
+ device context.
975
+ """
976
+ dc.SetBackground(self.BackgroundBrush)
977
+ #i = 0
978
+ PanelSize0, PanelSize1 = self.PanelSize # for speed
979
+ WorldToPixel = self.WorldToPixel # for speed
980
+ ScaleWorldToPixel = self.ScaleWorldToPixel # for speed
981
+ Blit = ScreenDC.Blit # for speed
982
+ NumBetweenBlits = self.NumBetweenBlits # for speed
983
+ for i, Object in enumerate(self._ShouldRedraw(DrawList, ViewPortBB)):
984
+ if Object.Visible:
985
+ Object._Draw(dc, WorldToPixel, ScaleWorldToPixel, HTdc)
986
+ if (i+1) % NumBetweenBlits == 0:
987
+ Blit(0, 0, PanelSize0, PanelSize1, dc, 0, 0)
988
+
989
+ def SaveAsImage(self, filename, ImageType=wx.BITMAP_TYPE_PNG):
990
+ """
991
+ Saves the current image as an image file.
992
+
993
+ :param string `filename`: the name of the image file
994
+ :param `ImageType`: format to use, see :ref:`wx.BitmapType` and the note in
995
+ :meth:`wx.Bitmap.SaveFile`
996
+
997
+ """
998
+
999
+ self._Buffer.SaveFile(filename, ImageType)
1000
+
1001
+
1002
+ def _makeFloatCanvasAddMethods(): ## lrk's code for doing this in module __init__
1003
+ classnames = ["Circle", "Ellipse", "Arc", "Rectangle", "ScaledText", "Polygon",
1004
+ "Line", "Text", "PointSet","Point", "Arrow", "ArrowLine", "ScaledTextBox",
1005
+ "SquarePoint","Bitmap", "ScaledBitmap", "Spline", "Group"]
1006
+ for classname in classnames:
1007
+ klass = globals()[classname]
1008
+ def getaddshapemethod(klass=klass):
1009
+ def addshape(self, *args, **kwargs):
1010
+ Object = klass(*args, **kwargs)
1011
+ self.AddObject(Object)
1012
+ return Object
1013
+ return addshape
1014
+ addshapemethod = getaddshapemethod()
1015
+ methodname = "Add" + classname
1016
+ setattr(FloatCanvas, methodname, addshapemethod)
1017
+ docstring = "Creates %s and adds its reference to the canvas.\n" % classname
1018
+ docstring += "Argument protocol same as %s class" % classname
1019
+ if klass.__doc__:
1020
+ docstring += ", whose docstring is:\n%s" % klass.__doc__
1021
+ FloatCanvas.__dict__[methodname].__doc__ = docstring
1022
+
1023
+ _makeFloatCanvasAddMethods()
1024
+
1025
+