- ('New since last release', ['ColourSelect', 'ImageBrowser', 'infoframe',
- 'ColourDB', 'wxToggleButton', 'OOR',
- ]),
-
- ('Managed Windows', ['wxFrame', 'wxDialog', 'wxMiniFrame']),
-
- ('Non-Managed Windows', ['wxGrid', 'wxSashWindow',
- 'wxScrolledWindow', 'wxSplitterWindow',
- 'wxStatusBar', 'wxNotebook',
- 'wxHtmlWindow',
- 'wxStyledTextCtrl_1', 'wxStyledTextCtrl_2',]),
-
- ('Common Dialogs', ['wxColourDialog', 'wxDirDialog', 'wxFileDialog',
- 'wxSingleChoiceDialog', 'wxTextEntryDialog',
- 'wxFontDialog', 'wxPageSetupDialog', 'wxPrintDialog',
- 'wxMessageDialog', 'wxProgressDialog']),
-
- ('Controls', ['wxButton', 'wxCheckBox', 'wxCheckListBox', 'wxChoice',
- 'wxComboBox', 'wxGauge', 'wxListBox', 'wxListCtrl', 'wxTextCtrl',
- 'wxTreeCtrl', 'wxSpinButton', 'wxSpinCtrl', 'wxStaticText',
- 'wxStaticBitmap', 'wxRadioBox', 'wxSlider', 'wxToolBar',
- 'wxCalendarCtrl', 'wxToggleButton',
- ]),
-
- ('Window Layout', ['wxLayoutConstraints', 'LayoutAnchors', 'Sizers', ]),
-
- ('Miscellaneous', [ 'DragAndDrop', 'CustomDragAndDrop', 'FontEnumerator',
- 'wxTimer', 'wxValidator', 'wxGLCanvas', 'DialogUnits',
- 'wxImage', 'wxMask', 'PrintFramework', 'wxOGL',
- 'PythonEvents', 'Threads',
- 'ActiveXWrapper_Acrobat', 'ActiveXWrapper_IE',
- 'wxDragImage', "wxProcess", "FancyText", "OOR",
- ]),
-
- ('wxPython Library', ['Layoutf', 'wxScrolledMessageDialog',
- 'wxMultipleChoiceDialog', 'wxPlotCanvas', 'wxFloatBar',
- 'PyShell', 'wxCalendar', 'wxMVCTree', 'wxVTKRenderWindow',
- 'FileBrowseButton', 'GenericButtons', 'wxEditor',
- 'PyShellWindow', 'ColourSelect', 'ImageBrowser',
- ]),
-
- ('Cool Contribs', ['pyTree', 'hangman', 'SlashDot', 'XMLtreeview']),
-
- ]
+ # new stuff
+ ('Recent Additions', [
+ 'wxVListBox',
+ 'wxListbook',
+ 'wxMaskedNumCtrl',
+ 'FloatCanvas',
+ 'wxXmlResourceSubclass',
+ 'wxGridBagSizer',
+ 'Cursor',
+ 'PyPlot',
+ ]),
+
+ # managed windows == things with a (optional) caption you can close
+ ('Base Frames and Dialogs', [
+ 'wxDialog',
+ 'wxFrame',
+ 'wxMDIWindows',
+ 'wxMiniFrame',
+ 'wxWizard',
+ ]),
+
+ # the common dialogs
+ ('Common Dialogs', [
+ 'wxColourDialog',
+ 'wxDirDialog',
+ 'wxFileDialog',
+ 'wxFileDialog_Save',
+ 'wxFindReplaceDialog',
+ 'wxFontDialog',
+ 'wxMessageDialog',
+ 'wxPageSetupDialog',
+ 'wxPrintDialog',
+ 'wxProgressDialog',
+ 'wxSingleChoiceDialog',
+ 'wxTextEntryDialog',
+ ]),
+
+ # dialogs from libraries
+ ('More Dialogs', [
+ 'ErrorDialogs',
+ 'ImageBrowser',
+ 'wxMultipleChoiceDialog',
+ 'wxScrolledMessageDialog',
+ ]),
+
+ # core controls
+ ('Core Windows/Controls', [
+ 'PopupMenu',
+ 'wxButton',
+ 'wxCheckBox',
+ 'wxCheckListBox',
+ 'wxChoice',
+ 'wxComboBox',
+ 'wxGauge',
+ 'wxGrid',
+ 'wxGrid_MegaExample',
+ 'wxListbook',
+ 'wxListBox',
+ 'wxListCtrl',
+ 'wxListCtrl_virtual',
+ 'wxMenu',
+ 'wxNotebook',
+ 'wxPopupWindow',
+ 'wxRadioBox',
+ 'wxRadioButton',
+ 'wxSashWindow',
+ 'wxScrolledWindow',
+ 'wxSlider',
+ 'wxSpinButton',
+ 'wxSpinCtrl',
+ 'wxSplitterWindow',
+ 'wxStaticBitmap',
+ 'wxStaticText',
+ 'wxStatusBar',
+ 'wxTextCtrl',
+ 'wxToggleButton',
+ 'wxToolBar',
+ 'wxTreeCtrl',
+ 'wxValidator',
+ ]),
+
+ ('Custom Controls', [
+ 'AnalogClockWindow',
+ 'ColourSelect',
+ 'GenericButtons',
+ 'wxEditor',
+ 'wxGenericDirCtrl',
+ 'wxLEDNumberCtrl',
+ 'wxMultiSash',
+ 'wxPopupControl',
+ 'wxPyColourChooser',
+ 'wxTreeListCtrl',
+ ]),
+
+ # controls coming from other libraries
+ ('More Windows/Controls', [
+ #'wxFloatBar', deprecated
+ #'wxMVCTree', deprecated
+ #'wxRightTextCtrl', deprecated as we have wxTE_RIGHT now.
+ 'ContextHelp',
+ 'FancyText',
+ 'FloatCanvas',
+ 'FileBrowseButton',
+ 'MaskedEditControls',
+ 'PyShell',
+ 'PyCrust',
+ 'PyPlot',
+ 'SplitTree',
+ 'TablePrint',
+ 'Throbber',
+ 'wxCalendar',
+ 'wxCalendarCtrl',
+ 'wxDynamicSashWindow',
+ 'wxEditableListBox',
+ 'wxHtmlWindow',
+ 'wxIEHtmlWin',
+ 'wxIntCtrl',
+ 'wxMimeTypesManager',
+ 'wxMaskedNumCtrl',
+ 'wxScrolledPanel',
+ 'wxStyledTextCtrl_1',
+ 'wxStyledTextCtrl_2',
+ 'wxTimeCtrl',
+ 'wxVListBox',
+ ]),
+
+ # How to lay out the controls in a frame/dialog
+ ('Window Layout', [
+ 'LayoutAnchors',
+ 'Layoutf',
+ 'RowColSizer',
+ 'Sizers',
+ 'wxGridBagSizer',
+ 'wxLayoutConstraints',
+ 'wxScrolledPanel',
+ 'wxXmlResource',
+ 'wxXmlResourceHandler',
+ 'wxXmlResourceSubclass',
+ ]),
+
+ # ditto
+ ('Process and Events', [
+ 'EventManager',
+ 'infoframe',
+ 'OOR',
+ 'PythonEvents',
+ 'Threads',
+ 'wxKeyEvents',
+ 'wxProcess',
+ 'wxTimer',
+ ]),
+
+ # Clipboard and DnD
+ ('Clipboard and DnD', [
+ 'CustomDragAndDrop',
+ 'DragAndDrop',
+ 'URLDragAndDrop',
+ ]),
+
+ # Images
+ ('Using Images', [
+ 'Cursor',
+ 'Throbber',
+ 'wxArtProvider',
+ 'wxDragImage',
+ 'wxImage',
+ 'wxImageFromStream',
+ 'wxMask',
+ ]),
+
+ # Other stuff
+ ('Miscellaneous', [
+ 'ColourDB',
+ 'DialogUnits',
+ 'DrawXXXList',
+ 'FontEnumerator',
+ 'NewNamespace',
+ 'PrintFramework',
+ 'ShapedWindow',
+ 'Throbber',
+ 'Unicode',
+ 'wxFileHistory',
+ 'wxJoystick',
+ 'wxOGL',
+ 'wxWave',
+ ]),
+
+ # need libs not coming with the demo
+ ('Objects using an external library', [
+ 'ActiveXWrapper_Acrobat',
+ 'ActiveXWrapper_IE',
+ 'wxGLCanvas',
+ #'wxPlotCanvas', # deprecated, use PyPlot
+ ]),
+
+
+ ('Check out the samples dir too', [
+ ]),
+
+]
+
+
+
+#---------------------------------------------------------------------------
+# Show how to derive a custom wxLog class
+
+class MyLog(wx.PyLog):
+ def __init__(self, textCtrl, logTime=0):
+ wx.PyLog.__init__(self)
+ self.tc = textCtrl
+ self.logTime = logTime
+
+ def DoLogString(self, message, timeStamp):
+ if self.logTime:
+ message = time.strftime("%X", time.localtime(timeStamp)) + \
+ ": " + message
+ if self.tc:
+ self.tc.AppendText(message + '\n')
+
+
+class MyTP(wx.PyTipProvider):
+ def GetTip(self):
+ return "This is my tip"
+
+#---------------------------------------------------------------------------
+# A class to be used to display source code in the demo. Try using the
+# wxSTC in the wxStyledTextCtrl_2 sample first, fall back to wxTextCtrl
+# if there is an error, such as the stc module not being present.
+#
+
+try:
+ ##raise ImportError
+ from wx import stc
+ from wxStyledTextCtrl_2 import PythonSTC
+ class DemoCodeViewer(PythonSTC):
+ def __init__(self, parent, ID):
+ PythonSTC.__init__(self, parent, ID)
+ self.SetUpEditor()
+
+ # Some methods to make it compatible with how the wxTextCtrl is used
+ def SetValue(self, value):
+ self.SetReadOnly(False)
+ self.SetText(value)
+ self.SetReadOnly(True)
+
+ def Clear(self):
+ self.ClearAll()
+
+ def SetInsertionPoint(self, pos):
+ self.SetCurrentPos(pos)
+
+ def ShowPosition(self, pos):
+ self.GotoPos(pos)
+
+ def GetLastPosition(self):
+ return self.GetLength()
+
+ def GetRange(self, start, end):
+ return self.GetTextRange(start, end)
+
+ def GetSelection(self):
+ return self.GetAnchor(), self.GetCurrentPos()
+
+ def SetSelection(self, start, end):
+ self.SetSelectionStart(start)
+ self.SetSelectionEnd(end)
+
+ def SetUpEditor(self):
+ """
+ This method carries out the work of setting up the demo editor.
+ It's seperate so as not to clutter up the init code.
+ """
+ import keyword
+
+ self.SetLexer(stc.STC_LEX_PYTHON)
+ self.SetKeyWords(0, " ".join(keyword.kwlist))
+
+ # Enable folding
+ self.SetProperty("fold", "1" )
+
+ # Highlight tab/space mixing (shouldn't be any)
+ self.SetProperty("tab.timmy.whinge.level", "1")
+
+ # Set left and right margins
+ self.SetMargins(2,2)
+
+ # Set up the numbers in the margin for margin #1
+ self.SetMarginType(1, wx.stc.STC_MARGIN_NUMBER)
+ # Reasonable value for, say, 4-5 digits using a mono font (40 pix)
+ self.SetMarginWidth(1, 40)
+
+ # Indentation and tab stuff
+ self.SetIndent(4) # Proscribed indent size for wx
+ self.SetIndentationGuides(True) # Show indent guides
+ self.SetBackSpaceUnIndents(True)# Backspace unindents rather than delete 1 space
+ self.SetTabIndents(True) # Tab key indents
+ self.SetTabWidth(4) # Proscribed tab size for wx
+ self.SetUseTabs(False) # Use spaces rather than tabs, or
+ # TabTimmy will complain!
+ # White space
+ self.SetViewWhiteSpace(False) # Don't view white space
+
+ # EOL
+ #self.SetEOLMode(wx.stc.STC_EOL_CRLF) # Just leave it at the default (autosense)
+ self.SetViewEOL(False)
+ # No right-edge mode indicator
+ self.SetEdgeMode(stc.STC_EDGE_NONE)
+
+ # Setup a margin to hold fold markers
+ self.SetMarginType(2, stc.STC_MARGIN_SYMBOL)
+ self.SetMarginMask(2, stc.STC_MASK_FOLDERS)
+ self.SetMarginSensitive(2, True)
+ self.SetMarginWidth(2, 12)
+
+ # and now set up the fold markers
+ self.MarkerDefine(stc.STC_MARKNUM_FOLDEREND, stc.STC_MARK_BOXPLUSCONNECTED, "white", "black")
+ self.MarkerDefine(stc.STC_MARKNUM_FOLDEROPENMID, stc.STC_MARK_BOXMINUSCONNECTED, "white", "black")
+ self.MarkerDefine(stc.STC_MARKNUM_FOLDERMIDTAIL, stc.STC_MARK_TCORNER, "white", "black")
+ self.MarkerDefine(stc.STC_MARKNUM_FOLDERTAIL, stc.STC_MARK_LCORNER, "white", "black")
+ self.MarkerDefine(stc.STC_MARKNUM_FOLDERSUB, stc.STC_MARK_VLINE, "white", "black")
+ self.MarkerDefine(stc.STC_MARKNUM_FOLDER, stc.STC_MARK_BOXPLUS, "white", "black")
+ self.MarkerDefine(stc.STC_MARKNUM_FOLDEROPEN, stc.STC_MARK_BOXMINUS, "white", "black")
+
+ # Global default style
+ if wx.Platform == '__WXMSW__':
+ self.StyleSetSpec(stc.STC_STYLE_DEFAULT,
+ 'fore:#000000,back:#FFFFFF,face:Courier New,size:9')
+ else:
+ self.StyleSetSpec(stc.STC_STYLE_DEFAULT,
+ 'fore:#000000,back:#FFFFFF,face:Courier,size:12')
+
+ # Clear styles and revert to default.
+ self.StyleClearAll()
+
+ # Following style specs only indicate differences from default.
+ # The rest remains unchanged.
+
+ # Line numbers in margin
+ self.StyleSetSpec(wx.stc.STC_STYLE_LINENUMBER,'fore:#000000,back:#99A9C2')
+
+ # Highlighted brace
+ self.StyleSetSpec(wx.stc.STC_STYLE_BRACELIGHT,'fore:#00009D,back:#FFFF00')
+ # Unmatched brace
+ self.StyleSetSpec(wx.stc.STC_STYLE_BRACEBAD,'fore:#00009D,back:#FF0000')
+ # Indentation guide
+ self.StyleSetSpec(wx.stc.STC_STYLE_INDENTGUIDE, "fore:#CDCDCD")
+
+ # Python styles
+ self.StyleSetSpec(wx.stc.STC_P_DEFAULT, 'fore:#000000')
+ # Comments
+ self.StyleSetSpec(wx.stc.STC_P_COMMENTLINE, 'fore:#008000,back:#F0FFF0')
+ self.StyleSetSpec(wx.stc.STC_P_COMMENTBLOCK, 'fore:#008000,back:#F0FFF0')
+ # Numbers
+ self.StyleSetSpec(wx.stc.STC_P_NUMBER, 'fore:#008080')
+ # Strings and characters
+ self.StyleSetSpec(wx.stc.STC_P_STRING, 'fore:#800080')
+ self.StyleSetSpec(wx.stc.STC_P_CHARACTER, 'fore:#800080')
+ # Keywords
+ self.StyleSetSpec(wx.stc.STC_P_WORD, 'fore:#000080,bold')
+ # Triple quotes
+ self.StyleSetSpec(wx.stc.STC_P_TRIPLE, 'fore:#800080,back:#FFFFEA')
+ self.StyleSetSpec(wx.stc.STC_P_TRIPLEDOUBLE, 'fore:#800080,back:#FFFFEA')
+ # Class names
+ self.StyleSetSpec(wx.stc.STC_P_CLASSNAME, 'fore:#0000FF,bold')
+ # Function names
+ self.StyleSetSpec(wx.stc.STC_P_DEFNAME, 'fore:#008080,bold')
+ # Operators
+ self.StyleSetSpec(wx.stc.STC_P_OPERATOR, 'fore:#800000,bold')
+ # Identifiers. I leave this as not bold because everything seems
+ # to be an identifier if it doesn't match the above criterae
+ self.StyleSetSpec(wx.stc.STC_P_IDENTIFIER, 'fore:#000000')
+
+ # Caret color
+ self.SetCaretForeground("BLUE")
+ # Selection background
+ self.SetSelBackground(1, '#66CCFF')
+
+ self.SetSelBackground(True, wx.SystemSettings_GetColour(wx.SYS_COLOUR_HIGHLIGHT))
+ self.SetSelForeground(True, wx.SystemSettings_GetColour(wx.SYS_COLOUR_HIGHLIGHTTEXT))
+
+
+except ImportError:
+ class DemoCodeViewer(wx.TextCtrl):
+ def __init__(self, parent, ID):
+ wx.TextCtrl.__init__(self, parent, ID, style =
+ wx.TE_MULTILINE | wx.TE_READONLY |
+ wx.HSCROLL | wx.TE_RICH2 | wx.TE_NOHIDESEL)
+
+
+#---------------------------------------------------------------------------
+
+def opj(path):
+ """Convert paths to the platform-specific separator"""
+ return apply(os.path.join, tuple(path.split('/')))
+