From 9b83ff5ddedf749665a426bf9e0f86d2207ae9e0 Mon Sep 17 00:00:00 2001 From: Reinier Sterkenburg Date: Sun, 4 Oct 2020 17:25:56 +0200 Subject: [PATCH 1/3] Improved DPI awareness --- Demos/Demo34/Demo34.dproj | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Demos/Demo34/Demo34.dproj b/Demos/Demo34/Demo34.dproj index 0dc29bed..93b43433 100644 --- a/Demos/Demo34/Demo34.dproj +++ b/Demos/Demo34/Demo34.dproj @@ -77,6 +77,7 @@ true $(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_44.png $(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_150.png + PerMonitorV2 $(BDS)\bin\delphi_PROJECTICON.ico @@ -87,6 +88,8 @@ true CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments= $(BDS)\bin\default_app.manifest + true + PerMonitorV2 false From 957f91adca115b3a89cab490b4d1f1ae3888a5fb Mon Sep 17 00:00:00 2001 From: Reinier Sterkenburg Date: Sun, 4 Oct 2020 17:26:01 +0200 Subject: [PATCH 2/3] small formatting improvements --- Demos/Demo34/Unit1.pas | 33 ++++++++++++++------------------- 1 file changed, 14 insertions(+), 19 deletions(-) diff --git a/Demos/Demo34/Unit1.pas b/Demos/Demo34/Unit1.pas index 3eeaaa4b..ae34a4a4 100644 --- a/Demos/Demo34/Unit1.pas +++ b/Demos/Demo34/Unit1.pas @@ -25,13 +25,11 @@ TForm1 = class(TForm) procedure FormCreate(Sender: TObject); procedure cbPyVersionsSelect(Sender: TObject); private - { Déclarations privées } PythonEngine1: TPythonEngine; PythonModule1: TPythonModule; PythonType1: TPythonType; PyVersions: TPythonVersions; public - { Déclarations publiques } procedure CreatePythonComponents; end; @@ -40,8 +38,8 @@ TForm1 = class(TForm) // Then it must override some methods, like the constructors, // the RegisterMethods and the type services' virtual methods. TPyPoint = class(TPyObject) - x, y : Integer; - Name : String; + x, y: Integer; + Name: String; // Constructors & Destructors constructor Create( APythonType : TPythonType ); override; @@ -96,7 +94,6 @@ procedure TForm1.CreatePythonComponents; PythonEngine1.IO := PythonGUIInputOutput1; - { TPythonModule } PythonModule1 := TPythonModule.Create(Self); @@ -131,8 +128,8 @@ procedure TForm1.CreatePythonComponents; end; procedure TForm1.FormCreate(Sender: TObject); -Var - PyVersion : TPythonVersion; +var + PyVersion: TPythonVersion; begin PyVersions := GetRegisteredPythonVersions; for PyVersion in PyVersions do @@ -143,7 +140,6 @@ procedure TForm1.FormCreate(Sender: TObject); end; end; - // First, we need to initialize the property PyObjectClass with // the class of our Type object procedure TForm1.PythonType1Initialization(Sender: TObject); @@ -163,7 +159,7 @@ constructor TPyPoint.Create( APythonType : TPythonType ); // Don't call the Create constructor of TPyPoint, because // we call the inherited constructor CreateWith that calls // the Create constructor first, and because the constructors -// are virtual, TPyPoint.Create will be automatically be called. +// are virtual, TPyPoint.Create will automatically be called. constructor TPyPoint.CreateWith( PythonType : TPythonType; args : PPyObject ); begin @@ -257,16 +253,16 @@ procedure TPyPoint.OffsetBy( dx, dy : Integer ); function TPyPoint.DoOffsetBy( args : PPyObject ) : PPyObject; var - dx, dy : Integer; + dx, dy: Integer; begin with GetPythonEngine do begin // We adjust the transmitted self argument Adjust(@Self); // first we extract the arguments - if PyArg_ParseTuple( args, 'ii:Point.Offset',@dx, @dy ) <> 0 then + if PyArg_ParseTuple( args, 'ii:Point.Offset', @dx, @dy ) <> 0 then begin - // if it's ok, then we call the method that does the job + // if it's ok, we call the method that does the job // with the correct arguments OffsetBy( dx, dy ); // Finally, we return nothing @@ -299,16 +295,15 @@ function TPyPoint.DoRaiseError( args : PPyObject ) : PPyObject; ///////////////////////////////////////////////// - procedure TForm1.Button1Click(Sender: TObject); var - DelphiPoint : TPyPoint; - p : PPyObject; + DelphiPoint: TPyPoint; + p: PPyObject; begin // Here's how you can create/read Python vars from Delphi with // Delphi/Python objects. - // You should ask to the TPythonType to create an instance of its type + // You should ask the TPythonType to create an instance of its type // because it will do some initialization. You can use CreateInstanceWith // if you want to transmit some Python arguments. // We receive a Python object pointer @@ -317,10 +312,10 @@ procedure TForm1.Button1Click(Sender: TObject); // Then we cast the python object to the right delphi type DelphiPoint := TPyPoint( PythonToDelphi(p) ); // We do some changes on the delphi object - DelphiPoint.X:=10; - DelphiPoint.Y:=20; + DelphiPoint.X := 10; + DelphiPoint.Y := 20; // Add variable "myPoint" in the module "spam". - // So you'll access to the var in the module called spam with: + // So you'll have access to the var in the module called spam with: // import spam // print spam.myPoint PythonModule1.SetVar( 'myPoint', p ); From 59bb9fe78b9ac0342cbf3d194412c1afb5436162 Mon Sep 17 00:00:00 2001 From: Reinier Sterkenburg Date: Sun, 4 Oct 2020 17:26:01 +0200 Subject: [PATCH 3/3] Some improvements in Python code; Memo font is now Consolas, size 10 --- Demos/Demo34/Unit1.dfm | Bin 3404 -> 4687 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/Demos/Demo34/Unit1.dfm b/Demos/Demo34/Unit1.dfm index d99467ee9ba6dfc40027f7fcfe5b62af32ac05d5..d69d10f4230c16b24b2da78db892418453a14d32 100644 GIT binary patch literal 4687 zcmeHLZExE)5dOYjadke}!5pKq(`G5q0kP|}0n*y2-KN7Z1hhoQTxC%s>Dd1FyW^Xr zy!2(*Fbr6LHq`NWdU(%s6fbh|J5LRqOSMj3z})`+0pOA^4ZMVYa*PjiS>iZ3q4AZ- z%nF~Lo%ZqR4Hq{nay;(S<43N{ELAekhfMX}v*L!^AWw1bEH&bmk7QwR9<6WrS|(^8 zvC;@xprvhJ-X@#Or9w-Z4^45-QjWHBT-h6~n9`hH_-cH9_Th4VJ$iHYem0&*hq&@e z6q(%4`Obv72sWYj+Ia8Snh>_%&S1t04KuF9k`UP0sW2(+bysY}jWPoJZafK~tpXpxSYS(yuC zxFUAK7-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