From c273dfa9b11c6967f3cf8d1c28dc1c12fcf483a1 Mon Sep 17 00:00:00 2001 From: Metallicow Date: Thu, 24 Nov 2016 19:26:05 -0600 Subject: [PATCH] Trim Trailing Whitespace demos --- demo/ActiveXWrapper_IE.py | 2 +- demo/ActiveX_FlashWindow.py | 2 +- demo/ActiveX_IEHtmlWindow.py | 14 +-- demo/ActiveX_PDFWindow.py | 12 +-- demo/AlphaDrawing.py | 6 +- demo/AnalogClock.py | 6 +- demo/AnimateCtrl.py | 4 +- demo/BannerWindow.py | 2 +- demo/CheckListBox.py | 8 +- demo/Choicebook.py | 4 +- demo/CollapsiblePane.py | 14 +-- demo/ColourDB.py | 2 +- demo/ComboTreeBox.py | 8 +- demo/DVC_CustomRenderer.py | 14 +-- demo/DVC_DataViewModel.py | 2 +- demo/DelayedResult.py | 38 ++++---- demo/Dialog.py | 14 +-- demo/DialogUnits.py | 8 +- demo/DirDialog.py | 4 +- demo/DragAndDrop.py | 4 +- demo/DragScroller.py | 14 +-- demo/ExpandoTextCtrl.py | 16 ++-- demo/FancyText.py | 8 +- demo/FileBrowseButton.py | 6 +- demo/FindReplaceDialog.py | 24 ++--- demo/FloatCanvas.py | 88 +++++++++--------- demo/Gauge.py | 2 +- demo/GetMouseState.py | 8 +- demo/Grid.py | 4 +- demo/GridCustEditor.py | 2 +- demo/GridDragable.py | 4 +- demo/GridHugeTable.py | 8 +- demo/GridLabelRenderer.py | 32 +++---- demo/GridSimple.py | 4 +- demo/HTML2_WebView.py | 16 ++-- demo/Image.py | 2 +- demo/ImageAlpha.py | 6 +- demo/ImageBrowser.py | 4 +- demo/ImageFromStream.py | 2 +- demo/Img2PyArtProvider.py | 14 +-- demo/InfoBar.py | 10 +- demo/KeyEvents.py | 2 +- demo/LEDNumberCtrl.py | 6 +- demo/LayoutAnchors.py | 70 +++++++------- demo/MDIWindows.py | 2 +- demo/Main.py | 4 +- demo/MaskedNumCtrl.py | 6 +- demo/MediaCtrl.py | 28 +++--- demo/MouseGestures.py | 38 ++++---- demo/MultiChoiceDialog.py | 2 +- demo/MultiSplitterWindow.py | 14 +-- demo/MultipleChoiceDialog.py | 2 +- demo/OGL.py | 36 ++++---- demo/PDFViewer.py | 12 +-- demo/PenAndBrushStyles.py | 2 +- demo/PlateButton.py | 12 +-- demo/PopupWindow.py | 12 +-- demo/ProgressDialog.py | 14 +-- demo/PropertyGrid.py | 2 +- demo/PyPlot.py | 4 +- demo/PythonEvents.py | 4 +- demo/ScrolledWindow.py | 4 +- demo/Sound.py | 6 +- demo/SpinButton.py | 12 +-- demo/StockButtons.py | 4 +- demo/TextEntryDialog.py | 4 +- demo/Timer.py | 22 ++--- demo/ToggleButton.py | 8 +- demo/UIActionSimulator.py | 36 ++++---- demo/Wizard.py | 4 +- demo/XmlResourceHandler.py | 2 +- demo/XmlResourceSubclass.py | 8 +- demo/agw/AGWInfoBar.py | 20 ++-- demo/agw/AdvancedSplash.py | 2 +- demo/agw/CubeColourDialog.py | 6 +- demo/agw/FoldPanelBar.py | 152 +++++++++++++++---------------- demo/agw/GradientButton.py | 18 ++-- demo/agw/HyperTreeList.py | 2 +- demo/agw/LabelBook.py | 22 ++--- demo/agw/MultiDirDialog.py | 18 ++-- demo/agw/PyBusyInfo.py | 10 +- demo/agw/PyCollapsiblePane.py | 76 ++++++++-------- demo/agw/PyProgress.py | 28 +++--- demo/agw/ShortcutEditor.py | 40 ++++---- demo/agw/SpeedMeter.py | 2 +- demo/agw/UltimateListIconDemo.py | 10 +- demo/agw/UltimateListListDemo.py | 5 +- demo/agw/XLSGrid.py | 34 +++---- demo/agw/__demo__.py | 14 +-- demo/encode_bitmaps.py | 8 +- 90 files changed, 645 insertions(+), 646 deletions(-) diff --git a/demo/ActiveXWrapper_IE.py b/demo/ActiveXWrapper_IE.py index 4d7c6a60..522c05f1 100644 --- a/demo/ActiveXWrapper_IE.py +++ b/demo/ActiveXWrapper_IE.py @@ -120,7 +120,7 @@ class TestPanel(wx.Window): dlg.Destroy() def OnHomeButton(self, event): - self.ie.GoHome() + self.ie.GoHome() def OnPrevPageButton(self, event): self.ie.GoBack() diff --git a/demo/ActiveX_FlashWindow.py b/demo/ActiveX_FlashWindow.py index 58e63af5..6604a65a 100644 --- a/demo/ActiveX_FlashWindow.py +++ b/demo/ActiveX_FlashWindow.py @@ -56,7 +56,7 @@ class TestPanel(wx.Panel): if dlg.ShowModal() == wx.ID_OK: wx.BeginBusyCursor() # setting the movie property works too - self.flash.movie = dlg.GetValue() + self.flash.movie = dlg.GetValue() wx.EndBusyCursor() dlg.Destroy() diff --git a/demo/ActiveX_IEHtmlWindow.py b/demo/ActiveX_IEHtmlWindow.py index ef1c20db..e28ce6a4 100644 --- a/demo/ActiveX_IEHtmlWindow.py +++ b/demo/ActiveX_IEHtmlWindow.py @@ -18,7 +18,7 @@ class TestPanel(wx.Panel): self, parent, -1, style=wx.TAB_TRAVERSAL|wx.CLIP_CHILDREN|wx.NO_FULL_REPAINT_ON_RESIZE ) - + self.log = log self.current = "http://wxPython.org/" self.frame = frame @@ -68,7 +68,7 @@ class TestPanel(wx.Panel): self.location = wx.ComboBox( self, -1, "", style=wx.CB_DROPDOWN|wx.TE_PROCESS_ENTER ) - + self.Bind(wx.EVT_COMBOBOX, self.OnLocationSelect, self.location) self.location.Bind(wx.EVT_KEY_UP, self.OnLocationKey) self.location.Bind(wx.EVT_CHAR, self.IgnoreReturn) @@ -145,7 +145,7 @@ class TestPanel(wx.Panel): def OnCheckCanGoBack(self, event): event.Enable(self.ie.CanGoBack()) - + def OnCheckCanGoForward(self, event): event.Enable(self.ie.CanGoForward()) @@ -162,7 +162,7 @@ class TestPanel(wx.Panel): # Here are some of the event methods for the IE COM events. See # the MSDN docs for DWebBrowserEvents2 for details on what events # are available, and what the parameters are. - + def BeforeNavigate2(self, this, pDisp, URL, Flags, TargetFrameName, PostData, Headers, Cancel): self.log.write('BeforeNavigate2: %s\n' % URL[0]) @@ -174,7 +174,7 @@ class TestPanel(wx.Panel): # so setting the value means it will be returned and # checked in the COM control. Cancel[0] = True - + def NewWindow3(self, this, pDisp, Cancel, Flags, urlContext, URL): self.log.write('NewWindow3: %s\n' % URL) @@ -182,7 +182,7 @@ class TestPanel(wx.Panel): #def ProgressChange(self, this, progress, progressMax): # self.log.write('ProgressChange: %d of %d\n' % (progress, progressMax)) - + def DocumentComplete(self, this, pDisp, URL): self.current = URL[0] self.location.SetValue(self.current) @@ -195,7 +195,7 @@ class TestPanel(wx.Panel): if self.frame: self.frame.SetStatusText(Text) - + #---------------------------------------------------------------------- # for the demo framework... diff --git a/demo/ActiveX_PDFWindow.py b/demo/ActiveX_PDFWindow.py index d90089cd..924e38dd 100644 --- a/demo/ActiveX_PDFWindow.py +++ b/demo/ActiveX_PDFWindow.py @@ -20,7 +20,7 @@ class TestPanel(wx.Panel): box = wx.StaticBox(self, wx.NewId(), "" ) buttonsizer = wx.StaticBoxSizer(box, wx.HORIZONTAL ) - + b1 = wx.Button(self, wx.NewId(), "First") buttonsizer.Add(b1, proportion=0, flag=wx.ALIGN_CENTER|wx.ALL, border=5) self.Bind(wx.EVT_BUTTON, self.OnFirstPageButton, b1) @@ -28,13 +28,13 @@ class TestPanel(wx.Panel): b2 = wx.Button(self, wx.NewId(), "Previous") buttonsizer.Add(b2, proportion=0, flag=wx.ALIGN_CENTER|wx.ALL, border=5) self.Bind(wx.EVT_BUTTON, self.OnPreviousPageButton, b2) - + tx1 = wx.StaticText(self, wx.NewId(), " Go to page" ) buttonsizer.Add(tx1, proportion=0, flag=wx.ALIGN_CENTER|wx.ALL, border=5) tc1 = wx.TextCtrl(self, wx.NewId(), "0", size=[30,-1]) buttonsizer.Add( tc1, proportion=0, flag=wx.ALIGN_CENTER|wx.ALL, border=5) self.Bind(wx.EVT_TEXT, self.OnGotoPage, tc1) - + b3 = wx.Button(self, wx.NewId(), "Next") buttonsizer.Add(b3, proportion=0, flag=wx.ALIGN_CENTER|wx.ALL, border=5) self.Bind(wx.EVT_BUTTON, self.OnNextPageButton, b3) @@ -45,7 +45,7 @@ class TestPanel(wx.Panel): tx2 = wx.StaticText(self, wx.NewId(), " Zoom") buttonsizer.Add(tx2, proportion=0, flag=wx.ALIGN_CENTER|wx.ALL, border=5) - + ch1 = wx.Choice(self, wx.NewId(), choices=["Default", "Fit", "FitH", "FitV", "25%", "50%", "75%", "100%", "125%", "200%", "400%"]) @@ -58,7 +58,7 @@ class TestPanel(wx.Panel): box = wx.StaticBox(self, wx.NewId(), "" ) rightsizer = wx.StaticBoxSizer(box, wx.VERTICAL) - + b5 = wx.Button(self, wx.NewId(), "Load PDF") rightsizer.Add(b5, proportion=0, flag=wx.ALIGN_CENTER_VERTICAL|wx.ALL, border=5) self.Bind(wx.EVT_BUTTON, self.OnLoadButton, b5) @@ -129,7 +129,7 @@ class TestPanel(wx.Panel): self.pdf.setZoom(percent) except ValueError: pass - + def OnLoadButton(self, event): dlg = wx.FileDialog(self, wildcard="*.pdf") if dlg.ShowModal() == wx.ID_OK: diff --git a/demo/AlphaDrawing.py b/demo/AlphaDrawing.py index 4f9b6abf..1e656df2 100644 --- a/demo/AlphaDrawing.py +++ b/demo/AlphaDrawing.py @@ -16,7 +16,7 @@ provides the wx.DC API on top of the new wx.GraphicsContext class) then these squares should be transparent. """ wx.StaticText(self, -1, txt, (20, 20)) - + def OnPaint(self, evt): pdc = wx.PaintDC(self) @@ -42,8 +42,8 @@ then these squares should be transparent. #dc.SetBrush(wx.Brush(wx.Colour(0,0,255, 64))) #dc.DrawCircle(50, 275, 25) #dc.DrawEllipse(100, 275, 75, 50) - - + + #---------------------------------------------------------------------- def runTest(frame, nb, log): diff --git a/demo/AnalogClock.py b/demo/AnalogClock.py index fe89657f..10085cfe 100644 --- a/demo/AnalogClock.py +++ b/demo/AnalogClock.py @@ -21,7 +21,7 @@ class TestPanel(wx.Panel): if True: # for a simpler test case just set this to False and # only the one clock will be created - + # A plain clock, with square hour and round minute marks, no # shadow, static border c2 = ac.AnalogClock(self, style=wx.STATIC_BORDER, @@ -60,7 +60,7 @@ class TestPanel(wx.Panel): # A clock with binary numbers shown only at the quarter tick marks, # no minutes ticks and different colours. - c5 = ac.AnalogClock(self, style = wx.RAISED_BORDER, + c5 = ac.AnalogClock(self, style = wx.RAISED_BORDER, hoursStyle=ac.TICKS_BINARY, clockStyle=ac.SHOW_QUARTERS_TICKS| \ ac.SHOW_HOURS_HAND| \ @@ -79,7 +79,7 @@ class TestPanel(wx.Panel): c5.SetFaceFillColour(colour) c5.SetShadowColour(wx.WHITE) - # A clock with a sunken border, roman numerals shown only at the + # A clock with a sunken border, roman numerals shown only at the # quarter tick marks with a roman font, circular minutes ticks, # no seconds hand, no shadows, tick overlapping and different colours. c6 = ac.AnalogClock(self, style = wx.SUNKEN_BORDER, diff --git a/demo/AnimateCtrl.py b/demo/AnimateCtrl.py index 97025f91..c2a3cd63 100644 --- a/demo/AnimateCtrl.py +++ b/demo/AnimateCtrl.py @@ -6,7 +6,7 @@ from Main import opj GIFNames = [ 'bitmaps/AG00178_.gif', - 'bitmaps/BD13656_.gif', + 'bitmaps/BD13656_.gif', 'bitmaps/AG00185_.gif', 'bitmaps/AG00039_.gif', 'bitmaps/AG00183_.gif', @@ -31,7 +31,7 @@ class TestPanel(wx.Panel): border = wx.BoxSizer() border.Add(sizer, 1, wx.EXPAND | wx.ALL, 20) self.SetSizer(border) - + #---------------------------------------------------------------------- diff --git a/demo/BannerWindow.py b/demo/BannerWindow.py index 7268daad..64709712 100644 --- a/demo/BannerWindow.py +++ b/demo/BannerWindow.py @@ -1 +1 @@ -#!/usr/bin/env python # -*- coding: utf-8 -*- import wx import wx.adv phoenix = ("""\ A phoenix is a mythical bird with a colorful plumage and a tail of gold and scarlet (or purple and blue, according to some sources). It has a 500 to 1,000 year life-cycle, near the end of which it builds itself a nest of myrrh twigs that then ignites; both nest and bird burn fiercely and are reduced to ashes, from which a new, young phoenix or phoenix egg arises, reborn anew to live again. The new phoenix is destined to live as long as its old self. """) class SampleBanners(wx.Panel): def __init__(self, parent): # ... create the frame itself ... wx.Panel.__init__(self, parent) pnxBmp = wx.Bitmap('bitmaps/phoenix_top.png') bmpsz = pnxBmp.GetSize() # Create and initialize the banner. whitePanel = wx.Panel(self, -1, size=(-1, bmpsz[1])) whitePanel.SetBackgroundColour(wx.WHITE) # Create and initialize the 1st banner and define a bitmap. banner1 = wx.adv.BannerWindow(whitePanel, dir=wx.BOTTOM) banner1.SetBitmap(pnxBmp) whiteSizer = wx.BoxSizer(wx.HORIZONTAL) whiteSizer.Add(banner1, 1) whitePanel.SetSizer(whiteSizer) # Create and initialize the 2nd banner and define the gradient text. banner2 = wx.adv.BannerWindow(self, dir=wx.TOP) banner2.SetGradient(start='#FF8000', end='#FFFFFF') banner2.SetText("Phoenix", phoenix) # Layout vsizer = wx.BoxSizer(wx.VERTICAL) vsizer.Add(whitePanel, 0, wx.EXPAND | wx.TOP | wx.LEFT | wx.RIGHT, 5) vsizer.Add(banner2, 1, wx.EXPAND | wx.BOTTOM | wx.LEFT | wx.RIGHT, 5) self.SetSizer(vsizer) class TestPanel(wx.Panel): def __init__(self, parent, log): self.log = log wx.Panel.__init__(self, parent, -1) banners = SampleBanners(self) sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(banners, 0, wx.EXPAND) text = wx.StaticText(self, -1, overview) sizer.Add(text, 0, wx.EXPAND|wx.ALL, 15) self.SetSizer(sizer) def runTest(frame, nb, log): win = TestPanel(nb, log) return win #--------------------------------------------------------------------------- overview = """\ This sample displays two banner windows, one with an image, and one with text and a colour gradient background. Banner windows can be used to present some overview of the current window contents to the user in an aesthetically pleasant way. They are typically positioned along the left or top edge of the window (although this class also supports right-aligned and bottom-aligned banners) and show either a bitmap with a logo or a few lines of text on a gradient-filled background. """ if __name__ == '__main__': import sys,os import run run.main(['', os.path.basename(sys.argv[0])] + sys.argv[1:]) \ No newline at end of file +#!/usr/bin/env python # -*- coding: utf-8 -*- import wx import wx.adv phoenix = ("""\ A phoenix is a mythical bird with a colorful plumage and a tail of gold and scarlet (or purple and blue, according to some sources). It has a 500 to 1,000 year life-cycle, near the end of which it builds itself a nest of myrrh twigs that then ignites; both nest and bird burn fiercely and are reduced to ashes, from which a new, young phoenix or phoenix egg arises, reborn anew to live again. The new phoenix is destined to live as long as its old self. """) class SampleBanners(wx.Panel): def __init__(self, parent): # ... create the frame itself ... wx.Panel.__init__(self, parent) pnxBmp = wx.Bitmap('bitmaps/phoenix_top.png') bmpsz = pnxBmp.GetSize() # Create and initialize the banner. whitePanel = wx.Panel(self, -1, size=(-1, bmpsz[1])) whitePanel.SetBackgroundColour(wx.WHITE) # Create and initialize the 1st banner and define a bitmap. banner1 = wx.adv.BannerWindow(whitePanel, dir=wx.BOTTOM) banner1.SetBitmap(pnxBmp) whiteSizer = wx.BoxSizer(wx.HORIZONTAL) whiteSizer.Add(banner1, 1) whitePanel.SetSizer(whiteSizer) # Create and initialize the 2nd banner and define the gradient text. banner2 = wx.adv.BannerWindow(self, dir=wx.TOP) banner2.SetGradient(start='#FF8000', end='#FFFFFF') banner2.SetText("Phoenix", phoenix) # Layout vsizer = wx.BoxSizer(wx.VERTICAL) vsizer.Add(whitePanel, 0, wx.EXPAND | wx.TOP | wx.LEFT | wx.RIGHT, 5) vsizer.Add(banner2, 1, wx.EXPAND | wx.BOTTOM | wx.LEFT | wx.RIGHT, 5) self.SetSizer(vsizer) class TestPanel(wx.Panel): def __init__(self, parent, log): self.log = log wx.Panel.__init__(self, parent, -1) banners = SampleBanners(self) sizer = wx.BoxSizer(wx.VERTICAL) sizer.Add(banners, 0, wx.EXPAND) text = wx.StaticText(self, -1, overview) sizer.Add(text, 0, wx.EXPAND|wx.ALL, 15) self.SetSizer(sizer) def runTest(frame, nb, log): win = TestPanel(nb, log) return win #--------------------------------------------------------------------------- overview = """\ This sample displays two banner windows, one with an image, and one with text and a colour gradient background. Banner windows can be used to present some overview of the current window contents to the user in an aesthetically pleasant way. They are typically positioned along the left or top edge of the window (although this class also supports right-aligned and bottom-aligned banners) and show either a bitmap with a logo or a few lines of text on a gradient-filled background. """ if __name__ == '__main__': import sys,os import run run.main(['', os.path.basename(sys.argv[0])] + sys.argv[1:]) \ No newline at end of file diff --git a/demo/CheckListBox.py b/demo/CheckListBox.py index abd9a549..98221cdb 100644 --- a/demo/CheckListBox.py +++ b/demo/CheckListBox.py @@ -22,7 +22,7 @@ class TestPanel(wx.Panel): self.lb = lb lb.Bind(wx.EVT_RIGHT_DOWN, self.OnDoHitTest) - + pos = lb.GetPosition().x + lb.GetSize().width + 25 btn = wx.Button(self, -1, "Test SetString", (pos, 50)) self.Bind(wx.EVT_BUTTON, self.OnTestButton, btn) @@ -38,7 +38,7 @@ class TestPanel(wx.Panel): status = '' self.log.WriteText('Box %s is %schecked \n' % (label, status)) self.lb.SetSelection(index) # so that (un)checking also selects (moves the highlight) - + def OnTestButton(self, evt): self.lb.SetString(4, "FUBAR") @@ -59,9 +59,9 @@ def runTest(frame, nb, log): overview = """\ A checklistbox is like a Listbox, but allows items to be checked or unchecked rather than relying on extended selection (e.g. shift-select) to select multiple items in -the list. +the list. -This class is currently implemented under Windows and GTK. +This class is currently implemented under Windows and GTK. This demo shows the basic CheckListBox and how to use the SetString method to change labels dynamically. diff --git a/demo/Choicebook.py b/demo/Choicebook.py index f63196c9..68653a05 100644 --- a/demo/Choicebook.py +++ b/demo/Choicebook.py @@ -11,7 +11,7 @@ pageTexts = [ "Yet", "Select", "Pages" ] - + class TestCB(wx.Choicebook): def __init__(self, parent, id, log): @@ -29,7 +29,7 @@ class TestCB(wx.Choicebook): else: st = wx.StaticText(win, -1, "Page: %d" % count, (10,10)) count += 1 - + self.AddPage(win, txt) self.Bind(wx.EVT_CHOICEBOOK_PAGE_CHANGED, self.OnPageChanged) diff --git a/demo/CollapsiblePane.py b/demo/CollapsiblePane.py index a7a02828..68ec6f2e 100644 --- a/demo/CollapsiblePane.py +++ b/demo/CollapsiblePane.py @@ -33,12 +33,12 @@ class TestPanel(wx.Panel): self.btn = btn = wx.Button(self, label=btnlbl1) self.Bind(wx.EVT_BUTTON, self.OnToggle, btn) sizer.Add(btn, 0, wx.ALL, 25) - - + + def OnToggle(self, evt): self.cp.Collapse(self.cp.IsExpanded()) self.OnPaneChanged() - + def OnPaneChanged(self, evt=None): if evt: @@ -55,7 +55,7 @@ class TestPanel(wx.Panel): self.cp.SetLabel(label1) self.btn.SetLabel(btnlbl1) self.btn.SetInitialSize() - + def MakePaneContent(self, pane): '''Just make a few controls to put on the collapsible pane''' @@ -70,16 +70,16 @@ class TestPanel(wx.Panel): city = wx.TextCtrl(pane, -1, "", size=(150,-1)); state = wx.TextCtrl(pane, -1, "", size=(50,-1)); zip = wx.TextCtrl(pane, -1, "", size=(70,-1)); - + addrSizer = wx.FlexGridSizer(cols=2, hgap=5, vgap=5) addrSizer.AddGrowableCol(1) - addrSizer.Add(nameLbl, 0, + addrSizer.Add(nameLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) addrSizer.Add(name, 0, wx.EXPAND) addrSizer.Add(addrLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) addrSizer.Add(addr1, 0, wx.EXPAND) - addrSizer.Add((5,5)) + addrSizer.Add((5,5)) addrSizer.Add(addr2, 0, wx.EXPAND) addrSizer.Add(cstLbl, 0, diff --git a/demo/ColourDB.py b/demo/ColourDB.py index 14331bf2..d3802b21 100644 --- a/demo/ColourDB.py +++ b/demo/ColourDB.py @@ -115,7 +115,7 @@ class TestWindow(wx.ScrolledWindow): else: start = 0 stop = numColours - + for line in range(max(0,start), min(stop,numColours)): clr = colours[line][0] y = (line+1) * self.lineHeight + 2 diff --git a/demo/ComboTreeBox.py b/demo/ComboTreeBox.py index b45df47f..6caf65b5 100644 --- a/demo/ComboTreeBox.py +++ b/demo/ComboTreeBox.py @@ -13,10 +13,10 @@ class TestComboTreeBox(wx.Panel): self.log = log panelSizer = wx.FlexGridSizer(cols=2) panelSizer.AddGrowableCol(1) - for style, labelText in [(0, 'Default style:'), + for style, labelText in [(0, 'Default style:'), (wx.CB_READONLY, 'Read-only style:')]: label = wx.StaticText(self, label=labelText) - panelSizer.Add(label, flag=wx.ALL|wx.ALIGN_CENTER_VERTICAL, + panelSizer.Add(label, flag=wx.ALL|wx.ALIGN_CENTER_VERTICAL, border=5) comboBox = self._createComboTreeBox(style) panelSizer.Add(comboBox, flag=wx.EXPAND|wx.ALL, border=5) @@ -32,9 +32,9 @@ class TestComboTreeBox(wx.Panel): for k in range(5): comboBox.Append('Item %d.%d.%d'%(i,j, k), grandChild) return comboBox - + def _bindEventHandlers(self, comboBox): - for eventType, handler in [(wx.EVT_COMBOBOX, self.OnItemSelected), + for eventType, handler in [(wx.EVT_COMBOBOX, self.OnItemSelected), (wx.EVT_TEXT, self.OnItemEntered)]: comboBox.Bind(eventType, handler) diff --git a/demo/DVC_CustomRenderer.py b/demo/DVC_CustomRenderer.py index 2ce726cc..3c6b0b4e 100644 --- a/demo/DVC_CustomRenderer.py +++ b/demo/DVC_CustomRenderer.py @@ -11,7 +11,7 @@ class MyCustomRenderer(dv.DataViewCustomRenderer): dv.DataViewCustomRenderer.__init__(self, *args, **kw) self.log = log self.value = None - + def SetValue(self, value): #self.log.write('SetValue: %s' % value) @@ -115,17 +115,17 @@ class TestPanel(wx.Panel): # Create a dataview control self.dvc = dv.DataViewCtrl(self, style=wx.BORDER_THEME - | dv.DV_ROW_LINES + | dv.DV_ROW_LINES #| dv.DV_HORIZ_RULES | dv.DV_VERT_RULES | dv.DV_MULTIPLE ) - + # Create an instance of the model if model is None: self.model = TestModel(data, log) else: - self.model = model + self.model = model self.dvc.AssociateModel(self.model) # Now we create some columns. @@ -142,10 +142,10 @@ class TestPanel(wx.Panel): column = dv.DataViewColumn(title, renderer, col, width=width) column.Alignment = wx.ALIGN_LEFT self.dvc.AppendColumn(column) - - self.Sizer = wx.BoxSizer(wx.VERTICAL) + + self.Sizer = wx.BoxSizer(wx.VERTICAL) self.Sizer.Add(self.dvc, 1, wx.EXPAND) - + #---------------------------------------------------------------------- diff --git a/demo/DVC_DataViewModel.py b/demo/DVC_DataViewModel.py index c6541646..4593b1d7 100644 --- a/demo/DVC_DataViewModel.py +++ b/demo/DVC_DataViewModel.py @@ -224,7 +224,7 @@ class MyTreeListModel(dv.PyDataViewModel): elif col == 5: node.like = value return True - + #---------------------------------------------------------------------- diff --git a/demo/DelayedResult.py b/demo/DelayedResult.py index def625bb..6d28e550 100644 --- a/demo/DelayedResult.py +++ b/demo/DelayedResult.py @@ -1,9 +1,9 @@ #!/usr/bin/env python """ -This demonstrates a simple use of delayedresult: get/compute +This demonstrates a simple use of delayedresult: get/compute something that takes a long time, without hanging the GUI while this -is taking place. +is taking place. The top button runs a small GUI that uses wx.lib.delayedresult.startWorker to wrap a long-running function into a separate thread. Just click @@ -45,7 +45,7 @@ class FrameSimpleDelayedBase(wx.Frame): vsizer.Add(hsizer, 0, wx.ALL, 5) pnl.SetSizer(vsizer) vsizer.SetSizeHints(self) - + self.Bind(wx.EVT_BUTTON, self.handleGet, self.buttonGet) self.Bind(wx.EVT_BUTTON, self.handleAbort, self.buttonAbort) @@ -53,7 +53,7 @@ class FrameSimpleDelayedBase(wx.Frame): class FrameSimpleDelayed(FrameSimpleDelayedBase): """This demos simplistic use of delayedresult module.""" - + def __init__(self, *args, **kwargs): FrameSimpleDelayedBase.__init__(self, *args, **kwargs) self.jobID = 0 @@ -76,24 +76,24 @@ class FrameSimpleDelayed(FrameSimpleDelayedBase): self.log( "Exiting: Aborting job %s" % self.jobID ) self.abortEvent.set() self.Destroy() - - def handleGet(self, event): + + def handleGet(self, event): """Compute result in separate thread, doesn't affect GUI response.""" self.buttonGet.Enable(False) self.buttonAbort.Enable(True) self.abortEvent.clear() self.jobID += 1 - + self.log( "Starting job %s in producer thread: GUI remains responsive" % self.jobID ) - delayedresult.startWorker(self._resultConsumer, self._resultProducer, + delayedresult.startWorker(self._resultConsumer, self._resultProducer, wargs=(self.jobID,self.abortEvent), jobID=self.jobID) - + def _resultProducer(self, jobID, abortEvent): """ Pretend to be a complex worker function or something that takes - long time to run due to network access etc. GUI will freeze if this + long time to run due to network access etc. GUI will freeze if this method is not called in separate thread. """ import time @@ -104,14 +104,14 @@ class FrameSimpleDelayed(FrameSimpleDelayedBase): return jobID - def handleAbort(self, event): + def handleAbort(self, event): """Abort the result computation.""" self.log( "Aborting result for job %s" % self.jobID ) self.buttonGet.Enable(True) self.buttonAbort.Enable(False) self.abortEvent.set() - + def _resultConsumer(self, delayedResult): jobID = delayedResult.getJobID() assert jobID == self.jobID @@ -120,11 +120,11 @@ class FrameSimpleDelayed(FrameSimpleDelayedBase): except Exception as exc: self.log( "Result for job %s raised exception: %s" % (jobID, exc) ) return - + # output result self.log( "Got result for job %s: %s" % (jobID, result) ) self.textCtrlResult.SetValue(str(result)) - + # get ready for next job: self.buttonGet.Enable(True) self.buttonAbort.Enable(False) @@ -134,7 +134,7 @@ class FrameSimpleDelayed(FrameSimpleDelayedBase): class FrameSimpleDirect(FrameSimpleDelayedBase): """This does not use delayedresult so the GUI will freeze while the GET is taking place.""" - + def __init__(self, *args, **kwargs): self.jobID = 1 FrameSimpleDelayedBase.__init__(self, *args, **kwargs) @@ -144,7 +144,7 @@ class FrameSimpleDirect(FrameSimpleDelayedBase): self.log = log - def handleGet(self, event): + def handleGet(self, event): """ Not using delayedresult, this will compute result in the same thread, and will affect GUI response because a thread is not used. @@ -160,7 +160,7 @@ class FrameSimpleDirect(FrameSimpleDelayedBase): def _resultProducer(self, jobID): """ Pretend to be a complex worker function or something that takes - long time to run due to network access etc. GUI will freeze if this + long time to run due to network access etc. GUI will freeze if this method is not called in separate thread. """ import time @@ -177,7 +177,7 @@ class FrameSimpleDirect(FrameSimpleDelayedBase): # output result self.log( "Got result for job %s: %s" % (self.jobID, result) ) self.textCtrlResult.SetValue(str(result)) - + # get ready for next job: self.buttonGet.Enable(True) self.buttonAbort.Enable(False) @@ -215,7 +215,7 @@ class TestPanel(wx.Panel): frame = FrameSimpleDirect(self, title="Long-running function in GUI thread") frame.setLog(self.log.WriteText) frame.Show() - + #--------------------------------------------------------------------------- diff --git a/demo/Dialog.py b/demo/Dialog.py index d6f03ef4..2e12519f 100644 --- a/demo/Dialog.py +++ b/demo/Dialog.py @@ -12,7 +12,7 @@ wx.HelpProvider.Set(provider) class TestDialog(wx.Dialog): def __init__( - self, parent, id, title, size=wx.DefaultSize, pos=wx.DefaultPosition, + self, parent, id, title, size=wx.DefaultSize, pos=wx.DefaultPosition, style=wx.DEFAULT_DIALOG_STYLE, name='dialog' ): @@ -60,11 +60,11 @@ class TestDialog(wx.Dialog): sizer.Add(line, 0, wx.GROW|wx.ALIGN_CENTER_VERTICAL|wx.RIGHT|wx.TOP, 5) btnsizer = wx.StdDialogButtonSizer() - + if wx.Platform != "__WXMSW__": btn = wx.ContextHelpButton(self) btnsizer.AddButton(btn) - + btn = wx.Button(self, wx.ID_OK) btn.SetHelpText("The OK button completes the dialog") btn.SetDefault() @@ -93,7 +93,7 @@ class TestPanel(wx.Panel): b = wx.Button(self, -1, "Show dialog with ShowWindowModal", (50, 140)) self.Bind(wx.EVT_BUTTON, self.OnShowWindowModal, b) self.Bind(wx.EVT_WINDOW_MODAL_DIALOG_CLOSED, self.OnWindowModalDialogClosed) - + def OnButton(self, evt): dlg = TestDialog(self, -1, "Sample Dialog", size=(350, 200), @@ -103,14 +103,14 @@ class TestPanel(wx.Panel): # this does not return until the dialog is closed. val = dlg.ShowModal() - + if val == wx.ID_OK: self.log.WriteText("You pressed OK\n") else: self.log.WriteText("You pressed Cancel\n") dlg.Destroy() - + def OnShowWindowModal(self, evt): dlg = TestDialog(self, -1, "Sample Dialog", size=(350, 200), @@ -126,7 +126,7 @@ class TestPanel(wx.Panel): wx.ID_CANCEL: "Cancel" }[val] except KeyError: btnTxt = '' - + wx.MessageBox("You closed the window-modal dialog with the %s button" % btnTxt) dialog.Destroy() diff --git a/demo/DialogUnits.py b/demo/DialogUnits.py index 5acda83b..d89714c6 100644 --- a/demo/DialogUnits.py +++ b/demo/DialogUnits.py @@ -31,20 +31,20 @@ class MyFrame(wx.Frame): # Add a panel and some controls to display the size and position panel = wx.Panel(self, -1) - wx.StaticText(panel, -1, "Size:", + wx.StaticText(panel, -1, "Size:", panel.DLG_UNIT((4, 4)), wx.DefaultSize ) - wx.StaticText(panel, -1, "Pos:", + wx.StaticText(panel, -1, "Pos:", panel.DLG_UNIT((4, 20)), wx.DefaultSize ) - self.sizeCtrl = wx.TextCtrl(panel, -1, "", + self.sizeCtrl = wx.TextCtrl(panel, -1, "", panel.DLG_UNIT((24, 4)), panel.DLG_UNIT((36, -1)), wx.TE_READONLY) - self.posCtrl = wx.TextCtrl(panel, -1, "", + self.posCtrl = wx.TextCtrl(panel, -1, "", panel.DLG_UNIT((24, 20)), panel.DLG_UNIT((36, -1)), wx.TE_READONLY) diff --git a/demo/DirDialog.py b/demo/DirDialog.py index dbe46b90..2b9aa4a9 100644 --- a/demo/DirDialog.py +++ b/demo/DirDialog.py @@ -14,7 +14,7 @@ class TestPanel(wx.Panel): def OnButton(self, evt): - # In this case we include a "New directory" button. + # In this case we include a "New directory" button. dlg = wx.DirDialog(self, "Choose a directory:", style=wx.DD_DEFAULT_STYLE #| wx.DD_DIR_MUST_EXIST @@ -23,7 +23,7 @@ class TestPanel(wx.Panel): # If the user selects OK, then we process the dialog's data. # This is done by getting the path data from the dialog - BEFORE - # we destroy it. + # we destroy it. if dlg.ShowModal() == wx.ID_OK: self.log.WriteText('You selected: %s\n' % dlg.GetPath()) diff --git a/demo/DragAndDrop.py b/demo/DragAndDrop.py index b2d0be57..b1325143 100644 --- a/demo/DragAndDrop.py +++ b/demo/DragAndDrop.py @@ -20,7 +20,7 @@ class ClipTextPanel(wx.Panel): wx.StaticText( self, -1, "Copy/Paste text to/from\n" "this window and other apps" - ), + ), 0, wx.EXPAND|wx.ALL, 2 ) @@ -32,7 +32,7 @@ class ClipTextPanel(wx.Panel): hsz.Add(wx.Button(self, ID_PasteBtn, " Paste "), 1, wx.EXPAND|wx.ALL, 2) sizer.Add(hsz, 0, wx.EXPAND) sizer.Add( - wx.Button(self, ID_BitmapBtn, " Copy Bitmap "), + wx.Button(self, ID_BitmapBtn, " Copy Bitmap "), 0, wx.EXPAND|wx.ALL, 2 ) diff --git a/demo/DragScroller.py b/demo/DragScroller.py index 70c069da..0143f336 100644 --- a/demo/DragScroller.py +++ b/demo/DragScroller.py @@ -2,7 +2,7 @@ import wx import wx.lib.dragscroller - + #------------------------------------------------------------------------------- def runTest(frame, nb, log): @@ -19,23 +19,23 @@ class DragScrollerExample(wx.ScrolledWindow): self.SetScrollbars(1, 1, 2000, 2000, 0, 0) self.scroller = wx.lib.dragscroller.DragScroller(self) - + def OnPaint(self, event): dc = wx.PaintDC(self) self.PrepareDC(dc) - + pen = wx.Pen(wx.BLACK, 5) dc.SetPen(pen) for y in range(10): for x in range(10): dc.DrawCircle(x*400+20, y*400+20, 200) - + dc.DrawText('Right click and drag in the direction you want to scroll.', 20, 20) - dc.DrawText('The distance from the start of the drag determines the speed.', + dc.DrawText('The distance from the start of the drag determines the speed.', 20, 50) - + def OnRightDown(self, event): self.scroller.Start(event.GetPosition()) @@ -52,7 +52,7 @@ A helper class that adds scrolling to a wx.ScrolledWindow in the direction of the drag. """ - + if __name__ == '__main__': import sys,os import run diff --git a/demo/ExpandoTextCtrl.py b/demo/ExpandoTextCtrl.py index 8c3e9323..d6dc8b37 100644 --- a/demo/ExpandoTextCtrl.py +++ b/demo/ExpandoTextCtrl.py @@ -65,7 +65,7 @@ class TestFrame(wx.Frame): frameSizer = wx.BoxSizer() frameSizer.Add(p, 1, wx.EXPAND) self.SetSizer(frameSizer) - + self.Fit() @@ -85,21 +85,21 @@ class TestFrame(wx.Frame): if dlg.ShowModal() == wx.ID_OK: self.eom.SetMaxHeight(dlg.GetValue()) dlg.Destroy() - - + + def OnSetFont(self, evt): dlg = wx.FontDialog(self, wx.FontData()) dlg.GetFontData().SetInitialFont(self.eom.GetFont()) if dlg.ShowModal() == wx.ID_OK: self.eom.SetFont(dlg.GetFontData().GetChosenFont()) dlg.Destroy() - - + + def OnWriteText(self, evt): self.eom.WriteText("\nThis is a test... Only a test. If this had " "been a real emergency you would have seen the " "quick brown fox jump over the lazy dog.\n") - + def OnAppendText(self, evt): self.eom.AppendText("\nAppended text.") @@ -114,7 +114,7 @@ class TestFrame(wx.Frame): #print(self.eom.numLines) self.eom._adjustCtrl() #print(self.eom.numLines) - + #---------------------------------------------------------------------- class TestPanel(wx.Panel): @@ -130,7 +130,7 @@ class TestPanel(wx.Panel): self.win = TestFrame(self, self.log) self.win.Show(True) - + #---------------------------------------------------------------------- def runTest(frame, nb, log): diff --git a/demo/FancyText.py b/demo/FancyText.py index 99ed7884..1d72c636 100644 --- a/demo/FancyText.py +++ b/demo/FancyText.py @@ -1,5 +1,5 @@ #!/usr/bin/env python - + import wx import wx.lib.fancytext as fancytext @@ -51,18 +51,18 @@ overview = \ In all cases, 'str' is an XML string. Note that start and end tags -are only required if *enclose* is set to False. In this case the +are only required if *enclose* is set to False. In this case the text should be wrapped in FancyText tags.

