Skip to content

Commit

Permalink
Trim Trailing Whitespace demos
Browse files Browse the repository at this point in the history
  • Loading branch information
Metallicow committed Nov 25, 2016
1 parent 3d30023 commit c273dfa
Show file tree
Hide file tree
Showing 90 changed files with 645 additions and 646 deletions.
2 changes: 1 addition & 1 deletion demo/ActiveXWrapper_IE.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ def OnOpenButton(self, event):
dlg.Destroy()

def OnHomeButton(self, event):
self.ie.GoHome()
self.ie.GoHome()

def OnPrevPageButton(self, event):
self.ie.GoBack()
Expand Down
2 changes: 1 addition & 1 deletion demo/ActiveX_FlashWindow.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def OnOpenURLButton(self, event):
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()
Expand Down
14 changes: 7 additions & 7 deletions demo/ActiveX_IEHtmlWindow.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def __init__(self, parent, log, frame=None):
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
Expand Down Expand Up @@ -68,7 +68,7 @@ def __init__(self, parent, log, frame=None):
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)
Expand Down Expand Up @@ -145,7 +145,7 @@ def OnNextPageButton(self, event):

def OnCheckCanGoBack(self, event):
event.Enable(self.ie.CanGoBack())

def OnCheckCanGoForward(self, event):
event.Enable(self.ie.CanGoForward())

Expand All @@ -162,7 +162,7 @@ def OnRefreshPageButton(self, evt):
# 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])
Expand All @@ -174,15 +174,15 @@ def BeforeNavigate2(self, this, pDisp, URL, Flags, TargetFrameName,
# 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)
Cancel[0] = True # Veto the creation of a new window.

#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)
Expand All @@ -195,7 +195,7 @@ def StatusTextChange(self, this, Text):
if self.frame:
self.frame.SetStatusText(Text)



#----------------------------------------------------------------------
# for the demo framework...
Expand Down
12 changes: 6 additions & 6 deletions demo/ActiveX_PDFWindow.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,21 @@ def __init__(self, parent, log):

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)

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)
Expand All @@ -45,7 +45,7 @@ def __init__(self, parent, log):

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%"])
Expand All @@ -58,7 +58,7 @@ def __init__(self, parent, log):

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)
Expand Down Expand Up @@ -129,7 +129,7 @@ def OnZoom(self, event):
self.pdf.setZoom(percent)
except ValueError:
pass

def OnLoadButton(self, event):
dlg = wx.FileDialog(self, wildcard="*.pdf")
if dlg.ShowModal() == wx.ID_OK:
Expand Down
6 changes: 3 additions & 3 deletions demo/AlphaDrawing.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def __init__(self, parent, log):
then these squares should be transparent.
"""
wx.StaticText(self, -1, txt, (20, 20))


def OnPaint(self, evt):
pdc = wx.PaintDC(self)
Expand All @@ -42,8 +42,8 @@ def OnPaint(self, evt):
#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):
Expand Down
6 changes: 3 additions & 3 deletions demo/AnalogClock.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def __init__(self, parent, log):

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,
Expand Down Expand Up @@ -60,7 +60,7 @@ def __init__(self, parent, log):

# 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| \
Expand All @@ -79,7 +79,7 @@ def __init__(self, parent, log):
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,
Expand Down
4 changes: 2 additions & 2 deletions demo/AnimateCtrl.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

GIFNames = [
'bitmaps/AG00178_.gif',
'bitmaps/BD13656_.gif',
'bitmaps/BD13656_.gif',
'bitmaps/AG00185_.gif',
'bitmaps/AG00039_.gif',
'bitmaps/AG00183_.gif',
Expand All @@ -31,7 +31,7 @@ def __init__(self, parent, log):
border = wx.BoxSizer()
border.Add(sizer, 1, wx.EXPAND | wx.ALL, 20)
self.SetSizer(border)


#----------------------------------------------------------------------

Expand Down
2 changes: 1 addition & 1 deletion demo/BannerWindow.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
#!/usr/bin/env python# -*- coding: utf-8 -*-import wximport wx.advphoenix = ("""\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 nestand bird burn fiercely and are reduced to ashes, from which a new, young phoenix or phoenixegg arises, reborn anew to live again. The new phoenix is destined to live as long as its oldself. """)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 anda colour gradient background.Banner windows can be used to present some overview of the current window contentsto the user in an aesthetically pleasant way. They are typically positioned alongthe left or top edge of the window (although this class also supports right-alignedand bottom-aligned banners) and show either a bitmap with a logo or a few lines oftext on a gradient-filled background."""if __name__ == '__main__': import sys,os import run run.main(['', os.path.basename(sys.argv[0])] + sys.argv[1:])
#!/usr/bin/env python# -*- coding: utf-8 -*-import wximport wx.advphoenix = ("""\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 nestand bird burn fiercely and are reduced to ashes, from which a new, young phoenix or phoenixegg arises, reborn anew to live again. The new phoenix is destined to live as long as its oldself. """)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 anda colour gradient background.Banner windows can be used to present some overview of the current window contentsto the user in an aesthetically pleasant way. They are typically positioned alongthe left or top edge of the window (although this class also supports right-alignedand bottom-aligned banners) and show either a bitmap with a logo or a few lines oftext on a gradient-filled background."""if __name__ == '__main__': import sys,os import run run.main(['', os.path.basename(sys.argv[0])] + sys.argv[1:])
Expand Down
8 changes: 4 additions & 4 deletions demo/CheckListBox.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def __init__(self, parent, log):
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)
Expand All @@ -38,7 +38,7 @@ def EvtCheckListBox(self, event):
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")
Expand All @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions demo/Choicebook.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"Select",
"Pages"
]


class TestCB(wx.Choicebook):
def __init__(self, parent, id, log):
Expand All @@ -29,7 +29,7 @@ def __init__(self, parent, id, log):
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)
Expand Down
14 changes: 7 additions & 7 deletions demo/CollapsiblePane.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ def __init__(self, parent, log):
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:
Expand All @@ -55,7 +55,7 @@ def OnPaneChanged(self, evt=None):
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'''
Expand All @@ -70,16 +70,16 @@ def MakePaneContent(self, pane):
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,
Expand Down
2 changes: 1 addition & 1 deletion demo/ColourDB.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ def Draw(self, dc, rgn=None, vs=None):
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
Expand Down
8 changes: 4 additions & 4 deletions demo/ComboTreeBox.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ def __init__(self, parent, log):
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)
Expand All @@ -32,9 +32,9 @@ def _createComboTreeBox(self, style):
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)

Expand Down
14 changes: 7 additions & 7 deletions demo/DVC_CustomRenderer.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def __init__(self, log, *args, **kw):
dv.DataViewCustomRenderer.__init__(self, *args, **kw)
self.log = log
self.value = None


def SetValue(self, value):
#self.log.write('SetValue: %s' % value)
Expand Down Expand Up @@ -115,17 +115,17 @@ def __init__(self, parent, log, model=None, data=None):
# 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.
Expand All @@ -142,10 +142,10 @@ def __init__(self, parent, log, model=None, data=None):
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)



#----------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion demo/DVC_DataViewModel.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ def SetValue(self, value, item, col):
elif col == 5:
node.like = value
return True


#----------------------------------------------------------------------

Expand Down
Loading

0 comments on commit c273dfa

Please sign in to comment.