Skip to content

Commit 660bba5

Browse files
author
Metallicow
committed
Cleanup/Shebang/print("PY3")/General Fixes
1 parent ccc414a commit 660bba5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

93 files changed

+1889
-2147
lines changed

AboutDialog.py

+13-13
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,11 @@ def __init__(self, parent, icon1=None,
3737
self.urls = urls
3838
self.licence = licence
3939
self.developers = developers
40-
40+
4141
self.Build()
42-
42+
4343
def Build(self):
44-
44+
4545
# Build the header
4646
Header = wx.BoxSizer(wx.HORIZONTAL)
4747
if self.icon1:
@@ -66,9 +66,9 @@ def Build(self):
6666

6767
# Now the rest;
6868
MainSizer = wx.BoxSizer(wx.VERTICAL)
69-
69+
7070
MainSizer.Add(Header, 0, wx.EXPAND|wx.ALIGN_CENTER|wx.ALL, 5)
71-
71+
7272
if self.long_name:
7373
Label = wx.StaticText(self, label=self.long_name)
7474
of = Label.GetFont()
@@ -89,11 +89,11 @@ def Build(self):
8989
#of = Label.GetFont()
9090
#Font = wx.Font(int(of.GetPointSize() * 1.5), of.GetFamily(), wx.NORMAL, wx.NORMAL)
9191
#Label.SetFont(Font)
92-
92+
9393
Label.Wrap(max(250, 0.9*width))
9494
MainSizer.Add(Label, 0, wx.ALL|wx.ALIGN_CENTER, 5)
9595

96-
96+
9797
if self.licence:
9898
Label = wx.StaticText(self, label="License:")
9999
of = Label.GetFont()
@@ -110,12 +110,12 @@ def Build(self):
110110
Font = wx.Font(of.GetPointSize(), of.GetFamily(), wx.NORMAL, wx.BOLD)
111111
Label.SetFont(Font)
112112
MainSizer.Add(Label, 0, wx.ALL|wx.ALIGN_LEFT, 5)
113-
113+
114114
for developer in self.developers:
115115
Label = wx.StaticText(self, label=" "+developer)
116116
MainSizer.Add(Label, 0, wx.ALL|wx.ALIGN_LEFT, 0)
117-
118-
if self.urls:
117+
118+
if self.urls:
119119
Label = wx.StaticText(self, label="For more information:")
120120
of = Label.GetFont()
121121
Font = wx.Font(of.GetPointSize(), of.GetFamily(), wx.NORMAL, wx.BOLD)
@@ -126,13 +126,13 @@ def Build(self):
126126
label=url,
127127
URL=url)
128128
MainSizer.Add(Link, 0, wx.ALL|wx.ALIGN_CENTER, 2)
129-
129+
130130
MainSizer.Add((1,5),1)
131131
MainSizer.Add(wx.Button(self, id=wx.ID_OK, label="Dismiss"), 0, wx.ALL|wx.ALIGN_RIGHT,5)
132132
SpaceSizer = wx.BoxSizer(wx.VERTICAL)
133133
SpaceSizer.Add(MainSizer, 0, wx.ALL, 10)
134134
self.SetSizerAndFit(SpaceSizer)
135-
135+
136136
if __name__ == "__main__":
137137

138138
a = wx.App(False)
@@ -147,5 +147,5 @@ def Build(self):
147147
"mailto:[email protected]"],
148148
licence="This is a short description of the license used for the program.",
149149
developers = ["A Developer", "Another Developer"])
150-
150+
151151
d.ShowModal()

Append_test.py

+14-15
Original file line numberDiff line numberDiff line change
@@ -12,26 +12,26 @@ def __init__(self):
1212
wx.DefaultPosition,
1313
size=(800,600),
1414
style=wx.DEFAULT_FRAME_STYLE | wx.NO_FULL_REPAINT_ON_RESIZE)
15-
16-
self.objects = []
15+
16+
self.objects = []
1717
self.dragImage = None
1818
self.DragPaper = None
19-
self.hiliteObjects = None
19+
self.hiliteObjects = None
2020
self.lines = []
2121
self.maxWidth = 1000
2222
self.maxHeight = 1000
2323
self.x = self.y = 0
2424
self.curLine = []
2525
self.drawing = False
26-
26+
2727
self.Paper = wx.Bitmap("Paper.BMP", wx.BITMAP_TYPE_BMP)
2828
if self.Paper.Ok():
2929
print "bitmap loaded OK"
3030
else:
3131
raise Exception("bitmap DID NOT load OK")
3232

