wxPython-zombie 3.1.5.8__cp313-cp313-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 (1175) hide show
  1. wx/__init__.py +22 -0
  2. wx/__version__.py +9 -0
  3. wx/_adv.cp313-win_amd64.pyd +0 -0
  4. wx/_aui.cp313-win_amd64.pyd +0 -0
  5. wx/_core.cp313-win_amd64.pyd +0 -0
  6. wx/_dataview.cp313-win_amd64.pyd +0 -0
  7. wx/_glcanvas.cp313-win_amd64.pyd +0 -0
  8. wx/_grid.cp313-win_amd64.pyd +0 -0
  9. wx/_html.cp313-win_amd64.pyd +0 -0
  10. wx/_html2.cp313-win_amd64.pyd +0 -0
  11. wx/_media.cp313-win_amd64.pyd +0 -0
  12. wx/_msw.cp313-win_amd64.pyd +0 -0
  13. wx/_propgrid.cp313-win_amd64.pyd +0 -0
  14. wx/_ribbon.cp313-win_amd64.pyd +0 -0
  15. wx/_richtext.cp313-win_amd64.pyd +0 -0
  16. wx/_stc.cp313-win_amd64.pyd +0 -0
  17. wx/_xml.cp313-win_amd64.pyd +0 -0
  18. wx/_xrc.cp313-win_amd64.pyd +0 -0
  19. wx/adv.py +124 -0
  20. wx/adv.pyi +5182 -0
  21. wx/aui.py +77 -0
  22. wx/aui.pyi +3655 -0
  23. wx/core.py +3540 -0
  24. wx/core.pyi +50592 -0
  25. wx/dataview.py +173 -0
  26. wx/dataview.pyi +3491 -0
  27. wx/demo/AUI_DockingWindowMgr.py +1154 -0
  28. wx/demo/AUI_MDI.py +117 -0
  29. wx/demo/AUI_Notebook.py +58 -0
  30. wx/demo/About.py +75 -0
  31. wx/demo/AboutBox.py +75 -0
  32. wx/demo/ActiveXWrapper_Acrobat.py +132 -0
  33. wx/demo/ActiveXWrapper_IE.py +187 -0
  34. wx/demo/ActiveX_FlashWindow.py +107 -0
  35. wx/demo/ActiveX_IEHtmlWindow.py +242 -0
  36. wx/demo/ActiveX_PDFWindow.py +204 -0
  37. wx/demo/ActivityIndicator.py +80 -0
  38. wx/demo/AddPrivateFont.py +116 -0
  39. wx/demo/AdjustChannels.py +178 -0
  40. wx/demo/AlphaDrawing.py +77 -0
  41. wx/demo/AnalogClock.py +144 -0
  42. wx/demo/AnimationCtrl.py +104 -0
  43. wx/demo/ArtProvider.py +893 -0
  44. wx/demo/BannerWindow.py +1 -0
  45. wx/demo/BitmapButton.py +87 -0
  46. wx/demo/BitmapComboBox.py +63 -0
  47. wx/demo/BitmapFromBuffer.py +140 -0
  48. wx/demo/Button.py +77 -0
  49. wx/demo/Cairo.py +197 -0
  50. wx/demo/Cairo_Snippets.py +135 -0
  51. wx/demo/Calendar.py +660 -0
  52. wx/demo/CalendarCtrl.py +122 -0
  53. wx/demo/CheckBox.py +74 -0
  54. wx/demo/CheckListBox.py +79 -0
  55. wx/demo/CheckListCtrl.py +99 -0
  56. wx/demo/Choice.py +55 -0
  57. wx/demo/Choicebook.py +80 -0
  58. wx/demo/CollapsibleHeaderCtrl.py +85 -0
  59. wx/demo/CollapsiblePane.py +126 -0
  60. wx/demo/ColorPanel.py +19 -0
  61. wx/demo/ColourDB.py +203 -0
  62. wx/demo/ColourDialog.py +76 -0
  63. wx/demo/ColourSelect.py +119 -0
  64. wx/demo/ComboBox.py +111 -0
  65. wx/demo/ComboCtrl.py +153 -0
  66. wx/demo/ComboTreeBox.py +71 -0
  67. wx/demo/CommandLinkButton.py +50 -0
  68. wx/demo/ContextHelp.py +112 -0
  69. wx/demo/Cursor.py +336 -0
  70. wx/demo/CustomDragAndDrop.py +353 -0
  71. wx/demo/DVC_CustomRenderer.py +204 -0
  72. wx/demo/DVC_DataViewModel.py +365 -0
  73. wx/demo/DVC_IndexListModel.py +257 -0
  74. wx/demo/DVC_ListCtrl.py +69 -0
  75. wx/demo/DVC_TreeCtrl.py +76 -0
  76. wx/demo/DatePickerCtrl.py +68 -0
  77. wx/demo/DelayedResult.py +239 -0
  78. wx/demo/Dialog.py +169 -0
  79. wx/demo/DialogUnits.py +128 -0
  80. wx/demo/DirDialog.py +58 -0
  81. wx/demo/DragAndDrop.py +265 -0
  82. wx/demo/DragImage.py +316 -0
  83. wx/demo/DragScroller.py +59 -0
  84. wx/demo/DrawXXXList.py +436 -0
  85. wx/demo/DynamicSashWindow.py +177 -0
  86. wx/demo/EditableListBox.py +101 -0
  87. wx/demo/Editor.py +70 -0
  88. wx/demo/EventManager.py +291 -0
  89. wx/demo/ExpandoTextCtrl.py +164 -0
  90. wx/demo/FancyText.py +83 -0
  91. wx/demo/FileBrowseButton.py +100 -0
  92. wx/demo/FileCtrl.py +97 -0
  93. wx/demo/FileDialog.py +144 -0
  94. wx/demo/FileHistory.py +140 -0
  95. wx/demo/FindReplaceDialog.py +123 -0
  96. wx/demo/FloatCanvas.py +1959 -0
  97. wx/demo/FontDialog.py +142 -0
  98. wx/demo/FontEnumerator.py +82 -0
  99. wx/demo/Frame.py +85 -0
  100. wx/demo/GLCanvas.py +371 -0
  101. wx/demo/Gauge.py +66 -0
  102. wx/demo/GenericButtons.py +185 -0
  103. wx/demo/GenericCheckBox.py +65 -0
  104. wx/demo/GenericDirCtrl.py +74 -0
  105. wx/demo/GetMouseState.py +159 -0
  106. wx/demo/GraphicsContext.py +236 -0
  107. wx/demo/GraphicsGradient.py +281 -0
  108. wx/demo/Grid.py +95 -0
  109. wx/demo/GridBagSizer.py +170 -0
  110. wx/demo/GridCustEditor.py +247 -0
  111. wx/demo/GridCustTable.py +170 -0
  112. wx/demo/GridDragAndDrop.py +102 -0
  113. wx/demo/GridDragable.py +206 -0
  114. wx/demo/GridEnterHandler.py +66 -0
  115. wx/demo/GridHugeTable.py +89 -0
  116. wx/demo/GridLabelRenderer.py +114 -0
  117. wx/demo/GridSimple.py +270 -0
  118. wx/demo/GridStdEdRend.py +186 -0
  119. wx/demo/Grid_MegaExample.py +490 -0
  120. wx/demo/HTML2_WebView.py +183 -0
  121. wx/demo/HtmlWindow.py +232 -0
  122. wx/demo/I18N.py +237 -0
  123. wx/demo/Image.py +338 -0
  124. wx/demo/ImageAlpha.py +87 -0
  125. wx/demo/ImageBrowser.py +70 -0
  126. wx/demo/ImageFromStream.py +49 -0
  127. wx/demo/Img2PyArtProvider.py +99 -0
  128. wx/demo/InfoBar.py +127 -0
  129. wx/demo/IntCtrl.py +343 -0
  130. wx/demo/ItemsPicker.py +108 -0
  131. wx/demo/Joystick.py +1083 -0
  132. wx/demo/KeyEvents.py +428 -0
  133. wx/demo/LEDNumberCtrl.py +121 -0
  134. wx/demo/LayoutAnchors.py +258 -0
  135. wx/demo/LayoutConstraints.py +149 -0
  136. wx/demo/Layoutf.py +69 -0
  137. wx/demo/ListBox.py +164 -0
  138. wx/demo/ListCtrl.py +538 -0
  139. wx/demo/ListCtrl_edit.py +155 -0
  140. wx/demo/ListCtrl_virtual.py +145 -0
  141. wx/demo/Listbook.py +104 -0
  142. wx/demo/MDIDemo.py +86 -0
  143. wx/demo/MDISashDemo.py +152 -0
  144. wx/demo/MDIWindows.py +66 -0
  145. wx/demo/Main.py +2768 -0
  146. wx/demo/Mask.py +137 -0
  147. wx/demo/MaskedEditControls.py +648 -0
  148. wx/demo/MaskedNumCtrl.py +359 -0
  149. wx/demo/MediaCtrl.py +190 -0
  150. wx/demo/Menu.py +322 -0
  151. wx/demo/MessageDialog.py +54 -0
  152. wx/demo/MimeTypesManager.py +354 -0
  153. wx/demo/MiniFrame.py +67 -0
  154. wx/demo/MouseGestures.py +198 -0
  155. wx/demo/MultiChoiceDialog.py +59 -0
  156. wx/demo/MultiSash.py +95 -0
  157. wx/demo/MultiSplitterWindow.py +168 -0
  158. wx/demo/MultipleChoiceDialog.py +101 -0
  159. wx/demo/Notebook.py +134 -0
  160. wx/demo/NotificationMessage.py +61 -0
  161. wx/demo/OGL.py +433 -0
  162. wx/demo/Overlay.py +209 -0
  163. wx/demo/OwnerDrawnComboBox.py +152 -0
  164. wx/demo/PDFViewer.py +109 -0
  165. wx/demo/PageSetupDialog.py +70 -0
  166. wx/demo/PenAndBrushStyles.py +208 -0
  167. wx/demo/Pickers.py +120 -0
  168. wx/demo/PlateButton.py +430 -0
  169. wx/demo/PopupControl.py +99 -0
  170. wx/demo/PopupMenu.py +156 -0
  171. wx/demo/PopupWindow.py +227 -0
  172. wx/demo/PrintDialog.py +60 -0
  173. wx/demo/PrintFramework.py +227 -0
  174. wx/demo/Process.py +168 -0
  175. wx/demo/ProgressDialog.py +87 -0
  176. wx/demo/PropertyGrid.py +1045 -0
  177. wx/demo/PropertySheetDialog.py +231 -0
  178. wx/demo/PseudoDC.py +350 -0
  179. wx/demo/PyColourChooser.py +60 -0
  180. wx/demo/PyCrust.py +21 -0
  181. wx/demo/PyPlot.py +83 -0
  182. wx/demo/PyShell.py +22 -0
  183. wx/demo/PythonEvents.py +109 -0
  184. wx/demo/README.txt +7 -0
  185. wx/demo/RadioBox.py +67 -0
  186. wx/demo/RadioButton.py +127 -0
  187. wx/demo/RawBitmapAccess.py +208 -0
  188. wx/demo/RearrangeDialog.py +160 -0
  189. wx/demo/RendererNative.py +170 -0
  190. wx/demo/ResizeWidget.py +76 -0
  191. wx/demo/RichMessageDialog.py +85 -0
  192. wx/demo/RichTextCtrl.py +732 -0
  193. wx/demo/RichToolTip.py +145 -0
  194. wx/demo/SVGImage_Bitmap.py +130 -0
  195. wx/demo/SVGImage_Render.py +138 -0
  196. wx/demo/SashWindow.py +151 -0
  197. wx/demo/ScrolledMessageDialog.py +52 -0
  198. wx/demo/ScrolledPanel.py +124 -0
  199. wx/demo/ScrolledWindow.py +260 -0
  200. wx/demo/SearchCtrl.py +115 -0
  201. wx/demo/ShapedWindow.py +145 -0
  202. wx/demo/Simplebook.py +202 -0
  203. wx/demo/SingleChoiceDialog.py +56 -0
  204. wx/demo/SizedControls.py +433 -0
  205. wx/demo/Sizers.py +609 -0
  206. wx/demo/Slider.py +52 -0
  207. wx/demo/Sound.py +95 -0
  208. wx/demo/SpinButton.py +63 -0
  209. wx/demo/SpinCtrl.py +56 -0
  210. wx/demo/SpinCtrlDouble.py +42 -0
  211. wx/demo/SplitTree.py +146 -0
  212. wx/demo/SplitterWindow.py +62 -0
  213. wx/demo/StandardPaths.py +113 -0
  214. wx/demo/StaticBitmap.py +55 -0
  215. wx/demo/StaticBox.py +62 -0
  216. wx/demo/StaticText.py +69 -0
  217. wx/demo/StatusBar.py +144 -0
  218. wx/demo/StockButtons.py +113 -0
  219. wx/demo/StyledTextCtrl_1.py +303 -0
  220. wx/demo/StyledTextCtrl_2.py +410 -0
  221. wx/demo/SystemSettings.py +333 -0
  222. wx/demo/TablePrint.py +215 -0
  223. wx/demo/TestTable.txt +38 -0
  224. wx/demo/TextCtrl.py +187 -0
  225. wx/demo/TextEntryDialog.py +57 -0
  226. wx/demo/Threads.py +258 -0
  227. wx/demo/Throbber.py +250 -0
  228. wx/demo/Ticker.py +147 -0
  229. wx/demo/TimeCtrl.py +240 -0
  230. wx/demo/TimePickerCtrl.py +60 -0
  231. wx/demo/Timer.py +275 -0
  232. wx/demo/ToggleButton.py +54 -0
  233. wx/demo/ToolBar.py +249 -0
  234. wx/demo/ToolTip.py +71 -0
  235. wx/demo/Toolbook.py +111 -0
  236. wx/demo/TreeCtrl.py +199 -0
  237. wx/demo/TreeListCtrl.py +121 -0
  238. wx/demo/TreeMixin.py +269 -0
  239. wx/demo/Treebook.py +117 -0
  240. wx/demo/UIActionSimulator.py +151 -0
  241. wx/demo/URLDragAndDrop.py +130 -0
  242. wx/demo/Unicode.py +146 -0
  243. wx/demo/VListBox.py +176 -0
  244. wx/demo/Validator.py +237 -0
  245. wx/demo/Wizard.py +248 -0
  246. wx/demo/WrapSizer.py +115 -0
  247. wx/demo/XmlResource.py +80 -0
  248. wx/demo/XmlResourceHandler.py +199 -0
  249. wx/demo/XmlResourceSubclass.py +119 -0
  250. wx/demo/__init__.py +9 -0
  251. wx/demo/agw/AGWInfoBar.py +175 -0
  252. wx/demo/agw/AUI.py +3058 -0
  253. wx/demo/agw/AdvancedSplash.py +59 -0
  254. wx/demo/agw/AquaButton.py +146 -0
  255. wx/demo/agw/BalloonTip.py +378 -0
  256. wx/demo/agw/ButtonPanel.py +890 -0
  257. wx/demo/agw/CubeColourDialog.py +83 -0
  258. wx/demo/agw/CustomTreeCtrl.py +2167 -0
  259. wx/demo/agw/Example1 +67 -0
  260. wx/demo/agw/Example2 +49 -0
  261. wx/demo/agw/FlatMenu.py +876 -0
  262. wx/demo/agw/FlatNotebook.py +994 -0
  263. wx/demo/agw/FloatSpin.py +475 -0
  264. wx/demo/agw/FoldPanelBar.py +953 -0
  265. wx/demo/agw/FourWaySplitter.py +300 -0
  266. wx/demo/agw/GenericMessageDialog.py +207 -0
  267. wx/demo/agw/GradientButton.py +156 -0
  268. wx/demo/agw/HyperLinkCtrl.py +144 -0
  269. wx/demo/agw/HyperTreeList.py +2660 -0
  270. wx/demo/agw/KnobCtrl.py +186 -0
  271. wx/demo/agw/LabelBook.py +567 -0
  272. wx/demo/agw/MacLargeDemo.py +360 -0
  273. wx/demo/agw/MultiDirDialog.py +117 -0
  274. wx/demo/agw/PeakMeter.py +194 -0
  275. wx/demo/agw/PersistentControls.py +589 -0
  276. wx/demo/agw/PieCtrl.py +206 -0
  277. wx/demo/agw/PyBusyInfo.py +64 -0
  278. wx/demo/agw/PyCollapsiblePane.py +308 -0
  279. wx/demo/agw/PyGauge.py +162 -0
  280. wx/demo/agw/PyProgress.py +155 -0
  281. wx/demo/agw/RibbonBar.py +925 -0
  282. wx/demo/agw/RulerCtrl.py +454 -0
  283. wx/demo/agw/ScrolledThumbnail.py +128 -0
  284. wx/demo/agw/ShapedButton.py +603 -0
  285. wx/demo/agw/ShortcutEditor.py +397 -0
  286. wx/demo/agw/SpeedMeter.py +668 -0
  287. wx/demo/agw/SuperToolTip.py +396 -0
  288. wx/demo/agw/ThumbDemoConfig.py +603 -0
  289. wx/demo/agw/ThumbnailCtrl.py +149 -0
  290. wx/demo/agw/ToasterBox.py +410 -0
  291. wx/demo/agw/UltimateListCtrl.py +80 -0
  292. wx/demo/agw/UltimateListIconDemo.py +908 -0
  293. wx/demo/agw/UltimateListListDemo.py +124 -0
  294. wx/demo/agw/UltimateReportDemo.py +1146 -0
  295. wx/demo/agw/UltimateVirtualDemo.py +207 -0
  296. wx/demo/agw/Windows7Explorer_Contents.py +368 -0
  297. wx/demo/agw/XLSGrid.py +238 -0
  298. wx/demo/agw/ZoomBar.py +230 -0
  299. wx/demo/agw/__demo__.py +183 -0
  300. wx/demo/agw/bitmaps/Explorer96.png +0 -0
  301. wx/demo/agw/bitmaps/Explorer96Flip40.png +0 -0
  302. wx/demo/agw/bitmaps/Folder96.png +0 -0
  303. wx/demo/agw/bitmaps/Folder96Flip40.png +0 -0
  304. wx/demo/agw/bitmaps/Monitor96.png +0 -0
  305. wx/demo/agw/bitmaps/Monitor96Flip40.png +0 -0
  306. wx/demo/agw/bitmaps/Music96.png +0 -0
  307. wx/demo/agw/bitmaps/Music96Flip40.png +0 -0
  308. wx/demo/agw/bitmaps/Photo96.png +0 -0
  309. wx/demo/agw/bitmaps/Photo96Flip40.png +0 -0
  310. wx/demo/agw/bitmaps/Search96.png +0 -0
  311. wx/demo/agw/bitmaps/Search96Flip40.png +0 -0
  312. wx/demo/agw/bitmaps/Wizard96.png +0 -0
  313. wx/demo/agw/bitmaps/Wizard96Flip40.png +0 -0
  314. wx/demo/agw/bitmaps/advancedsplash.png +0 -0
  315. wx/demo/agw/bitmaps/aquabutton.png +0 -0
  316. wx/demo/agw/bitmaps/aquachecked.ico +0 -0
  317. wx/demo/agw/bitmaps/aquaflagged.ico +0 -0
  318. wx/demo/agw/bitmaps/aquanotchecked.ico +0 -0
  319. wx/demo/agw/bitmaps/aquanotflagged.ico +0 -0
  320. wx/demo/agw/bitmaps/canada.gif +0 -0
  321. wx/demo/agw/bitmaps/checked.ico +0 -0
  322. wx/demo/agw/bitmaps/columns.png +0 -0
  323. wx/demo/agw/bitmaps/contexthelp-16.png +0 -0
  324. wx/demo/agw/bitmaps/contexthelp.png +0 -0
  325. wx/demo/agw/bitmaps/copy.png +0 -0
  326. wx/demo/agw/bitmaps/cut.png +0 -0
  327. wx/demo/agw/bitmaps/editcopy.png +0 -0
  328. wx/demo/agw/bitmaps/editcut.png +0 -0
  329. wx/demo/agw/bitmaps/editpaste.png +0 -0
  330. wx/demo/agw/bitmaps/empty_icon.png +0 -0
  331. wx/demo/agw/bitmaps/exit-16.png +0 -0
  332. wx/demo/agw/bitmaps/exit.ico +0 -0
  333. wx/demo/agw/bitmaps/ffwd.png +0 -0
  334. wx/demo/agw/bitmaps/ffwddisabled.png +0 -0
  335. wx/demo/agw/bitmaps/field-16.png +0 -0
  336. wx/demo/agw/bitmaps/filenew.png +0 -0
  337. wx/demo/agw/bitmaps/fileopen.png +0 -0
  338. wx/demo/agw/bitmaps/filesave.png +0 -0
  339. wx/demo/agw/bitmaps/flagged.ico +0 -0
  340. wx/demo/agw/bitmaps/folder.png +0 -0
  341. wx/demo/agw/bitmaps/folder_new.png +0 -0
  342. wx/demo/agw/bitmaps/ghost.png +0 -0
  343. wx/demo/agw/bitmaps/gradientbutton.png +0 -0
  344. wx/demo/agw/bitmaps/help-16.png +0 -0
  345. wx/demo/agw/bitmaps/help.ico +0 -0
  346. wx/demo/agw/bitmaps/italy.gif +0 -0
  347. wx/demo/agw/bitmaps/lbadd.png +0 -0
  348. wx/demo/agw/bitmaps/lbcharge.png +0 -0
  349. wx/demo/agw/bitmaps/lbdecrypted.png +0 -0
  350. wx/demo/agw/bitmaps/lbnews.png +0 -0
  351. wx/demo/agw/bitmaps/lbroll.png +0 -0
  352. wx/demo/agw/bitmaps/minus1.ico +0 -0
  353. wx/demo/agw/bitmaps/minus2.ico +0 -0
  354. wx/demo/agw/bitmaps/minus3.ico +0 -0
  355. wx/demo/agw/bitmaps/minus4.ico +0 -0
  356. wx/demo/agw/bitmaps/minus5.ico +0 -0
  357. wx/demo/agw/bitmaps/month-16.png +0 -0
  358. wx/demo/agw/bitmaps/new_file.png +0 -0
  359. wx/demo/agw/bitmaps/new_folder.png +0 -0
  360. wx/demo/agw/bitmaps/notchecked.ico +0 -0
  361. wx/demo/agw/bitmaps/notflagged.ico +0 -0
  362. wx/demo/agw/bitmaps/ok-16.png +0 -0
  363. wx/demo/agw/bitmaps/open_folder.png +0 -0
  364. wx/demo/agw/bitmaps/paste.png +0 -0
  365. wx/demo/agw/bitmaps/pause.png +0 -0
  366. wx/demo/agw/bitmaps/pausedisabled.png +0 -0
  367. wx/demo/agw/bitmaps/play.png +0 -0
  368. wx/demo/agw/bitmaps/playdisabled.png +0 -0
  369. wx/demo/agw/bitmaps/plus1.ico +0 -0
  370. wx/demo/agw/bitmaps/plus2.ico +0 -0
  371. wx/demo/agw/bitmaps/plus3.ico +0 -0
  372. wx/demo/agw/bitmaps/plus4.ico +0 -0
  373. wx/demo/agw/bitmaps/plus5.ico +0 -0
  374. wx/demo/agw/bitmaps/record.png +0 -0
  375. wx/demo/agw/bitmaps/recorddisabled.png +0 -0
  376. wx/demo/agw/bitmaps/recording.gif +0 -0
  377. wx/demo/agw/bitmaps/rewind.png +0 -0
  378. wx/demo/agw/bitmaps/rewinddisabled.png +0 -0
  379. wx/demo/agw/bitmaps/round.png +0 -0
  380. wx/demo/agw/bitmaps/save.png +0 -0
  381. wx/demo/agw/bitmaps/separator.gif +0 -0
  382. wx/demo/agw/bitmaps/separatorflip.png +0 -0
  383. wx/demo/agw/bitmaps/smfuel.ico +0 -0
  384. wx/demo/agw/bitmaps/smpi.ico +0 -0
  385. wx/demo/agw/bitmaps/smtemp.ico +0 -0
  386. wx/demo/agw/bitmaps/stop.png +0 -0
  387. wx/demo/agw/bitmaps/stopdisabled.png +0 -0
  388. wx/demo/agw/bitmaps/sttbutton.png +0 -0
  389. wx/demo/agw/bitmaps/sttfont.png +0 -0
  390. wx/demo/agw/bitmaps/sttheader.png +0 -0
  391. wx/demo/agw/bitmaps/stthelp.png +0 -0
  392. wx/demo/agw/bitmaps/view1.png +0 -0
  393. wx/demo/agw/bitmaps/view2.png +0 -0
  394. wx/demo/agw/bitmaps/view_choose.png +0 -0
  395. wx/demo/agw/bitmaps/view_detailed.png +0 -0
  396. wx/demo/agw/bitmaps/view_icon.png +0 -0
  397. wx/demo/agw/bitmaps/view_multicolumn.png +0 -0
  398. wx/demo/agw/bitmaps/viewmag-16.png +0 -0
  399. wx/demo/agw/bitmaps/viewmag-m-16.png +0 -0
  400. wx/demo/agw/bitmaps/viewmag-p-16.png +0 -0
  401. wx/demo/agw/bitmaps/viewmagfit-16.png +0 -0
  402. wx/demo/agw/data/Example_1.xls +0 -0
  403. wx/demo/agw/images.py +6714 -0
  404. wx/demo/bitmaps/AG00028_.gif +0 -0
  405. wx/demo/bitmaps/AG00039_.gif +0 -0
  406. wx/demo/bitmaps/AG00178_.gif +0 -0
  407. wx/demo/bitmaps/AG00183_.gif +0 -0
  408. wx/demo/bitmaps/AG00185_.gif +0 -0
  409. wx/demo/bitmaps/BD13656_.gif +0 -0
  410. wx/demo/bitmaps/advancedsplash.png +0 -0
  411. wx/demo/bitmaps/aquabutton.png +0 -0
  412. wx/demo/bitmaps/aquachecked.ico +0 -0
  413. wx/demo/bitmaps/aquaflagged.ico +0 -0
  414. wx/demo/bitmaps/aquanotchecked.ico +0 -0
  415. wx/demo/bitmaps/aquanotflagged.ico +0 -0
  416. wx/demo/bitmaps/canada.gif +0 -0
  417. wx/demo/bitmaps/checked.ico +0 -0
  418. wx/demo/bitmaps/columns.png +0 -0
  419. wx/demo/bitmaps/contexthelp-16.png +0 -0
  420. wx/demo/bitmaps/contexthelp.png +0 -0
  421. wx/demo/bitmaps/copy.png +0 -0
  422. wx/demo/bitmaps/cropshot24x20.png +0 -0
  423. wx/demo/bitmaps/cut.png +0 -0
  424. wx/demo/bitmaps/editcopy.png +0 -0
  425. wx/demo/bitmaps/editcut.png +0 -0
  426. wx/demo/bitmaps/editpaste.png +0 -0
  427. wx/demo/bitmaps/exit-16.png +0 -0
  428. wx/demo/bitmaps/exit.ico +0 -0
  429. wx/demo/bitmaps/ffwd.png +0 -0
  430. wx/demo/bitmaps/ffwddisabled.png +0 -0
  431. wx/demo/bitmaps/field-16.png +0 -0
  432. wx/demo/bitmaps/filenew.png +0 -0
  433. wx/demo/bitmaps/fileopen.png +0 -0
  434. wx/demo/bitmaps/filesave.png +0 -0
  435. wx/demo/bitmaps/flagged.ico +0 -0
  436. wx/demo/bitmaps/folder_new.png +0 -0
  437. wx/demo/bitmaps/ghost.png +0 -0
  438. wx/demo/bitmaps/gradientbutton.png +0 -0
  439. wx/demo/bitmaps/help-16.png +0 -0
  440. wx/demo/bitmaps/help.ico +0 -0
  441. wx/demo/bitmaps/honeycomb300.png +0 -0
  442. wx/demo/bitmaps/image.bmp +0 -0
  443. wx/demo/bitmaps/image.gif +0 -0
  444. wx/demo/bitmaps/image.ico +0 -0
  445. wx/demo/bitmaps/image.jpg +0 -0
  446. wx/demo/bitmaps/image.png +0 -0
  447. wx/demo/bitmaps/image.tif +0 -0
  448. wx/demo/bitmaps/italy.gif +0 -0
  449. wx/demo/bitmaps/lbadd.png +0 -0
  450. wx/demo/bitmaps/lbcharge.png +0 -0
  451. wx/demo/bitmaps/lbdecrypted.png +0 -0
  452. wx/demo/bitmaps/lbnews.png +0 -0
  453. wx/demo/bitmaps/lbroll.png +0 -0
  454. wx/demo/bitmaps/minus1.ico +0 -0
  455. wx/demo/bitmaps/minus2.ico +0 -0
  456. wx/demo/bitmaps/minus3.ico +0 -0
  457. wx/demo/bitmaps/minus4.ico +0 -0
  458. wx/demo/bitmaps/minus5.ico +0 -0
  459. wx/demo/bitmaps/month-16.png +0 -0
  460. wx/demo/bitmaps/new_file.png +0 -0
  461. wx/demo/bitmaps/new_folder.png +0 -0
  462. wx/demo/bitmaps/notchecked.ico +0 -0
  463. wx/demo/bitmaps/notflagged.ico +0 -0
  464. wx/demo/bitmaps/ok-16.png +0 -0
  465. wx/demo/bitmaps/open_folder.png +0 -0
  466. wx/demo/bitmaps/paste.png +0 -0
  467. wx/demo/bitmaps/pause.png +0 -0
  468. wx/demo/bitmaps/pausedisabled.png +0 -0
  469. wx/demo/bitmaps/phoenix_title.png +0 -0
  470. wx/demo/bitmaps/phoenix_top.png +0 -0
  471. wx/demo/bitmaps/play.png +0 -0
  472. wx/demo/bitmaps/playdisabled.png +0 -0
  473. wx/demo/bitmaps/plus1.ico +0 -0
  474. wx/demo/bitmaps/plus2.ico +0 -0
  475. wx/demo/bitmaps/plus3.ico +0 -0
  476. wx/demo/bitmaps/plus4.ico +0 -0
  477. wx/demo/bitmaps/plus5.ico +0 -0
  478. wx/demo/bitmaps/record.png +0 -0
  479. wx/demo/bitmaps/recorddisabled.png +0 -0
  480. wx/demo/bitmaps/rewind.png +0 -0
  481. wx/demo/bitmaps/rewinddisabled.png +0 -0
  482. wx/demo/bitmaps/round.png +0 -0
  483. wx/demo/bitmaps/save.png +0 -0
  484. wx/demo/bitmaps/smfuel.ico +0 -0
  485. wx/demo/bitmaps/smpi.ico +0 -0
  486. wx/demo/bitmaps/smtemp.ico +0 -0
  487. wx/demo/bitmaps/snakey_render.png +0 -0
  488. wx/demo/bitmaps/splash.png +0 -0
  489. wx/demo/bitmaps/stop.png +0 -0
  490. wx/demo/bitmaps/stopdisabled.png +0 -0
  491. wx/demo/bitmaps/sttbutton.png +0 -0
  492. wx/demo/bitmaps/sttfont.png +0 -0
  493. wx/demo/bitmaps/sttheader.png +0 -0
  494. wx/demo/bitmaps/stthelp.png +0 -0
  495. wx/demo/bitmaps/toucan.png +0 -0
  496. wx/demo/bitmaps/view1.png +0 -0
  497. wx/demo/bitmaps/view2.png +0 -0
  498. wx/demo/bitmaps/view_choose.png +0 -0
  499. wx/demo/bitmaps/view_detailed.png +0 -0
  500. wx/demo/bitmaps/view_icon.png +0 -0
  501. wx/demo/bitmaps/view_multicolumn.png +0 -0
  502. wx/demo/bitmaps/viewmag-16.png +0 -0
  503. wx/demo/bitmaps/viewmag-m-16.png +0 -0
  504. wx/demo/bitmaps/viewmag-p-16.png +0 -0
  505. wx/demo/bitmaps/viewmagfit-16.png +0 -0
  506. wx/demo/bmp_source/001.png +0 -0
  507. wx/demo/bmp_source/002.png +0 -0
  508. wx/demo/bmp_source/003.png +0 -0
  509. wx/demo/bmp_source/004.png +0 -0
  510. wx/demo/bmp_source/005.png +0 -0
  511. wx/demo/bmp_source/006.png +0 -0
  512. wx/demo/bmp_source/007.png +0 -0
  513. wx/demo/bmp_source/008.png +0 -0
  514. wx/demo/bmp_source/009.png +0 -0
  515. wx/demo/bmp_source/010.png +0 -0
  516. wx/demo/bmp_source/011.png +0 -0
  517. wx/demo/bmp_source/012.png +0 -0
  518. wx/demo/bmp_source/013.png +0 -0
  519. wx/demo/bmp_source/014.png +0 -0
  520. wx/demo/bmp_source/015.png +0 -0
  521. wx/demo/bmp_source/016.png +0 -0
  522. wx/demo/bmp_source/017.png +0 -0
  523. wx/demo/bmp_source/018.png +0 -0
  524. wx/demo/bmp_source/019.png +0 -0
  525. wx/demo/bmp_source/020.png +0 -0
  526. wx/demo/bmp_source/021.png +0 -0
  527. wx/demo/bmp_source/022.png +0 -0
  528. wx/demo/bmp_source/023.png +0 -0
  529. wx/demo/bmp_source/024.png +0 -0
  530. wx/demo/bmp_source/025.png +0 -0
  531. wx/demo/bmp_source/026.png +0 -0
  532. wx/demo/bmp_source/027.png +0 -0
  533. wx/demo/bmp_source/028.png +0 -0
  534. wx/demo/bmp_source/029.png +0 -0
  535. wx/demo/bmp_source/030.png +0 -0
  536. wx/demo/bmp_source/DbDec.bmp +0 -0
  537. wx/demo/bmp_source/DbInc.bmp +0 -0
  538. wx/demo/bmp_source/Dec.bmp +0 -0
  539. wx/demo/bmp_source/FRM_0.png +0 -0
  540. wx/demo/bmp_source/FRM_1.png +0 -0
  541. wx/demo/bmp_source/FRM_2.png +0 -0
  542. wx/demo/bmp_source/FRM_3.png +0 -0
  543. wx/demo/bmp_source/FRM_4.png +0 -0
  544. wx/demo/bmp_source/FRM_5.png +0 -0
  545. wx/demo/bmp_source/FRM_6.png +0 -0
  546. wx/demo/bmp_source/FRM_7.png +0 -0
  547. wx/demo/bmp_source/FRM_8.png +0 -0
  548. wx/demo/bmp_source/GridBG.gif +0 -0
  549. wx/demo/bmp_source/Inc.bmp +0 -0
  550. wx/demo/bmp_source/LB01.png +0 -0
  551. wx/demo/bmp_source/LB02.png +0 -0
  552. wx/demo/bmp_source/LB03.png +0 -0
  553. wx/demo/bmp_source/LB04.png +0 -0
  554. wx/demo/bmp_source/LB05.png +0 -0
  555. wx/demo/bmp_source/LB06.png +0 -0
  556. wx/demo/bmp_source/LB07.png +0 -0
  557. wx/demo/bmp_source/LB08.png +0 -0
  558. wx/demo/bmp_source/LB09.png +0 -0
  559. wx/demo/bmp_source/LB10.png +0 -0
  560. wx/demo/bmp_source/LB11.png +0 -0
  561. wx/demo/bmp_source/LB12.png +0 -0
  562. wx/demo/bmp_source/Pt.bmp +0 -0
  563. wx/demo/bmp_source/Vippi.png +0 -0
  564. wx/demo/bmp_source/backgrnd.png +0 -0
  565. wx/demo/bmp_source/book.png +0 -0
  566. wx/demo/bmp_source/book_blue.png +0 -0
  567. wx/demo/bmp_source/book_green.png +0 -0
  568. wx/demo/bmp_source/book_red.png +0 -0
  569. wx/demo/bmp_source/bp_btn1.png +0 -0
  570. wx/demo/bmp_source/bp_btn2.png +0 -0
  571. wx/demo/bmp_source/bp_btn3.png +0 -0
  572. wx/demo/bmp_source/bp_btn4.png +0 -0
  573. wx/demo/bmp_source/bulb1.bmp +0 -0
  574. wx/demo/bmp_source/bulb2.bmp +0 -0
  575. wx/demo/bmp_source/carrot.png +0 -0
  576. wx/demo/bmp_source/clipboard.png +0 -0
  577. wx/demo/bmp_source/code.png +0 -0
  578. wx/demo/bmp_source/core.png +0 -0
  579. wx/demo/bmp_source/custom.png +0 -0
  580. wx/demo/bmp_source/customcontrol.png +0 -0
  581. wx/demo/bmp_source/deletedocs.png +0 -0
  582. wx/demo/bmp_source/deleteperspective.png +0 -0
  583. wx/demo/bmp_source/demo.png +0 -0
  584. wx/demo/bmp_source/dialog.png +0 -0
  585. wx/demo/bmp_source/exit.png +0 -0
  586. wx/demo/bmp_source/expansion.png +0 -0
  587. wx/demo/bmp_source/find.png +0 -0
  588. wx/demo/bmp_source/findnext.png +0 -0
  589. wx/demo/bmp_source/floatcanvas.png +0 -0
  590. wx/demo/bmp_source/frame.png +0 -0
  591. wx/demo/bmp_source/images.png +0 -0
  592. wx/demo/bmp_source/inspect.png +0 -0
  593. wx/demo/bmp_source/layout.png +0 -0
  594. wx/demo/bmp_source/logo.png +0 -0
  595. wx/demo/bmp_source/miscellaneous.png +0 -0
  596. wx/demo/bmp_source/modifiedexists.png +0 -0
  597. wx/demo/bmp_source/mondrian.ico +0 -0
  598. wx/demo/bmp_source/morecontrols.png +0 -0
  599. wx/demo/bmp_source/moredialog.png +0 -0
  600. wx/demo/bmp_source/noicon.png +0 -0
  601. wx/demo/bmp_source/overview.png +0 -0
  602. wx/demo/bmp_source/pencil.png +0 -0
  603. wx/demo/bmp_source/pointy.png +0 -0
  604. wx/demo/bmp_source/process.png +0 -0
  605. wx/demo/bmp_source/pyshell.png +0 -0
  606. wx/demo/bmp_source/recent.png +0 -0
  607. wx/demo/bmp_source/rest.png +0 -0
  608. wx/demo/bmp_source/robin.jpg +0 -0
  609. wx/demo/bmp_source/rt_alignleft.xpm +24 -0
  610. wx/demo/bmp_source/rt_alignright.xpm +24 -0
  611. wx/demo/bmp_source/rt_bold.xpm +24 -0
  612. wx/demo/bmp_source/rt_centre.xpm +24 -0
  613. wx/demo/bmp_source/rt_colour.xpm +59 -0
  614. wx/demo/bmp_source/rt_copy.xpm +44 -0
  615. wx/demo/bmp_source/rt_cut.xpm +46 -0
  616. wx/demo/bmp_source/rt_font.xpm +25 -0
  617. wx/demo/bmp_source/rt_idea.xpm +47 -0
  618. wx/demo/bmp_source/rt_indentless.xpm +25 -0
  619. wx/demo/bmp_source/rt_indentmore.xpm +25 -0
  620. wx/demo/bmp_source/rt_italic.xpm +25 -0
  621. wx/demo/bmp_source/rt_open.xpm +57 -0
  622. wx/demo/bmp_source/rt_paste.xpm +46 -0
  623. wx/demo/bmp_source/rt_redo.xpm +58 -0
  624. wx/demo/bmp_source/rt_sample.xpm +44 -0
  625. wx/demo/bmp_source/rt_save.xpm +42 -0
  626. wx/demo/bmp_source/rt_smiley.xpm +42 -0
  627. wx/demo/bmp_source/rt_underline.xpm +25 -0
  628. wx/demo/bmp_source/rt_undo.xpm +58 -0
  629. wx/demo/bmp_source/rt_zebra.xpm +409 -0
  630. wx/demo/bmp_source/saveperspective.png +0 -0
  631. wx/demo/bmp_source/sm_down.bmp +0 -0
  632. wx/demo/bmp_source/sm_up.bmp +0 -0
  633. wx/demo/bmp_source/smiles2.bmp +0 -0
  634. wx/demo/bmp_source/test2.bmp +0 -0
  635. wx/demo/bmp_source/testmask.bmp +0 -0
  636. wx/demo/bmp_source/teststar.png +0 -0
  637. wx/demo/bmp_source/thekid.png +0 -0
  638. wx/demo/bmp_source/tog1.bmp +0 -0
  639. wx/demo/bmp_source/tog2.bmp +0 -0
  640. wx/demo/bmp_source/wiztest1.bmp +0 -0
  641. wx/demo/bmp_source/wiztest2.bmp +0 -0
  642. wx/demo/bmp_source/wxpdemo.ico +0 -0
  643. wx/demo/cursors/paperairplane_arrow_blue.cur +0 -0
  644. wx/demo/cursors/paperairplane_arrow_blue_fadeout80.cur +0 -0
  645. wx/demo/cursors/paperairplane_arrow_colorshift.ani +0 -0
  646. wx/demo/cursors/paperairplane_arrow_dark.cur +0 -0
  647. wx/demo/cursors/paperairplane_arrow_grey.cur +0 -0
  648. wx/demo/cursors/paperairplane_arrow_red.cur +0 -0
  649. wx/demo/cursors/paperairplane_arrow_white.cur +0 -0
  650. wx/demo/cursors/paperairplane_arrow_white24.png +0 -0
  651. wx/demo/data/0-tiger.svg +725 -0
  652. wx/demo/data/Asteroid_blaster.swf +0 -0
  653. wx/demo/data/SIL_OPEN_FONT_LICENSE.txt +97 -0
  654. wx/demo/data/SourceCodePro-Regular.ttf +0 -0
  655. wx/demo/data/accessories-calculator.svg +636 -0
  656. wx/demo/data/accessories-text-editor.svg +554 -0
  657. wx/demo/data/anykey.wav +0 -0
  658. wx/demo/data/applications-internet.svg +623 -0
  659. wx/demo/data/desktop-accessibility.svg +245 -0
  660. wx/demo/data/desktop-keyboard-shortcuts.svg +839 -0
  661. wx/demo/data/desktop-locale.svg +878 -0
  662. wx/demo/data/desktop-remote-desktop.svg +1479 -0
  663. wx/demo/data/desktop-theme.svg +882 -0
  664. wx/demo/data/desktop-wallpaper.svg +747 -0
  665. wx/demo/data/echo.py +25 -0
  666. wx/demo/data/imagemap.htm +20 -0
  667. wx/demo/data/imagemap.png +0 -0
  668. wx/demo/data/internet-group-chat.svg +312 -0
  669. wx/demo/data/internet-mail.svg +440 -0
  670. wx/demo/data/locale/af/LC_MESSAGES/wxpydemo.mo +0 -0
  671. wx/demo/data/locale/de/LC_MESSAGES/wxpydemo.mo +0 -0
  672. wx/demo/data/locale/es/LC_MESSAGES/wxpydemo.mo +0 -0
  673. wx/demo/data/locale/fr/LC_MESSAGES/wxpydemo.mo +0 -0
  674. wx/demo/data/locale/it/LC_MESSAGES/wxpydemo.mo +0 -0
  675. wx/demo/data/locale-src/af.po +23 -0
  676. wx/demo/data/locale-src/de.po +23 -0
  677. wx/demo/data/locale-src/es.po +22 -0
  678. wx/demo/data/locale-src/fr.po +22 -0
  679. wx/demo/data/locale-src/install +15 -0
  680. wx/demo/data/locale-src/it.po +23 -0
  681. wx/demo/data/locale-src/wxpydemo.po +21 -0
  682. wx/demo/data/office-calendar.svg +316 -0
  683. wx/demo/data/pic.png +0 -0
  684. wx/demo/data/pic2.bmp +0 -0
  685. wx/demo/data/plan.wav +0 -0
  686. wx/demo/data/proclamation.txt +115 -0
  687. wx/demo/data/resource.wdr +0 -0
  688. wx/demo/data/resource_wdr.xrc +146 -0
  689. wx/demo/data/romedalen.png +0 -0
  690. wx/demo/data/stc.h.html +3544 -0
  691. wx/demo/data/system-session.svg +510 -0
  692. wx/demo/data/system-users.svg +539 -0
  693. wx/demo/data/tables.htm +116 -0
  694. wx/demo/data/test-gradient-pen.svg +14 -0
  695. wx/demo/data/test-opacity.svg +7 -0
  696. wx/demo/data/test.htm +253 -0
  697. wx/demo/data/testmovie.mpg +0 -0
  698. wx/demo/data/testtable.txt +38 -0
  699. wx/demo/data/tips.txt +73 -0
  700. wx/demo/data/utilities-system-monitor.svg +435 -0
  701. wx/demo/data/utilities-terminal.svg +500 -0
  702. wx/demo/data/widgetTest.htm +70 -0
  703. wx/demo/data/world.dat +24055 -0
  704. wx/demo/demo.py +4 -0
  705. wx/demo/demo.pyw +4 -0
  706. wx/demo/demodata.py +310 -0
  707. wx/demo/encode_bitmaps.py +181 -0
  708. wx/demo/images.py +6812 -0
  709. wx/demo/infoframe.py +149 -0
  710. wx/demo/run.py +171 -0
  711. wx/demo/snippets/__init__.py +13 -0
  712. wx/demo/snippets/arc.py +21 -0
  713. wx/demo/snippets/arc_negative.py +21 -0
  714. wx/demo/snippets/clip.py +13 -0
  715. wx/demo/snippets/clip_image.py +13 -0
  716. wx/demo/snippets/curve_rectangle.py +53 -0
  717. wx/demo/snippets/curve_to.py +17 -0
  718. wx/demo/snippets/dash.py +18 -0
  719. wx/demo/snippets/ellipse.py +33 -0
  720. wx/demo/snippets/fill_and_stroke.py +12 -0
  721. wx/demo/snippets/fill_and_stroke2.py +18 -0
  722. wx/demo/snippets/fill_style.py +31 -0
  723. wx/demo/snippets/glyph_path.py +21 -0
  724. wx/demo/snippets/gradient.py +16 -0
  725. wx/demo/snippets/gradient_mask.py +12 -0
  726. wx/demo/snippets/group.py +16 -0
  727. wx/demo/snippets/image.py +14 -0
  728. wx/demo/snippets/imagepattern.py +23 -0
  729. wx/demo/snippets/path.py +7 -0
  730. wx/demo/snippets/set_line_cap.py +19 -0
  731. wx/demo/snippets/set_line_join.py +21 -0
  732. wx/demo/snippets/show_glyphs.py +15 -0
  733. wx/demo/snippets/text.py +22 -0
  734. wx/demo/snippets/text_align_center.py +26 -0
  735. wx/demo/snippets/text_extents.py +27 -0
  736. wx/demo/template.py +36 -0
  737. wx/demo/throbImages.py +1277 -0
  738. wx/demo/version.py +3 -0
  739. wx/demo/widgetTest.py +72 -0
  740. wx/demo/wxpdemo.ico +0 -0
  741. wx/glcanvas.py +10 -0
  742. wx/glcanvas.pyi +458 -0
  743. wx/grid.py +229 -0
  744. wx/grid.pyi +4959 -0
  745. wx/html.py +35 -0
  746. wx/html.pyi +2965 -0
  747. wx/html2.py +40 -0
  748. wx/html2.pyi +772 -0
  749. wx/lib/CDate.py +202 -0
  750. wx/lib/ClickableHtmlWindow.py +57 -0
  751. wx/lib/__init__.py +0 -0
  752. wx/lib/activex.py +178 -0
  753. wx/lib/activexwrapper.py +153 -0
  754. wx/lib/agw/__init__.py +128 -0
  755. wx/lib/agw/advancedsplash.py +564 -0
  756. wx/lib/agw/aquabutton.py +1127 -0
  757. wx/lib/agw/artmanager.py +2110 -0
  758. wx/lib/agw/aui/__init__.py +295 -0
  759. wx/lib/agw/aui/aui_constants.py +2628 -0
  760. wx/lib/agw/aui/aui_switcherdialog.py +1227 -0
  761. wx/lib/agw/aui/aui_utilities.py +672 -0
  762. wx/lib/agw/aui/auibar.py +4031 -0
  763. wx/lib/agw/aui/auibook.py +6289 -0
  764. wx/lib/agw/aui/dockart.py +1198 -0
  765. wx/lib/agw/aui/framemanager.py +10409 -0
  766. wx/lib/agw/aui/tabart.py +2771 -0
  767. wx/lib/agw/aui/tabmdi.py +679 -0
  768. wx/lib/agw/balloontip.py +1158 -0
  769. wx/lib/agw/buttonpanel.py +2823 -0
  770. wx/lib/agw/cubecolourdialog.py +3529 -0
  771. wx/lib/agw/customtreectrl.py +8963 -0
  772. wx/lib/agw/data/ShortcutEditor_1.png +0 -0
  773. wx/lib/agw/data/ShortcutEditor_1_thumb.png +0 -0
  774. wx/lib/agw/data/ShortcutEditor_2.png +0 -0
  775. wx/lib/agw/data/ShortcutEditor_2_thumb.png +0 -0
  776. wx/lib/agw/data/ShortcutEditor_3.png +0 -0
  777. wx/lib/agw/data/ShortcutEditor_3_thumb.png +0 -0
  778. wx/lib/agw/data/ShortcutEditor_4.png +0 -0
  779. wx/lib/agw/data/ShortcutEditor_4_thumb.png +0 -0
  780. wx/lib/agw/data/default_help_text.html +105 -0
  781. wx/lib/agw/flatmenu.py +7333 -0
  782. wx/lib/agw/flatnotebook.py +6672 -0
  783. wx/lib/agw/floatspin.py +1823 -0
  784. wx/lib/agw/fmcustomizedlg.py +540 -0
  785. wx/lib/agw/fmresources.py +407 -0
  786. wx/lib/agw/foldpanelbar.py +2282 -0
  787. wx/lib/agw/fourwaysplitter.py +1130 -0
  788. wx/lib/agw/genericmessagedialog.py +1549 -0
  789. wx/lib/agw/gradientbutton.py +732 -0
  790. wx/lib/agw/hyperlink.py +664 -0
  791. wx/lib/agw/hypertreelist.py +5374 -0
  792. wx/lib/agw/infobar.py +885 -0
  793. wx/lib/agw/knobctrl.py +945 -0
  794. wx/lib/agw/labelbook.py +3029 -0
  795. wx/lib/agw/multidirdialog.py +615 -0
  796. wx/lib/agw/peakmeter.py +1029 -0
  797. wx/lib/agw/persist/__init__.py +188 -0
  798. wx/lib/agw/persist/persist_constants.py +284 -0
  799. wx/lib/agw/persist/persist_handlers.py +2614 -0
  800. wx/lib/agw/persist/persistencemanager.py +864 -0
  801. wx/lib/agw/piectrl.py +1082 -0
  802. wx/lib/agw/pybusyinfo.py +399 -0
  803. wx/lib/agw/pycollapsiblepane.py +940 -0
  804. wx/lib/agw/pygauge.py +570 -0
  805. wx/lib/agw/pyprogress.py +917 -0
  806. wx/lib/agw/ribbon/__init__.py +198 -0
  807. wx/lib/agw/ribbon/art.py +219 -0
  808. wx/lib/agw/ribbon/art_aui.py +1284 -0
  809. wx/lib/agw/ribbon/art_default.py +81 -0
  810. wx/lib/agw/ribbon/art_internal.py +244 -0
  811. wx/lib/agw/ribbon/art_msw.py +2736 -0
  812. wx/lib/agw/ribbon/art_osx.py +52 -0
  813. wx/lib/agw/ribbon/bar.py +1261 -0
  814. wx/lib/agw/ribbon/buttonbar.py +1320 -0
  815. wx/lib/agw/ribbon/control.py +205 -0
  816. wx/lib/agw/ribbon/gallery.py +974 -0
  817. wx/lib/agw/ribbon/page.py +946 -0
  818. wx/lib/agw/ribbon/panel.py +1170 -0
  819. wx/lib/agw/ribbon/toolbar.py +1442 -0
  820. wx/lib/agw/rulerctrl.py +1887 -0
  821. wx/lib/agw/scrolledthumbnail.py +2119 -0
  822. wx/lib/agw/shapedbutton.py +1809 -0
  823. wx/lib/agw/shortcuteditor.py +2634 -0
  824. wx/lib/agw/speedmeter.py +1801 -0
  825. wx/lib/agw/supertooltip.py +1444 -0
  826. wx/lib/agw/thumbnailctrl.py +529 -0
  827. wx/lib/agw/toasterbox.py +1327 -0
  828. wx/lib/agw/ultimatelistctrl.py +13666 -0
  829. wx/lib/agw/xlsgrid.py +2113 -0
  830. wx/lib/agw/zoombar.py +1339 -0
  831. wx/lib/analogclock/__init__.py +140 -0
  832. wx/lib/analogclock/analogclock.py +631 -0
  833. wx/lib/analogclock/helpers.py +991 -0
  834. wx/lib/analogclock/lib_setup/__init__.py +0 -0
  835. wx/lib/analogclock/lib_setup/buttontreectrlpanel.py +297 -0
  836. wx/lib/analogclock/lib_setup/fontselect.py +57 -0
  837. wx/lib/analogclock/setup.py +490 -0
  838. wx/lib/analogclock/styles.py +47 -0
  839. wx/lib/anchors.py +103 -0
  840. wx/lib/art/__init__.py +4 -0
  841. wx/lib/art/flagart.py +1583 -0
  842. wx/lib/art/img2pyartprov.py +56 -0
  843. wx/lib/busy.py +146 -0
  844. wx/lib/buttons.py +1141 -0
  845. wx/lib/calendar.py +1597 -0
  846. wx/lib/checkbox.py +837 -0
  847. wx/lib/colourchooser/__init__.py +38 -0
  848. wx/lib/colourchooser/canvas.py +145 -0
  849. wx/lib/colourchooser/intl.py +24 -0
  850. wx/lib/colourchooser/pycolourbox.py +89 -0
  851. wx/lib/colourchooser/pycolourchooser.py +629 -0
  852. wx/lib/colourchooser/pycolourslider.py +100 -0
  853. wx/lib/colourchooser/pypalette.py +211 -0
  854. wx/lib/colourdb.py +740 -0
  855. wx/lib/colourselect.py +385 -0
  856. wx/lib/colourutils.py +118 -0
  857. wx/lib/combotreebox.py +944 -0
  858. wx/lib/delayedresult.py +420 -0
  859. wx/lib/dialogs.py +510 -0
  860. wx/lib/docview.py +3210 -0
  861. wx/lib/dragscroller.py +79 -0
  862. wx/lib/editor/README.txt +77 -0
  863. wx/lib/editor/__init__.py +24 -0
  864. wx/lib/editor/editor.py +974 -0
  865. wx/lib/editor/images.py +15 -0
  866. wx/lib/editor/selection.py +44 -0
  867. wx/lib/embeddedimage.py +76 -0
  868. wx/lib/eventStack.py +136 -0
  869. wx/lib/eventwatcher.py +440 -0
  870. wx/lib/evtmgr.py +521 -0
  871. wx/lib/expando.py +393 -0
  872. wx/lib/fancytext.py +505 -0
  873. wx/lib/filebrowsebutton.py +459 -0
  874. wx/lib/flashwin.py +262 -0
  875. wx/lib/flashwin_old.py +651 -0
  876. wx/lib/floatcanvas/FCEvents.py +53 -0
  877. wx/lib/floatcanvas/FCObjects.py +2923 -0
  878. wx/lib/floatcanvas/FloatCanvas.py +1027 -0
  879. wx/lib/floatcanvas/GUIMode.py +396 -0
  880. wx/lib/floatcanvas/NavCanvas.py +161 -0
  881. wx/lib/floatcanvas/Resources.py +319 -0
  882. wx/lib/floatcanvas/ScreenShot.py +1788 -0
  883. wx/lib/floatcanvas/Utilities/BBox.py +314 -0
  884. wx/lib/floatcanvas/Utilities/Colors.py +137 -0
  885. wx/lib/floatcanvas/Utilities/GUI.py +91 -0
  886. wx/lib/floatcanvas/Utilities/__init__.py +7 -0
  887. wx/lib/floatcanvas/__init__.py +124 -0
  888. wx/lib/foldmenu.py +89 -0
  889. wx/lib/gestures.py +310 -0
  890. wx/lib/gizmos/__init__.py +18 -0
  891. wx/lib/gizmos/dynamicsash.py +1202 -0
  892. wx/lib/gizmos/ledctrl.py +300 -0
  893. wx/lib/gizmos/treelistctrl.py +87 -0
  894. wx/lib/graphics.py +1939 -0
  895. wx/lib/gridmovers.py +511 -0
  896. wx/lib/iewin.py +249 -0
  897. wx/lib/iewin_old.py +894 -0
  898. wx/lib/imagebrowser.py +856 -0
  899. wx/lib/imageutils.py +163 -0
  900. wx/lib/infoframe.py +490 -0
  901. wx/lib/inspection.py +1255 -0
  902. wx/lib/intctrl.py +1001 -0
  903. wx/lib/itemspicker.py +256 -0
  904. wx/lib/langlistctrl.py +480 -0
  905. wx/lib/layoutf.py +271 -0
  906. wx/lib/masked/__init__.py +27 -0
  907. wx/lib/masked/combobox.py +839 -0
  908. wx/lib/masked/ctrl.py +108 -0
  909. wx/lib/masked/ipaddrctrl.py +242 -0
  910. wx/lib/masked/maskededit.py +7279 -0
  911. wx/lib/masked/numctrl.py +2001 -0
  912. wx/lib/masked/textctrl.py +465 -0
  913. wx/lib/masked/timectrl.py +1466 -0
  914. wx/lib/mixins/__init__.py +17 -0
  915. wx/lib/mixins/grid.py +47 -0
  916. wx/lib/mixins/gridlabelrenderer.py +251 -0
  917. wx/lib/mixins/imagelist.py +77 -0
  918. wx/lib/mixins/inspection.py +184 -0
  919. wx/lib/mixins/listctrl.py +894 -0
  920. wx/lib/mixins/rubberband.py +404 -0
  921. wx/lib/mixins/treemixin.py +678 -0
  922. wx/lib/msgpanel.py +95 -0
  923. wx/lib/multisash.py +747 -0
  924. wx/lib/myole4ax.idl +178 -0
  925. wx/lib/myole4ax.tlb +0 -0
  926. wx/lib/newevent.py +229 -0
  927. wx/lib/nvdlg.py +156 -0
  928. wx/lib/ogl/__init__.py +13 -0
  929. wx/lib/ogl/basic.py +3991 -0
  930. wx/lib/ogl/bmpshape.py +87 -0
  931. wx/lib/ogl/canvas.py +467 -0
  932. wx/lib/ogl/composit.py +1577 -0
  933. wx/lib/ogl/diagram.py +230 -0
  934. wx/lib/ogl/divided.py +483 -0
  935. wx/lib/ogl/drawn.py +900 -0
  936. wx/lib/ogl/lines.py +1811 -0
  937. wx/lib/ogl/oglmisc.py +608 -0
  938. wx/lib/pdfviewer/__init__.py +113 -0
  939. wx/lib/pdfviewer/bitmaps/ArrowLeft.png +0 -0
  940. wx/lib/pdfviewer/bitmaps/ArrowRight.png +0 -0
  941. wx/lib/pdfviewer/bitmaps/DirectionH.png +0 -0
  942. wx/lib/pdfviewer/bitmaps/DirectionV.png +0 -0
  943. wx/lib/pdfviewer/bitmaps/PlayerFirst.png +0 -0
  944. wx/lib/pdfviewer/bitmaps/PlayerLast.png +0 -0
  945. wx/lib/pdfviewer/bitmaps/PlayerNext.png +0 -0
  946. wx/lib/pdfviewer/bitmaps/PlayerPrev.png +0 -0
  947. wx/lib/pdfviewer/bitmaps/Printer.png +0 -0
  948. wx/lib/pdfviewer/bitmaps/ReadMe.txt +28 -0
  949. wx/lib/pdfviewer/bitmaps/Save.png +0 -0
  950. wx/lib/pdfviewer/bitmaps/ZoomIn.png +0 -0
  951. wx/lib/pdfviewer/bitmaps/ZoomOut.png +0 -0
  952. wx/lib/pdfviewer/bitmaps/encode_bitmaps.py +37 -0
  953. wx/lib/pdfviewer/buttonpanel.py +279 -0
  954. wx/lib/pdfviewer/images.py +240 -0
  955. wx/lib/pdfviewer/viewer.py +1077 -0
  956. wx/lib/pdfwin.py +295 -0
  957. wx/lib/pdfwin_old.py +789 -0
  958. wx/lib/platebtn.py +789 -0
  959. wx/lib/plot/CHANGELOG.md +150 -0
  960. wx/lib/plot/README.md +16 -0
  961. wx/lib/plot/__init__.py +46 -0
  962. wx/lib/plot/__main__.py +5 -0
  963. wx/lib/plot/examples/__init__.py +0 -0
  964. wx/lib/plot/examples/demo.py +1009 -0
  965. wx/lib/plot/examples/simple_example.py +54 -0
  966. wx/lib/plot/plotcanvas.py +2981 -0
  967. wx/lib/plot/polyobjects.py +1525 -0
  968. wx/lib/plot/utils.py +327 -0
  969. wx/lib/popupctl.py +250 -0
  970. wx/lib/printout.py +1157 -0
  971. wx/lib/progressindicator.py +151 -0
  972. wx/lib/pubsub/LICENSE_BSD_Simple.txt +23 -0
  973. wx/lib/pubsub/README_WxPython.txt +22 -0
  974. wx/lib/pubsub/RELEASE_NOTES.txt +71 -0
  975. wx/lib/pubsub/__init__.py +25 -0
  976. wx/lib/pubsub/core/__init__.py +92 -0
  977. wx/lib/pubsub/core/arg1/__init__.py +16 -0
  978. wx/lib/pubsub/core/arg1/listenerimpl.py +97 -0
  979. wx/lib/pubsub/core/arg1/publisher.py +40 -0
  980. wx/lib/pubsub/core/arg1/publishermixin.py +34 -0
  981. wx/lib/pubsub/core/arg1/topicargspecimpl.py +66 -0
  982. wx/lib/pubsub/core/arg1/topicmgrimpl.py +19 -0
  983. wx/lib/pubsub/core/callables.py +191 -0
  984. wx/lib/pubsub/core/imp2.py +63 -0
  985. wx/lib/pubsub/core/itopicdefnprovider.py +0 -0
  986. wx/lib/pubsub/core/kwargs/__init__.py +16 -0
  987. wx/lib/pubsub/core/kwargs/datamsg.py +27 -0
  988. wx/lib/pubsub/core/kwargs/listenerimpl.py +93 -0
  989. wx/lib/pubsub/core/kwargs/publisher.py +77 -0
  990. wx/lib/pubsub/core/kwargs/publishermixin.py +65 -0
  991. wx/lib/pubsub/core/kwargs/topicargspecimpl.py +217 -0
  992. wx/lib/pubsub/core/kwargs/topicmgrimpl.py +13 -0
  993. wx/lib/pubsub/core/listener.py +40 -0
  994. wx/lib/pubsub/core/listenerbase.py +185 -0
  995. wx/lib/pubsub/core/notificationmgr.py +185 -0
  996. wx/lib/pubsub/core/publisherbase.py +191 -0
  997. wx/lib/pubsub/core/topicargspec.py +77 -0
  998. wx/lib/pubsub/core/topicdefnprovider.py +632 -0
  999. wx/lib/pubsub/core/topicexc.py +72 -0
  1000. wx/lib/pubsub/core/topicmgr.py +456 -0
  1001. wx/lib/pubsub/core/topicobj.py +472 -0
  1002. wx/lib/pubsub/core/topictreetraverser.py +143 -0
  1003. wx/lib/pubsub/core/topicutils.py +118 -0
  1004. wx/lib/pubsub/core/treeconfig.py +21 -0
  1005. wx/lib/pubsub/core/validatedefnargs.py +29 -0
  1006. wx/lib/pubsub/core/weakmethod.py +102 -0
  1007. wx/lib/pubsub/policies.py +24 -0
  1008. wx/lib/pubsub/pub.py +199 -0
  1009. wx/lib/pubsub/py2and3.py +608 -0
  1010. wx/lib/pubsub/setuparg1.py +47 -0
  1011. wx/lib/pubsub/setupkwargs.py +29 -0
  1012. wx/lib/pubsub/utils/__init__.py +27 -0
  1013. wx/lib/pubsub/utils/exchandling.py +100 -0
  1014. wx/lib/pubsub/utils/misc.py +100 -0
  1015. wx/lib/pubsub/utils/notification.py +331 -0
  1016. wx/lib/pubsub/utils/topictreeprinter.py +195 -0
  1017. wx/lib/pubsub/utils/xmltopicdefnprovider.py +287 -0
  1018. wx/lib/pydocview.py +3300 -0
  1019. wx/lib/rcsizer.py +229 -0
  1020. wx/lib/resizewidget.py +357 -0
  1021. wx/lib/scrolledpanel.py +225 -0
  1022. wx/lib/sheet.py +350 -0
  1023. wx/lib/sized_controls.py +691 -0
  1024. wx/lib/softwareupdate.py +361 -0
  1025. wx/lib/splitter.py +925 -0
  1026. wx/lib/statbmp.py +199 -0
  1027. wx/lib/stattext.py +322 -0
  1028. wx/lib/throbber.py +425 -0
  1029. wx/lib/ticker.py +295 -0
  1030. wx/lib/ticker_xrc.py +48 -0
  1031. wx/lib/utils.py +89 -0
  1032. wx/lib/wordwrap.py +97 -0
  1033. wx/lib/wxcairo/__init__.py +124 -0
  1034. wx/lib/wxcairo/wx_cairocffi.py +200 -0
  1035. wx/lib/wxcairo/wx_pycairo.py +463 -0
  1036. wx/lib/wxpTag.py +274 -0
  1037. wx/locale/af/LC_MESSAGES/wxstd.mo +0 -0
  1038. wx/locale/an/LC_MESSAGES/wxstd.mo +0 -0
  1039. wx/locale/ar/LC_MESSAGES/wxstd.mo +0 -0
  1040. wx/locale/ca/LC_MESSAGES/wxstd.mo +0 -0
  1041. wx/locale/ca@valencia/LC_MESSAGES/wxstd.mo +0 -0
  1042. wx/locale/cs/LC_MESSAGES/wxstd.mo +0 -0
  1043. wx/locale/da/LC_MESSAGES/wxstd.mo +0 -0
  1044. wx/locale/de/LC_MESSAGES/wxstd.mo +0 -0
  1045. wx/locale/el/LC_MESSAGES/wxstd.mo +0 -0
  1046. wx/locale/es/LC_MESSAGES/wxstd.mo +0 -0
  1047. wx/locale/eu/LC_MESSAGES/wxstd.mo +0 -0
  1048. wx/locale/fa_IR/LC_MESSAGES/wxstd.mo +0 -0
  1049. wx/locale/fi/LC_MESSAGES/wxstd.mo +0 -0
  1050. wx/locale/fr/LC_MESSAGES/wxstd.mo +0 -0
  1051. wx/locale/gl_ES/LC_MESSAGES/wxstd.mo +0 -0
  1052. wx/locale/hi/LC_MESSAGES/wxstd.mo +0 -0
  1053. wx/locale/hr/LC_MESSAGES/wxstd.mo +0 -0
  1054. wx/locale/hu/LC_MESSAGES/wxstd.mo +0 -0
  1055. wx/locale/id/LC_MESSAGES/wxstd.mo +0 -0
  1056. wx/locale/it/LC_MESSAGES/wxstd.mo +0 -0
  1057. wx/locale/ja/LC_MESSAGES/wxstd.mo +0 -0
  1058. wx/locale/ka/LC_MESSAGES/wxstd.mo +0 -0
  1059. wx/locale/ko_KR/LC_MESSAGES/wxstd.mo +0 -0
  1060. wx/locale/lt/LC_MESSAGES/wxstd.mo +0 -0
  1061. wx/locale/lv/LC_MESSAGES/wxstd.mo +0 -0
  1062. wx/locale/ms/LC_MESSAGES/wxstd.mo +0 -0
  1063. wx/locale/nb/LC_MESSAGES/wxstd.mo +0 -0
  1064. wx/locale/ne/LC_MESSAGES/wxstd.mo +0 -0
  1065. wx/locale/nl/LC_MESSAGES/wxstd.mo +0 -0
  1066. wx/locale/pl/LC_MESSAGES/wxstd.mo +0 -0
  1067. wx/locale/pt/LC_MESSAGES/wxstd.mo +0 -0
  1068. wx/locale/pt_BR/LC_MESSAGES/wxstd.mo +0 -0
  1069. wx/locale/ro/LC_MESSAGES/wxstd.mo +0 -0
  1070. wx/locale/ru/LC_MESSAGES/wxstd.mo +0 -0
  1071. wx/locale/sk/LC_MESSAGES/wxstd.mo +0 -0
  1072. wx/locale/sl/LC_MESSAGES/wxstd.mo +0 -0
  1073. wx/locale/sq/LC_MESSAGES/wxstd.mo +0 -0
  1074. wx/locale/sv/LC_MESSAGES/wxstd.mo +0 -0
  1075. wx/locale/ta/LC_MESSAGES/wxstd.mo +0 -0
  1076. wx/locale/tr/LC_MESSAGES/wxstd.mo +0 -0
  1077. wx/locale/uk/LC_MESSAGES/wxstd.mo +0 -0
  1078. wx/locale/vi/LC_MESSAGES/wxstd.mo +0 -0
  1079. wx/locale/zh_CN/LC_MESSAGES/wxstd.mo +0 -0
  1080. wx/locale/zh_TW/LC_MESSAGES/wxstd.mo +0 -0
  1081. wx/media.py +27 -0
  1082. wx/media.pyi +223 -0
  1083. wx/msw.py +13 -0
  1084. wx/msw.pyi +65 -0
  1085. wx/propgrid.py +1451 -0
  1086. wx/propgrid.pyi +7914 -0
  1087. wx/py/CHANGES.txt +796 -0
  1088. wx/py/Py.ico +0 -0
  1089. wx/py/PyAlaCarte.py +34 -0
  1090. wx/py/PyAlaMode.py +34 -0
  1091. wx/py/PyAlaModeTest.py +33 -0
  1092. wx/py/PyCrust.ico +0 -0
  1093. wx/py/PyCrust.py +78 -0
  1094. wx/py/PyCrust_16.png +0 -0
  1095. wx/py/PyCrust_32.png +0 -0
  1096. wx/py/PyFilling.py +35 -0
  1097. wx/py/PyShell.py +78 -0
  1098. wx/py/PySlices.ico +0 -0
  1099. wx/py/PySlices.py +98 -0
  1100. wx/py/PySlicesShell.py +94 -0
  1101. wx/py/PySlices_16.png +0 -0
  1102. wx/py/PySlices_32.png +0 -0
  1103. wx/py/PyWrap.py +52 -0
  1104. wx/py/README.txt +77 -0
  1105. wx/py/__init__.py +20 -0
  1106. wx/py/buffer.py +136 -0
  1107. wx/py/crust.py +403 -0
  1108. wx/py/crustslices.py +403 -0
  1109. wx/py/dispatcher.py +259 -0
  1110. wx/py/document.py +37 -0
  1111. wx/py/editor.py +844 -0
  1112. wx/py/editwindow.py +299 -0
  1113. wx/py/filling.py +357 -0
  1114. wx/py/frame.py +978 -0
  1115. wx/py/images.py +212 -0
  1116. wx/py/interpreter.py +170 -0
  1117. wx/py/introspect.py +393 -0
  1118. wx/py/magic.py +98 -0
  1119. wx/py/parse.py +134 -0
  1120. wx/py/path.py +36 -0
  1121. wx/py/pseudo.py +99 -0
  1122. wx/py/shell.py +1588 -0
  1123. wx/py/sliceshell.py +3814 -0
  1124. wx/py/tests/test_interpreter.py +71 -0
  1125. wx/py/tests/test_introspect.py +862 -0
  1126. wx/py/tests/test_pseudo.py +70 -0
  1127. wx/py/tests/test_version.py +36 -0
  1128. wx/py/tests/testall.py +22 -0
  1129. wx/py/version.py +7 -0
  1130. wx/ribbon.py +45 -0
  1131. wx/ribbon.pyi +2494 -0
  1132. wx/richtext.py +142 -0
  1133. wx/richtext.pyi +12113 -0
  1134. wx/siplib.cp313-win_amd64.pyd +0 -0
  1135. wx/stc.py +58 -0
  1136. wx/stc.pyi +8463 -0
  1137. wx/svg/__init__.py +364 -0
  1138. wx/svg/_nanosvg.cp313-win_amd64.pyd +0 -0
  1139. wx/tools/__init__.py +18 -0
  1140. wx/tools/dbg.py +268 -0
  1141. wx/tools/genaxmodule.py +50 -0
  1142. wx/tools/helpviewer.py +92 -0
  1143. wx/tools/img2img.py +85 -0
  1144. wx/tools/img2png.py +54 -0
  1145. wx/tools/img2py.py +309 -0
  1146. wx/tools/img2xpm.py +54 -0
  1147. wx/tools/pywxrc.py +949 -0
  1148. wx/tools/wxget.py +254 -0
  1149. wx/tools/wxget_docs_demo.py +186 -0
  1150. wx/wxbase315u_net_vc140_x64.dll +0 -0
  1151. wx/wxbase315u_vc140_x64.dll +0 -0
  1152. wx/wxbase315u_xml_vc140_x64.dll +0 -0
  1153. wx/wxmsw315u_adv_vc140_x64.dll +0 -0
  1154. wx/wxmsw315u_aui_vc140_x64.dll +0 -0
  1155. wx/wxmsw315u_core_vc140_x64.dll +0 -0
  1156. wx/wxmsw315u_gl_vc140_x64.dll +0 -0
  1157. wx/wxmsw315u_html_vc140_x64.dll +0 -0
  1158. wx/wxmsw315u_media_vc140_x64.dll +0 -0
  1159. wx/wxmsw315u_propgrid_vc140_x64.dll +0 -0
  1160. wx/wxmsw315u_qa_vc140_x64.dll +0 -0
  1161. wx/wxmsw315u_ribbon_vc140_x64.dll +0 -0
  1162. wx/wxmsw315u_richtext_vc140_x64.dll +0 -0
  1163. wx/wxmsw315u_stc_vc140_x64.dll +0 -0
  1164. wx/wxmsw315u_webview_vc140_x64.dll +0 -0
  1165. wx/wxmsw315u_xrc_vc140_x64.dll +0 -0
  1166. wx/xml.py +15 -0
  1167. wx/xml.pyi +575 -0
  1168. wx/xrc.py +65 -0
  1169. wx/xrc.pyi +742 -0
  1170. wxPython_zombie-3.1.5.8.dist-info/LICENSE.txt +950 -0
  1171. wxPython_zombie-3.1.5.8.dist-info/METADATA +107 -0
  1172. wxPython_zombie-3.1.5.8.dist-info/RECORD +1175 -0
  1173. wxPython_zombie-3.1.5.8.dist-info/WHEEL +5 -0
  1174. wxPython_zombie-3.1.5.8.dist-info/entry_points.txt +2 -0
  1175. wxPython_zombie-3.1.5.8.dist-info/top_level.txt +1 -0
