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/pydocview.py ADDED
@@ -0,0 +1,3300 @@
1
+ #----------------------------------------------------------------------------
2
+ # Name: pydocview.py
3
+ # Purpose: Python extensions to the wxWindows docview framework
4
+ #
5
+ # Author: Peter Yared, Morgan Hua, Matt Fryer
6
+ #
7
+ # Created: 5/15/03
8
+ # Copyright: (c) 2003-2006 ActiveGrid, Inc.
9
+ # License: wxWindows license
10
+ # Tags: phoenix-port
11
+ #----------------------------------------------------------------------------
12
+
13
+
14
+ import wx
15
+ import wx.adv
16
+ import wx.lib.docview
17
+ import sys
18
+ import getopt
19
+ from wx.lib.rcsizer import RowColSizer
20
+ import os
21
+ import os.path
22
+ import time
23
+ import string
24
+ import pickle
25
+ import tempfile
26
+ import mmap
27
+ _ = wx.GetTranslation
28
+ if wx.Platform == '__WXMSW__':
29
+ _WINDOWS = True
30
+ else:
31
+ _WINDOWS = False
32
+
33
+ #----------------------------------------------------------------------------
34
+ # Constants
35
+ #----------------------------------------------------------------------------
36
+
37
+ VIEW_TOOLBAR_ID = wx.NewIdRef()
38
+ VIEW_STATUSBAR_ID = wx.NewIdRef()
39
+
40
+ EMBEDDED_WINDOW_TOP = 1
41
+ EMBEDDED_WINDOW_BOTTOM = 2
42
+ EMBEDDED_WINDOW_LEFT = 4
43
+ EMBEDDED_WINDOW_RIGHT = 8
44
+ EMBEDDED_WINDOW_TOPLEFT = 16
45
+ EMBEDDED_WINDOW_BOTTOMLEFT = 32
46
+ EMBEDDED_WINDOW_TOPRIGHT = 64
47
+ EMBEDDED_WINDOW_BOTTOMRIGHT = 128
48
+ EMBEDDED_WINDOW_ALL = EMBEDDED_WINDOW_TOP | EMBEDDED_WINDOW_BOTTOM | EMBEDDED_WINDOW_LEFT | EMBEDDED_WINDOW_RIGHT | \
49
+ EMBEDDED_WINDOW_TOPLEFT | EMBEDDED_WINDOW_BOTTOMLEFT | EMBEDDED_WINDOW_TOPRIGHT | EMBEDDED_WINDOW_BOTTOMRIGHT
50
+
51
+ SAVEALL_ID = wx.NewIdRef()
52
+
53
+ WINDOW_MENU_NUM_ITEMS = 9
54
+
55
+
56
+ class DocFrameMixIn:
57
+ """
58
+ Class with common code used by DocMDIParentFrame, DocTabbedParentFrame, and
59
+ DocSDIFrame.
60
+ """
61
+
62
+
63
+ def GetDocumentManager(self):
64
+ """
65
+ Returns the document manager associated with the DocMDIParentFrame.
66
+ """
67
+ return self._docManager
68
+
69
+
70
+ def InitializePrintData(self):
71
+ """
72
+ Initializes the PrintData that is used when printing.
73
+ """
74
+ self._printData = wx.PrintData()
75
+ self._printData.SetPaperId(wx.PAPER_LETTER)
76
+
77
+
78
+ def CreateDefaultMenuBar(self, sdi=False):
79
+ """
80
+ Creates the default MenuBar. Contains File, Edit, View, Tools, and Help menus.
81
+ """
82
+ menuBar = wx.MenuBar()
83
+
84
+ fileMenu = wx.Menu()
85
+ fileMenu.Append(wx.ID_NEW, _("&New...\tCtrl+N"), _("Creates a new document"))
86
+ fileMenu.Append(wx.ID_OPEN, _("&Open...\tCtrl+O"), _("Opens an existing document"))
87
+ fileMenu.Append(wx.ID_CLOSE, _("&Close"), _("Closes the active document"))
88
+ if not sdi:
89
+ fileMenu.Append(wx.ID_CLOSE_ALL, _("Close A&ll"), _("Closes all open documents"))
90
+ fileMenu.AppendSeparator()
91
+ fileMenu.Append(wx.ID_SAVE, _("&Save\tCtrl+S"), _("Saves the active document"))
92
+ fileMenu.Append(wx.ID_SAVEAS, _("Save &As..."), _("Saves the active document with a new name"))
93
+ fileMenu.Append(SAVEALL_ID, _("Save All\tCtrl+Shift+A"), _("Saves the all active documents"))
94
+ wx.EVT_MENU(self, SAVEALL_ID, self.ProcessEvent)
95
+ wx.EVT_UPDATE_UI(self, SAVEALL_ID, self.ProcessUpdateUIEvent)
96
+ fileMenu.AppendSeparator()
97
+ fileMenu.Append(wx.ID_PRINT, _("&Print\tCtrl+P"), _("Prints the active document"))
98
+ fileMenu.Append(wx.ID_PREVIEW, _("Print Pre&view"), _("Displays full pages"))
99
+ fileMenu.Append(wx.ID_PRINT_SETUP, _("Page Set&up"), _("Changes page layout settings"))
100
+ fileMenu.AppendSeparator()
101
+ if wx.Platform == '__WXMAC__':
102
+ fileMenu.Append(wx.ID_EXIT, _("&Quit"), _("Closes this program"))
103
+ else:
104
+ fileMenu.Append(wx.ID_EXIT, _("E&xit"), _("Closes this program"))
105
+ self._docManager.FileHistoryUseMenu(fileMenu)
106
+ self._docManager.FileHistoryAddFilesToMenu()
107
+ menuBar.Append(fileMenu, _("&File"));
108
+
109
+ editMenu = wx.Menu()
110
+ editMenu.Append(wx.ID_UNDO, _("&Undo\tCtrl+Z"), _("Reverses the last action"))
111
+ editMenu.Append(wx.ID_REDO, _("&Redo\tCtrl+Y"), _("Reverses the last undo"))
112
+ editMenu.AppendSeparator()
113
+ #item = wxMenuItem(self.editMenu, wxID_CUT, _("Cu&t\tCtrl+X"), _("Cuts the selection and puts it on the Clipboard"))
114
+ #item.SetBitmap(getCutBitmap())
115
+ #editMenu.AppendItem(item)
116
+ editMenu.Append(wx.ID_CUT, _("Cu&t\tCtrl+X"), _("Cuts the selection and puts it on the Clipboard"))
117
+ wx.EVT_MENU(self, wx.ID_CUT, self.ProcessEvent)
118
+ wx.EVT_UPDATE_UI(self, wx.ID_CUT, self.ProcessUpdateUIEvent)
119
+ editMenu.Append(wx.ID_COPY, _("&Copy\tCtrl+C"), _("Copies the selection and puts it on the Clipboard"))
120
+ wx.EVT_MENU(self, wx.ID_COPY, self.ProcessEvent)
121
+ wx.EVT_UPDATE_UI(self, wx.ID_COPY, self.ProcessUpdateUIEvent)
122
+ editMenu.Append(wx.ID_PASTE, _("&Paste\tCtrl+V"), _("Inserts Clipboard contents"))
123
+ wx.EVT_MENU(self, wx.ID_PASTE, self.ProcessEvent)
124
+ wx.EVT_UPDATE_UI(self, wx.ID_PASTE, self.ProcessUpdateUIEvent)
125
+ editMenu.Append(wx.ID_CLEAR, _("&Delete"), _("Erases the selection"))
126
+ wx.EVT_MENU(self, wx.ID_CLEAR, self.ProcessEvent)
127
+ wx.EVT_UPDATE_UI(self, wx.ID_CLEAR, self.ProcessUpdateUIEvent)
128
+ editMenu.AppendSeparator()
129
+ editMenu.Append(wx.ID_SELECTALL, _("Select A&ll\tCtrl+A"), _("Selects all available data"))
130
+ wx.EVT_MENU(self, wx.ID_SELECTALL, self.ProcessEvent)
131
+ wx.EVT_UPDATE_UI(self, wx.ID_SELECTALL, self.ProcessUpdateUIEvent)
132
+ menuBar.Append(editMenu, _("&Edit"))
133
+ if sdi:
134
+ if self.GetDocument() and self.GetDocument().GetCommandProcessor():
135
+ self.GetDocument().GetCommandProcessor().SetEditMenu(editMenu)
136
+
137
+ viewMenu = wx.Menu()
138
+ viewMenu.AppendCheckItem(VIEW_TOOLBAR_ID, _("&Toolbar"), _("Shows or hides the toolbar"))
139
+ wx.EVT_MENU(self, VIEW_TOOLBAR_ID, self.OnViewToolBar)
140
+ wx.EVT_UPDATE_UI(self, VIEW_TOOLBAR_ID, self.OnUpdateViewToolBar)
141
+ viewMenu.AppendCheckItem(VIEW_STATUSBAR_ID, _("&Status Bar"), _("Shows or hides the status bar"))
142
+ wx.EVT_MENU(self, VIEW_STATUSBAR_ID, self.OnViewStatusBar)
143
+ wx.EVT_UPDATE_UI(self, VIEW_STATUSBAR_ID, self.OnUpdateViewStatusBar)
144
+ menuBar.Append(viewMenu, _("&View"))
145
+
146
+ helpMenu = wx.Menu()
147
+ helpMenu.Append(wx.ID_ABOUT, _("&About" + " " + wx.GetApp().GetAppName()), _("Displays program information, version number, and copyright"))
148
+ menuBar.Append(helpMenu, _("&Help"))
149
+
150
+ wx.EVT_MENU(self, wx.ID_ABOUT, self.OnAbout)
151
+ wx.EVT_UPDATE_UI(self, wx.ID_ABOUT, self.ProcessUpdateUIEvent) # Using ID_ABOUT to update the window menu, the window menu items are not triggering
152
+
153
+ if sdi: # TODO: Is this really needed?
154
+ wx.EVT_COMMAND_FIND_CLOSE(self, -1, self.ProcessEvent)
155
+
156
+ return menuBar
157
+
158
+
159
+ def CreateDefaultStatusBar(self):
160
+ """
161
+ Creates the default StatusBar.
162
+ """
163
+ wx.Frame.CreateStatusBar(self)
164
+ self.GetStatusBar().Show(wx.ConfigBase.Get().ReadInt("ViewStatusBar", True))
165
+ self.UpdateStatus()
166
+ return self.GetStatusBar()
167
+
168
+
169
+ def CreateDefaultToolBar(self):
170
+ """
171
+ Creates the default ToolBar.
172
+ """
173
+ self._toolBar = self.CreateToolBar(wx.TB_HORIZONTAL | wx.NO_BORDER | wx.TB_FLAT)
174
+ self._toolBar.AddSimpleTool(wx.ID_NEW, New.GetBitmap(), _("New"), _("Creates a new document"))
175
+ self._toolBar.AddSimpleTool(wx.ID_OPEN, Open.GetBitmap(), _("Open"), _("Opens an existing document"))
176
+ self._toolBar.AddSimpleTool(wx.ID_SAVE, Save.GetBitmap(), _("Save"), _("Saves the active document"))
177
+ self._toolBar.AddSimpleTool(SAVEALL_ID, SaveAll.GetBitmap(), _("Save All"), _("Saves all the active documents"))
178
+ self._toolBar.AddSeparator()
179
+ self._toolBar.AddSimpleTool(wx.ID_PRINT, Print.GetBitmap(), _("Print"), _("Displays full pages"))
180
+ self._toolBar.AddSimpleTool(wx.ID_PREVIEW, PrintPreview.GetBitmap(), _("Print Preview"), _("Prints the active document"))
181
+ self._toolBar.AddSeparator()
182
+ self._toolBar.AddSimpleTool(wx.ID_CUT, Cut.GetBitmap(), _("Cut"), _("Cuts the selection and puts it on the Clipboard"))
183
+ self._toolBar.AddSimpleTool(wx.ID_COPY, Copy.GetBitmap(), _("Copy"), _("Copies the selection and puts it on the Clipboard"))
184
+ self._toolBar.AddSimpleTool(wx.ID_PASTE, Paste.GetBitmap(), _("Paste"), _("Inserts Clipboard contents"))
185
+ self._toolBar.AddSimpleTool(wx.ID_UNDO, Undo.GetBitmap(), _("Undo"), _("Reverses the last action"))
186
+ self._toolBar.AddSimpleTool(wx.ID_REDO, Redo.GetBitmap(), _("Redo"), _("Reverses the last undo"))
187
+ self._toolBar.Realize()
188
+ self._toolBar.Show(wx.ConfigBase.Get().ReadInt("ViewToolBar", True))
189
+
190
+ return self._toolBar
191
+
192
+
193
+ def OnFileSaveAll(self, event):
194
+ """
195
+ Saves all of the currently open documents.
196
+ """
197
+ docs = wx.GetApp().GetDocumentManager().GetDocuments()
198
+
199
+ # save child documents first
200
+ for doc in docs:
201
+ if isinstance(doc, wx.lib.pydocview.ChildDocument):
202
+ doc.Save()
203
+
204
+ # save parent and other documents later
205
+ for doc in docs:
206
+ if not isinstance(doc, wx.lib.pydocview.ChildDocument):
207
+ doc.Save()
208
+
209
+
210
+ def OnAbout(self, event):
211
+ """
212
+ Invokes the about dialog.
213
+ """
214
+ aboutService = wx.GetApp().GetService(AboutService)
215
+ if aboutService:
216
+ aboutService.ShowAbout()
217
+
218
+
219
+ def OnViewToolBar(self, event):
220
+ """
221
+ Toggles whether the ToolBar is visible.
222
+ """
223
+ self._toolBar.Show(not self._toolBar.IsShown())
224
+ self._LayoutFrame()
225
+
226
+
227
+ def OnUpdateViewToolBar(self, event):
228
+ """
229
+ Updates the View ToolBar menu item.
230
+ """
231
+ event.Check(self.GetToolBar().IsShown())
232
+
233
+
234
+ def OnViewStatusBar(self, event):
235
+ """
236
+ Toggles whether the StatusBar is visible.
237
+ """
238
+ self.GetStatusBar().Show(not self.GetStatusBar().IsShown())
239
+ self._LayoutFrame()
240
+
241
+
242
+ def OnUpdateViewStatusBar(self, event):
243
+ """
244
+ Updates the View StatusBar menu item.
245
+ """
246
+ event.Check(self.GetStatusBar().IsShown())
247
+
248
+
249
+ def UpdateStatus(self, message = _("Ready")):
250
+ """
251
+ Updates the StatusBar.
252
+ """
253
+ # wxBug: Menubar and toolbar help strings don't pop the status text back
254
+ if self.GetStatusBar().GetStatusText() != message:
255
+ self.GetStatusBar().PushStatusText(message)
256
+
257
+
258
+ class DocMDIParentFrameMixIn:
259
+ """
260
+ Class with common code used by DocMDIParentFrame and DocTabbedParentFrame.
261
+ """
262
+
263
+
264
+ def _GetPosSizeFromConfig(self, pos, size):
265
+ """
266
+ Adjusts the position and size of the frame using the saved config position and size.
267
+ """
268
+ config = wx.ConfigBase.Get()
269
+ if pos == wx.DefaultPosition and size == wx.DefaultSize and config.ReadInt("MDIFrameMaximized", False):
270
+ pos = [0, 0]
271
+ size = wx.DisplaySize()
272
+ # wxBug: Need to set to fill screen to get around bug where maximize is leaving shadow of statusbar, check out maximize call at end of this function
273
+ else:
274
+ if pos == wx.DefaultPosition:
275
+ pos = config.ReadInt("MDIFrameXLoc", -1), config.ReadInt("MDIFrameYLoc", -1)
276
+
277
+ if wx.Display.GetFromPoint(pos) == -1: # Check if the frame position is offscreen
278
+ pos = wx.DefaultPosition
279
+
280
+ if size == wx.DefaultSize:
281
+ size = wx.Size(config.ReadInt("MDIFrameXSize", 450), config.ReadInt("MDIFrameYSize", 300))
282
+ return pos, size
283
+
284
+
285
+ def _InitFrame(self, embeddedWindows, minSize):
286
+ """
287
+ Initializes the frame and creates the default menubar, toolbar, and status bar.
288
+ """
289
+ self._embeddedWindows = []
290
+ self.SetDropTarget(_DocFrameFileDropTarget(self._docManager, self))
291
+
292
+ if wx.GetApp().GetDefaultIcon():
293
+ self.SetIcon(wx.GetApp().GetDefaultIcon())
294
+
295
+ wx.EVT_MENU(self, wx.ID_ABOUT, self.OnAbout)
296
+ wx.EVT_SIZE(self, self.OnSize)
297
+
298
+ self.InitializePrintData()
299
+
300
+ toolBar = self.CreateDefaultToolBar()
301
+ self.SetToolBar(toolBar)
302
+ menuBar = self.CreateDefaultMenuBar()
303
+ statusBar = self.CreateDefaultStatusBar()
304
+
305
+ config = wx.ConfigBase.Get()
306
+ if config.ReadInt("MDIFrameMaximized", False):
307
+ # wxBug: On maximize, statusbar leaves a residual that needs to be refereshed, happens even when user does it
308
+ self.Maximize()
309
+
310
+ self.CreateEmbeddedWindows(embeddedWindows, minSize)
311
+ self._LayoutFrame()
312
+
313
+ if wx.Platform == '__WXMAC__':
314
+ self.SetMenuBar(menuBar) # wxBug: Have to set the menubar at the very end or the automatic MDI "window" menu doesn't get put in the right place when the services add new menus to the menubar
315
+
316
+ wx.GetApp().SetTopWindow(self) # Need to do this here in case the services are looking for wx.GetApp().GetTopWindow()
317
+ for service in wx.GetApp().GetServices():
318
+ service.InstallControls(self, menuBar = menuBar, toolBar = toolBar, statusBar = statusBar)
319
+ if hasattr(service, "ShowWindow"):
320
+ service.ShowWindow() # instantiate service windows for correct positioning, we'll hide/show them later based on user preference
321
+
322
+ if wx.Platform != '__WXMAC__':
323
+ self.SetMenuBar(menuBar) # wxBug: Have to set the menubar at the very end or the automatic MDI "window" menu doesn't get put in the right place when the services add new menus to the menubar
324
+
325
+
326
+ def ProcessEvent(self, event):
327
+ """
328
+ Processes an event, searching event tables and calling zero or more
329
+ suitable event handler function(s). Note that the ProcessEvent
330
+ method is called from the wxPython docview framework directly since
331
+ wxPython does not have a virtual ProcessEvent function.
332
+ """
333
+ id = event.GetId()
334
+ if id == SAVEALL_ID:
335
+ self.OnFileSaveAll(event)
336
+ return True
337
+
338
+ return wx.GetApp().ProcessEvent(event)
339
+
340
+
341
+ def ProcessUpdateUIEvent(self, event):
342
+ """
343
+ Processes a UI event, searching event tables and calling zero or more
344
+ suitable event handler function(s). Note that the ProcessEvent
345
+ method is called from the wxPython docview framework directly since
346
+ wxPython does not have a virtual ProcessEvent function.
347
+ """
348
+ id = event.GetId()
349
+ if id == wx.ID_CUT:
350
+ event.Enable(False)
351
+ return True
352
+ elif id == wx.ID_COPY:
353
+ event.Enable(False)
354
+ return True
355
+ elif id == wx.ID_PASTE:
356
+ event.Enable(False)
357
+ return True
358
+ elif id == wx.ID_CLEAR:
359
+ event.Enable(False)
360
+ return True
361
+ elif id == wx.ID_SELECTALL:
362
+ event.Enable(False)
363
+ return True
364
+ elif id == SAVEALL_ID:
365
+ filesModified = False
366
+ docs = wx.GetApp().GetDocumentManager().GetDocuments()
367
+ for doc in docs:
368
+ if doc.IsModified():
369
+ filesModified = True
370
+ break
371
+
372
+ event.Enable(filesModified)
373
+ return True
374
+ else:
375
+ return wx.GetApp().ProcessUpdateUIEvent(event)
376
+
377
+
378
+ def CreateEmbeddedWindows(self, windows=0, minSize=20):
379
+ """
380
+ Create the specified embedded windows around the edges of the frame.
381
+ """
382
+ frameSize = self.GetSize() # TODO: GetClientWindow.GetSize is still returning 0,0 since the frame isn't fully constructed yet, so using full frame size
383
+ defaultHSize = max(minSize, int(frameSize[0] / 6))
384
+ defaultVSize = max(minSize, int(frameSize[1] / 7))
385
+ defaultSubVSize = int(frameSize[1] / 2)
386
+ config = wx.ConfigBase.Get()
387
+ if windows & (EMBEDDED_WINDOW_LEFT | EMBEDDED_WINDOW_TOPLEFT | EMBEDDED_WINDOW_BOTTOMLEFT):
388
+ self._leftEmbWindow = self._CreateEmbeddedWindow(self, (max(minSize,config.ReadInt("MDIEmbedLeftSize", defaultHSize)), -1), wx.LAYOUT_VERTICAL, wx.LAYOUT_LEFT, visible = config.ReadInt("MDIEmbedLeftVisible", 1), sash = wx.SASH_RIGHT)
389
+ else:
390
+ self._leftEmbWindow = None
391
+ if windows & EMBEDDED_WINDOW_TOPLEFT:
392
+ self._topLeftEmbWindow = self._CreateEmbeddedWindow(self._leftEmbWindow, (-1, config.ReadInt("MDIEmbedTopLeftSize", defaultSubVSize)), wx.LAYOUT_HORIZONTAL, wx.LAYOUT_TOP, visible = config.ReadInt("MDIEmbedTopLeftVisible", 1), sash = wx.SASH_BOTTOM)
393
+ else:
394
+ self._topLeftEmbWindow = None
395
+ if windows & EMBEDDED_WINDOW_BOTTOMLEFT:
396
+ self._bottomLeftEmbWindow = self._CreateEmbeddedWindow(self._leftEmbWindow, (-1, config.ReadInt("MDIEmbedBottomLeftSize", defaultSubVSize)), wx.LAYOUT_HORIZONTAL, wx.LAYOUT_BOTTOM, visible = config.ReadInt("MDIEmbedBottomLeftVisible", 1))
397
+ else:
398
+ self._bottomLeftEmbWindow = None
399
+ if windows & (EMBEDDED_WINDOW_RIGHT | EMBEDDED_WINDOW_TOPRIGHT | EMBEDDED_WINDOW_BOTTOMRIGHT):
400
+ self._rightEmbWindow = self._CreateEmbeddedWindow(self, (max(minSize,config.ReadInt("MDIEmbedRightSize", defaultHSize)), -1), wx.LAYOUT_VERTICAL, wx.LAYOUT_RIGHT, visible = config.ReadInt("MDIEmbedRightVisible", 1), sash = wx.SASH_LEFT)
401
+ else:
402
+ self._rightEmbWindow = None
403
+ if windows & EMBEDDED_WINDOW_TOPRIGHT:
404
+ self._topRightEmbWindow = self._CreateEmbeddedWindow(self._rightEmbWindow, (-1, config.ReadInt("MDIEmbedTopRightSize", defaultSubVSize)), wx.LAYOUT_HORIZONTAL, wx.LAYOUT_TOP, visible = config.ReadInt("MDIEmbedTopRightVisible", 1), sash = wx.SASH_BOTTOM)
405
+ else:
406
+ self._topRightEmbWindow = None
407
+ if windows & EMBEDDED_WINDOW_BOTTOMRIGHT:
408
+ self._bottomRightEmbWindow = self._CreateEmbeddedWindow(self._rightEmbWindow, (-1, config.ReadInt("MDIEmbedBottomRightSize", defaultSubVSize)), wx.LAYOUT_HORIZONTAL, wx.LAYOUT_BOTTOM, visible = config.ReadInt("MDIEmbedBottomRightVisible", 1))
409
+ else:
410
+ self._bottomRightEmbWindow = None
411
+ if windows & EMBEDDED_WINDOW_TOP:
412
+ self._topEmbWindow = self._CreateEmbeddedWindow(self, (-1, max(minSize,config.ReadInt("MDIEmbedTopSize", defaultVSize))), wx.LAYOUT_HORIZONTAL, wx.LAYOUT_TOP, visible = config.ReadInt("MDIEmbedTopVisible", 1), sash = wx.SASH_BOTTOM)
413
+ else:
414
+ self._topEmbWindow = None
415
+ if windows & EMBEDDED_WINDOW_BOTTOM:
416
+ self._bottomEmbWindow = self._CreateEmbeddedWindow(self, (-1, max(minSize,config.ReadInt("MDIEmbedBottomSize", defaultVSize))), wx.LAYOUT_HORIZONTAL, wx.LAYOUT_BOTTOM, visible = config.ReadInt("MDIEmbedBottomVisible", 1), sash = wx.SASH_TOP)
417
+ else:
418
+ self._bottomEmbWindow = None
419
+
420
+
421
+ def SaveEmbeddedWindowSizes(self):
422
+ """
423
+ Saves the sizes of the embedded windows.
424
+ """
425
+ config = wx.ConfigBase.Get()
426
+ if not self.IsMaximized():
427
+ config.WriteInt("MDIFrameXLoc", self.GetPosition()[0])
428
+ config.WriteInt("MDIFrameYLoc", self.GetPosition()[1])
429
+ config.WriteInt("MDIFrameXSize", self.GetSize()[0])
430
+ config.WriteInt("MDIFrameYSize", self.GetSize()[1])
431
+ config.WriteInt("MDIFrameMaximized", self.IsMaximized())
432
+ config.WriteInt("ViewToolBar", self._toolBar.IsShown())
433
+ config.WriteInt("ViewStatusBar", self.GetStatusBar().IsShown())
434
+
435
+ if self._leftEmbWindow:
436
+ config.WriteInt("MDIEmbedLeftSize", self._leftEmbWindow.GetSize()[0])
437
+ config.WriteInt("MDIEmbedLeftVisible", self._leftEmbWindow.IsShown())
438
+ if self._topLeftEmbWindow:
439
+ if self._topLeftEmbWindow._sizeBeforeHidden:
440
+ size = self._topLeftEmbWindow._sizeBeforeHidden[1]
441
+ else:
442
+ size = self._topLeftEmbWindow.GetSize()[1]
443
+ config.WriteInt("MDIEmbedTopLeftSize", size)
444
+ config.WriteInt("MDIEmbedTopLeftVisible", self._topLeftEmbWindow.IsShown())
445
+ if self._bottomLeftEmbWindow:
446
+ if self._bottomLeftEmbWindow._sizeBeforeHidden:
447
+ size = self._bottomLeftEmbWindow._sizeBeforeHidden[1]
448
+ else:
449
+ size = self._bottomLeftEmbWindow.GetSize()[1]
450
+ config.WriteInt("MDIEmbedBottomLeftSize", size)
451
+ config.WriteInt("MDIEmbedBottomLeftVisible", self._bottomLeftEmbWindow.IsShown())
452
+ if self._rightEmbWindow:
453
+ config.WriteInt("MDIEmbedRightSize", self._rightEmbWindow.GetSize()[0])
454
+ config.WriteInt("MDIEmbedRightVisible", self._rightEmbWindow.IsShown())
455
+ if self._topRightEmbWindow:
456
+ if self._topRightEmbWindow._sizeBeforeHidden:
457
+ size = self._topRightEmbWindow._sizeBeforeHidden[1]
458
+ else:
459
+ size = self._topRightEmbWindow.GetSize()[1]
460
+ config.WriteInt("MDIEmbedTopRightSize", size)
461
+ config.WriteInt("MDIEmbedTopRightVisible", self._topRightEmbWindow.IsShown())
462
+ if self._bottomRightEmbWindow:
463
+ if self._bottomRightEmbWindow._sizeBeforeHidden:
464
+ size = self._bottomRightEmbWindow._sizeBeforeHidden[1]
465
+ else:
466
+ size = self._bottomRightEmbWindow.GetSize()[1]
467
+ config.WriteInt("MDIEmbedBottomRightSize", size)
468
+ config.WriteInt("MDIEmbedBottomRightVisible", self._bottomRightEmbWindow.IsShown())
469
+ if self._topEmbWindow:
470
+ config.WriteInt("MDIEmbedTopSize", self._topEmbWindow.GetSize()[1])
471
+ config.WriteInt("MDIEmbedTopVisible", self._topEmbWindow.IsShown())
472
+ if self._bottomEmbWindow:
473
+ config.WriteInt("MDIEmbedBottomSize", self._bottomEmbWindow.GetSize()[1])
474
+ config.WriteInt("MDIEmbedBottomVisible", self._bottomEmbWindow.IsShown())
475
+
476
+
477
+ def GetEmbeddedWindow(self, loc):
478
+ """
479
+ Returns the instance of the embedded window specified by the embedded window location constant.
480
+ """
481
+ if loc == EMBEDDED_WINDOW_TOP:
482
+ return self._topEmbWindow
483
+ elif loc == EMBEDDED_WINDOW_BOTTOM:
484
+ return self._bottomEmbWindow
485
+ elif loc == EMBEDDED_WINDOW_LEFT:
486
+ return self._leftEmbWindow
487
+ elif loc == EMBEDDED_WINDOW_RIGHT:
488
+ return self._rightEmbWindow
489
+ elif loc == EMBEDDED_WINDOW_TOPLEFT:
490
+ return self._topLeftEmbWindow
491
+ elif loc == EMBEDDED_WINDOW_BOTTOMLEFT:
492
+ return self._bottomLeftEmbWindow
493
+ elif loc == EMBEDDED_WINDOW_TOPRIGHT:
494
+ return self._topRightEmbWindow
495
+ elif loc == EMBEDDED_WINDOW_BOTTOMRIGHT:
496
+ return self._bottomRightEmbWindow
497
+ return None
498
+
499
+
500
+ def _CreateEmbeddedWindow(self, parent, size, orientation, alignment, visible=True, sash=None):
501
+ """
502
+ Creates the embedded window with the specified size, orientation, and alignment. If the
503
+ window is not visible it will retain the size with which it was last viewed.
504
+ """
505
+ window = wx.SashLayoutWindow(parent, wx.ID_ANY, style = wx.NO_BORDER | wx.SW_3D)
506
+ window.SetDefaultSize(size)
507
+ window.SetOrientation(orientation)
508
+ window.SetAlignment(alignment)
509
+ if sash is not None: # wx.SASH_TOP is 0 so check for None instead of just doing "if sash:"
510
+ window.SetSashVisible(sash, True)
511
+ ####
512
+ def OnEmbeddedWindowSashDrag(event):
513
+ if event.GetDragStatus() == wx.SASH_STATUS_OUT_OF_RANGE:
514
+ return
515
+ sashWindow = event.GetEventObject()
516
+ if sashWindow.GetAlignment() == wx.LAYOUT_TOP or sashWindow.GetAlignment() == wx.LAYOUT_BOTTOM:
517
+ size = wx.Size(-1, event.GetDragRect().height)
518
+ else:
519
+ size = wx.Size(event.GetDragRect().width, -1)
520
+ event.GetEventObject().SetDefaultSize(size)
521
+ self._LayoutFrame()
522
+ sashWindow.Refresh()
523
+ if isinstance(sashWindow.GetParent(), wx.SashLayoutWindow):
524
+ sashWindow.Show()
525
+ parentSashWindow = sashWindow.GetParent() # Force a refresh
526
+ parentSashWindow.Layout()
527
+ parentSashWindow.Refresh()
528
+ parentSashWindow.SetSize((parentSashWindow.GetSize().width + 1, parentSashWindow.GetSize().height + 1))
529
+ ####
530
+ wx.EVT_SASH_DRAGGED(window, window.GetId(), OnEmbeddedWindowSashDrag)
531
+ window._sizeBeforeHidden = None
532
+ if not visible:
533
+ window.Show(False)
534
+ if isinstance(parent, wx.SashLayoutWindow): # It's a window embedded in another sash window so remember its actual size to show it again
535
+ window._sizeBeforeHidden = size
536
+ return window
537
+
538
+
539
+ def ShowEmbeddedWindow(self, window, show=True):
540
+ """
541
+ Shows or hides the embedded window specified by the embedded window location constant.
542
+ """
543
+ window.Show(show)
544
+ if isinstance(window.GetParent(), wx.SashLayoutWindow): # It is a parent sashwindow with multiple embedded sashwindows
545
+ parentSashWindow = window.GetParent()
546
+ if show: # Make sure it is visible in case all of the subwindows were hidden
547
+ parentSashWindow.Show()
548
+ if show and window._sizeBeforeHidden:
549
+ if window._sizeBeforeHidden[1] == parentSashWindow.GetClientSize()[1]:
550
+ if window == self.GetEmbeddedWindow(EMBEDDED_WINDOW_BOTTOMLEFT) and self.GetEmbeddedWindow(EMBEDDED_WINDOW_TOPLEFT).IsShown():
551
+ window.SetDefaultSize((window._sizeBeforeHidden[0], window._sizeBeforeHidden[0] - self.GetEmbeddedWindow(EMBEDDED_WINDOW_TOPLEFT).GetSize()[1]))
552
+ elif window == self.GetEmbeddedWindow(EMBEDDED_WINDOW_TOPLEFT) and self.GetEmbeddedWindow(EMBEDDED_WINDOW_BOTTOMLEFT).IsShown():
553
+ window.SetDefaultSize((window._sizeBeforeHidden[0], window._sizeBeforeHidden[0] - self.GetEmbeddedWindow(EMBEDDED_WINDOW_BOTTOMLEFT).GetSize()[1]))
554
+ elif window == self.GetEmbeddedWindow(EMBEDDED_WINDOW_BOTTOMRIGHT) and self.GetEmbeddedWindow(EMBEDDED_WINDOW_TOPRIGHT).IsShown():
555
+ window.SetDefaultSize((window._sizeBeforeHidden[0], window._sizeBeforeHidden[0] - self.GetEmbeddedWindow(EMBEDDED_WINDOW_TOPRIGHT).GetSize()[1]))
556
+ elif window == self.GetEmbeddedWindow(EMBEDDED_WINDOW_TOPRIGHT) and self.GetEmbeddedWindow(EMBEDDED_WINDOW_BOTTOMRIGHT).IsShown():
557
+ window.SetDefaultSize((window._sizeBeforeHidden[0], window._sizeBeforeHidden[0] - self.GetEmbeddedWindow(EMBEDDED_WINDOW_BOTTOMRIGHT).GetSize()[1]))
558
+ else:
559
+ window.SetDefaultSize(window._sizeBeforeHidden)
560
+ # If it is not the size of the full parent sashwindow set the other window's size so that if it gets shown it will have a cooresponding size
561
+ if window._sizeBeforeHidden[1] < parentSashWindow.GetClientSize()[1]:
562
+ otherWindowSize = (-1, parentSashWindow.GetClientSize()[1] - window._sizeBeforeHidden[1])
563
+ if window == self.GetEmbeddedWindow(EMBEDDED_WINDOW_BOTTOMLEFT):
564
+ self.GetEmbeddedWindow(EMBEDDED_WINDOW_TOPLEFT).SetDefaultSize(otherWindowSize)
565
+ elif window == self.GetEmbeddedWindow(EMBEDDED_WINDOW_TOPLEFT):
566
+ self.GetEmbeddedWindow(EMBEDDED_WINDOW_BOTTOMLEFT).SetDefaultSize(otherWindowSize)
567
+ elif window == self.GetEmbeddedWindow(EMBEDDED_WINDOW_BOTTOMRIGHT):
568
+ self.GetEmbeddedWindow(EMBEDDED_WINDOW_TOPRIGHT).SetDefaultSize(otherWindowSize)
569
+ elif window == self.GetEmbeddedWindow(EMBEDDED_WINDOW_TOPRIGHT):
570
+ self.GetEmbeddedWindow(EMBEDDED_WINDOW_BOTTOMRIGHT).SetDefaultSize(otherWindowSize)
571
+
572
+ if not show:
573
+ if window == self.GetEmbeddedWindow(EMBEDDED_WINDOW_BOTTOMRIGHT) and not self.GetEmbeddedWindow(EMBEDDED_WINDOW_TOPRIGHT).IsShown() \
574
+ or window == self.GetEmbeddedWindow(EMBEDDED_WINDOW_TOPRIGHT) and not self.GetEmbeddedWindow(EMBEDDED_WINDOW_BOTTOMRIGHT).IsShown() \
575
+ or window == self.GetEmbeddedWindow(EMBEDDED_WINDOW_BOTTOMLEFT) and not self.GetEmbeddedWindow(EMBEDDED_WINDOW_TOPLEFT).IsShown() \
576
+ or window == self.GetEmbeddedWindow(EMBEDDED_WINDOW_TOPLEFT) and not self.GetEmbeddedWindow(EMBEDDED_WINDOW_BOTTOMLEFT).IsShown():
577
+ parentSashWindow.Hide() # Hide the parent sashwindow if all of the children are hidden
578
+ parentSashWindow.Layout() # Force a refresh
579
+ parentSashWindow.Refresh()
580
+ parentSashWindow.SetSize((parentSashWindow.GetSize().width + 1, parentSashWindow.GetSize().height + 1))
581
+ self._LayoutFrame()
582
+
583
+
584
+ def HideEmbeddedWindow(self, window):
585
+ """
586
+ Hides the embedded window specified by the embedded window location constant.
587
+ """
588
+ self.ShowEmbeddedWindow(window, show=False)
589
+
590
+
591
+ class DocTabbedChildFrame(wx.Panel):
592
+ """
593
+ The wxDocMDIChildFrame class provides a default frame for displaying
594
+ documents on separate windows. This class can only be used for MDI child
595
+ frames.
596
+
597
+ The class is part of the document/view framework supported by wxWindows,
598
+ and cooperates with the wxView, wxDocument, wxDocManager and wxDocTemplate
599
+ classes.
600
+ """
601
+
602
+
603
+ def __init__(self, doc, view, frame, id, title, pos=wx.DefaultPosition, size=wx.DefaultSize, style=wx.DEFAULT_FRAME_STYLE, name="frame"):
604
+ """
605
+ Constructor. Note that the event table must be rebuilt for the
606
+ frame since the EvtHandler is not virtual.
607
+ """
608
+ wx.Panel.__init__(self, frame.GetNotebook(), id)
609
+ self._childDocument = doc
610
+ self._childView = view
611
+ frame.AddNotebookPage(self, doc.GetPrintableName())
612
+ if view:
613
+ view.SetFrame(self)
614
+
615
+
616
+ def GetIcon(self):
617
+ """
618
+ Dummy method since the icon of tabbed frames are managed by the notebook.
619
+ """
620
+ return None
621
+
622
+
623
+ def SetIcon(self, icon):
624
+ """
625
+ Dummy method since the icon of tabbed frames are managed by the notebook.
626
+ """
627
+ pass
628
+
629
+
630
+ def Destroy(self):
631
+ """
632
+ Removes the current notebook page.
633
+ """
634
+ wx.GetApp().GetTopWindow().RemoveNotebookPage(self)
635
+
636
+
637
+ def SetFocus(self):
638
+ """
639
+ Activates the current notebook page.
640
+ """
641
+ wx.GetApp().GetTopWindow().ActivateNotebookPage(self)
642
+
643
+
644
+ def Activate(self): # Need this in case there are embedded sash windows and such, OnActivate is not getting called
645
+ """
646
+ Activates the current view.
647
+ """
648
+ # Called by Project Editor
649
+ if self._childView:
650
+ self._childView.Activate(True)
651
+
652
+
653
+ def GetTitle(self):
654
+ """
655
+ Returns the frame's title.
656
+ """
657
+ return wx.GetApp().GetTopWindow().GetNotebookPageTitle(self)
658
+
659
+
660
+ def SetTitle(self, title):
661
+ """
662
+ Sets the frame's title.
663
+ """
664
+ wx.GetApp().GetTopWindow().SetNotebookPageTitle(self, title)
665
+
666
+
667
+ def OnTitleIsModified(self):
668
+ """
669
+ Add/remove to the frame's title an indication that the document is dirty.
670
+ If the document is dirty, an '*' is appended to the title
671
+ """
672
+ title = self.GetTitle()
673
+ if title:
674
+ if self.GetDocument().IsModified():
675
+ if not title.endswith("*"):
676
+ title = title + "*"
677
+ self.SetTitle(title)
678
+ else:
679
+ if title.endswith("*"):
680
+ title = title[:-1]
681
+ self.SetTitle(title)
682
+
683
+
684
+ def ProcessEvent(event):
685
+ """
686
+ Processes an event, searching event tables and calling zero or more
687
+ suitable event handler function(s). Note that the ProcessEvent
688
+ method is called from the wxPython docview framework directly since
689
+ wxPython does not have a virtual ProcessEvent function.
690
+ """
691
+ if not self._childView or not self._childView.ProcessEvent(event):
692
+ if not isinstance(event, wx.CommandEvent) or not self.GetParent() or not self.GetParent().ProcessEvent(event):
693
+ return False
694
+ else:
695
+ return True
696
+ else:
697
+ return True
698
+
699
+
700
+ def GetDocument(self):
701
+ """
702
+ Returns the document associated with this frame.
703
+ """
704
+ return self._childDocument
705
+
706
+
707
+ def SetDocument(self, document):
708
+ """
709
+ Sets the document for this frame.
710
+ """
711
+ self._childDocument = document
712
+
713
+
714
+ def GetView(self):
715
+ """
716
+ Returns the view associated with this frame.
717
+ """
718
+ return self._childView
719
+
720
+
721
+ def SetView(self, view):
722
+ """
723
+ Sets the view for this frame.
724
+ """
725
+ self._childView = view
726
+
727
+
728
+ class DocTabbedParentFrame(wx.Frame, DocFrameMixIn, DocMDIParentFrameMixIn):
729
+ """
730
+ The DocTabbedParentFrame class provides a default top-level frame for
731
+ applications using the document/view framework. This class can only be
732
+ used for MDI parent frames that use a tabbed interface.
733
+
734
+ It cooperates with the wxView, wxDocument, wxDocManager and wxDocTemplate
735
+ classes.
736
+ """
737
+
738
+
739
+ def __init__(self, docManager, frame, id, title, pos = wx.DefaultPosition, size = wx.DefaultSize, style = wx.DEFAULT_FRAME_STYLE, name = "DocTabbedParentFrame", embeddedWindows = 0, minSize=20):
740
+ """
741
+ Constructor. Note that the event table must be rebuilt for the
742
+ frame since the EvtHandler is not virtual.
743
+ """
744
+ pos, size = self._GetPosSizeFromConfig(pos, size)
745
+ wx.Frame.__init__(self, frame, id, title, pos, size, style, name)
746
+
747
+ # From docview.MDIParentFrame
748
+ self._docManager = docManager
749
+
750
+ wx.EVT_CLOSE(self, self.OnCloseWindow)
751
+
752
+ wx.EVT_MENU(self, wx.ID_EXIT, self.OnExit)
753
+ wx.EVT_MENU_RANGE(self, wx.ID_FILE1, wx.ID_FILE9, self.OnMRUFile)
754
+
755
+ wx.EVT_MENU(self, wx.ID_NEW, self.ProcessEvent)
756
+ wx.EVT_MENU(self, wx.ID_OPEN, self.ProcessEvent)
757
+ wx.EVT_MENU(self, wx.ID_CLOSE_ALL, self.ProcessEvent)
758
+ wx.EVT_MENU(self, wx.ID_CLOSE, self.ProcessEvent)
759
+ wx.EVT_MENU(self, wx.ID_REVERT, self.ProcessEvent)
760
+ wx.EVT_MENU(self, wx.ID_SAVE, self.ProcessEvent)
761
+ wx.EVT_MENU(self, wx.ID_SAVEAS, self.ProcessEvent)
762
+ wx.EVT_MENU(self, wx.ID_UNDO, self.ProcessEvent)
763
+ wx.EVT_MENU(self, wx.ID_REDO, self.ProcessEvent)
764
+ wx.EVT_MENU(self, wx.ID_PRINT, self.ProcessEvent)
765
+ wx.EVT_MENU(self, wx.ID_PRINT_SETUP, self.ProcessEvent)
766
+ wx.EVT_MENU(self, wx.ID_PREVIEW, self.ProcessEvent)
767
+ wx.EVT_MENU(self, wx.ID_ABOUT, self.OnAbout)
768
+
769
+ wx.EVT_UPDATE_UI(self, wx.ID_NEW, self.ProcessUpdateUIEvent)
770
+ wx.EVT_UPDATE_UI(self, wx.ID_OPEN, self.ProcessUpdateUIEvent)
771
+ wx.EVT_UPDATE_UI(self, wx.ID_CLOSE_ALL, self.ProcessUpdateUIEvent)
772
+ wx.EVT_UPDATE_UI(self, wx.ID_CLOSE, self.ProcessUpdateUIEvent)
773
+ wx.EVT_UPDATE_UI(self, wx.ID_REVERT, self.ProcessUpdateUIEvent)
774
+ wx.EVT_UPDATE_UI(self, wx.ID_SAVE, self.ProcessUpdateUIEvent)
775
+ wx.EVT_UPDATE_UI(self, wx.ID_SAVEAS, self.ProcessUpdateUIEvent)
776
+ wx.EVT_UPDATE_UI(self, wx.ID_UNDO, self.ProcessUpdateUIEvent)
777
+ wx.EVT_UPDATE_UI(self, wx.ID_REDO, self.ProcessUpdateUIEvent)
778
+ wx.EVT_UPDATE_UI(self, wx.ID_PRINT, self.ProcessUpdateUIEvent)
779
+ wx.EVT_UPDATE_UI(self, wx.ID_PRINT_SETUP, self.ProcessUpdateUIEvent)
780
+ wx.EVT_UPDATE_UI(self, wx.ID_PREVIEW, self.ProcessUpdateUIEvent)
781
+ # End From docview.MDIParentFrame
782
+
783
+ self.CreateNotebook()
784
+ self._InitFrame(embeddedWindows, minSize)
785
+
786
+
787
+ def _LayoutFrame(self):
788
+ """
789
+ Lays out the frame.
790
+ """
791
+ wx.adv.LayoutAlgorithm().LayoutFrame(self, self._notebook)
792
+
793
+
794
+ def CreateNotebook(self):
795
+ """
796
+ Creates the notebook to use for the tabbed document interface.
797
+ """
798
+ if wx.Platform != "__WXMAC__":
799
+ self._notebook = wx.Notebook(self, wx.ID_ANY)
800
+ else:
801
+ self._notebook = wx.Listbook(self, wx.ID_ANY, style=wx.LB_LEFT)
802
+ # self._notebook.SetSizer(wx.NotebookSizer(self._notebook))
803
+ if wx.Platform != "__WXMAC__":
804
+ wx.EVT_NOTEBOOK_PAGE_CHANGED(self, self._notebook.GetId(), self.OnNotebookPageChanged)
805
+ else:
806
+ wx.EVT_LISTBOOK_PAGE_CHANGED(self, self._notebook.GetId(), self.OnNotebookPageChanged)
807
+ wx.EVT_RIGHT_DOWN(self._notebook, self.OnNotebookRightClick)
808
+ wx.EVT_MIDDLE_DOWN(self._notebook, self.OnNotebookMiddleClick)
809
+
810
+ # wxBug: wx.Listbook does not implement HitTest the same way wx.Notebook
811
+ # does, so for now don't fire MouseOver events.
812
+ if wx.Platform != "__WXMAC__":
813
+ wx.EVT_MOTION(self._notebook, self.OnNotebookMouseOver)
814
+
815
+ templates = wx.GetApp().GetDocumentManager().GetTemplates()
816
+ iconList = wx.ImageList(16, 16, initialCount = len(templates))
817
+ self._iconIndexLookup = []
818
+ for template in templates:
819
+ icon = template.GetIcon()
820
+ if icon:
821
+ if icon.GetHeight() != 16 or icon.GetWidth() != 16:
822
+ icon.SetHeight(16)
823
+ icon.SetWidth(16)
824
+ if wx.GetApp().GetDebug():
825
+ print("Warning: icon for '%s' isn't 16x16, not crossplatform" % template._docTypeName)
826
+ iconIndex = iconList.Add(icon)
827
+ self._iconIndexLookup.append((template, iconIndex))
828
+
829
+ icon = Blank.GetIcon()
830
+ if icon.GetHeight() != 16 or icon.GetWidth() != 16:
831
+ icon.SetHeight(16)
832
+ icon.SetWidth(16)
833
+ if wx.GetApp().GetDebug():
834
+ print("Warning: getBlankIcon isn't 16x16, not crossplatform")
835
+ self._blankIconIndex = iconList.Add(icon)
836
+ self._notebook.AssignImageList(iconList)
837
+
838
+
839
+ def GetNotebook(self):
840
+ """
841
+ Returns the notebook used by the tabbed document interface.
842
+ """
843
+ return self._notebook
844
+
845
+
846
+ def GetActiveChild(self):
847
+ """
848
+ Returns the active notebook page, which to the framework is treated as
849
+ a document frame.
850
+ """
851
+ index = self._notebook.GetSelection()
852
+ if index == -1:
853
+ return None
854
+ return self._notebook.GetPage(index)
855
+
856
+
857
+ def OnNotebookPageChanged(self, event):
858
+ """
859
+ Activates a notebook page's view when it is selected.
860
+ """
861
+ index = self._notebook.GetSelection()
862
+ if index > -1:
863
+ self._notebook.GetPage(index).GetView().Activate()
864
+
865
+
866
+ def OnNotebookMouseOver(self, event):
867
+ # wxBug: On Windows XP the tooltips don't automatically disappear when you move the mouse and it is on a notebook tab, has nothing to do with this code!!!
868
+ index, type = self._notebook.HitTest(event.GetPosition())
869
+
870
+ if index > -1:
871
+ doc = self._notebook.GetPage(index).GetView().GetDocument()
872
+ # wxBug: Tooltips no longer appearing on tabs except on
873
+ # about a 2 pixel area between tab top and contents that will show tip.
874
+ self._notebook.GetParent().SetToolTip(wx.ToolTip(doc.GetFilename()))
875
+ else:
876
+ self._notebook.SetToolTip(wx.ToolTip(""))
877
+ event.Skip()
878
+
879
+
880
+ def OnNotebookMiddleClick(self, event):
881
+ """
882
+ Handles middle clicks for the notebook, closing the document whose tab was
883
+ clicked on.
884
+ """
885
+ index, type = self._notebook.HitTest(event.GetPosition())
886
+ if index > -1:
887
+ doc = self._notebook.GetPage(index).GetView().GetDocument()
888
+ if doc:
889
+ doc.DeleteAllViews()
890
+
891
+ def OnNotebookRightClick(self, event):
892
+ """
893
+ Handles right clicks for the notebook, enabling users to either close
894
+ a tab or select from the available documents if the user clicks on the
895
+ notebook's white space.
896
+ """
897
+ index, type = self._notebook.HitTest(event.GetPosition())
898
+ menu = wx.Menu()
899
+ x, y = event.GetX(), event.GetY()
900
+ if index > -1:
901
+ doc = self._notebook.GetPage(index).GetView().GetDocument()
902
+ id = wx.NewIdRef()
903
+ menu.Append(id, _("Close"))
904
+ def OnRightMenuSelect(event):
905
+ doc.DeleteAllViews()
906
+ wx.EVT_MENU(self, id, OnRightMenuSelect)
907
+ if self._notebook.GetPageCount() > 1:
908
+ id = wx.NewIdRef()
909
+ menu.Append(id, _("Close All but \"%s\"" % doc.GetPrintableName()))
910
+ def OnRightMenuSelect(event):
911
+ for i in range(self._notebook.GetPageCount()-1, -1, -1): # Go from len-1 to 0
912
+ if i != index:
913
+ doc = self._notebook.GetPage(i).GetView().GetDocument()
914
+ if not self.GetDocumentManager().CloseDocument(doc, False):
915
+ return
916
+ wx.EVT_MENU(self, id, OnRightMenuSelect)
917
+ menu.AppendSeparator()
918
+ tabsMenu = wx.Menu()
919
+ menu.AppendMenu(wx.ID_ANY, _("Select Tab"), tabsMenu)
920
+ else:
921
+ y = y - 25 # wxBug: It is offsetting click events in the blank notebook area
922
+ tabsMenu = menu
923
+
924
+ if self._notebook.GetPageCount() > 1:
925
+ selectIDs = {}
926
+ for i in range(0, self._notebook.GetPageCount()):
927
+ id = wx.NewIdRef()
928
+ selectIDs[id] = i
929
+ tabsMenu.Append(id, self._notebook.GetPageText(i))
930
+ def OnRightMenuSelect(event):
931
+ self._notebook.SetSelection(selectIDs[event.GetId()])
932
+ wx.EVT_MENU(self, id, OnRightMenuSelect)
933
+
934
+ self._notebook.PopupMenu(menu, wx.Point(x, y))
935
+ menu.Destroy()
936
+
937
+
938
+ def AddNotebookPage(self, panel, title):
939
+ """
940
+ Adds a document page to the notebook.
941
+ """
942
+ self._notebook.AddPage(panel, title)
943
+ index = self._notebook.GetPageCount() - 1
944
+ self._notebook.SetSelection(index)
945
+
946
+ found = False # Now set the icon
947
+ template = panel.GetDocument().GetDocumentTemplate()
948
+ if template:
949
+ for t, iconIndex in self._iconIndexLookup:
950
+ if t is template:
951
+ self._notebook.SetPageImage(index, iconIndex)
952
+ found = True
953
+ break
954
+ if not found:
955
+ self._notebook.SetPageImage(index, self._blankIconIndex)
956
+
957
+ # wxBug: the wxListbook used on Mac needs its tabs list resized
958
+ # whenever a new tab is added, but the only way to do this is
959
+ # to resize the entire control
960
+ if wx.Platform == "__WXMAC__":
961
+ content_size = self._notebook.GetSize()
962
+ self._notebook.SetSize((content_size.x+2, -1))
963
+ self._notebook.SetSize((content_size.x, -1))
964
+
965
+ self._notebook.Layout()
966
+
967
+ windowMenuService = wx.GetApp().GetService(WindowMenuService)
968
+ if windowMenuService:
969
+ windowMenuService.BuildWindowMenu(wx.GetApp().GetTopWindow()) # build file menu list when we open a file
970
+
971
+
972
+ def RemoveNotebookPage(self, panel):
973
+ """
974
+ Removes a document page from the notebook.
975
+ """
976
+ index = self.GetNotebookPageIndex(panel)
977
+ if index > -1:
978
+ if self._notebook.GetPageCount() == 1 or index < 2:
979
+ pass
980
+ elif index >= 1:
981
+ self._notebook.SetSelection(index - 1)
982
+ elif index < self._notebook.GetPageCount():
983
+ self._notebook.SetSelection(index + 1)
984
+ self._notebook.DeletePage(index)
985
+ self._notebook.GetParent().SetToolTip(wx.ToolTip(""))
986
+
987
+ windowMenuService = wx.GetApp().GetService(WindowMenuService)
988
+ if windowMenuService:
989
+ windowMenuService.BuildWindowMenu(wx.GetApp().GetTopWindow()) # build file menu list when we open a file
990
+
991
+
992
+ def ActivateNotebookPage(self, panel):
993
+ """
994
+ Sets the notebook to the specified panel.
995
+ """
996
+ index = self.GetNotebookPageIndex(panel)
997
+ if index > -1:
998
+ self._notebook.SetFocus()
999
+ self._notebook.SetSelection(index)
1000
+
1001
+
1002
+ def GetNotebookPageTitle(self, panel):
1003
+ index = self.GetNotebookPageIndex(panel)
1004
+ if index != -1:
1005
+ return self._notebook.GetPageText(self.GetNotebookPageIndex(panel))
1006
+ else:
1007
+ return None
1008
+
1009
+
1010
+ def SetNotebookPageTitle(self, panel, title):
1011
+ self._notebook.SetPageText(self.GetNotebookPageIndex(panel), title)
1012
+
1013
+
1014
+ def GetNotebookPageIndex(self, panel):
1015
+ """
1016
+ Returns the index of particular notebook panel.
1017
+ """
1018
+ index = -1
1019
+ for i in range(self._notebook.GetPageCount()):
1020
+ if self._notebook.GetPage(i) == panel:
1021
+ index = i
1022
+ break
1023
+ return index
1024
+
1025
+
1026
+ def ProcessEvent(self, event):
1027
+ """
1028
+ Processes an event, searching event tables and calling zero or more
1029
+ suitable event handler function(s). Note that the ProcessEvent
1030
+ method is called from the wxPython docview framework directly since
1031
+ wxPython does not have a virtual ProcessEvent function.
1032
+ """
1033
+ if wx.GetApp().ProcessEventBeforeWindows(event):
1034
+ return True
1035
+ if self._docManager and self._docManager.ProcessEvent(event):
1036
+ return True
1037
+ return DocMDIParentFrameMixIn.ProcessEvent(self, event)
1038
+
1039
+
1040
+ def ProcessUpdateUIEvent(self, event):
1041
+ """
1042
+ Processes a UI event, searching event tables and calling zero or more
1043
+ suitable event handler function(s). Note that the ProcessEvent
1044
+ method is called from the wxPython docview framework directly since
1045
+ wxPython does not have a virtual ProcessEvent function.
1046
+ """
1047
+ if wx.GetApp().ProcessUpdateUIEventBeforeWindows(event):
1048
+ return True
1049
+ if self._docManager and self._docManager.ProcessUpdateUIEvent(event):
1050
+ return True
1051
+ return DocMDIParentFrameMixIn.ProcessUpdateUIEvent(self, event)
1052
+
1053
+
1054
+ def OnExit(self, event):
1055
+ """
1056
+ Called when File/Exit is chosen and closes the window.
1057
+ """
1058
+ self.Close()
1059
+
1060
+
1061
+ def OnMRUFile(self, event):
1062
+ """
1063
+ Opens the appropriate file when it is selected from the file history
1064
+ menu.
1065
+ """
1066
+ n = event.GetId() - wx.ID_FILE1
1067
+ filename = self._docManager.GetHistoryFile(n)
1068
+ if filename:
1069
+ self._docManager.CreateDocument(filename, wx.lib.docview.DOC_SILENT)
1070
+ else:
1071
+ self._docManager.RemoveFileFromHistory(n)
1072
+ msgTitle = wx.GetApp().GetAppName()
1073
+ if not msgTitle:
1074
+ msgTitle = _("File Error")
1075
+ 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),
1076
+ msgTitle,
1077
+ wx.OK | wx.ICON_EXCLAMATION,
1078
+ self)
1079
+
1080
+
1081
+ def OnSize(self, event):
1082
+ """
1083
+ Called when the frame is resized and lays out the client window.
1084
+ """
1085
+ # Needed in case there are splitpanels around the mdi frame
1086
+ self._LayoutFrame()
1087
+
1088
+
1089
+ def OnCloseWindow(self, event):
1090
+ """
1091
+ Called when the frame is closed. Remembers the frame size.
1092
+ """
1093
+ self.SaveEmbeddedWindowSizes()
1094
+
1095
+ # save and close services last
1096
+ for service in wx.GetApp().GetServices():
1097
+ if not service.OnCloseFrame(event):
1098
+ return
1099
+
1100
+ # From docview.MDIParentFrame
1101
+ if self._docManager.Clear(not event.CanVeto()):
1102
+ self.Destroy()
1103
+ else:
1104
+ event.Veto()
1105
+
1106
+
1107
+ class DocMDIChildFrame(wx.MDIChildFrame):
1108
+ """
1109
+ The wxDocMDIChildFrame class provides a default frame for displaying
1110
+ documents on separate windows. This class can only be used for MDI child
1111
+ frames.
1112
+
1113
+ The class is part of the document/view framework supported by wxWindows,
1114
+ and cooperates with the wxView, wxDocument, wxDocManager and wxDocTemplate
1115
+ classes.
1116
+ """
1117
+
1118
+
1119
+ def __init__(self, doc, view, frame, id, title, pos=wx.DefaultPosition, size=wx.DefaultSize, style=wx.DEFAULT_FRAME_STYLE, name="frame"):
1120
+ """
1121
+ Constructor. Note that the event table must be rebuilt for the
1122
+ frame since the EvtHandler is not virtual.
1123
+ """
1124
+ wx.MDIChildFrame.__init__(self, frame, id, title, pos, size, style, name)
1125
+ self._childDocument = doc
1126
+ self._childView = view
1127
+ if view:
1128
+ view.SetFrame(self)
1129
+ # self.Create(doc, view, frame, id, title, pos, size, style, name)
1130
+ self._activeEvent = None
1131
+ self._activated = 0
1132
+ wx.EVT_ACTIVATE(self, self.OnActivate)
1133
+ wx.EVT_CLOSE(self, self.OnCloseWindow)
1134
+
1135
+ 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
1136
+ mdiChildren = filter(lambda x: isinstance(x, wx.MDIChildFrame), frame.GetChildren())
1137
+ if len(mdiChildren) == 1:
1138
+ self.Activate()
1139
+
1140
+
1141
+ ## # Couldn't get this to work, but seems to work fine with single stage construction
1142
+ ## def Create(self, doc, view, frame, id, title, pos, size, style, name):
1143
+ ## self._childDocument = doc
1144
+ ## self._childView = view
1145
+ ## if wx.MDIChildFrame.Create(self, frame, id, title, pos, size, style, name):
1146
+ ## if view:
1147
+ ## view.SetFrame(self)
1148
+ ## return True
1149
+ ## return False
1150
+
1151
+
1152
+
1153
+ def Activate(self): # Need this in case there are embedded sash windows and such, OnActivate is not getting called
1154
+ """
1155
+ Activates the current view.
1156
+ """
1157
+ if self._childView:
1158
+ self._childView.Activate(True)
1159
+
1160
+
1161
+ def OnTitleIsModified(self):
1162
+ """
1163
+ Add/remove to the frame's title an indication that the document is dirty.
1164
+ If the document is dirty, an '*' is appended to the title
1165
+ """
1166
+ title = self.GetTitle()
1167
+ if title:
1168
+ if self.GetDocument().IsModified():
1169
+ if title.endswith("*"):
1170
+ return
1171
+ else:
1172
+ title = title + "*"
1173
+ self.SetTitle(title)
1174
+ else:
1175
+ if title.endswith("*"):
1176
+ title = title[:-1]
1177
+ self.SetTitle(title)
1178
+ else:
1179
+ return
1180
+
1181
+
1182
+ def ProcessEvent(event):
1183
+ """
1184
+ Processes an event, searching event tables and calling zero or more
1185
+ suitable event handler function(s). Note that the ProcessEvent
1186
+ method is called from the wxPython docview framework directly since
1187
+ wxPython does not have a virtual ProcessEvent function.
1188
+ """
1189
+ if self._activeEvent == event:
1190
+ return False
1191
+
1192
+ self._activeEvent = event # Break recursion loops
1193
+
1194
+ if self._childView:
1195
+ self._childView.Activate(True)
1196
+
1197
+ if not self._childView or not self._childView.ProcessEvent(event):
1198
+ if not isinstance(event, wx.CommandEvent) or not self.GetParent() or not self.GetParent().ProcessEvent(event):
1199
+ ret = False
1200
+ else:
1201
+ ret = True
1202
+ else:
1203
+ ret = True
1204
+
1205
+ self._activeEvent = None
1206
+ return ret
1207
+
1208
+
1209
+ def OnActivate(self, event):
1210
+ """
1211
+ Sets the currently active view to be the frame's view. You may need to
1212
+ override (but still call) this function in order to set the keyboard
1213
+ focus for your subwindow.
1214
+ """
1215
+ event.Skip()
1216
+ if self._activated != 0:
1217
+ return True
1218
+ self._activated += 1
1219
+ wx.MDIChildFrame.Activate(self)
1220
+ if event.GetActive() and self._childView:
1221
+ self._childView.Activate(event.GetActive())
1222
+ self._activated = 0
1223
+
1224
+
1225
+ def OnCloseWindow(self, event):
1226
+ """
1227
+ Closes and deletes the current view and document.
1228
+ """
1229
+ if self._childView:
1230
+ ans = False
1231
+ if not event.CanVeto():
1232
+ ans = True
1233
+ else:
1234
+ ans = self._childView.Close(deleteWindow = False)
1235
+
1236
+ if ans:
1237
+ self._childView.Activate(False)
1238
+ self._childView.Destroy()
1239
+ self._childView = None
1240
+ if self._childDocument:
1241
+ self._childDocument.Destroy() # This isn't in the wxWindows codebase but the document needs to be disposed of somehow
1242
+ self._childDocument = None
1243
+ self.Destroy()
1244
+ else:
1245
+ event.Veto()
1246
+ else:
1247
+ event.Veto()
1248
+
1249
+
1250
+ def GetDocument(self):
1251
+ """
1252
+ Returns the document associated with this frame.
1253
+ """
1254
+ return self._childDocument
1255
+
1256
+
1257
+ def SetDocument(self, document):
1258
+ """
1259
+ Sets the document for this frame.
1260
+ """
1261
+ self._childDocument = document
1262
+
1263
+
1264
+ def GetView(self):
1265
+ """
1266
+ Returns the view associated with this frame.
1267
+ """
1268
+ return self._childView
1269
+
1270
+
1271
+ def SetView(self, view):
1272
+ """
1273
+ Sets the view for this frame.
1274
+ """
1275
+ self._childView = view
1276
+
1277
+
1278
+ class DocService(wx.EvtHandler):
1279
+ """
1280
+ An abstract class used to add reusable services to a docview application.
1281
+ """
1282
+
1283
+
1284
+ def __init__(self):
1285
+ """Initializes the DocService."""
1286
+ pass
1287
+
1288
+
1289
+ def GetDocumentManager(self):
1290
+ """Returns the DocManager for the docview application."""
1291
+ return self._docManager
1292
+
1293
+
1294
+ def SetDocumentManager(self, docManager):
1295
+ """Sets the DocManager for the docview application."""
1296
+ self._docManager = docManager
1297
+
1298
+
1299
+ def InstallControls(self, frame, menuBar=None, toolBar=None, statusBar=None, document=None):
1300
+ """Called to install controls into the menubar and toolbar of a SDI or MDI window. Override this method for a particular service."""
1301
+ pass
1302
+
1303
+
1304
+ def ProcessEventBeforeWindows(self, event):
1305
+ """
1306
+ Processes an event before the main window has a chance to process the window.
1307
+ Override this method for a particular service.
1308
+ """
1309
+ return False
1310
+
1311
+
1312
+ def ProcessUpdateUIEventBeforeWindows(self, event):
1313
+ """
1314
+ Processes a UI event before the main window has a chance to process the window.
1315
+ Override this method for a particular service.
1316
+ """
1317
+ return False
1318
+
1319
+
1320
+ def ProcessEvent(self, event):
1321
+ """
1322
+ Processes an event, searching event tables and calling zero or more
1323
+ suitable event handler function(s). Note that the ProcessEvent
1324
+ method is called from the wxPython docview framework directly since
1325
+ wxPython does not have a virtual ProcessEvent function.
1326
+ """
1327
+ return False
1328
+
1329
+
1330
+ def ProcessUpdateUIEvent(self, event):
1331
+ """
1332
+ Processes a UI event, searching event tables and calling zero or more
1333
+ suitable event handler function(s). Note that the ProcessEvent
1334
+ method is called from the wxPython docview framework directly since
1335
+ wxPython does not have a virtual ProcessEvent function.
1336
+ """
1337
+ return False
1338
+
1339
+
1340
+ def OnCloseFrame(self, event):
1341
+ """
1342
+ Called when the a docview frame is being closed. Override this method
1343
+ so a service can either do cleanup or veto the frame being closed by
1344
+ returning false.
1345
+ """
1346
+ return True
1347
+
1348
+
1349
+ def OnExit(self):
1350
+ """
1351
+ Called when the the docview application is being closed. Override this method
1352
+ so a service can either do cleanup or veto the frame being closed by
1353
+ returning false.
1354
+ """
1355
+ pass
1356
+
1357
+
1358
+ def GetMenuItemPos(self, menu, id):
1359
+ """
1360
+ Utility method used to find the position of a menu item so that services can
1361
+ easily find where to insert a menu item in InstallControls.
1362
+ """
1363
+ menuItems = menu.GetMenuItems()
1364
+ for i, menuItem in enumerate(menuItems):
1365
+ if menuItem.GetId() == id:
1366
+ return i
1367
+ return i
1368
+
1369
+
1370
+ def GetView(self):
1371
+ """
1372
+ Called by WindowMenuService to get views for services that don't
1373
+ have dedicated documents such as the Outline Service.
1374
+ """
1375
+ return None
1376
+
1377
+
1378
+ class DocOptionsService(DocService):
1379
+ """
1380
+ A service that implements an options menu item and an options dialog with
1381
+ notebook tabs. New tabs can be added by other services by calling the
1382
+ "AddOptionsPanel" method.
1383
+ """
1384
+
1385
+
1386
+ def __init__(self, showGeneralOptions=True, supportedModes=wx.lib.docview.DOC_SDI & wx.lib.docview.DOC_MDI):
1387
+ """
1388
+ Initializes the options service with the option of suppressing the default
1389
+ general options pane that is included with the options service by setting
1390
+ showGeneralOptions to False. It allowModeChanges is set to False, the
1391
+ default general options pane will allow users to change the document
1392
+ interface mode between SDI and MDI modes.
1393
+ """
1394
+ DocService.__init__(self)
1395
+ self.ClearOptionsPanels()
1396
+ self._supportedModes = supportedModes
1397
+ self._toolOptionsID = wx.ID_PREFERENCES
1398
+ if showGeneralOptions:
1399
+ self.AddOptionsPanel(GeneralOptionsPanel)
1400
+
1401
+
1402
+ def InstallControls(self, frame, menuBar=None, toolBar=None, statusBar=None, document=None):
1403
+ """
1404
+ Installs a "Tools" menu with an "Options" menu item.
1405
+ """
1406
+ toolsMenuIndex = menuBar.FindMenu(_("&Tools"))
1407
+ if toolsMenuIndex > -1:
1408
+ toolsMenu = menuBar.GetMenu(toolsMenuIndex)
1409
+ else:
1410
+ toolsMenu = wx.Menu()
1411
+ if toolsMenuIndex == -1:
1412
+ formatMenuIndex = menuBar.FindMenu(_("&Format"))
1413
+ menuBar.Insert(formatMenuIndex + 1, toolsMenu, _("&Tools"))
1414
+ if toolsMenu:
1415
+ if toolsMenu.GetMenuItemCount():
1416
+ toolsMenu.AppendSeparator()
1417
+ toolsMenu.Append(self._toolOptionsID, _("&Options..."), _("Sets options"))
1418
+ wx.EVT_MENU(frame, self._toolOptionsID, frame.ProcessEvent)
1419
+
1420
+
1421
+ def ProcessEvent(self, event):
1422
+ """
1423
+ Checks to see if the "Options" menu item has been selected.
1424
+ """
1425
+ id = event.GetId()
1426
+ if id == self._toolOptionsID:
1427
+ self.OnOptions(event)
1428
+ return True
1429
+ else:
1430
+ return False
1431
+
1432
+
1433
+ def GetSupportedModes(self):
1434
+ """
1435
+ Return the modes supported by the application. Use docview.DOC_SDI and
1436
+ docview.DOC_MDI flags to check if SDI and/or MDI modes are supported.
1437
+ """
1438
+ return self._supportedModes
1439
+
1440
+
1441
+ def SetSupportedModes(self, _supportedModessupportedModes):
1442
+ """
1443
+ Sets the modes supported by the application. Use docview.DOC_SDI and
1444
+ docview.DOC_MDI flags to set if SDI and/or MDI modes are supported.
1445
+ """
1446
+ self._supportedModes = supportedModes
1447
+
1448
+
1449
+ def ClearOptionsPanels(self):
1450
+ """
1451
+ Clears all of the options panels that have been added into the
1452
+ options dialog.
1453
+ """
1454
+ self._optionsPanels = []
1455
+
1456
+
1457
+ def AddOptionsPanel(self, optionsPanel):
1458
+ """
1459
+ Adds an options panel to the options dialog.
1460
+ """
1461
+ self._optionsPanels.append(optionsPanel)
1462
+
1463
+
1464
+ def OnOptions(self, event):
1465
+ """
1466
+ Shows the options dialog, called when the "Options" menu item is selected.
1467
+ """
1468
+ if len(self._optionsPanels) == 0:
1469
+ return
1470
+ optionsDialog = OptionsDialog(wx.GetApp().GetTopWindow(), self._optionsPanels, self._docManager)
1471
+ optionsDialog.CenterOnParent()
1472
+ if optionsDialog.ShowModal() == wx.ID_OK:
1473
+ optionsDialog.OnOK(optionsDialog) # wxBug: wxDialog should be calling this automatically but doesn't
1474
+ optionsDialog.Destroy()
1475
+
1476
+
1477
+ class OptionsDialog(wx.Dialog):
1478
+ """
1479
+ A default options dialog used by the OptionsService that hosts a notebook
1480
+ tab of options panels.
1481
+ """
1482
+
1483
+
1484
+ def __init__(self, parent, optionsPanelClasses, docManager):
1485
+ """
1486
+ Initializes the options dialog with a notebook page that contains new
1487
+ instances of the passed optionsPanelClasses.
1488
+ """
1489
+ wx.Dialog.__init__(self, parent, -1, _("Options"))
1490
+
1491
+ self._optionsPanels = []
1492
+ self._docManager = docManager
1493
+
1494
+ HALF_SPACE = 5
1495
+ SPACE = 10
1496
+
1497
+ sizer = wx.BoxSizer(wx.VERTICAL)
1498
+
1499
+ if wx.Platform == "__WXMAC__":
1500
+ optionsNotebook = wx.Listbook(self, wx.ID_ANY, style=wx.LB_DEFAULT)
1501
+ else:
1502
+ optionsNotebook = wx.Notebook(self, wx.ID_ANY, style=wx.NB_MULTILINE) # NB_MULTILINE is windows platform only
1503
+ sizer.Add(optionsNotebook, 0, wx.ALL | wx.EXPAND, SPACE)
1504
+
1505
+ if wx.Platform == "__WXMAC__":
1506
+ iconList = wx.ImageList(16, 16, initialCount = len(optionsPanelClasses))
1507
+ self._iconIndexLookup = []
1508
+
1509
+ for optionsPanelClass in optionsPanelClasses:
1510
+ optionsPanel = optionsPanelClass(optionsNotebook, -1)
1511
+ self._optionsPanels.append(optionsPanel)
1512
+
1513
+ # We need to populate the image list before setting notebook images
1514
+ if hasattr(optionsPanel, "GetIcon"):
1515
+ icon = optionsPanel.GetIcon()
1516
+ else:
1517
+ icon = None
1518
+ if icon:
1519
+ if icon.GetHeight() != 16 or icon.GetWidth() != 16:
1520
+ icon.SetHeight(16)
1521
+ icon.SetWidth(16)
1522
+ if wx.GetApp().GetDebug():
1523
+ print("Warning: icon for '%s' isn't 16x16, not crossplatform" % template._docTypeName)
1524
+ iconIndex = iconList.AddIcon(icon)
1525
+ self._iconIndexLookup.append((optionsPanel, iconIndex))
1526
+
1527
+ else:
1528
+ # use -1 to represent that this panel has no icon
1529
+ self._iconIndexLookup.append((optionsPanel, -1))
1530
+
1531
+ optionsNotebook.AssignImageList(iconList)
1532
+
1533
+ # Add icons to notebook
1534
+ for index in range(0, len(optionsPanelClasses)-1):
1535
+ iconIndex = self._iconIndexLookup[index][1]
1536
+ if iconIndex >= 0:
1537
+ optionsNotebook.SetPageImage(index, iconIndex)
1538
+ else:
1539
+ for optionsPanelClass in optionsPanelClasses:
1540
+ optionsPanel = optionsPanelClass(optionsNotebook, -1)
1541
+ self._optionsPanels.append(optionsPanel)
1542
+
1543
+ sizer.Add(self.CreateButtonSizer(wx.OK | wx.CANCEL), 0, wx.ALIGN_RIGHT | wx.RIGHT | wx.BOTTOM, HALF_SPACE)
1544
+ self.SetSizer(sizer)
1545
+ self.Layout()
1546
+ self.Fit()
1547
+ wx.CallAfter(self.DoRefresh)
1548
+
1549
+
1550
+ def DoRefresh(self):
1551
+ """
1552
+ wxBug: On Windows XP when using a multiline notebook the default page doesn't get
1553
+ drawn, but it works when using a single line notebook.
1554
+ """
1555
+ self.Refresh()
1556
+
1557
+
1558
+ def GetDocManager(self):
1559
+ """
1560
+ Returns the document manager passed to the OptionsDialog constructor.
1561
+ """
1562
+ return self._docManager
1563
+
1564
+
1565
+ def OnOK(self, event):
1566
+ """
1567
+ Calls the OnOK method of all of the OptionDialog's embedded panels
1568
+ """
1569
+ for optionsPanel in self._optionsPanels:
1570
+ optionsPanel.OnOK(event)
1571
+
1572
+
1573
+ class GeneralOptionsPanel(wx.Panel):
1574
+ """
1575
+ A general options panel that is used in the OptionDialog to configure the
1576
+ generic properties of a pydocview application, such as "show tips at startup"
1577
+ and whether to use SDI or MDI for the application.
1578
+ """
1579
+
1580
+
1581
+ def __init__(self, parent, id):
1582
+ """
1583
+ Initializes the panel by adding an "Options" folder tab to the parent notebook and
1584
+ populating the panel with the generic properties of a pydocview application.
1585
+ """
1586
+ wx.Panel.__init__(self, parent, id)
1587
+ SPACE = 10
1588
+ HALF_SPACE = 5
1589
+ config = wx.ConfigBase.Get()
1590
+ self._showTipsCheckBox = wx.CheckBox(self, -1, _("Show tips at start up"))
1591
+ self._showTipsCheckBox.SetValue(config.ReadInt("ShowTipAtStartup", True))
1592
+ if self._AllowModeChanges():
1593
+ supportedModes = wx.GetApp().GetService(DocOptionsService).GetSupportedModes()
1594
+ choices = []
1595
+ self._sdiChoice = _("Show each document in its own window")
1596
+ self._mdiChoice = _("Show all documents in a single window with tabs")
1597
+ self._winMdiChoice = _("Show all documents in a single window with child windows")
1598
+ if supportedModes & wx.lib.docview.DOC_SDI:
1599
+ choices.append(self._sdiChoice)
1600
+ choices.append(self._mdiChoice)
1601
+ if wx.Platform == "__WXMSW__":
1602
+ choices.append(self._winMdiChoice)
1603
+ self._documentRadioBox = wx.RadioBox(self, -1, _("Document Display Style"),
1604
+ choices = choices,
1605
+ majorDimension=1,
1606
+ )
1607
+ if config.ReadInt("UseWinMDI", False):
1608
+ self._documentRadioBox.SetStringSelection(self._winMdiChoice)
1609
+ elif config.ReadInt("UseMDI", True):
1610
+ self._documentRadioBox.SetStringSelection(self._mdiChoice)
1611
+ else:
1612
+ self._documentRadioBox.SetStringSelection(self._sdiChoice)
1613
+ def OnDocumentInterfaceSelect(event):
1614
+ if not self._documentInterfaceMessageShown:
1615
+ msgTitle = wx.GetApp().GetAppName()
1616
+ if not msgTitle:
1617
+ msgTitle = _("Document Options")
1618
+ wx.MessageBox(_("Document interface changes will not appear until the application is restarted."),
1619
+ msgTitle,
1620
+ wx.OK | wx.ICON_INFORMATION,
1621
+ self.GetParent())
1622
+ self._documentInterfaceMessageShown = True
1623
+ wx.EVT_RADIOBOX(self, self._documentRadioBox.GetId(), OnDocumentInterfaceSelect)
1624
+ optionsBorderSizer = wx.BoxSizer(wx.VERTICAL)
1625
+ optionsSizer = wx.BoxSizer(wx.VERTICAL)
1626
+ if self._AllowModeChanges():
1627
+ optionsSizer.Add(self._documentRadioBox, 0, wx.ALL, HALF_SPACE)
1628
+ optionsSizer.Add(self._showTipsCheckBox, 0, wx.ALL, HALF_SPACE)
1629
+ optionsBorderSizer.Add(optionsSizer, 0, wx.ALL, SPACE)
1630
+ self.SetSizer(optionsBorderSizer)
1631
+ self.Layout()
1632
+ self._documentInterfaceMessageShown = False
1633
+ parent.AddPage(self, _("General"))
1634
+
1635
+
1636
+ def _AllowModeChanges(self):
1637
+ supportedModes = wx.GetApp().GetService(DocOptionsService).GetSupportedModes()
1638
+ return supportedModes & wx.lib.docview.DOC_SDI and supportedModes & wx.lib.docview.DOC_MDI or wx.Platform == "__WXMSW__" and supportedModes & wx.lib.docview.DOC_MDI # More than one mode is supported, allow selection
1639
+
1640
+
1641
+ def OnOK(self, optionsDialog):
1642
+ """
1643
+ Updates the config based on the selections in the options panel.
1644
+ """
1645
+ config = wx.ConfigBase.Get()
1646
+ config.WriteInt("ShowTipAtStartup", self._showTipsCheckBox.GetValue())
1647
+ if self._AllowModeChanges():
1648
+ config.WriteInt("UseMDI", (self._documentRadioBox.GetStringSelection() == self._mdiChoice))
1649
+ config.WriteInt("UseWinMDI", (self._documentRadioBox.GetStringSelection() == self._winMdiChoice))
1650
+
1651
+
1652
+ def GetIcon(self):
1653
+ """ Return icon for options panel on the Mac. """
1654
+ return wx.GetApp().GetDefaultIcon()
1655
+
1656
+
1657
+ class DocApp(wx.App):
1658
+ """
1659
+ The DocApp class serves as the base class for pydocview applications and offers
1660
+ functionality such as services, creation of SDI and MDI frames, show tips,
1661
+ and a splash screen.
1662
+ """
1663
+
1664
+
1665
+ def OnInit(self):
1666
+ """
1667
+ Initializes the DocApp.
1668
+ """
1669
+ self._services = []
1670
+ self._defaultIcon = None
1671
+ self._registeredCloseEvent = False
1672
+ self._useTabbedMDI = True
1673
+
1674
+ if not hasattr(self, "_debug"): # only set if not already initialized
1675
+ self._debug = False
1676
+ if not hasattr(self, "_singleInstance"): # only set if not already initialized
1677
+ self._singleInstance = True
1678
+
1679
+ # if _singleInstance is TRUE only allow one single instance of app to run.
1680
+ # When user tries to run a second instance of the app, abort startup,
1681
+ # But if user also specifies files to open in command line, send message to running app to open those files
1682
+ if self._singleInstance:
1683
+ # create shared memory temporary file
1684
+ if wx.Platform == '__WXMSW__':
1685
+ tfile = tempfile.TemporaryFile(prefix="ag", suffix="tmp")
1686
+ fno = tfile.fileno()
1687
+ self._sharedMemory = mmap.mmap(fno, 1024, "shared_memory")
1688
+ else:
1689
+ tfile = file(os.path.join(tempfile.gettempdir(), tempfile.gettempprefix() + self.GetAppName() + '-' + wx.GetUserId() + "AGSharedMemory"), 'w+b')
1690
+ tfile.write("*")
1691
+ tfile.seek(1024)
1692
+ tfile.write(" ")
1693
+ tfile.flush()
1694
+ fno = tfile.fileno()
1695
+ self._sharedMemory = mmap.mmap(fno, 1024)
1696
+
1697
+ self._singleInstanceChecker = wx.SingleInstanceChecker(self.GetAppName() + '-' + wx.GetUserId(), tempfile.gettempdir())
1698
+ if self._singleInstanceChecker.IsAnotherRunning():
1699
+ # have running single instance open file arguments
1700
+ data = pickle.dumps(sys.argv[1:])
1701
+ while 1:
1702
+ self._sharedMemory.seek(0)
1703
+ marker = self._sharedMemory.read_byte()
1704
+ if marker == '\0' or marker == '*': # available buffer
1705
+ self._sharedMemory.seek(0)
1706
+ self._sharedMemory.write_byte('-') # set writing marker
1707
+ self._sharedMemory.write(data) # write files we tried to open to shared memory
1708
+ self._sharedMemory.seek(0)
1709
+ self._sharedMemory.write_byte('+') # set finished writing marker
1710
+ self._sharedMemory.flush()
1711
+ break
1712
+ else:
1713
+ time.sleep(1) # give enough time for buffer to be available
1714
+
1715
+ return False
1716
+ else:
1717
+ self._timer = wx.PyTimer(self.DoBackgroundListenAndLoad)
1718
+ self._timer.Start(250)
1719
+
1720
+ return True
1721
+
1722
+
1723
+ def OpenMainFrame(self):
1724
+ docManager = self.GetDocumentManager()
1725
+ if docManager.GetFlags() & wx.lib.docview.DOC_MDI:
1726
+ if self.GetUseTabbedMDI():
1727
+ frame = wx.lib.pydocview.DocTabbedParentFrame(docManager, None, -1, self.GetAppName())
1728
+ else:
1729
+ frame = wx.lib.pydocview.DocMDIParentFrame(docManager, None, -1, self.GetAppName())
1730
+ frame.Show(True)
1731
+
1732
+ def MacOpenFile(self, filename):
1733
+ self.GetDocumentManager().CreateDocument(os.path.normpath(filename), wx.lib.docview.DOC_SILENT)
1734
+
1735
+ # force display of running app
1736
+ topWindow = wx.GetApp().GetTopWindow()
1737
+ if topWindow.IsIconized():
1738
+ topWindow.Iconize(False)
1739
+ else:
1740
+ topWindow.Raise()
1741
+
1742
+ def DoBackgroundListenAndLoad(self):
1743
+ """
1744
+ Open any files specified in the given command line argument passed in via shared memory
1745
+ """
1746
+ self._timer.Stop()
1747
+
1748
+ self._sharedMemory.seek(0)
1749
+ if self._sharedMemory.read_byte() == '+': # available data
1750
+ data = self._sharedMemory.read(1024-1)
1751
+ self._sharedMemory.seek(0)
1752
+ self._sharedMemory.write_byte("*") # finished reading, set buffer free marker
1753
+ self._sharedMemory.flush()
1754
+ args = pickle.loads(data)
1755
+ for arg in args:
1756
+ if (wx.Platform != "__WXMSW__" or arg[0] != "/") and arg[0] != '-' and os.path.exists(arg):
1757
+ self.GetDocumentManager().CreateDocument(os.path.normpath(arg), wx.lib.docview.DOC_SILENT)
1758
+
1759
+ # force display of running app
1760
+ topWindow = wx.GetApp().GetTopWindow()
1761
+ if topWindow.IsIconized():
1762
+ topWindow.Iconize(False)
1763
+ else:
1764
+ topWindow.Raise()
1765
+
1766
+
1767
+ self._timer.Start(1000) # 1 second interval
1768
+
1769
+
1770
+ def OpenCommandLineArgs(self):
1771
+ """
1772
+ Called to open files that have been passed to the application from the
1773
+ command line.
1774
+ """
1775
+ args = sys.argv[1:]
1776
+ for arg in args:
1777
+ if (wx.Platform != "__WXMSW__" or arg[0] != "/") and arg[0] != '-' and os.path.exists(arg):
1778
+ self.GetDocumentManager().CreateDocument(os.path.normpath(arg), wx.lib.docview.DOC_SILENT)
1779
+
1780
+
1781
+ def GetDocumentManager(self):
1782
+ """
1783
+ Returns the document manager associated to the DocApp.
1784
+ """
1785
+ return self._docManager
1786
+
1787
+
1788
+ def SetDocumentManager(self, docManager):
1789
+ """
1790
+ Sets the document manager associated with the DocApp and loads the
1791
+ DocApp's file history into the document manager.
1792
+ """
1793
+ self._docManager = docManager
1794
+ config = wx.ConfigBase.Get()
1795
+ self.GetDocumentManager().FileHistoryLoad(config)
1796
+
1797
+
1798
+ def ProcessEventBeforeWindows(self, event):
1799
+ """
1800
+ Enables services to process an event before the main window has a chance to
1801
+ process the window.
1802
+ """
1803
+ for service in self._services:
1804
+ if service.ProcessEventBeforeWindows(event):
1805
+ return True
1806
+ return False
1807
+
1808
+
1809
+ def ProcessUpdateUIEventBeforeWindows(self, event):
1810
+ """
1811
+ Enables services to process a UI event before the main window has a chance
1812
+ to process the window.
1813
+ """
1814
+ for service in self._services:
1815
+ if service.ProcessUpdateUIEventBeforeWindows(event):
1816
+ return True
1817
+ return False
1818
+
1819
+
1820
+ def ProcessEvent(self, event):
1821
+ """
1822
+ Processes an event, searching event tables and calling zero or more
1823
+ suitable event handler function(s). Note that the ProcessEvent
1824
+ method is called from the wxPython docview framework directly since
1825
+ wxPython does not have a virtual ProcessEvent function.
1826
+ """
1827
+ for service in self._services:
1828
+ if service.ProcessEvent(event):
1829
+ return True
1830
+ return False
1831
+
1832
+
1833
+ def ProcessUpdateUIEvent(self, event):
1834
+ """
1835
+ Processes a UI event, searching event tables and calling zero or more
1836
+ suitable event handler function(s). Note that the ProcessEvent
1837
+ method is called from the wxPython docview framework directly since
1838
+ wxPython does not have a virtual ProcessEvent function.
1839
+ """
1840
+ for service in self._services:
1841
+ if service.ProcessUpdateUIEvent(event):
1842
+ return True
1843
+ return False
1844
+
1845
+
1846
+ def InstallService(self, service):
1847
+ """
1848
+ Installs an instance of a DocService into the DocApp.
1849
+ """
1850
+ service.SetDocumentManager(self._docManager)
1851
+ self._services.append(service)
1852
+ return service
1853
+
1854
+
1855
+ def GetServices(self):
1856
+ """
1857
+ Returns the DocService instances that have been installed into the DocApp.
1858
+ """
1859
+ return self._services
1860
+
1861
+
1862
+ def GetService(self, type):
1863
+ """
1864
+ Returns the instance of a particular type of service that has been installed
1865
+ into the DocApp. For example, "wx.GetApp().GetService(pydocview.OptionsService)"
1866
+ returns the isntance of the OptionsService that is running within the DocApp.
1867
+ """
1868
+ for service in self._services:
1869
+ if isinstance(service, type):
1870
+ return service
1871
+ return None
1872
+
1873
+
1874
+ def OnExit(self):
1875
+ """
1876
+ Called when the DocApp is exited, enables the installed DocServices to exit
1877
+ and saves the DocManager's file history.
1878
+ """
1879
+ for service in self._services:
1880
+ service.OnExit()
1881
+ config = wx.ConfigBase.Get()
1882
+ self._docManager.FileHistorySave(config)
1883
+
1884
+ if hasattr(self, "_singleInstanceChecker"):
1885
+ del self._singleInstanceChecker
1886
+
1887
+
1888
+ def GetDefaultDocManagerFlags(self):
1889
+ """
1890
+ Returns the default flags to use when creating the DocManager.
1891
+ """
1892
+ config = wx.ConfigBase.Get()
1893
+ if config.ReadInt("UseMDI", True) or config.ReadInt("UseWinMDI", False):
1894
+ flags = wx.lib.docview.DOC_MDI | wx.lib.docview.DOC_OPEN_ONCE
1895
+ if config.ReadInt("UseWinMDI", False):
1896
+ self.SetUseTabbedMDI(False)
1897
+ else:
1898
+ flags = wx.lib.docview.DOC_SDI | wx.lib.docview.DOC_OPEN_ONCE
1899
+ return flags
1900
+
1901
+
1902
+ def ShowTip(self, frame, tipProvider):
1903
+ """
1904
+ Shows the tip window, generally this is called when an application starts.
1905
+ A wx.TipProvider must be passed.
1906
+ """
1907
+ config = wx.ConfigBase.Get()
1908
+ showTip = config.ReadInt("ShowTipAtStartup", 1)
1909
+ if showTip:
1910
+ index = config.ReadInt("TipIndex", 0)
1911
+ showTipResult = wx.ShowTip(wx.GetApp().GetTopWindow(), tipProvider, showAtStartup = showTip)
1912
+ if showTipResult != showTip:
1913
+ config.WriteInt("ShowTipAtStartup", showTipResult)
1914
+
1915
+
1916
+ def GetEditMenu(self, frame):
1917
+ """
1918
+ Utility method that finds the Edit menu within the menubar of a frame.
1919
+ """
1920
+ menuBar = frame.GetMenuBar()
1921
+ if not menuBar:
1922
+ return None
1923
+ editMenuIndex = menuBar.FindMenu(_("&Edit"))
1924
+ if editMenuIndex == -1:
1925
+ return None
1926
+ return menuBar.GetMenu(editMenuIndex)
1927
+
1928
+
1929
+ def GetUseTabbedMDI(self):
1930
+ """
1931
+ Returns True if Windows MDI should use folder tabs instead of child windows.
1932
+ """
1933
+ return self._useTabbedMDI
1934
+
1935
+
1936
+ def SetUseTabbedMDI(self, useTabbedMDI):
1937
+ """
1938
+ Set to True if Windows MDI should use folder tabs instead of child windows.
1939
+ """
1940
+ self._useTabbedMDI = useTabbedMDI
1941
+
1942
+
1943
+ def CreateDocumentFrame(self, view, doc, flags, id = -1, title = "", pos = wx.DefaultPosition, size = wx.DefaultSize, style = wx.DEFAULT_FRAME_STYLE):
1944
+ """
1945
+ Called by the DocManager to create and return a new Frame for a Document.
1946
+ Chooses whether to create an MDIChildFrame or SDI Frame based on the
1947
+ DocManager's flags.
1948
+ """
1949
+ docflags = self.GetDocumentManager().GetFlags()
1950
+ if docflags & wx.lib.docview.DOC_SDI:
1951
+ frame = self.CreateSDIDocumentFrame(doc, view, id, title, pos, size, style)
1952
+ frame.Show()
1953
+
1954
+ # wxBug: operating system bug, first window is set to the position of last window closed, ignoring passed in position on frame creation
1955
+ # also, initial size is incorrect for the same reasons
1956
+ if frame.GetPosition() != pos:
1957
+ frame.Move(pos)
1958
+ if frame.GetSize() != size:
1959
+ frame.SetSize(size)
1960
+
1961
+ if doc and doc.GetCommandProcessor():
1962
+ doc.GetCommandProcessor().SetEditMenu(self.GetEditMenu(frame))
1963
+ elif docflags & wx.lib.docview.DOC_MDI:
1964
+ if self.GetUseTabbedMDI():
1965
+ frame = self.CreateTabbedDocumentFrame(doc, view, id, title, pos, size, style)
1966
+ else:
1967
+ frame = self.CreateMDIDocumentFrame(doc, view, id, title, pos, size, style)
1968
+ if doc:
1969
+ if doc.GetDocumentTemplate().GetIcon():
1970
+ frame.SetIcon(doc.GetDocumentTemplate().GetIcon())
1971
+ elif wx.GetApp().GetTopWindow().GetIcon():
1972
+ frame.SetIcon(wx.GetApp().GetTopWindow().GetIcon())
1973
+ if doc and doc.GetCommandProcessor():
1974
+ doc.GetCommandProcessor().SetEditMenu(self.GetEditMenu(wx.GetApp().GetTopWindow()))
1975
+ if not frame.GetIcon() and self._defaultIcon:
1976
+ frame.SetIcon(self.GetDefaultIcon())
1977
+ view.SetFrame(frame)
1978
+ return frame
1979
+
1980
+
1981
+ def CreateSDIDocumentFrame(self, doc, view, id=-1, title="", pos=wx.DefaultPosition, size=wx.DefaultSize, style=wx.DEFAULT_FRAME_STYLE):
1982
+ """
1983
+ Creates and returns an SDI Document Frame.
1984
+ """
1985
+ frame = DocSDIFrame(doc, view, None, id, title, pos, size, style)
1986
+ return frame
1987
+
1988
+
1989
+ def CreateTabbedDocumentFrame(self, doc, view, id=-1, title="", pos=wx.DefaultPosition, size=wx.DefaultSize, style=wx.DEFAULT_FRAME_STYLE):
1990
+ """
1991
+ Creates and returns an MDI Document Frame for a Tabbed MDI view
1992
+ """
1993
+ frame = DocTabbedChildFrame(doc, view, wx.GetApp().GetTopWindow(), id, title, pos, size, style)
1994
+ return frame
1995
+
1996
+
1997
+ def CreateMDIDocumentFrame(self, doc, view, id=-1, title="", pos=wx.DefaultPosition, size=wx.DefaultSize, style=wx.DEFAULT_FRAME_STYLE):
1998
+ """
1999
+ Creates and returns an MDI Document Frame.
2000
+ """
2001
+ # if any child windows are maximized, then user must want any new children maximized
2002
+ # if no children exist, then use the default value from registry
2003
+ # wxBug: Only current window is maximized, so need to check every child frame
2004
+ parentFrame = wx.GetApp().GetTopWindow()
2005
+ childrenMaximized = filter(lambda child: isinstance(child, wx.MDIChildFrame) and child.IsMaximized(), parentFrame.GetChildren())
2006
+ if childrenMaximized:
2007
+ maximize = True
2008
+ else:
2009
+ children = filter(lambda child: isinstance(child, wx.MDIChildFrame), parentFrame.GetChildren())
2010
+ if children:
2011
+ # other windows exist and none are maximized
2012
+ maximize = False
2013
+ else:
2014
+ # get default setting from registry
2015
+ maximize = wx.ConfigBase.Get().ReadInt("MDIChildFrameMaximized", False)
2016
+
2017
+ frame = wx.lib.docview.DocMDIChildFrame(doc, view, wx.GetApp().GetTopWindow(), id, title, pos, size, style)
2018
+ if maximize: # wxBug: Should already be maximizing new child frames if one is maximized but it's not so we have to force it to
2019
+ frame.Maximize(True)
2020
+
2021
+ ## wx.EVT_MAXIMIZE(frame, self.OnMaximize) # wxBug: This doesn't work, need to save MDIChildFrameMaximized state on close of windows instead
2022
+ wx.EVT_CLOSE(frame, self.OnCloseChildWindow)
2023
+ if not self._registeredCloseEvent:
2024
+ wx.EVT_CLOSE(parentFrame, self.OnCloseMainWindow) # need to check on this, but only once
2025
+ self._registeredCloseEvent = True
2026
+
2027
+ return frame
2028
+
2029
+
2030
+ def SaveMDIDocumentFrameMaximizedState(self, maximized):
2031
+ """
2032
+ Remember in the config whether the MDI Frame is maximized so that it can be restored
2033
+ on open.
2034
+ """
2035
+ config = wx.ConfigBase.Get()
2036
+ maximizeFlag = config.ReadInt("MDIChildFrameMaximized", False)
2037
+ if maximized != maximizeFlag:
2038
+ config.WriteInt("MDIChildFrameMaximized", maximized)
2039
+
2040
+
2041
+ def OnCloseChildWindow(self, event):
2042
+ """
2043
+ Called when an MDI Child Frame is closed. Calls SaveMDIDocumentFrameMaximizedState to
2044
+ remember whether the MDI Frame is maximized so that it can be restored on open.
2045
+ """
2046
+ self.SaveMDIDocumentFrameMaximizedState(event.GetEventObject().IsMaximized())
2047
+ event.Skip()
2048
+
2049
+
2050
+ def OnCloseMainWindow(self, event):
2051
+ """
2052
+ Called when the MDI Parent Frame is closed. Remembers whether the MDI Parent Frame is
2053
+ maximized.
2054
+ """
2055
+ children = event.GetEventObject().GetChildren()
2056
+ childrenMaximized = filter(lambda child: isinstance(child, wx.MDIChildFrame)and child.IsMaximized(), children)
2057
+ if childrenMaximized:
2058
+ self.SaveMDIDocumentFrameMaximizedState(True)
2059
+ else:
2060
+ childrenNotMaximized = filter(lambda child: isinstance(child, wx.MDIChildFrame), children)
2061
+
2062
+ if childrenNotMaximized:
2063
+ # other windows exist and none are maximized
2064
+ self.SaveMDIDocumentFrameMaximizedState(False)
2065
+
2066
+ event.Skip()
2067
+
2068
+
2069
+ def GetDefaultIcon(self):
2070
+ """
2071
+ Returns the application's default icon.
2072
+ """
2073
+ return self._defaultIcon
2074
+
2075
+
2076
+ def SetDefaultIcon(self, icon):
2077
+ """
2078
+ Sets the application's default icon.
2079
+ """
2080
+ self._defaultIcon = icon
2081
+
2082
+
2083
+ def GetDebug(self):
2084
+ """
2085
+ Returns True if the application is in debug mode.
2086
+ """
2087
+ return self._debug
2088
+
2089
+
2090
+ def SetDebug(self, debug):
2091
+ """
2092
+ Sets the application's debug mode.
2093
+ """
2094
+ self._debug = debug
2095
+
2096
+
2097
+ def GetSingleInstance(self):
2098
+ """
2099
+ Returns True if the application is in single instance mode. Used to determine if multiple instances of the application is allowed to launch.
2100
+ """
2101
+ return self._singleInstance
2102
+
2103
+
2104
+ def SetSingleInstance(self, singleInstance):
2105
+ """
2106
+ Sets application's single instance mode.
2107
+ """
2108
+ self._singleInstance = singleInstance
2109
+
2110
+
2111
+
2112
+ def CreateChildDocument(self, parentDocument, documentType, objectToEdit, path=''):
2113
+ """
2114
+ Creates a child window of a document that edits an object. The child window
2115
+ is managed by the parent document frame, so it will be prompted to close if its
2116
+ parent is closed, etc. Child Documents are useful when there are complicated
2117
+ Views of a Document and users will need to tunnel into the View.
2118
+ """
2119
+ for document in self.GetDocumentManager().GetDocuments()[:]: # Cloning list to make sure we go through all docs even as they are deleted
2120
+ if isinstance(document, ChildDocument) and document.GetParentDocument() == parentDocument:
2121
+ if document.GetData() == objectToEdit:
2122
+ if hasattr(document.GetFirstView().GetFrame(), "SetFocus"):
2123
+ document.GetFirstView().GetFrame().SetFocus()
2124
+ return document
2125
+ for temp in wx.GetApp().GetDocumentManager().GetTemplates():
2126
+ if temp.GetDocumentType() == documentType:
2127
+ break
2128
+ temp = None
2129
+ newDoc = temp.CreateDocument(path, 0, data = objectToEdit, parentDocument = parentDocument)
2130
+ newDoc.SetDocumentName(temp.GetDocumentName())
2131
+ newDoc.SetDocumentTemplate(temp)
2132
+ if path == '':
2133
+ newDoc.OnNewDocument()
2134
+ else:
2135
+ if not newDoc.OnOpenDocument(path):
2136
+ newDoc.DeleteAllViews() # Implicitly deleted by DeleteAllViews
2137
+ return None
2138
+ return newDoc
2139
+
2140
+
2141
+ def CloseChildDocuments(self, parentDocument):
2142
+ """
2143
+ Closes the child windows of a Document.
2144
+ """
2145
+ for document in self.GetDocumentManager().GetDocuments()[:]: # Cloning list to make sure we go through all docs even as they are deleted
2146
+ if isinstance(document, ChildDocument) and document.GetParentDocument() == parentDocument:
2147
+ if document.GetFirstView().GetFrame():
2148
+ document.GetFirstView().GetFrame().SetFocus()
2149
+ if not document.GetFirstView().OnClose():
2150
+ return False
2151
+ return True
2152
+
2153
+
2154
+ def IsMDI(self):
2155
+ """
2156
+ Returns True if the application is in MDI mode.
2157
+ """
2158
+ return self.GetDocumentManager().GetFlags() & wx.lib.docview.DOC_MDI
2159
+
2160
+
2161
+ def IsSDI(self):
2162
+ """
2163
+ Returns True if the application is in SDI mode.
2164
+ """
2165
+ return self.GetDocumentManager().GetFlags() & wx.lib.docview.DOC_SDI
2166
+
2167
+
2168
+ def ShowSplash(self, image):
2169
+ """
2170
+ Shows a splash window with the given image. Input parameter 'image' can either be a wx.Bitmap or a filename.
2171
+ """
2172
+ if isinstance(image, wx.Bitmap):
2173
+ splash_bmp = image
2174
+ else:
2175
+ splash_bmp = wx.Image(image).ConvertToBitmap()
2176
+ self._splash = wx.adv.SplashScreen(splash_bmp, wx.adv.SPLASH_CENTRE_ON_SCREEN|wx.adv.SPLASH_NO_TIMEOUT, 0, None, -1, style=wx.SIMPLE_BORDER|wx.FRAME_NO_TASKBAR)
2177
+ self._splash.Show()
2178
+
2179
+
2180
+ def CloseSplash(self):
2181
+ """
2182
+ Closes the splash window.
2183
+ """
2184
+ if self._splash:
2185
+ self._splash.Close(True)
2186
+
2187
+
2188
+ class _DocFrameFileDropTarget(wx.FileDropTarget):
2189
+ """
2190
+ Class used to handle drops into the document frame.
2191
+ """
2192
+
2193
+ def __init__(self, docManager, docFrame):
2194
+ """
2195
+ Initializes the FileDropTarget class with the active docManager and the docFrame.
2196
+ """
2197
+ wx.FileDropTarget.__init__(self)
2198
+ self._docManager = docManager
2199
+ self._docFrame = docFrame
2200
+
2201
+
2202
+ def OnDropFiles(self, x, y, filenames):
2203
+ """
2204
+ Called when files are dropped in the drop target and tells the docManager to open
2205
+ the files.
2206
+ """
2207
+ try:
2208
+ for file in filenames:
2209
+ self._docManager.CreateDocument(file, wx.lib.docview.DOC_SILENT)
2210
+ except:
2211
+ msgTitle = wx.GetApp().GetAppName()
2212
+ if not msgTitle:
2213
+ msgTitle = _("File Error")
2214
+ wx.MessageBox("Could not open '%s'. '%s'" % (wx.lib.docview.FileNameFromPath(file), sys.exc_value),
2215
+ msgTitle,
2216
+ wx.OK | wx.ICON_EXCLAMATION,
2217
+ self._docManager.FindSuitableParent())
2218
+
2219
+
2220
+ class DocMDIParentFrame(wx.lib.docview.DocMDIParentFrame, DocFrameMixIn, DocMDIParentFrameMixIn):
2221
+ """
2222
+ The DocMDIParentFrame is the primary frame which the DocApp uses to host MDI child windows. It offers
2223
+ features such as a default menubar, toolbar, and status bar, and a mechanism to manage embedded windows
2224
+ on the edges of the DocMDIParentFrame.
2225
+ """
2226
+
2227
+
2228
+ def __init__(self, docManager, parent, id, title, pos=wx.DefaultPosition, size=wx.DefaultSize, style=wx.DEFAULT_FRAME_STYLE, name="DocMDIFrame", embeddedWindows=0, minSize=20):
2229
+ """
2230
+ Initializes the DocMDIParentFrame with the default menubar, toolbar, and status bar. Use the
2231
+ optional embeddedWindows parameter with the embedded window constants to create embedded
2232
+ windows around the edges of the DocMDIParentFrame.
2233
+ """
2234
+ pos, size = self._GetPosSizeFromConfig(pos, size)
2235
+ wx.lib.docview.DocMDIParentFrame.__init__(self, docManager, parent, id, title, pos, size, style, name)
2236
+ self._InitFrame(embeddedWindows, minSize)
2237
+
2238
+
2239
+ def _LayoutFrame(self):
2240
+ """
2241
+ Lays out the frame.
2242
+ """
2243
+ wx.adv.LayoutAlgorithm().LayoutMDIFrame(self)
2244
+ self.GetClientWindow().Refresh()
2245
+
2246
+
2247
+ def ProcessEvent(self, event):
2248
+ """
2249
+ Processes an event, searching event tables and calling zero or more
2250
+ suitable event handler function(s). Note that the ProcessEvent
2251
+ method is called from the wxPython docview framework directly since
2252
+ wxPython does not have a virtual ProcessEvent function.
2253
+ """
2254
+ if wx.GetApp().ProcessEventBeforeWindows(event):
2255
+ return True
2256
+ if wx.lib.docview.DocMDIParentFrame.ProcessEvent(self, event):
2257
+ return True
2258
+ return DocMDIParentFrameMixIn.ProcessEvent(self, event)
2259
+
2260
+
2261
+ def ProcessUpdateUIEvent(self, event):
2262
+ """
2263
+ Processes a UI event, searching event tables and calling zero or more
2264
+ suitable event handler function(s). Note that the ProcessEvent
2265
+ method is called from the wxPython docview framework directly since
2266
+ wxPython does not have a virtual ProcessEvent function.
2267
+ """
2268
+ if wx.GetApp().ProcessUpdateUIEventBeforeWindows(event):
2269
+ return True
2270
+ if wx.lib.docview.DocMDIParentFrame.ProcessUpdateUIEvent(self, event): # Let the views handle the event before the services
2271
+ return True
2272
+ if event.GetId() == wx.ID_ABOUT: # Using ID_ABOUT to update the window menu, the window menu items are not triggering
2273
+ self.UpdateWindowMenu()
2274
+ return True
2275
+ return DocMDIParentFrameMixIn.ProcessUpdateUIEvent(self, event)
2276
+
2277
+
2278
+ def UpdateWindowMenu(self):
2279
+ """
2280
+ Updates the WindowMenu on Windows platforms.
2281
+ """
2282
+ if wx.Platform == '__WXMSW__':
2283
+ children = filter(lambda child: isinstance(child, wx.MDIChildFrame), self.GetChildren())
2284
+ windowCount = len(children)
2285
+ hasWindow = windowCount >= 1
2286
+ has2OrMoreWindows = windowCount >= 2
2287
+
2288
+ windowMenu = self.GetWindowMenu()
2289
+ if windowMenu:
2290
+ windowMenu.Enable(wx.IDM_WINDOWTILE, hasWindow)
2291
+ windowMenu.Enable(wx.IDM_WINDOWTILEHOR, hasWindow)
2292
+ windowMenu.Enable(wx.IDM_WINDOWCASCADE, hasWindow)
2293
+ windowMenu.Enable(wx.IDM_WINDOWICONS, hasWindow)
2294
+ windowMenu.Enable(wx.IDM_WINDOWTILEVERT, hasWindow)
2295
+ wx.IDM_WINDOWPREV = 4006 # wxBug: Not defined for some reason
2296
+ windowMenu.Enable(wx.IDM_WINDOWPREV, has2OrMoreWindows)
2297
+ windowMenu.Enable(wx.IDM_WINDOWNEXT, has2OrMoreWindows)
2298
+
2299
+
2300
+
2301
+ def OnSize(self, event):
2302
+ """
2303
+ Called when the DocMDIParentFrame is resized and lays out the MDI client window.
2304
+ """
2305
+ # Needed in case there are splitpanels around the mdi frame
2306
+ self._LayoutFrame()
2307
+
2308
+
2309
+ def OnCloseWindow(self, event):
2310
+ """
2311
+ Called when the DocMDIParentFrame is closed. Remembers the frame size.
2312
+ """
2313
+ self.SaveEmbeddedWindowSizes()
2314
+
2315
+ # save and close services last.
2316
+ for service in wx.GetApp().GetServices():
2317
+ if not service.OnCloseFrame(event):
2318
+ return
2319
+
2320
+ # save and close documents
2321
+ # documents with a common view, e.g. project view, should save the document, but not close the window
2322
+ # and let the service close the window.
2323
+ wx.lib.docview.DocMDIParentFrame.OnCloseWindow(self, event)
2324
+
2325
+
2326
+ class DocSDIFrame(wx.lib.docview.DocChildFrame, DocFrameMixIn):
2327
+ """
2328
+ The DocSDIFrame host DocManager Document windows. It offers features such as a default menubar,
2329
+ toolbar, and status bar.
2330
+ """
2331
+
2332
+
2333
+ def __init__(self, doc, view, parent, id, title, pos=wx.DefaultPosition, size=wx.DefaultSize, style=wx.DEFAULT_FRAME_STYLE, name="DocSDIFrame"):
2334
+ """
2335
+ Initializes the DocSDIFrame with the default menubar, toolbar, and status bar.
2336
+ """
2337
+ wx.lib.docview.DocChildFrame.__init__(self, doc, view, parent, id, title, pos, size, style, name)
2338
+ self._fileMenu = None
2339
+ if doc:
2340
+ self._docManager = doc.GetDocumentManager()
2341
+ else:
2342
+ self._docManager = None
2343
+ self.SetDropTarget(_DocFrameFileDropTarget(self._docManager, self))
2344
+
2345
+ wx.EVT_MENU(self, wx.ID_ABOUT, self.OnAbout)
2346
+ wx.EVT_MENU(self, wx.ID_EXIT, self.OnExit)
2347
+ wx.EVT_MENU_RANGE(self, wx.ID_FILE1, wx.ID_FILE9, self.OnMRUFile)
2348
+
2349
+ self.InitializePrintData()
2350
+
2351
+ menuBar = self.CreateDefaultMenuBar(sdi=True)
2352
+ toolBar = self.CreateDefaultToolBar()
2353
+ self.SetToolBar(toolBar)
2354
+ statusBar = self.CreateDefaultStatusBar()
2355
+
2356
+ for service in wx.GetApp().GetServices():
2357
+ service.InstallControls(self, menuBar = menuBar, toolBar = toolBar, statusBar = statusBar, document = doc)
2358
+
2359
+ self.SetMenuBar(menuBar) # wxBug: Need to do this in SDI to mimic MDI... because have to set the menubar at the very end or the automatic MDI "window" menu doesn't get put in the right place when the services add new menus to the menubar
2360
+
2361
+
2362
+ def _LayoutFrame(self):
2363
+ """
2364
+ Lays out the Frame.
2365
+ """
2366
+ self.Layout()
2367
+
2368
+
2369
+ def OnExit(self, event):
2370
+ """
2371
+ Called when the application is exitting.
2372
+ """
2373
+ self._childView.GetDocumentManager().Clear(force = False)
2374
+
2375
+
2376
+ def OnMRUFile(self, event):
2377
+ """
2378
+ Opens the appropriate file when it is selected from the file history
2379
+ menu.
2380
+ """
2381
+ n = event.GetId() - wx.ID_FILE1
2382
+ filename = self._docManager.GetHistoryFile(n)
2383
+ if filename:
2384
+ self._docManager.CreateDocument(filename, wx.lib.docview.DOC_SILENT)
2385
+ else:
2386
+ self._docManager.RemoveFileFromHistory(n)
2387
+ msgTitle = wx.GetApp().GetAppName()
2388
+ if not msgTitle:
2389
+ msgTitle = _("File Error")
2390
+ wx.MessageBox("The file '%s' doesn't exist and couldn't be opened.\nIt has been removed from the most recently used files list" % docview.FileNameFromPath(file),
2391
+ msgTitle,
2392
+ wx.OK | wx.ICON_EXCLAMATION,
2393
+ self)
2394
+
2395
+
2396
+ def ProcessEvent(self, event):
2397
+ """
2398
+ Processes an event, searching event tables and calling zero or more
2399
+ suitable event handler function(s). Note that the ProcessEvent
2400
+ method is called from the wxPython docview framework directly since
2401
+ wxPython does not have a virtual ProcessEvent function.
2402
+ """
2403
+ if wx.GetApp().ProcessEventBeforeWindows(event):
2404
+ return True
2405
+ if self._childView:
2406
+ self._childView.Activate(True)
2407
+
2408
+ id = event.GetId()
2409
+ if id == SAVEALL_ID:
2410
+ self.OnFileSaveAll(event)
2411
+ return True
2412
+
2413
+ if hasattr(self._childView, "GetDocumentManager") and self._childView.GetDocumentManager().ProcessEvent(event): # Need to call docmanager here since super class relies on DocParentFrame which we are not using
2414
+ return True
2415
+ else:
2416
+ return wx.GetApp().ProcessEvent(event)
2417
+
2418
+
2419
+ def ProcessUpdateUIEvent(self, event):
2420
+ """
2421
+ Processes a UI event, searching event tables and calling zero or more
2422
+ suitable event handler function(s). Note that the ProcessEvent
2423
+ method is called from the wxPython docview framework directly since
2424
+ wxPython does not have a virtual ProcessEvent function.
2425
+ """
2426
+ if wx.GetApp().ProcessUpdateUIEventBeforeWindows(event):
2427
+ return True
2428
+ if self._childView:
2429
+ if hasattr(self._childView, "GetDocumentManager"):
2430
+ docMgr = self._childView.GetDocumentManager()
2431
+ if docMgr:
2432
+ if docMgr.GetCurrentDocument() != self._childView.GetDocument():
2433
+ return False
2434
+ if docMgr.ProcessUpdateUIEvent(event): # Let the views handle the event before the services
2435
+ return True
2436
+ id = event.GetId()
2437
+ if id == wx.ID_CUT:
2438
+ event.Enable(False)
2439
+ return True
2440
+ elif id == wx.ID_COPY:
2441
+ event.Enable(False)
2442
+ return True
2443
+ elif id == wx.ID_PASTE:
2444
+ event.Enable(False)
2445
+ return True
2446
+ elif id == wx.ID_CLEAR:
2447
+ event.Enable(False)
2448
+ return True
2449
+ elif id == wx.ID_SELECTALL:
2450
+ event.Enable(False)
2451
+ return True
2452
+ elif id == SAVEALL_ID:
2453
+ filesModified = False
2454
+ docs = wx.GetApp().GetDocumentManager().GetDocuments()
2455
+ for doc in docs:
2456
+ if doc.IsModified():
2457
+ filesModified = True
2458
+ break
2459
+
2460
+ event.Enable(filesModified)
2461
+ return True
2462
+ else:
2463
+ return wx.GetApp().ProcessUpdateUIEvent(event)
2464
+
2465
+
2466
+ def OnCloseWindow(self, event):
2467
+ """
2468
+ Called when the window is saved. Enables services to help close the frame.
2469
+ """
2470
+ for service in wx.GetApp().GetServices():
2471
+ service.OnCloseFrame(event)
2472
+ wx.lib.docview.DocChildFrame.OnCloseWindow(self, event)
2473
+ if self._fileMenu and self._docManager:
2474
+ self._docManager.FileHistoryRemoveMenu(self._fileMenu)
2475
+
2476
+
2477
+ class AboutService(DocService):
2478
+ """
2479
+ About Dialog Service that installs under the Help menu to show the properties of the current application.
2480
+ """
2481
+
2482
+ def __init__(self, aboutDialog=None, image=None):
2483
+ """
2484
+ Initializes the AboutService.
2485
+ """
2486
+ if aboutDialog:
2487
+ self._dlg = aboutDialog
2488
+ self._image = None
2489
+ else:
2490
+ self._dlg = AboutDialog # use default AboutDialog
2491
+ self._image = image
2492
+
2493
+
2494
+ def ShowAbout(self):
2495
+ """
2496
+ Show the AboutDialog
2497
+ """
2498
+ if self._image:
2499
+ dlg = self._dlg(wx.GetApp().GetTopWindow(), self._image)
2500
+ else:
2501
+ dlg = self._dlg(wx.GetApp().GetTopWindow())
2502
+ dlg.CenterOnParent()
2503
+ dlg.ShowModal()
2504
+ dlg.Destroy()
2505
+
2506
+
2507
+ def SetAboutDialog(self, dlg):
2508
+ """
2509
+ Customize the AboutDialog
2510
+ """
2511
+ self._dlg = dlg
2512
+
2513
+
2514
+ class AboutDialog(wx.Dialog):
2515
+ """
2516
+ Opens an AboutDialog. Shared by DocMDIParentFrame and DocSDIFrame.
2517
+ """
2518
+
2519
+ def __init__(self, parent, image=None):
2520
+ """
2521
+ Initializes the about dialog.
2522
+ """
2523
+ wx.Dialog.__init__(self, parent, -1, _("About ") + wx.GetApp().GetAppName(), style = wx.DEFAULT_DIALOG_STYLE)
2524
+
2525
+ sizer = wx.BoxSizer(wx.VERTICAL)
2526
+ if image:
2527
+ imageItem = wx.StaticBitmap(self, -1, image.ConvertToBitmap(), (0,0), (image.GetWidth(), image.GetHeight()))
2528
+ sizer.Add(imageItem, 0, wx.ALIGN_CENTER|wx.ALL, 0)
2529
+ sizer.Add(wx.StaticText(self, -1, wx.GetApp().GetAppName()), 0, wx.ALIGN_CENTRE|wx.ALL, 5)
2530
+
2531
+ btn = wx.Button(self, wx.ID_OK)
2532
+ sizer.Add(btn, 0, wx.ALIGN_CENTRE|wx.ALL, 5)
2533
+
2534
+ self.SetSizer(sizer)
2535
+ sizer.Fit(self)
2536
+
2537
+
2538
+
2539
+ class FilePropertiesService(DocService):
2540
+ """
2541
+ Service that installs under the File menu to show the properties of the file associated
2542
+ with the current document.
2543
+ """
2544
+
2545
+ PROPERTIES_ID = wx.NewIdRef()
2546
+
2547
+
2548
+ def __init__(self):
2549
+ """
2550
+ Initializes the PropertyService.
2551
+ """
2552
+ self._customEventHandlers = []
2553
+
2554
+
2555
+ def InstallControls(self, frame, menuBar=None, toolBar=None, statusBar=None, document=None):
2556
+ """
2557
+ Installs a File/Properties menu item.
2558
+ """
2559
+ fileMenu = menuBar.GetMenu(menuBar.FindMenu(_("&File")))
2560
+ exitMenuItemPos = self.GetMenuItemPos(fileMenu, wx.ID_EXIT)
2561
+ fileMenu.InsertSeparator(exitMenuItemPos)
2562
+ fileMenu.Insert(exitMenuItemPos, FilePropertiesService.PROPERTIES_ID, _("&Properties"), _("Show file properties"))
2563
+ wx.EVT_MENU(frame, FilePropertiesService.PROPERTIES_ID, self.ProcessEvent)
2564
+ wx.EVT_UPDATE_UI(frame, FilePropertiesService.PROPERTIES_ID, self.ProcessUpdateUIEvent)
2565
+
2566
+
2567
+ def ProcessEvent(self, event):
2568
+ """
2569
+ Detects when the File/Properties menu item is selected.
2570
+ """
2571
+ id = event.GetId()
2572
+ if id == FilePropertiesService.PROPERTIES_ID:
2573
+ for eventHandler in self._customEventHandlers:
2574
+ if eventHandler.ProcessEvent(event):
2575
+ return True
2576
+
2577
+ self.ShowPropertiesDialog()
2578
+ return True
2579
+ else:
2580
+ return False
2581
+
2582
+
2583
+ def ProcessUpdateUIEvent(self, event):
2584
+ """
2585
+ Updates the File/Properties menu item.
2586
+ """
2587
+ id = event.GetId()
2588
+ if id == FilePropertiesService.PROPERTIES_ID:
2589
+ for eventHandler in self._customEventHandlers:
2590
+ if eventHandler.ProcessUpdateUIEvent(event):
2591
+ return True
2592
+
2593
+ event.Enable(wx.GetApp().GetDocumentManager().GetCurrentDocument() is not None)
2594
+ return True
2595
+ else:
2596
+ return False
2597
+
2598
+
2599
+ def ShowPropertiesDialog(self, filename=None):
2600
+ """
2601
+ Shows the PropertiesDialog for the specified file.
2602
+ """
2603
+ if not filename:
2604
+ filename = wx.GetApp().GetDocumentManager().GetCurrentDocument().GetFilename()
2605
+
2606
+ filePropertiesDialog = FilePropertiesDialog(wx.GetApp().GetTopWindow(), filename)
2607
+ filePropertiesDialog.CenterOnParent()
2608
+ if filePropertiesDialog.ShowModal() == wx.ID_OK:
2609
+ pass # Handle OK
2610
+ filePropertiesDialog.Destroy()
2611
+
2612
+
2613
+ def GetCustomEventHandlers(self):
2614
+ """
2615
+ Returns the custom event handlers for the PropertyService.
2616
+ """
2617
+ return self._customEventHandlers
2618
+
2619
+
2620
+ def AddCustomEventHandler(self, handler):
2621
+ """
2622
+ Adds a custom event handlers for the PropertyService. A custom event handler enables
2623
+ a different dialog to be provided for a particular file.
2624
+ """
2625
+ self._customEventHandlers.append(handler)
2626
+
2627
+
2628
+ def RemoveCustomEventHandler(self, handler):
2629
+ """
2630
+ Removes a custom event handler from the PropertyService.
2631
+ """
2632
+ self._customEventHandlers.remove(handler)
2633
+
2634
+
2635
+ def chopPath(self, text, length=36):
2636
+ """
2637
+ Simple version of textwrap. textwrap.fill() unfortunately chops lines at spaces
2638
+ and creates odd word boundaries. Instead, we will chop the path without regard to
2639
+ spaces, but pay attention to path delimiters.
2640
+ """
2641
+ chopped = ""
2642
+ textLen = len(text)
2643
+ start = 0
2644
+
2645
+ while start < textLen:
2646
+ end = start + length
2647
+ if end > textLen:
2648
+ end = textLen
2649
+
2650
+ # see if we can find a delimiter to chop the path
2651
+ if end < textLen:
2652
+ lastSep = text.rfind(os.sep, start, end + 1)
2653
+ if lastSep != -1 and lastSep != start:
2654
+ end = lastSep
2655
+
2656
+ if len(chopped):
2657
+ chopped = chopped + '\n' + text[start:end]
2658
+ else:
2659
+ chopped = text[start:end]
2660
+
2661
+ start = end
2662
+
2663
+ return chopped
2664
+
2665
+
2666
+ class FilePropertiesDialog(wx.Dialog):
2667
+ """
2668
+ Dialog that shows the properties of a file. Invoked by the PropertiesService.
2669
+ """
2670
+
2671
+
2672
+ def __init__(self, parent, filename):
2673
+ """
2674
+ Initializes the properties dialog.
2675
+ """
2676
+ wx.Dialog.__init__(self, parent, -1, _("File Properties"), size=(310, 330))
2677
+
2678
+ HALF_SPACE = 5
2679
+ SPACE = 10
2680
+
2681
+ filePropertiesService = wx.GetApp().GetService(FilePropertiesService)
2682
+
2683
+ fileExists = os.path.exists(filename)
2684
+
2685
+ notebook = wx.Notebook(self, -1)
2686
+ tab = wx.Panel(notebook, -1)
2687
+
2688
+ gridSizer = RowColSizer()
2689
+
2690
+ gridSizer.Add(wx.StaticText(tab, -1, _("Filename:")), flag=wx.RIGHT, border=HALF_SPACE, row=0, col=0)
2691
+ gridSizer.Add(wx.StaticText(tab, -1, os.path.basename(filename)), row=0, col=1)
2692
+
2693
+ gridSizer.Add(wx.StaticText(tab, -1, _("Location:")), flag=wx.RIGHT, border=HALF_SPACE, row=1, col=0)
2694
+ gridSizer.Add(wx.StaticText(tab, -1, filePropertiesService.chopPath(os.path.dirname(filename))), flag=wx.BOTTOM, border=SPACE, row=1, col=1)
2695
+
2696
+ gridSizer.Add(wx.StaticText(tab, -1, _("Size:")), flag=wx.RIGHT, border=HALF_SPACE, row=2, col=0)
2697
+ if fileExists:
2698
+ gridSizer.Add(wx.StaticText(tab, -1, str(os.path.getsize(filename)) + ' ' + _("bytes")), row=2, col=1)
2699
+
2700
+ lineSizer = wx.BoxSizer(wx.VERTICAL) # let the line expand horizontally without vertical expansion
2701
+ lineSizer.Add(wx.StaticLine(tab, -1, size = (10,-1)), 0, wx.EXPAND)
2702
+ gridSizer.Add(lineSizer, flag=wx.EXPAND|wx.ALIGN_CENTER_VERTICAL|wx.TOP, border=HALF_SPACE, row=3, col=0, colspan=2)
2703
+
2704
+ gridSizer.Add(wx.StaticText(tab, -1, _("Created:")), flag=wx.RIGHT, border=HALF_SPACE, row=4, col=0)
2705
+ if fileExists:
2706
+ gridSizer.Add(wx.StaticText(tab, -1, time.ctime(os.path.getctime(filename))), row=4, col=1)
2707
+
2708
+ gridSizer.Add(wx.StaticText(tab, -1, _("Modified:")), flag=wx.RIGHT, border=HALF_SPACE, row=5, col=0)
2709
+ if fileExists:
2710
+ gridSizer.Add(wx.StaticText(tab, -1, time.ctime(os.path.getmtime(filename))), row=5, col=1)
2711
+
2712
+ gridSizer.Add(wx.StaticText(tab, -1, _("Accessed:")), flag=wx.RIGHT, border=HALF_SPACE, row=6, col=0)
2713
+ if fileExists:
2714
+ gridSizer.Add(wx.StaticText(tab, -1, time.ctime(os.path.getatime(filename))), row=6, col=1)
2715
+
2716
+ # add a border around the inside of the tab
2717
+ spacerGrid = wx.BoxSizer(wx.VERTICAL)
2718
+ spacerGrid.Add(gridSizer, 0, wx.ALL, SPACE);
2719
+ tab.SetSizer(spacerGrid)
2720
+ notebook.AddPage(tab, _("General"))
2721
+
2722
+ sizer = wx.BoxSizer(wx.VERTICAL)
2723
+ sizer.Add(notebook, 0, wx.ALL | wx.EXPAND, SPACE)
2724
+ sizer.Add(self.CreateButtonSizer(wx.OK), 0, wx.ALIGN_RIGHT | wx.RIGHT | wx.BOTTOM, HALF_SPACE)
2725
+
2726
+ sizer.Fit(self)
2727
+ self.SetSize(-1, -1, 310, -1, wx.SIZE_USE_EXISTING)
2728
+ self.SetSizer(sizer)
2729
+ self.Layout()
2730
+
2731
+
2732
+ class ChildDocument(wx.lib.docview.Document):
2733
+ """
2734
+ A ChildDocument is a document that represents a portion of a Document. The child
2735
+ document is managed by the parent document, so it will be prompted to close if its
2736
+ parent is closed, etc. Child Documents are useful when there are complicated
2737
+ Views of a Document and users will need to tunnel into the View.
2738
+ """
2739
+
2740
+
2741
+ def GetData(self):
2742
+ """
2743
+ Returns the data that the ChildDocument contains.
2744
+ """
2745
+ return self._data
2746
+
2747
+
2748
+ def SetData(self, data):
2749
+ """
2750
+ Sets the data that the ChildDocument contains.
2751
+ """
2752
+ self._data = data
2753
+
2754
+
2755
+ def GetParentDocument(self):
2756
+ """
2757
+ Returns the parent Document of the ChildDocument.
2758
+ """
2759
+ return self._parentDocument
2760
+
2761
+
2762
+ def SetParentDocument(self, parentDocument):
2763
+ """
2764
+ Sets the parent Document of the ChildDocument.
2765
+ """
2766
+ self._parentDocument = parentDocument
2767
+
2768
+
2769
+ def OnSaveDocument(self, filename):
2770
+ """
2771
+ Called when the ChildDocument is saved and does the minimum such that the
2772
+ ChildDocument looks like a real Document to the framework.
2773
+ """
2774
+ self.SetFilename(filename, True)
2775
+ self.Modify(False)
2776
+ self.SetDocumentSaved(True)
2777
+ return True
2778
+
2779
+
2780
+ def OnOpenDocument(self, filename):
2781
+ """
2782
+ Called when the ChildDocument is opened and does the minimum such that the
2783
+ ChildDocument looks like a real Document to the framework.
2784
+ """
2785
+ self.SetFilename(filename, True)
2786
+ self.Modify(False)
2787
+ self.SetDocumentSaved(True)
2788
+ self.UpdateAllViews()
2789
+ return True
2790
+
2791
+
2792
+ def Save(self):
2793
+ """
2794
+ Called when the ChildDocument is saved and does the minimum such that the
2795
+ ChildDocument looks like a real Document to the framework.
2796
+ """
2797
+ return self.OnSaveDocument(self._documentFile)
2798
+
2799
+
2800
+ def SaveAs(self):
2801
+ """
2802
+ Called when the ChildDocument is saved and does the minimum such that the
2803
+ ChildDocument looks like a real Document to the framework.
2804
+ """
2805
+ return self.OnSaveDocument(self._documentFile)
2806
+
2807
+
2808
+ class ChildDocTemplate(wx.lib.docview.DocTemplate):
2809
+ """
2810
+ A ChildDocTemplate is a DocTemplate subclass that enables the creation of ChildDocuments
2811
+ that represents a portion of a Document. The child document is managed by the parent document,
2812
+ so it will be prompted to close if its parent is closed, etc. Child Documents are useful
2813
+ when there are complicated Views of a Document and users will need to tunnel into the View.
2814
+ """
2815
+
2816
+
2817
+ def __init__(self, manager, description, filter, dir, ext, docTypeName, viewTypeName, docType, viewType, flags=wx.lib.docview.TEMPLATE_INVISIBLE, icon=None):
2818
+ """
2819
+ Initializes the ChildDocTemplate.
2820
+ """
2821
+ wx.lib.docview.DocTemplate.__init__(self, manager, description, filter, dir, ext, docTypeName, viewTypeName, docType, viewType, flags=flags, icon=icon)
2822
+
2823
+
2824
+ def CreateDocument(self, path, flags, data=None, parentDocument=None):
2825
+ """
2826
+ Called when a ChildDocument is to be created and does the minimum such that the
2827
+ ChildDocument looks like a real Document to the framework.
2828
+ """
2829
+ doc = self._docType()
2830
+ doc.SetFilename(path)
2831
+ doc.SetData(data)
2832
+ doc.SetParentDocument(parentDocument)
2833
+ doc.SetDocumentTemplate(self)
2834
+ self.GetDocumentManager().AddDocument(doc)
2835
+ doc.SetCommandProcessor(doc.OnCreateCommandProcessor())
2836
+ if doc.OnCreate(path, flags):
2837
+ return doc
2838
+ else:
2839
+ if doc in self.GetDocumentManager().GetDocuments():
2840
+ doc.DeleteAllViews()
2841
+ return None
2842
+
2843
+
2844
+ class WindowMenuService(DocService):
2845
+ """
2846
+ The WindowMenuService is a service that implements a standard Window menu that is used
2847
+ by the DocSDIFrame. The MDIFrame automatically includes a Window menu and does not use
2848
+ the WindowMenuService.
2849
+ """
2850
+
2851
+ #----------------------------------------------------------------------------
2852
+ # Constants
2853
+ #----------------------------------------------------------------------------
2854
+ ARRANGE_WINDOWS_ID = wx.NewIdRef()
2855
+ SELECT_MORE_WINDOWS_ID = wx.NewIdRef()
2856
+ SELECT_NEXT_WINDOW_ID = wx.NewIdRef()
2857
+ SELECT_PREV_WINDOW_ID = wx.NewIdRef()
2858
+ CLOSE_CURRENT_WINDOW_ID = wx.NewIdRef()
2859
+
2860
+
2861
+ def __init__(self):
2862
+ """
2863
+ Initializes the WindowMenu and its globals.
2864
+ """
2865
+ self._selectWinIds = []
2866
+ for i in range(0, 9):
2867
+ self._selectWinIds.append(wx.NewIdRef())
2868
+
2869
+
2870
+ def InstallControls(self, frame, menuBar=None, toolBar=None, statusBar=None, document=None):
2871
+ """
2872
+ Installs the Window menu.
2873
+ """
2874
+
2875
+ windowMenu = None
2876
+ if hasattr(frame, "GetWindowMenu"):
2877
+ windowMenu = frame.GetWindowMenu()
2878
+ if not windowMenu:
2879
+ needWindowMenu = True
2880
+ windowMenu = wx.Menu()
2881
+ else:
2882
+ needWindowMenu = False
2883
+
2884
+ if self.GetDocumentManager().GetFlags() & wx.lib.docview.DOC_SDI:
2885
+ if not _WINDOWS: # Arrange All and window navigation doesn't work on Linux
2886
+ return
2887
+
2888
+ item = windowMenu.Append(self.ARRANGE_WINDOWS_ID, _("&Arrange All"), _("Arrange the open windows"))
2889
+ wx.EVT_MENU(frame, self.ARRANGE_WINDOWS_ID, frame.ProcessEvent)
2890
+ wx.EVT_UPDATE_UI(frame, self.ARRANGE_WINDOWS_ID, frame.ProcessUpdateUIEvent)
2891
+ windowMenu.AppendSeparator()
2892
+
2893
+ for i, id in enumerate(self._selectWinIds):
2894
+ wx.EVT_MENU(frame, id, frame.ProcessEvent)
2895
+ wx.EVT_MENU(frame, self.SELECT_MORE_WINDOWS_ID, frame.ProcessEvent)
2896
+ elif wx.GetApp().GetUseTabbedMDI():
2897
+ item = windowMenu.Append(self.SELECT_PREV_WINDOW_ID, _("Previous"), _("Previous Tab"))
2898
+ wx.EVT_MENU(frame, self.SELECT_PREV_WINDOW_ID, frame.ProcessEvent)
2899
+ wx.EVT_UPDATE_UI(frame, self.SELECT_PREV_WINDOW_ID, frame.ProcessUpdateUIEvent)
2900
+ item = windowMenu.Append(self.SELECT_NEXT_WINDOW_ID, _("Next"), _("Next Tab"))
2901
+ wx.EVT_MENU(frame, self.SELECT_NEXT_WINDOW_ID, frame.ProcessEvent)
2902
+ wx.EVT_UPDATE_UI(frame, self.SELECT_NEXT_WINDOW_ID, frame.ProcessUpdateUIEvent)
2903
+ item = windowMenu.Append(self.CLOSE_CURRENT_WINDOW_ID, _("Close Current\tCtrl+F4"), _("Close Current Tab"))
2904
+ wx.EVT_MENU(frame, self.CLOSE_CURRENT_WINDOW_ID, frame.ProcessEvent)
2905
+ wx.EVT_UPDATE_UI(frame, self.CLOSE_CURRENT_WINDOW_ID, frame.ProcessUpdateUIEvent)
2906
+ self._sep = None
2907
+
2908
+ for i, id in enumerate(self._selectWinIds):
2909
+ wx.EVT_MENU(frame, id, self.OnCtrlKeySelect)
2910
+
2911
+ if needWindowMenu:
2912
+ helpMenuIndex = menuBar.FindMenu(_("&Help"))
2913
+ menuBar.Insert(helpMenuIndex, windowMenu, _("&Window"))
2914
+
2915
+ self._lastFrameUpdated = None
2916
+
2917
+
2918
+ def OnCtrlKeySelect(self, event):
2919
+ i = self._selectWinIds.index(event.GetId())
2920
+ notebook = wx.GetApp().GetTopWindow()._notebook
2921
+ if i < notebook.GetPageCount():
2922
+ notebook.SetSelection(i)
2923
+
2924
+
2925
+ def ProcessEvent(self, event):
2926
+ """
2927
+ Processes a Window menu event.
2928
+ """
2929
+ id = event.GetId()
2930
+ if id == self.ARRANGE_WINDOWS_ID:
2931
+ self.OnArrangeWindows(event)
2932
+ return True
2933
+ elif id == self.SELECT_MORE_WINDOWS_ID:
2934
+ self.OnSelectMoreWindows(event)
2935
+ return True
2936
+ elif id in self._selectWinIds:
2937
+ self.OnSelectWindowMenu(event)
2938
+ return True
2939
+ elif wx.GetApp().GetUseTabbedMDI():
2940
+ if id == self.SELECT_NEXT_WINDOW_ID:
2941
+ notebook = wx.GetApp().GetTopWindow()._notebook
2942
+ i = notebook.GetSelection()
2943
+ notebook.SetSelection(i+1)
2944
+ return True
2945
+ elif id == self.SELECT_PREV_WINDOW_ID:
2946
+ notebook = wx.GetApp().GetTopWindow()._notebook
2947
+ i = notebook.GetSelection()
2948
+ notebook.SetSelection(i-1)
2949
+ return True
2950
+ elif id == self.CLOSE_CURRENT_WINDOW_ID:
2951
+ notebook = wx.GetApp().GetTopWindow()._notebook
2952
+ i = notebook.GetSelection()
2953
+ if i != -1:
2954
+ doc = notebook.GetPage(i).GetView().GetDocument()
2955
+ wx.GetApp().GetDocumentManager().CloseDocument(doc, False)
2956
+ return True
2957
+ else:
2958
+ return False
2959
+
2960
+
2961
+ def ProcessUpdateUIEvent(self, event):
2962
+ """
2963
+ Updates the Window menu items.
2964
+ """
2965
+ id = event.GetId()
2966
+ if id == self.ARRANGE_WINDOWS_ID:
2967
+ frame = event.GetEventObject()
2968
+ if not self._lastFrameUpdated or self._lastFrameUpdated != frame:
2969
+ self.BuildWindowMenu(frame) # It's a new frame, so update the windows menu... this is as if the View::OnActivateMethod had been invoked
2970
+ self._lastFrameUpdated = frame
2971
+ return True
2972
+ elif wx.GetApp().GetUseTabbedMDI():
2973
+ if id == self.SELECT_NEXT_WINDOW_ID:
2974
+ self.BuildWindowMenu(event.GetEventObject()) # build file list only when we are updating the windows menu
2975
+
2976
+ notebook = wx.GetApp().GetTopWindow()._notebook
2977
+ i = notebook.GetSelection()
2978
+ if i == -1:
2979
+ event.Enable(False)
2980
+ return True
2981
+ i += 1
2982
+ if i >= notebook.GetPageCount():
2983
+ event.Enable(False)
2984
+ return True
2985
+ event.Enable(True)
2986
+ return True
2987
+ elif id == self.SELECT_PREV_WINDOW_ID:
2988
+ notebook = wx.GetApp().GetTopWindow()._notebook
2989
+ i = notebook.GetSelection()
2990
+ if i == -1:
2991
+ event.Enable(False)
2992
+ return True
2993
+ i -= 1
2994
+ if i < 0:
2995
+ event.Enable(False)
2996
+ return True
2997
+ event.Enable(True)
2998
+ return True
2999
+ elif id == self.CLOSE_CURRENT_WINDOW_ID:
3000
+ event.Enable(wx.GetApp().GetTopWindow()._notebook.GetSelection() != -1)
3001
+ return True
3002
+
3003
+ return False
3004
+ else:
3005
+ return False
3006
+
3007
+
3008
+ def BuildWindowMenu(self, currentFrame):
3009
+ """
3010
+ Builds the Window menu and adds menu items for all of the open documents in the DocManager.
3011
+ """
3012
+ if wx.GetApp().GetUseTabbedMDI():
3013
+ currentFrame = wx.GetApp().GetTopWindow()
3014
+
3015
+ windowMenuIndex = currentFrame.GetMenuBar().FindMenu(_("&Window"))
3016
+ assert windowMenuIndex != wx.NOT_FOUND, "Menu not found in MenuBar for {}".format(_("&Window"))
3017
+ windowMenu = currentFrame.GetMenuBar().GetMenu(windowMenuIndex)
3018
+
3019
+ if self.GetDocumentManager().GetFlags() & wx.lib.docview.DOC_SDI:
3020
+ frames = self._GetWindowMenuFrameList(currentFrame)
3021
+ max = WINDOW_MENU_NUM_ITEMS
3022
+ if max > len(frames):
3023
+ max = len(frames)
3024
+ i = 0
3025
+ for i in range(0, max):
3026
+ frame = frames[i]
3027
+ item = windowMenu.FindItemById(self._selectWinIds[i])
3028
+ label = '&' + str(i + 1) + ' ' + frame.GetTitle()
3029
+ if not item:
3030
+ item = windowMenu.AppendCheckItem(self._selectWinIds[i], label)
3031
+ else:
3032
+ windowMenu.SetLabel(self._selectWinIds[i], label)
3033
+ windowMenu.Check(self._selectWinIds[i], (frame == currentFrame))
3034
+ if len(frames) > WINDOW_MENU_NUM_ITEMS: # Add the more items item
3035
+ if not windowMenu.FindItemById(self.SELECT_MORE_WINDOWS_ID):
3036
+ windowMenu.Append(self.SELECT_MORE_WINDOWS_ID, _("&More Windows..."))
3037
+ else: # Remove any extra items
3038
+ if windowMenu.FindItemById(self.SELECT_MORE_WINDOWS_ID):
3039
+ windowMenu.Remove(self.SELECT_MORE_WINDOWS_ID)
3040
+
3041
+ for j in range(i + 1, WINDOW_MENU_NUM_ITEMS):
3042
+ if windowMenu.FindItemById(self._selectWinIds[j]):
3043
+ windowMenu.Remove(self._selectWinIds[j])
3044
+
3045
+ elif wx.GetApp().GetUseTabbedMDI():
3046
+ notebook = wx.GetApp().GetTopWindow()._notebook
3047
+ numPages = notebook.GetPageCount()
3048
+
3049
+ for id in self._selectWinIds:
3050
+ item = windowMenu.FindItemById(id)
3051
+ if item:
3052
+ windowMenu.DeleteItem(item)
3053
+ if numPages == 0 and self._sep:
3054
+ windowMenu.DeleteItem(self._sep)
3055
+ self._sep = None
3056
+
3057
+ if numPages > len(self._selectWinIds):
3058
+ for i in range(len(self._selectWinIds), numPages):
3059
+ self._selectWinIds.append(wx.NewIdRef())
3060
+ wx.EVT_MENU(currentFrame, self._selectWinIds[i], self.OnCtrlKeySelect)
3061
+
3062
+ for i in range(0, numPages):
3063
+ if i == 0 and not self._sep:
3064
+ self._sep = windowMenu.AppendSeparator()
3065
+ if i < 9:
3066
+ menuLabel = "%s\tCtrl+%s" % (notebook.GetPageText(i), i+1)
3067
+ else:
3068
+ menuLabel = notebook.GetPageText(i)
3069
+ windowMenu.Append(self._selectWinIds[i], menuLabel)
3070
+
3071
+
3072
+ def _GetWindowMenuIDList(self):
3073
+ """
3074
+ Returns a list of the Window menu item IDs.
3075
+ """
3076
+ return self._selectWinIds
3077
+
3078
+
3079
+ def _GetWindowMenuFrameList(self, currentFrame=None):
3080
+ """
3081
+ Returns the Frame associated with each menu item in the Window menu.
3082
+ """
3083
+ frameList = []
3084
+ # get list of windows for documents
3085
+ for doc in self._docManager.GetDocuments():
3086
+ for view in doc.GetViews():
3087
+ frame = view.GetFrame()
3088
+ if frame not in frameList:
3089
+ if frame == currentFrame and len(frameList) >= WINDOW_MENU_NUM_ITEMS:
3090
+ frameList.insert(WINDOW_MENU_NUM_ITEMS - 1, frame)
3091
+ else:
3092
+ frameList.append(frame)
3093
+ # get list of windows for general services
3094
+ for service in wx.GetApp().GetServices():
3095
+ view = service.GetView()
3096
+ if view:
3097
+ frame = view.GetFrame()
3098
+ if frame not in frameList:
3099
+ if frame == currentFrame and len(frameList) >= WINDOW_MENU_NUM_ITEMS:
3100
+ frameList.insert(WINDOW_MENU_NUM_ITEMS - 1, frame)
3101
+ else:
3102
+ frameList.append(frame)
3103
+
3104
+ return frameList
3105
+
3106
+
3107
+ def OnArrangeWindows(self, event):
3108
+ """
3109
+ Called by Window/Arrange and tiles the frames on the desktop.
3110
+ """
3111
+ currentFrame = event.GetEventObject()
3112
+
3113
+ tempFrame = wx.Frame(None, -1, "", pos = wx.DefaultPosition, size = wx.DefaultSize)
3114
+ sizex = tempFrame.GetSize()[0]
3115
+ sizey = tempFrame.GetSize()[1]
3116
+ tempFrame.Destroy()
3117
+
3118
+ posx = 0
3119
+ posy = 0
3120
+ delta = 0
3121
+ frames = self._GetWindowMenuFrameList()
3122
+ frames.remove(currentFrame)
3123
+ frames.append(currentFrame) # Make the current frame the last frame so that it is the last one to appear
3124
+ for frame in frames:
3125
+ if delta == 0:
3126
+ delta = frame.GetClientAreaOrigin()[1]
3127
+ frame.SetPosition((posx, posy))
3128
+ frame.SetSize((sizex, sizey))
3129
+ # TODO: Need to loop around if posx + delta + size > displaysize
3130
+ frame.SetFocus()
3131
+ posx = posx + delta
3132
+ posy = posy + delta
3133
+ if posx + sizex > wx.DisplaySize()[0] or posy + sizey > wx.DisplaySize()[1]:
3134
+ posx = 0
3135
+ posy = 0
3136
+ currentFrame.SetFocus()
3137
+
3138
+
3139
+ def OnSelectWindowMenu(self, event):
3140
+ """
3141
+ Called when the Window menu item representing a Frame is selected and brings the selected
3142
+ Frame to the front of the desktop.
3143
+ """
3144
+ id = event.GetId()
3145
+ index = self._selectWinIds.index(id)
3146
+ if index > -1:
3147
+ currentFrame = event.GetEventObject()
3148
+ frame = self._GetWindowMenuFrameList(currentFrame)[index]
3149
+ if frame:
3150
+ wx.CallAfter(frame.Raise)
3151
+
3152
+
3153
+ def OnSelectMoreWindows(self, event):
3154
+ """
3155
+ Called when the "Window/Select More Windows..." menu item is selected and enables user to
3156
+ select from the Frames that do not in the Window list. Useful when there are more than
3157
+ 10 open frames in the application.
3158
+ """
3159
+ frames = self._GetWindowMenuFrameList() # TODO - make the current window the first one
3160
+ strings = map(lambda frame: frame.GetTitle(), frames)
3161
+ # Should preselect the current window, but not supported by wx.GetSingleChoice
3162
+ res = wx.GetSingleChoiceIndex(_("Select a window to show:"),
3163
+ _("Select Window"),
3164
+ strings,
3165
+ self)
3166
+ if res == -1:
3167
+ return
3168
+ frames[res].SetFocus()
3169
+
3170
+
3171
+
3172
+ def getBlankIcon():
3173
+ return Blank.GetIcon()
3174
+
3175
+ #----------------------------------------------------------------------------
3176
+ # File generated by encode_bitmaps.py
3177
+ #----------------------------------------------------------------------------
3178
+ from wx.lib.embeddedimage import PyEmbeddedImage
3179
+
3180
+ New = PyEmbeddedImage(
3181
+ "iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABHNCSVQICAgIfAhkiAAAAQRJ"
3182
+ "REFUOI2lk71qAkEQx397Z21l5WPkCYKFhYVvYeUr2FrYJ2X6gNjYWBlSxAeQBNFKCBcMclxW"
3183
+ "4eT8gLU499i9D6I4MOzsMr//zsyyQjgu91jJ3HxMl0rHvgwB8NYBAFJGdFp1kVEQjpv45PNb"
3184
+ "LXcq8a9t7M+DiRqtlOq+jJWZLxwX59pSyyV4aNRod1+VeW614MuQ6iUOT/G62cflvw/fWF3a"
3185
+ "KRQwQQ0DPDZrbE/wd4R+78nKL2xBw0AC55lVgbcOqOztBBPeHP4RkDKyQMjCi9m8WMAENazB"
3186
+ "IEpn5gjoKadv1bC/ywpkhngLnCtwCwypFn68X+ud0wPLM3Hvb7z6LxTZGR/7imGH8vcWAAAA"
3187
+ "AElFTkSuQmCC")
3188
+
3189
+ Open = PyEmbeddedImage(
3190
+ "iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABHNCSVQICAgIfAhkiAAAAWdJ"
3191
+ "REFUOI2lkz1LQlEYx39Xbyk1FTk0REMEIdELTS3R0FSBurf4AVqa2/oIQUMQDrWGukRDYENN"
3192
+ "YU7ZC1FGN+J6wWt6zcSX06DevFxvRf2nc87z/H/nec6LJLnc/EcyQPFiQwAYJc0SHF7cl34E"
3193
+ "GOdLom9mBYD+jkDDyPJ6ShOsK+b6eChhgcqid4qGkYWqbkX3DODzzwNQfXwzl5MRVcyF0yZE"
3194
+ "7vSIsvo1KasomSIAuYdjCzsZ8QuAuXBasgAA01TLpQAo5FVm17ZtvacO1onHosIEPF/f4xUa"
3195
+ "tVa/Y6ubNlM3yUZJQ7/L4BUavullfK1AQ791NJ3sblGZ3GkCAOofGhVdYahwY0uuvz85ggLB"
3196
+ "kCQbuoI86OuaXMsp3XwUchU8rbGrmZhiZGLUcafvZLsFp92PDi+dAYW8ClgrOEtcmeUCeBb2"
3197
+ "ugIkyeU2H0Zb2otunnKnAsGQ7W9I7d8Yj0XFbwyOgL/qE6gYiTXnTLM6AAAAAElFTkSuQmCC")
3198
+
3199
+ Copy = PyEmbeddedImage(
3200
+ "iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABHNCSVQICAgIfAhkiAAAAV9J"
3201
+ "REFUOI2Nkr9LAmEYxz93+ifY0KDkdtAkTY1CERGlQn9AQ9BSQ3trOEWDNLQ1ChX9gGhoaNKt"
3202
+ "SYKkIbiEytQ7pfJS4W3Q+/VeHn7h5V6ee76f9/u8d0qpogtGapjfANTqBgBm22Jvc1EhTKWK"
3203
+ "LqpfIrCOzsui/CnETv5UKGqEsatU0UUsGXeAjZdXdz9BItVu8iqWjBNLxtFSGlpKY2FpHoD0"
3204
+ "aprt/aLwAULnG6nZHT47A1jZWPdBVG9Ds+vGlmW2LR5u77k5OQPg6vJCAERrdYMpzYWMO31u"
3205
+ "OQ2A0YdivgCzM8MEZttymjsDv0mGGv3gAapt7AyGDfaNe832OwCzJwHeP5o+upxINrcseH6q"
3206
+ "Oj1Rn7nnH0Wut1y2H+CNFUgkmRs/EkDX39APCk4hkZie2AwQvT7eVexvCnD3+OtLFGZ2Rshk"
3207
+ "c87/vbZ1KLyJvBf2nxRFjQSK3kRhymRzyh8MSdTaiEWdxAAAAABJRU5ErkJggg==")
3208
+
3209
+ Paste = PyEmbeddedImage(
3210
+ "iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABHNCSVQICAgIfAhkiAAAAZBJ"
3211
+ "REFUOI2Nkz9IAmEYh59Td7GpIXHIsD9C0JgQRFMQmIJD0RIazQ1iJq0aFDRGYFvUIGhCUEtD"
3212
+ "g1CLNOSpdFCCmIhgJIKL2HDddael/ZZ7v+/9vc/3fnf3CoLBCEBN7HTRKHgSZWbKTi4vEVzc"
3213
+ "06Zweo2CEguCwUhN7HQtY/eqIRDJ4F1yUqy0AcjlJeK7RjVffAypEAM9CkQyACTvnsnlJXJ5"
3214
+ "Sd4/6Oh86atUF8DUC9gKbKhx/aMlt9l44a09wnG6wo77VefvAwCYbdbvp7IzydttBvuKj+B5"
3215
+ "isDEEADAzUVCjZfXfWq8sOYhfplk0TEEoC1SJF0nqDRNNMoFcDh/B9Q/WphtcgeVppz2b3uw"
3216
+ "zrsAsAPpw9jwK2g7ePn8y9ULaD5QencxPgtnpyldqlEuAGDbDA8AaE70b3t+PfmpDlmxindJ"
3217
+ "8w5qBbCYHwB4LdWwzsPRfkxXmBWrzE2P/q8DAHcwzFP9Z237w9f3Kyt31RYPkgnk6XpOhr6n"
3218
+ "Mar7TFmxOhAgKOMMPwPyX7lXPcIXHPiHmgMS17kAAAAASUVORK5CYII=")
3219
+
3220
+ Save = PyEmbeddedImage(
3221
+ "iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABHNCSVQICAgIfAhkiAAAAR1J"
3222
+ "REFUOI2dkz1Ow0AQhb/1oi3xEaCNQ4+CoOWnpuIEtHAAGvsCEVT0pKDBwVwBkFIixaSJUkQU"
3223
+ "BCSiQAGxBEPhyLFgHUNeNTs/782MdpRyNPHFp1CCYf+3b/1AK5SjuW8iMqhLGIZShMGHyN3z"
3224
+ "WHzfFxGRm2MkiiJx8oxaa6v60xge3xK67waA2xOVxRxrRQnWtvfsBEmSlKr/xFwd8NL9G0GZ"
3225
+ "OsBC/rG78UAQBDPFjzavAOh1wF2eEAz7QG2SsL84zR61rG3bOxi1wF0lOH3NhSuZ1Y6/Mvv8"
3226
+ "sGcfIVWs4Hle5jLGcNZoFI40c4nGpMtbqVb/R6C1zoqXalu047iQQCkn/b7X9eKD6nXsfncn"
3227
+ "mhIAXDbD0qss7GBefAO233xRLqcViQAAAABJRU5ErkJggg==")
3228
+
3229
+ SaveAll = PyEmbeddedImage(
3230
+ "iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABHNCSVQICAgIfAhkiAAAAVVJ"
3231
+ "REFUOI2dk79Lw0Acxd8lAWfrIB2Ki4NNEekWiov/QKDdFCcXF0Ey6SwIyRSCbi5ubpreP+BS"
3232
+ "O7g4mXboYIYKLiKBtrS0fh3SxF6SavUDx/1+9+5xxzwXhCmjHgSGM/3xMKy3j2UmLPJcEPkG"
3233
+ "cc4pSX9M9NonMk2TiIgeLkCcc2KSjLh4LqhYNtB6smPRPzmJHPzXiYIE6586WvVsJzs54PHq"
3234
+ "FMoSsOLraDggKSkAAMWygY7EsbVHQtk8IBT2CffvJipHYfaZAlkMJsDHCHjpAUEQoHnJFheY"
3235
+ "3RxR0Y2fBTzPEzbPIxVixMnuGyzLivtBEMTt88MBAMBvA0qpJrOGY9NyIVvkNxQgfBTPtxNK"
3236
+ "Tlo3q8Lp3W43nrs+ywGYyaBUk1mT20iiqio0TUO1Ws10IISY+ihT8vn83CswJsmpwYbzfR2/"
3237
+ "DaxthPXCAgBQd+9SmWTxBXqU0GLLIFPzAAAAAElFTkSuQmCC")
3238
+
3239
+ Print = PyEmbeddedImage(
3240
+ "iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABHNCSVQICAgIfAhkiAAAAadJ"
3241
+ "REFUOI2lUz1Lw1AUPe+1IA72F7gkWBCngrQKXQVBB+tkJf4Cl4LgoIOjiLVF/QdqC3HqBxgo"
3242
+ "ODo1FqJI8YtOEgl06YvdWp5DfGmT1A/wwOHmvtx73rnJe4TQEP6DsHg4bfa4afc9L/utB0+e"
3243
+ "XZ8lAQVCQyA0hB29x/14sh1emZwf5o55tVrlol6QCqGDuTGyeztw8PzhxFfbiePLGaiqikq5"
3244
+ "xIcN0OHEb/kvCAPAxfkZB4D7r53Fri02KDTtPppvQQF6cX7GFUWBoiju4tSEE+VIsME/BgWA"
3245
+ "YrHoFrzaDlvMoWn3Mfx38vm8R4QUCgUei8Wg1a6xvZWBZVkjZ2232558Y3MfdzeXJGxabcQA"
3246
+ "LC0uIJs/wXRUHinAGEMkEgFjzofpvuuolEucTkdlaLVrAIDRqCORSECW5QAlScLjSwuapkGS"
3247
+ "JFc4vJJaJevpNW406gGrnU7H4yI5H0dyPu5Zc49yOp0GYwyGYXgKTMs7ux+E0BAq5RJXVRXN"
3248
+ "N2Bm8sd6AICu68jlclhJrRIibmOlXOJ7Ryq67/qvAqLZdSDgP+ffQTQDwCfjgskYZ5COXQAA"
3249
+ "AABJRU5ErkJggg==")
3250
+
3251
+ PrintPreview = PyEmbeddedImage(
3252
+ "iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABHNCSVQICAgIfAhkiAAAAW1J"
3253
+ "REFUOI2Nkr1LAmEcxz93GoVFBDU4OFhIYdEUIUFCDS69B20tQnkuTf4DTgUO7fkSNAQ1BBXc"
3254
+ "2iY0tURDSoqBRQkugpE42PBwT3feGX3h4Xf3Oz7f38tzyt1DuUOXHotV+ZzYXVa6v5ulAvim"
3255
+ "xi1nZT0MQHApzMHhpa2AzaCXhvtgNbrzp4nbKVn/FvEieyVztzfXnc2tbds4NgMDDkXCBNtQ"
3256
+ "a8F5MkVkZtp5hObbk4SM2GiLU2v1atxkUGqOWGBDBpw/iuPvL6PrOrH9PdsuLCM02nYYLW0B"
3257
+ "YtDJ5k7lLlRzy05weg6ifpELeAAtbelELVc+JWjAH1+/Fe/rkK/B4hh4PSKCuBXZgXlZZhjg"
3258
+ "rCLAwBCExkQ0y/IjdcOybWB0ACYHRTTLXXguUUim7CQT+DNxXrQ0Xo+4pSJwnIijkeGdNQAU"
3259
+ "RXXJeZyk67rlfbaaAWDBB/M5l6IoqqsXK9Vd4PVkQ5r8y8DJ0DD5ATHJh/O00XSvAAAAAElF"
3260
+ "TkSuQmCC")
3261
+
3262
+ Cut = PyEmbeddedImage(
3263
+ "iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABHNCSVQICAgIfAhkiAAAAUhJ"
3264
+ "REFUOI2Fkk9LAlEUxX+jBX0bocCdtKpmNpNhEONeg2zfxqUbSUG0oJxN5SKEGP8QOLvwk7R2"
3265
+ "FWiprxavhbxhdF7Tgbc599zzznv3YiSShE+n05GbXPjU67W1egINnh4fpI5vNRsSYNDvBXWt"
3266
+ "QS6Xw3Xv10xazYa07WxEqzXQQQjBbDZlPl/EG4hvAUDeyQeRa9dVaZqW1nhrkygUzg1AHh4c"
3267
+ "RcSe55FKpTjOnhh/GgAsF6uYtp1FCCFN04pEVzCMRFJbULFVo++PIrdDzCfuvXfxPC9ozkyG"
3268
+ "Wp32CW8XuzJtOTB6xvchMxmSthzG3auINnaMacsJmhXCS6Q1ULcXbysALKafABRvK+yfFVi6"
3269
+ "l/EJVEMc/l1lgHapzLjrMvv44vWuQbtU1uoiYxz0e3L7ZfVZP6fVgFfRdwo3a6PU7oGKGBbq"
3270
+ "OIBfXKKLiCHSUwgAAAAASUVORK5CYII=")
3271
+
3272
+ Undo = PyEmbeddedImage(
3273
+ "iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABHNCSVQICAgIfAhkiAAAAadJ"
3274
+ "REFUOI2lkL9LW1EYhp9zI41/QnXI1snBoYPQFqFDQCqYxKIS2o41m4MEB0FwaBcpFt3UwaFa"
3275
+ "G8UmOaZQuneom5ugU7Dij1wlMV6N3vo5hHPx6qUGPHCGw/me57zvUcoK8ZDVdN9AuhCVcs0B"
3276
+ "YO71b9WwIF2ICkDXs14ALq/O2J0+EIAfQ1ueSAVVSBeichOsnV9QcY8BKDk23xbXWP+4rwIF"
3277
+ "BjagKzXmswsc7lcAeNHzFICvk7/Yy7jqTgXT17ya0d8ZjExApH6fmuyjs6cNgHwuKz7B+9Xn"
3278
+ "MvDyLVWn7INj8YTXOZ/LSmqpL/gTy+dVLq/OcKUGUI8d8SeMxRMqn8uKJ+hfbBeA5Tcb6tSu"
3279
+ "x3f+OZQc24MeDzQJwF7GVUZi7qxT22H41Qjd00/EdDeruG2TWvJ3vv1nSmsts8URxt6NU5WK"
3280
+ "17/k2Oyc7HKyU2Zt+Q8zyRXfy16CWDyhBiMTDH0aBiDc/Mg38D+4HsEKoawQWmvpGGuVn0dT"
3281
+ "8qU4Kp83U9KSDIvWWsxM0PYdtNbSkgzL6t8PDcF3BDcljcCBAiNpBFZWiGuCvt7CsLLqpwAA"
3282
+ "AABJRU5ErkJggg==")
3283
+
3284
+ Redo = PyEmbeddedImage(
3285
+ "iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABHNCSVQICAgIfAhkiAAAAYhJ"
3286
+ "REFUOI2lksFLAkEUxr9RCbwUdEr7DzIIukTdOuUh0q0kL4JGUAaZhwShg0QQC4XUqYwgKII8"
3287
+ "rc6p/8Bb0im8dQmy0KW1lBR6HWSHXRtCaODB8N77fjPvm2HM4cR/lkuW3Nb8ZO5PlDvWN8AU"
3288
+ "RmfXRa5+pVPj00Ah/igFMXOEbc1PViEANL8NAIDeruJCu5RCXAAQuZoS4ixXRXFjflPs15QY"
3289
+ "qq9ZKmVebBCH9bQsV7E8mBZxmFeht6sAgEanDgAoFjSyAsAcTii5cVJy48Q5J+Zwwhoz+6N0"
3290
+ "+7xL509bpFbC5EsO2/pcABDzHAAAAkFFapTRMVD/epOVuoBe4fTeCAFAKfPC3mstIa41dejP"
3291
+ "LQCAZ2mAbB70rsRqFGOJITFvramL2sb1ChZ2JrsWyH5isaCR+hBHNLJoO73R/hA9/OgeZ5G8"
3292
+ "/AaBoMLSE6c4Ob6R3s4UB4IKQ6/r1uCcky85TGolTKnyHKXKc+QNuW2v8CfAhHhDblIr4V/i"
3293
+ "vgBWiOyf9AUwIbL8D+DEtq2XUuV6AAAAAElFTkSuQmCC")
3294
+
3295
+ Blank = PyEmbeddedImage(
3296
+ "iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABHNCSVQICAgIfAhkiAAAAF1J"
3297
+ "REFUOI3tkzEOwDAIA22S//84cYe2QxGJqFg61BMDOhsBpDVU1O9Cc2jXSGvcAgBAihkkoTkU"
3298
+ "QSyV84JHKdMA8jT3kB52B+4e9DrBSj/gC4DHHfgdZ8TqN5ZHOACokRkohSNQfwAAAABJRU5E"
3299
+ "rkJggg==")
3300
+