3333
self.DrawTextOnPaper()
34-
34+
3535
#--------------------------------------------------------------------------
3636
if BUFFERED:
3737
self.buffer = wx.EmptyBitmap(self.maxWidth, self.maxHeight)
@@ -60,27 +60,27 @@ def DrawTextOnPaper(self):
6060
dc.SetFont(wx.Font(36, wx.MODERN, wx.NORMAL, wx.NORMAL, 0, "Arial"))
6161
dc.SetTextForeground(wx.BLACK)
6262
dc.DrawText(text, 155, 25)
63-
63+
6464
def DoDrawing(self, dc, printing=False):
65-
dc.BeginDrawing()
66-
65+
dc.BeginDrawing()
66+
6767
## l1 = ['a','b','c','d']
6868
## text = " "+"".join(l1)
6969
## bg_colour = wx.Colour(57, 115, 57) # matches the bg image
7070
## dc.SetFont(wx.Font(36, wx.MODERN, wx.NORMAL, wx.NORMAL, 0, "Arial"))
7171
## dc.SetTextForeground(wx.BLACK)
7272
## te = dc.GetTextExtent(text)
73-
74-
73+
74+
7575
dc.DrawBitmap(self.Paper, 200, 20, True)
76-
77-
76+
77+
7878
#dc = wx.MemoryDC()
7979
#dc.SelectObject(self.manuscript)
8080
#self.DoDrawing(dc)
81-
81+
8282
## dc.DrawText(text, 225, 25)
83-
83+
8484
dc.EndDrawing()
8585
#--------------------------------------------------------------------------
8686
class MyApp(wx.App):
@@ -95,4 +95,3 @@ def OnInit(self):
9595
if __name__ == "__main__":
9696
app = MyApp(0)
9797
app.MainLoop()
98-

BitmapFromBufferTest.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@
1212
class BitmapWindow(wx.Window):
1313
def __init__(self, parent, bytearray, *args, **kwargs):
1414
wx.Window.__init__(self, parent, *args, **kwargs)
15-
15+
1616
self.bytearray = bytearray
1717
self.Bind(wx.EVT_PAINT, self.OnPaint)
18-
18+
1919
def OnPaint(self, evt):
2020
dc = wx.PaintDC(self)
2121
bmp = wx.BitmapFromBufferRGBA(200,200, self.bytearray)

BitmapFromPILTest.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ def __init__(self, title = "Bitmap Demo"):
2121
self.bitmap = wx.BitmapFromBuffer(w, h, image.tostring() )
2222

2323
self.Bind(wx.EVT_PAINT, self.OnPaint)
24-
24+
2525
def OnPaint(self, evt):
2626
dc = wx.PaintDC(self)
2727
dc.DrawBitmap(self.bitmap, 10, 10 )

BlitTest.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def __init__(self,parent,id,title):
2020
self.t=wx.Timer(self)
2121
self.BuildImage()
2222
self.t.Start(100)
23-
23+
2424
def OnQuit(self,Event):
2525
self.Destroy()
2626

@@ -43,10 +43,10 @@ def BuildImage(self, event = None):
4343
random.randint(1,max(Size)),
4444
random.randint(1,max(Size)),
4545
random.randint(1,max(Size)))
46-
46+
4747
color = self.random_color()
4848
self.Lines.append( [color, (x1,y1,x2,y2)] )
49-
49+
5050
dc.BeginDrawing()
5151
dc.Clear()
5252
for line in self.Lines:
@@ -71,7 +71,7 @@ def OnTimer(self,event):
7171
dc.EndDrawing()
7272
del dc
7373
wx.ClientDC(self).DrawBitmap(self._Buffer,0,0)
74-
74+
7575
def random_color(self):
7676
return apply(wx.Colour,(random.randrange(255),random.randrange(255),random.randrange(255)))
7777

@@ -82,9 +82,9 @@ def OnInit(self):
8282
frame = MainWindow(None, -1, "BlitTest")
8383
self.SetTopWindow(frame)
8484
frame.Show()
85-
85+
8686
return True
87-
87+
8888

8989
app = MyApp(0)
9090
app.MainLoop()

BufferedWithControls.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ def UpdateDrawing(self):
6363
dc.SelectObject(self._Buffer)
6464
self.Draw(dc)
6565
self.Refresh() # This forces a Paint event, so the screen gets updated.
66-
#self.Update() # If it's not getting updated fast enough, this should force it.
66+
#self.Update() # If it's not getting updated fast enough, this should force it.
6767

