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,1441 @@
1
+ # -*- coding: utf-8 -*-
2
+ #----------------------------------------------------------------------------
3
+ # Name: toolbar.py
4
+ # Purpose:
5
+ #
6
+ # Author: Andrea Gavana <andrea.gavana@gmail.com>
7
+ #
8
+ # Created:
9
+ # Version:
10
+ # Date:
11
+ # Licence: wxWindows license
12
+ # Tags: phoenix-port, unittest, documented, py3-port
13
+ #----------------------------------------------------------------------------
14
+ """
15
+ A ribbon tool bar is similar to a traditional toolbar which has no labels.
16
+
17
+
18
+ Description
19
+ ===========
20
+
21
+ It contains one or more tool groups, each of which contains one or more tools.
22
+ Each tool is represented by a (generally small, i.e. 16x15) bitmap.
23
+
24
+
25
+ Events Processing
26
+ =================
27
+
28
+ This class processes the following events:
29
+
30
+ ====================================== ======================================
31
+ Event Name Description
32
+ ====================================== ======================================
33
+ ``EVT_RIBBONTOOLBAR_CLICKED`` Triggered when the normal (non-dropdown) region of a tool on the tool bar is clicked.
34
+ ``EVT_RIBBONTOOLBAR_DROPDOWN_CLICKED`` Triggered when the dropdown region of a tool on the tool bar is clicked. LRibbonToolBarEvent.PopupMenu should be called by the event handler if it wants to display a popup menu (which is what most dropdown tools should be doing).
35
+ ====================================== ======================================
36
+
37
+ """
38
+
39
+ import wx
40
+
41
+ from .control import RibbonControl
42
+ from .panel import RibbonPanel
43
+
44
+ from .art import *
45
+
46
+ wxEVT_COMMAND_RIBBONTOOL_CLICKED = wx.NewEventType()
47
+ wxEVT_COMMAND_RIBBONTOOL_DROPDOWN_CLICKED = wx.NewEventType()
48
+
49
+ EVT_RIBBONTOOLBAR_CLICKED = wx.PyEventBinder(wxEVT_COMMAND_RIBBONTOOL_CLICKED, 1)
50
+ EVT_RIBBONTOOLBAR_DROPDOWN_CLICKED = wx.PyEventBinder(wxEVT_COMMAND_RIBBONTOOL_DROPDOWN_CLICKED, 1)
51
+
52
+
53
+ def GetSizeInOrientation(size, orientation):
54
+
55
+ if orientation == wx.HORIZONTAL:
56
+ return size.GetWidth()
57
+
58
+ if orientation == wx.VERTICAL:
59
+ return size.GetHeight()
60
+
61
+ if orientation == wx.BOTH:
62
+ return size.GetWidth() * size.GetHeight()
63
+
64
+ return 0
65
+
66
+
67
+ class RibbonToolBarEvent(wx.PyCommandEvent):
68
+ """ Handles events related to :class:`RibbonToolBar`. """
69
+
70
+ def __init__(self, command_type=None, win_id=0, bar=None):
71
+ """
72
+ Default class constructor.
73
+
74
+ :param integer `command_type`: the event type;
75
+ :param integer `win_id`: the event identifier;
76
+ :param `bar`: an instance of :class:`RibbonToolBar`.
77
+ """
78
+
79
+ wx.PyCommandEvent.__init__(self, command_type, win_id)
80
+ self._bar = bar
81
+
82
+
83
+ def GetBar(self):
84
+ """ Returns an instance of :class:`RibbonToolBar`. """
85
+
86
+ return self._bar
87
+
88
+
89
+ def SetBar(self, bar):
90
+ """
91
+ Sets the current :class:`RibbonToolBar` for this event.
92
+
93
+ :param `bar`: an instance of :class:`RibbonToolBar`.
94
+ """
95
+
96
+ self._bar = bar
97
+
98
+
99
+ def PopupMenu(self, menu):
100
+ """
101
+ Pops up the given menu and returns control when the user has dismissed the menu.
102
+
103
+ If a menu item is selected, the corresponding menu event is generated and will
104
+ be processed as usual.
105
+
106
+ :param `menu`: the menu to pop up, an instance of :class:`wx.Menu`.
107
+
108
+ :note: Just before the menu is popped up, :meth:`wx.Menu.UpdateUI` is called to ensure
109
+ that the menu items are in the correct state. The menu does not get deleted by
110
+ the window.
111
+ """
112
+
113
+ return self._bar.PopupMenu(menu)
114
+
115
+
116
+ class RibbonToolBarToolBase(object):
117
+
118
+ def __init__(self):
119
+
120
+ self.help_string = ""
121
+ self.bitmap = wx.NullBitmap
122
+ self.bitmap_disabled = wx.NullBitmap
123
+ self.dropdown = wx.Rect()
124
+ self.position = wx.Point()
125
+ self.size = wx.Size()
126
+ self.client_data = None
127
+ self.id = -1
128
+ self.kind = RIBBON_BUTTON_NORMAL
129
+ self.state = None
130
+
131
+
132
+ class RibbonToolBarToolGroup(object):
133
+
134
+ def __init__(self):
135
+
136
+ # To identify the group as a RibbonToolBarToolBase
137
+ self.dummy_tool = None
138
+
139
+ self.tools = []
140
+ self.position = wx.Point()
141
+ self.size = wx.Size()
142
+
143
+
144
+ class RibbonToolBar(RibbonControl):
145
+
146
+ def __init__(self, parent, id=wx.ID_ANY, pos=wx.DefaultPosition, size=wx.DefaultSize, style=0,
147
+ name="RibbonToolBar"):
148
+
149
+ """
150
+ Default class constructor.
151
+
152
+ :param `parent`: pointer to a parent window, typically a :class:`~wx.lib.agw.ribbon.panel.RibbonPanel`;
153
+ :param `id`: window identifier. If ``wx.ID_ANY``, will automatically create
154
+ an identifier;
155
+ :param `pos`: window position. ``wx.DefaultPosition`` indicates that wxPython
156
+ should generate a default position for the window;
157
+ :param `size`: window size. ``wx.DefaultSize`` indicates that wxPython should
158
+ generate a default size for the window. If no suitable size can be found, the
159
+ window will be sized to 20x20 pixels so that the window is visible but obviously
160
+ not correctly sized;
161
+ :param `style`: window style, currently unused.
162
+ :param `name`: the window name.
163
+
164
+ """
165
+
166
+ RibbonControl.__init__(self, parent, id, pos, size, wx.BORDER_NONE, name=name)
167
+
168
+ self.Bind(wx.EVT_ENTER_WINDOW, self.OnMouseEnter)
169
+ self.Bind(wx.EVT_ERASE_BACKGROUND, self.OnEraseBackground)
170
+ self.Bind(wx.EVT_LEAVE_WINDOW, self.OnMouseLeave)
171
+ self.Bind(wx.EVT_LEFT_DOWN, self.OnMouseDown)
172
+ self.Bind(wx.EVT_LEFT_UP, self.OnMouseUp)
173
+ self.Bind(wx.EVT_MOTION, self.OnMouseMove)
174
+ self.Bind(wx.EVT_PAINT, self.OnPaint)
175
+ self.Bind(wx.EVT_SIZE, self.OnSize)
176
+
177
+ self.CommonInit(style)
178
+
179
+
180
+ def CommonInit(self, style):
181
+
182
+ self._groups = []
183
+
184
+ self.AppendGroup()
185
+ self._hover_tool = None
186
+ self._active_tool = None
187
+ self._nrows_min = 1
188
+ self._nrows_max = 1
189
+ self._sizes = [wx.Size(0, 0)]
190
+ self.SetBackgroundStyle(wx.BG_STYLE_CUSTOM)
191
+
192
+
193
+ def AddSimpleTool(self, tool_id, bitmap, help_string, kind=RIBBON_BUTTON_NORMAL):
194
+ """
195
+ Add a tool to the tool bar (simple version).
196
+
197
+ :param `tool_id`: id of the new tool (used for event callbacks);
198
+ :param `bitmap`: large bitmap of the new button. Must be the same size as all
199
+ other large bitmaps used on the button bar;
200
+ :param `help_string`: the UI help string to associate with the new button;
201
+ :param `kind`: the kind of button to add.
202
+
203
+ :see: :meth:`~RibbonToolBar.AddDropdownTool`, :meth:`~RibbonToolBar.AddHybridTool`, :meth:`~RibbonToolBar.AddTool`
204
+
205
+ """
206
+
207
+ return self.AddTool(tool_id, bitmap, wx.NullBitmap, help_string, kind, None)
208
+
209
+
210
+ def AddDropdownTool(self, tool_id, bitmap, help_string=""):
211
+ """
212
+ Add a dropdown tool to the tool bar (simple version).
213
+
214
+ :param `tool_id`: id of the new tool (used for event callbacks);
215
+ :param `bitmap`: large bitmap of the new button. Must be the same size as all
216
+ other large bitmaps used on the button bar;
217
+ :param `help_string`: the UI help string to associate with the new button.
218
+
219
+ :see: :meth:`~RibbonToolBar.AddTool`
220
+ """
221
+
222
+ return self.AddTool(tool_id, bitmap, wx.NullBitmap, help_string, RIBBON_BUTTON_DROPDOWN, None)
223
+
224
+
225
+ def InsertDropdownTool(self, pos, tool_id, bitmap, help_string=""):
226
+ """
227
+ Inserts a dropdown tool in the tool bar at the position specified by `pos`.
228
+
229
+ :param `pos`: the position of the new tool in the toolbar (zero-based);
230
+ :param `tool_id`: id of the new tool (used for event callbacks);
231
+ :param `bitmap`: large bitmap of the new button. Must be the same size as all
232
+ other large bitmaps used on the button bar;
233
+ :param `help_string`: the UI help string to associate with the new button.
234
+
235
+ :see: :meth:`~RibbonToolBar.AddTool`, :meth:`~RibbonToolBar.InsertTool`
236
+
237
+ .. versionadded:: 0.9.5
238
+ """
239
+
240
+ return self.InsertTool(pos, tool_id, bitmap, wx.NullBitmap, help_string, RIBBON_BUTTON_DROPDOWN, None)
241
+
242
+
243
+ def AddHybridTool(self, tool_id, bitmap, help_string=""):
244
+ """
245
+ Add a hybrid tool to the tool bar (simple version).
246
+
247
+ :param `tool_id`: id of the new tool (used for event callbacks);
248
+ :param `bitmap`: large bitmap of the new button. Must be the same size as all
249
+ other large bitmaps used on the button bar;
250
+ :param `help_string`: the UI help string to associate with the new button.
251
+
252
+ :see: :meth:`~RibbonToolBar.AddTool`
253
+ """
254
+
255
+ return self.AddTool(tool_id, bitmap, wx.NullBitmap, help_string, RIBBON_BUTTON_HYBRID, None)
256
+
257
+
258
+ def InsertHybridTool(self, pos, tool_id, bitmap, help_string=""):
259
+ """
260
+ Inserts a hybrid tool in the tool bar at the position specified by `pos`.
261
+
262
+ :param `pos`: the position of the new tool in the toolbar (zero-based);
263
+ :param `tool_id`: id of the new tool (used for event callbacks);
264
+ :param `bitmap`: large bitmap of the new button. Must be the same size as all
265
+ other large bitmaps used on the button bar;
266
+ :param `help_string`: the UI help string to associate with the new button.
267
+
268
+ :see: :meth:`~RibbonToolBar.AddTool`, :meth:`~RibbonToolBar.InsertTool`
269
+
270
+ .. versionadded:: 0.9.5
271
+ """
272
+
273
+ return self.InsertTool(pos, tool_id, bitmap, wx.NullBitmap, help_string, RIBBON_BUTTON_HYBRID, None)
274
+
275
+
276
+ def AddToggleTool(self, tool_id, bitmap, help_string=""):
277
+ """
278
+ Add a toggle tool to the tool bar (simple version).
279
+
280
+ :param `tool_id`: id of the new tool (used for event callbacks);
281
+ :param `bitmap`: large bitmap of the new button. Must be the same size as all
282
+ other large bitmaps used on the button bar;
283
+ :param `help_string`: the UI help string to associate with the new button.
284
+
285
+ :see: :meth:`~RibbonToolBar.AddTool`
286
+ """
287
+
288
+ return self.AddTool(tool_id, bitmap, wx.NullBitmap, help_string, RIBBON_BUTTON_TOGGLE, None)
289
+
290
+
291
+ def InsertToggleTool(self, pos, tool_id, bitmap, help_string=""):
292
+ """
293
+ Inserts a toggle tool in the tool bar at the position specified by `pos`.
294
+
295
+ :param `pos`: the position of the new tool in the toolbar (zero-based);
296
+ :param `tool_id`: id of the new tool (used for event callbacks);
297
+ :param `bitmap`: large bitmap of the new button. Must be the same size as all
298
+ other large bitmaps used on the button bar;
299
+ :param `help_string`: the UI help string to associate with the new button.
300
+
301
+ :see: :meth:`~RibbonToolBar.AddTool`, :meth:`~RibbonToolBar.InsertTool`
302
+
303
+ .. versionadded:: 0.9.5
304
+ """
305
+
306
+ return self.InsertTool(pos, tool_id, bitmap, wx.NullBitmap, help_string, RIBBON_BUTTON_TOGGLE, None)
307
+
308
+
309
+ def AddTool(self, tool_id, bitmap, bitmap_disabled=wx.NullBitmap, help_string="", kind=RIBBON_BUTTON_NORMAL, client_data=None):
310
+ """
311
+ Add a tool to the tool bar.
312
+
313
+ :param `tool_id`: id of the new tool (used for event callbacks);
314
+ :param `bitmap`: bitmap to use as the foreground for the new tool. Does not
315
+ have to be the same size as other tool bitmaps, but should be similar as
316
+ otherwise it will look visually odd;
317
+ :param `bitmap_disabled`: bitmap to use when the tool is disabled. If left
318
+ as :class:`NullBitmap`, then a bitmap will be automatically generated from `bitmap`;
319
+ :param `help_string`: the UI help string to associate with the new tool;
320
+ :param `kind`: the kind of tool to add;
321
+ :param `client_data`: client data to associate with the new tool.
322
+
323
+ :returns: An opaque pointer which can be used only with other tool bar methods.
324
+
325
+ :see: :meth:`~RibbonToolBar.AddDropdownTool`, :meth:`~RibbonToolBar.AddHybridTool`, :meth:`~RibbonToolBar.AddSeparator`
326
+ """
327
+
328
+ return self.InsertTool(self.GetToolCount(), tool_id, bitmap, bitmap_disabled,
329
+ help_string, kind, client_data)
330
+
331
+
332
+ def InsertTool(self, pos, tool_id, bitmap, bitmap_disabled=wx.NullBitmap, help_string="", kind=RIBBON_BUTTON_NORMAL, client_data=None):
333
+ """
334
+ Inserts a tool in the tool bar at the position specified by `pos`.
335
+
336
+ :param `pos`: the position of the new tool in the toolbar (zero-based);
337
+ :param `tool_id`: id of the new tool (used for event callbacks);
338
+ :param `bitmap`: bitmap to use as the foreground for the new tool. Does not
339
+ have to be the same size as other tool bitmaps, but should be similar as
340
+ otherwise it will look visually odd;
341
+ :param `bitmap_disabled`: bitmap to use when the tool is disabled. If left
342
+ as :class:`NullBitmap`, then a bitmap will be automatically generated from `bitmap`;
343
+ :param `help_string`: the UI help string to associate with the new tool;
344
+ :param `kind`: the kind of tool to add;
345
+ :param `client_data`: client data to associate with the new tool.
346
+
347
+ :returns: An opaque pointer which can be used only with other tool bar methods.
348
+
349
+ :see: :meth:`~RibbonToolBar.AddTool`, :meth:`~RibbonToolBar.AddDropdownTool`, :meth:`~RibbonToolBar.AddHybridTool`, :meth:`~RibbonToolBar.AddSeparator`
350
+
351
+ .. versionadded:: 0.9.5
352
+ """
353
+
354
+ if not bitmap.IsOk():
355
+ raise Exception("Exception")
356
+
357
+ tool = RibbonToolBarToolBase()
358
+ tool.id = tool_id
359
+ tool.bitmap = bitmap
360
+
361
+ if bitmap_disabled.IsOk():
362
+ if bitmap.GetSize() != bitmap_disabled.GetSize():
363
+ raise Exception("Exception")
364
+
365
+ tool.bitmap_disabled = bitmap_disabled
366
+ else:
367
+ tool.bitmap_disabled = self.MakeDisabledBitmap(bitmap)
368
+
369
+ tool.help_string = help_string
370
+ tool.kind = kind
371
+ tool.client_data = client_data
372
+ tool.position = wx.Point(0, 0)
373
+ tool.size = wx.Size(0, 0)
374
+ tool.state = 0
375
+
376
+ # Find the position where insert tool
377
+ group_count = len(self._groups)
378
+
379
+ for group in self._groups:
380
+ tool_count = len(group.tools)
381
+
382
+ if pos <= tool_count:
383
+ group.tools.insert(pos, tool)
384
+ return tool
385
+
386
+ pos -= tool_count + 1
387
+
388
+ raise Exception("Tool position out of toolbar bounds.")
389
+
390
+
391
+ def AddSeparator(self):
392
+ """
393
+ Adds a separator to the tool bar.
394
+
395
+ Separators are used to separate tools into groups. As such, a separator is not
396
+ explicitly drawn, but is visually seen as the gap between tool groups.
397
+ """
398
+
399
+ if not self._groups[-1].tools:
400
+ return None
401
+
402
+ self.AppendGroup()
403
+ return self._groups[-1].dummy_tool
404
+
405
+
406
+ def InsertSeparator(self, pos):
407
+ """
408
+ Inserts a separator into the tool bar at the position specified by `pos`.
409
+
410
+ Separators are used to separate tools into groups. As such, a separator is not
411
+ explicitly drawn, but is visually seen as the gap between tool groups.
412
+
413
+ :param `pos`: the position of the new tool in the toolbar (zero-based).
414
+
415
+ .. versionadded:: 0.9.5
416
+ """
417
+
418
+ for index, group in enumerate(self._groups):
419
+ if pos == 0:
420
+ # Prepend group
421
+ return self.InsertGroup(index).dummy_tool
422
+
423
+ if pos >= len(self._groups):
424
+ # Append group
425
+ return self.InsertGroup(index+1).dummy_tool
426
+
427
+ tool_count = len(group.tools)
428
+
429
+ if pos < tool_count:
430
+ new_group = self.InsertGroup(index+1)
431
+
432
+ for t in range(pos, tool_count):
433
+ new_group.tools.append(group.tools[t])
434
+
435
+ group.tools = group.tools[0:pos]
436
+ return group.dummy_tool
437
+
438
+ pos -= tool_count + 1
439
+
440
+ # Add an empty group at the end of the bar.
441
+ if not self._groups[-1].tools:
442
+ return None
443
+
444
+ self.AppendGroup()
445
+ return self._groups[-1].dummy_tool
446
+
447
+
448
+ def MakeDisabledBitmap(self, original):
449
+
450
+ img = original.ConvertToImage()
451
+ return wx.Bitmap(img.ConvertToGreyscale())
452
+
453
+
454
+ def AppendGroup(self):
455
+
456
+ group = RibbonToolBarToolGroup()
457
+ group.position = wx.Point(0, 0)
458
+ group.size = wx.Size(0, 0)
459
+ self._groups.append(group)
460
+
461
+
462
+ def InsertGroup(self, pos):
463
+
464
+ group = RibbonToolBarToolGroup()
465
+ group.position = wx.Point(0, 0)
466
+ group.size = wx.Size(0, 0)
467
+ self._groups.insert(pos, group)
468
+
469
+ return group
470
+
471
+
472
+ def ClearTools(self):
473
+ """
474
+ Deletes all the tools in the toolbar.
475
+
476
+ .. versionadded:: 0.9.5
477
+ """
478
+
479
+ self._groups = []
480
+
481
+
482
+ def DeleteTool(self, tool_id):
483
+ """
484
+ Removes the specified tool from the toolbar and deletes it.
485
+
486
+ :param `tool_id`: id of the tool to delete.
487
+
488
+ :returns: ``True`` if the tool was deleted, ``False`` otherwise.
489
+
490
+ :see: :meth:`~RibbonToolBar.DeleteToolByPos`
491
+
492
+ .. versionadded:: 0.9.5
493
+ """
494
+
495
+ for group in self._groups:
496
+ for tool in group.tools:
497
+ if tool.id == tool_id:
498
+ group.tools.remove(tool)
499
+ return True
500
+
501
+ return False
502
+
503
+
504
+ def DeleteToolByPos(self, pos):
505
+ """
506
+ This function behaves like :meth:`~RibbonToolBar.DeleteTool` but it deletes the tool at the
507
+ specified position `pos` and not the one with the given id.
508
+
509
+ Useful to delete separators.
510
+
511
+ :param `pos`: zero-based position of the tool to delete.
512
+
513
+ :returns: ``True`` if the tool was deleted, ``False`` otherwise.
514
+
515
+ :see: :meth:`~RibbonToolBar.DeleteTool`
516
+
517
+ .. versionadded:: 0.9.5
518
+ """
519
+
520
+ for index, group in enumerate(self._groups):
521
+ tool_count = len(group.tools)
522
+
523
+ if pos < tool_count:
524
+ # Remove tool
525
+ group.tools.pop(pos)
526
+ return True
527
+
528
+ elif pos == tool_count:
529
+ # Remove separator
530
+ if index < len(self._groups) - 1:
531
+
532
+ next_group = self._groups[index+1]
533
+
534
+ for t in range(0, len(next_group.tools)):
535
+ group.tools.append(next_group.tools[t])
536
+
537
+ self._groups.pop(index+1)
538
+
539
+ return True
540
+
541
+ return False
542
+
543
+
544
+ def FindById(self, tool_id):
545
+ """
546
+ Returns a pointer to the tool opaque structure by `tool_id` or ``None`` if
547
+ no corresponding tool is found.
548
+
549
+ :param `tool_id`: id of the tool to find.
550
+
551
+ .. versionadded:: 0.9.5
552
+ """
553
+
554
+ for group in self._groups:
555
+ for tool in group.tools:
556
+ if tool.id == tool_id:
557
+ return tool
558
+
559
+ return None
560
+
561
+
562
+ def GetToolByPos(self, pos):
563
+ """
564
+ Returns a pointer to the tool opaque structure by `pos` or ``None`` if
565
+ no corresponding tool is found.
566
+
567
+ :param `pos`: zero-based position of the tool to retrieve.
568
+
569
+ :returns: An instance of :class:`RibbonToolBarToolBase` if the tool was found,
570
+ ``None`` if it was not found.
571
+
572
+ .. versionadded:: 0.9.5
573
+ """
574
+
575
+ for group in self._groups:
576
+ tool_count = len(group.tools)
577
+
578
+ if pos < tool_count:
579
+ return group.tools[pos]
580
+
581
+ elif pos >= tool_count:
582
+ return None
583
+
584
+ return None
585
+
586
+
587
+ def GetToolCount(self):
588
+ """
589
+ Returns the number of tools in this :class:`RibbonToolBar`.
590
+
591
+ .. versionadded:: 0.9.5
592
+ """
593
+
594
+ count = 0
595
+ for group in self._groups:
596
+ count += len(group.tools)
597
+
598
+ # There is a splitter in front of every group except for the first
599
+ # If only one group, no separator.
600
+ if len(self._groups) > 1:
601
+ count += len(self._groups) - 1
602
+
603
+ return count
604
+
605
+
606
+ def GetToolId(self, tool):
607
+ """
608
+ Returns the tool id for the specified input `tool`.
609
+
610
+ :param `tool`: an instance of :class:`RibbonToolBarToolBase`.
611
+
612
+ .. versionadded:: 0.9.5
613
+ """
614
+
615
+ return tool.id
616
+
617
+
618
+ def GetToolClientData(self, tool_id):
619
+ """
620
+ Get any client data associated with the tool.
621
+
622
+ :param `tool_id`: id of the tool in question, as passed to :meth:`~RibbonToolBar.AddTool`.
623
+
624
+ :return: Client data (any Python object), or ``None`` if there is none.
625
+
626
+ .. versionadded:: 0.9.5
627
+ """
628
+
629
+ tool = self.FindById(tool_id)
630
+ if tool is None:
631
+ raise Exception("Invalid tool id")
632
+
633
+ return tool.client_data
634
+
635
+
636
+ def GetToolEnabled(self, tool_id):
637
+ """
638
+ Called to determine whether a tool is enabled (responds to user input).
639
+
640
+ :param `tool_id`: id of the tool in question, as passed to :meth:`~RibbonToolBar.AddTool`.
641
+
642
+ :return: ``True`` if the tool was found and it is enabled, ``False`` otherwise.
643
+
644
+ .. versionadded:: 0.9.5
645
+ """
646
+
647
+ tool = self.FindById(tool_id)
648
+ if tool is None:
649
+ raise Exception("Invalid tool id")
650
+
651
+ return (tool.state & RIBBON_TOOLBAR_TOOL_DISABLED) == 0
652
+
653
+
654
+ def GetToolHelpString(self, tool_id):
655
+ """
656
+ Returns the tool short help string.
657
+
658
+ :param `tool_id`: id of the tool in question, as passed to :meth:`~RibbonToolBar.AddTool`.
659
+
660
+ .. versionadded:: 0.9.5
661
+ """
662
+
663
+ tool = self.FindById(tool_id)
664
+ if tool is None:
665
+ raise Exception("Invalid tool id")
666
+
667
+ return tool.help_string
668
+
669
+
670
+ def GetToolKind(self, tool_id):
671
+ """
672
+ Returns the kind of the given tool.
673
+
674
+ :param `tool_id`: id of the tool in question, as passed to :meth:`~RibbonToolBar.AddTool`.
675
+
676
+ .. versionadded:: 0.9.5
677
+ """
678
+
679
+ tool = self.FindById(tool_id)
680
+ if tool is None:
681
+ raise Exception("Invalid tool id")
682
+
683
+ return tool.kind
684
+
685
+
686
+ def GetToolPos(self, tool_id):
687
+ """
688
+ Returns the tool position in the toolbar, or ``wx.NOT_FOUND`` if the tool is not found.
689
+
690
+ :param `tool_id`: id of the tool in question, as passed to :meth:`~RibbonToolBar.AddTool`.
691
+
692
+ .. versionadded:: 0.9.5
693
+ """
694
+
695
+ pos = 0
696
+ for group in self._groups:
697
+
698
+ for tool in group.tools:
699
+
700
+ if tool.id == tool_id:
701
+ return pos
702
+
703
+ pos += 1
704
+
705
+ pos += 1 # Increment pos for group separator.
706
+
707
+ return wx.NOT_FOUND
708
+
709
+
710
+ def GetToolState(self, tool_id):
711
+ """
712
+ Gets the on/off state of a toggle tool.
713
+
714
+ :param `tool_id`: id of the tool in question, as passed to :meth:`~RibbonToolBar.AddTool`.
715
+
716
+ :return: ``True`` if the tool is toggled on, ``False`` otherwise.
717
+
718
+ :see: :meth:`~RibbonToolBar.ToggleTool`
719
+
720
+ .. versionadded:: 0.9.5
721
+ """
722
+
723
+ tool = self.FindById(tool_id)
724
+ if tool is None:
725
+ raise Exception("Invalid tool id")
726
+
727
+ return tool.state & RIBBON_TOOLBAR_TOOL_TOGGLED
728
+
729
+
730
+ def SetToolClientData(self, tool_id, clientData):
731
+ """
732
+ Sets the client data associated with the tool.
733
+
734
+ :param `tool_id`: id of the tool in question, as passed to :meth:`~RibbonToolBar.AddTool`;
735
+ :param `clientData`: any Python object.
736
+
737
+ .. versionadded:: 0.9.5
738
+ """
739
+
740
+ tool = self.FindById(tool_id)
741
+ if tool is None:
742
+ raise Exception("Invalid tool id")
743
+
744
+ tool.client_data = clientData
745
+
746
+
747
+ def SetToolDisabledBitmap(self, tool_id, bitmap):
748
+ """
749
+ Sets the bitmap to be used by the tool with the given ID when the tool is in a disabled state.
750
+
751
+ :param `tool_id`: id of the tool in question, as passed to :meth:`~RibbonToolBar.AddTool`;
752
+ :param `bitmap`: an instance of :class:`wx.Bitmap`.
753
+
754
+ .. versionadded:: 0.9.5
755
+ """
756
+
757
+ tool = self.FindById(tool_id)
758
+ if tool is None:
759
+ raise Exception("Invalid tool id")
760
+
761
+ tool.bitmap_disabled = bitmap
762
+
763
+
764
+ def SetToolHelpString(self, tool_id, helpString):
765
+ """
766
+ Sets the tool short help string.
767
+
768
+ :param `tool_id`: id of the tool in question, as passed to :meth:`~RibbonToolBar.AddTool`;
769
+ :param `helpString`: a string for the help.
770
+
771
+ .. versionadded:: 0.9.5
772
+ """
773
+
774
+ tool = self.FindById(tool_id)
775
+ if tool is None:
776
+ raise Exception("Invalid tool id")
777
+
778
+ tool.help_string = helpString
779
+
780
+
781
+ def SetToolNormalBitmap(self, tool_id, bitmap):
782
+ """
783
+ Sets the bitmap to be used by the tool with the given ID when the tool is enabled.
784
+
785
+ :param `tool_id`: id of the tool in question, as passed to :meth:`~RibbonToolBar.AddTool`;
786
+ :param `bitmap`: an instance of :class:`wx.Bitmap`.
787
+
788
+ .. versionadded:: 0.9.5
789
+ """
790
+
791
+ tool = self.FindById(tool_id)
792
+ if tool is None:
793
+ raise Exception("Invalid tool id")
794
+
795
+ tool.bitmap = bitmap
796
+
797
+
798
+ def EnableTool(self, tool_id, enable=True):
799
+ """
800
+ Enables or disables a single tool on the bar.
801
+
802
+ :param `tool_id`: id of the tool in question, as passed to :meth:`~RibbonToolBar.AddTool`;
803
+ :param `enable`: ``True`` to enable the tool, ``False`` to disable it.
804
+
805
+ .. versionadded:: 0.9.5
806
+ """
807
+
808
+ tool = self.FindById(tool_id)
809
+ if tool is None:
810
+ raise Exception("Invalid tool id")
811
+
812
+ if enable:
813
+
814
+ if tool.state & RIBBON_TOOLBAR_TOOL_DISABLED:
815
+ tool.state &= ~RIBBON_TOOLBAR_TOOL_DISABLED
816
+ self.Refresh()
817
+
818
+ else:
819
+
820
+ if (tool.state & RIBBON_TOOLBAR_TOOL_DISABLED) == 0:
821
+ tool.state |= RIBBON_TOOLBAR_TOOL_DISABLED
822
+ self.Refresh()
823
+
824
+
825
+ def ToggleTool(self, tool_id, checked=True):
826
+ """
827
+ Toggles on or off a single tool on the bar.
828
+
829
+ :param `tool_id`: id of the tool in question, as passed to :meth:`~RibbonToolBar.AddTool`;
830
+ :param `checked`: ``True`` to toggle on the tool, ``False`` to toggle it off.
831
+
832
+ .. versionadded:: 0.9.5
833
+ """
834
+
835
+ tool = self.FindById(tool_id)
836
+ if tool is None:
837
+ raise Exception("Invalid tool id")
838
+
839
+ if checked:
840
+ if (tool.state & RIBBON_TOOLBAR_TOOL_TOGGLED) == 0:
841
+ tool.state |= RIBBON_TOOLBAR_TOOL_TOGGLED
842
+ self.Refresh()
843
+ else:
844
+ if tool.state & RIBBON_TOOLBAR_TOOL_TOGGLED:
845
+ tool.state &= ~RIBBON_TOOLBAR_TOOL_TOGGLED
846
+ self.Refresh()
847
+
848
+
849
+ def IsSizingContinuous(self):
850
+ """
851
+ Returns ``True`` if this window can take any size (greater than its minimum size),
852
+ ``False`` if it can only take certain sizes.
853
+
854
+ :see: :meth:`RibbonControl.GetNextSmallerSize() <lib.agw.ribbon.control.RibbonControl.GetNextSmallerSize>`,
855
+ :meth:`RibbonControl.GetNextLargerSize() <lib.agw.ribbon.control.RibbonControl.GetNextLargerSize>`
856
+ """
857
+
858
+ return False
859
+
860
+
861
+ def DoGetNextSmallerSize(self, direction, relative_to):
862
+ """
863
+ Implementation of :meth:`RibbonControl.GetNextSmallerSize() <lib.agw.ribbon.control.RibbonControl.GetNextSmallerSize>`.
864
+
865
+ Controls which have non-continuous sizing must override this virtual function
866
+ rather than :meth:`RibbonControl.GetNextSmallerSize() <lib.agw.ribbon.control.RibbonControl.GetNextSmallerSize>`.
867
+ """
868
+
869
+ result = wx.Size(*relative_to)
870
+ area = 0
871
+ tobreak = False
872
+
873
+ for nrows in range(self._nrows_max, self._nrows_min-1, -1):
874
+
875
+ size = wx.Size(*self._sizes[nrows - self._nrows_min])
876
+ original = wx.Size(*size)
877
+
878
+ if direction == wx.HORIZONTAL:
879
+ if size.GetWidth() < relative_to.GetWidth() and size.GetHeight() <= relative_to.GetHeight():
880
+ size.SetHeight(relative_to.GetHeight())
881
+ tobreak = True
882
+
883
+ elif direction == wx.VERTICAL:
884
+ if size.GetWidth() <= relative_to.GetWidth() and size.GetHeight() < relative_to.GetHeight():
885
+ size.SetWidth(relative_to.GetWidth())
886
+ tobreak = True
887
+
888
+ elif direction == wx.BOTH:
889
+ if size.GetWidth() < relative_to.GetWidth() and size.GetHeight() < relative_to.GetHeight():
890
+ pass
891
+
892
+ if GetSizeInOrientation(original, direction) > area:
893
+ result = wx.Size(*size)
894
+ area = GetSizeInOrientation(original, direction)
895
+ if tobreak:
896
+ break
897
+
898
+ return result
899
+
900
+
901
+ def DoGetNextLargerSize(self, direction, relative_to):
902
+ """
903
+ Implementation of :meth:`RibbonControl.GetNextLargerSize() <lib.agw.ribbon.control.RibbonControl.GetNextLargerSize>`.
904
+
905
+ Controls which have non-continuous sizing must override this virtual function
906
+ rather than :meth:`RibbonControl.GetNextLargerSize() <lib.agw.ribbon.control.RibbonControl.GetNextLargerSize>`.
907
+ """
908
+
909
+ # Pick the smallest of our sizes which are larger than the given size
910
+ result = wx.Size(*relative_to)
911
+ area = 10000
912
+ tobreak = False
913
+
914
+ for nrows in range(self._nrows_min, self._nrows_max+1):
915
+
916
+ size = wx.Size(*self._sizes[nrows - self._nrows_min])
917
+ original = wx.Size(*size)
918
+
919
+ if direction == wx.HORIZONTAL:
920
+ if size.GetWidth() > relative_to.GetWidth() and size.GetHeight() <= relative_to.GetHeight():
921
+ size.SetHeight(relative_to.GetHeight())
922
+ tobreak = True
923
+
924
+ elif direction == wx.VERTICAL:
925
+ if size.GetWidth() <= relative_to.GetWidth() and size.GetHeight() > relative_to.GetHeight():
926
+ size.SetWidth(relative_to.GetWidth())
927
+ tobreak = True
928
+
929
+ elif direction == wx.BOTH:
930
+ if size.GetWidth() > relative_to.GetWidth() and size.GetHeight() > relative_to.GetHeight():
931
+ tobreak = True
932
+
933
+ if GetSizeInOrientation(original, direction) < area:
934
+ result = wx.Size(*size)
935
+ area = GetSizeInOrientation(original, direction)
936
+ if tobreak:
937
+ break
938
+
939
+ return result
940
+
941
+
942
+ def SetRows(self, nMin, nMax):
943
+ """
944
+ Set the number of rows to distribute tool groups over.
945
+
946
+ Tool groups can be distributed over a variable number of rows. The way in which
947
+ groups are assigned to rows is not specified, and the order of groups may
948
+ change, but they will be distributed in such a way as to minimise the overall
949
+ size of the tool bar.
950
+
951
+ :param `nMin`: the minimum number of rows to use;
952
+ :param `nMax`: the maximum number of rows to use (defaults to `nMin`).
953
+
954
+ """
955
+
956
+ if nMax == -1:
957
+ nMax = nMin
958
+
959
+ if nMin < 1:
960
+ raise Exception("Exception")
961
+ if nMin > nMax:
962
+ raise Exception("Exception")
963
+
964
+ self._nrows_min = nMin
965
+ self._nrows_max = nMax
966
+
967
+ self._sizes = []
968
+ self._sizes = [wx.Size(0, 0) for i in range(self._nrows_min, self._nrows_max + 1)]
969
+
970
+ self.Realize()
971
+
972
+
973
+ def Realize(self):
974
+ """
975
+ Calculates tool layouts and positions.
976
+
977
+ Must be called after tools are added to the tool bar, as otherwise the newly
978
+ added tools will not be displayed.
979
+
980
+ :note: Reimplemented from :class:`~wx.lib.agw.ribbon.control.RibbonControl`.
981
+ """
982
+
983
+ if self._art is None:
984
+ return False
985
+
986
+ # Calculate the size of each group and the position/size of each tool
987
+ temp_dc = wx.MemoryDC()
988
+ group_count = len(self._groups)
989
+
990
+ for group in self._groups:
991
+
992
+ prev = None
993
+ tool_count = len(group.tools)
994
+ tallest = 0
995
+
996
+ for t, tool in enumerate(group.tools):
997
+
998
+ tool.size, tool.dropdown = self._art.GetToolSize(temp_dc, self, tool.bitmap.GetSize(), tool.kind, t==0, t==(tool_count-1))
999
+ tool.state = tool.state & ~RIBBON_TOOLBAR_TOOL_DISABLED
1000
+ if t == 0:
1001
+ tool.state |= RIBBON_TOOLBAR_TOOL_FIRST
1002
+ if t == tool_count - 1:
1003
+ tool.state |= RIBBON_TOOLBAR_TOOL_LAST
1004
+ if tool.size.GetHeight() > tallest:
1005
+ tallest = tool.size.GetHeight()
1006
+ if prev:
1007
+ tool.position = wx.Point(*prev.position)
1008
+ tool.position.x += prev.size.x
1009
+ else:
1010
+ tool.position = wx.Point(0, 0)
1011
+
1012
+ prev = tool
1013
+
1014
+ if tool_count == 0:
1015
+ group.size = wx.Size(0, 0)
1016
+ else:
1017
+ group.size = wx.Size(prev.position.x + prev.size.x, tallest)
1018
+ for tool in group.tools:
1019
+ tool.size.SetHeight(tallest)
1020
+
1021
+ # Calculate the minimum size for each possible number of rows
1022
+ sep = self._art.GetMetric(RIBBON_ART_TOOL_GROUP_SEPARATION_SIZE)
1023
+ smallest_area = 10000
1024
+ row_sizes = [wx.Size(0, 0) for i in range(self._nrows_max)]
1025
+ major_axis = ((self._art.GetFlags() & RIBBON_BAR_FLOW_VERTICAL) and [wx.VERTICAL] or [wx.HORIZONTAL])[0]
1026
+ self.SetMinSize(wx.Size(0, 0))
1027
+
1028
+ minSize = wx.Size(10000, 10000)
1029
+
1030
+ # See if we're sizing flexibly (i.e. wrapping), and set min size differently
1031
+ sizingFlexibly = False
1032
+ panel = self.GetParent()
1033
+
1034
+ if isinstance(panel, RibbonPanel) and (panel.GetFlags() & RIBBON_PANEL_FLEXIBLE):
1035
+ sizingFlexibly = True
1036
+
1037
+ # Without this, there will be redundant horizontal space because SetMinSize will
1038
+ # use the smallest possible height (and therefore largest width).
1039
+ if sizingFlexibly:
1040
+ major_axis = wx.HORIZONTAL
1041
+
1042
+ for nrows in range(self._nrows_min, self._nrows_max+1):
1043
+
1044
+ for r in range(nrows):
1045
+ row_sizes[r] = wx.Size(0, 0)
1046
+
1047
+ for g in range(group_count):
1048
+
1049
+ group = self._groups[g]
1050
+ shortest_row = 0
1051
+
1052
+ for r in range(1, nrows):
1053
+ if row_sizes[r].GetWidth() < row_sizes[shortest_row].GetWidth():
1054
+ shortest_row = r
1055
+
1056
+ row_sizes[shortest_row].x += group.size.x + sep
1057
+ if group.size.y > row_sizes[shortest_row].y:
1058
+ row_sizes[shortest_row].y = group.size.y
1059
+
1060
+ size = wx.Size(0, 0)
1061
+
1062
+ for r in range(nrows):
1063
+ if row_sizes[r].GetWidth() != 0:
1064
+ row_sizes[r].DecBy(sep, 0)
1065
+ if row_sizes[r].GetWidth() > size.GetWidth():
1066
+ size.SetWidth(row_sizes[r].GetWidth())
1067
+
1068
+ size.IncBy(0, row_sizes[r].y)
1069
+
1070
+ self._sizes[nrows - self._nrows_min] = size
1071
+
1072
+ if GetSizeInOrientation(size, major_axis) < smallest_area:
1073
+ smallest_area = GetSizeInOrientation(size, major_axis)
1074
+ self.SetMinSize(size)
1075
+
1076
+ if sizingFlexibly:
1077
+ if size.x < minSize.x:
1078
+ minSize.x = size.x
1079
+ if size.y < minSize.y:
1080
+ minSize.y = size.y
1081
+
1082
+ if sizingFlexibly:
1083
+ # Give it the min size in either direction regardless of row,
1084
+ # so that we're able to vary the size of the panel according to
1085
+ # the space the toolbar takes up.
1086
+ self.SetMinSize(minSize)
1087
+
1088
+ # Position the groups
1089
+ dummy_event = wx.SizeEvent(self.GetSize())
1090
+ self.OnSize(dummy_event)
1091
+
1092
+ return True
1093
+
1094
+
1095
+ def OnSize(self, event):
1096
+ """
1097
+ Handles the ``wx.EVT_SIZE`` event for :class:`RibbonToolBar`.
1098
+
1099
+ :param `event`: a :class:`wx.SizeEvent` event to be processed.
1100
+ """
1101
+
1102
+ if self._art is None:
1103
+ return
1104
+
1105
+ # Choose row count with largest possible area
1106
+ size = event.GetSize()
1107
+ row_count = self._nrows_max
1108
+ major_axis = (self._art.GetFlags() & RIBBON_BAR_FLOW_VERTICAL and [wx.VERTICAL] or [wx.HORIZONTAL])[0]
1109
+
1110
+ # See if we're sizing flexibly, and set min size differently
1111
+ sizingFlexibly = False
1112
+ panel = self.GetParent()
1113
+
1114
+ if isinstance(panel, RibbonPanel) and (panel.GetFlags() & RIBBON_PANEL_FLEXIBLE):
1115
+ sizingFlexibly = True
1116
+
1117
+ # Without this, there will be redundant horizontal space because SetMinSize will
1118
+ # use the smallest possible height (and therefore largest width).
1119
+ if sizingFlexibly:
1120
+ major_axis = wx.HORIZONTAL
1121
+
1122
+ bestSize = wx.Size(*self._sizes[0])
1123
+
1124
+ if self._nrows_max != self._nrows_min:
1125
+ area = 0
1126
+ for i in range(self._nrows_max - self._nrows_min + 1):
1127
+ if self._sizes[i].x <= size.x and self._sizes[i].y <= size.y and \
1128
+ GetSizeInOrientation(self._sizes[i], major_axis) > area:
1129
+ area = GetSizeInOrientation(self._sizes[i], major_axis)
1130
+ row_count = self._nrows_min + i
1131
+ bestSize = wx.Size(*self._sizes[i])
1132
+
1133
+ # Assign groups to rows and calculate row widths
1134
+ row_sizes = [wx.Size(0, 0) for i in range(row_count)]
1135
+ sep = self._art.GetMetric(RIBBON_ART_TOOL_GROUP_SEPARATION_SIZE)
1136
+
1137
+ group_count = len(self._groups)
1138
+ for group in self._groups:
1139
+ shortest_row = 0
1140
+ for r in range(1, row_count):
1141
+ if row_sizes[r].GetWidth() < row_sizes[shortest_row].GetWidth():
1142
+ shortest_row = r
1143
+
1144
+ group.position = wx.Point(row_sizes[shortest_row].x, shortest_row)
1145
+ row_sizes[shortest_row].x += group.size.x + sep
1146
+ if group.size.y > row_sizes[shortest_row].y:
1147
+ row_sizes[shortest_row].y = group.size.y
1148
+
1149
+ # Calculate row positions
1150
+ total_height = 0
1151
+ for r in range(row_count):
1152
+ total_height += row_sizes[r].GetHeight()
1153
+
1154
+ rowsep = (size.GetHeight() - total_height) / (row_count + 1)
1155
+ rowypos = [0]*row_count
1156
+ rowypos[0] = rowsep
1157
+ for r in range(1, row_count):
1158
+ rowypos[r] = rowypos[r - 1] + row_sizes[r - 1].GetHeight() + rowsep
1159
+
1160
+ # Set group y positions
1161
+ for group in self._groups:
1162
+ group.position.y = int(rowypos[group.position.y])
1163
+
1164
+
1165
+ def GetBestSizeForParentSize(self, parentSize):
1166
+ """ Finds the best width and height given the parent's width and height. """
1167
+
1168
+ if not self._sizes:
1169
+ return self.GetMinSize()
1170
+
1171
+ # Choose row count with largest possible area
1172
+ size = wx.Size(*parentSize)
1173
+ row_count = self._nrows_max
1174
+ major_axis = (self._art.GetFlags() & RIBBON_BAR_FLOW_VERTICAL and [wx.VERTICAL] or [wx.HORIZONTAL])[0]
1175
+
1176
+ # A toolbar should maximize its width whether vertical or horizontal, so
1177
+ # force the major axis to be horizontal. Without this, there will be
1178
+ # redundant horizontal space.
1179
+ major_axis = wx.HORIZONTAL
1180
+ bestSize = wx.Size(*self._sizes[0])
1181
+
1182
+ if self._nrows_max != self._nrows_min:
1183
+ area = 0
1184
+ for i in range(self._nrows_max - self._nrows_min + 1):
1185
+
1186
+ if self._sizes[i].x <= size.x and self._sizes[i].y <= size.y and \
1187
+ GetSizeInOrientation(self._sizes[i], major_axis) > area:
1188
+ area = GetSizeInOrientation(self._sizes[i], major_axis)
1189
+ row_count = self._nrows_min + i
1190
+ bestSize = wx.Size(*self._sizes[i])
1191
+
1192
+ return bestSize
1193
+
1194
+
1195
+ def DoGetBestSize(self):
1196
+ """
1197
+ Gets the size which best suits the window: for a control, it would be the
1198
+ minimal size which doesn't truncate the control, for a panel - the same size
1199
+ as it would have after a call to `Fit()`.
1200
+
1201
+ :return: An instance of :class:`wx.Size`.
1202
+
1203
+ :note: Overridden from :class:`wx.Control`.
1204
+ """
1205
+
1206
+ return self.GetMinSize()
1207
+
1208
+
1209
+ def OnEraseBackground(self, event):
1210
+ """
1211
+ Handles the ``wx.EVT_ERASE_BACKGROUND`` event for :class:`RibbonToolBar`.
1212
+
1213
+ :param `event`: a :class:`EraseEvent` event to be processed.
1214
+ """
1215
+
1216
+ # All painting done in main paint handler to minimise flicker
1217
+ pass
1218
+
1219
+
1220
+ def OnPaint(self, event):
1221
+ """
1222
+ Handles the ``wx.EVT_PAINT`` event for :class:`RibbonToolBar`.
1223
+
1224
+ :param `event`: a :class:`PaintEvent` event to be processed.
1225
+ """
1226
+
1227
+ dc = wx.AutoBufferedPaintDC(self)
1228
+
1229
+ if self._art is None:
1230
+ return
1231
+
1232
+ self._art.DrawToolBarBackground(dc, self, wx.Rect(0, 0, *self.GetSize()))
1233
+
1234
+ for group in self._groups:
1235
+ tool_count = len(group.tools)
1236
+
1237
+ if tool_count != 0:
1238
+ self._art.DrawToolGroupBackground(dc, self, wx.Rect(group.position, group.size))
1239
+
1240
+ for tool in group.tools:
1241
+ rect = wx.Rect(group.position + tool.position, tool.size)
1242
+
1243
+ if tool.state & RIBBON_TOOLBAR_TOOL_DISABLED:
1244
+ self._art.DrawTool(dc, self, rect, tool.bitmap_disabled, tool.kind, tool.state)
1245
+ else:
1246
+ self._art.DrawTool(dc, self, rect, tool.bitmap, tool.kind, tool.state)
1247
+
1248
+
1249
+ def OnMouseMove(self, event):
1250
+ """
1251
+ Handles the ``wx.EVT_MOTION`` event for :class:`RibbonToolBar`.
1252
+
1253
+ :param `event`: a :class:`MouseEvent` event to be processed.
1254
+ """
1255
+
1256
+ pos = event.GetPosition()
1257
+ new_hover = None
1258
+
1259
+ for group in self._groups:
1260
+
1261
+ if group.position.x <= pos.x and pos.x < group.position.x + group.size.x \
1262
+ and group.position.y <= pos.y and pos.y < group.position.y + group.size.y:
1263
+ pos -= group.position
1264
+
1265
+ for tool in group.tools:
1266
+ if tool.position.x <= pos.x and pos.x < tool.position.x + tool.size.x \
1267
+ and tool.position.y <= pos.y and pos.y < tool.position.y + tool.size.y:
1268
+ pos -= tool.position
1269
+ new_hover = tool
1270
+ break
1271
+ break
1272
+
1273
+ if new_hover and new_hover != self._hover_tool:
1274
+ self.SetToolTip(new_hover.help_string)
1275
+ elif self.GetToolTip() and new_hover != self._hover_tool:
1276
+ self.SetToolTip("")
1277
+
1278
+ if new_hover != self._hover_tool:
1279
+ if self._hover_tool:
1280
+ self._hover_tool.state &= ~(RIBBON_TOOLBAR_TOOL_HOVER_MASK | RIBBON_TOOLBAR_TOOL_ACTIVE_MASK)
1281
+
1282
+ self._hover_tool = new_hover
1283
+
1284
+ if new_hover:
1285
+ what = RIBBON_TOOLBAR_TOOL_NORMAL_HOVERED
1286
+ if new_hover.dropdown.Contains(pos):
1287
+ what = RIBBON_TOOLBAR_TOOL_DROPDOWN_HOVERED
1288
+
1289
+ new_hover.state |= what
1290
+
1291
+ if new_hover == self._active_tool:
1292
+
1293
+ new_hover.state &= ~RIBBON_TOOLBAR_TOOL_ACTIVE_MASK
1294
+ new_hover.state |= (what << 2)
1295
+
1296
+ self.Refresh(False)
1297
+
1298
+ elif self._hover_tool and self._hover_tool.kind == RIBBON_BUTTON_HYBRID:
1299
+ newstate = self._hover_tool.state & ~RIBBON_TOOLBAR_TOOL_HOVER_MASK
1300
+ what = RIBBON_TOOLBAR_TOOL_NORMAL_HOVERED
1301
+
1302
+ if self._hover_tool.dropdown.Contains(pos):
1303
+ what = RIBBON_TOOLBAR_TOOL_DROPDOWN_HOVERED
1304
+
1305
+ newstate |= what
1306
+
1307
+ if newstate != self._hover_tool.state:
1308
+ self._hover_tool.state = newstate
1309
+ if self._hover_tool == self._active_tool:
1310
+ self._hover_tool.state &= ~RIBBON_TOOLBAR_TOOL_ACTIVE_MASK
1311
+ self._hover_tool.state |= (what << 2)
1312
+
1313
+ self.Refresh(False)
1314
+
1315
+
1316
+ def OnMouseDown(self, event):
1317
+ """
1318
+ Handles the ``wx.EVT_LEFT_DOWN`` event for :class:`RibbonToolBar`.
1319
+
1320
+ :param `event`: a :class:`MouseEvent` event to be processed.
1321
+ """
1322
+
1323
+ self.OnMouseMove(event)
1324
+
1325
+ if self._hover_tool:
1326
+ self._active_tool = self._hover_tool
1327
+ self._active_tool.state |= (self._active_tool.state & RIBBON_TOOLBAR_TOOL_HOVER_MASK) << 2
1328
+ self.Refresh(False)
1329
+
1330
+
1331
+ def OnMouseLeave(self, event):
1332
+ """
1333
+ Handles the ``wx.EVT_LEAVE_WINDOW`` event for :class:`RibbonToolBar`.
1334
+
1335
+ :param `event`: a :class:`MouseEvent` event to be processed.
1336
+ """
1337
+
1338
+ if self._hover_tool:
1339
+ self._hover_tool.state &= ~RIBBON_TOOLBAR_TOOL_HOVER_MASK
1340
+ self._hover_tool = None
1341
+ self.Refresh(False)
1342
+
1343
+
1344
+ def OnMouseUp(self, event):
1345
+ """
1346
+ Handles the ``wx.EVT_LEFT_UP`` event for :class:`RibbonToolBar`.
1347
+
1348
+ :param `event`: a :class:`MouseEvent` event to be processed.
1349
+ """
1350
+
1351
+ if self._active_tool:
1352
+ if self._active_tool.state & RIBBON_TOOLBAR_TOOL_ACTIVE_MASK:
1353
+ evt_type = wxEVT_COMMAND_RIBBONTOOL_CLICKED
1354
+ if self._active_tool.state & RIBBON_TOOLBAR_TOOL_DROPDOWN_ACTIVE:
1355
+ evt_type = wxEVT_COMMAND_RIBBONTOOL_DROPDOWN_CLICKED
1356
+
1357
+ notification = RibbonToolBarEvent(evt_type, self._active_tool.id)
1358
+ notification.SetEventObject(self)
1359
+ notification.SetBar(self)
1360
+ self.ProcessEvent(notification)
1361
+
1362
+ if self._active_tool.kind == RIBBON_BUTTON_TOGGLE:
1363
+ self._active_tool.state ^= RIBBON_BUTTONBAR_BUTTON_TOGGLED
1364
+ notification.SetInt(self._active_tool.state & RIBBON_BUTTONBAR_BUTTON_TOGGLED)
1365
+
1366
+ # Notice that m_active_tool could have been reset by the event handler
1367
+ # above so we need to test it again.
1368
+ if self._active_tool:
1369
+ self._active_tool.state &= ~RIBBON_TOOLBAR_TOOL_ACTIVE_MASK
1370
+ self._active_tool = None
1371
+ self.Refresh(False)
1372
+
1373
+
1374
+ def OnMouseEnter(self, event):
1375
+ """
1376
+ Handles the ``wx.EVT_ENTER_WINDOW`` event for :class:`RibbonToolBar`.
1377
+
1378
+ :param `event`: a :class:`MouseEvent` event to be processed.
1379
+ """
1380
+
1381
+ if self._active_tool and not event.LeftIsDown():
1382
+ self._active_tool = None
1383
+
1384
+
1385
+ def GetDefaultBorder(self):
1386
+ """ Returns the default border style for :class:`RibbonToolBar`. """
1387
+
1388
+ return wx.BORDER_NONE
1389
+
1390
+
1391
+ def UpdateWindowUI(self, flags):
1392
+ """
1393
+ This function sends one or more :class:`UpdateUIEvent` to the window.
1394
+
1395
+ The particular implementation depends on the window; for example a :class:`ToolBar` will
1396
+ send an update UI event for each toolbar button, and a :class:`wx.Frame` will send an
1397
+ update UI event for each menubar menu item.
1398
+
1399
+ You can call this function from your application to ensure that your UI is up-to-date
1400
+ at this point (as far as your :class:`UpdateUIEvent` handlers are concerned). This may be
1401
+ necessary if you have called :meth:`UpdateUIEvent.SetMode` or :meth:`UpdateUIEvent.SetUpdateInterval`
1402
+ to limit the overhead that wxWidgets incurs by sending update UI events in idle time.
1403
+
1404
+ :param integer `flags`: should be a bitlist of one or more of ``wx.UPDATE_UI_NONE``,
1405
+ ``wx.UPDATE_UI_RECURSE`` or ``wx.UPDATE_UI_FROMIDLE``.
1406
+
1407
+ If you are calling this function from an `OnInternalIdle` or `OnIdle` function, make sure
1408
+ you pass the ``wx.UPDATE_UI_FROMIDLE`` flag, since this tells the window to only update
1409
+ the UI elements that need to be updated in idle time. Some windows update their elements
1410
+ only when necessary, for example when a menu is about to be shown. The following is an
1411
+ example of how to call :meth:`~RibbonToolBar.UpdateWindowUI` from an idle function::
1412
+
1413
+ def OnInternalIdle(self):
1414
+
1415
+ if wx.UpdateUIEvent.CanUpdate(self):
1416
+ self.UpdateWindowUI(wx.UPDATE_UI_FROMIDLE)
1417
+
1418
+
1419
+
1420
+ .. versionadded:: 0.9.5
1421
+ """
1422
+
1423
+ wx.Control.UpdateWindowUI(self, flags)
1424
+
1425
+ # don't waste time updating state of tools in a hidden toolbar
1426
+ if not self.IsShown():
1427
+ return
1428
+
1429
+ for group in self._groups:
1430
+ for tool in group.tools:
1431
+ id = tool.id
1432
+
1433
+ event = wx.UpdateUIEvent(id)
1434
+ event.SetEventObject(self)
1435
+
1436
+ if self.ProcessWindowEvent(event):
1437
+ if event.GetSetEnabled():
1438
+ self.EnableTool(id, event.GetEnabled())
1439
+ if event.GetSetChecked():
1440
+ self.ToggleTool(id, event.GetChecked())
1441
+