Skip to content

Commit 27e7b2e

Browse files
committed
Updated to python 3
1 parent 3a6d233 commit 27e7b2e

File tree

4 files changed

+39
-39
lines changed

4 files changed

+39
-39
lines changed

Demos/FPC/Demo01/unit1.lfm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ object Form1: TForm1
5353
Width = 545
5454
Align = alClient
5555
Lines.Strings = (
56-
'print 2+2'
56+
'print(2+2)'
5757
)
5858
TabOrder = 2
5959
end

Demos/FPC/Demo06/Unit1.lfm

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,16 @@ object Form1: TForm1
3131
Lines.Strings = (
3232
'import sys'
3333
'import spam'
34-
'print spam.foo(''hello world'', 1)'
34+
'print(spam.foo(''hello world'', 1))'
3535
'p = spam.CreatePoint( 10, 25 )'
36-
'print "Point:", p'
36+
'print("Point:", p)'
3737
'p.x = 58'
38-
'print p.x, p'
38+
'print(p.x, p)'
3939
'p.OffsetBy( 5, 5 )'
40-
'print p'
41-
'print "Current value of var test is: ", test'
40+
'print(p)'
41+
'print("Current value of var test is: ", test)'
4242
'test.Value = "New value set by Python"'
43-
'print "getdouble: ", spam.getdouble()'
43+
'print("getdouble: ", spam.getdouble())'
4444
)
4545
ScrollBars = ssVertical
4646
TabOrder = 1
@@ -113,9 +113,9 @@ object Form1: TForm1
113113
object PythonEngine1: TPythonEngine
114114
InitScript.Strings = (
115115
'import sys'
116-
'print "Python Dll: ", sys.version'
117-
'print sys.copyright'
118-
'print'
116+
'print("Python Dll: ", sys.version)'
117+
'print(sys.copyright)'
118+
'print()'
119119
)
120120
IO = PythonGUIInputOutput1
121121
left = 8

Demos/FPC/Demo25/unit1.lfm

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ object Form1: TForm1
6161
' def __init__(Self, Value=0):'
6262
' Self.Value = Value'
6363
' def __del__(Self):'
64-
' print "delete", Self'
64+
' print("delete", Self)'
6565
' def __add__(self, other):'
6666
' return Foo(self.Value + other.Value)'
6767
' def Inc(Self, AValue = 1):'
@@ -85,7 +85,7 @@ object Form1: TForm1
8585
' return [a, b, c, d]'
8686
''
8787
'f = Foo()'
88-
'print "Created", f'
88+
'print("Created", f)'
8989
'f.Inc()'
9090
'f.Inc(2)'
9191
'b = Bar()'