In addition, the module exports one class::

     class StaticFancyText(self, window, id, text, background, ...)
 
-This class works similar to StaticText except it interprets its text +This class works similar to StaticText except it interprets its text as FancyText.

The text can supportsuperscripts and subscripts, text -in different sizes, colors, +in different sizes, colors, styles, weights and families. It also supports a limited set of symbols, currently , , as well as greek letters in both diff --git a/demo/FileBrowseButton.py b/demo/FileBrowseButton.py index 50278307..662d7abf 100644 --- a/demo/FileBrowseButton.py +++ b/demo/FileBrowseButton.py @@ -23,7 +23,7 @@ class TestPanel(wx.Panel): self.fbbh = filebrowse.FileBrowseButtonWithHistory( self, -1, size=(450, -1), changeCallback = self.fbbhCallback ) - + self.dbb = filebrowse.DirBrowseButton( self, -1, size=(450, -1), changeCallback = self.dbbCallback ) @@ -88,9 +88,9 @@ overview = """ < """ % ( filebrowse.FileBrowseButton.__doc__, - filebrowse.FileBrowseButtonWithHistory.__doc__ , + filebrowse.FileBrowseButtonWithHistory.__doc__ , filebrowse.DirBrowseButton.__doc__ - ) + ) if __name__ == '__main__': diff --git a/demo/FindReplaceDialog.py b/demo/FindReplaceDialog.py index 9e62060d..b000b686 100644 --- a/demo/FindReplaceDialog.py +++ b/demo/FindReplaceDialog.py @@ -3,7 +3,7 @@ # 11/17/2003 - Jeff Grimmett (grimmtooth@softhome.net) # # o Updated for wx namespace -# +# # 11/28/2003 - Jeff Grimmett (grimmtooth@softhome.net) # # o Changed the event binding slightly. @@ -64,7 +64,7 @@ class TestPanel(wx.Panel): } et = evt.GetEventType() - + if et in map: evtType = map[et] else: @@ -83,7 +83,7 @@ class TestPanel(wx.Panel): self.log.write("FindReplaceDialog closing...\n") evt.GetDialog().Destroy() self.EnableButtons() - + #--------------------------------------------------------------------------- @@ -97,17 +97,17 @@ def runTest(frame, nb, log): overview = """\ -FindReplaceDialog is a standard modeless dialog which is used to allow the user -to search for some text (and possibly replace it with something else). The actual -searching is supposed to be done in the owner window which is the parent of this -dialog. Note that it means that unlike for the other standard dialogs this one -must have a parent window. Also note that there is no way to use this +FindReplaceDialog is a standard modeless dialog which is used to allow the user +to search for some text (and possibly replace it with something else). The actual +searching is supposed to be done in the owner window which is the parent of this +dialog. Note that it means that unlike for the other standard dialogs this one +must have a parent window. Also note that there is no way to use this dialog in a modal way; it is always, by design and implementation, modeless. -FileReplaceDialog requires the use of FindReplaceData. This holds the -data for the dialog. It is used to initialize the dialog with the default values -and will keep the last values from the dialog when it is closed. It is also -updated each time a FindDialogEvent is generated so instead of using the +FileReplaceDialog requires the use of FindReplaceData. This holds the +data for the dialog. It is used to initialize the dialog with the default values +and will keep the last values from the dialog when it is closed. It is also +updated each time a FindDialogEvent is generated so instead of using the FindDialogEvent methods you can also directly query this object. Care must be taken not to use this object after the dialog is destroyed. The data within will be invalid after the parent dialog is destroyed. diff --git a/demo/FloatCanvas.py b/demo/FloatCanvas.py index 1f88f9b6..868947fd 100644 --- a/demo/FloatCanvas.py +++ b/demo/FloatCanvas.py @@ -13,7 +13,7 @@ except ImportError: "You can get info about it at:\n" "http://numpy.scipy.org/\n\n" ) - + #--------------------------------------------------------------------------- @@ -114,7 +114,7 @@ def BuildDrawFrame(): # this gets called when needed, rather than on import self.CreateStatusBar() - + # Add the Canvas NC = NavCanvas.NavCanvas(self, Debug = 0, @@ -128,7 +128,7 @@ def BuildDrawFrame(): # this gets called when needed, rather than on import wx.TE_READONLY | wx.SUNKEN_BORDER) ) - + ##Create a sizer to manage the Canvas and message window MainSizer = wx.BoxSizer(wx.VERTICAL) MainSizer.Add(NC, 4, wx.EXPAND) @@ -137,8 +137,8 @@ def BuildDrawFrame(): # this gets called when needed, rather than on import self.SetSizer(MainSizer) self.Bind(wx.EVT_CLOSE, self.OnCloseWindow) - self.Canvas.Bind(FloatCanvas.EVT_MOTION, self.OnMove) - self.Canvas.Bind(FloatCanvas.EVT_MOUSEWHEEL, self.OnWheel) + self.Canvas.Bind(FloatCanvas.EVT_MOTION, self.OnMove) + self.Canvas.Bind(FloatCanvas.EVT_MOUSEWHEEL, self.OnWheel) self.EventsAreBound = False @@ -153,22 +153,22 @@ def BuildDrawFrame(): # this gets called when needed, rather than on import self.MsgWindow.AppendText(text) if not text[-1] == "\n": self.MsgWindow.AppendText("\n") - + def BindAllMouseEvents(self): if not self.EventsAreBound: ## Here is how you catch FloatCanvas mouse events - self.Canvas.Bind(FloatCanvas.EVT_LEFT_DOWN, self.OnLeftDown) + self.Canvas.Bind(FloatCanvas.EVT_LEFT_DOWN, self.OnLeftDown) self.Canvas.Bind(FloatCanvas.EVT_LEFT_UP, self.OnLeftUp) - self.Canvas.Bind(FloatCanvas.EVT_LEFT_DCLICK, self.OnLeftDouble) + self.Canvas.Bind(FloatCanvas.EVT_LEFT_DCLICK, self.OnLeftDouble) - self.Canvas.Bind(FloatCanvas.EVT_MIDDLE_DOWN, self.OnMiddleDown) - self.Canvas.Bind(FloatCanvas.EVT_MIDDLE_UP, self.OnMiddleUp) - self.Canvas.Bind(FloatCanvas.EVT_MIDDLE_DCLICK, self.OnMiddleDouble) + self.Canvas.Bind(FloatCanvas.EVT_MIDDLE_DOWN, self.OnMiddleDown) + self.Canvas.Bind(FloatCanvas.EVT_MIDDLE_UP, self.OnMiddleUp) + self.Canvas.Bind(FloatCanvas.EVT_MIDDLE_DCLICK, self.OnMiddleDouble) - self.Canvas.Bind(FloatCanvas.EVT_RIGHT_DOWN, self.OnRightDown) - self.Canvas.Bind(FloatCanvas.EVT_RIGHT_UP, self.OnRightUp) - self.Canvas.Bind(FloatCanvas.EVT_RIGHT_DCLICK, self.OnRightDouble) + self.Canvas.Bind(FloatCanvas.EVT_RIGHT_DOWN, self.OnRightDown) + self.Canvas.Bind(FloatCanvas.EVT_RIGHT_UP, self.OnRightUp) + self.Canvas.Bind(FloatCanvas.EVT_RIGHT_DCLICK, self.OnRightDouble) self.EventsAreBound = True @@ -197,7 +197,7 @@ def BuildDrawFrame(): # this gets called when needed, rather than on import def OnSavePNG(self, event=None): import os dlg = wx.FileDialog( - self, message="Save file as ...", defaultDir=os.getcwd(), + self, message="Save file as ...", defaultDir=os.getcwd(), defaultFile="", wildcard="*.png", style=wx.FD_SAVE ) if dlg.ShowModal() == wx.ID_OK: @@ -206,7 +206,7 @@ def BuildDrawFrame(): # this gets called when needed, rather than on import path = path+".png" self.Canvas.SaveAsImage(path) - + def OnLeftDown(self, event): self.Log("LeftDown") self.PrintCoords(event) @@ -252,7 +252,7 @@ def BuildDrawFrame(): # this gets called when needed, rather than on import self.Canvas.MoveImage( (Rot, 0), "Panel" ) else: # move up-down self.Canvas.MoveImage( (0, Rot), "Panel" ) - + def OnMove(self, event): """ Updates the status bar with the world coordinates @@ -288,7 +288,7 @@ def BuildDrawFrame(): # this gets called when needed, rather than on import This demo draws a few of everything """ - + wx.GetApp().Yield(True) Range = (-10,10) @@ -298,11 +298,11 @@ def BuildDrawFrame(): # this gets called when needed, rather than on import Canvas = self.Canvas Canvas.InitAll() - # + # ## these set the limits for how much you can zoom in and out Canvas.MinScale = 14 Canvas.MaxScale = 500 - + ############# Random tests of everything ############## @@ -873,9 +873,9 @@ def BuildDrawFrame(): # this gets called when needed, rather than on import self.BindAllMouseEvents() Canvas = self.Canvas Canvas.InitAll() - - DefaultSize = 12 + + DefaultSize = 12 Point = (3, 0) ## Add a non-visible rectangle, just to get a Bounding Box @@ -1231,7 +1231,7 @@ def BuildDrawFrame(): # this gets called when needed, rather than on import self.UnBindAllMouseEvents() Canvas = self.Canvas Canvas.InitAll() - + Canvas.AddRectangle((10, 20), (400, 100), LineWidth = 3, @@ -1241,7 +1241,7 @@ def BuildDrawFrame(): # this gets called when needed, rather than on import bmp = Resources.getMagPlusBitmap() Canvas.AddText("These are Unscaled Bitmaps:", (140, 90)) - + Point = (150, 50) BitMap = Canvas.AddBitmap(bmp, Point, Position = "cc" ) Canvas.AddPoint(Point, Diameter=4, Color="Green") @@ -1292,7 +1292,7 @@ def BuildDrawFrame(): # this gets called when needed, rather than on import def DrawMap(self,event = None): wx.GetApp().Yield(True) import os, time - + self.Canvas.InitAll() self.Canvas.SetProjectionFun("FlatEarth") self.BindAllMouseEvents() @@ -1378,7 +1378,7 @@ def BuildDrawFrame(): # this gets called when needed, rather than on import Canvas = self.Canvas Canvas.InitAll() - + # Pointset coords = [] for i in range(1000): @@ -1401,7 +1401,7 @@ def BuildDrawFrame(): # this gets called when needed, rather than on import Canvas = self.Canvas Canvas.InitAll() - + self.ColorObjectsAll = [] self.ColorObjectsLine = [] self.ColorObjectsColor = [] @@ -1423,7 +1423,7 @@ def BuildDrawFrame(): # this gets called when needed, rather than on import self.Ellipse = Canvas.AddEllipse(Point, wh, LineWidth = lw, FillColor = colors[cf]) self.ColorObjectsAll.append(self.Ellipse) - # Point + # Point xy = (random.uniform(Range[0],Range[1]),random.uniform(Range[0],Range[1])) D = random.randint(1,50) lw = random.randint(1,5) @@ -1460,7 +1460,7 @@ def BuildDrawFrame(): # this gets called when needed, rather than on import cf = random.randint(0,len(colors)-1) cl = random.randint(0,len(colors)-1) self.ColorObjectsAll.append(Canvas.AddPolygon(points, - LineWidth = lw, + LineWidth = lw, LineColor = colors[cl], FillColor = colors[cf], FillStyle = 'Solid')) @@ -1541,7 +1541,7 @@ def BuildDrawFrame(): # this gets called when needed, rather than on import Canvas.InitAll() Canvas.MinScale = 15 Canvas.MaxScale = 30 - + # put in a rectangle to get a bounding box Canvas.AddRectangle((0,0), (20,20), LineColor = None) @@ -1587,7 +1587,7 @@ def BuildDrawFrame(): # this gets called when needed, rather than on import self.UnBindAllMouseEvents() Canvas = self.Canvas Canvas.InitAll() - + Range = (-10,10) # Create a couple random Polygons @@ -1622,7 +1622,7 @@ def BuildDrawFrame(): # this gets called when needed, rather than on import ) HideButton.Bind(FloatCanvas.EVT_FC_LEFT_DOWN, self.HidePoly) HideButton.HidePoly = Poly - + HideButton2 = Canvas.AddScaledTextBox("Click To Hide\nForeground Polygon", (-10, 5), .5, @@ -1634,7 +1634,7 @@ def BuildDrawFrame(): # this gets called when needed, rather than on import # Put a reference to the Polygon in the Button object HideButton2.Bind(FloatCanvas.EVT_FC_LEFT_DOWN, self.HidePoly) HideButton2.HidePoly = Poly2 - + Canvas.ZoomToBB() @@ -1652,20 +1652,20 @@ def BuildDrawFrame(): # this gets called when needed, rather than on import def TempTest(self, event= None): """ - + This is the start of a poly editor test, but it's not complete so you can only run it through a command line flag: - + python FloatCanvasDemo.py --temp - + """ - + wx.GetApp().Yield(True) self.UnBindAllMouseEvents() Canvas = self.Canvas Canvas.InitAll() - + Range = (-10,10) # Create a random Polygon @@ -1754,10 +1754,10 @@ def BuildDrawFrame(): # this gets called when needed, rather than on import return Lines else: return Shorelines - return DrawFrame + return DrawFrame #--------------------------------------------------------------------------- - + if __name__ == "__main__": # running stand alone, Use wxversion: @@ -1765,8 +1765,8 @@ if __name__ == "__main__": # wxversion.select("2.6") # wxversion.select("2.8") import wx - - + + # check options: import sys, getopt optlist, args = getopt.getopt(sys.argv[1:],'l',["all", @@ -1802,7 +1802,7 @@ if __name__ == "__main__": objects, of each kind supported. *Draw Map: will draw a map of the world. Be patient, it is a big map, - with a lot of data, and will take a while to load and draw (about 10 sec + with a lot of data, and will take a while to load and draw (about 10 sec on my 450Mhz PIII). Redraws take about 2 sec. This demonstrates how the performance is not very good for large drawings. @@ -1810,7 +1810,7 @@ if __name__ == "__main__": Once you have a picture drawn, you can zoom in and out and move about the picture. There is a tool bar with three tools that can be - selected. + selected. The magnifying glass with the plus is the zoom in tool. Once selected, if you click the image, it will zoom in, centered on where you diff --git a/demo/Gauge.py b/demo/Gauge.py index 34df7677..637e4c27 100644 --- a/demo/Gauge.py +++ b/demo/Gauge.py @@ -35,7 +35,7 @@ class TestPanel(wx.Panel): self.g2.Pulse() if 'wxMac' not in wx.PlaformInfo: self.g3.Pulse() - + #---------------------------------------------------------------------- diff --git a/demo/GetMouseState.py b/demo/GetMouseState.py index 7a4b45c0..d7b1436e 100644 --- a/demo/GetMouseState.py +++ b/demo/GetMouseState.py @@ -29,7 +29,7 @@ class TestPanel(wx.Panel): "Mouse and modifier state can be polled with wx.GetMouseState"), 0, wx.CENTER|wx.ALL, 10) sizer.Add(wx.StaticLine(self), 0, wx.EXPAND|wx.TOP, 10) - + row = wx.BoxSizer(wx.HORIZONTAL) sizer.Add(row, 0, wx.CENTER) @@ -99,7 +99,7 @@ class TestPanel(wx.Panel): self.cmd = StaticText(self, -1, "False") fgs.Add(lbl) fgs.Add(self.cmd) - + self.timer = wx.Timer(self) self.Bind(wx.EVT_TIMER, self.OnTimer, self.timer) self.timer.Start(100) @@ -109,7 +109,7 @@ class TestPanel(wx.Panel): ms = wx.GetMouseState() self.x.SetLabel( str(ms.x) ) self.y.SetLabel( str(ms.y) ) - + self.lft.SetLabel( str(ms.leftIsDown) ) self.mid.SetLabel( str(ms.middleIsDown) ) self.rgt.SetLabel( str(ms.rightIsDown) ) @@ -126,7 +126,7 @@ class TestPanel(wx.Panel): def ShutdownDemo(self): self.timer.Stop() del self.timer - + #---------------------------------------------------------------------- def runTest(frame, nb, log): diff --git a/demo/Grid.py b/demo/Grid.py index 8e5a0d55..cbf793ff 100644 --- a/demo/Grid.py +++ b/demo/Grid.py @@ -33,7 +33,7 @@ class ButtonPanel(wx.Panel): self.SetSizer(box) box.Fit(self) - + def OnButton(self, evt): modName = buttonDefs[evt.GetId()][0] @@ -56,7 +56,7 @@ overview = """\

wx.grid.Grid

-This demo shows various ways of using the wx.grid.Grid class. +This demo shows various ways of using the wx.grid.Grid class.

You can look at the sources for these samples to learn a lot about how the new classes work. diff --git a/demo/GridCustEditor.py b/demo/GridCustEditor.py index d0dcef5a..070554c3 100644 --- a/demo/GridCustEditor.py +++ b/demo/GridCustEditor.py @@ -220,7 +220,7 @@ class GridEditorTest(gridlib.Grid): self.SetCellValue(1, 2, "or any in this column") self.SetCellValue(2, 2, "and watch the log.") self.SetCellValue(4, 0, "(The log shows if the custom cell editor is being used.)") - + self.SetColSize(0, 150) self.SetColSize(1, 150) diff --git a/demo/GridDragable.py b/demo/GridDragable.py index 4fa2b3c6..dece408c 100644 --- a/demo/GridDragable.py +++ b/demo/GridDragable.py @@ -107,9 +107,9 @@ class CustomDataTable(gridlib.GridTableBase): msg = gridlib.GridTableMessage( self, gridlib.GRIDTABLE_NOTIFY_COLS_DELETED, frm, 1 ) - + grid.ProcessTableMessage(msg) - + msg = gridlib.GridTableMessage( self, gridlib.GRIDTABLE_NOTIFY_COLS_INSERTED, to, 1 ) diff --git a/demo/GridHugeTable.py b/demo/GridHugeTable.py index 2a6bfd60..27b15b27 100644 --- a/demo/GridHugeTable.py +++ b/demo/GridHugeTable.py @@ -22,12 +22,12 @@ class HugeTable(gridlib.GridTableBase): return attr - + # This is all it takes to make a custom data table to plug into a # wxGrid. There are many more methods that can be overridden, but # the ones shown below are the required ones. This table simply # provides strings containing the row and column values. - + def GetNumberRows(self): return 10000 @@ -59,8 +59,8 @@ class HugeTableGrid(gridlib.Grid): # Otherwise you would need to keep a reference to it, but that # would allow other grids to use the same table. self.SetTable(table, True) - - self.Bind(gridlib.EVT_GRID_CELL_RIGHT_CLICK, self.OnRightDown) + + self.Bind(gridlib.EVT_GRID_CELL_RIGHT_CLICK, self.OnRightDown) def OnRightDown(self, event): print("hello") diff --git a/demo/GridLabelRenderer.py b/demo/GridLabelRenderer.py index b7283725..86d9407f 100644 --- a/demo/GridLabelRenderer.py +++ b/demo/GridLabelRenderer.py @@ -11,11 +11,11 @@ class MyGrid(grid.Grid, glr.GridWithLabelRenderersMixin): grid.Grid.__init__(self, *args, **kw) glr.GridWithLabelRenderersMixin.__init__(self) - + class MyRowLabelRenderer(glr.GridLabelRenderer): def __init__(self, bgcolor): self._bgcolor = bgcolor - + def Draw(self, grid, dc, rect, row): dc.SetBrush(wx.Brush(self._bgcolor)) dc.SetPen(wx.TRANSPARENT_PEN) @@ -24,12 +24,12 @@ class MyRowLabelRenderer(glr.GridLabelRenderer): text = grid.GetRowLabelValue(row) self.DrawBorder(grid, dc, rect) self.DrawText(grid, dc, rect, text, hAlign, vAlign) - - + + class MyColLabelRenderer(glr.GridLabelRenderer): def __init__(self, bgcolor): self._bgcolor = bgcolor - + def Draw(self, grid, dc, rect, col): dc.SetBrush(wx.Brush(self._bgcolor)) dc.SetPen(wx.TRANSPARENT_PEN) @@ -38,20 +38,20 @@ class MyColLabelRenderer(glr.GridLabelRenderer): text = grid.GetColLabelValue(col) self.DrawBorder(grid, dc, rect) self.DrawText(grid, dc, rect, text, hAlign, vAlign) - - + + class MyCornerLabelRenderer(glr.GridLabelRenderer): def __init__(self): import images self._bmp = images.Smiles.getBitmap() - + def Draw(self, grid, dc, rect, rc): x = rect.left + (rect.width - self._bmp.GetWidth()) / 2 y = rect.top + (rect.height - self._bmp.GetHeight()) / 2 dc.DrawBitmap(self._bmp, x, y, True) - - - + + + class TestPanel(wx.Panel): def __init__(self, parent, log): self.log = log @@ -59,17 +59,17 @@ class TestPanel(wx.Panel): ROWS = 27 COLS = 15 - + g = MyGrid(self, size=(100,100)) g.CreateGrid(ROWS, COLS) g.SetCornerLabelRenderer(MyCornerLabelRenderer()) - + for row in range(0, ROWS, 3): g.SetRowLabelRenderer(row+0, MyRowLabelRenderer('#ffe0e0')) g.SetRowLabelRenderer(row+1, MyRowLabelRenderer('#e0ffe0')) g.SetRowLabelRenderer(row+2, MyRowLabelRenderer('#e0e0ff')) - + for col in range(0, COLS, 3): g.SetColLabelRenderer(col+0, MyColLabelRenderer('#e0ffe0')) g.SetColLabelRenderer(col+1, MyColLabelRenderer('#e0e0ff')) @@ -77,8 +77,8 @@ class TestPanel(wx.Panel): self.Sizer = wx.BoxSizer() self.Sizer.Add(g, 1, wx.EXPAND) - - + + #---------------------------------------------------------------------- def runTest(frame, nb, log): diff --git a/demo/GridSimple.py b/demo/GridSimple.py index c79c49f9..04bce2d4 100644 --- a/demo/GridSimple.py +++ b/demo/GridSimple.py @@ -77,7 +77,7 @@ class SimpleGrid(gridlib.Grid): ##, mixins.GridAutoEditMixin): self.SetCellRenderer(15,0, renderer) self.SetCellValue(15,0, "The text in this cell will be rendered with word-wrapping") - + # test all the events self.Bind(gridlib.EVT_GRID_CELL_LEFT_CLICK, self.OnCellLeftClick) self.Bind(gridlib.EVT_GRID_CELL_RIGHT_CLICK, self.OnCellRightClick) @@ -146,7 +146,7 @@ class SimpleGrid(gridlib.Grid): ##, mixins.GridAutoEditMixin): def OnGridColSort(self, evt): self.log.write("OnGridColSort: %s %s" % (evt.GetCol(), self.GetSortingColumn())) self.SetSortingColumn(evt.GetCol()) - + def OnRowSize(self, evt): self.log.write("OnRowSize: row %d, %s\n" % (evt.GetRowOrCol(), evt.GetPosition())) diff --git a/demo/HTML2_WebView.py b/demo/HTML2_WebView.py index 38c4dbec..09c3a0f9 100644 --- a/demo/HTML2_WebView.py +++ b/demo/HTML2_WebView.py @@ -14,14 +14,14 @@ class TestPanel(wx.Panel): self.frame = frame if frame: self.titleBase = frame.GetTitle() - + sizer = wx.BoxSizer(wx.VERTICAL) btnSizer = wx.BoxSizer(wx.HORIZONTAL) self.wv = webview.WebView.New(self) self.Bind(webview.EVT_WEBVIEW_NAVIGATING, self.OnWebViewNavigating, self.wv) self.Bind(webview.EVT_WEBVIEW_LOADED, self.OnWebViewLoaded, self.wv) - - + + btn = wx.Button(self, -1, "Open", style=wx.BU_EXACTFIT) self.Bind(wx.EVT_BUTTON, self.OnOpenButton, btn) btnSizer.Add(btn, 0, wx.EXPAND|wx.ALL, 2) @@ -60,7 +60,7 @@ class TestPanel(wx.Panel): sizer.Add(btnSizer, 0, wx.EXPAND) sizer.Add(self.wv, 1, wx.EXPAND) self.SetSizer(sizer) - + self.wv.LoadURL(self.current) @@ -83,7 +83,7 @@ class TestPanel(wx.Panel): # The full document has loaded self.current = evt.GetURL() self.location.SetValue(self.current) - + # Control bar events def OnLocationSelect(self, evt): @@ -117,7 +117,7 @@ class TestPanel(wx.Panel): def OnCheckCanGoBack(self, event): event.Enable(self.wv.CanGoBack()) - + def OnCheckCanGoForward(self, event): event.Enable(self.wv.CanGoForward()) @@ -126,8 +126,8 @@ class TestPanel(wx.Panel): def OnRefreshPageButton(self, evt): self.wv.Reload() - - + + #---------------------------------------------------------------------- def runTest(frame, nb, log): diff --git a/demo/Image.py b/demo/Image.py index 995d3713..47eca5cf 100644 --- a/demo/Image.py +++ b/demo/Image.py @@ -230,7 +230,7 @@ class ImagePanel(scrolled.ScrolledPanel): self.rotatehueIMG = getImg() self.rotatehueIMG.RotateHue(0.5) self.rotatehue = self.rotatehueIMG - + def ChangePanelColor(self, event): color = event.GetColour() self.SetBackgroundColour(color) diff --git a/demo/ImageAlpha.py b/demo/ImageAlpha.py index a098e1e0..117a96c5 100644 --- a/demo/ImageAlpha.py +++ b/demo/ImageAlpha.py @@ -24,7 +24,7 @@ class TestPanel(wx.Panel): dc.SetFont(wx.Font(16, wx.FONTFAMILY_SWISS, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD, True)) dc.DrawText("Bitmap alpha blending (on all ports but gtk+ 1.2)", 25,25) - + bmp = wx.Bitmap(opj('bitmaps/toucan.png')) if "gtk1" in wx.PlatformInfo: # Try to make up for lack of alpha support in wxGTK (gtk+ @@ -42,7 +42,7 @@ class TestPanel(wx.Panel): # convert back to a wx.Bitmap bmp = img.ConvertToBitmap() - + dc.DrawBitmap(bmp, 25,100, True) dc.SetFont(self.GetFont()) @@ -51,7 +51,7 @@ class TestPanel(wx.Panel): y += dc.GetCharHeight() + 5 dc.DrawText(msg, 200, y) dc.DrawBitmap(bmp, 250,100, True) - + #---------------------------------------------------------------------- diff --git a/demo/ImageBrowser.py b/demo/ImageBrowser.py index 6ad50931..05282bbc 100644 --- a/demo/ImageBrowser.py +++ b/demo/ImageBrowser.py @@ -42,7 +42,7 @@ class TestPanel(wx.Panel): if dlg.ShowModal() == wx.ID_OK: # show the selected file - self.log.WriteText("You Selected File: " + dlg.GetFile()) + self.log.WriteText("You Selected File: " + dlg.GetFile()) else: self.log.WriteText("You pressed Cancel\n") @@ -56,7 +56,7 @@ def runTest(frame, nb, log): win = TestPanel(nb, log) return win - + #--------------------------------------------------------------------------- diff --git a/demo/ImageFromStream.py b/demo/ImageFromStream.py index 091bf1cf..d71c9e4d 100644 --- a/demo/ImageFromStream.py +++ b/demo/ImageFromStream.py @@ -19,7 +19,7 @@ class TestPanel(wx.Panel): bmp = wx.Bitmap(wx.Image(stream)) wx.StaticText( - self, -1, "This image was loaded from a Python file-like object:", + self, -1, "This image was loaded from a Python file-like object:", (15, 15) ) diff --git a/demo/Img2PyArtProvider.py b/demo/Img2PyArtProvider.py index b26f00ec..6b529700 100644 --- a/demo/Img2PyArtProvider.py +++ b/demo/Img2PyArtProvider.py @@ -11,10 +11,10 @@ class TestPanel(wx.Panel): def __init__(self, parent, log): self.log = log wx.Panel.__init__(self, parent, -1) - + sizer = wx.BoxSizer(wx.VERTICAL) self.SetSizer(sizer) - + title = wx.StaticText(self, -1, "Img2PyArtProvider") title.SetFont(wx.Font(18, wx.FONTFAMILY_SWISS, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD)) sizer.Add(title, 0, wx.ALIGN_CENTRE|wx.ALL, 5) @@ -33,9 +33,9 @@ class TestPanel(wx.Panel): bmp = wx.Bitmap(32,22) self.bmpFlag = wx.StaticBitmap(self, -1, bmp) box.Add(self.bmpFlag, 0, wx.ALIGN_CENTER_VERTICAL) - + sizer.Add(box, 0, wx.CENTER|wx.ALL, 10) - + self.country = 'BLANK' global FlagArtProvider if FlagArtProvider is None: @@ -45,7 +45,7 @@ class TestPanel(wx.Panel): self.getArt() - + def OnSelectCountry(self, evt): self.log.write("OnSelectCountry\n") self.country = evt.GetString() @@ -58,14 +58,14 @@ class TestPanel(wx.Panel): bmp = wx.Bitmap(32,22) self.clearBmp(bmp) self.bmpFlag.SetBitmap(bmp) - + def clearBmp(self, bmp): dc = wx.MemoryDC() dc.SelectObject(bmp) dc.SetBackground(wx.Brush("white")) dc.Clear() - + #---------------------------------------------------------------------- def runTest(frame, nb, log): diff --git a/demo/InfoBar.py b/demo/InfoBar.py index e03bb860..eceae0e3 100644 --- a/demo/InfoBar.py +++ b/demo/InfoBar.py @@ -10,7 +10,7 @@ flags = [ (wx.ICON_NONE, "ICON_NONE"), (wx.ICON_WARNING, "ICON_WARNING"), (wx.ICON_ERROR, "ICON_ERROR") ] - + class TestPanel(wx.Panel): def __init__(self, parent, log): @@ -25,7 +25,7 @@ class TestPanel(wx.Panel): self.message = wx.TextCtrl(panel, -1, "Hello World", size=(250,-1)) self.flags = wx.Choice(panel, choices=[f[1] for f in flags]) self.flags.SetSelection(1) # wx.ICON_INFORMATION is the default - + smBtn = wx.Button(panel, -1, "Show Message") dmBtn = wx.Button(panel, -1, "Dismiss") addBtn = wx.Button(panel, -1, "Add Button") @@ -48,10 +48,10 @@ class TestPanel(wx.Panel): panel.Sizer = wx.BoxSizer(wx.VERTICAL) text = """\ An info bar is a transient window shown at top or bottom of its parent window -to display non-critical information to the user.""" +to display non-critical information to the user.""" panel.Sizer.Add(wx.StaticText(panel, -1, text), 0, wx.TOP|wx.LEFT, 25) panel.Sizer.Add(fgs, 1, wx.EXPAND|wx.ALL, 25) - + self.Sizer = wx.BoxSizer(wx.VERTICAL) self.Sizer.Add(self.info, 0, wx.EXPAND) self.Sizer.Add(panel, 1, wx.EXPAND) @@ -85,7 +85,7 @@ to display non-critical information to the user.""" # Skip(). evt.Skip() - + #---------------------------------------------------------------------- def runTest(frame, nb, log): diff --git a/demo/KeyEvents.py b/demo/KeyEvents.py index a434e14a..b6239675 100644 --- a/demo/KeyEvents.py +++ b/demo/KeyEvents.py @@ -274,7 +274,7 @@ class KeyLog(wx.ListCtrl, listmix.ListCtrlAutoWidthMixin): UniChr = '' if "unicode" in wx.PlatformInfo: UniChr = "\"" + unichr(evt.GetUnicodeKey()) + "\"" - + modifiers = "" for mod, ch in [(evt.ControlDown(), 'C'), (evt.AltDown(), 'A'), diff --git a/demo/LEDNumberCtrl.py b/demo/LEDNumberCtrl.py index 963444c2..13b5d70d 100644 --- a/demo/LEDNumberCtrl.py +++ b/demo/LEDNumberCtrl.py @@ -56,11 +56,11 @@ overview = """\ source, which was a bit reluctant to reveal its secrets. My appologies if I missed anything - jmg

-LEDNumberCtrl( parent, id=-1, pos=wx.DefaultPosition, +LEDNumberCtrl( parent, id=-1, pos=wx.DefaultPosition, size=wx.DefaultSize, style=LED_ALIGN_LEFT | LED_DRAW_FADED) -

This is a control that simulates an LED clock display. It only accepts -numeric input. +

This is a control that simulates an LED clock display. It only accepts +numeric input.

Styles diff --git a/demo/LayoutAnchors.py b/demo/LayoutAnchors.py index c8838952..49da58aa 100644 --- a/demo/LayoutAnchors.py +++ b/demo/LayoutAnchors.py @@ -6,17 +6,17 @@ import wx.lib.anchors as anchors #---------------------------------------------------------------------- # Nifty little trick here; apply wx.NewId() to generate a series of -# IDs used later on in the app. +# IDs used later on in the app. -[ ID_ANCHORSDEMOFRAMEANCHOREDPANEL, +[ ID_ANCHORSDEMOFRAMEANCHOREDPANEL, ID_ANCHORSDEMOFRAMEHELPSTATICTEXT, - ID_ANCHORSDEMOFRAMEMAINPANEL, + ID_ANCHORSDEMOFRAMEMAINPANEL, ID_ANCHORSDEMOFRAMEBACKGROUNDPANEL, - ID_ANCHORSDEMOFRAMERIGHTCHECKBOX, + ID_ANCHORSDEMOFRAMERIGHTCHECKBOX, ID_ANCHORSDEMOFRAMEOKBUTTON, - ID_ANCHORSDEMOFRAMETOPCHECKBOX, + ID_ANCHORSDEMOFRAMETOPCHECKBOX, ID_ANCHORSDEMOFRAMEBOTTOMCHECKBOX, - ID_ANCHORSDEMOFRAME, + ID_ANCHORSDEMOFRAME, ID_ANCHORSDEMOFRAMELEFTCHECKBOX, ] = map(lambda _init_ctrls: wx.NewId(), range(10)) @@ -30,27 +30,27 @@ class AnchorsDemoFrame(wx.Frame): def _init_ctrls(self, prnt): wx.Frame.__init__( - self, size=(328, 187), id=ID_ANCHORSDEMOFRAME, - title='LayoutAnchors Demonstration', parent=prnt, - name='AnchorsDemoFrame', + self, size=(328, 187), id=ID_ANCHORSDEMOFRAME, + title='LayoutAnchors Demonstration', parent=prnt, + name='AnchorsDemoFrame', style = wx.DEFAULT_FRAME_STYLE | wx.CLIP_CHILDREN, pos=(261, 123) ) self._init_utils() self.mainPanel = wx.Panel( - size=(320, 160), parent=self, - id=ID_ANCHORSDEMOFRAMEMAINPANEL, name='panel1', + size=(320, 160), parent=self, + id=ID_ANCHORSDEMOFRAMEMAINPANEL, name='panel1', style=wx.TAB_TRAVERSAL | wx.CLIP_CHILDREN - | wx.FULL_REPAINT_ON_RESIZE, + | wx.FULL_REPAINT_ON_RESIZE, pos=(0, 0) ) self.mainPanel.SetAutoLayout(True) self.okButton = wx.Button( - label='OK', id=ID_ANCHORSDEMOFRAMEOKBUTTON, - parent=self.mainPanel, name='okButton', + label='OK', id=ID_ANCHORSDEMOFRAMEOKBUTTON, + parent=self.mainPanel, name='okButton', size=(72, 24), style=0, pos=(240, 128) ) @@ -63,10 +63,10 @@ class AnchorsDemoFrame(wx.Frame): ) self.backgroundPanel = wx.Panel( - size=(304, 80), parent=self.mainPanel, - id=ID_ANCHORSDEMOFRAMEBACKGROUNDPANEL, - name='backgroundPanel', - style=wx.SIMPLE_BORDER | wx.CLIP_CHILDREN, + size=(304, 80), parent=self.mainPanel, + id=ID_ANCHORSDEMOFRAMEBACKGROUNDPANEL, + name='backgroundPanel', + style=wx.SIMPLE_BORDER | wx.CLIP_CHILDREN, pos = (8, 40) ) @@ -76,8 +76,8 @@ class AnchorsDemoFrame(wx.Frame): ) self.anchoredPanel = wx.Panel( - size=(88, 48), id=ID_ANCHORSDEMOFRAMEANCHOREDPANEL, - parent=self.backgroundPanel, name='anchoredPanel', + size=(88, 48), id=ID_ANCHORSDEMOFRAMEANCHOREDPANEL, + parent=self.backgroundPanel, name='anchoredPanel', style=wx.SIMPLE_BORDER, pos=(104, 16) ) @@ -87,38 +87,38 @@ class AnchorsDemoFrame(wx.Frame): ) self.leftCheckBox = wx.CheckBox( - label='Left', id=ID_ANCHORSDEMOFRAMELEFTCHECKBOX, - parent=self.mainPanel, name='leftCheckBox', + label='Left', id=ID_ANCHORSDEMOFRAMELEFTCHECKBOX, + parent=self.mainPanel, name='leftCheckBox', style=0, pos=(8, 8) ) self.leftCheckBox.SetConstraints( anchors.LayoutAnchors(self.leftCheckBox, False, True, False, False) ) - + self.Bind( wx.EVT_CHECKBOX, self.OnCheckboxCheckbox, source=self.leftCheckBox, id=ID_ANCHORSDEMOFRAMELEFTCHECKBOX ) self.topCheckBox = wx.CheckBox( - label='Top', id=ID_ANCHORSDEMOFRAMETOPCHECKBOX, - parent=self.mainPanel, name='topCheckBox', + label='Top', id=ID_ANCHORSDEMOFRAMETOPCHECKBOX, + parent=self.mainPanel, name='topCheckBox', style=0, pos=(88, 8) ) self.topCheckBox.SetConstraints( anchors.LayoutAnchors(self.topCheckBox, False, True, False, False) ) - + self.Bind( wx.EVT_CHECKBOX, self.OnCheckboxCheckbox, source=self.topCheckBox, id=ID_ANCHORSDEMOFRAMETOPCHECKBOX ) self.rightCheckBox = wx.CheckBox( - label='Right', id=ID_ANCHORSDEMOFRAMERIGHTCHECKBOX, - parent=self.mainPanel, name='rightCheckBox', + label='Right', id=ID_ANCHORSDEMOFRAMERIGHTCHECKBOX, + parent=self.mainPanel, name='rightCheckBox', style=0, pos=(168, 8) ) @@ -132,8 +132,8 @@ class AnchorsDemoFrame(wx.Frame): ) self.bottomCheckBox = wx.CheckBox( - label='Bottom', id=ID_ANCHORSDEMOFRAMEBOTTOMCHECKBOX, - parent=self.mainPanel, name='bottomCheckBox', + label='Bottom', id=ID_ANCHORSDEMOFRAMEBOTTOMCHECKBOX, + parent=self.mainPanel, name='bottomCheckBox', style=0, pos=(248, 8) ) @@ -147,10 +147,10 @@ class AnchorsDemoFrame(wx.Frame): ) self.helpStaticText = wx.StaticText( - label='Select anchor options above, then resize window to see the effect', - id=ID_ANCHORSDEMOFRAMEHELPSTATICTEXT, - parent=self.mainPanel, name='helpStaticText', - size=(224, 24), style=wx.ST_NO_AUTORESIZE, + label='Select anchor options above, then resize window to see the effect', + id=ID_ANCHORSDEMOFRAMEHELPSTATICTEXT, + parent=self.mainPanel, name='helpStaticText', + size=(224, 24), style=wx.ST_NO_AUTORESIZE, pos=(8, 128) ) @@ -168,7 +168,7 @@ class AnchorsDemoFrame(wx.Frame): anchors.LayoutAnchors(self.anchoredPanel, self.leftCheckBox.GetValue(), self.topCheckBox.GetValue(), self.rightCheckBox.GetValue(), self.bottomCheckBox.GetValue() - ) + ) ) def OnOkButtonButton(self, event): diff --git a/demo/MDIWindows.py b/demo/MDIWindows.py index 0cd57096..13d44edf 100644 --- a/demo/MDIWindows.py +++ b/demo/MDIWindows.py @@ -38,7 +38,7 @@ class TestPanel(wx.Panel): def GetPyExecutable(self): return sys.executable, os.spawnl - + #---------------------------------------------------------------------- def runTest(frame, nb, log): diff --git a/demo/Main.py b/demo/Main.py index a22a1903..bc9b54d8 100644 --- a/demo/Main.py +++ b/demo/Main.py @@ -1172,7 +1172,7 @@ class DemoError(object): self.exception_type = excType.__name__ else: self.exception_type = excType - + # If it's a syntax error, extra information needs # to be added to the traceback if excType is SyntaxError: @@ -1471,7 +1471,7 @@ class wxPythonDemo(wx.Frame): imgList.Add(bmp) for indx in range(9): bmp = images.catalog["spinning_nb%d"%indx].GetBitmap() - imgList.Add(bmp) + imgList.Add(bmp) self.nb.AssignImageList(imgList) self.BuildMenuBar() diff --git a/demo/MaskedNumCtrl.py b/demo/MaskedNumCtrl.py index c58d126c..85c6e1a2 100644 --- a/demo/MaskedNumCtrl.py +++ b/demo/MaskedNumCtrl.py @@ -105,7 +105,7 @@ value entry ctrl:""") grid1.Add( self.limit_target, 0, wx.ALIGN_LEFT|wx.ALL, 5 ) grid1.Add( self.limit_on_field_change, 0, wx.ALIGN_LEFT|wx.ALL, 5 ) - + hbox1 = wx.BoxSizer( wx.HORIZONTAL ) hbox1.Add( (17,5), 0, wx.ALIGN_LEFT|wx.ALL, 5) hbox1.Add( self.allow_none, 0, wx.ALIGN_LEFT|wx.ALL, 5 ) @@ -113,13 +113,13 @@ value entry ctrl:""") grid1.Add( (5,5), 0, wx.ALIGN_LEFT|wx.ALL, 5) grid1.Add( self.group_digits, 0, wx.ALIGN_LEFT|wx.LEFT, 5 ) - grid1.Add( self.allow_negative, 0, wx.ALIGN_LEFT|wx.ALL, 5 ) + grid1.Add( self.allow_negative, 0, wx.ALIGN_LEFT|wx.ALL, 5 ) hbox2 = wx.BoxSizer( wx.HORIZONTAL ) hbox2.Add( (17,5), 0, wx.ALIGN_LEFT|wx.ALL, 5) hbox2.Add( self.use_parens, 0, wx.ALIGN_LEFT|wx.ALL, 5 ) grid1.Add( hbox2, 0, wx.ALIGN_LEFT|wx.ALL, 5) grid1.Add( (5,5), 0, wx.ALIGN_LEFT|wx.ALL, 5) - + grid1.Add( self.select_on_entry, 0, wx.ALIGN_LEFT|wx.LEFT, 5 ) grid1.Add( (5,5), 0, wx.ALIGN_LEFT|wx.ALL, 5) grid1.Add( (5,5), 0, wx.ALIGN_LEFT|wx.ALL, 5) diff --git a/demo/MediaCtrl.py b/demo/MediaCtrl.py index d481571b..3eb164a0 100644 --- a/demo/MediaCtrl.py +++ b/demo/MediaCtrl.py @@ -45,14 +45,14 @@ class TestPanel(wx.Panel): btn1 = wx.Button(self, -1, "Load File") self.Bind(wx.EVT_BUTTON, self.OnLoadFile, btn1) - + btn2 = wx.Button(self, -1, "Play") self.Bind(wx.EVT_BUTTON, self.OnPlay, btn2) self.playBtn = btn2 - + btn3 = wx.Button(self, -1, "Pause") self.Bind(wx.EVT_BUTTON, self.OnPause, btn3) - + btn4 = wx.Button(self, -1, "Stop") self.Bind(wx.EVT_BUTTON, self.OnStop, btn4) @@ -64,8 +64,8 @@ class TestPanel(wx.Panel): self.st_size = StaticText(self, -1, size=(100,-1)) self.st_len = StaticText(self, -1, size=(100,-1)) self.st_pos = StaticText(self, -1, size=(100,-1)) - - + + # setup the layout sizer = wx.GridBagSizer(5,5) sizer.Add(self.mc, (1,1), span=(5,1))#, flag=wx.EXPAND) @@ -85,8 +85,8 @@ class TestPanel(wx.Panel): self.timer = wx.Timer(self) self.Bind(wx.EVT_TIMER, self.OnTimer) self.timer.Start(100) - - + + def OnLoadFile(self, evt): dlg = wx.FileDialog(self, message="Choose a media file", @@ -99,7 +99,7 @@ class TestPanel(wx.Panel): def DoLoadFile(self, path): - + if not self.mc.Load(path): wx.MessageBox("Unable to load %s: Unsupported format?" % path, "ERROR", @@ -113,7 +113,7 @@ class TestPanel(wx.Panel): def OnMediaLoaded(self, evt): self.playBtn.Enable() - + def OnPlay(self, evt): if not self.mc.Play(): wx.MessageBox("Unable to Play media : Unsupported format?", @@ -126,10 +126,10 @@ class TestPanel(wx.Panel): def OnPause(self, evt): self.mc.Pause() - + def OnStop(self, evt): self.mc.Stop() - + def OnSeek(self, evt): offset = self.slider.GetValue() @@ -157,7 +157,7 @@ def runTest(frame, nb, log): win = MessagePanel(nb, 'wx.MediaCtrl is not available on this platform.', 'Sorry', wx.ICON_WARNING) return win - + #---------------------------------------------------------------------- @@ -174,10 +174,10 @@ may require specific codecs to be installed.

wx.MediaCtrl uses native backends to render media, for example on Windows -there is a ActiveMovie/DirectShow backend, and on Macintosh there is a +there is a ActiveMovie/DirectShow backend, and on Macintosh there is a QuickTime backend.

-wx.MediaCtrl is not currently available on unix systems. +wx.MediaCtrl is not currently available on unix systems. """ diff --git a/demo/MouseGestures.py b/demo/MouseGestures.py index 25216a96..0dd66a04 100644 --- a/demo/MouseGestures.py +++ b/demo/MouseGestures.py @@ -33,12 +33,12 @@ class TestPanel(wx.Panel): self.log = log #Mouse Gestures: - + self.mg = MouseGestures(self, Auto=True, MouseButton=wx.MOUSE_BTN_RIGHT) - + self.mg.SetGesturesVisible(True) - + self.mg.AddGesture('LR', self.ShowSomethingClever, 'Left then Right!') self.mg.AddGesture('39', self.ShowSomethingClever, 'You made a V!') self.mg.AddGesture('L', self.LogSomethingClever, 'You moved left') @@ -47,15 +47,15 @@ class TestPanel(wx.Panel): self.mg.AddGesture('DR', self.OnDownThenRight) self.mg.AddGesture('LDRU', self.SetToBlue) self.mg.AddGesture('RDLU', self.SetToOrange) - + #Widgets: - + self.btnAddGesture = wx.Button(self, ID_GESTURE, 'Add New Gesture') self.btnChangeMouseButton = wx.Button(self, ID_MOUSE, 'Change Mouse Button') self.btnChangeModifier = wx.Button(self, ID_MODIFIER, 'Change Modifier') self.btnToggleVisible = wx.ToggleButton(self, ID_VISIBLE, 'Toggle Gestures Visible') self.btnToggleVisible.SetValue(True) - + msg = "Mouse Gestures" text = wx.StaticText(self, -1, "", style=wx.ALIGN_CENTRE) text.SetFont(wx.Font(24, wx.FONTFAMILY_SWISS, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD, False)) @@ -64,12 +64,12 @@ class TestPanel(wx.Panel): w,h = text.GetTextExtent(msg) text.SetSize(wx.Size(w,h+1)) text.SetForegroundColour(wx.BLUE) - + #Sizer: outsideSizer = wx.BoxSizer(wx.VERTICAL) - + btnSizer = wx.BoxSizer(wx.HORIZONTAL) - + outsideSizer.Add(text, 0, wx.EXPAND|wx.ALL, 5) outsideSizer.Add(wx.StaticLine(self, -1), 0, wx.EXPAND) outsideSizer.Add(wx.StaticText(self, -1, ' '), 0, wx.EXPAND) @@ -83,7 +83,7 @@ class TestPanel(wx.Panel): btnSizer.Add(self.btnChangeModifier, 0, wx.SHAPED) btnSizer.Add(self.btnToggleVisible, 0, wx.SHAPED) outsideSizer.Add(btnSizer, 0, wx.SHAPED) - + self.SetAutoLayout(True) self.SetSizer(outsideSizer) @@ -95,30 +95,30 @@ class TestPanel(wx.Panel): def LogSomethingClever(self, somethingclever): self.log.WriteText(somethingclever) - + def OnAddGesture(self, event): d = wx.TextEntryDialog(self, "Enter Gesture (LRUD1379) (EG Right Then Up Then DownLeft is RU1):", "Add New Gesture", "") answer1 = d.ShowModal() gesture = d.GetValue() d.Destroy() - + d = wx.TextEntryDialog(self, 'Print the following text on "%s":' % gesture, "Gesture Action", "") answer2 = d.ShowModal() text = d.GetValue() d.Destroy() - + if (answer1 == wx.ID_OK) and (answer2 == wx.ID_OK): self.mg.AddGesture(gesture.upper(), self.LogSomethingClever, text) - + def OnChangeModifiers(self, event): choices = [wx.WXK_CONTROL, wx.WXK_SHIFT, wx.WXK_ALT] schoices = ['Control', 'Shift', 'Alt'] - + d = wx.lib.dialogs.MultipleChoiceDialog(self, 'Select Modifier Keys:\n(Select None if you do not want to use modifier keys\n\n', "Change Modifier Keys", schoices) answer = d.ShowModal() tuply = d.GetValue() d.Destroy() - + if (answer == wx.ID_OK): if len(tuply) > 0: modifiers = [] @@ -131,7 +131,7 @@ class TestPanel(wx.Panel): else: self.mg.SetModifiers() self.log.WriteText('UnSet All Modifiers') - + def OnChangeMouseButton(self, event): choices = [wx.MOUSE_BTN_LEFT, wx.MOUSE_BTN_MIDDLE, wx.MOUSE_BTN_RIGHT] schoices = ['Left', 'Middle', 'Right'] @@ -144,7 +144,7 @@ class TestPanel(wx.Panel): if (answer == wx.ID_OK): self.mg.SetMouseButton(choices[i]) self.log.WriteText('Set the Mouse Button to ' + schoices[i]) - + def OnDownThenRight(self): self.log.WriteText('You made an "L"!') @@ -159,7 +159,7 @@ class TestPanel(wx.Panel): def SetToBlue(self): self.mg.SetGesturePen(wx.Colour(0, 144, 255), 5) self.log.WriteText('Set Gesture Colour to Blue') - + def SetToOrange(self): self.mg.SetGesturePen(wx.Colour(255, 156, 0), 5) self.log.WriteText('Set Gesture Colour to Orange') diff --git a/demo/MultiChoiceDialog.py b/demo/MultiChoiceDialog.py index 67c62738..0fe67e33 100644 --- a/demo/MultiChoiceDialog.py +++ b/demo/MultiChoiceDialog.py @@ -18,7 +18,7 @@ class TestPanel(wx.Panel): 'blueberry', 'raspberry', 'blackberry', 'snozzleberry', 'etc', 'etc..', 'etc...' ] - dlg = wx.MultiChoiceDialog( self, + dlg = wx.MultiChoiceDialog( self, "Pick some fruit from\nthis list", "wx.MultiChoiceDialog", lst) diff --git a/demo/MultiSplitterWindow.py b/demo/MultiSplitterWindow.py index 1f917e57..61414dc1 100644 --- a/demo/MultiSplitterWindow.py +++ b/demo/MultiSplitterWindow.py @@ -29,7 +29,7 @@ class ControlPane(wx.Panel): majorDimension=1) hvBox.SetSelection(0) self.Bind(wx.EVT_RADIOBOX, self.OnSetHV, hvBox) - + luCheck = wx.CheckBox(self, -1, "Live Update") luCheck.SetValue(True) self.Bind(wx.EVT_CHECKBOX, self.OnSetLiveUpdate, luCheck) @@ -49,7 +49,7 @@ class ControlPane(wx.Panel): def OnSetHV(self, evt): rb = evt.GetEventObject() self.GetParent().SetOrientation(rb.GetSelection()) - + def OnSetLiveUpdate(self, evt): check = evt.GetEventObject() @@ -58,7 +58,7 @@ class ControlPane(wx.Panel): def OnSwapButton(self, evt): self.GetParent().Swap2and4() - + class TestPanel(wx.Panel): @@ -67,7 +67,7 @@ class TestPanel(wx.Panel): wx.Panel.__init__(self, parent, -1) cp = ControlPane(self) - + splitter = MultiSplitterWindow(self, style=wx.SP_LIVE_UPDATE) self.splitter = splitter sizer = wx.BoxSizer(wx.HORIZONTAL) @@ -117,7 +117,7 @@ class TestPanel(wx.Panel): self.log.write( "Changed sash:%d %s\n" % (evt.GetSashIdx(), evt.GetSashPosition())) - + def SetOrientation(self, value): if value: self.splitter.SetOrientation(wx.VERTICAL) @@ -125,13 +125,13 @@ class TestPanel(wx.Panel): self.splitter.SetOrientation(wx.HORIZONTAL) self.splitter.SizeWindows() - + def SetLiveUpdate(self, enable): if enable: self.splitter.SetWindowStyle(wx.SP_LIVE_UPDATE) else: self.splitter.SetWindowStyle(0) - + def Swap2and4(self): win2 = self.splitter.GetWindow(1) diff --git a/demo/MultipleChoiceDialog.py b/demo/MultipleChoiceDialog.py index 3141896b..0e66f2d0 100644 --- a/demo/MultipleChoiceDialog.py +++ b/demo/MultipleChoiceDialog.py @@ -48,7 +48,7 @@ overview = """\ This is a Python implementation of a dialog that is not yet implemented in wxWindows proper, so don't let the wxWindows documentation mislead you. -

MultipleChoiceDialog(self, parent, msg, title, lst, +

MultipleChoiceDialog(self, parent, msg, title, lst, pos = wx.wxDefaultPosition, size = (200,200), style = wx.DEFAULT_DIALOG_STYLE) diff --git a/demo/OGL.py b/demo/OGL.py index eeea932d..72ca543d 100644 --- a/demo/OGL.py +++ b/demo/OGL.py @@ -4,7 +4,7 @@ # 11/20/2003 - Jeff Grimmett (grimmtooth@softhome.net) # # o Updated for wx namespace -# +# # 20040508 - Pierre Hjälm # # o Changed to use the python version of OGL @@ -51,7 +51,7 @@ class DrawnShape(ogl.DrawnShape): # Make sure to call CalculateSize when all drawing is done self.CalculateSize() - + #---------------------------------------------------------------------- class DiamondShape(ogl.PolygonShape): @@ -106,7 +106,7 @@ class CompositeDivisionShape(ogl.CompositeShape): for division in self.GetDivisions(): division.SetSensitivityFilter(0) - + #---------------------------------------------------------------------- class CompositeShape(ogl.CompositeShape): @@ -121,7 +121,7 @@ class CompositeShape(ogl.CompositeShape): constraining_shape.SetBrush(wx.BLUE_BRUSH) constrained_shape2.SetBrush(wx.RED_BRUSH) - + self.AddChild(constraining_shape) self.AddChild(constrained_shape1) self.AddChild(constrained_shape2) @@ -139,7 +139,7 @@ class CompositeShape(ogl.CompositeShape): # If we don't do this the shape will take all left-clicks for itself constraining_shape.SetSensitivityFilter(0) - + #---------------------------------------------------------------------- class DividedShape(ogl.DividedShape): @@ -287,27 +287,27 @@ class TestWindow(ogl.ShapeCanvas): dsBrush = wx.Brush("WHEAT", wx.BRUSHSTYLE_SOLID) self.MyAddShape( - CompositeDivisionShape(self), + CompositeDivisionShape(self), 270, 310, wx.BLACK_PEN, wx.BLUE_BRUSH, "Division" ) - + self.MyAddShape( - CompositeShape(self), + CompositeShape(self), 100, 260, wx.BLACK_PEN, wx.RED_BRUSH, "Composite" ) - + self.MyAddShape( - ogl.CircleShape(80), + ogl.CircleShape(80), 75, 110, wx.Pen(wx.BLUE, 3), wx.GREEN_BRUSH, "Circle" ) - + self.MyAddShape( - ogl.TextShape(120, 45), + ogl.TextShape(120, 45), 160, 35, wx.GREEN_PEN, wx.LIGHT_GREY_BRUSH, "OGL is now a\npure Python lib!" ) self.MyAddShape( - ogl.RectangleShape(85, 50), + ogl.RectangleShape(85, 50), 305, 60, wx.BLACK_PEN, wx.LIGHT_GREY_BRUSH, "Rectangle" ) @@ -317,17 +317,17 @@ class TestWindow(ogl.ShapeCanvas): ) ds = self.MyAddShape( - DividedShape(140, 150, self), + DividedShape(140, 150, self), 520, 265, wx.BLACK_PEN, dsBrush, '' ) self.MyAddShape( - DiamondShape(90, 90), + DiamondShape(90, 90), 355, 260, wx.Pen(wx.BLUE, 3, wx.PENSTYLE_DOT), wx.RED_BRUSH, "Polygon" ) - + self.MyAddShape( - RoundedRectangleShape(95, 70), + RoundedRectangleShape(95, 70), 345, 145, wx.Pen(wx.RED, 2), rRectBrush, "Rounded Rect" ) @@ -406,7 +406,7 @@ def runTest(frame, nb, log): win = TestWindow(nb, log, frame) return win - + #---------------------------------------------------------------------- diff --git a/demo/PDFViewer.py b/demo/PDFViewer.py index 8cd8a9d0..3f24031a 100644 --- a/demo/PDFViewer.py +++ b/demo/PDFViewer.py @@ -16,7 +16,7 @@ class TestPanel(wx.Panel): hsizer = wx.BoxSizer( wx.HORIZONTAL ) vsizer = wx.BoxSizer( wx.VERTICAL ) self.buttonpanel = pdfButtonPanel(self, wx.NewId(), - wx.DefaultPosition, wx.DefaultSize, 0) + wx.DefaultPosition, wx.DefaultSize, 0) vsizer.Add(self.buttonpanel, 0, wx.GROW|wx.ALIGN_CENTER_VERTICAL|wx.LEFT|wx.RIGHT|wx.TOP, 5) self.viewer = pdfViewer( self, wx.NewId(), wx.DefaultPosition, @@ -25,7 +25,7 @@ class TestPanel(wx.Panel): loadbutton = wx.Button(self, wx.NewId(), "Load PDF file", wx.DefaultPosition, wx.DefaultSize, 0 ) vsizer.Add(loadbutton, 0, wx.ALIGN_CENTER|wx.ALL, 5) - hsizer.Add(vsizer, 1, wx.GROW|wx.ALIGN_CENTER_HORIZONTAL|wx.ALL, 5) + hsizer.Add(vsizer, 1, wx.GROW|wx.ALIGN_CENTER_HORIZONTAL|wx.ALL, 5) self.SetSizer(hsizer) self.SetAutoLayout(True) @@ -34,7 +34,7 @@ class TestPanel(wx.Panel): self.viewer.buttonpanel = self.buttonpanel self.Bind(wx.EVT_BUTTON, self.OnLoadButton, loadbutton) - + def OnLoadButton(self, event): dlg = wx.FileDialog(self, wildcard="*.pdf") if dlg.ShowModal() == wx.ID_OK: @@ -51,9 +51,9 @@ def runTest(frame, nb, log): return win else: from wx.lib.msgpanel import MessagePanel - win = MessagePanel(nb, + win = MessagePanel(nb, 'This demo requires either the\n' - 'PyMuPDF see http://pythonhosted.org/PyMuPDF\n' + 'PyMuPDF see http://pythonhosted.org/PyMuPDF\n' 'or\n' 'PyPDF2 see http://pythonhosted.org/PyPDF2\n' 'package installed.\n', @@ -78,7 +78,7 @@ complete PDF rendering library that is GPL licenced. PyMuPDF version 1.9.2 or la

PyPDF2 provides a PdfFileReader class that is used to read the content stream of a PDF file which is subsequently rendered by the viewer itself. -Please note that this is not a complete implementation of the pdf specification and +Please note that this is not a complete implementation of the pdf specification and will probably fail to render any random PDF file you supply. However it does seem to behave correctly with files that have been produced by ReportLab using Western languages. The main limitation is that it doesn't currently support embedded fonts. diff --git a/demo/PenAndBrushStyles.py b/demo/PenAndBrushStyles.py index 52367009..24040b1f 100644 --- a/demo/PenAndBrushStyles.py +++ b/demo/PenAndBrushStyles.py @@ -26,7 +26,7 @@ if 'wxMSW' in wx.PlatformInfo: pen_styles.append("wx.PENSTYLE_STIPPLE_MASK_OPAQUE") pen_styles.append("wx.PENSTYLE_STIPPLE_MASK") pen_styles.append("wx.PENSTYLE_STIPPLE") - + brush_styles = [#"wx.BRUSHSTYLE_INVALID", "wx.BRUSHSTYLE_SOLID", "wx.BRUSHSTYLE_TRANSPARENT", diff --git a/demo/PlateButton.py b/demo/PlateButton.py index 7b16457a..54a97c58 100644 --- a/demo/PlateButton.py +++ b/demo/PlateButton.py @@ -50,7 +50,7 @@ class TestPanel(scrolled.ScrolledPanel): self.__LayoutPanel(p3, "Solid Background:") sizer = wx.BoxSizer(wx.VERTICAL) - sizer.AddMany([(p1, 0, wx.EXPAND), (p2, 0, wx.EXPAND), + sizer.AddMany([(p1, 0, wx.EXPAND), (p2, 0, wx.EXPAND), (p3, 0, wx.EXPAND)]) hsizer = wx.BoxSizer(wx.HORIZONTAL) hsizer.Add(sizer, 1, wx.EXPAND) @@ -169,9 +169,9 @@ class TestPanel(scrolled.ScrolledPanel): # Set a custom colour? if btn[5] is not None: tbtn.SetPressColor(btn[5]) - + if btn[2] == droparrow: - + tbtn.Bind(platebtn.EVT_PLATEBTN_DROPARROW_PRESSED, self.OnDropArrowPressed) # Enable/Disable button state @@ -183,12 +183,12 @@ class TestPanel(scrolled.ScrolledPanel): txt_sz.AddMany([((5, 5)), (wx.StaticText(panel, label=label), 0, wx.ALIGN_LEFT)]) vsizer.AddMany([((10, 10)), (txt_sz, 0, wx.ALIGN_LEFT), - ((10, 10)), (hsizer1, 0, wx.EXPAND), ((10, 10)), - (hsizer2, 0, wx.EXPAND), ((10, 10)), + ((10, 10)), (hsizer1, 0, wx.EXPAND), ((10, 10)), + (hsizer2, 0, wx.EXPAND), ((10, 10)), (hsizer3, 0, wx.EXPAND), ((10, 10)), (hsizer4, 0, wx.EXPAND), ((10, 10))]) panel.SetSizer(vsizer) - + def OnDropArrowPressed(self, evt): self.log.write("DROPARROW PRESSED") diff --git a/demo/PopupWindow.py b/demo/PopupWindow.py index 2428fbe8..d8e17557 100644 --- a/demo/PopupWindow.py +++ b/demo/PopupWindow.py @@ -48,7 +48,7 @@ class TestPopup(wx.PopupWindow): st.Bind(wx.EVT_RIGHT_UP, self.OnRightUp) wx.CallAfter(self.Refresh) - + def OnMouseLeftDown(self, evt): self.Refresh() @@ -80,7 +80,7 @@ class TestTransientPopup(wx.PopupTransientWindow): self.log = log panel = wx.Panel(self) panel.SetBackgroundColour("#FFB6C1") - + st = wx.StaticText(panel, -1, "wx.PopupTransientWindow is a\n" "wx.PopupWindow which disappears\n" @@ -101,8 +101,8 @@ class TestTransientPopup(wx.PopupTransientWindow): sizer.Fit(panel) sizer.Fit(self) self.Layout() - - + + def ProcessLeftDown(self, evt): self.log.write("ProcessLeftDown: %s\n" % evt.GetPosition()) return wx.PopupTransientWindow.ProcessLeftDown(self, evt) @@ -132,7 +132,7 @@ class TestPanel(wx.Panel): # This isn't working so well, not sure why. Commented out for # now. - + # b = wx.Button(self, -1, "Show wx.PopupWindow with listbox", (25, 140)) # self.Bind(wx.EVT_BUTTON, self.OnShowPopupListbox, b) @@ -183,7 +183,7 @@ class TestPanel(wx.Panel): # This class is currently not implemented in the demo. It does not # behave the way it should, so for the time being it's only here # for show. If you figure out how to make it work, please send -# a corrected file to Robin! +# a corrected file to Robin! class TestPopupWithListbox(wx.PopupWindow): def __init__(self, parent, style, log): wx.PopupWindow.__init__(self, parent, style) diff --git a/demo/ProgressDialog.py b/demo/ProgressDialog.py index 6d28f189..66ce9b60 100644 --- a/demo/ProgressDialog.py +++ b/demo/ProgressDialog.py @@ -3,7 +3,7 @@ # 11/21/2003 - Jeff Grimmett (grimmtooth@softhome.net) # # o Updated for wx namespace -# +# # 11/30/2003 - Jeff Grimmett (grimmtooth@softhome.net) # # o wx.ProgressDialog appears to be broken. No abort button @@ -46,13 +46,13 @@ class TestPanel(wx.Panel): count += 1 wx.MilliSleep(250) wx.Yield() - + if count >= max / 2: (keepGoing, skip) = dlg.Update(count, "Half-time!") else: (keepGoing, skip) = dlg.Update(count) - + dlg.Destroy() #--------------------------------------------------------------------------- @@ -67,16 +67,16 @@ def runTest(frame, nb, log): overview = """\ -This class represents a dialog that shows a short message and a progress bar. +This class represents a dialog that shows a short message and a progress bar. Optionally, it can display an ABORT button

-This dialog indicates the progress of some event that takes a while to accomplish, +This dialog indicates the progress of some event that takes a while to accomplish, usually, such as file copy progress, download progress, and so on. The display is completely under control of the program; you must update the dialog from -within the program creating it. +within the program creating it.

When the dialog closes, you must check to see if the user aborted the process or -not, and act accordingly -- that is, if the PD_CAN_ABORT style flag is set. +not, and act accordingly -- that is, if the PD_CAN_ABORT style flag is set. If not then you may progress blissfully onward. """ diff --git a/demo/PropertyGrid.py b/demo/PropertyGrid.py index ac29983b..99463bd8 100644 --- a/demo/PropertyGrid.py +++ b/demo/PropertyGrid.py @@ -312,7 +312,7 @@ class SampleMultiButtonEditor(wxpg.PyTextCtrlEditor): buttons.AddButton("A") # Add a bitmap button buttons.AddBitmapButton(wx.ArtProvider.GetBitmap(wx.ART_FOLDER)) - + # Create the 'primary' editor control (textctrl in this case) wnd = self.CallSuperMethod("CreateControls", propGrid, diff --git a/demo/PyPlot.py b/demo/PyPlot.py index 442b896e..fb6b715e 100644 --- a/demo/PyPlot.py +++ b/demo/PyPlot.py @@ -7,7 +7,7 @@ try: import wx.lib.plot except ImportError: hadImportError = True - + ############################################################################# # Where's the code??? @@ -48,7 +48,7 @@ This demo requires the numpy module, which could not be imported. It probably is not installed (it's not part of the standard Python distribution). See https://pypi.python.org/pypi/numpy for information about the numpy package.""", 'Sorry', wx.ICON_WARNING) - + return win diff --git a/demo/PythonEvents.py b/demo/PythonEvents.py index 69149c71..bc4345fe 100644 --- a/demo/PythonEvents.py +++ b/demo/PythonEvents.py @@ -66,7 +66,7 @@ class TestPanel(wx.Panel): b = MyButton(self, -1, " Click me ", (30,30)) self.Bind(wx.EVT_BUTTON, self.OnClick, id=b.GetId()) - + # This is our custom event binder created above. self.Bind(EVT_BUTTON_CLICKPOS, self.OnMyEvent, id=b.GetId()) @@ -94,7 +94,7 @@ def runTest(frame, nb, log): overview = """\ -This demo is a contrived example of defining an event class in wxPython and +This demo is a contrived example of defining an event class in wxPython and sending it up the containment hierarchy for processing. V2.5 note: this demo also shows the new style of creating event binders that diff --git a/demo/ScrolledWindow.py b/demo/ScrolledWindow.py index 4f3f8a68..a2d5622f 100644 --- a/demo/ScrolledWindow.py +++ b/demo/ScrolledWindow.py @@ -117,8 +117,8 @@ class MyCanvas(wx.ScrolledWindow): # it does... y = 20 - for style in [wx.PENSTYLE_DOT, wx.PENSTYLE_LONG_DASH, - wx.PENSTYLE_SHORT_DASH, wx.PENSTYLE_DOT_DASH, + for style in [wx.PENSTYLE_DOT, wx.PENSTYLE_LONG_DASH, + wx.PENSTYLE_SHORT_DASH, wx.PENSTYLE_DOT_DASH, wx.PENSTYLE_USER_DASH]: pen = wx.Pen("DARK ORCHID", 1, style) if style == wx.PENSTYLE_USER_DASH: diff --git a/demo/Sound.py b/demo/Sound.py index 96afa984..0d21f29c 100644 --- a/demo/Sound.py +++ b/demo/Sound.py @@ -39,7 +39,7 @@ class TestPanel(wx.Panel): # sounds can also be loaded from a buffer object data = open(opj('data/plan.wav'), 'rb').read() sound = wx.SoundFromData(data) - + self.log.write("before Play...\n") sound.Play(wx.adv.SOUND_ASYNC) self.sound = sound # save a reference (This shoudln't be needed, but there seems to be a bug...) @@ -61,7 +61,7 @@ class TestPanel(wx.Panel): # another way to do it. wx.adv.Sound.PlaySound(dlg.GetPath(), wx.adv.SOUND_SYNC) - + except NotImplementedError as v: wx.MessageBox(str(v), "Exception Message") dlg.Destroy() @@ -79,7 +79,7 @@ def runTest(frame, nb, log): overview = """

Sound

This class represents a short wave file, in Windows WAV format, that can -be stored in memory and played. +be stored in memory and played.

This demo offers two examples, both driven by buttons, but obviously the event that drives the playing of the sound can come from anywhere. diff --git a/demo/SpinButton.py b/demo/SpinButton.py index 5061998b..db4b2d50 100644 --- a/demo/SpinButton.py +++ b/demo/SpinButton.py @@ -45,14 +45,14 @@ def runTest(frame, nb, log): overview = """\ -A wx.SpinButton has two small up and down (or left and right) arrow buttons. -It is often used next to a text control for increment and decrementing a value. -Portable programs should try to use wx.SpinCtrl instead as wx.SpinButton is not +A wx.SpinButton has two small up and down (or left and right) arrow buttons. +It is often used next to a text control for increment and decrementing a value. +Portable programs should try to use wx.SpinCtrl instead as wx.SpinButton is not implemented for all platforms (Win32 and GTK only currently). -NB: the range supported by this control (and wx.SpinCtrl) depends on the platform -but is at least -0x8000 to 0x7fff. Under GTK and Win32 with sufficiently new version -of comctrl32.dll (at least 4.71 is required, 5.80 is recommended) the full 32 bit +NB: the range supported by this control (and wx.SpinCtrl) depends on the platform +but is at least -0x8000 to 0x7fff. Under GTK and Win32 with sufficiently new version +of comctrl32.dll (at least 4.71 is required, 5.80 is recommended) the full 32 bit range is supported. """ diff --git a/demo/StockButtons.py b/demo/StockButtons.py index 08367331..db742666 100644 --- a/demo/StockButtons.py +++ b/demo/StockButtons.py @@ -1,6 +1,6 @@ #!/usr/bin/env python -import wx +import wx #---------------------------------------------------------------------- @@ -74,7 +74,7 @@ class TestPanel(wx.Panel): sizer.Add(b) self.SetSizer(sizer) - + #---------------------------------------------------------------------- diff --git a/demo/TextEntryDialog.py b/demo/TextEntryDialog.py index 7a3d1f3c..384ed0e6 100644 --- a/demo/TextEntryDialog.py +++ b/demo/TextEntryDialog.py @@ -40,8 +40,8 @@ def runTest(frame, nb, log): overview = """\ -This class represents a dialog that requests a one-line text string from the user. -It is implemented as a generic wxWindows dialog. Along with the usual wx.Dialog +This class represents a dialog that requests a one-line text string from the user. +It is implemented as a generic wxWindows dialog. Along with the usual wx.Dialog style flags, all of the wx.TextCtrl TE_* style flags are accepted, so, for example, wx.TE_PASSWORD could be used to create a password dialog. diff --git a/demo/Timer.py b/demo/Timer.py index fecf5432..fb84fb72 100644 --- a/demo/Timer.py +++ b/demo/Timer.py @@ -77,7 +77,7 @@ class TestPanel(sp.ScrolledPanel): # Bind all EVT_TIMER events to self.OnTest1Timer self.Bind(wx.EVT_TIMER, self.OnTest1Timer) - + t2b1 = wx.Button(self, -1, "wx.CallLater") t2b2 = wx.Button(self, -1, "stop timer") t2st = wx.StaticText(self, -1, doc2) @@ -121,16 +121,16 @@ class TestPanel(sp.ScrolledPanel): fgs.Add(t4b1) fgs.Add(t4b2) fgs.Add(t4st) - + outsideSizer.Add(fgs, 0, wx.ALIGN_CENTER|wx.ALL, 10) self.SetSizer(outsideSizer) self.SetupScrolling() - + # Test 1 shows how to use a timer to generate EVT_TIMER # events, by passing self to the wx.Timer constructor. The # event is bound above to the OnTest1Timer method. - + def OnTest1Start(self, evt): self.t1 = wx.Timer(self) self.t1.Start(1000) @@ -145,11 +145,11 @@ class TestPanel(sp.ScrolledPanel): def OnTest1Timer(self, evt): self.log.write("got EVT_TIMER event\n") - + # Test 2 shows how to use the wx.CallLater class. - + def OnTest2Start(self, evt): # Call OnTest2Timer one second in the future, passing some # optional arbitrary args. There is no need to hold a @@ -159,14 +159,14 @@ class TestPanel(sp.ScrolledPanel): 'a', 'b', 'c', one=1, two=2) self.log.write("CallLater scheduled\n") self.t2b2.Enable() - + def OnTest2Stop(self, evt): self.t2.Stop() self.log.write("CallLater stopped, last return value was: %s\n" % repr(self.t2.GetResult())) del self.t2 self.t2b2.Disable() - + def OnTest2Timer(self, *args, **kw): self.log.write("CallLater called with args=%s, kwargs=%s\n" % (args, kw)) @@ -183,7 +183,7 @@ class TestPanel(sp.ScrolledPanel): # Test 3 shows how to use a class derived from wx.Timer. See # also the NotifyTimer class below. - + def OnTest3Start(self, evt): self.t3 = NotifyTimer(self.log) self.t3.Start(1000) @@ -217,7 +217,7 @@ class TestPanel(sp.ScrolledPanel): def OnTest4Timer(self): self.log.write("got wx.PyTimer event\n") - + #---------------------------------------------------------------------- @@ -229,7 +229,7 @@ class NotifyTimer(wx.Timer): def __init__(self, log): wx.Timer.__init__(self) self.log = log - + def Notify(self): self.log.write("got NotifyTimer event\n") diff --git a/demo/ToggleButton.py b/demo/ToggleButton.py index a111ca13..22d30151 100644 --- a/demo/ToggleButton.py +++ b/demo/ToggleButton.py @@ -26,7 +26,7 @@ class TestPanel(wx.Panel): b.SetBitmap(images.Mondrian.Bitmap) b.SetInitialSize() # adjust default size for the bitmap self.Bind(wx.EVT_TOGGLEBUTTON, self.OnToggle, b) - + def OnToggle(self, evt): self.log.write("Button %d toggled\n" % evt.GetId()) @@ -35,14 +35,14 @@ class TestPanel(wx.Panel): def runTest(frame, nb, log): win = TestPanel(nb, log) return win - + #---------------------------------------------------------------------- overview = """\ -wx.ToggleButton is a button that stays pressed when clicked by the user. -In other words, it is similar to wxCheckBox in functionality but looks like a +wx.ToggleButton is a button that stays pressed when clicked by the user. +In other words, it is similar to wxCheckBox in functionality but looks like a wxButton. """ diff --git a/demo/UIActionSimulator.py b/demo/UIActionSimulator.py index 64c7a5de..cbba14f5 100644 --- a/demo/UIActionSimulator.py +++ b/demo/UIActionSimulator.py @@ -13,30 +13,30 @@ class TestPanel(wx.Panel): self.recordingKeys = False self.stopwatchKeys = wx.StopWatch() self.uisim = wx.UIActionSimulator() - - + + # create widgets and bind events keyLabel = wx.StaticText(self, -1, "Key Events") keyLabel.SetFont(wx.FFont(18, wx.SWISS, wx.FONTFLAG_BOLD)) - + self.txt = wx.TextCtrl(self, size=(300,-1)) self.txt.Bind(wx.EVT_KEY_DOWN, self.OnTxtKeyDown) self.txt.Bind(wx.EVT_KEY_UP, self.OnTxtKeyUp) - + self.recordBtn = buttons.GenToggleButton(self, -1, "Record") self.Bind(wx.EVT_BUTTON, self.OnToggleRecordKeys, self.recordBtn) self.recordBtn.SetToolTip( "Click this button and then type some keys in the\n" "textctrl. Click here again when done.") - + self.playbackKeysBtn = buttons.GenButton(self, -1, "Playback") self.Bind(wx.EVT_BUTTON, self.OnPlaybackKeys, self.playbackKeysBtn) self.playbackKeysBtn.SetToolTip( "Record some key events and then click here to\n" "replay the recorded events.") self.playbackKeysBtn.Disable() - - + + # create the layout gbs = wx.GridBagSizer(10,10) gbs.Add(keyLabel, (0,0), span=(1,2)) @@ -46,7 +46,7 @@ class TestPanel(wx.Panel): btnsizer.Add((10,10)) btnsizer.Add(self.playbackKeysBtn) gbs.Add(btnsizer, (2,1), span=(1,2)) - + self.Sizer = wx.BoxSizer() self.Sizer.Add(gbs, 1, wx.EXPAND|wx.ALL, 20) @@ -64,7 +64,7 @@ class TestPanel(wx.Panel): self.playbackKeysBtn.Enable() self.recordBtn.SetLabel('Record') - + def OnPlaybackKeys(self, evt): self._playbackEvents = self.keyEvents[:] # make a copy so we can pop() if self._playbackEvents: @@ -72,8 +72,8 @@ class TestPanel(wx.Panel): self.txt.Clear() self.txt.SetFocus() self._setNextKeyEvent() - - + + def _playbackKey(self, evtType, key, modifiers): if evtType == 'down': self.uisim.KeyDown(key, modifiers) @@ -84,15 +84,15 @@ class TestPanel(wx.Panel): self._setNextKeyEvent() else: self.playbackKeysBtn.Enable() - + def _setNextKeyEvent(self): evtType, key, modifiers, milli = self._playbackEvents.pop(0) milli = max(milli/2, 1) # play back faster than it was recorded print(evtType, key, modifiers, milli) wx.CallLater(milli, self._playbackKey, evtType, key, modifiers) - - + + def _onKeyEvent(self, evt, evtType): evt.Skip() if not self.recordingKeys: @@ -108,12 +108,12 @@ class TestPanel(wx.Panel): def OnTxtKeyDown(self, evt): self._onKeyEvent(evt, 'down') - + def OnTxtKeyUp(self, evt): self._onKeyEvent(evt, 'up') - - + + #---------------------------------------------------------------------- def runTest(frame, nb, log): @@ -129,7 +129,7 @@ def runTest(frame, nb, log): "Sorry", wx.ICON_WARNING) return win - + #---------------------------------------------------------------------- diff --git a/demo/Wizard.py b/demo/Wizard.py index 6cfffed8..b4279947 100644 --- a/demo/Wizard.py +++ b/demo/Wizard.py @@ -56,7 +56,7 @@ class SkipNextPage(wx.adv.WizardPage): else: self.next.GetNext().SetPrev(self.next) return self.next - + def GetPrev(self): return self.prev @@ -144,7 +144,7 @@ class TestPanel(wx.Panel): def OnWizFinished(self, evt): self.log.write("OnWizFinished\n") - + def OnRunSimpleWizard(self, evt): # Create the wizard and the pages diff --git a/demo/XmlResourceHandler.py b/demo/XmlResourceHandler.py index 33339195..eaaa03fa 100644 --- a/demo/XmlResourceHandler.py +++ b/demo/XmlResourceHandler.py @@ -27,7 +27,7 @@ class MyCustomPanel(wx.Panel): wx.Panel.__init__(self, parent, id, pos, size, style, name) # This is the little bit of customization that we do for this - # silly example. + # silly example. self.Bind(wx.EVT_SIZE, self.OnSize) t = wx.StaticText(self, -1, "MyCustomPanel") f = t.GetFont() diff --git a/demo/XmlResourceSubclass.py b/demo/XmlResourceSubclass.py index 3ffb043f..a565538b 100644 --- a/demo/XmlResourceSubclass.py +++ b/demo/XmlResourceSubclass.py @@ -30,12 +30,12 @@ class MyCustomPanel(wx.Panel): # the Create step is done by XRC. self.Bind(wx.EVT_WINDOW_CREATE, self.OnCreate) self.Bind(wx.EVT_SIZE, self.OnSize) - - + + def OnCreate(self, evt): # This is the little bit of customization that we do for this # silly example. It could just as easily have been done in - # the resource. We do it in the EVT_WINDOW_CREATE handler + # the resource. We do it in the EVT_WINDOW_CREATE handler # because the window doesn't really exist yet in the __init__. if self is evt.GetEventObject(): t = wx.StaticText(self, -1, "MyCustomPanel") @@ -54,7 +54,7 @@ class MyCustomPanel(wx.Panel): sz = self.GetSize() w, h = self.t.GetTextExtent(self.t.GetLabel()) self.t.SetPosition(((sz.width-w)/2, (sz.height-h)/2)) - + #---------------------------------------------------------------------- diff --git a/demo/agw/AGWInfoBar.py b/demo/agw/AGWInfoBar.py index 8e699df3..be62dbbc 100644 --- a/demo/agw/AGWInfoBar.py +++ b/demo/agw/AGWInfoBar.py @@ -27,14 +27,14 @@ def GetValidImages(): keys = catalog.keys() valid_images = [] counter = 0 - + for key in keys: bmp = catalog[key].GetBitmap() if bmp.GetWidth() == 16 and bmp.GetHeight() == 16: valid_images.append(bmp) return valid_images - + #---------------------------------------------------------------------- flags = [ (wx.ICON_NONE, "ICON_NONE"), @@ -43,7 +43,7 @@ flags = [ (wx.ICON_NONE, "ICON_NONE"), (wx.ICON_WARNING, "ICON_WARNING"), (wx.ICON_ERROR, "ICON_ERROR") ] - + class TestPanel(wx.Panel): def __init__(self, parent, log): @@ -53,7 +53,7 @@ class TestPanel(wx.Panel): # Create the InfoBar. It starts out in a hidden state so it # won't be visible until we need it. self.info = IB.InfoBar(self) - + panel = wx.Panel(self) self.message = wx.TextCtrl(panel, -1, "Hello World", size=(250,-1)) @@ -61,7 +61,7 @@ class TestPanel(wx.Panel): self.flags.SetSelection(1) # wx.ICON_INFORMATION is the default self.checkBitmap = wx.CheckBox(panel, -1, 'With Bitmap') - + smBtn = wx.Button(panel, -1, "Show Message") dmBtn = wx.Button(panel, -1, "Dismiss") addBtn = wx.Button(panel, -1, "Add Button") @@ -89,10 +89,10 @@ class TestPanel(wx.Panel): panel.Sizer = wx.BoxSizer(wx.VERTICAL) text = """\ An info bar is a transient window shown at top or bottom of its parent window -to display non-critical information to the user.""" +to display non-critical information to the user.""" panel.Sizer.Add(wx.StaticText(panel, -1, text), 0, wx.TOP|wx.LEFT, 25) panel.Sizer.Add(fgs, 1, wx.EXPAND|wx.ALL, 25) - + self.Sizer = wx.BoxSizer(wx.VERTICAL) self.Sizer.Add(self.info, 0, wx.EXPAND) self.Sizer.Add(panel, 1, wx.EXPAND) @@ -102,7 +102,7 @@ to display non-critical information to the user.""" self.Bind(wx.EVT_BUTTON, self.OnAddButton, addBtn) self.valid_images = GetValidImages() - + def OnShowMessage(self, event): msg = self.message.GetValue() @@ -121,7 +121,7 @@ to display non-critical information to the user.""" bitmap = random.choice(self.valid_images) else: bitmap = wx.NullBitmap - + self.info.AddButton(btnId, "New Button", bitmap) self.info.Bind(wx.EVT_BUTTON, self.OnButtonClicked, id=btnId) @@ -134,7 +134,7 @@ to display non-critical information to the user.""" # Skip(). event.Skip() - + #---------------------------------------------------------------------- def runTest(frame, nb, log): diff --git a/demo/agw/AdvancedSplash.py b/demo/agw/AdvancedSplash.py index 9299c4bc..8d3cf453 100644 --- a/demo/agw/AdvancedSplash.py +++ b/demo/agw/AdvancedSplash.py @@ -34,7 +34,7 @@ class TestPanel(wx.Panel): pn = os.path.normpath(os.path.join(bitmapDir, "advancedsplash.png")) bitmap = wx.Bitmap(pn, wx.BITMAP_TYPE_PNG) shadow = wx.WHITE - + frame = AS.AdvancedSplash(self, bitmap=bitmap, timeout=5000, agwStyle=AS.AS_TIMEOUT | AS.AS_CENTER_ON_PARENT | diff --git a/demo/agw/CubeColourDialog.py b/demo/agw/CubeColourDialog.py index 46106154..2cffa57f 100644 --- a/demo/agw/CubeColourDialog.py +++ b/demo/agw/CubeColourDialog.py @@ -28,16 +28,16 @@ class CubeColourDialogDemo(wx.Panel): b = wx.Button(self, -1, "Create and Show a CubeColourDialog", (50, 70)) self.Bind(wx.EVT_BUTTON, self.OnButton, b) - self.log = log + self.log = log def OnButton(self, evt): if not hasattr(self, "colourData"): self.colourData = wx.ColourData() - + self.colourData.SetColour(self.GetBackgroundColour()) - + dlg = CCD.CubeColourDialog(self, self.colourData) if dlg.ShowModal() == wx.ID_OK: diff --git a/demo/agw/FoldPanelBar.py b/demo/agw/FoldPanelBar.py index ea76b47b..bb7d5fd0 100644 --- a/demo/agw/FoldPanelBar.py +++ b/demo/agw/FoldPanelBar.py @@ -53,7 +53,7 @@ zzW\xcff&\xb8,\x89\xa8@Q\xd6\xaaf\xdfRm,\xee\xb1BDxr#\xae\xf5|\xddo\xd6\xe2H\ \xb7w\xf3\x1d$\x7f\xc1\xe0\xbd\xa7\xeb\xa0(,"Kc\x12\xc1+\xfd\xe8\tI\xee\xed)\ \xbf\xbcN\xc1{D\x04k\x05#\x12\xfd\xf2a\xde[\x81\x87\xbb\xdf\x9cr\x1a\x87\xd3\ 0)\xba>\x83\xd5\xb97o\xe0\xaf\x04\xff\x13?\x00\xd2\xfb\xa9`z\xac\x80w\x00\ -\x00\x00\x00IEND\xaeB`\x82' +\x00\x00\x00IEND\xaeB`\x82' def GetCollapsedIconBitmap(): return wx.Bitmap(GetCollapsedIconImage()) @@ -84,7 +84,7 @@ b'\x89PNG\r\n\x1a\n\x00\x00\x00\rIHDR\x00\x00\x00\x10\x00\x00\x00\x10\x08\x06\ \xd8|\xb9\x0f\xd3\x9a\x8a\xc7\x08\x00\x9f?\xdd%\xde\x07\xda\x93\xc3{\x19C\ \x8a\x9c\x03\x0b8\x17\xe8\x9d\xbf\x02.>\x13\xc0n\xff{PJ\xc5\xfdP\x11""<\xbc\ \xff\x87\xdf\xf8\xbf\xf5\x17FF\xaf\x8f\x8b\xd3\xe6K\x00\x00\x00\x00IEND\xaeB\ -`\x82' +`\x82' def GetExpandedIconBitmap(): return wx.Bitmap(GetExpandedIconImage()) @@ -121,14 +121,14 @@ def GetMondrianIcon(): # ---------------------------------------------------------------------------- class Extended(wx.Frame): - + def __init__(self, parent, id=wx.ID_ANY, title="", pos=wx.DefaultPosition, size=(700,650), style=wx.DEFAULT_FRAME_STYLE): wx.Frame.__init__(self, parent, id, title, pos, size, style) self._flags = 0 - + self.SetIcon(GetMondrianIcon()) self.SetMenuBar(self.CreateMenuBar()) @@ -159,23 +159,23 @@ class Extended(wx.Frame): self.ID_WINDOW_LEFT1 = 101 self.ID_WINDOW_RIGHT1 = 102 self.ID_WINDOW_BOTTOM = 103 - + self._leftWindow1.Bind(wx.adv.EVT_SASH_DRAGGED_RANGE, self.OnFoldPanelBarDrag, id=100, id2=103) self.Bind(wx.EVT_SIZE, self.OnSize) self.Bind(wx.EVT_SCROLL, self.OnSlideColour) - + self.ReCreateFoldPanel(0) - + def OnSize(self, event): wx.adv.LayoutAlgorithm().LayoutWindow(self, self.remainingSpace) event.Skip() - + def OnQuit(self, event): - + self.Destroy() @@ -188,7 +188,7 @@ class Extended(wx.Frame): "andrea.gavana@agip.it\n" + "andrea_gavana@tin.it\n\n" + \ "Based On Jorgen Bodde C++ demo implementation.\n\n" + \ "Welcome To wxPython " + wx.VERSION_STRING + "!!" - + dlg = wx.MessageDialog(self, msg, "FoldPanelBar Extended Demo", wx.OK | wx.ICON_INFORMATION) dlg.SetFont(wx.Font(8, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, False, "Verdana")) @@ -197,14 +197,14 @@ class Extended(wx.Frame): def OnToggleWindow(self, event): - + self._leftWindow1.Show(not self._leftWindow1.IsShown()) # Leaves bits of itself behind sometimes wx.adv.LayoutAlgorithm().LayoutWindow(self, self.remainingSpace) self.remainingSpace.Refresh() event.Skip() - + def OnFoldPanelBarDrag(self, event): @@ -220,7 +220,7 @@ class Extended(wx.Frame): self.remainingSpace.Refresh() event.Skip() - + def ReCreateFoldPanel(self, fpb_flags): @@ -235,44 +235,44 @@ class Extended(wx.Frame): Images = wx.ImageList(16,16) Images.Add(GetExpandedIconBitmap()) Images.Add(GetCollapsedIconBitmap()) - + item = self._pnl.AddFoldPanel("Caption Colours", collapsed=False, foldIcons=Images) self._pnl.AddFoldPanelWindow(item, wx.StaticText(item, -1, "Adjust The First Colour"), - fpb.FPB_ALIGN_WIDTH, 5, 20) + fpb.FPB_ALIGN_WIDTH, 5, 20) # RED colour spin control self._rslider1 = wx.Slider(item, -1, 0, 0, 255) - self._pnl.AddFoldPanelWindow(item, self._rslider1, fpb.FPB_ALIGN_WIDTH, 2, 20) + self._pnl.AddFoldPanelWindow(item, self._rslider1, fpb.FPB_ALIGN_WIDTH, 2, 20) # GREEN colour spin control self._gslider1 = wx.Slider(item, -1, 0, 0, 255) - self._pnl.AddFoldPanelWindow(item, self._gslider1, fpb.FPB_ALIGN_WIDTH, 0, 20) + self._pnl.AddFoldPanelWindow(item, self._gslider1, fpb.FPB_ALIGN_WIDTH, 0, 20) # BLUE colour spin control self._bslider1 = wx.Slider(item, -1, 0, 0, 255) - self._pnl.AddFoldPanelWindow(item, self._bslider1, fpb.FPB_ALIGN_WIDTH, 0, 20) - + self._pnl.AddFoldPanelWindow(item, self._bslider1, fpb.FPB_ALIGN_WIDTH, 0, 20) + self._pnl.AddFoldPanelSeparator(item) self._pnl.AddFoldPanelWindow(item, wx.StaticText(item, -1, "Adjust The Second Colour"), - fpb.FPB_ALIGN_WIDTH, 5, 20) + fpb.FPB_ALIGN_WIDTH, 5, 20) # RED colour spin control self._rslider2 = wx.Slider(item, -1, 0, 0, 255) - self._pnl.AddFoldPanelWindow(item, self._rslider2, fpb.FPB_ALIGN_WIDTH, 2, 20) + self._pnl.AddFoldPanelWindow(item, self._rslider2, fpb.FPB_ALIGN_WIDTH, 2, 20) # GREEN colour spin control self._gslider2 = wx.Slider(item, -1, 0, 0, 255) - self._pnl.AddFoldPanelWindow(item, self._gslider2, fpb.FPB_ALIGN_WIDTH, 0, 20) + self._pnl.AddFoldPanelWindow(item, self._gslider2, fpb.FPB_ALIGN_WIDTH, 0, 20) # BLUE colour spin control self._bslider2 = wx.Slider(item, -1, 0, 0, 255) - self._pnl.AddFoldPanelWindow(item, self._bslider2, fpb.FPB_ALIGN_WIDTH, 0, 20) + self._pnl.AddFoldPanelWindow(item, self._bslider2, fpb.FPB_ALIGN_WIDTH, 0, 20) self._pnl.AddFoldPanelSeparator(item) - + button1 = wx.Button(item, wx.ID_ANY, "Apply To All") button1.Bind(wx.EVT_BUTTON, self.OnExpandMe) self._pnl.AddFoldPanelWindow(item, button1) @@ -302,11 +302,11 @@ class Extended(wx.Frame): self.ID_USE_SINGLE = wx.NewId() self.ID_USE_RECTANGLE = wx.NewId() self.ID_USE_FILLED_RECTANGLE = wx.NewId() - + currStyle = wx.RadioButton(item, self.ID_USE_VGRADIENT, "&Vertical Gradient") self._pnl.AddFoldPanelWindow(item, currStyle, fpb.FPB_ALIGN_WIDTH, fpb.FPB_DEFAULT_SPACING, 10) - + currStyle.SetValue(True) radio1 = wx.RadioButton(item, self.ID_USE_HGRADIENT, "&Horizontal Gradient") @@ -319,17 +319,17 @@ class Extended(wx.Frame): radio2.Bind(wx.EVT_RADIOBUTTON, self.OnStyleChange) radio3.Bind(wx.EVT_RADIOBUTTON, self.OnStyleChange) radio4.Bind(wx.EVT_RADIOBUTTON, self.OnStyleChange) - - self._pnl.AddFoldPanelWindow(item, radio1, fpb.FPB_ALIGN_WIDTH, fpb.FPB_DEFAULT_SPACING, 10) - self._pnl.AddFoldPanelWindow(item, radio2, fpb.FPB_ALIGN_WIDTH, fpb.FPB_DEFAULT_SPACING, 10) - self._pnl.AddFoldPanelWindow(item, radio3, fpb.FPB_ALIGN_WIDTH, fpb.FPB_DEFAULT_SPACING, 10) - self._pnl.AddFoldPanelWindow(item, radio4, fpb.FPB_ALIGN_WIDTH, fpb.FPB_DEFAULT_SPACING, 10) + + self._pnl.AddFoldPanelWindow(item, radio1, fpb.FPB_ALIGN_WIDTH, fpb.FPB_DEFAULT_SPACING, 10) + self._pnl.AddFoldPanelWindow(item, radio2, fpb.FPB_ALIGN_WIDTH, fpb.FPB_DEFAULT_SPACING, 10) + self._pnl.AddFoldPanelWindow(item, radio3, fpb.FPB_ALIGN_WIDTH, fpb.FPB_DEFAULT_SPACING, 10) + self._pnl.AddFoldPanelWindow(item, radio4, fpb.FPB_ALIGN_WIDTH, fpb.FPB_DEFAULT_SPACING, 10) self._pnl.AddFoldPanelSeparator(item) self._single = wx.CheckBox(item, -1, "&Only This Caption") self._pnl.AddFoldPanelWindow(item, self._single, fpb.FPB_ALIGN_WIDTH, - fpb.FPB_DEFAULT_SPACING, 10) + fpb.FPB_DEFAULT_SPACING, 10) # one more panel to finish it @@ -339,25 +339,25 @@ class Extended(wx.Frame): item = self._pnl.AddFoldPanel("Misc Stuff", collapsed=True, foldIcons=Images, cbstyle=cs) - button2 = wx.Button(item, wx.NewId(), "Collapse All") - self._pnl.AddFoldPanelWindow(item, button2) + button2 = wx.Button(item, wx.NewId(), "Collapse All") + self._pnl.AddFoldPanelWindow(item, button2) self._pnl.AddFoldPanelWindow(item, wx.StaticText(item, -1, "Enter Some Comments"), - fpb.FPB_ALIGN_WIDTH, 5, 20) + fpb.FPB_ALIGN_WIDTH, 5, 20) self._pnl.AddFoldPanelWindow(item, wx.TextCtrl(item, -1, "Comments"), fpb.FPB_ALIGN_WIDTH, fpb.FPB_DEFAULT_SPACING, 10) button2.Bind(wx.EVT_BUTTON, self.OnCollapseMe) self.radiocontrols = [currStyle, radio1, radio2, radio3, radio4] - + self._leftWindow1.SizeWindows() - + def OnCreateBottomStyle(self, event): # recreate with style collapse to bottom, which means # all panels that are collapsed are placed at the bottom, # or normal - + if event.IsChecked(): self.GetMenuBar().Check(self._singlestyle, False) self.GetMenuBar().Check(self._exclusivestyle, False) @@ -371,7 +371,7 @@ class Extended(wx.Frame): def OnCreateNormalStyle(self, event): - + # recreate with style where only one panel at the time is # allowed to be opened @@ -402,7 +402,7 @@ class Extended(wx.Frame): self._flags = self._flags & ~fpb.FPB_EXCLUSIVE_FOLD self.ReCreateFoldPanel(self._flags) - + def OnCollapseMe(self, event): @@ -428,7 +428,7 @@ class Extended(wx.Frame): if items.GetValue(): break counter = counter + 1 - + if counter == 0: mystyle = fpb.CAPTIONBAR_GRADIENT_V elif counter == 1: @@ -457,7 +457,7 @@ class Extended(wx.Frame): for items in self.radiocontrols: if items.GetValue(): break - + counter = counter + 1 if counter == 0: @@ -470,36 +470,36 @@ class Extended(wx.Frame): mystyle = fpb.CAPTIONBAR_RECTANGLE else: mystyle = fpb.CAPTIONBAR_FILLED_RECTANGLE - + style.SetFirstColour(col1) style.SetSecondColour(col2) style.SetCaptionStyle(mystyle) item = self._pnl.GetFoldPanel(0) self._pnl.ApplyCaptionStyle(item, style) - + def OnStyleChange(self, event): style = fpb.CaptionBarStyle() - + eventid = event.GetId() - + if eventid == self.ID_USE_HGRADIENT: style.SetCaptionStyle(fpb.CAPTIONBAR_GRADIENT_H) - + elif eventid == self.ID_USE_VGRADIENT: style.SetCaptionStyle(fpb.CAPTIONBAR_GRADIENT_V) - + elif eventid == self.ID_USE_SINGLE: style.SetCaptionStyle(fpb.CAPTIONBAR_SINGLE) - + elif eventid == self.ID_USE_RECTANGLE: style.SetCaptionStyle(fpb.CAPTIONBAR_RECTANGLE) - + elif eventid == self.ID_USE_FILLED_RECTANGLE: style.SetCaptionStyle(fpb.CAPTIONBAR_FILLED_RECTANGLE) - + else: raise "ERROR: Undefined Style Selected For CaptionBar: " + repr(eventid) @@ -516,7 +516,7 @@ class Extended(wx.Frame): self._pnl.ApplyCaptionStyle(item, style) else: self._pnl.ApplyCaptionStyleAll(style) - + def CreateMenuBar(self, with_window=False): @@ -530,7 +530,7 @@ class Extended(wx.Frame): FPB_EXCLUSIVE_FOLD = wx.NewId() FPBTEST_TOGGLE_WINDOW = wx.NewId() FPBTEST_ABOUT = wx.NewId() - + file_menu.Append(FPBTEST_QUIT, "&Exit") option_menu = None @@ -541,15 +541,15 @@ class Extended(wx.Frame): option_menu.Append(FPBTEST_REFRESH, "&Refresh picture") # make fold panel menu - + fpb_menu = wx.Menu() fpb_menu.AppendCheckItem(FPB_BOTTOM_FOLD, "Create with &fpb.FPB_COLLAPSE_TO_BOTTOM") - + # Now Implemented! fpb_menu.AppendCheckItem(FPB_SINGLE_FOLD, "Create with &fpb.FPB_SINGLE_FOLD") # Now Implemented! - fpb_menu.AppendCheckItem(FPB_EXCLUSIVE_FOLD, "Create with &fpb.FPB_EXCLUSIVE_FOLD") + fpb_menu.AppendCheckItem(FPB_EXCLUSIVE_FOLD, "Create with &fpb.FPB_EXCLUSIVE_FOLD") fpb_menu.AppendSeparator() fpb_menu.Append(FPBTEST_TOGGLE_WINDOW, "&Toggle FoldPanelBar") @@ -561,10 +561,10 @@ class Extended(wx.Frame): menu_bar.Append(file_menu, "&File") menu_bar.Append(fpb_menu, "&FoldPanel") - + if option_menu: menu_bar.Append(option_menu, "&Options") - + menu_bar.Append(help_menu, "&Help") self.Bind(wx.EVT_MENU, self.OnAbout, id=FPBTEST_ABOUT) @@ -589,7 +589,7 @@ class FoldTestPanel(wx.Panel): def __init__(self, parent, id, pos=wx.DefaultPosition, size=wx.DefaultSize, style=wx.NO_BORDER | wx.TAB_TRAVERSAL): - + wx.Panel.__init__(self, parent, id, pos, size, style) self.CreateControls() @@ -607,7 +607,7 @@ class FoldTestPanel(wx.Panel): sizer = wx.BoxSizer(wx.VERTICAL) self.SetSizer(sizer) - + subpanel = wx.Panel(self, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, wx.NO_BORDER | wx.TAB_TRAVERSAL) sizer.Add(subpanel, 1, wx.GROW | wx.ADJUST_MINSIZE, 5) @@ -618,9 +618,9 @@ class FoldTestPanel(wx.Panel): item5 = wx.Choice(subpanel, wx.ID_ANY, wx.DefaultPosition, wx.DefaultSize, itemstrings, 0) - + subsizer.Add(item5, 0, wx.GROW | wx.ALL, 5) - + item6 = wx.TextCtrl(subpanel, wx.ID_ANY, "", wx.DefaultPosition, wx.DefaultSize, wx.TE_MULTILINE) subsizer.Add(item6, 1, wx.GROW | wx.ALL, 5) @@ -644,7 +644,7 @@ class Collapsed(wx.Frame): size=(400,300), style=wx.DEFAULT_FRAME_STYLE): wx.Frame.__init__(self, parent, id, title, pos, size, style) - + self.SetIcon(GetMondrianIcon()) self.SetMenuBar(self.CreateMenuBar()) @@ -654,10 +654,10 @@ class Collapsed(wx.Frame): self.statusbar.SetStatusText("Welcome to wxPython!", 1) self.CreateFoldBar() - + def CreateFoldBar(self, vertical=True): - + if vertical: self.SetSize((500,600)) else: @@ -671,14 +671,14 @@ class Collapsed(wx.Frame): item = bar.AddFoldPanel("Test me", collapsed=False) button1 = wx.Button(item, wx.ID_ANY, "Collapse Me") button1.Bind(wx.EVT_BUTTON, self.OnCollapseMe) - + bar.AddFoldPanelWindow(item, button1, fpb.FPB_ALIGN_LEFT) item = bar.AddFoldPanel("Test me too!", collapsed=True) button2 = wx.Button(item, wx.ID_ANY, "Expand First One") button2.Bind(wx.EVT_BUTTON, self.OnExpandMe) - + bar.AddFoldPanelWindow(item, button2) bar.AddFoldPanelSeparator(item) @@ -726,7 +726,7 @@ class Collapsed(wx.Frame): FoldPanelBarTest_About = wx.NewId() FoldPanelBarTest_Horizontal = wx.NewId() FoldPanelBarTest_Vertical = wx.NewId() - + menuFile = wx.Menu() menuFile.Append(FoldPanelBarTest_Horizontal, "&Horizontal\tAlt-H") menuFile.Append(FoldPanelBarTest_Vertical, "&Vertical\tAlt-V") @@ -781,7 +781,7 @@ class Collapsed(wx.Frame): self.pnl.Collapse(self.pnl.GetFoldPanel(1)) - + # ---------------------------------------------------------------------------- # NotCollapsed Implementation # ---------------------------------------------------------------------------- @@ -791,7 +791,7 @@ class NotCollapsed(wx.Frame): size=(400,300), style=wx.DEFAULT_FRAME_STYLE): wx.Frame.__init__(self, parent, id, title, pos, size, style) - + self.SetIcon(GetMondrianIcon()) self.SetMenuBar(self.CreateMenuBar()) @@ -804,12 +804,12 @@ class NotCollapsed(wx.Frame): agwStyle=fpb.FPB_VERTICAL) item = pnl.AddFoldPanel("Test Me", collapsed=False) - + button1 = wx.Button(item, wx.ID_ANY, "Collapse Me") - + pnl.AddFoldPanelWindow(item, button1, fpb.FPB_ALIGN_LEFT) pnl.AddFoldPanelSeparator(item) - + button1.Bind(wx.EVT_BUTTON, self.OnCollapseMe) item = pnl.AddFoldPanel("Test Me Too!", collapsed=True) @@ -818,7 +818,7 @@ class NotCollapsed(wx.Frame): pnl.AddFoldPanelSeparator(item) button2.Bind(wx.EVT_BUTTON, self.OnExpandMe) - + newfoldpanel = FoldTestPanel(item, wx.ID_ANY) pnl.AddFoldPanelWindow(item, newfoldpanel) @@ -848,7 +848,7 @@ class NotCollapsed(wx.Frame): FoldPanelBarTest_Quit = wx.NewId() FoldPanelBarTest_About = wx.NewId() - + menuFile = wx.Menu() menuFile.Append(FoldPanelBarTest_Quit, "E&xit\tAlt-X", "Quit This Program") @@ -930,7 +930,7 @@ class TestPanel(wx.Panel): def OnButton3(self, evt): frame = NotCollapsed(self, title="FoldPanelBar NotCollapsed Demo") frame.Show() - + #--------------------------------------------------------------------------- diff --git a/demo/agw/GradientButton.py b/demo/agw/GradientButton.py index 256809c1..470f3e1e 100644 --- a/demo/agw/GradientButton.py +++ b/demo/agw/GradientButton.py @@ -19,7 +19,7 @@ except ImportError: # if it's not there locally, try the wxPython lib. import wx.lib.agw.gradientbutton as GB bitmapDir = "agw/bitmaps/" - + class GradientButtonDemo(wx.Panel): def __init__(self, parent, log): @@ -53,15 +53,15 @@ class GradientButtonDemo(wx.Panel): self.DoLayout() self.BindEvents() - + def DoLayout(self): frameSizer = wx.BoxSizer(wx.VERTICAL) mainSizer = wx.BoxSizer(wx.VERTICAL) - btnSizer = wx.BoxSizer(wx.HORIZONTAL) + btnSizer = wx.BoxSizer(wx.HORIZONTAL) colourSizer = wx.FlexGridSizer(4, 4, 1, 10) - label1 = wx.StaticText(self.mainPanel, -1, "Welcome to the GradientButton demo for wxPython!") + label1 = wx.StaticText(self.mainPanel, -1, "Welcome to the GradientButton demo for wxPython!") mainSizer.Add(label1, 0, wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP, 10) mainSizer.Add(self.btn1, 0, wx.ALIGN_CENTER_VERTICAL|wx.LEFT|wx.RIGHT|wx.TOP, 15) @@ -70,7 +70,7 @@ class GradientButtonDemo(wx.Panel): firstStrings = ["Top Start", "Bottom Start", "Pressed Top", "Text Colour"] secondStrings = ["Top End", "Bottom End", "Pressed Bottom", ""] - + for strings in firstStrings: label = wx.StaticText(self.mainPanel, -1, strings) colourSizer.Add(label, 0, wx.ALIGN_CENTER|wx.EXPAND) @@ -89,7 +89,7 @@ class GradientButtonDemo(wx.Panel): boldFont = wx.SystemSettings.GetFont(wx.SYS_DEFAULT_GUI_FONT) boldFont.SetWeight(wx.FONTWEIGHT_BOLD) - + for child in self.mainPanel.GetChildren(): if isinstance(child, wx.StaticText): child.SetFont(boldFont) @@ -103,7 +103,7 @@ class GradientButtonDemo(wx.Panel): except: self.btn1.SetFont(boldFont) self.btn2.SetFont(boldFont) - + self.mainPanel.SetSizer(mainSizer) mainSizer.Layout() frameSizer.Add(self.mainPanel, 1, wx.EXPAND) @@ -131,13 +131,13 @@ class GradientButtonDemo(wx.Panel): method = getattr(self.btn2, method) method(colour) - + def OnButton(self, event): obj = event.GetEventObject() self.log.write("You clicked %s\n"%obj.GetLabel()) - + #---------------------------------------------------------------------- def runTest(frame, nb, log): diff --git a/demo/agw/HyperTreeList.py b/demo/agw/HyperTreeList.py index 17de60ff..0640ea56 100644 --- a/demo/agw/HyperTreeList.py +++ b/demo/agw/HyperTreeList.py @@ -1,5 +1,5 @@ #!/usr/bin/env python -# Tags: phoenix-port, py3-port +# Tags: phoenix-port, py3-port import os import string diff --git a/demo/agw/LabelBook.py b/demo/agw/LabelBook.py index 21b88be5..a009cac9 100644 --- a/demo/agw/LabelBook.py +++ b/demo/agw/LabelBook.py @@ -39,7 +39,7 @@ class SamplePane(wx.Panel): self.SetBackgroundColour(wx.Colour(255,255,255)) label = label + "\nEnjoy the LabelBook && FlatImageBook demo!" - static = wx.StaticText(self, -1, label, pos=(10, 10)) + static = wx.StaticText(self, -1, label, pos=(10, 10)) #---------------------------------------------------------------------- @@ -82,7 +82,7 @@ class LabelBookDemo(wx.Frame): self.fittext = wx.CheckBox(self.leftpanel, -1, "Fit Label Text") self.boldtext = wx.CheckBox(self.leftpanel, -1, "Bold Label Text") self.boldselection = wx.CheckBox(self.leftpanel, -1, "Bold Selected Tab") - + self.textsize = wx.TextCtrl(self.leftpanel, -1, "1.0",style=wx.TE_PROCESS_ENTER) self.background = csel.ColourSelect(self.leftpanel, -1, "Choose...", wx.Colour(132, 164, 213), size=(-1, 20)) @@ -142,7 +142,7 @@ class LabelBookDemo(wx.Frame): self.SetSize((800,700)) - self.SetIcon(images.Mondrian.GetIcon()) + self.SetIcon(images.Mondrian.GetIcon()) self.CenterOnScreen() self.initializing = False @@ -157,7 +157,7 @@ class LabelBookDemo(wx.Frame): self.fittext.SetValue(1) self.border.SetValue(1) self.onlytext.SetValue(1) - + def DoLayout(self): @@ -175,7 +175,7 @@ class LabelBookDemo(wx.Frame): sizer_2.Add(self.bookdirection, 0, wx.ALL, 3) leftsizer.Add(sizer_2, 0, wx.ALL|wx.EXPAND, 5) - sizer_3.Add(self.border, 0, wx.ALL, 3) + sizer_3.Add(self.border, 0, wx.ALL, 3) sizer_3.Add(self.onlytext, 0, wx.LEFT|wx.BOTTOM, 3) sizer_3.Add(self.onlyimages, 0, wx.LEFT|wx.BOTTOM, 3) sizer_3.Add(self.shadow, 0, wx.LEFT|wx.BOTTOM, 3) @@ -249,7 +249,7 @@ class LabelBookDemo(wx.Frame): if self.bookdirection.GetSelection() > 1: self.bookdirection.SetSelection(0) - self.SetUserColours() + self.SetUserColours() self.book.SetFontSizeMultiple(1.0) self.book.SetFontBold(False) @@ -263,7 +263,7 @@ class LabelBookDemo(wx.Frame): self.book.AddPage(SamplePane(self.book, _pageColours[indx], label), txts, True, indx) - self.book.SetSelection(0) + self.book.SetSelection(0) if not self.initializing: panelsizer.Add(self.book, 1, wx.EXPAND) @@ -318,8 +318,8 @@ class LabelBookDemo(wx.Frame): style |= INB_FIT_LABELTEXT if self.boldselection.IsEnabled() and self.boldselection.GetValue(): style |= INB_BOLD_TAB_SELECTION - - if self.book: + + if self.book: self.book.SetFontBold(self.boldtext.GetValue()) return style @@ -369,7 +369,7 @@ class LabelBookDemo(wx.Frame): style = self.GetBookStyles() self.book.SetAGWWindowStyleFlag(style) - + self.book.SetFontSizeMultiple(float(self.textsize.GetValue())) if self.textsize.GetValue() != self._oldTextSize: self.book.ResizeTabArea() @@ -473,7 +473,7 @@ class LabelBookDemo(wx.Frame): def OnDeleteAllPages(self, event): - self.book.DeleteAllPages() + self.book.DeleteAllPages() def CreateMenu(self): diff --git a/demo/agw/MultiDirDialog.py b/demo/agw/MultiDirDialog.py index 584df9f3..a3fbd069 100644 --- a/demo/agw/MultiDirDialog.py +++ b/demo/agw/MultiDirDialog.py @@ -27,16 +27,16 @@ class MultiDirDialogDemo(wx.Panel): wx.Panel.__init__(self, parent) self.log = log - + self.mainPanel = wx.Panel(self) self.dialogSizer_staticbox = wx.StaticBox(self.mainPanel, -1, "Dialog Styles") - + self.dd_multiple = wx.CheckBox(self.mainPanel, -1, "MDD.DD_MULTIPLE") self.dd_must = wx.CheckBox(self.mainPanel, -1, "wx.DD_DIR_MUST_EXIST") self.dd_new = wx.CheckBox(self.mainPanel, -1, "wx.DD_NEW_DIR_BUTTON") - + self.showDialog = wx.Button(self.mainPanel, -1, "Show MultiDirDialog") - + self.SetProperties() self.DoLayout() @@ -44,7 +44,7 @@ class MultiDirDialogDemo(wx.Panel): def SetProperties(self): - + self.showDialog.SetDefault() @@ -65,13 +65,13 @@ class MultiDirDialogDemo(wx.Panel): mainSizer.Add(self.showDialog, 0, wx.ALL|wx.ALIGN_CENTER_HORIZONTAL|wx.ALIGN_CENTER_VERTICAL, 5) mainSizer.Add((10, 0), 0, 0, 0) - panelSizer.Add(mainSizer, 0, wx.EXPAND) + panelSizer.Add(mainSizer, 0, wx.EXPAND) self.mainPanel.SetSizer(panelSizer) frameSizer.Add(self.mainPanel, 1, wx.EXPAND) self.SetSizer(frameSizer) frameSizer.Layout() - + def OnShowDialog(self, event): @@ -84,7 +84,7 @@ class MultiDirDialogDemo(wx.Panel): userPath = wx.StandardPaths.Get().GetUserDataDir() dlg = MDD.MultiDirDialog(self, title="Custom MultiDirDialog :-D", defaultPath=userPath, agwStyle=dlgStyle) - + dlg.SetIcon(images.Mondrian.GetIcon()) if dlg.ShowModal() != wx.ID_OK: self.log.write("You Cancelled The Dialog!\n") @@ -94,7 +94,7 @@ class MultiDirDialogDemo(wx.Panel): paths = dlg.GetPaths() for indx, path in enumerate(paths): self.log.write("Path %d: %s\n"%(indx+1, path)) - + dlg.Destroy() diff --git a/demo/agw/PyBusyInfo.py b/demo/agw/PyBusyInfo.py index fce029d8..041fd5b6 100644 --- a/demo/agw/PyBusyInfo.py +++ b/demo/agw/PyBusyInfo.py @@ -23,7 +23,7 @@ except ImportError: # if it's not there locally, try the wxPython lib. class TestPanel(wx.Panel): def __init__(self, parent, log): - + self.log = log wx.Panel.__init__(self, parent, -1) @@ -32,20 +32,20 @@ class TestPanel(wx.Panel): def OnButton(self, evt): - + evt.Skip() message = "Please wait 5 seconds, working..." busy = PBI.PyBusyInfo(message, parent=None, title="Really Busy", icon=images.Smiles.GetBitmap()) wx.Yield() - + for indx in range(5): wx.MilliSleep(1000) del busy - - + + #---------------------------------------------------------------------- def runTest(frame, nb, log): diff --git a/demo/agw/PyCollapsiblePane.py b/demo/agw/PyCollapsiblePane.py index aa9e00f4..be8c11c9 100644 --- a/demo/agw/PyCollapsiblePane.py +++ b/demo/agw/PyCollapsiblePane.py @@ -23,15 +23,15 @@ import images btnlbl1 = "call Expand(True)" btnlbl2 = "call Expand(False)" -choices = ["wx.Button", - "GenButton", - "GenBitmapButton", - "GenBitmapTextButton", +choices = ["wx.Button", + "GenButton", + "GenBitmapButton", + "GenBitmapTextButton", "ThemedGenButton", - "ThemedGenBitmapTextButton"] + "ThemedGenBitmapTextButton"] -gtkChoices = ["3, 6", - "4, 8", +gtkChoices = ["3, 6", + "4, 8", "5, 10"] styles = ["CP_NO_TLW_RESIZE", @@ -47,7 +47,7 @@ class PyCollapsiblePaneDemo(wx.Panel): wx.Panel.__init__(self, parent) self.log = log - + self.label1 = "Click here to show pane" self.label2 = "Click here to hide pane" @@ -61,7 +61,7 @@ class PyCollapsiblePaneDemo(wx.Panel): self.Bind(wx.EVT_COLLAPSIBLEPANE_CHANGED, self.OnPaneChanged, cp) self.MakePaneContent(cp.GetPane()) - self.btnRB = radioBox = wx.RadioBox(self, -1, "Button Types", + self.btnRB = radioBox = wx.RadioBox(self, -1, "Button Types", choices=choices, style=wx.RA_SPECIFY_ROWS) self.static1 = wx.StaticText(self, -1, "Collapsed Button Text:") self.static2 = wx.StaticText(self, -1, "Expanded Button Text:") @@ -81,14 +81,14 @@ class PyCollapsiblePaneDemo(wx.Panel): cb.Bind(wx.EVT_CHECKBOX, self.OnStyleChoice) self.styleCBs.append(cb) sboxsizer.Add(cb, 0, wx.ALL, 4) - + self.gtkText = wx.StaticText(self, -1, "Expander Size") self.gtkChoice = wx.ComboBox(self, -1, choices=gtkChoices) self.gtkChoice.SetSelection(0) - + self.gtkText.Enable(False) self.gtkChoice.Enable(False) - + sizer = wx.BoxSizer(wx.VERTICAL) radioSizer = wx.BoxSizer(wx.HORIZONTAL) dummySizer = wx.BoxSizer(wx.VERTICAL) @@ -114,9 +114,9 @@ class PyCollapsiblePaneDemo(wx.Panel): subSizer.Add(self.static2, 0, wx.LEFT|wx.ALIGN_CENTER_VERTICAL, 5) subSizer.Add(self.buttonText2, 0, wx.EXPAND) subSizer.Add(self.updateButton, 0, wx.LEFT|wx.RIGHT, 10) - + subSizer.AddGrowableCol(1) - + sizer.Add(subSizer, 0, wx.EXPAND|wx.LEFT, 20) sizer.Add((0, 15)) sizer.Add(cp, 0, wx.RIGHT|wx.LEFT|wx.EXPAND, 20) @@ -128,10 +128,10 @@ class PyCollapsiblePaneDemo(wx.Panel): self.Bind(wx.EVT_BUTTON, self.OnUpdate, self.updateButton) self.Bind(wx.EVT_RADIOBOX, self.OnButtonChoice) self.Bind(wx.EVT_COMBOBOX, self.OnUserChoice, self.gtkChoice) - - + + def OnToggle(self, event): - + self.cp.Collapse(self.cp.IsExpanded()) self.OnPaneChanged() @@ -143,32 +143,32 @@ class PyCollapsiblePaneDemo(wx.Panel): self.OnPaneChanged(None) - + def OnStyleChoice(self, evt): style = 0 for cb in self.styleCBs: if cb.IsChecked(): style |= getattr(wx, cb.GetLabel(), 0) - + self.cpStyle = style self.Rebuild() - + def OnButtonChoice(self, event): #self.gtkText.Enable(selection == 4) #self.gtkChoice.Enable(selection == 4) - + self.Rebuild() - - + + def MakeButton(self): - + if self.cpStyle & wx.CP_GTK_EXPANDER: return None - + selection = self.btnRB.GetSelection() - + if selection == 0: # standard wx.Button btn = wx.Button(self.cp, -1, self.label1) elif selection == 1: # buttons.GenButton @@ -184,12 +184,12 @@ class PyCollapsiblePaneDemo(wx.Panel): elif selection == 5: # buttons.ThemedGenBitmapTextButton bmp = images.Mondrian.GetBitmap() btn = buttons.ThemedGenBitmapTextButton(self.cp, -1, bmp, self.label1) - + return btn - - + + def Rebuild(self): - + isExpanded = self.cp.IsExpanded() self.Freeze() cp = PCP.PyCollapsiblePane(self, label=self.label1, agwStyle=self.cpStyle) @@ -206,11 +206,11 @@ class PyCollapsiblePaneDemo(wx.Panel): self.gtkText.Enable(btn is None) self.gtkChoice.Enable(btn is None) self.btnRB.Enable(btn is not None) - + if isExpanded: self.cp.Expand() self.Thaw() - + self.OnPaneChanged(None) self.Layout() @@ -222,7 +222,7 @@ class PyCollapsiblePaneDemo(wx.Panel): # redo the layout self.Layout() - + # and also change the labels if self.cp.IsExpanded(): self.cp.SetLabel(self.label2) @@ -230,7 +230,7 @@ class PyCollapsiblePaneDemo(wx.Panel): else: self.cp.SetLabel(self.label1) self.btn.SetLabel(btnlbl1) - + self.btn.SetInitialSize() @@ -248,7 +248,7 @@ class PyCollapsiblePaneDemo(wx.Panel): width, height = choice.split(",") return int(width), int(height) - + def MakePaneContent(self, pane): '''Just make a few controls to put on the collapsible pane''' @@ -264,16 +264,16 @@ class PyCollapsiblePaneDemo(wx.Panel): city = wx.TextCtrl(pane, -1, "", size=(150,-1)); state = wx.TextCtrl(pane, -1, "", size=(50,-1)); zip = wx.TextCtrl(pane, -1, "", size=(70,-1)); - + addrSizer = wx.FlexGridSizer(cols=2, hgap=5, vgap=5) addrSizer.AddGrowableCol(1) - addrSizer.Add(nameLbl, 0, + addrSizer.Add(nameLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) addrSizer.Add(name, 0, wx.EXPAND) addrSizer.Add(addrLbl, 0, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL) addrSizer.Add(addr1, 0, wx.EXPAND) - addrSizer.Add((5,5)) + addrSizer.Add((5,5)) addrSizer.Add(addr2, 0, wx.EXPAND) addrSizer.Add(cstLbl, 0, diff --git a/demo/agw/PyProgress.py b/demo/agw/PyProgress.py index 2f4522ea..c094e1d5 100644 --- a/demo/agw/PyProgress.py +++ b/demo/agw/PyProgress.py @@ -25,9 +25,9 @@ class PyProgressDemo(wx.Panel): wx.Panel.__init__(self, parent) - self.panel = wx.Panel(self, -1) + self.panel = wx.Panel(self, -1) self.log = log - + self.LayoutItems() @@ -40,16 +40,16 @@ class PyProgressDemo(wx.Panel): self.elapsedchoice = wx.CheckBox(self.panel, -1, "Show Elapsed Time") self.elapsedchoice.SetValue(1) - + self.cancelchoice = wx.CheckBox(self.panel, -1, "Enable Cancel Button") self.cancelchoice.SetValue(1) - + static1 = wx.StaticText(self.panel, -1, "Gauge Proportion (%): ") self.slider1 = wx.Slider(self.panel, -1, 20, 1, 99, style=wx.SL_HORIZONTAL| wx.SL_AUTOTICKS|wx.SL_LABELS) self.slider1.SetTickFreq(10) self.slider1.SetValue(20) - + static2 = wx.StaticText(self.panel, -1, "Gauge Steps: ") self.slider2 = wx.Slider(self.panel, -1, 50, 2, 100, style=wx.SL_HORIZONTAL| wx.SL_AUTOTICKS|wx.SL_LABELS) @@ -58,10 +58,10 @@ class PyProgressDemo(wx.Panel): static3 = wx.StaticText(self.panel, -1, "Gauge Background Colour: ") self.csel3 = csel.ColourSelect(self.panel, -1, "Choose...", wx.WHITE) - + static4 = wx.StaticText(self.panel, -1, "Gauge First Gradient Colour: ") self.csel4 = csel.ColourSelect(self.panel, -1, "Choose...", wx.WHITE) - + static5 = wx.StaticText(self.panel, -1, "Gauge Second Gradient Colour: ") self.csel5 = csel.ColourSelect(self.panel, -1, "Choose...", wx.BLUE) @@ -79,7 +79,7 @@ class PyProgressDemo(wx.Panel): rightsizer.Add(self.csel4, 0) rightsizer.Add(static5, 0, wx.ALIGN_CENTER_VERTICAL) rightsizer.Add(self.csel5, 0) - + mainsizer.Add(startbutton, 0, wx.ALL, 20) mainsizer.Add(rightsizer, 1, wx.EXPAND|wx.ALL, 10) @@ -92,12 +92,12 @@ class PyProgressDemo(wx.Panel): framesizer.Layout() startbutton.Bind(wx.EVT_BUTTON, self.OnStartProgress) - - + + def OnStartProgress(self, event): event.Skip() - + style = wx.PD_APP_MODAL if self.elapsedchoice.GetValue(): style |= wx.PD_ELAPSED_TIME @@ -105,12 +105,12 @@ class PyProgressDemo(wx.Panel): style |= wx.PD_CAN_ABORT dlg = PP.PyProgress(None, -1, "PyProgress Example", - "An Informative Message", + "An Informative Message", agwStyle=style) proportion = self.slider1.GetValue() steps = self.slider2.GetValue() - + backcol = self.csel3.GetColour() firstcol = self.csel4.GetColour() secondcol = self.csel5.GetColour() @@ -120,7 +120,7 @@ class PyProgressDemo(wx.Panel): dlg.SetGaugeBackground(backcol) dlg.SetFirstGradientColour(firstcol) dlg.SetSecondGradientColour(secondcol) - + max = 400 keepGoing = True count = 0 diff --git a/demo/agw/ShortcutEditor.py b/demo/agw/ShortcutEditor.py index be268fd4..7f3da3a6 100644 --- a/demo/agw/ShortcutEditor.py +++ b/demo/agw/ShortcutEditor.py @@ -139,14 +139,14 @@ def GetValidMenuImages(): keys = catalog.keys() valid_images = [] counter = 0 - + for key in keys: bmp = catalog[key].GetBitmap() if bmp.GetWidth() == 16 and bmp.GetHeight() == 16: valid_images.append(bmp) return valid_images - + #---------------------------------------------------------------------- class ShortcutEditorDemo(wx.Frame): @@ -156,12 +156,12 @@ class ShortcutEditorDemo(wx.Frame): wx.Frame.__init__(self, parent, -1, 'ShortcutEditor wxPython Demo :-D', size=(900, 800)) self.log = log - + self.valid_images = GetValidMenuImages() self.used_shortcuts = [] - self.SetIcon(images.Mondrian.GetIcon()) - + self.SetIcon(images.Mondrian.GetIcon()) + self.MakeMenuBar() self.MakeAcceleratorTable() @@ -169,11 +169,11 @@ class ShortcutEditorDemo(wx.Frame): dlg.FromMenuBar(self) dlg.FromAcceleratorTable(self.accelTable) - self.AddTopMenuBitmaps(dlg) + self.AddTopMenuBitmaps(dlg) dlg.Bind(SE.EVT_SHORTCUT_CHANGING, self.OnShortcutChanging) dlg.Bind(SE.EVT_SHORTCUT_CHANGED, self.OnShortcutChanged) - + self.CenterOnScreen() self.Show() self.Raise() @@ -191,7 +191,7 @@ class ShortcutEditorDemo(wx.Frame): self.AppendMenus(menu, title) - bar.Append(menu, title) + bar.Append(menu, title) top_menus.append(menu) self.SetMenuBar(bar) @@ -205,7 +205,7 @@ class ShortcutEditorDemo(wx.Frame): for i in range(6): name = 'Accelerator %d'%(i+1) choice = random.choice(list(SE.ACCELERATORS.keys())) - + if choice == wx.ACCEL_ALT: letter = random.choice(COMBINATIONS) @@ -214,7 +214,7 @@ class ShortcutEditorDemo(wx.Frame): wxk = inv_keyMap[letter] else: wxk = ord(letter) - + else: wxk = random.choice(list(SE.KEYMAP.keys())) @@ -222,13 +222,13 @@ class ShortcutEditorDemo(wx.Frame): saved_accel = (name, choice, wxk, ACCEL_IDS[i]) self.Bind(wx.EVT_MENU, self.OnAcceleratorShortcuts, id=ACCEL_IDS[i]) - + table.append(accel) saved_table.append(saved_accel) self.accelTable = saved_table self.SetAcceleratorTable(wx.AcceleratorTable(table)) - + def AppendMenus(self, top_menu, title, recursive=''): @@ -259,9 +259,9 @@ class ShortcutEditorDemo(wx.Frame): # Get a random image for the menu bmp = random.choice(self.valid_images) dummy_item.SetBitmap(bmp) - + recursive = '' - + top_menu.Append(sub_menu) if random.randint(0, 1) == 1 and index < num_menus - 1: @@ -279,7 +279,7 @@ class ShortcutEditorDemo(wx.Frame): letter = random.choice(COMBINATIONS) shortcut = '\t%s+' + letter - + if rand == 1: # Ctrl + character modifier = 'Ctrl' @@ -296,7 +296,7 @@ class ShortcutEditorDemo(wx.Frame): if shortcut in self.used_shortcuts: return self.CreateShortcut() - + self.used_shortcuts.append(shortcut) return shortcut @@ -321,10 +321,10 @@ class ShortcutEditorDemo(wx.Frame): dlg.ToMenuBar(self) dlg.ToAcceleratorTable(self) - + dlg.Destroy() - - + + def OnMenuShortcuts(self, event): itemId = event.GetId() @@ -345,7 +345,7 @@ class ShortcutEditorDemo(wx.Frame): if ids == itemId: self.log.write('You have selected the accelerator for %s (%s)'%(label, accel)) break - + def OnShortcutChanging(self, event): diff --git a/demo/agw/SpeedMeter.py b/demo/agw/SpeedMeter.py index 779240d8..33079c2b 100644 --- a/demo/agw/SpeedMeter.py +++ b/demo/agw/SpeedMeter.py @@ -517,7 +517,7 @@ class SpeedMeterDemo(wx.Panel): mainSizer.Layout() self.SendSizeEvent() - + self.timer.Start(1000) self.timer3.Start(500) diff --git a/demo/agw/UltimateListIconDemo.py b/demo/agw/UltimateListIconDemo.py index cc2dcd6c..b5c51e9f 100644 --- a/demo/agw/UltimateListIconDemo.py +++ b/demo/agw/UltimateListIconDemo.py @@ -852,7 +852,7 @@ class TestFrame(wx.Frame): il = wx.ImageList(64, 64, True) imgs = list(catalog.keys()) imgs.sort() - + for img in imgs: bmp = catalog[img].GetBitmap() il_max = il.Add(bmp) @@ -869,14 +869,14 @@ class TestFrame(wx.Frame): info._mask = wx.LIST_MASK_TEXT | wx.LIST_MASK_FORMAT info._format = 0 info._text = "Artist\nName" - + self.list.InsertColumnInfo(0, info) info = ULC.UltimateListItem() info._format = wx.LIST_FORMAT_RIGHT info._mask = wx.LIST_MASK_TEXT | wx.LIST_MASK_FORMAT info._text = "Title" - + self.list.InsertColumnInfo(1, info) info = ULC.UltimateListItem() @@ -888,7 +888,7 @@ class TestFrame(wx.Frame): for i in range(3): self.list.SetColumnWidth(i, 130) - + # create some items for the list for x in range(25): img = x % (il_max+1) @@ -896,7 +896,7 @@ class TestFrame(wx.Frame): self.list.InsertImageStringItem(x, text, img) self.SetIcon(images.Mondrian.GetIcon()) - self.Show() + self.Show() #--------------------------------------------------------------------------- diff --git a/demo/agw/UltimateListListDemo.py b/demo/agw/UltimateListListDemo.py index af78622b..3bb636fd 100644 --- a/demo/agw/UltimateListListDemo.py +++ b/demo/agw/UltimateListListDemo.py @@ -91,7 +91,7 @@ class TestFrame(wx.Frame): il = wx.ImageList(16, 16, True) imgs = list(catalog.keys()) imgs.sort() - + for img in imgs: bmp = catalog[img].GetBitmap() il_max = il.Add(bmp) @@ -113,7 +113,7 @@ class TestFrame(wx.Frame): self.list.InsertImageStringItem(x, "This is item %02d" % x, img, it_kind=it_kind) self.SetIcon(images.Mondrian.GetIcon()) - self.Show() + self.Show() #--------------------------------------------------------------------------- @@ -123,4 +123,3 @@ if __name__ == '__main__': frame = TestFrame(None, sys.stdout) frame.Show(True) app.MainLoop() - \ No newline at end of file diff --git a/demo/agw/XLSGrid.py b/demo/agw/XLSGrid.py index 365c2258..ca564d46 100644 --- a/demo/agw/XLSGrid.py +++ b/demo/agw/XLSGrid.py @@ -58,7 +58,7 @@ class XLSGridDemo(wx.Panel): def OnButton(self, evt): - XLSGridFrame(None) + XLSGridFrame(None) class XLSGridFrame(wx.Frame): @@ -78,7 +78,7 @@ class XLSGridFrame(wx.Frame): menuBar = wx.MenuBar() fileMenu = wx.Menu() helpMenu = wx.Menu() - + item = wx.MenuItem(fileMenu, wx.ID_ANY, "E&xit", "Exit XLSGrid demo") self.Bind(wx.EVT_MENU, self.OnClose, item) fileMenu.Append(item) @@ -86,7 +86,7 @@ class XLSGridFrame(wx.Frame): item = wx.MenuItem(helpMenu, wx.ID_ANY, "About...", "Shows the about dialog") self.Bind(wx.EVT_MENU, self.OnAbout, item) helpMenu.Append(item) - + menuBar.Append(fileMenu, "&File") menuBar.Append(helpMenu, "&Help") @@ -94,10 +94,10 @@ class XLSGridFrame(wx.Frame): statusbar = self.CreateStatusBar(2, wx.STB_SIZEGRIP) statusbar.SetStatusWidths([-2, -1]) - + statusbar_fields = [("wxPython XLSGrid Demo, Andrea Gavana @ 08 Aug 2011"), ("Welcome To wxPython!")] - + for i in range(len(statusbar_fields)): statusbar.SetStatusText(statusbar_fields[i], i) @@ -120,11 +120,11 @@ class XLSGridPanel(wx.Panel): def __init__(self, parent): wx.Panel.__init__(self, parent) - + self.start_button = wx.Button(self, -1, "Start") self.grid = XG.XLSGrid(self) - self.grid.Hide() + self.grid.Hide() self.DoLayout() @@ -135,7 +135,7 @@ class XLSGridPanel(wx.Panel): xlrd_ver = xlrd.__VERSION__ string_xlrd = "Version " + xlrd_ver - + if xlrd_ver <= "0.7.1": string_xlrd += ": hyperlink and rich-text functionalities will not work. xlrd 0.7.2 (SVN) is required for this." else: @@ -145,7 +145,7 @@ class XLSGridPanel(wx.Panel): string_pywin32 = "You have pywin32! XLSGrid cells should appear exactly as in Excel (WYSIWYG)." else: string_pywin32 = "You don't have pywin32. Cell string formatting will be severely limited." - + main_sizer = wx.BoxSizer(wx.VERTICAL) top_sizer = wx.BoxSizer(wx.HORIZONTAL) top_right_sizer = wx.BoxSizer(wx.VERTICAL) @@ -171,14 +171,14 @@ class XLSGridPanel(wx.Panel): self.SetSizer(main_sizer) main_sizer.Layout() - + def OnStart(self, event): event.Skip() - + filename = os.path.join(os.path.abspath(dataDir), "Example_1.xls") - + if not os.path.isfile(filename): dlg = wx.MessageDialog(self, 'Error: the file "Example_1.xls" is not in the "data" directory', 'XLSGridDemo Error', wx.OK | wx.ICON_ERROR) @@ -187,7 +187,7 @@ class XLSGridPanel(wx.Panel): return busy = wx.BusyInfo("Reading Excel file, please wait...") - + sheetname = "Example_1" book = xlrd.open_workbook(filename, formatting_info=1) @@ -200,7 +200,7 @@ class XLSGridPanel(wx.Panel): self.grid.Show() self.grid.PopulateGrid(book, sheet, texts, comments) - + self.start_button.Enable(False) self.Layout() @@ -215,7 +215,7 @@ def runTest(frame, nb, log): else: msg = 'This demo requires the xlrd package to be installed.\n' \ 'See: http://pypi.python.org/pypi/xlrd' - + if _isStandalone: dlg = wx.MessageDialog(nb, msg, 'Sorry', wx.ICON_WARNING|wx.OK) dlg.ShowModal() @@ -224,9 +224,9 @@ def runTest(frame, nb, log): else: from Main import MessagePanel win = MessagePanel(nb, msg, 'Sorry', wx.ICON_WARNING) - + return win - + #---------------------------------------------------------------------- overview = XG.__doc__ diff --git a/demo/agw/__demo__.py b/demo/agw/__demo__.py index 2b8ba6c0..a598dedd 100644 --- a/demo/agw/__demo__.py +++ b/demo/agw/__demo__.py @@ -12,7 +12,7 @@ this module returns the following information: item in the wxPython demo; * GetDemos: returns all the demos in the AGW package; * GetOverview: returns a wx.html-ready representation of the AGW docs. - + These meta data are merged into the wxPython demo tree at startup. Last updated: Andrea Gavana @ 04 Feb 2013, 21.00 GMT. @@ -43,7 +43,7 @@ _agwDocs = wx.lib.agw.__doc__ def GetDemoBitmap(): """ Returns the bitmap to be used in the demo tree for the AGW package. """ - # Get the image as PyEmbeddedImage + # Get the image as PyEmbeddedImage image = PyEmbeddedImage( b"iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAABHNCSVQICAgIfAhkiAAAAvdJ" b"REFUOI2NkX1I3HUcx1/f7+/B85yXpXa38o+ltIdzGRUUs4fpClaYi5iFERpkG6yQtkEEBZ0Q" @@ -94,7 +94,7 @@ def GetRecentAdditions(): else: recentAdditions = ['AGWInfoBar', 'PersistentControls', 'ShortcutEditor', 'XLSGrid'] - # Return the Recent Additions for AGW + # Return the Recent Additions for AGW return recentAdditions @@ -107,7 +107,7 @@ def GetDemos(): # The tree item text for AGW AGWTreeItem = "Advanced Generic Widgets" - # The AGW demos + # The AGW demos AGWDemos = ['AdvancedSplash', 'AquaButton', 'AUI', 'BalloonTip', 'ButtonPanel', 'CubeColourDialog', 'CustomTreeCtrl', 'FlatMenu', 'FlatNotebook', 'FloatSpin', @@ -140,8 +140,8 @@ def GetOverview(): _agwDocs = wx.lib.agw.__doc__ _agwDocs = _agwDocs.replace("`", "").replace("L{", "").replace("}", "") - - # Split the docs in many lines + + # Split the docs in many lines splitted = _agwDocs.split("\n") # Add the title strs = "\n

Advanced Generic Widgets (AGW)

\n\n" @@ -196,6 +196,6 @@ def GetOverview(): # Show wx things with the tag strs = strs.replace(widget, "%s"%widget) - # Return the beautified AGW docs, ready for wx.html + # Return the beautified AGW docs, ready for wx.html return strs diff --git a/demo/encode_bitmaps.py b/demo/encode_bitmaps.py index 0c27e8a5..af4d7e84 100644 --- a/demo/encode_bitmaps.py +++ b/demo/encode_bitmaps.py @@ -65,7 +65,7 @@ command_lines = [ "-a -F -n Carrot bmp_source/carrot.png images.py", "-a -F -n Pointy bmp_source/pointy.png images.py", "-a -F -n Pencil bmp_source/pencil.png images.py", - + "-a -F -i -n WXPdemo bmp_source/wxpdemo.ico images.py", "-a -F -n _rt_alignleft bmp_source/rt_alignleft.xpm images.py", @@ -125,9 +125,9 @@ command_lines = [ "-a -F -c bmp_source/recent.png images.py", "-a -F -c bmp_source/saveperspective.png images.py", "-a -F -c bmp_source/customcontrol.png images.py", - + "-a -F -c bmp_source/deletedocs.png images.py", - + "-a -F -c -n spinning_nb0 bmp_source/FRM_0.png images.py", "-a -F -c -n spinning_nb1 bmp_source/FRM_1.png images.py", "-a -F -c -n spinning_nb2 bmp_source/FRM_2.png images.py", @@ -137,7 +137,7 @@ command_lines = [ "-a -F -c -n spinning_nb6 bmp_source/FRM_6.png images.py", "-a -F -c -n spinning_nb7 bmp_source/FRM_7.png images.py", "-a -F -c -n spinning_nb8 bmp_source/FRM_8.png images.py", - + " -F -c bmp_source/001.png throbImages.py", "-a -F -c bmp_source/002.png throbImages.py", "-a -F -c bmp_source/003.png throbImages.py",