wx/lib/docview.py ADDED
@@ -0,0 +1,3210 @@
1
+ #----------------------------------------------------------------------------
2
+ # Name: docview.py
3
+ # Purpose: Port of the wxWindows docview classes
4
+ #
5
+ # Author: Peter Yared
6
+ #
7
+ # Created: 5/15/03
8
+ # Copyright: (c) 2003-2006 ActiveGrid, Inc. (Port of wxWindows classes by Julian Smart et al)
9
+ # License: wxWindows license
10
+ # Tags: phoenix-port, docs
11
+ #----------------------------------------------------------------------------
12
+
13
+
14
+ import os
15
+ import os.path
16
+ import shutil
17
+ import wx
18
+ import sys
19
+ from functools import cmp_to_key
20
+ _ = wx.GetTranslation
21
+
22
+
23
+ #----------------------------------------------------------------------
24
+ # docview globals
25
+ #----------------------------------------------------------------------
26
+
27
+ DOC_SDI = 1
28
+ DOC_MDI = 2
29
+ DOC_NEW = 4
30
+ DOC_SILENT = 8
31
+ DOC_OPEN_ONCE = 16
32
+ DOC_NO_VIEW = 32
33
+ DEFAULT_DOCMAN_FLAGS = DOC_SDI & DOC_OPEN_ONCE
34
+
35
+ TEMPLATE_VISIBLE = 1
36
+ TEMPLATE_INVISIBLE = 2
37
+ TEMPLATE_NO_CREATE = (4 | TEMPLATE_VISIBLE)
38
+ DEFAULT_TEMPLATE_FLAGS = TEMPLATE_VISIBLE
39
+
40
+ MAX_FILE_HISTORY = 9
41
+
42
+
43
+ #----------------------------------------------------------------------
44
+ # Convenience functions from wxWindows used in docview
45
+ #----------------------------------------------------------------------
46
+
47
+
48
+ def FileNameFromPath(path):
49
+ """
50
+ Returns the filename for a full path.
51
+ """
52
+ return os.path.split(path)[1]
53
+
54
+ def FindExtension(path):
55
+ """
56
+ Returns the extension of a filename for a full path.
57
+ """
58
+ return os.path.splitext(path)[1].lower()
59
+
60
+ def FileExists(path):
61
+ """
62
+ Returns True if the path exists.
63
+ """
64
+ return os.path.isfile(path)
65
+
66
+ def PathOnly(path):
67
+ """
68
+ Returns the path of a full path without the filename.
69
+ """
70
+ return os.path.split(path)[0]
71
+
72
+
73
+ #----------------------------------------------------------------------
74
+ # Document/View Classes
75
+ #----------------------------------------------------------------------
76
+
77
+
78
+ class Document(wx.EvtHandler):
79
+ """
80
+ The document class can be used to model an application's file-based data. It
81
+ is part of the document/view framework supported by wxWindows, and cooperates
82
+ with the :class:`View`, :class:`DocTemplate` and :class:`DocManager` classes.
83
+
84
+ Note this wxPython version also keeps track of the modification date of the
85
+ document and if it changes on disk outside of the application, we will warn the
86
+ user before saving to avoid clobbering the file.
87
+ """
88
+
89
+
90
+ def __init__(self, parent=None):
91
+ """
92
+ Constructor. Define your own default constructor to initialize
93
+ application-specific data.
94
+ """
95
+ wx.EvtHandler.__init__(self)
96
+
97
+ self._documentParent = parent
98
+ self._documentTemplate = None
99
+ self._commandProcessor = None
100
+ self._savedYet = False
101
+ self._writeable = True
102
+
103
+ self._documentTitle = None
104
+ self._documentFile = None
105
+ self._documentTypeName = None
106
+ self._documentModified = False
107
+ self._documentModificationDate = None
108
+ self._documentViews = []
109
+
110
+
111
+ def ProcessEvent(self, event):
112
+ """
113
+ Processes an event, searching event tables and calling zero or more
114
+ suitable event handler function(s). Note that the ProcessEvent
115
+ method is called from the wxPython docview framework directly since
116
+ wxPython does not have a virtual ProcessEvent function.
117
+ """
118
+ # TODO: ProcessEvent is virtual now, should this method just go away?
119
+ return False
120
+
121
+
122
+ def GetFilename(self):
123
+ """
124
+ Gets the filename associated with this document, or "" if none is
125
+ associated.
126
+ """
127
+ return self._documentFile
128
+
129
+
130
+ def GetTitle(self):
131
+ """
132
+ Gets the title for this document. The document title is used for an
133
+ associated frame (if any), and is usually constructed by the framework
134
+ from the filename.
135
+ """
136
+ return self._documentTitle
137
+
138
+
139
+ def SetTitle(self, title):
140
+ """
141
+ Sets the title for this document. The document title is used for an
142
+ associated frame (if any), and is usually constructed by the framework
143
+ from the filename.
144
+ """
145
+ self._documentTitle = title
146
+
147
+
148
+ def GetDocumentName(self):
149
+ """
150
+ The document type name given to the wxDocTemplate constructor,
151
+ copied to this document when the document is created. If several
152
+ document templates are created that use the same document type, this
153
+ variable is used in :meth:`DocManager.CreateView` to collate a list of
154
+ alternative view types that can be used on this kind of document.
155
+ """
156
+ return self._documentTypeName
157
+
158
+
159
+ def SetDocumentName(self, name):
160
+ """
161
+ Sets the document type name given to the :class:`DocTemplate` constructor,
162
+ copied to this document when the document is created. If several
163
+ document templates are created that use the same document type, this
164
+ variable is used in :meth:`DocManager.CreateView` to collate a list of
165
+ alternative view types that can be used on this kind of document. Do
166
+ not change the value of this variable.
167
+ """
168
+ self._documentTypeName = name
169
+
170
+
171
+ def GetDocumentSaved(self):
172
+ """
173
+ Returns True if the document has been saved.
174
+ """
175
+ return self._savedYet
176
+
177
+
178
+ def SetDocumentSaved(self, saved=True):
179
+ """
180
+ Sets whether the document has been saved.
181
+ """
182
+ self._savedYet = saved
183
+
184
+
185
+ def GetCommandProcessor(self):
186
+ """
187
+ Returns the command processor associated with this document.
188
+ """
189
+ return self._commandProcessor
190
+
191
+
192
+ def SetCommandProcessor(self, processor):
193
+ """
194
+ Sets the command processor to be used for this document. The document
195
+ will then be responsible for its deletion. Normally you should not
196
+ call this; override :meth:`OnCreateCommandProcessor` instead.
197
+ """
198
+ self._commandProcessor = processor
199
+
200
+
201
+ def IsModified(self):
202
+ """
203
+ Returns true if the document has been modified since the last save,
204
+ false otherwise. You may need to override this if your document view
205
+ maintains its own record of being modified (for example if using
206
+ wxTextWindow to view and edit the document).
207
+ """
208
+ return self._documentModified
209
+
210
+
211
+ def Modify(self, modify):
212
+ """
213
+ Call with true to mark the document as modified since the last save,
214
+ false otherwise. You may need to override this if your document view
215
+ maintains its own record of being modified (for example if using
216
+ :class:`wx.TextWindow` to view and edit the document).
217
+ This method has been extended to notify its views that the dirty
218
+ flag has changed.
219
+ """
220
+ self._documentModified = modify
221
+ self.UpdateAllViews(hint=("modify", self, self._documentModified))
222
+
223
+
224
+ def SetDocumentModificationDate(self):
225
+ """
226
+ Saves the file's last modification date.
227
+ This is used to check if the file has been modified outside of
228
+ the application.
229
+ """
230
+ self._documentModificationDate = os.path.getmtime(self.GetFilename())
231
+
232
+
233
+ def GetDocumentModificationDate(self):
234
+ """
235
+ Returns the file's modification date when it was loaded from disk.
236
+ This is used to check if the file has been modified outside of the application.
237
+ """
238
+ return self._documentModificationDate
239
+
240
+
241
+ def IsDocumentModificationDateCorrect(self):
242
+ """
243
+ Returns False if the file has been modified outside of the application.
244
+ """
245
+ if not os.path.exists(self.GetFilename()): # document must be in memory only and can't be out of date
246
+ return True
247
+ return self._documentModificationDate == os.path.getmtime(self.GetFilename())
248
+
249
+
250
+ def GetViews(self):
251
+ """
252
+ Returns the list whose elements are the views on the document.
253
+ """
254
+ return self._documentViews
255
+
256
+
257
+ def GetDocumentTemplate(self):
258
+ """
259
+ Returns the template that created the document.
260
+ """
261
+ return self._documentTemplate
262
+
263
+
264
+ def SetDocumentTemplate(self, template):
265
+ """
266
+ Sets the template that created the document. Should only be called by
267
+ the framework.
268
+ """
269
+ self._documentTemplate = template
270
+
271
+
272
+ def DeleteContents(self):
273
+ """
274
+ Deletes the contents of the document. Override this method as
275
+ necessary.
276
+ """
277
+ return True
278
+
279
+
280
+ def Destroy(self):
281
+ """
282
+ Destructor. Removes itself from the document manager.
283
+ """
284
+ self.DeleteContents()
285
+ self._documentModificationDate = None
286
+ if self.GetDocumentManager():
287
+ self.GetDocumentManager().RemoveDocument(self)
288
+ wx.EvtHandler.Destroy(self)
289
+
290
+
291
+ def Close(self):
292
+ """
293
+ Closes the document, by calling :meth:`OnSaveModified` and then (if this true)
294
+ :meth:`OnCloseDocument`. This does not normally delete the document object:
295
+ use :meth:`DeleteAllViews` to do this implicitly.
296
+ """
297
+ if self.OnSaveModified():
298
+ if self.OnCloseDocument():
299
+ return True
300
+ else:
301
+ return False
302
+ else:
303
+ return False
304
+
305
+
306
+ def OnCloseDocument(self):
307
+ """
308
+ The default implementation calls :meth:`DeleteContents` (an empty
309
+ implementation) sets the modified flag to false. Override this to
310
+ supply additional behaviour when the document is closed with Close.
311
+ """
312
+ self.NotifyClosing()
313
+ self.DeleteContents()
314
+ self.Modify(False)
315
+ return True
316
+
317
+
318
+ def DeleteAllViews(self):
319
+ """
320
+ Calls :meth:`View.Close` and deletes each view. Deleting the final view will
321
+ implicitly delete the document itself, because the wxView destructor
322
+ calls RemoveView. This in turn calls :meth:`Document.OnChangedViewList`,
323
+ whose default implemention is to save and delete the document if no
324
+ views exist.
325
+ """
326
+ manager = self.GetDocumentManager()
327
+ for view in self._documentViews:
328
+ if not view.Close():
329
+ return False
330
+ if self in manager.GetDocuments():
331
+ self.Destroy()
332
+ return True
333
+
334
+
335
+ def GetFirstView(self):
336
+ """
337
+ A convenience function to get the first view for a document, because
338
+ in many cases a document will only have a single view.
339
+ """
340
+ if len(self._documentViews) == 0:
341
+ return None
342
+ return self._documentViews[0]
343
+
344
+
345
+ def GetDocumentManager(self):
346
+ """
347
+ Returns the associated document manager.
348
+ """
349
+ if self._documentTemplate:
350
+ return self._documentTemplate.GetDocumentManager()
351
+ return None
352
+
353
+
354
+ def OnNewDocument(self):
355
+ """
356
+ The default implementation calls OnSaveModified and DeleteContents,
357
+ makes a default title for the document, and notifies the views that
358
+ the filename (in fact, the title) has changed.
359
+ """
360
+ if not self.OnSaveModified() or not self.OnCloseDocument():
361
+ return False
362
+ self.DeleteContents()
363
+ self.Modify(False)
364
+ self.SetDocumentSaved(False)
365
+ name = self.GetDocumentManager().MakeDefaultName()
366
+ self.SetTitle(name)
367
+ self.SetFilename(name, notifyViews = True)
368
+
369
+
370
+ def Save(self):
371
+ """
372
+ Saves the document by calling :meth:`OnSaveDocument` if there is an
373
+ associated filename, or :meth:`SaveAs` if there is no filename.
374
+ """
375
+ if not self.IsModified(): # and self._savedYet: This was here, but if it is not modified who cares if it hasn't been saved yet?
376
+ return True
377
+
378
+ """ check for file modification outside of application """
379
+ if not self.IsDocumentModificationDateCorrect():
380
+ msgTitle = wx.GetApp().GetAppName()
381
+ if not msgTitle:
382
+ msgTitle = _("Application")
383
+ res = wx.MessageBox(_("'%s' has been modified outside of %s. Overwrite '%s' with current changes?") % (self.GetPrintableName(), msgTitle, self.GetPrintableName()),
384
+ msgTitle,
385
+ wx.YES_NO | wx.CANCEL | wx.ICON_QUESTION,
386
+ self.GetDocumentWindow())
387
+
388
+ if res == wx.NO:
389
+ return True
390
+ elif res == wx.YES:
391
+ pass
392
+ else: # elif res == wx.CANCEL:
393
+ return False
394
+
395
+ if not self._documentFile or not self._savedYet:
396
+ return self.SaveAs()
397
+ return self.OnSaveDocument(self._documentFile)
398
+
399
+
400
+ def SaveAs(self):
401
+ """
402
+ Prompts the user for a file to save to, and then calls :meth:`OnSaveDocument`.
403
+ """
404
+ docTemplate = self.GetDocumentTemplate()
405
+ if not docTemplate:
406
+ return False
407
+
408
+ descr = docTemplate.GetDescription() + _(" (") + docTemplate.GetFileFilter() + _(") |") + docTemplate.GetFileFilter() # spacing is important, make sure there is no space after the "|", it causes a bug on wx_gtk
409
+ filename = wx.FileSelector(_("Save As"),
410
+ docTemplate.GetDirectory(),
411
+ FileNameFromPath(self.GetFilename()),
412
+ docTemplate.GetDefaultExtension(),
413
+ wildcard = descr,
414
+ flags = wx.FD_SAVE | wx.FD_OVERWRITE_PROMPT,
415
+ parent = self.GetDocumentWindow())
416
+ if filename == "":
417
+ return False
418
+
419
+ name, ext = os.path.splitext(filename)
420
+ if ext == "":
421
+ filename += '.' + docTemplate.GetDefaultExtension()
422
+
423
+ self.SetFilename(filename)
424
+ self.SetTitle(FileNameFromPath(filename))
425
+
426
+ for view in self._documentViews:
427
+ view.OnChangeFilename()
428
+
429
+ if not self.OnSaveDocument(filename):
430
+ return False
431
+
432
+ if docTemplate.FileMatchesTemplate(filename):
433
+ self.GetDocumentManager().AddFileToHistory(filename)
434
+
435
+ return True
436
+
437
+
438
+ def OnSaveDocument(self, filename):
439
+ """
440
+ Constructs an output file for the given filename (which must
441
+ not be empty), and calls :meth:`SaveObject`. If :meth:`SaveObject`
442
+ returns true, the document is set to unmodified; otherwise, an
443
+ error message box is displayed.
444
+ """
445
+ if not filename:
446
+ return False
447
+
448
+ msgTitle = wx.GetApp().GetAppName()
449
+ if not msgTitle:
450
+ msgTitle = _("File Error")
451
+
452
+ backupFilename = None
453
+ fileObject = None
454
+ copied = False
455
+ try:
456
+ # if current file exists, move it to a safe place temporarily
457
+ if os.path.exists(filename):
458
+
459
+ # Check if read-only.
460
+ if not os.access(filename, os.W_OK):
461
+ wx.MessageBox("Could not save '%s'. No write permission to overwrite existing file." % FileNameFromPath(filename),
462
+ msgTitle,
463
+ wx.OK | wx.ICON_EXCLAMATION,
464
+ self.GetDocumentWindow())
465
+ return False
466
+
467
+ i = 1
468
+ backupFilename = "%s.bak%s" % (filename, i)
469
+ while os.path.exists(backupFilename):
470
+ i += 1
471
+ backupFilename = "%s.bak%s" % (filename, i)
472
+ shutil.copy(filename, backupFilename)
473
+ copied = True
474
+
475
+ fileObject = file(filename, 'w')
476
+ self.SaveObject(fileObject)
477
+ fileObject.close()
478
+ fileObject = None
479
+
480
+ if backupFilename:
481
+ os.remove(backupFilename)
482
+ except:
483
+ # for debugging purposes
484
+ import traceback
485
+ traceback.print_exc()
486
+
487
+ if fileObject:
488
+ fileObject.close() # file is still open, close it, need to do this before removal
489
+
490
+ # save failed, remove copied file
491
+ if backupFilename and copied:
492
+ os.remove(backupFilename)
493
+
494
+ wx.MessageBox("Could not save '%s'. %s" % (FileNameFromPath(filename), sys.exc_value),
495
+ msgTitle,
496
+ wx.OK | wx.ICON_EXCLAMATION,
497
+ self.GetDocumentWindow())
498
+ return False
499
+
500
+ self.SetDocumentModificationDate()
501
+ self.SetFilename(filename, True)
502
+ self.Modify(False)
503
+ self.SetDocumentSaved(True)
504
+ #if wx.Platform == '__WXMAC__': # Not yet implemented in wxPython
505
+ # wx.FileName(file).MacSetDefaultTypeAndCreator()
506
+ return True
507
+
508
+
509
+ def OnOpenDocument(self, filename):
510
+ """
511
+ Constructs an input file for the given filename (which must not
512
+ be empty), and calls :meth:`LoadObject`. If LoadObject returns true, the
513
+ document is set to unmodified; otherwise, an error message box is
514
+ displayed. The document's views are notified that the filename has
515
+ changed, to give windows an opportunity to update their titles. All of
516
+ the document's views are then updated.
517
+ """
518
+ if not self.OnSaveModified():
519
+ return False
520
+
521
+ msgTitle = wx.GetApp().GetAppName()
522
+ if not msgTitle:
523
+ msgTitle = _("File Error")
524
+
525
+ fileObject = file(filename, 'r')
526
+ try:
527
+ self.LoadObject(fileObject)
528
+ fileObject.close()
529
+ fileObject = None
530
+ except:
531
+ # for debugging purposes
532
+ import traceback
533
+ traceback.print_exc()
534
+
535
+ if fileObject:
536
+ fileObject.close() # file is still open, close it
537
+
538
+ wx.MessageBox("Could not open '%s'. %s" % (FileNameFromPath(filename), sys.exc_value),
539
+ msgTitle,
540
+ wx.OK | wx.ICON_EXCLAMATION,
541
+ self.GetDocumentWindow())
542
+ return False
543
+
544
+ self.SetDocumentModificationDate()
545
+ self.SetFilename(filename, True)
546
+ self.Modify(False)
547
+ self.SetDocumentSaved(True)
548
+ self.UpdateAllViews()
549
+ return True
550
+
551
+
552
+ def LoadObject(self, file):
553
+ """
554
+ Override this function and call it from your own ``LoadObject`` before
555
+ loading your own data. ``LoadObject`` is called by the framework
556
+ automatically when the document contents need to be loaded.
557
+
558
+ Note that the wxPython version simply sends you a Python file object,
559
+ so you can use pickle.
560
+ """
561
+ return True
562
+
563
+
564
+ def SaveObject(self, file):
565
+ """
566
+ Override this function and call it from your own ``SaveObject`` before
567
+ saving your own data. ``SaveObject`` is called by the framework
568
+ automatically when the document contents need to be saved.
569
+
570
+ Note that the wxPython version simply sends you a Python file object,
571
+ so you can use pickle.
572
+ """
573
+ return True
574
+
575
+
576
+ def Revert(self):
577
+ """
578
+ Override this function to revert the document to its last saved state.
579
+ """
580
+ return False
581
+
582
+
583
+ def GetPrintableName(self):
584
+ """
585
+ Copies a suitable document name into the supplied name buffer.
586
+ The default function uses the title, or if there is no title, uses the
587
+ filename; or if no filename, the string 'Untitled'.
588
+ """
589
+ if self._documentTitle:
590
+ return self._documentTitle
591
+ elif self._documentFile:
592
+ return FileNameFromPath(self._documentFile)
593
+ else:
594
+ return _("Untitled")
595
+
596
+
597
+ def GetDocumentWindow(self):
598
+ """
599
+ Intended to return a suitable window for using as a parent for
600
+ document-related dialog boxes. By default, uses the frame associated
601
+ with the first view.
602
+ """
603
+ if len(self._documentViews) > 0:
604
+ return self._documentViews[0].GetFrame()
605
+ else:
606
+ return wx.GetApp().GetTopWindow()
607
+
608
+
609
+ def OnCreateCommandProcessor(self):
610
+ """
611
+ Override this function if you want a different (or no) command
612
+ processor to be created when the document is created. By default, it
613
+ returns an instance of :class:`CommandProcessor`.
614
+ """
615
+ return CommandProcessor()
616
+
617
+
618
+ def OnSaveModified(self):
619
+ """
620
+ If the document has been modified, prompts the user to ask if the
621
+ changes should be changed. If the user replies Yes, the Save function
622
+ is called. If No, the document is marked as unmodified and the
623
+ function succeeds. If Cancel, the function fails.
624
+ """
625
+ if not self.IsModified():
626
+ return True
627
+
628
+ """ check for file modification outside of application """
629
+ if not self.IsDocumentModificationDateCorrect():
630
+ msgTitle = wx.GetApp().GetAppName()
631
+ if not msgTitle:
632
+ msgTitle = _("Warning")
633
+ res = wx.MessageBox(_("'%s' has been modified outside of %s. Overwrite '%s' with current changes?") % (self.GetPrintableName(), msgTitle, self.GetPrintableName()),
634
+ msgTitle,
635
+ wx.YES_NO | wx.CANCEL | wx.ICON_QUESTION,
636
+ self.GetDocumentWindow())
637
+
638
+ if res == wx.NO:
639
+ self.Modify(False)
640
+ return True
641
+ elif res == wx.YES:
642
+ return wx.lib.docview.Document.Save(self)
643
+ else: # elif res == wx.CANCEL:
644
+ return False
645
+
646
+ msgTitle = wx.GetApp().GetAppName()
647
+ if not msgTitle:
648
+ msgTitle = _("Warning")
649
+
650
+ res = wx.MessageBox(_("Save changes to '%s'?") % self.GetPrintableName(),
651
+ msgTitle,
652
+ wx.YES_NO | wx.CANCEL | wx.ICON_QUESTION,
653
+ self.GetDocumentWindow())
654
+
655
+ if res == wx.NO:
656
+ self.Modify(False)
657
+ return True
658
+ elif res == wx.YES:
659
+ return self.Save()
660
+ else: # elif res == wx.CANCEL:
661
+ return False
662
+
663
+
664
+ def Draw(context):
665
+ """
666
+ Called by printing framework to draw the view.
667
+ """
668
+ return True
669
+
670
+
671
+ def AddView(self, view):
672
+ """
673
+ If the view is not already in the list of views, adds the view and
674
+ calls :meth:`OnChangedViewList`.
675
+ """
676
+ if not view in self._documentViews:
677
+ self._documentViews.append(view)
678
+ self.OnChangedViewList()
679
+ return True
680
+
681
+
682
+ def RemoveView(self, view):
683
+ """
684
+ Removes the view from the document's list of views, and calls
685
+ :meth:`OnChangedViewList`.
686
+ """
687
+ if view in self._documentViews:
688
+ self._documentViews.remove(view)
689
+ self.OnChangedViewList()
690
+ return True
691
+
692
+
693
+ def OnCreate(self, path, flags):
694
+ """
695
+ The default implementation calls :meth:`DeleteContents` (an empty
696
+ implementation) sets the modified flag to false. Override this to
697
+ supply additional behaviour when the document is opened with Open.
698
+ """
699
+ if flags & DOC_NO_VIEW:
700
+ return True
701
+ return self.GetDocumentTemplate().CreateView(self, flags)
702
+
703
+
704
+ def OnChangedViewList(self):
705
+ """
706
+ Called when a view is added to or deleted from this document. The
707
+ default implementation saves and deletes the document if no views
708
+ exist (the last one has just been removed).
709
+ """
710
+ if len(self._documentViews) == 0:
711
+ if self.OnSaveModified():
712
+ pass # C version does a delete but Python will garbage collect
713
+
714
+
715
+ def UpdateAllViews(self, sender = None, hint = None):
716
+ """
717
+ Updates all views. If sender is non-NULL, does not update this view.
718
+ hint represents optional information to allow a view to optimize its
719
+ update.
720
+ """
721
+ for view in self._documentViews:
722
+ if view != sender:
723
+ view.OnUpdate(sender, hint)
724
+
725
+
726
+ def NotifyClosing(self):
727
+ """
728
+ Notifies the views that the document is going to close.
729
+ """
730
+ for view in self._documentViews:
731
+ view.OnClosingDocument()
732
+
733
+
734
+ def SetFilename(self, filename, notifyViews = False):
735
+ """
736
+ Sets the filename for this document. Usually called by the framework.
737
+ If notifyViews is true, :meth:`View.OnChangeFilename` is called for all
738
+ views.
739
+ """
740
+ self._documentFile = filename
741
+ if notifyViews:
742
+ for view in self._documentViews:
743
+ view.OnChangeFilename()
744
+
745
+
746
+ def GetWriteable(self):
747
+ """
748
+ Returns true if the document can be written to its accociated file path.
749
+ """
750
+ if not self._writeable:
751
+ return False
752
+ if not self._documentFile: # Doesn't exist, do a save as
753
+ return True
754
+ else:
755
+ return os.access(self._documentFile, os.W_OK)
756
+
757
+
758
+ def SetWriteable(self, writeable):
759
+ """
760
+ Set to False if the document can not be saved. This will disable the
761
+ ``ID_SAVE_AS`` event and is useful for custom documents that should
762
+ not be saveable. The ``ID_SAVE`` event can be disabled by never
763
+ modifying the document.
764
+ """
765
+ self._writeable = writeable
766
+
767
+
768
+ class View(wx.EvtHandler):
769
+ """
770
+ The view class can be used to model the viewing and editing component of
771
+ an application's file-based data. It is part of the document/view
772
+ framework supported by wxWindows, and cooperates with the :class:`Document`,
773
+ :class:`DocTemplate` and :class:`DocManager` classes.
774
+ """
775
+
776
+ def __init__(self):
777
+ """
778
+ Constructor. Define your own default constructor to initialize
779
+ application-specific data.
780
+ """
781
+ wx.EvtHandler.__init__(self)
782
+ self._viewDocument = None
783
+ self._viewFrame = None
784
+
785
+
786
+ def Destroy(self):
787
+ """
788
+ Destructor. Removes itself from the document's list of views.
789
+ """
790
+ if self._viewDocument:
791
+ self._viewDocument.RemoveView(self)
792
+ wx.EvtHandler.Destroy(self)
793
+
794
+
795
+ def ProcessEvent(self, event):
796
+ """
797
+ Processes an event, searching event tables and calling zero or more
798
+ suitable event handler function(s).
799
+ """
800
+ if not self.GetDocument() or not self.GetDocument().ProcessEvent(event):
801
+ return False
802
+ else:
803
+ return True
804
+
805
+
806
+ def ProcessUpdateUIEvent(self, event):
807
+ """
808
+ Processes a UI event, searching event tables and calling zero or more
809
+ suitable event handler function(s).
810
+ """
811
+ return False
812
+
813
+
814
+ def OnActivateView(self, activate, activeView, deactiveView):
815
+ """
816
+ Called when a view is activated by means of :meth:`View.Activate`. The
817
+ default implementation does nothing.
818
+ """
819
+ pass
820
+
821
+
822
+ def OnClosingDocument(self):
823
+ """
824
+ Override this to clean up the view when the document is being closed.
825
+ The default implementation does nothing.
826
+ """
827
+ pass
828
+
829
+
830
+ def OnDraw(self, dc):
831
+ """
832
+ Override this to draw the view for the printing framework. The
833
+ default implementation does nothing.
834
+ """
835
+ pass
836
+
837
+
838
+ def OnPrint(self, dc, info):
839
+ """
840
+ Override this to print the view for the printing framework. The
841
+ default implementation calls :meth:`View.OnDraw`.
842
+ """
843
+ self.OnDraw(dc)
844
+
845
+
846
+ def OnUpdate(self, sender, hint):
847
+ """
848
+ Called when the view should be updated. sender is a pointer to the
849
+ view that sent the update request, or None if no single view requested
850
+ the update (for instance, when the document is opened). hint is as yet
851
+ unused but may in future contain application-specific information for
852
+ making updating more efficient.
853
+ """
854
+ if hint:
855
+ if hint[0] == "modify": # if dirty flag changed, update the view's displayed title
856
+ frame = self.GetFrame()
857
+ if frame and hasattr(frame, "OnTitleIsModified"):
858
+ frame.OnTitleIsModified()
859
+ return True
860
+ return False
861
+
862
+
863
+ def OnChangeFilename(self):
864
+ """
865
+ Called when the filename has changed. The default implementation
866
+ constructs a suitable title and sets the title of the view frame (if
867
+ any).
868
+ """
869
+ if self.GetFrame():
870
+ appName = wx.GetApp().GetAppName()
871
+ if not self.GetDocument():
872
+ if appName:
873
+ title = appName
874
+ else:
875
+ return
876
+ else:
877
+ if appName and isinstance(self.GetFrame(), DocChildFrame): # Only need app name in title for SDI
878
+ title = appName + _(" - ")
879
+ else:
880
+ title = ''
881
+ self.GetFrame().SetTitle(title + self.GetDocument().GetPrintableName())
882
+
883
+
884
+ def GetDocument(self):
885
+ """
886
+ Returns the document associated with the view.
887
+ """
888
+ return self._viewDocument
889
+
890
+
891
+ def SetDocument(self, doc):
892
+ """
893
+ Associates the given document with the view. Normally called by the
894
+ framework.
895
+ """
896
+ self._viewDocument = doc
897
+ if doc:
898
+ doc.AddView(self)
899
+
900
+
901
+ def GetViewName(self):
902
+ """
903
+ Gets the name associated with the view (passed to the :class:`DocTemplate`
904
+ constructor). Not currently used by the framework.
905
+ """
906
+ return self._viewTypeName
907
+
908
+
909
+ def SetViewName(self, name):
910
+ """
911
+ Sets the view type name. Should only be called by the framework.
912
+ """
913
+ self._viewTypeName = name
914
+
915
+
916
+ def Close(self, deleteWindow=True):
917
+ """
918
+ Closes the view by calling :meth:`OnClose`. If deleteWindow is true, this
919
+ function should delete the window associated with the view.
920
+ """
921
+ if self.OnClose(deleteWindow = deleteWindow):
922
+ return True
923
+ else:
924
+ return False
925
+
926
+
927
+ def Activate(self, activate=True):
928
+ """
929
+ Call this from your view frame's ``OnActivate`` member to tell the
930
+ framework which view is currently active. If your windowing system
931
+ doesn't call ``OnActivate``, you may need to call this function from
932
+ OnMenuCommand or any place where you know the view must be active, and
933
+ the framework will need to get the current view.
934
+
935
+ The prepackaged view frame :class:`DocChildFrame` calls ``View.Activate` from
936
+ its ``OnActivate`` member and from its ``OnMenuCommand`` member.
937
+ """
938
+ if self.GetDocument() and self.GetDocumentManager():
939
+ self.OnActivateView(activate, self, self.GetDocumentManager().GetCurrentView())
940
+ self.GetDocumentManager().ActivateView(self, activate)
941
+
942
+
943
+ def OnClose(self, deleteWindow=True):
944
+ """
945
+ Implements closing behaviour. The default implementation calls
946
+ :meth:`Document.Close` to close the associated document. Does not delete the
947
+ view. The application may wish to do some cleaning up operations in
948
+ this function, if a call to :meth:`Document::Close` succeeded. For example,
949
+ if your application's all share the same window, you need to
950
+ disassociate the window from the view and perhaps clear the window. If
951
+ deleteWindow is true, delete the frame associated with the view.
952
+ """
953
+ if self.GetDocument():
954
+ return self.GetDocument().Close()
955
+ else:
956
+ return True
957
+
958
+
959
+ def OnCreate(self, doc, flags):
960
+ """
961
+ :class:`DocManager` or :class:`Document` creates a :class:`View` via
962
+ a :class:`DocTemplate`. Just after the :class:`DocTemplate` creates
963
+ the :class:`View`, it calls :meth:`xView.OnCreate`. In its ``OnCreate``
964
+ member function, the ``View`` can create a :class:`DocChildFrame` or
965
+ a derived class. This :class:`DocChildFrame` provides user
966
+ interface elements to view and/or edit the contents of the wxDocument.
967
+
968
+ By default, simply returns true. If the function returns false, the
969
+ view will be deleted.
970
+ """
971
+ return True
972
+
973
+
974
+ def OnCreatePrintout(self):
975
+ """
976
+ Returns a :class:`wx.Printout` object for the purposes of printing. It
977
+ should create a new object every time it is called; the framework will delete
978
+ objects it creates.
979
+
980
+ By default, this function returns an instance of :class:`DocPrintout`, which
981
+ prints and previews one page by calling :meth:`View.OnDraw`.
982
+
983
+ Override to return an instance of a class other than :class:`DocPrintout`.
984
+ """
985
+ return DocPrintout(self, self.GetDocument().GetPrintableName())
986
+
987
+
988
+ def GetFrame(self):
989
+ """
990
+ Gets the frame associated with the view (if any). Note that this
991
+ "frame" is not a :class:`wx.Frame` at all in the generic MDI implementation
992
+ which uses the notebook pages instead of the frames and this is why
993
+ this method returns a :class:`wx.Window` and not a :class:`wx.Frame`.
994
+ """
995
+ return self._viewFrame
996
+
997
+
998
+ def SetFrame(self, frame):
999
+ """
1000
+ Sets the frame associated with this view. The application should call
1001
+ this if possible, to tell the view about the frame. See :meth:`GetFrame`
1002
+ for the explanation about the mismatch between the "Frame" in the method
1003
+ name and the type of its parameter.
1004
+ """
1005
+ self._viewFrame = frame
1006
+
1007
+
1008
+ def GetDocumentManager(self):
1009
+ """
1010
+ Returns the document manager instance associated with this view.
1011
+ """
1012
+ if self._viewDocument:
1013
+ return self.GetDocument().GetDocumentManager()
1014
+ else:
1015
+ return None
1016
+
1017
+
1018
+ class DocTemplate(wx.Object):
1019
+ """
1020
+ The :class:`DocTemplate` class is used to model the relationship between a
1021
+ document class and a view class.
1022
+ """
1023
+
1024
+
1025
+ def __init__(self, manager, description, filter, dir, ext, docTypeName, viewTypeName, docType, viewType, flags=DEFAULT_TEMPLATE_FLAGS, icon=None):
1026
+ """
1027
+ Constructor. Create instances dynamically near the start of your
1028
+ application after creating a wxDocManager instance, and before doing
1029
+ any document or view operations.
1030
+
1031
+ manager is the document manager object which manages this template.
1032
+
1033
+ description is a short description of what the template is for. This
1034
+ string will be displayed in the file filter list of Windows file
1035
+ selectors.
1036
+
1037
+ filter is an appropriate file filter such as \*.txt.
1038
+
1039
+ dir is the default directory to use for file selectors.
1040
+
1041
+ ext is the default file extension (such as txt).
1042
+
1043
+ docTypeName is a name that should be unique for a given type of
1044
+ document, used for gathering a list of views relevant to a
1045
+ particular document.
1046
+
1047
+ viewTypeName is a name that should be unique for a given view.
1048
+
1049
+ docClass is a Python class. If this is not supplied, you will need to
1050
+ derive a new wxDocTemplate class and override the CreateDocument
1051
+ member to return a new document instance on demand.
1052
+
1053
+ viewClass is a Python class. If this is not supplied, you will need to
1054
+ derive a new wxDocTemplate class and override the CreateView member to
1055
+ return a new view instance on demand.
1056
+
1057
+ flags is a bit list of the following:
1058
+ ``TEMPLATE_VISIBLE``: The template may be displayed to the user in
1059
+ dialogs.
1060
+
1061
+ ``TEMPLATE_INVISIBLE``: The template may not be displayed to the user in
1062
+ dialogs.
1063
+
1064
+ ``DEFAULT_TEMPLATE_FLAGS``: Defined as ``TEMPLATE_VISIBLE``.
1065
+ """
1066
+ self._docManager = manager
1067
+ self._description = description
1068
+ self._fileFilter = filter
1069
+ self._directory = dir
1070
+ self._defaultExt = ext
1071
+ self._docTypeName = docTypeName
1072
+ self._viewTypeName = viewTypeName
1073
+ self._docType = docType
1074
+ self._viewType = viewType
1075
+ self._flags = flags
1076
+ self._icon = icon
1077
+
1078
+ self._docManager.AssociateTemplate(self)
1079
+
1080
+
1081
+ def GetDefaultExtension(self):
1082
+ """
1083
+ Returns the default file extension for the document data, as passed to
1084
+ the document template constructor.
1085
+ """
1086
+ return self._defaultExt
1087
+
1088
+
1089
+ def SetDefaultExtension(self, defaultExt):
1090
+ """
1091
+ Sets the default file extension.
1092
+ """
1093
+ self._defaultExt = defaultExt
1094
+
1095
+
1096
+ def GetDescription(self):
1097
+ """
1098
+ Returns the text description of this template, as passed to the
1099
+ document template constructor.
1100
+ """
1101
+ return self._description
1102
+
1103
+
1104
+ def SetDescription(self, description):
1105
+ """
1106
+ Sets the template description.
1107
+ """
1108
+ self._description = description
1109
+
1110
+
1111
+ def GetDirectory(self):
1112
+ """
1113
+ Returns the default directory, as passed to the document template
1114
+ constructor.
1115
+ """
1116
+ return self._directory
1117
+
1118
+
1119
+ def SetDirectory(self, dir):
1120
+ """
1121
+ Sets the default directory.
1122
+ """
1123
+ self._directory = dir
1124
+
1125
+
1126
+ def GetDocumentManager(self):
1127
+ """
1128
+ Returns the document manager instance for which this template was
1129
+ created.
1130
+ """
1131
+ return self._docManager
1132
+
1133
+
1134
+ def SetDocumentManager(self, manager):
1135
+ """
1136
+ Sets the document manager instance for which this template was
1137
+ created. Should not be called by the application.
1138
+ """
1139
+ self._docManager = manager
1140
+
1141
+
1142
+ def GetFileFilter(self):
1143
+ """
1144
+ Returns the file filter, as passed to the document template
1145
+ constructor.
1146
+ """
1147
+ return self._fileFilter
1148
+
1149
+
1150
+ def SetFileFilter(self, filter):
1151
+ """
1152
+ Sets the file filter.
1153
+ """
1154
+ self._fileFilter = filter
1155
+
1156
+
1157
+ def GetFlags(self):
1158
+ """
1159
+ Returns the flags, as passed to the document template constructor.
1160
+ (see the constructor description for more details).
1161
+ """
1162
+ return self._flags
1163
+
1164
+
1165
+ def SetFlags(self, flags):
1166
+ """
1167
+ Sets the internal document template flags (see the constructor
1168
+ description for more details).
1169
+ """
1170
+ self._flags = flags
1171
+
1172
+
1173
+ def GetIcon(self):
1174
+ """
1175
+ Returns the icon, as passed to the document template
1176
+ constructor.
1177
+ """
1178
+ return self._icon
1179
+
1180
+
1181
+ def SetIcon(self, flags):
1182
+ """
1183
+ Sets the icon.
1184
+ """
1185
+ self._icon = icon
1186
+
1187
+
1188
+ def GetDocumentType(self):
1189
+ """
1190
+ Returns the Python document class, as passed to the document template
1191
+ constructor.
1192
+ """
1193
+ return self._docType
1194
+
1195
+
1196
+ def GetViewType(self):
1197
+ """
1198
+ Returns the Python view class, as passed to the document template
1199
+ constructor.
1200
+ """
1201
+ return self._viewType
1202
+
1203
+
1204
+ def IsVisible(self):
1205
+ """
1206
+ Returns true if the document template can be shown in user dialogs,
1207
+ false otherwise.
1208
+ """
1209
+ return (self._flags & TEMPLATE_VISIBLE) == TEMPLATE_VISIBLE
1210
+
1211
+
1212
+ def IsNewable(self):
1213
+ """
1214
+ Returns true if the document template can be shown in "New" dialogs,
1215
+ false otherwise.
1216
+ """
1217
+ return (self._flags & TEMPLATE_NO_CREATE) != TEMPLATE_NO_CREATE
1218
+
1219
+
1220
+ def GetDocumentName(self):
1221
+ """
1222
+ Returns the document type name, as passed to the document template
1223
+ constructor.
1224
+ """
1225
+ return self._docTypeName
1226
+
1227
+
1228
+ def GetViewName(self):
1229
+ """
1230
+ Returns the view type name, as passed to the document template
1231
+ constructor.
1232
+ """
1233
+ return self._viewTypeName
1234
+
1235
+
1236
+ def CreateDocument(self, path, flags):
1237
+ """
1238
+ Creates a new instance of the associated document class. If you have
1239
+ not supplied a class to the template constructor, you will need to
1240
+ override this function to return an appropriate document instance.
1241
+ """
1242
+ doc = self._docType()
1243
+ doc.SetFilename(path)
1244
+ doc.SetDocumentTemplate(self)
1245
+ self.GetDocumentManager().AddDocument(doc)
1246
+ doc.SetCommandProcessor(doc.OnCreateCommandProcessor())
1247
+ if doc.OnCreate(path, flags):
1248
+ return doc
1249
+ else:
1250
+ if doc in self.GetDocumentManager().GetDocuments():
1251
+ doc.DeleteAllViews()
1252
+ return None
1253
+
1254
+
1255
+ def CreateView(self, doc, flags):
1256
+ """
1257
+ Creates a new instance of the associated document view. If you have
1258
+ not supplied a class to the template constructor, you will need to
1259
+ override this function to return an appropriate view instance.
1260
+ """
1261
+ view = self._viewType()
1262
+ view.SetDocument(doc)
1263
+ if view.OnCreate(doc, flags):
1264
+ return view
1265
+ else:
1266
+ view.Destroy()
1267
+ return None
1268
+
1269
+
1270
+ def FileMatchesTemplate(self, path):
1271
+ """
1272
+ Returns True if the path's extension matches one of this template's
1273
+ file filter extensions.
1274
+ """
1275
+ ext = FindExtension(path)
1276
+ if not ext: return False
1277
+
1278
+ extList = self.GetFileFilter().replace('*','').split(';')
1279
+ return ext in extList
1280
+
1281
+
1282
+ class DocManager(wx.EvtHandler):
1283
+ """
1284
+ The :class:`DocManager` class is part of the document/view framework,
1285
+ and cooperates with the :class:`View`, :class:`Document` and
1286
+ :class:`DocTemplate` classes.
1287
+ """
1288
+
1289
+ def __init__(self, flags=DEFAULT_DOCMAN_FLAGS, initialize=True):
1290
+ """
1291
+ Constructor. Create a document manager instance dynamically near the
1292
+ start of your application before doing any document or view operations.
1293
+
1294
+ flags is used in the Python version to indicate whether the document
1295
+ manager is in DOC_SDI or DOC_MDI mode.
1296
+
1297
+ If initialize is true, the Initialize function will be called to
1298
+ create a default history list object. If you derive from wxDocManager,
1299
+ you may wish to call the base constructor with false, and then call
1300
+ Initialize in your own constructor, to allow your own Initialize or
1301
+ OnCreateFileHistory functions to be called.
1302
+ """
1303
+
1304
+ wx.EvtHandler.__init__(self)
1305
+
1306
+ self._defaultDocumentNameCounter = 1
1307
+ self._flags = flags
1308
+ self._currentView = None
1309
+ self._lastActiveView = None
1310
+ self._maxDocsOpen = 10000
1311
+ self._fileHistory = None
1312
+ self._templates = []
1313
+ self._docs = []
1314
+ self._lastDirectory = ""
1315
+
1316
+ if initialize:
1317
+ self.Initialize()
1318
+
1319
+ self.Bind(wx.EVT_MENU, self.OnFileOpen, id=wx.ID_OPEN)
1320
+ self.Bind(wx.EVT_MENU, self.OnFileClose, id=wx.ID_CLOSE)
1321
+ self.Bind(wx.EVT_MENU, self.OnFileCloseAll, id=wx.ID_CLOSE_ALL)
1322
+ self.Bind(wx.EVT_MENU, self.OnFileRevert, id=wx.ID_REVERT)
1323
+ self.Bind(wx.EVT_MENU, self.OnFileNew, id=wx.ID_NEW)
1324
+ self.Bind(wx.EVT_MENU, self.OnFileSave, id=wx.ID_SAVE)
1325
+ self.Bind(wx.EVT_MENU, self.OnFileSaveAs, id=wx.ID_SAVEAS)
1326
+ self.Bind(wx.EVT_MENU, self.OnUndo, id=wx.ID_UNDO)
1327
+ self.Bind(wx.EVT_MENU, self.OnRedo, id=wx.ID_REDO)
1328
+ self.Bind(wx.EVT_MENU, self.OnPrint, id=wx.ID_PRINT)
1329
+ self.Bind(wx.EVT_MENU, self.OnPrintSetup, id=wx.ID_PRINT_SETUP)
1330
+ self.Bind(wx.EVT_MENU, self.OnPreview, id=wx.ID_PREVIEW)
1331
+
1332
+ self.Bind(wx.EVT_UPDATE_UI, self.OnUpdateFileOpen, id=wx.ID_OPEN)
1333
+ self.Bind(wx.EVT_UPDATE_UI, self.OnUpdateFileClose, id=wx.ID_CLOSE)
1334
+ self.Bind(wx.EVT_UPDATE_UI, self.OnUpdateFileCloseAll, id=wx.ID_CLOSE_ALL)
1335
+ self.Bind(wx.EVT_UPDATE_UI, self.OnUpdateFileRevert, id=wx.ID_REVERT)
1336
+ self.Bind(wx.EVT_UPDATE_UI, self.OnUpdateFileNew, id=wx.ID_NEW)
1337
+ self.Bind(wx.EVT_UPDATE_UI, self.OnUpdateFileSave, id=wx.ID_SAVE)
1338
+ self.Bind(wx.EVT_UPDATE_UI, self.OnUpdateFileSaveAs, id=wx.ID_SAVEAS)
1339
+ self.Bind(wx.EVT_UPDATE_UI, self.OnUpdateUndo, id=wx.ID_UNDO)
1340
+ self.Bind(wx.EVT_UPDATE_UI, self.OnUpdateRedo, id=wx.ID_REDO)
1341
+ self.Bind(wx.EVT_UPDATE_UI, self.OnUpdatePrint, id=wx.ID_PRINT)
1342
+ self.Bind(wx.EVT_UPDATE_UI, self.OnUpdatePrintSetup, id=wx.ID_PRINT_SETUP)
1343
+ self.Bind(wx.EVT_UPDATE_UI, self.OnUpdatePreview, id=wx.ID_PREVIEW)
1344
+
1345
+
1346
+ def Destroy(self):
1347
+ """
1348
+ Destructor.
1349
+ """
1350
+ self.Clear()
1351
+ wx.EvtHandler.Destroy(self)
1352
+
1353
+
1354
+ def GetFlags(self):
1355
+ """
1356
+ Returns the document manager's flags.
1357
+ """
1358
+ return self._flags
1359
+
1360
+
1361
+ def CloseDocument(self, doc, force=True):
1362
+ """
1363
+ Closes the specified document.
1364
+ """
1365
+ if doc.Close() or force:
1366
+ doc.DeleteAllViews()
1367
+ if doc in self._docs:
1368
+ doc.Destroy()
1369
+ return True
1370
+ return False
1371
+
1372
+
1373
+ def CloseDocuments(self, force=True):
1374
+ """
1375
+ Closes all currently opened documents.
1376
+ """
1377
+ for document in self._docs[::-1]: # Close in lifo (reverse) order. We clone the list to make sure we go through all docs even as they are deleted
1378
+ if not self.CloseDocument(document, force):
1379
+ return False
1380
+ if document:
1381
+ document.DeleteAllViews() # Implicitly delete the document when the last view is removed
1382
+ return True
1383
+
1384
+
1385
+ def Clear(self, force=True):
1386
+ """
1387
+ Closes all currently opened document by callling :meth:`CloseDocuments`
1388
+ and clears the document manager's templates.
1389
+ """
1390
+ if not self.CloseDocuments(force):
1391
+ return False
1392
+ self._templates = []
1393
+ return True
1394
+
1395
+
1396
+ def Initialize(self):
1397
+ """
1398
+ Initializes data; currently just calls :meth:`OnCreateFileHistory`. Some data
1399
+ cannot always be initialized in the constructor because the programmer
1400
+ must be given the opportunity to override functionality. In fact
1401
+ ``Initialize`` is called from the :class:`DocManager` constructor, but this can
1402
+ be vetoed by passing false to the second argument, allowing the
1403
+ derived class's constructor to call ``Initialize``, possibly calling a
1404
+ different :meth:`OnCreateFileHistory` from the default.
1405
+
1406
+ The bottom line: if you're not deriving from ``Initialize``, forget it and
1407
+ construct :class:`DocManager` with no arguments.
1408
+ """
1409
+ self.OnCreateFileHistory()
1410
+ return True
1411
+
1412
+
1413
+ def OnCreateFileHistory(self):
1414
+ """
1415
+ A hook to allow a derived class to create a different type of file
1416
+ history. Called from :meth:`Initialize`.
1417
+ """
1418
+ self._fileHistory = wx.FileHistory()
1419
+
1420
+
1421
+ def OnFileClose(self, event):
1422
+ """
1423
+ Closes and deletes the currently active document.
1424
+ """
1425
+ doc = self.GetCurrentDocument()
1426
+ if doc:
1427
+ doc.DeleteAllViews()
1428
+ if doc in self._docs:
1429
+ self._docs.remove(doc)
1430
+
1431
+
1432
+ def OnFileCloseAll(self, event):
1433
+ """
1434
+ Closes and deletes all the currently opened documents.
1435
+ """
1436
+ return self.CloseDocuments(force = False)
1437
+
1438
+
1439
+ def OnFileNew(self, event):
1440
+ """
1441
+ Creates a new document and reads in the selected file.
1442
+ """
1443
+ self.CreateDocument('', DOC_NEW)
1444
+
1445
+
1446
+ def OnFileOpen(self, event):
1447
+ """
1448
+ Creates a new document and reads in the selected file.
1449
+ """
1450
+ if not self.CreateDocument('', DEFAULT_DOCMAN_FLAGS):
1451
+ self.OnOpenFileFailure()
1452
+
1453
+
1454
+ def OnFileRevert(self, event):
1455
+ """
1456
+ Reverts the current document by calling wxDocument.Save for the current
1457
+ document.
1458
+ """
1459
+ doc = self.GetCurrentDocument()
1460
+ if not doc:
1461
+ return
1462
+ doc.Revert()
1463
+
1464
+
1465
+ def OnFileSave(self, event):
1466
+ """
1467
+ Saves the current document by calling :meth:`Document.Save` for
1468
+ the current document.
1469
+ """
1470
+ doc = self.GetCurrentDocument()
1471
+ if not doc:
1472
+ return
1473
+ doc.Save()
1474
+
1475
+
1476
+ def OnFileSaveAs(self, event):
1477
+ """
1478
+ Calls :meth:`Document.SaveAs` for the current document.
1479
+ """
1480
+ doc = self.GetCurrentDocument()
1481
+ if not doc:
1482
+ return
1483
+ doc.SaveAs()
1484
+
1485
+
1486
+ def OnPrint(self, event):
1487
+ """
1488
+ Prints the current document by calling its View's
1489
+ :meth:`~View.OnCreatePrintout` method.
1490
+ """
1491
+ view = self.GetCurrentView()
1492
+ if not view:
1493
+ return
1494
+
1495
+ printout = view.OnCreatePrintout()
1496
+ if printout:
1497
+ if not hasattr(self, "printData"):
1498
+ self.printData = wx.PrintData()
1499
+ self.printData.SetPaperId(wx.PAPER_LETTER)
1500
+ self.printData.SetPrintMode(wx.PRINT_MODE_PRINTER)
1501
+
1502
+ pdd = wx.PrintDialogData(self.printData)
1503
+ printer = wx.Printer(pdd)
1504
+ printer.Print(view.GetFrame(), printout)
1505
+
1506
+
1507
+ def OnPrintSetup(self, event):
1508
+ """
1509
+ Presents the print setup dialog.
1510
+ """
1511
+ view = self.GetCurrentView()
1512
+ if view:
1513
+ parentWin = view.GetFrame()
1514
+ else:
1515
+ parentWin = wx.GetApp().GetTopWindow()
1516
+
1517
+ if not hasattr(self, "printData"):
1518
+ self.printData = wx.PrintData()
1519
+ self.printData.SetPaperId(wx.PAPER_LETTER)
1520
+
1521
+ data = wx.PrintDialogData(self.printData)
1522
+ printDialog = wx.PrintDialog(parentWin, data)
1523
+ printDialog.GetPrintDialogData().SetSetupDialog(True)
1524
+ printDialog.ShowModal()
1525
+
1526
+ # this makes a copy of the wx.PrintData instead of just saving
1527
+ # a reference to the one inside the PrintDialogData that will
1528
+ # be destroyed when the dialog is destroyed
1529
+ self.printData = wx.PrintData(printDialog.GetPrintDialogData().GetPrintData())
1530
+
1531
+ printDialog.Destroy()
1532
+
1533
+
1534
+ def OnPreview(self, event):
1535
+ """
1536
+ Previews the current document by calling its View's
1537
+ :meth:`~View.OnCreatePrintout` method.
1538
+ """
1539
+ view = self.GetCurrentView()
1540
+ if not view:
1541
+ return
1542
+
1543
+ printout = view.OnCreatePrintout()
1544
+ if printout:
1545
+ if not hasattr(self, "printData"):
1546
+ self.printData = wx.PrintData()
1547
+ self.printData.SetPaperId(wx.PAPER_LETTER)
1548
+ self.printData.SetPrintMode(wx.PRINT_MODE_PREVIEW)
1549
+
1550
+ data = wx.PrintDialogData(self.printData)
1551
+ # Pass two printout objects: for preview, and possible printing.
1552
+ preview = wx.PrintPreview(printout, view.OnCreatePrintout(), data)
1553
+ if not preview.IsOk():
1554
+ wx.MessageBox(_("Unable to display print preview."))
1555
+ return
1556
+ # wxWindows source doesn't use base frame's pos, size, and icon, but did it this way so it would work like MS Office etc.
1557
+ mimicFrame = wx.GetApp().GetTopWindow()
1558
+ frame = wx.PreviewFrame(preview, mimicFrame, _("Print Preview"), mimicFrame.GetPosition(), mimicFrame.GetSize())
1559
+ frame.SetIcon(mimicFrame.GetIcon())
1560
+ frame.SetTitle(_("%s - %s - Preview") % (mimicFrame.GetTitle(), view.GetDocument().GetPrintableName()))
1561
+ frame.Initialize()
1562
+ frame.Show(True)
1563
+
1564
+
1565
+ def OnUndo(self, event):
1566
+ """
1567
+ Issues an Undo command to the current document's command processor.
1568
+ """
1569
+ doc = self.GetCurrentDocument()
1570
+ if not doc:
1571
+ return
1572
+ if doc.GetCommandProcessor():
1573
+ doc.GetCommandProcessor().Undo()
1574
+
1575
+
1576
+ def OnRedo(self, event):
1577
+ """
1578
+ Issues a Redo command to the current document's command processor.
1579
+ """
1580
+ doc = self.GetCurrentDocument()
1581
+ if not doc:
1582
+ return
1583
+ if doc.GetCommandProcessor():
1584
+ doc.GetCommandProcessor().Redo()
1585
+
1586
+
1587
+ def OnUpdateFileOpen(self, event):
1588
+ """
1589
+ Updates the user interface for the File Open command.
1590
+ """
1591
+ event.Enable(True)
1592
+
1593
+
1594
+ def OnUpdateFileClose(self, event):
1595
+ """
1596
+ Updates the user interface for the File Close command.
1597
+ """
1598
+ event.Enable(self.GetCurrentDocument() is not None)
1599
+
1600
+
1601
+ def OnUpdateFileCloseAll(self, event):
1602
+ """
1603
+ Updates the user interface for the File Close All command.
1604
+ """
1605
+ event.Enable(self.GetCurrentDocument() is not None)
1606
+
1607
+
1608
+ def OnUpdateFileRevert(self, event):
1609
+ """
1610
+ Updates the user interface for the File Revert command.
1611
+ """
1612
+ event.Enable(self.GetCurrentDocument() is not None)
1613
+
1614
+
1615
+ def OnUpdateFileNew(self, event):
1616
+ """
1617
+ Updates the user interface for the File New command.
1618
+ """
1619
+ return True
1620
+
1621
+
1622
+ def OnUpdateFileSave(self, event):
1623
+ """
1624
+ Updates the user interface for the File Save command.
1625
+ """
1626
+ doc = self.GetCurrentDocument()
1627
+ event.Enable(doc is not None and doc.IsModified())
1628
+
1629
+
1630
+ def OnUpdateFileSaveAs(self, event):
1631
+ """
1632
+ Updates the user interface for the File Save As command.
1633
+ """
1634
+ event.Enable(self.GetCurrentDocument() is not None and self.GetCurrentDocument().GetWriteable())
1635
+
1636
+
1637
+ def OnUpdateUndo(self, event):
1638
+ """
1639
+ Updates the user interface for the Undo command.
1640
+ """
1641
+ doc = self.GetCurrentDocument()
1642
+ event.Enable(doc is not None and doc.GetCommandProcessor() is not None and doc.GetCommandProcessor().CanUndo())
1643
+ if doc and doc.GetCommandProcessor():
1644
+ doc.GetCommandProcessor().SetMenuStrings()
1645
+ else:
1646
+ event.SetText(_("&Undo\tCtrl+Z"))
1647
+
1648
+
1649
+ def OnUpdateRedo(self, event):
1650
+ """
1651
+ Updates the user interface for the Redo command.
1652
+ """
1653
+ doc = self.GetCurrentDocument()
1654
+ event.Enable(doc is not None and doc.GetCommandProcessor() is not None and doc.GetCommandProcessor().CanRedo())
1655
+ if doc and doc.GetCommandProcessor():
1656
+ doc.GetCommandProcessor().SetMenuStrings()
1657
+ else:
1658
+ event.SetText(_("&Redo\tCtrl+Y"))
1659
+
1660
+
1661
+ def OnUpdatePrint(self, event):
1662
+ """
1663
+ Updates the user interface for the Print command.
1664
+ """
1665
+ event.Enable(self.GetCurrentDocument() is not None)
1666
+
1667
+
1668
+ def OnUpdatePrintSetup(self, event):
1669
+ """
1670
+ Updates the user interface for the Print Setup command.
1671
+ """
1672
+ return True
1673
+
1674
+
1675
+ def OnUpdatePreview(self, event):
1676
+ """
1677
+ Updates the user interface for the Print Preview command.
1678
+ """
1679
+ event.Enable(self.GetCurrentDocument() is not None)
1680
+
1681
+
1682
+ def GetCurrentView(self):
1683
+ """
1684
+ Returns the currently active view.
1685
+ """
1686
+ if self._currentView:
1687
+ return self._currentView
1688
+ if len(self._docs) == 1:
1689
+ return self._docs[0].GetFirstView()
1690
+ return None
1691
+
1692
+
1693
+ def GetLastActiveView(self):
1694
+ """
1695
+ Returns the last active view. This is used in the SDI framework where dialogs can be mistaken for a view
1696
+ and causes the framework to deactivete the current view. This happens when something like a custom dialog box used
1697
+ to operate on the current view is shown.
1698
+ """
1699
+ if len(self._docs) >= 1:
1700
+ return self._lastActiveView
1701
+ else:
1702
+ return None
1703
+
1704
+
1705
+ def ProcessEvent(self, event):
1706
+ """
1707
+ Processes an event, searching event tables and calling zero or more
1708
+ suitable event handler function(s). Note that the ProcessEvent
1709
+ method is called from the wxPython docview framework directly since
1710
+ wxPython does not have a virtual ProcessEvent function.
1711
+ """
1712
+ view = self.GetCurrentView()
1713
+ if view:
1714
+ if view.ProcessEvent(event):
1715
+ return True
1716
+ id = event.GetId()
1717
+ if id == wx.ID_OPEN:
1718
+ self.OnFileOpen(event)
1719
+ return True
1720
+ elif id == wx.ID_CLOSE:
1721
+ self.OnFileClose(event)
1722
+ return True
1723
+ elif id == wx.ID_CLOSE_ALL:
1724
+ self.OnFileCloseAll(event)
1725
+ return True
1726
+ elif id == wx.ID_REVERT:
1727
+ self.OnFileRevert(event)
1728
+ return True
1729
+ elif id == wx.ID_NEW:
1730
+ self.OnFileNew(event)
1731
+ return True
1732
+ elif id == wx.ID_SAVE:
1733
+ self.OnFileSave(event)
1734
+ return True
1735
+ elif id == wx.ID_SAVEAS:
1736
+ self.OnFileSaveAs(event)
1737
+ return True
1738
+ elif id == wx.ID_UNDO:
1739
+ self.OnUndo(event)
1740
+ return True
1741
+ elif id == wx.ID_REDO:
1742
+ self.OnRedo(event)
1743
+ return True
1744
+ elif id == wx.ID_PRINT:
1745
+ self.OnPrint(event)
1746
+ return True
1747
+ elif id == wx.ID_PRINT_SETUP:
1748
+ self.OnPrintSetup(event)
1749
+ return True
1750
+ elif id == wx.ID_PREVIEW:
1751
+ self.OnPreview(event)
1752
+ return True
1753
+ else:
1754
+ return False
1755
+
1756
+
1757
+ def ProcessUpdateUIEvent(self, event):
1758
+ """
1759
+ Processes a UI event, searching event tables and calling zero or more
1760
+ suitable event handler function(s).
1761
+ """
1762
+ id = event.GetId()
1763
+ view = self.GetCurrentView()
1764
+ if view:
1765
+ if view.ProcessUpdateUIEvent(event):
1766
+ return True
1767
+ if id == wx.ID_OPEN:
1768
+ self.OnUpdateFileOpen(event)
1769
+ return True
1770
+ elif id == wx.ID_CLOSE:
1771
+ self.OnUpdateFileClose(event)
1772
+ return True
1773
+ elif id == wx.ID_CLOSE_ALL:
1774
+ self.OnUpdateFileCloseAll(event)
1775
+ return True
1776
+ elif id == wx.ID_REVERT:
1777
+ self.OnUpdateFileRevert(event)
1778
+ return True
1779
+ elif id == wx.ID_NEW:
1780
+ self.OnUpdateFileNew(event)
1781
+ return True
1782
+ elif id == wx.ID_SAVE:
1783
+ self.OnUpdateFileSave(event)
1784
+ return True
1785
+ elif id == wx.ID_SAVEAS:
1786
+ self.OnUpdateFileSaveAs(event)
1787
+ return True
1788
+ elif id == wx.ID_UNDO:
1789
+ self.OnUpdateUndo(event)
1790
+ return True
1791
+ elif id == wx.ID_REDO:
1792
+ self.OnUpdateRedo(event)
1793
+ return True
1794
+ elif id == wx.ID_PRINT:
1795
+ self.OnUpdatePrint(event)
1796
+ return True
1797
+ elif id == wx.ID_PRINT_SETUP:
1798
+ self.OnUpdatePrintSetup(event)
1799
+ return True
1800
+ elif id == wx.ID_PREVIEW:
1801
+ self.OnUpdatePreview(event)
1802
+ return True
1803
+ else:
1804
+ return False
1805
+
1806
+
1807
+ def CreateDocument(self, path, flags=0):
1808
+ """
1809
+ Creates a new document in a manner determined by the flags parameter,
1810
+ which can be:
1811
+
1812
+ ``wx.lib.docview.DOC_NEW`` Creates a fresh document.
1813
+ ``wx.lib.docview.DOC_SILENT`` Silently loads the given document file.
1814
+
1815
+ If ``wx.lib.docview.DOC_NEW`` is present, a new document will be
1816
+ created and returned, possibly after asking the user for a template to
1817
+ use if there is more than one document template. ``If
1818
+ wx.lib.docview.DOC_SILENT`` is present, a new document will be created
1819
+ and the given file loaded into it. If neither of these flags is
1820
+ present, the user will be presented with a file selector for the file
1821
+ to load, and the template to use will be determined by the extension
1822
+ (Windows) or by popping up a template choice list (other platforms).
1823
+
1824
+ If the maximum number of documents has been reached, this function
1825
+ will delete the oldest currently loaded document before creating a new
1826
+ one.
1827
+
1828
+ wxPython version supports the document manager's
1829
+ ``wx.lib.docview.DOC_OPEN_ONCE`` and ``wx.lib.docview.DOC_NO_VIEW``
1830
+ flag.
1831
+
1832
+ if ``wx.lib.docview.DOC_OPEN_ONCE`` is present, trying to open the
1833
+ same file multiple times will just return the same document. if
1834
+ ``wx.lib.docview.DOC_NO_VIEW`` is present, opening a file will
1835
+ generate the document, but not generate a corresponding view.
1836
+ """
1837
+ templates = []
1838
+ for temp in self._templates:
1839
+ if temp.IsVisible():
1840
+ templates.append(temp)
1841
+ if len(templates) == 0:
1842
+ return None
1843
+
1844
+ if len(self.GetDocuments()) >= self._maxDocsOpen:
1845
+ doc = self.GetDocuments()[0]
1846
+ if not self.CloseDocument(doc, False):
1847
+ return None
1848
+
1849
+ if flags & DOC_NEW:
1850
+ for temp in templates[:]:
1851
+ if not temp.IsNewable():
1852
+ templates.remove(temp)
1853
+ if len(templates) == 1:
1854
+ temp = templates[0]
1855
+ else:
1856
+ temp = self.SelectDocumentType(templates)
1857
+ if temp:
1858
+ newDoc = temp.CreateDocument(path, flags)
1859
+ if newDoc:
1860
+ newDoc.SetDocumentName(temp.GetDocumentName())
1861
+ newDoc.SetDocumentTemplate(temp)
1862
+ newDoc.OnNewDocument()
1863
+ return newDoc
1864
+ else:
1865
+ return None
1866
+
1867
+ if path and flags & DOC_SILENT:
1868
+ temp = self.FindTemplateForPath(path)
1869
+ else:
1870
+ temp, path = self.SelectDocumentPath(templates, path, flags)
1871
+
1872
+ # Existing document
1873
+ if path and self.GetFlags() & DOC_OPEN_ONCE:
1874
+ for document in self._docs:
1875
+ if document.GetFilename() and os.path.normcase(document.GetFilename()) == os.path.normcase(path):
1876
+ """ check for file modification outside of application """
1877
+ if not document.IsDocumentModificationDateCorrect():
1878
+ msgTitle = wx.GetApp().GetAppName()
1879
+ if not msgTitle:
1880
+ msgTitle = _("Warning")
1881
+ shortName = document.GetPrintableName()
1882
+ res = wx.MessageBox(_("'%s' has been modified outside of %s. Reload '%s' from file system?") % (shortName, msgTitle, shortName),
1883
+ msgTitle,
1884
+ wx.YES_NO | wx.ICON_QUESTION,
1885
+ self.FindSuitableParent())
1886
+ if res == wx.YES:
1887
+ if not self.CloseDocument(document, False):
1888
+ wx.MessageBox(_("Couldn't reload '%s'. Unable to close current '%s'.") % (shortName, shortName))
1889
+ return None
1890
+ return self.CreateDocument(path, flags)
1891
+ elif res == wx.NO: # don't ask again
1892
+ document.SetDocumentModificationDate()
1893
+
1894
+ firstView = document.GetFirstView()
1895
+ if not firstView and not (flags & DOC_NO_VIEW):
1896
+ document.GetDocumentTemplate().CreateView(document, flags)
1897
+ document.UpdateAllViews()
1898
+ firstView = document.GetFirstView()
1899
+
1900
+ if firstView and firstView.GetFrame() and not (flags & DOC_NO_VIEW):
1901
+ firstView.GetFrame().SetFocus() # Not in wxWindows code but useful nonetheless
1902
+ if hasattr(firstView.GetFrame(), "IsIconized") and firstView.GetFrame().IsIconized(): # Not in wxWindows code but useful nonetheless
1903
+ firstView.GetFrame().Iconize(False)
1904
+ return None
1905
+
1906
+ if temp:
1907
+ newDoc = temp.CreateDocument(path, flags)
1908
+ if newDoc:
1909
+ newDoc.SetDocumentName(temp.GetDocumentName())
1910
+ newDoc.SetDocumentTemplate(temp)
1911
+ if not newDoc.OnOpenDocument(path):
1912
+ frame = newDoc.GetFirstView().GetFrame()
1913
+ newDoc.DeleteAllViews() # Implicitly deleted by DeleteAllViews
1914
+ if frame:
1915
+ frame.Destroy() # DeleteAllViews doesn't get rid of the frame, so we'll explicitly destroy it.
1916
+ return None
1917
+ self.AddFileToHistory(path)
1918
+ return newDoc
1919
+
1920
+ return None
1921
+
1922
+
1923
+ def CreateView(self, doc, flags=0):
1924
+ """
1925
+ Creates a new view for the given document. If more than one view is
1926
+ allowed for the document (by virtue of multiple templates mentioning
1927
+ the same document type), a choice of view is presented to the user.
1928
+ """
1929
+ templates = []
1930
+ for temp in self._templates:
1931
+ if temp.IsVisible():
1932
+ if temp.GetDocumentName() == doc.GetDocumentName():
1933
+ templates.append(temp)
1934
+ if len(templates) == 0:
1935
+ return None
1936
+
1937
+ if len(templates) == 1:
1938
+ temp = templates[0]
1939
+ view = temp.CreateView(doc, flags)
1940
+ if view:
1941
+ view.SetViewName(temp.GetViewName())
1942
+ return view
1943
+
1944
+ temp = SelectViewType(templates)
1945
+ if temp:
1946
+ view = temp.CreateView(doc, flags)
1947
+ if view:
1948
+ view.SetViewName(temp.GetViewName())
1949
+ return view
1950
+ else:
1951
+ return None
1952
+
1953
+
1954
+ def DeleteTemplate(self, template, flags):
1955
+ """
1956
+ Placeholder, not yet implemented in wxWindows.
1957
+ """
1958
+ pass
1959
+
1960
+
1961
+ def FlushDoc(self, doc):
1962
+ """
1963
+ Placeholder, not yet implemented in wxWindows.
1964
+ """
1965
+ return False
1966
+
1967
+
1968
+ def MatchTemplate(self, path):
1969
+ """
1970
+ Placeholder, not yet implemented in wxWindows.
1971
+ """
1972
+ return None
1973
+
1974
+
1975
+ def GetCurrentDocument(self):
1976
+ """
1977
+ Returns the document associated with the currently active view (if any).
1978
+ """
1979
+ view = self.GetCurrentView()
1980
+ if view:
1981
+ return view.GetDocument()
1982
+ else:
1983
+ return None
1984
+
1985
+
1986
+ def MakeDefaultName(self):
1987
+ """
1988
+ Returns a suitable default name. This is implemented by appending an
1989
+ integer counter to the string "Untitled" and incrementing the counter.
1990
+ """
1991
+ name = _("Untitled %d") % self._defaultDocumentNameCounter
1992
+ self._defaultDocumentNameCounter = self._defaultDocumentNameCounter + 1
1993
+ return name
1994
+
1995
+
1996
+ def MakeFrameTitle(self):
1997
+ """
1998
+ Returns a suitable title for a document frame. This is implemented by
1999
+ appending the document name to the application name.
2000
+ """
2001
+ appName = wx.GetApp().GetAppName()
2002
+ if not doc:
2003
+ title = appName
2004
+ else:
2005
+ docName = doc.GetPrintableName()
2006
+ title = docName + _(" - ") + appName
2007
+ return title
2008
+
2009
+
2010
+ def AddFileToHistory(self, fileName):
2011
+ """
2012
+ Adds a file to the file history list, if we have a pointer to an
2013
+ appropriate file menu.
2014
+ """
2015
+ if self._fileHistory:
2016
+ self._fileHistory.AddFileToHistory(fileName)
2017
+
2018
+
2019
+ def RemoveFileFromHistory(self, i):
2020
+ """
2021
+ Removes a file from the file history list, if we have a pointer to an
2022
+ appropriate file menu.
2023
+ """
2024
+ if self._fileHistory:
2025
+ self._fileHistory.RemoveFileFromHistory(i)
2026
+
2027
+
2028
+ def GetFileHistory(self):
2029
+ """
2030
+ Returns the file history.
2031
+ """
2032
+ return self._fileHistory
2033
+
2034
+
2035
+ def GetHistoryFile(self, i):
2036
+ """
2037
+ Returns the file at index i from the file history.
2038
+ """
2039
+ if self._fileHistory:
2040
+ return self._fileHistory.GetHistoryFile(i)
2041
+ else:
2042
+ return None
2043
+
2044
+
2045
+ def FileHistoryUseMenu(self, menu):
2046
+ """
2047
+ Use this menu for appending recently-visited document filenames, for
2048
+ convenient access. Calling this function with a valid menu enables the
2049
+ history list functionality.
2050
+
2051
+ Note that you can add multiple menus using this function, to be
2052
+ managed by the file history object.
2053
+ """
2054
+ if self._fileHistory:
2055
+ self._fileHistory.UseMenu(menu)
2056
+
2057
+
2058
+ def FileHistoryRemoveMenu(self, menu):
2059
+ """
2060
+ Removes the given menu from the list of menus managed by the file
2061
+ history object.
2062
+ """
2063
+ if self._fileHistory:
2064
+ self._fileHistory.RemoveMenu(menu)
2065
+
2066
+
2067
+ def FileHistoryLoad(self, config):
2068
+ """
2069
+ Loads the file history from a config object.
2070
+ """
2071
+ if self._fileHistory:
2072
+ self._fileHistory.Load(config)
2073
+
2074
+
2075
+ def FileHistorySave(self, config):
2076
+ """
2077
+ Saves the file history into a config object. This must be called
2078
+ explicitly by the application.
2079
+ """
2080
+ if self._fileHistory:
2081
+ self._fileHistory.Save(config)
2082
+
2083
+
2084
+ def FileHistoryAddFilesToMenu(self, menu=None):
2085
+ """
2086
+ Appends the files in the history list, to all menus managed by the
2087
+ file history object.
2088
+
2089
+ If menu is specified, appends the files in the history list to the
2090
+ given menu only.
2091
+ """
2092
+ if self._fileHistory:
2093
+ if menu:
2094
+ self._fileHistory.AddFilesToThisMenu(menu)
2095
+ else:
2096
+ self._fileHistory.AddFilesToMenu()
2097
+
2098
+
2099
+ def GetHistoryFilesCount(self):
2100
+ """
2101
+ Returns the number of files currently stored in the file history.
2102
+ """
2103
+ if self._fileHistory:
2104
+ return self._fileHistory.GetNoHistoryFiles()
2105
+ else:
2106
+ return 0
2107
+
2108
+
2109
+ def FindTemplateForPath(self, path):
2110
+ """
2111
+ Given a path, try to find template that matches the extension. This is
2112
+ only an approximate method of finding a template for creating a
2113
+ document.
2114
+
2115
+ Note this wxPython verson looks for and returns a default template
2116
+ if no specific template is found.
2117
+ """
2118
+ default = None
2119
+ for temp in self._templates:
2120
+ if temp.FileMatchesTemplate(path):
2121
+ return temp
2122
+
2123
+ if "*.*" in temp.GetFileFilter():
2124
+ default = temp
2125
+ return default
2126
+
2127
+
2128
+ def FindSuitableParent(self):
2129
+ """
2130
+ Returns a parent frame or dialog, either the frame with the current
2131
+ focus or if there is no current focus the application's top frame.
2132
+ """
2133
+ parent = wx.GetApp().GetTopWindow()
2134
+ focusWindow = wx.Window.FindFocus()
2135
+ if focusWindow:
2136
+ while focusWindow and not isinstance(focusWindow, wx.Dialog) and not isinstance(focusWindow, wx.Frame):
2137
+ focusWindow = focusWindow.GetParent()
2138
+ if focusWindow:
2139
+ parent = focusWindow
2140
+ return parent
2141
+
2142
+
2143
+ def SelectDocumentPath(self, templates, flags, save):
2144
+ """
2145
+ Under Windows, pops up a file selector with a list of filters
2146
+ corresponding to document templates. The wxDocTemplate corresponding
2147
+ to the selected file's extension is returned.
2148
+
2149
+ On other platforms, if there is more than one document template a
2150
+ choice list is popped up, followed by a file selector.
2151
+
2152
+ This function is used in :meth:`DocManager.CreateDocument`.
2153
+ """
2154
+ if wx.Platform == "__WXMSW__" or wx.Platform == "__WXGTK__" or wx.Platform == "__WXMAC__":
2155
+ descr = ''
2156
+ for temp in templates:
2157
+ if temp.IsVisible():
2158
+ if len(descr) > 0:
2159
+ descr = descr + _('|')
2160
+ descr = descr + temp.GetDescription() + _(" (") + temp.GetFileFilter() + _(") |") + temp.GetFileFilter() # spacing is important, make sure there is no space after the "|", it causes a bug on wx_gtk
2161
+ descr = _("All|*.*|%s") % descr # spacing is important, make sure there is no space after the "|", it causes a bug on wx_gtk
2162
+ else:
2163
+ descr = _("*.*")
2164
+
2165
+ dlg = wx.FileDialog(self.FindSuitableParent(),
2166
+ _("Select a File"),
2167
+ wildcard=descr,
2168
+ style=wx.FD_OPEN|wx.FD_FILE_MUST_EXIST|wx.FD_CHANGE_DIR)
2169
+ # dlg.CenterOnParent() # wxBug: caused crash with wx.FileDialog
2170
+ if dlg.ShowModal() == wx.ID_OK:
2171
+ path = dlg.GetPath()
2172
+ else:
2173
+ path = None
2174
+ dlg.Destroy()
2175
+
2176
+ if path:
2177
+ theTemplate = self.FindTemplateForPath(path)
2178
+ return (theTemplate, path)
2179
+
2180
+ return (None, None)
2181
+
2182
+
2183
+ def OnOpenFileFailure(self):
2184
+ """
2185
+ Called when there is an error opening a file.
2186
+ """
2187
+ pass
2188
+
2189
+
2190
+ def SelectDocumentType(self, temps, sort=False):
2191
+ """
2192
+ Returns a document template by asking the user (if there is more than
2193
+ one template). This function is used in :methW`DocManager.CreateDocument`.
2194
+
2195
+ Parameters
2196
+
2197
+ templates - list of templates from which to choose a desired template.
2198
+
2199
+ sort - If more than one template is passed in in templates, then this
2200
+ parameter indicates whether the list of templates that the user will
2201
+ have to choose from is sorted or not when shown the choice box dialog.
2202
+ Default is false.
2203
+ """
2204
+ templates = []
2205
+ for temp in temps:
2206
+ if temp.IsVisible():
2207
+ want = True
2208
+ for temp2 in templates:
2209
+ if temp.GetDocumentName() == temp2.GetDocumentName() and temp.GetViewName() == temp2.GetViewName():
2210
+ want = False
2211
+ break
2212
+ if want:
2213
+ templates.append(temp)
2214
+
2215
+ if len(templates) == 0:
2216
+ return None
2217
+ elif len(templates) == 1:
2218
+ return templates[0]
2219
+
2220
+ if sort:
2221
+ def tempcmp(a, b):
2222
+ return cmp(a.GetDescription(), b.GetDescription())
2223
+ templates.sort(key=cmp_to_key(tempcmp))
2224
+
2225
+ strings = []
2226
+ for temp in templates:
2227
+ strings.append(temp.GetDescription())
2228
+
2229
+ res = wx.GetSingleChoiceIndex(_("Select a document type:"),
2230
+ _("Documents"),
2231
+ strings,
2232
+ self.FindSuitableParent())
2233
+ if res == -1:
2234
+ return None
2235
+ return templates[res]
2236
+
2237
+
2238
+ def SelectViewType(self, temps, sort=False):
2239
+ """
2240
+ Returns a document template by asking the user (if there is
2241
+ more than one template), displaying a list of valid views.
2242
+ This function is used in wxDocManager::CreateView. The dialog
2243
+ normally will not appear because the array of templates only
2244
+ contains those relevant to the document in question, and
2245
+ often there will only be one such.
2246
+ """
2247
+ templates = []
2248
+ strings = []
2249
+ for temp in temps:
2250
+ if temp.IsVisible() and temp.GetViewTypeName():
2251
+ if temp.GetViewName() not in strings:
2252
+ templates.append(temp)
2253
+ strings.append(temp.GetViewTypeName())
2254
+
2255
+ if len(templates) == 0:
2256
+ return None
2257
+ elif len(templates) == 1:
2258
+ return templates[0]
2259
+
2260
+ if sort:
2261
+ def tempcmp(a, b):
2262
+ return cmp(a.GetViewTypeName(), b.GetViewTypeName())
2263
+ templates.sort(key=cmp_to_key(tempcmp))
2264
+
2265
+ res = wx.GetSingleChoiceIndex(_("Select a document view:"),
2266
+ _("Views"),
2267
+ strings,
2268
+ self.FindSuitableParent())
2269
+ if res == -1:
2270
+ return None
2271
+ return templates[res]
2272
+
2273
+
2274
+ def GetTemplates(self):
2275
+ """
2276
+ Returns the document manager's template list.
2277
+ """
2278
+ return self._templates
2279
+
2280
+
2281
+ def AssociateTemplate(self, docTemplate):
2282
+ """
2283
+ Adds the template to the document manager's template list.
2284
+ """
2285
+ if docTemplate not in self._templates:
2286
+ self._templates.append(docTemplate)
2287
+
2288
+
2289
+ def DisassociateTemplate(self, docTemplate):
2290
+ """
2291
+ Removes the template from the list of templates.
2292
+ """
2293
+ self._templates.remove(docTemplate)
2294
+
2295
+
2296
+ def AddDocument(self, document):
2297
+ """
2298
+ Adds the document to the list of documents.
2299
+ """
2300
+ if document not in self._docs:
2301
+ self._docs.append(document)
2302
+
2303
+
2304
+ def RemoveDocument(self, doc):
2305
+ """
2306
+ Removes the document from the list of documents.
2307
+ """
2308
+ if doc in self._docs:
2309
+ self._docs.remove(doc)
2310
+
2311
+
2312
+ def ActivateView(self, view, activate=True, deleting=False):
2313
+ """
2314
+ Sets the current view.
2315
+ """
2316
+ if activate:
2317
+ self._currentView = view
2318
+ self._lastActiveView = view
2319
+ else:
2320
+ self._currentView = None
2321
+
2322
+
2323
+ def GetMaxDocsOpen(self):
2324
+ """
2325
+ Returns the number of documents that can be open simultaneously.
2326
+ """
2327
+ return self._maxDocsOpen
2328
+
2329
+
2330
+ def SetMaxDocsOpen(self, maxDocsOpen):
2331
+ """
2332
+ Sets the maximum number of documents that can be open at a time. By
2333
+ default, this is 10,000. If you set it to 1, existing documents will
2334
+ be saved and deleted when the user tries to open or create a new one
2335
+ (similar to the behaviour of Windows Write, for example). Allowing
2336
+ multiple documents gives behaviour more akin to MS Word and other
2337
+ Multiple Document Interface applications.
2338
+ """
2339
+ self._maxDocsOpen = maxDocsOpen
2340
+
2341
+
2342
+ def GetDocuments(self):
2343
+ """
2344
+ Returns the list of documents.
2345
+ """
2346
+ return self._docs
2347
+
2348
+
2349
+ class DocParentFrame(wx.Frame):
2350
+ """
2351
+ The :class:`DocParentFrame` class provides a default top-level frame for
2352
+ applications using the document/view framework. This class can only be
2353
+ used for SDI (not MDI) parent frames.
2354
+
2355
+ It cooperates with the :class:`View`, :class:`Document`, :class:`DocManager`
2356
+ and :class:`DocTemplates` classes.
2357
+ """
2358
+
2359
+ def __init__(self, manager, frame, id, title, pos=wx.DefaultPosition,
2360
+ size=wx.DefaultSize, style=wx.DEFAULT_FRAME_STYLE,
2361
+ name="frame"):
2362
+ """
2363
+ Constructor. Note that the event table must be rebuilt for the
2364
+ frame since the EvtHandler is not virtual.
2365
+ """
2366
+ wx.Frame.__init__(self, frame, id, title, pos, size, style)
2367
+ self._docManager = manager
2368
+
2369
+ self.Bind(wx.EVT_CLOSE, self.OnCloseWindow)
2370
+
2371
+ self.Bind(wx.EVT_MENU, self.OnExit, id=wx.ID_EXIT)
2372
+ self.Bind(wx.EVT_MENU_RANGE, self.OnMRUFile, id=wx.ID_FILE1, id2=wx.ID_FILE9)
2373
+
2374
+ self.Bind(wx.EVT_MENU, self.ProcessEvent, id=wx.ID_NEW)
2375
+ self.Bind(wx.EVT_MENU, self.ProcessEvent, id=wx.ID_OPEN)
2376
+ self.Bind(wx.EVT_MENU, self.ProcessEvent, id=wx.ID_CLOSE_ALL)
2377
+ self.Bind(wx.EVT_MENU, self.ProcessEvent, id=wx.ID_CLOSE)
2378
+ self.Bind(wx.EVT_MENU, self.ProcessEvent, id=wx.ID_REVERT)
2379
+ self.Bind(wx.EVT_MENU, self.ProcessEvent, id=wx.ID_SAVE)
2380
+ self.Bind(wx.EVT_MENU, self.ProcessEvent, id=wx.ID_SAVEAS)
2381
+ self.Bind(wx.EVT_MENU, self.ProcessEvent, id=wx.ID_UNDO)
2382
+ self.Bind(wx.EVT_MENU, self.ProcessEvent, id=wx.ID_REDO)
2383
+ self.Bind(wx.EVT_MENU, self.ProcessEvent, id=wx.ID_PRINT)
2384
+ self.Bind(wx.EVT_MENU, self.ProcessEvent, id=wx.ID_PRINT_SETUP)
2385
+ self.Bind(wx.EVT_MENU, self.ProcessEvent, id=wx.ID_PREVIEW)
2386
+
2387
+ self.Bind(wx.EVT_UPDATE_UI, self.ProcessUpdateUIEvent, id=wx.ID_NEW)
2388
+ self.Bind(wx.EVT_UPDATE_UI, self.ProcessUpdateUIEvent, id=wx.ID_OPEN)
2389
+ self.Bind(wx.EVT_UPDATE_UI, self.ProcessUpdateUIEvent, id=wx.ID_CLOSE_ALL)
2390
+ self.Bind(wx.EVT_UPDATE_UI, self.ProcessUpdateUIEvent, id=wx.ID_CLOSE)
2391
+ self.Bind(wx.EVT_UPDATE_UI, self.ProcessUpdateUIEvent, id=wx.ID_REVERT)
2392
+ self.Bind(wx.EVT_UPDATE_UI, self.ProcessUpdateUIEvent, id=wx.ID_SAVE)
2393
+ self.Bind(wx.EVT_UPDATE_UI, self.ProcessUpdateUIEvent, id=wx.ID_SAVEAS)
2394
+ self.Bind(wx.EVT_UPDATE_UI, self.ProcessUpdateUIEvent, id=wx.ID_UNDO)
2395
+ self.Bind(wx.EVT_UPDATE_UI, self.ProcessUpdateUIEvent, id=wx.ID_REDO)
2396
+ self.Bind(wx.EVT_UPDATE_UI, self.ProcessUpdateUIEvent, id=wx.ID_PRINT)
2397
+ self.Bind(wx.EVT_UPDATE_UI, self.ProcessUpdateUIEvent, id=wx.ID_PRINT_SETUP)
2398
+ self.Bind(wx.EVT_UPDATE_UI, self.ProcessUpdateUIEvent, id=wx.ID_PREVIEW)
2399
+
2400
+
2401
+ def ProcessEvent(self, event):
2402
+ """
2403
+ Processes an event, searching event tables and calling zero or more
2404
+ suitable event handler function(s).
2405
+ """
2406
+ return self._docManager and self._docManager.ProcessEvent(event)
2407
+
2408
+
2409
+ def ProcessUpdateUIEvent(self, event):
2410
+ """
2411
+ Processes a UI event, searching event tables and calling zero or more
2412
+ suitable event handler function(s).
2413
+ """
2414
+ return self._docManager and self._docManager.ProcessUpdateUIEvent(event)
2415
+
2416
+
2417
+ def OnExit(self, event):
2418
+ """
2419
+ Called when File/Exit is chosen and closes the window.
2420
+ """
2421
+ self.Close()
2422
+
2423
+
2424
+ def OnMRUFile(self, event):
2425
+ """
2426
+ Opens the appropriate file when it is selected from the file history
2427
+ menu.
2428
+ """
2429
+ n = event.GetId() - wx.ID_FILE1
2430
+ filename = self._docManager.GetHistoryFile(n)
2431
+ if filename:
2432
+ self._docManager.CreateDocument(filename, DOC_SILENT)
2433
+ else:
2434
+ self._docManager.RemoveFileFromHistory(n)
2435
+ msgTitle = wx.GetApp().GetAppName()
2436
+ if not msgTitle:
2437
+ msgTitle = _("File Error")
2438
+ wx.MessageBox("The file '%s' doesn't exist and couldn't be opened.\nIt has been removed from the most recently used files list" % FileNameFromPath(file),
2439
+ msgTitle,
2440
+ wx.OK | wx.ICON_EXCLAMATION,
2441
+ self)
2442
+
2443
+
2444
+ def OnCloseWindow(self, event):
2445
+ """
2446
+ Deletes all views and documents. If no user input cancelled the
2447
+ operation, the frame will be destroyed and the application will exit.
2448
+ """
2449
+ if self._docManager.Clear(not event.CanVeto()):
2450
+ self.Destroy()
2451
+ else:
2452
+ event.Veto()
2453
+
2454
+
2455
+ class DocChildFrame(wx.Frame):
2456
+ """
2457
+ The :class:`DocChildFrame` class provides a default frame for displaying
2458
+ documents on separate windows. This class can only be used for SDI (not
2459
+ MDI) child frames.
2460
+
2461
+ The class is part of the document/view framework and cooperates with
2462
+ the :class:`View`, :class:`Document`, :class:`DocManager` and
2463
+ :class:`DocTemplate` classes.
2464
+ """
2465
+
2466
+
2467
+ def __init__(self, doc, view, frame, id, title, pos=wx.DefaultPosition, size=wx.DefaultSize, style=wx.DEFAULT_FRAME_STYLE, name="frame"):
2468
+ """
2469
+ Constructor.
2470
+ """
2471
+ wx.Frame.__init__(self, frame, id, title, pos, size, style, name)
2472
+ self.Bind(wx.EVT_ACTIVATE, self.OnActivate)
2473
+ self.Bind(wx.EVT_CLOSE, self.OnCloseWindow)
2474
+ self._childDocument = doc
2475
+ self._childView = view
2476
+ if view:
2477
+ view.SetFrame(self)
2478
+
2479
+ self.Bind(wx.EVT_MENU, self.ProcessEvent, id=wx.ID_NEW)
2480
+ self.Bind(wx.EVT_MENU, self.ProcessEvent, id=wx.ID_OPEN)
2481
+ self.Bind(wx.EVT_MENU, self.ProcessEvent, id=wx.ID_CLOSE_ALL)
2482
+ self.Bind(wx.EVT_MENU, self.ProcessEvent, id=wx.ID_CLOSE)
2483
+ self.Bind(wx.EVT_MENU, self.ProcessEvent, id=wx.ID_REVERT)
2484
+ self.Bind(wx.EVT_MENU, self.ProcessEvent, id=wx.ID_SAVE)
2485
+ self.Bind(wx.EVT_MENU, self.ProcessEvent, id=wx.ID_SAVEAS)
2486
+ self.Bind(wx.EVT_MENU, self.ProcessEvent, id=wx.ID_UNDO)
2487
+ self.Bind(wx.EVT_MENU, self.ProcessEvent, id=wx.ID_REDO)
2488
+ self.Bind(wx.EVT_MENU, self.ProcessEvent, id=wx.ID_PRINT)
2489
+ self.Bind(wx.EVT_MENU, self.ProcessEvent, id=wx.ID_PRINT_SETUP)
2490
+ self.Bind(wx.EVT_MENU, self.ProcessEvent, id=wx.ID_PREVIEW)
2491
+
2492
+ self.Bind(wx.EVT_UPDATE_UI, self.ProcessUpdateUIEvent, id=wx.ID_NEW)
2493
+ self.Bind(wx.EVT_UPDATE_UI, self.ProcessUpdateUIEvent, id=wx.ID_OPEN)
2494
+ self.Bind(wx.EVT_UPDATE_UI, self.ProcessUpdateUIEvent, id=wx.ID_CLOSE_ALL)
2495
+ self.Bind(wx.EVT_UPDATE_UI, self.ProcessUpdateUIEvent, id=wx.ID_CLOSE)
2496
+ self.Bind(wx.EVT_UPDATE_UI, self.ProcessUpdateUIEvent, id=wx.ID_REVERT)
2497
+ self.Bind(wx.EVT_UPDATE_UI, self.ProcessUpdateUIEvent, id=wx.ID_SAVE)
2498
+ self.Bind(wx.EVT_UPDATE_UI, self.ProcessUpdateUIEvent, id=wx.ID_SAVEAS)
2499
+ self.Bind(wx.EVT_UPDATE_UI, self.ProcessUpdateUIEvent, id=wx.ID_UNDO)
2500
+ self.Bind(wx.EVT_UPDATE_UI, self.ProcessUpdateUIEvent, id=wx.ID_REDO)
2501
+ self.Bind(wx.EVT_UPDATE_UI, self.ProcessUpdateUIEvent, id=wx.ID_PRINT)
2502
+ self.Bind(wx.EVT_UPDATE_UI, self.ProcessUpdateUIEvent, id=wx.ID_PRINT_SETUP)
2503
+ self.Bind(wx.EVT_UPDATE_UI, self.ProcessUpdateUIEvent, id=wx.ID_PREVIEW)
2504
+
2505
+
2506
+ def ProcessEvent(self, event):
2507
+ """
2508
+ Processes an event, searching event tables and calling zero or more
2509
+ suitable event handler function(s).
2510
+ """
2511
+ if self._childView:
2512
+ self._childView.Activate(True)
2513
+ if not self._childView or not self._childView.ProcessEvent(event):
2514
+ # IsInstance not working, but who cares just send all the commands up since this isn't a real ProcessEvent like wxWindows
2515
+ # if not isinstance(event, wx.CommandEvent) or not self.GetParent() or not self.GetParent().ProcessEvent(event):
2516
+ if not self.GetParent() or not self.GetParent().ProcessEvent(event):
2517
+ return False
2518
+ else:
2519
+ return True
2520
+ else:
2521
+ return True
2522
+
2523
+
2524
+ def ProcessUpdateUIEvent(self, event):
2525
+ """
2526
+ Processes a UI event, searching event tables and calling zero or more
2527
+ suitable event handler function(s).
2528
+ """
2529
+ if self.GetParent():
2530
+ self.GetParent().ProcessUpdateUIEvent(event)
2531
+ else:
2532
+ return False
2533
+
2534
+
2535
+ def OnActivate(self, event):
2536
+ """
2537
+ Activates the current view.
2538
+ """
2539
+ event.Skip()
2540
+ if self._childView:
2541
+ self._childView.Activate(event.GetActive())
2542
+
2543
+
2544
+ def OnCloseWindow(self, event):
2545
+ """
2546
+ Closes and deletes the current view and document.
2547
+ """
2548
+ if self._childView:
2549
+ ans = False
2550
+ if not event.CanVeto():
2551
+ ans = True
2552
+ else:
2553
+ ans = self._childView.Close(deleteWindow = False)
2554
+
2555
+ if ans:
2556
+ self._childView.Activate(False)
2557
+ self._childView.Destroy()
2558
+ self._childView = None
2559
+ if self._childDocument:
2560
+ self._childDocument.Destroy() # This isn't in the wxWindows codebase but the document needs to be disposed of somehow
2561
+ self._childDocument = None
2562
+ self.Destroy()
2563
+ else:
2564
+ event.Veto()
2565
+ else:
2566
+ event.Veto()
2567
+
2568
+
2569
+ def GetDocument(self):
2570
+ """
2571
+ Returns the document associated with this frame.
2572
+ """
2573
+ return self._childDocument
2574
+
2575
+
2576
+ def SetDocument(self, document):
2577
+ """
2578
+ Sets the document for this frame.
2579
+ """
2580
+ self._childDocument = document
2581
+
2582
+
2583
+ def GetView(self):
2584
+ """
2585
+ Returns the view associated with this frame.
2586
+ """
2587
+ return self._childView
2588
+
2589
+
2590
+ def SetView(self, view):
2591
+ """
2592
+ Sets the view for this frame.
2593
+ """
2594
+ self._childView = view
2595
+
2596
+
2597
+ class DocMDIParentFrame(wx.MDIParentFrame):
2598
+ """
2599
+ The :class:`DocMDIParentFrame` class provides a default top-level frame for
2600
+ applications using the document/view framework. This class can only be
2601
+ used for MDI parent frames.
2602
+
2603
+ It cooperates with the :class:`View`, :class:`Document`,
2604
+ :class:`DocManager` and :class:`DocTemplate` classes.
2605
+ """
2606
+
2607
+
2608
+ def __init__(self, manager, frame, id, title, pos=wx.DefaultPosition, size=wx.DefaultSize, style=wx.DEFAULT_FRAME_STYLE, name="frame"):
2609
+ """
2610
+ Constructor.
2611
+ """
2612
+ wx.MDIParentFrame.__init__(self, frame, id, title, pos, size, style, name)
2613
+ self._docManager = manager
2614
+
2615
+ self.Bind(wx.EVT_CLOSE, self.OnCloseWindow)
2616
+
2617
+ self.Bind(wx.EVT_MENU, self.OnExit, id=wx.ID_EXIT)
2618
+ self.Bind(wx.EVT_MENU_RANGE, self.OnMRUFile, id=wx.ID_FILE1, id2=wx.ID_FILE9)
2619
+
2620
+ self.Bind(wx.EVT_MENU, self.ProcessEvent, id=wx.ID_NEW)
2621
+ self.Bind(wx.EVT_MENU, self.ProcessEvent, id=wx.ID_OPEN)
2622
+ self.Bind(wx.EVT_MENU, self.ProcessEvent, id=wx.ID_CLOSE_ALL)
2623
+ self.Bind(wx.EVT_MENU, self.ProcessEvent, id=wx.ID_CLOSE)
2624
+ self.Bind(wx.EVT_MENU, self.ProcessEvent, id=wx.ID_REVERT)
2625
+ self.Bind(wx.EVT_MENU, self.ProcessEvent, id=wx.ID_SAVE)
2626
+ self.Bind(wx.EVT_MENU, self.ProcessEvent, id=wx.ID_SAVEAS)
2627
+ self.Bind(wx.EVT_MENU, self.ProcessEvent, id=wx.ID_UNDO)
2628
+ self.Bind(wx.EVT_MENU, self.ProcessEvent, id=wx.ID_REDO)
2629
+ self.Bind(wx.EVT_MENU, self.ProcessEvent, id=wx.ID_PRINT)
2630
+ self.Bind(wx.EVT_MENU, self.ProcessEvent, id=wx.ID_PRINT_SETUP)
2631
+ self.Bind(wx.EVT_MENU, self.ProcessEvent, id=wx.ID_PREVIEW)
2632
+
2633
+ self.Bind(wx.EVT_UPDATE_UI, self.ProcessUpdateUIEvent, id=wx.ID_NEW)
2634
+ self.Bind(wx.EVT_UPDATE_UI, self.ProcessUpdateUIEvent, id=wx.ID_OPEN)
2635
+ self.Bind(wx.EVT_UPDATE_UI, self.ProcessUpdateUIEvent, id=wx.ID_CLOSE_ALL)
2636
+ self.Bind(wx.EVT_UPDATE_UI, self.ProcessUpdateUIEvent, id=wx.ID_CLOSE)
2637
+ self.Bind(wx.EVT_UPDATE_UI, self.ProcessUpdateUIEvent, id=wx.ID_REVERT)
2638
+ self.Bind(wx.EVT_UPDATE_UI, self.ProcessUpdateUIEvent, id=wx.ID_SAVE)
2639
+ self.Bind(wx.EVT_UPDATE_UI, self.ProcessUpdateUIEvent, id=wx.ID_SAVEAS)
2640
+ self.Bind(wx.EVT_UPDATE_UI, self.ProcessUpdateUIEvent, id=wx.ID_UNDO)
2641
+ self.Bind(wx.EVT_UPDATE_UI, self.ProcessUpdateUIEvent, id=wx.ID_REDO)
2642
+ self.Bind(wx.EVT_UPDATE_UI, self.ProcessUpdateUIEvent, id=wx.ID_PRINT)
2643
+ self.Bind(wx.EVT_UPDATE_UI, self.ProcessUpdateUIEvent, id=wx.ID_PRINT_SETUP)
2644
+ self.Bind(wx.EVT_UPDATE_UI, self.ProcessUpdateUIEvent, id=wx.ID_PREVIEW)
2645
+
2646
+
2647
+ def ProcessEvent(self, event):
2648
+ """
2649
+ Processes an event, searching event tables and calling zero or more
2650
+ suitable event handler function(s).
2651
+ """
2652
+ return self._docManager and self._docManager.ProcessEvent(event)
2653
+
2654
+
2655
+ def ProcessUpdateUIEvent(self, event):
2656
+ """
2657
+ Processes a UI event, searching event tables and calling zero or more
2658
+ suitable event handler function(s).
2659
+ """
2660
+ return self._docManager and self._docManager.ProcessUpdateUIEvent(event)
2661
+
2662
+
2663
+ def OnExit(self, event):
2664
+ """
2665
+ Called when File/Exit is chosen and closes the window.
2666
+ """
2667
+ self.Close()
2668
+
2669
+
2670
+ def OnMRUFile(self, event):
2671
+ """
2672
+ Opens the appropriate file when it is selected from the file history
2673
+ menu.
2674
+ """
2675
+ n = event.GetId() - wx.ID_FILE1
2676
+ filename = self._docManager.GetHistoryFile(n)
2677
+ if filename:
2678
+ self._docManager.CreateDocument(filename, DOC_SILENT)
2679
+ else:
2680
+ self._docManager.RemoveFileFromHistory(n)
2681
+ msgTitle = wx.GetApp().GetAppName()
2682
+ if not msgTitle:
2683
+ msgTitle = _("File Error")
2684
+ wx.MessageBox("The file '%s' doesn't exist and couldn't be opened.\nIt has been removed from the most recently used files list" % FileNameFromPath(file),
2685
+ msgTitle,
2686
+ wx.OK | wx.ICON_EXCLAMATION,
2687
+ self)
2688
+
2689
+
2690
+ def OnCloseWindow(self, event):
2691
+ """
2692
+ Deletes all views and documents. If no user input cancelled the
2693
+ operation, the frame will be destroyed and the application will exit.
2694
+ """
2695
+ if self._docManager.Clear(not event.CanVeto()):
2696
+ self.Destroy()
2697
+ else:
2698
+ event.Veto()
2699
+
2700
+
2701
+ class DocMDIChildFrame(wx.MDIChildFrame):
2702
+ """
2703
+ The :class:`DocMDIChildFrame` class provides a default frame for displaying
2704
+ documents on separate windows. This class can only be used for MDI child
2705
+ frames.
2706
+
2707
+ The class is part of the document/view framework and cooperates with the
2708
+ :class:`View`, :class:`Document`, :class:`DocManager` and :class:`DocTemplate`
2709
+ classes.
2710
+ """
2711
+
2712
+
2713
+ def __init__(self, doc, view, frame, id, title, pos=wx.DefaultPosition, size=wx.DefaultSize, style=wx.DEFAULT_FRAME_STYLE, name="frame"):
2714
+ """
2715
+ Constructor. Note that the event table must be rebuilt for the
2716
+ frame since the EvtHandler is not virtual.
2717
+ """
2718
+ wx.MDIChildFrame.__init__(self, frame, id, title, pos, size, style, name)
2719
+ self._childDocument = doc
2720
+ self._childView = view
2721
+ if view:
2722
+ view.SetFrame(self)
2723
+ # self.Create(doc, view, frame, id, title, pos, size, style, name)
2724
+ self._activeEvent = None
2725
+ self._activated = 0
2726
+ self.Bind(wx.EVT_ACTIVATE, self.OnActivate)
2727
+ self.Bind(wx.EVT_CLOSE, self.OnCloseWindow)
2728
+
2729
+ if frame: # wxBug: For some reason the EVT_ACTIVATE event is not getting triggered for the first mdi client window that is opened so we have to do it manually
2730
+ mdiChildren = filter(lambda x: isinstance(x, wx.MDIChildFrame), frame.GetChildren())
2731
+ if len(mdiChildren) == 1:
2732
+ self.Activate()
2733
+
2734
+
2735
+ ## # Couldn't get this to work, but seems to work fine with single stage construction
2736
+ ## def Create(self, doc, view, frame, id, title, pos, size, style, name):
2737
+ ## self._childDocument = doc
2738
+ ## self._childView = view
2739
+ ## if wx.MDIChildFrame.Create(self, frame, id, title, pos, size, style, name):
2740
+ ## if view:
2741
+ ## view.SetFrame(self)
2742
+ ## return True
2743
+ ## return False
2744
+
2745
+
2746
+
2747
+ def Activate(self): # Need this in case there are embedded sash windows and such, OnActivate is not getting called
2748
+ """
2749
+ Activates the current view.
2750
+ """
2751
+ if self._childView:
2752
+ self._childView.Activate(True)
2753
+
2754
+
2755
+ def ProcessEvent(event):
2756
+ """
2757
+ Processes an event, searching event tables and calling zero or more
2758
+ suitable event handler function(s).
2759
+ """
2760
+ if self._activeEvent == event:
2761
+ return False
2762
+
2763
+ self._activeEvent = event # Break recursion loops
2764
+
2765
+ if self._childView:
2766
+ self._childView.Activate(True)
2767
+
2768
+ if not self._childView or not self._childView.ProcessEvent(event):
2769
+ if not isinstance(event, wx.CommandEvent) or not self.GetParent() or not self.GetParent().ProcessEvent(event):
2770
+ ret = False
2771
+ else:
2772
+ ret = True
2773
+ else:
2774
+ ret = True
2775
+
2776
+ self._activeEvent = None
2777
+ return ret
2778
+
2779
+
2780
+ def OnActivate(self, event):
2781
+ """
2782
+ Sets the currently active view to be the frame's view. You may need to
2783
+ override (but still call) this function in order to set the keyboard
2784
+ focus for your subwindow.
2785
+ """
2786
+ event.Skip()
2787
+ if self._activated != 0:
2788
+ return True
2789
+ self._activated += 1
2790
+ wx.MDIChildFrame.Activate(self)
2791
+ if event.GetActive() and self._childView:
2792
+ self._childView.Activate(event.GetActive())
2793
+ self._activated = 0
2794
+
2795
+
2796
+ def OnCloseWindow(self, event):
2797
+ """
2798
+ Closes and deletes the current view and document.
2799
+ """
2800
+ if self._childView:
2801
+ ans = False
2802
+ if not event.CanVeto():
2803
+ ans = True
2804
+ else:
2805
+ ans = self._childView.Close(deleteWindow = False)
2806
+
2807
+ if ans:
2808
+ self._childView.Activate(False)
2809
+ self._childView.Destroy()
2810
+ self._childView = None
2811
+ if self._childDocument: # This isn't in the wxWindows codebase but the document needs to be disposed of somehow
2812
+ self._childDocument.DeleteContents()
2813
+ if self._childDocument.GetDocumentManager():
2814
+ self._childDocument.GetDocumentManager().RemoveDocument(self._childDocument)
2815
+ self._childDocument = None
2816
+ self.Destroy()
2817
+ else:
2818
+ event.Veto()
2819
+ else:
2820
+ event.Veto()
2821
+
2822
+
2823
+ def GetDocument(self):
2824
+ """
2825
+ Returns the document associated with this frame.
2826
+ """
2827
+ return self._childDocument
2828
+
2829
+
2830
+ def SetDocument(self, document):
2831
+ """
2832
+ Sets the document for this frame.
2833
+ """
2834
+ self._childDocument = document
2835
+
2836
+
2837
+ def GetView(self):
2838
+ """
2839
+ Returns the view associated with this frame.
2840
+ """
2841
+ return self._childView
2842
+
2843
+
2844
+ def SetView(self, view):
2845
+ """
2846
+ Sets the view for this frame.
2847
+ """
2848
+ self._childView = view
2849
+
2850
+
2851
+ def OnTitleIsModified(self):
2852
+ """
2853
+ Add/remove to the frame's title an indication that the document is dirty.
2854
+ If the document is dirty, an '*' is appended to the title
2855
+ """
2856
+ title = self.GetTitle()
2857
+ if title:
2858
+ if self.GetDocument().IsModified():
2859
+ if title.endswith("*"):
2860
+ return
2861
+ else:
2862
+ title = title + "*"
2863
+ self.SetTitle(title)
2864
+ else:
2865
+ if title.endswith("*"):
2866
+ title = title[:-1]
2867
+ self.SetTitle(title)
2868
+ else:
2869
+ return
2870
+
2871
+
2872
+ class DocPrintout(wx.Printout):
2873
+ """
2874
+ DocPrintout is a default :class:`wx.Printout` that prints the first
2875
+ page of a document view.
2876
+ """
2877
+
2878
+
2879
+ def __init__(self, view, title="Printout"):
2880
+ """
2881
+ Constructor.
2882
+ """
2883
+ wx.Printout.__init__(self, title)
2884
+ self._printoutView = view
2885
+
2886
+
2887
+ def GetView(self):
2888
+ """
2889
+ Returns the DocPrintout's view.
2890
+ """
2891
+ return self._printoutView
2892
+
2893
+
2894
+ def OnPrintPage(self, page):
2895
+ """
2896
+ Prints the first page of the view.
2897
+ """
2898
+ dc = self.GetDC()
2899
+ ppiScreenX, ppiScreenY = self.GetPPIScreen()
2900
+ ppiPrinterX, ppiPrinterY = self.GetPPIPrinter()
2901
+ scale = ppiPrinterX/ppiScreenX
2902
+ w, h = dc.GetSize()
2903
+ pageWidth, pageHeight = self.GetPageSizePixels()
2904
+ overallScale = scale * w / pageWidth
2905
+ dc.SetUserScale(overallScale, overallScale)
2906
+ if self._printoutView:
2907
+ self._printoutView.OnDraw(dc)
2908
+ return True
2909
+
2910
+
2911
+ def HasPage(self, pageNum):
2912
+ """
2913
+ Indicates that the DocPrintout only has a single page.
2914
+ """
2915
+ return pageNum == 1
2916
+
2917
+
2918
+ def GetPageInfo(self):
2919
+ """
2920
+ Indicates that the DocPrintout only has a single page.
2921
+ """
2922
+ minPage = 1
2923
+ maxPage = 1
2924
+ selPageFrom = 1
2925
+ selPageTo = 1
2926
+ return (minPage, maxPage, selPageFrom, selPageTo)
2927
+
2928
+
2929
+ #----------------------------------------------------------------------
2930
+ # Command Classes
2931
+ #----------------------------------------------------------------------
2932
+
2933
+ class Command(wx.Object):
2934
+ """
2935
+ ``Command`` is a base class for modelling an application command,
2936
+ which is an action usually performed by selecting a menu item, pressing a
2937
+ toolbar button or any other means provided by the application to
2938
+ change the data or view.
2939
+ """
2940
+
2941
+
2942
+ def __init__(self, canUndo = False, name = None):
2943
+ """
2944
+ Constructor. :class:`Command` is an abstract class, so you will need to
2945
+ derive a new class and call this constructor from your own constructor.
2946
+
2947
+ ``canUndo`` tells the command processor whether this command is undo-able.
2948
+ You can achieve the same functionality by overriding the CanUndo member
2949
+ function (if for example the criteria for undoability is context-
2950
+ dependent).
2951
+
2952
+ ``name`` must be supplied for the command processor to display the command
2953
+ name in the application's edit menu.
2954
+ """
2955
+ self._canUndo = canUndo
2956
+ self._name = name
2957
+
2958
+
2959
+ def CanUndo(self):
2960
+ """
2961
+ Returns ``True`` if the command can be undone, false otherwise.
2962
+ """
2963
+ return self._canUndo
2964
+
2965
+
2966
+ def GetName(self):
2967
+ """
2968
+ Returns the command name.
2969
+ """
2970
+ return self._name
2971
+
2972
+
2973
+ def Do(self):
2974
+ """
2975
+ Override this member function to execute the appropriate action when
2976
+ called. Return ``True`` to indicate that the action has taken place, false
2977
+ otherwise. Returning false will indicate to the command processor that
2978
+ the action is not undoable and should not be added to the command
2979
+ history.
2980
+ """
2981
+ return True
2982
+
2983
+
2984
+ def Undo(self):
2985
+ """
2986
+ Override this member function to un-execute a previous :meth:`Do`.
2987
+ Return ``True`` to indicate that the action has taken place, ``False``
2988
+ otherwise. Returning ``False`` will indicate to the command processor
2989
+ that the action is not redoable and no change should be made to the
2990
+ command history.
2991
+
2992
+ How you implement this command is totally application dependent, but
2993
+ typical strategies include:
2994
+
2995
+ Perform an inverse operation on the last modified piece of data in the
2996
+ document. When redone, a copy of data stored in command is pasted back
2997
+ or some operation reapplied. This relies on the fact that you know the
2998
+ ordering of Undos; the user can never Undo at an arbitrary position in
2999
+ he command history.
3000
+
3001
+ Restore the entire document state (perhaps using document
3002
+ transactioning). Potentially very inefficient, but possibly easier to
3003
+ code if the user interface and data are complex, and an 'inverse
3004
+ execute' operation is hard to write.
3005
+ """
3006
+ return True
3007
+
3008
+
3009
+ class CommandProcessor(wx.Object):
3010
+ """
3011
+ :class:`CommandProcessor` is a class that maintains a history of
3012
+ :class:`Commands`, with undo/redo functionality built-in. Derive a
3013
+ new class from this if you want different behaviour.
3014
+ """
3015
+
3016
+
3017
+ def __init__(self, maxCommands=-1):
3018
+ """
3019
+ Constructor. ``maxCommands`` may be set to a positive integer to limit
3020
+ the number of commands stored to it, otherwise (and by default) the
3021
+ list of commands can grow arbitrarily.
3022
+ """
3023
+ self._maxCommands = maxCommands
3024
+ self._editMenu = None
3025
+ self._undoAccelerator = _("Ctrl+Z")
3026
+ self._redoAccelerator = _("Ctrl+Y")
3027
+ self.ClearCommands()
3028
+
3029
+
3030
+ def _GetCurrentCommand(self):
3031
+ if len(self._commands) == 0:
3032
+ return None
3033
+ else:
3034
+ return self._commands[-1]
3035
+
3036
+
3037
+ def _GetCurrentRedoCommand(self):
3038
+ if len(self._redoCommands) == 0:
3039
+ return None
3040
+ else:
3041
+ return self._redoCommands[-1]
3042
+
3043
+
3044
+ def GetMaxCommands(self):
3045
+ """
3046
+ Returns the maximum number of commands that the command processor
3047
+ stores.
3048
+
3049
+ """
3050
+ return self._maxCommands
3051
+
3052
+
3053
+ def GetCommands(self):
3054
+ """
3055
+ Returns the list of commands.
3056
+ """
3057
+ return self._commands
3058
+
3059
+
3060
+ def ClearCommands(self):
3061
+ """
3062
+ Deletes all the commands in the list and sets the current command
3063
+ pointer to None.
3064
+ """
3065
+ self._commands = []
3066
+ self._redoCommands = []
3067
+
3068
+
3069
+ def GetEditMenu(self):
3070
+ """
3071
+ Returns the edit menu associated with the command processor.
3072
+ """
3073
+ return self._editMenu
3074
+
3075
+
3076
+ def SetEditMenu(self, menu):
3077
+ """
3078
+ Tells the command processor to update the Undo and Redo items on this
3079
+ menu as appropriate. Set this to ``None`` if the menu is about to be
3080
+ destroyed and command operations may still be performed, or the
3081
+ command processor may try to access an invalid pointer.
3082
+ """
3083
+ self._editMenu = menu
3084
+
3085
+
3086
+ def GetUndoAccelerator(self):
3087
+ """
3088
+ Returns the string that will be appended to the Undo menu item.
3089
+ """
3090
+ return self._undoAccelerator
3091
+
3092
+
3093
+ def SetUndoAccelerator(self, accel):
3094
+ """
3095
+ Sets the string that will be appended to the Redo menu item.
3096
+ """
3097
+ self._undoAccelerator = accel
3098
+
3099
+
3100
+ def GetRedoAccelerator(self):
3101
+ """
3102
+ Returns the string that will be appended to the Redo menu item.
3103
+ """
3104
+ return self._redoAccelerator
3105
+
3106
+
3107
+ def SetRedoAccelerator(self, accel):
3108
+ """
3109
+ Sets the string that will be appended to the Redo menu item.
3110
+ """
3111
+ self._redoAccelerator = accel
3112
+
3113
+
3114
+ def SetMenuStrings(self):
3115
+ """
3116
+ Sets the menu labels according to the currently set menu and the
3117
+ current command state.
3118
+ """
3119
+ if self.GetEditMenu() is not None:
3120
+ undoCommand = self._GetCurrentCommand()
3121
+ redoCommand = self._GetCurrentRedoCommand()
3122
+ undoItem = self.GetEditMenu().FindItemById(wx.ID_UNDO)
3123
+ redoItem = self.GetEditMenu().FindItemById(wx.ID_REDO)
3124
+ if self.GetUndoAccelerator():
3125
+ undoAccel = '\t' + self.GetUndoAccelerator()
3126
+ else:
3127
+ undoAccel = ''
3128
+ if self.GetRedoAccelerator():
3129
+ redoAccel = '\t' + self.GetRedoAccelerator()
3130
+ else:
3131
+ redoAccel = ''
3132
+ if undoCommand and undoItem and undoCommand.CanUndo():
3133
+ undoItem.SetText(_("&Undo ") + undoCommand.GetName() + undoAccel)
3134
+ #elif undoCommand and not undoCommand.CanUndo():
3135
+ # undoItem.SetText(_("Can't Undo") + undoAccel)
3136
+ else:
3137
+ undoItem.SetText(_("&Undo" + undoAccel))
3138
+ if redoCommand and redoItem:
3139
+ redoItem.SetText(_("&Redo ") + redoCommand.GetName() + redoAccel)
3140
+ else:
3141
+ redoItem.SetText(_("&Redo") + redoAccel)
3142
+
3143
+
3144
+ def CanUndo(self):
3145
+ """
3146
+ Returns ``True`` if the currently-active command can be undone,
3147
+ ``False`` otherwise.
3148
+ """
3149
+ if self._GetCurrentCommand() is None:
3150
+ return False
3151
+ return self._GetCurrentCommand().CanUndo()
3152
+
3153
+
3154
+ def CanRedo(self):
3155
+ """
3156
+ Returns ``True`` if the currently-active command can be redone,
3157
+ ``False`` otherwise.
3158
+ """
3159
+ return self._GetCurrentRedoCommand() is not None
3160
+
3161
+
3162
+ def Submit(self, command, storeIt=True):
3163
+ """
3164
+ Submits a new command to the command processor. The command processor
3165
+ calls :meth:`Command.Do` to execute the command; if it succeeds, the
3166
+ command is stored in the history list, and the associated edit menu
3167
+ (if any) updated appropriately. If it fails, the command is deleted
3168
+ immediately. Once Submit has been called, the passed command should
3169
+ not be deleted directly by the application.
3170
+
3171
+ ``storeIt`` indicates whether the successful command should be stored in
3172
+ the history list.
3173
+ """
3174
+ done = command.Do()
3175
+ if done:
3176
+ del self._redoCommands[:]
3177
+ if storeIt:
3178
+ self._commands.append(command)
3179
+ if self._maxCommands > -1:
3180
+ if len(self._commands) > self._maxCommands:
3181
+ del self._commands[0]
3182
+ return done
3183
+
3184
+
3185
+ def Redo(self):
3186
+ """
3187
+ Redoes the command just undone.
3188
+ """
3189
+ cmd = self._GetCurrentRedoCommand()
3190
+ if not cmd:
3191
+ return False
3192
+ done = cmd.Do()
3193
+ if done:
3194
+ self._commands.append(self._redoCommands.pop())
3195
+ return done
3196
+
3197
+
3198
+ def Undo(self):
3199
+ """
3200
+ Undoes the command just executed.
3201
+ """
3202
+ cmd = self._GetCurrentCommand()
3203
+ if not cmd:
3204
+ return False
3205
+ done = cmd.Undo()
3206
+ if done:
3207
+ self._redoCommands.append(self._commands.pop())
3208
+ return done
3209
+
3210
+