Demos/FPC/Demo31/Unit1.lfm

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ object Form1: TForm1
6666
' self.Height = 400'
6767
''
6868
' def btnCloseClick(self, Sender):'
69-
' print "Close!"'
69+
' print("Close!")'
7070
' self.Close()'
7171
''
7272
' def MyFormCloseQuery(self, Sender, CanClose):'
@@ -78,7 +78,7 @@ object Form1: TForm1
7878
' def grdTestDrawCell(self, Sender, Col, Row, Rect, State):'
7979
' if gdSelected in State:'
8080
' Sender.Canvas.Brush.Color = clBlue # 0x00ff0000 # blue'
81-
' print "Cell[%d, %d] is selected, Rect=%s, State=%s" % (Col, Row, Rect, State)'
81+
' print("Cell[%d, %d] is selected, Rect=%s, State=%s" % (Col, Row, Rect, State))'
8282
' Sender.Canvas.TextRect(Rect, Rect.Left+2, Rect.Top+2, "%d @ %d" % (Col, Row))'
8383
''
8484
' def grdTestSelectCell(self, Sender, Col, Row, CanSelect):'
@@ -102,8 +102,8 @@ object Form1: TForm1
102102
' self.assertEqual(DVar.IValue, 70)'
103103
' MainForm.Caption = ''PyDelphi rocks!'' #setting properties'
104104
' self.assertEqual(MainForm.Caption, ''PyDelphi rocks!'')'
105-
' print'
106-
' print ''MainForm.ActiveControl='', MainForm.ActiveControl # class properties'
105+
' print()'
106+
' print(''MainForm.ActiveControl='', MainForm.ActiveControl # class properties)'
107107
' MainForm.BorderStyle = ''bsSizeable'' #enumeration property'
108108
' MainForm.Anchors = [''akTop'', ''akLeft''] #set property'
109109
' self.assertEqual(MainForm.Anchors, [''akTop'', ''akLeft''])'
@@ -117,23 +117,23 @@ object Form1: TForm1
117117
' DVar.SetMeUp(''Age'', 25)'
118118
' self.assertEqual(DVar.SValue, ''Age'')'
119119
' self.assertEqual(DVar.IValue, 25)'
120-
' print'
121-
' print DVar.DescribeMe() #method calls'
120+
' print()'
121+
' print(DVar.DescribeMe() #method calls)'
122122
''
123123
' def testRepr(self):'
124-
' print'
125-
' print ''Representation of Delphi objects'''
126-
' print DVar'
127-
' print MainForm'
124+
' print()'
125+
' print(''Representation of Delphi objects'')'
126+
' print(DVar)'
127+
' print(MainForm)'
128128
' if DelphiVersion >= 7:'
129-
' print DVar.DescribeMe # method object'
130-
' print DVar.SL # TStrings'
129+
' print(DVar.DescribeMe # method object)'
130+
' print(DVar.SL # TStrings)'
131131
''
132132
' def testTStrings(self):'
133133
' SL = DVar.SL'
134134
' self.assertEqual(len(SL), 2)'
135-
' print'
136-
' for i in DVar.SL: print i, '' contains '', DVar.SL[i]'
135+
' print()'
136+
' for i in DVar.SL: print(i, '' contains '', DVar.SL[i])'
137137
' SL.Add(''New String'')'
138138
' self.assertEqual(len(SL), 3)'
139139
' self.assertEqual(SL.IndexOf(''New String''), 2)'
@@ -148,7 +148,7 @@ object Form1: TForm1
148148
' self.assertEqual(MainForm in SL.Objects, True)'
149149
' SL.Delete(2)'
150150
' self.assertEqual(len(SL), 2)'
151-
' print "str(SL) =", str(SL)'
151+
' print("str(SL) =", str(SL))'
152152
' SL.Assign([1, 2, 3])'
153153
' self.assertEqual(len(SL), 3)'
154154
' self.assertEqual(''2'' in SL, True)'
@@ -180,7 +180,7 @@ object Form1: TForm1
180180
' self.assertEqual(MainForm.Button1.Caption, ''Click me!!!!'')'
181181
' # Test Owner property and DelphiObject comparison'
182182
' self.assert_(MainForm.Button1.Owner == MainForm)'
183-
' print [i.Name for i in MainForm.Components]'
183+
' print([i.Name for i in MainForm.Components])'
184184
''
185185
' def testCreateComponent(self):'
186186
' NewButton = CreateComponent(''TButton'', None)'
@@ -191,9 +191,9 @@ object Form1: TForm1
191191
''
192192
' def testWinControls(self):'
193193
' self.assertEqual(MainForm.Panel1.Parent, MainForm)'
194-
' print'
195-
' print ''MainForm contains '', MainForm.ControlCount, '' controls'''
196-
' print [i.Name for i in MainForm.Controls]'
194+
' print()'
195+
' print(''MainForm contains '', MainForm.ControlCount, '' controls'')'
196+
' print([i.Name for i in MainForm.Controls])'
197197
''
198198
' def testForm(self):'
199199
' MyForm = CreateComponent(''TForm'', None)'
@@ -246,7 +246,7 @@ object Form1: TForm1
246246
' B2.ModalResult = mrOk'
247247
' B2.TabOrder = 3'
248248
' def ClickHandler(Sender):'
249-
' print Sender.Name, '' was clicked'''
249+
' print(Sender.Name, '' was clicked'')'
250250
' LB.Items.Add(Edit.Text)'
251251
' B1.OnClick = ClickHandler'
252252
' def KeyPressHandler(Sender, Key):'
@@ -302,29 +302,29 @@ object Form1: TForm1
302302
' def testFormSubclass(self):'
303303
' f = MyForm(Application)'
304304
' try:'
305-
' print f.ShowModal()'
305+
' print(f.ShowModal())'
306306
' finally:'
307307
' f.Free()'
308308
''
309309
' def testFormSubclass2(self):'
310310
' f = TTestForm(Application)'
311311
' try:'
312-
' print f.ShowModal()'
312+
' print(f.ShowModal())'
313313
' finally:'
314314
' f.Free()'
315315
''
316316
' def testPointConversions(self):'
317317
' p1 = Point(10, 10)'
318318
' p = MainForm.ClientToScreen(p1)'
319-
' print p'
319+
' print(p)'
320320
' p2 = MainForm.ScreenToClient(p)'
321321
' self.assertEqual(p2.X, p1.X)'
322322
' self.assertEqual(p2.Y, p1.Y)'
323323
''
324324
' def testObjectNotification(self):'
325325
' DVar.IValue = 0'
326326
' def ChangeHandler(Sender):'
327-
' print Sender'
327+
' print(Sender)'
328328
' Sender.IValue = 55'
329329
' DVar.OnChange = ChangeHandler'
330330
' if DelphiVersion >= 7:'
@@ -343,7 +343,7 @@ object Form1: TForm1
343343
' MainForm.actTest.Execute()'
344344
' self.assertEqual(DVar.IValue, 1)'
345345
' def ActionHandler(Sender):'
346-
' print "Action", Sender.Name, "executed from Python"'
346+
' print("Action", Sender.Name, "executed from Python")'
347347
' DVar.IValue = 2'
348348
' self.assertEqual(MainForm.actTest.OnExecute, None)'
349349
' MainForm.actTest.OnExecute = ActionHandler'
@@ -371,8 +371,8 @@ object Form1: TForm1
371371
' MainForm.Button1.SetFocus()'
372372
' self.assertEqual(Screen.ActiveControl, MainForm.Button1)'
373373
' def ActiveControlChangeHandler(Sender):'
374-
' print "ActiveControlChangeHandler fired"'
375-
' print "New active constrol is", Sender.ActiveControl.Name'
374+
' print("ActiveControlChangeHandler fired")'
375+
' print("New active constrol is", Sender.ActiveControl.Name)'
376376
' DVar.IValue = 2'
377377
' self.assertEqual(Screen.OnActiveControlChange, None)'
378378
' Screen.OnActiveControlChange = ActiveControlChangeHandler'

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy