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,1259 @@
1
+ # -*- coding: utf-8 -*-
2
+ #----------------------------------------------------------------------------
3
+ # Name: bar.py
4
+ # Licence: wxWindows license
5
+ #
6
+ # Tags: phoenix-port, unittest, documented, py3-port
7
+ #
8
+ # RIBBONBAR Library wxPython IMPLEMENTATION
9
+ #
10
+ # Original C++ Code From Peter Cawley.
11
+ #
12
+ # Current wxRibbon Version Tracked: wxWidgets 2.9.0 SVN HEAD
13
+ #
14
+ #
15
+ # Python Code By:
16
+ #
17
+ # Andrea Gavana, @ 15 Oct 2009
18
+ # Latest Revision: 27 Dec 2012, 21.00 GMT
19
+ #
20
+ # For All Kind Of Problems, Requests Or Enhancements And Bug Reports, Please
21
+ # Write To Me At:
22
+ #
23
+ # andrea.gavana@gmail.com
24
+ # andrea.gavana@maerskoil.com
25
+ #
26
+ # Or, Obviously, To The wxPython Mailing List!!!
27
+ #
28
+ # End Of Comments
29
+ #---------------------------------------------------------------------------
30
+
31
+ """
32
+ Top-level control in a ribbon user interface.
33
+
34
+
35
+ Description
36
+ ===========
37
+
38
+ Serves as a tabbed container for :class:`~wx.lib.agw.ribbon.page.RibbonPage` - a ribbon user interface typically
39
+ has a ribbon bar, which contains one or more RibbonPages, which in turn each contains
40
+ one or more RibbonPanels, which in turn contain controls. While a :class:`RibbonBar` has
41
+ tabs similar to a :class:`Notebook`, it does not follow the same API for adding pages.
42
+ Containers like :class:`Notebook` can contain any type of window as a page, hence the
43
+ normal procedure is to create the sub-window and then call :meth:`BookCtrlBase.AddPage` ().
44
+
45
+ As :class:`RibbonBar` can only have :class:`~wx.lib.agw.ribbon.page.RibbonPage` as children
46
+ (and a :class:`~wx.lib.agw.ribbon.page.RibbonPage` can only have a :class:`RibbonBar` as parent),
47
+ when a page is created, it is automatically added to the bar - there is no `AddPage` equivalent to call.
48
+
49
+ After all pages have been created, and all controls and panels placed on those pages,
50
+ :meth:`~RibbonBar.Realize` must be called.
51
+
52
+
53
+ Window Styles
54
+ =============
55
+
56
+ This class supports the following window styles:
57
+
58
+ ========================================== =========== ==========================================
59
+ Window Styles Hex Value Description
60
+ ========================================== =========== ==========================================
61
+ ``RIBBON_BAR_DEFAULT_STYLE`` 0x9 Defined as ``RIBBON_BAR_FLOW_HORIZONTAL`` | ``RIBBON_BAR_SHOW_PAGE_LABELS`` | ``RIBBON_BAR_SHOW_PANEL_EXT_BUTTONS``
62
+ ``RIBBON_BAR_FOLDBAR_STYLE`` 0x1e Defined as ``RIBBON_BAR_FLOW_VERTICAL`` | ``RIBBON_BAR_SHOW_PAGE_ICONS`` | ``RIBBON_BAR_SHOW_PANEL_EXT_BUTTONS`` | ``RIBBON_BAR_SHOW_PANEL_MINIMISE_BUTTONS``
63
+ ``RIBBON_BAR_SHOW_PAGE_LABELS`` 0x1 Causes labels to be shown on the tabs in the ribbon bar.
64
+ ``RIBBON_BAR_SHOW_PAGE_ICONS`` 0x2 Causes icons to be shown on the tabs in the ribbon bar.
65
+ ``RIBBON_BAR_FLOW_HORIZONTAL`` 0x0 Causes panels within pages to stack horizontally.
66
+ ``RIBBON_BAR_FLOW_VERTICAL`` 0x4 Causes panels within pages to stack vertically.
67
+ ``RIBBON_BAR_SHOW_PANEL_EXT_BUTTONS`` 0x8 Causes extension buttons to be shown on panels (where the panel has such a button).
68
+ ``RIBBON_BAR_SHOW_PANEL_MINIMISE_BUTTONS`` 0x10 Causes minimise buttons to be shown on panels (where the panel has such a button).
69
+ ``RIBBON_BAR_ALWAYS_SHOW_TABS`` 0x20 Always shows the tabs area even when only one tab is added.
70
+ ========================================== =========== ==========================================
71
+
72
+
73
+ Events Processing
74
+ =================
75
+
76
+ This class processes the following events:
77
+
78
+ ================================= =================================
79
+ Event Name Description
80
+ ================================= =================================
81
+ ``EVT_RIBBONBAR_PAGE_CHANGED`` Triggered after the transition from one page being active to a different page being active.
82
+ ``EVT_RIBBONBAR_PAGE_CHANGING`` Triggered prior to the transition from one page being active to a different page being active, and can veto the change.
83
+ ``EVT_RIBBONBAR_TAB_MIDDLE_DOWN`` Triggered when the middle mouse button is pressed on a tab.
84
+ ``EVT_RIBBONBAR_TAB_MIDDLE_UP`` Triggered when the middle mouse button is released on a tab.
85
+ ``EVT_RIBBONBAR_TAB_RIGHT_DOWN`` Triggered when the right mouse button is pressed on a tab.
86
+ ``EVT_RIBBONBAR_TAB_RIGHT_UP`` Triggered when the right mouse button is released on a tab.
87
+ ``EVT_RIBBONBAR_TAB_LEFT_DCLICK`` Triggered when the user double-clicks on a tab.
88
+ ================================= =================================
89
+
90
+
91
+ See Also
92
+ ========
93
+
94
+ :class:`~wx.lib.agw.ribbon.page.RibbonPage`, :class:`~wx.lib.agw.ribbon.panel.RibbonPanel`
95
+ """
96
+
97
+
98
+ import wx
99
+ from functools import cmp_to_key
100
+
101
+ from .control import RibbonControl
102
+
103
+ from .art_internal import RibbonPageTabInfo
104
+ from .art_msw import RibbonMSWArtProvider
105
+ from .art import *
106
+
107
+ wxEVT_COMMAND_RIBBONBAR_PAGE_CHANGED = wx.NewEventType()
108
+ wxEVT_COMMAND_RIBBONBAR_PAGE_CHANGING = wx.NewEventType()
109
+ wxEVT_COMMAND_RIBBONBAR_TAB_MIDDLE_DOWN = wx.NewEventType()
110
+ wxEVT_COMMAND_RIBBONBAR_TAB_MIDDLE_UP = wx.NewEventType()
111
+ wxEVT_COMMAND_RIBBONBAR_TAB_RIGHT_DOWN = wx.NewEventType()
112
+ wxEVT_COMMAND_RIBBONBAR_TAB_RIGHT_UP = wx.NewEventType()
113
+ wxEVT_COMMAND_RIBBONBAR_TAB_LEFT_DCLICK = wx.NewEventType()
114
+
115
+ EVT_RIBBONBAR_PAGE_CHANGED = wx.PyEventBinder(wxEVT_COMMAND_RIBBONBAR_PAGE_CHANGED, 1)
116
+ EVT_RIBBONBAR_PAGE_CHANGING = wx.PyEventBinder(wxEVT_COMMAND_RIBBONBAR_PAGE_CHANGING, 1)
117
+ EVT_RIBBONBAR_TAB_MIDDLE_DOWN = wx.PyEventBinder(wxEVT_COMMAND_RIBBONBAR_TAB_MIDDLE_DOWN, 1)
118
+ EVT_RIBBONBAR_TAB_MIDDLE_UP = wx.PyEventBinder(wxEVT_COMMAND_RIBBONBAR_TAB_MIDDLE_UP, 1)
119
+ EVT_RIBBONBAR_TAB_RIGHT_DOWN = wx.PyEventBinder(wxEVT_COMMAND_RIBBONBAR_TAB_RIGHT_DOWN, 1)
120
+ EVT_RIBBONBAR_TAB_RIGHT_UP = wx.PyEventBinder(wxEVT_COMMAND_RIBBONBAR_TAB_RIGHT_UP, 1)
121
+ EVT_RIBBONBAR_TAB_LEFT_DCLICK = wx.PyEventBinder(wxEVT_COMMAND_RIBBONBAR_TAB_LEFT_DCLICK, 1)
122
+
123
+
124
+ def SET_FLAG(variable, flag):
125
+
126
+ refresh_tabs = False
127
+ if variable & flag != flag:
128
+ variable |= flag
129
+ refresh_tabs = True
130
+
131
+ return variable, refresh_tabs
132
+
133
+
134
+ def UNSET_FLAG(variable, flag):
135
+
136
+ refresh_tabs = False
137
+ if variable & flag:
138
+ variable &= ~flag
139
+ refresh_tabs = True
140
+
141
+ return variable, refresh_tabs
142
+
143
+
144
+ class RibbonBarEvent(wx.NotifyEvent):
145
+ """
146
+ Event used to indicate various actions relating to a :class:`RibbonBar`.
147
+
148
+ .. seealso:: :class:`RibbonBar` for available event types.
149
+ """
150
+
151
+ def __init__(self, command_type=None, win_id=0, page=None):
152
+ """
153
+ Default class constructor.
154
+
155
+ :param integer `command_type`: the event type;
156
+ :param integer `win_id`: the event identifier;
157
+ :param `page`: an instance of :class:`~wx.lib.agw.ribbon.page.RibbonPage`.
158
+ """
159
+
160
+ wx.NotifyEvent.__init__(self, command_type, win_id)
161
+ self._page = page
162
+
163
+ self._isAllowed = True
164
+
165
+
166
+ def GetPage(self):
167
+ """
168
+ Returns the page being changed to, or being clicked on.
169
+
170
+ :returns: An instance of :class:`~wx.lib.agw.ribbon.page.RibbonPage`.
171
+ """
172
+
173
+ return self._page
174
+
175
+
176
+ def SetPage(self, page):
177
+ """
178
+ Sets the page relating to this event.
179
+
180
+ :param `page`: an instance of :class:`~wx.lib.agw.ribbon.page.RibbonPage`.
181
+ """
182
+
183
+ self._page = page
184
+
185
+
186
+ def Allow(self):
187
+ """
188
+ This is the opposite of :meth:`~RibbonBarEvent.Veto`: it explicitly allows the event to be processed.
189
+ For most events it is not necessary to call this method as the events are
190
+ allowed anyhow but some are forbidden by default (this will be mentioned
191
+ in the corresponding event description).
192
+ """
193
+
194
+ self._isAllowed = True
195
+
196
+
197
+ def Veto(self):
198
+ """
199
+ Prevents the change announced by this event from happening.
200
+
201
+ :note: It is in general a good idea to notify the user about the reasons
202
+ for vetoing the change because otherwise the applications behaviour (which
203
+ just refuses to do what the user wants) might be quite surprising.
204
+ """
205
+
206
+ self._isAllowed = False
207
+
208
+
209
+ def IsAllowed(self):
210
+ """
211
+ Returns ``True`` if the change is allowed (:meth:`~RibbonBarEvent.Veto` hasn't been called) or
212
+ ``False`` otherwise (if it was).
213
+ """
214
+
215
+ return self._isAllowed
216
+
217
+
218
+ class RibbonBar(RibbonControl):
219
+ """ Top-level control in a ribbon user interface. """
220
+
221
+ def __init__(self, parent, id=wx.ID_ANY, pos=wx.DefaultPosition, size=wx.DefaultSize, agwStyle=RIBBON_BAR_DEFAULT_STYLE,
222
+ validator=wx.DefaultValidator, name="RibbonBar"):
223
+ """
224
+ Default constructor.
225
+
226
+ :param `parent`: pointer to a parent window, must not be ``None``;
227
+ :type `parent`: :class:`wx.Window`
228
+ :param integer `id`: window identifier. If ``wx.ID_ANY``, will automatically create
229
+ an identifier;
230
+ :param `pos`: window position. ``wx.DefaultPosition`` indicates that wxPython
231
+ should generate a default position for the window;
232
+ :type `pos`: tuple or :class:`wx.Point`
233
+ :param `size`: window size. ``wx.DefaultSize`` indicates that wxPython should
234
+ generate a default size for the window. If no suitable size can be found, the
235
+ window will be sized to 20x20 pixels so that the window is visible but obviously
236
+ not correctly sized;
237
+ :type `size`: tuple or :class:`wx.Size`
238
+ :param `agwStyle`: the AGW-specific window style. This can be a combination of the
239
+ following bits:
240
+
241
+ ========================================== =========== ==========================================
242
+ Window Styles Hex Value Description
243
+ ========================================== =========== ==========================================
244
+ ``RIBBON_BAR_DEFAULT_STYLE`` 0x9 Defined as ``RIBBON_BAR_FLOW_HORIZONTAL`` | ``RIBBON_BAR_SHOW_PAGE_LABELS`` | ``RIBBON_BAR_SHOW_PANEL_EXT_BUTTONS``
245
+ ``RIBBON_BAR_FOLDBAR_STYLE`` 0x1e Defined as ``RIBBON_BAR_FLOW_VERTICAL`` | ``RIBBON_BAR_SHOW_PAGE_ICONS`` | ``RIBBON_BAR_SHOW_PANEL_EXT_BUTTONS`` | ``RIBBON_BAR_SHOW_PANEL_MINIMISE_BUTTONS``
246
+ ``RIBBON_BAR_SHOW_PAGE_LABELS`` 0x1 Causes labels to be shown on the tabs in the ribbon bar.
247
+ ``RIBBON_BAR_SHOW_PAGE_ICONS`` 0x2 Causes icons to be shown on the tabs in the ribbon bar.
248
+ ``RIBBON_BAR_FLOW_HORIZONTAL`` 0x0 Causes panels within pages to stack horizontally.
249
+ ``RIBBON_BAR_FLOW_VERTICAL`` 0x4 Causes panels within pages to stack vertically.
250
+ ``RIBBON_BAR_SHOW_PANEL_EXT_BUTTONS`` 0x8 Causes extension buttons to be shown on panels (where the panel has such a button).
251
+ ``RIBBON_BAR_SHOW_PANEL_MINIMISE_BUTTONS`` 0x10 Causes minimise buttons to be shown on panels (where the panel has such a button).
252
+ ``RIBBON_BAR_ALWAYS_SHOW_TABS`` 0x20 Always shows the tabs area even when only one tab is added.
253
+ ========================================== =========== ==========================================
254
+
255
+ :param `validator`: the window validator;
256
+ :type `validator`: :class:`wx.Validator`
257
+ :param string `name`: the window name.
258
+
259
+ """
260
+
261
+ RibbonControl.__init__(self, parent, id, pos, size, style=wx.NO_BORDER)
262
+
263
+ self._flags = 0
264
+ self._tabs_total_width_ideal = 0
265
+ self._tabs_total_width_minimum = 0
266
+ self._tab_margin_left = 0
267
+ self._tab_margin_right = 0
268
+ self._tab_height = 0
269
+ self._tab_scroll_amount = 0
270
+ self._current_page = -1
271
+ self._current_hovered_page = -1
272
+ self._tab_scroll_left_button_state = RIBBON_SCROLL_BTN_NORMAL
273
+ self._tab_scroll_right_button_state = RIBBON_SCROLL_BTN_NORMAL
274
+ self._tab_scroll_buttons_shown = False
275
+ self._arePanelsShown = True
276
+ self._pages = []
277
+
278
+ self.Bind(wx.EVT_ERASE_BACKGROUND, self.OnEraseBackground)
279
+ self.Bind(wx.EVT_LEAVE_WINDOW, self.OnMouseLeave)
280
+ self.Bind(wx.EVT_LEFT_DOWN, self.OnMouseLeftDown)
281
+ self.Bind(wx.EVT_LEFT_DCLICK, self.OnMouseDoubleClick)
282
+ self.Bind(wx.EVT_LEFT_UP, self.OnMouseLeftUp)
283
+ self.Bind(wx.EVT_MIDDLE_DOWN, self.OnMouseMiddleDown)
284
+ self.Bind(wx.EVT_MIDDLE_UP, self.OnMouseMiddleUp)
285
+ self.Bind(wx.EVT_MOTION, self.OnMouseMove)
286
+ self.Bind(wx.EVT_PAINT, self.OnPaint)
287
+ self.Bind(wx.EVT_RIGHT_DOWN, self.OnMouseRightDown)
288
+ self.Bind(wx.EVT_RIGHT_UP, self.OnMouseRightUp)
289
+ self.Bind(wx.EVT_SIZE, self.OnSize)
290
+
291
+ self.CommonInit(agwStyle)
292
+
293
+
294
+ def AddPage(self, page):
295
+ """
296
+ Adds a page to the :class:`RibbonBar`.
297
+
298
+ :param `page`: an instance of :class:`~wx.lib.agw.ribbon.page.RibbonPage`.
299
+ """
300
+
301
+ info = RibbonPageTabInfo()
302
+
303
+ info.page = page
304
+ info.active = False
305
+ info.hovered = False
306
+ # info.rect not set (intentional)
307
+
308
+ dcTemp = wx.ClientDC(self)
309
+ label = ""
310
+ if self._flags & RIBBON_BAR_SHOW_PAGE_LABELS:
311
+ label = page.GetLabel()
312
+
313
+ icon = wx.NullBitmap
314
+ if self._flags & RIBBON_BAR_SHOW_PAGE_ICONS:
315
+ icon = page.GetIcon()
316
+
317
+ info.ideal_width, info.small_begin_need_separator_width, \
318
+ info.small_must_have_separator_width, info.minimum_width = self._art.GetBarTabWidth(dcTemp, self, label, icon, info.ideal_width,
319
+ info.small_begin_need_separator_width,
320
+ info.small_must_have_separator_width, info.minimum_width)
321
+
322
+ if not self._pages:
323
+ self._tabs_total_width_ideal = info.ideal_width
324
+ self._tabs_total_width_minimum = info.minimum_width
325
+ else:
326
+ sep = self._art.GetMetric(RIBBON_ART_TAB_SEPARATION_SIZE)
327
+ self._tabs_total_width_ideal += sep + info.ideal_width
328
+ self._tabs_total_width_minimum += sep + info.minimum_width
329
+
330
+ self._pages.append(info)
331
+
332
+ page.Hide() # Most likely case is that self new page is not the active tab
333
+ page.SetArtProvider(self._art)
334
+
335
+ if len(self._pages) == 1:
336
+ self.SetActivePage(0)
337
+
338
+
339
+ def DismissExpandedPanel(self):
340
+ """
341
+ Dismiss the expanded panel of the currently active page.
342
+
343
+ Calls and returns the value from :meth:`RibbonPage.DismissExpandedPanel() <lib.agw.ribbon.page.RibbonPage.DismissExpandedPanel>` for the
344
+ currently active page, or ``False`` if there is no active page.
345
+ """
346
+
347
+ if self._current_page == -1:
348
+ return False
349
+
350
+ return self._pages[self._current_page].page.DismissExpandedPanel()
351
+
352
+
353
+ def ShowPanels(self, show=True):
354
+ """
355
+ Shows or hides the panels inside :class:`RibbonBar`.
356
+
357
+ :param bool `show`: ``True`` to show the panels, ``False`` to hide them.
358
+ """
359
+
360
+ self._arePanelsShown = show
361
+ self.SetMinSize(wx.Size(self.GetSize().GetWidth(), self.DoGetBestSize().GetHeight()))
362
+ self.Realise()
363
+ self.GetParent().Layout()
364
+
365
+
366
+ def SetAGWWindowStyleFlag(self, agwStyle):
367
+ """
368
+ Sets the window style for :class:`RibbonBar`.
369
+
370
+ :param integer `agwStyle`: can be a combination of the following bits:
371
+
372
+ ========================================== =========== ==========================================
373
+ Window Styles Hex Value Description
374
+ ========================================== =========== ==========================================
375
+ ``RIBBON_BAR_DEFAULT_STYLE`` 0x9 Defined as ``RIBBON_BAR_FLOW_HORIZONTAL`` | ``RIBBON_BAR_SHOW_PAGE_LABELS`` | ``RIBBON_BAR_SHOW_PANEL_EXT_BUTTONS``
376
+ ``RIBBON_BAR_FOLDBAR_STYLE`` 0x1e Defined as ``RIBBON_BAR_FLOW_VERTICAL`` | ``RIBBON_BAR_SHOW_PAGE_ICONS`` | ``RIBBON_BAR_SHOW_PANEL_EXT_BUTTONS`` | ``RIBBON_BAR_SHOW_PANEL_MINIMISE_BUTTONS``
377
+ ``RIBBON_BAR_SHOW_PAGE_LABELS`` 0x1 Causes labels to be shown on the tabs in the ribbon bar.
378
+ ``RIBBON_BAR_SHOW_PAGE_ICONS`` 0x2 Causes icons to be shown on the tabs in the ribbon bar.
379
+ ``RIBBON_BAR_FLOW_HORIZONTAL`` 0x0 Causes panels within pages to stack horizontally.
380
+ ``RIBBON_BAR_FLOW_VERTICAL`` 0x4 Causes panels within pages to stack vertically.
381
+ ``RIBBON_BAR_SHOW_PANEL_EXT_BUTTONS`` 0x8 Causes extension buttons to be shown on panels (where the panel has such a button).
382
+ ``RIBBON_BAR_SHOW_PANEL_MINIMISE_BUTTONS`` 0x10 Causes minimise buttons to be shown on panels (where the panel has such a button).
383
+ ``RIBBON_BAR_ALWAYS_SHOW_TABS`` 0x20 Always shows the tabs area even when only one tab is added.
384
+ ========================================== =========== ==========================================
385
+
386
+ :note: Please note that some styles cannot be changed after the window creation
387
+ and that `Refresh()` might need to be be called after changing the others for
388
+ the change to take place immediately.
389
+ """
390
+
391
+ self._flags = agwStyle
392
+
393
+ if self._art:
394
+ self._art.SetFlags(agwStyle)
395
+
396
+
397
+ def GetAGWWindowStyleFlag(self):
398
+ """
399
+ Returns the :class:`RibbonBar` window style flag.
400
+
401
+ :see: :meth:`~RibbonBar.SetAGWWindowStyleFlag` for a list of valid window styles.
402
+ """
403
+
404
+ return self._flags
405
+
406
+
407
+ def Realize(self):
408
+ """
409
+ Perform initial layout and size calculations of the bar and its children.
410
+
411
+ This must be called after all of the bar's children have been created (and their
412
+ children created, etc.) - if it is not, then windows may not be laid out or
413
+ sized correctly. Also calls :meth:`RibbonPage.Realize() <lib.agw.ribbon.page.RibbonPage.Realize>`
414
+ on each child page.
415
+
416
+ :note: Reimplemented from :class:`~wx.lib.agw.ribbon.control.RibbonControl`.
417
+ """
418
+
419
+ status = True
420
+
421
+ dcTemp = wx.ClientDC(self)
422
+ sep = self._art.GetMetric(RIBBON_ART_TAB_SEPARATION_SIZE)
423
+ numtabs = len(self._pages)
424
+
425
+ for i, info in enumerate(self._pages):
426
+
427
+ self.RepositionPage(info.page)
428
+ if not info.page.Realize():
429
+ status = False
430
+
431
+ label = ""
432
+ if self._flags & RIBBON_BAR_SHOW_PAGE_LABELS:
433
+ label = info.page.GetLabel()
434
+
435
+ icon = wx.NullBitmap
436
+ if self._flags & RIBBON_BAR_SHOW_PAGE_ICONS:
437
+ icon = info.page.GetIcon()
438
+
439
+ info.ideal_width, info.small_begin_need_separator_width, \
440
+ info.small_must_have_separator_width, \
441
+ info.minimum_width = self._art.GetBarTabWidth(dcTemp, self, label, icon, info.ideal_width,
442
+ info.small_begin_need_separator_width, info.small_must_have_separator_width,
443
+ info.minimum_width)
444
+
445
+ if i == 0:
446
+ self._tabs_total_width_ideal = info.ideal_width
447
+ self._tabs_total_width_minimum = info.minimum_width
448
+ else:
449
+ self._tabs_total_width_ideal += sep + info.ideal_width
450
+ self._tabs_total_width_minimum += sep + info.minimum_width
451
+
452
+ self._tab_height = self._art.GetTabCtrlHeight(dcTemp, self, self._pages)
453
+
454
+ self.RecalculateMinSize()
455
+ self.RecalculateTabSizes()
456
+ self.Refresh()
457
+
458
+ return status
459
+
460
+
461
+ def OnMouseMove(self, event):
462
+ """
463
+ Handles the ``wx.EVT_MOTION`` event for :class:`RibbonBar`.
464
+
465
+ :param `event`: a :class:`MouseEvent` event to be processed.
466
+ """
467
+
468
+ x, y = event.GetX(), event.GetY()
469
+ hovered_page = -1
470
+ refresh_tabs = False
471
+
472
+ if y < self._tab_height:
473
+ # It is quite likely that the mouse moved a small amount and is still over the same tab
474
+ if self._current_hovered_page != -1 and self._pages[self._current_hovered_page].rect.Contains((x, y)):
475
+ hovered_page = self._current_hovered_page
476
+ # But be careful, if tabs can be scrolled, then parts of the tab rect may not be valid
477
+ if self._tab_scroll_buttons_shown:
478
+ if x >= self._tab_scroll_right_button_rect.GetX() or x < self._tab_scroll_left_button_rect.GetRight():
479
+ hovered_page = -1
480
+
481
+ else:
482
+
483
+ hovered_page, dummy = self.HitTestTabs(event.GetPosition())
484
+
485
+ if hovered_page != self._current_hovered_page:
486
+ if self._current_hovered_page != -1:
487
+ self._pages[self._current_hovered_page].hovered = False
488
+
489
+ self._current_hovered_page = hovered_page
490
+ if self._current_hovered_page != -1:
491
+ self._pages[self._current_hovered_page].hovered = True
492
+
493
+ refresh_tabs = True
494
+
495
+ if self._tab_scroll_buttons_shown:
496
+ if self._tab_scroll_left_button_rect.Contains((x, y)):
497
+ self._tab_scroll_left_button_state, refresh_tabs = SET_FLAG(self._tab_scroll_left_button_state, RIBBON_SCROLL_BTN_HOVERED)
498
+ else:
499
+ self._tab_scroll_left_button_state, refresh_tabs = UNSET_FLAG(self._tab_scroll_left_button_state, RIBBON_SCROLL_BTN_HOVERED)
500
+
501
+ if self._tab_scroll_right_button_rect.Contains((x, y)):
502
+ self._tab_scroll_right_button_state, refresh_tabs = SET_FLAG(self._tab_scroll_right_button_state, RIBBON_SCROLL_BTN_HOVERED)
503
+ else:
504
+ self._tab_scroll_right_button_state, refresh_tabs = UNSET_FLAG(self._tab_scroll_right_button_state, RIBBON_SCROLL_BTN_HOVERED)
505
+
506
+ if refresh_tabs:
507
+ self.RefreshTabBar()
508
+
509
+
510
+ def OnMouseLeave(self, event):
511
+ """
512
+ Handles the ``wx.EVT_LEAVE_WINDOW`` event for :class:`RibbonBar`.
513
+
514
+ :param `event`: a :class:`MouseEvent` event to be processed.
515
+ """
516
+
517
+ # The ribbon bar is (usually) at the top of a window, and at least on MSW, the mouse
518
+ # can leave the window quickly and leave a tab in the hovered state.
519
+ refresh_tabs = False
520
+
521
+ if self._current_hovered_page != -1:
522
+ self._pages[self._current_hovered_page].hovered = False
523
+ self._current_hovered_page = -1
524
+ refresh_tabs = True
525
+
526
+ if self._tab_scroll_left_button_state & RIBBON_SCROLL_BTN_HOVERED:
527
+ self._tab_scroll_left_button_state &= ~RIBBON_SCROLL_BTN_HOVERED
528
+ refresh_tabs = True
529
+
530
+ if self._tab_scroll_right_button_state & RIBBON_SCROLL_BTN_HOVERED:
531
+ self._tab_scroll_right_button_state &= ~RIBBON_SCROLL_BTN_HOVERED
532
+ refresh_tabs = True
533
+
534
+ if refresh_tabs:
535
+ self.RefreshTabBar()
536
+
537
+
538
+ def GetPage(self, n):
539
+ """
540
+ Get a page by index.
541
+
542
+ ``None`` will be returned if the given index is out of range.
543
+
544
+ :param integer `n`: the zero-based index indicating the page position.
545
+
546
+ """
547
+
548
+ if n < 0 or n >= len(self._pages):
549
+ return 0
550
+
551
+ return self._pages[n].page
552
+
553
+
554
+ def SetActivePageByIndex(self, page):
555
+ """
556
+ Set the active page by index, without triggering any events.
557
+
558
+ :param integer `page`: The zero-based index of the page to activate.
559
+
560
+ :returns: ``True`` if the specified page is now active, ``False`` if it could
561
+ not be activated (for example because the page index is invalid).
562
+ """
563
+
564
+ if self._current_page == page:
565
+ return True
566
+
567
+ if page >= len(self._pages):
568
+ return False
569
+
570
+ if self._current_page != -1:
571
+ self._pages[self._current_page].active = False
572
+ self._pages[self._current_page].page.Hide()
573
+
574
+ self._current_page = page
575
+ self._pages[page].active = True
576
+
577
+ wnd = self._pages[page].page
578
+ self.RepositionPage(wnd)
579
+ wnd.Layout()
580
+ wnd.Show()
581
+
582
+ self.Refresh()
583
+
584
+ return True
585
+
586
+
587
+ def SetActivePageByPage(self, page):
588
+ """
589
+ Set the active page, without triggering any events.
590
+
591
+ :param `page`: the page to activate, an instance of :class:`~wx.lib.agw.ribbon.page.RibbonPage`.
592
+
593
+ :returns: ``True`` if the specified page is now active, ``False`` if it could
594
+ not be activated (for example because the given page is not a child of the
595
+ ribbon bar).
596
+ """
597
+
598
+ for i in range(len(self._pages)):
599
+ if self._pages[i].page == page:
600
+ return self.SetActivePageByIndex(i)
601
+
602
+ return False
603
+
604
+
605
+ def SetActivePage(self, page):
606
+ """ See comments on :meth:`~RibbonBar.SetActivePageByIndex` and :meth:`~RibbonBar.SetActivePageByPage`. """
607
+
608
+ if isinstance(page, int):
609
+ return self.SetActivePageByIndex(page)
610
+
611
+ return self.SetActivePageByPage(page)
612
+
613
+
614
+ def GetActivePage(self):
615
+ """
616
+ Get the index of the active page.
617
+
618
+ In the rare case of no page being active, -1 is returned.
619
+ """
620
+
621
+ return self._current_page
622
+
623
+
624
+ def SetTabCtrlMargins(self, left, right):
625
+ """
626
+ Set the margin widths (in pixels) on the left and right sides of the tab bar
627
+ region of the ribbon bar.
628
+
629
+ These margins will be painted with the tab background, but tabs and scroll
630
+ buttons will never be painted in the margins. The left margin could be used for
631
+ rendering something equivalent to the "Office Button", though this is not
632
+ currently implemented. The right margin could be used for rendering a help
633
+ button, and/or MDI buttons, but again, this is not currently implemented.
634
+
635
+ :param integer `left`: the left margin (in pixels);
636
+ :param integer `right`: the right margin (in pixels).
637
+ """
638
+
639
+ self._tab_margin_left = left
640
+ self._tab_margin_right = right
641
+
642
+ self.RecalculateTabSizes()
643
+
644
+
645
+ def OrderPageTabInfoBySmallWidthAsc(self, first, second):
646
+
647
+ return first.small_must_have_separator_width - second.small_must_have_separator_width
648
+
649
+
650
+ def RecalculateTabSizes(self):
651
+ """ Recalculates the :class:`RibbonBar` tab sizes. """
652
+
653
+ numtabs = len(self._pages)
654
+
655
+ if numtabs == 0:
656
+ return
657
+
658
+ width = self.GetSize().GetWidth() - self._tab_margin_left - self._tab_margin_right
659
+ tabsep = self._art.GetMetric(RIBBON_ART_TAB_SEPARATION_SIZE)
660
+ x = self._tab_margin_left
661
+ y = 0
662
+
663
+ if width >= self._tabs_total_width_ideal:
664
+ # Simple case: everything at ideal width
665
+ for info in self._pages:
666
+ info.rect.x = x
667
+ info.rect.y = y
668
+ info.rect.width = info.ideal_width
669
+ info.rect.height = self._tab_height
670
+ x += info.rect.width + tabsep
671
+
672
+ self._tab_scroll_buttons_shown = False
673
+ self._tab_scroll_left_button_rect.SetWidth(0)
674
+ self._tab_scroll_right_button_rect.SetWidth(0)
675
+
676
+ elif width < self._tabs_total_width_minimum:
677
+ # Simple case: everything minimum with scrollbar
678
+ for info in self._pages:
679
+ info.rect.x = x
680
+ info.rect.y = y
681
+ info.rect.width = info.minimum_width
682
+ info.rect.height = self._tab_height
683
+ x += info.rect.width + tabsep
684
+
685
+ if not self._tab_scroll_buttons_shown:
686
+ self._tab_scroll_left_button_state = RIBBON_SCROLL_BTN_NORMAL
687
+ self._tab_scroll_right_button_state = RIBBON_SCROLL_BTN_NORMAL
688
+ self._tab_scroll_buttons_shown = True
689
+
690
+ temp_dc = wx.ClientDC(self)
691
+ self._tab_scroll_left_button_rect.SetWidth(self._art.GetScrollButtonMinimumSize(temp_dc, self,
692
+ RIBBON_SCROLL_BTN_LEFT | RIBBON_SCROLL_BTN_NORMAL |
693
+ RIBBON_SCROLL_BTN_FOR_TABS).GetWidth())
694
+ self._tab_scroll_left_button_rect.SetHeight(self._tab_height)
695
+ self._tab_scroll_left_button_rect.SetX(self._tab_margin_left)
696
+ self._tab_scroll_left_button_rect.SetY(0)
697
+ self._tab_scroll_right_button_rect.SetWidth(self._art.GetScrollButtonMinimumSize(temp_dc, self,
698
+ RIBBON_SCROLL_BTN_RIGHT | RIBBON_SCROLL_BTN_NORMAL |
699
+ RIBBON_SCROLL_BTN_FOR_TABS).GetWidth())
700
+ self._tab_scroll_right_button_rect.SetHeight(self._tab_height)
701
+ self._tab_scroll_right_button_rect.SetX(self.GetClientSize().GetWidth() - self._tab_margin_right - self._tab_scroll_right_button_rect.GetWidth())
702
+ self._tab_scroll_right_button_rect.SetY(0)
703
+
704
+ if self._tab_scroll_amount == 0:
705
+ self._tab_scroll_left_button_rect.SetWidth(0)
706
+
707
+ elif self._tab_scroll_amount + width >= self._tabs_total_width_minimum:
708
+ self._tab_scroll_amount = self._tabs_total_width_minimum - width
709
+ self._tab_scroll_right_button_rect.SetX(self._tab_scroll_right_button_rect.GetX() + self._tab_scroll_right_button_rect.GetWidth())
710
+ self._tab_scroll_right_button_rect.SetWidth(0)
711
+
712
+ for info in self._pages:
713
+ info.rect.x -= self._tab_scroll_amount
714
+
715
+ else:
716
+ self._tab_scroll_buttons_shown = False
717
+ self._tab_scroll_left_button_rect.SetWidth(0)
718
+ self._tab_scroll_right_button_rect.SetWidth(0)
719
+ # Complex case: everything sized such that: minimum <= width < ideal
720
+ #
721
+ # Strategy:
722
+ # 1) Uniformly reduce all tab widths from ideal to small_must_have_separator_width
723
+ # 2) Reduce the largest tab by 1 pixel, repeating until all tabs are same width (or at minimum)
724
+ # 3) Uniformly reduce all tabs down to their minimum width
725
+ #
726
+ smallest_tab_width = 10000
727
+ total_small_width = tabsep * (numtabs - 1)
728
+
729
+ for info in self._pages:
730
+ if info.small_must_have_separator_width < smallest_tab_width:
731
+ smallest_tab_width = info.small_must_have_separator_width
732
+
733
+ total_small_width += info.small_must_have_separator_width
734
+
735
+ if width >= total_small_width:
736
+ # Do (1)
737
+ total_delta = self._tabs_total_width_ideal - total_small_width
738
+ total_small_width -= tabsep*(numtabs - 1)
739
+ width -= tabsep*(numtabs - 1)
740
+ for info in self._pages:
741
+ delta = info.ideal_width - info.small_must_have_separator_width
742
+ info.rect.x = x
743
+ info.rect.y = y
744
+ info.rect.width = info.small_must_have_separator_width + delta*(width - total_small_width)//total_delta
745
+ info.rect.height = self._tab_height
746
+
747
+ x += info.rect.width + tabsep
748
+ total_delta -= delta
749
+ total_small_width -= info.small_must_have_separator_width
750
+ width -= info.rect.width
751
+
752
+ else:
753
+
754
+ total_small_width = tabsep*(numtabs - 1)
755
+ for info in self._pages:
756
+ if info.minimum_width < smallest_tab_width:
757
+ total_small_width += smallest_tab_width
758
+ else:
759
+ total_small_width += info.minimum_width
760
+
761
+ if width >= total_small_width:
762
+ # Do (2)
763
+ sorted_pages = []
764
+ for info in self._pages:
765
+ # Sneaky obj array trickery to not copy the tab descriptors
766
+ sorted_pages.append(info)
767
+
768
+ sorted_pages.sort(key=cmp_to_key(self.OrderPageTabInfoBySmallWidthAsc))
769
+ width -= tabsep*(numtabs - 1)
770
+
771
+ for i, info in enumerate(self._pages):
772
+ if info.small_must_have_separator_width*(numtabs - i) <= width:
773
+ info.rect.width = info.small_must_have_separator_width
774
+ else:
775
+ info.rect.width = int(width/(numtabs - i))
776
+
777
+ width -= info.rect.width
778
+
779
+ for i, info in enumerate(self._pages):
780
+ info.rect.x = x
781
+ info.rect.y = y
782
+ info.rect.height = self._tab_height
783
+ x += info.rect.width + tabsep
784
+ sorted_pages.pop(numtabs - (i + 1))
785
+
786
+ else:
787
+
788
+ # Do (3)
789
+ total_small_width = (smallest_tab_width + tabsep)*numtabs - tabsep
790
+ total_delta = total_small_width - self._tabs_total_width_minimum
791
+ total_small_width = self._tabs_total_width_minimum - tabsep*(numtabs - 1)
792
+ width -= tabsep*(numtabs - 1)
793
+
794
+ for info in self._pages:
795
+ delta = smallest_tab_width - info.minimum_width
796
+ info.rect.x = x
797
+ info.rect.y = y
798
+ info.rect.width = info.minimum_width + delta*(width - total_small_width)//total_delta
799
+ info.rect.height = self._tab_height
800
+
801
+ x += info.rect.width + tabsep
802
+ total_delta -= delta
803
+ total_small_width -= info.minimum_width
804
+ width -= info.rect.width
805
+
806
+
807
+ def CommonInit(self, agwStyle):
808
+ """
809
+ Common initialization procedures.
810
+
811
+ :param integer `agwStyle`: the AGW-specific window style.
812
+
813
+ :see: :meth:`~RibbonBar.SetAGWWindowStyleFlag` for a list of valid window styles.
814
+ """
815
+
816
+ self.SetName("RibbonBar")
817
+
818
+ self._flags = agwStyle
819
+ self._tabs_total_width_ideal = 0
820
+ self._tabs_total_width_minimum = 0
821
+ self._tab_margin_left = 50
822
+ self._tab_margin_right = 20
823
+ self._tab_height = 20 # initial guess
824
+ self._tab_scroll_amount = 0
825
+ self._current_page = -1
826
+ self._current_hovered_page = -1
827
+ self._tab_scroll_left_button_state = RIBBON_SCROLL_BTN_NORMAL
828
+ self._tab_scroll_right_button_state = RIBBON_SCROLL_BTN_NORMAL
829
+ self._tab_scroll_buttons_shown = False
830
+ self._arePanelsShown = True
831
+ self._tab_scroll_left_button_rect = wx.Rect()
832
+ self._tab_scroll_right_button_rect = wx.Rect()
833
+
834
+ if not self._art:
835
+ self.SetArtProvider(RibbonMSWArtProvider())
836
+
837
+ self.SetBackgroundStyle(wx.BG_STYLE_CUSTOM)
838
+
839
+
840
+ def SetArtProvider(self, art):
841
+ """
842
+ Set the art provider to be used be the ribbon bar.
843
+
844
+ Also sets the art provider on all current :class:`~wx.lib.agw.ribbon.page.RibbonPage` children, and any
845
+ :class:`~wx.lib.agw.ribbon.page.RibbonPage` children added in the future.
846
+
847
+ Note that unlike most other ribbon controls, the ribbon bar creates a default
848
+ art provider when initialised, so an explicit call to :meth:`~RibbonBar.SetArtProvider` is
849
+ not required if the default art provider is sufficient. Also unlike other
850
+ ribbon controls, the ribbon bar takes ownership of the given pointer, and
851
+ will delete it when the art provider is changed or the bar is destroyed.
852
+
853
+ If this behaviour is not desired, then clone the art provider before setting
854
+ it.
855
+
856
+ :param `art`: an art provider.
857
+
858
+ :note: Reimplemented from :class:`~wx.lib.agw.ribbon.control.RibbonControl`.
859
+ """
860
+
861
+ self._art = art
862
+
863
+ if art:
864
+ art.SetFlags(self._flags)
865
+
866
+ for info in self._pages:
867
+ if info.page.GetArtProvider() != art:
868
+ info.page.SetArtProvider(art)
869
+
870
+
871
+ def OnPaint(self, event):
872
+ """
873
+ Handles the ``wx.EVT_PAINT`` event for :class:`RibbonBar`.
874
+
875
+ :param `event`: a :class:`PaintEvent` event to be processed.
876
+ """
877
+
878
+ dc = wx.AutoBufferedPaintDC(self)
879
+
880
+ if not self.GetUpdateRegion().Contains(wx.Rect(0, 0, self.GetClientSize().GetWidth(), self._tab_height)):
881
+ # Nothing to do in the tab area, and the page area is handled by the active page
882
+ return
883
+
884
+ self.DoEraseBackground(dc)
885
+
886
+ numtabs = len(self._pages)
887
+ sep_visibility = 0.0
888
+ draw_sep = False
889
+ tabs_rect = wx.Rect(self._tab_margin_left, 0, self.GetClientSize().GetWidth() - self._tab_margin_left - self._tab_margin_right, self._tab_height)
890
+
891
+ if self._tab_scroll_buttons_shown:
892
+ tabs_rect.x += self._tab_scroll_left_button_rect.GetWidth()
893
+ tabs_rect.width -= self._tab_scroll_left_button_rect.GetWidth() + self._tab_scroll_right_button_rect.GetWidth()
894
+
895
+ for info in self._pages:
896
+ dc.DestroyClippingRegion()
897
+ if self._tab_scroll_buttons_shown:
898
+ if not tabs_rect.Intersects(info.rect):
899
+ continue
900
+ dc.SetClippingRegion(tabs_rect)
901
+
902
+ dc.SetClippingRegion(info.rect)
903
+ self._art.DrawTab(dc, self, info)
904
+
905
+ if info.rect.width < info.small_begin_need_separator_width:
906
+ draw_sep = True
907
+ if info.rect.width < info.small_must_have_separator_width:
908
+ sep_visibility += 1.0
909
+ else:
910
+ sep_visibility += float(info.small_begin_need_separator_width - info.rect.width)/ \
911
+ float(info.small_begin_need_separator_width - info.small_must_have_separator_width)
912
+
913
+ if draw_sep:
914
+
915
+ rect = wx.Rect(*self._pages[0].rect)
916
+ rect.width = self._art.GetMetric(RIBBON_ART_TAB_SEPARATION_SIZE)
917
+ sep_visibility /= float(numtabs)
918
+
919
+ for i in range(0, numtabs-1):
920
+ info = self._pages[i]
921
+ rect.x = info.rect.x + info.rect.width
922
+
923
+ if self._tab_scroll_buttons_shown and not tabs_rect.Intersects(rect):
924
+ continue
925
+
926
+ dc.DestroyClippingRegion()
927
+ dc.SetClippingRegion(rect)
928
+ self._art.DrawTabSeparator(dc, self, rect, sep_visibility)
929
+
930
+ if self._tab_scroll_buttons_shown:
931
+ dc.DestroyClippingRegion()
932
+ if self._tab_scroll_left_button_rect.GetWidth() != 0:
933
+ self._art.DrawScrollButton(dc, self, self._tab_scroll_left_button_rect, RIBBON_SCROLL_BTN_LEFT |
934
+ self._tab_scroll_left_button_state | RIBBON_SCROLL_BTN_FOR_TABS)
935
+
936
+ if self._tab_scroll_right_button_rect.GetWidth() != 0:
937
+ self._art.DrawScrollButton(dc, self, self._tab_scroll_right_button_rect, RIBBON_SCROLL_BTN_RIGHT |
938
+ self._tab_scroll_right_button_state | RIBBON_SCROLL_BTN_FOR_TABS)
939
+
940
+
941
+ def OnEraseBackground(self, event):
942
+ """
943
+ Handles the ``wx.EVT_ERASE_BACKGROUND`` event for :class:`RibbonBar`.
944
+
945
+ :param `event`: a :class:`EraseEvent` event to be processed.
946
+ """
947
+
948
+ # Background painting done in main paint handler to reduce screen flicker
949
+ pass
950
+
951
+
952
+ def DoEraseBackground(self, dc):
953
+ """
954
+ Does the initial painting of stuff from the :meth:`~RibbonBar.OnPaint` event.
955
+
956
+ :param `dc`: an instance of :class:`wx.DC`.
957
+ """
958
+
959
+ tabs = wx.Rect(0, 0, *self.GetSize())
960
+ tabs.height = self._tab_height
961
+ self._art.DrawTabCtrlBackground(dc, self, tabs)
962
+
963
+
964
+ def OnSize(self, event):
965
+ """
966
+ Handles the ``wx.EVT_SIZE`` event for :class:`RibbonBar`.
967
+
968
+ :param `event`: a :class:`wx.SizeEvent` event to be processed.
969
+ """
970
+
971
+ self.RecalculateTabSizes()
972
+ if self._current_page != -1:
973
+ self.RepositionPage(self._pages[self._current_page].page)
974
+
975
+ self.RefreshTabBar()
976
+ event.Skip()
977
+
978
+
979
+ def RepositionPage(self, page):
980
+
981
+ w, h = self.GetSize()
982
+ page.SetSizeWithScrollButtonAdjustment(0, self._tab_height, w, h - self._tab_height)
983
+
984
+
985
+ def HitTestTabs(self, position):
986
+ """
987
+ Hit test method for :class:`RibbonBar`, testing where the given (in client coordinates)
988
+ point lies.
989
+
990
+ :param `position`: an instance of :class:`wx.Point` in client coordinates.
991
+
992
+ :return: a tuple containing the tab index and the :class:`~wx.lib.agw.ribbon.page.RibbonPage` if the :meth:`~RibbonBar.HitTestTabs`
993
+ successfully found such combination, or a tuple `(-1, None)` if no tab has been hit.
994
+ """
995
+
996
+ tabs_rect = wx.Rect(self._tab_margin_left, 0, self.GetClientSize().GetWidth() - self._tab_margin_left - self._tab_margin_right, self._tab_height)
997
+
998
+ if self._tab_scroll_buttons_shown:
999
+ tabs_rect.SetX(tabs_rect.GetX() + self._tab_scroll_left_button_rect.GetWidth())
1000
+ tabs_rect.SetWidth(tabs_rect.GetWidth() - self._tab_scroll_left_button_rect.GetWidth() - self._tab_scroll_right_button_rect.GetWidth())
1001
+
1002
+ if tabs_rect.Contains(position):
1003
+ for i, info in enumerate(self._pages):
1004
+ if info.rect.Contains(position):
1005
+ return i, info
1006
+
1007
+ return -1, None
1008
+
1009
+
1010
+ def OnMouseLeftDown(self, event):
1011
+ """
1012
+ Handles the ``wx.EVT_LEFT_DOWN`` event for :class:`RibbonBar`.
1013
+
1014
+ :param `event`: a :class:`MouseEvent` event to be processed.
1015
+ """
1016
+
1017
+ index, tab = self.HitTestTabs(event.GetPosition())
1018
+ if tab and tab != self._pages[self._current_page]:
1019
+ query = RibbonBarEvent(wxEVT_COMMAND_RIBBONBAR_PAGE_CHANGING, self.GetId(), tab.page)
1020
+ query.SetEventObject(self)
1021
+ self.GetEventHandler().ProcessEvent(query)
1022
+
1023
+ if query.IsAllowed():
1024
+ self.SetActivePage(query.GetPage())
1025
+ notification = RibbonBarEvent(wxEVT_COMMAND_RIBBONBAR_PAGE_CHANGED, self.GetId(), self._pages[self._current_page].page)
1026
+ notification.SetEventObject(self)
1027
+ self.GetEventHandler().ProcessEvent(notification)
1028
+
1029
+ elif tab is None:
1030
+ if self._tab_scroll_left_button_rect.Contains(event.GetPosition()):
1031
+ self._tab_scroll_left_button_state |= RIBBON_SCROLL_BTN_ACTIVE | RIBBON_SCROLL_BTN_HOVERED
1032
+ self.RefreshTabBar()
1033
+
1034
+ elif self._tab_scroll_right_button_rect.Contains(event.GetPosition()):
1035
+ self._tab_scroll_right_button_state |= RIBBON_SCROLL_BTN_ACTIVE | RIBBON_SCROLL_BTN_HOVERED
1036
+ self.RefreshTabBar()
1037
+
1038
+
1039
+ def OnMouseDoubleClick(self, event):
1040
+ """
1041
+ Handles the ``wx.EVT_LEFT_DCLICK`` event for :class:`RibbonBar`.
1042
+
1043
+ :param `event`: a :class:`MouseEvent` event to be processed.
1044
+ """
1045
+
1046
+ self.DoMouseButtonCommon(event, wxEVT_COMMAND_RIBBONBAR_TAB_LEFT_DCLICK)
1047
+
1048
+
1049
+ def OnMouseLeftUp(self, event):
1050
+ """
1051
+ Handles the ``wx.EVT_LEFT_UP`` event for :class:`RibbonBar`.
1052
+
1053
+ :param `event`: a :class:`MouseEvent` event to be processed.
1054
+ """
1055
+
1056
+ if not self._tab_scroll_buttons_shown:
1057
+ return
1058
+
1059
+ amount = 0
1060
+
1061
+ if self._tab_scroll_left_button_state & RIBBON_SCROLL_BTN_ACTIVE:
1062
+ amount = -1
1063
+
1064
+ elif self._tab_scroll_right_button_state & RIBBON_SCROLL_BTN_ACTIVE:
1065
+ amount = 1
1066
+
1067
+ if amount != 0:
1068
+ self._tab_scroll_left_button_state &= ~RIBBON_SCROLL_BTN_ACTIVE
1069
+ self._tab_scroll_right_button_state &= ~RIBBON_SCROLL_BTN_ACTIVE
1070
+ self.ScrollTabBar(amount*8)
1071
+
1072
+
1073
+ def ScrollTabBar(self, amount):
1074
+ """
1075
+ Scrolls the tab area left/right/up/down by the specified `amount`.
1076
+
1077
+ :param integer `amount`: the amount by which the tab area is scrolled, in pixels.
1078
+ """
1079
+
1080
+ show_left = True
1081
+ show_right = True
1082
+
1083
+ if self._tab_scroll_amount + amount <= 0:
1084
+ amount = -self._tab_scroll_amount
1085
+ show_left = False
1086
+
1087
+ elif self._tab_scroll_amount + amount + (self.GetClientSize().GetWidth() - \
1088
+ self._tab_margin_left - self._tab_margin_right) >= \
1089
+ self._tabs_total_width_minimum:
1090
+ amount = self._tabs_total_width_minimum - self._tab_scroll_amount - \
1091
+ (self.GetClientSize().GetWidth() - self._tab_margin_left - self._tab_margin_right)
1092
+ show_right = False
1093
+
1094
+ if amount == 0:
1095
+ return
1096
+
1097
+ self._tab_scroll_amount += amount
1098
+ for info in self._pages:
1099
+ info.rect.SetX(info.rect.GetX() - amount)
1100
+
1101
+ if show_right != (self._tab_scroll_right_button_rect.GetWidth() != 0) or \
1102
+ show_left != (self._tab_scroll_left_button_rect.GetWidth() != 0):
1103
+
1104
+ temp_dc = wx.ClientDC(self)
1105
+
1106
+ if show_left:
1107
+ self._tab_scroll_left_button_rect.SetWidth(self._art.GetScrollButtonMinimumSize(temp_dc, self, RIBBON_SCROLL_BTN_LEFT |
1108
+ RIBBON_SCROLL_BTN_NORMAL |
1109
+ RIBBON_SCROLL_BTN_FOR_TABS).GetWidth())
1110
+ else:
1111
+ self._tab_scroll_left_button_rect.SetWidth(0)
1112
+
1113
+ if show_right:
1114
+ if self._tab_scroll_right_button_rect.GetWidth() == 0:
1115
+ self._tab_scroll_right_button_rect.SetWidth(self._art.GetScrollButtonMinimumSize(temp_dc, self,
1116
+ RIBBON_SCROLL_BTN_RIGHT |
1117
+ RIBBON_SCROLL_BTN_NORMAL |
1118
+ RIBBON_SCROLL_BTN_FOR_TABS).GetWidth())
1119
+ self._tab_scroll_right_button_rect.SetX(self._tab_scroll_right_button_rect.GetX() - self._tab_scroll_right_button_rect.GetWidth())
1120
+ else:
1121
+
1122
+ if self._tab_scroll_right_button_rect.GetWidth() != 0:
1123
+ self._tab_scroll_right_button_rect.SetX(self._tab_scroll_right_button_rect.GetX() + self._tab_scroll_right_button_rect.GetWidth())
1124
+ self._tab_scroll_right_button_rect.SetWidth(0)
1125
+
1126
+ self.RefreshTabBar()
1127
+
1128
+
1129
+ def RefreshTabBar(self):
1130
+ """ Repaints the tab area in :class:`RibbonBar`. """
1131
+
1132
+ tab_rect = wx.Rect(0, 0, self.GetClientSize().GetWidth(), self._tab_height)
1133
+ self.Refresh(False, tab_rect)
1134
+
1135
+
1136
+ def OnMouseMiddleDown(self, event):
1137
+ """
1138
+ Handles the ``wx.EVT_MIDDLE_DOWN`` event for :class:`RibbonBar`.
1139
+
1140
+ :param `event`: a :class:`MouseEvent` event to be processed.
1141
+ """
1142
+
1143
+ self.DoMouseButtonCommon(event, wxEVT_COMMAND_RIBBONBAR_TAB_MIDDLE_DOWN)
1144
+
1145
+
1146
+ def OnMouseMiddleUp(self, event):
1147
+ """
1148
+ Handles the ``wx.EVT_MIDDLE_UP`` event for :class:`RibbonBar`.
1149
+
1150
+ :param `event`: a :class:`MouseEvent` event to be processed.
1151
+ """
1152
+
1153
+ self.DoMouseButtonCommon(event, wxEVT_COMMAND_RIBBONBAR_TAB_MIDDLE_UP)
1154
+
1155
+
1156
+ def OnMouseRightDown(self, event):
1157
+ """
1158
+ Handles the ``wx.EVT_RIGHT_DOWN`` event for :class:`RibbonBar`.
1159
+
1160
+ :param `event`: a :class:`MouseEvent` event to be processed.
1161
+ """
1162
+
1163
+ self.DoMouseButtonCommon(event, wxEVT_COMMAND_RIBBONBAR_TAB_RIGHT_DOWN)
1164
+
1165
+
1166
+ def OnMouseRightUp(self, event):
1167
+ """
1168
+ Handles the ``wx.EVT_RIGHT_UP`` event for :class:`RibbonBar`.
1169
+
1170
+ :param `event`: a :class:`MouseEvent` event to be processed.
1171
+ """
1172
+
1173
+ self.DoMouseButtonCommon(event, wxEVT_COMMAND_RIBBONBAR_TAB_RIGHT_UP)
1174
+
1175
+
1176
+ def DoMouseButtonCommon(self, event, tab_event_type):
1177
+ """
1178
+ Common methods for all the mouse move/click events.
1179
+
1180
+ :param `event`: a :class:`MouseEvent` event to be processed;
1181
+ :param integer `tab_event_type`: one of the :class:`RibbonBar` events.
1182
+ """
1183
+
1184
+ index, tab = self.HitTestTabs(event.GetPosition())
1185
+
1186
+ if tab:
1187
+ notification = RibbonBarEvent(tab_event_type, self.GetId(), tab.page)
1188
+ notification.SetEventObject(self)
1189
+ self.GetEventHandler().ProcessEvent(notification)
1190
+
1191
+
1192
+ def RecalculateMinSize(self):
1193
+ """ Recalculates the :class:`RibbonBar` minimum size. """
1194
+
1195
+ min_size = wx.Size(-1, -1)
1196
+ numtabs = len(self._pages)
1197
+
1198
+ if numtabs != 0:
1199
+ min_size = wx.Size(*self._pages[0].page.GetMinSize())
1200
+
1201
+ for info in self._pages:
1202
+ page_min = info.page.GetMinSize()
1203
+ min_size.x = max(min_size.x, page_min.x)
1204
+ min_size.y = max(min_size.y, page_min.y)
1205
+
1206
+ if min_size.y != -1:
1207
+ # TODO: Decide on best course of action when min height is unspecified
1208
+ # - should we specify it to the tab minimum, or leave it unspecified?
1209
+ min_size.IncBy(0, self._tab_height)
1210
+
1211
+ self._minWidth = min_size.GetWidth()
1212
+ self._minHeight = (self._arePanelsShown and [min_size.GetHeight()] or [self._tab_height])[0]
1213
+
1214
+
1215
+ def DoGetBestSize(self):
1216
+ """
1217
+ Gets the size which best suits the window: for a control, it would be the
1218
+ minimal size which doesn't truncate the control, for a panel - the same size
1219
+ as it would have after a call to `Fit()`.
1220
+
1221
+ :return: An instance of :class:`wx.Size`.
1222
+
1223
+ :note: Overridden from :class:`wx.Control`.
1224
+ """
1225
+
1226
+ best = wx.Size(0, 0)
1227
+
1228
+ if self._current_page != -1:
1229
+ best = wx.Size(*self._pages[self._current_page].page.GetBestSize())
1230
+
1231
+ if best.GetHeight() == -1:
1232
+ best.SetHeight(self._tab_height)
1233
+ else:
1234
+ best.IncBy(0, self._tab_height)
1235
+
1236
+ if not self._arePanelsShown:
1237
+ best.SetHeight(self._tab_height)
1238
+
1239
+ return best
1240
+
1241
+
1242
+ def HasMultiplePages(self):
1243
+ """
1244
+ This method should be overridden to return true if this window has multiple pages.
1245
+
1246
+ All standard class with multiple pages such as :class:`Notebook`, :class:`Listbook` and :class:`Treebook`
1247
+ already override it to return true and user-defined classes with similar behaviour should also
1248
+ do so, to allow the library to handle such windows appropriately.
1249
+ """
1250
+
1251
+ return True
1252
+
1253
+
1254
+ def GetDefaultBorder(self):
1255
+ """ Returns the default border style for :class:`RibbonBar`. """
1256
+
1257
+ return wx.BORDER_NONE
1258
+
1259
+