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,2116 @@
1
+ # --------------------------------------------------------------------------- #
2
+ # SCROLLEDTHUMBNAIL Control wxPython IMPLEMENTATION
3
+ # Python Code By:
4
+ #
5
+ # Michael Eager (eager@eagercon.com), 26 Sep 2020
6
+ #
7
+ # Based on thumnailctrl.py by
8
+ # Andrea Gavana And Peter Damoc, @ 12 Dec 2005, revised 27 Dec 2012
9
+ # andrea.gavana@gmail.com
10
+ # andrea.gavana@maerskoil.com
11
+ #
12
+ # Tags: phoenix-port, documented, unittest, py3-port
13
+ #
14
+ # End Of Comments
15
+ # --------------------------------------------------------------------------- #
16
+
17
+ """
18
+ :class:`ScrolledThumbnail` is a widget that can be used to display a series of
19
+ thumbnails for files in a scrollable window.
20
+
21
+ Description
22
+ ===========
23
+
24
+ :class:`ScrolledThumbnail` is a widget derived from :class:`wx.ScrolledWindow`
25
+ which will display the thumbnail image for a file in a scrollable, resizable
26
+ window. It supports selecting one or more thumbnails, rotating the thumbnails,
27
+ displaying information for each thumbnail, and popups for both the window and
28
+ for individual thumbnails.
29
+
30
+ The class uses two support classes: :class:`Thumb` and :class:`ImageHandler`.
31
+
32
+ :class:`Thumb` contains all of the information for a particular thumbnail,
33
+ including filename, bitmaped thumbnail image, caption, and other data. This
34
+ class also has methods to perform thumbnail operations such as rotation,
35
+ highlighting, setting a file name.
36
+
37
+ :class:`ImageHandler` provides file/image handling functions, including loading
38
+ a file and creating an image from it, rotating an image, or highlighting an image.
39
+
40
+ The implementations of these two classes included in this file support generating
41
+ thumbnails from supported image files, such as JPEG, GIF, PNG, etc., using either
42
+ WxPythons native support or the PIL image library. Additional file types can be
43
+ supported by extending these classes, for example, to provide a thumbnail image
44
+ for an MP4 file, perhaps the cover photo, an MPEG by providing the image of a
45
+ title frame, or a PDF by providing an image of the cover page. The images for
46
+ these files may be generated on the fly by a suitably extended :class:`ImageHandler`,
47
+ or may be provided with the instance of :class:`Thumb`. The list of `Thumb`
48
+ instances passed to `ScrolledThumbnail` may contain different derived classes,
49
+ as long as each contains the required functions.
50
+
51
+ NB: Use of :class:`ScrolledThumbnail` has not been tested with extended classes.
52
+
53
+ :class:`ScrolledThumbnail`, :class:`Thumb`, and :class:`ImageHandler`, implemented
54
+ here are derived from the similarly named classes included in :class:`agw.ThumbnailCtrl`,
55
+ written by Andrea Gavana. That implementation was tightly integrated as a image
56
+ file browser application. The current implementation removes dependencies between
57
+ the several classes and narrows the scope of `ScrolledThumbnail` to the placement
58
+ and management of thumbnails within a window.
59
+
60
+ An updated :class:`ThumbnailCtrl` which uses this implementation of
61
+ :class:`ScrolledThumbnail`, :class:`Thumb`, and :class:`ImageHandler` provides
62
+ all of the previous functionality, which described as a widget that can be used
63
+ to display a series of images in a "thumbnail" format; it mimics, for example,
64
+ the windows explorer behavior when you select the "view thumbnails" option.
65
+ Basically, by specifying a folder that contains some image files, the files
66
+ in the folder are displayed as miniature versions of the actual images in
67
+ a :class:`ScrolledWindow`.
68
+
69
+ The code in the previous implementation is partly based on `wxVillaLib`, a
70
+ wxWidgets implementation of the :class:`ThumbnailCtrl` control. Andrea Gavana
71
+ notes that :class:`ThumbnailCtrl` wouldn't have been so fast and complete
72
+ without the suggestions and hints from Peter Damoc.
73
+
74
+ Usage
75
+ =====
76
+
77
+ Usage example::
78
+
79
+ import os
80
+ import wx
81
+ from scrolledthumbnail import ScrolledThumbnail, Thumb, NativeImageHandler
82
+
83
+ class MyFrame(wx.Frame):
84
+
85
+ def __init__(self, parent):
86
+ wx.Frame.__init__(self, parent, -1, "ScrolledThumb Demo", size=(400,300))
87
+
88
+ self.scroll = ScrolledThumbnail(self, -1, size=(400,300))
89
+
90
+ def ShowDir(self, dir):
91
+ dir = os.getcwd()
92
+ files = os.listdir(dir)
93
+ thumbs = []
94
+ for f in files:
95
+ if os.path.splitext(f)[1] in [".jpg", ".gif", ".png"]:
96
+ thumbs.append(Thumb(dir, f, caption=f, imagehandler=NativeImageHandler))
97
+ self.scroll.ShowThumbs(thumbs)
98
+
99
+
100
+ app = wx.App(False)
101
+ frame = MyFrame(None)
102
+ frame.ShowDir(os.getcwd())
103
+ frame.Show(True)
104
+
105
+ app.MainLoop()
106
+
107
+
108
+
109
+ Methods and Settings
110
+ ====================
111
+
112
+ With :class:`ScrolledThumbnail` you can:
113
+
114
+ - Create different thumbnail outlines (none, images only, full, etc...);
115
+ - Highlight thumbnails on mouse hovering;
116
+ - Show/hide file names below thumbnails;
117
+ - Change thumbnail caption font;
118
+ - Zoom in/out thumbnails (done via ``Ctrl`` key + mouse wheel or with ``+`` and ``-`` chars,
119
+ with zoom factor value customizable);
120
+ - Rotate thumbnails with these specifications:
121
+
122
+ a) ``d`` key rotates 90 degrees clockwise;
123
+ b) ``s`` key rotates 90 degrees counter-clockwise;
124
+ c) ``a`` key rotates 180 degrees.
125
+
126
+ - Drag and drop thumbnails from :class:`ScrolledThumbnail` to whatever application you want;
127
+ - Use local (when at least one thumbnail is selected) or global (no need for
128
+ thumbnail selection) popup menus;
129
+ - possibility to show tooltips on thumbnails, which display file information
130
+ (like file name, size, last modification date and thumbnail size).
131
+
132
+ :note: Using highlight thumbnails on mouse hovering may be slow on slower
133
+ computers.
134
+
135
+
136
+ Window Styles
137
+ =============
138
+
139
+ `No particular window styles are available for this class.`
140
+
141
+
142
+ Events Processing
143
+ =================
144
+
145
+ This class processes the following events:
146
+
147
+ This class processes the following events:
148
+
149
+ ================================== ==================================================
150
+ Event Name Description
151
+ ================================== ==================================================
152
+ ``EVT_THUMBNAILS_CAPTION_CHANGED`` The thumbnail caption has been changed. Not used at present.
153
+ ``EVT_THUMBNAILS_DCLICK`` The user has double-clicked on a thumbnail.
154
+ ``EVT_THUMBNAILS_POINTED`` The mouse cursor is hovering over a thumbnail.
155
+ ``EVT_THUMBNAILS_SEL_CHANGED`` The user has changed the selected thumbnail.
156
+ ``EVT_THUMBNAILS_THUMB_CHANGED`` The thumbnail of an image has changed. Used internally.
157
+ ``EVT_THUMBNAILS_CHAR`` A character has been typed
158
+ ================================== ==================================================
159
+
160
+
161
+ License And Version
162
+ ===================
163
+
164
+ :class:`ScrolledThumbnail` is distributed under the wxPython license.
165
+
166
+ Latest revision: Michael Eager @ 2 Oct 2020
167
+
168
+ Version 1.0
169
+
170
+ """
171
+
172
+ #----------------------------------------------------------------------
173
+ # Beginning Of ThumbnailCtrl wxPython Code
174
+ #----------------------------------------------------------------------
175
+
176
+ import io
177
+ import os
178
+ import wx
179
+ import zlib
180
+ from math import radians
181
+
182
+ from wx.lib.embeddedimage import PyEmbeddedImage
183
+
184
+ import _thread as thread
185
+
186
+ #----------------------------------------------------------------------
187
+ # Get Default Icon/Data
188
+ #----------------------------------------------------------------------
189
+
190
+ #----------------------------------------------------------------------
191
+ file_broken = PyEmbeddedImage(
192
+ b"iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAABGdBTUEAAK/INwWK6QAADU9J"
193
+ b"REFUeJzNWn1QE2cefja7yRI+lAKiAgKCVIqegUYMFMsM4kfvzk7nmFrnvHGcOT3bq3P/OJ1p"
194
+ b"b+zYf+r0HGxt6VVFqpYqWq9TW23RVnp6R7FXiq0UPAGhyFeQSCQJISHZ7Mf9gZuGkE02IeA9"
195
+ b"M5k3u/vuu+/z/H7v7/297y4BPzh//vxfSJIsIgjC5a/eTIPn+UnHgiDIqisIAsUwTNfmzZtf"
196
+ b"A8D7qk/5e3B0dPS6wsLCp/09MFTIbdO7ntR9vs5HRESgvr6+E0AlAD2AKZX8CsDzvEKtVsvq"
197
+ b"aKjw7LggCO7jcJQqlQoMw6gBpAIYRAgCECGxCgDPTsohEopI4n+e5xXww1MRHkry4d1Zf9fk"
198
+ b"uv90MOsCeMKfGN51pO6ZrmizKsBsWt976EjhoQ+BYMQItpSDWRNAjptPZ4xLCfl/PQTCaX2p"
199
+ b"+wNhVgSYbet7tumdRXpj1ofAbFhfqn1fmHEBHpb1AYAgAudxMy4AQRB+LReuSB/MGsETMyqA"
200
+ b"2WyG1WqVZQl/CDUZeuge0NvbKwwODk7bC7zryYFI/qF6QGNj42BnZ6dZ6rocQtNNhQNhxgQw"
201
+ b"Go24fPnyDy0tLTcFQfDpBZ7/w2198RcIMyZAW1vb+KVLlxoGBwfr7927B4Vi8qO8CfnqbCjW"
202
+ b"D4Y8MEMCCIKA77777me73d7a1tb25dDQkNXzmud/giDgdDrBsqzkuA1l7CuVSgCA0+n0y3FG"
203
+ b"BBgYGMCVK1eub926dRFN04aBgYH/el73JKRUKjE4OIi+vj5QFDWtaVG0fGRkJHiex7lz5xyn"
204
+ b"T59uBMBI9TWsAoidaW1tNTc1Nd1cv379zuzs7F91dHT8x+l0TooDnuju7h779ttvjdOdLlUq"
205
+ b"FaKjo9HV1YX9+/d379q16+QXX3xxFsAAMHU7DAgggNw1tQiCIOByuXDt2rWbK1asUOfk5KxM"
206
+ b"SUlZW19f39LX18eTJDmpbbG8cePGndra2mtDQ0NQKpUhJUPR0dHgeR6ffvqpbdeuXV+9/vrr"
207
+ b"R4eGhs4A+ArA3ZAECAXd3d24dOnSD2VlZavy8vKQmppaUFdXN2gwGO561yVJEmazGR0dHV3n"
208
+ b"z5//+NatW0MU5XebcgooikJMTAy6urqwb9++zp07d1ZfvXq1GsAn8+bNa6qsrEyGxJY4EGBT"
209
+ b"lCAIhVR0ZhgGTqcTTqcTDocDDocDgiDgm2++0Y+MjNxbuXLl7wmCQFpaWtbcuXMje3p6fly9"
210
+ b"enWyeL8gCCBJEj09PUJLS0s7z/PXWlpavigoKNhBURRYlnU/S6qMjIwEwzD47LPPbIcOHWq4"
211
+ b"cuXKPwF8D+DHF154QV1cXFxpsVjiAGwGYIUPL/ArgNFoNNbV1dmtVqvdarW6LBaLY2xszOFw"
212
+ b"OBiLxWKz2WxOs9lsHx0ddZhMJpvZbB7v7u7+effu3elZWVmJAJCUlBS1bt26nNbW1kaj0fj0"
213
+ b"I4884iYHAHfu3Lnf2dnZDWC4oaHhH08++eRWrVZLe9bxJk9RFNRqNTo6OvDhhx92Hj16tG5k"
214
+ b"ZKQBwHUAneXl5cVarfaQVqtddurUqesAUgC0BysAsWfPngOjo6ONY2NjUQzDOACMA7ADcGAi"
215
+ b"sjoBuB6U4jFTWlp6Kj4+HjzPIzExEbm5uSuPHz9+csuWLfaEhIRIl8sFgiDA8zxu3rz585Yt"
216
+ b"W3SpqanX9u7d+93GjRuv5eXlrRGvT+oQQUCtVsPhcODcuXO2w4cPi1ZvAnADgP3EiRN7NBrN"
217
+ b"ntzcXDXHcXA6nREAJF9u+BNA6OnpuQ1gGAD5gCjrUXIPFOUflAIA7siRI8Xp6ekaYOI1lVKp"
218
+ b"RGZmpqatre2QXq/v1mg0y4EJKxoMBrS1tQ2UlJQ8abPZjAD23Lhx46Pi4uI1aWlp7mEl1qdp"
219
+ b"Grdu3UJNTU1nVVVV3cjIyDUAPwJof+WVVzJ0Ol1NQUHBbxMTEyHOOoEQKOKMP/jJxoIFC/6Q"
220
+ b"mZlJidYTBAHp6emp2dnZCV1dXY0MwywnCAIkSUKv1zu7u7uNu3fvTh8aGtoE4Pj7779/ec2a"
221
+ b"NZ0ZGRlZwC9Wt9vt+Pzzz22VlZUNV69eFa3+EwDTkSNHynJyct5ZtWpVikKhgMPhgEKhkJx2"
222
+ b"gxFgSv1t27ZRUVFRFMuyZGZmZmJcXNwcpVIZT9N0tMvlWpiSklKmVConBbGkpCRq3bp1Kxsb"
223
+ b"G69v3Lhxe3p6OgRBQHt7u2Hx4sVRycnJ9Ny5czO3bdv2VHV19XvNzc2frF69+pXY2FgoFAop"
224
+ b"q3ds2rQp6plnnnkzLy9v99KlS8EwDDiOC2r5LSnAiRMnIubNm/dHkiSzaZqOIUkygabpGIqi"
225
+ b"4iiKmkuSZDRJkiqVSkWRJKmkaZqMiIhAZGQkOI5zk+c4DnFxccjOztZWVVV9+eKLLw5nZGTM"
226
+ b"YxgGzc3Ndx577LGF8fHxiI2NhU6n+111dfWZixcvnispKfmzTqebe+HCBW+rtwK4/8Ybb+Rp"
227
+ b"NJojBQUFq2JiYuB0OgH8kgqLpdiXoAVobW2NfvbZZ/cWFhbOly3ngwf6yvczMzNzWJZV9Pb2"
228
+ b"/lRUVLR2cHAQt2/fvrt9+3YtSZJQKBRYtmxZYXFx8ar6+vqrTU1NF7/++mtdZWXll0ajsQET"
229
+ b"Qa4TE3HmBY1Gsz8/P3+Oy+Vyj3dP8nK9QFKA/v5+Cn7GfzBZmiAISE5OTiwqKsq4fft2k91u"
230
+ b"X9vf3283GAyWtLS0ZNFTsrOzI0pKSsrq6+v//c477/xNr9evwMRr7ZsAhl966aUFOp3uzfz8"
231
+ b"/C2LFi3C+Pj4JMLeAsjJYiUFYFk2oIRyReA4DikpKSgqKlpZW1t7saysjOvo6NAvXbo0NjEx"
232
+ b"MZLneXAchzlz5kCj0TwVGxu7RK/Xt2Mihx8DwBw4cGBDbm5uRWFh4aNKpRJ2u30S8VCsD8hY"
233
+ b"CwRzXqouz/OIiopCVlaWtrm5+X57e/tAS0uLPicnJzEhIcE9TnmeR05OTvJzzz33a0xMtyNa"
234
+ b"rVY4fvz4a6WlpRdKSkoeFZfPYpSXIi93SyzYWWASMTmlZ/2MjIys+Pj4mI6Ojoa+vj5h/fr1"
235
+ b"xaKrikIlJyfj8ccfLwNw7NVXX43TarV/LyoqWhsXF4fx8XF3TPFF2Pv/tPIAu93ul7g/+BJD"
236
+ b"EAQsXLgwqrS0NLexsfE8RVHLFi1atNn7PpVKhdzc3OUvv/zyvg0bNvwmPz8/WeyPt8sHEkLO"
237
+ b"anZaQyCYDUmO47BgwQIsX758VW1t7bc6nU5ISkpSeuYLHMeBYRhkZWWpd+zY8afCwsJklmXB"
238
+ b"MMwUlw9EXjwOhIDL4dHRUQwMDMBms4Hn+YCuJSUKz/NQqVRYsmTJcgDzlixZsnzOnDlu1xfj"
239
+ b"AMdxoGkaqampsNvtEATBvZ8olzxBEO57whIDxsbGMD4+DrVajaioKERGRoKiKMmdXn9IT09P"
240
+ b"Li4ufiIxMVEHACzLThGW47gp54IhHwz8CiCSEt3P4XDA6XTCYrGApmnQNA2VSuUWwzvyescA"
241
+ b"l8uF+fPnK59//vm/zp8/f6FoebF98VlSBOWS99WXkATwfrhnw+JmiEKhgEKhAEmSEDM6KTEI"
242
+ b"gkBcXBwRExOTkpCQAJfLNSPkg4EsD/Algncs4Hl+ktv6+onjOS0tDTRNT1q4hJN8MCKE5AFS"
243
+ b"nQx0DQAYhkFqaqpbrJkmH5YPJMJFXqFQTBmTM0E+LB5gt9slXTpU8t4E5JKXSnsDkfV+HReU"
244
+ b"AJ6YLnlf1pNLXhAEmM1msCw7KSZ598/7PEEQ4DgOLMv6VSHQt8JhIS/HG/y5vV6vh9FohFqt"
245
+ b"ducN3r8pxCgKJpMJvb29o/hlzzI4AUSEk7yUtfyJwTAMMjMzsXjxYr/zuuf7wbt376K8vLz/"
246
+ b"7NmzlzCxpA5NgHCTl1vHFzkAPjNE774aDAaUl5f3V1RU1HAc9y9MbKr4RMA8QIr4TJP3LEU3"
247
+ b"5zjOnTtItWUwGLB//36R/CVMbKXZQhbAV2dnk7zYD3G1KI537/oURbndvqKi4hTHcV9iYvd4"
248
+ b"zB/HkFPh6ZL3JurvHIBJXuB9XfzG4MCBA/3vvvtujVzysgTwR2I65KVmAl/3iUtmlmUnDQGR"
249
+ b"/P3793H48GH9A/Ki2wckH1AAzxjgS4yZJO/dD899A7EORVEYGRlBVVWV8b333vs4GMvLEsAT"
250
+ b"oQ4Ff+Q92/YniGcMEAUQ5/ljx44Nv/XWWx9ZrdaLAJqDIR9QAO/9gHCTlxsERRFEAZRKJUwm"
251
+ b"E6qrq4cPHjx4xmq11mLi1bglGPIBBfBF8mGQFyHmACaTCSdPnhx+++23z4yOjtZi4pWZKVjy"
252
+ b"sgTwFiIU8v7GuVzyIsxmM06fPj188ODBjx5Y/nsAkl+jBoLsPECEryDl7ziQMHLJkyQJi8WC"
253
+ b"mpqa4YqKCtHtmzAN8oCM9wJKpRIRERGyyAQi6CvwyeokRcFsNqOurm64oqLijMVimZbbT2pb"
254
+ b"6gJN04TNZlNZLBYwDOOeEgNtMsqpF+y1sbEx1NbWDn/wwQdhJQ8AkmZYsWJFVEZGxtZ79+49"
255
+ b"wbIsDa/VlBQJqS0of6QD3UMQBHp7e++YTKYrCIPbe8KfHyoALACwGIAqXA8MEQImPnO7A2Ak"
256
+ b"nA3/D+/OyD/Ur3BPAAAAAElFTkSuQmCC")
257
+
258
+
259
+ def getDataSH():
260
+ """ Return the first part of the shadow dropped behind thumbnails. """
261
+
262
+ return zlib.decompress(
263
+ b'x\xda\xeb\x0c\xf0s\xe7\xe5\x92\xe2b``\xe0\xf5\xf4p\t\x02\xd2_A\x98\x83\rHvl\
264
+ \xdc\x9c\n\xa4X\x8a\x9d<C8\x80\xa0\x86#\xa5\x83\x81\x81y\x96\xa7\x8bcH\xc5\
265
+ \x9c\xb7\xd7\xd7\xf6\x85D2\xb4^\xbc\x1b\xd0\xd0p\xa6\x85\x9d\xa1\xf1\xc0\xc7\
266
+ \x7f\xef\x8d\x98\xf89_:p]\xaew\x0c\xe9\x16[\xbc\x8bSt\xdf\x9aT\xad\xef\xcb\
267
+ \x8e\x98\xc5\xbf\xb3\x94\x9ePT\xf8\xff\xf7\xfbm\xf5\xdb\xfeZ<\x16{\xf01o[l\
268
+ \xee\xee\xbd7\xbe\x95\xdd\xde\x9d+\xbf\xfdo\xf9\xb9\xd0\x03\x8be\xb7\xc7\xe6\
269
+ Y\xcb\xbd\x8b\xdfs\xe3[\xd6\xed\xe5\x9b}\x99\xe6=:\xbd\xed\xfc\xedu|\xfcq\
270
+ \xfb\xec/K<\xf8\xfec\xd7\xdb\xdb\x87W\xec\xcf\xfd]\xb0\xcc\xf0\xc0\xe5=\xf7^\
271
+ \x1e\xf9\xfb\xe6\xe6\xce\xe9\x0c\xfb\xa7\xafPt\xbb"\xa0\x9c\xd5!hz\xa4C*\xc9\
272
+ \x85\xd7pQ\x9bD\xa0s\xcf\xa8\xf0\xa8\xf0\x00\x0b\x9fyX\x7fo\xef\xdf\xc7\xda\
273
+ \r\xcbw\xd4\xfcx\xe0\xcdk\xd8\x9e[~{\xdd\xf6\xbfw\xbe\xfd\xddS\xdc\xe0\xfec_\
274
+ \xf0\xfe\xeb\xb7\xdf\xf1\xdd\xce\xdb&\xbb\xbdv\xe7\xff\xc3\xaf\x8dy\x99\xe5\
275
+ \x9e?\xf7\xfb+\xb7\xfdnLN\xf5\xc6\xb7g\xfd\xca_\x9a\x7f?\x7f\xe0\xfe\xe3\xaa\
276
+ \xe5\x0b\xf4\xb7\xcb\xea\x97\xed\n\xb7\xbf\xff\xadh\xf9\xe3\x1d\xd5f\x7fb\
277
+ \xdf\x95Y\x15\xc6\xe7\xee\xfe\xcbz7Y\xbd\xde[\xf3y\x1f0\xd72x\xba\xfa\xb9\
278
+ \xacsJh\x02\x00\xc4i\x8dN' )
279
+
280
+
281
+ def getDataBL():
282
+ """ Return the second part of the shadow dropped behind thumbnails. """
283
+
284
+ return zlib.decompress(
285
+ b"x\xda\xeb\x0c\xf0s\xe7\xe5\x92\xe2b``\xe0\xf5\xf4p\t\x02\xd2\xac \xcc\xc1\
286
+ \x06${\xf3\xd5\x9e\x02)\x96b'\xcf\x10\x0e \xa8\xe1H\xe9\x00\xf2\xed=]\x1cC8f\
287
+ \xea\x9e\xde\xcb\xd9` \xc2\xf0P\xdf~\xc9y\xaeu\x0f\xfe1\xdf\xcc\x14\x1482A\
288
+ \xe9\xfd\x83\x1d\xaf\x84\xac\xf8\xe6\\\x8c3\xfc\x98\xf8\xa0\xb1\xa9K\xec\x9f\
289
+ \xc4\xd1\xb4GG{\xb5\x15\x8f_|t\x8a[a\x1fWzG\xa9\xc4,\xa0Q\x0c\x9e\xae~.\xeb\
290
+ \x9c\x12\x9a\x00\x7f1,7" )
291
+
292
+
293
+ def getDataTR():
294
+ """ Return the third part of the shadow dropped behind thumbnails. """
295
+
296
+ return zlib.decompress(
297
+ b'x\xda\xeb\x0c\xf0s\xe7\xe5\x92\xe2b``\xe0\xf5\xf4p\t\x02\xd2\xac \xcc\xc1\
298
+ \x06${\xf3\xd5\x9e\x02)\x96b\'\xcf\x10\x0e \xa8\xe1H\xe9\x00\xf2m=]\x1cC8f\
299
+ \xe6\x9e\xd9\xc8\xd9` \xc2p\x91\xbd\xaei\xeeL\x85\xdcUo\xf6\xf7\xd6\xb2\x88\
300
+ \x0bp\x9a\x89i\x16=-\x94\xe16\x93\xb9!\xb8y\xcd\t\x0f\x89\n\xe6\xb7\xfcV~6\
301
+ \x8dFo\xf5\xee\xc8\x1fOaw\xc9\x88\x0c\x16\x05\x1a\xc4\xe0\xe9\xea\xe7\xb2\
302
+ \xce)\xa1\t\x00"\xf9$\x83' )
303
+
304
+
305
+ def getShadow():
306
+ """ Creates a shadow behind every thumbnail. """
307
+
308
+ sh_tr = wx.Image(io.BytesIO(getDataTR())).ConvertToBitmap()
309
+ sh_bl = wx.Image(io.BytesIO(getDataBL())).ConvertToBitmap()
310
+ sh_sh = wx.Image(io.BytesIO(getDataSH())).Rescale(500, 500, wx.IMAGE_QUALITY_HIGH)
311
+ return (sh_tr, sh_bl, sh_sh.ConvertToBitmap())
312
+
313
+
314
+ #-----------------------------------------------------------------------------
315
+ # PATH & FILE FILLING (OS INDEPENDENT)
316
+ #-----------------------------------------------------------------------------
317
+
318
+ def opj(path):
319
+ """
320
+ Convert paths to the platform-specific separator.
321
+
322
+ :param `path`: the path to convert.
323
+ """
324
+
325
+ strs = os.path.join(*tuple(path.split('/')))
326
+ # HACK: on Linux, a leading / gets lost...
327
+ if path.startswith('/'):
328
+ strs = '/' + strs
329
+
330
+ return strs
331
+
332
+ #-----------------------------------------------------------------------------
333
+
334
+ # Different Outline On Thumb Selection:
335
+ # THUMB_OUTLINE_NONE: No Outline Drawn On Selection
336
+ # THUMB_OUTLINE_FULL: Full Outline Drawn On Selection
337
+ # THUMB_OUTLINE_RECT: Only Maximum Image Rect Outlined On Selection
338
+ # THUMB_OUTLINE_IMAGE: Only Image Rect Outlined On Selection
339
+
340
+ THUMB_OUTLINE_NONE = 0
341
+ """ No outline drawn on selection. """
342
+ THUMB_OUTLINE_FULL = 1
343
+ """ Full outline drawn on selection. """
344
+ THUMB_OUTLINE_RECT = 2
345
+ """ Only the maximum image rectangle outlined on selection. """
346
+ THUMB_OUTLINE_IMAGE = 4
347
+ """ Only the image rectangle outlined on selection. """
348
+
349
+ # ThumbnailCtrl Events:
350
+ # wxEVT_THUMBNAILS_SEL_CHANGED: Event Fired When You Change Thumb Selection
351
+ # wxEVT_THUMBNAILS_POINTED: Event Fired When You Point A Thumb
352
+ # wxEVT_THUMBNAILS_DCLICK: Event Fired When You Double-Click A Thumb
353
+ # wxEVT_THUMBNAILS_CAPTION_CHANGED: Not Used At Present
354
+ # wxEVT_THUMBNAILS_THUMB_CHANGED: Used nternally
355
+ # wxEVT_THUMBNAILS_CHAR: Event Fired when character typed
356
+
357
+ wxEVT_THUMBNAILS_SEL_CHANGED = wx.NewEventType()
358
+ wxEVT_THUMBNAILS_POINTED = wx.NewEventType()
359
+ wxEVT_THUMBNAILS_DCLICK = wx.NewEventType()
360
+ wxEVT_THUMBNAILS_CAPTION_CHANGED = wx.NewEventType()
361
+ wxEVT_THUMBNAILS_THUMB_CHANGED = wx.NewEventType()
362
+ wxEVT_THUMBNAILS_CHAR = wx.NewEventType()
363
+
364
+ #-----------------------------------#
365
+ # ThumbnailCtrlEvent
366
+ #-----------------------------------#
367
+
368
+ EVT_THUMBNAILS_SEL_CHANGED = wx.PyEventBinder(wxEVT_THUMBNAILS_SEL_CHANGED, 1)
369
+ """ The user has changed the selected thumbnail. """
370
+ EVT_THUMBNAILS_POINTED = wx.PyEventBinder(wxEVT_THUMBNAILS_POINTED, 1)
371
+ """ The mouse cursor is hovering over a thumbnail. """
372
+ EVT_THUMBNAILS_DCLICK = wx.PyEventBinder(wxEVT_THUMBNAILS_DCLICK, 1)
373
+ """ The user has double-clicked on a thumbnail. """
374
+ EVT_THUMBNAILS_THUMB_CHANGED = wx.PyEventBinder(wxEVT_THUMBNAILS_THUMB_CHANGED, 1)
375
+ """ The thumbnail of an image has changed. Used internally"""
376
+ EVT_THUMBNAILS_CHAR = wx.PyEventBinder(wxEVT_THUMBNAILS_CHAR, 1)
377
+ """ A character has been typed. """
378
+
379
+ # ---------------------------------------------------------------------------- #
380
+ # Class PILImageHandler, handles loading and highlighting images with PIL
381
+ # ---------------------------------------------------------------------------- #
382
+
383
+ class PILImageHandler(object):
384
+ """
385
+ This image handler loads and manipulates the thumbnails with the help
386
+ of PIL (the Python Imaging Library).
387
+ """
388
+
389
+ def __init__(self):
390
+ """
391
+ Default class constructor.
392
+
393
+ :note: If PIL is not installed, this will raise an exception. PIL
394
+ can be downloaded from http://www.pythonware.com/products/pil/ .
395
+ """
396
+
397
+ try:
398
+
399
+ import PIL.Image as Image
400
+ import PIL.ImageEnhance as ImageEnhance
401
+
402
+ except ImportError:
403
+
404
+ errstr = ("\nThumbnailCtrl *requires* PIL (Python Imaging Library).\n"
405
+ "You can get it at:\n\n"
406
+ "http://www.pythonware.com/products/pil/\n\n"
407
+ "ThumbnailCtrl can not continue. Exiting...\n")
408
+
409
+ raise Exception(errstr)
410
+
411
+
412
+ def Load(self, filename):
413
+ """
414
+ Load the file.
415
+
416
+ :param `filename`: a file containing an image;
417
+ """
418
+
419
+ import PIL.Image as Image
420
+
421
+ try:
422
+ with Image.open(filename) as pil:
423
+ originalsize = pil.size
424
+
425
+ img = wx.Image(pil.size[0], pil.size[1])
426
+
427
+ img.SetData(pil.convert("RGB").tobytes())
428
+
429
+ alpha = False
430
+ if "A" in pil.getbands():
431
+ img.SetAlpha(pil.convert("RGBA").tobytes()[3::4])
432
+ alpha = True
433
+ except:
434
+ img = file_broken.GetImage()
435
+ originalsize = (img.GetWidth(), img.GetHeight())
436
+ alpha = False
437
+
438
+ return img, originalsize, alpha
439
+
440
+
441
+ def HighlightImage(self, img, factor):
442
+ """
443
+ Adjust overall image brightness to highlight.
444
+
445
+ :param `img`: an instance of :class:`wx.Image`;
446
+ :param `factor`: unused in :class:`PILImageHandler`.
447
+ """
448
+
449
+ import PIL.Image as Image
450
+ import PIL.ImageEnhance as ImageEnhance
451
+
452
+ pil = Image.new('RGB', (img.GetWidth(), img.GetHeight()))
453
+ pil.frombytes(bytes(img.GetData()))
454
+ enh = ImageEnhance.Brightness(pil)
455
+ enh = enh.enhance(1.5)
456
+ img.SetData(enh.convert('RGB').tobytes())
457
+ return img
458
+
459
+ def Rotate(self, img, angle):
460
+ """
461
+ Rotate image by angle degrees.
462
+
463
+ :param img: an instance of :class:wx.Image;
464
+ :param angle: angle in degrees
465
+ :return: rotated image
466
+ """
467
+
468
+ img = img.Rotate(radians(angle), (img.GetWidth(), img.GetHeight()), True)
469
+ return img
470
+
471
+ # ---------------------------------------------------------------------------- #
472
+ # Class NativeImageHandler, handles loading and highlighting images with wx
473
+ # ---------------------------------------------------------------------------- #
474
+
475
+ class NativeImageHandler(object):
476
+ """
477
+ This image handler loads and manipulates the thumbnails with the help of
478
+ wxPython's own image related functions.
479
+ """
480
+
481
+ def Load(self, filename):
482
+ """
483
+ Load the file.
484
+
485
+ :param `filename`: a file containing an image;
486
+ """
487
+
488
+ img = wx.Image(filename)
489
+
490
+ # Don't stop when a corrupt file is to be loaded, show Mondrian instead
491
+ try:
492
+ originalsize = (img.GetWidth(), img.GetHeight())
493
+ alpha = img.HasAlpha()
494
+ assert img.IsOk()
495
+ except:
496
+ img = file_broken.GetImage()
497
+ originalsize = (img.GetWidth(), img.GetHeight())
498
+ alpha = False
499
+
500
+ return img, originalsize, alpha
501
+
502
+
503
+ def HighlightImage(self, img, factor):
504
+ """
505
+ Adjust overall image brightness to highlight.
506
+
507
+ :param `img`: an instance of :class:`wx.Image`;
508
+ :param `factor`: a floating point number representing the highlight factor.
509
+ """
510
+
511
+ return img.AdjustChannels(factor, factor, factor, factor)
512
+
513
+
514
+ def Rotate(self, img, angle):
515
+ """
516
+ Rotate image by angle degrees.
517
+
518
+ :param img: an instance of :class:wx.Image;
519
+ :param angle: angle in degrees
520
+ :return: rotated image
521
+ """
522
+
523
+ img = img.Rotate(radians(angle), (img.GetWidth(), img.GetHeight()), True)
524
+ return img
525
+
526
+
527
+ # ---------------------------------------------------------------------------- #
528
+ # Class Thumb
529
+ # Auxiliary Class, To Handle Single Thumb Information For Every Thumb.
530
+ # ---------------------------------------------------------------------------- #
531
+
532
+ class Thumb(object):
533
+ """
534
+ This is an auxiliary class, to handle single thumbnail information for every thumb.
535
+
536
+ Used internally.
537
+ """
538
+
539
+ def __init__(self, folder, filename, caption="", size=0, lastmod=0, imagehandler=None):
540
+ """
541
+ Default class constructor.
542
+
543
+ :param `folder`: the directory containing the images;
544
+ :param `filename`: a file containing an image;
545
+ :param `caption`: the thumbnail caption string;
546
+ :param `size`: the file size;
547
+ :param `lastmod`: the file last modification time.
548
+ """
549
+
550
+ self._filename = filename
551
+ self.SetCaption(caption)
552
+ self._id = 0
553
+ self._dir = folder
554
+ self._filesize = size
555
+ self._lastmod = lastmod
556
+ self._captionbreaks = []
557
+ self._image = wx.Image(1, 1)
558
+ self._alpha = None
559
+ self._imagehandler = imagehandler()
560
+ self._bitmap = None
561
+
562
+
563
+ def SetCaption(self, caption=""):
564
+ """
565
+ Sets the thumbnail caption.
566
+
567
+ :param `caption`: the thumbnail caption string.
568
+ """
569
+
570
+ self._caption = caption
571
+ self._captionbreaks = []
572
+
573
+
574
+ def GetImage(self):
575
+ """ Returns the thumbnail image. """
576
+
577
+ return self._image
578
+
579
+
580
+ def SetImage(self, image):
581
+ """
582
+ Sets the thumbnail image.
583
+
584
+ :param `image`: a :class:`wx.Image` object.
585
+ """
586
+
587
+ self._image = image
588
+
589
+
590
+ def GetFileName(self):
591
+ """ Returns the file name associated with this thumbnail. """
592
+
593
+ return self._filename
594
+
595
+
596
+ def SetFileName(self, filename):
597
+ """
598
+ Sets the file name associated with this thumbnail.
599
+
600
+ :param `filename`: the file containing the image.
601
+ """
602
+
603
+ self._filename = filename
604
+
605
+
606
+ def GetId(self):
607
+ """ Returns the thumbnail identifier. """
608
+
609
+ return self._id
610
+
611
+
612
+ def SetId(self, id=-1):
613
+ """
614
+ Sets the thumbnail identifier.
615
+
616
+ :param `id`: an integer specifying the thumbnail identifier.
617
+ """
618
+
619
+ self._id = id
620
+
621
+
622
+ def GetThumbnail(self, width, height):
623
+ """
624
+ Returns the wx.Image of the thumbnail
625
+
626
+ :param `width`: the associated bitmap width;
627
+ :param `height`: the associated bitmap height.
628
+ """
629
+
630
+ img = self._image
631
+ imgwidth, imgheight = (img.GetWidth(), img.GetHeight())
632
+ if width < imgwidth or height < imgheight:
633
+ scale = float(width)/imgwidth
634
+
635
+ if scale > float(height)/imgheight:
636
+ scale = float(height)/imgheight
637
+
638
+ newW, newH = int(imgwidth*scale), int(imgheight*scale)
639
+ if newW < 1:
640
+ newW = 1
641
+ if newH < 1:
642
+ newH = 1
643
+
644
+ img = img.Scale(newW, newH)
645
+
646
+ return img
647
+
648
+
649
+ def GetBitmap(self, width, height):
650
+ """
651
+ Returns the bitmap of the thumbnail
652
+
653
+ :param `width`: the associated bitmap width;
654
+ :param `height`: the associated bitmap height.
655
+ """
656
+
657
+ if self._bitmap:
658
+ if self._bitmap.GetWidth() == width and self._bitmap.GetHeight() == height:
659
+ return self._bitmap
660
+
661
+ img = self.GetThumbnail(width, height)
662
+ bmp = img.ConvertToBitmap()
663
+
664
+ return bmp
665
+
666
+
667
+ def GetFullFileName(self):
668
+ """ Returns the full filename of the thumbnail. """
669
+
670
+ return os.path.join(self._dir, self._filename)
671
+
672
+
673
+ def GetCaption(self, line):
674
+ """
675
+ Returns the caption associated to a thumbnail.
676
+
677
+ :param `line`: the caption line we wish to retrieve (useful for multilines
678
+ caption strings).
679
+ """
680
+
681
+ if line + 1 >= len(self._captionbreaks):
682
+ return ""
683
+
684
+ strs = self._caption
685
+
686
+ return strs
687
+
688
+
689
+ def GetFileSize(self):
690
+ """ Returns the file size in bytes associated to a thumbnail. """
691
+
692
+ return self._filesize
693
+
694
+
695
+ def GetDisplayFileSize(self):
696
+ """ Return printable file size (with bytes, Kb, Mb suffix). """
697
+
698
+ size = self.GetFileSize()
699
+ if size < 1000:
700
+ size = str(size) + " bytes"
701
+ elif size < 1000000:
702
+ size = str(int(round(size/1000.0))) + " Kb"
703
+ else:
704
+ size = str(round(size/1000000.0, 2)) + " Mb"
705
+ return size
706
+
707
+
708
+ def GetCreationDate(self):
709
+ """ Returns the file last modification date associated to a thumbnail. """
710
+
711
+ return self._lastmod
712
+
713
+
714
+ def GetOriginalSize(self):
715
+ """ Returns a tuple containing the original image width and height, in pixels. """
716
+
717
+ return self._originalsize
718
+
719
+
720
+ def GetCaptionLinesCount(self, width):
721
+ """
722
+ Returns the number of lines for the caption.
723
+
724
+ :param `width`: the maximum width, in pixels, available for the caption text.
725
+ """
726
+
727
+ self.BreakCaption(width)
728
+ return len(self._captionbreaks) - 1
729
+
730
+
731
+ def BreakCaption(self, width):
732
+ """
733
+ Breaks the caption in several lines of text (if needed).
734
+
735
+ :param `width`: the maximum width, in pixels, available for the caption text.
736
+ """
737
+
738
+ if len(self._captionbreaks) > 0 or width < 16:
739
+ return
740
+
741
+ self._captionbreaks.append(0)
742
+
743
+ if len(self._caption) == 0:
744
+ return
745
+
746
+ pos = width//16
747
+ beg = 0
748
+ end = 0
749
+
750
+ dc = wx.MemoryDC()
751
+ bmp = wx.Bitmap(10, 10)
752
+ dc.SelectObject(bmp)
753
+
754
+ while 1:
755
+
756
+ if pos >= len(self._caption):
757
+
758
+ self._captionbreaks.append(len(self._caption))
759
+ break
760
+
761
+ sw, sh = dc.GetTextExtent(self._caption[beg:pos-beg])
762
+
763
+ if sw > width:
764
+
765
+ if end > 0:
766
+
767
+ self._captionbreaks.append(end)
768
+ beg = end
769
+
770
+ else:
771
+
772
+ self._captionbreaks.append(pos)
773
+ beg = pos
774
+
775
+ pos = beg + width//16
776
+ end = 0
777
+
778
+ if pos < len(self._caption) and self._caption[pos] in [" ", "-", ",", ".", "_"]:
779
+ end = pos + 1
780
+
781
+ pos = pos + 1
782
+
783
+
784
+ dc.SelectObject(wx.NullBitmap)
785
+
786
+
787
+ def GetInfo(self):
788
+ """ Returns info for thumbnain in display format. """
789
+ thumbinfo = "Name: " + self.GetFileName() + "\n" \
790
+ "Size: " + self.GetDisplayFileSize() + "\n" \
791
+ "Modified: " + self.GetCreationDate() + "\n" \
792
+ "Dimensions: " + str(self.GetOriginalSize()) + "\n"
793
+ return thumbinfo
794
+
795
+
796
+ def LoadImage(self):
797
+ """ Load image using imagehandler. """
798
+ filename = self.GetFullFileName()
799
+ img, size, alpha = self._imagehandler.Load(filename)
800
+ self._image = img
801
+ self._originalsize = size
802
+ self._alpha = alpha
803
+
804
+
805
+ def Rotate(self, angle):
806
+ """ Rotate image using imagehandler. """
807
+ img = self._imagehandler.Rotate(self._image, angle)
808
+ self._image = img
809
+ self._originalsize = (img.GetWidth, img.GetHeight)
810
+ self._alpha = img.HasAlpha()
811
+ # Clear _bitmap so thumbnail is recreated after rotate
812
+ self._bitmap = None
813
+
814
+
815
+ def GetHighlightBitmap(self, width, height, factor):
816
+ """ Returned highlighted bitmap of thumbnail. """
817
+
818
+ img = self.GetThumbnail(width, height)
819
+ img = self._imagehandler.HighlightImage(img, factor)
820
+
821
+ bmp = img.ConvertToBitmap()
822
+
823
+ return bmp
824
+
825
+ # ---------------------------------------------------------------------------- #
826
+ # Class ScrolledThumbnail
827
+ # This Is The Main Class Implementation
828
+ # ---------------------------------------------------------------------------- #
829
+
830
+ class ScrolledThumbnail(wx.ScrolledWindow):
831
+ """ This is the main class implementation of :class:`ThumbnailCtrl`. """
832
+
833
+ def __init__(self, parent, id=wx.ID_ANY, pos=wx.DefaultPosition,
834
+ size=wx.DefaultSize, thumboutline=THUMB_OUTLINE_IMAGE,
835
+ imagehandler=None):
836
+ """
837
+ Default class constructor.
838
+
839
+ :param `parent`: parent window. Must not be ``None``;
840
+ :param `id`: window identifier. A value of -1 indicates a default value;
841
+ :param `pos`: the control position. A value of (-1, -1) indicates a default position,
842
+ chosen by either the windowing system or wxPython, depending on platform;
843
+ :param `size`: the control size. A value of (-1, -1) indicates a default size,
844
+ chosen by either the windowing system or wxPython, depending on platform;
845
+ :param `thumboutline`: outline style for :class:`ScrolledThumbnail`, which may be:
846
+
847
+ =========================== ======= ==================================
848
+ Outline Flag Value Description
849
+ =========================== ======= ==================================
850
+ ``THUMB_OUTLINE_NONE`` 0 No outline is drawn on selection
851
+ ``THUMB_OUTLINE_FULL`` 1 Full outline (image+caption) is drawn on selection
852
+ ``THUMB_OUTLINE_RECT`` 2 Only thumbnail bounding rectangle is drawn on selection (default)
853
+ ``THUMB_OUTLINE_IMAGE`` 4 Only image bounding rectangle is drawn.
854
+ =========================== ======= ==================================
855
+
856
+ :param `imagehandler`: can be :class:`PILImageHandler` if PIL is installed (faster), or
857
+ :class:`NativeImageHandler` which only uses wxPython image methods.
858
+ """
859
+
860
+ wx.ScrolledWindow.__init__(self, parent, id, pos, size)
861
+
862
+ self._items = []
863
+ self.SetThumbSize(96, 80)
864
+ self._tOutline = thumboutline
865
+ self._selected = -1
866
+ self._pointed = -1
867
+ self._pmenu = None
868
+ self._gpmenu = None
869
+ self._dragging = False
870
+ self._checktext = False
871
+ self._dropShadow = True
872
+
873
+ self._tCaptionHeight = []
874
+ self._selectedarray = []
875
+ self._tTextHeight = 16
876
+ self._tCaptionBorder = 8
877
+ self._tOutlineNotSelected = True
878
+ self._mouseeventhandled = False
879
+ self._highlight = False
880
+ self._zoomfactor = 1.4
881
+ self.SetCaptionFont()
882
+
883
+ self._enabletooltip = False
884
+
885
+ self._parent = parent
886
+
887
+ self._selectioncolour = "#009EFF"
888
+ self.grayPen = wx.Pen("#A2A2D2", 1, wx.SHORT_DASH)
889
+ self.grayPen.SetJoin(wx.JOIN_MITER)
890
+ self.SetBackgroundColour(wx.SystemSettings.GetColour(wx.SYS_COLOUR_LISTBOX))
891
+
892
+ t, b, s = getShadow()
893
+ self.shadow = wx.MemoryDC()
894
+ self.shadow.SelectObject(s)
895
+
896
+ self.ShowFileNames(True)
897
+
898
+ self.Bind(wx.EVT_LEFT_DOWN, self.OnMouseDown)
899
+ self.Bind(wx.EVT_LEFT_UP, self.OnMouseUp)
900
+ self.Bind(wx.EVT_LEFT_DCLICK, self.OnMouseDClick)
901
+ self.Bind(wx.EVT_RIGHT_DOWN, self.OnMouseDown)
902
+ self.Bind(wx.EVT_RIGHT_UP, self.OnMouseUp)
903
+ self.Bind(wx.EVT_MOTION, self.OnMouseMove)
904
+ self.Bind(wx.EVT_LEAVE_WINDOW, self.OnMouseLeave)
905
+ self.Bind(EVT_THUMBNAILS_THUMB_CHANGED, self.OnThumbChanged)
906
+ self.Bind(wx.EVT_CHAR, self.OnChar)
907
+ self.Bind(wx.EVT_MOUSEWHEEL, self.OnMouseWheel)
908
+
909
+ self.Bind(wx.EVT_SIZE, self.OnResize)
910
+ self.Bind(wx.EVT_ERASE_BACKGROUND, lambda x: None)
911
+ self.Bind(wx.EVT_PAINT, self.OnPaint)
912
+
913
+
914
+ def GetSelectedItem(self, index):
915
+ """
916
+ Returns the selected thumbnail.
917
+
918
+ :param `index`: the thumbnail index (i.e., the selection).
919
+ """
920
+
921
+ return self.GetItem(self.GetSelection(index))
922
+
923
+
924
+ def GetPointed(self):
925
+ """ Returns the pointed thumbnail index. """
926
+
927
+ return self._pointed
928
+
929
+
930
+ def GetHighlightPointed(self):
931
+ """
932
+ Returns whether the thumbnail pointed should be highlighted or not.
933
+
934
+ :note: Please be aware that this functionality may be slow on slower computers.
935
+ """
936
+
937
+ return self._highlight
938
+
939
+
940
+ def SetHighlightPointed(self, highlight=True):
941
+ """
942
+ Sets whether the thumbnail pointed should be highlighted or not.
943
+
944
+ :param `highlight`: ``True`` to enable highlight-on-point with the mouse,
945
+ ``False`` otherwise.
946
+
947
+ :note: Please be aware that this functionality may be slow on slower computers.
948
+ """
949
+
950
+ self._highlight = highlight
951
+
952
+
953
+ def SetThumbOutline(self, outline):
954
+ """
955
+ Sets the thumbnail outline style on selection.
956
+
957
+ :param `outline`: the outline to use on selection. This can be one of the following
958
+ bits:
959
+
960
+ =========================== ======= ==================================
961
+ Outline Flag Value Description
962
+ =========================== ======= ==================================
963
+ ``THUMB_OUTLINE_NONE`` 0 No outline is drawn on selection
964
+ ``THUMB_OUTLINE_FULL`` 1 Full outline (image+caption) is drawn on selection
965
+ ``THUMB_OUTLINE_RECT`` 2 Only thumbnail bounding rectangle is drawn on selection (default)
966
+ ``THUMB_OUTLINE_IMAGE`` 4 Only image bounding rectangle is drawn.
967
+ =========================== ======= ==================================
968
+
969
+ """
970
+
971
+ if outline not in [THUMB_OUTLINE_NONE, THUMB_OUTLINE_FULL, THUMB_OUTLINE_RECT,
972
+ THUMB_OUTLINE_IMAGE]:
973
+ return
974
+
975
+ self._tOutline = outline
976
+
977
+
978
+ def GetThumbOutline(self):
979
+ """
980
+ Returns the thumbnail outline style on selection.
981
+
982
+ :see: :meth:`~ScrolledThumbnail.SetThumbOutline` for a list of possible return values.
983
+ """
984
+
985
+ return self._tOutline
986
+
987
+
988
+ def SetDropShadow(self, drop):
989
+ """
990
+ Sets whether to drop a shadow behind thumbnails or not.
991
+
992
+ :param `drop`: ``True`` to drop a shadow behind each thumbnail, ``False`` otheriwise.
993
+ """
994
+
995
+ self._dropShadow = drop
996
+ self.Refresh()
997
+
998
+
999
+ def GetDropShadow(self):
1000
+ """
1001
+ Returns whether to drop a shadow behind thumbnails or not.
1002
+ """
1003
+
1004
+ return self._dropShadow
1005
+
1006
+
1007
+ def GetPointedItem(self):
1008
+ """ Returns the pointed thumbnail. """
1009
+
1010
+ return self.GetItem(self._pointed)
1011
+
1012
+
1013
+ def GetItem(self, index):
1014
+ """
1015
+ Returns the item at position `index`.
1016
+
1017
+ :param `index`: the thumbnail index position.
1018
+ """
1019
+
1020
+ return index >= 0 and (index < len(self._items) and [self._items[index]] or [None])[0]
1021
+
1022
+
1023
+ def GetItemCount(self):
1024
+ """ Returns the number of thumbnails. """
1025
+
1026
+ return len(self._items)
1027
+
1028
+
1029
+ def GetThumbWidth(self):
1030
+ """ Returns the thumbnail width. """
1031
+
1032
+ return self._tWidth
1033
+
1034
+
1035
+ def GetThumbHeight(self):
1036
+ """ Returns the thumbnail height. """
1037
+
1038
+ return self._tHeight
1039
+
1040
+
1041
+ def GetThumbBorder(self):
1042
+ """ Returns the thumbnail border. """
1043
+
1044
+ return self._tBorder
1045
+
1046
+
1047
+ def ShowFileNames(self, show=True):
1048
+ """
1049
+ Sets whether the user wants to show file names under the thumbnails or not.
1050
+
1051
+ :param `show`: ``True`` to show file names under the thumbnails, ``False`` otherwise.
1052
+ """
1053
+
1054
+ self._showfilenames = show
1055
+ self.Refresh()
1056
+
1057
+
1058
+ def SetPopupMenu(self, menu):
1059
+ """
1060
+ Sets the thumbnails popup menu when at least one thumbnail is selected.
1061
+
1062
+ :param `menu`: an instance of :class:`wx.Menu`.
1063
+ """
1064
+
1065
+ self._pmenu = menu
1066
+
1067
+
1068
+ def GetPopupMenu(self):
1069
+ """ Returns the thumbnails popup menu when at least one thumbnail is selected. """
1070
+
1071
+ return self._pmenu
1072
+
1073
+
1074
+ def SetGlobalPopupMenu(self, gpmenu):
1075
+ """
1076
+ Sets the global thumbnails popup menu (no need of thumbnail selection).
1077
+
1078
+ :param `gpmenu`: an instance of :class:`wx.Menu`.
1079
+ """
1080
+
1081
+ self._gpmenu = gpmenu
1082
+
1083
+
1084
+ def GetGlobalPopupMenu(self):
1085
+ """ Returns the global thumbnailss popup menu (no need of thumbnail selection). """
1086
+
1087
+ return self._gpmenu
1088
+
1089
+
1090
+ def GetSelectionColour(self):
1091
+ """ Returns the colour used to indicate a selected thumbnail. """
1092
+
1093
+ return self._selectioncolour
1094
+
1095
+
1096
+ def SetSelectionColour(self, colour=None):
1097
+ """
1098
+ Sets the colour used to indicate a selected thumbnail.
1099
+
1100
+ :param `colour`: a valid :class:`wx.Colour` object. If defaulted to ``None``, it
1101
+ will be taken from the system settings.
1102
+ """
1103
+
1104
+ if colour is None:
1105
+ colour = wx.SystemSettings.GetColour(wx.SYS_COLOUR_HIGHLIGHT)
1106
+
1107
+ self._selectioncolour = colour
1108
+
1109
+
1110
+ def EnableDragging(self, enable=True):
1111
+ """
1112
+ Enables/disables thumbnails drag and drop.
1113
+
1114
+ :param `enable`: ``True`` to enable drag and drop, ``False`` to disable it.
1115
+ """
1116
+
1117
+ self._dragging = enable
1118
+
1119
+
1120
+ def EnableToolTips(self, enable=True):
1121
+ """
1122
+ Globally enables/disables thumbnail file information.
1123
+
1124
+ :param `enable`: ``True`` to enable thumbnail file information, ``False`` to disable it.
1125
+ """
1126
+
1127
+ self._enabletooltip = enable
1128
+
1129
+ if not enable and hasattr(self, "_tipwindow"):
1130
+ self._tipwindow.Enable(False)
1131
+
1132
+
1133
+ def GetThumbInfo(self, thumb=-1):
1134
+ """
1135
+ Returns the thumbnail information.
1136
+
1137
+ :param `thumb`: the index of the thumbnail for which we are collecting information.
1138
+ """
1139
+
1140
+ thumbinfo = None
1141
+
1142
+ if thumb >= 0:
1143
+ thumbinfo = self._items[thumb].GetInfo() + \
1144
+ "Thumb: " + str(self.GetThumbSize()[0:2])
1145
+ return thumbinfo
1146
+
1147
+ def SetThumbSize(self, width, height, border=6):
1148
+ """
1149
+ Sets the thumbnail size as width, height and border.
1150
+
1151
+ :param `width`: the desired thumbnail width;
1152
+ :param `height`: the desired thumbnail height;
1153
+ :param `border`: the spacing between thumbnails.
1154
+ """
1155
+
1156
+ if width > 350 or height > 280:
1157
+ return
1158
+
1159
+ self._tWidth = width
1160
+ self._tHeight = height
1161
+ self._tBorder = border
1162
+ self.SetScrollRate((self._tWidth + self._tBorder)//4,
1163
+ (self._tHeight + self._tBorder)//4)
1164
+ self.SetSizeHints(self._tWidth + self._tBorder*2 + 16,
1165
+ self._tHeight + self._tBorder*2 + 8)
1166
+ if self._items:
1167
+ self.UpdateShow()
1168
+
1169
+
1170
+ def GetThumbSize(self):
1171
+ """ Returns the thumbnail size as width, height and border. """
1172
+
1173
+ return self._tWidth, self._tHeight, self._tBorder
1174
+
1175
+
1176
+ def Clear(self):
1177
+ """ Clears :class:`ThumbnailCtrl`. """
1178
+
1179
+ self._items = []
1180
+ self._selected = -1
1181
+ self._selectedarray = []
1182
+ self.UpdateProp()
1183
+ self.Refresh()
1184
+
1185
+
1186
+ def ThreadImage(self, filenames):
1187
+ """
1188
+ Threaded method to load images. Used internally.
1189
+
1190
+ :param `filenames`: a Python list of file names containing images.
1191
+ """
1192
+
1193
+ count = 0
1194
+
1195
+ while count < len(filenames):
1196
+
1197
+ if not self._isrunning:
1198
+ self._isrunning = False
1199
+ thread.exit()
1200
+ return
1201
+
1202
+ self.LoadImages(filenames[count], count)
1203
+ if count < 4:
1204
+ self.Refresh()
1205
+ elif count%4 == 0:
1206
+ self.Refresh()
1207
+
1208
+ count = count + 1
1209
+
1210
+ self._isrunning = False
1211
+ thread.exit()
1212
+
1213
+
1214
+ def LoadImages(self, newfile, imagecount):
1215
+ """
1216
+ Threaded method to load images. Used internally.
1217
+
1218
+ :param `newfile`: a file name containing an image to thumbnail;
1219
+ :param `imagecount`: the number of images loaded until now.
1220
+ """
1221
+
1222
+ if not self._isrunning:
1223
+ thread.exit()
1224
+ return
1225
+
1226
+ self._items[imagecount].LoadImage()
1227
+
1228
+
1229
+ def ShowThumbs(self, thumbs):
1230
+ """
1231
+ Shows all the thumbnails.
1232
+
1233
+ :param `thumbs`: should be a sequence with instances of :class:`Thumb`;
1234
+ """
1235
+
1236
+ self._isrunning = False
1237
+
1238
+ # update items
1239
+ self._items = thumbs
1240
+ myfiles = [thumb.GetFullFileName() for thumb in thumbs]
1241
+
1242
+ self._isrunning = True
1243
+
1244
+ thread.start_new_thread(self.ThreadImage, (myfiles,))
1245
+ wx.MilliSleep(20)
1246
+
1247
+ self._selectedarray = []
1248
+ self.UpdateProp()
1249
+ self.Refresh()
1250
+
1251
+
1252
+
1253
+ def SetSelection(self, value=-1):
1254
+ """
1255
+ Sets thumbnail selection.
1256
+
1257
+ :param `value`: the thumbnail index to select.
1258
+ """
1259
+
1260
+ self._selected = value
1261
+
1262
+ if value != -1:
1263
+ self._selectedarray = [value]
1264
+ eventOut = ThumbnailEvent(wxEVT_THUMBNAILS_SEL_CHANGED, self.GetId())
1265
+ self.GetEventHandler().ProcessEvent(eventOut)
1266
+ self.ScrollToSelected()
1267
+ self.Refresh()
1268
+
1269
+
1270
+ def SetZoomFactor(self, zoom=1.4):
1271
+ """
1272
+ Sets the zoom factor.
1273
+
1274
+ :param `zoom`: a floating point number representing the zoom factor. Must be
1275
+ greater than or equal to 1.0.
1276
+ """
1277
+
1278
+ if zoom <= 1.0:
1279
+ raise Exception("\nERROR: Zoom Factor Must Be Greater Than 1.0")
1280
+
1281
+ self._zoomfactor = zoom
1282
+
1283
+
1284
+ def GetZoomFactor(self):
1285
+ """ Returns the zoom factor. """
1286
+
1287
+ return self._zoomfactor
1288
+
1289
+
1290
+ def UpdateItems(self):
1291
+ """ Updates thumbnail items. """
1292
+
1293
+ selected = self._selectedarray
1294
+ selectedfname = []
1295
+ selecteditemid = []
1296
+
1297
+ for ii in range(len(self._selectedarray)):
1298
+ selectedfname.append(self.GetSelectedItem(ii).GetFileName())
1299
+ selecteditemid.append(self.GetSelectedItem(ii).GetId())
1300
+
1301
+ self.UpdateShow()
1302
+
1303
+ if len(selected) > 0:
1304
+ self._selectedarray = []
1305
+ for ii in range(len(self._items)):
1306
+ for jj in range(len(selected)):
1307
+ if self._items[ii].GetFileName() == selectedfname[jj] and \
1308
+ self._items[ii].GetId() == selecteditemid[jj]:
1309
+
1310
+ self._selectedarray.append(ii)
1311
+ if len(self._selectedarray) == 1:
1312
+ self.ScrollToSelected()
1313
+
1314
+ if len(self._selectedarray) > 0:
1315
+ self.Refresh()
1316
+ eventOut = ThumbnailEvent(wxEVT_THUMBNAILS_SEL_CHANGED, self.GetId())
1317
+ self.GetEventHandler().ProcessEvent(eventOut)
1318
+
1319
+
1320
+ def SetCaptionFont(self, font=None):
1321
+ """
1322
+ Sets the font for all the thumbnail captions.
1323
+
1324
+ :param `font`: a valid :class:`wx.Font` object. If defaulted to ``None``, a standard
1325
+ font will be generated.
1326
+ """
1327
+
1328
+ if font is None:
1329
+ font = wx.Font(8, wx.FONTFAMILY_SWISS, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD, False)
1330
+
1331
+ self._captionfont = font
1332
+
1333
+
1334
+ def GetCaptionFont(self):
1335
+ """ Returns the font for all the thumbnail captions. """
1336
+
1337
+ return self._captionfont
1338
+
1339
+
1340
+ def UpdateShow(self):
1341
+ """ Updates thumbnail items. """
1342
+
1343
+ self.ShowThumbs(self._items)
1344
+
1345
+
1346
+ def GetCaptionHeight(self, begRow, count=1):
1347
+ """
1348
+ Returns the height for the file name caption.
1349
+
1350
+ :param `begRow`: the caption line at which we start measuring the height;
1351
+ :param `count`: the number of lines to measure.
1352
+ """
1353
+
1354
+ capHeight = 0
1355
+ for ii in range(begRow, begRow + count):
1356
+ if ii < len(self._tCaptionHeight):
1357
+ capHeight = capHeight + self._tCaptionHeight[ii]
1358
+
1359
+ return capHeight*self._tTextHeight
1360
+
1361
+
1362
+ def GetItemIndex(self, x, y):
1363
+ """
1364
+ Returns the thumbnail index at position (x, y).
1365
+
1366
+ :param `x`: the mouse `x` position;
1367
+ :param `y`: the mouse `y` position.
1368
+ """
1369
+
1370
+ col = (x - self._tBorder)//(self._tWidth + self._tBorder)
1371
+
1372
+ if col >= self._cols:
1373
+ col = self._cols - 1
1374
+
1375
+ row = -1
1376
+ y = y - self._tBorder
1377
+
1378
+ while y > 0:
1379
+
1380
+ row = row + 1
1381
+ y = y - (self._tHeight + self._tBorder + self.GetCaptionHeight(row))
1382
+
1383
+ if row < 0:
1384
+ row = 0
1385
+
1386
+ index = row*self._cols + col
1387
+
1388
+ if index >= len(self._items):
1389
+ index = -1
1390
+
1391
+ return index
1392
+
1393
+
1394
+ def UpdateProp(self, checkSize=True):
1395
+ """
1396
+ Updates :class:`ThumbnailCtrl` and its visible thumbnails.
1397
+
1398
+ :param `checkSize`: ``True`` to update the items visibility if the window
1399
+ size has changed.
1400
+ """
1401
+
1402
+ width = self.GetClientSize().GetWidth()
1403
+ self._cols = (width - self._tBorder)//(self._tWidth + self._tBorder)
1404
+
1405
+ if self._cols <= 0:
1406
+ self._cols = 1
1407
+
1408
+ tmpvar = (len(self._items)%self._cols and [1] or [0])[0]
1409
+ self._rows = len(self._items)//self._cols + tmpvar
1410
+
1411
+ self._tCaptionHeight = []
1412
+
1413
+ for row in range(self._rows):
1414
+
1415
+ capHeight = 0
1416
+
1417
+ for col in range(self._cols):
1418
+
1419
+ ii = row*self._cols + col
1420
+
1421
+ if len(self._items) > ii and \
1422
+ self._items[ii].GetCaptionLinesCount(self._tWidth - self._tCaptionBorder) > capHeight:
1423
+
1424
+ capHeight = self._items[ii].GetCaptionLinesCount(self._tWidth - self._tCaptionBorder)
1425
+
1426
+ self._tCaptionHeight.append(capHeight)
1427
+
1428
+ self.SetVirtualSize((self._cols*(self._tWidth + self._tBorder) + self._tBorder,
1429
+ self._rows*(self._tHeight + self._tBorder) + \
1430
+ self.GetCaptionHeight(0, self._rows) + self._tBorder))
1431
+
1432
+ self.SetSizeHints(self._tWidth + 2*self._tBorder + 16,
1433
+ self._tHeight + 2*self._tBorder + 8 + \
1434
+ (self._rows and [self.GetCaptionHeight(0)] or [0])[0])
1435
+
1436
+ if checkSize and width != self.GetClientSize().GetWidth():
1437
+ self.UpdateProp(False)
1438
+
1439
+
1440
+ def GetItem(self, pos):
1441
+ """
1442
+ Return thumbnail at specified position.
1443
+
1444
+ :param pos: the index of the thumbnail
1445
+ :return: the Thumb
1446
+ """
1447
+
1448
+ return self._items[pos]
1449
+
1450
+ def InsertItem(self, thumb, pos):
1451
+ """
1452
+ Inserts a thumbnail in the specified position.
1453
+
1454
+ :param `pos`: the index at which we wish to insert the new thumbnail.
1455
+ """
1456
+
1457
+ if pos < 0 or pos > len(self._items):
1458
+ self._items.append(thumb)
1459
+ else:
1460
+ self._items.insert(pos, thumb)
1461
+
1462
+ self.UpdateProp()
1463
+
1464
+
1465
+ def RemoveItemAt(self, pos):
1466
+ """
1467
+ Removes a thumbnail at the specified position.
1468
+
1469
+ :param `pos`: the index at which we wish to remove the thumbnail.
1470
+ """
1471
+
1472
+ del self._items[pos]
1473
+
1474
+ self.UpdateProp()
1475
+
1476
+
1477
+ def GetPaintRect(self):
1478
+ """ Returns the paint bounding rect for the :meth:`~ScrolledThumbnail.OnPaint` method. """
1479
+
1480
+ size = self.GetClientSize()
1481
+ paintRect = wx.Rect(0, 0, size.GetWidth(), size.GetHeight())
1482
+ paintRect.x, paintRect.y = self.GetViewStart()
1483
+ xu, yu = self.GetScrollPixelsPerUnit()
1484
+ paintRect.x = paintRect.x*xu
1485
+ paintRect.y = paintRect.y*yu
1486
+
1487
+ return paintRect
1488
+
1489
+
1490
+ def IsSelected(self, indx):
1491
+ """
1492
+ Returns whether a thumbnail is selected or not.
1493
+
1494
+ :param `indx`: the index of the thumbnail to check for selection.
1495
+ """
1496
+
1497
+ return self._selectedarray.count(indx) != 0
1498
+
1499
+
1500
+ def GetSelection(self, selIndex=-1):
1501
+ """
1502
+ Returns the selected thumbnail.
1503
+
1504
+ :param `selIndex`: if not equal to -1, the index of the selected thumbnail.
1505
+ """
1506
+
1507
+ return (selIndex == -1 and [self._selected] or
1508
+ [self._selectedarray[selIndex]])[0]
1509
+
1510
+
1511
+ def ScrollToSelected(self):
1512
+ """ Scrolls the :class:`ScrolledWindow` to the selected thumbnail. """
1513
+
1514
+ if self.GetSelection() == -1:
1515
+ return
1516
+
1517
+ # get row
1518
+ row = self.GetSelection()//self._cols
1519
+ # calc position to scroll view
1520
+
1521
+ paintRect = self.GetPaintRect()
1522
+ y1 = row*(self._tHeight + self._tBorder) + self.GetCaptionHeight(0, row)
1523
+ y2 = y1 + self._tBorder + self._tHeight + self.GetCaptionHeight(row)
1524
+
1525
+ if y1 < paintRect.GetTop():
1526
+ sy = y1 # scroll top
1527
+ elif y2 > paintRect.GetBottom():
1528
+ sy = y2 - paintRect.height # scroll bottom
1529
+ else:
1530
+ return
1531
+
1532
+ # scroll view
1533
+ xu, yu = self.GetScrollPixelsPerUnit()
1534
+ sy = sy//yu + (sy%yu and [1] or [0])[0] # convert sy to scroll units
1535
+ x, y = self.GetViewStart()
1536
+
1537
+ self.Scroll(x,sy)
1538
+
1539
+
1540
+ def CalculateBestCaption(self, dc, caption, sw, width):
1541
+ """
1542
+ Calculates the best caption string to show based on the actual zoom factor.
1543
+
1544
+ :param `dc`: an instance of :class:`wx.DC`;
1545
+ :param `caption`: the original caption string;
1546
+ :param `sw`: the maximum width allowed for the caption string, in pixels;
1547
+ :param `width`: the caption string width, in pixels.
1548
+ """
1549
+
1550
+ caption = caption + "..."
1551
+
1552
+ while sw > width:
1553
+ caption = caption[1:]
1554
+ sw, sh = dc.GetTextExtent(caption)
1555
+
1556
+ return "..." + caption[0:-3]
1557
+
1558
+
1559
+ def DrawThumbnail(self, bmp, thumb, index):
1560
+ """
1561
+ Draws a visible thumbnail.
1562
+
1563
+ :param `bmp`: the thumbnail version of the original image;
1564
+ :param `thumb`: an instance of :class:`Thumb`;
1565
+ :param `index`: the index of the thumbnail to draw.
1566
+ """
1567
+
1568
+ dc = wx.MemoryDC()
1569
+ dc.SelectObject(bmp)
1570
+
1571
+ x = self._tBorder/2
1572
+ y = self._tBorder/2
1573
+
1574
+ # background
1575
+ dc.SetPen(wx.Pen(wx.BLACK, 0, wx.TRANSPARENT))
1576
+ dc.SetBrush(wx.Brush(self.GetBackgroundColour(), wx.BRUSHSTYLE_SOLID))
1577
+ dc.DrawRectangle(0, 0, bmp.GetWidth(), bmp.GetHeight())
1578
+
1579
+ # image
1580
+ if index == self.GetPointed() and self.GetHighlightPointed():
1581
+ factor = 1.5
1582
+ img = thumb.GetHighlightBitmap(self._tWidth, self._tHeight, factor)
1583
+ else:
1584
+ img = thumb.GetBitmap(self._tWidth, self._tHeight)
1585
+
1586
+ ww = img.GetWidth()
1587
+ hh = img.GetHeight()
1588
+ imgRect = wx.Rect(int(x + (self._tWidth - img.GetWidth())/2),
1589
+ int(y + (self._tHeight - img.GetHeight())/2),
1590
+ img.GetWidth(), img.GetHeight())
1591
+
1592
+ if not thumb._alpha and self._dropShadow:
1593
+ dc.Blit(imgRect.x+5, imgRect.y+5, imgRect.width, imgRect.height, self.shadow, 500-ww, 500-hh)
1594
+ dc.DrawBitmap(img, imgRect.x, imgRect.y, True)
1595
+
1596
+ colour = self.GetSelectionColour()
1597
+ selected = self.IsSelected(index)
1598
+
1599
+ colour = self.GetSelectionColour()
1600
+
1601
+ # draw caption
1602
+ sw, sh = 0, 0
1603
+ if self._showfilenames:
1604
+ textWidth = 0
1605
+ dc.SetFont(self.GetCaptionFont())
1606
+ mycaption = thumb.GetCaption(0)
1607
+ sw, sh = dc.GetTextExtent(mycaption)
1608
+
1609
+ if sw > self._tWidth:
1610
+ mycaption = self.CalculateBestCaption(dc, mycaption, sw, self._tWidth)
1611
+ sw = self._tWidth
1612
+
1613
+ textWidth = sw + 8
1614
+ tx = x + (self._tWidth - textWidth)/2
1615
+ ty = y + self._tHeight
1616
+
1617
+ txtcolour = "#7D7D7D"
1618
+ dc.SetTextForeground(txtcolour)
1619
+
1620
+ tx = x + (self._tWidth - sw)/2
1621
+ if hh >= self._tHeight:
1622
+ ty = y + self._tHeight + (self._tTextHeight - sh)/2 + 3
1623
+ else:
1624
+ ty = y + hh + (self._tHeight-hh)/2 + (self._tTextHeight - sh)/2 + 3
1625
+
1626
+ dc.DrawText(mycaption, int(tx), int(ty))
1627
+
1628
+ # outline
1629
+ if self._tOutline != THUMB_OUTLINE_NONE and (self._tOutlineNotSelected or self.IsSelected(index)):
1630
+
1631
+ dotrect = wx.Rect()
1632
+ dotrect.x = int(x) - 2
1633
+ dotrect.y = int(y) - 2
1634
+ dotrect.width = bmp.GetWidth() - self._tBorder + 4
1635
+ dotrect.height = bmp.GetHeight() - self._tBorder + 4
1636
+
1637
+ dc.SetPen(wx.Pen((self.IsSelected(index) and [colour] or [wx.LIGHT_GREY])[0],
1638
+ 0, wx.PENSTYLE_SOLID))
1639
+ dc.SetBrush(wx.Brush(wx.BLACK, wx.BRUSHSTYLE_TRANSPARENT))
1640
+
1641
+ if self._tOutline == THUMB_OUTLINE_FULL or self._tOutline == THUMB_OUTLINE_RECT:
1642
+
1643
+ imgRect.x = int(x)
1644
+ imgRect.y = int(y)
1645
+ imgRect.width = bmp.GetWidth() - self._tBorder
1646
+ imgRect.height = bmp.GetHeight() - self._tBorder
1647
+
1648
+ if self._tOutline == THUMB_OUTLINE_RECT:
1649
+ imgRect.height = self._tHeight
1650
+
1651
+ dc.SetBrush(wx.TRANSPARENT_BRUSH)
1652
+
1653
+ if selected:
1654
+
1655
+ dc.SetPen(self.grayPen)
1656
+ dc.DrawRoundedRectangle(dotrect, 2)
1657
+
1658
+ dc.SetPen(wx.Pen(wx.WHITE))
1659
+ dc.DrawRectangle(imgRect.x, imgRect.y,
1660
+ imgRect.width, imgRect.height)
1661
+
1662
+ pen = wx.Pen((selected and [colour] or [wx.LIGHT_GREY])[0], 2)
1663
+ pen.SetJoin(wx.JOIN_MITER)
1664
+ dc.SetPen(pen)
1665
+ if self._tOutline == THUMB_OUTLINE_FULL:
1666
+ dc.DrawRoundedRectangle(imgRect.x - 1, imgRect.y - 1,
1667
+ imgRect.width + 3, imgRect.height + 3, 2)
1668
+ else:
1669
+ dc.DrawRectangle(imgRect.x - 1, imgRect.y - 1,
1670
+ imgRect.width + 3, imgRect.height + 3)
1671
+ else:
1672
+ dc.SetPen(wx.Pen(wx.LIGHT_GREY))
1673
+
1674
+ dc.DrawRectangle(imgRect.x - 1, imgRect.y - 1,
1675
+ imgRect.width + 2, imgRect.height + 2)
1676
+
1677
+
1678
+ dc.SelectObject(wx.NullBitmap)
1679
+
1680
+
1681
+ def OnPaint(self, event):
1682
+ """
1683
+ Handles the ``wx.EVT_PAINT`` event for :class:`ThumbnailCtrl`.
1684
+
1685
+ :param `event`: a :class:`PaintEvent` event to be processed.
1686
+ """
1687
+
1688
+ paintRect = self.GetPaintRect()
1689
+
1690
+ dc = wx.BufferedPaintDC(self)
1691
+ self.PrepareDC(dc)
1692
+
1693
+ dc.SetPen(wx.Pen(wx.BLACK, 0, wx.PENSTYLE_TRANSPARENT))
1694
+ dc.SetBrush(wx.Brush(self.GetBackgroundColour(), wx.BRUSHSTYLE_SOLID))
1695
+
1696
+ w, h = self.GetClientSize()
1697
+
1698
+ # items
1699
+ row = -1
1700
+ xwhite = self._tBorder
1701
+
1702
+ for ii in range(len(self._items)):
1703
+
1704
+ col = ii%self._cols
1705
+ if col == 0:
1706
+ row = row + 1
1707
+
1708
+ xwhite = ((w - self._cols*(self._tWidth + self._tBorder)))//(self._cols+1)
1709
+ tx = xwhite + col*(self._tWidth + self._tBorder)
1710
+
1711
+ ty = self._tBorder//2 + row*(self._tHeight + self._tBorder) + \
1712
+ self.GetCaptionHeight(0, row)
1713
+ tw = self._tWidth + self._tBorder
1714
+ th = self._tHeight + self.GetCaptionHeight(row) + self._tBorder
1715
+ # visible?
1716
+ if not paintRect.Intersects(wx.Rect(tx, ty, tw, th)):
1717
+ continue
1718
+
1719
+ thmb = wx.Bitmap(tw, th)
1720
+ self.DrawThumbnail(thmb, self._items[ii], ii)
1721
+ dc.DrawBitmap(thmb, tx, ty)
1722
+
1723
+ rect = wx.Rect(xwhite, self._tBorder//2,
1724
+ self._cols*(self._tWidth + self._tBorder),
1725
+ self._rows*(self._tHeight + self._tBorder) + \
1726
+ self.GetCaptionHeight(0, self._rows))
1727
+
1728
+ w = max(self.GetClientSize().GetWidth(), rect.width)
1729
+ h = max(self.GetClientSize().GetHeight(), rect.height)
1730
+ dc.DrawRectangle(0, 0, w, rect.y)
1731
+ dc.DrawRectangle(0, 0, rect.x, h)
1732
+ dc.DrawRectangle(rect.GetRight(), 0, w - rect.GetRight(), h + 50)
1733
+ dc.DrawRectangle(0, rect.GetBottom(), w, h - rect.GetBottom() + 50)
1734
+
1735
+ col = len(self._items)%self._cols
1736
+
1737
+ if col > 0:
1738
+ rect.x = rect.x + col*(self._tWidth + self._tBorder)
1739
+ rect.y = rect.y + (self._rows - 1)*(self._tHeight + self._tBorder) + \
1740
+ self.GetCaptionHeight(0, self._rows - 1)
1741
+ dc.DrawRectangle(rect)
1742
+
1743
+
1744
+ def OnResize(self, event):
1745
+ """
1746
+ Handles the ``wx.EVT_SIZE`` event for :class:`ThumbnailCtrl`.
1747
+
1748
+ :param `event`: a :class:`wx.SizeEvent` event to be processed.
1749
+ """
1750
+
1751
+ self.UpdateProp()
1752
+ self.ScrollToSelected()
1753
+ self.Refresh()
1754
+
1755
+
1756
+ def OnMouseDown(self, event):
1757
+ """
1758
+ Handles the ``wx.EVT_LEFT_DOWN`` and ``wx.EVT_RIGHT_DOWN`` events for :class:`ThumbnailCtrl`.
1759
+
1760
+ :param `event`: a :class:`MouseEvent` event to be processed.
1761
+ """
1762
+
1763
+ x = event.GetX()
1764
+ y = event.GetY()
1765
+ x, y = self.CalcUnscrolledPosition(x, y)
1766
+ # get item number to select
1767
+ lastselected = self._selected
1768
+ self._selected = self.GetItemIndex(x, y)
1769
+
1770
+ self._mouseeventhandled = False
1771
+ update = False
1772
+
1773
+ if event.ControlDown():
1774
+ if self._selected == -1:
1775
+ self._mouseeventhandled = True
1776
+ elif not self.IsSelected(self._selected):
1777
+ self._selectedarray.append(self._selected)
1778
+ update = True
1779
+ self._mouseeventhandled = True
1780
+
1781
+ elif event.ShiftDown():
1782
+ if self._selected != -1:
1783
+ begindex = self._selected
1784
+ endindex = lastselected
1785
+ if lastselected < self._selected:
1786
+ begindex = lastselected
1787
+ endindex = self._selected
1788
+ self._selectedarray = []
1789
+
1790
+ for ii in range(begindex, endindex+1):
1791
+ self._selectedarray.append(ii)
1792
+
1793
+ update = True
1794
+
1795
+ self._selected = lastselected
1796
+ self._mouseeventhandled = True
1797
+
1798
+ else:
1799
+
1800
+ if self._selected == -1:
1801
+ update = len(self._selectedarray) > 0
1802
+ self._selectedarray = []
1803
+ self._mouseeventhandled = True
1804
+ elif len(self._selectedarray) <= 1:
1805
+ try:
1806
+ update = len(self._selectedarray)== 0 or self._selectedarray[0] != self._selected
1807
+ except:
1808
+ update = True
1809
+ self._selectedarray = []
1810
+ self._selectedarray.append(self._selected)
1811
+ self._mouseeventhandled = True
1812
+
1813
+ if update:
1814
+ self.ScrollToSelected()
1815
+ self.Refresh()
1816
+ eventOut = ThumbnailEvent(wxEVT_THUMBNAILS_SEL_CHANGED, self.GetId())
1817
+ self.GetEventHandler().ProcessEvent(eventOut)
1818
+
1819
+ self.SetFocus()
1820
+
1821
+
1822
+ def OnMouseUp(self, event):
1823
+ """
1824
+ Handles the ``wx.EVT_LEFT_UP`` and ``wx.EVT_RIGHT_UP`` events for :class:`ThumbnailCtrl`.
1825
+
1826
+ :param `event`: a :class:`MouseEvent` event to be processed.
1827
+ """
1828
+
1829
+ # get item number to select
1830
+ x = event.GetX()
1831
+ y = event.GetY()
1832
+ x, y = self.CalcUnscrolledPosition(x, y)
1833
+ lastselected = self._selected
1834
+ self._selected = self.GetItemIndex(x,y)
1835
+
1836
+ if not self._mouseeventhandled:
1837
+ # set new selection
1838
+ if event.ControlDown():
1839
+ if self._selected in self._selectedarray:
1840
+ self._selectedarray.remove(self._selected)
1841
+
1842
+ self._selected = -1
1843
+ else:
1844
+ self._selectedarray = []
1845
+ self._selectedarray.append(self._selected)
1846
+
1847
+ self.ScrollToSelected()
1848
+ self.Refresh()
1849
+ eventOut = ThumbnailEvent(wxEVT_THUMBNAILS_SEL_CHANGED, self.GetId())
1850
+ self.GetEventHandler().ProcessEvent(eventOut)
1851
+
1852
+ # Popup menu
1853
+ if event.RightUp():
1854
+ if self._selected >= 0 and self._pmenu:
1855
+ self.PopupMenu(self._pmenu)
1856
+ elif self._selected >= 0 and not self._pmenu and self._gpmenu:
1857
+ self.PopupMenu(self._gpmenu)
1858
+ elif self._selected == -1 and self._gpmenu:
1859
+ self.PopupMenu(self._gpmenu)
1860
+
1861
+ if event.ShiftDown():
1862
+ self._selected = lastselected
1863
+
1864
+
1865
+ def OnMouseDClick(self, event):
1866
+ """
1867
+ Handles the ``wx.EVT_LEFT_DCLICK`` event for :class:`ThumbnailCtrl`.
1868
+
1869
+ :param `event`: a :class:`MouseEvent` event to be processed.
1870
+ """
1871
+
1872
+ eventOut = ThumbnailEvent(wxEVT_THUMBNAILS_DCLICK, self.GetId())
1873
+ self.GetEventHandler().ProcessEvent(eventOut)
1874
+
1875
+
1876
+ def OnMouseMove(self, event):
1877
+ """
1878
+ Handles the ``wx.EVT_MOTION`` event for :class:`ThumbnailCtrl`.
1879
+
1880
+ :param `event`: a :class:`MouseEvent` event to be processed.
1881
+ """
1882
+
1883
+ # -- drag & drop --
1884
+ if self._dragging and event.Dragging() and len(self._selectedarray) > 0:
1885
+
1886
+ files = wx.FileDataObject()
1887
+ for ii in range(len(self._selectedarray)):
1888
+ files.AddFile(opj(self.GetSelectedItem(ii).GetFullFileName()))
1889
+
1890
+ source = wx.DropSource(self)
1891
+ source.SetData(files)
1892
+ source.DoDragDrop(wx.Drag_DefaultMove)
1893
+
1894
+ # -- light-effect --
1895
+ x = event.GetX()
1896
+ y = event.GetY()
1897
+ x, y = self.CalcUnscrolledPosition(x, y)
1898
+
1899
+ # get item number
1900
+ sel = self.GetItemIndex(x, y)
1901
+
1902
+ if sel == self._pointed:
1903
+ if self._enabletooltip and sel >= 0:
1904
+ if not hasattr(self, "_tipwindow"):
1905
+ self._tipwindow = wx.ToolTip(self.GetThumbInfo(sel))
1906
+ self._tipwindow.SetDelay(1000)
1907
+ self.SetToolTip(self._tipwindow)
1908
+ else:
1909
+ self._tipwindow.SetDelay(1000)
1910
+ self._tipwindow.SetTip(self.GetThumbInfo(sel))
1911
+
1912
+ event.Skip()
1913
+ return
1914
+
1915
+ if self._enabletooltip:
1916
+ if hasattr(self, "_tipwindow"):
1917
+ self._tipwindow.Enable(False)
1918
+
1919
+ # update thumbnail
1920
+ self._pointed = sel
1921
+
1922
+ if self._enabletooltip and sel >= 0:
1923
+ if not hasattr(self, "_tipwindow"):
1924
+ self._tipwindow = wx.ToolTip(self.GetThumbInfo(sel))
1925
+ self._tipwindow.SetDelay(1000)
1926
+ self._tipwindow.Enable(True)
1927
+ self.SetToolTip(self._tipwindow)
1928
+ else:
1929
+ self._tipwindow.SetDelay(1000)
1930
+ self._tipwindow.Enable(True)
1931
+ self._tipwindow.SetTip(self.GetThumbInfo(sel))
1932
+
1933
+ self.Refresh()
1934
+ eventOut = ThumbnailEvent(wxEVT_THUMBNAILS_POINTED, self.GetId())
1935
+ self.GetEventHandler().ProcessEvent(eventOut)
1936
+ event.Skip()
1937
+
1938
+
1939
+ def OnMouseLeave(self, event):
1940
+ """
1941
+ Handles the ``wx.EVT_LEAVE_WINDOW`` event for :class:`ThumbnailCtrl`.
1942
+
1943
+ :param `event`: a :class:`MouseEvent` event to be processed.
1944
+ """
1945
+
1946
+ if self._pointed != -1:
1947
+
1948
+ self._pointed = -1
1949
+ self.Refresh()
1950
+ eventOut = ThumbnailEvent(wxEVT_THUMBNAILS_POINTED, self.GetId())
1951
+ self.GetEventHandler().ProcessEvent(eventOut)
1952
+
1953
+
1954
+ def OnThumbChanged(self, event):
1955
+ """
1956
+ Handles the ``EVT_THUMBNAILS_THUMB_CHANGED`` event for :class:`ThumbnailCtrl`.
1957
+
1958
+ :param `event`: a :class:`ThumbnailEvent` event to be processed.
1959
+ """
1960
+
1961
+ for ii in range(len(self._items)):
1962
+ if self._items[ii].GetFileName() == event.GetString():
1963
+
1964
+ self._items[ii].SetFilename(self._items[ii].GetFileName())
1965
+ if event.GetClientData():
1966
+
1967
+ img = wx.Image(event.GetClientData())
1968
+ self._items[ii].SetImage(img)
1969
+
1970
+ self.Refresh()
1971
+
1972
+
1973
+ def OnChar(self, event):
1974
+ """
1975
+ Handles the ``wx.EVT_CHAR`` event for :class:`ThumbnailCtrl`.
1976
+
1977
+ :param `event`: a :class:`KeyEvent` event to be processed.
1978
+
1979
+ :note: You have these choices:
1980
+
1981
+ (1) ``d`` key rotates 90 degrees clockwise the selected thumbnails;
1982
+ (2) ``s`` key rotates 90 degrees counter-clockwise the selected thumbnails;
1983
+ (3) ``a`` key rotates 180 degrees the selected thumbnails;
1984
+ (4) ``+`` key zooms in;
1985
+ (5) ``-`` key zooms out.
1986
+ All other keys cause an EVT_THUMBNAILS_CHAR event to be thrown.
1987
+ """
1988
+
1989
+ if event.KeyCode == ord("s"):
1990
+ self.Rotate()
1991
+ elif event.KeyCode == ord("d"):
1992
+ self.Rotate(270)
1993
+ elif event.KeyCode == ord("a"):
1994
+ self.Rotate(180)
1995
+ elif event.KeyCode in [wx.WXK_ADD, wx.WXK_NUMPAD_ADD]:
1996
+ self.ZoomIn()
1997
+ elif event.KeyCode in [wx.WXK_SUBTRACT, wx.WXK_NUMPAD_SUBTRACT]:
1998
+ self.ZoomOut()
1999
+
2000
+ selected = []
2001
+ for ii in range(len(self._items)):
2002
+ if self.IsSelected(ii):
2003
+ selected.append(ii)
2004
+
2005
+ eventOut = ThumbnailEvent(wxEVT_THUMBNAILS_CHAR, self.GetId(),
2006
+ thumbs=selected, keycode=event.KeyCode)
2007
+ self.GetEventHandler().ProcessEvent(eventOut)
2008
+
2009
+ event.Skip()
2010
+
2011
+ def Rotate(self, angle=90):
2012
+ """
2013
+ Rotates the selected thumbnails by the angle specified by `angle`.
2014
+
2015
+ :param `angle`: the rotation angle for the thumbnail, in degrees.
2016
+ """
2017
+
2018
+ wx.BeginBusyCursor()
2019
+
2020
+ selected = []
2021
+ for ii in range(len(self._items)):
2022
+ if self.IsSelected(ii):
2023
+ selected.append(self._items[ii])
2024
+
2025
+ for thumb in selected:
2026
+ thumb.Rotate(angle)
2027
+
2028
+ wx.EndBusyCursor()
2029
+
2030
+ if self.GetSelection() != -1:
2031
+ self.Refresh()
2032
+
2033
+
2034
+ def OnMouseWheel(self, event):
2035
+ """
2036
+ Handles the ``wx.EVT_MOUSEWHEEL`` event for :class:`ThumbnailCtrl`.
2037
+
2038
+ :param `event`: a :class:`MouseEvent` event to be processed.
2039
+
2040
+ :note: If you hold down the ``Ctrl`` key, you can zoom in/out with the mouse wheel.
2041
+ """
2042
+
2043
+ if event.ControlDown():
2044
+ if event.GetWheelRotation() > 0:
2045
+ self.ZoomIn()
2046
+ else:
2047
+ self.ZoomOut()
2048
+ else:
2049
+ event.Skip()
2050
+
2051
+
2052
+ def ZoomOut(self):
2053
+ """ Zooms the thumbnails out. """
2054
+
2055
+ w, h, b = self.GetThumbSize()
2056
+
2057
+ if w < 40 or h < 40:
2058
+ return
2059
+
2060
+ zoom = self.GetZoomFactor()
2061
+ neww = float(w)/zoom
2062
+ newh = float(h)/zoom
2063
+
2064
+ self.SetThumbSize(int(neww), int(newh))
2065
+ self.OnResize(None)
2066
+ self._checktext = True
2067
+
2068
+ self.Refresh()
2069
+
2070
+
2071
+ def ZoomIn(self):
2072
+ """ Zooms the thumbnails in. """
2073
+
2074
+ size = self.GetClientSize()
2075
+ w, h, b = self.GetThumbSize()
2076
+ zoom = self.GetZoomFactor()
2077
+
2078
+ if w*zoom + b > size.GetWidth() or h*zoom + b > size.GetHeight():
2079
+ if w*zoom + b > size.GetWidth():
2080
+ neww = size.GetWidth() - 2*self._tBorder
2081
+ newh = (float(h)/w)*neww
2082
+ else:
2083
+ newh = size.GetHeight() - 2*self._tBorder
2084
+ neww = (float(w)/h)*newh
2085
+
2086
+ else:
2087
+ neww = float(w)*zoom
2088
+ newh = float(h)*zoom
2089
+
2090
+ self.SetThumbSize(int(neww), int(newh))
2091
+ self.OnResize(None)
2092
+ self._checktext = True
2093
+
2094
+ self.Refresh()
2095
+
2096
+
2097
+ # ---------------------------------------------------------------------------- #
2098
+ # Class ThumbnailEvent
2099
+ # ---------------------------------------------------------------------------- #
2100
+
2101
+ class ThumbnailEvent(wx.PyCommandEvent):
2102
+ """
2103
+ This class is used to send events when a thumbnail is hovered, selected,
2104
+ double-clicked or when its caption has been changed.
2105
+ """
2106
+ def __init__(self, evtType, evtId=-1, thumbs=None, keycode=None):
2107
+ """
2108
+ Default class constructor.
2109
+
2110
+ :param `evtType`: the event type;
2111
+ :param `evtId`: the event identifier.
2112
+ """
2113
+
2114
+ wx.PyCommandEvent.__init__(self, evtType, evtId)
2115
+ self.thumbs = thumbs
2116
+ self.keycode = keycode