6868
class DrawWindow(wxBufferedWindow):
6969
def __init__(self, parent, id = -1):
@@ -119,7 +119,7 @@ def OnBitmapButton(self,event=None):
119119
def CheckB(self):
120120
self.ID_SOSO = wx.NewId()
121121
self.checkB = wx.CheckBox(self, self.ID_SOSO, "test", pos = (50, 50))
122-
122+
123123
class TestFrame(wx.Frame):
124124
def __init__(self):
125125
wx.Frame.__init__(self, None, -1, "Double Buffered Test",

ButtonArray.py

+8-8
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,20 @@ class ButtonArrayPanel(wx.Panel):
66
def __init__(self, *args, **kwargs):
77
wx.Panel.__init__(self, *args, **kwargs)
88
Sizer = wx.GridSizer(16, 2, 0, 0)
9-
9+
1010
for i in range(32):
1111
B = wx.Button(self, label = "button %i"%i)
1212
B.Bind(wx.EVT_BUTTON,
1313
lambda evt, but_num = i: self.OnButton(evt, but_num) )
1414
Sizer.Add(B, 0, wx.GROW|wx.ALL, 4)
15-
15+
1616
self.SetSizerAndFit(Sizer)
17-
17+
1818
def OnButton(self, evt, but_num):
1919
print "Button number: %i clicked"%but_num
20-
21-
22-
20+
21+
22+
2323

2424
class DemoFrame(wx.Frame):
2525

@@ -39,10 +39,10 @@ def __init__(self, title = "Button Array Demo"):
3939

4040
self.Bind(wx.EVT_CLOSE, self.OnQuit)
4141

42-
42+
4343
def OnQuit(self,Event):
4444
self.Destroy()
45-
45+
4646

4747
app = wx.App(False)
4848
frame = DemoFrame()

CalculatorDemo.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
It has been altered to allow it to be "driven" by an external script,
1212
plus a little layout improvement
1313
14-
See CalcualtorDemoDriver.py
14+
See CalcualtorDemoDriver.py
1515
1616
for an example
1717
"""
@@ -20,7 +20,7 @@
2020
# Calculator GUI:
2121

2222
# ___________v
23-
# [7][8][9][/]
23+
# [7][8][9][/]
2424
# [4][5][6][*]
2525
# [1][2][3][-]
2626
# [0][.][C][+]
@@ -39,7 +39,7 @@ def __init__(self, parent=None):
3939
self.display = wx.ComboBox(self, -1) # Current calculation
4040
sizer.Add(self.display, 0, wx.EXPAND) # Add to main sizer
4141

42-
# [7][8][9][/]
42+
# [7][8][9][/]
4343
# [4][5][6][*]
4444
# [1][2][3][-]
4545
# [0][.][C][+]
@@ -67,7 +67,7 @@ def __init__(self, parent=None):
6767

6868
def OnButton(self, evt):
6969
'''Handle button click event'''
70-
70+
7171
# Get title of clicked button
7272
label = evt.GetEventObject().GetLabel()
7373

@@ -83,7 +83,7 @@ def OnButton(self, evt):
8383
def Calculate(self):
8484
"""
8585
do the calculation itself
86-
86+
8787
in a separate method, so it can be called outside of a button event handler
8888
"""
8989
try:
@@ -107,7 +107,7 @@ def Calculate(self):
107107
def ComputeExpression(self, expression):
108108
"""
109109
Compute the expression passed in.
110-
110+
111111
This can be called from another class, module, etc.
112112
"""
113113
self.display.SetValue(expression)

CalculatorDemoDriver.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/usr/bin/env python
2-
2+
33
"""
44
demo of how to drive a wxPython app from another script:
55
@@ -21,11 +21,11 @@
2121

2222
class GUI_Thread(threading.Thread):
2323
"""
24-
class to create a thread to run the GUI in
25-
24+
class to create a thread to run the GUI in
25+
2626
this should allow the command line to stay active in the main thread,
2727
while the mainloop is running in this thread.
28-
28+
2929
"""
3030
def run(self):
3131
"""
@@ -36,7 +36,7 @@ def run(self):
3636
self.calculator = CalculatorDemo.Calculator()
3737
self.calculator.Show()
3838
self.app.MainLoop()
39-
39+
4040

4141
# create and start the thread for the GUI
4242
gui_thread = GUI_Thread()
@@ -49,5 +49,5 @@ def run(self):
4949
expr = raw_input()
5050
# send the input to the calculator to calculate
5151
gui_thread.calculator.ComputeExpression(expr)
52-
52+
5353

CenterTest.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env python2.4
1+
#!/usr/bin/env python
22

33
import wx
44

0 commit comments

Comments
 (0)