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.
- wx/__init__.py +22 -0
- wx/__version__.py +9 -0
- wx/_adv.cp313-win_amd64.pyd +0 -0
- wx/_aui.cp313-win_amd64.pyd +0 -0
- wx/_core.cp313-win_amd64.pyd +0 -0
- wx/_dataview.cp313-win_amd64.pyd +0 -0
- wx/_glcanvas.cp313-win_amd64.pyd +0 -0
- wx/_grid.cp313-win_amd64.pyd +0 -0
- wx/_html.cp313-win_amd64.pyd +0 -0
- wx/_html2.cp313-win_amd64.pyd +0 -0
- wx/_media.cp313-win_amd64.pyd +0 -0
- wx/_msw.cp313-win_amd64.pyd +0 -0
- wx/_propgrid.cp313-win_amd64.pyd +0 -0
- wx/_ribbon.cp313-win_amd64.pyd +0 -0
- wx/_richtext.cp313-win_amd64.pyd +0 -0
- wx/_stc.cp313-win_amd64.pyd +0 -0
- wx/_xml.cp313-win_amd64.pyd +0 -0
- wx/_xrc.cp313-win_amd64.pyd +0 -0
- wx/adv.py +124 -0
- wx/adv.pyi +5182 -0
- wx/aui.py +77 -0
- wx/aui.pyi +3655 -0
- wx/core.py +3540 -0
- wx/core.pyi +50592 -0
- wx/dataview.py +173 -0
- wx/dataview.pyi +3491 -0
- wx/demo/AUI_DockingWindowMgr.py +1154 -0
- wx/demo/AUI_MDI.py +117 -0
- wx/demo/AUI_Notebook.py +58 -0
- wx/demo/About.py +75 -0
- wx/demo/AboutBox.py +75 -0
- wx/demo/ActiveXWrapper_Acrobat.py +132 -0
- wx/demo/ActiveXWrapper_IE.py +187 -0
- wx/demo/ActiveX_FlashWindow.py +107 -0
- wx/demo/ActiveX_IEHtmlWindow.py +242 -0
- wx/demo/ActiveX_PDFWindow.py +204 -0
- wx/demo/ActivityIndicator.py +80 -0
- wx/demo/AddPrivateFont.py +116 -0
- wx/demo/AdjustChannels.py +178 -0
- wx/demo/AlphaDrawing.py +77 -0
- wx/demo/AnalogClock.py +144 -0
- wx/demo/AnimationCtrl.py +104 -0
- wx/demo/ArtProvider.py +893 -0
- wx/demo/BannerWindow.py +1 -0
- wx/demo/BitmapButton.py +87 -0
- wx/demo/BitmapComboBox.py +63 -0
- wx/demo/BitmapFromBuffer.py +140 -0
- wx/demo/Button.py +77 -0
- wx/demo/Cairo.py +197 -0
- wx/demo/Cairo_Snippets.py +135 -0
- wx/demo/Calendar.py +660 -0
- wx/demo/CalendarCtrl.py +122 -0
- wx/demo/CheckBox.py +74 -0
- wx/demo/CheckListBox.py +79 -0
- wx/demo/CheckListCtrl.py +99 -0
- wx/demo/Choice.py +55 -0
- wx/demo/Choicebook.py +80 -0
- wx/demo/CollapsibleHeaderCtrl.py +85 -0
- wx/demo/CollapsiblePane.py +126 -0
- wx/demo/ColorPanel.py +19 -0
- wx/demo/ColourDB.py +203 -0
- wx/demo/ColourDialog.py +76 -0
- wx/demo/ColourSelect.py +119 -0
- wx/demo/ComboBox.py +111 -0
- wx/demo/ComboCtrl.py +153 -0
- wx/demo/ComboTreeBox.py +71 -0
- wx/demo/CommandLinkButton.py +50 -0
- wx/demo/ContextHelp.py +112 -0
- wx/demo/Cursor.py +336 -0
- wx/demo/CustomDragAndDrop.py +353 -0
- wx/demo/DVC_CustomRenderer.py +204 -0
- wx/demo/DVC_DataViewModel.py +365 -0
- wx/demo/DVC_IndexListModel.py +257 -0
- wx/demo/DVC_ListCtrl.py +69 -0
- wx/demo/DVC_TreeCtrl.py +76 -0
- wx/demo/DatePickerCtrl.py +68 -0
- wx/demo/DelayedResult.py +239 -0
- wx/demo/Dialog.py +169 -0
- wx/demo/DialogUnits.py +128 -0
- wx/demo/DirDialog.py +58 -0
- wx/demo/DragAndDrop.py +265 -0
- wx/demo/DragImage.py +316 -0
- wx/demo/DragScroller.py +59 -0
- wx/demo/DrawXXXList.py +436 -0
- wx/demo/DynamicSashWindow.py +177 -0
- wx/demo/EditableListBox.py +101 -0
- wx/demo/Editor.py +70 -0
- wx/demo/EventManager.py +291 -0
- wx/demo/ExpandoTextCtrl.py +164 -0
- wx/demo/FancyText.py +83 -0
- wx/demo/FileBrowseButton.py +100 -0
- wx/demo/FileCtrl.py +97 -0
- wx/demo/FileDialog.py +144 -0
- wx/demo/FileHistory.py +140 -0
- wx/demo/FindReplaceDialog.py +123 -0
- wx/demo/FloatCanvas.py +1959 -0
- wx/demo/FontDialog.py +142 -0
- wx/demo/FontEnumerator.py +82 -0
- wx/demo/Frame.py +85 -0
- wx/demo/GLCanvas.py +371 -0
- wx/demo/Gauge.py +66 -0
- wx/demo/GenericButtons.py +185 -0
- wx/demo/GenericCheckBox.py +65 -0
- wx/demo/GenericDirCtrl.py +74 -0
- wx/demo/GetMouseState.py +159 -0
- wx/demo/GraphicsContext.py +236 -0
- wx/demo/GraphicsGradient.py +281 -0
- wx/demo/Grid.py +95 -0
- wx/demo/GridBagSizer.py +170 -0
- wx/demo/GridCustEditor.py +247 -0
- wx/demo/GridCustTable.py +170 -0
- wx/demo/GridDragAndDrop.py +102 -0
- wx/demo/GridDragable.py +206 -0
- wx/demo/GridEnterHandler.py +66 -0
- wx/demo/GridHugeTable.py +89 -0
- wx/demo/GridLabelRenderer.py +114 -0
- wx/demo/GridSimple.py +270 -0
- wx/demo/GridStdEdRend.py +186 -0
- wx/demo/Grid_MegaExample.py +490 -0
- wx/demo/HTML2_WebView.py +183 -0
- wx/demo/HtmlWindow.py +232 -0
- wx/demo/I18N.py +237 -0
- wx/demo/Image.py +338 -0
- wx/demo/ImageAlpha.py +87 -0
- wx/demo/ImageBrowser.py +70 -0
- wx/demo/ImageFromStream.py +49 -0
- wx/demo/Img2PyArtProvider.py +99 -0
- wx/demo/InfoBar.py +127 -0
- wx/demo/IntCtrl.py +343 -0
- wx/demo/ItemsPicker.py +108 -0
- wx/demo/Joystick.py +1083 -0
- wx/demo/KeyEvents.py +428 -0
- wx/demo/LEDNumberCtrl.py +121 -0
- wx/demo/LayoutAnchors.py +258 -0
- wx/demo/LayoutConstraints.py +149 -0
- wx/demo/Layoutf.py +69 -0
- wx/demo/ListBox.py +164 -0
- wx/demo/ListCtrl.py +538 -0
- wx/demo/ListCtrl_edit.py +155 -0
- wx/demo/ListCtrl_virtual.py +145 -0
- wx/demo/Listbook.py +104 -0
- wx/demo/MDIDemo.py +86 -0
- wx/demo/MDISashDemo.py +152 -0
- wx/demo/MDIWindows.py +66 -0
- wx/demo/Main.py +2768 -0
- wx/demo/Mask.py +137 -0
- wx/demo/MaskedEditControls.py +648 -0
- wx/demo/MaskedNumCtrl.py +359 -0
- wx/demo/MediaCtrl.py +190 -0
- wx/demo/Menu.py +322 -0
- wx/demo/MessageDialog.py +54 -0
- wx/demo/MimeTypesManager.py +354 -0
- wx/demo/MiniFrame.py +67 -0
- wx/demo/MouseGestures.py +198 -0
- wx/demo/MultiChoiceDialog.py +59 -0
- wx/demo/MultiSash.py +95 -0
- wx/demo/MultiSplitterWindow.py +168 -0
- wx/demo/MultipleChoiceDialog.py +101 -0
- wx/demo/Notebook.py +134 -0
- wx/demo/NotificationMessage.py +61 -0
- wx/demo/OGL.py +433 -0
- wx/demo/Overlay.py +209 -0
- wx/demo/OwnerDrawnComboBox.py +152 -0
- wx/demo/PDFViewer.py +109 -0
- wx/demo/PageSetupDialog.py +70 -0
- wx/demo/PenAndBrushStyles.py +208 -0
- wx/demo/Pickers.py +120 -0
- wx/demo/PlateButton.py +430 -0
- wx/demo/PopupControl.py +99 -0
- wx/demo/PopupMenu.py +156 -0
- wx/demo/PopupWindow.py +227 -0
- wx/demo/PrintDialog.py +60 -0
- wx/demo/PrintFramework.py +227 -0
- wx/demo/Process.py +168 -0
- wx/demo/ProgressDialog.py +87 -0
- wx/demo/PropertyGrid.py +1045 -0
- wx/demo/PropertySheetDialog.py +231 -0
- wx/demo/PseudoDC.py +350 -0
- wx/demo/PyColourChooser.py +60 -0
- wx/demo/PyCrust.py +21 -0
- wx/demo/PyPlot.py +83 -0
- wx/demo/PyShell.py +22 -0
- wx/demo/PythonEvents.py +109 -0
- wx/demo/README.txt +7 -0
- wx/demo/RadioBox.py +67 -0
- wx/demo/RadioButton.py +127 -0
- wx/demo/RawBitmapAccess.py +208 -0
- wx/demo/RearrangeDialog.py +160 -0
- wx/demo/RendererNative.py +170 -0
- wx/demo/ResizeWidget.py +76 -0
- wx/demo/RichMessageDialog.py +85 -0
- wx/demo/RichTextCtrl.py +732 -0
- wx/demo/RichToolTip.py +145 -0
- wx/demo/SVGImage_Bitmap.py +130 -0
- wx/demo/SVGImage_Render.py +138 -0
- wx/demo/SashWindow.py +151 -0
- wx/demo/ScrolledMessageDialog.py +52 -0
- wx/demo/ScrolledPanel.py +124 -0
- wx/demo/ScrolledWindow.py +260 -0
- wx/demo/SearchCtrl.py +115 -0
- wx/demo/ShapedWindow.py +145 -0
- wx/demo/Simplebook.py +202 -0
- wx/demo/SingleChoiceDialog.py +56 -0
- wx/demo/SizedControls.py +433 -0
- wx/demo/Sizers.py +609 -0
- wx/demo/Slider.py +52 -0
- wx/demo/Sound.py +95 -0
- wx/demo/SpinButton.py +63 -0
- wx/demo/SpinCtrl.py +56 -0
- wx/demo/SpinCtrlDouble.py +42 -0
- wx/demo/SplitTree.py +146 -0
- wx/demo/SplitterWindow.py +62 -0
- wx/demo/StandardPaths.py +113 -0
- wx/demo/StaticBitmap.py +55 -0
- wx/demo/StaticBox.py +62 -0
- wx/demo/StaticText.py +69 -0
- wx/demo/StatusBar.py +144 -0
- wx/demo/StockButtons.py +113 -0
- wx/demo/StyledTextCtrl_1.py +303 -0
- wx/demo/StyledTextCtrl_2.py +410 -0
- wx/demo/SystemSettings.py +333 -0
- wx/demo/TablePrint.py +215 -0
- wx/demo/TestTable.txt +38 -0
- wx/demo/TextCtrl.py +187 -0
- wx/demo/TextEntryDialog.py +57 -0
- wx/demo/Threads.py +258 -0
- wx/demo/Throbber.py +250 -0
- wx/demo/Ticker.py +147 -0
- wx/demo/TimeCtrl.py +240 -0
- wx/demo/TimePickerCtrl.py +60 -0
- wx/demo/Timer.py +275 -0
- wx/demo/ToggleButton.py +54 -0
- wx/demo/ToolBar.py +249 -0
- wx/demo/ToolTip.py +71 -0
- wx/demo/Toolbook.py +111 -0
- wx/demo/TreeCtrl.py +199 -0
- wx/demo/TreeListCtrl.py +121 -0
- wx/demo/TreeMixin.py +269 -0
- wx/demo/Treebook.py +117 -0
- wx/demo/UIActionSimulator.py +151 -0
- wx/demo/URLDragAndDrop.py +130 -0
- wx/demo/Unicode.py +146 -0
- wx/demo/VListBox.py +176 -0
- wx/demo/Validator.py +237 -0
- wx/demo/Wizard.py +248 -0
- wx/demo/WrapSizer.py +115 -0
- wx/demo/XmlResource.py +80 -0
- wx/demo/XmlResourceHandler.py +199 -0
- wx/demo/XmlResourceSubclass.py +119 -0
- wx/demo/__init__.py +9 -0
- wx/demo/agw/AGWInfoBar.py +175 -0
- wx/demo/agw/AUI.py +3058 -0
- wx/demo/agw/AdvancedSplash.py +59 -0
- wx/demo/agw/AquaButton.py +146 -0
- wx/demo/agw/BalloonTip.py +378 -0
- wx/demo/agw/ButtonPanel.py +890 -0
- wx/demo/agw/CubeColourDialog.py +83 -0
- wx/demo/agw/CustomTreeCtrl.py +2167 -0
- wx/demo/agw/Example1 +67 -0
- wx/demo/agw/Example2 +49 -0
- wx/demo/agw/FlatMenu.py +876 -0
- wx/demo/agw/FlatNotebook.py +994 -0
- wx/demo/agw/FloatSpin.py +475 -0
- wx/demo/agw/FoldPanelBar.py +953 -0
- wx/demo/agw/FourWaySplitter.py +300 -0
- wx/demo/agw/GenericMessageDialog.py +207 -0
- wx/demo/agw/GradientButton.py +156 -0
- wx/demo/agw/HyperLinkCtrl.py +144 -0
- wx/demo/agw/HyperTreeList.py +2660 -0
- wx/demo/agw/KnobCtrl.py +186 -0
- wx/demo/agw/LabelBook.py +567 -0
- wx/demo/agw/MacLargeDemo.py +360 -0
- wx/demo/agw/MultiDirDialog.py +117 -0
- wx/demo/agw/PeakMeter.py +194 -0
- wx/demo/agw/PersistentControls.py +589 -0
- wx/demo/agw/PieCtrl.py +206 -0
- wx/demo/agw/PyBusyInfo.py +64 -0
- wx/demo/agw/PyCollapsiblePane.py +308 -0
- wx/demo/agw/PyGauge.py +162 -0
- wx/demo/agw/PyProgress.py +155 -0
- wx/demo/agw/RibbonBar.py +925 -0
- wx/demo/agw/RulerCtrl.py +454 -0
- wx/demo/agw/ScrolledThumbnail.py +128 -0
- wx/demo/agw/ShapedButton.py +603 -0
- wx/demo/agw/ShortcutEditor.py +397 -0
- wx/demo/agw/SpeedMeter.py +668 -0
- wx/demo/agw/SuperToolTip.py +396 -0
- wx/demo/agw/ThumbDemoConfig.py +603 -0
- wx/demo/agw/ThumbnailCtrl.py +149 -0
- wx/demo/agw/ToasterBox.py +410 -0
- wx/demo/agw/UltimateListCtrl.py +80 -0
- wx/demo/agw/UltimateListIconDemo.py +908 -0
- wx/demo/agw/UltimateListListDemo.py +124 -0
- wx/demo/agw/UltimateReportDemo.py +1146 -0
- wx/demo/agw/UltimateVirtualDemo.py +207 -0
- wx/demo/agw/Windows7Explorer_Contents.py +368 -0
- wx/demo/agw/XLSGrid.py +238 -0
- wx/demo/agw/ZoomBar.py +230 -0
- wx/demo/agw/__demo__.py +183 -0
- wx/demo/agw/bitmaps/Explorer96.png +0 -0
- wx/demo/agw/bitmaps/Explorer96Flip40.png +0 -0
- wx/demo/agw/bitmaps/Folder96.png +0 -0
- wx/demo/agw/bitmaps/Folder96Flip40.png +0 -0
- wx/demo/agw/bitmaps/Monitor96.png +0 -0
- wx/demo/agw/bitmaps/Monitor96Flip40.png +0 -0
- wx/demo/agw/bitmaps/Music96.png +0 -0
- wx/demo/agw/bitmaps/Music96Flip40.png +0 -0
- wx/demo/agw/bitmaps/Photo96.png +0 -0
- wx/demo/agw/bitmaps/Photo96Flip40.png +0 -0
- wx/demo/agw/bitmaps/Search96.png +0 -0
- wx/demo/agw/bitmaps/Search96Flip40.png +0 -0
- wx/demo/agw/bitmaps/Wizard96.png +0 -0
- wx/demo/agw/bitmaps/Wizard96Flip40.png +0 -0
- wx/demo/agw/bitmaps/advancedsplash.png +0 -0
- wx/demo/agw/bitmaps/aquabutton.png +0 -0
- wx/demo/agw/bitmaps/aquachecked.ico +0 -0
- wx/demo/agw/bitmaps/aquaflagged.ico +0 -0
- wx/demo/agw/bitmaps/aquanotchecked.ico +0 -0
- wx/demo/agw/bitmaps/aquanotflagged.ico +0 -0
- wx/demo/agw/bitmaps/canada.gif +0 -0
- wx/demo/agw/bitmaps/checked.ico +0 -0
- wx/demo/agw/bitmaps/columns.png +0 -0
- wx/demo/agw/bitmaps/contexthelp-16.png +0 -0
- wx/demo/agw/bitmaps/contexthelp.png +0 -0
- wx/demo/agw/bitmaps/copy.png +0 -0
- wx/demo/agw/bitmaps/cut.png +0 -0
- wx/demo/agw/bitmaps/editcopy.png +0 -0
- wx/demo/agw/bitmaps/editcut.png +0 -0
- wx/demo/agw/bitmaps/editpaste.png +0 -0
- wx/demo/agw/bitmaps/empty_icon.png +0 -0
- wx/demo/agw/bitmaps/exit-16.png +0 -0
- wx/demo/agw/bitmaps/exit.ico +0 -0
- wx/demo/agw/bitmaps/ffwd.png +0 -0
- wx/demo/agw/bitmaps/ffwddisabled.png +0 -0
- wx/demo/agw/bitmaps/field-16.png +0 -0
- wx/demo/agw/bitmaps/filenew.png +0 -0
- wx/demo/agw/bitmaps/fileopen.png +0 -0
- wx/demo/agw/bitmaps/filesave.png +0 -0
- wx/demo/agw/bitmaps/flagged.ico +0 -0
- wx/demo/agw/bitmaps/folder.png +0 -0
- wx/demo/agw/bitmaps/folder_new.png +0 -0
- wx/demo/agw/bitmaps/ghost.png +0 -0
- wx/demo/agw/bitmaps/gradientbutton.png +0 -0
- wx/demo/agw/bitmaps/help-16.png +0 -0
- wx/demo/agw/bitmaps/help.ico +0 -0
- wx/demo/agw/bitmaps/italy.gif +0 -0
- wx/demo/agw/bitmaps/lbadd.png +0 -0
- wx/demo/agw/bitmaps/lbcharge.png +0 -0
- wx/demo/agw/bitmaps/lbdecrypted.png +0 -0
- wx/demo/agw/bitmaps/lbnews.png +0 -0
- wx/demo/agw/bitmaps/lbroll.png +0 -0
- wx/demo/agw/bitmaps/minus1.ico +0 -0
- wx/demo/agw/bitmaps/minus2.ico +0 -0
- wx/demo/agw/bitmaps/minus3.ico +0 -0
- wx/demo/agw/bitmaps/minus4.ico +0 -0
- wx/demo/agw/bitmaps/minus5.ico +0 -0
- wx/demo/agw/bitmaps/month-16.png +0 -0
- wx/demo/agw/bitmaps/new_file.png +0 -0
- wx/demo/agw/bitmaps/new_folder.png +0 -0
- wx/demo/agw/bitmaps/notchecked.ico +0 -0
- wx/demo/agw/bitmaps/notflagged.ico +0 -0
- wx/demo/agw/bitmaps/ok-16.png +0 -0
- wx/demo/agw/bitmaps/open_folder.png +0 -0
- wx/demo/agw/bitmaps/paste.png +0 -0
- wx/demo/agw/bitmaps/pause.png +0 -0
- wx/demo/agw/bitmaps/pausedisabled.png +0 -0
- wx/demo/agw/bitmaps/play.png +0 -0
- wx/demo/agw/bitmaps/playdisabled.png +0 -0
- wx/demo/agw/bitmaps/plus1.ico +0 -0
- wx/demo/agw/bitmaps/plus2.ico +0 -0
- wx/demo/agw/bitmaps/plus3.ico +0 -0
- wx/demo/agw/bitmaps/plus4.ico +0 -0
- wx/demo/agw/bitmaps/plus5.ico +0 -0
- wx/demo/agw/bitmaps/record.png +0 -0
- wx/demo/agw/bitmaps/recorddisabled.png +0 -0
- wx/demo/agw/bitmaps/recording.gif +0 -0
- wx/demo/agw/bitmaps/rewind.png +0 -0
- wx/demo/agw/bitmaps/rewinddisabled.png +0 -0
- wx/demo/agw/bitmaps/round.png +0 -0
- wx/demo/agw/bitmaps/save.png +0 -0
- wx/demo/agw/bitmaps/separator.gif +0 -0
- wx/demo/agw/bitmaps/separatorflip.png +0 -0
- wx/demo/agw/bitmaps/smfuel.ico +0 -0
- wx/demo/agw/bitmaps/smpi.ico +0 -0
- wx/demo/agw/bitmaps/smtemp.ico +0 -0
- wx/demo/agw/bitmaps/stop.png +0 -0
- wx/demo/agw/bitmaps/stopdisabled.png +0 -0
- wx/demo/agw/bitmaps/sttbutton.png +0 -0
- wx/demo/agw/bitmaps/sttfont.png +0 -0
- wx/demo/agw/bitmaps/sttheader.png +0 -0
- wx/demo/agw/bitmaps/stthelp.png +0 -0
- wx/demo/agw/bitmaps/view1.png +0 -0
- wx/demo/agw/bitmaps/view2.png +0 -0
- wx/demo/agw/bitmaps/view_choose.png +0 -0
- wx/demo/agw/bitmaps/view_detailed.png +0 -0
- wx/demo/agw/bitmaps/view_icon.png +0 -0
- wx/demo/agw/bitmaps/view_multicolumn.png +0 -0
- wx/demo/agw/bitmaps/viewmag-16.png +0 -0
- wx/demo/agw/bitmaps/viewmag-m-16.png +0 -0
- wx/demo/agw/bitmaps/viewmag-p-16.png +0 -0
- wx/demo/agw/bitmaps/viewmagfit-16.png +0 -0
- wx/demo/agw/data/Example_1.xls +0 -0
- wx/demo/agw/images.py +6714 -0
- wx/demo/bitmaps/AG00028_.gif +0 -0
- wx/demo/bitmaps/AG00039_.gif +0 -0
- wx/demo/bitmaps/AG00178_.gif +0 -0
- wx/demo/bitmaps/AG00183_.gif +0 -0
- wx/demo/bitmaps/AG00185_.gif +0 -0
- wx/demo/bitmaps/BD13656_.gif +0 -0
- wx/demo/bitmaps/advancedsplash.png +0 -0
- wx/demo/bitmaps/aquabutton.png +0 -0
- wx/demo/bitmaps/aquachecked.ico +0 -0
- wx/demo/bitmaps/aquaflagged.ico +0 -0
- wx/demo/bitmaps/aquanotchecked.ico +0 -0
- wx/demo/bitmaps/aquanotflagged.ico +0 -0
- wx/demo/bitmaps/canada.gif +0 -0
- wx/demo/bitmaps/checked.ico +0 -0
- wx/demo/bitmaps/columns.png +0 -0
- wx/demo/bitmaps/contexthelp-16.png +0 -0
- wx/demo/bitmaps/contexthelp.png +0 -0
- wx/demo/bitmaps/copy.png +0 -0
- wx/demo/bitmaps/cropshot24x20.png +0 -0
- wx/demo/bitmaps/cut.png +0 -0
- wx/demo/bitmaps/editcopy.png +0 -0
- wx/demo/bitmaps/editcut.png +0 -0
- wx/demo/bitmaps/editpaste.png +0 -0
- wx/demo/bitmaps/exit-16.png +0 -0
- wx/demo/bitmaps/exit.ico +0 -0
- wx/demo/bitmaps/ffwd.png +0 -0
- wx/demo/bitmaps/ffwddisabled.png +0 -0
- wx/demo/bitmaps/field-16.png +0 -0
- wx/demo/bitmaps/filenew.png +0 -0
- wx/demo/bitmaps/fileopen.png +0 -0
- wx/demo/bitmaps/filesave.png +0 -0
- wx/demo/bitmaps/flagged.ico +0 -0
- wx/demo/bitmaps/folder_new.png +0 -0
- wx/demo/bitmaps/ghost.png +0 -0
- wx/demo/bitmaps/gradientbutton.png +0 -0
- wx/demo/bitmaps/help-16.png +0 -0
- wx/demo/bitmaps/help.ico +0 -0
- wx/demo/bitmaps/honeycomb300.png +0 -0
- wx/demo/bitmaps/image.bmp +0 -0
- wx/demo/bitmaps/image.gif +0 -0
- wx/demo/bitmaps/image.ico +0 -0
- wx/demo/bitmaps/image.jpg +0 -0
- wx/demo/bitmaps/image.png +0 -0
- wx/demo/bitmaps/image.tif +0 -0
- wx/demo/bitmaps/italy.gif +0 -0
- wx/demo/bitmaps/lbadd.png +0 -0
- wx/demo/bitmaps/lbcharge.png +0 -0
- wx/demo/bitmaps/lbdecrypted.png +0 -0
- wx/demo/bitmaps/lbnews.png +0 -0
- wx/demo/bitmaps/lbroll.png +0 -0
- wx/demo/bitmaps/minus1.ico +0 -0
- wx/demo/bitmaps/minus2.ico +0 -0
- wx/demo/bitmaps/minus3.ico +0 -0
- wx/demo/bitmaps/minus4.ico +0 -0
- wx/demo/bitmaps/minus5.ico +0 -0
- wx/demo/bitmaps/month-16.png +0 -0
- wx/demo/bitmaps/new_file.png +0 -0
- wx/demo/bitmaps/new_folder.png +0 -0
- wx/demo/bitmaps/notchecked.ico +0 -0
- wx/demo/bitmaps/notflagged.ico +0 -0
- wx/demo/bitmaps/ok-16.png +0 -0
- wx/demo/bitmaps/open_folder.png +0 -0
- wx/demo/bitmaps/paste.png +0 -0
- wx/demo/bitmaps/pause.png +0 -0
- wx/demo/bitmaps/pausedisabled.png +0 -0
- wx/demo/bitmaps/phoenix_title.png +0 -0
- wx/demo/bitmaps/phoenix_top.png +0 -0
- wx/demo/bitmaps/play.png +0 -0
- wx/demo/bitmaps/playdisabled.png +0 -0
- wx/demo/bitmaps/plus1.ico +0 -0
- wx/demo/bitmaps/plus2.ico +0 -0
- wx/demo/bitmaps/plus3.ico +0 -0
- wx/demo/bitmaps/plus4.ico +0 -0
- wx/demo/bitmaps/plus5.ico +0 -0
- wx/demo/bitmaps/record.png +0 -0
- wx/demo/bitmaps/recorddisabled.png +0 -0
- wx/demo/bitmaps/rewind.png +0 -0
- wx/demo/bitmaps/rewinddisabled.png +0 -0
- wx/demo/bitmaps/round.png +0 -0
- wx/demo/bitmaps/save.png +0 -0
- wx/demo/bitmaps/smfuel.ico +0 -0
- wx/demo/bitmaps/smpi.ico +0 -0
- wx/demo/bitmaps/smtemp.ico +0 -0
- wx/demo/bitmaps/snakey_render.png +0 -0
- wx/demo/bitmaps/splash.png +0 -0
- wx/demo/bitmaps/stop.png +0 -0
- wx/demo/bitmaps/stopdisabled.png +0 -0
- wx/demo/bitmaps/sttbutton.png +0 -0
- wx/demo/bitmaps/sttfont.png +0 -0
- wx/demo/bitmaps/sttheader.png +0 -0
- wx/demo/bitmaps/stthelp.png +0 -0
- wx/demo/bitmaps/toucan.png +0 -0
- wx/demo/bitmaps/view1.png +0 -0
- wx/demo/bitmaps/view2.png +0 -0
- wx/demo/bitmaps/view_choose.png +0 -0
- wx/demo/bitmaps/view_detailed.png +0 -0
- wx/demo/bitmaps/view_icon.png +0 -0
- wx/demo/bitmaps/view_multicolumn.png +0 -0
- wx/demo/bitmaps/viewmag-16.png +0 -0
- wx/demo/bitmaps/viewmag-m-16.png +0 -0
- wx/demo/bitmaps/viewmag-p-16.png +0 -0
- wx/demo/bitmaps/viewmagfit-16.png +0 -0
- wx/demo/bmp_source/001.png +0 -0
- wx/demo/bmp_source/002.png +0 -0
- wx/demo/bmp_source/003.png +0 -0
- wx/demo/bmp_source/004.png +0 -0
- wx/demo/bmp_source/005.png +0 -0
- wx/demo/bmp_source/006.png +0 -0
- wx/demo/bmp_source/007.png +0 -0
- wx/demo/bmp_source/008.png +0 -0
- wx/demo/bmp_source/009.png +0 -0
- wx/demo/bmp_source/010.png +0 -0
- wx/demo/bmp_source/011.png +0 -0
- wx/demo/bmp_source/012.png +0 -0
- wx/demo/bmp_source/013.png +0 -0
- wx/demo/bmp_source/014.png +0 -0
- wx/demo/bmp_source/015.png +0 -0
- wx/demo/bmp_source/016.png +0 -0
- wx/demo/bmp_source/017.png +0 -0
- wx/demo/bmp_source/018.png +0 -0
- wx/demo/bmp_source/019.png +0 -0
- wx/demo/bmp_source/020.png +0 -0
- wx/demo/bmp_source/021.png +0 -0
- wx/demo/bmp_source/022.png +0 -0
- wx/demo/bmp_source/023.png +0 -0
- wx/demo/bmp_source/024.png +0 -0
- wx/demo/bmp_source/025.png +0 -0
- wx/demo/bmp_source/026.png +0 -0
- wx/demo/bmp_source/027.png +0 -0
- wx/demo/bmp_source/028.png +0 -0
- wx/demo/bmp_source/029.png +0 -0
- wx/demo/bmp_source/030.png +0 -0
- wx/demo/bmp_source/DbDec.bmp +0 -0
- wx/demo/bmp_source/DbInc.bmp +0 -0
- wx/demo/bmp_source/Dec.bmp +0 -0
- wx/demo/bmp_source/FRM_0.png +0 -0
- wx/demo/bmp_source/FRM_1.png +0 -0
- wx/demo/bmp_source/FRM_2.png +0 -0
- wx/demo/bmp_source/FRM_3.png +0 -0
- wx/demo/bmp_source/FRM_4.png +0 -0
- wx/demo/bmp_source/FRM_5.png +0 -0
- wx/demo/bmp_source/FRM_6.png +0 -0
- wx/demo/bmp_source/FRM_7.png +0 -0
- wx/demo/bmp_source/FRM_8.png +0 -0
- wx/demo/bmp_source/GridBG.gif +0 -0
- wx/demo/bmp_source/Inc.bmp +0 -0
- wx/demo/bmp_source/LB01.png +0 -0
- wx/demo/bmp_source/LB02.png +0 -0
- wx/demo/bmp_source/LB03.png +0 -0
- wx/demo/bmp_source/LB04.png +0 -0
- wx/demo/bmp_source/LB05.png +0 -0
- wx/demo/bmp_source/LB06.png +0 -0
- wx/demo/bmp_source/LB07.png +0 -0
- wx/demo/bmp_source/LB08.png +0 -0
- wx/demo/bmp_source/LB09.png +0 -0
- wx/demo/bmp_source/LB10.png +0 -0
- wx/demo/bmp_source/LB11.png +0 -0
- wx/demo/bmp_source/LB12.png +0 -0
- wx/demo/bmp_source/Pt.bmp +0 -0
- wx/demo/bmp_source/Vippi.png +0 -0
- wx/demo/bmp_source/backgrnd.png +0 -0
- wx/demo/bmp_source/book.png +0 -0
- wx/demo/bmp_source/book_blue.png +0 -0
- wx/demo/bmp_source/book_green.png +0 -0
- wx/demo/bmp_source/book_red.png +0 -0
- wx/demo/bmp_source/bp_btn1.png +0 -0
- wx/demo/bmp_source/bp_btn2.png +0 -0
- wx/demo/bmp_source/bp_btn3.png +0 -0
- wx/demo/bmp_source/bp_btn4.png +0 -0
- wx/demo/bmp_source/bulb1.bmp +0 -0
- wx/demo/bmp_source/bulb2.bmp +0 -0
- wx/demo/bmp_source/carrot.png +0 -0
- wx/demo/bmp_source/clipboard.png +0 -0
- wx/demo/bmp_source/code.png +0 -0
- wx/demo/bmp_source/core.png +0 -0
- wx/demo/bmp_source/custom.png +0 -0
- wx/demo/bmp_source/customcontrol.png +0 -0
- wx/demo/bmp_source/deletedocs.png +0 -0
- wx/demo/bmp_source/deleteperspective.png +0 -0
- wx/demo/bmp_source/demo.png +0 -0
- wx/demo/bmp_source/dialog.png +0 -0
- wx/demo/bmp_source/exit.png +0 -0
- wx/demo/bmp_source/expansion.png +0 -0
- wx/demo/bmp_source/find.png +0 -0
- wx/demo/bmp_source/findnext.png +0 -0
- wx/demo/bmp_source/floatcanvas.png +0 -0
- wx/demo/bmp_source/frame.png +0 -0
- wx/demo/bmp_source/images.png +0 -0
- wx/demo/bmp_source/inspect.png +0 -0
- wx/demo/bmp_source/layout.png +0 -0
- wx/demo/bmp_source/logo.png +0 -0
- wx/demo/bmp_source/miscellaneous.png +0 -0
- wx/demo/bmp_source/modifiedexists.png +0 -0
- wx/demo/bmp_source/mondrian.ico +0 -0
- wx/demo/bmp_source/morecontrols.png +0 -0
- wx/demo/bmp_source/moredialog.png +0 -0
- wx/demo/bmp_source/noicon.png +0 -0
- wx/demo/bmp_source/overview.png +0 -0
- wx/demo/bmp_source/pencil.png +0 -0
- wx/demo/bmp_source/pointy.png +0 -0
- wx/demo/bmp_source/process.png +0 -0
- wx/demo/bmp_source/pyshell.png +0 -0
- wx/demo/bmp_source/recent.png +0 -0
- wx/demo/bmp_source/rest.png +0 -0
- wx/demo/bmp_source/robin.jpg +0 -0
- wx/demo/bmp_source/rt_alignleft.xpm +24 -0
- wx/demo/bmp_source/rt_alignright.xpm +24 -0
- wx/demo/bmp_source/rt_bold.xpm +24 -0
- wx/demo/bmp_source/rt_centre.xpm +24 -0
- wx/demo/bmp_source/rt_colour.xpm +59 -0
- wx/demo/bmp_source/rt_copy.xpm +44 -0
- wx/demo/bmp_source/rt_cut.xpm +46 -0
- wx/demo/bmp_source/rt_font.xpm +25 -0
- wx/demo/bmp_source/rt_idea.xpm +47 -0
- wx/demo/bmp_source/rt_indentless.xpm +25 -0
- wx/demo/bmp_source/rt_indentmore.xpm +25 -0
- wx/demo/bmp_source/rt_italic.xpm +25 -0
- wx/demo/bmp_source/rt_open.xpm +57 -0
- wx/demo/bmp_source/rt_paste.xpm +46 -0
- wx/demo/bmp_source/rt_redo.xpm +58 -0
- wx/demo/bmp_source/rt_sample.xpm +44 -0
- wx/demo/bmp_source/rt_save.xpm +42 -0
- wx/demo/bmp_source/rt_smiley.xpm +42 -0
- wx/demo/bmp_source/rt_underline.xpm +25 -0
- wx/demo/bmp_source/rt_undo.xpm +58 -0
- wx/demo/bmp_source/rt_zebra.xpm +409 -0
- wx/demo/bmp_source/saveperspective.png +0 -0
- wx/demo/bmp_source/sm_down.bmp +0 -0
- wx/demo/bmp_source/sm_up.bmp +0 -0
- wx/demo/bmp_source/smiles2.bmp +0 -0
- wx/demo/bmp_source/test2.bmp +0 -0
- wx/demo/bmp_source/testmask.bmp +0 -0
- wx/demo/bmp_source/teststar.png +0 -0
- wx/demo/bmp_source/thekid.png +0 -0
- wx/demo/bmp_source/tog1.bmp +0 -0
- wx/demo/bmp_source/tog2.bmp +0 -0
- wx/demo/bmp_source/wiztest1.bmp +0 -0
- wx/demo/bmp_source/wiztest2.bmp +0 -0
- wx/demo/bmp_source/wxpdemo.ico +0 -0
- wx/demo/cursors/paperairplane_arrow_blue.cur +0 -0
- wx/demo/cursors/paperairplane_arrow_blue_fadeout80.cur +0 -0
- wx/demo/cursors/paperairplane_arrow_colorshift.ani +0 -0
- wx/demo/cursors/paperairplane_arrow_dark.cur +0 -0
- wx/demo/cursors/paperairplane_arrow_grey.cur +0 -0
- wx/demo/cursors/paperairplane_arrow_red.cur +0 -0
- wx/demo/cursors/paperairplane_arrow_white.cur +0 -0
- wx/demo/cursors/paperairplane_arrow_white24.png +0 -0
- wx/demo/data/0-tiger.svg +725 -0
- wx/demo/data/Asteroid_blaster.swf +0 -0
- wx/demo/data/SIL_OPEN_FONT_LICENSE.txt +97 -0
- wx/demo/data/SourceCodePro-Regular.ttf +0 -0
- wx/demo/data/accessories-calculator.svg +636 -0
- wx/demo/data/accessories-text-editor.svg +554 -0
- wx/demo/data/anykey.wav +0 -0
- wx/demo/data/applications-internet.svg +623 -0
- wx/demo/data/desktop-accessibility.svg +245 -0
- wx/demo/data/desktop-keyboard-shortcuts.svg +839 -0
- wx/demo/data/desktop-locale.svg +878 -0
- wx/demo/data/desktop-remote-desktop.svg +1479 -0
- wx/demo/data/desktop-theme.svg +882 -0
- wx/demo/data/desktop-wallpaper.svg +747 -0
- wx/demo/data/echo.py +25 -0
- wx/demo/data/imagemap.htm +20 -0
- wx/demo/data/imagemap.png +0 -0
- wx/demo/data/internet-group-chat.svg +312 -0
- wx/demo/data/internet-mail.svg +440 -0
- wx/demo/data/locale/af/LC_MESSAGES/wxpydemo.mo +0 -0
- wx/demo/data/locale/de/LC_MESSAGES/wxpydemo.mo +0 -0
- wx/demo/data/locale/es/LC_MESSAGES/wxpydemo.mo +0 -0
- wx/demo/data/locale/fr/LC_MESSAGES/wxpydemo.mo +0 -0
- wx/demo/data/locale/it/LC_MESSAGES/wxpydemo.mo +0 -0
- wx/demo/data/locale-src/af.po +23 -0
- wx/demo/data/locale-src/de.po +23 -0
- wx/demo/data/locale-src/es.po +22 -0
- wx/demo/data/locale-src/fr.po +22 -0
- wx/demo/data/locale-src/install +15 -0
- wx/demo/data/locale-src/it.po +23 -0
- wx/demo/data/locale-src/wxpydemo.po +21 -0
- wx/demo/data/office-calendar.svg +316 -0
- wx/demo/data/pic.png +0 -0
- wx/demo/data/pic2.bmp +0 -0
- wx/demo/data/plan.wav +0 -0
- wx/demo/data/proclamation.txt +115 -0
- wx/demo/data/resource.wdr +0 -0
- wx/demo/data/resource_wdr.xrc +146 -0
- wx/demo/data/romedalen.png +0 -0
- wx/demo/data/stc.h.html +3544 -0
- wx/demo/data/system-session.svg +510 -0
- wx/demo/data/system-users.svg +539 -0
- wx/demo/data/tables.htm +116 -0
- wx/demo/data/test-gradient-pen.svg +14 -0
- wx/demo/data/test-opacity.svg +7 -0
- wx/demo/data/test.htm +253 -0
- wx/demo/data/testmovie.mpg +0 -0
- wx/demo/data/testtable.txt +38 -0
- wx/demo/data/tips.txt +73 -0
- wx/demo/data/utilities-system-monitor.svg +435 -0
- wx/demo/data/utilities-terminal.svg +500 -0
- wx/demo/data/widgetTest.htm +70 -0
- wx/demo/data/world.dat +24055 -0
- wx/demo/demo.py +4 -0
- wx/demo/demo.pyw +4 -0
- wx/demo/demodata.py +310 -0
- wx/demo/encode_bitmaps.py +181 -0
- wx/demo/images.py +6812 -0
- wx/demo/infoframe.py +149 -0
- wx/demo/run.py +171 -0
- wx/demo/snippets/__init__.py +13 -0
- wx/demo/snippets/arc.py +21 -0
- wx/demo/snippets/arc_negative.py +21 -0
- wx/demo/snippets/clip.py +13 -0
- wx/demo/snippets/clip_image.py +13 -0
- wx/demo/snippets/curve_rectangle.py +53 -0
- wx/demo/snippets/curve_to.py +17 -0
- wx/demo/snippets/dash.py +18 -0
- wx/demo/snippets/ellipse.py +33 -0
- wx/demo/snippets/fill_and_stroke.py +12 -0
- wx/demo/snippets/fill_and_stroke2.py +18 -0
- wx/demo/snippets/fill_style.py +31 -0
- wx/demo/snippets/glyph_path.py +21 -0
- wx/demo/snippets/gradient.py +16 -0
- wx/demo/snippets/gradient_mask.py +12 -0
- wx/demo/snippets/group.py +16 -0
- wx/demo/snippets/image.py +14 -0
- wx/demo/snippets/imagepattern.py +23 -0
- wx/demo/snippets/path.py +7 -0
- wx/demo/snippets/set_line_cap.py +19 -0
- wx/demo/snippets/set_line_join.py +21 -0
- wx/demo/snippets/show_glyphs.py +15 -0
- wx/demo/snippets/text.py +22 -0
- wx/demo/snippets/text_align_center.py +26 -0
- wx/demo/snippets/text_extents.py +27 -0
- wx/demo/template.py +36 -0
- wx/demo/throbImages.py +1277 -0
- wx/demo/version.py +3 -0
- wx/demo/widgetTest.py +72 -0
- wx/demo/wxpdemo.ico +0 -0
- wx/glcanvas.py +10 -0
- wx/glcanvas.pyi +458 -0
- wx/grid.py +229 -0
- wx/grid.pyi +4959 -0
- wx/html.py +35 -0
- wx/html.pyi +2965 -0
- wx/html2.py +40 -0
- wx/html2.pyi +772 -0
- wx/lib/CDate.py +202 -0
- wx/lib/ClickableHtmlWindow.py +57 -0
- wx/lib/__init__.py +0 -0
- wx/lib/activex.py +178 -0
- wx/lib/activexwrapper.py +153 -0
- wx/lib/agw/__init__.py +128 -0
- wx/lib/agw/advancedsplash.py +564 -0
- wx/lib/agw/aquabutton.py +1127 -0
- wx/lib/agw/artmanager.py +2110 -0
- wx/lib/agw/aui/__init__.py +295 -0
- wx/lib/agw/aui/aui_constants.py +2628 -0
- wx/lib/agw/aui/aui_switcherdialog.py +1227 -0
- wx/lib/agw/aui/aui_utilities.py +672 -0
- wx/lib/agw/aui/auibar.py +4031 -0
- wx/lib/agw/aui/auibook.py +6289 -0
- wx/lib/agw/aui/dockart.py +1198 -0
- wx/lib/agw/aui/framemanager.py +10409 -0
- wx/lib/agw/aui/tabart.py +2771 -0
- wx/lib/agw/aui/tabmdi.py +679 -0
- wx/lib/agw/balloontip.py +1158 -0
- wx/lib/agw/buttonpanel.py +2823 -0
- wx/lib/agw/cubecolourdialog.py +3529 -0
- wx/lib/agw/customtreectrl.py +8963 -0
- wx/lib/agw/data/ShortcutEditor_1.png +0 -0
- wx/lib/agw/data/ShortcutEditor_1_thumb.png +0 -0
- wx/lib/agw/data/ShortcutEditor_2.png +0 -0
- wx/lib/agw/data/ShortcutEditor_2_thumb.png +0 -0
- wx/lib/agw/data/ShortcutEditor_3.png +0 -0
- wx/lib/agw/data/ShortcutEditor_3_thumb.png +0 -0
- wx/lib/agw/data/ShortcutEditor_4.png +0 -0
- wx/lib/agw/data/ShortcutEditor_4_thumb.png +0 -0
- wx/lib/agw/data/default_help_text.html +105 -0
- wx/lib/agw/flatmenu.py +7333 -0
- wx/lib/agw/flatnotebook.py +6672 -0
- wx/lib/agw/floatspin.py +1823 -0
- wx/lib/agw/fmcustomizedlg.py +540 -0
- wx/lib/agw/fmresources.py +407 -0
- wx/lib/agw/foldpanelbar.py +2282 -0
- wx/lib/agw/fourwaysplitter.py +1130 -0
- wx/lib/agw/genericmessagedialog.py +1549 -0
- wx/lib/agw/gradientbutton.py +732 -0
- wx/lib/agw/hyperlink.py +664 -0
- wx/lib/agw/hypertreelist.py +5374 -0
- wx/lib/agw/infobar.py +885 -0
- wx/lib/agw/knobctrl.py +945 -0
- wx/lib/agw/labelbook.py +3029 -0
- wx/lib/agw/multidirdialog.py +615 -0
- wx/lib/agw/peakmeter.py +1029 -0
- wx/lib/agw/persist/__init__.py +188 -0
- wx/lib/agw/persist/persist_constants.py +284 -0
- wx/lib/agw/persist/persist_handlers.py +2614 -0
- wx/lib/agw/persist/persistencemanager.py +864 -0
- wx/lib/agw/piectrl.py +1082 -0
- wx/lib/agw/pybusyinfo.py +399 -0
- wx/lib/agw/pycollapsiblepane.py +940 -0
- wx/lib/agw/pygauge.py +570 -0
- wx/lib/agw/pyprogress.py +917 -0
- wx/lib/agw/ribbon/__init__.py +198 -0
- wx/lib/agw/ribbon/art.py +219 -0
- wx/lib/agw/ribbon/art_aui.py +1284 -0
- wx/lib/agw/ribbon/art_default.py +81 -0
- wx/lib/agw/ribbon/art_internal.py +244 -0
- wx/lib/agw/ribbon/art_msw.py +2736 -0
- wx/lib/agw/ribbon/art_osx.py +52 -0
- wx/lib/agw/ribbon/bar.py +1261 -0
- wx/lib/agw/ribbon/buttonbar.py +1320 -0
- wx/lib/agw/ribbon/control.py +205 -0
- wx/lib/agw/ribbon/gallery.py +974 -0
- wx/lib/agw/ribbon/page.py +946 -0
- wx/lib/agw/ribbon/panel.py +1170 -0
- wx/lib/agw/ribbon/toolbar.py +1442 -0
- wx/lib/agw/rulerctrl.py +1887 -0
- wx/lib/agw/scrolledthumbnail.py +2119 -0
- wx/lib/agw/shapedbutton.py +1809 -0
- wx/lib/agw/shortcuteditor.py +2634 -0
- wx/lib/agw/speedmeter.py +1801 -0
- wx/lib/agw/supertooltip.py +1444 -0
- wx/lib/agw/thumbnailctrl.py +529 -0
- wx/lib/agw/toasterbox.py +1327 -0
- wx/lib/agw/ultimatelistctrl.py +13666 -0
- wx/lib/agw/xlsgrid.py +2113 -0
- wx/lib/agw/zoombar.py +1339 -0
- wx/lib/analogclock/__init__.py +140 -0
- wx/lib/analogclock/analogclock.py +631 -0
- wx/lib/analogclock/helpers.py +991 -0
- wx/lib/analogclock/lib_setup/__init__.py +0 -0
- wx/lib/analogclock/lib_setup/buttontreectrlpanel.py +297 -0
- wx/lib/analogclock/lib_setup/fontselect.py +57 -0
- wx/lib/analogclock/setup.py +490 -0
- wx/lib/analogclock/styles.py +47 -0
- wx/lib/anchors.py +103 -0
- wx/lib/art/__init__.py +4 -0
- wx/lib/art/flagart.py +1583 -0
- wx/lib/art/img2pyartprov.py +56 -0
- wx/lib/busy.py +146 -0
- wx/lib/buttons.py +1141 -0
- wx/lib/calendar.py +1597 -0
- wx/lib/checkbox.py +837 -0
- wx/lib/colourchooser/__init__.py +38 -0
- wx/lib/colourchooser/canvas.py +145 -0
- wx/lib/colourchooser/intl.py +24 -0
- wx/lib/colourchooser/pycolourbox.py +89 -0
- wx/lib/colourchooser/pycolourchooser.py +629 -0
- wx/lib/colourchooser/pycolourslider.py +100 -0
- wx/lib/colourchooser/pypalette.py +211 -0
- wx/lib/colourdb.py +740 -0
- wx/lib/colourselect.py +385 -0
- wx/lib/colourutils.py +118 -0
- wx/lib/combotreebox.py +944 -0
- wx/lib/delayedresult.py +420 -0
- wx/lib/dialogs.py +510 -0
- wx/lib/docview.py +3210 -0
- wx/lib/dragscroller.py +79 -0
- wx/lib/editor/README.txt +77 -0
- wx/lib/editor/__init__.py +24 -0
- wx/lib/editor/editor.py +974 -0
- wx/lib/editor/images.py +15 -0
- wx/lib/editor/selection.py +44 -0
- wx/lib/embeddedimage.py +76 -0
- wx/lib/eventStack.py +136 -0
- wx/lib/eventwatcher.py +440 -0
- wx/lib/evtmgr.py +521 -0
- wx/lib/expando.py +393 -0
- wx/lib/fancytext.py +505 -0
- wx/lib/filebrowsebutton.py +459 -0
- wx/lib/flashwin.py +262 -0
- wx/lib/flashwin_old.py +651 -0
- wx/lib/floatcanvas/FCEvents.py +53 -0
- wx/lib/floatcanvas/FCObjects.py +2923 -0
- wx/lib/floatcanvas/FloatCanvas.py +1027 -0
- wx/lib/floatcanvas/GUIMode.py +396 -0
- wx/lib/floatcanvas/NavCanvas.py +161 -0
- wx/lib/floatcanvas/Resources.py +319 -0
- wx/lib/floatcanvas/ScreenShot.py +1788 -0
- wx/lib/floatcanvas/Utilities/BBox.py +314 -0
- wx/lib/floatcanvas/Utilities/Colors.py +137 -0
- wx/lib/floatcanvas/Utilities/GUI.py +91 -0
- wx/lib/floatcanvas/Utilities/__init__.py +7 -0
- wx/lib/floatcanvas/__init__.py +124 -0
- wx/lib/foldmenu.py +89 -0
- wx/lib/gestures.py +310 -0
- wx/lib/gizmos/__init__.py +18 -0
- wx/lib/gizmos/dynamicsash.py +1202 -0
- wx/lib/gizmos/ledctrl.py +300 -0
- wx/lib/gizmos/treelistctrl.py +87 -0
- wx/lib/graphics.py +1939 -0
- wx/lib/gridmovers.py +511 -0
- wx/lib/iewin.py +249 -0
- wx/lib/iewin_old.py +894 -0
- wx/lib/imagebrowser.py +856 -0
- wx/lib/imageutils.py +163 -0
- wx/lib/infoframe.py +490 -0
- wx/lib/inspection.py +1255 -0
- wx/lib/intctrl.py +1001 -0
- wx/lib/itemspicker.py +256 -0
- wx/lib/langlistctrl.py +480 -0
- wx/lib/layoutf.py +271 -0
- wx/lib/masked/__init__.py +27 -0
- wx/lib/masked/combobox.py +839 -0
- wx/lib/masked/ctrl.py +108 -0
- wx/lib/masked/ipaddrctrl.py +242 -0
- wx/lib/masked/maskededit.py +7279 -0
- wx/lib/masked/numctrl.py +2001 -0
- wx/lib/masked/textctrl.py +465 -0
- wx/lib/masked/timectrl.py +1466 -0
- wx/lib/mixins/__init__.py +17 -0
- wx/lib/mixins/grid.py +47 -0
- wx/lib/mixins/gridlabelrenderer.py +251 -0
- wx/lib/mixins/imagelist.py +77 -0
- wx/lib/mixins/inspection.py +184 -0
- wx/lib/mixins/listctrl.py +894 -0
- wx/lib/mixins/rubberband.py +404 -0
- wx/lib/mixins/treemixin.py +678 -0
- wx/lib/msgpanel.py +95 -0
- wx/lib/multisash.py +747 -0
- wx/lib/myole4ax.idl +178 -0
- wx/lib/myole4ax.tlb +0 -0
- wx/lib/newevent.py +229 -0
- wx/lib/nvdlg.py +156 -0
- wx/lib/ogl/__init__.py +13 -0
- wx/lib/ogl/basic.py +3991 -0
- wx/lib/ogl/bmpshape.py +87 -0
- wx/lib/ogl/canvas.py +467 -0
- wx/lib/ogl/composit.py +1577 -0
- wx/lib/ogl/diagram.py +230 -0
- wx/lib/ogl/divided.py +483 -0
- wx/lib/ogl/drawn.py +900 -0
- wx/lib/ogl/lines.py +1811 -0
- wx/lib/ogl/oglmisc.py +608 -0
- wx/lib/pdfviewer/__init__.py +113 -0
- wx/lib/pdfviewer/bitmaps/ArrowLeft.png +0 -0
- wx/lib/pdfviewer/bitmaps/ArrowRight.png +0 -0
- wx/lib/pdfviewer/bitmaps/DirectionH.png +0 -0
- wx/lib/pdfviewer/bitmaps/DirectionV.png +0 -0
- wx/lib/pdfviewer/bitmaps/PlayerFirst.png +0 -0
- wx/lib/pdfviewer/bitmaps/PlayerLast.png +0 -0
- wx/lib/pdfviewer/bitmaps/PlayerNext.png +0 -0
- wx/lib/pdfviewer/bitmaps/PlayerPrev.png +0 -0
- wx/lib/pdfviewer/bitmaps/Printer.png +0 -0
- wx/lib/pdfviewer/bitmaps/ReadMe.txt +28 -0
- wx/lib/pdfviewer/bitmaps/Save.png +0 -0
- wx/lib/pdfviewer/bitmaps/ZoomIn.png +0 -0
- wx/lib/pdfviewer/bitmaps/ZoomOut.png +0 -0
- wx/lib/pdfviewer/bitmaps/encode_bitmaps.py +37 -0
- wx/lib/pdfviewer/buttonpanel.py +279 -0
- wx/lib/pdfviewer/images.py +240 -0
- wx/lib/pdfviewer/viewer.py +1077 -0
- wx/lib/pdfwin.py +295 -0
- wx/lib/pdfwin_old.py +789 -0
- wx/lib/platebtn.py +789 -0
- wx/lib/plot/CHANGELOG.md +150 -0
- wx/lib/plot/README.md +16 -0
- wx/lib/plot/__init__.py +46 -0
- wx/lib/plot/__main__.py +5 -0
- wx/lib/plot/examples/__init__.py +0 -0
- wx/lib/plot/examples/demo.py +1009 -0
- wx/lib/plot/examples/simple_example.py +54 -0
- wx/lib/plot/plotcanvas.py +2981 -0
- wx/lib/plot/polyobjects.py +1525 -0
- wx/lib/plot/utils.py +327 -0
- wx/lib/popupctl.py +250 -0
- wx/lib/printout.py +1157 -0
- wx/lib/progressindicator.py +151 -0
- wx/lib/pubsub/LICENSE_BSD_Simple.txt +23 -0
- wx/lib/pubsub/README_WxPython.txt +22 -0
- wx/lib/pubsub/RELEASE_NOTES.txt +71 -0
- wx/lib/pubsub/__init__.py +25 -0
- wx/lib/pubsub/core/__init__.py +92 -0
- wx/lib/pubsub/core/arg1/__init__.py +16 -0
- wx/lib/pubsub/core/arg1/listenerimpl.py +97 -0
- wx/lib/pubsub/core/arg1/publisher.py +40 -0
- wx/lib/pubsub/core/arg1/publishermixin.py +34 -0
- wx/lib/pubsub/core/arg1/topicargspecimpl.py +66 -0
- wx/lib/pubsub/core/arg1/topicmgrimpl.py +19 -0
- wx/lib/pubsub/core/callables.py +191 -0
- wx/lib/pubsub/core/imp2.py +63 -0
- wx/lib/pubsub/core/itopicdefnprovider.py +0 -0
- wx/lib/pubsub/core/kwargs/__init__.py +16 -0
- wx/lib/pubsub/core/kwargs/datamsg.py +27 -0
- wx/lib/pubsub/core/kwargs/listenerimpl.py +93 -0
- wx/lib/pubsub/core/kwargs/publisher.py +77 -0
- wx/lib/pubsub/core/kwargs/publishermixin.py +65 -0
- wx/lib/pubsub/core/kwargs/topicargspecimpl.py +217 -0
- wx/lib/pubsub/core/kwargs/topicmgrimpl.py +13 -0
- wx/lib/pubsub/core/listener.py +40 -0
- wx/lib/pubsub/core/listenerbase.py +185 -0
- wx/lib/pubsub/core/notificationmgr.py +185 -0
- wx/lib/pubsub/core/publisherbase.py +191 -0
- wx/lib/pubsub/core/topicargspec.py +77 -0
- wx/lib/pubsub/core/topicdefnprovider.py +632 -0
- wx/lib/pubsub/core/topicexc.py +72 -0
- wx/lib/pubsub/core/topicmgr.py +456 -0
- wx/lib/pubsub/core/topicobj.py +472 -0
- wx/lib/pubsub/core/topictreetraverser.py +143 -0
- wx/lib/pubsub/core/topicutils.py +118 -0
- wx/lib/pubsub/core/treeconfig.py +21 -0
- wx/lib/pubsub/core/validatedefnargs.py +29 -0
- wx/lib/pubsub/core/weakmethod.py +102 -0
- wx/lib/pubsub/policies.py +24 -0
- wx/lib/pubsub/pub.py +199 -0
- wx/lib/pubsub/py2and3.py +608 -0
- wx/lib/pubsub/setuparg1.py +47 -0
- wx/lib/pubsub/setupkwargs.py +29 -0
- wx/lib/pubsub/utils/__init__.py +27 -0
- wx/lib/pubsub/utils/exchandling.py +100 -0
- wx/lib/pubsub/utils/misc.py +100 -0
- wx/lib/pubsub/utils/notification.py +331 -0
- wx/lib/pubsub/utils/topictreeprinter.py +195 -0
- wx/lib/pubsub/utils/xmltopicdefnprovider.py +287 -0
- wx/lib/pydocview.py +3300 -0
- wx/lib/rcsizer.py +229 -0
- wx/lib/resizewidget.py +357 -0
- wx/lib/scrolledpanel.py +225 -0
- wx/lib/sheet.py +350 -0
- wx/lib/sized_controls.py +691 -0
- wx/lib/softwareupdate.py +361 -0
- wx/lib/splitter.py +925 -0
- wx/lib/statbmp.py +199 -0
- wx/lib/stattext.py +322 -0
- wx/lib/throbber.py +425 -0
- wx/lib/ticker.py +295 -0
- wx/lib/ticker_xrc.py +48 -0
- wx/lib/utils.py +89 -0
- wx/lib/wordwrap.py +97 -0
- wx/lib/wxcairo/__init__.py +124 -0
- wx/lib/wxcairo/wx_cairocffi.py +200 -0
- wx/lib/wxcairo/wx_pycairo.py +463 -0
- wx/lib/wxpTag.py +274 -0
- wx/locale/af/LC_MESSAGES/wxstd.mo +0 -0
- wx/locale/an/LC_MESSAGES/wxstd.mo +0 -0
- wx/locale/ar/LC_MESSAGES/wxstd.mo +0 -0
- wx/locale/ca/LC_MESSAGES/wxstd.mo +0 -0
- wx/locale/ca@valencia/LC_MESSAGES/wxstd.mo +0 -0
- wx/locale/cs/LC_MESSAGES/wxstd.mo +0 -0
- wx/locale/da/LC_MESSAGES/wxstd.mo +0 -0
- wx/locale/de/LC_MESSAGES/wxstd.mo +0 -0
- wx/locale/el/LC_MESSAGES/wxstd.mo +0 -0
- wx/locale/es/LC_MESSAGES/wxstd.mo +0 -0
- wx/locale/eu/LC_MESSAGES/wxstd.mo +0 -0
- wx/locale/fa_IR/LC_MESSAGES/wxstd.mo +0 -0
- wx/locale/fi/LC_MESSAGES/wxstd.mo +0 -0
- wx/locale/fr/LC_MESSAGES/wxstd.mo +0 -0
- wx/locale/gl_ES/LC_MESSAGES/wxstd.mo +0 -0
- wx/locale/hi/LC_MESSAGES/wxstd.mo +0 -0
- wx/locale/hr/LC_MESSAGES/wxstd.mo +0 -0
- wx/locale/hu/LC_MESSAGES/wxstd.mo +0 -0
- wx/locale/id/LC_MESSAGES/wxstd.mo +0 -0
- wx/locale/it/LC_MESSAGES/wxstd.mo +0 -0
- wx/locale/ja/LC_MESSAGES/wxstd.mo +0 -0
- wx/locale/ka/LC_MESSAGES/wxstd.mo +0 -0
- wx/locale/ko_KR/LC_MESSAGES/wxstd.mo +0 -0
- wx/locale/lt/LC_MESSAGES/wxstd.mo +0 -0
- wx/locale/lv/LC_MESSAGES/wxstd.mo +0 -0
- wx/locale/ms/LC_MESSAGES/wxstd.mo +0 -0
- wx/locale/nb/LC_MESSAGES/wxstd.mo +0 -0
- wx/locale/ne/LC_MESSAGES/wxstd.mo +0 -0
- wx/locale/nl/LC_MESSAGES/wxstd.mo +0 -0
- wx/locale/pl/LC_MESSAGES/wxstd.mo +0 -0
- wx/locale/pt/LC_MESSAGES/wxstd.mo +0 -0
- wx/locale/pt_BR/LC_MESSAGES/wxstd.mo +0 -0
- wx/locale/ro/LC_MESSAGES/wxstd.mo +0 -0
- wx/locale/ru/LC_MESSAGES/wxstd.mo +0 -0
- wx/locale/sk/LC_MESSAGES/wxstd.mo +0 -0
- wx/locale/sl/LC_MESSAGES/wxstd.mo +0 -0
- wx/locale/sq/LC_MESSAGES/wxstd.mo +0 -0
- wx/locale/sv/LC_MESSAGES/wxstd.mo +0 -0
- wx/locale/ta/LC_MESSAGES/wxstd.mo +0 -0
- wx/locale/tr/LC_MESSAGES/wxstd.mo +0 -0
- wx/locale/uk/LC_MESSAGES/wxstd.mo +0 -0
- wx/locale/vi/LC_MESSAGES/wxstd.mo +0 -0
- wx/locale/zh_CN/LC_MESSAGES/wxstd.mo +0 -0
- wx/locale/zh_TW/LC_MESSAGES/wxstd.mo +0 -0
- wx/media.py +27 -0
- wx/media.pyi +223 -0
- wx/msw.py +13 -0
- wx/msw.pyi +65 -0
- wx/propgrid.py +1451 -0
- wx/propgrid.pyi +7914 -0
- wx/py/CHANGES.txt +796 -0
- wx/py/Py.ico +0 -0
- wx/py/PyAlaCarte.py +34 -0
- wx/py/PyAlaMode.py +34 -0
- wx/py/PyAlaModeTest.py +33 -0
- wx/py/PyCrust.ico +0 -0
- wx/py/PyCrust.py +78 -0
- wx/py/PyCrust_16.png +0 -0
- wx/py/PyCrust_32.png +0 -0
- wx/py/PyFilling.py +35 -0
- wx/py/PyShell.py +78 -0
- wx/py/PySlices.ico +0 -0
- wx/py/PySlices.py +98 -0
- wx/py/PySlicesShell.py +94 -0
- wx/py/PySlices_16.png +0 -0
- wx/py/PySlices_32.png +0 -0
- wx/py/PyWrap.py +52 -0
- wx/py/README.txt +77 -0
- wx/py/__init__.py +20 -0
- wx/py/buffer.py +136 -0
- wx/py/crust.py +403 -0
- wx/py/crustslices.py +403 -0
- wx/py/dispatcher.py +259 -0
- wx/py/document.py +37 -0
- wx/py/editor.py +844 -0
- wx/py/editwindow.py +299 -0
- wx/py/filling.py +357 -0
- wx/py/frame.py +978 -0
- wx/py/images.py +212 -0
- wx/py/interpreter.py +170 -0
- wx/py/introspect.py +393 -0
- wx/py/magic.py +98 -0
- wx/py/parse.py +134 -0
- wx/py/path.py +36 -0
- wx/py/pseudo.py +99 -0
- wx/py/shell.py +1588 -0
- wx/py/sliceshell.py +3814 -0
- wx/py/tests/test_interpreter.py +71 -0
- wx/py/tests/test_introspect.py +862 -0
- wx/py/tests/test_pseudo.py +70 -0
- wx/py/tests/test_version.py +36 -0
- wx/py/tests/testall.py +22 -0
- wx/py/version.py +7 -0
- wx/ribbon.py +45 -0
- wx/ribbon.pyi +2494 -0
- wx/richtext.py +142 -0
- wx/richtext.pyi +12113 -0
- wx/siplib.cp313-win_amd64.pyd +0 -0
- wx/stc.py +58 -0
- wx/stc.pyi +8463 -0
- wx/svg/__init__.py +364 -0
- wx/svg/_nanosvg.cp313-win_amd64.pyd +0 -0
- wx/tools/__init__.py +18 -0
- wx/tools/dbg.py +268 -0
- wx/tools/genaxmodule.py +50 -0
- wx/tools/helpviewer.py +92 -0
- wx/tools/img2img.py +85 -0
- wx/tools/img2png.py +54 -0
- wx/tools/img2py.py +309 -0
- wx/tools/img2xpm.py +54 -0
- wx/tools/pywxrc.py +949 -0
- wx/tools/wxget.py +254 -0
- wx/tools/wxget_docs_demo.py +186 -0
- wx/wxbase315u_net_vc140_x64.dll +0 -0
- wx/wxbase315u_vc140_x64.dll +0 -0
- wx/wxbase315u_xml_vc140_x64.dll +0 -0
- wx/wxmsw315u_adv_vc140_x64.dll +0 -0
- wx/wxmsw315u_aui_vc140_x64.dll +0 -0
- wx/wxmsw315u_core_vc140_x64.dll +0 -0
- wx/wxmsw315u_gl_vc140_x64.dll +0 -0
- wx/wxmsw315u_html_vc140_x64.dll +0 -0
- wx/wxmsw315u_media_vc140_x64.dll +0 -0
- wx/wxmsw315u_propgrid_vc140_x64.dll +0 -0
- wx/wxmsw315u_qa_vc140_x64.dll +0 -0
- wx/wxmsw315u_ribbon_vc140_x64.dll +0 -0
- wx/wxmsw315u_richtext_vc140_x64.dll +0 -0
- wx/wxmsw315u_stc_vc140_x64.dll +0 -0
- wx/wxmsw315u_webview_vc140_x64.dll +0 -0
- wx/wxmsw315u_xrc_vc140_x64.dll +0 -0
- wx/xml.py +15 -0
- wx/xml.pyi +575 -0
- wx/xrc.py +65 -0
- wx/xrc.pyi +742 -0
- wxPython_zombie-3.1.5.8.dist-info/LICENSE.txt +950 -0
- wxPython_zombie-3.1.5.8.dist-info/METADATA +107 -0
- wxPython_zombie-3.1.5.8.dist-info/RECORD +1175 -0
- wxPython_zombie-3.1.5.8.dist-info/WHEEL +5 -0
- wxPython_zombie-3.1.5.8.dist-info/entry_points.txt +2 -0
- wxPython_zombie-3.1.5.8.dist-info/top_level.txt +1 -0
wx/lib/agw/floatspin.py
ADDED
|
@@ -0,0 +1,1823 @@
|
|
|
1
|
+
# --------------------------------------------------------------------------- #
|
|
2
|
+
# FLOATSPIN Control wxPython IMPLEMENTATION
|
|
3
|
+
# Python Code By:
|
|
4
|
+
#
|
|
5
|
+
# Andrea Gavana, @ 16 Nov 2005
|
|
6
|
+
# Latest Revision: 03 Jan 2014, 23.00 GMT
|
|
7
|
+
#
|
|
8
|
+
#
|
|
9
|
+
# TODO List/Caveats
|
|
10
|
+
#
|
|
11
|
+
# 1. Ay Idea?
|
|
12
|
+
#
|
|
13
|
+
# For All Kind Of Problems, Requests Of Enhancements And Bug Reports, Please
|
|
14
|
+
# Write To Me At:
|
|
15
|
+
#
|
|
16
|
+
# andrea.gavana@gmail.com
|
|
17
|
+
# andrea.gavana@maerskoil.com
|
|
18
|
+
#
|
|
19
|
+
# Or, Obviously, To The wxPython Mailing List!!!
|
|
20
|
+
#
|
|
21
|
+
# Tags: phoenix-port, unittest, documented
|
|
22
|
+
#
|
|
23
|
+
# End Of Comments
|
|
24
|
+
# --------------------------------------------------------------------------- #
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
"""
|
|
28
|
+
:class:`~wx.lib.agw.floatspin.FloatSpin` implements a floating point :class:`SpinCtrl`.
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
Description
|
|
32
|
+
===========
|
|
33
|
+
|
|
34
|
+
:class:`FloatSpin` implements a floating point :class:`SpinCtrl`. It is built using a custom
|
|
35
|
+
:class:`wx.Control`, composed by a :class:`TextCtrl` and a :class:`SpinButton`. In order to
|
|
36
|
+
correctly handle floating points numbers without rounding errors or non-exact
|
|
37
|
+
floating point representations, :class:`FloatSpin` uses the great :class:`FixedPoint` class
|
|
38
|
+
from Tim Peters.
|
|
39
|
+
|
|
40
|
+
What you can do:
|
|
41
|
+
|
|
42
|
+
- Set the number of representative digits for your floating point numbers;
|
|
43
|
+
- Set the floating point format (``%f``, ``%F``, ``%e``, ``%E``, ``%g``, ``%G``);
|
|
44
|
+
- Set the increment of every ``EVT_FLOATSPIN`` event;
|
|
45
|
+
- Set minimum, maximum values for :class:`FloatSpin` as well as its range;
|
|
46
|
+
- Change font and colour for the underline :class:`TextCtrl`.
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
Usage
|
|
50
|
+
=====
|
|
51
|
+
|
|
52
|
+
Usage example::
|
|
53
|
+
|
|
54
|
+
import wx
|
|
55
|
+
import wx.lib.agw.floatspin as FS
|
|
56
|
+
|
|
57
|
+
class MyFrame(wx.Frame):
|
|
58
|
+
|
|
59
|
+
def __init__(self, parent):
|
|
60
|
+
|
|
61
|
+
wx.Frame.__init__(self, parent, -1, "FloatSpin Demo")
|
|
62
|
+
|
|
63
|
+
panel = wx.Panel(self)
|
|
64
|
+
|
|
65
|
+
floatspin = FS.FloatSpin(panel, -1, pos=(50, 50), min_val=0, max_val=1,
|
|
66
|
+
increment=0.01, value=0.1, agwStyle=FS.FS_LEFT)
|
|
67
|
+
floatspin.SetFormat("%f")
|
|
68
|
+
floatspin.SetDigits(2)
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
# our normal wxApp-derived class, as usual
|
|
72
|
+
|
|
73
|
+
app = wx.App(0)
|
|
74
|
+
|
|
75
|
+
frame = MyFrame(None)
|
|
76
|
+
app.SetTopWindow(frame)
|
|
77
|
+
frame.Show()
|
|
78
|
+
|
|
79
|
+
app.MainLoop()
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
Events
|
|
84
|
+
======
|
|
85
|
+
|
|
86
|
+
:class:`FloatSpin` catches 3 different types of events:
|
|
87
|
+
|
|
88
|
+
1) Spin events: events generated by spinning up/down the spinbutton;
|
|
89
|
+
2) Char events: playing with up/down arrows of the keyboard increase/decrease
|
|
90
|
+
the value of :class:`FloatSpin`;
|
|
91
|
+
3) Mouse wheel event: using the wheel will change the value of :class:`FloatSpin`.
|
|
92
|
+
|
|
93
|
+
In addition, there are some other functionalities:
|
|
94
|
+
|
|
95
|
+
- It remembers the initial value as a default value, call :meth:`~FloatSpin.SetToDefaultValue`, or
|
|
96
|
+
press ``Esc`` to return to it;
|
|
97
|
+
- ``Shift`` + arrow = 2 * increment (or ``Shift`` + mouse wheel);
|
|
98
|
+
- ``Ctrl`` + arrow = 10 * increment (or ``Ctrl`` + mouse wheel);
|
|
99
|
+
- ``Alt`` + arrow = 100 * increment (or ``Alt`` + mouse wheel);
|
|
100
|
+
- Combinations of ``Shift``, ``Ctrl``, ``Alt`` increment the :class:`FloatSpin` value by the
|
|
101
|
+
product of the factors;
|
|
102
|
+
- ``PgUp`` & ``PgDn`` = 10 * increment * the product of the ``Shift``, ``Ctrl``, ``Alt``
|
|
103
|
+
factors;
|
|
104
|
+
- ``Space`` sets the control's value to it's last valid state.
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
Window Styles
|
|
108
|
+
=============
|
|
109
|
+
|
|
110
|
+
This class supports the following window styles:
|
|
111
|
+
|
|
112
|
+
=============== =========== ==================================================
|
|
113
|
+
Window Styles Hex Value Description
|
|
114
|
+
=============== =========== ==================================================
|
|
115
|
+
``FS_READONLY`` 0x1 Sets :class:`FloatSpin` as read-only control.
|
|
116
|
+
``FS_LEFT`` 0x2 Horizontally align the underlying :class:`TextCtrl` on the left.
|
|
117
|
+
``FS_CENTRE`` 0x4 Horizontally align the underlying :class:`TextCtrl` on center.
|
|
118
|
+
``FS_RIGHT`` 0x8 Horizontally align the underlying :class:`TextCtrl` on the right.
|
|
119
|
+
=============== =========== ==================================================
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
Events Processing
|
|
123
|
+
=================
|
|
124
|
+
|
|
125
|
+
This class processes the following events:
|
|
126
|
+
|
|
127
|
+
================= ==================================================
|
|
128
|
+
Event Name Description
|
|
129
|
+
================= ==================================================
|
|
130
|
+
``EVT_FLOATSPIN`` Emitted when the user changes the value of :class:`FloatSpin`, either with the mouse or with the keyboard.
|
|
131
|
+
================= ==================================================
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
License And Version
|
|
135
|
+
===================
|
|
136
|
+
|
|
137
|
+
:class:`FloatSpin` control is distributed under the wxPython license.
|
|
138
|
+
|
|
139
|
+
Latest revision: Andrea Gavana @ 03 Jan 2014, 23.00 GMT
|
|
140
|
+
|
|
141
|
+
Version 1.0
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
Backward Incompatibilities
|
|
145
|
+
==========================
|
|
146
|
+
|
|
147
|
+
Modifications to allow `min_val` or `max_val` to be ``None`` done by:
|
|
148
|
+
|
|
149
|
+
James Bigler,
|
|
150
|
+
SCI Institute, University of Utah,
|
|
151
|
+
March 14, 2007
|
|
152
|
+
|
|
153
|
+
:note: Note that the changes I made will break backward compatibility,
|
|
154
|
+
because I changed the contructor's parameters from `min` / `max` to
|
|
155
|
+
`min_val` / `max_val` to be consistent with the other functions and to
|
|
156
|
+
eliminate any potential confusion with the built in `min` and `max`
|
|
157
|
+
functions.
|
|
158
|
+
|
|
159
|
+
You specify open ranges like this (you can equally do this in the
|
|
160
|
+
constructor)::
|
|
161
|
+
|
|
162
|
+
SetRange(min_val=1, max_val=None) # [1, ]
|
|
163
|
+
SetRange(min_val=None, max_val=0) # [ , 0]
|
|
164
|
+
|
|
165
|
+
or no range::
|
|
166
|
+
|
|
167
|
+
SetRange(min_val=None, max_val=None) # [ , ]
|
|
168
|
+
|
|
169
|
+
"""
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
#----------------------------------------------------------------------
|
|
173
|
+
# Beginning Of FLOATSPIN wxPython Code
|
|
174
|
+
#----------------------------------------------------------------------
|
|
175
|
+
|
|
176
|
+
import wx
|
|
177
|
+
import locale
|
|
178
|
+
from math import ceil, floor
|
|
179
|
+
|
|
180
|
+
# Python 2/3 compatibility helper
|
|
181
|
+
import six
|
|
182
|
+
if six.PY3:
|
|
183
|
+
long = int
|
|
184
|
+
|
|
185
|
+
# Set The Styles For The Underline wx.TextCtrl
|
|
186
|
+
FS_READONLY = 1
|
|
187
|
+
""" Sets :class:`FloatSpin` as read-only control. """
|
|
188
|
+
FS_LEFT = 2
|
|
189
|
+
""" Horizontally align the underlying :class:`TextCtrl` on the left. """
|
|
190
|
+
FS_CENTRE = 4
|
|
191
|
+
""" Horizontally align the underlying :class:`TextCtrl` on center. """
|
|
192
|
+
FS_RIGHT = 8
|
|
193
|
+
""" Horizontally align the underlying :class:`TextCtrl` on the right. """
|
|
194
|
+
|
|
195
|
+
# Define The FloatSpin Event
|
|
196
|
+
wxEVT_FLOATSPIN = wx.NewEventType()
|
|
197
|
+
|
|
198
|
+
#-----------------------------------#
|
|
199
|
+
# FloatSpinEvent
|
|
200
|
+
#-----------------------------------#
|
|
201
|
+
|
|
202
|
+
EVT_FLOATSPIN = wx.PyEventBinder(wxEVT_FLOATSPIN, 1)
|
|
203
|
+
""" Emitted when the user changes the value of :class:`FloatSpin`, either with the mouse or""" \
|
|
204
|
+
""" with the keyboard. """
|
|
205
|
+
|
|
206
|
+
# ---------------------------------------------------------------------------- #
|
|
207
|
+
# Class FloatSpinEvent
|
|
208
|
+
# ---------------------------------------------------------------------------- #
|
|
209
|
+
|
|
210
|
+
class FloatSpinEvent(wx.CommandEvent):
|
|
211
|
+
""" This event will be sent when a ``EVT_FLOATSPIN`` event is mapped in the parent. """
|
|
212
|
+
|
|
213
|
+
def __init__(self, eventType, eventId=1, nSel=-1, nOldSel=-1):
|
|
214
|
+
"""
|
|
215
|
+
Default class constructor.
|
|
216
|
+
|
|
217
|
+
:param `eventType`: the event type;
|
|
218
|
+
:param `eventId`: the event identifier;
|
|
219
|
+
:param `nSel`: the current selection;
|
|
220
|
+
:param `nOldSel`: the old selection.
|
|
221
|
+
"""
|
|
222
|
+
|
|
223
|
+
wx.CommandEvent.__init__(self, eventType, eventId)
|
|
224
|
+
self._eventType = eventType
|
|
225
|
+
|
|
226
|
+
|
|
227
|
+
def SetPosition(self, pos):
|
|
228
|
+
"""
|
|
229
|
+
Sets event position.
|
|
230
|
+
|
|
231
|
+
:param `pos`: an integer specyfing the event position.
|
|
232
|
+
"""
|
|
233
|
+
|
|
234
|
+
self._position = pos
|
|
235
|
+
|
|
236
|
+
|
|
237
|
+
def GetPosition(self):
|
|
238
|
+
""" Returns event position. """
|
|
239
|
+
|
|
240
|
+
return self._position
|
|
241
|
+
|
|
242
|
+
|
|
243
|
+
#----------------------------------------------------------------------------
|
|
244
|
+
# FloatTextCtrl
|
|
245
|
+
#----------------------------------------------------------------------------
|
|
246
|
+
|
|
247
|
+
|
|
248
|
+
class FloatTextCtrl(wx.TextCtrl):
|
|
249
|
+
"""
|
|
250
|
+
A class which holds a :class:`TextCtrl`, one of the two building blocks
|
|
251
|
+
of :class:`FloatSpin`.
|
|
252
|
+
"""
|
|
253
|
+
|
|
254
|
+
def __init__(self, parent, id=wx.ID_ANY, value="", pos=wx.DefaultPosition,
|
|
255
|
+
size=wx.DefaultSize, style=wx.TE_NOHIDESEL | wx.TE_PROCESS_ENTER,
|
|
256
|
+
validator=wx.DefaultValidator,
|
|
257
|
+
name=wx.TextCtrlNameStr):
|
|
258
|
+
"""
|
|
259
|
+
Default class constructor.
|
|
260
|
+
Used internally. Do not call directly this class in your code!
|
|
261
|
+
|
|
262
|
+
:param `parent`: the :class:`FloatTextCtrl` parent;
|
|
263
|
+
:param `id`: an identifier for the control: a value of -1 is taken to mean a default;
|
|
264
|
+
:param `value`: default text value;
|
|
265
|
+
:param `pos`: the control position. A value of (-1, -1) indicates a default position,
|
|
266
|
+
chosen by either the windowing system or wxPython, depending on platform;
|
|
267
|
+
:param `size`: the control size. A value of (-1, -1) indicates a default size,
|
|
268
|
+
chosen by either the windowing system or wxPython, depending on platform;
|
|
269
|
+
:param `style`: the window style;
|
|
270
|
+
:param `validator`: the window validator;
|
|
271
|
+
:param `name`: the window name.
|
|
272
|
+
|
|
273
|
+
"""
|
|
274
|
+
|
|
275
|
+
wx.TextCtrl.__init__(self, parent, id, value, pos, size, style, validator, name)
|
|
276
|
+
|
|
277
|
+
self._parent = parent
|
|
278
|
+
self.Bind(wx.EVT_WINDOW_DESTROY, self.OnDestroy)
|
|
279
|
+
self.Bind(wx.EVT_CHAR, self.OnChar)
|
|
280
|
+
self.Bind(wx.EVT_KILL_FOCUS, self.OnKillFocus)
|
|
281
|
+
|
|
282
|
+
|
|
283
|
+
def OnDestroy(self, event):
|
|
284
|
+
"""
|
|
285
|
+
Handles the ``wx.EVT_WINDOW_DESTROY`` event for :class:`FloatTextCtrl`.
|
|
286
|
+
|
|
287
|
+
:param `event`: a :class:`wx.WindowDestroyEvent` event to be processed.
|
|
288
|
+
|
|
289
|
+
:note: This method tries to correctly handle the control destruction under MSW.
|
|
290
|
+
"""
|
|
291
|
+
|
|
292
|
+
if self._parent:
|
|
293
|
+
self._parent._textctrl = None
|
|
294
|
+
self._parent = None
|
|
295
|
+
|
|
296
|
+
|
|
297
|
+
def OnChar(self, event):
|
|
298
|
+
"""
|
|
299
|
+
Handles the ``wx.EVT_CHAR`` event for :class:`FloatTextCtrl`.
|
|
300
|
+
|
|
301
|
+
:param `event`: a :class:`KeyEvent` event to be processed.
|
|
302
|
+
"""
|
|
303
|
+
|
|
304
|
+
if self._parent:
|
|
305
|
+
self._parent.OnChar(event)
|
|
306
|
+
|
|
307
|
+
|
|
308
|
+
def OnKillFocus(self, event):
|
|
309
|
+
"""
|
|
310
|
+
Handles the ``wx.EVT_KILL_FOCUS`` event for :class:`FloatTextCtrl`.
|
|
311
|
+
|
|
312
|
+
:param `event`: a :class:`FocusEvent` event to be processed.
|
|
313
|
+
|
|
314
|
+
:note: This method synchronizes the :class:`SpinButton` and the :class:`TextCtrl`
|
|
315
|
+
when focus is lost.
|
|
316
|
+
"""
|
|
317
|
+
|
|
318
|
+
if self._parent:
|
|
319
|
+
self._parent.SyncSpinToText(True)
|
|
320
|
+
|
|
321
|
+
event.Skip()
|
|
322
|
+
|
|
323
|
+
|
|
324
|
+
#---------------------------------------------------------------------------- #
|
|
325
|
+
# FloatSpin
|
|
326
|
+
# This Is The Main Class Implementation
|
|
327
|
+
# ---------------------------------------------------------------------------- #
|
|
328
|
+
|
|
329
|
+
class FloatSpin(wx.Control):
|
|
330
|
+
"""
|
|
331
|
+
:class:`FloatSpin` implements a floating point :class:`SpinCtrl`. It is built using a custom
|
|
332
|
+
:class:`wx.Control`, composed by a :class:`TextCtrl` and a :class:`SpinButton`. In order to
|
|
333
|
+
correctly handle floating points numbers without rounding errors or non-exact
|
|
334
|
+
floating point representations, :class:`FloatSpin` uses the great :class:`FixedPoint` class
|
|
335
|
+
from Tim Peters.
|
|
336
|
+
"""
|
|
337
|
+
|
|
338
|
+
def __init__(self, parent, id=wx.ID_ANY, pos=wx.DefaultPosition,
|
|
339
|
+
size=(95,-1), style=0, value=0.0, min_val=None, max_val=None,
|
|
340
|
+
increment=1.0, digits=-1, agwStyle=FS_LEFT,
|
|
341
|
+
name="FloatSpin"):
|
|
342
|
+
"""
|
|
343
|
+
Default class constructor.
|
|
344
|
+
|
|
345
|
+
:param `parent`: the :class:`FloatSpin` parent;
|
|
346
|
+
:param `id`: an identifier for the control: a value of -1 is taken to mean a default;
|
|
347
|
+
:param `pos`: the control position. A value of (-1, -1) indicates a default position,
|
|
348
|
+
chosen by either the windowing system or wxPython, depending on platform;
|
|
349
|
+
:param `size`: the control size. A value of (-1, -1) indicates a default size,
|
|
350
|
+
chosen by either the windowing system or wxPython, depending on platform;
|
|
351
|
+
:param `style`: the window style;
|
|
352
|
+
:param `value`: is the current value for :class:`FloatSpin`;
|
|
353
|
+
:param `min_val`: the minimum value, ignored if ``None``;
|
|
354
|
+
:param `max_val`: the maximum value, ignored if ``None``;
|
|
355
|
+
:param `increment`: the increment for every :class:`FloatSpinEvent` event;
|
|
356
|
+
:param `digits`: number of representative digits for your floating point numbers;
|
|
357
|
+
:param `agwStyle`: one of the following bits:
|
|
358
|
+
|
|
359
|
+
=============== =========== ==================================================
|
|
360
|
+
Window Styles Hex Value Description
|
|
361
|
+
=============== =========== ==================================================
|
|
362
|
+
``FS_READONLY`` 0x1 Sets :class:`FloatSpin` as read-only control.
|
|
363
|
+
``FS_LEFT`` 0x2 Horizontally align the underlying :class:`TextCtrl` on the left.
|
|
364
|
+
``FS_CENTRE`` 0x4 Horizontally align the underlying :class:`TextCtrl` on center.
|
|
365
|
+
``FS_RIGHT`` 0x8 Horizontally align the underlying :class:`TextCtrl` on the right.
|
|
366
|
+
=============== =========== ==================================================
|
|
367
|
+
|
|
368
|
+
:param `name`: the window name.
|
|
369
|
+
|
|
370
|
+
"""
|
|
371
|
+
|
|
372
|
+
wx.Control.__init__(self, parent, id, pos, size, style|wx.NO_BORDER|
|
|
373
|
+
wx.NO_FULL_REPAINT_ON_RESIZE | wx.CLIP_CHILDREN,
|
|
374
|
+
wx.DefaultValidator, name)
|
|
375
|
+
|
|
376
|
+
# Don't call SetRange here, because it will try to modify
|
|
377
|
+
# self._value whose value doesn't exist yet.
|
|
378
|
+
self.SetRangeDontClampValue(min_val, max_val)
|
|
379
|
+
self._value = self.ClampValue(FixedPoint(str(value), 20))
|
|
380
|
+
self._defaultvalue = self._value
|
|
381
|
+
self._increment = FixedPoint(str(increment), 20)
|
|
382
|
+
self._spinmodifier = FixedPoint(str(1.0), 20)
|
|
383
|
+
self._digits = digits
|
|
384
|
+
self._snapticks = False
|
|
385
|
+
self._spinbutton = None
|
|
386
|
+
self._textctrl = None
|
|
387
|
+
self._spinctrl_bestsize = wx.Size(-999, -999)
|
|
388
|
+
|
|
389
|
+
# start Philip Semanchuk addition
|
|
390
|
+
# The textbox & spin button are drawn slightly differently
|
|
391
|
+
# depending on the platform. The difference is most pronounced
|
|
392
|
+
# under OS X.
|
|
393
|
+
if "__WXMAC__" in wx.PlatformInfo:
|
|
394
|
+
self._gap = 8
|
|
395
|
+
self._spin_top = 3
|
|
396
|
+
self._text_left = 4
|
|
397
|
+
self._text_top = 4
|
|
398
|
+
elif "__WXMSW__" in wx.PlatformInfo:
|
|
399
|
+
self._gap = 1
|
|
400
|
+
self._spin_top = 0
|
|
401
|
+
self._text_left = 0
|
|
402
|
+
self._text_top = 0
|
|
403
|
+
else:
|
|
404
|
+
# GTK
|
|
405
|
+
self._gap = -1
|
|
406
|
+
self._spin_top = 0
|
|
407
|
+
self._text_left = 0
|
|
408
|
+
self._text_top = 0
|
|
409
|
+
# end Philip Semanchuk addition
|
|
410
|
+
|
|
411
|
+
self.SetLabel(name)
|
|
412
|
+
self.SetForegroundColour(parent.GetForegroundColour())
|
|
413
|
+
|
|
414
|
+
width = size[0]
|
|
415
|
+
height = size[1]
|
|
416
|
+
best_size = self.DoGetBestSize()
|
|
417
|
+
|
|
418
|
+
if width == -1:
|
|
419
|
+
width = best_size.GetWidth()
|
|
420
|
+
if height == -1:
|
|
421
|
+
height = best_size.GetHeight()
|
|
422
|
+
|
|
423
|
+
self._validkeycode = [43, 44, 45, 46, 69, 101, 127, 314]
|
|
424
|
+
self._validkeycode.extend(list(range(48, 58)))
|
|
425
|
+
self._validkeycode.extend([wx.WXK_RETURN, wx.WXK_TAB, wx.WXK_BACK,
|
|
426
|
+
wx.WXK_LEFT, wx.WXK_RIGHT])
|
|
427
|
+
|
|
428
|
+
self._spinbutton = wx.SpinButton(self, wx.ID_ANY, wx.DefaultPosition,
|
|
429
|
+
size=(-1, height),
|
|
430
|
+
style=wx.SP_ARROW_KEYS | wx.SP_VERTICAL |
|
|
431
|
+
wx.SP_WRAP)
|
|
432
|
+
|
|
433
|
+
txtstyle = wx.TE_NOHIDESEL | wx.TE_PROCESS_ENTER
|
|
434
|
+
|
|
435
|
+
if agwStyle & FS_RIGHT:
|
|
436
|
+
txtstyle = txtstyle | wx.TE_RIGHT
|
|
437
|
+
elif agwStyle & FS_CENTRE:
|
|
438
|
+
txtstyle = txtstyle | wx.TE_CENTER
|
|
439
|
+
|
|
440
|
+
if agwStyle & FS_READONLY:
|
|
441
|
+
txtstyle = txtstyle | wx.TE_READONLY
|
|
442
|
+
|
|
443
|
+
self._textctrl = FloatTextCtrl(self, wx.ID_ANY, str(self._value),
|
|
444
|
+
wx.DefaultPosition,
|
|
445
|
+
(width-self._spinbutton.GetSize().GetWidth(), height),
|
|
446
|
+
txtstyle)
|
|
447
|
+
|
|
448
|
+
# start Philip Semanchuk addition
|
|
449
|
+
# Setting the textctrl's size in the ctor also sets its min size.
|
|
450
|
+
# But the textctrl is entirely controlled by the parent floatspin
|
|
451
|
+
# control and should accept whatever size its parent dictates, so
|
|
452
|
+
# here we tell it to forget its min size.
|
|
453
|
+
self._textctrl.SetMinSize(wx.DefaultSize)
|
|
454
|
+
# Setting the spin buttons's size in the ctor also sets its min size.
|
|
455
|
+
# Under OS X that results in a rendering artifact because spin buttons
|
|
456
|
+
# are a little shorter than textboxes.
|
|
457
|
+
# Setting the min size to the default allows OS X to draw the spin
|
|
458
|
+
# button correctly. However, Windows and KDE take the call to
|
|
459
|
+
# SetMinSize() as a cue to size the spin button taller than the
|
|
460
|
+
# textbox, so we avoid the call there.
|
|
461
|
+
if "__WXMAC__" in wx.PlatformInfo:
|
|
462
|
+
self._spinbutton.SetMinSize(wx.DefaultSize)
|
|
463
|
+
# end Philip Semanchuk addition
|
|
464
|
+
|
|
465
|
+
self._mainsizer = wx.BoxSizer(wx.HORIZONTAL)
|
|
466
|
+
# Ensure the spin button is shown, and the text widget takes
|
|
467
|
+
# all remaining free space
|
|
468
|
+
self._mainsizer.Add(self._textctrl, 1)
|
|
469
|
+
self._mainsizer.Add(self._spinbutton, 0)
|
|
470
|
+
self.SetSizer(self._mainsizer)
|
|
471
|
+
self._mainsizer.Layout()
|
|
472
|
+
|
|
473
|
+
self.SetFormat()
|
|
474
|
+
self.SetDigits(digits)
|
|
475
|
+
|
|
476
|
+
# set the value here without generating an event
|
|
477
|
+
|
|
478
|
+
decimal = locale.localeconv()["decimal_point"]
|
|
479
|
+
strs = ("%100." + str(self._digits) + self._textformat[1])%self._value
|
|
480
|
+
strs = strs.replace(".", decimal)
|
|
481
|
+
|
|
482
|
+
strs = strs.strip()
|
|
483
|
+
strs = self.ReplaceDoubleZero(strs)
|
|
484
|
+
|
|
485
|
+
self._textctrl.SetValue(strs)
|
|
486
|
+
|
|
487
|
+
if not (agwStyle & FS_READONLY):
|
|
488
|
+
self.Bind(wx.EVT_SPIN_UP, self.OnSpinUp)
|
|
489
|
+
self.Bind(wx.EVT_SPIN_DOWN, self.OnSpinDown)
|
|
490
|
+
self._spinbutton.Bind(wx.EVT_LEFT_DOWN, self.OnSpinMouseDown)
|
|
491
|
+
|
|
492
|
+
self._textctrl.Bind(wx.EVT_TEXT_ENTER, self.OnTextEnter)
|
|
493
|
+
self._textctrl.Bind(wx.EVT_MOUSEWHEEL, self.OnMouseWheel)
|
|
494
|
+
self._spinbutton.Bind(wx.EVT_MOUSEWHEEL, self.OnMouseWheel)
|
|
495
|
+
|
|
496
|
+
self.Bind(wx.EVT_SET_FOCUS, self.OnFocus)
|
|
497
|
+
self.Bind(wx.EVT_KILL_FOCUS, self.OnKillFocus)
|
|
498
|
+
self.Bind(wx.EVT_SIZE, self.OnSize)
|
|
499
|
+
|
|
500
|
+
# start Philip Semanchuk move
|
|
501
|
+
self.SetInitialSize((width, height))
|
|
502
|
+
# end Philip Semanchuk move
|
|
503
|
+
|
|
504
|
+
|
|
505
|
+
def OnDestroy(self, event):
|
|
506
|
+
"""
|
|
507
|
+
Handles the ``wx.EVT_WINDOW_DESTROY`` event for :class:`FloatSpin`.
|
|
508
|
+
|
|
509
|
+
:param `event`: a :class:`wx.WindowDestroyEvent` event to be processed.
|
|
510
|
+
|
|
511
|
+
:note: This method tries to correctly handle the control destruction under MSW.
|
|
512
|
+
"""
|
|
513
|
+
|
|
514
|
+
# Null This Since MSW Sends KILL_FOCUS On Deletion
|
|
515
|
+
if self._textctrl:
|
|
516
|
+
self._textctrl._parent = None
|
|
517
|
+
self._textctrl.Destroy()
|
|
518
|
+
self._textctrl = None
|
|
519
|
+
|
|
520
|
+
self._spinbutton.Destroy()
|
|
521
|
+
self._spinbutton = None
|
|
522
|
+
|
|
523
|
+
|
|
524
|
+
def DoGetBestSize(self):
|
|
525
|
+
"""
|
|
526
|
+
Gets the size which best suits the window: for a control, it would be the
|
|
527
|
+
minimal size which doesn't truncate the control, for a panel - the same
|
|
528
|
+
size as it would have after a call to `Fit()`.
|
|
529
|
+
|
|
530
|
+
:note: Overridden from :class:`wx.Control`.
|
|
531
|
+
"""
|
|
532
|
+
|
|
533
|
+
if self._spinctrl_bestsize.x == -999:
|
|
534
|
+
|
|
535
|
+
spin = wx.SpinCtrl(self, -1)
|
|
536
|
+
self._spinctrl_bestsize = spin.GetBestSize()
|
|
537
|
+
|
|
538
|
+
# oops something went wrong, set to reasonable value
|
|
539
|
+
if self._spinctrl_bestsize.GetWidth() < 20:
|
|
540
|
+
self._spinctrl_bestsize.SetWidth(95)
|
|
541
|
+
if self._spinctrl_bestsize.GetHeight() < 10:
|
|
542
|
+
self._spinctrl_bestsize.SetHeight(22)
|
|
543
|
+
|
|
544
|
+
spin.Destroy()
|
|
545
|
+
|
|
546
|
+
return self._spinctrl_bestsize
|
|
547
|
+
|
|
548
|
+
|
|
549
|
+
def DoSendEvent(self):
|
|
550
|
+
""" Send the event to the parent. """
|
|
551
|
+
|
|
552
|
+
event = wx.CommandEvent(wx.wxEVT_COMMAND_SPINCTRL_UPDATED, self.GetId())
|
|
553
|
+
event.SetEventObject(self)
|
|
554
|
+
event.SetInt(int(self._value + 0.5))
|
|
555
|
+
|
|
556
|
+
if self._textctrl:
|
|
557
|
+
event.SetString(self._textctrl.GetValue())
|
|
558
|
+
|
|
559
|
+
self.GetEventHandler().ProcessEvent(event)
|
|
560
|
+
|
|
561
|
+
eventOut = FloatSpinEvent(wxEVT_FLOATSPIN, self.GetId())
|
|
562
|
+
eventOut.SetPosition(int(self._value + 0.5))
|
|
563
|
+
eventOut.SetEventObject(self)
|
|
564
|
+
self.GetEventHandler().ProcessEvent(eventOut)
|
|
565
|
+
|
|
566
|
+
|
|
567
|
+
def OnSpinMouseDown(self, event):
|
|
568
|
+
"""
|
|
569
|
+
Handles the ``wx.EVT_LEFT_DOWN`` event for :class:`FloatSpin`.
|
|
570
|
+
|
|
571
|
+
:param `event`: a :class:`MouseEvent` event to be processed.
|
|
572
|
+
|
|
573
|
+
:note: This method works on the underlying :class:`SpinButton`.
|
|
574
|
+
"""
|
|
575
|
+
|
|
576
|
+
modifier = FixedPoint(str(1.0), 20)
|
|
577
|
+
if event.ShiftDown():
|
|
578
|
+
modifier = modifier*2.0
|
|
579
|
+
if event.ControlDown():
|
|
580
|
+
modifier = modifier*10.0
|
|
581
|
+
if event.AltDown():
|
|
582
|
+
modifier = modifier*100.0
|
|
583
|
+
|
|
584
|
+
self._spinmodifier = modifier
|
|
585
|
+
|
|
586
|
+
event.Skip()
|
|
587
|
+
|
|
588
|
+
|
|
589
|
+
def OnSpinUp(self, event):
|
|
590
|
+
"""
|
|
591
|
+
Handles the ``wx.EVT_SPIN_UP`` event for :class:`FloatSpin`.
|
|
592
|
+
|
|
593
|
+
:param `event`: a :class:`SpinEvent` event to be processed.
|
|
594
|
+
"""
|
|
595
|
+
|
|
596
|
+
if self._textctrl and self._textctrl.IsModified():
|
|
597
|
+
self.SyncSpinToText(False)
|
|
598
|
+
|
|
599
|
+
if self.InRange(self._value + self._increment*self._spinmodifier):
|
|
600
|
+
|
|
601
|
+
self._value = self._value + self._increment*self._spinmodifier
|
|
602
|
+
self.SetValue(self._value)
|
|
603
|
+
self.DoSendEvent()
|
|
604
|
+
|
|
605
|
+
|
|
606
|
+
def OnSpinDown(self, event):
|
|
607
|
+
"""
|
|
608
|
+
Handles the ``wx.EVT_SPIN_DOWN`` event for :class:`FloatSpin`.
|
|
609
|
+
|
|
610
|
+
:param `event`: a :class:`SpinEvent` event to be processed.
|
|
611
|
+
"""
|
|
612
|
+
|
|
613
|
+
if self._textctrl and self._textctrl.IsModified():
|
|
614
|
+
self.SyncSpinToText(False)
|
|
615
|
+
|
|
616
|
+
if self.InRange(self._value - self._increment*self._spinmodifier):
|
|
617
|
+
|
|
618
|
+
self._value = self._value - self._increment*self._spinmodifier
|
|
619
|
+
self.SetValue(self._value)
|
|
620
|
+
self.DoSendEvent()
|
|
621
|
+
|
|
622
|
+
|
|
623
|
+
def OnTextEnter(self, event):
|
|
624
|
+
"""
|
|
625
|
+
Handles the ``wx.EVT_TEXT_ENTER`` event for :class:`FloatSpin`.
|
|
626
|
+
|
|
627
|
+
:param `event`: a :class:`KeyEvent` event to be processed.
|
|
628
|
+
|
|
629
|
+
:note: This method works on the underlying :class:`TextCtrl`.
|
|
630
|
+
"""
|
|
631
|
+
|
|
632
|
+
self.SyncSpinToText(True)
|
|
633
|
+
event.Skip()
|
|
634
|
+
|
|
635
|
+
|
|
636
|
+
def OnChar(self, event):
|
|
637
|
+
"""
|
|
638
|
+
Handles the ``wx.EVT_CHAR`` event for :class:`FloatSpin`.
|
|
639
|
+
|
|
640
|
+
:param `event`: a :class:`KeyEvent` event to be processed.
|
|
641
|
+
|
|
642
|
+
:note: This method works on the underlying :class:`TextCtrl`.
|
|
643
|
+
"""
|
|
644
|
+
|
|
645
|
+
modifier = FixedPoint(str(1.0), 20)
|
|
646
|
+
if event.ShiftDown():
|
|
647
|
+
modifier = modifier*2.0
|
|
648
|
+
if event.ControlDown():
|
|
649
|
+
modifier = modifier*10.0
|
|
650
|
+
if event.AltDown():
|
|
651
|
+
modifier = modifier*100.0
|
|
652
|
+
|
|
653
|
+
keycode = event.GetKeyCode()
|
|
654
|
+
|
|
655
|
+
if keycode == wx.WXK_UP:
|
|
656
|
+
|
|
657
|
+
if self._textctrl and self._textctrl.IsModified():
|
|
658
|
+
self.SyncSpinToText(False)
|
|
659
|
+
|
|
660
|
+
self.SetValue(self._value + self._increment*modifier)
|
|
661
|
+
self.DoSendEvent()
|
|
662
|
+
|
|
663
|
+
elif keycode == wx.WXK_DOWN:
|
|
664
|
+
|
|
665
|
+
if self._textctrl and self._textctrl.IsModified():
|
|
666
|
+
self.SyncSpinToText(False)
|
|
667
|
+
|
|
668
|
+
self.SetValue(self._value - self._increment*modifier)
|
|
669
|
+
self.DoSendEvent()
|
|
670
|
+
|
|
671
|
+
elif keycode == wx.WXK_PAGEUP:
|
|
672
|
+
|
|
673
|
+
if self._textctrl and self._textctrl.IsModified():
|
|
674
|
+
self.SyncSpinToText(False)
|
|
675
|
+
|
|
676
|
+
self.SetValue(self._value + 10.0*self._increment*modifier)
|
|
677
|
+
self.DoSendEvent()
|
|
678
|
+
|
|
679
|
+
elif keycode == wx.WXK_PAGEDOWN:
|
|
680
|
+
|
|
681
|
+
if self._textctrl and self._textctrl.IsModified():
|
|
682
|
+
self.SyncSpinToText(False)
|
|
683
|
+
|
|
684
|
+
self.SetValue(self._value - 10.0*self._increment*modifier)
|
|
685
|
+
self.DoSendEvent()
|
|
686
|
+
|
|
687
|
+
elif keycode == wx.WXK_SPACE:
|
|
688
|
+
|
|
689
|
+
self.SetValue(self._value)
|
|
690
|
+
event.Skip(False)
|
|
691
|
+
|
|
692
|
+
elif keycode == wx.WXK_ESCAPE:
|
|
693
|
+
|
|
694
|
+
self.SetToDefaultValue()
|
|
695
|
+
self.DoSendEvent()
|
|
696
|
+
|
|
697
|
+
elif keycode == wx.WXK_TAB:
|
|
698
|
+
|
|
699
|
+
new_event = wx.NavigationKeyEvent()
|
|
700
|
+
new_event.SetEventObject(self.GetParent())
|
|
701
|
+
new_event.SetDirection(not event.ShiftDown())
|
|
702
|
+
# CTRL-TAB changes the (parent) window, i.e. switch notebook page
|
|
703
|
+
new_event.SetWindowChange(event.ControlDown())
|
|
704
|
+
new_event.SetCurrentFocus(self)
|
|
705
|
+
self.GetParent().GetEventHandler().ProcessEvent(new_event)
|
|
706
|
+
|
|
707
|
+
else:
|
|
708
|
+
if keycode not in self._validkeycode:
|
|
709
|
+
return
|
|
710
|
+
|
|
711
|
+
event.Skip()
|
|
712
|
+
|
|
713
|
+
|
|
714
|
+
def OnMouseWheel(self, event):
|
|
715
|
+
"""
|
|
716
|
+
Handles the ``wx.EVT_MOUSEWHEEL`` event for :class:`FloatSpin`.
|
|
717
|
+
|
|
718
|
+
:param `event`: a :class:`MouseEvent` event to be processed.
|
|
719
|
+
"""
|
|
720
|
+
|
|
721
|
+
modifier = FixedPoint(str(1.0), 20)
|
|
722
|
+
if event.ShiftDown():
|
|
723
|
+
modifier = modifier*2.0
|
|
724
|
+
if event.ControlDown():
|
|
725
|
+
modifier = modifier*10.0
|
|
726
|
+
if event.AltDown():
|
|
727
|
+
modifier = modifier*100.0
|
|
728
|
+
|
|
729
|
+
if self._textctrl and self._textctrl.IsModified():
|
|
730
|
+
self.SyncSpinToText(False)
|
|
731
|
+
|
|
732
|
+
if event.GetWheelRotation() > 0:
|
|
733
|
+
self.SetValue(self._value + self._increment*modifier)
|
|
734
|
+
self.DoSendEvent()
|
|
735
|
+
|
|
736
|
+
else:
|
|
737
|
+
|
|
738
|
+
self.SetValue(self._value - self._increment*modifier)
|
|
739
|
+
self.DoSendEvent()
|
|
740
|
+
|
|
741
|
+
|
|
742
|
+
def OnSize(self, event):
|
|
743
|
+
"""
|
|
744
|
+
Handles the ``wx.EVT_SIZE`` event for :class:`FloatSpin`.
|
|
745
|
+
|
|
746
|
+
:param `event`: a :class:`wx.SizeEvent` event to be processed.
|
|
747
|
+
|
|
748
|
+
:note: This method resizes the text control and reposition the spin button when
|
|
749
|
+
resized.
|
|
750
|
+
"""
|
|
751
|
+
# start Philip Semanchuk addition
|
|
752
|
+
event_width = event.GetSize().width
|
|
753
|
+
|
|
754
|
+
self._textctrl.SetPosition((self._text_left, self._text_top))
|
|
755
|
+
|
|
756
|
+
text_width, text_height = self._textctrl.GetSize()
|
|
757
|
+
|
|
758
|
+
spin_width, _ = self._spinbutton.GetSize()
|
|
759
|
+
|
|
760
|
+
text_width = event_width - (spin_width + self._gap + self._text_left)
|
|
761
|
+
|
|
762
|
+
self._textctrl.SetSize(wx.Size(text_width, event.GetSize().height))
|
|
763
|
+
|
|
764
|
+
# The spin button is always snug against the right edge of the
|
|
765
|
+
# control.
|
|
766
|
+
self._spinbutton.SetPosition((event_width - spin_width, self._spin_top))
|
|
767
|
+
|
|
768
|
+
event.Skip()
|
|
769
|
+
# end Philip Semanchuk addition
|
|
770
|
+
|
|
771
|
+
|
|
772
|
+
def ReplaceDoubleZero(self, strs):
|
|
773
|
+
"""
|
|
774
|
+
Replaces the (somewhat) python ugly `+e000` with `+e00`.
|
|
775
|
+
|
|
776
|
+
:param `strs`: a string (possibly) containing a `+e00` substring.
|
|
777
|
+
"""
|
|
778
|
+
|
|
779
|
+
if self._textformat not in ["%g", "%e", "%E", "%G"]:
|
|
780
|
+
return strs
|
|
781
|
+
|
|
782
|
+
if strs.find("e+00") >= 0:
|
|
783
|
+
strs = strs.replace("e+00", "e+0")
|
|
784
|
+
elif strs.find("e-00") >= 0:
|
|
785
|
+
strs = strs.replace("e-00", "e-0")
|
|
786
|
+
elif strs.find("E+00") >= 0:
|
|
787
|
+
strs = strs.replace("E+00", "E+0")
|
|
788
|
+
elif strs.find("E-00") >= 0:
|
|
789
|
+
strs = strs.replace("E-00", "E-0")
|
|
790
|
+
|
|
791
|
+
return strs
|
|
792
|
+
|
|
793
|
+
|
|
794
|
+
def SetValue(self, value):
|
|
795
|
+
"""
|
|
796
|
+
Sets the :class:`FloatSpin` value.
|
|
797
|
+
|
|
798
|
+
:param `value`: the new value.
|
|
799
|
+
"""
|
|
800
|
+
if not self._textctrl or not self.InRange(value):
|
|
801
|
+
return
|
|
802
|
+
|
|
803
|
+
if self._snapticks and self._increment != 0.0:
|
|
804
|
+
|
|
805
|
+
finite, snap_value = self.IsFinite(value)
|
|
806
|
+
|
|
807
|
+
if not finite: # FIXME What To Do About A Failure?
|
|
808
|
+
|
|
809
|
+
if (snap_value - floor(snap_value) < ceil(snap_value) - snap_value):
|
|
810
|
+
value = self._defaultvalue + floor(snap_value)*self._increment
|
|
811
|
+
else:
|
|
812
|
+
value = self._defaultvalue + ceil(snap_value)*self._increment
|
|
813
|
+
|
|
814
|
+
decimal = locale.localeconv()["decimal_point"]
|
|
815
|
+
strs = ("%100." + str(self._digits) + self._textformat[1])%value
|
|
816
|
+
strs = strs.replace(".", decimal)
|
|
817
|
+
strs = strs.strip()
|
|
818
|
+
strs = self.ReplaceDoubleZero(strs)
|
|
819
|
+
|
|
820
|
+
if value != self._value or strs != self._textctrl.GetValue():
|
|
821
|
+
|
|
822
|
+
self._textctrl.SetValue(strs)
|
|
823
|
+
self._textctrl.DiscardEdits()
|
|
824
|
+
self._value = value
|
|
825
|
+
|
|
826
|
+
|
|
827
|
+
def GetValue(self):
|
|
828
|
+
""" Returns the :class:`FloatSpin` value. """
|
|
829
|
+
|
|
830
|
+
return float(self._value)
|
|
831
|
+
|
|
832
|
+
|
|
833
|
+
def SetRangeDontClampValue(self, min_val, max_val):
|
|
834
|
+
"""
|
|
835
|
+
Sets the allowed range.
|
|
836
|
+
|
|
837
|
+
:param `min_val`: the minimum value for :class:`FloatSpin`. If it is ``None`` it is
|
|
838
|
+
ignored;
|
|
839
|
+
:param `max_val`: the maximum value for :class:`FloatSpin`. If it is ``None`` it is
|
|
840
|
+
ignored.
|
|
841
|
+
|
|
842
|
+
:note: This method doesn't modify the current value.
|
|
843
|
+
"""
|
|
844
|
+
|
|
845
|
+
if (min_val is not None):
|
|
846
|
+
self._min = FixedPoint(str(min_val), 20)
|
|
847
|
+
else:
|
|
848
|
+
self._min = None
|
|
849
|
+
if (max_val is not None):
|
|
850
|
+
self._max = FixedPoint(str(max_val), 20)
|
|
851
|
+
else:
|
|
852
|
+
self._max = None
|
|
853
|
+
|
|
854
|
+
|
|
855
|
+
def SetRange(self, min_val, max_val):
|
|
856
|
+
"""
|
|
857
|
+
Sets the allowed range.
|
|
858
|
+
|
|
859
|
+
:param `min_val`: the minimum value for :class:`FloatSpin`. If it is ``None`` it is
|
|
860
|
+
ignored;
|
|
861
|
+
:param `max_val`: the maximum value for :class:`FloatSpin`. If it is ``None`` it is
|
|
862
|
+
ignored.
|
|
863
|
+
|
|
864
|
+
:note: This method doesn't modify the current value.
|
|
865
|
+
|
|
866
|
+
:note: You specify open ranges like this (you can equally do this in the
|
|
867
|
+
constructor)::
|
|
868
|
+
|
|
869
|
+
SetRange(min_val=1, max_val=None)
|
|
870
|
+
SetRange(min_val=None, max_val=0)
|
|
871
|
+
|
|
872
|
+
|
|
873
|
+
or no range::
|
|
874
|
+
|
|
875
|
+
SetRange(min_val=None, max_val=None)
|
|
876
|
+
|
|
877
|
+
"""
|
|
878
|
+
|
|
879
|
+
self.SetRangeDontClampValue(min_val, max_val)
|
|
880
|
+
|
|
881
|
+
value = self.ClampValue(self._value)
|
|
882
|
+
if (value != self._value):
|
|
883
|
+
self.SetValue(value)
|
|
884
|
+
|
|
885
|
+
|
|
886
|
+
def ClampValue(self, var):
|
|
887
|
+
"""
|
|
888
|
+
Clamps `var` between `_min` and `_max` depending if the range has
|
|
889
|
+
been specified.
|
|
890
|
+
|
|
891
|
+
:param `var`: the value to be clamped.
|
|
892
|
+
|
|
893
|
+
:return: A clamped copy of `var`.
|
|
894
|
+
"""
|
|
895
|
+
|
|
896
|
+
if (self._min is not None):
|
|
897
|
+
if (var < self._min):
|
|
898
|
+
var = self._min
|
|
899
|
+
return var
|
|
900
|
+
|
|
901
|
+
if (self._max is not None):
|
|
902
|
+
if (var > self._max):
|
|
903
|
+
var = self._max
|
|
904
|
+
|
|
905
|
+
return var
|
|
906
|
+
|
|
907
|
+
|
|
908
|
+
def SetIncrement(self, increment):
|
|
909
|
+
"""
|
|
910
|
+
Sets the increment for every ``EVT_FLOATSPIN`` event.
|
|
911
|
+
|
|
912
|
+
:param `increment`: a floating point number specifying the :class:`FloatSpin` increment.
|
|
913
|
+
"""
|
|
914
|
+
|
|
915
|
+
if increment < 1./10.0**self._digits:
|
|
916
|
+
raise Exception("\nERROR: Increment Should Be Greater Or Equal To 1/(10**digits).")
|
|
917
|
+
|
|
918
|
+
self._increment = FixedPoint(str(increment), 20)
|
|
919
|
+
self.SetValue(self._value)
|
|
920
|
+
|
|
921
|
+
|
|
922
|
+
def GetIncrement(self):
|
|
923
|
+
""" Returns the increment for every ``EVT_FLOATSPIN`` event. """
|
|
924
|
+
|
|
925
|
+
return self._increment
|
|
926
|
+
|
|
927
|
+
|
|
928
|
+
def SetDigits(self, digits=-1):
|
|
929
|
+
"""
|
|
930
|
+
Sets the number of digits to show.
|
|
931
|
+
|
|
932
|
+
:param `digits`: the number of digits to show. If `digits` < 0, :class:`FloatSpin`
|
|
933
|
+
tries to calculate the best number of digits based on input values passed
|
|
934
|
+
in the constructor.
|
|
935
|
+
"""
|
|
936
|
+
|
|
937
|
+
if digits < 0:
|
|
938
|
+
incr = str(self._increment)
|
|
939
|
+
if incr.find(".") < 0:
|
|
940
|
+
digits = 0
|
|
941
|
+
else:
|
|
942
|
+
digits = len(incr[incr.find(".")+1:])
|
|
943
|
+
|
|
944
|
+
self._digits = digits
|
|
945
|
+
|
|
946
|
+
self.SetValue(self._value)
|
|
947
|
+
|
|
948
|
+
|
|
949
|
+
def GetDigits(self):
|
|
950
|
+
""" Returns the number of digits shown. """
|
|
951
|
+
|
|
952
|
+
return self._digits
|
|
953
|
+
|
|
954
|
+
|
|
955
|
+
def SetFormat(self, fmt="%f"):
|
|
956
|
+
"""
|
|
957
|
+
Set the string format to use.
|
|
958
|
+
|
|
959
|
+
:param `fmt`: the new string format to use. One of the following strings:
|
|
960
|
+
|
|
961
|
+
====== =================================
|
|
962
|
+
Format Description
|
|
963
|
+
====== =================================
|
|
964
|
+
'e' Floating point exponential format (lowercase)
|
|
965
|
+
'E' Floating point exponential format (uppercase)
|
|
966
|
+
'f' Floating point decimal format
|
|
967
|
+
'F' Floating point decimal format
|
|
968
|
+
'g' Floating point format. Uses lowercase exponential format if exponent is less than -4 or not less than precision, decimal format otherwise
|
|
969
|
+
'G' Floating point format. Uses uppercase exponential format if exponent is less than -4 or not less than precision, decimal format otherwise
|
|
970
|
+
====== =================================
|
|
971
|
+
|
|
972
|
+
"""
|
|
973
|
+
|
|
974
|
+
if fmt not in ["%f", "%g", "%e", "%E", "%F", "%G"]:
|
|
975
|
+
raise Exception('\nERROR: Bad Float Number Format: ' + repr(fmt) + '. It Should Be ' \
|
|
976
|
+
'One Of "%f", "%g", "%e", "%E", "%F", "%G"')
|
|
977
|
+
|
|
978
|
+
self._textformat = fmt
|
|
979
|
+
|
|
980
|
+
if self._digits < 0:
|
|
981
|
+
self.SetDigits()
|
|
982
|
+
|
|
983
|
+
self.SetValue(self._value)
|
|
984
|
+
|
|
985
|
+
|
|
986
|
+
def GetFormat(self):
|
|
987
|
+
"""
|
|
988
|
+
Returns the string format in use.
|
|
989
|
+
|
|
990
|
+
:see: :meth:`~FloatSpin.SetFormat` for a list of valid string formats.
|
|
991
|
+
"""
|
|
992
|
+
|
|
993
|
+
return self._textformat
|
|
994
|
+
|
|
995
|
+
|
|
996
|
+
def SetDefaultValue(self, defaultvalue):
|
|
997
|
+
"""
|
|
998
|
+
Sets the :class:`FloatSpin` default value.
|
|
999
|
+
|
|
1000
|
+
:param `defaultvalue`: a floating point value representing the new default
|
|
1001
|
+
value for :class:`FloatSpin`.
|
|
1002
|
+
"""
|
|
1003
|
+
|
|
1004
|
+
if self.InRange(defaultvalue):
|
|
1005
|
+
self._defaultvalue = FixedPoint(str(defaultvalue), 20)
|
|
1006
|
+
|
|
1007
|
+
|
|
1008
|
+
def GetDefaultValue(self):
|
|
1009
|
+
""" Returns the :class:`FloatSpin` default value. """
|
|
1010
|
+
|
|
1011
|
+
return self._defaultvalue
|
|
1012
|
+
|
|
1013
|
+
|
|
1014
|
+
def IsDefaultValue(self):
|
|
1015
|
+
""" Returns whether the current value is the default value or not. """
|
|
1016
|
+
|
|
1017
|
+
return self._value == self._defaultvalue
|
|
1018
|
+
|
|
1019
|
+
|
|
1020
|
+
def SetToDefaultValue(self):
|
|
1021
|
+
""" Sets :class:`FloatSpin` value to its default value. """
|
|
1022
|
+
|
|
1023
|
+
self.SetValue(self._defaultvalue)
|
|
1024
|
+
|
|
1025
|
+
|
|
1026
|
+
def SetSnapToTicks(self, forceticks=True):
|
|
1027
|
+
"""
|
|
1028
|
+
Force the value to always be divisible by the increment. Initially ``False``.
|
|
1029
|
+
|
|
1030
|
+
:param `forceticks`: ``True`` to force the snap to ticks option, ``False`` otherwise.
|
|
1031
|
+
|
|
1032
|
+
:note: This uses the default value as the basis, you will get strange results
|
|
1033
|
+
for very large differences between the current value and default value
|
|
1034
|
+
when the increment is very small.
|
|
1035
|
+
"""
|
|
1036
|
+
|
|
1037
|
+
if self._snapticks != forceticks:
|
|
1038
|
+
|
|
1039
|
+
self._snapticks = forceticks
|
|
1040
|
+
self.SetValue(self._value)
|
|
1041
|
+
|
|
1042
|
+
|
|
1043
|
+
def GetSnapToTicks(self):
|
|
1044
|
+
""" Returns whether the snap to ticks option is active or not. """
|
|
1045
|
+
|
|
1046
|
+
return self._snapticks
|
|
1047
|
+
|
|
1048
|
+
|
|
1049
|
+
def OnFocus(self, event):
|
|
1050
|
+
"""
|
|
1051
|
+
Handles the ``wx.EVT_SET_FOCUS`` event for :class:`FloatSpin`.
|
|
1052
|
+
|
|
1053
|
+
:param `event`: a :class:`FocusEvent` event to be processed.
|
|
1054
|
+
"""
|
|
1055
|
+
|
|
1056
|
+
if self._textctrl:
|
|
1057
|
+
self._textctrl.SetFocus()
|
|
1058
|
+
|
|
1059
|
+
event.Skip()
|
|
1060
|
+
|
|
1061
|
+
|
|
1062
|
+
def OnKillFocus(self, event):
|
|
1063
|
+
"""
|
|
1064
|
+
Handles the ``wx.EVT_KILL_FOCUS`` event for :class:`FloatSpin`.
|
|
1065
|
+
|
|
1066
|
+
:param `event`: a :class:`FocusEvent` event to be processed.
|
|
1067
|
+
"""
|
|
1068
|
+
|
|
1069
|
+
self.SyncSpinToText(True)
|
|
1070
|
+
event.Skip()
|
|
1071
|
+
|
|
1072
|
+
|
|
1073
|
+
def SyncSpinToText(self, send_event=True, force_valid=True):
|
|
1074
|
+
"""
|
|
1075
|
+
Synchronize the underlying :class:`TextCtrl` with :class:`SpinButton`.
|
|
1076
|
+
|
|
1077
|
+
:param `send_event`: ``True`` to send a ``EVT_FLOATSPIN`` event, ``False``
|
|
1078
|
+
otherwise;
|
|
1079
|
+
:param `force_valid`: ``True`` to force a valid value (i.e. inside the
|
|
1080
|
+
provided range), ``False`` otherwise.
|
|
1081
|
+
"""
|
|
1082
|
+
|
|
1083
|
+
if not self._textctrl:
|
|
1084
|
+
return
|
|
1085
|
+
|
|
1086
|
+
curr = self._textctrl.GetValue()
|
|
1087
|
+
curr = curr.strip()
|
|
1088
|
+
decimal = locale.localeconv()["decimal_point"]
|
|
1089
|
+
curr = curr.replace(decimal, ".")
|
|
1090
|
+
|
|
1091
|
+
if curr:
|
|
1092
|
+
try:
|
|
1093
|
+
curro = float(curr)
|
|
1094
|
+
curr = FixedPoint(curr, 20)
|
|
1095
|
+
except:
|
|
1096
|
+
self.SetValue(self._value)
|
|
1097
|
+
return
|
|
1098
|
+
|
|
1099
|
+
if force_valid or not self.HasRange() or self.InRange(curr):
|
|
1100
|
+
|
|
1101
|
+
if force_valid and self.HasRange():
|
|
1102
|
+
|
|
1103
|
+
curr = self.ClampValue(curr)
|
|
1104
|
+
|
|
1105
|
+
if self._value != curr:
|
|
1106
|
+
self.SetValue(curr)
|
|
1107
|
+
|
|
1108
|
+
if send_event:
|
|
1109
|
+
self.DoSendEvent()
|
|
1110
|
+
|
|
1111
|
+
elif force_valid:
|
|
1112
|
+
|
|
1113
|
+
# textctrl is out of sync, discard and reset
|
|
1114
|
+
self.SetValue(self.GetValue())
|
|
1115
|
+
|
|
1116
|
+
|
|
1117
|
+
def SetFont(self, font=None):
|
|
1118
|
+
"""
|
|
1119
|
+
Sets the underlying :class:`TextCtrl` font.
|
|
1120
|
+
|
|
1121
|
+
:param `font`: a valid instance of :class:`wx.Font`.
|
|
1122
|
+
"""
|
|
1123
|
+
|
|
1124
|
+
if font is None:
|
|
1125
|
+
font = wx.SystemSettings.GetFont(wx.SYS_DEFAULT_GUI_FONT)
|
|
1126
|
+
|
|
1127
|
+
if not self._textctrl:
|
|
1128
|
+
return False
|
|
1129
|
+
|
|
1130
|
+
return self._textctrl.SetFont(font)
|
|
1131
|
+
|
|
1132
|
+
|
|
1133
|
+
def GetFont(self):
|
|
1134
|
+
""" Returns the underlying :class:`TextCtrl` font. """
|
|
1135
|
+
|
|
1136
|
+
if not self._textctrl:
|
|
1137
|
+
return self.GetFont()
|
|
1138
|
+
|
|
1139
|
+
return self._textctrl.GetFont()
|
|
1140
|
+
|
|
1141
|
+
|
|
1142
|
+
def GetMin(self):
|
|
1143
|
+
"""
|
|
1144
|
+
Returns the minimum value for :class:`FloatSpin`. It can be a
|
|
1145
|
+
number or ``None`` if no minimum is present.
|
|
1146
|
+
"""
|
|
1147
|
+
|
|
1148
|
+
return self._min
|
|
1149
|
+
|
|
1150
|
+
|
|
1151
|
+
def SetMin(self, min_val):
|
|
1152
|
+
"""
|
|
1153
|
+
Sets the minimum value for :class:`FloatSpin`.
|
|
1154
|
+
|
|
1155
|
+
:param `min_val`: the minimum value for :class:`FloatSpin`. If it is ``None`` it is
|
|
1156
|
+
ignored.
|
|
1157
|
+
|
|
1158
|
+
:note: This method doesn't modify the current value.
|
|
1159
|
+
"""
|
|
1160
|
+
|
|
1161
|
+
if (min_val is not None):
|
|
1162
|
+
self._min = FixedPoint(str(min_val), 20)
|
|
1163
|
+
else:
|
|
1164
|
+
self._min = None
|
|
1165
|
+
|
|
1166
|
+
|
|
1167
|
+
def GetMax(self):
|
|
1168
|
+
"""
|
|
1169
|
+
Returns the maximum value for :class:`FloatSpin`. It can be a
|
|
1170
|
+
number or ``None`` if no minimum is present.
|
|
1171
|
+
"""
|
|
1172
|
+
|
|
1173
|
+
return self._max
|
|
1174
|
+
|
|
1175
|
+
|
|
1176
|
+
def SetMax(self, max_val):
|
|
1177
|
+
"""
|
|
1178
|
+
Sets the maximum value for :class:`FloatSpin`.
|
|
1179
|
+
|
|
1180
|
+
:param `max_val`: the maximum value for :class:`FloatSpin`. If it is ``None`` it is
|
|
1181
|
+
ignored.
|
|
1182
|
+
|
|
1183
|
+
:note: This method doesn't modify the current value.
|
|
1184
|
+
"""
|
|
1185
|
+
|
|
1186
|
+
if (max_val is not None):
|
|
1187
|
+
self._max = FixedPoint(str(max_val), 20)
|
|
1188
|
+
else:
|
|
1189
|
+
self._max = None
|
|
1190
|
+
|
|
1191
|
+
|
|
1192
|
+
def HasRange(self):
|
|
1193
|
+
""" Returns whether :class:`FloatSpin` range has been set or not. """
|
|
1194
|
+
|
|
1195
|
+
return (self._min is not None) or (self._max is not None)
|
|
1196
|
+
|
|
1197
|
+
|
|
1198
|
+
def InRange(self, value):
|
|
1199
|
+
"""
|
|
1200
|
+
Returns whether a value is inside :class:`FloatSpin` range.
|
|
1201
|
+
|
|
1202
|
+
:param `value`: the value to test.
|
|
1203
|
+
"""
|
|
1204
|
+
|
|
1205
|
+
if (not self.HasRange()):
|
|
1206
|
+
return True
|
|
1207
|
+
if (self._min is not None):
|
|
1208
|
+
if (value < self._min):
|
|
1209
|
+
return False
|
|
1210
|
+
if (self._max is not None):
|
|
1211
|
+
if (value > self._max):
|
|
1212
|
+
return False
|
|
1213
|
+
return True
|
|
1214
|
+
|
|
1215
|
+
|
|
1216
|
+
def GetTextCtrl(self):
|
|
1217
|
+
""" Returns the underlying :class:`TextCtrl`. """
|
|
1218
|
+
|
|
1219
|
+
return self._textctrl
|
|
1220
|
+
|
|
1221
|
+
|
|
1222
|
+
def IsFinite(self, value):
|
|
1223
|
+
"""
|
|
1224
|
+
Tries to determine if a value is finite or infinite/NaN.
|
|
1225
|
+
|
|
1226
|
+
:param `value`: the value to test.
|
|
1227
|
+
"""
|
|
1228
|
+
|
|
1229
|
+
try:
|
|
1230
|
+
snap_value = (value - self._defaultvalue)/self._increment
|
|
1231
|
+
finite = True
|
|
1232
|
+
except:
|
|
1233
|
+
finite = False
|
|
1234
|
+
snap_value = None
|
|
1235
|
+
|
|
1236
|
+
return finite, snap_value
|
|
1237
|
+
|
|
1238
|
+
|
|
1239
|
+
DefaultValue = property(GetDefaultValue, SetDefaultValue)
|
|
1240
|
+
Digits = property(GetDigits, SetDigits)
|
|
1241
|
+
Font = property(GetFont, SetFont)
|
|
1242
|
+
Format = property(GetFormat, SetFormat)
|
|
1243
|
+
Increment = property(GetIncrement, SetIncrement)
|
|
1244
|
+
Min = property(GetMin, SetMin)
|
|
1245
|
+
Max = property(GetMax, SetMax)
|
|
1246
|
+
Value = property(GetValue, SetValue)
|
|
1247
|
+
|
|
1248
|
+
|
|
1249
|
+
|
|
1250
|
+
# Class FixedPoint, version 0.0.4.
|
|
1251
|
+
# Released to the public domain 28-Mar-2001,
|
|
1252
|
+
# by Tim Peters (tim.one@home.com).
|
|
1253
|
+
|
|
1254
|
+
# Provided as-is; use at your own risk; no warranty; no promises; enjoy!
|
|
1255
|
+
|
|
1256
|
+
|
|
1257
|
+
# 28-Mar-01 ver 0.0,4
|
|
1258
|
+
# Use repr() instead of str() inside __str__, because str(long) changed
|
|
1259
|
+
# since this was first written (used to produce trailing "L", doesn't
|
|
1260
|
+
# now).
|
|
1261
|
+
#
|
|
1262
|
+
# 09-May-99 ver 0,0,3
|
|
1263
|
+
# Repaired __sub__(FixedPoint, string); was blowing up.
|
|
1264
|
+
# Much more careful conversion of float (now best possible).
|
|
1265
|
+
# Implemented exact % and divmod.
|
|
1266
|
+
#
|
|
1267
|
+
# 14-Oct-98 ver 0,0,2
|
|
1268
|
+
# Added int, long, frac. Beefed up docs. Removed DECIMAL_POINT
|
|
1269
|
+
# and MINUS_SIGN globals to discourage bloating this class instead
|
|
1270
|
+
# of writing formatting wrapper classes (or subclasses)
|
|
1271
|
+
#
|
|
1272
|
+
# 11-Oct-98 ver 0,0,1
|
|
1273
|
+
# posted to c.l.py
|
|
1274
|
+
|
|
1275
|
+
__version__ = 0, 0, 4
|
|
1276
|
+
|
|
1277
|
+
# The default value for the number of decimal digits carried after the
|
|
1278
|
+
# decimal point. This only has effect at compile-time.
|
|
1279
|
+
DEFAULT_PRECISION = 2
|
|
1280
|
+
""" The default value for the number of decimal digits carried after the decimal point. This only has effect at compile-time. """
|
|
1281
|
+
|
|
1282
|
+
class FixedPoint(object):
|
|
1283
|
+
"""
|
|
1284
|
+
FixedPoint objects support decimal arithmetic with a fixed number of
|
|
1285
|
+
digits (called the object's precision) after the decimal point. The
|
|
1286
|
+
number of digits before the decimal point is variable & unbounded.
|
|
1287
|
+
|
|
1288
|
+
The precision is user-settable on a per-object basis when a FixedPoint
|
|
1289
|
+
is constructed, and may vary across FixedPoint objects. The precision
|
|
1290
|
+
may also be changed after construction via `FixedPoint.set_precision(p)`.
|
|
1291
|
+
Note that if the precision of a FixedPoint is reduced via :meth:`FixedPoint.set_precision() <FixedPoint.set_precision>`,
|
|
1292
|
+
information may be lost to rounding.
|
|
1293
|
+
|
|
1294
|
+
Example::
|
|
1295
|
+
|
|
1296
|
+
>>> x = FixedPoint("5.55") # precision defaults to 2
|
|
1297
|
+
>>> print(x)
|
|
1298
|
+
5.55
|
|
1299
|
+
>>> x.set_precision(1) # round to one fraction digit
|
|
1300
|
+
>>> print(x)
|
|
1301
|
+
5.6
|
|
1302
|
+
>>> print(FixedPoint("5.55", 1)) # same thing setting to 1 in constructor
|
|
1303
|
+
5.6
|
|
1304
|
+
>>> repr(x) # returns constructor string that reproduces object exactly
|
|
1305
|
+
"FixedPoint('5.6', 1)"
|
|
1306
|
+
>>>
|
|
1307
|
+
|
|
1308
|
+
|
|
1309
|
+
When :class:`FixedPoint` objects of different precision are combined via + - * /,
|
|
1310
|
+
the result is computed to the larger of the inputs' precisions, which also
|
|
1311
|
+
becomes the precision of the resulting :class:`FixedPoint` object. Example::
|
|
1312
|
+
|
|
1313
|
+
>>> print FixedPoint("3.42") + FixedPoint("100.005", 3)
|
|
1314
|
+
103.425
|
|
1315
|
+
>>>
|
|
1316
|
+
|
|
1317
|
+
|
|
1318
|
+
When a :class:`FixedPoint` is combined with other numeric types (ints, floats,
|
|
1319
|
+
strings representing a number) via + - * /, then similarly the computation
|
|
1320
|
+
is carried out using -- and the result inherits -- the :class:`FixedPoint`'s
|
|
1321
|
+
precision. Example::
|
|
1322
|
+
|
|
1323
|
+
>>> print(FixedPoint(1) / 7)
|
|
1324
|
+
0.14
|
|
1325
|
+
>>> print(FixedPoint(1, 30) / 7)
|
|
1326
|
+
0.142857142857142857142857142857
|
|
1327
|
+
>>>
|
|
1328
|
+
|
|
1329
|
+
|
|
1330
|
+
The string produced by `str(x)` (implictly invoked by `print`) always
|
|
1331
|
+
contains at least one digit before the decimal point, followed by a
|
|
1332
|
+
decimal point, followed by exactly `x.get_precision()` digits. If `x` is
|
|
1333
|
+
negative, `str(x)[0] == "-"`.
|
|
1334
|
+
|
|
1335
|
+
The :class:`FixedPoint` constructor can be passed an int, long, string, float,
|
|
1336
|
+
:class:`FixedPoint`, or any object convertible to a float via `float()` or to an
|
|
1337
|
+
integer via `int()`. Passing a precision is optional; if specified, the
|
|
1338
|
+
precision must be a non-negative int. There is no inherent limit on
|
|
1339
|
+
the size of the precision, but if very very large you'll probably run
|
|
1340
|
+
out of memory.
|
|
1341
|
+
|
|
1342
|
+
Note that conversion of floats to :class:`FixedPoint` can be surprising, and
|
|
1343
|
+
should be avoided whenever possible. Conversion from string is exact
|
|
1344
|
+
(up to final rounding to the requested precision), so is greatly
|
|
1345
|
+
preferred. Example::
|
|
1346
|
+
|
|
1347
|
+
>>> print(FixedPoint(1.1e30))
|
|
1348
|
+
1099999999999999993725589651456.00
|
|
1349
|
+
>>> print(FixedPoint("1.1e30"))
|
|
1350
|
+
1100000000000000000000000000000.00
|
|
1351
|
+
>>>
|
|
1352
|
+
|
|
1353
|
+
|
|
1354
|
+
"""
|
|
1355
|
+
|
|
1356
|
+
# the exact value is self.n / 10**self.p;
|
|
1357
|
+
# self.n is a long; self.p is an int
|
|
1358
|
+
|
|
1359
|
+
def __init__(self, value=0, precision=DEFAULT_PRECISION):
|
|
1360
|
+
"""
|
|
1361
|
+
Default class constructor.
|
|
1362
|
+
|
|
1363
|
+
:param `value`: the initial value;
|
|
1364
|
+
:param `precision`: must be an int >= 0, and defaults to ``DEFAULT_PRECISION``.
|
|
1365
|
+
"""
|
|
1366
|
+
|
|
1367
|
+
self.n = self.p = 0
|
|
1368
|
+
self.set_precision(precision)
|
|
1369
|
+
p = self.p
|
|
1370
|
+
|
|
1371
|
+
if isinstance(value, type("42.3e5")):
|
|
1372
|
+
n, exp = _string2exact(value)
|
|
1373
|
+
# exact value is n*10**exp = n*10**(exp+p)/10**p
|
|
1374
|
+
effective_exp = exp + p
|
|
1375
|
+
if effective_exp > 0:
|
|
1376
|
+
n = n * _tento(effective_exp)
|
|
1377
|
+
elif effective_exp < 0:
|
|
1378
|
+
n = _roundquotient(n, _tento(-effective_exp))
|
|
1379
|
+
self.n = n
|
|
1380
|
+
return
|
|
1381
|
+
|
|
1382
|
+
if isinstance(value, six.integer_types):
|
|
1383
|
+
self.n = int(value) * _tento(p)
|
|
1384
|
+
return
|
|
1385
|
+
|
|
1386
|
+
if isinstance(value, FixedPoint):
|
|
1387
|
+
temp = value.copy()
|
|
1388
|
+
temp.set_precision(p)
|
|
1389
|
+
self.n, self.p = temp.n, temp.p
|
|
1390
|
+
return
|
|
1391
|
+
|
|
1392
|
+
if isinstance(value, type(42.0)):
|
|
1393
|
+
# XXX ignoring infinities and NaNs and overflows for now
|
|
1394
|
+
import math
|
|
1395
|
+
f, e = math.frexp(abs(value))
|
|
1396
|
+
assert f == 0 or 0.5 <= f < 1.0
|
|
1397
|
+
# |value| = f * 2**e exactly
|
|
1398
|
+
|
|
1399
|
+
# Suck up CHUNK bits at a time; 28 is enough so that we suck
|
|
1400
|
+
# up all bits in 2 iterations for all known binary double-
|
|
1401
|
+
# precision formats, and small enough to fit in an int.
|
|
1402
|
+
CHUNK = 28
|
|
1403
|
+
top = 0
|
|
1404
|
+
# invariant: |value| = (top + f) * 2**e exactly
|
|
1405
|
+
while f:
|
|
1406
|
+
f = math.ldexp(f, CHUNK)
|
|
1407
|
+
digit = int(f)
|
|
1408
|
+
assert digit >> CHUNK == 0
|
|
1409
|
+
top = (top << CHUNK) | digit
|
|
1410
|
+
f = f - digit
|
|
1411
|
+
assert 0.0 <= f < 1.0
|
|
1412
|
+
e = e - CHUNK
|
|
1413
|
+
|
|
1414
|
+
# now |value| = top * 2**e exactly
|
|
1415
|
+
# want n such that n / 10**p = top * 2**e, or
|
|
1416
|
+
# n = top * 10**p * 2**e
|
|
1417
|
+
top = top * _tento(p)
|
|
1418
|
+
if e >= 0:
|
|
1419
|
+
n = top << e
|
|
1420
|
+
else:
|
|
1421
|
+
n = _roundquotient(top, 1 << -e)
|
|
1422
|
+
if value < 0:
|
|
1423
|
+
n = -n
|
|
1424
|
+
self.n = n
|
|
1425
|
+
return
|
|
1426
|
+
|
|
1427
|
+
if isinstance(value, type(42-42j)):
|
|
1428
|
+
raise TypeError("can't convert complex to FixedPoint: " +
|
|
1429
|
+
repr(value))
|
|
1430
|
+
|
|
1431
|
+
# can we coerce to a float?
|
|
1432
|
+
yes = 1
|
|
1433
|
+
try:
|
|
1434
|
+
asfloat = float(value)
|
|
1435
|
+
except:
|
|
1436
|
+
yes = 0
|
|
1437
|
+
if yes:
|
|
1438
|
+
self.__init__(asfloat, p)
|
|
1439
|
+
return
|
|
1440
|
+
|
|
1441
|
+
# similarly for long
|
|
1442
|
+
yes = 1
|
|
1443
|
+
try:
|
|
1444
|
+
aslong = int(value)
|
|
1445
|
+
except:
|
|
1446
|
+
yes = 0
|
|
1447
|
+
if yes:
|
|
1448
|
+
self.__init__(aslong, p)
|
|
1449
|
+
return
|
|
1450
|
+
|
|
1451
|
+
raise TypeError("can't convert to FixedPoint: " + repr(value))
|
|
1452
|
+
|
|
1453
|
+
|
|
1454
|
+
def get_precision(self):
|
|
1455
|
+
"""
|
|
1456
|
+
Return the precision of this :class:`FixedPoint`.
|
|
1457
|
+
|
|
1458
|
+
:note: The precision is the number of decimal digits carried after
|
|
1459
|
+
the decimal point, and is an int >= 0.
|
|
1460
|
+
"""
|
|
1461
|
+
|
|
1462
|
+
return self.p
|
|
1463
|
+
|
|
1464
|
+
|
|
1465
|
+
def set_precision(self, precision=DEFAULT_PRECISION):
|
|
1466
|
+
"""
|
|
1467
|
+
Change the precision carried by this :class:`FixedPoint` to `precision`.
|
|
1468
|
+
|
|
1469
|
+
:param `precision`: must be an int >= 0, and defaults to
|
|
1470
|
+
``DEFAULT_PRECISION``.
|
|
1471
|
+
|
|
1472
|
+
:note: If `precision` is less than this :class:`FixedPoint`'s current precision,
|
|
1473
|
+
information may be lost to rounding.
|
|
1474
|
+
"""
|
|
1475
|
+
|
|
1476
|
+
try:
|
|
1477
|
+
p = int(precision)
|
|
1478
|
+
except:
|
|
1479
|
+
raise TypeError("precision not convertable to int: " +
|
|
1480
|
+
repr(precision))
|
|
1481
|
+
if p < 0:
|
|
1482
|
+
raise ValueError("precision must be >= 0: " + repr(precision))
|
|
1483
|
+
|
|
1484
|
+
if p > self.p:
|
|
1485
|
+
self.n = self.n * _tento(p - self.p)
|
|
1486
|
+
elif p < self.p:
|
|
1487
|
+
self.n = _roundquotient(self.n, _tento(self.p - p))
|
|
1488
|
+
self.p = p
|
|
1489
|
+
|
|
1490
|
+
|
|
1491
|
+
def __str__(self):
|
|
1492
|
+
|
|
1493
|
+
n, p = self.n, self.p
|
|
1494
|
+
i, f = divmod(abs(n), _tento(p))
|
|
1495
|
+
if p:
|
|
1496
|
+
frac = repr(f)[:-1]
|
|
1497
|
+
frac = "0" * (p - len(frac)) + frac
|
|
1498
|
+
else:
|
|
1499
|
+
frac = ""
|
|
1500
|
+
return "-"[:n<0] + \
|
|
1501
|
+
repr(i)[:-1] + \
|
|
1502
|
+
"." + frac
|
|
1503
|
+
|
|
1504
|
+
|
|
1505
|
+
def __repr__(self):
|
|
1506
|
+
|
|
1507
|
+
return "FixedPoint" + repr((str(self), self.p))
|
|
1508
|
+
|
|
1509
|
+
|
|
1510
|
+
def copy(self):
|
|
1511
|
+
""" Create a copy of the current :class:`FixedPoint`. """
|
|
1512
|
+
|
|
1513
|
+
return _mkFP(self.n, self.p)
|
|
1514
|
+
|
|
1515
|
+
__copy__ = __deepcopy__ = copy
|
|
1516
|
+
|
|
1517
|
+
def __eq__(self, other):
|
|
1518
|
+
if other is None:
|
|
1519
|
+
return False
|
|
1520
|
+
xn, yn, p = _norm(self, other)
|
|
1521
|
+
return not _cmp(xn, yn)
|
|
1522
|
+
|
|
1523
|
+
def __ge__(self, other):
|
|
1524
|
+
if other is None:
|
|
1525
|
+
return False
|
|
1526
|
+
xn, yn, p = _norm(self, other)
|
|
1527
|
+
return xn >= yn
|
|
1528
|
+
|
|
1529
|
+
def __le__(self, other):
|
|
1530
|
+
if other is None:
|
|
1531
|
+
return False
|
|
1532
|
+
xn, yn, p = _norm(self, other)
|
|
1533
|
+
return xn <= yn
|
|
1534
|
+
|
|
1535
|
+
def __hash__(self):
|
|
1536
|
+
# caution! == values must have equal hashes, and a FixedPoint
|
|
1537
|
+
# is essentially a rational in unnormalized form. There's
|
|
1538
|
+
# really no choice here but to normalize it, so hash is
|
|
1539
|
+
# potentially expensive.
|
|
1540
|
+
n, p = self.__reduce()
|
|
1541
|
+
|
|
1542
|
+
# Obscurity: if the value is an exact integer, p will be 0 now,
|
|
1543
|
+
# so the hash expression reduces to hash(n). So FixedPoints
|
|
1544
|
+
# that happen to be exact integers hash to the same things as
|
|
1545
|
+
# their int or long equivalents. This is Good. But if a
|
|
1546
|
+
# FixedPoint happens to have a value exactly representable as
|
|
1547
|
+
# a float, their hashes may differ. This is a teensy bit Bad.
|
|
1548
|
+
return hash(n) ^ hash(p)
|
|
1549
|
+
|
|
1550
|
+
def __nonzero__(self):
|
|
1551
|
+
return self.n != 0
|
|
1552
|
+
|
|
1553
|
+
def __bool__(self):
|
|
1554
|
+
return self.n != 0
|
|
1555
|
+
|
|
1556
|
+
def __neg__(self):
|
|
1557
|
+
return _mkFP(-self.n, self.p)
|
|
1558
|
+
|
|
1559
|
+
def __abs__(self):
|
|
1560
|
+
if self.n >= 0:
|
|
1561
|
+
return self.copy()
|
|
1562
|
+
else:
|
|
1563
|
+
return -self
|
|
1564
|
+
|
|
1565
|
+
def __add__(self, other):
|
|
1566
|
+
n1, n2, p = _norm(self, other)
|
|
1567
|
+
# n1/10**p + n2/10**p = (n1+n2)/10**p
|
|
1568
|
+
return _mkFP(n1 + n2, p)
|
|
1569
|
+
|
|
1570
|
+
__radd__ = __add__
|
|
1571
|
+
|
|
1572
|
+
def __sub__(self, other):
|
|
1573
|
+
if not isinstance(other, FixedPoint):
|
|
1574
|
+
other = FixedPoint(other, self.p)
|
|
1575
|
+
return self.__add__(-other)
|
|
1576
|
+
|
|
1577
|
+
def __rsub__(self, other):
|
|
1578
|
+
return (-self) + other
|
|
1579
|
+
|
|
1580
|
+
def __mul__(self, other):
|
|
1581
|
+
n1, n2, p = _norm(self, other)
|
|
1582
|
+
# n1/10**p * n2/10**p = (n1*n2/10**p)/10**p
|
|
1583
|
+
return _mkFP(_roundquotient(n1 * n2, _tento(p)), p)
|
|
1584
|
+
|
|
1585
|
+
__rmul__ = __mul__
|
|
1586
|
+
|
|
1587
|
+
def __div__(self, other):
|
|
1588
|
+
n1, n2, p = _norm(self, other)
|
|
1589
|
+
if n2 == 0:
|
|
1590
|
+
raise ZeroDivisionError("FixedPoint division")
|
|
1591
|
+
if n2 < 0:
|
|
1592
|
+
n1, n2 = -n1, -n2
|
|
1593
|
+
# n1/10**p / (n2/10**p) = n1/n2 = (n1*10**p/n2)/10**p
|
|
1594
|
+
return _mkFP(_roundquotient(n1 * _tento(p), n2), p)
|
|
1595
|
+
|
|
1596
|
+
def __rdiv__(self, other):
|
|
1597
|
+
n1, n2, p = _norm(self, other)
|
|
1598
|
+
return _mkFP(n2, p) / self
|
|
1599
|
+
|
|
1600
|
+
def __divmod__(self, other):
|
|
1601
|
+
n1, n2, p = _norm(self, other)
|
|
1602
|
+
if n2 == 0:
|
|
1603
|
+
raise ZeroDivisionError("FixedPoint modulo")
|
|
1604
|
+
# floor((n1/10**p)/(n2*10**p)) = floor(n1/n2)
|
|
1605
|
+
q = n1 / n2
|
|
1606
|
+
# n1/10**p - q * n2/10**p = (n1 - q * n2)/10**p
|
|
1607
|
+
return q, _mkFP(n1 - q * n2, p)
|
|
1608
|
+
|
|
1609
|
+
def __rdivmod__(self, other):
|
|
1610
|
+
n1, n2, p = _norm(self, other)
|
|
1611
|
+
return divmod(_mkFP(n2, p), self)
|
|
1612
|
+
|
|
1613
|
+
def __mod__(self, other):
|
|
1614
|
+
return self.__divmod__(other)[1]
|
|
1615
|
+
|
|
1616
|
+
def __rmod__(self, other):
|
|
1617
|
+
n1, n2, p = _norm(self, other)
|
|
1618
|
+
return _mkFP(n2, p).__mod__(self)
|
|
1619
|
+
|
|
1620
|
+
# caution! float can lose precision
|
|
1621
|
+
def __float__(self):
|
|
1622
|
+
n, p = self.__reduce()
|
|
1623
|
+
return float(n) / float(_tento(p))
|
|
1624
|
+
|
|
1625
|
+
# XXX should this round instead?
|
|
1626
|
+
# XXX note e.g. int(-1.9) == -1L and int(1.9) == 1L in Python
|
|
1627
|
+
# XXX note that __int__ inherits whatever __long__ does,
|
|
1628
|
+
# XXX and .frac() is affected too
|
|
1629
|
+
def __long__(self):
|
|
1630
|
+
answer = abs(self.n) // _tento(self.p)
|
|
1631
|
+
if self.n < 0:
|
|
1632
|
+
answer = -answer
|
|
1633
|
+
return answer
|
|
1634
|
+
|
|
1635
|
+
def __int__(self):
|
|
1636
|
+
return int(self.__long__())
|
|
1637
|
+
|
|
1638
|
+
def __lt__(self, other):
|
|
1639
|
+
if other is None:
|
|
1640
|
+
return 1
|
|
1641
|
+
xn, yn, p = _norm(self, other)
|
|
1642
|
+
return xn < yn
|
|
1643
|
+
|
|
1644
|
+
def __gt__(self, other):
|
|
1645
|
+
if other is None:
|
|
1646
|
+
return 1
|
|
1647
|
+
xn, yn, p = _norm(self, other)
|
|
1648
|
+
return xn > yn
|
|
1649
|
+
|
|
1650
|
+
def frac(self):
|
|
1651
|
+
"""
|
|
1652
|
+
Returns fractional portion as a :class:`FixedPoint`.
|
|
1653
|
+
|
|
1654
|
+
:note: In :class:`FixedPoint`,
|
|
1655
|
+
|
|
1656
|
+
this equality holds true::
|
|
1657
|
+
|
|
1658
|
+
x = x.frac() + int(x)
|
|
1659
|
+
|
|
1660
|
+
|
|
1661
|
+
"""
|
|
1662
|
+
return self - int(self)
|
|
1663
|
+
|
|
1664
|
+
# return n, p s.t. self == n/10**p and n % 10 != 0
|
|
1665
|
+
def __reduce(self):
|
|
1666
|
+
n, p = self.n, self.p
|
|
1667
|
+
if n == 0:
|
|
1668
|
+
p = 0
|
|
1669
|
+
while p and n % 10 == 0:
|
|
1670
|
+
p = p - 1
|
|
1671
|
+
n = n // 10
|
|
1672
|
+
return n, p
|
|
1673
|
+
|
|
1674
|
+
# return 10L**n
|
|
1675
|
+
|
|
1676
|
+
def _tento(n, cache={}):
|
|
1677
|
+
try:
|
|
1678
|
+
return cache[n]
|
|
1679
|
+
except KeyError:
|
|
1680
|
+
answer = cache[n] = 10 ** n
|
|
1681
|
+
return answer
|
|
1682
|
+
|
|
1683
|
+
# return xn, yn, p s.t.
|
|
1684
|
+
# p = max(x.p, y.p)
|
|
1685
|
+
# x = xn / 10**p
|
|
1686
|
+
# y = yn / 10**p
|
|
1687
|
+
#
|
|
1688
|
+
# x must be FixedPoint to begin with; if y is not FixedPoint,
|
|
1689
|
+
# it inherits its precision from x.
|
|
1690
|
+
#
|
|
1691
|
+
# Note that this is called a lot, so default-arg tricks are helpful.
|
|
1692
|
+
|
|
1693
|
+
def _norm(x, y, isinstance=isinstance, FixedPoint=FixedPoint,
|
|
1694
|
+
_tento=_tento):
|
|
1695
|
+
assert isinstance(x, FixedPoint)
|
|
1696
|
+
if not isinstance(y, FixedPoint):
|
|
1697
|
+
y = FixedPoint(y, x.p)
|
|
1698
|
+
xn, yn = x.n, y.n
|
|
1699
|
+
xp, yp = x.p, y.p
|
|
1700
|
+
if xp > yp:
|
|
1701
|
+
yn = yn * _tento(xp - yp)
|
|
1702
|
+
p = xp
|
|
1703
|
+
elif xp < yp:
|
|
1704
|
+
xn = xn * _tento(yp - xp)
|
|
1705
|
+
p = yp
|
|
1706
|
+
else:
|
|
1707
|
+
p = xp # same as yp
|
|
1708
|
+
return xn, yn, p
|
|
1709
|
+
|
|
1710
|
+
def _mkFP(n, p, FixedPoint=FixedPoint):
|
|
1711
|
+
f = FixedPoint()
|
|
1712
|
+
f.n = n
|
|
1713
|
+
f.p = p
|
|
1714
|
+
return f
|
|
1715
|
+
|
|
1716
|
+
# divide x by y, rounding to int via nearest-even
|
|
1717
|
+
# y must be > 0
|
|
1718
|
+
# XXX which rounding modes are useful?
|
|
1719
|
+
|
|
1720
|
+
def _roundquotient(x, y):
|
|
1721
|
+
assert y > 0
|
|
1722
|
+
n, leftover = divmod(x, y)
|
|
1723
|
+
c = _cmp(leftover << 1, y)
|
|
1724
|
+
# c < 0 <-> leftover < y/2, etc
|
|
1725
|
+
if c > 0 or (c == 0 and (n & 1) == 1):
|
|
1726
|
+
n = n + 1
|
|
1727
|
+
return n
|
|
1728
|
+
|
|
1729
|
+
|
|
1730
|
+
def _cmp(a, b):
|
|
1731
|
+
return a - b
|
|
1732
|
+
|
|
1733
|
+
|
|
1734
|
+
# crud for parsing strings
|
|
1735
|
+
import re
|
|
1736
|
+
|
|
1737
|
+
# There's an optional sign at the start, and an optional exponent
|
|
1738
|
+
# at the end. The exponent has an optional sign and at least one
|
|
1739
|
+
# digit. In between, must have either at least one digit followed
|
|
1740
|
+
# by an optional fraction, or a decimal point followed by at least
|
|
1741
|
+
# one digit. Yuck.
|
|
1742
|
+
|
|
1743
|
+
_parser = re.compile(r"""
|
|
1744
|
+
\s*
|
|
1745
|
+
(?P<sign>[-+])?
|
|
1746
|
+
(
|
|
1747
|
+
(?P<int>\d+) (\. (?P<frac>\d*))?
|
|
1748
|
+
|
|
|
1749
|
+
\. (?P<onlyfrac>\d+)
|
|
1750
|
+
)
|
|
1751
|
+
([eE](?P<exp>[-+]? \d+))?
|
|
1752
|
+
\s* $
|
|
1753
|
+
""", re.VERBOSE).match
|
|
1754
|
+
|
|
1755
|
+
del re
|
|
1756
|
+
|
|
1757
|
+
# return n, p s.t. float string value == n * 10**p exactly
|
|
1758
|
+
|
|
1759
|
+
def _string2exact(s):
|
|
1760
|
+
m = _parser(s)
|
|
1761
|
+
if m is None:
|
|
1762
|
+
raise ValueError("can't parse as number: " + repr(s))
|
|
1763
|
+
|
|
1764
|
+
exp = m.group('exp')
|
|
1765
|
+
if exp is None:
|
|
1766
|
+
exp = 0
|
|
1767
|
+
else:
|
|
1768
|
+
exp = int(exp)
|
|
1769
|
+
|
|
1770
|
+
intpart = m.group('int')
|
|
1771
|
+
if intpart is None:
|
|
1772
|
+
intpart = "0"
|
|
1773
|
+
fracpart = m.group('onlyfrac')
|
|
1774
|
+
else:
|
|
1775
|
+
fracpart = m.group('frac')
|
|
1776
|
+
if fracpart is None or fracpart == "":
|
|
1777
|
+
fracpart = "0"
|
|
1778
|
+
assert intpart
|
|
1779
|
+
assert fracpart
|
|
1780
|
+
|
|
1781
|
+
i, f = int(intpart), int(fracpart)
|
|
1782
|
+
nfrac = len(fracpart)
|
|
1783
|
+
i = i * _tento(nfrac) + f
|
|
1784
|
+
exp = exp - nfrac
|
|
1785
|
+
|
|
1786
|
+
if m.group('sign') == "-":
|
|
1787
|
+
i = -i
|
|
1788
|
+
|
|
1789
|
+
return i, exp
|
|
1790
|
+
|
|
1791
|
+
|
|
1792
|
+
if __name__ == '__main__':
|
|
1793
|
+
|
|
1794
|
+
import wx
|
|
1795
|
+
|
|
1796
|
+
class MyFrame(wx.Frame):
|
|
1797
|
+
|
|
1798
|
+
def __init__(self, parent):
|
|
1799
|
+
|
|
1800
|
+
wx.Frame.__init__(self, parent, -1, "FloatSpin Demo")
|
|
1801
|
+
|
|
1802
|
+
panel = wx.Panel(self)
|
|
1803
|
+
|
|
1804
|
+
floatspin = FloatSpin(panel, -1, pos=(50, 50), min_val=0, max_val=1,
|
|
1805
|
+
increment=0.01, value=0.1, agwStyle=FS_LEFT)
|
|
1806
|
+
floatspin.Format = "%f"
|
|
1807
|
+
floatspin.Digits = 2
|
|
1808
|
+
floatspin.Min = -1
|
|
1809
|
+
floatspin.Max = 10
|
|
1810
|
+
floatspin.Increment = 0.02
|
|
1811
|
+
floatspin.Value = 0.2
|
|
1812
|
+
|
|
1813
|
+
|
|
1814
|
+
# our normal wxApp-derived class, as usual
|
|
1815
|
+
|
|
1816
|
+
app = wx.App(0)
|
|
1817
|
+
|
|
1818
|
+
frame = MyFrame(None)
|
|
1819
|
+
app.SetTopWindow(frame)
|
|
1820
|
+
frame.Show()
|
|
1821
|
+
|
|
1822
|
+
app.MainLoop()
|
|
1823
|
+
|