diff --git a/.gitignore b/.gitignore
new file mode 100644
index 00000000..10ae397c
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,44 @@
+# Compiled source #
+###################
+*.dcu
+*.obj
+*.exe
+*.bpl
+*.bpi
+*.dcp
+*.rsm
+*.stat
+*.map
+
+# Generated source #
+###################
+*.hpp
+
+# Backup files #
+###################
+*.~*
+
+# IDE Files #
+###################
+*.dproj.local
+*.groupproj.local
+*.identcache
+*.dsk
+*.tvsconfig
+*.otares
+*.drc
+*.rc
+*.res
+*.local
+
+# Output Folders #
+###################
+/Win32
+/Win64
+/OSX32
+/__history
+*.bak
+*.Patch
+VirtualTreeView.zip
+*.#00
+*.pch
diff --git a/Delphinus.Info.json b/Delphinus.Info.json
new file mode 100644
index 00000000..944c5bf5
--- /dev/null
+++ b/Delphinus.Info.json
@@ -0,0 +1,9 @@
+{
+ "id": "{CDB2CEA7-8130-428D-ABBC-C4EA6B567989}",
+ "name": "Python4Delphi",
+ "picture": "PythonForDelphi\\Components\\P4DLogo.jpg",
+ "license_type": "MIT",
+ "license_file": "LICENSE",
+ "platforms": "Win32;Win64",
+ "compiler_min": 10
+}
\ No newline at end of file
diff --git a/Delphinus.Install.json b/Delphinus.Install.json
new file mode 100644
index 00000000..b89ba2f6
--- /dev/null
+++ b/Delphinus.Install.json
@@ -0,0 +1,34 @@
+{
+ "search_pathes":
+ [
+ {
+ "pathes": "PythonForDelphi\\Components\\Sources\\Core",
+ "platforms": "Win32;Win64"
+ }
+ ],
+
+ "browsing_pathes":
+ [
+ {
+ "pathes": "PythonForDelphi\\Components\\Sources\\Core",
+ "platforms": "Win32;Win64"
+ }
+ ],
+
+ "source_folders":
+ [
+ {
+ "folder": "PythonForDelphi",
+ "base": "",
+ "recursive": true,
+ "filter": "*;*.*"
+ }
+ ],
+
+ "projects":
+ [
+ {
+ "project": "PythonForDelphi\\Components\\Python_D.dproj"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 00000000..bd34b125
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2018 Dietmar Budelsky, Morgan Martinet, Kiriakos Vlahos
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/PythonForDelphi/Changes.txt b/PythonForDelphi/Changes.txt
index 3d75e837..9ec91fb2 100644
--- a/PythonForDelphi/Changes.txt
+++ b/PythonForDelphi/Changes.txt
@@ -1247,3 +1247,6 @@ BaseException # New in Python 2.5
request made by Samuel Iseli.
* Added new property "Version" to TPythonEngine returning the current version of P4D as a string as a
request made by Roar Larsen.
+
+NOTE: This document has not been updated for a long time. Please use the Github tools (history, issue tracher) to
+follow the changes to this project.
diff --git a/PythonForDelphi/Components/Compile_PythonVCL_d5.bat b/PythonForDelphi/Components/Compile_PythonVCL_d5.bat
deleted file mode 100644
index a76cf18e..00000000
--- a/PythonForDelphi/Components/Compile_PythonVCL_d5.bat
+++ /dev/null
@@ -1,3 +0,0 @@
-"C:\Program Files\Borland\Delphi5\bin\dcc32.exe" PythonVCL_d5.dpk /USources\Core;Sources\Vcl /RSources\Core;Sources\Vcl
-pause
-
diff --git a/PythonForDelphi/Components/Compile_Python_d5.bat b/PythonForDelphi/Components/Compile_Python_d5.bat
deleted file mode 100644
index 20a718f0..00000000
--- a/PythonForDelphi/Components/Compile_Python_d5.bat
+++ /dev/null
@@ -1 +0,0 @@
-"C:\Program Files\Borland\Delphi5\bin\dcc32.exe" Python_d5.dpk /USources\Core;Sources\Vcl /RSources\Core;Sources\Vcl
diff --git a/PythonForDelphi/Components/P4DFpc.lpk b/PythonForDelphi/Components/P4DFpc.lpk
new file mode 100644
index 00000000..63a050ce
--- /dev/null
+++ b/PythonForDelphi/Components/P4DFpc.lpk
@@ -0,0 +1,67 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <_ExternHelp Items="Count"/>
+
+
+
diff --git a/PythonForDelphi/Components/P4DFpc.pas b/PythonForDelphi/Components/P4DFpc.pas
new file mode 100644
index 00000000..e1a1c690
--- /dev/null
+++ b/PythonForDelphi/Components/P4DFpc.pas
@@ -0,0 +1,15 @@
+{ This file was automatically created by Lazarus. Do not edit!
+ This source is only used to compile and install the package.
+ }
+
+unit P4DFpc;
+
+interface
+
+uses
+ PythonEngine, MethodCallBack, TinyWideStrings, VarPyth, WrapDelphiClasses,
+ WrapDelphiTypes;
+
+implementation
+
+end.
diff --git a/PythonForDelphi/Components/P4DLogo.jpg b/PythonForDelphi/Components/P4DLogo.jpg
new file mode 100644
index 00000000..8c9223ac
Binary files /dev/null and b/PythonForDelphi/Components/P4DLogo.jpg differ
diff --git a/PythonForDelphi/Components/PythonVCL_D.dpk b/PythonForDelphi/Components/PythonVCL_D.dpk
new file mode 100644
index 00000000..08cebe6e
--- /dev/null
+++ b/PythonForDelphi/Components/PythonVCL_D.dpk
@@ -0,0 +1,54 @@
+package PythonVCL_D;
+
+{$R *.res}
+{$R 'Sources\VCL\PythonDatabase.dcr'}
+{$ALIGN 8}
+{$ASSERTIONS ON}
+{$BOOLEVAL OFF}
+{$DEBUGINFO ON}
+{$EXTENDEDSYNTAX ON}
+{$IMPORTEDDATA ON}
+{$IOCHECKS ON}
+{$LOCALSYMBOLS ON}
+{$LONGSTRINGS ON}
+{$OPENSTRINGS ON}
+{$OPTIMIZATION ON}
+{$OVERFLOWCHECKS OFF}
+{$RANGECHECKS OFF}
+{$REFERENCEINFO ON}
+{$SAFEDIVIDE OFF}
+{$STACKFRAMES OFF}
+{$TYPEDADDRESS OFF}
+{$VARSTRINGCHECKS ON}
+{$WRITEABLECONST OFF}
+{$MINENUMSIZE 1}
+{$IMAGEBASE $400000}
+{$DESCRIPTION 'VCL Components for Python'}
+{$IMPLICITBUILD OFF}
+{$IFDEF VER180}{$LIBSUFFIX '10'} {$ENDIF}
+{$IFDEF VER200}{$LIBSUFFIX '12'} {$ENDIF}
+{$IFDEF VER210}{$LIBSUFFIX '14'} {$ENDIF}
+{$IFDEF VER220}{$LIBSUFFIX '15'} {$ENDIF}
+{$IFDEF VER230}{$LIBSUFFIX '16'} {$ENDIF}
+{$IFDEF VER240}{$LIBSUFFIX '17'} {$ENDIF}
+{$IFDEF VER250}{$LIBSUFFIX '18'} {$ENDIF}
+{$IFDEF VER260}{$LIBSUFFIX '19'} {$ENDIF}
+{$IFDEF VER270}{$LIBSUFFIX '20'} {$ENDIF}
+{$IFDEF VER280}{$LIBSUFFIX '21'} {$ENDIF}
+{$IFDEF VER200}{$LIBSUFFIX '22'} {$ENDIF}
+{$IFDEF VER300}{$LIBSUFFIX '23'} {$ENDIF}
+{$IFDEF VER310}{$LIBSUFFIX '24'} {$ENDIF}
+{$IFDEF VER320}{$LIBSUFFIX '25'} {$ENDIF}
+{$IFDEF VER330}{$LIBSUFFIX '26'} {$ENDIF}
+
+requires
+ rtl,
+ vcl,
+ dbrtl,
+ Python_D;
+
+contains
+ PythonDatabase in 'Sources\VCL\PythonDatabase.pas',
+ pyDB in 'Sources\VCL\pyDB.pas',
+ pyDBTables in 'Sources\VCL\pyDBTables.pas';
+end.
diff --git a/PythonForDelphi/Components/PythonVCL_XE2.dpk b/PythonForDelphi/Components/PythonVCL_XE2.dpk
index b2a06d00..bec9d58a 100644
--- a/PythonForDelphi/Components/PythonVCL_XE2.dpk
+++ b/PythonForDelphi/Components/PythonVCL_XE2.dpk
@@ -30,7 +30,7 @@ requires
rtl,
vcl,
dbrtl,
- bdertl,
+// bdertl,
Python_XE2;
contains
diff --git a/PythonForDelphi/Components/PythonVCL_cb3.bpk b/PythonForDelphi/Components/PythonVCL_cb3.bpk
deleted file mode 100644
index 2c81855c..00000000
--- a/PythonForDelphi/Components/PythonVCL_cb3.bpk
+++ /dev/null
@@ -1,163 +0,0 @@
-# ---------------------------------------------------------------------------
-!if !$d(BCB)
-BCB = $(MAKEDIR)\..
-!endif
-
-# ---------------------------------------------------------------------------
-# SECTION EDI
-# ---------------------------------------------------------------------------
-# La section suivante du Makefile du projet est gérée par l'EDI de BCB.
-# Il est recommandé d'utiliser l'EDI pour modifier les valeurs de cette
-# section.
-# ---------------------------------------------------------------------------
-
-VERSION = BCB.03
-# ---------------------------------------------------------------------------
-PROJECT = PythonVCL_cb3.bpl
-OBJFILES = Sources\VCL\PythonDatabase.obj Sources\VCL\pyDBTables.obj Sources\VCL\pyDB.obj \
- PythonVCL_cb3.obj
-RESFILES = PythonVCL_cb3.res Sources\VCL\PythonDatabase.dcr
-DEFFILE =
-RESDEPEN = $(RESFILES)
-LIBFILES =
-LIBRARIES =
-SPARELIBS = VCL35.lib Python_cb3.lib VCLDB35.lib
-PACKAGES = VCL35.bpi VCLDB35.bpi Python_cb3.bpi
-# ---------------------------------------------------------------------------
-PATHCPP = .;
-PATHASM = .;Sources\Core;Sources\VCL
-PATHPAS = .;Sources\Core;Sources\VCL
-PATHRC = .;
-DEBUGLIBPATH = $(BCB)\lib\debug
-RELEASELIBPATH = $(BCB)\lib\release
-# ---------------------------------------------------------------------------
-CFLAG1 = -O2 -Hc -w -Ve -r- -k -y -v -vi- -c -b- -w-par -w-inl -Vx
-CFLAG2 = -D_RTLDLL;USEPACKAGES -Isources\vcl;$(BCB)\include;$(BCB)\include\vcl \
- -H=$(BCB)\lib\vcl35.csm
-CFLAG3 = -Tkh30000
-PFLAGS = -D_RTLDLL;USEPACKAGES \
- -U.;sources\core;sources\vcl;$(BCB)\lib\obj;$(BCB)\lib;$(RELEASELIBPATH) \
- -Isources\core;sources\vcl;$(BCB)\include;$(BCB)\include\vcl -$Y -$W -$D- -v -JPHN -M
-RFLAGS = -D_RTLDLL;USEPACKAGES -isources\core;sources\vcl;$(BCB)\include;$(BCB)\include\vcl
-AFLAGS = /isources\core /isources\vcl /i$(BCB)\include /i$(BCB)\include\vcl /d_RTLDLL /dUSEPACKAGES /mx \
- /w2 /zd
-LFLAGS = -L.;sources\core;sources\vcl;$(BCB)\lib\obj;$(BCB)\lib;$(RELEASELIBPATH) \
- -D"VCL Components for Python" -aa -Tpp -x -Gn -Gl -Gi -v
-IFLAGS =
-# ---------------------------------------------------------------------------
-ALLOBJ = c0pkg32.obj $(PACKAGES) sysinit.obj $(OBJFILES)
-ALLRES = $(RESFILES)
-ALLLIB = $(LIBFILES) $(LIBRARIES) import32.lib cp32mti.lib
-# ---------------------------------------------------------------------------
-!ifdef IDEOPTIONS
-
-[Version Info]
-IncludeVerInfo=1
-AutoIncBuild=0
-MajorVer=1
-MinorVer=0
-Release=0
-Build=0
-Debug=0
-PreRelease=0
-Special=0
-Private=0
-DLL=0
-Locale=1036
-CodePage=1252
-
-[Version Info Keys]
-CompanyName=
-FileDescription=
-FileVersion=1.0.0.0
-InternalName=
-LegalCopyright=
-LegalTrademarks=
-OriginalFilename=
-ProductName=
-ProductVersion=1.0.0.0
-Comments=
-
-[Debugging]
-DebugSourceDirs=$(BCB)\source\vcl
-
-[Parameters]
-RunParams=
-HostApplication=
-
-!endif
-
-# ---------------------------------------------------------------------------
-# SECTION MAKE
-# ---------------------------------------------------------------------------
-# Cette section du fichier projet n'est pas utilisée par l'EDI de BCB. Elle est destinée
-# à la construction à partir de la ligne de commande en utilisant l'utilitaire MAKE.
-# ---------------------------------------------------------------------------
-
-.autodepend
-# ---------------------------------------------------------------------------
-!if !$d(BCC32)
-BCC32 = bcc32
-!endif
-
-!if !$d(DCC32)
-DCC32 = dcc32
-!endif
-
-!if !$d(TASM32)
-TASM32 = tasm32
-!endif
-
-!if !$d(LINKER)
-LINKER = ilink32
-!endif
-
-!if !$d(BRCC32)
-BRCC32 = brcc32
-!endif
-# ---------------------------------------------------------------------------
-!if $d(PATHCPP)
-.PATH.CPP = $(PATHCPP)
-.PATH.C = $(PATHCPP)
-!endif
-
-!if $d(PATHPAS)
-.PATH.PAS = $(PATHPAS)
-!endif
-
-!if $d(PATHASM)
-.PATH.ASM = $(PATHASM)
-!endif
-
-!if $d(PATHRC)
-.PATH.RC = $(PATHRC)
-!endif
-# ---------------------------------------------------------------------------
-$(PROJECT): $(OBJFILES) $(RESDEPEN) $(DEFFILE)
- $(BCB)\BIN\$(LINKER) @&&!
- $(LFLAGS) +
- $(ALLOBJ), +
- $(PROJECT),, +
- $(ALLLIB), +
- $(DEFFILE), +
- $(ALLRES)
-!
-# ---------------------------------------------------------------------------
-.pas.hpp:
- $(BCB)\BIN\$(DCC32) $(PFLAGS) {$< }
-
-.pas.obj:
- $(BCB)\BIN\$(DCC32) $(PFLAGS) {$< }
-
-.cpp.obj:
- $(BCB)\BIN\$(BCC32) $(CFLAG1) $(CFLAG2) $(CFLAG3) -n$(@D) {$< }
-
-.c.obj:
- $(BCB)\BIN\$(BCC32) $(CFLAG1) $(CFLAG2) $(CFLAG3) -n$(@D) {$< }
-
-.asm.obj:
- $(BCB)\BIN\$(TASM32) $(AFLAGS) $<, $@
-
-.rc.res:
- $(BCB)\BIN\$(BRCC32) $(RFLAGS) -fo$@ $<
-# ---------------------------------------------------------------------------
diff --git a/PythonForDelphi/Components/PythonVCL_cb3.cpp b/PythonForDelphi/Components/PythonVCL_cb3.cpp
deleted file mode 100644
index 8f27d640..00000000
--- a/PythonForDelphi/Components/PythonVCL_cb3.cpp
+++ /dev/null
@@ -1,21 +0,0 @@
-//---------------------------------------------------------------------------
-#include
-#pragma hdrstop
-USERES("PythonVCL_cb3.res");
-USEPACKAGE("VCL35.bpi");
-USEPACKAGE("VCLDB35.bpi");
-USEPACKAGE("Python_cb3.bpi");
-USEUNIT("Sources\VCL\PythonDatabase.pas");
-USERES("Sources\VCL\PythonDatabase.dcr");
-USEUNIT("Sources\VCL\pyDBTables.pas");
-USEUNIT("Sources\VCL\pyDB.pas");
-//---------------------------------------------------------------------------
-#pragma package(smart_init)
-//---------------------------------------------------------------------------
-// Source du paquet.
-//---------------------------------------------------------------------------
-int WINAPI DllEntryPoint(HINSTANCE hinst, unsigned long reason, void*)
-{
- return 1;
-}
-//---------------------------------------------------------------------------
diff --git a/PythonForDelphi/Components/PythonVCL_cb3.dpk b/PythonForDelphi/Components/PythonVCL_cb3.dpk
deleted file mode 100644
index 2e742f06..00000000
--- a/PythonForDelphi/Components/PythonVCL_cb3.dpk
+++ /dev/null
@@ -1,39 +0,0 @@
-package PythonVCL_cb3;
-
-{$R *.RES}
-{$R 'PythonDatabase.dcr'}
-{$ALIGN ON}
-{$ASSERTIONS ON}
-{$BOOLEVAL OFF}
-{$DEBUGINFO ON}
-{$EXTENDEDSYNTAX ON}
-{$IMPORTEDDATA ON}
-{$IOCHECKS ON}
-{$LOCALSYMBOLS ON}
-{$LONGSTRINGS ON}
-{$OPENSTRINGS ON}
-{$OPTIMIZATION ON}
-{$OVERFLOWCHECKS OFF}
-{$RANGECHECKS OFF}
-{$REFERENCEINFO OFF}
-{$SAFEDIVIDE OFF}
-{$STACKFRAMES OFF}
-{$TYPEDADDRESS OFF}
-{$VARSTRINGCHECKS ON}
-{$WRITEABLECONST ON}
-{$MINENUMSIZE 1}
-{$IMAGEBASE $00400000}
-{$DESCRIPTION 'VCL Components for Python'}
-{$DESIGNONLY}
-{$IMPLICITBUILD ON}
-
-requires
- VCLDB35,
- Python_cb3;
-
-contains
- pyDB,
- pyDBTables,
- PythonDatabase;
-
-end.
diff --git a/PythonForDelphi/Components/PythonVCL_cb3.res b/PythonForDelphi/Components/PythonVCL_cb3.res
deleted file mode 100644
index cde45972..00000000
Binary files a/PythonForDelphi/Components/PythonVCL_cb3.res and /dev/null differ
diff --git a/PythonForDelphi/Components/PythonVCL_cb4.bpk b/PythonForDelphi/Components/PythonVCL_cb4.bpk
deleted file mode 100644
index 9565d1a9..00000000
--- a/PythonForDelphi/Components/PythonVCL_cb4.bpk
+++ /dev/null
@@ -1,208 +0,0 @@
-# ---------------------------------------------------------------------------
-!if !$d(BCB)
-BCB = $(MAKEDIR)\..
-!endif
-
-# ---------------------------------------------------------------------------
-# IDE SECTION
-# ---------------------------------------------------------------------------
-# The following section of the project makefile is managed by the BCB IDE.
-# It is recommended to use the IDE to change any of the values in this
-# section.
-# ---------------------------------------------------------------------------
-
-VERSION = BCB.04.04
-# ---------------------------------------------------------------------------
-PROJECT = PythonVCL_cb4.bpl
-OBJFILES = Sources\VCL\PythonDatabase.obj Sources\VCL\pyDBTables.obj Sources\VCL\pyDB.obj \
- PythonVCL_cb4.obj
-RESFILES = PythonVCL_cb4.res Sources\VCL\PythonDatabase.dcr
-RESDEPEN = $(RESFILES)
-LIBFILES =
-IDLFILES =
-IDLGENFILES =
-LIBRARIES =
-SPARELIBS = Vcl40.lib
-PACKAGES = vcl40.bpi vcldb40.bpi Python_cb4.bpi
-DEFFILE =
-# ---------------------------------------------------------------------------
-PATHCPP = .;
-PATHASM = .;
-PATHPAS = .;Sources\VCL
-PATHRC = .;
-DEBUGLIBPATH = $(BCB)\lib\debug
-RELEASELIBPATH = $(BCB)\lib\release
-USERDEFINES =
-SYSDEFINES = _RTLDLL;NO_STRICT;USEPACKAGES
-# ---------------------------------------------------------------------------
-CFLAG1 = -ISources\Core;Sources\VCL;$(BCB)\include;$(BCB)\include\vcl -O2 -Hc \
- -H=$(BCB)\lib\vcl40.csm -w -Ve -r- -a8 -k -y -v -vi- -c -b- -w-par -w-inl -Vx \
- -tWM -D$(SYSDEFINES);$(USERDEFINES)
-IDLCFLAGS = -ISources\Core -ISources\VCL -I$(BCB)\include -I$(BCB)\include\vcl -src_suffixcpp
-PFLAGS = -U..\..\borland\cbuilder4\lib\release;Sources\Core;Sources\VCL;$(BCB)\lib\obj;$(BCB)\lib;$(RELEASELIBPATH) \
- -ISources\Core;Sources\VCL;$(BCB)\include;$(BCB)\include\vcl -$YD -$W -$O- -$D- \
- -v -JPHNE -M
-RFLAGS = -iSources\Core;Sources\VCL;$(BCB)\include;$(BCB)\include\vcl
-AFLAGS = /iSources\Core /iSources\VCL /i$(BCB)\include /i$(BCB)\include\vcl /mx /w2 /zd
-LFLAGS = -L..\..\borland\cbuilder4\lib\release;Sources\Core;Sources\VCL;$(BCB)\lib\obj;$(BCB)\lib;$(RELEASELIBPATH) \
- -l. -D"VCL Components for Python" -aa -Tpp -x -Gn -Gl -Gi -v
-# ---------------------------------------------------------------------------
-ALLOBJ = c0pkg32.obj Memmgr.Lib $(PACKAGES) sysinit.obj $(OBJFILES)
-ALLRES = $(RESFILES)
-ALLLIB = $(LIBFILES) $(LIBRARIES) import32.lib cp32mti.lib
-# ---------------------------------------------------------------------------
-!ifdef IDEOPTIONS
-
-[Version Info]
-IncludeVerInfo=1
-AutoIncBuild=0
-MajorVer=1
-MinorVer=0
-Release=0
-Build=0
-Debug=0
-PreRelease=0
-Special=0
-Private=0
-DLL=0
-Locale=1036
-CodePage=1252
-
-[Version Info Keys]
-CompanyName=
-FileDescription=
-FileVersion=1.0.0.0
-InternalName=
-LegalCopyright=
-LegalTrademarks=
-OriginalFilename=
-ProductName=
-ProductVersion=1.0.0.0
-Comments=
-
-[HistoryLists\hlIncludePath]
-Count=1
-Item0=Sources\Core;Sources\VCL;$(BCB)\include;$(BCB)\include\vcl
-
-[HistoryLists\hlLibraryPath]
-Count=1
-Item0=..\..\borland\cbuilder4\lib\release;Sources\Core;Sources\VCL;$(BCB)\lib\obj;$(BCB)\lib
-
-[HistoryLists\hlDebugSourcePath]
-Count=1
-Item0=$(BCB)\source\vcl
-
-[HistoryLists\hIBPIOutputDir]
-Count=1
-Item0=.
-
-[Debugging]
-DebugSourceDirs=$(BCB)\source\vcl
-
-[Parameters]
-RunParams=
-HostApplication=
-RemoteHost=
-RemotePath=
-RemoteDebug=0
-
-[Compiler]
-InMemoryExe=0
-ShowInfoMsgs=0
-
-[CORBA]
-AddServerUnit=1
-AddClientUnit=1
-PrecompiledHeaders=1
-
-!endif
-
-# ---------------------------------------------------------------------------
-# MAKE SECTION
-# ---------------------------------------------------------------------------
-# This section of the project file is not used by the BCB IDE. It is for
-# the benefit of building from the command-line using the MAKE utility.
-# ---------------------------------------------------------------------------
-
-.autodepend
-# ---------------------------------------------------------------------------
-!if !$d(BCC32)
-BCC32 = bcc32
-!endif
-
-!if !$d(CPP32)
-CPP32 = cpp32
-!endif
-
-!if !$d(DCC32)
-DCC32 = dcc32
-!endif
-
-!if !$d(TASM32)
-TASM32 = tasm32
-!endif
-
-!if !$d(LINKER)
-LINKER = ilink32
-!endif
-
-!if !$d(BRCC32)
-BRCC32 = brcc32
-!endif
-
-!if !$d(IDL2CPP)
-IDL2CPP = idl2cpp
-!endif
-
-# ---------------------------------------------------------------------------
-!if $d(PATHCPP)
-.PATH.CPP = $(PATHCPP)
-.PATH.C = $(PATHCPP)
-!endif
-
-!if $d(PATHPAS)
-.PATH.PAS = $(PATHPAS)
-!endif
-
-!if $d(PATHASM)
-.PATH.ASM = $(PATHASM)
-!endif
-
-!if $d(PATHRC)
-.PATH.RC = $(PATHRC)
-!endif
-# ---------------------------------------------------------------------------
-$(PROJECT): $(IDLGENFILES) $(OBJFILES) $(RESDEPEN) $(DEFFILE)
- $(BCB)\BIN\$(LINKER) @&&!
- $(LFLAGS) +
- $(ALLOBJ), +
- $(PROJECT),, +
- $(ALLLIB), +
- $(DEFFILE), +
- $(ALLRES)
-!
-# ---------------------------------------------------------------------------
-.pas.hpp:
- $(BCB)\BIN\$(DCC32) $(PFLAGS) {$< }
-
-.pas.obj:
- $(BCB)\BIN\$(DCC32) $(PFLAGS) {$< }
-
-.cpp.obj:
- $(BCB)\BIN\$(BCC32) $(CFLAG1) -n$(@D) {$< }
-
-.c.obj:
- $(BCB)\BIN\$(BCC32) $(CFLAG1) -n$(@D) {$< }
-
-.c.i:
- $(BCB)\BIN\$(CPP32) $(CFLAG1) -n. {$< }
-
-.cpp.i:
- $(BCB)\BIN\$(CPP32) $(CFLAG1) -n. {$< }
-
-.asm.obj:
- $(BCB)\BIN\$(TASM32) $(AFLAGS) $<, $@
-
-.rc.res:
- $(BCB)\BIN\$(BRCC32) $(RFLAGS) -fo$@ $<
-# ---------------------------------------------------------------------------
diff --git a/PythonForDelphi/Components/PythonVCL_cb4.cpp b/PythonForDelphi/Components/PythonVCL_cb4.cpp
deleted file mode 100644
index d23d4d79..00000000
--- a/PythonForDelphi/Components/PythonVCL_cb4.cpp
+++ /dev/null
@@ -1,21 +0,0 @@
-//---------------------------------------------------------------------------
-#include
-#pragma hdrstop
-USERES("PythonVCL_cb4.res");
-USEPACKAGE("vcl40.bpi");
-USEUNIT("Sources\VCL\PythonDatabase.pas");
-USERES("Sources\VCL\PythonDatabase.dcr");
-USEUNIT("Sources\VCL\pyDBTables.pas");
-USEUNIT("Sources\VCL\pyDB.pas");
-USEPACKAGE("vcldb40.bpi");
-USEPACKAGE("Python_cb4.bpi");
-//---------------------------------------------------------------------------
-#pragma package(smart_init)
-//---------------------------------------------------------------------------
-// Package source.
-//---------------------------------------------------------------------------
-int WINAPI DllEntryPoint(HINSTANCE hinst, unsigned long reason, void*)
-{
- return 1;
-}
-//---------------------------------------------------------------------------
diff --git a/PythonForDelphi/Components/PythonVCL_cb4.dpk b/PythonForDelphi/Components/PythonVCL_cb4.dpk
deleted file mode 100644
index ecd8c3db..00000000
--- a/PythonForDelphi/Components/PythonVCL_cb4.dpk
+++ /dev/null
@@ -1,39 +0,0 @@
-package PythonVCL_cb4;
-
-{$R *.RES}
-{$R 'Sources\VCL\PythonDatabase.dcr'}
-{$ALIGN ON}
-{$ASSERTIONS ON}
-{$BOOLEVAL OFF}
-{$DEBUGINFO ON}
-{$EXTENDEDSYNTAX ON}
-{$IMPORTEDDATA ON}
-{$IOCHECKS ON}
-{$LOCALSYMBOLS ON}
-{$LONGSTRINGS ON}
-{$OPENSTRINGS ON}
-{$OPTIMIZATION ON}
-{$OVERFLOWCHECKS OFF}
-{$RANGECHECKS OFF}
-{$REFERENCEINFO ON}
-{$SAFEDIVIDE OFF}
-{$STACKFRAMES OFF}
-{$TYPEDADDRESS OFF}
-{$VARSTRINGCHECKS ON}
-{$WRITEABLECONST ON}
-{$MINENUMSIZE 1}
-{$IMAGEBASE $00400000}
-{$DESCRIPTION 'VCL Components for Python'}
-{$IMPLICITBUILD OFF}
-
-requires
- vcl40,
- Vcldb40,
- Python_cb4;
-
-contains
- PythonDatabase in 'Sources\VCL\PythonDatabase.pas',
- pyDB in 'Sources\VCL\pyDB.pas',
- pyDBTables in 'sources\VCL\pyDBTables.pas';
-
-end.
diff --git a/PythonForDelphi/Components/PythonVCL_cb4.res b/PythonForDelphi/Components/PythonVCL_cb4.res
deleted file mode 100644
index 37c47b0b..00000000
Binary files a/PythonForDelphi/Components/PythonVCL_cb4.res and /dev/null differ
diff --git a/PythonForDelphi/Components/PythonVCL_cb5.bpi b/PythonForDelphi/Components/PythonVCL_cb5.bpi
deleted file mode 100644
index 0cf91383..00000000
Binary files a/PythonForDelphi/Components/PythonVCL_cb5.bpi and /dev/null differ
diff --git a/PythonForDelphi/Components/PythonVCL_cb5.bpk b/PythonForDelphi/Components/PythonVCL_cb5.bpk
deleted file mode 100644
index 794b8a16..00000000
--- a/PythonForDelphi/Components/PythonVCL_cb5.bpk
+++ /dev/null
@@ -1,117 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-[Version Info]
-IncludeVerInfo=1
-AutoIncBuild=0
-MajorVer=1
-MinorVer=0
-Release=0
-Build=0
-Debug=0
-PreRelease=0
-Special=0
-Private=0
-DLL=0
-Locale=1036
-CodePage=1252
-
-[Version Info Keys]
-CompanyName=
-FileDescription=
-FileVersion=1.0.0.0
-InternalName=
-LegalCopyright=
-LegalTrademarks=
-OriginalFilename=
-ProductName=
-ProductVersion=1.0.0.0
-Comments=
-
-[HistoryLists\hlIncludePath]
-Count=1
-Item0=Sources\Core;Sources\VCL;$(BCB)\include;$(BCB)\include\vcl
-
-[HistoryLists\hlLibraryPath]
-Count=1
-Item0=..\..\borland\cbuilder4\lib\release;Sources\Core;Sources\VCL;$(BCB)\lib\obj;$(BCB)\lib
-
-[HistoryLists\hlDebugSourcePath]
-Count=1
-Item0=$(BCB)\source\vcl
-
-[HistoryLists\hIBPIOutputDir]
-Count=1
-Item0=.
-
-[Debugging]
-DebugSourceDirs=$(BCB)\source\vcl
-
-[Parameters]
-RunParams=
-HostApplication=
-RemoteHost=
-RemotePath=
-RemoteDebug=0
-
-[Compiler]
-ShowInfoMsgs=0
-LinkDebugVcl=0
-LinkCGLIB=0
-
-[CORBA]
-AddServerUnit=1
-AddClientUnit=1
-PrecompiledHeaders=1
-
-[Language]
-ActiveLang=
-ProjectLang=
-RootDir=
-
-
\ No newline at end of file
diff --git a/PythonForDelphi/Components/PythonVCL_cb5.cpp b/PythonForDelphi/Components/PythonVCL_cb5.cpp
deleted file mode 100644
index 7585c651..00000000
--- a/PythonForDelphi/Components/PythonVCL_cb5.cpp
+++ /dev/null
@@ -1,22 +0,0 @@
-//---------------------------------------------------------------------------
-#include
-#pragma hdrstop
-USERES("PythonVCL_cb5.res");
-USEUNIT("Sources\VCL\PythonDatabase.pas");
-USERES("Sources\VCL\PythonDatabase.dcr");
-USEUNIT("Sources\VCL\pyDBTables.pas");
-USEUNIT("Sources\VCL\pyDB.pas");
-USEPACKAGE("Python_cb5.bpi");
-USEPACKAGE("vcl50.bpi");
-USEPACKAGE("vcldb50.bpi");
-USEPACKAGE("vclbde50.bpi");
-//---------------------------------------------------------------------------
-#pragma package(smart_init)
-//---------------------------------------------------------------------------
-// Package source.
-//---------------------------------------------------------------------------
-int WINAPI DllEntryPoint(HINSTANCE hinst, unsigned long reason, void*)
-{
- return 1;
-}
-//---------------------------------------------------------------------------
diff --git a/PythonForDelphi/Components/PythonVCL_cb5.lib b/PythonForDelphi/Components/PythonVCL_cb5.lib
deleted file mode 100644
index 3e1902de..00000000
Binary files a/PythonForDelphi/Components/PythonVCL_cb5.lib and /dev/null differ
diff --git a/PythonForDelphi/Components/PythonVCL_cb5.res b/PythonForDelphi/Components/PythonVCL_cb5.res
deleted file mode 100644
index 37c47b0b..00000000
Binary files a/PythonForDelphi/Components/PythonVCL_cb5.res and /dev/null differ
diff --git a/PythonForDelphi/Components/PythonVCL_d3.dpk b/PythonForDelphi/Components/PythonVCL_d3.dpk
deleted file mode 100644
index 92eb8c0a..00000000
--- a/PythonForDelphi/Components/PythonVCL_d3.dpk
+++ /dev/null
@@ -1,40 +0,0 @@
-package PythonVCL_d3;
-
-{$R *.RES}
-{$R 'PythonDatabase.dcr'}
-{$ALIGN ON}
-{$ASSERTIONS ON}
-{$BOOLEVAL OFF}
-{$DEBUGINFO ON}
-{$EXTENDEDSYNTAX ON}
-{$IMPORTEDDATA ON}
-{$IOCHECKS ON}
-{$LOCALSYMBOLS ON}
-{$LONGSTRINGS ON}
-{$OPENSTRINGS ON}
-{$OPTIMIZATION ON}
-{$OVERFLOWCHECKS OFF}
-{$RANGECHECKS OFF}
-{$REFERENCEINFO OFF}
-{$SAFEDIVIDE OFF}
-{$STACKFRAMES OFF}
-{$TYPEDADDRESS OFF}
-{$VARSTRINGCHECKS ON}
-{$WRITEABLECONST ON}
-{$MINENUMSIZE 1}
-{$IMAGEBASE $00400000}
-{$DESCRIPTION 'VCL Components for Python'}
-{$DESIGNONLY}
-{$IMPLICITBUILD ON}
-
-requires
- vcl30,
- VCLDB30,
- Python_d3;
-
-contains
- pyDB,
- pyDBTables,
- PythonDatabase;
-
-end.
diff --git a/PythonForDelphi/Components/PythonVCL_d4.dpk b/PythonForDelphi/Components/PythonVCL_d4.dpk
deleted file mode 100644
index c1d9f6ed..00000000
--- a/PythonForDelphi/Components/PythonVCL_d4.dpk
+++ /dev/null
@@ -1,39 +0,0 @@
-package PythonVCL_d4;
-
-{$R *.RES}
-{$R 'Sources\VCL\PythonDatabase.dcr'}
-{$ALIGN ON}
-{$ASSERTIONS ON}
-{$BOOLEVAL OFF}
-{$DEBUGINFO ON}
-{$EXTENDEDSYNTAX ON}
-{$IMPORTEDDATA ON}
-{$IOCHECKS ON}
-{$LOCALSYMBOLS ON}
-{$LONGSTRINGS ON}
-{$OPENSTRINGS ON}
-{$OPTIMIZATION ON}
-{$OVERFLOWCHECKS OFF}
-{$RANGECHECKS OFF}
-{$REFERENCEINFO ON}
-{$SAFEDIVIDE OFF}
-{$STACKFRAMES OFF}
-{$TYPEDADDRESS OFF}
-{$VARSTRINGCHECKS ON}
-{$WRITEABLECONST ON}
-{$MINENUMSIZE 1}
-{$IMAGEBASE $00400000}
-{$DESCRIPTION 'VCL Components for Python'}
-{$IMPLICITBUILD OFF}
-
-requires
- vcl40,
- Vcldb40,
- Python_d4;
-
-contains
- PythonDatabase in 'Sources\VCL\PythonDatabase.pas',
- pyDB in 'Sources\VCL\pyDB.pas',
- pyDBTables in 'sources\VCL\pyDBTables.pas';
-
-end.
diff --git a/PythonForDelphi/Components/PythonVCL_d4.res b/PythonForDelphi/Components/PythonVCL_d4.res
deleted file mode 100644
index 592ec65d..00000000
Binary files a/PythonForDelphi/Components/PythonVCL_d4.res and /dev/null differ
diff --git a/PythonForDelphi/Components/PythonVCL_d5.dpk b/PythonForDelphi/Components/PythonVCL_d5.dpk
deleted file mode 100644
index 81bdc087..00000000
--- a/PythonForDelphi/Components/PythonVCL_d5.dpk
+++ /dev/null
@@ -1,40 +0,0 @@
-package PythonVCL_d5;
-
-{$R *.RES}
-{$R 'Sources\VCL\PythonDatabase.dcr'}
-{$ALIGN ON}
-{$ASSERTIONS ON}
-{$BOOLEVAL OFF}
-{$DEBUGINFO ON}
-{$EXTENDEDSYNTAX ON}
-{$IMPORTEDDATA ON}
-{$IOCHECKS ON}
-{$LOCALSYMBOLS ON}
-{$LONGSTRINGS ON}
-{$OPENSTRINGS ON}
-{$OPTIMIZATION ON}
-{$OVERFLOWCHECKS OFF}
-{$RANGECHECKS OFF}
-{$REFERENCEINFO ON}
-{$SAFEDIVIDE OFF}
-{$STACKFRAMES OFF}
-{$TYPEDADDRESS OFF}
-{$VARSTRINGCHECKS ON}
-{$WRITEABLECONST ON}
-{$MINENUMSIZE 1}
-{$IMAGEBASE $400000}
-{$DESCRIPTION 'VCL Components for Python'}
-{$IMPLICITBUILD OFF}
-
-requires
- vcl50,
- Vcldb50,
- Vclbde50,
- Python_d5;
-
-contains
- pyDB in 'Sources\VCL\pyDB.pas',
- pyDBTables in 'Sources\VCL\pyDBTables.pas',
- PythonDatabase in 'Sources\VCL\PythonDatabase.pas';
-
-end.
diff --git a/PythonForDelphi/Components/PythonVCL_d5.res b/PythonForDelphi/Components/PythonVCL_d5.res
deleted file mode 100644
index ffcaf64c..00000000
Binary files a/PythonForDelphi/Components/PythonVCL_d5.res and /dev/null differ
diff --git a/PythonForDelphi/Components/PythonVCL_d6.dof b/PythonForDelphi/Components/PythonVCL_d6.dof
deleted file mode 100644
index 6e946470..00000000
--- a/PythonForDelphi/Components/PythonVCL_d6.dof
+++ /dev/null
@@ -1,87 +0,0 @@
-[FileVersion]
-Version=6.0
-[Compiler]
-A=8
-B=0
-C=1
-D=1
-E=0
-F=0
-G=1
-H=1
-I=1
-J=1
-K=0
-L=1
-M=0
-N=1
-O=1
-P=1
-Q=0
-R=0
-S=0
-T=0
-U=0
-V=1
-W=0
-X=1
-Y=1
-Z=1
-ShowHints=1
-ShowWarnings=1
-UnitAliases=WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;
-[Linker]
-MapFile=0
-OutputObjs=0
-ConsoleApp=1
-DebugInfo=0
-RemoteSymbols=0
-MinStackSize=16384
-MaxStackSize=1048576
-ImageBase=4194304
-ExeDescription=VCL Components for Python
-[Directories]
-OutputDir=
-UnitOutputDir=
-PackageDLLOutputDir=
-PackageDCPOutputDir=
-SearchPath=
-Packages=
-Conditionals=
-DebugSourceDirs=
-UsePackages=0
-[Parameters]
-RunParams=
-HostApplication=
-Launcher=
-UseLauncher=0
-DebugCWD=
-[Language]
-ActiveLang=
-ProjectLang=
-RootDir=
-[Version Info]
-IncludeVerInfo=1
-AutoIncBuild=0
-MajorVer=1
-MinorVer=0
-Release=0
-Build=0
-Debug=0
-PreRelease=0
-Special=0
-Private=0
-DLL=0
-Locale=1033
-CodePage=1252
-[Version Info Keys]
-CompanyName=
-FileDescription=
-FileVersion=1.0.0.0
-InternalName=
-LegalCopyright=
-LegalTrademarks=
-OriginalFilename=
-ProductName=
-ProductVersion=1.0.0.0
-Comments=
diff --git a/PythonForDelphi/Components/PythonVCL_d6.dpk b/PythonForDelphi/Components/PythonVCL_d6.dpk
deleted file mode 100644
index 37c609a7..00000000
--- a/PythonForDelphi/Components/PythonVCL_d6.dpk
+++ /dev/null
@@ -1,40 +0,0 @@
-package PythonVCL_d6;
-
-{$R *.res}
-{$R 'Sources\VCL\PythonDatabase.dcr'}
-{$ALIGN 8}
-{$ASSERTIONS ON}
-{$BOOLEVAL OFF}
-{$DEBUGINFO ON}
-{$EXTENDEDSYNTAX ON}
-{$IMPORTEDDATA ON}
-{$IOCHECKS ON}
-{$LOCALSYMBOLS ON}
-{$LONGSTRINGS ON}
-{$OPENSTRINGS ON}
-{$OPTIMIZATION ON}
-{$OVERFLOWCHECKS OFF}
-{$RANGECHECKS OFF}
-{$REFERENCEINFO ON}
-{$SAFEDIVIDE OFF}
-{$STACKFRAMES OFF}
-{$TYPEDADDRESS OFF}
-{$VARSTRINGCHECKS ON}
-{$WRITEABLECONST ON}
-{$MINENUMSIZE 1}
-{$IMAGEBASE $400000}
-{$DESCRIPTION 'VCL Components for Python'}
-{$IMPLICITBUILD OFF}
-
-requires
- vcl,
- vcldb,
- bdertl,
- Python_d6;
-
-contains
- pyDB in 'Sources\VCL\pyDB.pas',
- pyDBTables in 'Sources\VCL\pyDBTables.pas',
- PythonDatabase in 'Sources\VCL\PythonDatabase.pas';
-
-end.
diff --git a/PythonForDelphi/Components/PythonVCL_d6.res b/PythonForDelphi/Components/PythonVCL_d6.res
deleted file mode 100644
index ffcaf64c..00000000
Binary files a/PythonForDelphi/Components/PythonVCL_d6.res and /dev/null differ
diff --git a/PythonForDelphi/Components/Python_d6.dpk b/PythonForDelphi/Components/Python_D.dpk
similarity index 60%
rename from PythonForDelphi/Components/Python_d6.dpk
rename to PythonForDelphi/Components/Python_D.dpk
index f3df967c..2c16994f 100644
--- a/PythonForDelphi/Components/Python_d6.dpk
+++ b/PythonForDelphi/Components/Python_D.dpk
@@ -1,40 +1,43 @@
-package Python_d6;
+package Python_D;
{$R *.res}
{$R 'Sources\Core\PythonEngine.dcr'}
+{$IFDEF IMPLICITBUILDING This IFDEF should not be used by users}
{$ALIGN 8}
{$ASSERTIONS ON}
{$BOOLEVAL OFF}
-{$DEBUGINFO ON}
+{$DEBUGINFO OFF}
{$EXTENDEDSYNTAX ON}
{$IMPORTEDDATA ON}
{$IOCHECKS ON}
{$LOCALSYMBOLS ON}
{$LONGSTRINGS ON}
{$OPENSTRINGS ON}
-{$OPTIMIZATION ON}
+{$OPTIMIZATION OFF}
{$OVERFLOWCHECKS OFF}
{$RANGECHECKS OFF}
{$REFERENCEINFO ON}
{$SAFEDIVIDE OFF}
-{$STACKFRAMES OFF}
+{$STACKFRAMES ON}
{$TYPEDADDRESS OFF}
{$VARSTRINGCHECKS ON}
-{$WRITEABLECONST ON}
+{$WRITEABLECONST OFF}
{$MINENUMSIZE 1}
{$IMAGEBASE $400000}
+{$DEFINE DEBUG}
+{$ENDIF IMPLICITBUILDING}
{$DESCRIPTION 'Components for Python'}
{$IMPLICITBUILD OFF}
requires
+ DesignIDE,
+ rtl,
vcl;
contains
+ MethodCallBack in 'Sources\Core\MethodCallBack.pas',
PythonEngine in 'Sources\Core\PythonEngine.pas',
PythonGUIInputOutput in 'Sources\Core\PythonGUIInputOutput.pas',
- MethodCallback in 'Sources\Core\MethodCallBack.pas',
- WrapDelphi in 'Sources\Core\WrapDelphi.pas',
- AtomPythonEngine in 'Sources\Core\AtomPythonEngine.pas',
- PythonAtom in 'Sources\Core\PythonAtom.pas';
+ WrapDelphi in 'Sources\Core\WrapDelphi.pas';
end.
diff --git a/PythonForDelphi/Components/Python_D.dproj b/PythonForDelphi/Components/Python_D.dproj
new file mode 100644
index 00000000..d9feb64c
--- /dev/null
+++ b/PythonForDelphi/Components/Python_D.dproj
@@ -0,0 +1,110 @@
+
+
+ {FDF413DD-FEB8-446B-AAC5-50DC046EBFCB}
+ Python_D.dpk
+ True
+ Debug
+ 1
+ Package
+ VCL
+ 18.3
+ Win32
+
+
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ false
+ false
+ false
+ false
+ false
+ 00400000
+ true
+ true
+ Python_D
+ Components for Python
+ true
+ Vcl;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;System;Xml;Data;Datasnap;Web;Soap;Winapi;System.Win;$(DCC_Namespace)
+ 1032
+ CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments=;CFBundleName=
+
+
+ Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace)
+ Debug
+ true
+ CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments=;ProgramID=com.embarcadero.$(MSBuildProjectName)
+ 1033
+
+
+ RELEASE;$(DCC_Define)
+ 0
+ false
+ 0
+
+
+ DEBUG;$(DCC_Define)
+ false
+ true
+
+
+
+ MainSource
+
+
+
+
+
+
+
+
+
+
+ Cfg_2
+ Base
+
+
+ Base
+
+
+ Cfg_1
+ Base
+
+
+
+ Delphi.Personality.12
+ Package
+
+
+
+ Python_D.dpk
+
+
+
+ False
+ False
+ False
+ True
+ False
+
+
+ 12
+
+
+
+
diff --git a/PythonForDelphi/Components/Python_XE7.dpk b/PythonForDelphi/Components/Python_XE7.dpk
index a54cda0b..9ebd0ef9 100644
--- a/PythonForDelphi/Components/Python_XE7.dpk
+++ b/PythonForDelphi/Components/Python_XE7.dpk
@@ -1,3 +1,5 @@
+// JCL_DEBUG_EXPERT_GENERATEJDBG OFF
+// JCL_DEBUG_EXPERT_INSERTJDBG OFF
package Python_XE7;
{$R *.res}
diff --git a/PythonForDelphi/Components/Python_cb3.bpk b/PythonForDelphi/Components/Python_cb3.bpk
deleted file mode 100644
index e9e5f34a..00000000
--- a/PythonForDelphi/Components/Python_cb3.bpk
+++ /dev/null
@@ -1,179 +0,0 @@
-# ---------------------------------------------------------------------------
-!if !$d(BCB)
-BCB = $(MAKEDIR)\..
-!endif
-
-# ---------------------------------------------------------------------------
-# SECTION EDI
-# ---------------------------------------------------------------------------
-# La section suivante du Makefile du projet est gérée par l'EDI de BCB.
-# Il est recommandé d'utiliser l'EDI pour modifier les valeurs de cette
-# section.
-# ---------------------------------------------------------------------------
-
-VERSION = BCB.03
-# ---------------------------------------------------------------------------
-PROJECT = Python_cb3.bpl
-OBJFILES = Sources\Core\PythonGUIInputOutput.obj Sources\Core\PythonEngine.obj \
- Sources\Core\MethodCallBack.obj Python_cb3.obj
-RESFILES = Python_cb3.res Sources\Core\PythonEngine.dcr
-DEFFILE =
-RESDEPEN = $(RESFILES)
-LIBFILES =
-LIBRARIES =
-SPARELIBS = VCL35.lib
-PACKAGES = VCL35.bpi
-# ---------------------------------------------------------------------------
-PATHCPP = .;
-PATHASM = .;Sources\Core
-PATHPAS = .;Sources\Core
-PATHRC = .;
-DEBUGLIBPATH = $(BCB)\lib\debug
-RELEASELIBPATH = $(BCB)\lib\release
-# ---------------------------------------------------------------------------
-CFLAG1 = -O2 -Hc -w -Ve -r- -k -y -v -vi- -c -b- -w-par -w-inl -Vx
-CFLAG2 = -D_RTLDLL;USEPACKAGES -Isources\core;$(BCB)\include;$(BCB)\include\vcl \
- -H=$(BCB)\lib\vcl35.csm
-CFLAG3 = -Tkh30000
-PFLAGS = -D_RTLDLL;USEPACKAGES \
- -Usources\core;$(BCB)\lib\obj;$(BCB)\lib;$(RELEASELIBPATH) -Isources\core;$(BCB)\include;$(BCB)\include\vcl \
- -$Y -$W -$D- -v -JPHN -M
-RFLAGS = -D_RTLDLL;USEPACKAGES -isources\core;$(BCB)\include;$(BCB)\include\vcl
-AFLAGS = /isources\core /i$(BCB)\include /i$(BCB)\include\vcl /d_RTLDLL /dUSEPACKAGES \
- /mx /w2 /zd
-LFLAGS = -Lsources\core;$(BCB)\lib\obj;$(BCB)\lib;$(RELEASELIBPATH) \
- -D"Components for Python" -aa -Tpp -x -Gn -Gl -Gi -v
-IFLAGS =
-# ---------------------------------------------------------------------------
-ALLOBJ = c0pkg32.obj $(PACKAGES) sysinit.obj $(OBJFILES)
-ALLRES = $(RESFILES)
-ALLLIB = $(LIBFILES) $(LIBRARIES) import32.lib cp32mti.lib
-# ---------------------------------------------------------------------------
-!ifdef IDEOPTIONS
-
-[Version Info]
-IncludeVerInfo=1
-AutoIncBuild=0
-MajorVer=1
-MinorVer=0
-Release=0
-Build=0
-Debug=0
-PreRelease=0
-Special=0
-Private=0
-DLL=0
-Locale=1036
-CodePage=1252
-
-[Version Info Keys]
-CompanyName=
-FileDescription=
-FileVersion=1.0.0.0
-InternalName=
-LegalCopyright=
-LegalTrademarks=
-OriginalFilename=
-ProductName=
-ProductVersion=1.0.0.0
-Comments=
-
-[HistoryLists\hlIncludePath]
-Count=1
-Item0=sources\core;$(BCB)\include;$(BCB)\include\vcl
-
-[HistoryLists\hlLibraryPath]
-Count=1
-Item0=sources\core;$(BCB)\lib\obj;$(BCB)\lib
-
-[HistoryLists\hlDebugSourcePath]
-Count=1
-Item0=$(BCB)\source\vcl
-
-[HistoryLists\hlConditionals]
-Count=1
-Item0=_RTLDLL;USEPACKAGES
-
-[Debugging]
-DebugSourceDirs=$(BCB)\source\vcl
-
-[Parameters]
-RunParams=
-HostApplication=
-
-!endif
-
-# ---------------------------------------------------------------------------
-# SECTION MAKE
-# ---------------------------------------------------------------------------
-# Cette section du fichier projet n'est pas utilisée par l'EDI de BCB. Elle est destinée
-# à la construction à partir de la ligne de commande en utilisant l'utilitaire MAKE.
-# ---------------------------------------------------------------------------
-
-.autodepend
-# ---------------------------------------------------------------------------
-!if !$d(BCC32)
-BCC32 = bcc32
-!endif
-
-!if !$d(DCC32)
-DCC32 = dcc32
-!endif
-
-!if !$d(TASM32)
-TASM32 = tasm32
-!endif
-
-!if !$d(LINKER)
-LINKER = ilink32
-!endif
-
-!if !$d(BRCC32)
-BRCC32 = brcc32
-!endif
-# ---------------------------------------------------------------------------
-!if $d(PATHCPP)
-.PATH.CPP = $(PATHCPP)
-.PATH.C = $(PATHCPP)
-!endif
-
-!if $d(PATHPAS)
-.PATH.PAS = $(PATHPAS)
-!endif
-
-!if $d(PATHASM)
-.PATH.ASM = $(PATHASM)
-!endif
-
-!if $d(PATHRC)
-.PATH.RC = $(PATHRC)
-!endif
-# ---------------------------------------------------------------------------
-$(PROJECT): $(OBJFILES) $(RESDEPEN) $(DEFFILE)
- $(BCB)\BIN\$(LINKER) @&&!
- $(LFLAGS) +
- $(ALLOBJ), +
- $(PROJECT),, +
- $(ALLLIB), +
- $(DEFFILE), +
- $(ALLRES)
-!
-# ---------------------------------------------------------------------------
-.pas.hpp:
- $(BCB)\BIN\$(DCC32) $(PFLAGS) {$< }
-
-.pas.obj:
- $(BCB)\BIN\$(DCC32) $(PFLAGS) {$< }
-
-.cpp.obj:
- $(BCB)\BIN\$(BCC32) $(CFLAG1) $(CFLAG2) $(CFLAG3) -n$(@D) {$< }
-
-.c.obj:
- $(BCB)\BIN\$(BCC32) $(CFLAG1) $(CFLAG2) $(CFLAG3) -n$(@D) {$< }
-
-.asm.obj:
- $(BCB)\BIN\$(TASM32) $(AFLAGS) $<, $@
-
-.rc.res:
- $(BCB)\BIN\$(BRCC32) $(RFLAGS) -fo$@ $<
-# ---------------------------------------------------------------------------
diff --git a/PythonForDelphi/Components/Python_cb3.cpp b/PythonForDelphi/Components/Python_cb3.cpp
deleted file mode 100644
index d9a0132d..00000000
--- a/PythonForDelphi/Components/Python_cb3.cpp
+++ /dev/null
@@ -1,19 +0,0 @@
-//---------------------------------------------------------------------------
-#include
-#pragma hdrstop
-USERES("Python_cb3.res");
-USEPACKAGE("VCL35.bpi");
-USEUNIT("Sources\Core\PythonGUIInputOutput.pas");
-USEUNIT("Sources\Core\PythonEngine.pas");
-USERES("Sources\Core\PythonEngine.dcr");
-USEUNIT("Sources\Core\MethodCallBack.pas");
-//---------------------------------------------------------------------------
-#pragma package(smart_init)
-//---------------------------------------------------------------------------
-// Source du paquet.
-//---------------------------------------------------------------------------
-int WINAPI DllEntryPoint(HINSTANCE hinst, unsigned long reason, void*)
-{
- return 1;
-}
-//---------------------------------------------------------------------------
diff --git a/PythonForDelphi/Components/Python_cb3.dpk b/PythonForDelphi/Components/Python_cb3.dpk
deleted file mode 100644
index d59ac666..00000000
--- a/PythonForDelphi/Components/Python_cb3.dpk
+++ /dev/null
@@ -1,38 +0,0 @@
-package Python_cb3;
-
-{$R *.RES}
-{$R 'PythonEngine.dcr'}
-{$ALIGN ON}
-{$ASSERTIONS ON}
-{$BOOLEVAL OFF}
-{$DEBUGINFO ON}
-{$EXTENDEDSYNTAX ON}
-{$IMPORTEDDATA ON}
-{$IOCHECKS ON}
-{$LOCALSYMBOLS ON}
-{$LONGSTRINGS ON}
-{$OPENSTRINGS ON}
-{$OPTIMIZATION ON}
-{$OVERFLOWCHECKS OFF}
-{$RANGECHECKS OFF}
-{$REFERENCEINFO OFF}
-{$SAFEDIVIDE OFF}
-{$STACKFRAMES OFF}
-{$TYPEDADDRESS OFF}
-{$VARSTRINGCHECKS ON}
-{$WRITEABLECONST ON}
-{$MINENUMSIZE 1}
-{$IMAGEBASE $00400000}
-{$DESCRIPTION 'Components for Python'}
-{$DESIGNONLY}
-{$IMPLICITBUILD ON}
-
-requires
- vcl35;
-
-contains
- PythonEngine,
- MethodCallback,
- PythonGUIInputOutput;
-
-end.
diff --git a/PythonForDelphi/Components/Python_cb3.res b/PythonForDelphi/Components/Python_cb3.res
deleted file mode 100644
index cde45972..00000000
Binary files a/PythonForDelphi/Components/Python_cb3.res and /dev/null differ
diff --git a/PythonForDelphi/Components/Python_cb4.bpi b/PythonForDelphi/Components/Python_cb4.bpi
deleted file mode 100644
index be3d06d4..00000000
Binary files a/PythonForDelphi/Components/Python_cb4.bpi and /dev/null differ
diff --git a/PythonForDelphi/Components/Python_cb4.bpk b/PythonForDelphi/Components/Python_cb4.bpk
deleted file mode 100644
index 0d83ceb8..00000000
--- a/PythonForDelphi/Components/Python_cb4.bpk
+++ /dev/null
@@ -1,214 +0,0 @@
-# ---------------------------------------------------------------------------
-!if !$d(BCB)
-BCB = $(MAKEDIR)\..
-!endif
-
-# ---------------------------------------------------------------------------
-# IDE SECTION
-# ---------------------------------------------------------------------------
-# The following section of the project makefile is managed by the BCB IDE.
-# It is recommended to use the IDE to change any of the values in this
-# section.
-# ---------------------------------------------------------------------------
-
-VERSION = BCB.04.04
-# ---------------------------------------------------------------------------
-PROJECT = Python_cb4.bpl
-OBJFILES = Sources\Core\PythonGUIInputOutput.obj Sources\Core\PythonEngine.obj \
- Sources\Core\MethodCallBack.obj Sources\Core\AtomPythonEngine.obj \
- Sources\Core\PythonAtom.obj Python_cb4.obj
-RESFILES = Python_cb4.res Sources\Core\PythonEngine.dcr
-RESDEPEN = $(RESFILES)
-LIBFILES =
-IDLFILES =
-IDLGENFILES =
-LIBRARIES = dclocx40.lib inet40.lib inetdb40.lib nmfast40.lib dss40.lib tee40.lib \
- teedb40.lib teeui40.lib qrpt40.lib vcldbx40.lib ibsmp40.lib bcbsmp40.lib \
- vcldb40.lib vclmid40.lib vcljpg40.lib vclx40.lib
-SPARELIBS = Vcl40.lib vclx40.lib vcljpg40.lib vclmid40.lib vcldb40.lib bcbsmp40.lib \
- ibsmp40.lib vcldbx40.lib qrpt40.lib teeui40.lib teedb40.lib tee40.lib dss40.lib \
- nmfast40.lib inetdb40.lib inet40.lib dclocx40.lib
-PACKAGES = vcl40.bpi
-DEFFILE =
-# ---------------------------------------------------------------------------
-PATHCPP = .;
-PATHASM = .;
-PATHPAS = .;Sources\Core
-PATHRC = .;
-DEBUGLIBPATH = $(BCB)\lib\debug
-RELEASELIBPATH = $(BCB)\lib\release
-USERDEFINES =
-SYSDEFINES = _RTLDLL;NO_STRICT;USEPACKAGES
-# ---------------------------------------------------------------------------
-CFLAG1 = -ISources\Core;$(BCB)\include;$(BCB)\include\vcl -O2 -Hc \
- -H=$(BCB)\lib\vcl40.csm -w -Ve -r- -a8 -k -y -v -vi- -c -b- -w-par -w-inl -Vx \
- -tWM -D$(SYSDEFINES);$(USERDEFINES)
-IDLCFLAGS = -ISources\Core -I$(BCB)\include -I$(BCB)\include\vcl -src_suffixcpp
-PFLAGS = -U..\..\borland\cbuilder4\lib\release;Sources\Core;$(BCB)\lib\obj;$(BCB)\lib;$(RELEASELIBPATH) \
- -ISources\Core;$(BCB)\include;$(BCB)\include\vcl -H- -W- -$YD -$W -$D- -v \
- -JPHNE -M
-RFLAGS = -iSources\Core;$(BCB)\include;$(BCB)\include\vcl
-AFLAGS = /iSources\Core /i$(BCB)\include /i$(BCB)\include\vcl /mx /w2 /zd
-LFLAGS = -L..\..\borland\cbuilder4\lib\release;Sources\Core;$(BCB)\lib\obj;$(BCB)\lib;$(RELEASELIBPATH) \
- -l. -D"Components for Python" -aa -Tpp -x -Gn -Gl -Gi -v
-# ---------------------------------------------------------------------------
-ALLOBJ = c0pkg32.obj Memmgr.Lib $(PACKAGES) sysinit.obj $(OBJFILES)
-ALLRES = $(RESFILES)
-ALLLIB = $(LIBFILES) $(LIBRARIES) import32.lib cp32mti.lib
-# ---------------------------------------------------------------------------
-!ifdef IDEOPTIONS
-
-[Version Info]
-IncludeVerInfo=1
-AutoIncBuild=0
-MajorVer=1
-MinorVer=0
-Release=0
-Build=0
-Debug=0
-PreRelease=0
-Special=0
-Private=0
-DLL=0
-Locale=1036
-CodePage=1252
-
-[Version Info Keys]
-CompanyName=
-FileDescription=
-FileVersion=1.0.0.0
-InternalName=
-LegalCopyright=
-LegalTrademarks=
-OriginalFilename=
-ProductName=
-ProductVersion=1.0.0.0
-Comments=
-
-[HistoryLists\hlIncludePath]
-Count=1
-Item0=Sources\Core;$(BCB)\include;$(BCB)\include\vcl
-
-[HistoryLists\hlLibraryPath]
-Count=2
-Item0=..\..\borland\cbuilder4\lib\release;Sources\Core;$(BCB)\lib\obj;$(BCB)\lib
-Item1=Sources\Core;$(BCB)\lib\obj;$(BCB)\lib
-
-[HistoryLists\hlDebugSourcePath]
-Count=1
-Item0=$(BCB)\source\vcl
-
-[HistoryLists\hIBPIOutputDir]
-Count=1
-Item0=.
-
-[Debugging]
-DebugSourceDirs=$(BCB)\source\vcl
-
-[Parameters]
-RunParams=
-HostApplication=
-RemoteHost=
-RemotePath=
-RemoteDebug=0
-
-[Compiler]
-InMemoryExe=0
-ShowInfoMsgs=0
-
-[CORBA]
-AddServerUnit=1
-AddClientUnit=1
-PrecompiledHeaders=1
-
-!endif
-
-# ---------------------------------------------------------------------------
-# MAKE SECTION
-# ---------------------------------------------------------------------------
-# This section of the project file is not used by the BCB IDE. It is for
-# the benefit of building from the command-line using the MAKE utility.
-# ---------------------------------------------------------------------------
-
-.autodepend
-# ---------------------------------------------------------------------------
-!if !$d(BCC32)
-BCC32 = bcc32
-!endif
-
-!if !$d(CPP32)
-CPP32 = cpp32
-!endif
-
-!if !$d(DCC32)
-DCC32 = dcc32
-!endif
-
-!if !$d(TASM32)
-TASM32 = tasm32
-!endif
-
-!if !$d(LINKER)
-LINKER = ilink32
-!endif
-
-!if !$d(BRCC32)
-BRCC32 = brcc32
-!endif
-
-!if !$d(IDL2CPP)
-IDL2CPP = idl2cpp
-!endif
-
-# ---------------------------------------------------------------------------
-!if $d(PATHCPP)
-.PATH.CPP = $(PATHCPP)
-.PATH.C = $(PATHCPP)
-!endif
-
-!if $d(PATHPAS)
-.PATH.PAS = $(PATHPAS)
-!endif
-
-!if $d(PATHASM)
-.PATH.ASM = $(PATHASM)
-!endif
-
-!if $d(PATHRC)
-.PATH.RC = $(PATHRC)
-!endif
-# ---------------------------------------------------------------------------
-$(PROJECT): $(IDLGENFILES) $(OBJFILES) $(RESDEPEN) $(DEFFILE)
- $(BCB)\BIN\$(LINKER) @&&!
- $(LFLAGS) +
- $(ALLOBJ), +
- $(PROJECT),, +
- $(ALLLIB), +
- $(DEFFILE), +
- $(ALLRES)
-!
-# ---------------------------------------------------------------------------
-.pas.hpp:
- $(BCB)\BIN\$(DCC32) $(PFLAGS) {$< }
-
-.pas.obj:
- $(BCB)\BIN\$(DCC32) $(PFLAGS) {$< }
-
-.cpp.obj:
- $(BCB)\BIN\$(BCC32) $(CFLAG1) -n$(@D) {$< }
-
-.c.obj:
- $(BCB)\BIN\$(BCC32) $(CFLAG1) -n$(@D) {$< }
-
-.c.i:
- $(BCB)\BIN\$(CPP32) $(CFLAG1) -n. {$< }
-
-.cpp.i:
- $(BCB)\BIN\$(CPP32) $(CFLAG1) -n. {$< }
-
-.asm.obj:
- $(BCB)\BIN\$(TASM32) $(AFLAGS) $<, $@
-
-.rc.res:
- $(BCB)\BIN\$(BRCC32) $(RFLAGS) -fo$@ $<
-# ---------------------------------------------------------------------------
diff --git a/PythonForDelphi/Components/Python_cb4.cpp b/PythonForDelphi/Components/Python_cb4.cpp
deleted file mode 100644
index d38ba51a..00000000
--- a/PythonForDelphi/Components/Python_cb4.cpp
+++ /dev/null
@@ -1,21 +0,0 @@
-//---------------------------------------------------------------------------
-#include
-#pragma hdrstop
-USERES("Python_cb4.res");
-USEPACKAGE("vcl40.bpi");
-USEUNIT("Sources\Core\PythonGUIInputOutput.pas");
-USEUNIT("Sources\Core\PythonEngine.pas");
-USERES("Sources\Core\PythonEngine.dcr");
-USEUNIT("Sources\Core\MethodCallBack.pas");
-USEUNIT("Sources\Core\AtomPythonEngine.pas");
-USEUNIT("Sources\Core\PythonAtom.pas");
-//---------------------------------------------------------------------------
-#pragma package(smart_init)
-//---------------------------------------------------------------------------
-// Package source.
-//---------------------------------------------------------------------------
-int WINAPI DllEntryPoint(HINSTANCE hinst, unsigned long reason, void*)
-{
- return 1;
-}
-//---------------------------------------------------------------------------
diff --git a/PythonForDelphi/Components/Python_cb4.dpk b/PythonForDelphi/Components/Python_cb4.dpk
deleted file mode 100644
index 3032f047..00000000
--- a/PythonForDelphi/Components/Python_cb4.dpk
+++ /dev/null
@@ -1,37 +0,0 @@
-package Python_cb4;
-
-{$R *.RES}
-{$R 'Sources\Core\PythonEngine.dcr'}
-{$ALIGN ON}
-{$ASSERTIONS ON}
-{$BOOLEVAL OFF}
-{$DEBUGINFO ON}
-{$EXTENDEDSYNTAX ON}
-{$IMPORTEDDATA ON}
-{$IOCHECKS ON}
-{$LOCALSYMBOLS ON}
-{$LONGSTRINGS ON}
-{$OPENSTRINGS ON}
-{$OPTIMIZATION ON}
-{$OVERFLOWCHECKS OFF}
-{$RANGECHECKS OFF}
-{$REFERENCEINFO ON}
-{$SAFEDIVIDE OFF}
-{$STACKFRAMES OFF}
-{$TYPEDADDRESS OFF}
-{$VARSTRINGCHECKS ON}
-{$WRITEABLECONST ON}
-{$MINENUMSIZE 1}
-{$IMAGEBASE $00400000}
-{$DESCRIPTION 'Components for Python'}
-{$IMPLICITBUILD OFF}
-
-requires
- vcl40;
-
-contains
- PythonEngine in 'Sources\Core\PythonEngine.pas',
- PythonGUIInputOutput in 'Sources\Core\PythonGUIInputOutput.pas',
- MethodCallback in 'Sources\Core\MethodCallBack.pas';
-
-end.
diff --git a/PythonForDelphi/Components/Python_cb4.lib b/PythonForDelphi/Components/Python_cb4.lib
deleted file mode 100644
index 0ba8c238..00000000
Binary files a/PythonForDelphi/Components/Python_cb4.lib and /dev/null differ
diff --git a/PythonForDelphi/Components/Python_cb4.res b/PythonForDelphi/Components/Python_cb4.res
deleted file mode 100644
index 37c47b0b..00000000
Binary files a/PythonForDelphi/Components/Python_cb4.res and /dev/null differ
diff --git a/PythonForDelphi/Components/Python_cb5.bpi b/PythonForDelphi/Components/Python_cb5.bpi
deleted file mode 100644
index 053a7eb3..00000000
Binary files a/PythonForDelphi/Components/Python_cb5.bpi and /dev/null differ
diff --git a/PythonForDelphi/Components/Python_cb5.bpk b/PythonForDelphi/Components/Python_cb5.bpk
deleted file mode 100644
index 97835fbe..00000000
--- a/PythonForDelphi/Components/Python_cb5.bpk
+++ /dev/null
@@ -1,117 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-[Version Info]
-IncludeVerInfo=1
-AutoIncBuild=0
-MajorVer=1
-MinorVer=0
-Release=0
-Build=0
-Debug=0
-PreRelease=0
-Special=0
-Private=0
-DLL=0
-Locale=1036
-CodePage=1252
-
-[Version Info Keys]
-CompanyName=
-FileDescription=
-FileVersion=1.0.0.0
-InternalName=
-LegalCopyright=
-LegalTrademarks=
-OriginalFilename=
-ProductName=
-ProductVersion=1.0.0.0
-Comments=
-
-[HistoryLists\hlIncludePath]
-Count=1
-Item0=Sources\Core;$(BCB)\include;$(BCB)\include\vcl
-
-[HistoryLists\hlLibraryPath]
-Count=2
-Item0=Sources\Core;$(BCB)\lib\obj;$(BCB)\lib
-Item1=..\..\borland\cbuilder4\lib\release;Sources\Core;$(BCB)\lib\obj;$(BCB)\lib
-
-[HistoryLists\hlDebugSourcePath]
-Count=1
-Item0=$(BCB)\source\vcl
-
-[HistoryLists\hIBPIOutputDir]
-Count=1
-Item0=.
-
-[Debugging]
-DebugSourceDirs=$(BCB)\source\vcl
-
-[Parameters]
-RunParams=
-HostApplication=
-RemoteHost=
-RemotePath=
-RemoteDebug=0
-
-[Compiler]
-ShowInfoMsgs=0
-LinkDebugVcl=0
-LinkCGLIB=0
-
-[CORBA]
-AddServerUnit=1
-AddClientUnit=1
-PrecompiledHeaders=1
-
-[Language]
-ActiveLang=
-ProjectLang=
-RootDir=
-
-
\ No newline at end of file
diff --git a/PythonForDelphi/Components/Python_cb5.cpp b/PythonForDelphi/Components/Python_cb5.cpp
deleted file mode 100644
index 3f50a4e3..00000000
--- a/PythonForDelphi/Components/Python_cb5.cpp
+++ /dev/null
@@ -1,19 +0,0 @@
-//---------------------------------------------------------------------------
-#include
-#pragma hdrstop
-USERES("Python_cb5.res");
-USEUNIT("Sources\Core\PythonGUIInputOutput.pas");
-USEUNIT("Sources\Core\PythonEngine.pas");
-USERES("Sources\Core\PythonEngine.dcr");
-USEUNIT("Sources\Core\MethodCallBack.pas");
-USEPACKAGE("vcl50.bpi");
-//---------------------------------------------------------------------------
-#pragma package(smart_init)
-//---------------------------------------------------------------------------
-// Package source.
-//---------------------------------------------------------------------------
-int WINAPI DllEntryPoint(HINSTANCE hinst, unsigned long reason, void*)
-{
- return 1;
-}
-//---------------------------------------------------------------------------
diff --git a/PythonForDelphi/Components/Python_cb5.lib b/PythonForDelphi/Components/Python_cb5.lib
deleted file mode 100644
index 047fcae8..00000000
Binary files a/PythonForDelphi/Components/Python_cb5.lib and /dev/null differ
diff --git a/PythonForDelphi/Components/Python_cb5.res b/PythonForDelphi/Components/Python_cb5.res
deleted file mode 100644
index 37c47b0b..00000000
Binary files a/PythonForDelphi/Components/Python_cb5.res and /dev/null differ
diff --git a/PythonForDelphi/Components/Python_d3.dpk b/PythonForDelphi/Components/Python_d3.dpk
deleted file mode 100644
index 3657c00d..00000000
--- a/PythonForDelphi/Components/Python_d3.dpk
+++ /dev/null
@@ -1,40 +0,0 @@
-package Python_d3;
-
-{$R *.RES}
-{$R 'PythonEngine.dcr'}
-{$ALIGN ON}
-{$ASSERTIONS ON}
-{$BOOLEVAL OFF}
-{$DEBUGINFO ON}
-{$EXTENDEDSYNTAX ON}
-{$IMPORTEDDATA ON}
-{$IOCHECKS ON}
-{$LOCALSYMBOLS ON}
-{$LONGSTRINGS ON}
-{$OPENSTRINGS ON}
-{$OPTIMIZATION ON}
-{$OVERFLOWCHECKS OFF}
-{$RANGECHECKS OFF}
-{$REFERENCEINFO OFF}
-{$SAFEDIVIDE OFF}
-{$STACKFRAMES OFF}
-{$TYPEDADDRESS OFF}
-{$VARSTRINGCHECKS ON}
-{$WRITEABLECONST ON}
-{$MINENUMSIZE 1}
-{$IMAGEBASE $00400000}
-{$DESCRIPTION 'Components for Python'}
-{$DESIGNONLY}
-{$IMPLICITBUILD ON}
-
-requires
- vcl30;
-
-contains
- PythonEngine,
- MethodCallback,
- PythonGUIInputOutput,
- AtomPythonEngine,
- PythonAtom;
-
-end.
diff --git a/PythonForDelphi/Components/Python_d3.res b/PythonForDelphi/Components/Python_d3.res
deleted file mode 100644
index acd36711..00000000
Binary files a/PythonForDelphi/Components/Python_d3.res and /dev/null differ
diff --git a/PythonForDelphi/Components/Python_d4.dof b/PythonForDelphi/Components/Python_d4.dof
deleted file mode 100644
index 8ed55064..00000000
--- a/PythonForDelphi/Components/Python_d4.dof
+++ /dev/null
@@ -1,78 +0,0 @@
-[Compiler]
-A=1
-B=0
-C=1
-D=1
-E=0
-F=0
-G=1
-H=1
-I=1
-J=1
-K=0
-L=1
-M=0
-N=1
-O=1
-P=1
-Q=0
-R=0
-S=0
-T=0
-U=0
-V=1
-W=0
-X=1
-Y=1
-Z=1
-ShowHints=1
-ShowWarnings=1
-UnitAliases=WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;
-[Linker]
-MapFile=0
-OutputObjs=0
-ConsoleApp=1
-DebugInfo=0
-RemoteSymbols=0
-MinStackSize=16384
-MaxStackSize=1048576
-ImageBase=4194304
-ExeDescription=Components for Python
-[Directories]
-OutputDir=
-UnitOutputDir=
-PackageDLLOutputDir=
-PackageDCPOutputDir=
-SearchPath=
-Packages=
-Conditionals=
-DebugSourceDirs=
-UsePackages=0
-[Parameters]
-RunParams=
-HostApplication=
-[Version Info]
-IncludeVerInfo=1
-AutoIncBuild=0
-MajorVer=1
-MinorVer=0
-Release=0
-Build=0
-Debug=0
-PreRelease=0
-Special=0
-Private=0
-DLL=0
-Locale=1033
-CodePage=1252
-[Version Info Keys]
-CompanyName=
-FileDescription=
-FileVersion=1.0.0.0
-InternalName=
-LegalCopyright=
-LegalTrademarks=
-OriginalFilename=
-ProductName=
-ProductVersion=1.0.0.0
-Comments=
diff --git a/PythonForDelphi/Components/Python_d4.dpk b/PythonForDelphi/Components/Python_d4.dpk
deleted file mode 100644
index 9f76d7d9..00000000
--- a/PythonForDelphi/Components/Python_d4.dpk
+++ /dev/null
@@ -1,39 +0,0 @@
-package Python_d4;
-
-{$R *.RES}
-{$R 'Sources\Core\PythonEngine.dcr'}
-{$ALIGN ON}
-{$ASSERTIONS ON}
-{$BOOLEVAL OFF}
-{$DEBUGINFO ON}
-{$EXTENDEDSYNTAX ON}
-{$IMPORTEDDATA ON}
-{$IOCHECKS ON}
-{$LOCALSYMBOLS ON}
-{$LONGSTRINGS ON}
-{$OPENSTRINGS ON}
-{$OPTIMIZATION ON}
-{$OVERFLOWCHECKS OFF}
-{$RANGECHECKS OFF}
-{$REFERENCEINFO ON}
-{$SAFEDIVIDE OFF}
-{$STACKFRAMES OFF}
-{$TYPEDADDRESS OFF}
-{$VARSTRINGCHECKS ON}
-{$WRITEABLECONST ON}
-{$MINENUMSIZE 1}
-{$IMAGEBASE $00400000}
-{$DESCRIPTION 'Components for Python'}
-{$IMPLICITBUILD OFF}
-
-requires
- vcl40;
-
-contains
- PythonEngine in 'Sources\Core\PythonEngine.pas',
- PythonGUIInputOutput in 'Sources\Core\PythonGUIInputOutput.pas',
- MethodCallback in 'Sources\Core\MethodCallBack.pas',
- AtomPythonEngine in 'Sources\Core\AtomPythonEngine.pas',
- PythonAtom in 'Sources\Core\PythonAtom.pas';
-
-end.
diff --git a/PythonForDelphi/Components/Python_d4.res b/PythonForDelphi/Components/Python_d4.res
deleted file mode 100644
index f001d42f..00000000
Binary files a/PythonForDelphi/Components/Python_d4.res and /dev/null differ
diff --git a/PythonForDelphi/Components/Python_d5.dof b/PythonForDelphi/Components/Python_d5.dof
deleted file mode 100644
index dca18cf5..00000000
--- a/PythonForDelphi/Components/Python_d5.dof
+++ /dev/null
@@ -1,85 +0,0 @@
-[Compiler]
-A=1
-B=0
-C=1
-D=1
-E=0
-F=0
-G=1
-H=1
-I=1
-J=1
-K=0
-L=1
-M=0
-N=1
-O=1
-P=1
-Q=0
-R=0
-S=0
-T=0
-U=0
-V=1
-W=0
-X=1
-Y=1
-Z=1
-ShowHints=1
-ShowWarnings=1
-UnitAliases=WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;
-[Linker]
-MapFile=0
-OutputObjs=0
-ConsoleApp=1
-DebugInfo=0
-RemoteSymbols=0
-MinStackSize=16384
-MaxStackSize=1048576
-ImageBase=4194304
-ExeDescription=Components for Python
-[Directories]
-OutputDir=
-UnitOutputDir=
-PackageDLLOutputDir=
-PackageDCPOutputDir=
-SearchPath=
-Packages=Vcl50;Vclx50;VclSmp50;Vcldb50;vclado50;ibevnt50;Vclbde50;vcldbx50;Qrpt50;TeeUI50;TeeDB50;Tee50;Dss50;TeeQR50;VCLIB50;Vclmid50;vclie50;Inetdb50;Inet50;NMFast50;webmid50;dclocx50;dclaxserver50;MyKardexComponents;MultiLinePalette
-Conditionals=
-DebugSourceDirs=
-UsePackages=0
-[Parameters]
-RunParams=
-HostApplication=
-[Version Info]
-IncludeVerInfo=1
-AutoIncBuild=0
-MajorVer=1
-MinorVer=0
-Release=0
-Build=0
-Debug=0
-PreRelease=0
-Special=0
-Private=0
-DLL=0
-Locale=1033
-CodePage=1252
-[Version Info Keys]
-CompanyName=
-FileDescription=
-FileVersion=1.0.0.0
-InternalName=
-LegalCopyright=
-LegalTrademarks=
-OriginalFilename=
-ProductName=
-ProductVersion=1.0.0.0
-Comments=
-[Excluded Packages]
-C:\WINNT\System32\ip50_d5.bpl=InfoPower 2000 for Delphi 5
-$(DELPHI)\Bin\dcltee50.bpl=TeeChart 5.0 Components
-$(DELPHI)\Bin\dcltqr50.bpl=TeeChart 5.0 for QuickReport Components Design Package
-$(DELPHI)\Bin\dcldss50.bpl=Borland Decision Cube Components
-$(DELPHI)\Bin\dclite50.bpl=Borland Integrated Translation Environment
-$(DELPHI)\Bin\dclOffice2k50.bpl=Microsoft Office 2000 Automation Components
diff --git a/PythonForDelphi/Components/Python_d5.dpk b/PythonForDelphi/Components/Python_d5.dpk
deleted file mode 100644
index d0d2eb64..00000000
--- a/PythonForDelphi/Components/Python_d5.dpk
+++ /dev/null
@@ -1,41 +0,0 @@
-package Python_d5;
-
-{$R *.RES}
-{$R 'Sources\Core\PythonEngine.dcr'}
-{$ALIGN ON}
-{$ASSERTIONS ON}
-{$BOOLEVAL OFF}
-{$DEBUGINFO ON}
-{$EXTENDEDSYNTAX ON}
-{$IMPORTEDDATA ON}
-{$IOCHECKS ON}
-{$LOCALSYMBOLS ON}
-{$LONGSTRINGS ON}
-{$OPENSTRINGS ON}
-{$OPTIMIZATION ON}
-{$OVERFLOWCHECKS OFF}
-{$RANGECHECKS OFF}
-{$REFERENCEINFO ON}
-{$SAFEDIVIDE OFF}
-{$STACKFRAMES OFF}
-{$TYPEDADDRESS OFF}
-{$VARSTRINGCHECKS ON}
-{$WRITEABLECONST ON}
-{$MINENUMSIZE 1}
-{$IMAGEBASE $400000}
-{$DESCRIPTION 'Components for Python'}
-{$IMPLICITBUILD OFF}
-
-requires
- vcl50;
-
-contains
- PythonEngine in 'Sources\Core\PythonEngine.pas',
- PythonGUIInputOutput in 'Sources\Core\PythonGUIInputOutput.pas',
- MethodCallback in 'Sources\Core\MethodCallBack.pas',
- WrapDelphi in 'Sources\Core\WrapDelphi.pas',
- AtomPythonEngine in 'Sources\Core\AtomPythonEngine.pas',
- PythonAtom in 'Sources\Core\PythonAtom.pas',
- TinyWideStrings in 'Sources\Core\TinyWideStrings.pas';
-
-end.
diff --git a/PythonForDelphi/Components/Python_d5.res b/PythonForDelphi/Components/Python_d5.res
deleted file mode 100644
index f001d42f..00000000
Binary files a/PythonForDelphi/Components/Python_d5.res and /dev/null differ
diff --git a/PythonForDelphi/Components/Python_d6.dof b/PythonForDelphi/Components/Python_d6.dof
deleted file mode 100644
index 670bffd4..00000000
--- a/PythonForDelphi/Components/Python_d6.dof
+++ /dev/null
@@ -1,94 +0,0 @@
-[FileVersion]
-Version=6.0
-[Compiler]
-A=8
-B=0
-C=1
-D=1
-E=0
-F=0
-G=1
-H=1
-I=1
-J=1
-K=0
-L=1
-M=0
-N=1
-O=1
-P=1
-Q=0
-R=0
-S=0
-T=0
-U=0
-V=1
-W=0
-X=1
-Y=1
-Z=1
-ShowHints=1
-ShowWarnings=1
-UnitAliases=WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;
-[Linker]
-MapFile=0
-OutputObjs=0
-ConsoleApp=1
-DebugInfo=0
-RemoteSymbols=0
-MinStackSize=16384
-MaxStackSize=1048576
-ImageBase=4194304
-ExeDescription=Components for Python
-[Directories]
-OutputDir=
-UnitOutputDir=
-PackageDLLOutputDir=
-PackageDCPOutputDir=
-SearchPath=
-Packages=Vcl50;Vclx50;VclSmp50;Vcldb50;vclado50;ibevnt50;Vclbde50;vcldbx50;Qrpt50;TeeUI50;TeeDB50;Tee50;Dss50;TeeQR50;VCLIB50;Vclmid50;vclie50;Inetdb50;Inet50;NMFast50;webmid50;dclocx50;dclaxserver50;MyKardexComponents;MultiLinePalette
-Conditionals=
-DebugSourceDirs=
-UsePackages=0
-[Parameters]
-RunParams=
-HostApplication=
-Launcher=
-UseLauncher=0
-DebugCWD=
-[Language]
-ActiveLang=
-ProjectLang=
-RootDir=
-[Version Info]
-IncludeVerInfo=1
-AutoIncBuild=0
-MajorVer=1
-MinorVer=0
-Release=0
-Build=0
-Debug=0
-PreRelease=0
-Special=0
-Private=0
-DLL=0
-Locale=1033
-CodePage=1252
-[Version Info Keys]
-CompanyName=
-FileDescription=
-FileVersion=1.0.0.0
-InternalName=
-LegalCopyright=
-LegalTrademarks=
-OriginalFilename=
-ProductName=
-ProductVersion=1.0.0.0
-Comments=
-[Excluded Packages]
-C:\WINNT\System32\ip50_d5.bpl=InfoPower 2000 for Delphi 5
-c:\program files\borland\delphi6\Bin\dcltee50.bpl=TeeChart 5.0 Components
-c:\program files\borland\delphi6\Bin\dcltqr50.bpl=TeeChart 5.0 for QuickReport Components Design Package
-c:\program files\borland\delphi6\Bin\dcldss50.bpl=Borland Decision Cube Components
-c:\program files\borland\delphi6\Bin\dclite50.bpl=Borland Integrated Translation Environment
-c:\program files\borland\delphi6\Bin\dclOffice2k50.bpl=Microsoft Office 2000 Automation Components
diff --git a/PythonForDelphi/Components/Python_d6.res b/PythonForDelphi/Components/Python_d6.res
deleted file mode 100644
index f001d42f..00000000
Binary files a/PythonForDelphi/Components/Python_d6.res and /dev/null differ
diff --git a/PythonForDelphi/Components/Python_kylix.conf b/PythonForDelphi/Components/Python_kylix.conf
deleted file mode 100644
index f8e16b1e..00000000
--- a/PythonForDelphi/Components/Python_kylix.conf
+++ /dev/null
@@ -1,33 +0,0 @@
--$A8
--$B-
--$C+
--$D+
--$E-
--$F-
--$G+
--$H+
--$I+
--$J-
--$K-
--$L+
--$M-
--$N+
--$O+
--$P+
--$Q-
--$R-
--$S-
--$T-
--$U-
--$V+
--$W-
--$X+
--$YD
--$Z1
--cg
--H+
--W+
--M
--$M16384,1048576
--K$00400000
--Z
diff --git a/PythonForDelphi/Components/Python_kylix.dpk b/PythonForDelphi/Components/Python_kylix.dpk
deleted file mode 100644
index acb0f2af..00000000
--- a/PythonForDelphi/Components/Python_kylix.dpk
+++ /dev/null
@@ -1,37 +0,0 @@
-package Python_kylix;
-
-{$R *.res}
-{$R 'Sources/Core/PythonEngine.dcr'}
-{$ALIGN 8}
-{$ASSERTIONS ON}
-{$BOOLEVAL OFF}
-{$DEBUGINFO ON}
-{$EXTENDEDSYNTAX ON}
-{$IMPORTEDDATA ON}
-{$IOCHECKS ON}
-{$LOCALSYMBOLS ON}
-{$LONGSTRINGS ON}
-{$OPENSTRINGS ON}
-{$OPTIMIZATION ON}
-{$OVERFLOWCHECKS OFF}
-{$RANGECHECKS OFF}
-{$REFERENCEINFO ON}
-{$SAFEDIVIDE OFF}
-{$STACKFRAMES OFF}
-{$TYPEDADDRESS OFF}
-{$VARSTRINGCHECKS ON}
-{$WRITEABLECONST OFF}
-{$MINENUMSIZE 1}
-{$IMAGEBASE $400000}
-{$IMPLICITBUILD OFF}
-
-requires
- baseclx,
- visualclx;
-
-contains
- MethodCallBack in 'Sources/Core/MethodCallBack.pas',
- PythonEngine in 'Sources/Core/PythonEngine.pas',
- PythonGUIInputOutput in 'Sources/Core/PythonGUIInputOutput.pas';
-
-end.
diff --git a/PythonForDelphi/Components/Python_kylix.res b/PythonForDelphi/Components/Python_kylix.res
deleted file mode 100644
index 36f26e23..00000000
Binary files a/PythonForDelphi/Components/Python_kylix.res and /dev/null differ
diff --git a/PythonForDelphi/Components/Sources/Core/Definition.Inc b/PythonForDelphi/Components/Sources/Core/Definition.Inc
index af7364be..c57287a7 100644
--- a/PythonForDelphi/Components/Sources/Core/Definition.Inc
+++ b/PythonForDelphi/Components/Sources/Core/Definition.Inc
@@ -1,4 +1,4 @@
-(**************************************************************************)
+(**************************************************************************)
(* *)
(* Module: 'Definition.Inc' Copyright (c) 1998 *)
(* *)
@@ -7,7 +7,7 @@
(* IBS Schillings GmbH & Co KG *)
(* Ein Unternehmen der KROHNE-Gruppe *)
(* Heisenbergstr. 18 *)
-(* 50169 Kerpen-Türnich *)
+(* 50169 Kerpen-Türnich *)
(* Phone: (49)22 37/97 44-0 *)
(* *)
(**************************************************************************)
@@ -26,17 +26,16 @@
// modify the default Python version below, in the Python versions section.
/////////////////////////////////////////////////////////////////////////////
-//{$DEFINE PYTHON23}
-//{$DEFINE PYTHON24}
//{$DEFINE PYTHON25}
//{$DEFINE PYTHON26}
//{$DEFINE PYTHON27}
-//{$DEFINE PYTHON30}
-//{$DEFINE PYTHON31}
//{$DEFINE PYTHON32}
//{$DEFINE PYTHON33}
//{$DEFINE PYTHON34}
//{$DEFINE PYTHON35}
+//{$DEFINE PYTHON36}
+//{$DEFINE PYTHON37}
+//{$DEFINE PYTHON38}
/////////////////////////////////////////////////////////////////////////////
// Python for Delphi settings. Comment out the setting you want to enable.
@@ -315,6 +314,100 @@
{$DEFINE DELPHIXE7_OR_HIGHER}
{$DEFINE DELPHIXE8_OR_HIGHER}
{$ENDIF}
+{$IFDEF VER300} // Delphi 10
+ {$DEFINE DELPHI10}
+ {$DEFINE DELPHI4_OR_HIGHER}
+ {$DEFINE DELPHI5_OR_HIGHER}
+ {$DEFINE DELPHI6_OR_HIGHER}
+ {$DEFINE DELPHI7_OR_HIGHER}
+ {$DEFINE DELPHI8_OR_HIGHER}
+ {$DEFINE DELPHI2005_OR_HIGHER}
+ {$DEFINE DELPHI2006_OR_HIGHER}
+ {$DEFINE DELPHI2007_OR_HIGHER}
+ {$DEFINE DELPHI2009_OR_HIGHER}
+ {$DEFINE DELPHI2010_OR_HIGHER}
+ {$DEFINE DELPHIXE_OR_HIGHER}
+ {$DEFINE DELPHIXE2_OR_HIGHER}
+ {$DEFINE DELPHIXE3_OR_HIGHER}
+ {$DEFINE DELPHIXE4_OR_HIGHER}
+ {$DEFINE DELPHIXE5_OR_HIGHER}
+ {$DEFINE DELPHIXE6_OR_HIGHER}
+ {$DEFINE DELPHIXE7_OR_HIGHER}
+ {$DEFINE DELPHIXE8_OR_HIGHER}
+ {$DEFINE DELPHIX10_OR_HIGHER}
+{$ENDIF}
+{$IFDEF VER310} // Delphi 10.1
+ {$DEFINE DELPHI10.1}
+ {$DEFINE DELPHI4_OR_HIGHER}
+ {$DEFINE DELPHI5_OR_HIGHER}
+ {$DEFINE DELPHI6_OR_HIGHER}
+ {$DEFINE DELPHI7_OR_HIGHER}
+ {$DEFINE DELPHI8_OR_HIGHER}
+ {$DEFINE DELPHI2005_OR_HIGHER}
+ {$DEFINE DELPHI2006_OR_HIGHER}
+ {$DEFINE DELPHI2007_OR_HIGHER}
+ {$DEFINE DELPHI2009_OR_HIGHER}
+ {$DEFINE DELPHI2010_OR_HIGHER}
+ {$DEFINE DELPHIXE_OR_HIGHER}
+ {$DEFINE DELPHIXE2_OR_HIGHER}
+ {$DEFINE DELPHIXE3_OR_HIGHER}
+ {$DEFINE DELPHIXE4_OR_HIGHER}
+ {$DEFINE DELPHIXE5_OR_HIGHER}
+ {$DEFINE DELPHIXE6_OR_HIGHER}
+ {$DEFINE DELPHIXE7_OR_HIGHER}
+ {$DEFINE DELPHIXE8_OR_HIGHER}
+ {$DEFINE DELPHI10_OR_HIGHER}
+ {$DEFINE DELPHI10.1_OR_HIGHER}
+{$ENDIF}
+{$IFDEF VER320} // Delphi 10.2
+ {$DEFINE DELPHI10.2}
+ {$DEFINE DELPHI4_OR_HIGHER}
+ {$DEFINE DELPHI5_OR_HIGHER}
+ {$DEFINE DELPHI6_OR_HIGHER}
+ {$DEFINE DELPHI7_OR_HIGHER}
+ {$DEFINE DELPHI8_OR_HIGHER}
+ {$DEFINE DELPHI2005_OR_HIGHER}
+ {$DEFINE DELPHI2006_OR_HIGHER}
+ {$DEFINE DELPHI2007_OR_HIGHER}
+ {$DEFINE DELPHI2009_OR_HIGHER}
+ {$DEFINE DELPHI2010_OR_HIGHER}
+ {$DEFINE DELPHIXE_OR_HIGHER}
+ {$DEFINE DELPHIXE2_OR_HIGHER}
+ {$DEFINE DELPHIXE3_OR_HIGHER}
+ {$DEFINE DELPHIXE4_OR_HIGHER}
+ {$DEFINE DELPHIXE5_OR_HIGHER}
+ {$DEFINE DELPHIXE6_OR_HIGHER}
+ {$DEFINE DELPHIXE7_OR_HIGHER}
+ {$DEFINE DELPHIXE8_OR_HIGHER}
+ {$DEFINE DELPHI10_OR_HIGHER}
+ {$DEFINE DELPHI10.1_OR_HIGHER}
+ {$DEFINE DELPHI10.2_OR_HIGHER}
+{$ENDIF}
+{$IFDEF VER330} // Delphi 10.3
+ {$DEFINE DELPHI10.3}
+ {$DEFINE DELPHI4_OR_HIGHER}
+ {$DEFINE DELPHI5_OR_HIGHER}
+ {$DEFINE DELPHI6_OR_HIGHER}
+ {$DEFINE DELPHI7_OR_HIGHER}
+ {$DEFINE DELPHI8_OR_HIGHER}
+ {$DEFINE DELPHI2005_OR_HIGHER}
+ {$DEFINE DELPHI2006_OR_HIGHER}
+ {$DEFINE DELPHI2007_OR_HIGHER}
+ {$DEFINE DELPHI2009_OR_HIGHER}
+ {$DEFINE DELPHI2010_OR_HIGHER}
+ {$DEFINE DELPHIXE_OR_HIGHER}
+ {$DEFINE DELPHIXE2_OR_HIGHER}
+ {$DEFINE DELPHIXE3_OR_HIGHER}
+ {$DEFINE DELPHIXE4_OR_HIGHER}
+ {$DEFINE DELPHIXE5_OR_HIGHER}
+ {$DEFINE DELPHIXE6_OR_HIGHER}
+ {$DEFINE DELPHIXE7_OR_HIGHER}
+ {$DEFINE DELPHIXE8_OR_HIGHER}
+ {$DEFINE DELPHI10_OR_HIGHER}
+ {$DEFINE DELPHI10.1_OR_HIGHER}
+ {$DEFINE DELPHI10.2_OR_HIGHER}
+ {$DEFINE DELPHI10.3_OR_HIGHER}
+{$ENDIF}
/////////////////////////////////////////////////////////////////////////////
// Python versions
/////////////////////////////////////////////////////////////////////////////
@@ -323,21 +416,19 @@
// Note that the installer will let the user specify its default Python version, and
// thus will edit this file.
-{$IFNDEF PYTHON35}
- {$IFNDEF PYTHON34}
- {$IFNDEF PYTHON33}
- {$IFNDEF PYTHON32}
- {$IFNDEF PYTHON31}
- {$IFNDEF PYTHON30}
- {$IFNDEF PYTHON27}
- {$IFNDEF PYTHON26}
- {$IFNDEF PYTHON25}
- {$IFNDEF PYTHON24}
- {$IFNDEF PYTHON23}
- {------}
- {$DEFINE PYTHON27}
- {------}
- {$ENDIF}
+{$IFNDEF PYTHON38}
+ {$IFNDEF PYTHON37}
+ {$IFNDEF PYTHON36}
+ {$IFNDEF PYTHON35}
+ {$IFNDEF PYTHON34}
+ {$IFNDEF PYTHON33}
+ {$IFNDEF PYTHON32}
+ {$IFNDEF PYTHON27}
+ {$IFNDEF PYTHON26}
+ {$IFNDEF PYTHON25}
+ {------}
+ {$DEFINE PYTHON27}
+ {------}
{$ENDIF}
{$ENDIF}
{$ENDIF}
@@ -349,75 +440,80 @@
{$ENDIF}
{$ENDIF}
-
-{$IFDEF PYTHON23}
- {$DEFINE PYTHON23_OR_HIGHER}
-{$ENDIF}
-{$IFDEF PYTHON24}
- {$DEFINE PYTHON23_OR_HIGHER}
- {$DEFINE PYTHON24_OR_HIGHER}
-{$ENDIF}
{$IFDEF PYTHON25}
- {$DEFINE PYTHON23_OR_HIGHER}
- {$DEFINE PYTHON24_OR_HIGHER}
{$DEFINE PYTHON25_OR_HIGHER}
{$ENDIF}
{$IFDEF PYTHON26}
- {$DEFINE PYTHON23_OR_HIGHER}
- {$DEFINE PYTHON24_OR_HIGHER}
{$DEFINE PYTHON25_OR_HIGHER}
{$DEFINE PYTHON26_OR_HIGHER}
{$ENDIF}
{$IFDEF PYTHON27}
- {$DEFINE PYTHON23_OR_HIGHER}
- {$DEFINE PYTHON24_OR_HIGHER}
{$DEFINE PYTHON25_OR_HIGHER}
+ {$DEFINE PYTHON26_OR_HIGHER}
+ {$DEFINE PYTHON27_OR_HIGHER}
+{$ENDIF}
+{$IFDEF PYTHON32}
+ {$DEFINE PYTHON25_OR_HIGHER}
+ {$DEFINE PYTHON26_OR_HIGHER}
{$DEFINE PYTHON27_OR_HIGHER}
+ {$DEFINE PYTHON32_OR_HIGHER}
{$ENDIF}
-{$IFDEF PYTHON30}
- {$DEFINE PYTHON23_OR_HIGHER}
- {$DEFINE PYTHON24_OR_HIGHER}
+{$IFDEF PYTHON33}
{$DEFINE PYTHON25_OR_HIGHER}
{$DEFINE PYTHON26_OR_HIGHER}
- {$DEFINE PYTHON30_OR_HIGHER}
+ {$DEFINE PYTHON27_OR_HIGHER}
+ {$DEFINE PYTHON32_OR_HIGHER}
+ {$DEFINE PYTHON33_OR_HIGHER}
{$ENDIF}
-{$IFDEF PYTHON31}
- {$DEFINE PYTHON23_OR_HIGHER}
- {$DEFINE PYTHON24_OR_HIGHER}
+{$IFDEF PYTHON34}
{$DEFINE PYTHON25_OR_HIGHER}
{$DEFINE PYTHON26_OR_HIGHER}
- {$DEFINE PYTHON30_OR_HIGHER}
- {$DEFINE PYTHON31_OR_HIGHER}
+ {$DEFINE PYTHON27_OR_HIGHER}
+ {$DEFINE PYTHON32_OR_HIGHER}
+ {$DEFINE PYTHON33_OR_HIGHER}
+ {$DEFINE PYTHON34_OR_HIGHER}
{$ENDIF}
-{$IFDEF PYTHON32}
- {$DEFINE PYTHON23_OR_HIGHER}
- {$DEFINE PYTHON24_OR_HIGHER}
+{$IFDEF PYTHON35}
+ {$DEFINE PYTHON25_OR_HIGHER}
+ {$DEFINE PYTHON26_OR_HIGHER}
+ {$DEFINE PYTHON27_OR_HIGHER}
+ {$DEFINE PYTHON32_OR_HIGHER}
+ {$DEFINE PYTHON33_OR_HIGHER}
+ {$DEFINE PYTHON34_OR_HIGHER}
+ {$DEFINE PYTHON35_OR_HIGHER}
+{$ENDIF}
+{$IFDEF PYTHON36}
{$DEFINE PYTHON25_OR_HIGHER}
{$DEFINE PYTHON26_OR_HIGHER}
- {$DEFINE PYTHON30_OR_HIGHER}
- {$DEFINE PYTHON31_OR_HIGHER}
+ {$DEFINE PYTHON27_OR_HIGHER}
{$DEFINE PYTHON32_OR_HIGHER}
+ {$DEFINE PYTHON33_OR_HIGHER}
+ {$DEFINE PYTHON34_OR_HIGHER}
+ {$DEFINE PYTHON35_OR_HIGHER}
+ {$DEFINE PYTHON36_OR_HIGHER}
{$ENDIF}
-{$IFDEF PYTHON33}
- {$DEFINE PYTHON23_OR_HIGHER}
- {$DEFINE PYTHON24_OR_HIGHER}
+{$IFDEF PYTHON37}
{$DEFINE PYTHON25_OR_HIGHER}
{$DEFINE PYTHON26_OR_HIGHER}
- {$DEFINE PYTHON30_OR_HIGHER}
- {$DEFINE PYTHON31_OR_HIGHER}
+ {$DEFINE PYTHON27_OR_HIGHER}
{$DEFINE PYTHON32_OR_HIGHER}
{$DEFINE PYTHON33_OR_HIGHER}
+ {$DEFINE PYTHON34_OR_HIGHER}
+ {$DEFINE PYTHON35_OR_HIGHER}
+ {$DEFINE PYTHON36_OR_HIGHER}
+ {$DEFINE PYTHON37_OR_HIGHER}
{$ENDIF}
-{$IFDEF PYTHON34}
- {$DEFINE PYTHON23_OR_HIGHER}
- {$DEFINE PYTHON24_OR_HIGHER}
+{$IFDEF PYTHON38}
{$DEFINE PYTHON25_OR_HIGHER}
{$DEFINE PYTHON26_OR_HIGHER}
- {$DEFINE PYTHON30_OR_HIGHER}
- {$DEFINE PYTHON31_OR_HIGHER}
+ {$DEFINE PYTHON27_OR_HIGHER}
{$DEFINE PYTHON32_OR_HIGHER}
{$DEFINE PYTHON33_OR_HIGHER}
{$DEFINE PYTHON34_OR_HIGHER}
+ {$DEFINE PYTHON35_OR_HIGHER}
+ {$DEFINE PYTHON36_OR_HIGHER}
+ {$DEFINE PYTHON37_OR_HIGHER}
+ {$DEFINE PYTHON38_OR_HIGHER}
{$ENDIF}
/////////////////////////////////////////////////////////////////////////////
@@ -445,4 +541,7 @@
{$ENDIF DARWIN}
{$ENDIF FPC}
+{$IFDEF DELPHIXE_OR_HIGHER}
+ {$DEFINE EXTENDED_RTTI}
+{$ENDIF DELPHIXE_OR_HIGHER}
diff --git a/PythonForDelphi/Components/Sources/Core/MethodCallBack.pas b/PythonForDelphi/Components/Sources/Core/MethodCallBack.pas
index 845252de..9e3ebfd0 100644
--- a/PythonForDelphi/Components/Sources/Core/MethodCallBack.pas
+++ b/PythonForDelphi/Components/Sources/Core/MethodCallBack.pas
@@ -181,8 +181,13 @@ procedure GetCodeMem(var ptr: PByte; size: integer);
{$ELSE}
//page := GetMem(PageSize);
page := mmap(Pointer($10000000), PageSize, PROT_NONE, MAP_PRIVATE or MAP_ANON, -1, 0);
+ if page=Pointer(-1) then //MMAP_FAILED result?
+ begin
+ ptr := nil;
+ exit;
+ end;
mprotect(page, PageSize, PROT_READ or PROT_WRITE or PROT_EXEC);
- {$ENDIF}
+ {$ENDIF}
page^.next:=CodeMemPages;
CodeMemPages:=page;
// init pointer to end of page
@@ -451,6 +456,7 @@ function GetCallBack( self: TObject; method: Pointer;
Inc(lCount,sizeof(c64jump));
GetCodeMem(Q,lCount);
+ if Q=nil then exit(nil);
P := Q;
lSize := 0;
diff --git a/PythonForDelphi/Components/Sources/Core/PythonEngine.pas b/PythonForDelphi/Components/Sources/Core/PythonEngine.pas
index 375a0419..cbc0dc30 100644
--- a/PythonForDelphi/Components/Sources/Core/PythonEngine.pas
+++ b/PythonForDelphi/Components/Sources/Core/PythonEngine.pas
@@ -31,7 +31,7 @@
(* Stefan Hoffmeister (Stefan.Hoffmeister@Econos.de) *)
(* Michiel du Toit (micdutoit@hsbfn.com) - Lazarus Port *)
(* Chris Nicolai (nicolaitanes@gmail.com) *)
-(* Kiriakos Vlahos (kvlahos@london.edu) *)
+(* Kiriakos Vlahos (pyscripter@gmail.com) *)
(* Andrey Gruzdev (andrey.gruzdev@gmail.com) *)
(**************************************************************************)
(* This source code is distributed with no WARRANTY, for no reason or use.*)
@@ -67,12 +67,17 @@
interface
uses
+ Types,
{$IFDEF MSWINDOWS}
Windows,
-{$ENDIF}
-{$IFDEF LINUX}
- Types,
+{$ELSE}
+{$IFDEF FPC}
dynlibs,
+{$ELSE}
+{$IFDEF LINUX}
+ Libc,
+{$ENDIF}
+{$ENDIF}
{$ENDIF}
Classes,
SysUtils,
@@ -116,8 +121,6 @@ interface
PNativeInt = ^NativeInt;
{$ENDIF}
-
-
TPythonVersionProp = packed record
DllName : String;
RegVersion : String;
@@ -126,65 +129,79 @@ interface
end;
const
{$IFDEF MSWINDOWS}
- PYTHON_KNOWN_VERSIONS: array[1..11] of TPythonVersionProp =
- ( (DllName: 'python23.dll'; RegVersion: '2.3'; APIVersion: 1012; CanUseLatest: True),
- (DllName: 'python24.dll'; RegVersion: '2.4'; APIVersion: 1012; CanUseLatest: True),
+ PYTHON_KNOWN_VERSIONS: array[1..10] of TPythonVersionProp =
+ (
(DllName: 'python25.dll'; RegVersion: '2.5'; APIVersion: 1013; CanUseLatest: True),
(DllName: 'python26.dll'; RegVersion: '2.6'; APIVersion: 1013; CanUseLatest: True),
(DllName: 'python27.dll'; RegVersion: '2.7'; APIVersion: 1013; CanUseLatest: True),
- (DllName: 'python30.dll'; RegVersion: '3.0'; APIVersion: 1013; CanUseLatest: True),
- (DllName: 'python31.dll'; RegVersion: '3.1'; APIVersion: 1013; CanUseLatest: True),
(DllName: 'python32.dll'; RegVersion: '3.2'; APIVersion: 1013; CanUseLatest: True),
(DllName: 'python33.dll'; RegVersion: '3.3'; APIVersion: 1013; CanUseLatest: True),
(DllName: 'python34.dll'; RegVersion: '3.4'; APIVersion: 1013; CanUseLatest: True),
- (DllName: 'python35.dll'; RegVersion: '3.5'; APIVersion: 1013; CanUseLatest: True) );
+ (DllName: 'python35.dll'; RegVersion: '3.5'; APIVersion: 1013; CanUseLatest: True),
+ (DllName: 'python36.dll'; RegVersion: '3.6'; APIVersion: 1013; CanUseLatest: True),
+ (DllName: 'python37.dll'; RegVersion: '3.7'; APIVersion: 1013; CanUseLatest: True),
+ (DllName: 'python38.dll'; RegVersion: '3.8'; APIVersion: 1013; CanUseLatest: True)
+ );
{$ENDIF}
{$IFDEF LINUX}
- PYTHON_KNOWN_VERSIONS: array[1..11] of TPythonVersionProp =
- ( (DllName: 'libpython2.3.so'; RegVersion: '2.3'; APIVersion: 1012; CanUseLatest: True),
- (DllName: 'libpython2.4.so'; RegVersion: '2.4'; APIVersion: 1012; CanUseLatest: True),
+ PYTHON_KNOWN_VERSIONS: array[1..10] of TPythonVersionProp =
+ (
(DllName: 'libpython2.5.so'; RegVersion: '2.5'; APIVersion: 1013; CanUseLatest: True),
(DllName: 'libpython2.6.so'; RegVersion: '2.6'; APIVersion: 1013; CanUseLatest: True),
(DllName: 'libpython2.7.so'; RegVersion: '2.7'; APIVersion: 1013; CanUseLatest: True),
- (DllName: 'libpython3.0.so'; RegVersion: '3.0'; APIVersion: 1013; CanUseLatest: True),
- (DllName: 'libpython3.1.so'; RegVersion: '3.1'; APIVersion: 1013; CanUseLatest: True),
(DllName: 'libpython3.2.so'; RegVersion: '3.2'; APIVersion: 1013; CanUseLatest: True),
(DllName: 'libpython3.3.so'; RegVersion: '3.3'; APIVersion: 1013; CanUseLatest: True),
(DllName: 'libpython3.4.so'; RegVersion: '3.4'; APIVersion: 1013; CanUseLatest: True),
- (DllName: 'libpython3.5.so'; RegVersion: '3.5'; APIVersion: 1013; CanUseLatest: True) );
+ (DllName: 'libpython3.5.so'; RegVersion: '3.5'; APIVersion: 1013; CanUseLatest: True),
+ (DllName: 'libpython3.6.so'; RegVersion: '3.6'; APIVersion: 1013; CanUseLatest: True)
+ (DllName: 'libpython3.7.so'; RegVersion: '3.7'; APIVersion: 1013; CanUseLatest: True)
+ (DllName: 'libpython3.8.so'; RegVersion: '3.8'; APIVersion: 1013; CanUseLatest: True)
+ );
{$ENDIF}
-{$IFDEF PYTHON23}
+{$IFDEF DARWIN}
+ PYTHON_KNOWN_VERSIONS: array[1..10] of TPythonVersionProp =
+ (
+ (DllName: 'libpython2.5.dylib'; RegVersion: '2.5'; APIVersion: 1013; CanUseLatest: True),
+ (DllName: 'libpython2.6.dylib'; RegVersion: '2.6'; APIVersion: 1013; CanUseLatest: True),
+ (DllName: 'libpython2.7.dylib'; RegVersion: '2.7'; APIVersion: 1013; CanUseLatest: True),
+ (DllName: 'libpython3.2.dylib'; RegVersion: '3.2'; APIVersion: 1013; CanUseLatest: True),
+ (DllName: 'libpython3.3.dylib'; RegVersion: '3.3'; APIVersion: 1013; CanUseLatest: True),
+ (DllName: 'libpython3.4.dylib'; RegVersion: '3.4'; APIVersion: 1013; CanUseLatest: True),
+ (DllName: 'libpython3.5.dylib'; RegVersion: '3.5'; APIVersion: 1013; CanUseLatest: True),
+ (DllName: 'libpython3.6.dylib'; RegVersion: '3.6'; APIVersion: 1013; CanUseLatest: True),
+ (DllName: 'libpython3.7.dylib'; RegVersion: '3.7'; APIVersion: 1013; CanUseLatest: True),
+ (DllName: 'libpython3.8.dylib'; RegVersion: '3.8'; APIVersion: 1013; CanUseLatest: True)
+ );
+{$endif}
+{$IFDEF PYTHON25}
COMPILED_FOR_PYTHON_VERSION_INDEX = 1;
{$ENDIF}
-{$IFDEF PYTHON24}
+{$IFDEF PYTHON26}
COMPILED_FOR_PYTHON_VERSION_INDEX = 2;
{$ENDIF}
-{$IFDEF PYTHON25}
+{$IFDEF PYTHON27}
COMPILED_FOR_PYTHON_VERSION_INDEX = 3;
{$ENDIF}
-{$IFDEF PYTHON26}
+{$IFDEF PYTHON32}
COMPILED_FOR_PYTHON_VERSION_INDEX = 4;
{$ENDIF}
-{$IFDEF PYTHON27}
+{$IFDEF PYTHON33}
COMPILED_FOR_PYTHON_VERSION_INDEX = 5;
{$ENDIF}
-{$IFDEF PYTHON30}
+{$IFDEF PYTHON34}
COMPILED_FOR_PYTHON_VERSION_INDEX = 6;
{$ENDIF}
-{$IFDEF PYTHON31}
+{$IFDEF PYTHON35}
COMPILED_FOR_PYTHON_VERSION_INDEX = 7;
{$ENDIF}
-{$IFDEF PYTHON32}
+{$IFDEF PYTHON36}
COMPILED_FOR_PYTHON_VERSION_INDEX = 8;
{$ENDIF}
-{$IFDEF PYTHON33}
+{$IFDEF PYTHON37}
COMPILED_FOR_PYTHON_VERSION_INDEX = 9;
{$ENDIF}
-{$IFDEF PYTHON34}
+{$IFDEF PYTHON38}
COMPILED_FOR_PYTHON_VERSION_INDEX = 10;
-{$ENDIF}
-{$IFDEF PYTHON35}
- COMPILED_FOR_PYTHON_VERSION_INDEX = 11;
{$ENDIF}
PYT_METHOD_BUFFER_INCREASE = 10;
PYT_MEMBER_BUFFER_INCREASE = 10;
@@ -481,8 +498,6 @@ interface
getattrofunc = function( ob1,ob2: PPyObject): PPyObject; cdecl;
setattrofunc = function( ob1,ob2,ob3: PPyObject): integer; cdecl;
-/// jah 29-sep-2000 : updated for python 2.0
-/// added from object.h
getreadbufferproc = function ( ob1: PPyObject; i: NativeInt; ptr: Pointer): NativeInt; cdecl;
getwritebufferproc= function ( ob1: PPyObject; i: NativeInt; ptr: Pointer): NativeInt; cdecl;
getsegcountproc = function ( ob1: PPyObject; i: NativeInt): NativeInt; cdecl;
@@ -525,8 +540,7 @@ interface
nb_oct : unaryfunc;
nb_hex : unaryfunc;
-/// jah 29-sep-2000 : updated for python 2.0
-/// added from .h
+ // Updated for python 2.0
nb_inplace_add : binaryfunc;
nb_inplace_subtract : binaryfunc;
nb_inplace_multiply : binaryfunc;
@@ -556,9 +570,6 @@ interface
sq_slice : ssizessizeargfunc;
sq_ass_item : ssizeobjargproc;
sq_ass_slice : ssizessizeobjargproc;
-
-/// jah 29-sep-2000 : updated for python 2.0
-/// added from .h
sq_contains : objobjproc;
sq_inplace_concat : binaryfunc;
sq_inplace_repeat : ssizeargfunc;
@@ -572,8 +583,6 @@ interface
end;
PPyMappingMethods = ^PyMappingMethods;
-/// jah 29-sep-2000 : updated for python 2.0
-/// added from .h
PyBufferProcs = {$IFNDEF CPUX64}packed{$ENDIF} record
bf_getreadbuffer : getreadbufferproc;
bf_getwritebuffer : getwritebufferproc;
@@ -760,10 +769,10 @@ interface
// Methods to implement standard operations
tp_dealloc: pydestructor;
- tp_print: printfunc;
+ tp_print: printfunc; // not available and replaced in Python 3.x
tp_getattr: getattrfunc;
tp_setattr: setattrfunc;
- tp_compare: cmpfunc;
+ tp_compare: cmpfunc; // not available and replaced in Python 3.x
tp_repr: reprfunc;
// Method suites for standard classes
@@ -780,8 +789,6 @@ interface
tp_getattro: getattrofunc;
tp_setattro: setattrofunc;
-/// jah 29-sep-2000 : updated for python 2.0
-
// Functions to access object as input/output buffer
tp_as_buffer: PPyBufferProcs;
// Flags to define presence of optional/expanded features
@@ -823,9 +830,20 @@ interface
tp_cache : PPyObject;
tp_subclasses : PPyObject;
tp_weaklist : PPyObject;
+ tp_del : PyDestructor;
+ tp_version_tag : NativeUInt; // Type attribute cache version tag. Added in version 2.6
+ tp_finalize : PyDestructor;
//More spares
+ tp_xxx1 : NativeInt;
+ tp_xxx2 : NativeInt;
+ tp_xxx3 : NativeInt;
+ tp_xxx4 : NativeInt;
+ tp_xxx5 : NativeInt;
+ tp_xxx6 : NativeInt;
tp_xxx7 : NativeInt;
- tp_xxx8 : LongInt;
+ tp_xxx8 : NativeInt;
+ tp_xxx9 : NativeInt;
+ tp_xxx10 : NativeInt;
end;
PPyMethodChain = ^PyMethodChain;
@@ -910,42 +928,78 @@ interface
next : PPyInterpreterState;
tstate_head : PPyThreadState;
- modules : PPyObject;
- sysdict : PPyObject;
- builtins : PPyObject;
+// The strucure has changed between versions beyond this point.
+// Not safe to use members
+// modules : PPyObject;
+// sysdict : PPyObject;
+// builtins : PPyObject;
- checkinterval : integer;
+ //Spares
+ is_xxx1 : NativeInt;
+ is_xxx2 : NativeInt;
+ is_xxx3 : NativeInt;
+ is_xxx4 : NativeInt;
+ is_xxx5 : NativeInt;
+ is_xxx6 : NativeInt;
+ is_xxx7 : NativeInt;
+ is_xxx8 : NativeInt;
+ is_xxx9 : NativeInt;
end;
// Thread specific information
PyThreadState = {$IFNDEF CPUX64}packed{$ENDIF} record
+ {prev : PPyThreadState; introduced in python 3.4}
next : PPyThreadState;
interp : PPyInterpreterState;
+ interp34 : PPyInterpreterState;
- frame : PPyFrameObject;
- recursion_depth: integer;
- ticker : integer;
- tracing : integer;
-
- sys_profilefn : Pointer; // c-functions for profile/trace
- sys_tracefn : Pointer;
- sys_profilefunc: PPyObject;
- sys_tracefunc : PPyObject;
-
- curexc_type : PPyObject;
- curexc_value : PPyObject;
- curexc_traceback: PPyObject;
-
- exc_type : PPyObject;
- exc_value : PPyObject;
- exc_traceback : PPyObject;
-
- dict : PPyObject;
- tick_counter :Integer;
- gilstate_counter :Integer;
-
- async_exc :PPyObject; { Asynchronous exception to raise }
- thread_id :LongInt; { Thread id where this tstate was created }
+// The strucure has changed between versions beyond this point.
+// Not safe to use members
+//
+// frame : PPyFrameObject;
+// recursion_depth: integer;
+// ticker : integer;
+// tracing : integer;
+//
+// sys_profilefn : Pointer; // c-functions for profile/trace
+// sys_tracefn : Pointer;
+// sys_profilefunc: PPyObject;
+// sys_tracefunc : PPyObject;
+//
+// curexc_type : PPyObject;
+// curexc_value : PPyObject;
+// curexc_traceback: PPyObject;
+//
+// exc_type : PPyObject;
+// exc_value : PPyObject;
+// exc_traceback : PPyObject;
+//
+// dict : PPyObject;
+// tick_counter :Integer;
+// gilstate_counter :Integer;
+//
+// async_exc :PPyObject; { Asynchronous exception to raise }
+// thread_id :LongInt; { Thread id where this tstate was created }
+ //Spares
+ ts_xxx1 : NativeInt;
+ ts_xxx2 : NativeInt;
+ ts_xxx3 : NativeInt;
+ ts_xxx4 : NativeInt;
+ ts_xxx5 : NativeInt;
+ ts_xxx6 : NativeInt;
+ ts_xxx7 : NativeInt;
+ ts_xxx8 : NativeInt;
+ ts_xxx9 : NativeInt;
+ ts_xxx10 : NativeInt;
+ ts_xxx11 : NativeInt;
+ ts_xxx12 : NativeInt;
+ ts_xxx13 : NativeInt;
+ ts_xxx14 : NativeInt;
+ ts_xxx15 : NativeInt;
+ ts_xxx16 : NativeInt;
+ ts_xxx17 : NativeInt;
+ ts_xxx18 : NativeInt;
+ ts_xxx19 : NativeInt;
{ XXX signal handlers should also be here }
end;
@@ -1011,6 +1065,11 @@ interface
n_child : PNode;
end;
+ PPyCompilerFlags = ^PyCompilerFlags;
+ PyCompilerFlags = {$IFNDEF CPUX64}packed{$ENDIF} record
+ flags : integer;
+ end;
+
// From weakrefobject.h
PPyWeakReference = ^PyWeakReference;
@@ -1228,9 +1287,6 @@ EPyExecError = class(EPythonError);
// Standard exception classes of Python
-/// jah 29-sep-2000 : updated for python 2.0
-/// base classes updated according python documentation
-
{ Hierarchy of Python exceptions, Python 2.3, copied from \Python\exceptions.c
Exception\n\
@@ -1702,13 +1758,14 @@ TPythonInterface=class(TDynamicDll)
PyDict_GetItemString: function( dp: PPyObject; key: PAnsiChar): PPyObject; cdecl;
PyDict_SetItemString: function( dp: PPyObject; key: PAnsiChar; item: PPyObject):
Integer; cdecl;
- PyDictProxy_New: function (obj : PPyObject) : PPyObject; cdecl;
+ PyDictProxy_New: function (obj : PPyObject) : PPyObject; cdecl;
PyModule_GetDict: function( module:PPyObject): PPyObject; cdecl;
PyObject_Str: function( v: PPyObject): PPyObject; cdecl;
PyRun_String: function( str: PAnsiChar; start: Integer; globals: PPyObject;
locals: PPyObject): PPyObject; cdecl;
PyRun_SimpleString: function( str: PAnsiChar): Integer; cdecl;
PyString_AsString: function( ob: PPyObject): PAnsiChar; cdecl;
+ PyString_AsStringAndSize: function( ob: PPyObject; var buffer: PAnsiChar; var size: NativeInt): integer; cdecl;
PySys_SetArgv: procedure( argc: Integer; argv: PPAnsiChar); cdecl;
PySys_SetArgv3000: procedure( argc: Integer; argv: PPWideChar); cdecl;
@@ -1809,7 +1866,6 @@ TPythonInterface=class(TDynamicDll)
PyOS_InterruptOccurred:function :integer; cdecl;
PyObject_CallObject:function (ob,args:PPyObject):PPyObject; cdecl;
PyObject_CallMethod : function ( obj : PPyObject; method, format : PAnsiChar {...}) : PPyObject; cdecl varargs;
- PyObject_CallMethodStr: function ( obj : PPyObject; method, format, value : PAnsiChar ) : PPyObject; cdecl;
PyObject_Compare: function (ob1,ob2:PPyObject):integer; cdecl;
PyObject_RichCompare:function (ob1,ob2:PPyObject;opid:integer):PPyObject; cdecl;
PyObject_RichCompareBool:function (ob1,ob2:PPyObject;opid:integer):Integer; cdecl;
@@ -1891,6 +1947,7 @@ TPythonInterface=class(TDynamicDll)
PyUnicode_Decode:function (const s:PAnsiChar; size: NativeInt; const encoding : PAnsiChar; const errors: PAnsiChar):PPyObject; cdecl;
PyUnicode_AsEncodedString:function (unicode:PPyObject; const encoding:PAnsiChar; const errors:PAnsiChar):PPyObject; cdecl;
PyUnicode_FromOrdinal:function (ordinal:integer):PPyObject; cdecl;
+ PyUnicode_GetSize:function (unicode:PPyObject):NativeInt; cdecl;
PyWeakref_GetObject: function ( ref : PPyObject) : PPyObject; cdecl;
PyWeakref_NewProxy: function ( ob, callback : PPyObject) : PPyObject; cdecl;
PyWeakref_NewRef: function ( ob, callback : PPyObject) : PPyObject; cdecl;
@@ -1899,7 +1956,8 @@ TPythonInterface=class(TDynamicDll)
PyThreadState_SetAsyncExc: function(t_id :LongInt; exc :PPyObject) : Integer; cdecl;
Py_AtExit:function (proc: AtExitProc):integer; cdecl;
//Py_Cleanup:procedure; cdecl;
- Py_CompileString:function (s1,s2:PAnsiChar;i:integer):PPyObject; cdecl;
+ Py_CompileStringFlags:function (s1,s2:PAnsiChar;i:integer;flags:PPyCompilerFlags):PPyObject; cdecl;
+ Py_CompileStringExFlags:function (s1,s2:PAnsiChar;i:integer;flags:PPyCompilerFlags;optimize:integer):PPyObject; cdecl;
Py_FatalError:procedure(s:PAnsiChar); cdecl;
Py_FindMethod:function (md:PPyMethodDef;ob:PPyObject;key:PAnsiChar):PPyObject; cdecl;
Py_FindMethodInChain:function (mc:PPyMethodChain;ob:PPyObject;key:PAnsiChar):PPyObject; cdecl;
@@ -1913,13 +1971,16 @@ TPythonInterface=class(TDynamicDll)
Py_GetCopyright : function : PAnsiChar; cdecl;
Py_GetExecPrefix : function : PAnsiChar; cdecl;
Py_GetPath : function : PAnsiChar; cdecl;
+ Py_SetPythonHome : procedure (home : PAnsiChar); cdecl;
+ Py_GetPythonHome : function : PAnsiChar; cdecl;
+ Py_SetPythonHome3000 : procedure (home : PWideChar); cdecl;
+ Py_GetPythonHome3000 : function : PWideChar; cdecl;
Py_GetPrefix : function : PAnsiChar; cdecl;
Py_GetProgramName : function : PAnsiChar; cdecl;
- PyParser_SimpleParseString : function ( str : PAnsiChar; start : Integer) : PNode; cdecl;
+ PyParser_SimpleParseStringFlags : function ( str : PAnsiChar; start, flags : Integer) : PNode; cdecl;
PyNode_Free : procedure( n : PNode ); cdecl;
PyErr_NewException : function ( name : PAnsiChar; base, dict : PPyObject ) : PPyObject; cdecl;
- Py_Malloc : function ( size : NativeInt ) : Pointer;
PyMem_Malloc : function ( size : NativeInt ) : Pointer;
{New exported Objects in Python 1.5}
@@ -2007,13 +2068,16 @@ TPythonInterface=class(TDynamicDll)
_Py_c_quot: Pointer;
_Py_c_sum: Pointer;
}
+ // Not exported in Python 3.8 and implemented as functions
+ function PyParser_SimpleParseString( str : PAnsiChar; start : Integer) : PNode; cdecl;
+ function Py_CompileString( s1,s2:PAnsiChar;i:integer) : PPyObject; cdecl;
+
// functions redefined in Delphi
procedure Py_INCREF ( op: PPyObject);
procedure Py_DECREF ( op: PPyObject);
procedure Py_XINCREF ( op: PPyObject);
procedure Py_XDECREF ( op: PPyObject);
- function Py_GetPlatform: PAnsiChar; cdecl;
function PyCode_Addr2Line( co: PPyCodeObject; addrq : Integer ) : Integer; cdecl;
function Py_GetBuildInfo: PAnsiChar; cdecl;
function PyImport_ExecCodeModule( const AName : AnsiString; codeobject : PPyObject) : PPyObject;
@@ -2054,7 +2118,6 @@ TPythonInterface=class(TDynamicDll)
function Py_InitModule( const AName : PAnsiChar; md : PPyMethodDef) : PPyObject;
function Py_InitModule3000( const md : PyModuleDef) : PPyObject;
function PyString_FromString( str: PAnsiChar): PPyObject; virtual; abstract;
- function PyString_AsDelphiString( ob: PPyObject): string; virtual; abstract;
procedure Py_FlushLine; cdecl;
// Constructors & Destructors
@@ -2123,6 +2186,7 @@ TPythonTraceback = class
{$IFEND}
TPythonEngine = class(TPythonInterface)
private
+ FVenvPythonExe: string;
FInitScript: TStrings;
FIO: TPythonInputOutput;
FRedirectIO: Boolean;
@@ -2133,6 +2197,8 @@ TPythonEngine = class(TPythonInterface)
FAutoFinalize: Boolean;
FProgramName: AnsiString;
FProgramNameW: UnicodeString;
+ FPythonHome: AnsiString;
+ FPythonHomeW: UnicodeString;
FInitThreads: Boolean;
FOnPathInitialization: TPathInitializationEvent;
FOnSysPathInit: TSysPathInitEvent;
@@ -2152,8 +2218,6 @@ TPythonEngine = class(TPythonInterface)
FPyDateTime_TZInfoType: PPyObject;
FPyDateTime_TimeTZType: PPyObject;
FPyDateTime_DateTimeTZType: PPyObject;
- function GetVersion: String;
- procedure SetVersion(const Value: String);
protected
procedure AfterLoad; override;
@@ -2186,12 +2250,15 @@ TPythonEngine = class(TPythonInterface)
procedure Finalize;
procedure Lock;
procedure Unlock;
+ procedure SetPythonHome(const PythonHome: string);
+ procedure SetProgramName(const ProgramName: string);
function IsType(ob: PPyObject; obt: PPyTypeObject): Boolean;
function GetAttrString(obj: PPyObject; AName: PAnsiChar):PAnsiChar;
- function CleanString(const s : AnsiString) : AnsiString;
function Run_CommandAsString(const command : AnsiString; mode : Integer) : String;
function Run_CommandAsObject(const command : AnsiString; mode : Integer) : PPyObject;
function Run_CommandAsObjectWithDict(const command : AnsiString; mode : Integer; locals, globals : PPyObject) : PPyObject;
+ function EncodeString (const str: string): AnsiString;
+ function EncodeWindowsFilePath (const str: string): AnsiString;
procedure ExecString(const command : AnsiString); overload;
procedure ExecStrings( strings : TStrings ); overload;
function EvalString(const command : AnsiString) : PPyObject; overload;
@@ -2252,7 +2319,8 @@ TPythonEngine = class(TPythonInterface)
function PyTZInfo_CheckExact( obj : PPyObject ) : Boolean;
{ end date/time functions }
function PyString_FromString( str: PAnsiChar): PPyObject; override;
- function PyString_AsDelphiString( ob: PPyObject): string; override;
+ function PyString_FromDelphiString(str : string): PPyObject;
+ function PyString_AsDelphiString( ob: PPyObject): string;
function PyString_AsAnsiString( ob: PPyObject): AnsiString;
function PyString_AsWideString( ob: PPyObject): UnicodeString;
@@ -2268,6 +2336,7 @@ TPythonEngine = class(TPythonInterface)
property IOPythonModule: TObject read FIOPythonModule; {TPythonModule}
published
property AutoFinalize: Boolean read FAutoFinalize write FAutoFinalize default True;
+ property VenvPythonExe: string read FVenvPythonExe write FVenvPythonExe;
property DatetimeConversionMode: TDatetimeConversionMode read FDatetimeConversionMode write FDatetimeConversionMode default DEFAULT_DATETIME_CONVERSION_MODE;
property InitScript: TStrings read FInitScript write SetInitScript;
property InitThreads: Boolean read FInitThreads write SetInitThreads default False;
@@ -2275,7 +2344,6 @@ TPythonEngine = class(TPythonInterface)
property PyFlags: TPythonFlags read FPyFlags write SetPyFlags default [];
property RedirectIO: Boolean read FRedirectIO write FRedirectIO default True;
property UseWindowsConsole: Boolean read FUseWindowsConsole write FUseWindowsConsole default False;
- property Version : String read GetVersion write SetVersion stored False;
property OnAfterInit: TNotifyEvent read FOnAfterInit write FOnAfterInit;
property OnPathInitialization: TPathInitializationEvent read FOnPathInitialization write FOnPathInitialization;
property OnSysPathInit: TSysPathInitEvent read FOnSysPathInit write FOnSysPathInit;
@@ -2623,6 +2691,7 @@ TPythonModule = class(TMethodsContainer)
procedure SetVar( const varName : AnsiString; value : PPyObject );
function GetVar( const varName : AnsiString ) : PPyObject;
procedure DeleteVar( const varName : AnsiString );
+ procedure ClearVars;
procedure SetVarFromVariant( const varName : AnsiString; const value : Variant );
function GetVarAsVariant( const varName: AnsiString ) : Variant;
@@ -3029,9 +3098,8 @@ TPyVar = class(TPyObject)
{$HINTS OFF}
TPythonThread = class(TThread)
private
- f_savethreadstate: PPyThreadState;
- fInterpreterState: PPyInterpreterState;
fThreadState: PPyThreadState;
+ f_savethreadstate: PPyThreadState;
fThreadExecMode: TThreadExecMode;
// Do not overwrite Execute! Use ExecuteWithPython instead!
@@ -3047,12 +3115,8 @@ TPythonThread = class(TThread)
procedure Py_Begin_Unblock_Threads;
public
- property InterpreterState: PPyInterpreterState read fInterpreterState
- write fInterpreterState
- default nil;
- property ThreadState: PPyThreadState read fThreadState
- write fThreadState;
- property ThreadExecMode: TThreadExecMode read fThreadExecMode;
+ property ThreadState : PPyThreadState read fThreadState;
+ property ThreadExecMode: TThreadExecMode read fThreadExecMode write fThreadExecMode;
end;
{$HINTS ON}
@@ -3090,6 +3154,7 @@ procedure PyObjectDestructor( pSelf : PPyObject); cdecl;
procedure FreeSubtypeInst(ob:PPyObject); cdecl;
procedure Register;
function PyType_HasFeature(AType : PPyTypeObject; AFlag : Integer) : Boolean;
+function GetPythonVersionFromDLLName(const DLLFileName : String): String;
{ Helper functions}
(*
@@ -3106,6 +3171,13 @@ function IsPythonVersionRegistered(PythonVersion : string;
*)
procedure MaskFPUExceptions(ExceptionsMasked : boolean;
MatchPythonPrecision : Boolean = True);
+(*
+ Converts line breaks to LF and optionally adds a line break at the end
+*)
+function CleanString(const s : AnsiString; AppendLF : Boolean = True) : AnsiString; overload;
+{$ifndef FPC}
+function CleanString(const s : string; AppendLF : Boolean = True) : string; overload;
+{$ENDIF}
//#######################################################
//## ##
@@ -3116,8 +3188,15 @@ procedure MaskFPUExceptions(ExceptionsMasked : boolean;
implementation
+uses
+{$IFDEF FPC}
+ StrUtils,
+{$ELSE}
+ AnsiStrings,
+{$ENDIF}
{$IFDEF MSWINDOWS}
-uses Registry;
+ Math,
+ Registry;
{$ENDIF}
@@ -3450,10 +3529,13 @@ procedure TDynamicDll.Quit;
{$IFDEF MSWINDOWS}
MessageBox( GetActiveWindow, PChar(GetQuitMessage), 'Error', MB_TASKMODAL or MB_ICONSTOP );
ExitProcess( 1 );
-{$ENDIF}
-{$IFDEF LINUX}
+{$ELSE}
WriteLn(ErrOutput, GetQuitMessage);
+{$IFDEF FPC}
Halt( 1 );
+{$ELSE}
+ __exit(1);
+{$ENDIF}
{$ENDIF}
end;
end;
@@ -3500,9 +3582,9 @@ constructor TPythonInterface.Create(AOwner: TComponent);
procedure TPythonInterface.AfterLoad;
begin
inherited;
- FIsPython3000 := Pos('PYTHON3', UpperCase(DLLName)) = 1;
+ FIsPython3000 := Pos('PYTHON3', UpperCase(DLLName)) > 0;
FMajorVersion := StrToInt(DLLName[7 {$IFDEF LINUX}+3{$ENDIF}]);
- FMinorVersion := StrToInt(DLLName[8{$IFDEF LINUX}+3{$ENDIF}]);
+ FMinorVersion := StrToInt(DLLName[8{$IFDEF LINUX}+4{$ENDIF}]);
if FIsPython3000 then
@@ -3517,8 +3599,7 @@ procedure TPythonInterface.AfterLoad;
if FatalMsgDlg then
{$IFDEF MSWINDOWS}
MessageBox( GetActiveWindow, PChar(E.Message), 'Error', MB_TASKMODAL or MB_ICONSTOP );
-{$ENDIF}
-{$IFDEF LINUX}
+{$ELSE}
WriteLn( ErrOutput, E.Message );
{$ENDIF}
if FatalAbort then Quit;
@@ -3550,21 +3631,31 @@ function TPythonInterface.GetUnicodeTypeSuffix : String;
if (fMajorVersion > 3) or ((fMajorVersion = 3) and (fMinorVersion >= 3)) then
Result := ''
else if APIVersion >= 1011 then
- Result := 'UCS2'
+ Result :=
+ {$IF DEFINED(MSWINDOWS) or DEFINED(DARWIN) or DEFINED(SOLARIS)}
+ 'UCS2'
+ {$ELSE}
+ 'UCS4'
+ {$ENDIF}
else
Result := '';
end;
procedure TPythonInterface.MapDll;
+Var
+ UnicodeSuffix : string;
+
begin
+ UnicodeSuffix := GetUnicodeTypeSuffix;
+
Py_DebugFlag := Import('Py_DebugFlag');
Py_VerboseFlag := Import('Py_VerboseFlag');
Py_InteractiveFlag := Import('Py_InteractiveFlag');
Py_OptimizeFlag := Import('Py_OptimizeFlag');
Py_NoSiteFlag := Import('Py_NoSiteFlag');
- Py_UseClassExceptionsFlag := Import('Py_UseClassExceptionsFlag');
Py_FrozenFlag := Import('Py_FrozenFlag');
if not IsPython3000 then begin
+ Py_UseClassExceptionsFlag := Import('Py_UseClassExceptionsFlag');
Py_TabcheckFlag := Import('Py_TabcheckFlag');
Py_UnicodeFlag := Import('Py_UnicodeFlag');
end;
@@ -3754,10 +3845,13 @@ procedure TPythonInterface.MapDll;
PyRun_String := Import('PyRun_String');
PyRun_SimpleString := Import('PyRun_SimpleString');
PyDict_GetItemString := Import('PyDict_GetItemString');
- if not IsPython3000 then
- PyString_AsString := Import('PyString_AsString')
- else
+ if not IsPython3000 then begin
+ PyString_AsString := Import('PyString_AsString');
+ PyString_AsStringAndSize := Import('PyString_AsStringAndSize')
+ end else begin
PyString_AsString := Import('PyBytes_AsString');
+ PyString_AsStringAndSize := Import('PyBytes_AsStringAndSize');
+ end;
if not IsPython3000 then
DLL_PyString_FromString := Import('PyString_FromString');
if not IsPython3000 then
@@ -3879,7 +3973,6 @@ procedure TPythonInterface.MapDll;
PyOS_InterruptOccurred :=Import('PyOS_InterruptOccurred');
PyObject_CallObject :=Import('PyObject_CallObject');
PyObject_CallMethod :=Import('PyObject_CallMethod');
- PyObject_CallMethodStr :=Import('PyObject_CallMethod');
if not IsPython3000 then
PyObject_Compare :=Import('PyObject_Compare');
PyObject_RichCompare :=Import('PyObject_RichCompare');
@@ -3966,11 +4059,12 @@ procedure TPythonInterface.MapDll;
PyType_GenericAlloc :=Import('PyType_GenericAlloc');
PyType_GenericNew :=Import('PyType_GenericNew');
PyType_Ready :=Import('PyType_Ready');
- PyUnicode_FromWideChar :=Import(AnsiString(Format('PyUnicode%s_FromWideChar',[GetUnicodeTypeSuffix])));
- PyUnicode_AsWideChar :=Import(AnsiString(Format('PyUnicode%s_AsWideChar',[GetUnicodeTypeSuffix])));
- PyUnicode_Decode :=Import(AnsiString(Format('PyUnicode%s_Decode',[GetUnicodeTypeSuffix])));
- PyUnicode_AsEncodedString :=Import(AnsiString(Format('PyUnicode%s_AsEncodedString',[GetUnicodeTypeSuffix])));
- PyUnicode_FromOrdinal :=Import(AnsiString(Format('PyUnicode%s_FromOrdinal',[GetUnicodeTypeSuffix])));
+ PyUnicode_FromWideChar :=Import(AnsiString(Format('PyUnicode%s_FromWideChar',[UnicodeSuffix])));
+ PyUnicode_AsWideChar :=Import(AnsiString(Format('PyUnicode%s_AsWideChar',[UnicodeSuffix])));
+ PyUnicode_Decode :=Import(AnsiString(Format('PyUnicode%s_Decode',[UnicodeSuffix])));
+ PyUnicode_AsEncodedString :=Import(AnsiString(Format('PyUnicode%s_AsEncodedString',[UnicodeSuffix])));
+ PyUnicode_FromOrdinal :=Import(AnsiString(Format('PyUnicode%s_FromOrdinal',[UnicodeSuffix])));
+ PyUnicode_GetSize :=Import(AnsiString(Format('PyUnicode%s_GetSize',[UnicodeSuffix])));
PyWeakref_GetObject :=Import('PyWeakref_GetObject');
PyWeakref_NewProxy :=Import('PyWeakref_NewProxy');
PyWeakref_NewRef :=Import('PyWeakref_NewRef');
@@ -3979,18 +4073,18 @@ procedure TPythonInterface.MapDll;
PyThreadState_SetAsyncExc :=Import('PyThreadState_SetAsyncExc');
Py_AtExit :=Import('Py_AtExit');
//Py_Cleanup :=Import('Py_Cleanup');
- Py_CompileString :=Import('Py_CompileString');
Py_FatalError :=Import('Py_FatalError');
if not IsPython3000 then begin
- Py_FindMethod :=Import('Py_FindMethod');
- Py_FindMethodInChain :=Import('Py_FindMethodInChain');
+ Py_FindMethod :=Import('Py_FindMethod');
+ Py_FindMethodInChain :=Import('Py_FindMethodInChain');
DLL_Py_FlushLine :=Import('Py_FlushLine');
+ _PyString_Resize :=Import('_PyString_Resize');
+ Py_CompileStringFlags :=Import('Py_CompileStringFlags');
+ end else begin
+ _PyString_Resize :=Import('_PyBytes_Resize');
+ Py_CompileStringExFlags :=Import('Py_CompileStringExFlags');
end;
- _PyObject_New :=Import('_PyObject_New');
- if not IsPython3000 then
- _PyString_Resize :=Import('_PyString_Resize')
- else
- _PyString_Resize :=Import('_PyBytes_Resize');
+ _PyObject_New :=Import('_PyObject_New');
Py_Finalize :=Import('Py_Finalize');
if getProcAddress( FDLLHandle, 'PyCode_Addr2Line' ) <> nil then
DLL_PyCode_Addr2Line := Import('PyCode_Addr2Line');
@@ -4004,17 +4098,20 @@ procedure TPythonInterface.MapDll;
Py_GetCopyright :=Import('Py_GetCopyright');
Py_GetExecPrefix :=Import('Py_GetExecPrefix');
Py_GetPath :=Import('Py_GetPath');
+ if IsPython3000 then
+ Py_SetPythonHome3000 :=Import('Py_SetPythonHome')
+ else
+ Py_SetPythonHome :=Import('Py_SetPythonHome');
+ if IsPython3000 then
+ Py_GetPythonHome3000 :=Import('Py_GetPythonHome')
+ else
+ Py_GetPythonHome :=Import('Py_GetPythonHome');
Py_GetPrefix :=Import('Py_GetPrefix');
Py_GetProgramName :=Import('Py_GetProgramName');
- PyParser_SimpleParseString :=Import('PyParser_SimpleParseString');
+ PyParser_SimpleParseStringFlags := Import('PyParser_SimpleParseStringFlags');
PyNode_Free :=Import('PyNode_Free');
PyErr_NewException :=Import('PyErr_NewException');
-/// jah 29-sep-2000 : updated for python 2.0
-/// replaced Py_Malloc with PyMem_Malloc
-///--- @Py_Malloc := Import ('Py_Malloc');
-///+++ @Py_Malloc := Import ('PyMem_Malloc');
try
- Py_Malloc := Import ('PyMem_Malloc');
PyMem_Malloc := Import ('PyMem_Malloc');
except
end;
@@ -4045,6 +4142,19 @@ procedure TPythonInterface.MapDll;
PyGILState_Release := Import('PyGILState_Release');
end;
+function TPythonInterface.Py_CompileString( s1,s2:PAnsiChar;i:integer):PPyObject; cdecl;
+begin
+ if IsPython3000 then
+ Result := Py_CompileStringExFlags(s1, s2, i, nil, -1)
+ else
+ Result := Py_CompileStringFlags(s1, s2, i, nil);
+end;
+
+function TPythonInterface.PyParser_SimpleParseString( str : PAnsiChar; start : integer) : PNode; cdecl;
+begin
+ Result := PyParser_SimpleParseStringFlags(str, start, 0);
+end;
+
procedure TPythonInterface.Py_INCREF(op: PPyObject);
begin
Inc(op^.ob_refcnt);
@@ -4070,11 +4180,6 @@ procedure TPythonInterface.Py_XDECREF(op: PPyObject);
if op <> nil then Py_DECREF(op);
end;
-function TPythonInterface.Py_GetPlatform: PAnsiChar; cdecl;
-begin
- Py_GetPlatform := 'win32';
-end;
-
// This function is copied from compile.c because it was not
// exported in the Dll
function TPythonInterface.PyCode_Addr2Line( co: PPyCodeObject; addrq : Integer ) : Integer; cdecl;
@@ -4604,13 +4709,17 @@ procedure TPythonEngine.Finalize;
Finalize;
end;
// Then finalize Python, if we have to
- if Initialized and FAutoFinalize then
+ if Initialized and FAutoFinalize then begin
try
- FFinalizing := True;
- Py_Finalize;
- finally
- FFinalizing := False;
+ try
+ FFinalizing := True;
+ Py_Finalize;
+ finally
+ FFinalizing := False;
+ end;
+ except
end;
+ end;
// Detach our clients, when engine is beeing destroyed or one of its clients.
canDetachClients := csDestroying in ComponentState;
if not canDetachClients then
@@ -4678,7 +4787,9 @@ procedure TPythonEngine.DoOpenDll(const aDllName : String);
end;
if not PYTHON_KNOWN_VERSIONS[i].CanUseLatest then
Break;
- end;
+ end
+ else
+ RegVersion := GetPythonVersionFromDLLName(aDllName);
inherited;
end;
@@ -4699,9 +4810,9 @@ procedure TPythonEngine.AssignPyFlags;
SetFlag(Py_InteractiveFlag, pfInteractive in FPyFlags);
SetFlag(Py_OptimizeFlag, pfOptimize in FPyFlags);
SetFlag(Py_NoSiteFlag, pfNoSite in FPyFlags);
- SetFlag(Py_UseClassExceptionsFlag, pfUseClassExceptionsFlag in FPyFlags);
SetFlag(Py_FrozenFlag, pfFrozenFlag in FPyFlags);
if not IsPython3000 then begin
+ SetFlag(Py_UseClassExceptionsFlag, pfUseClassExceptionsFlag in FPyFlags);
SetFlag(Py_UnicodeFlag, pfUnicode in FPyFlags);
SetFlag(Py_TabcheckFlag, pfTabcheck in FPyFlags);
end;
@@ -4715,7 +4826,19 @@ procedure TPythonEngine.Initialize;
procedure InitSysPath;
var
_path : PPyObject;
+ const Script =
+ 'import sys' + sLineBreak +
+ 'sys.executable = r"%s"' + sLineBreak +
+ 'path = sys.path' + sLineBreak +
+ 'for i in range(len(path)-1, -1, -1):' + sLineBreak +
+ ' if path[i].find("site-packages") > 0:' + sLineBreak +
+ ' path.pop(i)' + sLineBreak +
+ 'import site' + sLineBreak +
+ 'site.main()' + sLineBreak +
+ 'del sys, path, i, site';
begin
+ if VenvPythonExe <> '' then
+ ExecString(AnsiString(Format(Script, [VenvPythonExe])));
_path := PySys_GetObject('path');
if Assigned(FOnSysPathInit) then
FOnSysPathInit(Self, _path);
@@ -4788,17 +4911,25 @@ procedure TPythonEngine.Initialize;
if IsPython3000 then begin
if Assigned(Py_SetProgramName3000) then
begin
- FProgramNameW := ParamStr(0);
+ if FProgramNameW = '' then
+ FProgramNameW := ParamStr(0);
Py_SetProgramName3000(PWideChar(FProgramNameW));
end
end else begin
if Assigned(Py_SetProgramName) then
begin
- FProgramName := AnsiString(ParamStr(0));
+ if FProgramName = '' then
+ FProgramName := AnsiString(ParamStr(0));
Py_SetProgramName(PAnsiChar(FProgramName));
end
end;
AssignPyFlags;
+ if FPythonHomeW <> '' then begin
+ if IsPython3000 then
+ Py_SetPythonHome3000(PWideChar(FPythonHomeW))
+ else
+ Py_SetPythonHome(PAnsiChar(FPythonHome));
+ end;
Py_Initialize;
FInitialized := True;
FIORedirected := False;
@@ -4830,8 +4961,11 @@ function TPythonEngine.GetInterpreterState: PPyInterpreterState;
res: PPyThreadState;
begin
if Assigned(PyThreadState_Get) then begin
- res:= PyThreadState_Get;
- Result := res^.interp;
+ res:= PyThreadState_Get();
+ if (MajorVersion > 3) or ((MajorVersion = 3) and (MinorVersion >= 4)) then
+ Result := res^.interp34
+ else
+ Result := res^.interp;
end else
Result := nil;
end;
@@ -4889,37 +5023,50 @@ procedure TPythonEngine.Notification( AComponent: TComponent;
procedure TPythonEngine.CheckRegistry;
{$IFDEF MSWINDOWS}
var
- key : String;
- path : String;
+ key : string;
+ Path : string;
+ NewPath : string;
+{$IFDEF CPUX86}
+ MajorVersion : integer;
+ MinorVersion : integer;
+{$ENDIF}
+ VersionSuffix: string;
{$ENDIF}
begin
{$IFDEF MSWINDOWS}
+ if Assigned( FOnPathInitialization ) then
try
- with TRegistry.Create(KEY_READ and not KEY_NOTIFY) do
+ with TRegistry.Create(KEY_ALL_ACCESS and not KEY_NOTIFY) do
try
- //Access := KEY_READ; // works only with Delphi5 or greater
+ VersionSuffix := '';
+{$IFDEF CPUX86}
+ MajorVersion := StrToInt(RegVersion[1]);
+ MinorVersion := StrToInt(RegVersion[3]);
+ if (MajorVersion > 3) or ((MajorVersion = 3) and (MinorVersion >= 5)) then
+ VersionSuffix := '-32';
+{$ENDIF}
+ key := Format('\Software\Python\PythonCore\%s%s\PythonPath', [RegVersion, VersionSuffix]);
+
RootKey := HKEY_LOCAL_MACHINE;
- key := Format('\Software\Python\PythonCore\%s\PythonPath', [RegVersion]);
if not KeyExists( key ) then
+ begin
+ // try a current user installation
+ RootKey := HKEY_CURRENT_USER;
+ if not KeyExists( key ) then Exit;
+ end;
+ // Key found
+ OpenKey( key, True );
+ try
+ Path := ReadString('');
+ NewPath := Path;
+ FOnPathInitialization( Self, NewPath );
+ if NewPath <> Path then
begin
- // try a current user installation
- RootKey := HKEY_CURRENT_USER;
- if not KeyExists( key ) then
- begin
- if Assigned( FOnPathInitialization ) then
- begin
- path := '';
- FOnPathInitialization( Self, path );
- if path <> '' then
- begin
- //Access := KEY_ALL_ACCESS; // works only with Delphi5 or greater
- OpenKey( key, True );
- WriteString( '', path );
- CloseKey;
- end;
- end;
- end;
+ WriteString( '', NewPath );
end;
+ finally
+ CloseKey;
+ end;
finally
Free;
end;
@@ -5040,6 +5187,18 @@ procedure TPythonEngine.SetPyFlags(const Value: TPythonFlags);
end; // of if
end;
+procedure TPythonEngine.SetPythonHome(const PythonHome: string);
+begin
+ FPythonHomeW := PythonHome;
+ FPythonHome := EncodeString(PythonHome);
+end;
+
+procedure TPythonEngine.SetProgramName(const ProgramName: string);
+begin
+ FProgramNameW := ProgramName;
+ FProgramName := EncodeString(ProgramName);
+end;
+
function TPythonEngine.IsType(ob: PPyObject; obt: PPyTypeObject): Boolean;
begin
result := ob^.ob_type = obt;
@@ -5059,23 +5218,6 @@ function TPythonEngine.GetAttrString(obj: PPyObject; AName: PAnsiChar):PAnsiChar
PyErr_Clear;
end;
-function TPythonEngine.CleanString(const s : AnsiString) : AnsiString;
-var
- i : Integer;
-begin
- result := s;
- if s = '' then
- Exit;
- i := Pos(AnsiString(CR),s);
- while i > 0 do
- begin
- Delete( result, i, 1 );
- i := Pos(AnsiString(CR),result);
- end;
- if result[length(result)] <> LF then
- Insert( LF, result, length(result)+1 );
-end;
-
function TPythonEngine.EvalPyFunction(pyfunc, pyargs:PPyObject): Variant;
var presult :PPyObject;
begin
@@ -5209,12 +5351,12 @@ function TPythonEngine.Run_CommandAsObjectWithDict(const command : AnsiString; m
procedure TPythonEngine.ExecStrings( strings : TStrings );
begin
- Py_XDecRef( Run_CommandAsObject( CleanString( AnsiString(strings.Text) ), file_input ) );
+ Py_XDecRef( Run_CommandAsObject( EncodeString(strings.Text) , file_input ) );
end;
function TPythonEngine.EvalStrings( strings : TStrings ) : PPyObject;
begin
- Result := Run_CommandAsObject( CleanString( AnsiString(strings.Text) ), eval_input );
+ Result := Run_CommandAsObject( EncodeString(strings.Text) , eval_input );
end;
procedure TPythonEngine.ExecString(const command : AnsiString; locals, globals : PPyObject );
@@ -5224,7 +5366,7 @@ procedure TPythonEngine.ExecString(const command : AnsiString; locals, globals :
procedure TPythonEngine.ExecStrings( strings : TStrings; locals, globals : PPyObject );
begin
- Py_XDecRef( Run_CommandAsObjectWithDict( CleanString( AnsiString(strings.Text) ), file_input, locals, globals ) );
+ Py_XDecRef( Run_CommandAsObjectWithDict( EncodeString(strings.Text), file_input, locals, globals ) );
end;
function TPythonEngine.EvalString( const command : AnsiString; locals, globals : PPyObject ) : PPyObject;
@@ -5234,12 +5376,12 @@ function TPythonEngine.EvalString( const command : AnsiString; locals, globals :
function TPythonEngine.EvalStrings( strings : TStrings; locals, globals : PPyObject ) : PPyObject;
begin
- Result := Run_CommandAsObjectWithDict( CleanString( AnsiString(strings.Text) ), eval_input, locals, globals );
+ Result := Run_CommandAsObjectWithDict( EncodeString(strings.Text), eval_input, locals, globals );
end;
function TPythonEngine.EvalStringsAsStr( strings : TStrings ) : String;
begin
- Result := Run_CommandAsString( CleanString( AnsiString(strings.Text) ), eval_input );
+ Result := Run_CommandAsString( EncodeString(strings.Text), eval_input );
end;
function TPythonEngine.CheckEvalSyntax( const str : AnsiString ) : Boolean;
@@ -5587,6 +5729,23 @@ function TPythonEngine.FindClient( const aName : string ) : TEngineClient;
end;
end;
+function TPythonEngine.EncodeString(const str: string): AnsiString;
+begin
+ if IsPython3000 then
+ Result := UTF8Encode(str)
+ else
+ Result := AnsiString(str);
+end;
+
+function TPythonEngine.EncodeWindowsFilePath(const str: string): AnsiString;
+{PEP 529}
+begin
+ if (MajorVersion > 3) or ((MajorVersion = 3) and (MinorVersion >=6) )then
+ Result := UTF8Encode(str)
+ else
+ Result := AnsiString(str);
+end;
+
function TPythonEngine.TypeByName( const aTypeName : AnsiString ) : PPyTypeObject;
var
i : Integer;
@@ -5685,7 +5844,7 @@ function TPythonEngine.VariantAsPyObject( const V : Variant ) : PPyObject;
for j := VarArrayLowBound( DeRefV, 2 ) to VarArrayHighBound( DeRefV, 2 ) do
begin
L2 := PyList_New( VarArrayHighBound( DeRefV, 3 ) - VarArrayLowBound( DeRefV, 3 ) + 1 );
- PyList_SetItem( Result, cpt2, L );
+ PyList_SetItem( L, cpt2, L2 );
cpt3 := 0;
for k := VarArrayLowBound( DeRefV, 3 ) to VarArrayHighBound( DeRefV, 3 ) do
begin
@@ -5814,7 +5973,7 @@ function TPythonEngine.VariantAsPyObject( const V : Variant ) : PPyObject;
// detect if the variant supports this special property
if Assigned(Disp) and (Disp.GetIDsOfNames(GUID_NULL, @wStr, 1, 0, @DispID) = S_OK) then
begin
- myInt := DeRefV.__asPPyObject__; //Returns the address to PPyObject as integer. (See impl. in PythonAtom.pas)
+ myInt := Integer(DeRefV.__asPPyObject__); //Returns the address to PPyObject as integer. (See impl. in PythonAtom.pas)
Result := PPyObject(myInt);
Py_XIncRef(Result);
end
@@ -5997,8 +6156,6 @@ function TPythonEngine.PyObjectAsVariant( obj : PPyObject ) : Variant;
end;
function TPythonEngine.VarRecAsPyObject( v : TVarRec ) : PPyObject;
-var
- buff : array [0..256] of AnsiChar;
begin
case v.VType of
vtInteger: Result := PyInt_FromLong( v.VInteger );
@@ -6008,7 +6165,7 @@ function TPythonEngine.VarRecAsPyObject( v : TVarRec ) : PPyObject;
vtString:
begin
if Assigned(v.VString) then
- Result := PyString_FromString( StrPCopy( buff, v.VString^) )
+ Result := PyString_FromString(PAnsiChar(AnsiString(v.VString^)))
else
Result := PyString_FromString( '' );
end;
@@ -6134,7 +6291,7 @@ function TPythonEngine.ArrayToPyDict( items : array of const) : PPyObject;
vtAnsiString:
begin
if Assigned(v.VAnsiString) then
- Result := StrPas(PAnsiChar(Ansistring(v.VAnsiString)))
+ Result := Ansistring(v.VAnsiString)
else
Result := '';
end;
@@ -6203,7 +6360,7 @@ function TPythonEngine.StringsToPyList( strings : TStrings ) : PPyObject;
raise EPythonError.Create('Could not create a new list object');
for i := 0 to strings.Count - 1 do
PyList_SetItem( Result, i,
- PyString_FromString( PAnsiChar(AnsiString(strings.Strings[i])) ) );
+ PyString_FromDelphiString( strings.Strings[i]) );
end;
function TPythonEngine.StringsToPyTuple( strings : TStrings ) : PPyObject;
@@ -6215,7 +6372,7 @@ function TPythonEngine.StringsToPyTuple( strings : TStrings ) : PPyObject;
raise EPythonError.Create('Could not create a new tuple object');
for i := 0 to strings.Count - 1 do
PyTuple_SetItem( Result, i,
- PyString_FromString( PAnsiChar(AnsiString(strings.Strings[i])) ) );
+ PyString_FromDelphiString( strings.Strings[i]) );
end;
procedure TPythonEngine.PyListToStrings( list : PPyObject; strings : TStrings );
@@ -6249,7 +6406,7 @@ function TPythonEngine.PyUnicode_AsWideString( obj : PPyObject ) : UnicodeString
begin
if PyUnicode_Check(obj) then
begin
- _size := PySequence_Length(obj);
+ _size := PyUnicode_GetSize(obj);
if _size > 0 then
begin
{$IFDEF LINUX}
@@ -6283,7 +6440,7 @@ function TPythonEngine.PyUnicode_FromWideString( const AString : UnicodeString)
{$IFDEF LINUX}
// Note that Linux uses UCS4 strings, whereas it declares using UCS2 strings!!!
_ucs4Str := WideStringToUCS4String(AString);
- Result := PyUnicode_FromWideChar( {PWideChar}(@_ucs4Str[0]), Length(AString) );
+ Result := PyUnicode_FromWideChar( {PWideChar}(@_ucs4Str[0]), Length(_ucs4Str)-1 {trim trailing zero});
{$ELSE}
Result := PyUnicode_FromWideChar( PWideChar(AString), Length(AString) );
{$ENDIF}
@@ -6462,16 +6619,6 @@ function TPythonEngine.PyTZInfo_CheckExact( obj : PPyObject ) : Boolean;
Result := Assigned(FPyDateTime_DateType) and (Pointer(obj^.ob_type) = FPyDateTime_TZInfoType);
end;
-function TPythonEngine.GetVersion: String;
-begin
- Result := '3.32';
-end;
-
-procedure TPythonEngine.SetVersion(const Value: String);
-begin
- // do nothing
-end;
-
function TPythonEngine.PyString_AsDelphiString(ob: PPyObject): string;
begin
if PyUnicode_Check(ob) then
@@ -6496,6 +6643,16 @@ function TPythonEngine.PyString_AsWideString( ob: PPyObject): UnicodeString;
Result := UnicodeString(PyString_AsString(ob));
end;
+function TPythonEngine.PyString_FromDelphiString(str: string): PPyObject;
+begin
+ if IsPython3000 then
+ begin
+ Result := PyUnicode_FromWideString(str);
+ end
+ else
+ Result := DLL_PyString_FromString(PAnsiChar(AnsiString(str)));
+end;
+
function TPythonEngine.PyString_FromString( str: PAnsiChar): PPyObject;
var
_text : UnicodeString;
@@ -6631,7 +6788,8 @@ function TEventDef.GetDisplayName: string;
function TEventDef.GetDocString : AnsiString;
begin
Owner.Container.CheckEngine;
- FTmpDocString := Owner.Container.Engine.CleanString(AnsiString(FDocString.Text));
+ FTmpDocString :=
+ Owner.Container.Engine.EncodeString(CleanString(FDocString.Text, False));
Result := fTmpDocString;
end;
@@ -7406,7 +7564,8 @@ procedure TPythonModule.DefineDocString;
begin
if DocString.Text <> '' then
begin
- doc := PyString_FromString( PAnsiChar(CleanString(AnsiString(FDocString.Text))) );
+ doc :=
+ PyString_FromDelphiString(CleanString(FDocString.Text, False));
PyObject_SetAttrString( FModule, '__doc__', doc );
Py_XDecRef(doc);
CheckError(False);
@@ -7561,6 +7720,17 @@ procedure TPythonModule.DeleteVar( const varName : AnsiString );
raise EPythonError.CreateFmt( 'Can''t delete var "%s" in module "%s", because it is not yet initialized', [varName, ModuleName] );
end;
+procedure TPythonModule.ClearVars;
+var
+ dict : PPyObject;
+begin
+ if Assigned(FEngine) and Assigned( FModule ) then
+ with Engine do begin
+ dict := PyModule_GetDict( Module );
+ PyDict_Clear(dict);
+ end;
+end;
+
procedure TPythonModule.SetVarFromVariant( const varName : AnsiString; const value : Variant );
var
obj : PPyObject;
@@ -7718,15 +7888,6 @@ function TPyObject.GetAttr(key : PAnsiChar) : PPyObject;
finally
Py_XDecRef(PyKey);
end;
-
-// // check for a method
-// if IsPython3000 then
-// // I think Python 3000 from beta 2 gets the methods from the tp_methods field
-// Result := nil
-// else
-// Result := Py_FindMethod( PythonType.MethodsData, GetSelf, key);
-// if not Assigned(Result) then
-// PyErr_SetString (PyExc_AttributeError^, PAnsiChar(Format('Unknown attribute "%s"',[key])));
end;
end;
@@ -7742,9 +7903,9 @@ function TPyObject.SetAttr(key : PAnsiChar; value : PPyObject) : Integer;
function TPyObject.Repr : PPyObject;
begin
- with GetPythonEngine do
- Result :=
- PyString_FromString( PAnsiChar(AnsiString(Format('<%s at %x>', [PythonType.TypeName, NativeInt(self)]))) );
+ Result :=
+ GetPythonEngine.PyString_FromDelphiString( Format('<%s at %x>',
+ [PythonType.TypeName, NativeInt(self)]) );
end;
function TPyObject.Compare( obj: PPyObject) : Integer;
@@ -7788,8 +7949,23 @@ function TPyObject.Clear: integer;
end;
function TPyObject.RichCompare( obj : PPyObject; Op : TRichComparisonOpcode) : PPyObject;
-begin
- Result := nil;
+Var
+ Res : Boolean;
+begin
+ Res := False;
+ case Op of
+ pyLT: Res := Compare(obj) < 0;
+ pyLE: Res := Compare(obj) <= 0;
+ pyEQ: Res := Compare(obj) = 0;
+ pyNE: Res := Compare(obj) <> 0;
+ pyGT: Res := Compare(obj) > 0;
+ pyGE: Res := Compare(obj) >= 0;
+ end;
+ if Res then
+ Result := PPyObject(GetPythonEngine.Py_True)
+ else
+ Result := PPyObject(GetPythonEngine.Py_False);
+ GetPythonEngine.Py_INCREF( Result );
end;
function TPyObject.Iter : PPyObject;
@@ -8219,7 +8395,6 @@ procedure TPythonType.ReallocMembers;
procedure TPythonType.ReallocMethods;
begin
inherited;
-exit;
if tpfBaseType in TypeFlags then
FType.tp_methods := MethodsData;
end;
@@ -8652,8 +8827,9 @@ procedure TPythonType.InitServices;
begin
// Basic services
if FDocString.Count > 0 then
+ with Engine do
begin
- FCurrentDocString := GetPythonEngine.CleanString(AnsiString(FDocString.Text));
+ FCurrentDocString := EncodeString(CleanString(FDocString.Text, False));
tp_doc := PAnsiChar(FCurrentDocString);
end;
tp_dealloc := @PyObjectDestructor;
@@ -9232,8 +9408,8 @@ function TPyVar.Repr : PPyObject;
obj := GetValue;
try
Result :=
- PyString_FromString( PAnsiChar(AnsiString(Format('<%s: %s>',
- [PythonType.TypeName, PyObjectAsString(obj)]))) );
+ PyString_FromDelphiString( Format('<%s: %s>',
+ [PythonType.TypeName, PyObjectAsString(obj)]) );
finally
Py_XDecRef(obj);
end;
@@ -9346,29 +9522,22 @@ procedure TPyVar.SetValueFromVariant( const value : Variant );
procedure TPythonThread.Execute;
var
- withinterp: Boolean;
global_state : PPyThreadState;
gilstate : PyGILState_STATE;
begin
- withinterp := Assigned( fInterpreterState);
with GetPythonEngine do
begin
- if withinterp then
+ if fThreadExecMode = emNewState then
begin
- fThreadExecMode := emNewState;
- fThreadState := PyThreadState_New( fInterpreterState);
- if Assigned(fThreadState) then
- begin
- PyEval_AcquireThread(fThreadState);
+ gilstate := PyGILState_Ensure();
+ try
+ fThreadState := GetThreadState;
ExecuteWithPython;
- PyEval_ReleaseThread( fThreadState);
- PyThreadState_Clear( fThreadState);
- PyThreadState_Delete( fThreadState);
- end else
- raise EPythonError.Create( 'Could not create a new thread state');
- end else {withinterp}
+ finally
+ PyGILState_Release(gilstate);
+ end;
+ end else {fThreadExecMode}
begin
- fThreadExecMode := emNewInterpreter;
gilstate := PyGILState_Ensure();
global_state := PyThreadState_Get;
PyThreadState_Swap(nil);
@@ -9430,7 +9599,7 @@ function pyio_write(self, args : PPyObject) : PPyObject;
if GetCurrentThreadId <> MainThreadId then
with GetPythonEngine do
begin
- if RedirectIO and (IO <> nil) and (IO.ClassName <> 'TPythonInputOutput') then
+ if RedirectIO and (IO <> nil) and (IO.ClassName <> 'TPythonInputOutput') and not IO.DelayWrites then
begin
Result := GetPythonEngine.ReturnNone;
Exit;
@@ -9473,19 +9642,15 @@ function pyio_read(self, args : PPyObject) : PPyObject;
if Assigned(IO) then
if IO.UnicodeIO then begin
Widetxt := IO.ReceiveUniData;
- // KV!!!!!!
if PyErr_Occurred <> nil then
Result := nil
else
- // KV!!!!!!
Result := PyUnicode_FromWideString(PWideChar(Widetxt));
end else begin
txt := IO.ReceiveData;
- // KV!!!!!!
if PyErr_Occurred <> nil then
Result := nil
else
- // KV!!!!!!
Result := PyString_FromString(PAnsiChar(txt));
end
else
@@ -9653,6 +9818,11 @@ procedure Register;
TPythonType, TPythonModule, TPythonDelphiVar]);
end;
+function GetPythonVersionFromDLLName(const DLLFileName : String): String;
+begin
+ Result := DLLFileName[{$IFDEF MSWINDOWS}7{$ELSE}10{$ENDIF}] + '.' + DLLFileName[{$IFDEF MSWINDOWS}8{$ELSE}11{$ENDIF}];
+end;
+
function PyType_HasFeature(AType : PPyTypeObject; AFlag : Integer) : Boolean;
begin
//(((t)->tp_flags & (f)) != 0)
@@ -9662,19 +9832,43 @@ function PyType_HasFeature(AType : PPyTypeObject; AFlag : Integer) : Boolean;
procedure MaskFPUExceptions(ExceptionsMasked : boolean;
MatchPythonPrecision : Boolean);
begin
- if MatchPythonPrecision then begin
- if ExceptionsMasked then
- Set8087CW($1232 or $3F)
- else
- Set8087CW($1232);
- end else begin
- if ExceptionsMasked then
- Set8087CW($1332 or $3F)
+ if ExceptionsMasked then
+ SetExceptionMask([exInvalidOp, exDenormalized, exZeroDivide,
+ exOverflow, exUnderflow, exPrecision])
+ else
+ SetExceptionMask([exDenormalized, exUnderflow, exPrecision]);
+{$IFNDEF NEXTGEN}{$WARN SYMBOL_PLATFORM OFF}
+ if MatchPythonPrecision then
+ SetPrecisionMode(pmDouble)
else
- Set8087CW($1332);
- end;
+ SetPrecisionMode(pmExtended);
+{$ENDIF !NEXTGEN}{$WARN SYMBOL_PLATFORM ON}
end;
+function CleanString(const s : AnsiString; AppendLF : Boolean) : AnsiString;
+var
+ i : Integer;
+begin
+ result := s;
+ if s = '' then
+ Exit;
+ i := Pos(AnsiString(CR),s);
+ while i > 0 do
+ begin
+ Delete( result, i, 1 );
+ i := PosEx(AnsiString(CR),result, i);
+ end;
+ if AppendLF and (result[length(result)] <> LF) then
+ Result := Result + LF;
+end;
+{$ifndef FPC}
+function CleanString(const s : string; AppendLF : Boolean) : string;
+begin
+ Result := AdjustLineBreaks(s, tlbsLF);
+ if AppendLF and (result[length(result)] <> LF) then
+ Result := Result + LF;
+end;
+{$endif}
{$IFDEF MSWINDOWS}
function IsPythonVersionRegistered(PythonVersion : string;
out InstallPath: string; out AllUserInstall: Boolean) : Boolean;
@@ -9685,39 +9879,62 @@ function IsPythonVersionRegistered(PythonVersion : string;
// the registry info in HKEY_CURRENT_USER.
// Hence, for Current user installations we need to try and find the install path
// since it may not be on the system path.
+
+ // The above convension was changed in Python 3.5. Now even for all user
+ // installations the dll is located at the InstallPath.
+ // Also from version 3.5 onwards 32 bit version have a suffix -32 e.g. "3.6-32"
+ // See also PEP 514
+
var
key: string;
+ VersionSuffix: string;
+ MajorVersion : integer;
+ MinorVersion : integer;
begin
Result := False;
InstallPath := '';
AllUserInstall := False;
+ MajorVersion := StrToInt(PythonVersion[1]);
+ MinorVersion := StrToInt(PythonVersion[3]);
+ VersionSuffix := '';
+{$IFDEF CPUX86}
+ if (MajorVersion > 3) or ((MajorVersion = 3) and (MinorVersion >= 5)) then
+ VersionSuffix := '-32';
+{$ENDIF}
+ key := Format('\Software\Python\PythonCore\%s%s\InstallPath', [PythonVersion, VersionSuffix]);
+
+ // First try HKEY_CURRENT_USER as per PEP514
try
- key := Format('\Software\Python\PythonCore\%s\InstallPath', [PythonVersion]);
with TRegistry.Create(KEY_READ and not KEY_NOTIFY) do
try
- RootKey := HKEY_LOCAL_MACHINE;
- if KeyExists(key) then begin
- AllUserInstall := True;
+ RootKey := HKEY_CURRENT_USER;
+ if OpenKey(Key, False) then begin
+ InstallPath := ReadString('');
Result := True;
+ Exit;
end;
finally
Free;
end;
except
end;
- // We do not seem to have an All User Python Installation.
- // Check whether we have a current user installation
- if not AllUserInstall then
+
+ //Then try for an all user installation
+ try
with TRegistry.Create(KEY_READ and not KEY_NOTIFY) do
try
- RootKey := HKEY_CURRENT_USER;
+ RootKey := HKEY_LOCAL_MACHINE;
if OpenKey(Key, False) then begin
- InstallPath := ReadString('');
+ AllUserInstall := True;
+ if (MajorVersion > 3) or ((MajorVersion = 3) and (MinorVersion >= 5)) then
+ InstallPath := ReadString('');
Result := True;
end;
finally
Free;
end;
+ except
+ end;
end;
{$ENDIF}
diff --git a/PythonForDelphi/Components/Sources/Core/PythonVersions.pas b/PythonForDelphi/Components/Sources/Core/PythonVersions.pas
new file mode 100644
index 00000000..cc7a2dd6
--- /dev/null
+++ b/PythonForDelphi/Components/Sources/Core/PythonVersions.pas
@@ -0,0 +1,526 @@
+{-----------------------------------------------------------------------------
+ Unit Name: PythonVersions
+ Author: Kiriakos
+ Date: PyScripter
+ Purpose: Discover and get info about Python versions
+ Part of the Python for Delphi library
+
+ History:
+-----------------------------------------------------------------------------}
+
+unit PythonVersions;
+
+interface
+Uses
+ Classes;
+
+type
+
+ TPythonVersion = record
+ private
+ FDisplayName: string;
+ FHelpFile: string;
+ fSysArchitecture : string;
+ function GetDLLName: string;
+ function ExpectedArchitecture:string;
+ function GetIsPython3K: Boolean;
+ function GetHelpFile: string;
+ function GetDisplayName: string;
+ function GetApiVersion: integer;
+ function GetSysArchitecture: string;
+ function GetPythonExecutable: string;
+ public
+ IsRegistered: Boolean;
+ IsAllUsers: Boolean;
+ SysVersion: string;
+ Version: string;
+ DLLPath: string;
+ InstallPath: string;
+ PythonPath: string;
+ function Is_venv: Boolean;
+ function Is_virtualenv: Boolean;
+ function Is_conda: Boolean;
+ procedure AssignTo(PythonEngine: TPersistent);
+ property PythonExecutable: string read GetPythonExecutable;
+ property DLLName: string read GetDLLName;
+ property SysArchitecture: string read GetSysArchitecture;
+ property IsPython3K: Boolean read GetIsPython3K;
+ property HelpFile: string read GetHelpFile write FHelpFile;
+ property DisplayName: string read GetDisplayName write FDisplayName;
+ property ApiVersion: integer read GetApiVersion;
+ end;
+
+ TPythonVersions = array of TPythonVersion;
+
+ (*
+ Compares two Version strings and returns -1, 0, 1 depending on result
+ The function result has the semantics of Delphi compare functions
+ -1: A is bigger (newer), 0: equal versions, 1: B is bigger (newer)
+ *)
+ function CompareVersions(A, B : String) : Integer;
+
+
+ {$IFDEF MSWINDOWS}
+ (* Checks whether an executable was compiled for X64 *)
+ function IsEXEx64(const EXEName: string): Boolean;
+ (* Checks whether a DLL was compiled for X64 *)
+ function Isx64(const FileName: string): Boolean;
+ (* Checks whether a Python version is registered and returns the related info *)
+ function GetRegisteredPythonVersion(SysVersion: string;
+ out PythonVersion: TPythonVersion): Boolean;
+ (* Returns all registered Python versions *)
+ function GetRegisteredPythonVersions : TPythonVersions;
+ (* Returns the highest numbered registered Python version *)
+ function GetLatestRegisteredPythonVersion(out PythonVersion: TPythonVersion): Boolean;
+ function PythonVersionFromPath(const Path: string; out PythonVersion: TPythonVersion;
+ AcceptVirtualEnvs: Boolean = True): Boolean;
+ {$ENDIF}
+
+implementation
+
+Uses
+ {$IFDEF MSWINDOWS}
+ Windows,
+ {$ENDIF}
+ SysUtils,
+ Math,
+ Registry,
+ PythonEngine;
+
+{ TPythonVersion }
+
+function TPythonVersion.GetDLLName: string;
+begin
+ {$IFDEF MSWINDOWS}
+ Result := 'python' + SysVersion[1] + SysVersion[3] + '.dll';
+ {$ELSE}
+ Result := 'libpython' + SysVersion + '.so';
+ {$ENDIF}
+end;
+
+function TPythonVersion.ExpectedArchitecture: string;
+begin
+ Result := '';
+ {$IFDEF CPUX64}
+ Result := '64bit';
+ {$ENDIF}
+ {$IFDEF CPU64}
+ Result := '64bit';
+ {$ENDIF}
+ {$IFDEF CPU64bits}
+ Result := '64bit';
+ {$ENDIF}
+ if Result = '' then
+ Result := '32bit';
+end;
+
+procedure TPythonVersion.AssignTo(PythonEngine: TPersistent);
+begin
+ if PythonEngine is TPythonEngine then
+ begin
+ TPythonEngine(PythonEngine).UseLastKnownVersion := False;
+ TPythonEngine(PythonEngine).RegVersion := SysVersion;
+ TPythonEngine(PythonEngine).DllName := DLLName;
+ TPythonEngine(PythonEngine).DllPath := DLLPath;
+ TPythonEngine(PythonEngine).APIVersion := ApiVersion;
+ if Is_venv then begin
+ TPythonEngine(PythonEngine).VenvPythonExe := PythonExecutable;
+ TPythonEngine(PythonEngine).SetPythonHome(DLLPath);
+ end else if not IsRegistered or Is_conda then
+ // Not sure why but PythonHome needs to be set even for
+ // registered conda distributions
+ // Note also that for conda distributions to work properly,
+ // you need to add Format('%s;%0:s\Library\bin;', [Version.InstallPath]
+ // to your Windows path if it is not there already.
+ TPythonEngine(PythonEngine).SetPythonHome(InstallPath);
+ end;
+end;
+
+function TPythonVersion.GetApiVersion: integer;
+begin
+ if CompareVersions(SysVersion, '2.4') < 0 then
+ Result := 1013
+ else
+ Result := 1012;
+end;
+
+function TPythonVersion.GetDisplayName: string;
+Var
+ FormatStr: string;
+begin
+ if FDisplayName = '' then
+ begin
+ if Is_conda then
+ FormatStr := 'Conda %s (%s)'
+ else
+ FormatStr := 'Python %s (%s)';
+ if Is_venv then
+ FormatStr := FormatStr + ' -venv'
+ else if Is_virtualenv then
+ FormatStr := FormatStr + ' -virtualenv';
+
+ FDisplayName := Format(FormatStr, [SysVersion, SysArchitecture]);
+ end;
+ Result := FDisplayName;
+end;
+
+function TPythonVersion.GetHelpFile: string;
+var
+ PythonHelpFilePath: string;
+ Res: Integer;
+ SR: TSearchRec;
+begin
+ Result := FHelpFile;
+ // for unregistered Python
+ if (Result = '') and (InstallPath <> '') then
+ begin
+ PythonHelpFilePath := InstallPath + '\Doc\python*.chm';
+ Res := FindFirst(PythonHelpFilePath, faAnyFile, SR);
+ if Res = 0 then
+ Result := InstallPath + '\Doc\' + SR.Name;
+ FindClose(SR);
+ end;
+end;
+
+function TPythonVersion.GetIsPython3K: Boolean;
+begin
+ try
+ Result := StrToInt(SysVersion[1]) >= 3;
+ except
+ Result := False;
+ end;
+end;
+
+function TPythonVersion.GetPythonExecutable: string;
+begin
+ Result := IncludeTrailingPathDelimiter(InstallPath) + 'python.exe';
+ if not FileExists(Result) then begin
+ Result := IncludeTrailingPathDelimiter(InstallPath) + 'Scripts\python.exe';
+ if not FileExists(Result) then Result := '';
+ end;
+end;
+
+function TPythonVersion.GetSysArchitecture: string;
+begin
+ Result := fSysArchitecture;
+ if Result = '' then
+ Result := 'Unknown platform';
+end;
+
+function TPythonVersion.Is_conda: Boolean;
+begin
+ Result := DirectoryExists(IncludeTrailingPathDelimiter(InstallPath) + 'conda-meta');
+end;
+
+function TPythonVersion.Is_venv: Boolean;
+{
+ Check weather this is python venv folder introduced in python 3.5
+ Note: venv is different from virtualenv
+}
+begin
+ Result := not IsRegistered and (InstallPath <> DLLPath) and
+ FileExists(IncludeTrailingPathDelimiter(InstallPath) + 'pyvenv.cfg');
+end;
+
+function TPythonVersion.Is_virtualenv: Boolean;
+begin
+ Result := not IsRegistered and (InstallPath <> DLLPath) and
+ not FileExists(IncludeTrailingPathDelimiter(InstallPath) + 'pyvenv.cfg');
+end;
+
+function CompareVersions(A, B : String) : Integer;
+
+ function GetNextNumber(var Version: string): Integer;
+ var
+ P: Integer;
+ S: string;
+ begin
+ P := Pos('.', Version);
+ if P > 0 then
+ begin
+ S := Copy(Version, 1, P - 1);
+ Version := Copy(Version, P + 1, Length(Version) - P);
+ end
+ else
+ begin
+ S := Version;
+ Version := '';
+ end;
+ Result := StrToIntDef(S, 0)
+ end;
+
+var
+ N1, N2: Integer;
+begin
+ Result := 0;
+ repeat
+ N1 := GetNextNumber(A);
+ N2 := GetNextNumber(B);
+ if N2 > N1 then
+ begin
+ Result := 1;
+ Exit;
+ end
+ else
+ if N2 < N1 then
+ begin
+ Result := -1;
+ Exit;
+ end
+ until (A = '') and (B = '');
+end;
+
+{$IFDEF MSWINDOWS}
+function IsEXEx64(const EXEName: string): Boolean;
+var
+ BinaryType: DWORD;
+begin
+ Result := FileExists(EXEName) and
+ GetBinaryType(PChar(ExeName), Binarytype) and
+ (BinaryType = SCS_64BIT_BINARY);
+end;
+
+function Isx64(const FileName: string): Boolean;
+var
+ Strm : TFileStream;
+ Header: TImageDosHeader;
+ ImageNtHeaders: TImageNtHeaders;
+begin
+ Strm := TFileStream.Create(FileName, fmOpenRead);
+ try
+ Strm.ReadBuffer(Header, SizeOf(Header));
+ if (Header.e_magic <> IMAGE_DOS_SIGNATURE) or (Header._lfanew = 0) then
+ Exit(False);
+ Strm.Position := Header._lfanew;
+ Strm.ReadBuffer(ImageNtHeaders, SizeOf(ImageNtHeaders));
+ if ImageNtHeaders.Signature <> IMAGE_NT_SIGNATURE then
+ Exit(False);
+ Result := ImageNtHeaders.FileHeader.Machine <> IMAGE_FILE_MACHINE_I386;
+ finally
+ Strm.Free;
+ end;
+end;
+
+function GetRegisteredPythonVersion(SysVersion: string;
+ out PythonVersion: TPythonVersion): Boolean;
+ // Python provides for All user and Current user installations
+ // All User installations place the Python DLL in the Windows System directory
+ // and write registry info to HKEY_LOCAL_MACHINE
+ // Current User installations place the DLL in the install path and
+ // the registry info in HKEY_CURRENT_USER.
+ // Hence, for Current user installations we need to try and find the install path
+ // since it may not be on the system path.
+
+ // The above convension was changed in Python 3.5. Now even for all user
+ // installations the dll is located at the InstallPath.
+ // Also from version 3.5 onwards 32 bit version have a suffix -32 e.g. "3.6-32"
+ // See also PEP 514
+
+ function ReadFromRegistry(Root: HKEY; key: string): Boolean;
+ begin
+ Result := False;
+ try
+ with TRegistry.Create(KEY_READ and not KEY_NOTIFY) do
+ try
+ RootKey := Root;
+ if OpenKey(Key + '\InstallPath', False) then begin
+ PythonVersion.InstallPath := ReadString('');
+ if PythonVersion.IsAllUsers and (CompareVersions(SysVersion, '3.5') > 0) then
+ PythonVersion.DLLPath := ''
+ else
+ PythonVersion.DLLPath := PythonVersion.InstallPath;
+ CloseKey;
+ end;
+ Result := (PythonVersion.InstallPath <> '') and
+ DirectoryExists(ExcludeTrailingPathDelimiter(PythonVersion.InstallPath));
+ if not Result then Exit;
+
+ if OpenKey(Key, False) then begin
+ PythonVersion.DisplayName := ReadString('DisplayName');
+ PythonVersion.Version := ReadString('Version');
+ PythonVersion.fSysArchitecture := ReadString('SysArchitecture');
+ CloseKey;
+ end;
+ if OpenKey(Key + '\PythonPath', False) then begin
+ PythonVersion.PythonPath := ReadString('');
+ CloseKey;
+ end;
+ if OpenKey(Key + '\Help\Main Python Documentation', False) then begin
+ PythonVersion.HelpFile := ReadString('');
+ CloseKey;
+ end;
+ finally
+ Free;
+ end;
+ except
+ end;
+
+ end;
+
+var
+ key: string;
+ VersionSuffix: string;
+ APythonVersion: TPythonVersion;
+begin
+ // Initialize PythohVersion
+ Finalize(PythonVersion);
+ FillChar(PythonVersion, SizeOf(TPythonVersion), 0);
+
+ VersionSuffix := '';
+ {$IFDEF CPUX86}
+ if CompareVersions(SysVersion, '3.5') <= 0 then
+ VersionSuffix := '-32';
+ {$ENDIF}
+ key := Format('\Software\Python\PythonCore\%s%s', [SysVersion, VersionSuffix]);
+
+
+ PythonVersion.SysVersion := SysVersion;
+ // First try HKEY_CURRENT_USER as per PEP514
+ PythonVersion.IsAllUsers := False;
+ Result := ReadFromRegistry(HKEY_CURRENT_USER, key);
+
+ //Then try for an all user installation
+ if not Result then begin
+ PythonVersion.IsAllUsers := True;
+ Result := ReadFromRegistry(HKEY_LOCAL_MACHINE, key);
+ if PythonVersion.fSysArchitecture = '' then
+ // for all user installations we can be sure.
+ /// But not for local user installations
+ PythonVersion.fSysArchitecture := PythonVersion.ExpectedArchitecture;
+ end;
+
+ if Result and (PythonVersion.fSysArchitecture = '') then begin
+ // We need to check it is the proper platform
+ Result := PythonVersionFromPath(PythonVersion.InstallPath, APythonVersion);
+ if Result then
+ PythonVersion.fSysArchitecture := PythonVersion.ExpectedArchitecture;
+ end;
+
+ PythonVersion.IsRegistered := Result;
+end;
+
+function GetRegisteredPythonVersions : TPythonVersions;
+Var
+ Count: Integer;
+ I: Integer;
+ PythonVersion : TPythonVersion;
+begin
+ Count := 0;
+ SetLength(Result, High(PYTHON_KNOWN_VERSIONS) - COMPILED_FOR_PYTHON_VERSION_INDEX + 1);
+ for I := High(PYTHON_KNOWN_VERSIONS) downto COMPILED_FOR_PYTHON_VERSION_INDEX do
+ if GetRegisteredPythonVersion(PYTHON_KNOWN_VERSIONS[I].RegVersion, PythonVersion) then
+ begin
+ Result[Count] := PythonVersion;
+ Inc(Count);
+ end;
+ SetLength(Result, Count);
+end;
+
+function GetLatestRegisteredPythonVersion(out PythonVersion: TPythonVersion): Boolean;
+Var
+ I: Integer;
+begin
+ for I := High(PYTHON_KNOWN_VERSIONS) downto COMPILED_FOR_PYTHON_VERSION_INDEX do
+ begin
+ Result := GetRegisteredPythonVersion(PYTHON_KNOWN_VERSIONS[I].RegVersion, PythonVersion);
+ if Result then break;
+ end;
+end;
+
+function PythonVersionFromPath(const Path: string; out PythonVersion: TPythonVersion;
+ AcceptVirtualEnvs: Boolean = True): Boolean;
+
+ function FindPythonDLL(APath : string): string;
+ Var
+ FindFileData: TWIN32FindData;
+ Handle : THandle;
+ DLLFileName: string;
+ begin
+ Result := '';
+ Handle := FindFirstFile(PWideChar(APath+'\python??.dll'), FindFileData);
+ if Handle = INVALID_HANDLE_VALUE then Exit; // not python dll
+ DLLFileName:= FindFileData.cFileName;
+ // skip if python3.dll was found
+ if Length(DLLFileName) <> 12 then FindNextFile(Handle, FindFileData);
+ if Handle = INVALID_HANDLE_VALUE then Exit;
+ Windows.FindClose(Handle);
+ DLLFileName:= FindFileData.cFileName;
+ if Length(DLLFileName) = 12 then
+ Result := DLLFileName;
+ end;
+
+ function GetVenvBasePrefix(InstallPath: string): string;
+ var
+ SL : TStringList;
+ begin
+ SL := TStringList.Create;
+ try
+ try
+ SL.LoadFromFile(IncludeTrailingPathDelimiter(InstallPath)+'pyvenv.cfg');
+ Result := Trim(SL.Values['home']);
+ if Result = '' then
+ Result := Trim(SL.Values['home ']);
+ except
+ end;
+ finally
+ SL.Free;
+ end;
+ end;
+
+Var
+ DLLFileName: string;
+ DLLPath: string;
+ SysVersion: string;
+ BasePrefix: string;
+ I: integer;
+begin
+ Result := False;
+ Finalize(PythonVersion);
+ FillChar(PythonVersion, SizeOf(TPythonVersion), 0);
+ DLLPath := ExcludeTrailingPathDelimiter(Path);
+
+ PythonVersion.InstallPath := DLLPath;
+
+ DLLFileName := FindPythonDLL(DLLPath);
+
+ if (DLLFileName = '') and AcceptVirtualEnvs then begin
+ DLLPath := DLLPath + '\Scripts';
+ DLLFileName := FindPythonDLL(DLLPath);
+ end;
+ if DLLFileName = '' then begin
+ if AcceptVirtualEnvs and PythonVersion.Is_venv then
+ begin
+ BasePrefix := GetVenvBasePrefix(PythonVersion.InstallPath);
+ if (BasePrefix <> '') and PythonVersionFromPath(BasePrefix, PythonVersion, False) then
+ begin
+ // Install path points to venv but the rest of the info is from base_prefix
+ PythonVersion.InstallPath := ExcludeTrailingPathDelimiter(Path);
+ Result := True;
+ end;
+ end;
+ Exit;
+ end;
+
+ // check if same platform
+ try
+ if {$IFDEF CPUX64}not {$ENDIF}IsEXEx64(DLLPath+'\python.exe') then Exit;
+ except
+ Exit;
+ end;
+ PythonVersion.DLLPath := DLLPath;
+
+ SysVersion := GetPythonVersionFromDLLName(DLLFileName);
+
+ PythonVersion.SysVersion := SysVersion;
+ PythonVersion.fSysArchitecture := PythonVersion.ExpectedArchitecture;
+
+ for I := High(PYTHON_KNOWN_VERSIONS) downto COMPILED_FOR_PYTHON_VERSION_INDEX do
+ if PYTHON_KNOWN_VERSIONS[I].RegVersion = SysVersion then begin
+ Result := True;
+ break;
+ end;
+end;
+
+{$ENDIF}
+
+end.
diff --git a/PythonForDelphi/Components/Sources/Core/VarPyth.pas b/PythonForDelphi/Components/Sources/Core/VarPyth.pas
index d3eb8ce1..c83ba94c 100644
--- a/PythonForDelphi/Components/Sources/Core/VarPyth.pas
+++ b/PythonForDelphi/Components/Sources/Core/VarPyth.pas
@@ -126,10 +126,11 @@ TNamedParamDesc = record
{$IFDEF DELPHIXE2_OR_HIGHER}
{$DEFINE USESYSTEMDISPINVOKE} //Delphi 2010 DispInvoke is buggy
+ {$DEFINE PATCHEDSYSTEMDISPINVOKE} //To correct memory leaks
{$ENDIF}
-{$IF DEFINED(FPC_FULLVERSION) and (FPC_FULLVERSION >= 20500)}
- {$DEFINE USESYSTEMDISPINVOKE}
-{$IFEND}
+{.$IF DEFINED(FPC_FULLVERSION) and (FPC_FULLVERSION >= 20500)}
+ {.$DEFINE USESYSTEMDISPINVOKE}
+{.$IFEND}
{ Python variant type handler }
TPythonVariantType = class(TInvokeableVariantType, IVarInstanceReference)
@@ -145,8 +146,8 @@ TPythonVariantType = class(TInvokeableVariantType, IVarInstanceReference)
function VarDataToPythonObject( AVarData : TVarData ) : PPyObject;
procedure PythonObjectToVarData( var Dest : TVarData; AObject : PPyObject; APythonAtomCompatible : Boolean );
procedure PyhonVarDataCreate( var Dest : TVarData; AObject : PPyObject );
- {$IFNDEF USESYSTEMDISPINVOKE}
- procedure DoDispInvoke(Dest: PVarData; const Source: TVarData;
+ {$IFNDEF USESYSTEMDISPINVOKE}
+ procedure DoDispInvoke(Dest: PVarData; var Source: TVarData;
CallDesc: PCallDesc; Params: Pointer); virtual;
function GetPropertyWithArg(var Dest: TVarData; const V: TVarData;
const AName: AnsiString; AArg : TVarData): Boolean; virtual;
@@ -180,10 +181,15 @@ TPythonVariantType = class(TInvokeableVariantType, IVarInstanceReference)
const Arguments: TVarDataArray): Boolean; override;
function GetProperty(var Dest: TVarData; const V: TVarData;
const AName: string): Boolean; override;
- function SetProperty(const V: TVarData; const AName: string;
+ function SetProperty({$IF FPC_FULLVERSION >= 30000}var{$ELSE}const{$ENDIF} V: TVarData; const AName: string;
const Value: TVarData): Boolean; override;
- procedure DispInvoke(Dest: PVarData; const Source: TVarData;
- CallDesc: PCallDesc; Params: Pointer); override;
+ {$IFDEF DELPHIXE7_OR_HIGHER}
+ procedure DispInvoke(Dest: PVarData;
+ [Ref] const Source: TVarData; CallDesc: PCallDesc; Params: Pointer);override;
+ {$ELSE}
+ procedure DispInvoke(Dest: PVarData;
+ {$IF FPC_FULLVERSION >= 30000}var{$ELSE}const{$ENDIF}Source: TVarData; CallDesc: PCallDesc; Params: Pointer);override;
+ {$ENDIF}
end;
var
@@ -931,20 +937,48 @@ procedure SetClearVarToEmptyParam(var V: TVarData);
CPropertyGet = $02;
CPropertySet = $04;
-{$IFDEF USESYSTEMDISPINVOKE}
+{$IFDEF DELPHIXE7_OR_HIGHER}
+procedure TPythonVariantType.DispInvoke(Dest: PVarData;
+ [Ref] const Source: TVarData; CallDesc: PCallDesc; Params: Pointer);
+{$ELSE}
procedure TPythonVariantType.DispInvoke(Dest: PVarData;
- const Source: TVarData; CallDesc: PCallDesc; Params: Pointer);
-{$IFDEF DELPHIXE2}
- // Modified to correct memory leak QC102387
+ {$IF FPC_FULLVERSION >= 30000}var{$ELSE}const{$ENDIF}Source: TVarData; CallDesc: PCallDesc; Params: Pointer);
+{$ENDIF}
+{$IFDEF USESYSTEMDISPINVOKE}
+{$IFDEF PATCHEDSYSTEMDISPINVOKE}
+ // Modified to correct memory leak QC102387 / RSP-23093
+ procedure PatchedFinalizeDispatchInvokeArgs(CallDesc: PCallDesc; const Args: TVarDataArray; OrderLTR : Boolean);
+ const
+ atByRef = $80;
+ var
+ I: Integer;
+ ArgType: Byte;
+ PVarParm: PVarData;
+ VType: TVarType;
+ begin
+ for I := 0 to CallDesc^.ArgCount-1 do
+ begin
+ ArgType := CallDesc^.ArgTypes[I];
+
+ if OrderLTR then
+ PVarParm := @Args[I]
+ else
+ PVarParm := @Args[CallDesc^.ArgCount-I-1];
+
+ VType := PVarParm.VType;
+
+ // Only ByVal Variant or Array parameters have been copied and need to be released
+ // Strings have been released via the use of the TStringRefList parameter to GetDispatchInvokeArgs
+ // !!Modified to prevent memory leaks!! RSP-23093
+ if ((ArgType and atByRef) <> atByRef) and ((ArgType = varVariant) or ((VType and varArray) = varArray)) then
+ VarClear(PVariant(PVarParm)^);
+ end;
+ end;
+
procedure PatchedDispInvoke(Dest: PVarData;
const Source: TVarData; CallDesc: PCallDesc; Params: Pointer);
type
- PParamRec = ^TParamRec;
- TParamRec = array[0..3] of LongInt;
- TStringDesc = record
- BStr: WideString;
- PStr: PAnsiString;
- end;
+ PStringRefList = ^TStringRefList;
const
CDoMethod = $01;
CPropertyGet = $02;
@@ -954,67 +988,75 @@ TStringDesc = record
LIdent: string;
LTemp: TVarData;
VarParams : TVarDataArray;
- Strings: TStringRefList;
+ Strings: array of TStringRef;
+ PIdent: PByte;
begin
// Grab the identifier
LArgCount := CallDesc^.ArgCount;
- LIdent := FixupIdent(AnsiString(PAnsiChar(@CallDesc^.ArgTypes[LArgCount])));
-
- FillChar(Strings, SizeOf(Strings), 0);
- VarParams := GetDispatchInvokeArgs(CallDesc, Params, Strings, true);
-
- // What type of invoke is this?
- case CallDesc^.CallType of
- CDoMethod:
- // procedure with N arguments
- if Dest = nil then
- begin
- if not DoProcedure(Source, LIdent, VarParams) then
+ PIdent := @CallDesc^.ArgTypes[LArgCount];
+ LIdent := FixupIdent( UTF8ToString(MarshaledAString(PIdent)) );
+ if LArgCount > 0 then begin
+ SetLength(Strings, LArgCount);
+ FillChar(Strings[0], SizeOf(TStringRef)*LArgCount, 0);
+ VarParams := GetDispatchInvokeArgs(CallDesc, Params, PStringRefList(Strings)^, true);
+ end;
+ try
+ // What type of invoke is this?
+ case CallDesc^.CallType of
+ CDoMethod:
+ // procedure with N arguments
+ if Dest = nil then
begin
+ if not DoProcedure(Source, LIdent, VarParams) then
+ begin
+
+ // ok maybe its a function but first we must make room for a result
+ VarDataInit(LTemp);
+ try
+
+ // notate that the destination shouldn't be bothered with
+ // functions can still return stuff, we just do this so they
+ // can tell that they don't need to if they don't want to
+ SetClearVarToEmptyParam(LTemp);
+
+ // ok lets try for that function
+ if not DoFunction(LTemp, Source, LIdent, VarParams) then
+ RaiseDispError;
+ finally
+ VarDataClear(LTemp);
+ end;
+ end
+ end
- // ok maybe its a function but first we must make room for a result
- VarDataInit(LTemp);
- try
-
- // notate that the destination shouldn't be bothered with
- // functions can still return stuff, we just do this so they
- // can tell that they don't need to if they don't want to
- SetClearVarToEmptyParam(LTemp);
-
- // ok lets try for that function
- if not DoFunction(LTemp, Source, LIdent, VarParams) then
- RaiseDispError;
- finally
- VarDataClear(LTemp);
- end;
+ // property get or function with 0 argument
+ else if LArgCount = 0 then
+ begin
+ if not GetProperty(Dest^, Source, LIdent) and
+ not DoFunction(Dest^, Source, LIdent, VarParams) then
+ RaiseDispError;
end
- end
- // property get or function with 0 argument
- else if LArgCount = 0 then
- begin
- if not GetProperty(Dest^, Source, LIdent) and
- not DoFunction(Dest^, Source, LIdent, VarParams) then
+ // function with N arguments
+ else if not DoFunction(Dest^, Source, LIdent, VarParams) then
RaiseDispError;
- end
- // function with N arguments
- else if not DoFunction(Dest^, Source, LIdent, VarParams) then
- RaiseDispError;
+ CPropertyGet:
+ if not ((Dest <> nil) and // there must be a dest
+ (LArgCount = 0) and // only no args
+ GetProperty(Dest^, Source, LIdent)) then // get op be valid
+ RaiseDispError;
- CPropertyGet:
- if not ((Dest <> nil) and // there must be a dest
- (LArgCount = 0) and // only no args
- GetProperty(Dest^, Source, LIdent)) then // get op be valid
- RaiseDispError;
+ CPropertySet:
+ if not ((Dest = nil) and // there can't be a dest
+ (LArgCount = 1) and // can only be one arg
+ SetProperty(Source, LIdent, VarParams[0])) then // set op be valid
+ RaiseDispError;
+ else
+ RaiseDispError;
+ end;
- CPropertySet:
- if not ((Dest = nil) and // there can't be a dest
- (LArgCount = 1) and // can only be one arg
- SetProperty(Source, LIdent, VarParams[0])) then // set op be valid
- RaiseDispError;
- else
- RaiseDispError;
+ finally
+ PatchedFinalizeDispatchInvokeArgs(CallDesc, VarParams, true);
end;
for I := 0 to Length(Strings) - 1 do
@@ -1023,13 +1065,12 @@ TStringDesc = record
Break;
if Strings[I].Ansi <> nil then
Strings[I].Ansi^ := AnsiString(Strings[I].Wide)
- else if Strings[I].Unicode <> nil then
- Strings[I].Unicode^ := UnicodeString(Strings[I].Wide)
+ else
+ if Strings[I].Unicode <> nil then
+ Strings[I].Unicode^ := UnicodeString(Strings[I].Wide)
end;
- for I := Low(VarParams) to High(VarParams) do
- VarDataClear(VarParams[I]);
end;
-{$ENDIF DELPHIXE2}
+{$ENDIF PATCHEDSYSTEMDISPINVOKE}
procedure GetNamedParams;
var
@@ -1042,7 +1083,7 @@ TStringDesc = record
SetLength(fNamedParams, CallDesc^.NamedArgCount);
// Skip function Name
for I := 0 to CallDesc^.NamedArgCount - 1 do begin
- LNamePtr := LNamePtr + Succ(StrLen(LNamePtr));
+ LNamePtr := LNamePtr + Succ(Length(LNamePtr));
fNamedParams[I].Index := I+LNamedArgStart;
fNamedParams[I].Name := AnsiString(LNamePtr);
end;
@@ -1056,31 +1097,32 @@ TStringDesc = record
if (CallDesc^.CallType = CPropertyGet) and (CallDesc^.ArgCount = 1) then begin
NewCallDesc := CallDesc^;
NewCallDesc.CallType := CDoMethod;
- {$IFDEF DELPHIXE2}
+ {$IFDEF PATCHEDSYSTEMDISPINVOKE}
PatchedDispInvoke(Dest, Source, @NewCallDesc, Params);
- {$ELSE DELPHIXE2}
+ {$ELSE PATCHEDSYSTEMDISPINVOKE}
inherited DispInvoke(Dest, Source, @NewCallDesc, Params);
- {$ENDIF DELPHIXE2}
+ {$ENDIF PATCHEDSYSTEMDISPINVOKE}
end else
- {$IFDEF DELPHIXE2}
+ {$IFDEF PATCHEDSYSTEMDISPINVOKE}
PatchedDispInvoke(Dest, Source, CallDesc, Params);
- {$ELSE DELPHIXE2}
+ {$ELSE PATCHEDSYSTEMDISPINVOKE}
inherited;
- {$ENDIF DELPHIXE2}
+ {$ENDIF PATCHEDSYSTEMDISPINVOKE}
finally
if CallDesc^.NamedArgCount > 0 then SetLength(fNamedParams, 0);
end;
end;
{$ELSE USESYSTEMDISPINVOKE}
-procedure TPythonVariantType.DispInvoke(Dest: PVarData;
- const Source: TVarData; CallDesc: PCallDesc; Params: Pointer);
+var
+ aSource: tvardata;
begin
- DoDispInvoke(Dest, Source, CallDesc, Params);
+ aSource := Source;
+ DoDispInvoke(Dest, aSource, CallDesc, Params);
end;
procedure TPythonVariantType.DoDispInvoke(Dest: PVarData;
- const Source: TVarData; CallDesc: PCallDesc; Params: Pointer);
+ var Source: TVarData; CallDesc: PCallDesc; Params: Pointer);
type
PParamRec = ^TParamRec;
TParamRec = array[0..3] of LongInt;
@@ -1340,7 +1382,7 @@ function TPythonVariantType.GetPropertyWithArg(var Dest: TVarData;
// So: myList[0] won't work, but myObj.MyList[0] will!!!
if PySequence_Check(_prop) <> 0 then
begin
- _result := PySequence_GetItem(_prop, Variant(AArg));
+ _result := PySequence_GetItem(_prop, Integer(Variant(AArg)));
CheckError;
end; // of if
end; // of if
@@ -1419,7 +1461,6 @@ function TPythonVariantType.EvalPython(const V: TVarData;
_key, _value : PPyObject;
_result : Integer;
begin
- Result := nil;
with GetPythonEngine do
begin
PyErr_Clear;
@@ -1430,21 +1471,21 @@ function TPythonVariantType.EvalPython(const V: TVarData;
_value := VarDataToPythonObject(AValue);
if not Assigned(_value) then
raise Exception.Create(SCantConvertValueToPythonObject);
- if PyList_Check(AObject) then
- _result := PyList_SetItem( AObject, Variant(AKey), _value )
- else if PyTuple_Check(AObject) then
- _result := PyTuple_SetItem( AObject, Variant(AKey), _value )
- else
- try
- if PySequence_Check(AObject) <> 0 then
- _result := PySequence_SetItem(AObject, Variant(AKey), _value)
- else
- _result := PyObject_SetItem( AObject, _key, _value );
- finally
- Py_XDecRef(_value);
- end; // of try
- CheckError;
- Result := PyInt_FromLong(_result);
+ if PyList_Check(AObject) then
+ _result := PyList_SetItem( AObject, Integer(Variant(AKey)), _value )
+ else if PyTuple_Check(AObject) then
+ _result := PyTuple_SetItem( AObject, Integer(Variant(AKey)), _value )
+ else
+ try
+ if PySequence_Check(AObject) <> 0 then
+ _result := PySequence_SetItem(AObject, Integer(Variant(AKey)), _value)
+ else
+ _result := PyObject_SetItem( AObject, _key, _value );
+ finally
+ Py_XDecRef(_value);
+ end; // of try
+ CheckError;
+ Result := PyInt_FromLong(_result);
finally
Py_XDecRef(_key);
end; // of try
@@ -1855,7 +1896,7 @@ function TPythonVariantType.RightPromotion(const V: TVarData;
Result := False;
end;
-function TPythonVariantType.SetProperty(const V: TVarData;
+function TPythonVariantType.SetProperty({$IF FPC_FULLVERSION >= 30000}var{$ELSE}const{$ENDIF} V: TVarData;
const AName: string; const Value: TVarData): Boolean;
var
_newValue : PPyObject;
@@ -2189,7 +2230,7 @@ function TPythonData.GetAsAnsiString: AnsiString;
if Assigned(PyObject) and GetPythonEngine.PyString_CheckExact(PyObject) then
Result := GetPythonEngine.PyString_AsString(PyObject)
else
- result := GetAsString;
+ Result := AnsiString(GetAsString);
end;
function TPythonData.GetAsString: String;
diff --git a/PythonForDelphi/Components/Sources/Core/WrapDelphi.pas b/PythonForDelphi/Components/Sources/Core/WrapDelphi.pas
index 5e632be7..71194c96 100644
--- a/PythonForDelphi/Components/Sources/Core/WrapDelphi.pas
+++ b/PythonForDelphi/Components/Sources/Core/WrapDelphi.pas
@@ -1,4 +1,4 @@
-(*-----------------------------------------------------------------------------
+(*-----------------------------------------------------------------------------
Unit Name: WrapDelphi
Author: Kiriakos Vlahos
Date: 24-Feb-2005
@@ -8,7 +8,7 @@
Contributors:
Morgan Martinet (mmm@free.fr)
- Features:
+ Features: P
Check our Wiki at: http://py4d.pbwiki.com/.
Published properties and methods compiled with {$METHODINFO ON} are
@@ -66,7 +66,7 @@
def handle_btnAdd_OnClick(self, Sender):
self.ListBox1.Items.Add(self.Edit1.Text)
- There is also a helper method named SetProps at the TPyDelphiObject level,
+ There is also a helper method named SetProps at the TPyDelphiObject level,
allowing any wrapped object to do:
button.SetProps(Left=10, Top=20, Caption='Clickme!)
@@ -284,17 +284,26 @@
1.11 14-Mar-2006 Morgan Martinet
- - Added methods Repaint and Invalidate to the TControl wrapper
+ - Added methods Repaint and Invalidate to the TControl wrapper
- Fixed bug when running WrapDelphi without Assertions in the compiler options
thanks to a report from Dominique Whali
- - made fields fDefaultIterType and fDefaultContainerType of TPyDelphiWrapper protected
-
+ - made fields fDefaultIterType and fDefaultContainerType of TPyDelphiWrapper protected
+
+ Oct-2019 PyScripter
+ - Major refactoring and clean-up
+ - In Delhi version newer than XE, enhanced RTTI is used to provide access to
+ methods, fields and properties. So in most cases you no longer need to
+ create wrapping classes.
+ - __published__ property was replaced with the implementation of the __dir__()
+ method, so that you can do for example dir(MainForm) to inspect the
+ methods, fields and properties of MainForm.
+ - Demo 31 has been updated to test/showcase some of the new features.
+
TODO:
+ - Implement RTTI Fields
- Extend SetProps: if property receiving the value is a TStrings and the value a sequence,
then assign the sequence content to the TStrings.
- - what do we do if the Delphi code raises an exception when invoked by Python?
- Shouldn't we resurface it as a Python exception?
- can we debug the Python code executed from a triggered event? Presently not, as we directly ask Python
to execute a specific callable...
- Create a simple app that just initializes Python and executes a script? To avoid having a console...
@@ -322,8 +331,12 @@ interface
uses
SysUtils, Classes, PythonEngine, TypInfo,
Variants,
-{$IFNDEF FPC}
+ {$IFNDEF FPC}
+{$IFDEF EXTENDED_RTTI}
+ Rtti,
+{$ELSE}
ObjAuto,
+{$ENDIF}
{$ENDIF}
Contnrs;
@@ -356,7 +369,7 @@ TPyDelphiWrapper = class;
TMyClass = class(TInterfacedObject, IFreeNotification)
private
- fFreeNotifImpl : TFreeNotificationImpl;
+ fFreeNotifImpl : IFreeNotification;
protected
property FreeNotifImpl : IFreeNotification read fFreeNotifImpl implements IFreeNotification;
public
@@ -524,14 +537,11 @@ TPyDelphiObject = class (TPyInterfacedObject, IFreeNotificationSubscriber)
function ToTuple_Wrapper(args : PPyObject) : PPyObject; cdecl;
function ToList_Wrapper(args : PPyObject) : PPyObject; cdecl;
function SetProps(args, keywords : PPyObject) : PPyObject; cdecl;
+ function Dir_Wrapper(args: PPyObject): PPyObject; cdecl;
// Exposed Getters
function Get_ClassName(Acontext : Pointer) : PPyObject; cdecl;
function Get_Owned(Acontext : Pointer) : PPyObject; cdecl;
function Get_Bound(Acontext : Pointer) : PPyObject; cdecl;
- function Get_Published(AContext : Pointer) : PPyObject; cdecl;
- function Dummy_Getter(AContext : Pointer) : PPyObject; cdecl;
- // Exposed Setters
- function Dummy_Setter(AValue : PPyObject; AContext : Pointer): Integer; cdecl;
// implementation of interface IFreeNotificationSubscriber
procedure Notify(ADeletedObject : TObject);
public
@@ -545,7 +555,6 @@ TPyDelphiObject = class (TPyInterfacedObject, IFreeNotificationSubscriber)
function SetAttrO( key, value: PPyObject) : Integer; override;
// Objects are equal when they refer to the same DelphiObject
function Compare( obj: PPyObject) : Integer; override;
- function RichCompare( obj : PPyObject; Op : TRichComparisonOpcode) : PPyObject; override;
function Repr : PPyObject; override;
// automatic iterator support when the wrapper implements IContainerAccessProvider
function Iter : PPyObject; override;
@@ -590,7 +599,6 @@ TPyDelphiVarParameter = class(TPyObject)
public
destructor Destroy; override;
- function Compare( obj: PPyObject) : Integer; override;
function RichCompare( obj : PPyObject; Op : TRichComparisonOpcode) : PPyObject; override;
function Repr : PPyObject; override;
@@ -644,7 +652,8 @@ TEventHandlers = class
procedure Delete(AIndex : Integer);
function GetCallable(AComponent : TObject; APropInfo : PPropInfo) : PPyObject; overload;
function GetCallable(AComponent : TObject; const APropName : String) : PPyObject; overload;
- function Link(AComponent : TObject; APropInfo : PPropInfo; ACallable : PPyObject) : Boolean;
+ function Link(AComponent : TObject; APropInfo : PPropInfo;
+ ACallable : PPyObject; out ErrMsg: string) : Boolean;
function IndexOf(AComponent : TObject; APropInfo : PPropInfo) : Integer;
procedure RegisterHandler(AEventHandlerClass : TEventHandlerClass);
function Unlink(AComponent : TObject; APropInfo : PPropInfo) : Boolean;
@@ -738,9 +747,9 @@ TRegisteredUnits = class
{
The main component of this unit.
- Method TObjectToPyObject wraps Delphi objects into Python objects
- Method RegisterDelphiClass can be used to extend its functionality.
- Method RegisterEventHandler can be used to add event handling functionality
+ Method Wrap wraps Delphi objects into Python objects
+ Method RegisterDelphiWrapper can be used to extend its functionality.
+ Method EventHandlers.RegisterHandler can be used to add event handling functionality
}
{$IF not Defined(FPC) and (CompilerVersion >= 23)}
[ComponentPlatformsAttribute(pidWin32 or pidWin64)]
@@ -825,7 +834,8 @@ TPyDelphiWrapper = class(TEngineClient, IFreeNotificationSubscriber)
function SetToPython(ATypeInfo: PTypeInfo; AValue : Integer) : PPyObject; overload;
function SetToPython(APropInfo: PPropInfo; AValue : Integer) : PPyObject; overload;
function SetToPython(AInstance: TObject; APropInfo: PPropInfo) : PPyObject; overload;
- function PythonToSet(ASet : PPyObject; APropInfo: PPropInfo) : Integer;
+ function PythonToSet(APropInfo: PPropInfo; ASet : PPyObject) : Integer; overload;
+ function PythonToSet(ATypeInfo: PTypeInfo; ASet : PPyObject) : Integer; overload;
function SupportsFreeNotification(AObject : TObject) : Boolean;
procedure RaiseNotifyEvent(PyDelphiWrapper : TPyDelphiWrapper; ACallable : PPyObject; Sender: TObject);
@@ -835,8 +845,45 @@ implementation
Math,
RTLConsts;
+resourcestring
+ rs_ErrCheckIndex = '%s "%d" out of range';
+ rs_ErrCheckInt = '%s receives only integer values';
+ rs_ErrCheckStr = '%s receives only string values';
+ rs_ErrCheckCallable = '%s accepts only None or Callable values';
+ rs_ErrCheckEnum = 'Enum %s accepts values between %d and %d. Received %d.';
+ rs_ErrCheckObjOfType = '%s receives only Delphi objects of type %s';
+ rs_ErrCheckObj = '%s receives only Delphi objects';
+ rs_ErrSqAss = 'Container %s does not support indexed write (f[i] = x)';
+ rs_ErrSqContains = 'Container %s does not support the Contains protocol';
+ rs_ErrCheckBound = 'Delphi wrapper %s is not bound';
+ rs_ErrFree = 'The Delphi object cannot be freed, since it is not Owned';
+ rs_ErrSequence = 'Wrapper %s does not support sequences';
+ rs_ErrInvalidArgs = '"%s" called with invalid arguments.'#$A'Error: %s';
+ rs_ErrInvalidRet = 'Call "%s" returned a value that could not be coverted to Python'#$A'Error: %s';
+ rs_IncompatibleArguments = 'Could not find a method with compatible arguments';
+ rs_ErrAttrGet = 'Error in getting property "%s".'#$A'Error: %s';
+ rs_UnknownAttribute = 'Unknown attribute';
+ rs_ErrIterSupport = 'Wrapper %s does not support iterators';
+ rs_ErrAttrSetr = 'Error in setting property %s'#$A'Error: %s';
+ rs_IncompatibleClasses = 'Incompatible classes';
+ rs_NotPublished = 'Event handling is available only for published properties';
+ rs_ExpectedObject = 'Expected a Delphi object';
+ rs_InvalidClass = 'Invalid class';
+ rs_ErrEventNotReg = 'No Registered EventHandler for events of type "%s';
+ rs_ErrEventNoSuport = 'Class %s does not support events because it must '+
+ 'either inherit from TComponent or implement interface IFreeNotification';
+ rs_ErrEventExpectCallable = 'You can only assign a callable to method property "%s"';
+ rs_NotWritable = 'The class members is not writable';
+ rs_NotReadable = 'The class member is not readable';
+ rs_NoAccess = 'Private and protected class members cannot be accessed';
+ rs_ErrValueToPython = 'Unsupported conversion from TValue to Python value';
+ rs_ErrPythonToValue = 'Unsupported conversion from Python value to TValue';
+ rs_ErrNoTypeInfo = 'TypeInfo is not available';
+ rs_ErrUnexpected = 'Unexpected error';
+
var
gRegisteredUnits : TRegisteredUnits;
+
function RegisteredUnits : TRegisteredUnits;
begin
if not Assigned(gRegisteredUnits) then
@@ -844,21 +891,151 @@ function RegisteredUnits : TRegisteredUnits;
Result := gRegisteredUnits;
end;
-var
- gNames : TStringList;
+procedure Register;
+begin
+ RegisterComponents('Python', [TPyDelphiWrapper]);
+end;
+
+{ Helper functions }
-function AddName(const AName : String) : PAnsiChar;
+{$IFDEF EXTENDED_RTTI}
+function SimpleValueToPython(const Value: TValue; out ErrMsg: string): PPyObject;
begin
- gNames.Add(AName);
- Result := PAnsiChar(AnsiString(gNames[gNames.Count-1]));
+ Result := nil;
+ if Value.IsEmpty then begin
+ Result := GetPythonEngine.ReturnNone;
+ Exit;
+ end;
+ try
+ case Value.TypeInfo^.Kind of
+ tkUnknown: Result := GetPythonEngine.ReturnNone;
+ tkInteger, tkChar, tkFloat,
+ tkString, tkWChar, tkLString,
+ tkWString, tkUString, tkInt64,
+ tkVariant:
+ Result := GetPythonEngine.VariantAsPyObject(Value.AsVariant);
+ tkEnumeration:
+ begin
+ if Value.TypeInfo = TypeInfo(Boolean) then
+ with GetPythonEngine do begin
+ if Value.AsBoolean then
+ Result := PPyObject(Py_True)
+ else
+ Result := PPyObject(Py_False);
+ Py_XIncRef(Result);
+ end
+ else
+ Result := GetPythonEngine.PyString_FromDelphiString(GetEnumName(Value.TypeInfo,
+ PInteger(Value.GetReferenceToRawData)^));
+ end;
+ tkSet:
+ begin
+ Result := SetToPython(Value.TypeData.CompType^,
+ PInteger(Value.GetReferenceToRawData)^);
+ end;
+ tkClass, tkMethod, tkArray,
+ tkRecord, tkInterface, tkDynArray,
+ tkClassRef, tkPointer, tkProcedure:
+ ErrMsg := rs_ErrValueToPython;
+ else
+ ErrMsg := rs_ErrUnexpected;
+ end;
+ except
+ on E: Exception do begin
+ Result := nil;
+ ErrMsg := E.Message;
+ end;
+ end;
end;
-procedure Register;
+function SimplePythonToValue(PyValue: PPyObject; TypeInfo: PTypeInfo;
+ out Value: TValue; out ErrMsg: string): Boolean;
+Var
+ S: string;
+ I : integer;
+ V : TValue;
begin
- RegisterComponents('Python', [TPyDelphiWrapper]);
+ Result := False;
+ if TypeInfo = nil then begin
+ ErrMsg := rs_ErrNoTypeInfo;
+ Exit;
+ end;
+ try
+ case TypeInfo^.Kind of
+ tkUnknown:
+ if PyValue = GetPythonEngine.Py_None then
+ begin
+ Value := TValue.Empty;
+ Result := True;
+ end
+ else
+ ErrMsg := rs_ErrPythonToValue;
+ tkString, tkWString, tkUString,
+ tkLString, tkChar, tkWChar:
+ begin
+ V := GetPythonEngine.PyObjectAsString(PyValue);
+ Value := V.Cast(TypeInfo);
+ Result := True;
+ end;
+ tkInteger, tkFloat, tkInt64,
+ tkVariant:
+ begin
+ V := TValue.FromVariant(GetPythonEngine.PyObjectAsVariant(PyValue));
+ Value := V.Cast(TypeInfo);
+ Result := True;
+ end;
+ tkEnumeration:
+ begin
+ S := GetPythonEngine.PyString_AsDelphiString(PyValue);
+ I := GetEnumValue(TypeInfo, S);
+ Value := TValue.FromOrdinal(TypeInfo, I);
+ Result := True;
+ end;
+ tkSet:
+ begin
+ I := PythonToSet(TypeInfo, PyValue);
+ TValue.Make(@I, TypeInfo, Value);
+ Result := True;
+ end;
+ tkClass, tkMethod, tkArray,
+ tkRecord, tkInterface, tkDynArray,
+ tkClassRef, tkPointer, tkProcedure:
+ ErrMsg := rs_ErrPythonToValue;
+ else
+ ErrMsg := rs_ErrUnexpected;
+ end;
+ except
+ on E: Exception do begin
+ Result := False;
+ ErrMsg := E.Message;
+ end;
+ end
end;
+{$ENDIF}
-{ Helper functions }
+function ValidateClassProperty(PyValue: PPyObject; TypeInfo: PTypeInfo;
+ out Obj: TObject; out ErrMsg: string): Boolean;
+var
+ PyObject : TPyObject;
+begin
+ Result := False;
+ if IsDelphiObject(PyValue) then
+ begin
+ PyObject := PythonToDelphi(PyValue);
+ if PyObject is TPyDelphiObject then
+ begin
+ Obj := TPyDelphiObject(PyObject).DelphiObject;
+ if Obj.ClassType.InheritsFrom(GetTypeData(TypeInfo).ClassType) then
+ Result := True
+ else
+ ErrMsg := rs_IncompatibleClasses;
+ end
+ else
+ ErrMsg := rs_ExpectedObject;
+ end
+ else
+ ErrMsg := rs_ExpectedObject;
+end;
function CheckIndex(AIndex, ACount : Integer; const AIndexName : String = 'Index') : Boolean;
begin
@@ -866,8 +1043,8 @@ function CheckIndex(AIndex, ACount : Integer; const AIndexName : String = 'Index
with GetPythonEngine do
begin
Result := False;
- PyErr_SetString (PyExc_IndexError^,
- PAnsiChar(AnsiString(Format('%s "%d" out of range',[AIndexName, AIndex]))));
+ PyErr_SetObject (PyExc_IndexError^, PyString_FromDelphiString(
+ Format(rs_ErrCheckIndex,[AIndexName, AIndex])));
end
else
Result := True;
@@ -884,8 +1061,8 @@ function CheckIntAttribute(AAttribute : PPyObject; const AAttributeName : String
begin
Result := False;
with GetPythonEngine do
- PyErr_SetString (PyExc_AttributeError^,
- PAnsiChar(AnsiString(Format('%s receives only integer values', [AAttributeName]))));
+ PyErr_SetObject (PyExc_AttributeError^,
+ PyString_FromDelphiString(Format(rs_ErrCheckInt, [AAttributeName])));
end;
end;
@@ -906,8 +1083,8 @@ function CheckStrAttribute(AAttribute : PPyObject; const AAttributeName : String
begin
Result := False;
with GetPythonEngine do
- PyErr_SetString (PyExc_AttributeError^,
- PAnsiChar(AnsiString(Format('%s receives only string values', [AAttributeName]))));
+ PyErr_SetObject (PyExc_AttributeError^,
+ PyString_FromDelphiString(Format(rs_ErrCheckStr, [AAttributeName])));
end;
end;
@@ -919,8 +1096,8 @@ function CheckCallableAttribute(AAttribute : PPyObject; const AAttributeName : S
begin
Result := False;
with GetPythonEngine do
- PyErr_SetString (PyExc_AttributeError^,
- PAnsiChar(AnsiString(Format('%s accepts only None or Callable values', [AAttributeName]))));
+ PyErr_SetObject (PyExc_AttributeError^,
+ PyString_FromDelphiString(Format(rs_ErrCheckCallable, [AAttributeName])));
end;
end;
@@ -932,8 +1109,9 @@ function CheckEnum(const AEnumName : String; AValue, AMinValue, AMaxValue : Int
begin
Result := False;
with GetPythonEngine do
- PyErr_SetString (PyExc_AttributeError^,
- PAnsiChar(AnsiString(Format('Enum %s accepts values between %d and %d. Received %d.', [AEnumName, AMinValue, AMaxValue, AValue]))));
+ PyErr_SetObject (PyExc_AttributeError^,
+ PyString_FromDelphiString(Format(rs_ErrCheckEnum,
+ [AEnumName, AMinValue, AMaxValue, AValue])));
end;
end;
@@ -956,8 +1134,8 @@ function CheckObjAttribute(AAttribute : PPyObject; const AAttributeName : String
begin
Result := False;
with GetPythonEngine do
- PyErr_SetString (PyExc_AttributeError^,
- PAnsiChar(AnsiString(Format('%s receives only Delphi objects of type %s', [AAttributeName, AExpectedClass.ClassName]))));
+ PyErr_SetObject (PyExc_AttributeError^,
+ PyString_FromDelphiString(Format(rs_ErrCheckObjOfType, [AAttributeName, AExpectedClass.ClassName])));
end
else
begin
@@ -969,8 +1147,8 @@ function CheckObjAttribute(AAttribute : PPyObject; const AAttributeName : String
begin
Result := False;
with GetPythonEngine do
- PyErr_SetString (PyExc_AttributeError^,
- PAnsiChar(AnsiString(Format('%s receives only Delphi objects', [AAttributeName]))));
+ PyErr_SetObject (PyExc_AttributeError^,
+ PyString_FromDelphiString(Format(rs_ErrCheckObj, [AAttributeName])));
end;
end;
@@ -1048,7 +1226,7 @@ function SetToPython(ATypeInfo: PTypeInfo; AValue : Integer) : PPyObject; overlo
for I := 0 to SizeOf(Integer) * 8 - 1 do
if I in S then
begin
- _name := GetPythonEngine.PyString_FromString(PAnsiChar(AnsiString(GetEnumName(ATypeInfo, I))));
+ _name := GetPythonEngine.PyString_FromDelphiString(GetEnumName(ATypeInfo, I));
GetPythonEngine.PyList_Append(Result, _name);
GetPythonEngine.Py_XDecRef(_name);
end;
@@ -1068,14 +1246,13 @@ function SetToPython(AInstance: TObject; APropInfo: PPropInfo) : PPyObject; over
Result := SetToPython(APropInfo, GetOrdProp(AInstance, APropInfo));
end;
-function PythonToSet(ASet : PPyObject; APropInfo: PPropInfo) : Integer;
+function PythonToSet(ATypeInfo: PTypeInfo; ASet : PPyObject) : Integer; overload;
var
i : Integer;
EnumObj: PPyObject;
EnumName: string;
EnumValue: Longint;
EnumInfo: PTypeInfo;
-
begin
Result := 0;
with GetPythonEngine do
@@ -1083,9 +1260,9 @@ function PythonToSet(ASet : PPyObject; APropInfo: PPropInfo) : Integer;
Assert(PySequence_Check(ASet) <> 0, 'PythonToSet expects a Python sequence as first parameter');
{$IFDEF FPC}
- EnumInfo := GetTypeData(APropInfo^.PropType)^.CompType;
+ EnumInfo := GetTypeData(ATypeInfo)^.CompType;
{$ELSE FPC}
- EnumInfo := GetTypeData(APropInfo^.PropType^)^.CompType^;
+ EnumInfo := GetTypeData(ATypeInfo)^.CompType^;
{$ENDIF FPC}
for i := 0 to PySequence_Length(ASet)-1 do
begin
@@ -1103,15 +1280,32 @@ function PythonToSet(ASet : PPyObject; APropInfo: PPropInfo) : Integer;
end;
end;
+function PythonToSet(APropInfo: PPropInfo; ASet : PPyObject) : Integer; overload;
+begin
+ {$IFDEF FPC}
+ Result := PythonToSet(APropInfo^.PropType, ASet);
+ {$ELSE FPC}
+ Result := PythonToSet(APropInfo^.PropType^, ASet);
+ {$ENDIF FPC}
+end;
+
{$IFDEF FPC}
function GetPropValue(Instance: TObject; PropInfo: PPropInfo): Variant;
begin
+ {$IF FPC_FULLVERSION<=30000}
Result := Variants.GetPropValue(Instance, PropInfo^.Name);
+ {$ELSE}
+ Result := Variants.GetPropValue(Instance, PropInfo, False);
+ {$ENDIF}
end;
procedure SetPropValue(Instance: TObject; PropInfo: PPropInfo; const Value: Variant);
begin
+ {$IF FPC_FULLVERSION<=30000}
Variants.SetPropValue(Instance, PropInfo^.Name, Value);
+ {$ELSE}
+ Variants.SetPropValue(Instance, PropInfo, Value);
+ {$ENDIF}
end;
{$ENDIF}
@@ -1136,7 +1330,12 @@ TRegisteredClass = class
TPyDelphiMethodObject = class (TPyObject)
public
DelphiObject: TObject;
+ {$IFDEF EXTENDED_RTTI}
+ fDelphiWrapper : TPyDelphiWrapper;
+ MethName: string;
+ {$ELSE}
MethodInfo : TMethodInfoHeader;
+ {$ENDIF}
function Call( ob1, ob2 : PPyObject) : PPyObject; override;
function Repr : PPyObject; override;
class procedure SetupType( PythonType : TPythonType ); override;
@@ -1258,8 +1457,8 @@ function TPyDelphiContainer.Iter: PPyObject;
function TPyDelphiContainer.Repr: PPyObject;
begin
with GetPythonEngine do
- Result := PyString_FromString( PAnsiChar(AnsiString(Format('',
- [ContainerAccess.Name, NativeInt(Self)]))) );
+ Result := PyString_FromDelphiString( Format('',
+ [ContainerAccess.Name, NativeInt(Self)]) );
end;
procedure TPyDelphiContainer.Setup(APyDelphiWrapper : TPyDelphiWrapper;
@@ -1299,7 +1498,8 @@ function TPyDelphiContainer.SqAssItem(idx: NativeInt;
begin
Result := -1;
with GetPythonEngine do
- PyErr_SetString( PyExc_SystemError^, PAnsiChar(AnsiString(Format('Container %s does not support indexed write (f[i] = x)', [fContainerAccess.Name]))) );
+ PyErr_SetObject( PyExc_SystemError^,
+ PyString_FromDelphiString(Format(rs_ErrSqAss, [fContainerAccess.Name])) );
end;
end;
@@ -1316,7 +1516,8 @@ function TPyDelphiContainer.SqContains(obj: PPyObject): integer;
begin
Result := -1;
with GetPythonEngine do
- PyErr_SetString( PyExc_SystemError^, PAnsiChar(AnsiString(Format('Container %s does not support the Contains protocol', [fContainerAccess.Name]))) );
+ PyErr_SetObject( PyExc_SystemError^,
+ PyString_FromDelphiString(Format(rs_ErrSqContains, [fContainerAccess.Name])) );
end;
end;
@@ -1366,8 +1567,8 @@ function TPyDelphiIterator.IterNext: PPyObject;
function TPyDelphiIterator.Repr: PPyObject;
begin
with GetPythonEngine do
- Result := PyString_FromString( PAnsiChar(AnsiString(Format('',
- [ContainerAccess.Name, NativeInt(Self)]))) );
+ Result := PyString_FromDelphiString( Format('',
+ [ContainerAccess.Name, NativeInt(Self)]) );
end;
procedure TPyDelphiIterator.Setup(AContainerAccess : TContainerAccess);
@@ -1415,7 +1616,8 @@ function TPyDelphiObject.CheckBound: Boolean;
Result := Assigned(DelphiObject);
if not Result then
with GetPythonEngine do
- PyErr_SetString(PyExc_AttributeError^, PAnsiChar(AnsiString(Format('Delphi wrapper %s is not bound', [ClassName]))));
+ PyErr_SetObject(PyExc_AttributeError^,
+ PyString_FromDelphiString(Format(rs_ErrCheckBound, [ClassName])));
end;
function TPyDelphiObject.Compare(obj: PPyObject): Integer;
@@ -1462,37 +1664,12 @@ destructor TPyDelphiObject.Destroy;
inherited;
end;
-function TPyDelphiObject.Dummy_Getter(AContext: Pointer): PPyObject;
-begin
- // Note that this code should never execute as TPyDelphiObject overrides GetAttrO
- // to intercept an access to a published property.
- // This getter was only registered to help document the wrapped object and
- // benefit from the code insight of the Python IDE.
- Result := nil;
- with GetPythonEngine do
- PyErr_SetString (PyExc_AttributeError^,
- PAnsiChar('Fatal error. The Delphi wrapper did not find the published property you were trying to access'));
-end;
-
-function TPyDelphiObject.Dummy_Setter(AValue: PPyObject;
- AContext: Pointer): Integer;
-begin
- // Note that this code should never execute as TPyDelphiObject overrides GetAttrO
- // to intercept an access to a published property.
- // This getter was only registered to help document the wrapped object and
- // benefit from the code insight of the Python IDE.
- Result := -1;
- with GetPythonEngine do
- PyErr_SetString (PyExc_AttributeError^,
- PAnsiChar('Fatal error. The Delphi wrapper did not find the published property you were trying to access'));
-end;
-
function TPyDelphiObject.Free_Wrapper(args: PPyObject): PPyObject;
begin
+ // We adjust the transmitted self argument
+ Adjust(@Self);
with GetPythonEngine do
begin
- // We adjust the transmitted self argument
- Adjust(@Self);
if PyArg_ParseTuple( args, ':Free' ) <> 0 then
begin
if Owned or fCanFreeOwnedObject then begin
@@ -1500,8 +1677,8 @@ function TPyDelphiObject.Free_Wrapper(args: PPyObject): PPyObject;
Owned := False;
Result := ReturnNone;
end else begin
- PyErr_SetString (PyExc_AttributeError^,
- PAnsiChar('The Delphi object cannot be freed, since it is not Owned'));
+ PyErr_SetObject (PyExc_AttributeError^,
+ PyString_FromDelphiString(rs_ErrFree));
Result := nil;
end;
end
@@ -1512,27 +1689,122 @@ function TPyDelphiObject.Free_Wrapper(args: PPyObject): PPyObject;
function TPyDelphiObject.GetAttrO(key: PPyObject): PPyObject;
(*
- First Look for "published" methods compiled with {$METHODINFO ON}
- Then look for published properties
- Finally call inherited which calls PyObject_GenericGetAttr
+ First look whether the attribute has ben wrapped (RegisterGetSet, RegisterMethod).
+ This is done by calling the inherited GetAttrO. If this fails then
+ - Use Rtti to locate the property in DELPHIXE_OR_HIGHER (EXTENDED_RTTI)
+ or for other versions
+ - First Look for "published" methods compiled with {$METHODINFO ON}
+ - Then look for published properties
*)
+
+ {$IFDEF EXTENDED_RTTI}
+ function GetRttiAttr(Instance: TObject; const AttrName: string;
+ out ErrMsg: string): PPyObject;
+ var
+ Context: TRttiContext;
+ Prop: TRttiProperty;
+ Meth: TRttiMethod;
+ Field: TRttiField;
+ begin
+ Result := nil;
+ Context := TRttiContext.Create();
+ try
+ Meth := Context.GetType(Instance.ClassType).GetMethod(AttrName);
+ if Meth <> nil then
+ begin
+ Result := PyDelphiWrapper.DelphiMethodType.CreateInstance;
+ with PythonToDelphi(Result) as TPyDelphiMethodObject do
+ begin
+ fDelphiWrapper := PyDelphiWrapper;
+ MethName := Meth.Name;
+ DelphiObject := Self.DelphiObject;
+ end;
+ end
+ else
+ begin
+ Prop := Context.GetType(Instance.ClassType).GetProperty(AttrName);
+ if Prop <> nil then
+ begin
+ if Ord(Prop.Visibility) < Ord(mvPublic) then
+ ErrMsg := rs_NoAccess
+ else if not Prop.IsReadable then
+ ErrMsg := rs_NotReadable
+ else if Prop.PropertyType = nil then
+ ErrMsg := rs_ErrNoTypeInfo
+ else
+ case prop.PropertyType.TypeKind of
+ tkClass:
+ Result := Wrap(prop.GetValue(Instance).AsObject);
+ tkMethod:
+ if prop is TRttiInstanceProperty then
+ Result := PyDelphiWrapper.fEventHandlerList.GetCallable(Instance,
+ TRttiInstanceProperty(prop).PropInfo);
+ else
+ Result := SimpleValueToPython(prop.GetValue(Instance), ErrMsg)
+ end;
+ end
+ else
+ begin
+ Field := Context.GetType(Instance.ClassType).GetField(AttrName);
+ if Field <> nil then
+ begin
+ if Ord(Field.Visibility) < Ord(mvPublic) then
+ ErrMsg := rs_NoAccess
+ else if Field.FieldType = nil then
+ ErrMsg := rs_ErrNoTypeInfo
+ else
+ case Field.FieldType.TypeKind of
+ tkClass:
+ Result := Wrap(Field.GetValue(Instance).AsObject);
+ else
+ Result := SimpleValueToPython(Field.GetValue(Instance), ErrMsg)
+ end;
+ end
+ else
+ ErrMsg := rs_UnknownAttribute;
+ end;
+ end;
+ except
+ on E: Exception do begin
+ Result := nil;
+ ErrMsg := E.Message;
+ end;
+ end;
+ Context.Free;
+ end;
+ {$ENDIF}
+
var
- Name: ShortString;
-{$IFNDEF FPC}
+ KeyName: string;
+ ErrMsg : string;
+{$ifndef FPC}
+{$IFNDEF EXTENDED_RTTI}
Info: PMethodInfoHeader;
+ PropInfo: PPropInfo;
+ Obj : TObject;
{$ENDIF}
+{$else}
PropInfo: PPropInfo;
Obj : TObject;
+{$endif}
begin
- Result := nil;
- if GetPythonEngine.PyString_Check(Key) then
- Name := ShortString(GetPythonEngine.PyString_AsDelphiString(Key))
+ Result := inherited GetAttrO(key);
+ if GetPythonEngine.PyErr_Occurred = nil then Exit; // We found what we wanted
+
+ if Assigned(DelphiObject) and GetPythonEngine.PyString_Check(Key) then
+ KeyName := GetPythonEngine.PyString_AsDelphiString(Key)
else
- Name := '';
+ Exit;
+ GetPythonEngine.PyErr_Clear;
+{$IFDEF EXTENDED_RTTI}
+ // Use RTTI
+ if Assigned(DelphiObject) then
+ Result := GetRttiAttr(DelphiObject, KeyName, ErrMsg);
+{$ELSE}
{$IFNDEF FPC}
- if Assigned(DelphiObject) and (Name <> '') then
- Info := GetMethodInfo(DelphiObject, Name)
+ if Assigned(DelphiObject) then
+ Info := GetMethodInfo(DelphiObject, KeyName)
else
Info := nil;
@@ -1540,8 +1812,9 @@ function TPyDelphiObject.GetAttrO(key: PPyObject): PPyObject;
begin
// Ensure the method information has enough type information
if Info.Len <= SizeOf(Info^) - SizeOf(ShortString) + 1 + Length(Info.Name) then
- with GetPythonEngine do
- PyErr_SetString (PyExc_AttributeError^, PAnsiChar(AnsiString(Format('Unknown attribute "%s"',[Name]))))
+ begin
+ ErrMsg := rs_UnknownAttribute;
+ end
else
begin
Result := PyDelphiWrapper.DelphiMethodType.CreateInstance;
@@ -1551,10 +1824,10 @@ function TPyDelphiObject.GetAttrO(key: PPyObject): PPyObject;
end;
end;
end
- else{$ENDIF} if Assigned(DelphiObject) and (Name <> '') then
- begin
+ else{$ENDIF} if Assigned(DelphiObject) then
+ try
// Not a method, try a property.
- PropInfo := GetPropInfo(DelphiObject, string(Name));
+ PropInfo := GetPropInfo(DelphiObject, KeyName);
if PropInfo <> nil then
begin
// we have a property
@@ -1575,19 +1848,26 @@ function TPyDelphiObject.GetAttrO(key: PPyObject): PPyObject;
Result := GetPythonEngine.VariantAsPyObject(Boolean(GetOrdProp(Self.DelphiObject, PropInfo)))
else
{$IFDEF FPC}
- Result := GetPythonEngine.PyString_FromString(PAnsiChar(AnsiString(GetEnumName(PropInfo^.PropType,
+ Result := GetPythonEngine.PyString_FromDelphiString(GetEnumName(PropInfo^.PropType,
{$ELSE FPC}
- Result := GetPythonEngine.PyString_FromString(PAnsiChar(AnsiString(GetEnumName(PropInfo^.PropType^,
+ Result := GetPythonEngine.PyString_FromDelphiString(GetEnumName(PropInfo^.PropType^,
{$ENDIF FPC}
- GetOrdProp(Self.DelphiObject, PropInfo)))));
+ GetOrdProp(Self.DelphiObject, PropInfo)));
end
end else
Result := GetPythonEngine.VariantAsPyObject(GetPropValue(DelphiObject, PropInfo));
end;
+ except
+ on E: Exception do begin
+ Result := nil;
+ ErrMsg := E.Message;
+ end;
end;
-
+{$ENDIF}
if not Assigned(Result) then
- Result := inherited GetAttrO(key);
+ with GetPythonEngine do
+ PyErr_SetObject (PyExc_AttributeError^,
+ PyString_FromDelphiString(Format(rs_ErrAttrGet,[KeyName, ErrMsg])));
end;
function TPyDelphiObject.GetContainerAccess: TContainerAccess;
@@ -1604,63 +1884,82 @@ class function TPyDelphiObject.GetContainerAccessClass : TContainerAccessClass;
function TPyDelphiObject.Get_Bound(Acontext: Pointer): PPyObject;
begin
- with GetPythonEngine do
- begin
- Adjust(@Self);
- Result := VariantAsPyObject(Assigned(DelphiObject));
- end;
+ Adjust(@Self);
+ Result := GetPythonEngine.VariantAsPyObject(Assigned(DelphiObject));
end;
function TPyDelphiObject.Get_ClassName(Acontext: Pointer): PPyObject;
-Var
- S : String;
begin
- with GetPythonEngine do
- begin
- Adjust(@Self);
- if CheckBound then
- begin
- S := DelphiObject.ClassName;
- Result := PyString_FromString(PAnsiChar(AnsiString(S)));
- end
- else
- Result := nil;
- end;
+ Adjust(@Self);
+ if CheckBound then
+ Result := GetPythonEngine.PyString_FromDelphiString(DelphiObject.ClassName)
+ else
+ Result := nil;
end;
function TPyDelphiObject.Get_Owned(Acontext: Pointer): PPyObject;
begin
- with GetPythonEngine do
- begin
- Adjust(@Self);
- if CheckBound then
- Result := VariantAsPyObject(Owned)
- else
- Result := nil;
- end;
+ Adjust(@Self);
+ if CheckBound then
+ Result := GetPythonEngine.VariantAsPyObject(Owned)
+ else
+ Result := nil;
end;
-function TPyDelphiObject.Get_Published(AContext: Pointer): PPyObject;
+function TPyDelphiObject.Dir_Wrapper(args: PPyObject): PPyObject;
var
i : Integer;
+ SL : TStringList;
+{$IFDEF EXTENDED_RTTI}
+ Context: TRttiContext;
+ RttiType: TRTTIType;
+ RttiMethod: TRttiMethod;
+ RttiProperty: TRttiProperty;
+ RttiField: TRttiField;
+{$ELSE}
_PropList: PPropList;
_propCount : Integer;
+{$ENDIF}
begin
- with GetPythonEngine do
- begin
- Adjust(@Self);
+ Adjust(@Self);
+ SL := TStringList.Create;
+ SL.Sorted := True;
+ SL.Duplicates := dupIgnore;
+ try
+ // Add methods
+ for i := 0 to PythonType.MethodCount - 1 do
+ SL.Add(string(AnsiString(PythonType.Methods[i].ml_name)));
+ for i := 0 to PythonType.GetSetCount - 1 do
+ SL.Add(string(AnsiString(PythonType.GetSet[i].name)));
+{$IFDEF EXTENDED_RTTI}
+ Context := TRttiContext.Create();
+ try
+ RttiType := Context.GetType(DelphiObject.ClassType);
+ for RttiMethod in RttiType.GetMethods do
+ if Ord(RttiMethod.Visibility) > Ord(mvProtected) then
+ SL.Add(RttiMethod.Name);
+ for RttiProperty in RttiType.GetProperties do
+ if Ord(RttiProperty.Visibility) > Ord(mvProtected) then
+ SL.Add(RttiProperty.Name);
+ for RttiField in RttiType.GetFields do
+ if Ord(RttiField.Visibility) > Ord(mvProtected) then
+ SL.Add(RttiField.Name);
+ finally
+ Context.Free();
+ end;
+{$ELSE}
_propCount := GetPropList(DelphiObject, _PropList);
- Result := PyList_New(_propCount);
- if _propCount > 0 then
- begin
+ if _propCount > 0 then
try
- for i := 0 to _propCount-1 do
- PyList_SetItem(Result, i, PyString_FromString(PAnsiChar(AnsiString(_PropList^[i].Name))));
+ for i := 0 to _propCount - 1 do
+ SL.Add(_PropList^[i].Name);
finally
FreeMem(_PropList);
end;
- PyList_Sort(Result);
- end;
+{$ENDIF}
+ Result := GetPythonEngine.StringsToPyList(SL);
+ finally
+ SL.Free;
end;
end;
@@ -1681,10 +1980,10 @@ function TPyDelphiObject.InheritsFrom_Wrapper(args: PPyObject): PPyObject;
KlassName: string;
IsSubClass: Boolean;
begin
+ // We adjust the transmitted self argument
+ Adjust(@Self);
with GetPythonEngine do
begin
- // We adjust the transmitted self argument
- Adjust(@Self);
if PyArg_ParseTuple( args, 'O:InheritsFrom',@_obj ) <> 0 then begin
if CheckBound then begin
KlassName := PyObjectAsString(_obj);
@@ -1718,7 +2017,9 @@ function TPyDelphiObject.Iter: PPyObject;
begin
Result := nil;
with GetPythonEngine do
- PyErr_SetString( PyExc_SystemError^, PAnsiChar(AnsiString(Format('Wrapper %s does not support iterators', [Self.ClassName]))) );
+ PyErr_SetObject( PyExc_SystemError^,
+ PyString_FromDelphiString(Format(rs_ErrIterSupport,
+ [Self.ClassName])) );
end;
end;
@@ -1729,35 +2030,9 @@ procedure TPyDelphiObject.Notify(ADeletedObject: TObject);
end;
class procedure TPyDelphiObject.RegisterGetSets(PythonType: TPythonType);
-var
- i : Integer;
- _doc : String;
- _propCount : Integer;
- _PropList: PPropList;
- _typeInfo : PTypeInfo;
begin
inherited;
- // first register get/set for each published property, to allow easier documenting
- // and use of code insight within a Python IDE.
- // Note that the Delphi type info contains short strings which are not directly compatible with PAnsiChar.
- // So, we have to convert them to regular strings, store them in a list, to maintain them alive, then
- // we can cast them into PChars.
- _typeInfo := DelphiObjectClass.ClassInfo;
- if _typeInfo <> nil then
- begin
- _propCount := GetPropList(_typeInfo, _PropList);
- if _propCount > 0 then
- try
- for i := 0 to _propCount-1 do
- begin
- _doc := Format('Published property %s : %s', [_PropList^[i].Name, _PropList^[i].PropType^.Name]);
- PythonType.AddGetSet(AddName(string(_PropList^[i].Name)), @TPyDelphiObject.Dummy_Getter, @TPyDelphiObject.Dummy_Setter,
- AddName(_doc), nil);
- end;
- finally
- FreeMem(_PropList);
- end;
- end;
+
// then register TObject + custom getters/setters.
with PythonType do
begin
@@ -1767,8 +2042,6 @@ class procedure TPyDelphiObject.RegisterGetSets(PythonType: TPythonType);
'Returns True if the wrapper is still bound to the Delphi instance.', nil);
AddGetSet('__owned__', @TPyDelphiObject.Get_Owned, nil,
'Returns True if the wrapper owns the Delphi instance.', nil);
- AddGetSet('__published__', @TPyDelphiObject.Get_published, nil,
- 'Returns the list of all published properties of this instance.', nil);
end;
end;
@@ -1790,99 +2063,65 @@ class procedure TPyDelphiObject.RegisterMethods(PythonType: TPythonType);
PythonType.AddMethod('ToList', @TPyDelphiObject.ToList_Wrapper,
'TStrings.ToList()'#10 +
'If the object is a container (TStrings, TComponent...), it returns the content of the sequence as a Python list object.');
+ PythonType.AddMethod('__dir__', @TPyDelphiObject.Dir_Wrapper,
+ 'Returns the list of all methods, fields and properties of this instance.');
end;
function TPyDelphiObject.Repr: PPyObject;
begin
with GetPythonEngine do
if Assigned(DelphiObject) then
- Result := PyString_FromString( PAnsiChar(AnsiString(Format('',
- [DelphiObject.ClassName, NativeInt(Self)]))) )
+ Result := PyString_FromDelphiString( Format('',
+ [DelphiObject.ClassName, NativeInt(Self)]) )
else
- Result := PyString_FromString( PAnsiChar(AnsiString(Format('',
- [DelphiObjectClass.ClassName, NativeInt(Self)]))) );
-end;
-
-function TPyDelphiObject.RichCompare(obj: PPyObject;
- Op: TRichComparisonOpcode): PPyObject;
-Var
- Res : Boolean;
-begin
- Res := False;
- case Op of
- pyLT: Res := Compare(obj) < 0;
- pyLE: Res := Compare(obj) <= 0;
- pyEQ: Res := Compare(obj) = 0;
- pyNE: Res := Compare(obj) <> 0;
- pyGT: Res := Compare(obj) > 0;
- pyGE: Res := Compare(obj) >= 0;
- end;
- if Res then
- Result := PPyObject(GetPythonEngine.Py_True)
- else
- Result := PPyObject(GetPythonEngine.Py_False);
- GetPythonEngine.Py_INCREF( Result );
+ Result := PyString_FromDelphiString( Format('',
+ [DelphiObjectClass.ClassName, NativeInt(Self)]) );
end;
function TPyDelphiObject.SetAttrO(key, value: PPyObject): Integer;
+(*
+ First look whether the attribute has ben wrapped (RegisterGetSet, RegisterMethod).
+ This is done by calling the inherited SetAttrO. If this fails then
+ - Use Rtti to locate the property in DELPHIXE_OR_HIGHER (EXTENDED_RTTI)
+ or for other versions
+ - Look for published properties
+*)
- function HandleEvent(PropInfo: PPropInfo) : Integer;
+ function HandleEvent(PropInfo: PPropInfo; out ErrMsg: string) : Integer;
begin
- if PyDelphiWrapper.EventHandlers.Link(DelphiObject, PropInfo, value) then
+ if PyDelphiWrapper.EventHandlers.Link(DelphiObject, PropInfo, value, ErrMsg) then
Result := 0
else
Result := -1;
end;
- function HandleClass(PropInfo: PPropInfo) : Integer;
- var
- PyObject : TPyObject;
+ function HandleClass(PropInfo: PPropInfo; out ErrMsg: string) : Integer;
+ Var
Obj : TObject;
begin
Result := -1;
- if IsDelphiObject(value) then
+ if ValidateClassProperty(value, PropInfo^.PropType{$IFNDEF FPC}^{$ENDIF}, Obj, ErrMsg) then
begin
- PyObject := PythonToDelphi(value);
- if PyObject is TPyDelphiObject then
- begin
- Obj := TPyDelphiObject(PyObject).DelphiObject;
- {$IFDEF FPC}
- if Obj.ClassType.InheritsFrom(GetTypeData(PropInfo^.PropType).ClassType) then
- {$ELSE FPC}
- if Obj.ClassType.InheritsFrom(GetTypeData(PropInfo^.PropType^).ClassType) then
- {$ENDIF FPC}
- begin
- SetOrdProp(DelphiObject, PropInfo, NativeInt(Obj));
- Result := 0;
- end
- else
- with GetPythonEngine do
- PyErr_SetString (PyExc_AttributeError^, 'Incompatible classes');
- end
- else
- with GetPythonEngine do
- PyErr_SetString (PyExc_AttributeError^, 'Class property - expected a Delphi object');
+ SetOrdProp(DelphiObject, PropInfo, NativeInt(Obj));
+ Result := 0;
end
- else
- with GetPythonEngine do
- PyErr_SetString (PyExc_AttributeError^, 'Class property - expected a Delphi object');
end;
- function HandleSet(PropInfo: PPropInfo) : Integer;
+ function HandleSet(PropInfo: PPropInfo; out ErrMsg: string) : Integer;
begin
try
- SetPropValue(DelphiObject, PropInfo, PythonToSet(Value, PropInfo));
+ SetPropValue(DelphiObject, PropInfo, PythonToSet(PropInfo, Value));
Result := 0;
except
on E: Exception do with GetPythonEngine do
begin
Result := -1;
- PyErr_SetString (PyExc_AttributeError^, PAnsiChar(AnsiString(E.Message)));
+ ErrMsg := E.Message;
end;
end;
end;
- function HandleOtherTypes(PropInfo: PPropInfo) : Integer;
+ function HandleOtherTypes(PropInfo: PPropInfo; out ErrMsg: string) : Integer;
Var
V : Variant;
begin
@@ -1897,37 +2136,128 @@ function TPyDelphiObject.SetAttrO(key, value: PPyObject): Integer;
on E: Exception do with GetPythonEngine do
begin
Result := -1;
- PyErr_SetString (PyExc_AttributeError^, PAnsiChar(AnsiString(E.Message)));
+ ErrMsg := E.Message;
end;
end;
end;
+{$IFDEF EXTENDED_RTTI}
+ function SetRttiAttr(const AttrName: string; Value: PPyObject;
+ out ErrMsg: string): Boolean;
+ var
+ Context: TRttiContext;
+ Prop: TRttiProperty;
+ Field: TRttiField;
+ V: TValue;
+ Obj: TObject;
+ begin
+ Result := False;
+ Context := TRttiContext.Create();
+ Prop := Context.GetType(DelphiObject.ClassType).GetProperty(AttrName);
+ if Prop <> nil then
+ try
+ if Ord(Prop.Visibility) < Ord(mvPublic) then
+ ErrMsg := rs_NoAccess
+ else if not Prop.IsWritable then
+ ErrMsg := rs_NotWritable
+ else if Prop.PropertyType = nil then
+ ErrMsg := rs_ErrNoTypeInfo
+ else
+ case Prop.PropertyType.TypeKind of
+ tkClass:
+ if ValidateClassProperty(value, Prop.PropertyType.Handle, Obj, ErrMsg) then begin
+ Prop.SetValue(DelphiObject, TPyDelphiObject(PythonToDelphi(Value)).DelphiObject);
+ Result := True;
+ end;
+ tkMethod:
+ if Prop.Visibility = mvPublished then
+ Result := HandleEvent((Prop as TRttiInstanceProperty).PropInfo, ErrMsg) = 0
+ else
+ ErrMsg := rs_NotPublished;
+ else
+ begin
+ Result := SimplePythonToValue(Value, Prop.PropertyType.Handle, V, ErrMsg);
+ if Result then
+ Prop.SetValue(DelphiObject, V);
+ end;
+ end;
+ except
+ on E: Exception do begin
+ Result := False;
+ ErrMsg := E.Message;
+ end;
+ end
+ else
+ begin
+ Field := Context.GetType(DelphiObject.ClassType).GetField(AttrName);
+ if Field <> nil then
+ try
+ if Ord(Field.Visibility) < Ord(mvPublic) then
+ ErrMsg := rs_NoAccess
+ else if Field.FieldType = nil then
+ ErrMsg := rs_ErrNoTypeInfo
+ else
+ case Field.FieldType.TypeKind of
+ tkClass:
+ if ValidateClassProperty(value, Field.FieldType.Handle, Obj, ErrMsg) then begin
+ Field.SetValue(DelphiObject, TPyDelphiObject(PythonToDelphi(Value)).DelphiObject);
+ Result := True;
+ end;
+ else
+ begin
+ Result := SimplePythonToValue(Value, Field.FieldType.Handle, V, ErrMsg);
+ if Result then
+ Field.SetValue(DelphiObject, V);
+ end;
+ end;
+ except
+ on E: Exception do begin
+ Result := False;
+ ErrMsg := E.Message;
+ end;
+ end
+ end;
+ Context.Free;
+ end;
+{$ENDIF}
+
var
+{$IFNDEF EXTENDED_RTTI}
PropInfo: PPropInfo;
- Name : string;
+{$ENDIF}
+ KeyName: string;
+ ErrMsg: string;
begin
+ Result := inherited SetAttrO(key, value);
+ if Result = 0 then Exit;
- if Assigned(DelphiObject) then
- begin
- Name := GetPythonEngine.PyString_AsDelphiString(Key);
- PropInfo := GetPropInfo(DelphiObject, Name);
- end
+ if Assigned(DelphiObject) and GetPythonEngine.PyString_Check(Key) then
+ KeyName := GetPythonEngine.PyString_AsDelphiString(Key)
else
- PropInfo := nil;
+ Exit;
+ GetPythonEngine.PyErr_Clear;
+ {$IFDEF EXTENDED_RTTI}
+ if SetRttiAttr(KeyName, Value, ErrMsg) then
+ Result := 0;
+ {$ELSE}
+ PropInfo := GetPropInfo(DelphiObject, KeyName);
if PropInfo <> nil then
begin
if PropInfo^.PropType^.Kind = tkMethod then
- Result := HandleEvent(PropInfo)
+ Result := HandleEvent(PropInfo, ErrMsg)
else if PropInfo^.PropType^.Kind = tkClass then
- Result := HandleClass(PropInfo)
+ Result := HandleClass(PropInfo, ErrMsg)
else if PropInfo^.PropType^.Kind = tkSet then
- Result := HandleSet(PropInfo)
+ Result := HandleSet(PropInfo, ErrMsg)
else
- Result := HandleOtherTypes(PropInfo);
- end
- else
- Result := inherited SetAttrO(key, value);
+ Result := HandleOtherTypes(PropInfo, ErrMsg);
+ end;
+ {$ENDIF}
+ if Result <> 0 then
+ with GetPythonEngine do
+ PyErr_SetObject(PyExc_AttributeError^, PyString_FromDelphiString(
+ Format(rs_ErrAttrSetr, [KeyName, ErrMsg])));
end;
procedure TPyDelphiObject.SetDelphiObject(const Value: TObject);
@@ -1956,9 +2286,9 @@ function TPyDelphiObject.SetProps(args, keywords: PPyObject): PPyObject;
_value : PPyObject;
begin
Result := nil;
+ Adjust(@Self);
with GetPythonEngine do
begin
- Adjust(@Self);
_keys := PyDict_Keys(keywords);
try
for i := 0 to PySequence_Length(_keys)-1 do
@@ -1991,7 +2321,7 @@ class procedure TPyDelphiObject.SetupType(PythonType: TPythonType);
PythonType.TypeFlags := PythonType.TypeFlags + [tpfBaseType, tpfHaveRichCompare];
PythonType.GenerateCreateFunction := False;
PythonType.DocString.Text := 'Wrapper for Delphi ' + DelphiObjectClass.ClassName;
- PythonType.Services.Basic := [bsGetAttrO, bsSetAttrO, bsRepr, bsStr, bsCompare, bsRichCompare];
+ PythonType.Services.Basic := [bsGetAttrO, bsSetAttrO, bsRepr, bsStr, bsRichCompare];
_ContainerAccessClass := GetContainerAccessClass;
if Assigned(_ContainerAccessClass) then
begin
@@ -2020,7 +2350,8 @@ function TPyDelphiObject.SqAssItem(idx: NativeInt; obj: PPyObject): integer;
begin
Result := -1;
with GetPythonEngine do
- PyErr_SetString( PyExc_SystemError^, PAnsiChar(AnsiString(Format('Wrapper %s does not support indexed write (f[i] = x)', [Self.ClassName]))) );
+ PyErr_SetObject( PyExc_SystemError^,
+ PyString_FromDelphiString(Format(rs_ErrSqAss, [Self.ClassName])) );
end;
end;
@@ -2050,7 +2381,8 @@ function TPyDelphiObject.SqItem(idx: NativeInt): PPyObject;
begin
Result := nil;
with GetPythonEngine do
- PyErr_SetString( PyExc_SystemError^, PAnsiChar(AnsiString(Format('Wrapper %s does not support sequences', [Self.ClassName]))) );
+ PyErr_SetObject( PyExc_SystemError^,
+ PyString_FromDelphiString(Format(rs_ErrSequence, [Self.ClassName])) );
end;
end;
@@ -2086,7 +2418,8 @@ function TPyDelphiObject.ToList_Wrapper(args: PPyObject): PPyObject;
begin
Result := nil;
with GetPythonEngine do
- PyErr_SetString( PyExc_SystemError^, PAnsiChar(AnsiString(Format('Wrapper %s does not support sequences', [Self.ClassName]))) );
+ PyErr_SetObject( PyExc_SystemError^,
+ PyString_FromDelphiString(Format(rs_ErrSequence, [Self.ClassName])) );
end
else if GetPythonEngine.PyArg_ParseTuple( args, ':ToList' ) <> 0 then
with GetPythonEngine do
@@ -2109,7 +2442,8 @@ function TPyDelphiObject.ToTuple_Wrapper(args: PPyObject): PPyObject;
begin
Result := nil;
with GetPythonEngine do
- PyErr_SetString( PyExc_SystemError^, PAnsiChar(AnsiString(Format('Wrapper %s does not support sequences', [Self.ClassName]))) );
+ PyErr_SetObject( PyExc_SystemError^,
+ PyString_FromDelphiString(Format(rs_ErrSequence, [Self.ClassName])) );
end
else if GetPythonEngine.PyArg_ParseTuple( args, ':ToTuple' ) <> 0 then
with GetPythonEngine do
@@ -2140,6 +2474,131 @@ function TPyDelphiObject.Wrap(AObject: TObject;
{$IFNDEF FPC}
{ TPyDelphiMethodObject }
+{$IFDEF EXTENDED_RTTI}
+function TPyDelphiMethodObject.Call(ob1, ob2: PPyObject): PPyObject;
+
+ function FindMethod(const MethName:string; RttiType : TRttiType;
+ PyArgs: PPyObject; var Args: array of TValue):TRttiMethod;
+ // Deals with overloaded methods
+ // Constructs the Arg Array
+ // PyArgs is a Python tuple
+ Var
+ Method: TRttiMethod;
+ Index: Integer;
+ ErrMsg: string;
+ Obj: TObject;
+ PyValue : PPyObject;
+ Param: TRttiParameter;
+ Params : TArray;
+ begin
+ Result :=nil;
+ for Method in RttiType.GetMethods do
+ if SameText(Method.Name, MethName) then
+ begin
+ Params:=Method.GetParameters;
+ if Length(Args)=Length(Params) then
+ begin
+ Result := Method;
+ for Index:= 0 to Length(Params)-1 do
+ begin
+ Param := Params[Index];
+ if (Param.ParamType = nil) or
+ (Param.Flags * [TParamFlag.pfVar, TParamFlag.pfOut] <> []) then
+ begin
+ Result :=nil;
+ Break;
+ end;
+
+ PyValue := PythonType.Engine.PyTuple_GetItem(PyArgs, Index);
+ if Param.ParamType = nil then
+ begin
+ Result := nil;
+ Break
+ end
+ else if Param.ParamType.TypeKind = tkClass then
+ begin
+ if ValidateClassProperty(PyValue, Param.ParamType.Handle, Obj, ErrMsg)
+ then
+ Args[Index] := Obj
+ else begin
+ Result := nil;
+ Break
+ end
+ end
+ else
+ begin
+ if not SimplePythonToValue(PyValue, Param.ParamType.Handle,
+ Args[Index], ErrMsg) then
+ begin
+ Result := nil;
+ Break
+ end;
+ end;
+ if (Param.ParamType <> nil) and not Args[Index].IsType(Param.ParamType.Handle) then
+ begin
+ Result :=nil;
+ Break;
+ end;
+ end;
+ Break;
+ end;
+ end;
+ end;
+
+ procedure InvalidArguments(const MethName, ErrMsg : string);
+ begin
+ with GetPythonEngine do
+ PyErr_SetObject(PyExc_TypeError^, PyString_FromDelphiString(
+ Format(rs_ErrInvalidArgs,
+ [MethName, ErrMsg])));
+ end;
+
+Var
+ Args: array of TValue;
+ ArgCount: Integer;
+ Context: TRttiContext;
+ meth: TRttiMethod;
+ ret: TValue;
+ ErrMsg : string;
+
+begin
+ Result := nil;
+ // Ignore keyword arguments ob2
+ // ob1 is a tuple with zero or more elements
+
+ ArgCount := PythonType.Engine.PyTuple_Size(ob1);
+ SetLength(Args, ArgCount);
+
+ Context := TRttiContext.Create;
+ meth := FindMethod(MethName, Context.GetType(DelphiObject.ClassInfo), ob1, Args);
+
+ if not Assigned(meth) then begin
+ InvalidArguments(MethName, rs_IncompatibleArguments);
+ Exit;
+ end;
+
+ try
+ ret := meth.Invoke(DelphiObject, Args);
+ if ret.IsEmpty then
+ Result := GetPythonEngine.ReturnNone
+ else if ret.Kind = tkClass then
+ Result := fDelphiWrapper.Wrap(ret.AsObject)
+ else begin
+ Result := SimpleValueToPython(ret, ErrMsg);
+ if Result = nil then
+ with PythonType.Engine do
+ PyErr_SetObject(PyExc_TypeError^, PyString_FromDelphiString(
+ Format(rs_ErrInvalidRet, [MethName, ErrMsg])));
+ end;
+ except
+ on E: Exception do begin
+ Result := nil;
+ InvalidArguments(MethName, E.Message);
+ end;
+ end;
+end;
+
+{$ELSE)}
function TPyDelphiMethodObject.Call(ob1, ob2: PPyObject): PPyObject;
Var
V : Variant;
@@ -2163,22 +2622,32 @@ function TPyDelphiMethodObject.Call(ob1, ob2: PPyObject): PPyObject;
with GetPythonEngine do
try
Result := VariantAsPyObject(ObjectInvoke(DelphiObject,
- @MethodInfo, ParamIndexes, Params));
+ @MethodInfo, ParamIndexes, Params));
except
on E: Exception do
begin
Result := nil;
- PyErr_SetString (PyExc_TypeError^,
- PAnsiChar(AnsiString(Format('"%s" called with invalid arguments: %s',[MethodInfo.Name, E.Message]))));
+ PyErr_SetObject (PyExc_TypeError^,
+ PyString_FromDelphiString(Format(rs_ErrInvalidArgs,
+ [MethodInfo.Name, E.Message])));
end;
end;
end;
+{$ENDIF}
function TPyDelphiMethodObject.Repr: PPyObject;
begin
with GetPythonEngine do
- Result := PyString_FromString( PAnsiChar(AnsiString(Format('',
- [MethodInfo.Name, DelphiObject.ClassName, NativeInt(Self)]))) );
+ Result := PyString_FromDelphiString(
+ Format('',
+ [
+ {$IFDEF EXTENDED_RTTI}
+ MethName,
+ {$ELSE}
+ MethodInfo.Name,
+ {$ENDIF}
+ DelphiObject.ClassName, NativeInt(Self)
+ ]) );
end;
class procedure TPyDelphiMethodObject.SetupType( PythonType : TPythonType );
@@ -2195,29 +2664,6 @@ class procedure TPyDelphiMethodObject.SetupType( PythonType : TPythonType );
{ TPyDelphiVarParameter }
-function TPyDelphiVarParameter.Compare(obj: PPyObject): Integer;
-var
- _value : PPyObject;
-begin
- with GetPythonEngine do
- begin
- if Self.Value = nil then
- _value := Py_None
- else
- _value := Self.Value;
- if IsPython3000 then begin
- if PyObject_RichCompareBool(_value, obj, PY_LT) = 1 then
- Result := -1
- else if PyObject_RichCompareBool(_value, obj, PY_EQ) = 1 then
- Result := 0
- else
- Result := 1;
- PyErr_Clear;
- end else
- Result := PyObject_Compare(_value, obj);
- end;
-end;
-
destructor TPyDelphiVarParameter.Destroy;
begin
Value := nil;
@@ -2226,9 +2672,9 @@ destructor TPyDelphiVarParameter.Destroy;
function TPyDelphiVarParameter.Get_Value(Acontext: Pointer): PPyObject;
begin
+ Adjust(@Self);
with GetPythonEngine do
begin
- Adjust(@Self);
Result := Self.Value;
if not Assigned(Result) then
Result := Py_None;
@@ -2255,7 +2701,9 @@ function TPyDelphiVarParameter.Repr: PPyObject;
else
_value := GetPythonEngine.PyObject_Repr(Value);
try
- Result := GetPythonEngine.PyString_FromString(PAnsiChar(AnsiString(Format('', [GetPythonEngine.PyObjectAsString(_value)]))));
+ Result :=
+ GetPythonEngine.PyString_FromDelphiString(Format('',
+ [GetPythonEngine.PyObjectAsString(_value)]));
finally
GetPythonEngine.Py_DECREF(_value);
end;
@@ -2281,10 +2729,10 @@ class procedure TPyDelphiVarParameter.SetupType(PythonType: TPythonType);
inherited;
PythonType.TypeName := 'VarParameter';
PythonType.Name := string(PythonType.TypeName) + 'Type';
- PythonType.TypeFlags := PythonType.TypeFlags + [tpfBaseType];
+ PythonType.TypeFlags := PythonType.TypeFlags + [tpfBaseType, tpfHaveRichCompare];
PythonType.GenerateCreateFunction := False;
PythonType.DocString.Text := 'Container object allowing modification of Delphi var parameters from Python';
- PythonType.Services.Basic := [bsGetAttrO, bsSetAttrO, bsRepr, bsStr, bsCompare];
+ PythonType.Services.Basic := [bsGetAttrO, bsSetAttrO, bsRepr, bsStr, bsRichCompare];
end;
procedure TPyDelphiVarParameter.SetValue(const Value: PPyObject);
@@ -2304,12 +2752,9 @@ procedure TPyDelphiVarParameter.SetValue(const Value: PPyObject);
function TPyDelphiVarParameter.Set_Value(AValue: PPyObject;
Acontext: Pointer): Integer;
begin
- with GetPythonEngine do
- begin
- Adjust(@Self);
- Self.Value := AValue;
- Result := 0;
- end;
+ Adjust(@Self);
+ Self.Value := AValue;
+ Result := 0;
end;
{ TEventHandler }
@@ -2491,7 +2936,7 @@ function TEventHandlers.IndexOf(AComponent: TObject;
end;
function TEventHandlers.Link(AComponent: TObject; APropInfo: PPropInfo;
- ACallable: PPyObject) : Boolean;
+ ACallable: PPyObject; out ErrMsg: string) : Boolean;
var
_handlerClass : TEventHandlerClass;
begin
@@ -2522,16 +2967,13 @@ function TEventHandlers.Link(AComponent: TObject; APropInfo: PPropInfo;
Result := True;
end
else
- PyErr_SetString (PyExc_AttributeError^,
- PAnsiChar('No Registered EventHandler for events of type ' + APropInfo^.PropType^.Name));
+ ErrMsg := Format(rs_ErrEventNotReg, [APropInfo^.PropType^.Name]);
end
else
- PyErr_SetString (PyExc_AttributeError^,
- PAnsiChar(AnsiString(Format('Class %s does not support events because it must either inherit from TComponent or implement interface IFreeNotification', [AComponent.ClassName]))));
+ ErrMsg := Format(rs_ErrEventNoSuport, [AComponent.ClassName]);
end
else
- PyErr_SetString (PyExc_AttributeError^,
- PAnsiChar(AnsiString('You can only assign a callable to a method property')));
+ ErrMsg := Format(rs_ErrEventExpectCallable, [APropInfo^.Name])
end;
end;
@@ -2633,8 +3075,9 @@ function TPyDelphiWrapper.CreateComponent(pself, args: PPyObject): PPyObject;
Klass := nil;
end;
if (Klass = nil) or not Klass.InheritsFrom(TComponent) then begin
- PyErr_SetString (PyExc_AttributeError^,
- PAnsiChar('Invalid class'));
+ PyErr_SetObject(PyExc_TypeError^, PyString_FromDelphiString(
+ Format(rs_ErrInvalidArgs,
+ ['CreateComponent', rs_InvalidClass])));
Exit;
end;
@@ -2649,8 +3092,9 @@ function TPyDelphiWrapper.CreateComponent(pself, args: PPyObject): PPyObject;
Ownership := soOwned;
Result := Self.Wrap(Component, Ownership);
end else
- PyErr_SetString (PyExc_AttributeError^,
- PAnsiChar('Invalid Arguments'));
+ PyErr_SetObject(PyExc_TypeError^, PyString_FromDelphiString(
+ Format(rs_ErrInvalidArgs,
+ ['CreateComponent', ''])));
end;
end;
@@ -2926,7 +3370,6 @@ procedure TPyDelphiWrapper.UnsubscribeFreeNotifications;
fEventHandlerList[i].Unsubscribe;
end;
-
function TPyDelphiWrapper.Wrap(AObj: TObject;
AOwnership: TObjectOwnership): PPyObject;
Var
@@ -2951,7 +3394,7 @@ function TPyDelphiWrapper.Wrap(AObj: TObject;
if Index >= 0 then break;
DelphiClass := DelphiClass.ClassParent;
end;
- Assert(Index >= 0, 'Internal Error in PyDelphiWrapper.TObjectToPyObject'); // shouldn't happen
+ Assert(Index >= 0, 'Internal Error in PyDelphiWrapper.Wrap'); // shouldn't happen
Result := TRegisteredClass(fClassRegister[Index]).PythonType.CreateInstance;
with PythonToDelphi(Result) as TPyDelphiObject do begin
@@ -2962,10 +3405,26 @@ function TPyDelphiWrapper.Wrap(AObj: TObject;
end;
end;
+{$IFDEF EXTENDED_RTTI}
+// To keep the RTTI Pool alive and avoid continuously creating/destroying it
+// See also https://stackoverflow.com/questions/27368556/trtticontext-multi-thread-issue
+Var
+_RttiContext: TRttiContext;
+
+procedure _InitRttiPool;
+begin
+ _RttiContext := TRttiContext.Create;
+ _RttiContext.FindType('');
+end;
+
+initialization
+ _InitRttiPool;
+finalization
+ _RttiContext.Free();
+{$ELSE}
initialization
- gNames := TStringList.Create;
finalization
- FreeAndNil(gNames);
+{$ENDIF}
FreeAndNil(gRegisteredUnits);
end.
diff --git a/PythonForDelphi/Components/Sources/Core/WrapDelphiActnList.pas b/PythonForDelphi/Components/Sources/Core/WrapDelphiActnList.pas
index 30dc7858..3d929408 100644
--- a/PythonForDelphi/Components/Sources/Core/WrapDelphiActnList.pas
+++ b/PythonForDelphi/Components/Sources/Core/WrapDelphiActnList.pas
@@ -96,20 +96,16 @@ function TPyDelphiCustomActionList.GetDelphiObject: TCustomActionList;
function TPyDelphiCustomActionList.Get_ActionCount(AContext: Pointer): PPyObject;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- Result := PyInt_FromLong(DelphiObject.ActionCount);
- end;
+ Adjust(@Self);
+ Result := GetPythonEngine.PyInt_FromLong(DelphiObject.ActionCount);
end;
function TPyDelphiCustomActionList.Get_Actions(AContext: Pointer): PPyObject;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- Result := PyDelphiWrapper.DefaultContainerType.CreateInstance;
- with PythonToDelphi(Result) as TPyDelphiContainer do
- Setup(Self.PyDelphiWrapper, TActionListAccess.Create(Self.PyDelphiWrapper, Self.DelphiObject));
- end;
+ Adjust(@Self);
+ Result := PyDelphiWrapper.DefaultContainerType.CreateInstance;
+ with PythonToDelphi(Result) as TPyDelphiContainer do
+ Setup(Self.PyDelphiWrapper, TActionListAccess.Create(Self.PyDelphiWrapper, Self.DelphiObject));
end;
class procedure TPyDelphiCustomActionList.RegisterGetSets(
diff --git a/PythonForDelphi/Components/Sources/Core/WrapDelphiClasses.pas b/PythonForDelphi/Components/Sources/Core/WrapDelphiClasses.pas
index 8bd1932f..d795ad23 100644
--- a/PythonForDelphi/Components/Sources/Core/WrapDelphiClasses.pas
+++ b/PythonForDelphi/Components/Sources/Core/WrapDelphiClasses.pas
@@ -292,7 +292,7 @@ function ShiftToPython(AShift : TShiftState) : PPyObject;
begin
with GetPythonEngine do
begin
- _item := PyString_FromString(PAnsiChar(AnsiString(AString)));
+ _item := PyString_FromDelphiString(AString);
PyList_Append(AList, _item);
Py_XDecRef(_item);
end;
@@ -338,15 +338,12 @@ function TPyDelphiPersistent.Assign_Wrapper(args: PPyObject): PPyObject;
var
_obj : PPyObject;
begin
- with GetPythonEngine do
- begin
- // We adjust the transmitted self argument
- Adjust(@Self);
- if PyArg_ParseTuple( args, 'O:Assign',@_obj ) <> 0 then
- Result := Self.Assign(_obj)
- else
- Result := nil;
- end;
+ // We adjust the transmitted self argument
+ Adjust(@Self);
+ if GetPythonEngine.PyArg_ParseTuple( args, 'O:Assign',@_obj ) <> 0 then
+ Result := Self.Assign(_obj)
+ else
+ Result := nil;
end;
class function TPyDelphiPersistent.DelphiObjectClass: TClass;
@@ -362,11 +359,11 @@ function TPyDelphiPersistent.GetDelphiObject: TPersistent;
function TPyDelphiPersistent.GetNamePath_Wrapper(
args: PPyObject): PPyObject;
begin
+ // We adjust the transmitted self argument
+ Adjust(@Self);
with GetPythonEngine do begin
- // We adjust the transmitted self argument
- Adjust(@Self);
if PyArg_ParseTuple( args, ':GetNamePath' ) <> 0 then begin
- Result := PyString_FromString(PAnsiChar(AnsiString(DelphiObject.GetNamePath)))
+ Result := PyString_FromDelphiString(DelphiObject.GetNamePath)
end else
Result := nil;
end;
@@ -536,28 +533,22 @@ function TPyDelphiCollection.GetDelphiObject: TCollection;
function TPyDelphiCollection.Get_Count(AContext: Pointer): PPyObject;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- Result := PyInt_FromLong(DelphiObject.Count);
- end;
+ Adjust(@Self);
+ Result := GetPythonEngine.PyInt_FromLong(DelphiObject.Count);
end;
function TPyDelphiCollection.Get_Items(AContext: Pointer): PPyObject;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- Result := Self.PyDelphiWrapper.DefaultContainerType.CreateInstance;
- with PythonToDelphi(Result) as TPyDelphiContainer do
- Setup(Self.PyDelphiWrapper, Self.ContainerAccess.Clone);
- end;
+ Adjust(@Self);
+ Result := Self.PyDelphiWrapper.DefaultContainerType.CreateInstance;
+ with PythonToDelphi(Result) as TPyDelphiContainer do
+ Setup(Self.PyDelphiWrapper, Self.ContainerAccess.Clone);
end;
function TPyDelphiCollection.Get_Owner(AContext: Pointer): PPyObject;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- Result := Wrap(DelphiObject.Owner);
- end;
+ Adjust(@Self);
+ Result := Wrap(DelphiObject.Owner);
end;
function TPyDelphiCollection.Insert_Wrapper(args: PPyObject): PPyObject;
@@ -730,10 +721,10 @@ function TPyDelphiComponent.BindMethodsToEvents(args: PPyObject): PPyObject;
_bindings : PPyObject;
_type : PPyTypeObject;
begin
+ Adjust(@Self);
_prefix := 'handle_';
with GetPythonEngine do begin
// We adjust the transmitted self argument
- Adjust(@Self);
Result := nil;
s := nil;
if PyArg_ParseTuple( args, '|O:BindMethodsToEvents',@s ) <> 0 then
@@ -800,18 +791,22 @@ function TPyDelphiComponent.BindMethodsToEvents(args: PPyObject): PPyObject;
if Assigned(_comp) and Assigned(objComp) and IsPublishedProp(_comp, _eventName) then
begin
objMethod := PyObject_GenericGetAttr(GetSelf, key);
- if PyErr_Occurred <> nil then
- Exit;
- PyObject_SetAttrString(objComp, PAnsiChar(AnsiString(_eventName)), objMethod);
- if PyErr_Occurred <> nil then
- Exit
- else
- begin
- _pair := PyTuple_New(3);
- PyTuple_SetItem(_pair, 0, PyString_FromString(PAnsiChar(AnsiString(_compName))));
- PyTuple_SetItem(_pair, 1, PyString_FromString(PAnsiChar(AnsiString(_eventName))));
- PyTuple_SetItem(_pair, 2, objMethod);
- PyList_Append(_bindings, _pair);
+ try
+ if PyErr_Occurred <> nil then
+ Exit;
+ PyObject_SetAttrString(objComp, PAnsiChar(AnsiString(_eventName)), objMethod);
+ if PyErr_Occurred <> nil then
+ Exit
+ else
+ begin
+ _pair := PyTuple_New(3);
+ PyTuple_SetItem(_pair, 0, PyString_FromDelphiString(_compName));
+ PyTuple_SetItem(_pair, 1, PyString_FromDelphiString(_eventName));
+ PyTuple_SetItem(_pair, 2, objMethod);
+ PyList_Append(_bindings, _pair);
+ end;
+ finally
+ Py_XDecRef(objMethod);
end;
end;
end;
@@ -839,36 +834,30 @@ function TPyDelphiComponent.BindMethodsToEvents(args: PPyObject): PPyObject;
function TPyDelphiComponent.Get_ComponentCount(AContext: Pointer): PPyObject;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- Result := PyInt_FromLong(DelphiObject.ComponentCount);
- end;
+ Adjust(@Self);
+ Result := GetPythonEngine.PyInt_FromLong(DelphiObject.ComponentCount);
end;
function TPyDelphiComponent.Get_Components(AContext: Pointer): PPyObject;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- Result := Self.PyDelphiWrapper.DefaultContainerType.CreateInstance;
- with PythonToDelphi(Result) as TPyDelphiContainer do
- Setup(Self.PyDelphiWrapper, Self.ContainerAccess.Clone);
- end;
+ Adjust(@Self);
+ Result := Self.PyDelphiWrapper.DefaultContainerType.CreateInstance;
+ with PythonToDelphi(Result) as TPyDelphiContainer do
+ Setup(Self.PyDelphiWrapper, Self.ContainerAccess.Clone);
end;
function TPyDelphiComponent.Get_Owner(AContext: Pointer): PPyObject;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- Result := Wrap(DelphiObject.Owner);
- end;
+ Adjust(@Self);
+ Result := Wrap(DelphiObject.Owner);
end;
function TPyDelphiComponent.GetParentComponent_Wrapper(
args: PPyObject): PPyObject;
begin
+ Adjust(@Self);
with GetPythonEngine do begin
// We adjust the transmitted self argument
- Adjust(@Self);
if PyArg_ParseTuple( args, ':GetParentComponent') <> 0 then begin
Result := Wrap(DelphiObject.GetParentComponent)
end else
@@ -878,9 +867,9 @@ function TPyDelphiComponent.GetParentComponent_Wrapper(
function TPyDelphiComponent.HasParent_Wrapper(args: PPyObject): PPyObject;
begin
+ Adjust(@Self);
with GetPythonEngine do begin
// We adjust the transmitted self argument
- Adjust(@Self);
if PyArg_ParseTuple( args, ':HasParent') <> 0 then begin
Result := VariantAsPyObject(DelphiObject.HasParent)
end else
@@ -1071,7 +1060,7 @@ function TStringsAccess.GetContainer: TStrings;
function TStringsAccess.GetItem(AIndex: Integer): PPyObject;
begin
- Result := GetPythonEngine.PyString_FromString( PAnsiChar(AnsiString(Container[AIndex])) );
+ Result := GetPythonEngine.PyString_FromDelphiString( Container[AIndex] );
end;
function TStringsAccess.GetSize: Integer;
@@ -1302,28 +1291,24 @@ function TPyDelphiStrings.GetDelphiObject: TStrings;
function TPyDelphiStrings.Get_Capacity(AContext: Pointer): PPyObject;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- Result := PyInt_FromLong(DelphiObject.Capacity);
- end;
+ Adjust(@Self);
+ Result := GetPythonEngine.PyInt_FromLong(DelphiObject.Capacity);
end;
function TPyDelphiStrings.Get_Objects(AContext: Pointer): PPyObject;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- Result := Self.PyDelphiWrapper.DefaultContainerType.CreateInstance;
- with PythonToDelphi(Result) as TPyDelphiContainer do
- Setup(Self.PyDelphiWrapper, TStringsObjectsAccess.Create(Self.PyDelphiWrapper, Self.DelphiObject));
- end;
+ Adjust(@Self);
+ Result := Self.PyDelphiWrapper.DefaultContainerType.CreateInstance;
+ with PythonToDelphi(Result) as TPyDelphiContainer do
+ Setup(Self.PyDelphiWrapper, TStringsObjectsAccess.Create(Self.PyDelphiWrapper,
+ Self.DelphiObject));
end;
function TPyDelphiStrings.Get_Text(AContext: Pointer): PPyObject;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- Result := PyString_FromString(PAnsiChar(GetPythonEngine.CleanString(AnsiString(DelphiObject.Text))));
- end;
+ Adjust(@Self);
+ Result := GetPythonEngine.PyString_FromDelphiString(
+ CleanString(DelphiObject.Text, False));
end;
function TPyDelphiStrings.IndexOf_Wrapper(args: PPyObject): PPyObject;
@@ -1438,9 +1423,8 @@ class procedure TPyDelphiStrings.RegisterMethods(PythonType: TPythonType);
function TPyDelphiStrings.Repr: PPyObject;
begin
- with GetPythonEngine do
- Result := PyString_FromString( PAnsiChar(AnsiString(Format('',
- [NativeInt(self)]))) );
+ Result := GetPythonEngine.PyString_FromDelphiString( Format('',
+ [NativeInt(self)]) );
end;
function TPyDelphiStrings.SaveToFile_Wrapper(args: PPyObject): PPyObject;
diff --git a/PythonForDelphi/Components/Sources/Core/WrapDelphiComCtrls.pas b/PythonForDelphi/Components/Sources/Core/WrapDelphiComCtrls.pas
index e2c0b6c9..b1f5162e 100644
--- a/PythonForDelphi/Components/Sources/Core/WrapDelphiComCtrls.pas
+++ b/PythonForDelphi/Components/Sources/Core/WrapDelphiComCtrls.pas
@@ -169,15 +169,15 @@ class function TPyDelphiPageControl.DelphiObjectClass: TClass;
function TPyDelphiPageControl.FindNextPage_Wrapper(
args: PPyObject): PPyObject;
+// function FindNextPage(CurPage: TTabSheet; GoForward, CheckTabVisible: Boolean): TTabSheet;
var
_CurPage: TObject;
_pCurPage: PPyObject;
_pGoForward, _pCheckTabVisible: PPyObject;
begin
- // function FindNextPage(CurPage: TTabSheet; GoForward, CheckTabVisible: Boolean): TTabSheet;
+ // We adjust the transmitted self argument
+ Adjust(@Self);
with GetPythonEngine do begin
- // We adjust the transmitted self argument
- Adjust(@Self);
if PyArg_ParseTuple( args, 'OOO:FindNextPage',@_pCurPage, @_pGoForward, @_pCheckTabVisible ) <> 0 then begin
if CheckObjAttribute(_pCurPage, 'CurPage', TTabSheet, _CurPage) then
Result := Wrap( DelphiObject.FindNextPage(TTabSheet(_CurPage), PyObject_IsTrue(_pGoForward)<>0, PyObject_IsTrue(_pCheckTabVisible)<>0) )
@@ -203,7 +203,7 @@ function TPyDelphiPageControl.GetHitTestInfoAt_Wrapper(
begin
with GetPythonEngine do
begin
- _text := PyString_FromString(PAnsiChar(AnsiString(AText)));
+ _text := PyString_FromDelphiString(AText);
PyList_Append(Result, _text);
Py_DecRef(_text);
end;
@@ -213,9 +213,9 @@ function TPyDelphiPageControl.GetHitTestInfoAt_Wrapper(
x, y: Integer;
_result : THitTests;
begin
+ // We adjust the transmitted self argument
+ Adjust(@Self);
with GetPythonEngine do begin
- // We adjust the transmitted self argument
- Adjust(@Self);
if PyArg_ParseTuple( args, 'ii:GetHitTestInfoAt',@x, @y ) <> 0 then begin
_result := DelphiObject.GetHitTestInfoAt(x, y);
Result := PyList_New(0);
@@ -257,10 +257,8 @@ function TPyDelphiPageControl.Get_ActivePage(AContext: Pointer): PPyObject;
function TPyDelphiPageControl.Get_ActivePageIndex(
AContext: Pointer): PPyObject;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- Result := PyInt_FromLong(DelphiObject.ActivePageIndex);
- end;
+ Adjust(@Self);
+ Result := GetPythonEngine.PyInt_FromLong(DelphiObject.ActivePageIndex);
end;
{$IFNDEF FPC}
@@ -272,29 +270,23 @@ function TPyDelphiPageControl.Get_Canvas(AContext: Pointer): PPyObject;
function TPyDelphiPageControl.Get_PageCount(AContext: Pointer): PPyObject;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- Result := PyInt_FromLong(DelphiObject.PageCount);
- end;
+ Adjust(@Self);
+ Result := GetPythonEngine.PyInt_FromLong(DelphiObject.PageCount);
end;
function TPyDelphiPageControl.Get_Pages(AContext: Pointer): PPyObject;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- Result := Self.PyDelphiWrapper.DefaultContainerType.CreateInstance;
- with PythonToDelphi(Result) as TPyDelphiContainer do
- Setup(Self.PyDelphiWrapper, TPagesAccess.Create(Self.PyDelphiWrapper, Self.DelphiObject));
- end;
+ Adjust(@Self);
+ Result := Self.PyDelphiWrapper.DefaultContainerType.CreateInstance;
+ with PythonToDelphi(Result) as TPyDelphiContainer do
+ Setup(Self.PyDelphiWrapper, TPagesAccess.Create(Self.PyDelphiWrapper, Self.DelphiObject));
end;
{$IFNDEF FPC}
function TPyDelphiPageControl.Get_RowCount(AContext: Pointer): PPyObject;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- Result := PyInt_FromLong(DelphiObject.RowCount);
- end;
+ Adjust(@Self);
+ Result := GetPythonEngine.PyInt_FromLong(DelphiObject.RowCount);
end;
function TPyDelphiPageControl.IndexOfTabAt_Wrapper(
@@ -302,9 +294,9 @@ function TPyDelphiPageControl.IndexOfTabAt_Wrapper(
var
x, y: Integer;
begin
+ // We adjust the transmitted self argument
+ Adjust(@Self);
with GetPythonEngine do begin
- // We adjust the transmitted self argument
- Adjust(@Self);
if PyArg_ParseTuple( args, 'ii:IndexOfTabAt',@x, @y ) <> 0 then begin
Result := VariantAsPyObject( DelphiObject.IndexOfTabAt(x, y) );
end else
@@ -369,9 +361,9 @@ function TPyDelphiPageControl.ScrollTabs_Wrapper(
var
delta: Integer;
begin
+ // We adjust the transmitted self argument
+ Adjust(@Self);
with GetPythonEngine do begin
- // We adjust the transmitted self argument
- Adjust(@Self);
if PyArg_ParseTuple( args, 'i:ScrollTabs',@delta ) <> 0 then begin
DelphiObject.ScrollTabs(delta);
Result := ReturnNone;
@@ -383,13 +375,13 @@ function TPyDelphiPageControl.ScrollTabs_Wrapper(
function TPyDelphiPageControl.SelectNextPage_Wrapper(
args: PPyObject): PPyObject;
+// procedure SelectNextPage(GoForward: Boolean; CheckTabVisible: Boolean = True);
var
_pGoForward, _pCheckTabVisible: PPyObject;
begin
- // procedure SelectNextPage(GoForward: Boolean; CheckTabVisible: Boolean = True);
+ // We adjust the transmitted self argument
+ Adjust(@Self);
with GetPythonEngine do begin
- // We adjust the transmitted self argument
- Adjust(@Self);
if PyArg_ParseTuple( args, 'OO:SelectNextPage',@_pGoForward, @_pCheckTabVisible ) <> 0 then begin
DelphiObject.SelectNextPage(PyObject_IsTrue(_pGoForward)<>0, PyObject_IsTrue(_pCheckTabVisible)<>0);
Result := ReturnNone;
@@ -409,16 +401,14 @@ function TPyDelphiPageControl.Set_ActivePage(AValue: PPyObject;
var
_object : TObject;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- if CheckObjAttribute(AValue, 'ActivePage', TTabSheet, _object) then
- begin
- Self.DelphiObject.ActivePage := TTabSheet(_object);
- Result := 0;
- end
- else
- Result := -1;
- end;
+ Adjust(@Self);
+ if CheckObjAttribute(AValue, 'ActivePage', TTabSheet, _object) then
+ begin
+ Self.DelphiObject.ActivePage := TTabSheet(_object);
+ Result := 0;
+ end
+ else
+ Result := -1;
end;
function TPyDelphiPageControl.Set_ActivePageIndex(AValue: PPyObject;
@@ -426,30 +416,26 @@ function TPyDelphiPageControl.Set_ActivePageIndex(AValue: PPyObject;
var
_value : Integer;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- if CheckIntAttribute(AValue, 'ActivePageIndex', _value) then
- begin
- DelphiObject.ActivePageIndex := _value;
- Result := 0;
- end
- else
- Result := -1;
- end;
+ Adjust(@Self);
+ if CheckIntAttribute(AValue, 'ActivePageIndex', _value) then
+ begin
+ DelphiObject.ActivePageIndex := _value;
+ Result := 0;
+ end
+ else
+ Result := -1;
end;
function TPyDelphiPageControl.TabRect_Wrapper(args: PPyObject): PPyObject;
var
idx: Integer;
begin
- with GetPythonEngine do begin
- // We adjust the transmitted self argument
- Adjust(@Self);
- if PyArg_ParseTuple( args, 'i:TabRect',@idx ) <> 0 then begin
- Result := WrapRect(PyDelphiWrapper, DelphiObject.TabRect(idx));
- end else
- Result := nil;
- end;
+ // We adjust the transmitted self argument
+ Adjust(@Self);
+ if GetPythonEngine.PyArg_ParseTuple( args, 'i:TabRect',@idx ) <> 0 then begin
+ Result := WrapRect(PyDelphiWrapper, DelphiObject.TabRect(idx));
+ end else
+ Result := nil;
end;
{ TPyDelphiTabSheet }
@@ -466,18 +452,14 @@ function TPyDelphiTabSheet.GetDelphiObject: TTabSheet;
function TPyDelphiTabSheet.Get_PageControl(AContext: Pointer): PPyObject;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- Result := Wrap(DelphiObject.PageControl);
- end;
+ Adjust(@Self);
+ Result := Wrap(DelphiObject.PageControl);
end;
function TPyDelphiTabSheet.Get_TabIndex(AContext: Pointer): PPyObject;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- Result := PyInt_FromLong(DelphiObject.TabIndex);
- end;
+ Adjust(@Self);
+ Result := GetPythonEngine.PyInt_FromLong(DelphiObject.TabIndex);
end;
class procedure TPyDelphiTabSheet.RegisterGetSets(PythonType: TPythonType);
@@ -499,16 +481,14 @@ function TPyDelphiTabSheet.Set_PageControl(AValue: PPyObject;
var
_object : TObject;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- if CheckObjAttribute(AValue, 'PageControl', TPageControl, _object) then
- begin
- Self.DelphiObject.PageControl := TPageControl(_object);
- Result := 0;
- end
- else
- Result := -1;
- end;
+ Adjust(@Self);
+ if CheckObjAttribute(AValue, 'PageControl', TPageControl, _object) then
+ begin
+ Self.DelphiObject.PageControl := TPageControl(_object);
+ Result := 0;
+ end
+ else
+ Result := -1;
end;
{ TPagesAccess }
diff --git a/PythonForDelphi/Components/Sources/Core/WrapDelphiControls.pas b/PythonForDelphi/Components/Sources/Core/WrapDelphiControls.pas
index 211a5815..e055d488 100644
--- a/PythonForDelphi/Components/Sources/Core/WrapDelphiControls.pas
+++ b/PythonForDelphi/Components/Sources/Core/WrapDelphiControls.pas
@@ -192,9 +192,9 @@ procedure TControlsRegistration.RegisterWrappers(APyDelphiWrapper: TPyDelphiWrap
function TPyDelphiControl.BringToFront_Wrapper(args: PPyObject): PPyObject;
begin
+ // We adjust the transmitted self argument
+ Adjust(@Self);
with GetPythonEngine do begin
- // We adjust the transmitted self argument
- Adjust(@Self);
if PyArg_ParseTuple( args, ':BringToFront') <> 0 then begin
DelphiObject.BringToFront;
Result := ReturnNone;
@@ -209,9 +209,9 @@ function TPyDelphiControl.ClientToScreen_Wrapper(
p : TPoint;
pt : PPyObject;
begin
+ // We adjust the transmitted self argument
+ Adjust(@Self);
with GetPythonEngine do begin
- // We adjust the transmitted self argument
- Adjust(@Self);
if PyArg_ParseTuple( args, 'O:ClientToScreen',@pt ) <> 0 then begin
if CheckPointAttribute(pt, 'point', p) then
Result := WrapPoint(PyDelphiWrapper, DelphiObject.ClientToScreen(p))
@@ -234,17 +234,15 @@ function TPyDelphiControl.GetDelphiObject: TControl;
function TPyDelphiControl.Get_Parent(AContext: Pointer): PPyObject;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- Result := Wrap(DelphiObject.Parent);
- end;
+ Adjust(@Self);
+ Result := Wrap(DelphiObject.Parent);
end;
function TPyDelphiControl.Hide_Wrapper(args: PPyObject): PPyObject;
begin
+ // We adjust the transmitted self argument
+ Adjust(@Self);
with GetPythonEngine do begin
- // We adjust the transmitted self argument
- Adjust(@Self);
if PyArg_ParseTuple( args, ':Hide') <> 0 then begin
DelphiObject.Hide;
Result := ReturnNone;
@@ -255,9 +253,9 @@ function TPyDelphiControl.Hide_Wrapper(args: PPyObject): PPyObject;
function TPyDelphiControl.Invalidate_Wrapper(args: PPyObject): PPyObject;
begin
+ // We adjust the transmitted self argument
+ Adjust(@Self);
with GetPythonEngine do begin
- // We adjust the transmitted self argument
- Adjust(@Self);
if PyArg_ParseTuple( args, ':Invalidate') <> 0 then begin
DelphiObject.Invalidate;
Result := ReturnNone;
@@ -310,9 +308,9 @@ class procedure TPyDelphiControl.RegisterMethods(PythonType: TPythonType);
function TPyDelphiControl.Repaint_Wrapper(args: PPyObject): PPyObject;
begin
+ // We adjust the transmitted self argument
+ Adjust(@Self);
with GetPythonEngine do begin
- // We adjust the transmitted self argument
- Adjust(@Self);
if PyArg_ParseTuple( args, ':Repaint') <> 0 then begin
DelphiObject.Repaint;
Result := ReturnNone;
@@ -327,24 +325,22 @@ function TPyDelphiControl.ScreenToClient_Wrapper(
p : TPoint;
pt : PPyObject;
begin
- with GetPythonEngine do begin
- // We adjust the transmitted self argument
- Adjust(@Self);
- if PyArg_ParseTuple( args, 'O:ScreenToClient',@pt ) <> 0 then begin
- if CheckPointAttribute(pt, 'point', p) then
- Result := WrapPoint(PyDelphiWrapper, DelphiObject.ScreenToClient(p))
- else
- Result := nil;
- end else
+ // We adjust the transmitted self argument
+ Adjust(@Self);
+ if GetPythonEngine.PyArg_ParseTuple( args, 'O:ScreenToClient',@pt ) <> 0 then begin
+ if CheckPointAttribute(pt, 'point', p) then
+ Result := WrapPoint(PyDelphiWrapper, DelphiObject.ScreenToClient(p))
+ else
Result := nil;
- end;
+ end else
+ Result := nil;
end;
function TPyDelphiControl.SendToBack_Wrapper(args: PPyObject): PPyObject;
begin
+ // We adjust the transmitted self argument
+ Adjust(@Self);
with GetPythonEngine do begin
- // We adjust the transmitted self argument
- Adjust(@Self);
if PyArg_ParseTuple( args, ':SendToBack') <> 0 then begin
DelphiObject.SendToBack;
Result := ReturnNone;
@@ -360,9 +356,9 @@ function TPyDelphiControl.SetBounds_Wrapper(args: PPyObject): PPyObject;
_width : Integer;
_height : Integer;
begin
+ // We adjust the transmitted self argument
+ Adjust(@Self);
with GetPythonEngine do begin
- // We adjust the transmitted self argument
- Adjust(@Self);
if PyArg_ParseTuple( args, 'iiii:SetBounds',@_left, @_top, @_width, @_height ) <> 0 then begin
DelphiObject.SetBounds(_left, _top, _width, _height);
Result := ReturnNone;
@@ -381,23 +377,21 @@ function TPyDelphiControl.Set_Parent(AValue: PPyObject;
var
_object : TObject;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- if CheckObjAttribute(AValue, 'Parent', TWinControl, _object) then
- begin
- Self.DelphiObject.Parent := TWinControl(_object);
- Result := 0;
- end
- else
- Result := -1;
- end;
+ Adjust(@Self);
+ if CheckObjAttribute(AValue, 'Parent', TWinControl, _object) then
+ begin
+ Self.DelphiObject.Parent := TWinControl(_object);
+ Result := 0;
+ end
+ else
+ Result := -1;
end;
function TPyDelphiControl.Show_Wrapper(args: PPyObject): PPyObject;
begin
+ // We adjust the transmitted self argument
+ Adjust(@Self);
with GetPythonEngine do begin
- // We adjust the transmitted self argument
- Adjust(@Self);
if PyArg_ParseTuple( args, ':Show') <> 0 then begin
DelphiObject.Show;
Result := ReturnNone;
@@ -408,9 +402,9 @@ function TPyDelphiControl.Show_Wrapper(args: PPyObject): PPyObject;
function TPyDelphiControl.Update_Wrapper(args: PPyObject): PPyObject;
begin
+ // We adjust the transmitted self argument
+ Adjust(@Self);
with GetPythonEngine do begin
- // We adjust the transmitted self argument
- Adjust(@Self);
if PyArg_ParseTuple( args, ':Update') <> 0 then begin
DelphiObject.Update;
Result := ReturnNone;
@@ -497,9 +491,9 @@ class function TControlsAccess.SupportsIndexOf: Boolean;
function TPyDelphiWinControl.CanFocus_Wrapper(args: PPyObject): PPyObject;
begin
+ // We adjust the transmitted self argument
+ Adjust(@Self);
with GetPythonEngine do begin
- // We adjust the transmitted self argument
- Adjust(@Self);
if PyArg_ParseTuple( args, ':CanFocus') <> 0 then begin
Result := VariantAsPyObject(DelphiObject.CanFocus)
end else
@@ -519,62 +513,48 @@ function TPyDelphiWinControl.GetDelphiObject: TWinControl;
function TPyDelphiWinControl.Get_ControlCount(AContext: Pointer): PPyObject;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- Result := PyInt_FromLong(DelphiObject.ControlCount);
- end;
+ Adjust(@Self);
+ Result := GetPythonEngine.PyInt_FromLong(DelphiObject.ControlCount);
end;
function TPyDelphiWinControl.Get_Controls(AContext: Pointer): PPyObject;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- Result := Self.PyDelphiWrapper.DefaultContainerType.CreateInstance;
- with PythonToDelphi(Result) as TPyDelphiContainer do
- Setup(Self.PyDelphiWrapper, TControlsAccess.Create(Self.PyDelphiWrapper, Self.DelphiObject));
- end;
+ Adjust(@Self);
+ Result := Self.PyDelphiWrapper.DefaultContainerType.CreateInstance;
+ with PythonToDelphi(Result) as TPyDelphiContainer do
+ Setup(Self.PyDelphiWrapper, TControlsAccess.Create(Self.PyDelphiWrapper, Self.DelphiObject));
end;
function TPyDelphiWinControl.Get_Focused(AContext: Pointer): PPyObject;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- Result := VariantAsPyObject(DelphiObject.Focused);
- end;
+ Adjust(@Self);
+ Result := GetPythonEngine.VariantAsPyObject(DelphiObject.Focused);
end;
function TPyDelphiWinControl.Get_Handle(AContext: Pointer): PPyObject;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- Result := PyInt_FromLong(DelphiObject.Handle);
- end;
+ Adjust(@Self);
+ Result := GetPythonEngine.PyInt_FromLong(DelphiObject.Handle);
end;
function TPyDelphiWinControl.Get_HandleAllocated(
AContext: Pointer): PPyObject;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- Result := VariantAsPyObject(DelphiObject.HandleAllocated);
- end;
+ Adjust(@Self);
+ Result := GetPythonEngine.VariantAsPyObject(DelphiObject.HandleAllocated);
end;
function TPyDelphiWinControl.Get_ParentWindow(
AContext: Pointer): PPyObject;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- Result := PyInt_FromLong(DelphiObject.ParentWindow);
- end;
+ Adjust(@Self);
+ Result := GetPythonEngine.PyInt_FromLong(DelphiObject.ParentWindow);
end;
function TPyDelphiWinControl.Get_Showing(AContext: Pointer): PPyObject;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- Result := VariantAsPyObject(DelphiObject.Showing);
- end;
+ Adjust(@Self);
+ Result := GetPythonEngine.VariantAsPyObject(DelphiObject.Showing);
end;
class procedure TPyDelphiWinControl.RegisterGetSets(
@@ -616,9 +596,9 @@ procedure TPyDelphiWinControl.SetDelphiObject(const Value: TWinControl);
function TPyDelphiWinControl.SetFocus_Wrapper(args: PPyObject): PPyObject;
begin
+ // We adjust the transmitted self argument
+ Adjust(@Self);
with GetPythonEngine do begin
- // We adjust the transmitted self argument
- Adjust(@Self);
if PyArg_ParseTuple( args, ':SetFocus') <> 0 then begin
DelphiObject.SetFocus;
Result := ReturnNone;
diff --git a/PythonForDelphi/Components/Sources/Core/WrapDelphiDialogs.pas b/PythonForDelphi/Components/Sources/Core/WrapDelphiDialogs.pas
new file mode 100644
index 00000000..6e9b4630
--- /dev/null
+++ b/PythonForDelphi/Components/Sources/Core/WrapDelphiDialogs.pas
@@ -0,0 +1,112 @@
+unit WrapDelphiDialogs;
+{$I Definition.Inc}
+
+interface
+
+uses
+ Classes, SysUtils, PythonEngine, WrapDelphi, WrapDelphiClasses,
+ WrapDelphiControls, Windows, Dialogs, TypInfo;
+
+type
+ TPyDelphiOpenDialog = class(TPyDelphiComponent)
+ private
+ function GetDelphiObject: TOpenDialog;
+ procedure SetDelphiObject(const Value: TOpenDialog);
+ protected
+ // Exposed Methods
+ function Execute_Wrapper(args: PPyObject): PPyObject; cdecl;
+ // Property Getters
+ function Get_filename(AContext: Pointer): PPyObject; cdecl;
+ public
+ class function DelphiObjectClass: TClass; override;
+ class procedure RegisterGetSets(PythonType: TPythonType); override;
+ class procedure RegisterMethods( PythonType : TPythonType ); override;
+ // Properties
+ property DelphiObject: TOpenDialog read GetDelphiObject
+ write SetDelphiObject;
+ end;
+
+implementation
+
+uses
+ WrapDelphiTypes;
+
+{ Register the wrappers, the globals and the constants }
+type
+ TDialogRegistration = class(TRegisteredUnit)
+ public
+ function Name: String; override;
+ procedure RegisterWrappers(APyDelphiWrapper: TPyDelphiWrapper); override;
+ procedure DefineVars(APyDelphiWrapper: TPyDelphiWrapper); override;
+ end;
+
+ { TDialogRegistration }
+procedure TDialogRegistration.DefineVars(APyDelphiWrapper: TPyDelphiWrapper);
+begin
+ inherited;
+end;
+
+function TDialogRegistration.Name: String;
+begin
+ Result := 'Dialog';
+end;
+
+procedure TDialogRegistration.RegisterWrappers(APyDelphiWrapper
+ : TPyDelphiWrapper);
+begin
+ inherited;
+ APyDelphiWrapper.RegisterDelphiWrapper(TPyDelphiOpenDialog);
+end;
+
+{ TPyDelphiOpenDialog }
+class function TPyDelphiOpenDialog.DelphiObjectClass: TClass;
+begin
+ Result := TOpenDialog;
+end;
+
+function TPyDelphiOpenDialog.GetDelphiObject: TOpenDialog;
+begin
+ Result := TOpenDialog(inherited DelphiObject);
+end;
+
+function TPyDelphiOpenDialog.Execute_Wrapper(args: PPyObject): PPyObject;
+begin
+ // We adjust the transmitted self argument
+ Adjust(@Self);
+ with GetPythonEngine do begin
+ if PyArg_ParseTuple( args, ':Execute') <> 0 then
+ Result := VariantAsPyObject(DelphiObject.Execute())
+ else
+ Result := nil;
+ end;
+end;
+
+function TPyDelphiOpenDialog.Get_filename(AContext: Pointer): PPyObject;
+begin
+ Adjust(@self);
+ Result := GetPythonEngine.VariantAsPyObject(DelphiObject.FileName);
+end;
+
+class procedure TPyDelphiOpenDialog.RegisterGetSets(PythonType: TPythonType);
+begin
+ inherited;
+ PythonType.AddGetSet('FileName', @TPyDelphiOpenDialog.Get_filename,
+ nil, '', nil);
+end;
+
+class procedure TPyDelphiOpenDialog.RegisterMethods(PythonType: TPythonType);
+begin
+ inherited;
+ PythonType.AddMethod('Execute', @TPyDelphiOpenDialog.Execute_Wrapper,
+ 'TOpenDialog.Execute()'#10 +
+ 'Displays the dialog');
+end;
+
+procedure TPyDelphiOpenDialog.SetDelphiObject(const Value: TOpenDialog);
+begin
+ inherited DelphiObject := Value;
+end;
+
+initialization
+ RegisteredUnits.Add(TDialogRegistration.Create);
+end.
diff --git a/PythonForDelphi/Components/Sources/Core/WrapDelphiForms.pas b/PythonForDelphi/Components/Sources/Core/WrapDelphiForms.pas
index f45f4867..feb95722 100644
--- a/PythonForDelphi/Components/Sources/Core/WrapDelphiForms.pas
+++ b/PythonForDelphi/Components/Sources/Core/WrapDelphiForms.pas
@@ -453,10 +453,10 @@ procedure TFormsRegistration.RegisterWrappers(APyDelphiWrapper: TPyDelphiWrapper
function TPyDelphiCustomForm.Close_Wrapper(args: PPyObject): PPyObject;
begin
+ // We adjust the transmitted self argument
+ Adjust(@Self);
with GetPythonEngine do begin
- // We adjust the transmitted self argument
- Adjust(@Self);
- if PyArg_ParseTuple( args, ':Close') <> 0 then begin
+ if GetPythonEngine.PyArg_ParseTuple( args, ':Close') <> 0 then begin
DelphiObject.Close;
Result := ReturnNone;
end else
@@ -466,9 +466,9 @@ function TPyDelphiCustomForm.Close_Wrapper(args: PPyObject): PPyObject;
function TPyDelphiCustomForm.CloseQuery_Wrapper(args: PPyObject): PPyObject;
begin
+ // We adjust the transmitted self argument
+ Adjust(@Self);
with GetPythonEngine do begin
- // We adjust the transmitted self argument
- Adjust(@Self);
if PyArg_ParseTuple( args, ':CloseQuery') <> 0 then begin
Result := VariantAsPyObject(DelphiObject.CloseQuery)
end else
@@ -478,10 +478,10 @@ function TPyDelphiCustomForm.CloseQuery_Wrapper(args: PPyObject): PPyObject;
function TPyDelphiCustomForm.Release_Wrapper(args: PPyObject): PPyObject;
begin
+ // We adjust the transmitted self argument
+ Adjust(@Self);
with GetPythonEngine do
begin
- // We adjust the transmitted self argument
- Adjust(@Self);
if PyArg_ParseTuple( args, ':Release') <> 0 then
begin
if Owned then begin
@@ -504,9 +504,9 @@ function TPyDelphiCustomForm.ShowModal_Wrapper(args: PPyObject): PPyObject;
Var
ModalResult : integer;
begin
+ // We adjust the transmitted self argument
+ Adjust(@Self);
with GetPythonEngine do begin
- // We adjust the transmitted self argument
- Adjust(@Self);
if PyArg_ParseTuple( args, ':ShowModal') <> 0 then begin
ModalResult := (DelphiObject as TForm).ShowModal;
Result := PyInt_FromLong(ModalResult);
@@ -559,10 +559,8 @@ class function TPyDelphiCustomForm.DelphiObjectClass: TClass;
function TPyDelphiCustomForm.Get_ModalResult(AContext: Pointer): PPyObject;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- Result := PyInt_FromLong(DelphiObject.ModalResult);
- end;
+ Adjust(@Self);
+ Result := GetPythonEngine.PyInt_FromLong(DelphiObject.ModalResult);
end;
function TPyDelphiCustomForm.Set_ModalResult(AValue: PPyObject;
@@ -648,9 +646,9 @@ destructor TPyDelphiScreen.Destroy;
{$IFNDEF FPC}
function TPyDelphiScreen.DisableAlign_Wrapper(args: PPyObject): PPyObject;
begin
+ // We adjust the transmitted self argument
+ Adjust(@Self);
with GetPythonEngine do begin
- // We adjust the transmitted self argument
- Adjust(@Self);
if PyArg_ParseTuple( args, ':DisableAlign') <> 0 then begin
DelphiObject.DisableAlign;
Result := ReturnNone;
@@ -661,9 +659,9 @@ function TPyDelphiScreen.DisableAlign_Wrapper(args: PPyObject): PPyObject;
function TPyDelphiScreen.EnableAlign_Wrapper(args: PPyObject): PPyObject;
begin
+ // We adjust the transmitted self argument
+ Adjust(@Self);
with GetPythonEngine do begin
- // We adjust the transmitted self argument
- Adjust(@Self);
if PyArg_ParseTuple( args, ':EnableAlign') <> 0 then begin
DelphiObject.EnableAlign;
Result := ReturnNone;
@@ -680,234 +678,182 @@ function TPyDelphiScreen.GetDelphiObject: TScreen;
function TPyDelphiScreen.Get_ActiveControl(AContext: Pointer): PPyObject;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- Result := Wrap(DelphiObject.ActiveControl);
- end;
+ Adjust(@Self);
+ Result := Wrap(DelphiObject.ActiveControl);
end;
function TPyDelphiScreen.Get_ActiveCustomForm(
AContext: Pointer): PPyObject;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- Result := Wrap(DelphiObject.ActiveCustomForm);
- end;
+ Adjust(@Self);
+ Result := Wrap(DelphiObject.ActiveCustomForm);
end;
function TPyDelphiScreen.Get_ActiveForm(AContext: Pointer): PPyObject;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- Result := Wrap(DelphiObject.ActiveForm);
- end;
+ Adjust(@Self);
+ Result := Wrap(DelphiObject.ActiveForm);
end;
function TPyDelphiScreen.Get_Cursor(AContext: Pointer): PPyObject;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- Result := PyInt_FromLong(DelphiObject.Cursor);
- end;
+ Adjust(@Self);
+ Result := GetPythonEngine.PyInt_FromLong(DelphiObject.Cursor);
end;
function TPyDelphiScreen.Get_Cursors(AContext: Pointer): PPyObject;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- Result := PyDelphiWrapper.DefaultContainerType.CreateInstance;
- with PythonToDelphi(Result) as TPyDelphiContainer do
- Setup(Self.PyDelphiWrapper, TScreenCursorsAccess.Create(Self.PyDelphiWrapper, Self.DelphiObject));
- end;
+ Adjust(@Self);
+ Result := PyDelphiWrapper.DefaultContainerType.CreateInstance;
+ with PythonToDelphi(Result) as TPyDelphiContainer do
+ Setup(Self.PyDelphiWrapper, TScreenCursorsAccess.Create(Self.PyDelphiWrapper, Self.DelphiObject));
end;
function TPyDelphiScreen.Get_CustomFormCount(AContext: Pointer): PPyObject;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- Result := PyInt_FromLong(DelphiObject.CustomFormCount);
- end;
+ Adjust(@Self);
+ Result := GetPythonEngine.PyInt_FromLong(DelphiObject.CustomFormCount);
end;
function TPyDelphiScreen.Get_CustomForms(AContext: Pointer): PPyObject;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- Result := PyDelphiWrapper.DefaultContainerType.CreateInstance;
- with PythonToDelphi(Result) as TPyDelphiContainer do
- Setup(Self.PyDelphiWrapper, TScreenCustomFormsAccess.Create(Self.PyDelphiWrapper, Self.DelphiObject));
- end;
+ Adjust(@Self);
+ Result := PyDelphiWrapper.DefaultContainerType.CreateInstance;
+ with PythonToDelphi(Result) as TPyDelphiContainer do
+ Setup(Self.PyDelphiWrapper, TScreenCustomFormsAccess.Create(Self.PyDelphiWrapper, Self.DelphiObject));
end;
function TPyDelphiScreen.Get_DataModuleCount(AContext: Pointer): PPyObject;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- Result := PyInt_FromLong(DelphiObject.DataModuleCount);
- end;
+ Adjust(@Self);
+ Result := GetPythonEngine.PyInt_FromLong(DelphiObject.DataModuleCount);
end;
function TPyDelphiScreen.Get_DataModules(AContext: Pointer): PPyObject;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- Result := PyDelphiWrapper.DefaultContainerType.CreateInstance;
- with PythonToDelphi(Result) as TPyDelphiContainer do
- Setup(Self.PyDelphiWrapper, TScreenDataModulesAccess.Create(Self.PyDelphiWrapper, Self.DelphiObject));
- end;
+ Adjust(@Self);
+ Result := PyDelphiWrapper.DefaultContainerType.CreateInstance;
+ with PythonToDelphi(Result) as TPyDelphiContainer do
+ Setup(Self.PyDelphiWrapper, TScreenDataModulesAccess.Create(Self.PyDelphiWrapper, Self.DelphiObject));
end;
{$IFNDEF FPC}
function TPyDelphiScreen.Get_DefaultIme(AContext: Pointer): PPyObject;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- Result := PyString_FromString(PAnsiChar(AnsiString(DelphiObject.DefaultIme)));
- end;
+ Adjust(@Self);
+ Result := GetPythonEngine.PyString_FromDelphiString(DelphiObject.DefaultIme);
end;
function TPyDelphiScreen.Get_DefaultKbLayout(AContext: Pointer): PPyObject;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- Result := PyInt_FromLong(DelphiObject.DefaultKbLayout);
- end;
+ Adjust(@Self);
+ Result := GetPythonEngine.PyInt_FromLong(DelphiObject.DefaultKbLayout);
end;
{$ENDIF FPC}
function TPyDelphiScreen.Get_DesktopHeight(AContext: Pointer): PPyObject;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- Result := PyInt_FromLong(DelphiObject.DesktopHeight);
- end;
+ Adjust(@Self);
+ Result := GetPythonEngine.PyInt_FromLong(DelphiObject.DesktopHeight);
end;
{$IFNDEF FPC}
function TPyDelphiScreen.Get_DesktopLeft(AContext: Pointer): PPyObject;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- Result := PyInt_FromLong(DelphiObject.DesktopLeft);
- end;
+ Adjust(@Self);
+ Result := GetPythonEngine.PyInt_FromLong(DelphiObject.DesktopLeft);
end;
function TPyDelphiScreen.Get_DesktopRect(AContext: Pointer): PPyObject;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- Result := WrapRect(PyDelphiWrapper, DelphiObject.DesktopRect);
- end;
+ Adjust(@Self);
+ Result := WrapRect(PyDelphiWrapper, DelphiObject.DesktopRect);
end;
function TPyDelphiScreen.Get_DesktopTop(AContext: Pointer): PPyObject;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- Result := PyInt_FromLong(DelphiObject.DesktopTop);
- end;
+ Adjust(@Self);
+ Result := GetPythonEngine.PyInt_FromLong(DelphiObject.DesktopTop);
end;
{$ENDIF FPC}
function TPyDelphiScreen.Get_DesktopWidth(AContext: Pointer): PPyObject;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- Result := PyInt_FromLong(DelphiObject.DesktopWidth);
- end;
+ Adjust(@Self);
+ Result := GetPythonEngine.PyInt_FromLong(DelphiObject.DesktopWidth);
end;
function TPyDelphiScreen.Get_Fonts(AContext: Pointer): PPyObject;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- Result := Wrap(DelphiObject.Fonts);
- end;
+ Adjust(@Self);
+ Result := Wrap(DelphiObject.Fonts);
end;
function TPyDelphiScreen.Get_FormCount(AContext: Pointer): PPyObject;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- Result := PyInt_FromLong(DelphiObject.FormCount);
- end;
+ Adjust(@Self);
+ Result := GetPythonEngine.PyInt_FromLong(DelphiObject.FormCount);
end;
function TPyDelphiScreen.Get_Forms(AContext: Pointer): PPyObject;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- Result := PyDelphiWrapper.DefaultContainerType.CreateInstance;
- with PythonToDelphi(Result) as TPyDelphiContainer do
- Setup(Self.PyDelphiWrapper, TScreenFormsAccess.Create(Self.PyDelphiWrapper, Self.DelphiObject));
- end;
+ Adjust(@Self);
+ Result := PyDelphiWrapper.DefaultContainerType.CreateInstance;
+ with PythonToDelphi(Result) as TPyDelphiContainer do
+ Setup(Self.PyDelphiWrapper, TScreenFormsAccess.Create(Self.PyDelphiWrapper, Self.DelphiObject));
end;
function TPyDelphiScreen.Get_Height(AContext: Pointer): PPyObject;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- Result := PyInt_FromLong(DelphiObject.Height);
- end;
+ Adjust(@Self);
+ Result := GetPythonEngine.PyInt_FromLong(DelphiObject.Height);
end;
function TPyDelphiScreen.Get_HintFont(AContext: Pointer): PPyObject;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- Result := Wrap(DelphiObject.HintFont);
- end;
+ Adjust(@Self);
+ Result := Wrap(DelphiObject.HintFont);
end;
function TPyDelphiScreen.Get_IconFont(AContext: Pointer): PPyObject;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- Result := Wrap(DelphiObject.IconFont);
- end;
+ Adjust(@Self);
+ Result := Wrap(DelphiObject.IconFont);
end;
{$IFNDEF FPC}
function TPyDelphiScreen.Get_Imes(AContext: Pointer): PPyObject;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- Result := Wrap(DelphiObject.Imes);
- end;
+ Adjust(@Self);
+ Result := Wrap(DelphiObject.Imes);
end;
{$ENDIF FPC}
function TPyDelphiScreen.Get_MenuFont(AContext: Pointer): PPyObject;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- Result := Wrap(DelphiObject.MenuFont);
- end;
+ Adjust(@Self);
+ Result := Wrap(DelphiObject.MenuFont);
end;
function TPyDelphiScreen.Get_MonitorCount(AContext: Pointer): PPyObject;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- Result := PyInt_FromLong(DelphiObject.MonitorCount);
- end;
+ Adjust(@Self);
+ Result := GetPythonEngine.PyInt_FromLong(DelphiObject.MonitorCount);
end;
function TPyDelphiScreen.Get_Monitors(AContext: Pointer): PPyObject;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- Result := PyDelphiWrapper.DefaultContainerType.CreateInstance;
- with PythonToDelphi(Result) as TPyDelphiContainer do
- Setup(Self.PyDelphiWrapper, TScreenMonitorsAccess.Create(Self.PyDelphiWrapper, Self.DelphiObject));
- end;
+ Adjust(@Self);
+ Result := PyDelphiWrapper.DefaultContainerType.CreateInstance;
+ with PythonToDelphi(Result) as TPyDelphiContainer do
+ Setup(Self.PyDelphiWrapper, TScreenMonitorsAccess.Create(Self.PyDelphiWrapper, Self.DelphiObject));
end;
function TPyDelphiScreen.Get_OnActiveControlChange(
AContext: Pointer): PPyObject;
begin
+ Adjust(@Self);
with GetPythonEngine do begin
- Adjust(@Self);
if Assigned(fOnActiveControlChange) then
begin
Result := fOnActiveControlChange;
@@ -921,8 +867,8 @@ function TPyDelphiScreen.Get_OnActiveControlChange(
function TPyDelphiScreen.Get_OnActiveFormChange(
AContext: Pointer): PPyObject;
begin
+ Adjust(@Self);
with GetPythonEngine do begin
- Adjust(@Self);
if Assigned(fOnActiveFormChange) then
begin
Result := fOnActiveFormChange;
@@ -935,59 +881,45 @@ function TPyDelphiScreen.Get_OnActiveFormChange(
function TPyDelphiScreen.Get_PixelsPerInch(AContext: Pointer): PPyObject;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- Result := PyInt_FromLong(DelphiObject.PixelsPerInch);
- end;
+ Adjust(@Self);
+ Result := GetPythonEngine.PyInt_FromLong(DelphiObject.PixelsPerInch);
end;
function TPyDelphiScreen.Get_Width(AContext: Pointer): PPyObject;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- Result := PyInt_FromLong(DelphiObject.Width);
- end;
+ Adjust(@Self);
+ Result := GetPythonEngine.PyInt_FromLong(DelphiObject.Width);
end;
{$IFNDEF FPC}
function TPyDelphiScreen.Get_WorkAreaHeight(AContext: Pointer): PPyObject;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- Result := PyInt_FromLong(DelphiObject.WorkAreaHeight);
- end;
+ Adjust(@Self);
+ Result := GetPythonEngine.PyInt_FromLong(DelphiObject.WorkAreaHeight);
end;
function TPyDelphiScreen.Get_WorkAreaLeft(AContext: Pointer): PPyObject;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- Result := PyInt_FromLong(DelphiObject.WorkAreaLeft);
- end;
+ Adjust(@Self);
+ Result := GetPythonEngine.PyInt_FromLong(DelphiObject.WorkAreaLeft);
end;
function TPyDelphiScreen.Get_WorkAreaRect(AContext: Pointer): PPyObject;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- Result := WrapRect(PyDelphiWrapper, DelphiObject.WorkAreaRect);
- end;
+ Adjust(@Self);
+ Result := WrapRect(PyDelphiWrapper, DelphiObject.WorkAreaRect);
end;
function TPyDelphiScreen.Get_WorkAreaTop(AContext: Pointer): PPyObject;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- Result := PyInt_FromLong(DelphiObject.WorkAreaTop);
- end;
+ Adjust(@Self);
+ Result := GetPythonEngine.PyInt_FromLong(DelphiObject.WorkAreaTop);
end;
function TPyDelphiScreen.Get_WorkAreaWidth(AContext: Pointer): PPyObject;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- Result := PyInt_FromLong(DelphiObject.WorkAreaWidth);
- end;
+ Adjust(@Self);
+ Result := GetPythonEngine.PyInt_FromLong(DelphiObject.WorkAreaWidth);
end;
{$ENDIF FPC}
@@ -1007,30 +939,28 @@ function TPyDelphiScreen.MonitorFromPoint_Wrapper(args: PPyObject): PPyObject;
_pointObj : PPyObject;
_monitorDefault : Integer;
begin
- with GetPythonEngine do begin
- // We adjust the transmitted self argument
- Adjust(@Self);
- if PyArg_ParseTuple( args, 'Oi:MonitorFromPoint',@_pointObj, @_monitorDefault ) <> 0 then
+ // We adjust the transmitted self argument
+ Adjust(@Self);
+ if GetPythonEngine.PyArg_ParseTuple( args, 'Oi:MonitorFromPoint',@_pointObj, @_monitorDefault ) <> 0 then
+ begin
+ if CheckPointAttribute(_pointObj, 'First parameter', p) and
+ CheckEnum('TMonitorDefaultTo', _monitorDefault, Ord(Low(TMonitorDefaultTo)), Ord(High(TMonitorDefaultTo))) then
begin
- if CheckPointAttribute(_pointObj, 'First parameter', p) and
- CheckEnum('TMonitorDefaultTo', _monitorDefault, Ord(Low(TMonitorDefaultTo)), Ord(High(TMonitorDefaultTo))) then
- begin
- Result := Wrap(DelphiObject.MonitorFromPoint(p, TMonitorDefaultTo(_monitorDefault)));
- end
- else
- Result := nil;
+ Result := Wrap(DelphiObject.MonitorFromPoint(p, TMonitorDefaultTo(_monitorDefault)));
end
else
Result := nil;
- end;
+ end
+ else
+ Result := nil;
end;
{$IFNDEF FPC}
function TPyDelphiScreen.Realign_Wrapper(args: PPyObject): PPyObject;
begin
+ // We adjust the transmitted self argument
+ Adjust(@Self);
with GetPythonEngine do begin
- // We adjust the transmitted self argument
- Adjust(@Self);
if PyArg_ParseTuple( args, ':Realign') <> 0 then begin
DelphiObject.Realign;
Result := ReturnNone;
@@ -1041,9 +971,9 @@ function TPyDelphiScreen.Realign_Wrapper(args: PPyObject): PPyObject;
function TPyDelphiScreen.ResetFonts_Wrapper(args: PPyObject): PPyObject;
begin
+ // We adjust the transmitted self argument
+ Adjust(@Self);
with GetPythonEngine do begin
- // We adjust the transmitted self argument
- Adjust(@Self);
if PyArg_ParseTuple( args, ':ResetFonts') <> 0 then begin
DelphiObject.ResetFonts;
Result := ReturnNone;
@@ -1169,16 +1099,14 @@ function TPyDelphiScreen.Set_Cursor(AValue: PPyObject;
var
_cursor : Integer;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- if CheckIntAttribute(AValue, 'Cursor', _cursor) then
- begin
- DelphiObject.Cursor := _cursor;
- Result := 0;
- end
- else
- Result := -1;
- end;
+ Adjust(@Self);
+ if CheckIntAttribute(AValue, 'Cursor', _cursor) then
+ begin
+ DelphiObject.Cursor := _cursor;
+ Result := 0;
+ end
+ else
+ Result := -1;
end;
function TPyDelphiScreen.Set_HintFont(AValue: PPyObject;
@@ -1186,16 +1114,14 @@ function TPyDelphiScreen.Set_HintFont(AValue: PPyObject;
var
_font : TObject;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- if CheckObjAttribute(AValue, 'HintFont', TFont, _font) then
- begin
- DelphiObject.HintFont := TFont(_font);
- Result := 0;
- end
- else
- Result := -1;
- end;
+ Adjust(@Self);
+ if CheckObjAttribute(AValue, 'HintFont', TFont, _font) then
+ begin
+ DelphiObject.HintFont := TFont(_font);
+ Result := 0;
+ end
+ else
+ Result := -1;
end;
function TPyDelphiScreen.Set_IconFont(AValue: PPyObject;
@@ -1203,16 +1129,14 @@ function TPyDelphiScreen.Set_IconFont(AValue: PPyObject;
var
_font : TObject;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- if CheckObjAttribute(AValue, 'IconFont', TFont, _font) then
- begin
- DelphiObject.IconFont := TFont(_font);
- Result := 0;
- end
- else
- Result := -1;
- end;
+ Adjust(@Self);
+ if CheckObjAttribute(AValue, 'IconFont', TFont, _font) then
+ begin
+ DelphiObject.IconFont := TFont(_font);
+ Result := 0;
+ end
+ else
+ Result := -1;
end;
function TPyDelphiScreen.Set_MenuFont(AValue: PPyObject;
@@ -1220,23 +1144,21 @@ function TPyDelphiScreen.Set_MenuFont(AValue: PPyObject;
var
_font : TObject;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- if CheckObjAttribute(AValue, 'MenuFont', TFont, _font) then
- begin
- DelphiObject.MenuFont := TFont(_font);
- Result := 0;
- end
- else
- Result := -1;
- end;
+ Adjust(@Self);
+ if CheckObjAttribute(AValue, 'MenuFont', TFont, _font) then
+ begin
+ DelphiObject.MenuFont := TFont(_font);
+ Result := 0;
+ end
+ else
+ Result := -1;
end;
function TPyDelphiScreen.Set_OnActiveControlChange(AValue: PPyObject;
AContext: Pointer): Integer;
begin
+ Adjust(@Self);
with GetPythonEngine do begin
- Adjust(@Self);
if CheckCallableAttribute(AValue, 'OnActiveControlChange') then
begin
Py_XDECREF(fOnActiveControlChange);
@@ -1261,8 +1183,8 @@ function TPyDelphiScreen.Set_OnActiveControlChange(AValue: PPyObject;
function TPyDelphiScreen.Set_OnActiveFormChange(AValue: PPyObject;
AContext: Pointer): Integer;
begin
+ Adjust(@Self);
with GetPythonEngine do begin
- Adjust(@Self);
if CheckCallableAttribute(AValue, 'OnActiveFormChange') then
begin
Py_XDECREF(fOnActiveFormChange);
@@ -1385,83 +1307,56 @@ class function TScreenMonitorsAccess.Name: String;
function TPyDelphiMonitor.Get_BoundsRect(AContext : Pointer): PPyObject;
begin
- with GetPythonEngine do
- begin
- Adjust(@Self);
- Result := WrapRect(PyDelphiWrapper, DelphiObject.BoundsRect);
- end;
+ Adjust(@Self);
+ Result := WrapRect(PyDelphiWrapper, DelphiObject.BoundsRect);
end;
function TPyDelphiMonitor.Get_Handle(AContext : Pointer): PPyObject;
begin
- with GetPythonEngine do
- begin
- Adjust(@Self);
- Result := PyInt_FromLong(DelphiObject.Handle);
- end;
+ Adjust(@Self);
+ Result := GetPythonEngine.PyInt_FromLong(DelphiObject.Handle);
end;
function TPyDelphiMonitor.Get_Height(AContext : Pointer): PPyObject;
begin
- with GetPythonEngine do
- begin
- Adjust(@Self);
- Result := PyInt_FromLong(DelphiObject.Height);
- end;
+ Adjust(@Self);
+ Result := GetPythonEngine.PyInt_FromLong(DelphiObject.Height);
end;
function TPyDelphiMonitor.Get_Left(AContext : Pointer): PPyObject;
begin
- with GetPythonEngine do
- begin
- Adjust(@Self);
- Result := PyInt_FromLong(DelphiObject.Left);
- end;
+ Adjust(@Self);
+ Result := GetPythonEngine.PyInt_FromLong(DelphiObject.Left);
end;
function TPyDelphiMonitor.Get_MonitorNum(AContext : Pointer): PPyObject;
begin
- with GetPythonEngine do
- begin
- Adjust(@Self);
- Result := PyInt_FromLong(DelphiObject.MonitorNum);
- end;
+ Adjust(@Self);
+ Result := GetPythonEngine.PyInt_FromLong(DelphiObject.MonitorNum);
end;
function TPyDelphiMonitor.Get_Primary(AContext : Pointer): PPyObject;
begin
- with GetPythonEngine do
- begin
- Adjust(@Self);
- Result := VariantAsPyObject(DelphiObject.Primary);
- end;
+ Adjust(@Self);
+ Result := GetPythonEngine.VariantAsPyObject(DelphiObject.Primary);
end;
function TPyDelphiMonitor.Get_Top(AContext : Pointer): PPyObject;
begin
- with GetPythonEngine do
- begin
- Adjust(@Self);
- Result := PyInt_FromLong(DelphiObject.Top);
- end;
+ Adjust(@Self);
+ Result := GetPythonEngine.PyInt_FromLong(DelphiObject.Top);
end;
function TPyDelphiMonitor.Get_Width(AContext : Pointer): PPyObject;
begin
- with GetPythonEngine do
- begin
- Adjust(@Self);
- Result := PyInt_FromLong(DelphiObject.Width);
- end;
+ Adjust(@Self);
+ Result := GetPythonEngine.PyInt_FromLong(DelphiObject.Width);
end;
function TPyDelphiMonitor.Get_WorkareaRect(AContext : Pointer): PPyObject;
begin
- with GetPythonEngine do
- begin
- Adjust(@Self);
- Result := WrapRect(PyDelphiWrapper, DelphiObject.WorkareaRect);
- end;
+ Adjust(@Self);
+ Result := WrapRect(PyDelphiWrapper, DelphiObject.WorkareaRect);
end;
function TPyDelphiMonitor.GetDelphiObject: TMonitor;
@@ -1513,9 +1408,9 @@ function TPyDelphiApplication.ActivateHint_Wrapper(
_obj : PPyObject;
_point : TPoint;
begin
+ // We adjust the transmitted self argument
+ Adjust(@Self);
with GetPythonEngine do begin
- // We adjust the transmitted self argument
- Adjust(@Self);
if PyArg_ParseTuple( args, 'O:ActivateHint',@_obj ) <> 0 then begin
if CheckPointAttribute(_obj, 'The first argument of ActivateHint', _point) then
begin
@@ -1531,9 +1426,9 @@ function TPyDelphiApplication.ActivateHint_Wrapper(
function TPyDelphiApplication.BringToFront_Wrapper(
args: PPyObject): PPyObject;
begin
+ // We adjust the transmitted self argument
+ Adjust(@Self);
with GetPythonEngine do begin
- // We adjust the transmitted self argument
- Adjust(@Self);
if PyArg_ParseTuple( args, ':BringToFront') <> 0 then begin
DelphiObject.BringToFront;
Result := ReturnNone;
@@ -1545,9 +1440,9 @@ function TPyDelphiApplication.BringToFront_Wrapper(
function TPyDelphiApplication.CancelHint_Wrapper(
args: PPyObject): PPyObject;
begin
+ // We adjust the transmitted self argument
+ Adjust(@Self);
with GetPythonEngine do begin
- // We adjust the transmitted self argument
- Adjust(@Self);
if PyArg_ParseTuple( args, ':CancelHint') <> 0 then begin
DelphiObject.CancelHint;
Result := ReturnNone;
@@ -1562,9 +1457,9 @@ function TPyDelphiApplication.ExecuteAction_Wrapper(
_obj : PPyObject;
_value : TObject;
begin
+ // We adjust the transmitted self argument
+ Adjust(@Self);
with GetPythonEngine do begin
- // We adjust the transmitted self argument
- Adjust(@Self);
if PyArg_ParseTuple( args, 'O:ExecuteAction',@_obj ) <> 0 then begin
if CheckObjAttribute(_obj, 'The first argument of ExecuteAction', TBasicAction, _value) then
begin
@@ -1587,9 +1482,9 @@ function TPyDelphiApplication.HandleException_Wrapper(
_obj : PPyObject;
_sender : TObject;
begin
+ // We adjust the transmitted self argument
+ Adjust(@Self);
with GetPythonEngine do begin
- // We adjust the transmitted self argument
- Adjust(@Self);
if PyArg_ParseTuple( args, 'O:HandleException',@_obj ) <> 0 then begin
if CheckObjAttribute(_obj, 'The first argument of HandleException', TObject, _sender) then
begin
@@ -1605,9 +1500,9 @@ function TPyDelphiApplication.HandleException_Wrapper(
function TPyDelphiApplication.HandleMessage_Wrapper(
args: PPyObject): PPyObject;
begin
+ // We adjust the transmitted self argument
+ Adjust(@Self);
with GetPythonEngine do begin
- // We adjust the transmitted self argument
- Adjust(@Self);
if PyArg_ParseTuple( args, ':HandleMessage') <> 0 then begin
DelphiObject.HandleMessage;
Result := ReturnNone;
@@ -1622,9 +1517,9 @@ function TPyDelphiApplication.HelpCommand_Wrapper(
_command : Integer;
_data : Integer;
begin
+ // We adjust the transmitted self argument
+ Adjust(@Self);
with GetPythonEngine do begin
- // We adjust the transmitted self argument
- Adjust(@Self);
if PyArg_ParseTuple( args, 'i:HelpCommand',@_command, @_data ) <> 0 then begin
Result := VariantAsPyObject( DelphiObject.HelpCommand(_command, _data) );
end else
@@ -1637,9 +1532,9 @@ function TPyDelphiApplication.HelpContext_Wrapper(
var
_context : Integer;
begin
+ // We adjust the transmitted self argument
+ Adjust(@Self);
with GetPythonEngine do begin
- // We adjust the transmitted self argument
- Adjust(@Self);
if PyArg_ParseTuple( args, 'i:HelpContext',@_context ) <> 0 then begin
Result := VariantAsPyObject( DelphiObject.HelpContext(_context) );
end else
@@ -1652,9 +1547,9 @@ function TPyDelphiApplication.HelpJump_Wrapper(args: PPyObject): PPyObject;
var
_jumpID : PAnsiChar;
begin
+ // We adjust the transmitted self argument
+ Adjust(@Self);
with GetPythonEngine do begin
- // We adjust the transmitted self argument
- Adjust(@Self);
if PyArg_ParseTuple( args, 's:HelpJump',@_jumpID ) <> 0 then begin
Result := VariantAsPyObject( DelphiObject.HelpJump(String(_jumpID)) );
end else
@@ -1668,9 +1563,9 @@ function TPyDelphiApplication.HelpKeyword_Wrapper(
var
_keyword : PAnsiChar;
begin
+ // We adjust the transmitted self argument
+ Adjust(@Self);
with GetPythonEngine do begin
- // We adjust the transmitted self argument
- Adjust(@Self);
if PyArg_ParseTuple( args, 's:HelpKeyword',@_keyword ) <> 0 then begin
Result := VariantAsPyObject( DelphiObject.HelpKeyword(String(_keyword)) );
end else
@@ -1680,9 +1575,9 @@ function TPyDelphiApplication.HelpKeyword_Wrapper(
function TPyDelphiApplication.HideHint_Wrapper(args: PPyObject): PPyObject;
begin
+ // We adjust the transmitted self argument
+ Adjust(@Self);
with GetPythonEngine do begin
- // We adjust the transmitted self argument
- Adjust(@Self);
if PyArg_ParseTuple( args, ':HideHint') <> 0 then begin
DelphiObject.HideHint;
Result := ReturnNone;
@@ -1694,9 +1589,9 @@ function TPyDelphiApplication.HideHint_Wrapper(args: PPyObject): PPyObject;
function TPyDelphiApplication.Initialize_Wrapper(
args: PPyObject): PPyObject;
begin
+ // We adjust the transmitted self argument
+ Adjust(@Self);
with GetPythonEngine do begin
- // We adjust the transmitted self argument
- Adjust(@Self);
if PyArg_ParseTuple( args, ':Initialize') <> 0 then begin
DelphiObject.Initialize;
Result := ReturnNone;
@@ -1709,9 +1604,9 @@ function TPyDelphiApplication.Initialize_Wrapper(
function TPyDelphiApplication.IsRightToLeft_Wrapper(
args: PPyObject): PPyObject;
begin
+ // We adjust the transmitted self argument
+ Adjust(@Self);
with GetPythonEngine do begin
- // We adjust the transmitted self argument
- Adjust(@Self);
if PyArg_ParseTuple( args, ':IsRightToLeft') <> 0 then begin
Result := VariantAsPyObject( DelphiObject.IsRightToLeft );
end else
@@ -1727,9 +1622,9 @@ function TPyDelphiApplication.MessageBox_Wrapper(
_caption : PAnsiChar;
_flags : Integer;
begin
+ // We adjust the transmitted self argument
+ Adjust(@Self);
with GetPythonEngine do begin
- // We adjust the transmitted self argument
- Adjust(@Self);
if PyArg_ParseTuple( args, 'ssi:MessageBox',@_text, @_caption, @_flags ) <> 0 then begin
Result := PyInt_FromLong(
DelphiObject.MessageBox(PChar(string(_text)), PChar(string(_caption)), _flags) );
@@ -1740,9 +1635,9 @@ function TPyDelphiApplication.MessageBox_Wrapper(
function TPyDelphiApplication.Minimize_Wrapper(args: PPyObject): PPyObject;
begin
+ // We adjust the transmitted self argument
+ Adjust(@Self);
with GetPythonEngine do begin
- // We adjust the transmitted self argument
- Adjust(@Self);
if PyArg_ParseTuple( args, ':Minimize') <> 0 then begin
DelphiObject.Minimize;
Result := ReturnNone;
@@ -1754,9 +1649,9 @@ function TPyDelphiApplication.Minimize_Wrapper(args: PPyObject): PPyObject;
function TPyDelphiApplication.ModalFinished_Wrapper(
args: PPyObject): PPyObject;
begin
+ // We adjust the transmitted self argument
+ Adjust(@Self);
with GetPythonEngine do begin
- // We adjust the transmitted self argument
- Adjust(@Self);
if PyArg_ParseTuple( args, ':ModalFinished') <> 0 then begin
DelphiObject.ModalFinished;
Result := ReturnNone;
@@ -1768,9 +1663,9 @@ function TPyDelphiApplication.ModalFinished_Wrapper(
function TPyDelphiApplication.ModalStarted_Wrapper(
args: PPyObject): PPyObject;
begin
+ // We adjust the transmitted self argument
+ Adjust(@Self);
with GetPythonEngine do begin
- // We adjust the transmitted self argument
- Adjust(@Self);
if PyArg_ParseTuple( args, ':ModalStarted') <> 0 then begin
DelphiObject.ModalStarted;
Result := ReturnNone;
@@ -1783,9 +1678,9 @@ function TPyDelphiApplication.ModalStarted_Wrapper(
function TPyDelphiApplication.NormalizeAllTopMosts_Wrapper(
args: PPyObject): PPyObject;
begin
+ // We adjust the transmitted self argument
+ Adjust(@Self);
with GetPythonEngine do begin
- // We adjust the transmitted self argument
- Adjust(@Self);
if PyArg_ParseTuple( args, ':NormalizeAllTopMosts') <> 0 then begin
DelphiObject.NormalizeAllTopMosts;
Result := ReturnNone;
@@ -1797,9 +1692,9 @@ function TPyDelphiApplication.NormalizeAllTopMosts_Wrapper(
function TPyDelphiApplication.NormalizeTopMosts_Wrapper(
args: PPyObject): PPyObject;
begin
+ // We adjust the transmitted self argument
+ Adjust(@Self);
with GetPythonEngine do begin
- // We adjust the transmitted self argument
- Adjust(@Self);
if PyArg_ParseTuple( args, ':NormalizeTopMosts') <> 0 then begin
DelphiObject.NormalizeTopMosts;
Result := ReturnNone;
@@ -1811,9 +1706,9 @@ function TPyDelphiApplication.NormalizeTopMosts_Wrapper(
function TPyDelphiApplication.RestoreTopMosts_Wrapper(
args: PPyObject): PPyObject;
begin
+ // We adjust the transmitted self argument
+ Adjust(@Self);
with GetPythonEngine do begin
- // We adjust the transmitted self argument
- Adjust(@Self);
if PyArg_ParseTuple( args, ':RestoreTopMosts') <> 0 then begin
DelphiObject.RestoreTopMosts;
Result := ReturnNone;
@@ -1826,9 +1721,9 @@ function TPyDelphiApplication.RestoreTopMosts_Wrapper(
function TPyDelphiApplication.ProcessMessages_Wrapper(
args: PPyObject): PPyObject;
begin
+ // We adjust the transmitted self argument
+ Adjust(@Self);
with GetPythonEngine do begin
- // We adjust the transmitted self argument
- Adjust(@Self);
if PyArg_ParseTuple( args, ':ProcessMessages') <> 0 then begin
DelphiObject.ProcessMessages;
Result := ReturnNone;
@@ -2004,9 +1899,9 @@ class procedure TPyDelphiApplication.RegisterMethods(
function TPyDelphiApplication.Restore_Wrapper(args: PPyObject): PPyObject;
begin
+ // We adjust the transmitted self argument
+ Adjust(@Self);
with GetPythonEngine do begin
- // We adjust the transmitted self argument
- Adjust(@Self);
if PyArg_ParseTuple( args, ':Restore') <> 0 then begin
DelphiObject.Restore;
Result := ReturnNone;
@@ -2017,9 +1912,9 @@ function TPyDelphiApplication.Restore_Wrapper(args: PPyObject): PPyObject;
function TPyDelphiApplication.Run_Wrapper(args: PPyObject): PPyObject;
begin
+ // We adjust the transmitted self argument
+ Adjust(@Self);
with GetPythonEngine do begin
- // We adjust the transmitted self argument
- Adjust(@Self);
if PyArg_ParseTuple( args, ':Run') <> 0 then
begin
DelphiObject.Run;
@@ -2041,9 +1936,9 @@ function TPyDelphiApplication.ShowException_Wrapper(
_obj : PPyObject;
_value : TObject;
begin
+ // We adjust the transmitted self argument
+ Adjust(@Self);
with GetPythonEngine do begin
- // We adjust the transmitted self argument
- Adjust(@Self);
if PyArg_ParseTuple( args, 'O:ShowException',@_obj ) <> 0 then begin
if CheckObjAttribute(_obj, 'The first argument of ShowException', Exception, _value) then
begin
@@ -2059,9 +1954,9 @@ function TPyDelphiApplication.ShowException_Wrapper(
function TPyDelphiApplication.Terminate_Wrapper(
args: PPyObject): PPyObject;
begin
+ // We adjust the transmitted self argument
+ Adjust(@Self);
with GetPythonEngine do begin
- // We adjust the transmitted self argument
- Adjust(@Self);
if PyArg_ParseTuple( args, ':Terminate') <> 0 then begin
DelphiObject.Terminate;
Result := ReturnNone;
@@ -2076,9 +1971,9 @@ function TPyDelphiApplication.UpdateAction_Wrapper(
_obj : PPyObject;
_value : TObject;
begin
+ // We adjust the transmitted self argument
+ Adjust(@Self);
with GetPythonEngine do begin
- // We adjust the transmitted self argument
- Adjust(@Self);
if PyArg_ParseTuple( args, 'O:UpdateAction',@_obj ) <> 0 then begin
if CheckObjAttribute(_obj, 'The first argument of UpdateAction', TBasicAction, _value) then
begin
@@ -2095,9 +1990,9 @@ function TPyDelphiApplication.UpdateAction_Wrapper(
function TPyDelphiApplication.UseRightToLeftAlignment_Wrapper(
args: PPyObject): PPyObject;
begin
+ // We adjust the transmitted self argument
+ Adjust(@Self);
with GetPythonEngine do begin
- // We adjust the transmitted self argument
- Adjust(@Self);
if PyArg_ParseTuple( args, ':UseRightToLeftAlignment') <> 0 then begin
DelphiObject.UseRightToLeftAlignment;
Result := ReturnNone;
@@ -2109,9 +2004,9 @@ function TPyDelphiApplication.UseRightToLeftAlignment_Wrapper(
function TPyDelphiApplication.UseRightToLeftReading_Wrapper(
args: PPyObject): PPyObject;
begin
+ // We adjust the transmitted self argument
+ Adjust(@Self);
with GetPythonEngine do begin
- // We adjust the transmitted self argument
- Adjust(@Self);
if PyArg_ParseTuple( args, ':UseRightToLeftReading') <> 0 then begin
DelphiObject.UseRightToLeftReading;
Result := ReturnNone;
@@ -2123,9 +2018,9 @@ function TPyDelphiApplication.UseRightToLeftReading_Wrapper(
function TPyDelphiApplication.UseRightToLeftScrollBar_Wrapper(
args: PPyObject): PPyObject;
begin
+ // We adjust the transmitted self argument
+ Adjust(@Self);
with GetPythonEngine do begin
- // We adjust the transmitted self argument
- Adjust(@Self);
if PyArg_ParseTuple( args, ':UseRightToLeftScrollBar') <> 0 then begin
DelphiObject.UseRightToLeftScrollBar;
Result := ReturnNone;
@@ -2137,223 +2032,173 @@ function TPyDelphiApplication.UseRightToLeftScrollBar_Wrapper(
function TPyDelphiApplication.Get_Active(AContext: Pointer): PPyObject;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- Result := VariantAsPyObject(DelphiObject.Active);
- end;
+ Adjust(@Self);
+ Result := GetPythonEngine.VariantAsPyObject(DelphiObject.Active);
end;
{$IFNDEF FPC}
function TPyDelphiApplication.Get_AllowTesting(
AContext: Pointer): PPyObject;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- Result := VariantAsPyObject(DelphiObject.AllowTesting);
- end;
+ Adjust(@Self);
+ Result := GetPythonEngine.VariantAsPyObject(DelphiObject.AllowTesting);
end;
function TPyDelphiApplication.Get_AutoDragDocking(
AContext: Pointer): PPyObject;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- Result := VariantAsPyObject(DelphiObject.AutoDragDocking);
- end;
+ Adjust(@Self);
+ Result := GetPythonEngine.VariantAsPyObject(DelphiObject.AutoDragDocking);
end;
function TPyDelphiApplication.Get_BiDiKeyboard(
AContext: Pointer): PPyObject;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- Result := PyString_FromString(PAnsiChar(AnsiString(DelphiObject.BiDiKeyboard)));
- end;
+ Adjust(@Self);
+ Result := GetPythonEngine.PyString_FromDelphiString(DelphiObject.BiDiKeyboard);
end;
{$ENDIF FPC}
function TPyDelphiApplication.Get_BiDiMode(AContext: Pointer): PPyObject;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- Result := PyInt_FromLong(Ord(DelphiObject.BiDiMode));
- end;
+ Adjust(@Self);
+ Result := GetPythonEngine.PyInt_FromLong(Ord(DelphiObject.BiDiMode));
end;
{$IFNDEF FPC}
function TPyDelphiApplication.Get_CurrentHelpFile(
AContext: Pointer): PPyObject;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- Result := PyString_FromString(PAnsiChar(AnsiString(DelphiObject.CurrentHelpFile)));
- end;
+ Adjust(@Self);
+ Result := GetPythonEngine.PyString_FromDelphiString(DelphiObject.CurrentHelpFile);
end;
function TPyDelphiApplication.Get_DialogHandle(
AContext: Pointer): PPyObject;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- Result := PyInt_FromLong(DelphiObject.DialogHandle);
- end;
+ Adjust(@Self);
+ Result := GetPythonEngine.PyInt_FromLong(DelphiObject.DialogHandle);
end;
{$ENDIF FPC}
function TPyDelphiApplication.Get_ExeName(AContext: Pointer): PPyObject;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- Result := PyString_FromString(PAnsiChar(AnsiString(DelphiObject.ExeName)));
- end;
+ Adjust(@Self);
+ Result := GetPythonEngine.PyString_FromDelphiString(DelphiObject.ExeName);
end;
{$IFNDEF FPC}
function TPyDelphiApplication.Get_Handle(AContext: Pointer): PPyObject;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- Result := PyInt_FromLong(DelphiObject.Handle);
- end;
+ Adjust(@Self);
+ Result := GetPythonEngine.PyInt_FromLong(DelphiObject.Handle);
end;
{$ENDIF FPC}
function TPyDelphiApplication.Get_HelpFile(AContext: Pointer): PPyObject;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- Result := PyString_FromString(PAnsiChar(AnsiString(DelphiObject.HelpFile)));
- end;
+ Adjust(@Self);
+ Result := GetPythonEngine.PyString_FromDelphiString(DelphiObject.HelpFile);
end;
function TPyDelphiApplication.Get_Hint(AContext: Pointer): PPyObject;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- Result := PyString_FromString(PAnsiChar(AnsiString(DelphiObject.Hint)));
- end;
+ Adjust(@Self);
+ Result := GetPythonEngine.PyString_FromDelphiString(DelphiObject.Hint);
end;
function TPyDelphiApplication.Get_HintColor(AContext: Pointer): PPyObject;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- Result := PyInt_FromLong(DelphiObject.HintColor);
- end;
+ Adjust(@Self);
+ Result := GetPythonEngine.PyInt_FromLong(DelphiObject.HintColor);
end;
function TPyDelphiApplication.Get_HintHidePause(
AContext: Pointer): PPyObject;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- Result := PyInt_FromLong(DelphiObject.HintHidePause);
- end;
+ Adjust(@Self);
+ Result := GetPythonEngine.PyInt_FromLong(DelphiObject.HintHidePause);
end;
function TPyDelphiApplication.Get_HintPause(AContext: Pointer): PPyObject;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- Result := PyInt_FromLong(DelphiObject.HintPause);
- end;
+ Adjust(@Self);
+ Result := GetPythonEngine.PyInt_FromLong(DelphiObject.HintPause);
end;
function TPyDelphiApplication.Get_HintShortCuts(
AContext: Pointer): PPyObject;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- Result := VariantAsPyObject(DelphiObject.HintShortCuts);
- end;
+ Adjust(@Self);
+ Result := GetPythonEngine.VariantAsPyObject(DelphiObject.HintShortCuts);
end;
function TPyDelphiApplication.Get_HintShortPause(
AContext: Pointer): PPyObject;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- Result := PyInt_FromLong(DelphiObject.HintShortPause);
- end;
+ Adjust(@Self);
+ Result := GetPythonEngine.PyInt_FromLong(DelphiObject.HintShortPause);
end;
function TPyDelphiApplication.Get_Icon(AContext: Pointer): PPyObject;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- Result := Wrap(DelphiObject.Icon);
- end;
+ Adjust(@Self);
+ Result := Wrap(DelphiObject.Icon);
end;
function TPyDelphiApplication.Get_MainForm(AContext: Pointer): PPyObject;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- Result := Wrap(DelphiObject.MainForm);
- end;
+ Adjust(@Self);
+ Result := Wrap(DelphiObject.MainForm);
end;
{$IFNDEF FPC}
function TPyDelphiApplication.Get_NonBiDiKeyboard(
AContext: Pointer): PPyObject;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- Result := PyString_FromString(PAnsiChar(AnsiString(DelphiObject.NonBiDiKeyboard)));
- end;
+ Adjust(@Self);
+ Result := GetPythonEngine.PyString_FromDelphiString(DelphiObject.NonBiDiKeyboard);
end;
{$ENDIF FPC}
function TPyDelphiApplication.Get_ShowHint(AContext: Pointer): PPyObject;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- Result := VariantAsPyObject(DelphiObject.ShowHint);
- end;
+ Adjust(@Self);
+ Result := GetPythonEngine.VariantAsPyObject(DelphiObject.ShowHint);
end;
function TPyDelphiApplication.Get_ShowMainForm(
AContext: Pointer): PPyObject;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- Result := VariantAsPyObject(DelphiObject.ShowMainForm);
- end;
+ Adjust(@Self);
+ Result := GetPythonEngine.VariantAsPyObject(DelphiObject.ShowMainForm);
end;
function TPyDelphiApplication.Get_Terminated(AContext: Pointer): PPyObject;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- Result := VariantAsPyObject(DelphiObject.Terminated);
- end;
+ Adjust(@Self);
+ Result := GetPythonEngine.VariantAsPyObject(DelphiObject.Terminated);
end;
function TPyDelphiApplication.Get_Title(AContext: Pointer): PPyObject;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- Result := PyString_FromString(PAnsiChar(AnsiString(DelphiObject.Title)));
- end;
+ Adjust(@Self);
+ Result := GetPythonEngine.PyString_FromDelphiString(DelphiObject.Title);
end;
{$IFNDEF FPC}
function TPyDelphiApplication.Get_UpdateFormatSettings(
AContext: Pointer): PPyObject;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- Result := VariantAsPyObject(DelphiObject.UpdateFormatSettings);
- end;
+ Adjust(@Self);
+ Result := GetPythonEngine.VariantAsPyObject(DelphiObject.UpdateFormatSettings);
end;
function TPyDelphiApplication.Get_UpdateMetricSettings(
AContext: Pointer): PPyObject;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- Result := VariantAsPyObject(DelphiObject.UpdateMetricSettings);
- end;
+ Adjust(@Self);
+ Result := GetPythonEngine.VariantAsPyObject(DelphiObject.UpdateMetricSettings);
end;
function TPyDelphiApplication.Set_AllowTesting(AValue: PPyObject;
@@ -2361,16 +2206,14 @@ function TPyDelphiApplication.Set_AllowTesting(AValue: PPyObject;
var
_value : Boolean;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- if CheckBoolAttribute(AValue, 'AllowTesting', _value) then
- begin
- DelphiObject.AllowTesting := _value;
- Result := 0;
- end
- else
- Result := -1;
- end;
+ Adjust(@Self);
+ if CheckBoolAttribute(AValue, 'AllowTesting', _value) then
+ begin
+ DelphiObject.AllowTesting := _value;
+ Result := 0;
+ end
+ else
+ Result := -1;
end;
function TPyDelphiApplication.Set_AutoDragDocking(AValue: PPyObject;
@@ -2378,16 +2221,14 @@ function TPyDelphiApplication.Set_AutoDragDocking(AValue: PPyObject;
var
_value : Boolean;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- if CheckBoolAttribute(AValue, 'AutoDragDocking', _value) then
- begin
- DelphiObject.AutoDragDocking := _value;
- Result := 0;
- end
- else
- Result := -1;
- end;
+ Adjust(@Self);
+ if CheckBoolAttribute(AValue, 'AutoDragDocking', _value) then
+ begin
+ DelphiObject.AutoDragDocking := _value;
+ Result := 0;
+ end
+ else
+ Result := -1;
end;
function TPyDelphiApplication.Set_BiDiKeyboard(AValue: PPyObject;
@@ -2395,16 +2236,14 @@ function TPyDelphiApplication.Set_BiDiKeyboard(AValue: PPyObject;
var
_value : String;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- if CheckStrAttribute(AValue, 'BiDiKeyboard', _value) then
- begin
- DelphiObject.BiDiKeyboard := _value;
- Result := 0;
- end
- else
- Result := -1;
- end;
+ Adjust(@Self);
+ if CheckStrAttribute(AValue, 'BiDiKeyboard', _value) then
+ begin
+ DelphiObject.BiDiKeyboard := _value;
+ Result := 0;
+ end
+ else
+ Result := -1;
end;
{$ENDIF FPC}
@@ -2413,16 +2252,14 @@ function TPyDelphiApplication.Set_BiDiMode(AValue: PPyObject;
var
_value : Integer;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- if CheckIntAttribute(AValue, 'BiDiMode', _value) then
- begin
- DelphiObject.BiDiMode := TBiDiMode(_value);
- Result := 0;
- end
- else
- Result := -1;
- end;
+ Adjust(@Self);
+ if CheckIntAttribute(AValue, 'BiDiMode', _value) then
+ begin
+ DelphiObject.BiDiMode := TBiDiMode(_value);
+ Result := 0;
+ end
+ else
+ Result := -1;
end;
{$IFNDEF FPC}
@@ -2431,16 +2268,14 @@ function TPyDelphiApplication.Set_DialogHandle(AValue: PPyObject;
var
_value : Integer;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- if CheckIntAttribute(AValue, 'DialogHandle', _value) then
- begin
- DelphiObject.DialogHandle := _value;
- Result := 0;
- end
- else
- Result := -1;
- end;
+ Adjust(@Self);
+ if CheckIntAttribute(AValue, 'DialogHandle', _value) then
+ begin
+ DelphiObject.DialogHandle := _value;
+ Result := 0;
+ end
+ else
+ Result := -1;
end;
function TPyDelphiApplication.Set_Handle(AValue: PPyObject;
@@ -2448,16 +2283,14 @@ function TPyDelphiApplication.Set_Handle(AValue: PPyObject;
var
_value : Integer;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- if CheckIntAttribute(AValue, 'Handle', _value) then
- begin
- DelphiObject.Handle := _value;
- Result := 0;
- end
- else
- Result := -1;
- end;
+ Adjust(@Self);
+ if CheckIntAttribute(AValue, 'Handle', _value) then
+ begin
+ DelphiObject.Handle := _value;
+ Result := 0;
+ end
+ else
+ Result := -1;
end;
{$ENDIF FPC}
@@ -2466,16 +2299,14 @@ function TPyDelphiApplication.Set_HelpFile(AValue: PPyObject;
var
_value : String;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- if CheckStrAttribute(AValue, 'HelpFile', _value) then
- begin
- DelphiObject.HelpFile := _value;
- Result := 0;
- end
- else
- Result := -1;
- end;
+ Adjust(@Self);
+ if CheckStrAttribute(AValue, 'HelpFile', _value) then
+ begin
+ DelphiObject.HelpFile := _value;
+ Result := 0;
+ end
+ else
+ Result := -1;
end;
function TPyDelphiApplication.Set_Hint(AValue: PPyObject;
@@ -2483,16 +2314,14 @@ function TPyDelphiApplication.Set_Hint(AValue: PPyObject;
var
_value : String;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- if CheckStrAttribute(AValue, 'Hint', _value) then
- begin
- DelphiObject.Hint := _value;
- Result := 0;
- end
- else
- Result := -1;
- end;
+ Adjust(@Self);
+ if CheckStrAttribute(AValue, 'Hint', _value) then
+ begin
+ DelphiObject.Hint := _value;
+ Result := 0;
+ end
+ else
+ Result := -1;
end;
function TPyDelphiApplication.Set_HintColor(AValue: PPyObject;
@@ -2500,16 +2329,14 @@ function TPyDelphiApplication.Set_HintColor(AValue: PPyObject;
var
_value : Integer;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- if CheckIntAttribute(AValue, 'HintColor', _value) then
- begin
- DelphiObject.HintColor := _value;
- Result := 0;
- end
- else
- Result := -1;
- end;
+ Adjust(@Self);
+ if CheckIntAttribute(AValue, 'HintColor', _value) then
+ begin
+ DelphiObject.HintColor := _value;
+ Result := 0;
+ end
+ else
+ Result := -1;
end;
function TPyDelphiApplication.Set_HintHidePause(AValue: PPyObject;
@@ -2517,16 +2344,14 @@ function TPyDelphiApplication.Set_HintHidePause(AValue: PPyObject;
var
_value : Integer;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- if CheckIntAttribute(AValue, 'HintHidePause', _value) then
- begin
- DelphiObject.HintHidePause := _value;
- Result := 0;
- end
- else
- Result := -1;
- end;
+ Adjust(@Self);
+ if CheckIntAttribute(AValue, 'HintHidePause', _value) then
+ begin
+ DelphiObject.HintHidePause := _value;
+ Result := 0;
+ end
+ else
+ Result := -1;
end;
function TPyDelphiApplication.Set_HintPause(AValue: PPyObject;
@@ -2534,16 +2359,14 @@ function TPyDelphiApplication.Set_HintPause(AValue: PPyObject;
var
_value : Integer;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- if CheckIntAttribute(AValue, 'HintPause', _value) then
- begin
- DelphiObject.HintPause := _value;
- Result := 0;
- end
- else
- Result := -1;
- end;
+ Adjust(@Self);
+ if CheckIntAttribute(AValue, 'HintPause', _value) then
+ begin
+ DelphiObject.HintPause := _value;
+ Result := 0;
+ end
+ else
+ Result := -1;
end;
function TPyDelphiApplication.Set_HintShortCuts(AValue: PPyObject;
@@ -2551,16 +2374,14 @@ function TPyDelphiApplication.Set_HintShortCuts(AValue: PPyObject;
var
_value : Boolean;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- if CheckBoolAttribute(AValue, 'HintShortCuts', _value) then
- begin
- DelphiObject.HintShortCuts := _value;
- Result := 0;
- end
- else
- Result := -1;
- end;
+ Adjust(@Self);
+ if CheckBoolAttribute(AValue, 'HintShortCuts', _value) then
+ begin
+ DelphiObject.HintShortCuts := _value;
+ Result := 0;
+ end
+ else
+ Result := -1;
end;
function TPyDelphiApplication.Set_HintShortPause(AValue: PPyObject;
@@ -2568,16 +2389,14 @@ function TPyDelphiApplication.Set_HintShortPause(AValue: PPyObject;
var
_value : Integer;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- if CheckIntAttribute(AValue, 'HintShortPause', _value) then
- begin
- DelphiObject.HintShortPause := _value;
- Result := 0;
- end
- else
- Result := -1;
- end;
+ Adjust(@Self);
+ if CheckIntAttribute(AValue, 'HintShortPause', _value) then
+ begin
+ DelphiObject.HintShortPause := _value;
+ Result := 0;
+ end
+ else
+ Result := -1;
end;
function TPyDelphiApplication.Set_Icon(AValue: PPyObject;
@@ -2585,16 +2404,14 @@ function TPyDelphiApplication.Set_Icon(AValue: PPyObject;
var
_value : TObject;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- if CheckObjAttribute(AValue, 'Icon', TIcon, _value) then
- begin
- DelphiObject.Icon := TIcon(_value);
- Result := 0;
- end
- else
- Result := -1;
- end;
+ Adjust(@Self);
+ if CheckObjAttribute(AValue, 'Icon', TIcon, _value) then
+ begin
+ DelphiObject.Icon := TIcon(_value);
+ Result := 0;
+ end
+ else
+ Result := -1;
end;
{$IFNDEF FPC}
@@ -2603,16 +2420,14 @@ function TPyDelphiApplication.Set_NonBiDiKeyboard(AValue: PPyObject;
var
_value : String;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- if CheckStrAttribute(AValue, 'NonBiDiKeyboard', _value) then
- begin
- DelphiObject.NonBiDiKeyboard := _value;
- Result := 0;
- end
- else
- Result := -1;
- end;
+ Adjust(@Self);
+ if CheckStrAttribute(AValue, 'NonBiDiKeyboard', _value) then
+ begin
+ DelphiObject.NonBiDiKeyboard := _value;
+ Result := 0;
+ end
+ else
+ Result := -1;
end;
{$ENDIF FPC}
@@ -2621,16 +2436,14 @@ function TPyDelphiApplication.Set_ShowHint(AValue: PPyObject;
var
_value : Boolean;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- if CheckBoolAttribute(AValue, 'ShowHint', _value) then
- begin
- DelphiObject.ShowHint := _value;
- Result := 0;
- end
- else
- Result := -1;
- end;
+ Adjust(@Self);
+ if CheckBoolAttribute(AValue, 'ShowHint', _value) then
+ begin
+ DelphiObject.ShowHint := _value;
+ Result := 0;
+ end
+ else
+ Result := -1;
end;
function TPyDelphiApplication.Set_ShowMainForm(AValue: PPyObject;
@@ -2638,16 +2451,14 @@ function TPyDelphiApplication.Set_ShowMainForm(AValue: PPyObject;
var
_value : Boolean;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- if CheckBoolAttribute(AValue, 'ShowMainForm', _value) then
- begin
- DelphiObject.ShowMainForm := _value;
- Result := 0;
- end
- else
- Result := -1;
- end;
+ Adjust(@Self);
+ if CheckBoolAttribute(AValue, 'ShowMainForm', _value) then
+ begin
+ DelphiObject.ShowMainForm := _value;
+ Result := 0;
+ end
+ else
+ Result := -1;
end;
function TPyDelphiApplication.Set_Title(AValue: PPyObject;
@@ -2655,16 +2466,14 @@ function TPyDelphiApplication.Set_Title(AValue: PPyObject;
var
_value : String;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- if CheckStrAttribute(AValue, 'Title', _value) then
- begin
- DelphiObject.Title := _value;
- Result := 0;
- end
- else
- Result := -1;
- end;
+ Adjust(@Self);
+ if CheckStrAttribute(AValue, 'Title', _value) then
+ begin
+ DelphiObject.Title := _value;
+ Result := 0;
+ end
+ else
+ Result := -1;
end;
{$IFNDEF FPC}
@@ -2673,16 +2482,14 @@ function TPyDelphiApplication.Set_UpdateFormatSettings(AValue: PPyObject;
var
_value : Boolean;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- if CheckBoolAttribute(AValue, 'UpdateFormatSettings', _value) then
- begin
- DelphiObject.UpdateFormatSettings := _value;
- Result := 0;
- end
- else
- Result := -1;
- end;
+ Adjust(@Self);
+ if CheckBoolAttribute(AValue, 'UpdateFormatSettings', _value) then
+ begin
+ DelphiObject.UpdateFormatSettings := _value;
+ Result := 0;
+ end
+ else
+ Result := -1;
end;
function TPyDelphiApplication.Set_UpdateMetricSettings(AValue: PPyObject;
@@ -2690,16 +2497,14 @@ function TPyDelphiApplication.Set_UpdateMetricSettings(AValue: PPyObject;
var
_value : Boolean;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- if CheckBoolAttribute(AValue, 'UpdateMetricSettings', _value) then
- begin
- DelphiObject.UpdateMetricSettings := _value;
- Result := 0;
- end
- else
- Result := -1;
- end;
+ Adjust(@Self);
+ if CheckBoolAttribute(AValue, 'UpdateMetricSettings', _value) then
+ begin
+ DelphiObject.UpdateMetricSettings := _value;
+ Result := 0;
+ end
+ else
+ Result := -1;
end;
{$ENDIF FPC}
diff --git a/PythonForDelphi/Components/Sources/Core/WrapDelphiGraphics.pas b/PythonForDelphi/Components/Sources/Core/WrapDelphiGraphics.pas
index eda1033d..20459596 100644
--- a/PythonForDelphi/Components/Sources/Core/WrapDelphiGraphics.pas
+++ b/PythonForDelphi/Components/Sources/Core/WrapDelphiGraphics.pas
@@ -374,59 +374,45 @@ function TPyDelphiGraphic.GetDelphiObject: TGraphic;
function TPyDelphiGraphic.Get_Empty(AContext: Pointer): PPyObject;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- Result := VariantAsPyObject(DelphiObject.Empty);
- end;
+ Adjust(@Self);
+ Result := GetPythonEngine.VariantAsPyObject(DelphiObject.Empty);
end;
function TPyDelphiGraphic.Get_Height(AContext: Pointer): PPyObject;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- Result := PyInt_FromLong(DelphiObject.Height);
- end;
+ Adjust(@Self);
+ Result := GetPythonEngine.PyInt_FromLong(DelphiObject.Height);
end;
function TPyDelphiGraphic.Get_Modified(AContext: Pointer): PPyObject;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- Result := VariantAsPyObject(DelphiObject.Modified);
- end;
+ Adjust(@Self);
+ Result := GetPythonEngine.VariantAsPyObject(DelphiObject.Modified);
end;
function TPyDelphiGraphic.Get_Palette(AContext: Pointer): PPyObject;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- Result := PyInt_FromLong(DelphiObject.Palette);
- end;
+ Adjust(@Self);
+ Result := GetPythonEngine.PyInt_FromLong(DelphiObject.Palette);
end;
function TPyDelphiGraphic.Get_PaletteModified(
AContext: Pointer): PPyObject;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- Result := VariantAsPyObject(DelphiObject.PaletteModified);
- end;
+ Adjust(@Self);
+ Result := GetPythonEngine.VariantAsPyObject(DelphiObject.PaletteModified);
end;
function TPyDelphiGraphic.Get_Transparent(AContext: Pointer): PPyObject;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- Result := VariantAsPyObject(DelphiObject.Transparent);
- end;
+ Adjust(@Self);
+ Result := GetPythonEngine.VariantAsPyObject(DelphiObject.Transparent);
end;
function TPyDelphiGraphic.Get_Width(AContext: Pointer): PPyObject;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- Result := PyInt_FromLong(DelphiObject.Width);
- end;
+ Adjust(@Self);
+ Result := GetPythonEngine.PyInt_FromLong(DelphiObject.Width);
end;
function TPyDelphiGraphic.LoadFromClipboardFormat_Wrapper(
@@ -438,9 +424,9 @@ function TPyDelphiGraphic.LoadFromClipboardFormat_Wrapper(
_palette : Integer;
{$ENDIF FPC}
begin
+ // We adjust the transmitted self argument
+ Adjust(@Self);
with GetPythonEngine do begin
- // We adjust the transmitted self argument
- Adjust(@Self);
{$IFDEF FPC}
if PyArg_ParseTuple( args, 'i:LoadFromClipboardFormat',@_format ) <> 0 then
begin
@@ -461,9 +447,9 @@ function TPyDelphiGraphic.LoadFromFile_Wrapper(args: PPyObject): PPyObject;
var
_pFileName : PPyObject;
begin
+ // We adjust the transmitted self argument
+ Adjust(@Self);
with GetPythonEngine do begin
- // We adjust the transmitted self argument
- Adjust(@Self);
if PyArg_ParseTuple( args, 'O:LoadFromFile',@_pFileName ) <> 0 then
begin
DelphiObject.LoadFromFile(PyString_AsDelphiString(_pFileName));
@@ -481,9 +467,9 @@ function TPyDelphiGraphic.LoadFromStream_Wrapper(
_oStream : PPyObject;
_stream : TStream;
begin
+ // We adjust the transmitted self argument
+ Adjust(@Self);
with GetPythonEngine do begin
- // We adjust the transmitted self argument
- Adjust(@Self);
_oStream := nil;
if (PyArg_ParseTuple( args, 'O:LoadFromStrea',@_oStream ) <> 0) and
CheckObjAttribute(_oStream, 'Stream', TStream, _obj) then
@@ -551,9 +537,9 @@ function TPyDelphiGraphic.SaveToClipboardFormat_Wrapper(
_palette : HPALETTE;
{$ENDIF FPC}
begin
+ // We adjust the transmitted self argument
+ Adjust(@Self);
with GetPythonEngine do begin
- // We adjust the transmitted self argument
- Adjust(@Self);
{$IFDEF FPC}
if PyArg_ParseTuple( args, ':SaveToClipboardFormat') <> 0 then
begin
@@ -579,9 +565,9 @@ function TPyDelphiGraphic.SaveToFile_Wrapper(args: PPyObject): PPyObject;
var
_pFileName : PPyObject;
begin
+ // We adjust the transmitted self argument
+ Adjust(@Self);
with GetPythonEngine do begin
- // We adjust the transmitted self argument
- Adjust(@Self);
if PyArg_ParseTuple( args, 'O:SaveToFile',@_pFileName ) <> 0 then
begin
DelphiObject.SaveToFile(PyString_AsDelphiString(_pFileName));
@@ -598,9 +584,9 @@ function TPyDelphiGraphic.SaveToStream_Wrapper(args: PPyObject): PPyObject;
_oStream : PPyObject;
_stream : TStream;
begin
+ // We adjust the transmitted self argument
+ Adjust(@Self);
with GetPythonEngine do begin
- // We adjust the transmitted self argument
- Adjust(@Self);
_oStream := nil;
if (PyArg_ParseTuple( args, 'O:SaveToStream',@_oStream ) <> 0) and
CheckObjAttribute(_oStream, 'Stream', TStream, _obj) then
@@ -624,16 +610,14 @@ function TPyDelphiGraphic.Set_Height(AValue: PPyObject;
var
_value : Integer;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- if CheckIntAttribute(AValue, 'Height', _value) then
- begin
- DelphiObject.Height := _value;
- Result := 0;
- end
- else
- Result := -1;
- end;
+ Adjust(@Self);
+ if CheckIntAttribute(AValue, 'Height', _value) then
+ begin
+ DelphiObject.Height := _value;
+ Result := 0;
+ end
+ else
+ Result := -1;
end;
function TPyDelphiGraphic.Set_Modified(AValue: PPyObject;
@@ -641,16 +625,14 @@ function TPyDelphiGraphic.Set_Modified(AValue: PPyObject;
var
_value : Boolean;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- if CheckBoolAttribute(AValue, 'Modified', _value) then
- begin
- DelphiObject.Modified := _value;
- Result := 0;
- end
- else
- Result := -1;
- end;
+ Adjust(@Self);
+ if CheckBoolAttribute(AValue, 'Modified', _value) then
+ begin
+ DelphiObject.Modified := _value;
+ Result := 0;
+ end
+ else
+ Result := -1;
end;
function TPyDelphiGraphic.Set_Palette(AValue: PPyObject;
@@ -658,16 +640,14 @@ function TPyDelphiGraphic.Set_Palette(AValue: PPyObject;
var
_value : Integer;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- if CheckIntAttribute(AValue, 'Palette', _value) then
- begin
- DelphiObject.Palette := _value;
- Result := 0;
- end
- else
- Result := -1;
- end;
+ Adjust(@Self);
+ if CheckIntAttribute(AValue, 'Palette', _value) then
+ begin
+ DelphiObject.Palette := _value;
+ Result := 0;
+ end
+ else
+ Result := -1;
end;
function TPyDelphiGraphic.Set_PaletteModified(AValue: PPyObject;
@@ -675,16 +655,14 @@ function TPyDelphiGraphic.Set_PaletteModified(AValue: PPyObject;
var
_value : Boolean;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- if CheckBoolAttribute(AValue, 'PaletteModified', _value) then
- begin
- DelphiObject.PaletteModified := _value;
- Result := 0;
- end
- else
- Result := -1;
- end;
+ Adjust(@Self);
+ if CheckBoolAttribute(AValue, 'PaletteModified', _value) then
+ begin
+ DelphiObject.PaletteModified := _value;
+ Result := 0;
+ end
+ else
+ Result := -1;
end;
function TPyDelphiGraphic.Set_Transparent(AValue: PPyObject;
@@ -692,16 +670,14 @@ function TPyDelphiGraphic.Set_Transparent(AValue: PPyObject;
var
_value : Boolean;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- if CheckBoolAttribute(AValue, 'Transparent', _value) then
- begin
- DelphiObject.Transparent := _value;
- Result := 0;
- end
- else
- Result := -1;
- end;
+ Adjust(@Self);
+ if CheckBoolAttribute(AValue, 'Transparent', _value) then
+ begin
+ DelphiObject.Transparent := _value;
+ Result := 0;
+ end
+ else
+ Result := -1;
end;
function TPyDelphiGraphic.Set_Width(AValue: PPyObject;
@@ -709,16 +685,14 @@ function TPyDelphiGraphic.Set_Width(AValue: PPyObject;
var
_value : Integer;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- if CheckIntAttribute(AValue, 'Width', _value) then
- begin
- DelphiObject.Width := _value;
- Result := 0;
- end
- else
- Result := -1;
- end;
+ Adjust(@Self);
+ if CheckIntAttribute(AValue, 'Width', _value) then
+ begin
+ DelphiObject.Width := _value;
+ Result := 0;
+ end
+ else
+ Result := -1;
end;
{ TPyDelphiBitmap }
@@ -731,9 +705,9 @@ class function TPyDelphiBitmap.DelphiObjectClass: TClass;
{$IFNDEF FPC}
function TPyDelphiBitmap.Dormant_Wrapper(args: PPyObject): PPyObject;
begin
+ // We adjust the transmitted self argument
+ Adjust(@Self);
with GetPythonEngine do begin
- // We adjust the transmitted self argument
- Adjust(@Self);
if PyArg_ParseTuple( args, ':Dormant') <> 0 then
begin
DelphiObject.Dormant;
@@ -747,9 +721,9 @@ function TPyDelphiBitmap.Dormant_Wrapper(args: PPyObject): PPyObject;
function TPyDelphiBitmap.FreeImage_Wrapper(args: PPyObject): PPyObject;
begin
+ // We adjust the transmitted self argument
+ Adjust(@Self);
with GetPythonEngine do begin
- // We adjust the transmitted self argument
- Adjust(@Self);
if PyArg_ParseTuple( args, ':FreeImage') <> 0 then
begin
DelphiObject.FreeImage;
@@ -767,35 +741,29 @@ function TPyDelphiBitmap.GetDelphiObject: TBitmap;
function TPyDelphiBitmap.Get_Canvas(AContext: Pointer): PPyObject;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- Result := Wrap(DelphiObject.Canvas);
- end;
+ Adjust(@Self);
+ Result := Wrap(DelphiObject.Canvas);
end;
function TPyDelphiBitmap.Get_Handle(AContext: Pointer): PPyObject;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- Result := PyInt_FromLong(DelphiObject.Handle);
- end;
+ Adjust(@Self);
+ Result := GetPythonEngine.PyInt_FromLong(DelphiObject.Handle);
end;
function TPyDelphiBitmap.Get_HandleAllocated(AContext: Pointer): PPyObject;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- Result := VariantAsPyObject(DelphiObject.HandleAllocated);
- end;
+ Adjust(@Self);
+ Result := GetPythonEngine.VariantAsPyObject(DelphiObject.HandleAllocated);
end;
function TPyDelphiBitmap.Get_HandleType(AContext: Pointer): PPyObject;
begin
+ Adjust(@Self);
with GetPythonEngine do begin
- Adjust(@Self);
case DelphiObject.HandleType of
- bmDIB: Result := PyString_FromString('bmDIB');
- bmDDB: Result := PyString_FromString('bmDDB');
+ bmDIB: Result := PyString_FromDelphiString('bmDIB');
+ bmDDB: Result := PyString_FromDelphiString('bmDDB');
else
Result := ReturnNone;
end;
@@ -805,43 +773,37 @@ function TPyDelphiBitmap.Get_HandleType(AContext: Pointer): PPyObject;
{$IFNDEF FPC}
function TPyDelphiBitmap.Get_IgnorePalette(AContext: Pointer): PPyObject;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- Result := VariantAsPyObject(DelphiObject.IgnorePalette);
- end;
+ Adjust(@Self);
+ Result := GetPythonEngine.VariantAsPyObject(DelphiObject.IgnorePalette);
end;
{$ENDIF FPC}
function TPyDelphiBitmap.Get_MaskHandle(AContext: Pointer): PPyObject;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- Result := PyInt_FromLong(DelphiObject.MaskHandle);
- end;
+ Adjust(@Self);
+ Result := GetPythonEngine.PyInt_FromLong(DelphiObject.MaskHandle);
end;
function TPyDelphiBitmap.Get_Monochrome(AContext: Pointer): PPyObject;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- Result := VariantAsPyObject(DelphiObject.Monochrome);
- end;
+ Adjust(@Self);
+ Result := GetPythonEngine.VariantAsPyObject(DelphiObject.Monochrome);
end;
function TPyDelphiBitmap.Get_PixelFormat(AContext: Pointer): PPyObject;
begin
+ Adjust(@Self);
with GetPythonEngine do begin
- Adjust(@Self);
case DelphiObject.PixelFormat of
- pfDevice: Result := PyString_FromString('pfDevice');
- pf1bit: Result := PyString_FromString('pf1bit');
- pf4bit: Result := PyString_FromString('pf4bit');
- pf8bit: Result := PyString_FromString('pf8bit');
- pf15bit: Result := PyString_FromString('pf15bit');
- pf16bit: Result := PyString_FromString('pf16bit');
- pf24bit: Result := PyString_FromString('pf24bit');
- pf32bit: Result := PyString_FromString('pf32bit');
- pfCustom: Result := PyString_FromString('pfCustom');
+ pfDevice: Result := PyString_FromDelphiString('pfDevice');
+ pf1bit: Result := PyString_FromDelphiString('pf1bit');
+ pf4bit: Result := PyString_FromDelphiString('pf4bit');
+ pf8bit: Result := PyString_FromDelphiString('pf8bit');
+ pf15bit: Result := PyString_FromDelphiString('pf15bit');
+ pf16bit: Result := PyString_FromDelphiString('pf16bit');
+ pf24bit: Result := PyString_FromDelphiString('pf24bit');
+ pf32bit: Result := PyString_FromDelphiString('pf32bit');
+ pfCustom: Result := PyString_FromDelphiString('pfCustom');
else
Result := ReturnNone;
end;
@@ -851,19 +813,17 @@ function TPyDelphiBitmap.Get_PixelFormat(AContext: Pointer): PPyObject;
function TPyDelphiBitmap.Get_TransparentColor(
AContext: Pointer): PPyObject;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- Result := PyInt_FromLong(DelphiObject.TransparentColor);
- end;
+ Adjust(@Self);
+ Result := GetPythonEngine.PyInt_FromLong(DelphiObject.TransparentColor);
end;
function TPyDelphiBitmap.Get_TransparentMode(AContext: Pointer): PPyObject;
begin
+ Adjust(@Self);
with GetPythonEngine do begin
- Adjust(@Self);
case DelphiObject.TransparentMode of
- tmAuto: Result := PyString_FromString('tmAuto');
- tmFixed: Result := PyString_FromString('tmFixed');
+ tmAuto: Result := PyString_FromDelphiString('tmAuto');
+ tmFixed: Result := PyString_FromDelphiString('tmFixed');
else
Result := ReturnNone;
end;
@@ -876,9 +836,9 @@ function TPyDelphiBitmap.LoadFromResourceID_Wrapper(
_instance : Integer;
_resID : Integer;
begin
+ // We adjust the transmitted self argument
+ Adjust(@Self);
with GetPythonEngine do begin
- // We adjust the transmitted self argument
- Adjust(@Self);
if PyArg_ParseTuple( args, 'ii:LoadFromResourceID',@_instance, @_resID ) <> 0 then
begin
DelphiObject.LoadFromResourceID(_instance, _resID);
@@ -895,9 +855,9 @@ function TPyDelphiBitmap.LoadFromResourceName_Wrapper(
_instance : Integer;
_resName : PAnsiChar;
begin
+ // We adjust the transmitted self argument
+ Adjust(@Self);
with GetPythonEngine do begin
- // We adjust the transmitted self argument
- Adjust(@Self);
_resName := nil;
if PyArg_ParseTuple( args, 'is:LoadFromResourceName',@_instance, @_resName ) <> 0 then
begin
@@ -914,9 +874,9 @@ function TPyDelphiBitmap.Mask_Wrapper(args: PPyObject): PPyObject;
var
_transpColor : Integer;
begin
+ // We adjust the transmitted self argument
+ Adjust(@Self);
with GetPythonEngine do begin
- // We adjust the transmitted self argument
- Adjust(@Self);
if PyArg_ParseTuple( args, 'i:Mask',@_transpColor ) <> 0 then
begin
DelphiObject.Mask(_transpColor);
@@ -990,9 +950,9 @@ class procedure TPyDelphiBitmap.RegisterMethods(PythonType: TPythonType);
function TPyDelphiBitmap.ReleaseHandle_Wrapper(args: PPyObject): PPyObject;
begin
+ // We adjust the transmitted self argument
+ Adjust(@Self);
with GetPythonEngine do begin
- // We adjust the transmitted self argument
- Adjust(@Self);
if PyArg_ParseTuple( args, ':ReleaseHandle') <> 0 then
begin
Result := PyInt_FromLong(DelphiObject.ReleaseHandle);
@@ -1005,9 +965,9 @@ function TPyDelphiBitmap.ReleaseHandle_Wrapper(args: PPyObject): PPyObject;
function TPyDelphiBitmap.ReleaseMaskHandle_Wrapper(
args: PPyObject): PPyObject;
begin
+ // We adjust the transmitted self argument
+ Adjust(@Self);
with GetPythonEngine do begin
- // We adjust the transmitted self argument
- Adjust(@Self);
if PyArg_ParseTuple( args, ':ReleaseMaskHandle') <> 0 then
begin
Result := PyInt_FromLong(DelphiObject.ReleaseMaskHandle);
@@ -1020,9 +980,9 @@ function TPyDelphiBitmap.ReleaseMaskHandle_Wrapper(
function TPyDelphiBitmap.ReleasePalette_Wrapper(
args: PPyObject): PPyObject;
begin
+ // We adjust the transmitted self argument
+ Adjust(@Self);
with GetPythonEngine do begin
- // We adjust the transmitted self argument
- Adjust(@Self);
if PyArg_ParseTuple( args, ':ReleasePalette') <> 0 then
begin
Result := PyInt_FromLong(DelphiObject.ReleasePalette);
@@ -1042,16 +1002,14 @@ function TPyDelphiBitmap.Set_Handle(AValue: PPyObject;
var
_value : Integer;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- if CheckIntAttribute(AValue, 'Handle', _value) then
- begin
- DelphiObject.Handle := _value;
- Result := 0;
- end
- else
- Result := -1;
- end;
+ Adjust(@Self);
+ if CheckIntAttribute(AValue, 'Handle', _value) then
+ begin
+ DelphiObject.Handle := _value;
+ Result := 0;
+ end
+ else
+ Result := -1;
end;
function TPyDelphiBitmap.Set_HandleType(AValue: PPyObject;
@@ -1059,25 +1017,24 @@ function TPyDelphiBitmap.Set_HandleType(AValue: PPyObject;
var
_value : String;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- if CheckStrAttribute(AValue, 'HandleType', _value) then
+ Adjust(@Self);
+ if CheckStrAttribute(AValue, 'HandleType', _value) then
+ begin
+ if SameText(_value, 'bmDIB') then
+ DelphiObject.HandleType := bmDIB
+ else if SameText(_value, 'bmDDB') then
+ DelphiObject.HandleType := bmDDB
+ else
begin
- if SameText(_value, 'bmDIB') then
- DelphiObject.HandleType := bmDIB
- else if SameText(_value, 'bmDDB') then
- DelphiObject.HandleType := bmDDB
- else
- begin
+ with GetPythonEngine do
PyErr_SetString (PyExc_AttributeError^, PAnsiChar(AnsiString(Format('Unknown THandleType value "%s"', [_value]))));
- Result := -1;
- Exit;
- end;
- Result := 0;
- end
- else
Result := -1;
- end;
+ Exit;
+ end;
+ Result := 0;
+ end
+ else
+ Result := -1;
end;
{$IFNDEF FPC}
@@ -1086,16 +1043,14 @@ function TPyDelphiBitmap.Set_IgnorePalette(AValue: PPyObject;
var
_value : Boolean;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- if CheckBoolAttribute(AValue, 'IgnorePalette', _value) then
- begin
- DelphiObject.IgnorePalette := _value;
- Result := 0;
- end
- else
- Result := -1;
- end;
+ Adjust(@Self);
+ if CheckBoolAttribute(AValue, 'IgnorePalette', _value) then
+ begin
+ DelphiObject.IgnorePalette := _value;
+ Result := 0;
+ end
+ else
+ Result := -1;
end;
{$ENDIF FPC}
@@ -1104,16 +1059,14 @@ function TPyDelphiBitmap.Set_MaskHandle(AValue: PPyObject;
var
_value : Integer;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- if CheckIntAttribute(AValue, 'MaskHandle', _value) then
- begin
- DelphiObject.MaskHandle := _value;
- Result := 0;
- end
- else
- Result := -1;
- end;
+ Adjust(@Self);
+ if CheckIntAttribute(AValue, 'MaskHandle', _value) then
+ begin
+ DelphiObject.MaskHandle := _value;
+ Result := 0;
+ end
+ else
+ Result := -1;
end;
function TPyDelphiBitmap.Set_Monochrome(AValue: PPyObject;
@@ -1121,16 +1074,14 @@ function TPyDelphiBitmap.Set_Monochrome(AValue: PPyObject;
var
_value : Boolean;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- if CheckBoolAttribute(AValue, 'Monochrome', _value) then
- begin
- DelphiObject.Monochrome := _value;
- Result := 0;
- end
- else
- Result := -1;
- end;
+ Adjust(@Self);
+ if CheckBoolAttribute(AValue, 'Monochrome', _value) then
+ begin
+ DelphiObject.Monochrome := _value;
+ Result := 0;
+ end
+ else
+ Result := -1;
end;
function TPyDelphiBitmap.Set_PixelFormat(AValue: PPyObject;
@@ -1178,16 +1129,14 @@ function TPyDelphiBitmap.Set_TransparentColor(AValue: PPyObject;
var
_value : Integer;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- if CheckIntAttribute(AValue, 'TransparentColor', _value) then
- begin
- DelphiObject.TransparentColor := _value;
- Result := 0;
- end
- else
- Result := -1;
- end;
+ Adjust(@Self);
+ if CheckIntAttribute(AValue, 'TransparentColor', _value) then
+ begin
+ DelphiObject.TransparentColor := _value;
+ Result := 0;
+ end
+ else
+ Result := -1;
end;
function TPyDelphiBitmap.Set_TransparentMode(AValue: PPyObject;
@@ -1195,25 +1144,24 @@ function TPyDelphiBitmap.Set_TransparentMode(AValue: PPyObject;
var
_value : String;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- if CheckStrAttribute(AValue, 'TransparentMode', _value) then
+ Adjust(@Self);
+ if CheckStrAttribute(AValue, 'TransparentMode', _value) then
+ begin
+ if SameText(_value, 'tmAuto') then
+ DelphiObject.TransparentMode := tmAuto
+ else if SameText(_value, 'tmFixed') then
+ DelphiObject.TransparentMode := tmFixed
+ else
begin
- if SameText(_value, 'tmAuto') then
- DelphiObject.TransparentMode := tmAuto
- else if SameText(_value, 'tmFixed') then
- DelphiObject.TransparentMode := tmFixed
- else
- begin
+ with GetPythonEngine do
PyErr_SetString (PyExc_AttributeError^, PAnsiChar(AnsiString(Format('Unknown TTransparentMode value "%s"', [_value]))));
- Result := -1;
- Exit;
- end;
- Result := 0;
- end
- else
Result := -1;
- end;
+ Exit;
+ end;
+ Result := 0;
+ end
+ else
+ Result := -1;
end;
{ TPyDelphiCanvas }
@@ -1222,9 +1170,9 @@ function TPyDelphiCanvas.Arc_Wrapper(args: PPyObject): PPyObject;
var
x1, y1, x2, y2, x3, y3, x4, y4: Integer;
begin
+ // We adjust the transmitted self argument
+ Adjust(@Self);
with GetPythonEngine do begin
- // We adjust the transmitted self argument
- Adjust(@Self);
if PyArg_ParseTuple( args, 'iiiiiiii:Arc',@x1, @y1, @x2, @y2, @x3, @y3, @x4, @y4 ) <> 0 then
begin
DelphiObject.Arc(x1, y1, x2, y2, x3, y3, x4, y4);
@@ -1247,9 +1195,9 @@ function TPyDelphiCanvas.BrushCopy_Wrapper(args: PPyObject): PPyObject;
_oDest : PPyObject;
_oSource : PPyObject;
begin
+ // We adjust the transmitted self argument
+ Adjust(@Self);
with GetPythonEngine do begin
- // We adjust the transmitted self argument
- Adjust(@Self);
_oBitmap := nil;
_oSource := nil;
_oDest := nil;
@@ -1272,9 +1220,9 @@ function TPyDelphiCanvas.Chord_Wrapper(args: PPyObject): PPyObject;
var
x1, y1, x2, y2, x3, y3, x4, y4: Integer;
begin
+ // We adjust the transmitted self argument
+ Adjust(@Self);
with GetPythonEngine do begin
- // We adjust the transmitted self argument
- Adjust(@Self);
if PyArg_ParseTuple( args, 'iiiiiiii:Chord',@x1, @y1, @x2, @y2, @x3, @y3, @x4, @y4 ) <> 0 then
begin
DelphiObject.Chord(x1, y1, x2, y2, x3, y3, x4, y4);
@@ -1295,9 +1243,9 @@ function TPyDelphiCanvas.CopyRect_Wrapper(args: PPyObject): PPyObject;
_oSource : PPyObject;
_source : TRect;
begin
+ // We adjust the transmitted self argument
+ Adjust(@Self);
with GetPythonEngine do begin
- // We adjust the transmitted self argument
- Adjust(@Self);
_oCanvas := nil;
_oSource := nil;
_oDest := nil;
@@ -1327,9 +1275,9 @@ function TPyDelphiCanvas.Draw_Wrapper(args: PPyObject): PPyObject;
_oGraphic : PPyObject;
_graphic : TGraphic;
begin
+ // We adjust the transmitted self argument
+ Adjust(@Self);
with GetPythonEngine do begin
- // We adjust the transmitted self argument
- Adjust(@Self);
x := 0;
y := 0;
_oGraphic := nil;
@@ -1350,9 +1298,9 @@ function TPyDelphiCanvas.DrawFocusRect_Wrapper(args: PPyObject): PPyObject;
_rectO : PPyObject;
_rect : TRect;
begin
+ // We adjust the transmitted self argument
+ Adjust(@Self);
with GetPythonEngine do begin
- // We adjust the transmitted self argument
- Adjust(@Self);
if (PyArg_ParseTuple( args, 'O:DrawFocusRect',@_rectO ) <> 0) and
CheckRectAttribute(_rectO, 'Rect', _rect) then
begin
@@ -1368,9 +1316,9 @@ function TPyDelphiCanvas.Ellipse_Wrapper(args: PPyObject): PPyObject;
var
x1, y1, x2, y2: Integer;
begin
+ // We adjust the transmitted self argument
+ Adjust(@Self);
with GetPythonEngine do begin
- // We adjust the transmitted self argument
- Adjust(@Self);
if PyArg_ParseTuple( args, 'iiii:Ellipse',@x1, @y1, @x2, @y2 ) <> 0 then
begin
DelphiObject.Ellipse(x1, y1, x2, y2);
@@ -1386,9 +1334,9 @@ function TPyDelphiCanvas.FillRect_Wrapper(args: PPyObject): PPyObject;
_rectO : PPyObject;
_rect : TRect;
begin
+ // We adjust the transmitted self argument
+ Adjust(@Self);
with GetPythonEngine do begin
- // We adjust the transmitted self argument
- Adjust(@Self);
if (PyArg_ParseTuple( args, 'O:FillRect',@_rectO ) <> 0) and
CheckRectAttribute(_rectO, 'Rect', _rect) then
begin
@@ -1406,9 +1354,9 @@ function TPyDelphiCanvas.FloodFill_Wrapper(args: PPyObject): PPyObject;
_pFillStyle : PPyObject;
_FillStyle : TFillStyle;
begin
+ // We adjust the transmitted self argument
+ Adjust(@Self);
with GetPythonEngine do begin
- // We adjust the transmitted self argument
- Adjust(@Self);
if PyArg_ParseTuple( args, 'iiiO:FloodFill',@x, @y, @_color, @_pFillStyle ) <> 0 then
begin
if SameText(PyString_AsDelphiString(_pFillStyle), 'fsBorder') then
@@ -1428,9 +1376,9 @@ function TPyDelphiCanvas.FrameRect_Wrapper(args: PPyObject): PPyObject;
_rectO : PPyObject;
_rect : TRect;
begin
+ // We adjust the transmitted self argument
+ Adjust(@Self);
with GetPythonEngine do begin
- // We adjust the transmitted self argument
- Adjust(@Self);
if (PyArg_ParseTuple( args, 'O:FrameRect',@_rectO ) <> 0) and
CheckRectAttribute(_rectO, 'Rect', _rect) then
begin
@@ -1446,47 +1394,38 @@ function TPyDelphiCanvas.FrameRect_Wrapper(args: PPyObject): PPyObject;
function TPyDelphiCanvas.Get_CanvasOrientation(
AContext: Pointer): PPyObject;
begin
+ Adjust(@Self);
with GetPythonEngine do begin
- Adjust(@Self);
if DelphiObject.CanvasOrientation = coRightToLeft then
- Result := PyString_FromString('coRightToLeft')
+ Result := PyString_FromDelphiString('coRightToLeft')
else
- Result := PyString_FromString('coLeftToRight');
+ Result := PyString_FromDelphiString('coLeftToRight');
end;
end;
{$ENDIF FPC}
function TPyDelphiCanvas.Get_ClipRect(AContext: Pointer): PPyObject;
begin
- with GetPythonEngine do
- begin
- Adjust(@Self);
- Result := WrapRect(PyDelphiWrapper, DelphiObject.ClipRect);
- end;
+ Adjust(@Self);
+ Result := WrapRect(PyDelphiWrapper, DelphiObject.ClipRect);
end;
function TPyDelphiCanvas.Get_Handle(AContext: Pointer): PPyObject;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- Result := PyInt_FromLong(DelphiObject.Handle);
- end;
+ Adjust(@Self);
+ Result := GetPythonEngine.PyInt_FromLong(DelphiObject.Handle);
end;
function TPyDelphiCanvas.Get_HandleAllocated(AContext: Pointer): PPyObject;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- Result := VariantAsPyObject(DelphiObject.HandleAllocated);
- end;
+ Adjust(@Self);
+ Result := GetPythonEngine.VariantAsPyObject(DelphiObject.HandleAllocated);
end;
function TPyDelphiCanvas.Get_LockCount(AContext: Pointer): PPyObject;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- Result := PyInt_FromLong(DelphiObject.LockCount);
- end;
+ Adjust(@Self);
+ Result := GetPythonEngine.PyInt_FromLong(DelphiObject.LockCount);
end;
function TPyDelphiCanvas.Get_OnChange(AContext: Pointer): PPyObject;
@@ -1503,20 +1442,15 @@ function TPyDelphiCanvas.Get_OnChanging(AContext: Pointer): PPyObject;
function TPyDelphiCanvas.Get_PenPos(AContext: Pointer): PPyObject;
begin
- with GetPythonEngine do
- begin
- Adjust(@Self);
- Result := WrapPoint(PyDelphiWrapper, DelphiObject.PenPos);
- end;
+ Adjust(@Self);
+ Result := WrapPoint(PyDelphiWrapper, DelphiObject.PenPos);
end;
{$IFNDEF FPC}
function TPyDelphiCanvas.Get_TextFlags(AContext: Pointer): PPyObject;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- Result := PyInt_FromLong(DelphiObject.TextFlags);
- end;
+ Adjust(@Self);
+ Result := GetPythonEngine.PyInt_FromLong(DelphiObject.TextFlags);
end;
{$ENDIF FPC}
@@ -1529,9 +1463,9 @@ function TPyDelphiCanvas.GetPixel(args: PPyObject): PPyObject;
var
x, y : Integer;
begin
+ // We adjust the transmitted self argument
+ Adjust(@Self);
with GetPythonEngine do begin
- // We adjust the transmitted self argument
- Adjust(@Self);
x := 0;
y := 0;
if PyArg_ParseTuple( args, 'ii:GetPixel',@x, @y ) <> 0 then
@@ -1547,9 +1481,9 @@ function TPyDelphiCanvas.LineTo_Wrapper(args: PPyObject): PPyObject;
var
x, y : Integer;
begin
+ // We adjust the transmitted self argument
+ Adjust(@Self);
with GetPythonEngine do begin
- // We adjust the transmitted self argument
- Adjust(@Self);
x := 0;
y := 0;
if PyArg_ParseTuple( args, 'ii:LineTo',@x, @y ) <> 0 then
@@ -1564,9 +1498,9 @@ function TPyDelphiCanvas.LineTo_Wrapper(args: PPyObject): PPyObject;
function TPyDelphiCanvas.Lock_Wrapper(args: PPyObject): PPyObject;
begin
+ // We adjust the transmitted self argument
+ Adjust(@Self);
with GetPythonEngine do begin
- // We adjust the transmitted self argument
- Adjust(@Self);
if PyArg_ParseTuple( args, ':Lock') <> 0 then
begin
DelphiObject.Lock;
@@ -1581,9 +1515,9 @@ function TPyDelphiCanvas.MoveTo_Wrapper(args: PPyObject): PPyObject;
var
x, y : Integer;
begin
+ // We adjust the transmitted self argument
+ Adjust(@Self);
with GetPythonEngine do begin
- // We adjust the transmitted self argument
- Adjust(@Self);
x := 0;
y := 0;
if PyArg_ParseTuple( args, 'ii:MoveTo',@x, @y ) <> 0 then
@@ -1600,9 +1534,9 @@ function TPyDelphiCanvas.Pie_Wrapper(args: PPyObject): PPyObject;
var
x1, y1, x2, y2, x3, y3, x4, y4: Integer;
begin
+ // We adjust the transmitted self argument
+ Adjust(@Self);
with GetPythonEngine do begin
- // We adjust the transmitted self argument
- Adjust(@Self);
if PyArg_ParseTuple( args, 'iiiiiiii:Pie',@x1, @y1, @x2, @y2, @x3, @y3, @x4, @y4 ) <> 0 then
begin
DelphiObject.Pie(x1, y1, x2, y2, x3, y3, x4, y4);
@@ -1621,9 +1555,9 @@ function TPyDelphiCanvas.PolyBezier_Wrapper(args: PPyObject): PPyObject;
_oPoints : PPyObject;
_oPoint : PPyObject;
begin
+ // We adjust the transmitted self argument
+ Adjust(@Self);
with GetPythonEngine do begin
- // We adjust the transmitted self argument
- Adjust(@Self);
_oPoints := nil;
if PyArg_ParseTuple( args, 'O:PolyBezier',@_oPoints ) <> 0 then
begin
@@ -1668,9 +1602,9 @@ function TPyDelphiCanvas.PolyBezierTo_Wrapper(args: PPyObject): PPyObject;
_oPoints : PPyObject;
_oPoint : PPyObject;
begin
+ // We adjust the transmitted self argument
+ Adjust(@Self);
with GetPythonEngine do begin
- // We adjust the transmitted self argument
- Adjust(@Self);
_oPoints := nil;
if PyArg_ParseTuple( args, 'O:PolyBezierTo',@_oPoints ) <> 0 then
begin
@@ -1715,9 +1649,9 @@ function TPyDelphiCanvas.Polygon_Wrapper(args: PPyObject): PPyObject;
_oPoints : PPyObject;
_oPoint : PPyObject;
begin
+ // We adjust the transmitted self argument
+ Adjust(@Self);
with GetPythonEngine do begin
- // We adjust the transmitted self argument
- Adjust(@Self);
_oPoints := nil;
if PyArg_ParseTuple( args, 'O:Polygon',@_oPoints ) <> 0 then
begin
@@ -1761,9 +1695,9 @@ function TPyDelphiCanvas.Polyline_Wrapper(args: PPyObject): PPyObject;
_oPoints : PPyObject;
_oPoint : PPyObject;
begin
+ // We adjust the transmitted self argument
+ Adjust(@Self);
with GetPythonEngine do begin
- // We adjust the transmitted self argument
- Adjust(@Self);
_oPoints := nil;
if PyArg_ParseTuple( args, 'O:Polyline',@_oPoints ) <> 0 then
begin
@@ -1803,9 +1737,9 @@ function TPyDelphiCanvas.Rectangle_Wrapper(args: PPyObject): PPyObject;
var
x1, y1, x2, y2: Integer;
begin
+ // We adjust the transmitted self argument
+ Adjust(@Self);
with GetPythonEngine do begin
- // We adjust the transmitted self argument
- Adjust(@Self);
if PyArg_ParseTuple( args, 'iiii:Rectangle',@x1, @y1, @x2, @y2 ) <> 0 then
begin
DelphiObject.Rectangle(x1, y1, x2, y2);
@@ -1818,9 +1752,9 @@ function TPyDelphiCanvas.Rectangle_Wrapper(args: PPyObject): PPyObject;
function TPyDelphiCanvas.Refresh_Wrapper(args: PPyObject): PPyObject;
begin
+ // We adjust the transmitted self argument
+ Adjust(@Self);
with GetPythonEngine do begin
- // We adjust the transmitted self argument
- Adjust(@Self);
if PyArg_ParseTuple( args, ':Refresh') <> 0 then
begin
DelphiObject.Refresh;
@@ -1969,9 +1903,9 @@ function TPyDelphiCanvas.RoundRect_Wrapper(args: PPyObject): PPyObject;
var
x1, y1, x2, y2, x3, y3: Integer;
begin
+ // We adjust the transmitted self argument
+ Adjust(@Self);
with GetPythonEngine do begin
- // We adjust the transmitted self argument
- Adjust(@Self);
if PyArg_ParseTuple( args, 'iiiiii:RoundRect',@x1, @y1, @x2, @y2, @x3, @y3 ) <> 0 then
begin
DelphiObject.RoundRect(x1, y1, x2, y2, x3, y3);
@@ -1987,16 +1921,14 @@ function TPyDelphiCanvas.Set_Handle(AValue: PPyObject;
var
_value : Integer;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- if CheckIntAttribute(AValue, 'Handle', _value) then
- begin
- DelphiObject.Handle := _value;
- Result := 0;
- end
- else
- Result := -1;
- end;
+ Adjust(@Self);
+ if CheckIntAttribute(AValue, 'Handle', _value) then
+ begin
+ DelphiObject.Handle := _value;
+ Result := 0;
+ end
+ else
+ Result := -1;
end;
function TPyDelphiCanvas.Set_OnChange(AValue: PPyObject;
@@ -2019,16 +1951,14 @@ function TPyDelphiCanvas.Set_TextFlags(AValue: PPyObject;
var
_value : Integer;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- if CheckIntAttribute(AValue, 'TextFlags', _value) then
- begin
- DelphiObject.TextFlags := _value;
- Result := 0;
- end
- else
- Result := -1;
- end;
+ Adjust(@Self);
+ if CheckIntAttribute(AValue, 'TextFlags', _value) then
+ begin
+ DelphiObject.TextFlags := _value;
+ Result := 0;
+ end
+ else
+ Result := -1;
end;
{$ENDIF FPC}
@@ -2042,9 +1972,9 @@ function TPyDelphiCanvas.SetPixel(args: PPyObject): PPyObject;
x, y : Integer;
_color : TColor;
begin
+ // We adjust the transmitted self argument
+ Adjust(@Self);
with GetPythonEngine do begin
- // We adjust the transmitted self argument
- Adjust(@Self);
x := 0;
y := 0;
if PyArg_ParseTuple( args, 'iii:SetPixel',@x, @y, @_color ) <> 0 then
@@ -2065,9 +1995,9 @@ function TPyDelphiCanvas.StretchDraw_Wrapper(args: PPyObject): PPyObject;
_oRect : PPyObject;
_rect : TRect;
begin
+ // We adjust the transmitted self argument
+ Adjust(@Self);
with GetPythonEngine do begin
- // We adjust the transmitted self argument
- Adjust(@Self);
_oGraphic := nil;
_oRect := nil;
if (PyArg_ParseTuple( args, 'iiO:StretchDraw',@_oRect, @_oGraphic ) <> 0) and
@@ -2087,9 +2017,9 @@ function TPyDelphiCanvas.TextExtent_Wrapper(args: PPyObject): PPyObject;
var
_pText : PPyObject;
begin
+ // We adjust the transmitted self argument
+ Adjust(@Self);
with GetPythonEngine do begin
- // We adjust the transmitted self argument
- Adjust(@Self);
if PyArg_ParseTuple( args, 'O:TextExtent',@_pText ) <> 0 then
begin
Result := WrapSize(PyDelphiWrapper, DelphiObject.TextExtent(PyString_AsDelphiString(_pText)));
@@ -2103,9 +2033,9 @@ function TPyDelphiCanvas.TextHeight_Wrapper(args: PPyObject): PPyObject;
var
_pText : PPyObject;
begin
+ // We adjust the transmitted self argument
+ Adjust(@Self);
with GetPythonEngine do begin
- // We adjust the transmitted self argument
- Adjust(@Self);
if PyArg_ParseTuple( args, 'O:TextHeight',@_pText ) <> 0 then
begin
Result := PyInt_FromLong(DelphiObject.TextHeight(PyString_AsDelphiString(_pText)));
@@ -2120,9 +2050,9 @@ function TPyDelphiCanvas.TextOut_Wrapper(args: PPyObject): PPyObject;
x, y : Integer;
_text : PAnsiChar;
begin
+ // We adjust the transmitted self argument
+ Adjust(@Self);
with GetPythonEngine do begin
- // We adjust the transmitted self argument
- Adjust(@Self);
x := 0;
y := 0;
if PyArg_ParseTuple( args, 'iis:TextRect',@x, @y, @_text ) <> 0 then
@@ -2143,9 +2073,9 @@ function TPyDelphiCanvas.TextRect_Wrapper(args: PPyObject): PPyObject;
_rect : TRect;
_text : PAnsiChar;
begin
+ // We adjust the transmitted self argument
+ Adjust(@Self);
with GetPythonEngine do begin
- // We adjust the transmitted self argument
- Adjust(@Self);
x := 0;
y := 0;
_rectO := nil;
@@ -2166,9 +2096,9 @@ function TPyDelphiCanvas.TextWidth_Wrapper(args: PPyObject): PPyObject;
var
_pText : PPyObject;
begin
+ // We adjust the transmitted self argument
+ Adjust(@Self);
with GetPythonEngine do begin
- // We adjust the transmitted self argument
- Adjust(@Self);
if PyArg_ParseTuple( args, 'O:TextWidth',@_pText ) <> 0 then
begin
Result := PyInt_FromLong(DelphiObject.TextWidth(PyString_AsDelphiString(_pText)));
@@ -2180,9 +2110,9 @@ function TPyDelphiCanvas.TextWidth_Wrapper(args: PPyObject): PPyObject;
function TPyDelphiCanvas.TryLock_Wrapper(args: PPyObject): PPyObject;
begin
+ // We adjust the transmitted self argument
+ Adjust(@Self);
with GetPythonEngine do begin
- // We adjust the transmitted self argument
- Adjust(@Self);
if PyArg_ParseTuple( args, ':Unlock') <> 0 then
begin
Result := VariantAsPyObject( DelphiObject.TryLock );
@@ -2194,9 +2124,9 @@ function TPyDelphiCanvas.TryLock_Wrapper(args: PPyObject): PPyObject;
function TPyDelphiCanvas.Unlock_Wrapper(args: PPyObject): PPyObject;
begin
+ // We adjust the transmitted self argument
+ Adjust(@Self);
with GetPythonEngine do begin
- // We adjust the transmitted self argument
- Adjust(@Self);
if PyArg_ParseTuple( args, ':Unlock') <> 0 then
begin
DelphiObject.Unlock;
@@ -2212,9 +2142,9 @@ function TPyDelphiCanvas.Unlock_Wrapper(args: PPyObject): PPyObject;
function TPyDelphiMetaFile.Clear_Wrapper(args: PPyObject): PPyObject;
begin
+ // We adjust the transmitted self argument
+ Adjust(@Self);
with GetPythonEngine do begin
- // We adjust the transmitted self argument
- Adjust(@Self);
if PyArg_ParseTuple( args, ':Clear') <> 0 then
begin
DelphiObject.Clear;
@@ -2237,18 +2167,14 @@ function TPyDelphiMetaFile.GetDelphiObject: TMetaFile;
function TPyDelphiMetaFile.Get_CreatedBy(AContext: Pointer): PPyObject;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- Result := PyString_FromString(PAnsiChar(AnsiString(DelphiObject.CreatedBy)));
- end;
+ Adjust(@Self);
+ Result := GetPythonEngine.PyString_FromDelphiString(DelphiObject.CreatedBy);
end;
function TPyDelphiMetaFile.Get_Description(AContext: Pointer): PPyObject;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- Result := PyString_FromString(PAnsiChar(AnsiString(DelphiObject.Description)));
- end;
+ Adjust(@Self);
+ Result := GetPythonEngine.PyString_FromDelphiString(DelphiObject.Description);
end;
function TPyDelphiMetaFile.Get_Enhanced(AContext: Pointer): PPyObject;
@@ -2261,43 +2187,33 @@ function TPyDelphiMetaFile.Get_Enhanced(AContext: Pointer): PPyObject;
function TPyDelphiMetaFile.Get_Handle(AContext: Pointer): PPyObject;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- Result := PyInt_FromLong(DelphiObject.Handle);
- end;
+ Adjust(@Self);
+ Result := GetPythonEngine.PyInt_FromLong(DelphiObject.Handle);
end;
function TPyDelphiMetaFile.Get_HandleAllocated(
AContext: Pointer): PPyObject;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- Result := VariantAsPyObject(DelphiObject.HandleAllocated);
- end;
+ Adjust(@Self);
+ Result := GetPythonEngine.VariantAsPyObject(DelphiObject.HandleAllocated);
end;
function TPyDelphiMetaFile.Get_Inch(AContext: Pointer): PPyObject;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- Result := PyInt_FromLong(DelphiObject.Inch);
- end;
+ Adjust(@Self);
+ Result := GetPythonEngine.PyInt_FromLong(DelphiObject.Inch);
end;
function TPyDelphiMetaFile.Get_MMHeight(AContext: Pointer): PPyObject;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- Result := PyInt_FromLong(DelphiObject.MMHeight);
- end;
+ Adjust(@Self);
+ Result := GetPythonEngine.PyInt_FromLong(DelphiObject.MMHeight);
end;
function TPyDelphiMetaFile.Get_MMWidth(AContext: Pointer): PPyObject;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- Result := PyInt_FromLong(DelphiObject.MMWidth);
- end;
+ Adjust(@Self);
+ Result := GetPythonEngine.PyInt_FromLong(DelphiObject.MMWidth);
end;
class procedure TPyDelphiMetaFile.RegisterGetSets(PythonType: TPythonType);
@@ -2338,9 +2254,9 @@ class procedure TPyDelphiMetaFile.RegisterMethods(PythonType: TPythonType);
function TPyDelphiMetaFile.ReleaseHandle_Wrapper(
args: PPyObject): PPyObject;
begin
+ // We adjust the transmitted self argument
+ Adjust(@Self);
with GetPythonEngine do begin
- // We adjust the transmitted self argument
- Adjust(@Self);
if PyArg_ParseTuple( args, ':ReleaseHandle') <> 0 then
begin
Result := PyInt_FromLong(DelphiObject.ReleaseHandle);
@@ -2360,16 +2276,14 @@ function TPyDelphiMetaFile.Set_Enhanced(AValue: PPyObject;
var
_value : Boolean;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- if CheckBoolAttribute(AValue, 'Enhanced', _value) then
- begin
- DelphiObject.Enhanced := _value;
- Result := 0;
- end
- else
- Result := -1;
- end;
+ Adjust(@Self);
+ if CheckBoolAttribute(AValue, 'Enhanced', _value) then
+ begin
+ DelphiObject.Enhanced := _value;
+ Result := 0;
+ end
+ else
+ Result := -1;
end;
function TPyDelphiMetaFile.Set_Handle(AValue: PPyObject;
@@ -2377,16 +2291,14 @@ function TPyDelphiMetaFile.Set_Handle(AValue: PPyObject;
var
_value : Integer;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- if CheckIntAttribute(AValue, 'Handle', _value) then
- begin
- DelphiObject.Handle := _value;
- Result := 0;
- end
- else
- Result := -1;
- end;
+ Adjust(@Self);
+ if CheckIntAttribute(AValue, 'Handle', _value) then
+ begin
+ DelphiObject.Handle := _value;
+ Result := 0;
+ end
+ else
+ Result := -1;
end;
function TPyDelphiMetaFile.Set_Inch(AValue: PPyObject;
@@ -2394,16 +2306,14 @@ function TPyDelphiMetaFile.Set_Inch(AValue: PPyObject;
var
_value : Integer;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- if CheckIntAttribute(AValue, 'Inch', _value) then
- begin
- DelphiObject.Inch := _value;
- Result := 0;
- end
- else
- Result := -1;
- end;
+ Adjust(@Self);
+ if CheckIntAttribute(AValue, 'Inch', _value) then
+ begin
+ DelphiObject.Inch := _value;
+ Result := 0;
+ end
+ else
+ Result := -1;
end;
function TPyDelphiMetaFile.Set_MMHeight(AValue: PPyObject;
@@ -2411,16 +2321,14 @@ function TPyDelphiMetaFile.Set_MMHeight(AValue: PPyObject;
var
_value : Integer;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- if CheckIntAttribute(AValue, 'MMHeight', _value) then
- begin
- DelphiObject.MMHeight := _value;
- Result := 0;
- end
- else
- Result := -1;
- end;
+ Adjust(@Self);
+ if CheckIntAttribute(AValue, 'MMHeight', _value) then
+ begin
+ DelphiObject.MMHeight := _value;
+ Result := 0;
+ end
+ else
+ Result := -1;
end;
function TPyDelphiMetaFile.Set_MMWidth(AValue: PPyObject;
@@ -2428,16 +2336,14 @@ function TPyDelphiMetaFile.Set_MMWidth(AValue: PPyObject;
var
_value : Integer;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- if CheckIntAttribute(AValue, 'MMWidth', _value) then
- begin
- DelphiObject.MMWidth := _value;
- Result := 0;
- end
- else
- Result := -1;
- end;
+ Adjust(@Self);
+ if CheckIntAttribute(AValue, 'MMWidth', _value) then
+ begin
+ DelphiObject.MMWidth := _value;
+ Result := 0;
+ end
+ else
+ Result := -1;
end;
{$ENDIF FPC}
@@ -2455,18 +2361,14 @@ function TPyDelphiIcon.GetDelphiObject: TIcon;
function TPyDelphiIcon.Get_Handle(AContext: Pointer): PPyObject;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- Result := PyInt_FromLong(DelphiObject.Handle);
- end;
+ Adjust(@Self);
+ Result := GetPythonEngine.PyInt_FromLong(DelphiObject.Handle);
end;
function TPyDelphiIcon.Get_HandleAllocated(AContext: Pointer): PPyObject;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- Result := VariantAsPyObject(DelphiObject.HandleAllocated);
- end;
+ Adjust(@Self);
+ Result := GetPythonEngine.VariantAsPyObject(DelphiObject.HandleAllocated);
end;
class procedure TPyDelphiIcon.RegisterGetSets(PythonType: TPythonType);
@@ -2491,9 +2393,9 @@ class procedure TPyDelphiIcon.RegisterMethods(PythonType: TPythonType);
function TPyDelphiIcon.ReleaseHandle_Wrapper(args: PPyObject): PPyObject;
begin
+ // We adjust the transmitted self argument
+ Adjust(@Self);
with GetPythonEngine do begin
- // We adjust the transmitted self argument
- Adjust(@Self);
if PyArg_ParseTuple( args, ':ReleaseHandle') <> 0 then
begin
Result := PyInt_FromLong(DelphiObject.ReleaseHandle);
@@ -2513,16 +2415,14 @@ function TPyDelphiIcon.Set_Handle(AValue: PPyObject;
var
_value : Integer;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- if CheckIntAttribute(AValue, 'Handle', _value) then
- begin
- DelphiObject.Handle := _value;
- Result := 0;
- end
- else
- Result := -1;
- end;
+ Adjust(@Self);
+ if CheckIntAttribute(AValue, 'Handle', _value) then
+ begin
+ DelphiObject.Handle := _value;
+ Result := 0;
+ end
+ else
+ Result := -1;
end;
{ TPyDelphiPicture }
@@ -2534,52 +2434,40 @@ class function TPyDelphiPicture.DelphiObjectClass: TClass;
function TPyDelphiPicture.Get_Bitmap(AContext: Pointer): PPyObject;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- Result := Wrap(DelphiObject.Bitmap);
- end;
+ Adjust(@Self);
+ Result := Wrap(DelphiObject.Bitmap);
end;
function TPyDelphiPicture.Get_Graphic(AContext: Pointer): PPyObject;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- Result := Wrap(DelphiObject.Graphic);
- end;
+ Adjust(@Self);
+ Result := Wrap(DelphiObject.Graphic);
end;
function TPyDelphiPicture.Get_Height(AContext: Pointer): PPyObject;
begin
- with GetPythonEngine do begin
Adjust(@Self);
- Result := PyInt_FromLong(DelphiObject.Height);
- end;
+ Result := GetPythonEngine.PyInt_FromLong(DelphiObject.Height);
end;
function TPyDelphiPicture.Get_Icon(AContext: Pointer): PPyObject;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- Result := Wrap(DelphiObject.Icon);
- end;
+ Adjust(@Self);
+ Result := Wrap(DelphiObject.Icon);
end;
{$IFNDEF FPC}
function TPyDelphiPicture.Get_MetaFile(AContext: Pointer): PPyObject;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- Result := Wrap(DelphiObject.MetaFile);
- end;
+ Adjust(@Self);
+ Result := Wrap(DelphiObject.MetaFile);
end;
{$ENDIF FPC}
function TPyDelphiPicture.Get_Width(AContext: Pointer): PPyObject;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- Result := PyInt_FromLong(DelphiObject.Width);
- end;
+ Adjust(@Self);
+ Result := GetPythonEngine.PyInt_FromLong(DelphiObject.Width);
end;
function TPyDelphiPicture.GetDelphiObject: TPicture;
@@ -2591,9 +2479,9 @@ function TPyDelphiPicture.LoadFromFile_Wrapper(args: PPyObject): PPyObject;
var
_pFileName : PPyObject;
begin
+ // We adjust the transmitted self argument
+ Adjust(@Self);
with GetPythonEngine do begin
- // We adjust the transmitted self argument
- Adjust(@Self);
if PyArg_ParseTuple( args, 'O:LoadFromFile',@_pFileName ) <> 0 then
begin
DelphiObject.LoadFromFile(PyString_AsDelphiString(_pFileName));
@@ -2641,9 +2529,9 @@ function TPyDelphiPicture.SaveToFile_Wrapper(args: PPyObject): PPyObject;
var
_pFileName : PPyObject;
begin
+ // We adjust the transmitted self argument
+ Adjust(@Self);
with GetPythonEngine do begin
- // We adjust the transmitted self argument
- Adjust(@Self);
if PyArg_ParseTuple( args, 'O:SaveToFile',@_pFileName ) <> 0 then
begin
DelphiObject.SaveToFile(PyString_AsDelphiString(_pFileName));
@@ -2659,16 +2547,14 @@ function TPyDelphiPicture.Set_Bitmap(AValue: PPyObject;
var
_object : TObject;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- if CheckObjAttribute(AValue, 'Bitmap', TBitmap, _object) then
- begin
- Self.DelphiObject.Bitmap := TBitmap(_object);
- Result := 0;
- end
- else
- Result := -1;
- end;
+ Adjust(@Self);
+ if CheckObjAttribute(AValue, 'Bitmap', TBitmap, _object) then
+ begin
+ Self.DelphiObject.Bitmap := TBitmap(_object);
+ Result := 0;
+ end
+ else
+ Result := -1;
end;
function TPyDelphiPicture.Set_Graphic(AValue: PPyObject;
@@ -2676,16 +2562,14 @@ function TPyDelphiPicture.Set_Graphic(AValue: PPyObject;
var
_object : TObject;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- if CheckObjAttribute(AValue, 'Graphic', TGraphic, _object) then
- begin
- Self.DelphiObject.Graphic := TGraphic(_object);
- Result := 0;
- end
- else
- Result := -1;
- end;
+ Adjust(@Self);
+ if CheckObjAttribute(AValue, 'Graphic', TGraphic, _object) then
+ begin
+ Self.DelphiObject.Graphic := TGraphic(_object);
+ Result := 0;
+ end
+ else
+ Result := -1;
end;
function TPyDelphiPicture.Set_Icon(AValue: PPyObject;
@@ -2693,16 +2577,14 @@ function TPyDelphiPicture.Set_Icon(AValue: PPyObject;
var
_object : TObject;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- if CheckObjAttribute(AValue, 'Icon', TIcon, _object) then
- begin
- Self.DelphiObject.Icon := TIcon(_object);
- Result := 0;
- end
- else
- Result := -1;
- end;
+ Adjust(@Self);
+ if CheckObjAttribute(AValue, 'Icon', TIcon, _object) then
+ begin
+ Self.DelphiObject.Icon := TIcon(_object);
+ Result := 0;
+ end
+ else
+ Result := -1;
end;
{$IFNDEF FPC}
@@ -2711,16 +2593,14 @@ function TPyDelphiPicture.Set_MetaFile(AValue: PPyObject;
var
_object : TObject;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- if CheckObjAttribute(AValue, 'MetaFile', TMetaFile, _object) then
- begin
- Self.DelphiObject.MetaFile := TMetaFile(_object);
- Result := 0;
- end
- else
- Result := -1;
- end;
+ Adjust(@Self);
+ if CheckObjAttribute(AValue, 'MetaFile', TMetaFile, _object) then
+ begin
+ Self.DelphiObject.MetaFile := TMetaFile(_object);
+ Result := 0;
+ end
+ else
+ Result := -1;
end;
{$ENDIF FPC}
diff --git a/PythonForDelphi/Components/Sources/Core/WrapDelphiGrids.pas b/PythonForDelphi/Components/Sources/Core/WrapDelphiGrids.pas
index 31ec9cb7..e3bdb968 100644
--- a/PythonForDelphi/Components/Sources/Core/WrapDelphiGrids.pas
+++ b/PythonForDelphi/Components/Sources/Core/WrapDelphiGrids.pas
@@ -177,19 +177,19 @@ function MakeGridDrawState(AState : TGridDrawState) : PPyObject;
Result := PyList_New(0);
if gdSelected in AState then
begin
- _item := PyString_FromString('gdSelected');
+ _item := PyString_FromDelphiString('gdSelected');
PyList_Append(Result, _item);
Py_DecRef(_item);
end;
if gdFocused in AState then
begin
- _item := PyString_FromString('gdFocused');
+ _item := PyString_FromDelphiString('gdFocused');
PyList_Append(Result, _item);
Py_DecRef(_item);
end;
if gdFixed in AState then
begin
- _item := PyString_FromString('gdFixed');
+ _item := PyString_FromDelphiString('gdFixed');
PyList_Append(Result, _item);
Py_DecRef(_item);
end;
@@ -380,89 +380,69 @@ function TPyDelphiCustomDrawGrid.GetDelphiObject: TCustomDrawGrid;
function TPyDelphiCustomDrawGrid.Get_Canvas(AContext: Pointer): PPyObject;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- Result := Wrap(DelphiObject.Canvas);
- end;
+ Adjust(@Self);
+ Result := Wrap(DelphiObject.Canvas);
end;
function TPyDelphiCustomDrawGrid.Get_ColWidths(
AContext: Pointer): PPyObject;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- Result := Self.PyDelphiWrapper.DefaultContainerType.CreateInstance;
- with PythonToDelphi(Result) as TPyDelphiContainer do
- Setup(Self.PyDelphiWrapper, TGridColWidthsAccess.Create(Self.PyDelphiWrapper, Self.DelphiObject));
- end;
+ Adjust(@Self);
+ Result := Self.PyDelphiWrapper.DefaultContainerType.CreateInstance;
+ with PythonToDelphi(Result) as TPyDelphiContainer do
+ Setup(Self.PyDelphiWrapper, TGridColWidthsAccess.Create(Self.PyDelphiWrapper, Self.DelphiObject));
end;
function TPyDelphiCustomDrawGrid.Get_Col(AContext: Pointer): PPyObject;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- Result := PyInt_FromLong(DelphiObject.Col);
- end;
+ Adjust(@Self);
+ Result := GetPythonEngine.PyInt_FromLong(DelphiObject.Col);
end;
function TPyDelphiCustomDrawGrid.Get_EditorMode(
AContext: Pointer): PPyObject;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- Result := VariantAsPyObject(DelphiObject.EditorMode);
- end;
+ Adjust(@Self);
+ Result := GetPythonEngine.VariantAsPyObject(DelphiObject.EditorMode);
end;
function TPyDelphiCustomDrawGrid.Get_GridHeight(
AContext: Pointer): PPyObject;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- Result := PyInt_FromLong(DelphiObject.GridHeight);
- end;
+ Adjust(@Self);
+ Result := GetPythonEngine.PyInt_FromLong(DelphiObject.GridHeight);
end;
function TPyDelphiCustomDrawGrid.Get_GridWidth(
AContext: Pointer): PPyObject;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- Result := PyInt_FromLong(DelphiObject.GridWidth);
- end;
+ Adjust(@Self);
+ Result := GetPythonEngine.PyInt_FromLong(DelphiObject.GridWidth);
end;
function TPyDelphiCustomDrawGrid.Get_LeftCol(AContext: Pointer): PPyObject;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- Result := PyInt_FromLong(DelphiObject.LeftCol);
- end;
+ Adjust(@Self);
+ Result := GetPythonEngine.PyInt_FromLong(DelphiObject.LeftCol);
end;
function TPyDelphiCustomDrawGrid.Get_Row(AContext: Pointer): PPyObject;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- Result := PyInt_FromLong(DelphiObject.Row);
- end;
+ Adjust(@Self);
+ Result := GetPythonEngine.PyInt_FromLong(DelphiObject.Row);
end;
function TPyDelphiCustomDrawGrid.Get_Selection(
AContext: Pointer): PPyObject;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- Result := WrapRect(PyDelphiWrapper, TRect(DelphiObject.Selection));
- end;
+ Adjust(@Self);
+ Result := WrapRect(PyDelphiWrapper, TRect(DelphiObject.Selection));
end;
function TPyDelphiCustomDrawGrid.Get_TopRow(AContext: Pointer): PPyObject;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- Result := PyInt_FromLong(DelphiObject.TopRow);
- end;
+ Adjust(@Self);
+ Result := GetPythonEngine.PyInt_FromLong(DelphiObject.TopRow);
end;
class function TPyDelphiCustomDrawGrid.GetTypeName : String;
@@ -510,16 +490,14 @@ function TPyDelphiCustomDrawGrid.Set_Col(AValue: PPyObject;
var
_value : Integer;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- if CheckIntAttribute(AValue, 'Col', _value) then
- begin
- DelphiObject.Col := _value;
- Result := 0;
- end
- else
- Result := -1;
- end;
+ Adjust(@Self);
+ if CheckIntAttribute(AValue, 'Col', _value) then
+ begin
+ DelphiObject.Col := _value;
+ Result := 0;
+ end
+ else
+ Result := -1;
end;
function TPyDelphiCustomDrawGrid.Set_EditorMode(AValue: PPyObject;
@@ -527,16 +505,14 @@ function TPyDelphiCustomDrawGrid.Set_EditorMode(AValue: PPyObject;
var
_value : Boolean;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- if CheckBoolAttribute(AValue, 'EditorMode', _value) then
- begin
- DelphiObject.EditorMode := _value;
- Result := 0;
- end
- else
- Result := -1;
- end;
+ Adjust(@Self);
+ if CheckBoolAttribute(AValue, 'EditorMode', _value) then
+ begin
+ DelphiObject.EditorMode := _value;
+ Result := 0;
+ end
+ else
+ Result := -1;
end;
function TPyDelphiCustomDrawGrid.Set_LeftCol(AValue: PPyObject;
@@ -544,16 +520,14 @@ function TPyDelphiCustomDrawGrid.Set_LeftCol(AValue: PPyObject;
var
_value : Integer;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- if CheckIntAttribute(AValue, 'LeftCol', _value) then
- begin
- DelphiObject.LeftCol := _value;
- Result := 0;
- end
- else
- Result := -1;
- end;
+ Adjust(@Self);
+ if CheckIntAttribute(AValue, 'LeftCol', _value) then
+ begin
+ DelphiObject.LeftCol := _value;
+ Result := 0;
+ end
+ else
+ Result := -1;
end;
function TPyDelphiCustomDrawGrid.Set_Row(AValue: PPyObject;
@@ -561,16 +535,14 @@ function TPyDelphiCustomDrawGrid.Set_Row(AValue: PPyObject;
var
_value : Integer;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- if CheckIntAttribute(AValue, 'Row', _value) then
- begin
- DelphiObject.Row := _value;
- Result := 0;
- end
- else
- Result := -1;
- end;
+ Adjust(@Self);
+ if CheckIntAttribute(AValue, 'Row', _value) then
+ begin
+ DelphiObject.Row := _value;
+ Result := 0;
+ end
+ else
+ Result := -1;
end;
function TPyDelphiCustomDrawGrid.Set_Selection(AValue: PPyObject;
@@ -578,16 +550,14 @@ function TPyDelphiCustomDrawGrid.Set_Selection(AValue: PPyObject;
var
_value : TRect;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- if CheckRectAttribute(AValue, 'Selection', _value) then
- begin
- DelphiObject.Selection := TGridRect(_value);
- Result := 0;
- end
- else
- Result := -1;
- end;
+ Adjust(@Self);
+ if CheckRectAttribute(AValue, 'Selection', _value) then
+ begin
+ DelphiObject.Selection := TGridRect(_value);
+ Result := 0;
+ end
+ else
+ Result := -1;
end;
function TPyDelphiCustomDrawGrid.Set_TopRow(AValue: PPyObject;
@@ -595,16 +565,14 @@ function TPyDelphiCustomDrawGrid.Set_TopRow(AValue: PPyObject;
var
_value : Integer;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- if CheckIntAttribute(AValue, 'TopRow', _value) then
- begin
- DelphiObject.TopRow := _value;
- Result := 0;
- end
- else
- Result := -1;
- end;
+ Adjust(@Self);
+ if CheckIntAttribute(AValue, 'TopRow', _value) then
+ begin
+ DelphiObject.TopRow := _value;
+ Result := 0;
+ end
+ else
+ Result := -1;
end;
{ TPyDelphiDrawGrid }
@@ -666,11 +634,11 @@ function TPyDelphiStringGrid.GetCell(args: PPyObject): PPyObject;
var
col, row: integer;
begin
+ // adjust the transmitted self argument
+ Adjust(@Self);
with GetPythonEngine do begin
- // adjust the transmitted self argument
- Adjust(@Self);
if PyArg_ParseTuple( args, 'ii:GetCell',@col, @row ) <> 0 then
- Result := PyString_FromString(PAnsiChar(AnsiString(DelphiObject.Cells[col, row])))
+ Result := PyString_FromDelphiString(DelphiObject.Cells[col, row])
else
Result := nil;
end;
@@ -695,7 +663,6 @@ function TPyDelphiStringGrid.SetCell(args: PPyObject): PPyObject;
end;
-
initialization
RegisteredUnits.Add( TGridsRegistration.Create );
Classes.RegisterClasses([TDrawGrid, TStringGrid]);
diff --git a/PythonForDelphi/Components/Sources/Core/WrapDelphiStdCtrls.pas b/PythonForDelphi/Components/Sources/Core/WrapDelphiStdCtrls.pas
index 2872fb06..0fc7efaf 100644
--- a/PythonForDelphi/Components/Sources/Core/WrapDelphiStdCtrls.pas
+++ b/PythonForDelphi/Components/Sources/Core/WrapDelphiStdCtrls.pas
@@ -262,26 +262,22 @@ procedure TPyDelphiCustomEdit.SetDelphiObject(const Value: TCustomEdit);
function TPyDelphiCustomEdit.Get_SelStart(AContext: Pointer): PPyObject;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- Result := PyInt_FromLong(DelphiObject.SelStart);
- end;
+ Adjust(@Self);
+ Result := GetPythonEngine.PyInt_FromLong(DelphiObject.SelStart);
end;
function TPyDelphiCustomEdit.Set_SelStart(AValue: PPyObject; AContext: Pointer): integer;
var
_SelStart : Integer;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- if CheckIntAttribute(AValue, 'SelStart', _SelStart) then
- begin
- DelphiObject.SelStart := _SelStart;
- Result := 0;
- end
- else
- Result := -1;
- end;
+ Adjust(@Self);
+ if CheckIntAttribute(AValue, 'SelStart', _SelStart) then
+ begin
+ DelphiObject.SelStart := _SelStart;
+ Result := 0;
+ end
+ else
+ Result := -1;
end;
class procedure TPyDelphiCustomEdit.RegisterGetSets(PythonType: TPythonType);
@@ -403,24 +399,20 @@ function TPyDelphiListBox.Set_ItemIndex(AValue: PPyObject; AContext: Pointer): i
var
_index : Integer;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- if CheckIntAttribute(AValue, 'ItemIndex', _index) then
- begin
- DelphiObject.ItemIndex := _index;
- Result := 0;
- end
- else
- Result := -1;
- end;
+ Adjust(@Self);
+ if CheckIntAttribute(AValue, 'ItemIndex', _index) then
+ begin
+ DelphiObject.ItemIndex := _index;
+ Result := 0;
+ end
+ else
+ Result := -1;
end;
function TPyDelphiListBox.Get_ItemIndex(AContext: Pointer): PPyObject;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- Result := PyInt_FromLong(DelphiObject.ItemIndex);
- end;
+ Adjust(@Self);
+ Result := GetPythonEngine.PyInt_FromLong(DelphiObject.ItemIndex);
end;
class procedure TPyDelphiListBox.RegisterGetSets(PythonType: TPythonType);
diff --git a/PythonForDelphi/Components/Sources/Core/WrapDelphiTypes.pas b/PythonForDelphi/Components/Sources/Core/WrapDelphiTypes.pas
index 64a14f6c..0d3c4d3b 100644
--- a/PythonForDelphi/Components/Sources/Core/WrapDelphiTypes.pas
+++ b/PythonForDelphi/Components/Sources/Core/WrapDelphiTypes.pas
@@ -250,18 +250,14 @@ constructor TPyDelphiPoint.CreateWith(APythonType: TPythonType;
function TPyDelphiPoint.Get_X(Acontext: Pointer): PPyObject;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- Result := PyInt_FromLong(Value.X);
- end;
+ Adjust(@Self);
+ Result := GetPythonEngine.PyInt_FromLong(Value.X);
end;
function TPyDelphiPoint.Get_Y(Acontext: Pointer): PPyObject;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- Result := PyInt_FromLong(Value.Y);
- end;
+ Adjust(@Self);
+ Result := GetPythonEngine.PyInt_FromLong(Value.Y);
end;
class procedure TPyDelphiPoint.RegisterGetSets(PythonType: TPythonType);
@@ -278,8 +274,8 @@ class procedure TPyDelphiPoint.RegisterGetSets(PythonType: TPythonType);
function TPyDelphiPoint.Repr: PPyObject;
begin
- with GetPythonEngine do
- Result := PyString_FromString(PAnsiChar(AnsiString(Format('', [Value.X, Value.Y]))));
+ Result := GetPythonEngine.PyString_FromDelphiString(Format('',
+ [Value.X, Value.Y]));
end;
class procedure TPyDelphiPoint.SetupType(PythonType: TPythonType);
@@ -290,7 +286,7 @@ class procedure TPyDelphiPoint.SetupType(PythonType: TPythonType);
PythonType.TypeFlags := PythonType.TypeFlags + [tpfBaseType];
PythonType.GenerateCreateFunction := False;
PythonType.DocString.Text := 'wrapper for Delphi TPoint type';
- PythonType.Services.Basic := [bsGetAttrO, bsSetAttrO, bsRepr, bsStr, bsCompare];
+ PythonType.Services.Basic := [bsGetAttrO, bsSetAttrO, bsRepr, bsStr, bsRichCompare];
end;
function TPyDelphiPoint.Set_X(AValue: PPyObject;
@@ -353,50 +349,38 @@ constructor TPyDelphiRect.CreateWith(APythonType: TPythonType;
function TPyDelphiRect.Get_Bottom(Acontext: Pointer): PPyObject;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- Result := PyInt_FromLong(Value.Bottom);
- end;
+ Adjust(@Self);
+ Result := GetPythonEngine.PyInt_FromLong(Value.Bottom);
end;
function TPyDelphiRect.Get_BottomRight(Acontext: Pointer): PPyObject;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- Result := WrapPoint(PyDelphiWrapper, Value.BottomRight);
- end;
+ Adjust(@Self);
+ Result := WrapPoint(PyDelphiWrapper, Value.BottomRight);
end;
function TPyDelphiRect.Get_Left(Acontext: Pointer): PPyObject;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- Result := PyInt_FromLong(Value.Left);
- end;
+ Adjust(@Self);
+ Result := GetPythonEngine.PyInt_FromLong(Value.Left);
end;
function TPyDelphiRect.Get_Right(Acontext: Pointer): PPyObject;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- Result := PyInt_FromLong(Value.Right);
- end;
+ Adjust(@Self);
+ Result := GetPythonEngine.PyInt_FromLong(Value.Right);
end;
function TPyDelphiRect.Get_Top(Acontext: Pointer): PPyObject;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- Result := PyInt_FromLong(Value.Top);
- end;
+ Adjust(@Self);
+ Result := GetPythonEngine.PyInt_FromLong(Value.Top);
end;
function TPyDelphiRect.Get_TopLeft(Acontext: Pointer): PPyObject;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- Result := WrapPoint(PyDelphiWrapper, Value.TopLeft);
- end;
+ Adjust(@Self);
+ Result := WrapPoint(PyDelphiWrapper, Value.TopLeft);
end;
class procedure TPyDelphiRect.RegisterGetSets(PythonType: TPythonType);
@@ -421,8 +405,8 @@ class procedure TPyDelphiRect.RegisterGetSets(PythonType: TPythonType);
function TPyDelphiRect.Repr: PPyObject;
begin
- with GetPythonEngine do
- Result := PyString_FromString(PAnsiChar(AnsiString(Format('', [Value.Left, Value.Top, Value.Right, Value.Bottom]))));
+ Result := GetPythonEngine.PyString_FromDelphiString(Format('',
+ [Value.Left, Value.Top, Value.Right, Value.Bottom]));
end;
function TPyDelphiRect.Set_Bottom(AValue: PPyObject;
@@ -431,13 +415,13 @@ function TPyDelphiRect.Set_Bottom(AValue: PPyObject;
_value : Integer;
begin
if CheckIntAttribute(AValue, 'Bottom', _value) then
- with GetPythonEngine do begin
- Adjust(@Self);
- fValue.Bottom := _value;
- Result := 0;
- end
- else
- Result := -1;
+ begin
+ Adjust(@Self);
+ fValue.Bottom := _value;
+ Result := 0;
+ end
+ else
+ Result := -1;
end;
function TPyDelphiRect.Set_BottomRight(AValue: PPyObject;
@@ -446,13 +430,13 @@ function TPyDelphiRect.Set_BottomRight(AValue: PPyObject;
_value : TPoint;
begin
if CheckPointAttribute(AValue, 'BottomRight', _value) then
- with GetPythonEngine do begin
- Adjust(@Self);
- fValue.BottomRight := _value;
- Result := 0;
- end
- else
- Result := -1;
+ begin
+ Adjust(@Self);
+ fValue.BottomRight := _value;
+ Result := 0;
+ end
+ else
+ Result := -1;
end;
function TPyDelphiRect.Set_Left(AValue: PPyObject;
@@ -461,13 +445,13 @@ function TPyDelphiRect.Set_Left(AValue: PPyObject;
_value : Integer;
begin
if CheckIntAttribute(AValue, 'Left', _value) then
- with GetPythonEngine do begin
- Adjust(@Self);
- fValue.Left := _value;
- Result := 0;
- end
- else
- Result := -1;
+ begin
+ Adjust(@Self);
+ fValue.Left := _value;
+ Result := 0;
+ end
+ else
+ Result := -1;
end;
function TPyDelphiRect.Set_Right(AValue: PPyObject;
@@ -476,13 +460,13 @@ function TPyDelphiRect.Set_Right(AValue: PPyObject;
_value : Integer;
begin
if CheckIntAttribute(AValue, 'Right', _value) then
- with GetPythonEngine do begin
- Adjust(@Self);
- fValue.Right := _value;
- Result := 0;
- end
- else
- Result := -1;
+ begin
+ Adjust(@Self);
+ fValue.Right := _value;
+ Result := 0;
+ end
+ else
+ Result := -1;
end;
function TPyDelphiRect.Set_Top(AValue: PPyObject;
@@ -491,13 +475,13 @@ function TPyDelphiRect.Set_Top(AValue: PPyObject;
_value : Integer;
begin
if CheckIntAttribute(AValue, 'Top', _value) then
- with GetPythonEngine do begin
- Adjust(@Self);
- fValue.Top := _value;
- Result := 0;
- end
- else
- Result := -1;
+ begin
+ Adjust(@Self);
+ fValue.Top := _value;
+ Result := 0;
+ end
+ else
+ Result := -1;
end;
function TPyDelphiRect.Set_TopLeft(AValue: PPyObject;
@@ -506,13 +490,13 @@ function TPyDelphiRect.Set_TopLeft(AValue: PPyObject;
_value : TPoint;
begin
if CheckPointAttribute(AValue, 'TopLeft', _value) then
- with GetPythonEngine do begin
- Adjust(@Self);
- fValue.TopLeft := _value;
- Result := 0;
- end
- else
- Result := -1;
+ begin
+ Adjust(@Self);
+ fValue.TopLeft := _value;
+ Result := 0;
+ end
+ else
+ Result := -1;
end;
class procedure TPyDelphiRect.SetupType(PythonType: TPythonType);
@@ -523,7 +507,7 @@ class procedure TPyDelphiRect.SetupType(PythonType: TPythonType);
PythonType.TypeFlags := PythonType.TypeFlags + [tpfBaseType];
PythonType.GenerateCreateFunction := False;
PythonType.DocString.Text := 'wrapper for Delphi TRect type';
- PythonType.Services.Basic := [bsGetAttrO, bsSetAttrO, bsRepr, bsStr, bsCompare];
+ PythonType.Services.Basic := [bsGetAttrO, bsSetAttrO, bsRepr, bsStr, bsRichCompare];
end;
@@ -559,18 +543,14 @@ constructor TPyDelphiSize.CreateWith(APythonType: TPythonType;
function TPyDelphiSize.Get_CX(Acontext: Pointer): PPyObject;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- Result := PyInt_FromLong(Value.cx);
- end;
+ Adjust(@Self);
+ Result := GetPythonEngine.PyInt_FromLong(Value.cx);
end;
function TPyDelphiSize.Get_CY(Acontext: Pointer): PPyObject;
begin
- with GetPythonEngine do begin
- Adjust(@Self);
- Result := PyInt_FromLong(Value.cy);
- end;
+ Adjust(@Self);
+ Result := GetPythonEngine.PyInt_FromLong(Value.cy);
end;
class procedure TPyDelphiSize.RegisterGetSets(PythonType: TPythonType);
@@ -587,8 +567,8 @@ class procedure TPyDelphiSize.RegisterGetSets(PythonType: TPythonType);
function TPyDelphiSize.Repr: PPyObject;
begin
- with GetPythonEngine do
- Result := PyString_FromString(PAnsiChar(AnsiString(Format('', [Value.cx, Value.cy]))));
+ Result := GetPythonEngine.PyString_FromDelphiString(Format('',
+ [Value.cx, Value.cy]));
end;
class procedure TPyDelphiSize.SetupType(PythonType: TPythonType);
@@ -599,7 +579,7 @@ class procedure TPyDelphiSize.SetupType(PythonType: TPythonType);
PythonType.TypeFlags := PythonType.TypeFlags + [tpfBaseType];
PythonType.GenerateCreateFunction := False;
PythonType.DocString.Text := 'wrapper for Delphi TSize type';
- PythonType.Services.Basic := [bsGetAttrO, bsSetAttrO, bsRepr, bsStr, bsCompare];
+ PythonType.Services.Basic := [bsGetAttrO, bsSetAttrO, bsRepr, bsStr, bsRichCompare];
end;
function TPyDelphiSize.Set_CX(AValue: PPyObject;
@@ -608,13 +588,13 @@ function TPyDelphiSize.Set_CX(AValue: PPyObject;
cx : Integer;
begin
if CheckIntAttribute(AValue, 'cx', cx) then
- with GetPythonEngine do begin
- Adjust(@Self);
- fValue.cx := cx;
- Result := 0;
- end
- else
- Result := -1;
+ begin
+ Adjust(@Self);
+ fValue.cx := cx;
+ Result := 0;
+ end
+ else
+ Result := -1;
end;
function TPyDelphiSize.Set_CY(AValue: PPyObject;
@@ -623,13 +603,13 @@ function TPyDelphiSize.Set_CY(AValue: PPyObject;
cy : Integer;
begin
if CheckIntAttribute(AValue, 'cy', cy) then
- with GetPythonEngine do begin
- Adjust(@Self);
- fValue.cy := cy;
- Result := 0;
- end
- else
- Result := -1;
+ begin
+ Adjust(@Self);
+ fValue.cy := cy;
+ Result := 0;
+ end
+ else
+ Result := -1;
end;
initialization
diff --git a/PythonForDelphi/Components/Sources/Core/WrapFireDAC.pas b/PythonForDelphi/Components/Sources/Core/WrapFireDAC.pas
new file mode 100644
index 00000000..7725d428
--- /dev/null
+++ b/PythonForDelphi/Components/Sources/Core/WrapFireDAC.pas
@@ -0,0 +1,2254 @@
+{$REGION 'Licence'}
+{
+ Wrapper classes for FireDec TFDTable and TFDQuery
+ Original Code by https://github.com/hartmutdavid
+==============================================================================}
+{$ENDREGION}
+unit WrapFireDAC;
+
+interface
+
+uses
+ Classes, SysUtils, Variants, PythonEngine, WrapDelphi, WrapDelphiClasses,
+ Windows, System.AnsiStrings, System.Rtti, DB,
+ FireDAC.Stan.Intf, FireDAC.Stan.Option, FireDAC.Stan.Error, FireDAC.UI.Intf,
+ FireDAC.Phys.Intf, FireDAC.Stan.Def, FireDAC.Stan.Pool, FireDAC.Stan.Async,
+ FireDAC.Phys, FireDAC.FMXUI.Wait, FireDAC.Stan.Param, FireDAC.DatS,
+ FireDAC.DApt.Intf, FireDAC.DApt, FireDAC.Comp.Client, FireDAC.Comp.DataSet,
+ FireDAC.Comp.UI, FireDAC.Stan.ExprFuncs;
+
+type
+
+{
+ Published properties and events are supported automaitcally
+ by the WrapDelphi infrastructure. There is no need
+ to exposed them here.
+}
+
+TPyDBCommon = class(TPyDelphiComponent)
+ function GetProperties : PPyObject;
+ procedure AppendProperties( List : PPyObject ); virtual;
+ procedure AppendProp( List : PPyObject; const prop : String );
+ function GetAttrO(key: PPyObject) : PPyObject; override;
+ procedure RaiseDBError( E : Exception );
+end;
+
+TPyDBField = class(TPyDBCommon)
+private
+ function GetDelphiObject: TField;
+ procedure SetDelphiObject(const Value: TField);
+public
+ function GetAttrO(key: PPyObject) : PPyObject; override;
+ function SetAttrO(key, value: PPyObject) : Integer; override;
+
+ class function DelphiObjectClass : TClass; override;
+ class procedure RegisterMethods( PythonType : TPythonType ); override;
+
+ function CheckField : Boolean;
+ procedure AppendProperties( List : PPyObject ); override;
+
+ // Do-Methods
+ function Do_Clear( args : PPyObject ) : PPyObject; cdecl;
+ function Do_FocusControl( args : PPyObject ) : PPyObject; cdecl;
+ function Do_IsValidChar( args : PPyObject ) : PPyObject; cdecl;
+ function Do_RefreshLookupList( args : PPyObject ) : PPyObject; cdecl;
+
+ property DelphiObject: TField read GetDelphiObject write SetDelphiObject;
+end;
+
+TDSRowsAccess = class(TContainerAccess)
+private
+ function GetContainer: TFDDataset;
+public
+ function GetItem(AIndex : Integer) : PPyObject; override;
+ function GetSize : Integer; override;
+
+ class function ExpectedContainerClass : TClass; override;
+ class function Name : String; override;
+end;
+
+TPyDBDataset = class (TPyDelphiComponent)
+private
+ function GetDelphiObject: TFDDataset;
+ procedure SetDelphiObject(const Value: TFDDataset);
+protected
+ procedure RaiseDBError( E : Exception );
+public
+ // Class methodes
+ class function DelphiObjectClass : TClass; override;
+ class function GetContainerAccessClass : TContainerAccessClass; override;
+ class procedure RegisterGetSets( PythonType : TPythonType ); override;
+ class procedure RegisterMethods( PythonType : TPythonType ); override;
+ class procedure SetupType( PythonType : TPythonType ); override;
+ //
+ // Property Getters
+ function Get_RowsCount( AContext : Pointer) : PPyObject; cdecl;
+ function Get_Rows( AContext : Pointer) : PPyObject; cdecl;
+ //
+ // Attributes
+ function GetAttrO(key: PPyObject) : PPyObject; override;
+ function SetAttrO(key, value: PPyObject) : Integer; override;
+ //
+ // Methods
+ function Do_Fields( args : PPyObject ): PPyObject; cdecl;
+ function Do_FieldByName( args : PPyObject ): PPyObject; cdecl;
+ function Do_FieldNamesAsTuple( args: PPyObject): PPyObject; cdecl;
+ function Do_FieldsAsTuple( args: PPyObject): PPyObject; cdecl;
+ function Do_FieldsAsDict( args: PPyObject): PPyObject; cdecl;
+ function Do_First( args : PPyObject ) : PPyObject; cdecl;
+ function Do_Last( args : PPyObject ) : PPyObject; cdecl;
+ function Do_Next( args : PPyObject ) : PPyObject; cdecl;
+ function Do_Prior( args : PPyObject ) : PPyObject; cdecl;
+ function Do_Locate( args : PPyObject ) : PPyObject; cdecl;
+ function Do_Lookup( args : PPyObject ) : PPyObject; cdecl;
+ function Do_Refresh( args : PPyObject ) : PPyObject; cdecl;
+ function Do_FindKey( args : PPyObject ) : PPyObject; cdecl;
+ function Do_FindNearest( args : PPyObject ) : PPyObject; cdecl;
+ //
+ property DelphiObject: TFDDataset read GetDelphiObject write SetDelphiObject;
+end;
+
+TPyDBTable = class (TPyDBDataset)
+private
+ function CheckActiveDBTable(aMustOpen: Boolean): Boolean;
+public
+ destructor Destroy; override;
+
+ function GetDelphiObject: TFDTable;
+ procedure SetDelphiObject(const Value: TFDTable);
+ //
+ class function DelphiObjectClass : TClass; override;
+ class procedure RegisterMethods( PythonType : TPythonType ); override;
+ // Attributes
+ function GetAttrO(key: PPyObject) : PPyObject; override;
+ function SetAttrO(key, value: PPyObject) : Integer; override;
+ // Methods
+ function Do_Open( args : PPyObject ) : PPyObject; cdecl;
+ function Do_Close( args : PPyObject ) : PPyObject; cdecl;
+ function Do_Edit( args : PPyObject ) : PPyObject; cdecl;
+ function Do_Insert( args : PPyObject ) : PPyObject; cdecl;
+ function Do_Append( args : PPyObject ) : PPyObject; cdecl;
+ function Do_Post( args : PPyObject ) : PPyObject; cdecl;
+ function Do_Cancel( args : PPyObject ) : PPyObject; cdecl;
+ function Do_Delete( args : PPyObject ) : PPyObject; cdecl;
+ function Do_SetRangeStart( args : PPyObject ) : PPyObject; cdecl;
+ function Do_EditRangeStart( args : PPyObject ) : PPyObject; cdecl;
+ function Do_SetRangeEnd( args : PPyObject ) : PPyObject; cdecl;
+ function Do_EditRangeEnd( args : PPyObject ) : PPyObject; cdecl;
+ function Do_ApplyRange( args : PPyObject ) : PPyObject; cdecl;
+ function Do_SetRange( args : PPyObject ) : PPyObject; cdecl;
+ function Do_CancelRange( args : PPyObject ) : PPyObject; cdecl;
+ function Do_GetIndexNames( args : PPyObject ) : PPyObject; cdecl;
+
+ property DelphiObject: TFDTable read GetDelphiObject write SetDelphiObject;
+end;
+
+TPyDBQuery = class (TPyDBDataset)
+private
+ function CheckActiveDBQuery(aMustOpen: Boolean): Boolean;
+protected
+public
+ destructor Destroy; override;
+
+ function GetDelphiObject: TFDQuery;
+ procedure SetDelphiObject(const Value: TFDQuery);
+ //
+ class function DelphiObjectClass : TClass; override;
+ class procedure RegisterMethods( PythonType : TPythonType ); override;
+ // Attributes
+ function GetAttrO(key: PPyObject) : PPyObject; override;
+ function SetAttrO(key, value: PPyObject) : Integer; override;
+ // Methods
+ function Do_Open( args : PPyObject ) : PPyObject; cdecl;
+ function Do_Close( args : PPyObject ) : PPyObject; cdecl;
+ function Do_Prepare( args : PPyObject ) : PPyObject; cdecl;
+ function Do_Unprepare( args : PPyObject ) : PPyObject; cdecl;
+ function Do_ExecSQL( args : PPyObject ) : PPyObject; cdecl;
+ //
+ property DelphiObject: TFDQuery read GetDelphiObject write SetDelphiObject;
+end;
+
+TPyFireDACRegistration = class(TRegisteredUnit)
+public
+ function Name(): String; override;
+ procedure RegisterWrappers(aPyDelphiWrapper: TPyDelphiWrapper); override;
+ procedure DefineVars(APyDelphiWrapper : TPyDelphiWrapper); override;
+end;
+
+function SqlTimeToVarDate(V : Variant) : Variant;
+
+implementation
+
+Uses
+ Data.SqlTimSt;
+// ----------------------- TPyDBCommon -----------------------------------------
+
+function TPyDBCommon.GetProperties : PPyObject;
+begin
+ with GetPythonEngine do begin
+ Result := PyList_New(0);
+ AppendProperties( Result );
+ PyList_Sort(Result);
+ end;
+end;
+
+procedure TPyDBCommon.AppendProperties( List : PPyObject );
+begin
+ // Override this method in the subclasses and add your
+ // properties to the list
+end;
+
+procedure TPyDBCommon.AppendProp( List : PPyObject; const prop : String );
+var
+ obj : PPyObject;
+begin
+ with GetPythonEngine do begin
+ obj := PyUnicode_FromWideString(prop);
+ PyList_Append( List, obj );
+ Py_XDecRef(obj);
+ end;
+end;
+
+function TPyDBCommon.GetAttrO(key: PPyObject) : PPyObject;
+Var
+ SKey : string;
+begin
+ try
+ SKey := LowerCase(GetPythonEngine.PyString_AsDelphiString(Key));
+ if (SKey = '__properties__' ) or
+ (SKey = '__members__' ) then
+ Result := GetProperties
+ else
+ Result := inherited GetAttrO(key);
+ except // Remap Delphi exception to a Python exception
+ on E : Exception do begin
+ RaiseDBError( E );
+ Result := nil;
+ end;
+ end;
+end;
+
+procedure TPyDBCommon.RaiseDBError( E : Exception );
+begin
+ if GetModule <> nil then
+ GetModule.RaiseError( AnsiString('DBError'), AnsiString(E.Message) );
+end;
+
+// ----------------------- TPyDBField ------------------------------------------
+
+class function TPyDBField.DelphiObjectClass: TClass;
+begin
+ Result := TField;
+end;
+
+
+// Then we override the needed services
+
+function TPyDBField.GetAttrO(key: PPyObject) : PPyObject;
+{ TODO : Remove published properties }
+var
+ l_sUpperKey: String;
+begin
+ with GetPythonEngine do begin
+ if not CheckField then begin
+ Result := nil;
+ Exit;
+ end;
+ try
+ l_sUpperKey := UpperCase(PyString_AsDelphiString(Key));
+ if l_sUpperKey = 'ALIGNMENT' then
+ Result := VariantAsPyObject( Integer(DelphiObject.Alignment) )
+ else if l_sUpperKey = 'ASBOOLEAN' then
+ Result := VariantAsPyObject( DelphiObject.AsBoolean )
+ else if l_sUpperKey = 'ASDATETIME' then
+ Result := VariantAsPyObject( DelphiObject.AsDateTime )
+ else if l_sUpperKey = 'ASFLOAT' then
+ Result := VariantAsPyObject( DelphiObject.AsFloat )
+ else if l_sUpperKey = 'ASINTEGER' then
+ Result := VariantAsPyObject( DelphiObject.AsInteger )
+ else if l_sUpperKey = 'ASSTRING' then
+ Result := VariantAsPyObject( DelphiObject.AsString )
+ else if l_sUpperKey = 'CANMODIFY' then
+ Result := VariantAsPyObject( DelphiObject.CanModify )
+ else if l_sUpperKey = 'ConstraintErrorMessage' then
+ Result := VariantAsPyObject( DelphiObject.ConstraintErrorMessage )
+ else if l_sUpperKey = 'CurValue' then
+ Result := VariantAsPyObject( DelphiObject.CurValue )
+ else if l_sUpperKey = 'CustomConstraint' then
+ Result := VariantAsPyObject( DelphiObject.CustomConstraint )
+ else if l_sUpperKey = 'DATASIZE' then
+ Result := VariantAsPyObject( DelphiObject.DataSize )
+ else if l_sUpperKey = 'DATATYPE' then
+ Result := VariantAsPyObject( DelphiObject.DataType )
+ else if l_sUpperKey = 'DefaultExpression' then
+ Result := VariantAsPyObject( DelphiObject.DefaultExpression )
+ else if l_sUpperKey = 'DISPLAYLABEL' then
+ Result := VariantAsPyObject( DelphiObject.DisplayLabel )
+ else if l_sUpperKey = 'DISPLAYNAME' then
+ Result := VariantAsPyObject( DelphiObject.DisplayName )
+ else if l_sUpperKey = 'DISPLAYTEXT' then
+ Result := VariantAsPyObject( DelphiObject.DisplayText )
+ else if l_sUpperKey = 'DISPLAYWIDTH' then
+ Result := VariantAsPyObject( DelphiObject.DisplayWidth )
+ else if l_sUpperKey = 'EDITMASK' then
+ Result := VariantAsPyObject( DelphiObject.EditMask )
+ else if l_sUpperKey = 'FIELDKIND' then
+ Result := VariantAsPyObject( DelphiObject.FieldKind )
+ else if l_sUpperKey = 'FIELDNAME' then
+ Result := VariantAsPyObject( DelphiObject.FieldName)
+ else if l_sUpperKey = 'FIELDNO' then
+ Result := VariantAsPyObject( DelphiObject.FieldNo )
+ else if l_sUpperKey = 'HASCONSTRAINTS' then
+ Result := VariantAsPyObject( DelphiObject.HasConstraints )
+ else if l_sUpperKey = 'IMPORTEDCONSTRAINT' then
+ Result := VariantAsPyObject( DelphiObject.ImportedConstraint )
+ else if l_sUpperKey = 'INDEX' then
+ Result := VariantAsPyObject( DelphiObject.Index )
+ else if l_sUpperKey = 'ISBLOB' then
+ Result := VariantAsPyObject( DelphiObject.IsBlob)
+ else if l_sUpperKey = 'ISINDEXFIELD' then
+ Result := VariantAsPyObject( DelphiObject.IsIndexField )
+ else if l_sUpperKey = 'ISNULL' then
+ Result := VariantAsPyObject( DelphiObject.IsNull )
+ else if l_sUpperKey = 'KEYFFIELDS' then
+ Result := VariantAsPyObject( DelphiObject.KeyFields )
+ else if l_sUpperKey = 'LOOKUP' then
+ Result := VariantAsPyObject( DelphiObject.Lookup )
+ else if l_sUpperKey = 'LOOKUPCACHE' then
+ Result := VariantAsPyObject( DelphiObject.LookupCache )
+ else if l_sUpperKey = 'LOOKUPKeyFields' then
+ Result := VariantAsPyObject( DelphiObject.LookupKeyFields )
+ else if l_sUpperKey = 'LOOKUPLIST' then
+ Result := ReturnNone
+ else if l_sUpperKey = 'LOOKUPRESULTFIELD' then
+ Result := VariantAsPyObject( DelphiObject.LookupResultField )
+ else if l_sUpperKey = 'NEWVALUE' then
+ Result := VariantAsPyObject( DelphiObject.NewValue )
+ else if l_sUpperKey = 'OFFSET' then
+ Result := VariantAsPyObject( DelphiObject.Offset )
+ else if l_sUpperKey = 'OLDVALUE' then
+ Result := VariantAsPyObject( DelphiObject.OldValue )
+ else if l_sUpperKey = 'ORIGIN' then
+ Result := VariantAsPyObject( DelphiObject.Origin )
+ else if l_sUpperKey = 'READONLY' then
+ Result := VariantAsPyObject( DelphiObject.ReadOnly )
+ else if l_sUpperKey = 'REQUIRED' then
+ Result := VariantAsPyObject( DelphiObject.Required )
+ else if l_sUpperKey = 'SIZE' then
+ Result := VariantAsPyObject( DelphiObject.Size )
+ else if l_sUpperKey = 'TEXT' then
+ Result := VariantAsPyObject( DelphiObject.Text )
+ else if l_sUpperKey = 'VALIDCHARS' then
+ Result := ReturnNone
+ else if l_sUpperKey = 'VALUE' then begin
+ Result := VariantAsPyObject( SqlTimeToVarDate(DelphiObject.Value) );
+ end
+ else if l_sUpperKey = 'VISIBLE' then
+ Result := VariantAsPyObject( DelphiObject.Visible )
+ else
+ Result := inherited GetAttrO(key);
+ except
+ on E : Exception do begin
+ RaiseDBError( E );
+ Result := nil;
+ end;
+ end;
+ end;
+end;
+
+function TPyDBField.GetDelphiObject: TField;
+begin
+ Result := TField(inherited DelphiObject);
+end;
+
+function TPyDBField.SetAttrO(key, value: PPyObject) : Integer;
+{ TODO : Remove published properties }
+var
+ l_sUpperKey: String;
+begin
+ Result := -1;
+ with GetPythonEngine do begin
+ if not CheckField then
+ Exit;
+ try
+ l_sUpperKey := UpperCase(PyString_AsDelphiString(Key));
+ if l_sUpperKey = 'ALIGNMENT' then begin
+ DelphiObject.Alignment := TAlignment(PyObjectAsVariant( value ));
+ Result := 0;
+ end
+ else if l_sUpperKey = 'ASBOOLEAN' then begin
+ DelphiObject.AsBoolean := PyObjectAsVariant( value );
+ Result := 0;
+ end
+ else if l_sUpperKey = 'ASDATETIME' then begin
+ DelphiObject.AsDateTime := PyObjectAsVariant( value );
+ Result := 0;
+ end
+ else if l_sUpperKey = 'ASFLOAT' then begin
+ DelphiObject.AsFloat := PyObjectAsVariant( value );
+ Result := 0;
+ end
+ else if l_sUpperKey = 'ASINTEGER' then begin
+ DelphiObject.AsInteger := PyObjectAsVariant( value );
+ Result := 0;
+ end
+ else if l_sUpperKey = 'ASSTRING' then begin
+ DelphiObject.AsString := PyObjectAsVariant( value );
+ Result := 0;
+ end
+ else if l_sUpperKey = 'CANMODIFY' then begin
+ Result := 0;
+ end
+ else if l_sUpperKey = 'CONSTRAINTERRORMESSAGE' then begin
+ DelphiObject.ConstraintErrorMessage := PyObjectAsVariant( value );
+ Result := 0;
+ end
+ else if l_sUpperKey = 'CURVALUE' then begin
+ Result := 0;
+ end
+ else if l_sUpperKey = 'CUSTOMCONSTRAINT' then begin
+ DelphiObject.CustomConstraint := PyObjectAsVariant( value );
+ Result := 0;
+ end
+ else if l_sUpperKey = 'DATASIZE' then begin
+ Result := 0;
+ end
+ else if l_sUpperKey = 'DATATYPE' then begin
+ Result := 0;
+ end
+ else if l_sUpperKey = 'DEFAULTEXPRESSION' then begin
+ DelphiObject.DefaultExpression := PyObjectAsVariant( value );
+ Result := 0;
+ end
+ else if l_sUpperKey = 'DISPLAYLABEL' then begin
+ DelphiObject.DisplayLabel := PyObjectAsVariant( value );
+ Result := 0;
+ end
+ else if l_sUpperKey = 'DISPLAYNAME' then begin
+ Result := 0;
+ end
+ else if l_sUpperKey = 'DISPLAYTEXT' then begin
+ Result := 0;
+ end
+ else if l_sUpperKey = 'DISPLAYWIDTH' then begin
+ DelphiObject.DisplayWidth := PyObjectAsVariant( value );
+ Result := 0;
+ end
+ else if l_sUpperKey = 'EDITMASK' then begin
+ DelphiObject.EditMask := PyObjectAsVariant( value );
+ Result := 0;
+ end
+ else if l_sUpperKey = 'FIELDKIND' then begin
+ DelphiObject.FieldKind := PyObjectAsVariant( value );
+ Result := 0;
+ end
+ else if l_sUpperKey = 'FIELDNAME' then begin
+ DelphiObject.FieldName:= PyObjectAsVariant( value );
+ Result := 0;
+ end
+ else if l_sUpperKey = 'FIELDNO' then begin
+ Result := 0;
+ end
+ else if l_sUpperKey = 'HASCONSTRAINTS' then begin
+ Result := 0;
+ end
+ else if l_sUpperKey = 'IMPORTEDCONSTRAINT' then begin
+ DelphiObject.ImportedConstraint := PyObjectAsVariant( value );
+ Result := 0;
+ end
+ else if l_sUpperKey = 'INDEX' then begin
+ DelphiObject.Index := PyObjectAsVariant( value );
+ Result := 0;
+ end
+ else if l_sUpperKey = 'ISBLOB' then begin
+ Result := 0;
+ end
+ else if l_sUpperKey = 'ISINDEXFIELD' then begin
+ Result := 0;
+ end
+ else if l_sUpperKey = 'ISNULL' then begin
+ Result := 0;
+ end
+ else if l_sUpperKey = 'KEYFIELDS' then begin
+ DelphiObject.KeyFields := PyObjectAsVariant( value );
+ Result := 0;
+ end
+ else if l_sUpperKey = 'LOOKUP' then begin
+ DelphiObject.Lookup := PyObjectAsVariant( value );
+ Result := 0;
+ end
+ else if l_sUpperKey = 'LOOKUPCACHE' then begin
+ DelphiObject.LookupCache := PyObjectAsVariant( value );
+ Result := 0;
+ end
+ else if l_sUpperKey = 'LOOKUPKEYFIELDS' then begin
+ DelphiObject.LookupKeyFields := PyObjectAsVariant( value );
+ Result := 0;
+ end
+ else if l_sUpperKey = 'LOOKUPLIST' then begin
+ Result := 0;
+ end
+ else if l_sUpperKey = 'LOOKUPRESULTFIELD' then begin
+ DelphiObject.LookupResultField := PyObjectAsVariant( value );
+ Result := 0;
+ end
+ else if l_sUpperKey = 'NEWVALUE' then begin
+ DelphiObject.NewValue := PyObjectAsVariant( value );
+ Result := 0;
+ end
+ else if l_sUpperKey = 'OFFSET' then begin
+ Result := 0;
+ end
+ else if l_sUpperKey = 'OLDVALUE' then begin
+ Result := 0;
+ end
+ else if l_sUpperKey = 'ORIGIN' then begin
+ DelphiObject.Origin := PyObjectAsVariant( value );
+ Result := 0;
+ end
+ else if l_sUpperKey = 'READONLY' then begin
+ DelphiObject.ReadOnly := PyObjectAsVariant( value );
+ Result := 0;
+ end
+ else if l_sUpperKey = 'REQUIRED' then begin
+ DelphiObject.Required := PyObjectAsVariant( value );
+ Result := 0;
+ end
+ else if l_sUpperKey = 'SIZE' then begin
+ DelphiObject.Size := PyObjectAsVariant( value );
+ Result := 0;
+ end
+ else if l_sUpperKey = 'TEXT' then begin
+ DelphiObject.Text := PyObjectAsVariant( value );
+ Result := 0;
+ end
+ else if l_sUpperKey = 'VALIDCHARS' then begin
+ Result := 0;
+ end
+ else if l_sUpperKey = 'VALUE' then begin
+ DelphiObject.Value := PyObjectAsVariant( value );
+ Result := 0;
+ end
+ else if l_sUpperKey = 'VISIBLE' then begin
+ DelphiObject.Visible := PyObjectAsVariant( value );
+ Result := 0;
+ end
+ else
+ Result := inherited SetAttrO(key, value);
+ except
+ on E : Exception do begin
+ RaiseDBError( E );
+ Result := -1;
+ end;
+ end;
+ end;
+end;
+
+procedure TPyDBField.SetDelphiObject(const Value: TField);
+begin
+ inherited DelphiObject := Value;
+end;
+
+class procedure TPyDBField.RegisterMethods( PythonType : TPythonType );
+begin
+ inherited;
+ with PythonType do begin
+ AddMethod(AnsiString('Clear'), @TPyDBField.Do_Clear,
+ AnsiString('DBField.Clear() -> None') );
+ AddMethod(AnsiString('FocusControl'), @TPyDBField.Do_FocusControl,
+ AnsiString('DBField.FocusControl() -> None') );
+ AddMethod(AnsiString('IsValidChar'), @TPyDBField.Do_IsValidChar,
+ AnsiString('DBField.IsValidChar( InputChar : String ) -> True or False') );
+ AddMethod(AnsiString('RefreshLookupList'), @TPyDBField.Do_RefreshLookupList,
+ AnsiString('DBField.RefreshLookupList() -> None') );
+ end;
+end;
+
+function TPyDBField.CheckField : Boolean;
+begin
+ if not Assigned(DelphiObject) then begin
+ Result := False;
+ with GetPythonEngine do
+ PyErr_SetString (PyExc_RuntimeError^, PAnsiChar('No field defined !') );
+ end
+ else
+ Result := True;
+ Result := Result;
+end;
+
+procedure TPyDBField.AppendProperties( List : PPyObject );
+begin
+ inherited;
+ AppendProp( List, 'Alignment');
+ AppendProp( List, 'AsBoolean');
+ AppendProp( List, 'AsDateTime');
+ AppendProp( List, 'AsFloat');
+ AppendProp( List, 'AsInteger');
+ AppendProp( List, 'AsString');
+ AppendProp( List, 'CanModify');
+ AppendProp( List, 'ConstraintErrorMessage');
+ AppendProp( List, 'CurValue');
+ AppendProp( List, 'CustomConstraint');
+ AppendProp( List, 'DataSize');
+ AppendProp( List, 'DataType');
+ AppendProp( List, 'DefaultExpression');
+ AppendProp( List, 'DisplayLabel');
+ AppendProp( List, 'DisplayName');
+ AppendProp( List, 'DisplayText');
+ AppendProp( List, 'DisplayWidth');
+ AppendProp( List, 'EditMask');
+ AppendProp( List, 'FieldKind');
+ AppendProp( List, 'FieldName');
+ AppendProp( List, 'FieldNo');
+ AppendProp( List, 'HasConstraints');
+ AppendProp( List, 'ImportedConstraint');
+ AppendProp( List, 'Index');
+ AppendProp( List, 'IsBlob');
+ AppendProp( List, 'IsIndexField');
+ AppendProp( List, 'IsNull');
+ AppendProp( List, 'KeyFields');
+ AppendProp( List, 'Lookup');
+ AppendProp( List, 'LookupCache');
+ AppendProp( List, 'LookupDataset');
+ AppendProp( List, 'LookupKeyFields');
+ AppendProp( List, 'LookupList');
+ AppendProp( List, 'LookupResultField');
+ AppendProp( List, 'NewValue');
+ AppendProp( List, 'Offset');
+ AppendProp( List, 'OldValue');
+ AppendProp( List, 'Origin');
+ AppendProp( List, 'ReadOnly');
+ AppendProp( List, 'Required');
+ AppendProp( List, 'Size');
+ AppendProp( List, 'Text');
+ AppendProp( List, 'ValidChars');
+ AppendProp( List, 'Value');
+ AppendProp( List, 'Visible');
+end;
+
+function TPyDBField.Do_Clear( args : PPyObject ) : PPyObject;
+begin
+ Adjust(@Self); // <- adjust the transmitted self argument
+ with GetPythonEngine do begin
+ try
+ if CheckField then begin
+ DelphiObject.Clear;
+ Result := ReturnNone;
+ end
+ else
+ Result := nil;
+ except
+ on E : Exception do begin
+ RaiseDBError( E );
+ Result := nil;
+ end;
+ end;
+ end;
+end;
+
+function TPyDBField.Do_FocusControl( args : PPyObject ) : PPyObject;
+begin
+ Adjust(@Self); // <- adjust the transmitted self argument
+ with GetPythonEngine do begin
+ try
+ if CheckField then begin
+ DelphiObject.FocusControl;
+ Result := ReturnNone;
+ end
+ else
+ Result := nil;
+ except
+ on E : Exception do begin
+ RaiseDBError( E );
+ Result := nil;
+ end;
+ end;
+ end;
+end;
+
+function TPyDBField.Do_IsValidChar( args : PPyObject ) : PPyObject;
+var
+ c : Char;
+ s : PAnsiChar;
+ str : AnsiString;
+begin
+ Adjust(@Self); // <- adjust the transmitted self argument
+ with GetPythonEngine do begin
+ try
+ if CheckField then begin
+ if PyArg_ParseTuple( args, 's:TField.IsValidChar',@s ) <> 0 then begin
+ str := s;
+ if Length(str) > 0 then
+ c := Char(str[1])
+ else
+ c := #0;
+ Result := VariantAsPyObject( DelphiObject.IsValidChar( c ) )
+ end
+ else
+ Result := nil;
+ end
+ else
+ Result := nil;
+ except
+ on E : Exception do begin
+ RaiseDBError( E );
+ Result := nil;
+ end;
+ end;
+ end;
+end;
+
+function TPyDBField.Do_RefreshLookupList( args : PPyObject ) : PPyObject;
+begin
+ Adjust(@Self); // <- adjust the transmitted self argument
+ with GetPythonEngine do begin
+ try
+ if CheckField then begin
+ DelphiObject.RefreshLookupList;
+ Result := ReturnNone;
+ end
+ else
+ Result := nil;
+ except
+ on E : Exception do begin
+ RaiseDBError( E );
+ Result := nil;
+ end;
+ end;
+ end;
+end;
+
+// ----------------------- TDSRowsAccess ---------------------------------------
+
+class function TDSRowsAccess.ExpectedContainerClass: TClass;
+begin
+ Result := TFDDataset;
+end;
+
+function TDSRowsAccess.GetContainer: TFDDataset;
+begin
+ Result := TFDDataset(inherited Container);
+end;
+
+function TDSRowsAccess.GetItem(aIndex: Integer): PPyObject;
+var
+ i : Integer;
+ l_oDataset: TFDDataset;
+begin
+ Result := nil;
+ l_oDataset := GetContainer;
+ if (aIndex >= 0) and (aIndex < l_oDataset.RecordCount) then begin
+ with GetPythonEngine do begin
+ try
+ l_oDataset.RecNo := AIndex + 1;
+ Result := PyTuple_New(l_oDataset.FieldCount);
+ for i := 0 to l_oDataset.FieldCount - 1 do begin
+ with l_oDataset.Fields[i] do begin
+ PyTuple_SetItem( Result, i, VariantAsPyObject( SqlTimeToVarDate(Value) ) );
+ end;
+ end;
+ except
+ on E : Exception do begin
+ raise Exception.CreateFmt('Exception in TDSRowsAccess.GetItem - Index=%d', [AIndex]);
+ end;
+ end;
+ end;
+ end;
+end;
+
+function TDSRowsAccess.GetSize: Integer;
+var
+ l_oDataset: TFDDataset;
+begin
+ l_oDataset := GetContainer;
+ Result := l_oDataset.RecordCount;
+end;
+
+
+class function TDSRowsAccess.Name: String;
+begin
+ Result := 'DSRows';
+end;
+
+
+// ----------------------- TPyDBDataset ------------------------------------
+
+function TPyDBDataset.GetDelphiObject: TFDDataset;
+begin
+ Result := TFDDataset(inherited DelphiObject);
+end;
+
+procedure TPyDBDataset.SetDelphiObject(const Value: TFDDataset);
+begin
+ inherited DelphiObject := Value;
+end;
+
+
+class procedure TPyDBDataset.SetupType(PythonType: TPythonType);
+begin
+ inherited;
+ PythonType.GenerateCreateFunction := True;
+ PythonType.Prefix := 'T';
+end;
+
+class function TPyDBDataset.DelphiObjectClass : TClass;
+begin
+ Result := TFDDataset;
+end;
+
+class function TPyDBDataset.GetContainerAccessClass : TContainerAccessClass;
+begin
+ Result := TDSRowsAccess;
+end;
+
+function TPyDBDataset.Get_RowsCount(AContext: Pointer): PPyObject;
+begin
+ Adjust(@Self);
+ Result := GetPythonEngine.PyInt_FromLong(DelphiObject.RecordCount);
+end;
+
+function TPyDBDataset.Get_Rows(AContext: Pointer): PPyObject;
+begin
+ Adjust(@Self);
+ Result := Self.PyDelphiWrapper.DefaultContainerType.CreateInstance;
+ with PythonToDelphi(Result) as TPyDelphiContainer do
+ Setup(Self.PyDelphiWrapper, TDSRowsAccess.Create(Self.PyDelphiWrapper, Self.DelphiObject));
+end;
+
+class procedure TPyDBDataset.RegisterGetSets( PythonType : TPythonType );
+begin
+ inherited;
+ PythonType.AddGetSet(PAnsiChar('RowsCount'), @TPyDBDataset.Get_RowsCount, nil,
+ PAnsiChar('Returns the count of contained dataset rows'), nil);
+ PythonType.AddGetSet(PAnsiChar('Rows'), @TPyDBDataset.Get_Rows, nil,
+ PAnsiChar('Returns an iterator over contained dataset rows'), nil);
+end;
+
+class procedure TPyDBDataset.RegisterMethods( PythonType : TPythonType );
+begin
+ inherited;
+ with PythonType do begin
+ AddMethod(AnsiString('Fields'), @TPyDBDataset.Do_Fields,
+ AnsiString('DBDataset.Fields( index : Integer ) -> TField') );
+ AddMethod(AnsiString('FieldByName'), @TPyDBDataset.Do_FieldByName,
+ AnsiString('DBDataset.FieldByName(FieldName: String) -> DBField') );
+ AddMethod(AnsiString('FieldNamesAsTuple'), @TPyDBDataset.Do_FieldNamesAsTuple,
+ AnsiString('DBDataset.FieldNamesAsTuple() -> a tuple containing all field names') );
+ AddMethod(AnsiString('FieldsAsTuple'), @TPyDBDataset.Do_FieldsAsTuple,
+ AnsiString('DBDataset.FieldsAsTuple() -> a tuple containing all TFields') );
+ AddMethod(AnsiString('FieldsAsDict'), @TPyDBDataset.Do_FieldsAsDict,
+ AnsiString('DBDataset.FieldsAsDict() -> a dictionary containing all TFields, with FieldName as Key, and TField as Value') );
+ AddMethod(AnsiString('First'), @TPyDBDataset.Do_First,
+ AnsiString('DBDataset.First() -> None') );
+ AddMethod(AnsiString('Last'), @TPyDBDataset.Do_Last,
+ AnsiString('DBDataset.Last() -> None') );
+ AddMethod(AnsiString('Next'), @TPyDBDataset.Do_Next,
+ AnsiString('DBDataset.Next() -> None') );
+ AddMethod(AnsiString('Prior'), @TPyDBDataset.Do_Prior,
+ AnsiString('DBDataset.Prior() -> None') );
+ AddMethod(AnsiString('Locate'), @TPyDBDataset.Do_Locate,
+ AnsiString('DBDataset.Locate( KeyFields : String, KeyValues : Object or Sequence, Options : TLocateOptions ) -> True or False') );
+ AddMethod(AnsiString('Lookup'), @TPyDBDataset.Do_Lookup,
+ AnsiString('DBDataset.Lookup( KeyFields : String, KeyValues : Object or Sequence, ResultFields : String ) -> a list containing all Result fields') );
+ AddMethod(AnsiString('FindKey'), @TPyDBDataset.Do_FindKey,
+ AnsiString('DBDataset.FindKey( KeyValues : Sequence ) -> True or False') );
+ AddMethod(AnsiString('FindNearest'), @TPyDBDataset.Do_FindNearest,
+ AnsiString('DBDataset.FindNearest( KeyValues : Sequence ) -> None') );
+
+ end;
+end;
+
+function TPyDBDataset.GetAttrO(key: PPyObject) : PPyObject;
+var
+ l_sUpperKey: String;
+ l_oDataset: TFDDataset;
+begin
+ Result := nil;
+ with GetPythonEngine do begin
+ try
+ l_oDataset := DelphiObject;
+ l_sUpperKey := UpperCase(PyString_AsDelphiString(Key));
+ if l_sUpperKey = 'BOF' then
+ Result := VariantAsPyObject( l_oDataset.BOF )
+ else if l_sUpperKey = 'CANMODIFY' then
+ Result := VariantAsPyObject( l_oDataset.CanModify )
+ else if l_sUpperKey = 'EOF' then
+ Result := VariantAsPyObject( l_oDataset.EOF )
+ else if l_sUpperKey = 'FIELDCOUNT' then
+ Result := VariantAsPyObject( l_oDataset.FieldCount )
+ else if l_sUpperKey = 'RECNO' then
+ Result := VariantAsPyObject( l_oDataset.RecNo )
+ else
+ Result := inherited GetAttrO(key);
+ except
+ on E : Exception do begin
+ RaiseDBError( E );
+ Result := Nil;
+ end;
+ end;
+ end;
+end;
+
+function TPyDBDataset.SetAttrO(key, value: PPyObject) : Integer;
+var
+ l_sUpperKey: String;
+ l_oDataset: TFDDataset;
+begin
+ Result := -1;
+ with GetPythonEngine do begin
+ try
+ l_oDataset := DelphiObject;
+ l_sUpperKey := UpperCase(PyString_AsDelphiString(Key));
+ if l_sUpperKey = 'FILTER' then begin
+ l_oDataset.Filter := PyObjectAsVariant( value );
+ Result := 0;
+ end
+ else if l_sUpperKey = 'FILTERED' then begin
+ l_oDataset.Filtered := PyObjectAsVariant( value );
+ Result := 0;
+ end
+ else if l_sUpperKey = 'BOF' then begin
+ Result := 0;
+ end
+ else if l_sUpperKey = 'CanModify' then begin
+ Result := 0;
+ end
+ else if l_sUpperKey = 'EOF' then begin
+ Result := 0;
+ end
+ else if l_sUpperKey = 'RECNO' then begin
+ l_oDataset.RecNo := PyObjectAsVariant( value );
+ Result := 0;
+ end
+ else
+ Result := inherited SetAttrO(key, value);
+ except
+ on E : Exception do begin
+ RaiseDBError( E );
+ Result := -1;
+ end;
+ end;
+ end;
+end;
+
+// Methods
+
+procedure TPyDBDataset.RaiseDBError( E : Exception );
+begin
+ if self.GetModule <> nil then
+ GetModule.RaiseError( AnsiString('DBError'), AnsiString(E.Message) );
+end;
+
+function TPyDBDataset.Do_Fields( args : PPyObject ): PPyObject;
+var
+ idx : Integer;
+ l_oDataset: TFDDataset;
+begin
+ // We adjust the transmitted self argument
+ Adjust(@Self);
+ with GetPythonEngine do begin
+ l_oDataset := DelphiObject;
+ try
+ if PyArg_ParseTuple( args, 'i:DBDataset.Fields',@idx ) <> 0 then begin
+ if (idx >= 0) and (idx < l_oDataset.FieldCount) then
+ Result := PyDelphiWrapper.Wrap(l_oDataset.Fields[idx])
+ else begin
+ Result := nil;
+ PyErr_SetString (PyExc_AttributeError^, PAnsiChar(AnsiString(Format('Value out of range : %d', [idx]))));
+ end;
+ end
+ else
+ Result := nil;
+ except
+ on E : Exception do begin
+ RaiseDBError( E );
+ Result := nil;
+ end;
+ end;
+ end;
+end;
+
+function TPyDBDataset.Do_FieldByName( args : PPyObject ) : PPyObject;
+var
+ l_sAStr: AnsiString;
+ s : PAnsiChar;
+ fld : TField;
+ l_oDataset: TFDDataset;
+begin
+ // We adjust the transmitted self argument
+ Adjust(@Self);
+ with GetPythonEngine do begin
+ l_oDataset := DelphiObject;
+ try
+ if (PyArg_ParseTuple( args, PAnsiChar('s:DBDataset.FieldByName'),@s ) <> 0) then begin
+ l_sAStr := AnsiString(s);
+ fld := l_oDataset.FieldByName(String(l_sAStr));
+ if Assigned(fld) then
+ Result := PyDelphiWrapper.Wrap(fld)
+ else begin
+ Result := nil;
+ PyErr_SetString (PyExc_AttributeError^, PAnsiChar(AnsiString(Format('Unknown field "%s"', [String(s)]))) );
+ end;
+ end
+ else
+ Result := nil;
+ except
+ on E : Exception do begin
+ RaiseDBError( E );
+ Result := nil;
+ end;
+ end;
+ end;
+end;
+
+function TPyDBDataset.Do_FieldNamesAsTuple( args: PPyObject): PPyObject;
+var
+ i : Integer;
+ l_oDataset: TFDDataset;
+begin
+ Adjust(@Self);
+ with GetPythonEngine do begin
+ l_oDataset := DelphiObject;
+ try
+ Result := PyTuple_New(l_oDataset.FieldCount);
+ for i := 0 to l_oDataset.FieldCount - 1 do
+ with l_oDataset.Fields[i] do
+ PyTuple_SetItem(Result, i, PyUnicode_FromWideString(FieldName));
+ except
+ on E : Exception do begin
+ RaiseDBError( E );
+ Result := nil;
+ end;
+ end;
+ end;
+end;
+
+function TPyDBDataset.Do_FieldsAsTuple( args: PPyObject): PPyObject;
+var
+ i : Integer;
+ l_oDataset: TFDDataset;
+begin
+ Result := nil;
+ Adjust(@Self); // <- adjust the transmitted self argument
+ with GetPythonEngine do begin
+ l_oDataset := DelphiObject;
+ try
+ Result := PyTuple_New(l_oDataset.FieldCount);
+ for i := 0 to l_oDataset.FieldCount - 1 do begin
+ PyTuple_SetItem( Result, i,
+ VariantAsPyObject( SqlTimeToVarDate(l_oDataset.Fields[i].AsVariant )) );
+ end;
+ except
+ on E : Exception do begin
+ RaiseDBError( E );
+ end;
+ end;
+ end;
+end;
+
+function TPyDBDataset.Do_FieldsAsDict( args: PPyObject): PPyObject;
+var
+ i : Integer;
+ l_oDataset: TFDDataset;
+ obj : PPyObject;
+ _fieldName : PPyObject;
+begin
+ Adjust(@Self); // <- adjust the transmitted self argument
+ with GetPythonEngine do begin
+ l_oDataset := DelphiObject;
+ try
+ Result := PyDict_New;
+ for i := 0 to l_oDataset.FieldCount - 1 do
+ with l_oDataset.Fields[i] do begin
+ obj := VariantAsPyObject( SqlTimeToVarDate(AsVariant) );
+ _fieldName := VariantAsPyObject(Variant(FieldName));
+ PyDict_SetItem( Result, _fieldName, obj );
+ Py_XDecRef(obj);
+ Py_XDecRef(_fieldName);
+ end;
+ except
+ on E : Exception do begin
+ RaiseDBError( E );
+ Result := nil;
+ end;
+ end;
+ end;
+end;
+
+function TPyDBDataset.Do_First( args : PPyObject ) : PPyObject;
+var
+ l_oDataset: TFDDataset;
+begin
+ Adjust(@Self);
+ with GetPythonEngine do begin
+ l_oDataset := DelphiObject;
+ try
+ l_oDataset.First;
+ Result := ReturnNone;
+ except
+ on E : Exception do begin
+ RaiseDBError( E );
+ Result := nil;
+ end;
+ end;
+ end;
+end;
+
+function TPyDBDataset.Do_Last( args : PPyObject ) : PPyObject;
+var
+ l_oDataset: TFDDataset;
+begin
+ Adjust(@Self);
+ with GetPythonEngine do begin
+ l_oDataset := DelphiObject;
+ try
+ l_oDataset.Last;
+ Result := ReturnNone;
+ except
+ on E : Exception do begin
+ RaiseDBError( E );
+ Result := nil;
+ end;
+ end;
+ end;
+end;
+
+function TPyDBDataset.Do_Next( args : PPyObject ) : PPyObject;
+var
+ l_oDataset: TFDDataset;
+begin
+ Adjust(@Self);
+ with GetPythonEngine do begin
+ l_oDataset := DelphiObject;
+ try
+ l_oDataset.Next;
+ Result := ReturnNone;
+ except
+ on E : Exception do begin
+ RaiseDBError( E );
+ Result := nil;
+ end;
+ end;
+ end;
+end;
+
+function TPyDBDataset.Do_Prior( args : PPyObject ) : PPyObject;
+var
+ l_oDataset: TFDDataset;
+begin
+ Adjust(@Self);
+ with GetPythonEngine do begin
+ l_oDataset := DelphiObject;
+ try
+ l_oDataset.Prior;
+ Result := ReturnNone;
+ except
+ on E : Exception do begin
+ RaiseDBError( E );
+ Result := nil;
+ end;
+ end;
+ end;
+end;
+
+function TPyDBDataset.Do_Locate( args : PPyObject ) : PPyObject;
+var
+ l_oDataset: TFDDataset;
+ keyFields : PAnsiChar;
+ keyValues, options : PPyObject;
+ rslt : Boolean;
+ vvalues : Variant;
+ opt : TLocateOptions;
+begin
+ Result := nil;
+ Adjust(@Self);
+ with GetPythonEngine do begin
+ l_oDataset := DelphiObject;
+ try
+ if PyArg_ParseTuple( args, 'sOO:DBDataset.Locate',@keyFields, @keyValues, @options ) <> 0 then begin
+ if PySequence_Check(options) = 0 then
+ PyErr_SetString (PyExc_AttributeError^, 'Third argument of Locate must be a sequence.')
+ else begin
+ // Prepare the locate options
+ ListToSet( options, @opt, sizeof(opt) );
+ // Create a variant containing the key values
+ vvalues := PyObjectAsVariant( keyValues );
+ // Execute the locate
+ rslt := l_oDataset.Locate( String(keyFields), vvalues, opt );
+ // Return its result
+ Result := VariantAsPyObject( rslt );
+ end;
+ end;
+ except
+ on E : Exception do begin
+ RaiseDBError( E );
+ Result := nil;
+ end;
+ end;
+ end;
+end;
+
+function TPyDBDataset.Do_Lookup( args : PPyObject ) : PPyObject;
+var
+ l_oDataset: TFDDataset;
+ keyFields, resultFields : PAnsiChar;
+ keyValues : PPyObject;
+ rslt : Variant;
+ vvalues : Variant;
+begin
+ Result := nil;
+ Adjust(@Self);
+ with GetPythonEngine do begin
+ l_oDataset := DelphiObject;
+ try
+ if PyArg_ParseTuple( args, 'sOs:DBDataset.Lookup',@keyFields, @keyValues, @resultFields ) <> 0 then begin
+ // Create a variant containing the key values
+ vvalues := PyObjectAsVariant( keyValues );
+ // Execute the lookup
+ rslt := l_oDataset.Lookup( String(keyFields), vvalues, String(resultFields) );
+ // Return its result
+ Result := VariantAsPyObject( rslt );
+ end;
+ except
+ on E : Exception do begin
+ RaiseDBError( E );
+ Result := nil;
+ end;
+ end;
+ end;
+end;
+
+function TPyDBDataset.Do_Refresh( args : PPyObject ) : PPyObject;
+var
+ l_oDataset: TFDDataset;
+begin
+ Adjust(@Self);
+ with GetPythonEngine do begin
+ l_oDataset := DelphiObject;
+ try
+ l_oDataset.Refresh();
+ Result := ReturnNone;
+ except
+ on E : Exception do begin
+ RaiseDBError( E );
+ Result := nil;
+ end;
+ end;
+ end;
+end;
+
+function TPyDBDataset.Do_FindKey( args : PPyObject ) : PPyObject;
+var
+ i : Integer;
+ V : Variant;
+ l_oDataset: TFDDataSet;
+ KeyValues : PPyObject;
+begin
+ Result := nil;
+ Adjust(@Self);
+ with GetPythonEngine do begin
+ l_oDataset := DelphiObject;
+ try
+ if PyArg_ParseTuple( args, 'O:DBDataset.FindKey',@KeyValues ) <> 0 then begin
+ if PySequence_Check( KeyValues ) <> 0 then begin
+ V := PyObjectAsVariant( KeyValues );
+ l_oDataset.CheckBrowseMode;
+ l_oDataset.SetKey;
+ for i := 0 to VarArrayHighBound(V, 1) do
+ l_oDataset.IndexFields[i].AsVariant := V[i];
+ Result := VariantAsPyObject( l_oDataset.GotoKey );
+ end
+ end;
+ except
+ on E : Exception do begin
+ RaiseDBError( E );
+ end;
+ end;
+ end;
+end;
+
+function TPyDBDataset.Do_FindNearest( args : PPyObject ) : PPyObject;
+var
+ i : Integer;
+ V : Variant;
+ l_oDataset: TFDDataset;
+ KeyValues : PPyObject;
+begin
+ Result := nil;
+ Adjust(@Self);
+ with GetPythonEngine do begin
+ l_oDataset := DelphiObject;
+ try
+ if PyArg_ParseTuple( args, 'O:DBDataset.FindNearest',@KeyValues ) <> 0 then begin
+ if PySequence_Check( KeyValues ) <> 0 then begin
+ V := PyObjectAsVariant( KeyValues );
+ l_oDataset.CheckBrowseMode;
+ l_oDataset.SetKey;
+ for i := 0 to VarArrayHighBound(V, 1) do
+ l_oDataset.IndexFields[i].AsVariant := V[i];
+ l_oDataset.GotoNearest;
+ end;
+ Result := ReturnNone;
+ end;
+ except
+ on E : Exception do begin
+ RaiseDBError( E );
+ end;
+ end;
+ end;
+end;
+
+// ----------------------- TPyDBTable ------------------------------------
+
+function TPyDBTable.GetDelphiObject: TFDTable;
+begin
+ Result := TFDTable(inherited DelphiObject);
+end;
+
+procedure TPyDBTable.SetDelphiObject(const Value: TFDTable);
+begin
+ inherited DelphiObject := Value;
+end;
+
+class function TPyDBTable.DelphiObjectClass: TClass;
+begin
+ Result := TFDTable;
+end;
+
+destructor TPyDBTable.Destroy;
+begin
+ if Assigned(DelphiObject) then
+ DelphiObject.Active := False;
+ inherited;
+end;
+
+class procedure TPyDBTable.RegisterMethods( PythonType : TPythonType );
+begin
+ inherited;
+ with PythonType do begin
+ AddMethod(AnsiString('Open'), @TPyDBTable.Do_Open,
+ AnsiString('FDTable.Open() -> None') );
+ AddMethod(AnsiString('Close'), @TPyDBTable.Do_Close,
+ AnsiString('FDTable.Close() -> None') );
+ AddMethod(AnsiString('Edit'), @TPyDBTable.Do_Edit,
+ AnsiString('FDTable.Edit() -> None') );
+ AddMethod(AnsiString('Insert'), @TPyDBTable.Do_Insert,
+ AnsiString('FDTable.Insert() -> None') );
+ AddMethod(AnsiString('Append'), @TPyDBTable.Do_Append,
+ AnsiString('FDTable.Append() -> None') );
+ AddMethod(AnsiString('Post'), @TPyDBTable.Do_Post,
+ AnsiString('FDTable.Post() -> None') );
+ AddMethod(AnsiString('Cancel'), @TPyDBTable.Do_Cancel,
+ AnsiString('FDTable.Cancel() -> None') );
+ AddMethod(AnsiString('Delete'), @TPyDBTable.Do_Delete,
+ AnsiString('FDTable.Delete() -> None') );
+ AddMethod(AnsiString('SetRangeStart'), @TPyDBTable.Do_SetRangeStart,
+ AnsiStrin g('FDTable.SetRangeStart() -> None') );
+ AddMethod(AnsiString('EditRangeStart'), @TPyDBTable.Do_EditRangeStart,
+ AnsiString('FDTable.EditRangeStart() -> None') );
+ AddMethod(AnsiString('SetRangeEnd'), @TPyDBTable.Do_SetRangeEnd,
+ AnsiString('FDTable.SetRangeEnd() -> None') );
+ AddMethod(AnsiString('EditRangeEnd'), @TPyDBTable.Do_EditRangeEnd,
+ AnsiString('FDTable.EditRangeEnd() -> None') );
+ AddMethod(AnsiString('ApplyRange'), @TPyDBTable.Do_ApplyRange,
+ AnsiString('FDTable.ApplyRange() -> None') );
+ AddMethod(AnsiString('SetRange'), @TPyDBTable.Do_SetRange,
+ AnsiString('FDTable.SetRange( sequence of RangeStart values, sequence of RangeEnd values ) -> None') );
+ AddMethod(AnsiString('CancelRange'), @TPyDBTable.Do_CancelRange,
+ AnsiString('FDTable.CancelRange() -> None') );
+ AddMethod(AnsiString('GetIndexNames'), @TPyDBTable.Do_GetIndexNames,
+ AnsiString('FDTable.GetIndexNames() -> list of Index Names') );
+ end;
+end;
+
+function TPyDBTable.CheckActiveDBTable(aMustOpen: Boolean): Boolean;
+begin
+ Result := True;
+ if GetDelphiObject.Active then begin
+ if not aMustOpen then begin
+ Result := False;
+ with GetPythonEngine do
+ PyErr_SetString (PyExc_RuntimeError^, PAnsiChar('DBTable is open!') );
+ end;
+ end
+ else begin
+ if aMustOpen then begin
+ Result := False;
+ with GetPythonEngine do
+ PyErr_SetString (PyExc_RuntimeError^, PAnsiChar('DBTable is not open!') );
+ end;
+ end;
+end;
+
+function TPyDBTable.GetAttrO(key: PPyObject) : PPyObject;
+var
+ l_sUpperKey: String;
+ l_sConnectionDefName, l_sDatabaseName: String;
+ l_oConn: TFDCustomConnection;
+ l_oTable: TFDTable;
+begin
+ Result := nil;
+ with GetPythonEngine do begin
+ l_oConn := Nil;
+ try
+ l_oTable := DelphiObject;
+ l_sUpperKey := UpperCase(PyString_AsDelphiString(Key));
+ if l_sUpperKey = 'CONNECTIONDEFNAME' then begin
+ l_oConn := DelphiObject.Connection;
+ l_sConnectionDefName := DelphiObject.ConnectionName;
+ if Assigned(l_oConn) then
+ l_sConnectionDefName := l_oConn.ConnectionName;
+ Result := VariantAsPyObject( l_sConnectionDefName )
+ end
+ else if l_sUpperKey = 'DATABASENAME' then begin
+ l_oConn := DelphiObject.Connection;
+ if Assigned(l_oConn) then
+ l_sDatabaseName := l_oConn.Params.Database
+ else
+ l_sDatabaseName := '';
+ Result := VariantAsPyObject( l_sDatabaseName )
+ end
+ else if l_sUpperKey = 'TABLENAME'then
+ Result := VariantAsPyObject( l_oTable.TableName )
+ else if l_sUpperKey = 'ACTIVE' then
+ Result := VariantAsPyObject( l_oTable.Active )
+ else if l_sUpperKey = 'FILTER' then
+ Result := VariantAsPyObject( l_oTable.Filter )
+ else if l_sUpperKey = 'FILTERED' then
+ Result := VariantAsPyObject( l_oTable.Filtered )
+ else if l_sUpperKey = 'STATE' then
+ Result := VariantAsPyObject( Integer(l_oTable.State) )
+ else if l_sUpperKey = 'MODIFIED' then
+ Result := VariantAsPyObject( l_oTable.Modified )
+ else if l_sUpperKey = 'ISRANGED' then
+ // Ermöglicht das Ermitteln des aktuellen Bereichsfilterungsmodus.
+ Result := VariantAsPyObject( l_oTable.IsRanged )
+ else if l_sUpperKey = 'KEYEXCLUSIVE' then
+ // Ermittelt oder setzt die Einbeziehung der niedrigsten und höchsten Werte in einen gefilterten Bereich.
+ Result := VariantAsPyObject( l_oTable.KeyExclusive )
+ else if l_sUpperKey = 'KEYFIELDCOUNT' then
+ // Ermittelt oder setzt die Anzahl der in der Bereichsfilterung zu verwendenden Indexfelder
+ Result := VariantAsPyObject( l_oTable.KeyFieldCount )
+ else if l_sUpperKey = 'INDEXNAME' then
+ Result := VariantAsPyObject( l_oTable.IndexName )
+ else
+ Result := inherited GetAttrO(key);
+ except
+ on E : Exception do begin
+ RaiseDBError( E );
+ Result := nil;
+ end;
+ end;
+ end;
+end;
+
+function TPyDBTable.SetAttrO(key, value: PPyObject) : Integer;
+var
+ i: Integer;
+ l_sUpperKey: String;
+ l_sName, l_sConnectionDefName, l_sDatabaseName: String;
+ l_oConn: TFDCustomConnection;
+ l_oTable: TFDTable;
+begin
+ Result := -1;
+ with GetPythonEngine do begin
+ l_oConn := Nil;
+ try
+ l_oTable := DelphiObject;
+ l_sUpperKey := UpperCase(PyString_AsDelphiString(Key));
+ if l_sUpperKey = 'CONNECTIONDEFNAME' then begin
+ if CheckActiveDBTable(False) then begin
+ l_sConnectionDefName := UpperCase(PyObjectAsVariant(value));
+ for i := 0 to FDManager.ConnectionCount-1 do begin
+ l_sName := UpperCase(FDManager.Connections[i].ConnectionDefName);
+ if l_sName = l_sConnectionDefName then begin
+ l_oConn := FDManager.Connections[i];
+ break;
+ end;
+ end;
+ if Assigned(l_oConn) then begin
+ if l_oTable.Active then
+ l_oTable.Active := False;
+ l_oTable.Connection := l_oConn;
+ end;
+ Result := 0;
+ end;
+ end
+ else if l_sUpperKey = 'DATABASENAME' then begin
+ if CheckActiveDBTable(False) then begin
+ l_sDatabaseName := PyObjectAsVariant( value );
+ l_oConn := DelphiObject.Connection;
+ if Assigned(l_oConn) then begin
+ l_oConn.Params.Database := l_sDatabaseName;
+ end;
+ Result := 0;
+ end;
+ end
+ else if l_sUpperKey = 'TABLENAME' then begin
+ if CheckActiveDBTable(False) then begin
+ l_oTable.TableName := PyObjectAsVariant( value );
+ Result := 0;
+ end;
+ end
+ else if l_sUpperKey = 'ACTIVE' then begin
+ l_oTable.Active := PyObjectAsVariant( value );
+ Result := 0;
+ end
+ else if l_sUpperKey = 'FILTER' then begin
+ l_oTable.Filter := PyObjectAsVariant( value );
+ Result := 0;
+ end
+ else if l_sUpperKey = 'FILTERED' then begin
+ l_oTable.Filtered := PyObjectAsVariant( value );
+ Result := 0;
+ end
+ else if l_sUpperKey = 'STATE' then begin
+ Result := 0;
+ end
+ else if l_sUpperKey = 'MODIFIED' then begin
+ Result := 0;
+ end
+ else if l_sUpperKey = 'ISRANGED' then begin
+ Result := 0;
+ end
+ else if l_sUpperKey = 'KEYEXCLUSIVE' then begin
+ // Ermittelt oder setzt die Einbeziehung der niedrigsten und höchsten Werte in einen gefilterten Bereich.
+ l_oTable.KeyExclusive := PyObjectAsVariant( value );
+ Result := 0;
+ end
+ else if l_sUpperKey = 'KEYFIELDCOUNT' then begin
+ // Ermittelt oder setzt die Anzahl der in der Bereichsfilterung zu verwendenden Indexfelder
+ l_oTable.KeyFieldCount := PyObjectAsVariant( value );
+ Result := 0;
+ end
+ else if l_sUpperKey = 'INDEXNAME' then begin
+ // Ermittelt oder setzt die Anzahl der in der Bereichsfilterung zu verwendenden Indexfelder
+ l_oTable.IndexName := PyObjectAsVariant( value );
+ Result := 0;
+ end
+ else
+ Result := inherited SetAttrO(key, value);
+ except
+ on E : Exception do begin
+ RaiseDBError( E );
+ Result := -1;
+ end;
+ end;
+ end;
+end;
+
+function TPyDBTable.Do_Open( args : PPyObject ) : PPyObject;
+var
+ l_oTable: TFDTable;
+begin
+ Result := nil;
+ Adjust(@Self); // <- Adjust the transmitted self argument
+ with GetPythonEngine do begin
+ l_oTable := DelphiObject;
+ try
+ l_oTable.Open;
+ Result := ReturnNone;
+ except
+ on E : Exception do begin
+ RaiseDBError( E );
+ end;
+ end;
+ end;
+end;
+
+function TPyDBTable.Do_Close( args : PPyObject ) : PPyObject;
+var
+ l_oTable: TFDTable;
+begin
+ Result := nil;
+ Adjust(@Self);
+ with GetPythonEngine do begin
+ l_oTable := DelphiObject;
+ try
+ l_oTable.Close;
+ Result := ReturnNone;
+ except
+ on E : Exception do begin
+ RaiseDBError( E );
+ end;
+ end;
+ end;
+end;
+
+function TPyDBTable.Do_Edit( args : PPyObject ): PPyObject;
+var
+ l_oTable: TFDTable;
+begin
+ Result := nil;
+ Adjust(@Self);
+ with GetPythonEngine do begin
+ l_oTable := DelphiObject;
+ try
+ if l_oTable.Active then begin
+ l_oTable.Edit;
+ Result := ReturnNone;
+ end;
+ except
+ on E : Exception do begin
+ RaiseDBError( E );
+ end;
+ end;
+ end;
+end;
+
+function TPyDBTable.Do_Insert( args : PPyObject ): PPyObject;
+var
+ l_oTable: TFDTable;
+begin
+ Result := nil;
+ Adjust(@Self);
+ with GetPythonEngine do begin
+ l_oTable := DelphiObject;
+ try
+ if l_oTable.Active then begin
+ l_oTable.Insert;
+ Result := ReturnNone;
+ end;
+ except
+ on E : Exception do begin
+ RaiseDBError( E );
+ end;
+ end;
+ end;
+end;
+
+function TPyDBTable.Do_Append( args : PPyObject ): PPyObject;
+var
+ l_oTable: TFDTable;
+begin
+ Result := nil;
+ Adjust(@Self);
+ with GetPythonEngine do begin
+ l_oTable := DelphiObject;
+ try
+ if l_oTable.Active then begin
+ l_oTable.Append;
+ Result := ReturnNone;
+ end;
+ except
+ on E : Exception do begin
+ RaiseDBError( E );
+ end;
+ end;
+ end;
+end;
+
+function TPyDBTable.Do_Post( args : PPyObject ): PPyObject;
+var
+ l_oTable: TFDTable;
+begin
+ Result := nil;
+ Adjust(@Self);
+ with GetPythonEngine do begin
+ l_oTable := DelphiObject;
+ try
+ if l_oTable.Active then begin
+ l_oTable.Post;
+ Result := ReturnNone;
+ end;
+ except
+ on E : Exception do begin
+ RaiseDBError( E );
+ end;
+ end;
+ end;
+end;
+
+function TPyDBTable.Do_Cancel( args : PPyObject ): PPyObject;
+var
+ l_oTable: TFDTable;
+begin
+ Result := nil;
+ Adjust(@Self);
+ with GetPythonEngine do begin
+ l_oTable := DelphiObject;
+ try
+ if l_oTable.Active then begin
+ l_oTable.Cancel;
+ Result := ReturnNone;
+ end;
+ except
+ on E : Exception do begin
+ RaiseDBError( E );
+ end;
+ end;
+ end;
+end;
+
+function TPyDBTable.Do_Delete( args : PPyObject ): PPyObject;
+var
+ l_oTable: TFDTable;
+begin
+ Result := nil;
+ Adjust(@Self);
+ with GetPythonEngine do begin
+ l_oTable := DelphiObject;
+ try
+ if l_oTable.Active then begin
+ l_oTable.Delete;
+ Result := ReturnNone;
+ end;
+ except
+ on E : Exception do begin
+ RaiseDBError( E );
+ end;
+ end;
+ end;
+end;
+
+function TPyDBTable.Do_SetRangeStart( args : PPyObject ) : PPyObject;
+var
+ l_oTable: TFDTable;
+begin
+ Result := nil;
+ Adjust(@Self);
+ with GetPythonEngine do begin
+ l_oTable := DelphiObject;
+ try
+ if l_oTable.Active then begin
+ l_oTable.SetRangeStart;
+ Result := ReturnNone;
+ end;
+ except
+ on E : Exception do begin
+ RaiseDBError( E );
+ end;
+ end;
+ end;
+end;
+
+function TPyDBTable.Do_EditRangeStart( args : PPyObject ) : PPyObject;
+var
+ l_oTable: TFDTable;
+begin
+ Result := nil;
+ Adjust(@Self);
+ with GetPythonEngine do begin
+ l_oTable := DelphiObject;
+ try
+ if l_oTable.Active then begin
+ l_oTable.EditRangeStart;
+ Result := ReturnNone;
+ end;
+ except
+ on E : Exception do begin
+ RaiseDBError( E );
+ end;
+ end;
+ end;
+end;
+
+function TPyDBTable.Do_SetRangeEnd( args : PPyObject ) : PPyObject;
+var
+ l_oTable: TFDTable;
+begin
+ Result := nil;
+ Adjust(@Self);
+ with GetPythonEngine do begin
+ l_oTable := DelphiObject;
+ try
+ if l_oTable.Active then begin
+ l_oTable.EditRangeEnd;
+ Result := ReturnNone;
+ end;
+ except
+ on E : Exception do begin
+ RaiseDBError( E );
+ end;
+ end;
+ end;
+end;
+
+function TPyDBTable.Do_EditRangeEnd( args : PPyObject ) : PPyObject;
+var
+ l_oTable: TFDTable;
+begin
+ Result := nil;
+ Adjust(@Self);
+ with GetPythonEngine do begin
+ l_oTable := DelphiObject;
+ try
+ if l_oTable.Active then begin
+ l_oTable.EditRangeEnd;
+ Result := ReturnNone;
+ end;
+ except
+ on E : Exception do begin
+ RaiseDBError( E );
+ end;
+ end;
+ end;
+end;
+
+function TPyDBTable.Do_ApplyRange( args : PPyObject ) : PPyObject;
+var
+ l_oTable: TFDTable;
+begin
+ Result := nil;
+ Adjust(@Self);
+ with GetPythonEngine do begin
+ l_oTable := DelphiObject;
+ try
+ if l_oTable.Active then begin
+ l_oTable.ApplyRange;
+ Result := ReturnNone;
+ end;
+ except
+ on E : Exception do begin
+ RaiseDBError( E );
+ end;
+ end;
+ end;
+end;
+
+function TPyDBTable.Do_SetRange( args : PPyObject ) : PPyObject;
+var
+ i: Integer;
+ l_oTable: TFDTable;
+ l_oPyStartValues, l_oPyEndValues : PPyObject;
+begin
+ Result := nil;
+ Adjust(@Self);
+ with GetPythonEngine do begin
+ l_oTable := DelphiObject;
+ try
+ if l_oTable.Active and
+ (PyArg_ParseTuple( args, 'OO:FDTable.SetRange',@l_oPyStartValues, @l_oPyEndValues ) <> 0) then begin
+ if PySequence_Check(l_oPyStartValues) = 0 then begin
+ PyErr_SetString (PyExc_AttributeError^, 'First argument of SetRange must be a sequence.');
+ end
+ else if PySequence_Check(l_oPyEndValues) = 0 then begin
+ PyErr_SetString (PyExc_AttributeError^, 'Second argument of SetRange must be a sequence.');
+ end
+ else begin
+ l_oTable.SetRangeStart;
+ for i := 0 to PySequence_Length(l_oPyStartValues)-1 do
+ l_oTable.IndexFields[i].Value := PyObjectAsVariant(PySequence_GetItem(l_oPyStartValues, i));
+ l_oTable.SetRangeEnd;
+ for i := 0 to PySequence_Length(l_oPyEndValues)-1 do
+ l_oTable.IndexFields[i].Value := PyObjectAsVariant(PySequence_GetItem(l_oPyEndValues, i));
+ l_oTable.ApplyRange;
+ end;
+ Result := ReturnNone;
+ end;
+ except
+ on E : Exception do begin
+ RaiseDBError( E );
+ end;
+ end;
+ end;
+end;
+
+function TPyDBTable.Do_CancelRange( args : PPyObject ) : PPyObject;
+var
+ l_oTable: TFDTable;
+begin
+ Result := nil;
+ Adjust(@Self);
+ with GetPythonEngine do begin
+ l_oTable := DelphiObject;
+ try
+ if l_oTable.Active then begin
+ l_oTable.CancelRange;
+ Result := ReturnNone;
+ end;
+ except
+ on E : Exception do begin
+ RaiseDBError( E );
+ end;
+ end;
+ end;
+end;
+
+function TPyDBTable.Do_GetIndexNames( args : PPyObject ) : PPyObject;
+var
+ l_oTable: TFDTable;
+ L : TStringList;
+begin
+ Result := nil;
+ L := nil;
+ Adjust(@Self);
+ with GetPythonEngine do begin
+ l_oTable := DelphiObject;
+ L := TStringList.Create;
+ try
+ l_oTable.GetIndexNames( L );
+ Result := GetPythonEngine.StringsToPyList( L );
+ except
+ on E : Exception do begin
+ RaiseDBError( E );
+ end;
+ end;
+ end;
+ if Assigned(L) then
+ L.Free;
+end;
+
+// --------------------- TPyDBQuery --------------------------------------------
+
+function TPyDBQuery.GetDelphiObject: TFDQuery;
+begin
+ Result := TFDQuery(inherited DelphiObject);
+end;
+
+procedure TPyDBQuery.SetDelphiObject(const Value: TFDQuery);
+begin
+ inherited DelphiObject := Value;
+end;
+
+class function TPyDBQuery.DelphiObjectClass : TClass;
+begin
+ Result := TFDQuery;
+end;
+
+destructor TPyDBQuery.Destroy;
+begin
+ if Assigned(DelphiObject) then
+ DelphiObject.Active := False;
+ inherited;
+end;
+
+class procedure TPyDBQuery.RegisterMethods( PythonType : TPythonType );
+begin
+ inherited;
+ with PythonType do begin
+ AddMethod(AnsiString('Open'), @TPyDBQuery.Do_Open,
+ AnsiString('FDQuery.Open() -> None') );
+ AddMethod(AnsiString('Close'), @TPyDBQuery.Do_Close,
+ AnsiString('FDQuery.Close() -> None') );
+ AddMethod(AnsiString('Prepare'), @TPyDBQuery.Do_Prepare,
+ AnsiString('FDQuery.Prepare() -> None') );
+ AddMethod(AnsiString('Unprepare'), @TPyDBQuery.Do_Unprepare,
+ AnsiString('FDQuery.Unprepare() -> None') );
+ AddMethod(AnsiString('ExecSQL'), @TPyDBQuery.Do_ExecSQL,
+ AnsiString('FDQuery.ExecSQL() -> None') );
+ end;
+end;
+
+function TPyDBQuery.CheckActiveDBQuery(aMustOpen: Boolean): Boolean;
+begin
+ Result := True;
+ if GetDelphiObject.Active then begin
+ if not aMustOpen then begin
+ Result := False;
+ with GetPythonEngine do
+ PyErr_SetString (PyExc_RuntimeError^, PAnsiChar('DBQuery is open!') );
+ end;
+ end
+ else begin
+ if aMustOpen then begin
+ Result := False;
+ with GetPythonEngine do
+ PyErr_SetString (PyExc_RuntimeError^, PAnsiChar('DBQuery is not open!') );
+ end;
+ end;
+end;
+
+function TPyDBQuery.GetAttrO(key: PPyObject) : PPyObject;
+var
+ l_sUpperKey: String;
+ l_sConnectionDefName, l_sDatabaseName: String;
+ l_oConn: TFDCustomConnection;
+ l_oQuery: TFDQuery;
+begin
+ Result := nil;
+ with GetPythonEngine do begin
+ l_oConn := Nil;
+ try
+ l_oQuery := DelphiObject;
+ l_sUpperKey := UpperCase(PyString_AsDelphiString(Key));
+ if l_sUpperKey = 'CONNECTIONDEFNAME' then begin
+ l_oConn := DelphiObject.Connection;
+ l_sConnectionDefName := DelphiObject.ConnectionName;
+ if Assigned(l_oConn) then
+ l_sConnectionDefName := l_oConn.ConnectionName;
+ Result := VariantAsPyObject( l_sConnectionDefName )
+ end
+ else if l_sUpperKey = 'DATABASENAME' then begin
+ l_oConn := DelphiObject.Connection;
+ if Assigned(l_oConn) then
+ l_sDatabaseName := l_oConn.Params.Database
+ else
+ l_sDatabaseName := '';
+ Result := VariantAsPyObject( l_sDatabaseName )
+ end
+ else if l_sUpperKey = 'PARAMCOUNT' then
+ Result := VariantAsPyObject( l_oQuery.ParamCount )
+ else if l_sUpperKey = 'PREPARED' then
+ Result := VariantAsPyObject( l_oQuery.Prepared )
+ else
+ Result := inherited GetAttrO(key);
+ except
+ on E : Exception do begin
+ RaiseDBError( E );
+ Result := nil;
+ end;
+ end;
+ end;
+end;
+
+function TPyDBQuery.SetAttrO(key, value: PPyObject) : Integer;
+var
+ i: Integer;
+ l_sUpperKey: String;
+ l_sName, l_sConnectionDefName, l_sDatabaseName: String;
+ l_oConn: TFDCustomConnection;
+ l_oQuery: TFDQuery;
+begin
+ Result := -1;
+ with GetPythonEngine do begin
+ l_oConn := Nil;
+ try
+ l_oQuery := DelphiObject;
+ l_sUpperKey := UpperCase(PyString_AsDelphiString(Key));
+ if l_sUpperKey = 'CONNECTIONDEFNAME' then begin
+ if CheckActiveDBQuery(False) then begin
+ l_sConnectionDefName := UpperCase(PyObjectAsVariant(value));
+ for i := 0 to FDManager.ConnectionCount-1 do begin
+ l_sName := UpperCase(FDManager.Connections[i].ConnectionDefName);
+ if l_sName = l_sConnectionDefName then begin
+ l_oConn := FDManager.Connections[i];
+ break;
+ end;
+ end;
+ if Assigned(l_oConn) then begin
+ if l_oQuery.Active then
+ l_oQuery.Active := False;
+ l_oQuery.Connection := l_oConn;
+ end;
+ Result := 0;
+ end;
+ end
+ else if l_sUpperKey = 'DATABASENAME' then begin
+ if CheckActiveDBQuery(False) then begin
+ l_sDatabaseName := PyObjectAsVariant( value );
+ l_oConn := DelphiObject.Connection;
+ if Assigned(l_oConn) then begin
+ l_oConn.Params.Database := l_sDatabaseName;
+ end;
+ Result := 0;
+ end;
+ end
+ else if l_sUpperKey = 'PARAMCOUNT' then begin
+ Result := 0;
+ end
+ else if l_sUpperKey = 'PREPARED' then begin
+ l_oQuery.Prepared := PyObjectAsVariant( value );
+ Result := 0;
+ end
+ else
+ Result := inherited SetAttrO(key, value);
+ except
+ on E : Exception do begin
+ RaiseDBError( E );
+ Result := -1;
+ end;
+ end;
+ end;
+end;
+
+function TPyDBQuery.Do_Open( args : PPyObject ) : PPyObject;
+var
+ l_oQuery: TFDQuery;
+begin
+ Result := nil;
+ Adjust(@Self); // <- Adjust the transmitted self argument
+ with GetPythonEngine do begin
+ l_oQuery := DelphiObject;
+ try
+ l_oQuery.Open;
+ Result := ReturnNone;
+ except
+ on E : Exception do begin
+ RaiseDBError( E );
+ end;
+ end;
+ end;
+end;
+
+function TPyDBQuery.Do_Close( args : PPyObject ) : PPyObject;
+var
+ l_oQuery: TFDQuery;
+begin
+ Result := nil;
+ Adjust(@Self);
+ with GetPythonEngine do begin
+ l_oQuery := DelphiObject;
+ try
+ l_oQuery.Close;
+ Result := ReturnNone;
+ except
+ on E : Exception do begin
+ RaiseDBError( E );
+ end;
+ end;
+ end;
+end;
+
+function TPyDBQuery.Do_Prepare( args : PPyObject ) : PPyObject;
+var
+ l_oQuery: TFDQuery;
+begin
+ Result := nil;
+ Adjust(@Self);
+ with GetPythonEngine do begin
+ l_oQuery := DelphiObject;
+ try
+ l_oQuery.Prepare;
+ Result := ReturnNone;
+ except
+ on E : Exception do begin
+ RaiseDBError( E );
+ end;
+ end;
+ end;
+end;
+
+function TPyDBQuery.Do_Unprepare( args : PPyObject ) : PPyObject;
+var
+ l_oQuery: TFDQuery;
+begin
+ Result := nil;
+ Adjust(@Self);
+ with GetPythonEngine do begin
+ l_oQuery := DelphiObject;
+ try
+ l_oQuery.Unprepare;
+ Result := ReturnNone;
+ except
+ on E : Exception do begin
+ RaiseDBError( E );
+ end;
+ end;
+ end;
+end;
+
+function TPyDBQuery.Do_ExecSQL( args : PPyObject ) : PPyObject;
+var
+ l_oQuery: TFDQuery;
+begin
+ Result := nil;
+ Adjust(@Self);
+ with GetPythonEngine do begin
+ l_oQuery := DelphiObject;
+ try
+ l_oQuery.ExecSQL;
+ Result := ReturnNone;
+ except
+ on E : Exception do begin
+ RaiseDBError( E );
+ end;
+ end;
+ end;
+end;
+
+// -----------------------------------------------------------------------------
+
+{ TPyDSRowsRegistration }
+
+procedure TPyFireDACRegistration.DefineVars(APyDelphiWrapper: TPyDelphiWrapper);
+begin
+ inherited;
+ // Values for type TDatasetState
+ APyDelphiWrapper.DefineVar('dsInactive', 0);
+ APyDelphiWrapper.DefineVar('dsBrowse', 1);
+ APyDelphiWrapper.DefineVar('dsEdit', 2);
+ APyDelphiWrapper.DefineVar('dsInsert', 3);
+ APyDelphiWrapper.DefineVar('dsSetKey', 4);
+ APyDelphiWrapper.DefineVar('dsCalcFields', 5);
+ APyDelphiWrapper.DefineVar('dsFilter', 6);
+ APyDelphiWrapper.DefineVar('dsNewValue', 7);
+ APyDelphiWrapper.DefineVar('dsOldValue', 8);
+ APyDelphiWrapper.DefineVar('dsCurValue', 9);
+ // Values for type TFieldType
+ APyDelphiWrapper.DefineVar('ftUnknown', 0);
+ APyDelphiWrapper.DefineVar('ftString', 1);
+ APyDelphiWrapper.DefineVar('ftSmallint', 2);
+ APyDelphiWrapper.DefineVar('ftInteger', 3);
+ APyDelphiWrapper.DefineVar('ftWord', 4);
+ APyDelphiWrapper.DefineVar('ftBoolean', 5);
+ APyDelphiWrapper.DefineVar('ftFloat', 6);
+ APyDelphiWrapper.DefineVar('ftCurrency', 7);
+ APyDelphiWrapper.DefineVar('ftBCD', 8);
+ APyDelphiWrapper.DefineVar('ftDate', 9);
+ APyDelphiWrapper.DefineVar('ftTime', 10);
+ APyDelphiWrapper.DefineVar('ftDateTime', 11);
+ APyDelphiWrapper.DefineVar('ftBytes', 12);
+ APyDelphiWrapper.DefineVar('ftVarBytes', 13);
+ APyDelphiWrapper.DefineVar('ftAutoInc', 14);
+ APyDelphiWrapper.DefineVar('ftBlob', 15);
+ APyDelphiWrapper.DefineVar('ftMemo', 16);
+ APyDelphiWrapper.DefineVar('ftGraphic', 17);
+ APyDelphiWrapper.DefineVar('ftFmtMemo', 18);
+ APyDelphiWrapper.DefineVar('ftParadoxOle', 19);
+ APyDelphiWrapper.DefineVar('ftDBaseOle', 20);
+ APyDelphiWrapper.DefineVar('ftTypedBinary', 21);
+ APyDelphiWrapper.DefineVar('ftCursor', 22);
+ // Values for type TFieldKind
+ APyDelphiWrapper.DefineVar('fkData', 0);
+ APyDelphiWrapper.DefineVar('fkCalculated', 1);
+ APyDelphiWrapper.DefineVar('fkLookup', 2);
+ APyDelphiWrapper.DefineVar('fkInternalCalc', 3);
+ // Values for type TLocateOption
+ APyDelphiWrapper.DefineVar('loCaseInsensitive', 0);
+ APyDelphiWrapper.DefineVar('loPartialKey', 1);
+ // Values for type TLockType
+ APyDelphiWrapper.DefineVar('ltReadLock', 0);
+ APyDelphiWrapper.DefineVar('ltWriteLock', 1);
+ // Values for type TIndexOptions
+ APyDelphiWrapper.DefineVar('ixPrimary', 0);
+ APyDelphiWrapper.DefineVar('ixUnique', 1);
+ APyDelphiWrapper.DefineVar('ixDescending', 2);
+ APyDelphiWrapper.DefineVar('ixCaseInsensitive', 3);
+ APyDelphiWrapper.DefineVar('ixExpression', 4);
+ // Values for type TDataAction
+ APyDelphiWrapper.DefineVar('daFail', 0);
+ APyDelphiWrapper.DefineVar('daAbort', 1);
+ APyDelphiWrapper.DefineVar('daRetry', 2);
+ // Values for type TUpdateKind
+ APyDelphiWrapper.DefineVar('ukModify', 0);
+ APyDelphiWrapper.DefineVar('ukInsert', 1);
+ APyDelphiWrapper.DefineVar('ukDelete', 2);
+ // Values for type TUpdateAction
+ APyDelphiWrapper.DefineVar('uaFail', 0);
+ APyDelphiWrapper.DefineVar('uaAbort', 1);
+ APyDelphiWrapper.DefineVar('uaSkip', 2);
+ APyDelphiWrapper.DefineVar('uaRetry', 3);
+ APyDelphiWrapper.DefineVar('uaApplied', 4);
+end;
+
+function TPyFireDACRegistration.Name: String;
+begin
+ Result := 'FireDac';
+end;
+
+procedure TPyFireDACRegistration.RegisterWrappers(
+ aPyDelphiWrapper: TPyDelphiWrapper);
+begin
+ inherited;
+ APyDelphiWrapper.RegisterDelphiWrapper(TPyDBDataset);
+ APyDelphiWrapper.RegisterDelphiWrapper(TPyDBTable);
+ APyDelphiWrapper.RegisterDelphiWrapper(TPyDBQuery);
+ APyDelphiWrapper.RegisterDelphiWrapper(TPyDBField);
+end;
+
+function SqlTimeToVarDate(V : Variant) : Variant;
+begin
+ if VarIsSQLTimeStamp(V) or VarIsSQLTimeStampOffset(V) then
+ VarCast(Result, V, varDate)
+ else
+ Result := V;
+end;
+
+
+initialization
+begin
+ RegisteredUnits.Add( TPyFireDACRegistration.Create );
+end;
+
+end.
diff --git a/PythonForDelphi/Components/Sources/VCL/pyDB.pas b/PythonForDelphi/Components/Sources/VCL/pyDB.pas
index 0e109e53..810172cb 100644
--- a/PythonForDelphi/Components/Sources/VCL/pyDB.pas
+++ b/PythonForDelphi/Components/Sources/VCL/pyDB.pas
@@ -180,8 +180,8 @@ TPyDataset = class(TCommon)
function Repr : PPyObject; override;
// Sequence services
- function SqLength : Integer; override;
- function SqItem( idx : Integer ) : PPyObject; override;
+ function SqLength : NativeInt; override;
+ function SqItem( idx : NativeInt ) : PPyObject; override;
// Class methods
class procedure RegisterMethods( PythonType : TPythonType ); override;
@@ -469,7 +469,7 @@ procedure TCommon.AppendProp( List : PPyObject; const prop : String );
begin
with GetPythonEngine do
begin
- obj := PyString_FromString(PAnsiChar(AnsiString(prop)));
+ obj := PyString_FromDelphiString(prop);
PyList_Append( List, obj );
Py_XDecRef(obj);
end;
@@ -1630,7 +1630,7 @@ function TPyDataset.Repr : PPyObject;
// Sequence services
-function TPyDataset.SqLength : Integer;
+function TPyDataset.SqLength : NativeInt;
begin
if CheckDataset then
Result := Dataset.RecordCount
@@ -1638,7 +1638,7 @@ function TPyDataset.SqLength : Integer;
Result := -1;
end;
-function TPyDataset.SqItem( idx : Integer ) : PPyObject;
+function TPyDataset.SqItem( idx : NativeInt ) : PPyObject;
begin
if CheckDataset then
begin
@@ -2774,7 +2774,7 @@ function TVarArg.SetAttr(key : PAnsiChar; value : PPyObject) : Integer;
function TVarArg.Repr : PPyObject;
begin
with GetPythonEngine do
- Result := PyString_FromString( PAnsiChar(AnsiString(PyObjectAsString(FValue))) );
+ Result := PyString_FromDelphiString( PyObjectAsString(FValue) );
end;
constructor TPythonVarArg.Create( AOwner : TComponent );
diff --git a/PythonForDelphi/Components/Sources/VCL/pyDBTables.pas b/PythonForDelphi/Components/Sources/VCL/pyDBTables.pas
index 747f1801..46232d48 100644
--- a/PythonForDelphi/Components/Sources/VCL/pyDBTables.pas
+++ b/PythonForDelphi/Components/Sources/VCL/pyDBTables.pas
@@ -68,7 +68,6 @@ TPyBDEDataset = class(TPyDataset)
procedure OnUpdateRecord( Dataset : TDataset; UpdateKind: TUpdateKind; var ua:TUpdateAction);
end;
-
{*********************************************************************
* Interface of TDBDataset *
*********************************************************************}
@@ -97,7 +96,6 @@ TPyDBDataset = class(TPyBDEDataset)
{*********************************************************************
* Interface of TTable *
*********************************************************************}
-
TPyTable = class(TPyDBDataset)
// Constructors & Destructors
@@ -1742,5 +1740,7 @@ procedure CreateComponents( AOwner : TComponent );
gQueryType := TPythonQuery.Create(AOwner);
end;
+{$EndIf}
+{$EndIf}
end.
diff --git a/PythonForDelphi/Components/p4dlaz.lpk b/PythonForDelphi/Components/p4dlaz.lpk
index afdb8f03..e210b8a5 100644
--- a/PythonForDelphi/Components/p4dlaz.lpk
+++ b/PythonForDelphi/Components/p4dlaz.lpk
@@ -66,8 +66,7 @@
-
-
+
@@ -81,5 +80,8 @@
+
+ <_ExternHelp Items="Count"/>
+
diff --git a/PythonForDelphi/Components/p4dlaz.pas b/PythonForDelphi/Components/p4dlaz.pas
index 7980a0cb..dc842e31 100644
--- a/PythonForDelphi/Components/p4dlaz.pas
+++ b/PythonForDelphi/Components/p4dlaz.pas
@@ -4,12 +4,13 @@
unit P4DLaz;
+{$warn 5023 off : no warning about unused units}
interface
uses
- PythonEngine, PythonGUIInputOutput, MethodCallBack, TinyWideStrings,
- VarPyth, WrapDelphi, WrapDelphiButtons, WrapDelphiClasses,
- WrapDelphiControls, WrapDelphiTypes, LazarusPackageIntf;
+ PythonEngine, PythonGUIInputOutput, MethodCallBack, VarPyth, WrapDelphi,
+ WrapDelphiButtons, WrapDelphiClasses, WrapDelphiControls, WrapDelphiTypes,
+ LazarusPackageIntf;
implementation
diff --git a/PythonForDelphi/Components/py15.lib b/PythonForDelphi/Components/py15.lib
deleted file mode 100644
index 50b88f0d..00000000
Binary files a/PythonForDelphi/Components/py15.lib and /dev/null differ
diff --git a/PythonForDelphi/Components/py21.lib b/PythonForDelphi/Components/py21.lib
deleted file mode 100644
index 385f1c23..00000000
Binary files a/PythonForDelphi/Components/py21.lib and /dev/null differ
diff --git a/PythonForDelphi/Demos/Demo01/Project1.dpr b/PythonForDelphi/Demos/Demo01/Project1.dpr
index 34e6006c..7a68fc98 100644
--- a/PythonForDelphi/Demos/Demo01/Project1.dpr
+++ b/PythonForDelphi/Demos/Demo01/Project1.dpr
@@ -3,12 +3,7 @@ program Project1;
{$I Definition.Inc}
uses
-{$IFDEF MSWINDOWS}
Forms,
-{$ENDIF}
-{$IFDEF LINUX}
- QForms,
-{$ENDIF}
Unit1 in 'Unit1.pas' {Form1};
{$R *.res}
diff --git a/PythonForDelphi/Demos/Demo01/Unit1.pas b/PythonForDelphi/Demos/Demo01/Unit1.pas
index d4a0d70b..75370c0b 100644
--- a/PythonForDelphi/Demos/Demo01/Unit1.pas
+++ b/PythonForDelphi/Demos/Demo01/Unit1.pas
@@ -6,13 +6,8 @@ interface
uses
Classes, SysUtils,
-{$IFDEF MSWINDOWS}
Windows, Messages, Graphics, Controls, Forms, Dialogs,
StdCtrls, ComCtrls, ExtCtrls,
-{$ENDIF}
-{$IFDEF LINUX}
- QForms, QDialogs, QStdCtrls, QControls, QExtCtrls,
-{$ENDIF}
PythonEngine, PythonGUIInputOutput;
type
@@ -38,18 +33,12 @@ TForm1 = class(TForm)
end;
-
var
Form1: TForm1;
implementation
-{$IFDEF MSWINDOWS}
{$R *.DFM}
-{$ENDIF}
-{$IFDEF LINUX}
-{$R *.xfm}
-{$ENDIF}
procedure TForm1.Button1Click(Sender: TObject);
begin
diff --git a/PythonForDelphi/Demos/Demo01/Unit1.xfm b/PythonForDelphi/Demos/Demo01/Unit1.xfm
deleted file mode 100644
index 215ff8d1..00000000
Binary files a/PythonForDelphi/Demos/Demo01/Unit1.xfm and /dev/null differ
diff --git a/PythonForDelphi/Demos/Demo02/Project1.dpr b/PythonForDelphi/Demos/Demo02/Project1.dpr
index 37535427..7a68fc98 100644
--- a/PythonForDelphi/Demos/Demo02/Project1.dpr
+++ b/PythonForDelphi/Demos/Demo02/Project1.dpr
@@ -1,17 +1,9 @@
-// JCL_DEBUG_EXPERT_GENERATEJDBG OFF
-// JCL_DEBUG_EXPERT_INSERTJDBG OFF
-// JCL_DEBUG_EXPERT_DELETEMAPFILE OFF
program Project1;
{$I Definition.Inc}
uses
-{$IFDEF MSWINDOWS}
Forms,
-{$ENDIF}
-{$IFDEF LINUX}
- QForms,
-{$ENDIF}
Unit1 in 'Unit1.pas' {Form1};
{$R *.res}
diff --git a/PythonForDelphi/Demos/Demo02/Project1.kof b/PythonForDelphi/Demos/Demo02/Project1.kof
deleted file mode 100644
index 6ad26fc6..00000000
--- a/PythonForDelphi/Demos/Demo02/Project1.kof
+++ /dev/null
@@ -1,61 +0,0 @@
-[Compiler]
-A=8
-B=0
-C=1
-D=1
-E=0
-F=0
-G=1
-H=1
-I=1
-J=0
-K=0
-L=1
-M=0
-N=1
-O=1
-P=1
-Q=0
-R=0
-S=0
-T=0
-U=0
-V=1
-W=0
-X=1
-Y=1
-Z=1
-ShowHints=1
-ShowWarnings=1
-UnitAliases=
-
-[Linker]
-MapFile=0
-OutputObjs=0
-ConsoleApp=1
-DebugInfo=0
-RemoteSymbols=0
-MinStackSize=16384
-MaxStackSize=1048576
-ImageBase=4194304
-ExeDescription=
-DynamicLoader=/lib/ld-linux.so.2
-
-[Directories]
-OutputDir=
-UnitOutputDir=
-PackageDLLOutputDir=
-PackageDCPOutputDir=
-SearchPath=
-Packages=
-Conditionals=
-DebugSourceDirs=
-UsePackages=0
-
-[Parameters]
-RunParams=
-HostApplication=
-Launcher=/usr/X11R6/bin/xterm -T KylixDebuggerOutput -e bash -i -c %debuggee%
-UseLauncher=0
-DebugCWD=
-
diff --git a/PythonForDelphi/Demos/Demo02/Unit1.pas b/PythonForDelphi/Demos/Demo02/Unit1.pas
index a9097ae2..a995af9b 100644
--- a/PythonForDelphi/Demos/Demo02/Unit1.pas
+++ b/PythonForDelphi/Demos/Demo02/Unit1.pas
@@ -6,13 +6,8 @@ interface
uses
Classes, SysUtils,
-{$IFDEF MSWINDOWS}
Windows, Messages, Graphics, Controls, Forms, Dialogs,
StdCtrls, ComCtrls, ExtCtrls,
-{$ENDIF}
-{$IFDEF LINUX}
- QForms, QDialogs, QStdCtrls, QControls, QExtCtrls,
-{$ENDIF}
PythonEngine, PythonGUIInputOutput;
type
@@ -37,19 +32,12 @@ TForm1 = class(TForm)
{ Déclarations publiques }
end;
-
-
var
Form1: TForm1;
implementation
-{$IFDEF MSWINDOWS}
{$R *.DFM}
-{$ENDIF}
-{$IFDEF LINUX}
-{$R *.xfm}
-{$ENDIF}
procedure TForm1.Button1Click(Sender: TObject);
var
diff --git a/PythonForDelphi/Demos/Demo02/Unit1.xfm b/PythonForDelphi/Demos/Demo02/Unit1.xfm
deleted file mode 100644
index 52433e88..00000000
Binary files a/PythonForDelphi/Demos/Demo02/Unit1.xfm and /dev/null differ
diff --git a/PythonForDelphi/Demos/Demo03/Project1.conf b/PythonForDelphi/Demos/Demo03/Project1.conf
deleted file mode 100644
index 84e6d103..00000000
--- a/PythonForDelphi/Demos/Demo03/Project1.conf
+++ /dev/null
@@ -1,32 +0,0 @@
--$A8
--$B-
--$C+
--$D+
--$E-
--$F-
--$G+
--$H+
--$I+
--$J-
--$K-
--$L+
--$M-
--$N+
--$O+
--$P+
--$Q-
--$R-
--$S-
--$T-
--$U-
--$V+
--$W-
--$X+
--$YD
--$Z1
--cg
--H+
--W+
--M
--$M16384,1048576
--K$00400000
diff --git a/PythonForDelphi/Demos/Demo03/Project1.dof b/PythonForDelphi/Demos/Demo03/Project1.dof
deleted file mode 100644
index 9cccf462..00000000
--- a/PythonForDelphi/Demos/Demo03/Project1.dof
+++ /dev/null
@@ -1,87 +0,0 @@
-[Compiler]
-A=1
-B=0
-C=1
-D=1
-E=0
-F=0
-G=1
-H=1
-I=1
-J=1
-K=0
-L=1
-M=0
-N=1
-O=1
-P=1
-Q=0
-R=0
-S=0
-T=0
-U=0
-V=1
-W=0
-X=1
-Y=1
-Z=1
-ShowHints=1
-ShowWarnings=1
-UnitAliases=WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;
-[Linker]
-MapFile=0
-OutputObjs=0
-ConsoleApp=1
-DebugInfo=0
-RemoteSymbols=0
-MinStackSize=16384
-MaxStackSize=1048576
-ImageBase=4194304
-ExeDescription=
-[Directories]
-OutputDir=
-UnitOutputDir=
-PackageDLLOutputDir=
-PackageDCPOutputDir=
-SearchPath=
-Packages=Vcl50;Vclx50;VclSmp50;Vcldb50;vclado50;ibevnt50;Vclbde50;vcldbx50;Qrpt50;VCLIB50;Vclmid50;vclie50;Inetdb50;Inet50;NMFast50;webmid50;dclocx50;dclaxserver50;Indy50;VM;rbCIDE55;rbIDE55;rbRCL55;rbBDE55;rbDBDE55;rbDAD55;rbDIDE55;rbUSER55;rbDB55;rbADO55;rbIBE55;VMREPORTBUILDER
-Conditionals=
-DebugSourceDirs=
-UsePackages=0
-[Parameters]
-RunParams=
-HostApplication=
-[Language]
-ActiveLang=
-ProjectLang=$00000409
-RootDir=
-[Version Info]
-IncludeVerInfo=0
-AutoIncBuild=0
-MajorVer=1
-MinorVer=0
-Release=0
-Build=0
-Debug=0
-PreRelease=0
-Special=0
-Private=0
-DLL=0
-Locale=1033
-CodePage=1252
-[Version Info Keys]
-CompanyName=
-FileDescription=
-FileVersion=1.0.0.0
-InternalName=
-LegalCopyright=
-LegalTrademarks=
-OriginalFilename=
-ProductName=
-ProductVersion=1.0.0.0
-Comments=
-[Excluded Packages]
-D:\projects\Source\ThirdParty\ReportBuilder\dclRBC51.bpl=ReportBuilder TeeChart 4.0 Components
-$(DELPHI)\Bin\dcldss50.bpl=Borland Decision Cube Components
-$(DELPHI)\Bin\dcltee50.bpl=TeeChart Components
-$(DELPHI)\Bin\dcltqr50.bpl=TeeChart for QuickReport Components
diff --git a/PythonForDelphi/Demos/Demo03/Project1.dpr b/PythonForDelphi/Demos/Demo03/Project1.dpr
index 37535427..7a68fc98 100644
--- a/PythonForDelphi/Demos/Demo03/Project1.dpr
+++ b/PythonForDelphi/Demos/Demo03/Project1.dpr
@@ -1,17 +1,9 @@
-// JCL_DEBUG_EXPERT_GENERATEJDBG OFF
-// JCL_DEBUG_EXPERT_INSERTJDBG OFF
-// JCL_DEBUG_EXPERT_DELETEMAPFILE OFF
program Project1;
{$I Definition.Inc}
uses
-{$IFDEF MSWINDOWS}
Forms,
-{$ENDIF}
-{$IFDEF LINUX}
- QForms,
-{$ENDIF}
Unit1 in 'Unit1.pas' {Form1};
{$R *.res}
diff --git a/PythonForDelphi/Demos/Demo03/Project1.kof b/PythonForDelphi/Demos/Demo03/Project1.kof
deleted file mode 100644
index 6ad26fc6..00000000
--- a/PythonForDelphi/Demos/Demo03/Project1.kof
+++ /dev/null
@@ -1,61 +0,0 @@
-[Compiler]
-A=8
-B=0
-C=1
-D=1
-E=0
-F=0
-G=1
-H=1
-I=1
-J=0
-K=0
-L=1
-M=0
-N=1
-O=1
-P=1
-Q=0
-R=0
-S=0
-T=0
-U=0
-V=1
-W=0
-X=1
-Y=1
-Z=1
-ShowHints=1
-ShowWarnings=1
-UnitAliases=
-
-[Linker]
-MapFile=0
-OutputObjs=0
-ConsoleApp=1
-DebugInfo=0
-RemoteSymbols=0
-MinStackSize=16384
-MaxStackSize=1048576
-ImageBase=4194304
-ExeDescription=
-DynamicLoader=/lib/ld-linux.so.2
-
-[Directories]
-OutputDir=
-UnitOutputDir=
-PackageDLLOutputDir=
-PackageDCPOutputDir=
-SearchPath=
-Packages=
-Conditionals=
-DebugSourceDirs=
-UsePackages=0
-
-[Parameters]
-RunParams=
-HostApplication=
-Launcher=/usr/X11R6/bin/xterm -T KylixDebuggerOutput -e bash -i -c %debuggee%
-UseLauncher=0
-DebugCWD=
-
diff --git a/PythonForDelphi/Demos/Demo03/Unit1.pas b/PythonForDelphi/Demos/Demo03/Unit1.pas
index d7ebd2ae..42b46633 100644
--- a/PythonForDelphi/Demos/Demo03/Unit1.pas
+++ b/PythonForDelphi/Demos/Demo03/Unit1.pas
@@ -6,13 +6,8 @@ interface
uses
SysUtils, Classes,
-{$IFDEF MSWINDOWS}
Windows, Messages, Graphics, Controls, Forms, Dialogs, StdCtrls,
ComCtrls, ExtCtrls,
-{$ENDIF}
-{$IFDEF LINUX}
- QForms, QDialogs, QStdCtrls, QControls, QExtCtrls,
-{$ENDIF}
PythonEngine, PythonGUIInputOutput;
type
diff --git a/PythonForDelphi/Demos/Demo04/Project1.dof b/PythonForDelphi/Demos/Demo04/Project1.dof
deleted file mode 100644
index e3281697..00000000
--- a/PythonForDelphi/Demos/Demo04/Project1.dof
+++ /dev/null
@@ -1,92 +0,0 @@
-[FileVersion]
-Version=6.0
-[Compiler]
-A=8
-B=0
-C=1
-D=1
-E=0
-F=0
-G=1
-H=1
-I=1
-J=1
-K=0
-L=1
-M=0
-N=1
-O=1
-P=1
-Q=0
-R=0
-S=0
-T=0
-U=0
-V=1
-W=0
-X=1
-Y=1
-Z=1
-ShowHints=1
-ShowWarnings=1
-UnitAliases=WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;
-[Linker]
-MapFile=0
-OutputObjs=0
-ConsoleApp=1
-DebugInfo=0
-RemoteSymbols=0
-MinStackSize=16384
-MaxStackSize=1048576
-ImageBase=4194304
-ExeDescription=
-[Directories]
-OutputDir=
-UnitOutputDir=
-PackageDLLOutputDir=
-PackageDCPOutputDir=
-SearchPath=
-Packages=Vcl50;Vclx50;VclSmp50;Vcldb50;vclado50;ibevnt50;Vclbde50;vcldbx50;Qrpt50;VCLIB50;Vclmid50;vclie50;Inetdb50;Inet50;NMFast50;webmid50;dclocx50;dclaxserver50;Indy50;VM;rbCIDE55;rbIDE55;rbRCL55;rbBDE55;rbDBDE55;rbDAD55;rbDIDE55;rbUSER55;rbDB55;rbADO55;rbIBE55;VMREPORTBUILDER
-Conditionals=
-DebugSourceDirs=
-UsePackages=0
-[Parameters]
-RunParams=
-HostApplication=
-Launcher=
-UseLauncher=0
-DebugCWD=
-[Language]
-ActiveLang=
-ProjectLang=$00000409
-RootDir=
-[Version Info]
-IncludeVerInfo=0
-AutoIncBuild=0
-MajorVer=1
-MinorVer=0
-Release=0
-Build=0
-Debug=0
-PreRelease=0
-Special=0
-Private=0
-DLL=0
-Locale=1033
-CodePage=1252
-[Version Info Keys]
-CompanyName=
-FileDescription=
-FileVersion=1.0.0.0
-InternalName=
-LegalCopyright=
-LegalTrademarks=
-OriginalFilename=
-ProductName=
-ProductVersion=1.0.0.0
-Comments=
-[Excluded Packages]
-D:\projects\Source\ThirdParty\ReportBuilder\dclRBC51.bpl=ReportBuilder TeeChart 4.0 Components
-d:\program files\borland\delphi6\Bin\dcldss50.bpl=Borland Decision Cube Components
-d:\program files\borland\delphi6\Bin\dcltee50.bpl=TeeChart Components
-d:\program files\borland\delphi6\Bin\dcltqr50.bpl=TeeChart for QuickReport Components
diff --git a/PythonForDelphi/Demos/Demo04/Project1.dpr b/PythonForDelphi/Demos/Demo04/Project1.dpr
index 34e6006c..7a68fc98 100644
--- a/PythonForDelphi/Demos/Demo04/Project1.dpr
+++ b/PythonForDelphi/Demos/Demo04/Project1.dpr
@@ -3,12 +3,7 @@ program Project1;
{$I Definition.Inc}
uses
-{$IFDEF MSWINDOWS}
Forms,
-{$ENDIF}
-{$IFDEF LINUX}
- QForms,
-{$ENDIF}
Unit1 in 'Unit1.pas' {Form1};
{$R *.res}
diff --git a/PythonForDelphi/Demos/Demo04/Unit1.pas b/PythonForDelphi/Demos/Demo04/Unit1.pas
index 291ed953..7dbe3f4c 100644
--- a/PythonForDelphi/Demos/Demo04/Unit1.pas
+++ b/PythonForDelphi/Demos/Demo04/Unit1.pas
@@ -6,13 +6,8 @@ interface
uses
SysUtils, Classes,
-{$IFDEF MSWINDOWS}
Windows, Messages, Graphics, Controls, Forms, Dialogs,
StdCtrls, ComCtrls, ExtCtrls,
-{$ENDIF}
-{$IFDEF LINUX}
- QForms, QDialogs, QStdCtrls, QControls, QExtCtrls,
-{$ENDIF}
PythonEngine, PythonGUIInputOutput;
type
diff --git a/PythonForDelphi/Demos/Demo05/Project1.dpr b/PythonForDelphi/Demos/Demo05/Project1.dpr
index 34e6006c..7a68fc98 100644
--- a/PythonForDelphi/Demos/Demo05/Project1.dpr
+++ b/PythonForDelphi/Demos/Demo05/Project1.dpr
@@ -3,12 +3,7 @@ program Project1;
{$I Definition.Inc}
uses
-{$IFDEF MSWINDOWS}
Forms,
-{$ENDIF}
-{$IFDEF LINUX}
- QForms,
-{$ENDIF}
Unit1 in 'Unit1.pas' {Form1};
{$R *.res}
diff --git a/PythonForDelphi/Demos/Demo05/Unit1.dfm b/PythonForDelphi/Demos/Demo05/Unit1.dfm
index 07c01b88..58012c74 100644
Binary files a/PythonForDelphi/Demos/Demo05/Unit1.dfm and b/PythonForDelphi/Demos/Demo05/Unit1.dfm differ
diff --git a/PythonForDelphi/Demos/Demo05/Unit1.pas b/PythonForDelphi/Demos/Demo05/Unit1.pas
index 1b1909d9..1d315d7c 100644
--- a/PythonForDelphi/Demos/Demo05/Unit1.pas
+++ b/PythonForDelphi/Demos/Demo05/Unit1.pas
@@ -6,13 +6,8 @@ interface
uses
SysUtils, Classes,
-{$IFDEF MSWINDOWS}
Windows, Messages, Graphics, Controls, Forms, Dialogs,
StdCtrls, ComCtrls, ExtCtrls,
-{$ENDIF}
-{$IFDEF LINUX}
- QForms, QDialogs, QStdCtrls, QControls, QExtCtrls,
-{$ENDIF}
PythonEngine, PythonGUIInputOutput;
type
diff --git a/PythonForDelphi/Demos/Demo06/Project1.dof b/PythonForDelphi/Demos/Demo06/Project1.dof
deleted file mode 100644
index 911b28c0..00000000
--- a/PythonForDelphi/Demos/Demo06/Project1.dof
+++ /dev/null
@@ -1,136 +0,0 @@
-[FileVersion]
-Version=7.0
-[Compiler]
-A=8
-B=0
-C=1
-D=1
-E=0
-F=0
-G=1
-H=1
-I=1
-J=0
-K=0
-L=1
-M=0
-N=1
-O=1
-P=1
-Q=0
-R=0
-S=0
-T=0
-U=0
-V=1
-W=0
-X=1
-Y=1
-Z=1
-ShowHints=1
-ShowWarnings=1
-UnitAliases=WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;
-NamespacePrefix=
-SymbolDeprecated=1
-SymbolLibrary=1
-SymbolPlatform=1
-UnitLibrary=1
-UnitPlatform=1
-UnitDeprecated=1
-HResultCompat=1
-HidingMember=1
-HiddenVirtual=1
-Garbage=1
-BoundsError=1
-ZeroNilCompat=1
-StringConstTruncated=1
-ForLoopVarVarPar=1
-TypedConstVarPar=1
-AsgToTypedConst=1
-CaseLabelRange=1
-ForVariable=1
-ConstructingAbstract=1
-ComparisonFalse=1
-ComparisonTrue=1
-ComparingSignedUnsigned=1
-CombiningSignedUnsigned=1
-UnsupportedConstruct=1
-FileOpen=1
-FileOpenUnitSrc=1
-BadGlobalSymbol=1
-DuplicateConstructorDestructor=1
-InvalidDirective=1
-PackageNoLink=1
-PackageThreadVar=1
-ImplicitImport=1
-HPPEMITIgnored=1
-NoRetVal=1
-UseBeforeDef=1
-ForLoopVarUndef=1
-UnitNameMismatch=1
-NoCFGFileFound=1
-MessageDirective=1
-ImplicitVariants=1
-UnicodeToLocale=1
-LocaleToUnicode=1
-ImagebaseMultiple=1
-SuspiciousTypecast=1
-PrivatePropAccessor=1
-UnsafeType=0
-UnsafeCode=0
-UnsafeCast=0
-[Linker]
-MapFile=0
-OutputObjs=0
-ConsoleApp=1
-DebugInfo=0
-RemoteSymbols=0
-MinStackSize=16384
-MaxStackSize=1048576
-ImageBase=4194304
-ExeDescription=
-[Directories]
-OutputDir=
-UnitOutputDir=
-PackageDLLOutputDir=
-PackageDCPOutputDir=
-SearchPath=
-Packages=dxBarD6;dxcomnd6;rtl;dxBarDBNavD6;dbrtl;dxBarExtItemsD6;dxBarExtDBItemsD6;dxsbD6;dxdbtrD6;dxtrmdD6;dxmdsd6;dxInsD6;dxDBEdD6;dxEdtrD6;dxObjInsD6;vcldb;dxorgcD6;dxdborD6;vcl;vclx;fc3000v6;EQTLD6;ECQDBCD6;EQDBTLD6;EQGridD6;dxGrEdD6;dxExELD6;dxELibD6;dxPSCoreD6;dxPsPrVwAdvD6;dxPSLnksD6;dxPSTLLnkD6;dxPSdxDBTLLnkD6;dxPSdxDBCtrlLnkD6;dxPSdxDBGrLnkD6;dxPSdxDBTVLnkD6;dxPSdxInsLnkD6;dxPSdxOCLnkD6;dxPSdxDBOCLnkD6;rbTDBC61;rbRCL66;rbCIDE66;rbIDE66;rbBDE66;rbRIDE66;rbRAP66;rbDBDE66;rbDAD66;rbDIDE66;rbUSER66;rbDB66;rbADO66;adortl;rbDBE66;dbxcds;dbexpress;rbIBE66;ibxpress;dxMasterViewD6;RxCtl6;VclSmp;RxDB6;RxBDE6
-Conditionals=
-DebugSourceDirs=
-UsePackages=0
-[Parameters]
-RunParams=
-HostApplication=
-Launcher=
-UseLauncher=0
-DebugCWD=
-[Language]
-ActiveLang=
-ProjectLang=
-RootDir=D:\Program Files\Borland\Delphi6\Bin\
-[Version Info]
-IncludeVerInfo=0
-AutoIncBuild=0
-MajorVer=1
-MinorVer=0
-Release=0
-Build=0
-Debug=0
-PreRelease=0
-Special=0
-Private=0
-DLL=0
-Locale=1033
-CodePage=1252
-[Version Info Keys]
-CompanyName=
-FileDescription=
-FileVersion=1.0.0.0
-InternalName=
-LegalCopyright=
-LegalTrademarks=
-OriginalFilename=
-ProductName=
-ProductVersion=1.0.0.0
-Comments=
diff --git a/PythonForDelphi/Demos/Demo06/Project1.dpr b/PythonForDelphi/Demos/Demo06/Project1.dpr
index 34e6006c..7a68fc98 100644
--- a/PythonForDelphi/Demos/Demo06/Project1.dpr
+++ b/PythonForDelphi/Demos/Demo06/Project1.dpr
@@ -3,12 +3,7 @@ program Project1;
{$I Definition.Inc}
uses
-{$IFDEF MSWINDOWS}
Forms,
-{$ENDIF}
-{$IFDEF LINUX}
- QForms,
-{$ENDIF}
Unit1 in 'Unit1.pas' {Form1};
{$R *.res}
diff --git a/PythonForDelphi/Demos/Demo06/Unit1.pas b/PythonForDelphi/Demos/Demo06/Unit1.pas
index f8df4802..a228acf6 100644
--- a/PythonForDelphi/Demos/Demo06/Unit1.pas
+++ b/PythonForDelphi/Demos/Demo06/Unit1.pas
@@ -6,13 +6,8 @@ interface
uses
SysUtils, Classes,
-{$IFDEF MSWINDOWS}
Windows, Messages, Graphics, Controls, Forms, Dialogs,
StdCtrls, ComCtrls, ExtCtrls,
-{$ENDIF}
-{$IFDEF LINUX}
- QForms, QDialogs, QStdCtrls, QControls, QExtCtrls,
-{$ENDIF}
PythonEngine, PythonGUIInputOutput;
type
@@ -43,9 +38,7 @@ TForm1 = class(TForm)
procedure PythonDelphiVar1GetData(Sender: TObject; var Data: Variant);
procedure PythonDelphiVar1SetData(Sender: TObject; Data: Variant);
private
- { Déclarations privées }
public
- { Déclarations publiques }
end;
PyPointRec = record
@@ -170,9 +163,7 @@ function PyPoint_getattr(obj : PPyObject; key : PAnsiChar) : PPyObject; cdecl;
else
begin
// Else check for a method
- Result := Py_FindMethod( MethodsByName('PythonType1'), obj, key);
- // or we could write, because it's quicker:
- // Result := Py_FindMethod( Form1.PythonType1.MethodsData, obj, key);
+ Result := PyObject_GenericGetAttr(obj, PyString_FromString(key));
if not Assigned(Result) then
PyErr_SetString (PyExc_AttributeError^, PAnsiChar(Format('Unknown attribute "%s"',[key])));
end;
diff --git a/PythonForDelphi/Demos/Demo07/Project1.conf b/PythonForDelphi/Demos/Demo07/Project1.conf
deleted file mode 100644
index 84e6d103..00000000
--- a/PythonForDelphi/Demos/Demo07/Project1.conf
+++ /dev/null
@@ -1,32 +0,0 @@
--$A8
--$B-
--$C+
--$D+
--$E-
--$F-
--$G+
--$H+
--$I+
--$J-
--$K-
--$L+
--$M-
--$N+
--$O+
--$P+
--$Q-
--$R-
--$S-
--$T-
--$U-
--$V+
--$W-
--$X+
--$YD
--$Z1
--cg
--H+
--W+
--M
--$M16384,1048576
--K$00400000
diff --git a/PythonForDelphi/Demos/Demo07/Project1.dof b/PythonForDelphi/Demos/Demo07/Project1.dof
deleted file mode 100644
index 9cccf462..00000000
--- a/PythonForDelphi/Demos/Demo07/Project1.dof
+++ /dev/null
@@ -1,87 +0,0 @@
-[Compiler]
-A=1
-B=0
-C=1
-D=1
-E=0
-F=0
-G=1
-H=1
-I=1
-J=1
-K=0
-L=1
-M=0
-N=1
-O=1
-P=1
-Q=0
-R=0
-S=0
-T=0
-U=0
-V=1
-W=0
-X=1
-Y=1
-Z=1
-ShowHints=1
-ShowWarnings=1
-UnitAliases=WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;
-[Linker]
-MapFile=0
-OutputObjs=0
-ConsoleApp=1
-DebugInfo=0
-RemoteSymbols=0
-MinStackSize=16384
-MaxStackSize=1048576
-ImageBase=4194304
-ExeDescription=
-[Directories]
-OutputDir=
-UnitOutputDir=
-PackageDLLOutputDir=
-PackageDCPOutputDir=
-SearchPath=
-Packages=Vcl50;Vclx50;VclSmp50;Vcldb50;vclado50;ibevnt50;Vclbde50;vcldbx50;Qrpt50;VCLIB50;Vclmid50;vclie50;Inetdb50;Inet50;NMFast50;webmid50;dclocx50;dclaxserver50;Indy50;VM;rbCIDE55;rbIDE55;rbRCL55;rbBDE55;rbDBDE55;rbDAD55;rbDIDE55;rbUSER55;rbDB55;rbADO55;rbIBE55;VMREPORTBUILDER
-Conditionals=
-DebugSourceDirs=
-UsePackages=0
-[Parameters]
-RunParams=
-HostApplication=
-[Language]
-ActiveLang=
-ProjectLang=$00000409
-RootDir=
-[Version Info]
-IncludeVerInfo=0
-AutoIncBuild=0
-MajorVer=1
-MinorVer=0
-Release=0
-Build=0
-Debug=0
-PreRelease=0
-Special=0
-Private=0
-DLL=0
-Locale=1033
-CodePage=1252
-[Version Info Keys]
-CompanyName=
-FileDescription=
-FileVersion=1.0.0.0
-InternalName=
-LegalCopyright=
-LegalTrademarks=
-OriginalFilename=
-ProductName=
-ProductVersion=1.0.0.0
-Comments=
-[Excluded Packages]
-D:\projects\Source\ThirdParty\ReportBuilder\dclRBC51.bpl=ReportBuilder TeeChart 4.0 Components
-$(DELPHI)\Bin\dcldss50.bpl=Borland Decision Cube Components
-$(DELPHI)\Bin\dcltee50.bpl=TeeChart Components
-$(DELPHI)\Bin\dcltqr50.bpl=TeeChart for QuickReport Components
diff --git a/PythonForDelphi/Demos/Demo07/Project1.dpr b/PythonForDelphi/Demos/Demo07/Project1.dpr
index 34e6006c..7a68fc98 100644
--- a/PythonForDelphi/Demos/Demo07/Project1.dpr
+++ b/PythonForDelphi/Demos/Demo07/Project1.dpr
@@ -3,12 +3,7 @@ program Project1;
{$I Definition.Inc}
uses
-{$IFDEF MSWINDOWS}
Forms,
-{$ENDIF}
-{$IFDEF LINUX}
- QForms,
-{$ENDIF}
Unit1 in 'Unit1.pas' {Form1};
{$R *.res}
diff --git a/PythonForDelphi/Demos/Demo07/Project1.kof b/PythonForDelphi/Demos/Demo07/Project1.kof
deleted file mode 100644
index 6ad26fc6..00000000
--- a/PythonForDelphi/Demos/Demo07/Project1.kof
+++ /dev/null
@@ -1,61 +0,0 @@
-[Compiler]
-A=8
-B=0
-C=1
-D=1
-E=0
-F=0
-G=1
-H=1
-I=1
-J=0
-K=0
-L=1
-M=0
-N=1
-O=1
-P=1
-Q=0
-R=0
-S=0
-T=0
-U=0
-V=1
-W=0
-X=1
-Y=1
-Z=1
-ShowHints=1
-ShowWarnings=1
-UnitAliases=
-
-[Linker]
-MapFile=0
-OutputObjs=0
-ConsoleApp=1
-DebugInfo=0
-RemoteSymbols=0
-MinStackSize=16384
-MaxStackSize=1048576
-ImageBase=4194304
-ExeDescription=
-DynamicLoader=/lib/ld-linux.so.2
-
-[Directories]
-OutputDir=
-UnitOutputDir=
-PackageDLLOutputDir=
-PackageDCPOutputDir=
-SearchPath=
-Packages=
-Conditionals=
-DebugSourceDirs=
-UsePackages=0
-
-[Parameters]
-RunParams=
-HostApplication=
-Launcher=/usr/X11R6/bin/xterm -T KylixDebuggerOutput -e bash -i -c %debuggee%
-UseLauncher=0
-DebugCWD=
-
diff --git a/PythonForDelphi/Demos/Demo07/Unit1.pas b/PythonForDelphi/Demos/Demo07/Unit1.pas
index ff769141..f8cbcb35 100644
--- a/PythonForDelphi/Demos/Demo07/Unit1.pas
+++ b/PythonForDelphi/Demos/Demo07/Unit1.pas
@@ -6,13 +6,8 @@ interface
uses
SysUtils, Classes,
-{$IFDEF MSWINDOWS}
Windows, Messages, Graphics, Controls, Forms, Dialogs,
StdCtrls, ComCtrls, ExtCtrls,
-{$ENDIF}
-{$IFDEF LINUX}
- QForms, QDialogs, QStdCtrls, QControls, QExtCtrls,
-{$ENDIF}
PythonEngine, PythonGUIInputOutput;
type
@@ -43,13 +38,13 @@ TForm1 = class(TForm)
procedure PythonDelphiVar1GetData(Sender: TObject; var Data: Variant);
procedure PythonDelphiVar1SetData(Sender: TObject; Data: Variant);
private
- { Déclarations privées }
+ { D�clarations priv�es }
function spam_foo( pself, args : PPyObject ) : PPyObject; cdecl;
function spam_CreatePoint( pself, args : PPyObject ) : PPyObject; cdecl;
function spam_getdouble( pself, args : PPyObject ) : PPyObject; cdecl;
function spam_getdouble2( pself, args : PPyObject ) : PPyObject; cdecl;
public
- { Déclarations publiques }
+ { D�clarations publiques }
end;
PyPointRec = record
@@ -208,9 +203,7 @@ function PyPoint_getattr(obj : PPyObject; key : PAnsiChar) : PPyObject; cdecl;
else
begin
// Else check for a method
- Result := Py_FindMethod( MethodsByName('PythonType1'), obj, key);
- // or we could write, because it's quicker:
- // Result := Py_FindMethod( Form1.PythonType1.MethodsData, obj, key);
+ Result := PyObject_GenericGetAttr(obj, PyString_FromString(key));
if not Assigned(Result) then
PyErr_SetString (PyExc_AttributeError^, PAnsiChar(Format('Unknown attribute "%s"',[key])));
end;
diff --git a/PythonForDelphi/Demos/Demo08/Project1.conf b/PythonForDelphi/Demos/Demo08/Project1.conf
deleted file mode 100644
index 84e6d103..00000000
--- a/PythonForDelphi/Demos/Demo08/Project1.conf
+++ /dev/null
@@ -1,32 +0,0 @@
--$A8
--$B-
--$C+
--$D+
--$E-
--$F-
--$G+
--$H+
--$I+
--$J-
--$K-
--$L+
--$M-
--$N+
--$O+
--$P+
--$Q-
--$R-
--$S-
--$T-
--$U-
--$V+
--$W-
--$X+
--$YD
--$Z1
--cg
--H+
--W+
--M
--$M16384,1048576
--K$00400000
diff --git a/PythonForDelphi/Demos/Demo08/Project1.dof b/PythonForDelphi/Demos/Demo08/Project1.dof
deleted file mode 100644
index 2f62fbdb..00000000
--- a/PythonForDelphi/Demos/Demo08/Project1.dof
+++ /dev/null
@@ -1,88 +0,0 @@
-[FileVersion]
-Version=6.0
-[Compiler]
-A=8
-B=0
-C=1
-D=1
-E=0
-F=0
-G=1
-H=1
-I=1
-J=1
-K=0
-L=1
-M=0
-N=1
-O=0
-P=1
-Q=0
-R=0
-S=0
-T=0
-U=0
-V=1
-W=0
-X=1
-Y=1
-Z=1
-ShowHints=1
-ShowWarnings=1
-UnitAliases=WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;
-[Linker]
-MapFile=0
-OutputObjs=0
-ConsoleApp=1
-DebugInfo=0
-RemoteSymbols=0
-MinStackSize=16384
-MaxStackSize=1048576
-ImageBase=4194304
-ExeDescription=
-[Directories]
-OutputDir=
-UnitOutputDir=
-PackageDLLOutputDir=
-PackageDCPOutputDir=
-SearchPath=$(DELPHI)\Lib\Debug
-Packages=Vcl50;Vclx50;VclSmp50;Vcldb50;vclado50;ibevnt50;Vclbde50;vcldbx50;Qrpt50;TeeUI50;TeeDB50;Tee50;Dss50;TeeQR50;VCLIB50;Vclmid50;vclie50;Inetdb50;Inet50;NMFast50;webmid50;dclocx50;dclaxserver50;Indy50;VM;rbCIDE55;rbIDE55;rbRCL55;rbBDE55;rbDBDE55;rbDAD55;rbDIDE55;rbUSER55;rbDB55;rbADO55;rbIBE55
-Conditionals=
-DebugSourceDirs=
-UsePackages=0
-[Parameters]
-RunParams=
-HostApplication=
-Launcher=
-UseLauncher=0
-DebugCWD=
-[Language]
-ActiveLang=
-ProjectLang=$00000409
-RootDir=
-[Version Info]
-IncludeVerInfo=0
-AutoIncBuild=0
-MajorVer=1
-MinorVer=0
-Release=0
-Build=0
-Debug=0
-PreRelease=0
-Special=0
-Private=0
-DLL=0
-Locale=1033
-CodePage=1252
-[Excluded Packages]
-c:\program files\borland\delphi6\RBuilder\Lib\dclRBC61.bpl=ReportBuilder TeeChart 5.0 Components
-c:\program files\borland\delphi6\RBuilder\Lib\dclRBE66.bpl=ReportBuilder Enterprise
-c:\program files\borland\delphi6\RBuilder\Lib\dclRAP66.bpl=ReportBuilder RAP Language
-c:\program files\borland\delphi6\RBuilder\Lib\dclDAD66.bpl=ReportBuilder Data Access Environment
-c:\program files\borland\delphi6\RBuilder\Lib\dclRBU66.bpl=ReportBuilder Sample Components
-C:\Program Files\Developer Express Inc\ExpressPrinting System\Delphi 6\Lib\dxPSdxDBTVLnkD6.bpl=ExpressPrinting System ReportLink for ExpressDBTree by Developer Express Inc.
-C:\Program Files\Developer Express Inc\ExpressPrinting System\Delphi 6\Lib\dxPSdxInsLnkD6.bpl=ExpressPrinting System ReportLink for ExpressInspector by Developer Express Inc.
-C:\Program Files\Developer Express Inc\ExpressPrinting System\Delphi 6\Lib\dxPSdxMVLnkD6.bpl=ExpressPrinting System ReportLink for ExpressMasterView by Developer Express Inc.
-C:\Program Files\Developer Express Inc\ExpressPrinting System\Delphi 6\Lib\dxPSdxOCLnkD6.bpl=ExpressPrinting System ReportLinks for ExpressOrgChart by Developer Express Inc.
-C:\Program Files\Developer Express Inc\ExpressPrinting System\Delphi 6\Lib\dxPSdxDBOCLnkD6.bpl=ExpressPrinting System ReportLinks for ExpressDBOrgChart by Developer Express Inc.
-C:\Program Files\Developer Express Inc\ExpressPrinting System\Delphi 6\Lib\dxPSdxFCLnkD6.bpl=ExpressPrinting System ReportLinks for ExpressFlowChart by Developer Express Inc.
diff --git a/PythonForDelphi/Demos/Demo08/Project1.dpr b/PythonForDelphi/Demos/Demo08/Project1.dpr
index 34e6006c..7a68fc98 100644
--- a/PythonForDelphi/Demos/Demo08/Project1.dpr
+++ b/PythonForDelphi/Demos/Demo08/Project1.dpr
@@ -3,12 +3,7 @@ program Project1;
{$I Definition.Inc}
uses
-{$IFDEF MSWINDOWS}
Forms,
-{$ENDIF}
-{$IFDEF LINUX}
- QForms,
-{$ENDIF}
Unit1 in 'Unit1.pas' {Form1};
{$R *.res}
diff --git a/PythonForDelphi/Demos/Demo08/Project1.kof b/PythonForDelphi/Demos/Demo08/Project1.kof
deleted file mode 100644
index 6ad26fc6..00000000
--- a/PythonForDelphi/Demos/Demo08/Project1.kof
+++ /dev/null
@@ -1,61 +0,0 @@
-[Compiler]
-A=8
-B=0
-C=1
-D=1
-E=0
-F=0
-G=1
-H=1
-I=1
-J=0
-K=0
-L=1
-M=0
-N=1
-O=1
-P=1
-Q=0
-R=0
-S=0
-T=0
-U=0
-V=1
-W=0
-X=1
-Y=1
-Z=1
-ShowHints=1
-ShowWarnings=1
-UnitAliases=
-
-[Linker]
-MapFile=0
-OutputObjs=0
-ConsoleApp=1
-DebugInfo=0
-RemoteSymbols=0
-MinStackSize=16384
-MaxStackSize=1048576
-ImageBase=4194304
-ExeDescription=
-DynamicLoader=/lib/ld-linux.so.2
-
-[Directories]
-OutputDir=
-UnitOutputDir=
-PackageDLLOutputDir=
-PackageDCPOutputDir=
-SearchPath=
-Packages=
-Conditionals=
-DebugSourceDirs=
-UsePackages=0
-
-[Parameters]
-RunParams=
-HostApplication=
-Launcher=/usr/X11R6/bin/xterm -T KylixDebuggerOutput -e bash -i -c %debuggee%
-UseLauncher=0
-DebugCWD=
-
diff --git a/PythonForDelphi/Demos/Demo08/Unit1.pas b/PythonForDelphi/Demos/Demo08/Unit1.pas
index cebfa3d8..a544e55d 100644
--- a/PythonForDelphi/Demos/Demo08/Unit1.pas
+++ b/PythonForDelphi/Demos/Demo08/Unit1.pas
@@ -6,13 +6,8 @@ interface
uses
SysUtils, Classes,
-{$IFDEF MSWINDOWS}
Windows, Messages, Graphics, Controls, Forms, Dialogs,
StdCtrls, ExtCtrls, ComCtrls,
-{$ENDIF}
-{$IFDEF LINUX}
- QForms, QStdCtrls, QControls, QExtCtrls,
-{$ENDIF}
PythonEngine, PythonGUIInputOutput;
type
@@ -29,9 +24,9 @@ TForm1 = class(TForm)
procedure Button1Click(Sender: TObject);
procedure PythonType1Initialization(Sender: TObject);
private
- { Déclarations privées }
+ { D�clarations priv�es }
public
- { Déclarations publiques }
+ { D�clarations publiques }
end;
// This is a Delphi class implementing a new Python type
diff --git a/PythonForDelphi/Demos/Demo09/Project1.conf b/PythonForDelphi/Demos/Demo09/Project1.conf
deleted file mode 100644
index 84e6d103..00000000
--- a/PythonForDelphi/Demos/Demo09/Project1.conf
+++ /dev/null
@@ -1,32 +0,0 @@
--$A8
--$B-
--$C+
--$D+
--$E-
--$F-
--$G+
--$H+
--$I+
--$J-
--$K-
--$L+
--$M-
--$N+
--$O+
--$P+
--$Q-
--$R-
--$S-
--$T-
--$U-
--$V+
--$W-
--$X+
--$YD
--$Z1
--cg
--H+
--W+
--M
--$M16384,1048576
--K$00400000
diff --git a/PythonForDelphi/Demos/Demo09/Project1.dof b/PythonForDelphi/Demos/Demo09/Project1.dof
deleted file mode 100644
index c24dad24..00000000
--- a/PythonForDelphi/Demos/Demo09/Project1.dof
+++ /dev/null
@@ -1,150 +0,0 @@
-[FileVersion]
-Version=7.0
-[Compiler]
-A=8
-B=0
-C=1
-D=1
-E=0
-F=0
-G=1
-H=1
-I=1
-J=1
-K=0
-L=1
-M=0
-N=1
-O=0
-P=1
-Q=0
-R=0
-S=0
-T=0
-U=0
-V=1
-W=0
-X=1
-Y=1
-Z=1
-ShowHints=1
-ShowWarnings=1
-UnitAliases=WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;
-NamespacePrefix=
-SymbolDeprecated=1
-SymbolLibrary=1
-SymbolPlatform=1
-UnitLibrary=1
-UnitPlatform=1
-UnitDeprecated=1
-HResultCompat=1
-HidingMember=1
-HiddenVirtual=1
-Garbage=1
-BoundsError=1
-ZeroNilCompat=1
-StringConstTruncated=1
-ForLoopVarVarPar=1
-TypedConstVarPar=1
-AsgToTypedConst=1
-CaseLabelRange=1
-ForVariable=1
-ConstructingAbstract=1
-ComparisonFalse=1
-ComparisonTrue=1
-ComparingSignedUnsigned=1
-CombiningSignedUnsigned=1
-UnsupportedConstruct=1
-FileOpen=1
-FileOpenUnitSrc=1
-BadGlobalSymbol=1
-DuplicateConstructorDestructor=1
-InvalidDirective=1
-PackageNoLink=1
-PackageThreadVar=1
-ImplicitImport=1
-HPPEMITIgnored=1
-NoRetVal=1
-UseBeforeDef=1
-ForLoopVarUndef=1
-UnitNameMismatch=1
-NoCFGFileFound=1
-MessageDirective=1
-ImplicitVariants=1
-UnicodeToLocale=1
-LocaleToUnicode=1
-ImagebaseMultiple=1
-SuspiciousTypecast=1
-PrivatePropAccessor=1
-UnsafeType=0
-UnsafeCode=0
-UnsafeCast=0
-[Linker]
-MapFile=0
-OutputObjs=0
-ConsoleApp=1
-DebugInfo=0
-RemoteSymbols=0
-MinStackSize=16384
-MaxStackSize=1048576
-ImageBase=4194304
-ExeDescription=
-[Directories]
-OutputDir=
-UnitOutputDir=
-PackageDLLOutputDir=
-PackageDCPOutputDir=
-SearchPath=
-Packages=Vcl50;Vclx50;VclSmp50;Vcldb50;vclado50;ibevnt50;Vclbde50;vcldbx50;Qrpt50;VCLIB50;Vclmid50;vclie50;Inetdb50;Inet50;NMFast50;webmid50;dclocx50;dclaxserver50;Indy50;VM;rbCIDE55;rbIDE55;rbRCL55;rbBDE55;rbDBDE55;rbDAD55;rbDIDE55;rbUSER55;rbDB55;rbADO55;rbIBE55;VMREPORTBUILDER
-Conditionals=
-DebugSourceDirs=
-UsePackages=0
-[Parameters]
-RunParams=
-HostApplication=
-Launcher=
-UseLauncher=0
-DebugCWD=
-[Language]
-ActiveLang=
-ProjectLang=$00000409
-RootDir=
-[Version Info]
-IncludeVerInfo=0
-AutoIncBuild=0
-MajorVer=1
-MinorVer=0
-Release=0
-Build=0
-Debug=0
-PreRelease=0
-Special=0
-Private=0
-DLL=0
-Locale=1033
-CodePage=1252
-[Version Info Keys]
-CompanyName=
-FileDescription=
-FileVersion=1.0.0.0
-InternalName=
-LegalCopyright=
-LegalTrademarks=
-OriginalFilename=
-ProductName=
-ProductVersion=1.0.0.0
-Comments=
-[Excluded Packages]
-C:\Program Files\Developer Express Inc\ExpressPrinting System\Delphi 7\Lib\dxPSTLLnkD7.bpl=ExpressPrinting System ReportLink for ExpressQuantumTreeList by Developer Express Inc.
-C:\Program Files\Developer Express Inc\ExpressPrinting System\Delphi 7\Lib\dxPSdxDBTLLnkD7.bpl=ExpressPrinting System ReportLink for ExpressQuantumDBTreeList by Developer Express Inc.
-C:\Program Files\Developer Express Inc\ExpressPrinting System\Delphi 7\Lib\dxPSdxDBGrLnkD7.bpl=ExpressPrinting System ReportLink for ExpressQuantumGrid by Developer Express Inc.
-C:\Program Files\Developer Express Inc\ExpressPrinting System\Delphi 7\Lib\dxPSdxDBTVLnkD7.bpl=ExpressPrinting System ReportLink for ExpressDBTree by Developer Express Inc.
-C:\Program Files\Developer Express Inc\ExpressPrinting System\Delphi 7\Lib\dxPSdxInsLnkD7.bpl=ExpressPrinting System ReportLink for ExpressInspector by Developer Express Inc.
-C:\Program Files\Developer Express Inc\ExpressPrinting System\Delphi 7\Lib\dxPSdxOILnkD7.bpl=ExpressPrinting System ReportLink for ExpressRTTIInspector by Developer Express Inc.
-C:\Program Files\Developer Express Inc\ExpressPrinting System\Delphi 7\Lib\dxPSdxMVLnkD7.bpl=ExpressPrinting System ReportLink for ExpressMasterView by Developer Express Inc.
-C:\Program Files\Developer Express Inc\ExpressPrinting System\Delphi 7\Lib\dxPSdxOCLnkD7.bpl=ExpressPrinting System ReportLinks for ExpressOrgChart by Developer Express Inc.
-C:\Program Files\Developer Express Inc\ExpressPrinting System\Delphi 7\Lib\dxPSdxDBOCLnkD7.bpl=ExpressPrinting System ReportLinks for ExpressDBOrgChart by Developer Express Inc.
-C:\Program Files\Developer Express Inc\ExpressPrinting System\Delphi 7\Lib\dxPSdxFCLnkD7.bpl=ExpressPrinting System ReportLinks for ExpressFlowChart by Developer Express Inc.
-C:\Program Files\Developer Express Inc\ExpressPrinting System\Delphi 7\Lib\dxPSdxLCLnkD7.bpl=ExpressPrinting System ReportLink for ExpressLayoutControl by Developer Express Inc.
-C:\Program Files\Developer Express Inc\ExpressPrinting System\Delphi 7\Lib\dxPscxTLLnkD7.bpl=ExpressPrinting System ReportLink for ExpressQuantumTreeList 4 by Developer Express Inc.
-C:\Program Files\Developer Express Inc\ExpressPrinting System\Delphi 7\Lib\dxPScxPCProdD7.bpl=ExpressPrinting System ContainerProducer for ExpressPageControl 2 by Developer Express Inc.
diff --git a/PythonForDelphi/Demos/Demo09/Project1.dpr b/PythonForDelphi/Demos/Demo09/Project1.dpr
index 37535427..7a68fc98 100644
--- a/PythonForDelphi/Demos/Demo09/Project1.dpr
+++ b/PythonForDelphi/Demos/Demo09/Project1.dpr
@@ -1,17 +1,9 @@
-// JCL_DEBUG_EXPERT_GENERATEJDBG OFF
-// JCL_DEBUG_EXPERT_INSERTJDBG OFF
-// JCL_DEBUG_EXPERT_DELETEMAPFILE OFF
program Project1;
{$I Definition.Inc}
uses
-{$IFDEF MSWINDOWS}
Forms,
-{$ENDIF}
-{$IFDEF LINUX}
- QForms,
-{$ENDIF}
Unit1 in 'Unit1.pas' {Form1};
{$R *.res}
diff --git a/PythonForDelphi/Demos/Demo09/Project1.kof b/PythonForDelphi/Demos/Demo09/Project1.kof
deleted file mode 100644
index 6ad26fc6..00000000
--- a/PythonForDelphi/Demos/Demo09/Project1.kof
+++ /dev/null
@@ -1,61 +0,0 @@
-[Compiler]
-A=8
-B=0
-C=1
-D=1
-E=0
-F=0
-G=1
-H=1
-I=1
-J=0
-K=0
-L=1
-M=0
-N=1
-O=1
-P=1
-Q=0
-R=0
-S=0
-T=0
-U=0
-V=1
-W=0
-X=1
-Y=1
-Z=1
-ShowHints=1
-ShowWarnings=1
-UnitAliases=
-
-[Linker]
-MapFile=0
-OutputObjs=0
-ConsoleApp=1
-DebugInfo=0
-RemoteSymbols=0
-MinStackSize=16384
-MaxStackSize=1048576
-ImageBase=4194304
-ExeDescription=
-DynamicLoader=/lib/ld-linux.so.2
-
-[Directories]
-OutputDir=
-UnitOutputDir=
-PackageDLLOutputDir=
-PackageDCPOutputDir=
-SearchPath=
-Packages=
-Conditionals=
-DebugSourceDirs=
-UsePackages=0
-
-[Parameters]
-RunParams=
-HostApplication=
-Launcher=/usr/X11R6/bin/xterm -T KylixDebuggerOutput -e bash -i -c %debuggee%
-UseLauncher=0
-DebugCWD=
-
diff --git a/PythonForDelphi/Demos/Demo09/Unit1.pas b/PythonForDelphi/Demos/Demo09/Unit1.pas
index bdd9ebd6..add003b0 100644
--- a/PythonForDelphi/Demos/Demo09/Unit1.pas
+++ b/PythonForDelphi/Demos/Demo09/Unit1.pas
@@ -6,13 +6,8 @@ interface
uses
SysUtils, Classes,
-{$IFDEF MSWINDOWS}
Windows, Messages, Graphics, Controls, Forms, Dialogs,
StdCtrls, ExtCtrls, ComCtrls,
-{$ENDIF}
-{$IFDEF LINUX}
- QForms, QStdCtrls, QControls, QExtCtrls,
-{$ENDIF}
PythonEngine, PythonGUIInputOutput;
type
@@ -26,9 +21,7 @@ TForm1 = class(TForm)
Memo2: TMemo;
procedure Button1Click(Sender: TObject);
private
- { Déclarations privées }
public
- { Déclarations publiques }
end;
var
diff --git a/PythonForDelphi/Demos/Demo09/demodll.conf b/PythonForDelphi/Demos/Demo09/demodll.conf
deleted file mode 100644
index bb7b1251..00000000
--- a/PythonForDelphi/Demos/Demo09/demodll.conf
+++ /dev/null
@@ -1,34 +0,0 @@
--$A8
--$B-
--$C+
--$D+
--$E-
--$F-
--$G+
--$H+
--$I+
--$J-
--$K-
--$L+
--$M-
--$N+
--$O+
--$P+
--$Q-
--$R-
--$S-
--$T-
--$U-
--$V+
--$W-
--$X+
--$YD
--$Z1
--cg
--vn
--vr
--H+
--W+
--M
--$M16384,1048576
--K$00400000
diff --git a/PythonForDelphi/Demos/Demo09/demodll.dof b/PythonForDelphi/Demos/Demo09/demodll.dof
deleted file mode 100644
index 555135df..00000000
--- a/PythonForDelphi/Demos/Demo09/demodll.dof
+++ /dev/null
@@ -1,150 +0,0 @@
-[FileVersion]
-Version=7.0
-[Compiler]
-A=8
-B=0
-C=1
-D=1
-E=0
-F=0
-G=1
-H=1
-I=1
-J=1
-K=0
-L=1
-M=0
-N=1
-O=1
-P=1
-Q=0
-R=0
-S=0
-T=0
-U=0
-V=1
-W=0
-X=1
-Y=1
-Z=1
-ShowHints=1
-ShowWarnings=1
-UnitAliases=WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;
-NamespacePrefix=
-SymbolDeprecated=1
-SymbolLibrary=1
-SymbolPlatform=1
-UnitLibrary=1
-UnitPlatform=1
-UnitDeprecated=1
-HResultCompat=1
-HidingMember=1
-HiddenVirtual=1
-Garbage=1
-BoundsError=1
-ZeroNilCompat=1
-StringConstTruncated=1
-ForLoopVarVarPar=1
-TypedConstVarPar=1
-AsgToTypedConst=1
-CaseLabelRange=1
-ForVariable=1
-ConstructingAbstract=1
-ComparisonFalse=1
-ComparisonTrue=1
-ComparingSignedUnsigned=1
-CombiningSignedUnsigned=1
-UnsupportedConstruct=1
-FileOpen=1
-FileOpenUnitSrc=1
-BadGlobalSymbol=1
-DuplicateConstructorDestructor=1
-InvalidDirective=1
-PackageNoLink=1
-PackageThreadVar=1
-ImplicitImport=1
-HPPEMITIgnored=1
-NoRetVal=1
-UseBeforeDef=1
-ForLoopVarUndef=1
-UnitNameMismatch=1
-NoCFGFileFound=1
-MessageDirective=1
-ImplicitVariants=1
-UnicodeToLocale=1
-LocaleToUnicode=1
-ImagebaseMultiple=1
-SuspiciousTypecast=1
-PrivatePropAccessor=1
-UnsafeType=0
-UnsafeCode=0
-UnsafeCast=0
-[Linker]
-MapFile=0
-OutputObjs=0
-ConsoleApp=1
-DebugInfo=0
-RemoteSymbols=0
-MinStackSize=16384
-MaxStackSize=1048576
-ImageBase=4194304
-ExeDescription=
-[Directories]
-OutputDir=
-UnitOutputDir=
-PackageDLLOutputDir=
-PackageDCPOutputDir=
-SearchPath=
-Packages=Vcl50;Vclx50;VclSmp50;Vcldb50;vclado50;ibevnt50;Vclbde50;vcldbx50;Qrpt50;VCLIB50;Vclmid50;vclie50;Inetdb50;Inet50;NMFast50;webmid50;dclocx50;dclaxserver50;Indy50;VM;rbCIDE55;rbIDE55;rbRCL55;rbBDE55;rbDBDE55;rbDAD55;rbDIDE55;rbUSER55;rbDB55;rbADO55;rbIBE55;VMREPORTBUILDER
-Conditionals=
-DebugSourceDirs=
-UsePackages=0
-[Parameters]
-RunParams=
-HostApplication=
-Launcher=
-UseLauncher=0
-DebugCWD=
-[Language]
-ActiveLang=
-ProjectLang=$00000409
-RootDir=
-[Version Info]
-IncludeVerInfo=0
-AutoIncBuild=0
-MajorVer=1
-MinorVer=0
-Release=0
-Build=0
-Debug=0
-PreRelease=0
-Special=0
-Private=0
-DLL=0
-Locale=1033
-CodePage=1252
-[Version Info Keys]
-CompanyName=
-FileDescription=
-FileVersion=1.0.0.0
-InternalName=
-LegalCopyright=
-LegalTrademarks=
-OriginalFilename=
-ProductName=
-ProductVersion=1.0.0.0
-Comments=
-[Excluded Packages]
-C:\Program Files\Developer Express Inc\ExpressPrinting System\Delphi 7\Lib\dxPSTLLnkD7.bpl=ExpressPrinting System ReportLink for ExpressQuantumTreeList by Developer Express Inc.
-C:\Program Files\Developer Express Inc\ExpressPrinting System\Delphi 7\Lib\dxPSdxDBTLLnkD7.bpl=ExpressPrinting System ReportLink for ExpressQuantumDBTreeList by Developer Express Inc.
-C:\Program Files\Developer Express Inc\ExpressPrinting System\Delphi 7\Lib\dxPSdxDBGrLnkD7.bpl=ExpressPrinting System ReportLink for ExpressQuantumGrid by Developer Express Inc.
-C:\Program Files\Developer Express Inc\ExpressPrinting System\Delphi 7\Lib\dxPSdxDBTVLnkD7.bpl=ExpressPrinting System ReportLink for ExpressDBTree by Developer Express Inc.
-C:\Program Files\Developer Express Inc\ExpressPrinting System\Delphi 7\Lib\dxPSdxInsLnkD7.bpl=ExpressPrinting System ReportLink for ExpressInspector by Developer Express Inc.
-C:\Program Files\Developer Express Inc\ExpressPrinting System\Delphi 7\Lib\dxPSdxOILnkD7.bpl=ExpressPrinting System ReportLink for ExpressRTTIInspector by Developer Express Inc.
-C:\Program Files\Developer Express Inc\ExpressPrinting System\Delphi 7\Lib\dxPSdxMVLnkD7.bpl=ExpressPrinting System ReportLink for ExpressMasterView by Developer Express Inc.
-C:\Program Files\Developer Express Inc\ExpressPrinting System\Delphi 7\Lib\dxPSdxOCLnkD7.bpl=ExpressPrinting System ReportLinks for ExpressOrgChart by Developer Express Inc.
-C:\Program Files\Developer Express Inc\ExpressPrinting System\Delphi 7\Lib\dxPSdxDBOCLnkD7.bpl=ExpressPrinting System ReportLinks for ExpressDBOrgChart by Developer Express Inc.
-C:\Program Files\Developer Express Inc\ExpressPrinting System\Delphi 7\Lib\dxPSdxFCLnkD7.bpl=ExpressPrinting System ReportLinks for ExpressFlowChart by Developer Express Inc.
-C:\Program Files\Developer Express Inc\ExpressPrinting System\Delphi 7\Lib\dxPSdxLCLnkD7.bpl=ExpressPrinting System ReportLink for ExpressLayoutControl by Developer Express Inc.
-C:\Program Files\Developer Express Inc\ExpressPrinting System\Delphi 7\Lib\dxPscxTLLnkD7.bpl=ExpressPrinting System ReportLink for ExpressQuantumTreeList 4 by Developer Express Inc.
-C:\Program Files\Developer Express Inc\ExpressPrinting System\Delphi 7\Lib\dxPScxPCProdD7.bpl=ExpressPrinting System ContainerProducer for ExpressPageControl 2 by Developer Express Inc.
diff --git a/PythonForDelphi/Demos/Demo09/demodll.kof b/PythonForDelphi/Demos/Demo09/demodll.kof
deleted file mode 100644
index 44affd6b..00000000
--- a/PythonForDelphi/Demos/Demo09/demodll.kof
+++ /dev/null
@@ -1,61 +0,0 @@
-[Compiler]
-A=8
-B=0
-C=1
-D=1
-E=0
-F=0
-G=1
-H=1
-I=1
-J=0
-K=0
-L=1
-M=0
-N=1
-O=1
-P=1
-Q=0
-R=0
-S=0
-T=0
-U=0
-V=1
-W=0
-X=1
-Y=1
-Z=1
-ShowHints=1
-ShowWarnings=1
-UnitAliases=
-
-[Linker]
-MapFile=0
-OutputObjs=0
-ConsoleApp=1
-DebugInfo=1
-RemoteSymbols=1
-MinStackSize=16384
-MaxStackSize=1048576
-ImageBase=4194304
-ExeDescription=
-DynamicLoader=/lib/ld-linux.so.2
-
-[Directories]
-OutputDir=
-UnitOutputDir=
-PackageDLLOutputDir=
-PackageDCPOutputDir=
-SearchPath=
-Packages=baseclx:visualclx:visualdbclx:dataclx:netdataclx:netclx:indy:Python_kylix
-Conditionals=
-DebugSourceDirs=
-UsePackages=0
-
-[Parameters]
-RunParams=
-HostApplication=
-Launcher=/usr/X11R6/bin/xterm -T KylixDebuggerOutput -e bash -i -c %debuggee%
-UseLauncher=0
-DebugCWD=
-
diff --git a/PythonForDelphi/Demos/Demo10/Example2.py b/PythonForDelphi/Demos/Demo10/Example2.py
index 18e02925..6f699b6f 100644
--- a/PythonForDelphi/Demos/Demo10/Example2.py
+++ b/PythonForDelphi/Demos/Demo10/Example2.py
@@ -65,7 +65,7 @@ def PrintDocOf( inst ):
if type(inst).__doc__:
print type(inst).__doc__
print "Methods:"
- for i in inst.__methods__:
+ for i in inst.__members__:
doc = getattr(inst, i).__doc__
if doc:
print " ", doc
diff --git a/PythonForDelphi/Demos/Demo10/pyDB.pas b/PythonForDelphi/Demos/Demo10/pyDB.pas
index 5893136f..00c17cf3 100644
--- a/PythonForDelphi/Demos/Demo10/pyDB.pas
+++ b/PythonForDelphi/Demos/Demo10/pyDB.pas
@@ -1,5 +1,23 @@
+{$I Definition.Inc}
+
unit pyDB;
+{-------------------------------------------------------------------------------
+ $Header: /P4D/PythonForDelphi/Components/Sources/VCL/pyDB.pas 1 03-04-09 19:25 Morgan $
+ Copyright © MMM Inc. 2003 - All Rights Reserved.
+ ------------------------------------------------------------------------------
+ Author: Morgan Martinet
+
+ Description:
+
+ ------------------------------------------------------------------------------
+ $Log: /P4D/PythonForDelphi/Components/Sources/VCL/pyDB.pas $
+ *
+ * 1 03-04-09 19:25 Morgan
+ * initial check-in
+
+-------------------------------------------------------------------------------}
+
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
@@ -10,6 +28,15 @@ TCallBackSplit = record
self: TObject;
end;
+{*********************************************************************
+ * DB module *
+ *********************************************************************}
+ TPythonDB = class(TPythonModule)
+ public
+ constructor Create( AOwner : TComponent ); override;
+ procedure Initialize; override;
+ end;
+
{*********************************************************************
* Shared object *
*********************************************************************}
@@ -99,6 +126,11 @@ TPyField = class(TCommon)
procedure OnValidate( Sender : TField );
end;
+ TPythonField = class( TPythonType)
+ public
+ constructor Create( AOwner : TComponent ); override;
+ end;
+
{*********************************************************************
* Interface of TDataset *
*********************************************************************}
@@ -148,8 +180,8 @@ TPyDataset = class(TCommon)
function Repr : PPyObject; override;
// Sequence services
- function SqLength : Integer; override;
- function SqItem( idx : Integer ) : PPyObject; override;
+ function SqLength : NativeInt; override;
+ function SqItem( idx : NativeInt ) : PPyObject; override;
// Class methods
class procedure RegisterMethods( PythonType : TPythonType ); override;
@@ -216,6 +248,11 @@ TPyDataset = class(TCommon)
procedure OnPostError ( Dataset : TDataset; E: EDatabaseError; var Action: TDataAction );
end;
+ TPythonDataset = class( TPythonType)
+ public
+ constructor Create( AOwner : TComponent ); override;
+ end;
+
{*********************************************************************
* Interface of TVarArg *
*********************************************************************}
@@ -236,26 +273,116 @@ TVarArg = class(TPyObject)
function Repr : PPyObject; override;
end;
+ TPythonVarArg = class( TPythonType)
+ public
+ constructor Create( AOwner : TComponent ); override;
+ end;
+
{*********************************************************************
* Global functions *
*********************************************************************}
- procedure Initialize( Owner : TEngineClient );
+ procedure CreateComponents( AOwner : TComponent );
procedure SetEvent( var EventSlot : PPyObject; Event : PPyObject; const EventName, ClassName : String );
function SetDatasetEvent( EventSlot : PPyObject; dsEvent : TDataSetNotifyEvent ) : TDataSetNotifyEvent;
function SetDatasetErrorEvent( EventSlot : PPyObject; dsEvent : TDataSetErrorEvent ) : TDataSetErrorEvent;
procedure ClearEvent( var EventSlot : PPyObject );
function ReturnEvent( Event : PPyObject ) : PPyObject;
procedure ExecuteEvent( Event : PPyObject; Args : array of Const );
+ function NewDataset( aDataset : TDataset; IsOwner : Boolean ) : PPyObject;
{********************************************************************
* Global variables *
*********************************************************************}
var
+ gDatasetType : TPythonType;
gFieldType : TPythonType;
gVarArgType : TPythonType;
+ gDBModule : TPythonModule;
+
implementation
+{*********************************************************************
+ * DB module *
+ *********************************************************************}
+
+constructor TPythonDB.Create( AOwner : TComponent );
+begin
+ inherited;
+ ModuleName := 'DB';
+ Name := 'modDB';
+ with DocString do
+ begin
+ Add( 'This module contains several Object Types that' );
+ Add( 'will let you work with the Borland BDE and access' );
+ Add( 'a database.' );
+ Add( '' );
+ end;
+ with Errors.Add do
+ Name := 'DBError';
+end;
+
+procedure TPythonDB.Initialize;
+begin
+ inherited;
+ // Values for type TTableType
+ SetVarFromVariant( 'ttDefault', 0 );
+ SetVarFromVariant( 'ttParadox', 1 );
+ SetVarFromVariant( 'ttDBase', 2 );
+ SetVarFromVariant( 'ttASCII', 3 );
+ // Values for type TDatasetState
+ SetVarFromVariant( 'dsInactive', 0 );
+ SetVarFromVariant( 'dsBrowse', 1 );
+ SetVarFromVariant( 'dsEdit', 2 );
+ SetVarFromVariant( 'dsInsert', 3 );
+ SetVarFromVariant( 'dsSetKey', 4 );
+ SetVarFromVariant( 'dsCalcFields', 5 );
+ SetVarFromVariant( 'dsFilter', 6 );
+ SetVarFromVariant( 'dsNewValue', 7 );
+ SetVarFromVariant( 'dsOldValue', 8 );
+ SetVarFromVariant( 'dsCurValue', 9 );
+ // Values for type TFieldType
+ SetVarFromVariant( 'ftUnknown', 0 );
+ SetVarFromVariant( 'ftString', 1 );
+ SetVarFromVariant( 'ftSmallint', 2 );
+ SetVarFromVariant( 'ftInteger', 3 );
+ SetVarFromVariant( 'ftWord', 4 );
+ SetVarFromVariant( 'ftBoolean', 5 );
+ SetVarFromVariant( 'ftFloat', 6 );
+ SetVarFromVariant( 'ftCurrency', 7 );
+ SetVarFromVariant( 'ftBCD', 8 );
+ SetVarFromVariant( 'ftDate', 9 );
+ SetVarFromVariant( 'ftTime', 10 );
+ SetVarFromVariant( 'ftDateTime', 11 );
+ SetVarFromVariant( 'ftBytes', 12 );
+ SetVarFromVariant( 'ftVarBytes', 13 );
+ SetVarFromVariant( 'ftAutoInc', 14 );
+ SetVarFromVariant( 'ftBlob', 15 );
+ SetVarFromVariant( 'ftMemo', 16 );
+ SetVarFromVariant( 'ftGraphic', 17 );
+ SetVarFromVariant( 'ftFmtMemo', 18 );
+ SetVarFromVariant( 'ftParadoxOle', 19 );
+ SetVarFromVariant( 'ftDBaseOle', 20 );
+ SetVarFromVariant( 'ftTypedBinary', 21 );
+ SetVarFromVariant( 'ftCursor', 22 );
+ // Values for type TFieldKind
+ SetVarFromVariant( 'fkData', 0 );
+ SetVarFromVariant( 'fkCalculated', 1 );
+ SetVarFromVariant( 'fkLookup', 2 );
+ SetVarFromVariant( 'fkInternalCalc', 3 );
+ // Values for type TLocateOption
+ SetVarFromVariant( 'loCaseInsensitive', 0 );
+ SetVarFromVariant( 'loPartialKey', 1 );
+ // Values for type TDataAction
+ SetVarFromVariant( 'daFail', 0 );
+ SetVarFromVariant( 'daAbort', 1 );
+ SetVarFromVariant( 'daRetry', 2 );
+ // Values for type TUpdateKind
+ SetVarFromVariant( 'ukModify', 0 );
+ SetVarFromVariant( 'ukInsert', 1 );
+ SetVarFromVariant( 'ukDelete', 2 );
+end;
+
{*********************************************************************
* Shared object *
*********************************************************************}
@@ -342,7 +469,7 @@ procedure TCommon.AppendProp( List : PPyObject; const prop : String );
begin
with GetPythonEngine do
begin
- obj := PyString_FromString(PAnsiChar(prop));
+ obj := PyString_FromString(PAnsiChar(AnsiString(prop)));
PyList_Append( List, obj );
Py_XDecRef(obj);
end;
@@ -351,8 +478,8 @@ procedure TCommon.AppendProp( List : PPyObject; const prop : String );
function TCommon.GetAttr(key : PAnsiChar) : PPyObject;
begin
try
- if (CompareText( key, '__properties__' ) = 0) or
- (CompareText( key, '__members__' ) = 0) then
+ if (CompareText( string(key), '__properties__' ) = 0) or
+ (CompareText( string(key), '__members__' ) = 0) then
Result := GetProperties
else
Result := inherited GetAttr(key);
@@ -367,8 +494,8 @@ function TCommon.GetAttr(key : PAnsiChar) : PPyObject;
procedure TCommon.RaiseDBError( E : Exception );
begin
- if GetModule <> nil then
- GetModule.RaiseError( 'DBError', E.Message );
+ if gDBModule <> nil then
+ gDBModule.RaiseError( 'DBError', AnsiString(E.Message) );
end;
function TCommon.EventBelongsToObject( Event : TCallbackSplit ) : Boolean;
@@ -437,103 +564,103 @@ function TPyField.GetAttr(key : PAnsiChar) : PPyObject;
Exit;
end;
try
- if CompareText( key, 'Alignment' ) = 0 then
+ if CompareText( string(key), 'Alignment' ) = 0 then
Result := VariantAsPyObject( Integer(FField.Alignment) )
- else if CompareText( key, 'AsBoolean' ) = 0 then
+ else if CompareText( string(key), 'AsBoolean' ) = 0 then
Result := VariantAsPyObject( FField.AsBoolean )
- else if CompareText( key, 'AsDateTime' ) = 0 then
+ else if CompareText( string(key), 'AsDateTime' ) = 0 then
Result := VariantAsPyObject( FField.AsDateTime )
- else if CompareText( key, 'AsFloat' ) = 0 then
+ else if CompareText( string(key), 'AsFloat' ) = 0 then
Result := VariantAsPyObject( FField.AsFloat )
- else if CompareText( key, 'AsInteger' ) = 0 then
+ else if CompareText( string(key), 'AsInteger' ) = 0 then
Result := VariantAsPyObject( FField.AsInteger )
- else if CompareText( key, 'AsString' ) = 0 then
+ else if CompareText( string(key), 'AsString' ) = 0 then
Result := VariantAsPyObject( FField.AsString )
- else if CompareText( key, 'CanModify' ) = 0 then
+ else if CompareText( string(key), 'CanModify' ) = 0 then
Result := VariantAsPyObject( FField.CanModify )
- else if CompareText( key, 'ConstraintErrorMessage' ) = 0 then
+ else if CompareText( string(key), 'ConstraintErrorMessage' ) = 0 then
Result := VariantAsPyObject( FField.ConstraintErrorMessage )
- else if CompareText( key, 'CurValue' ) = 0 then
+ else if CompareText( string(key), 'CurValue' ) = 0 then
Result := VariantAsPyObject( FField.CurValue )
- else if CompareText( key, 'CustomConstraint' ) = 0 then
+ else if CompareText( string(key), 'CustomConstraint' ) = 0 then
Result := VariantAsPyObject( FField.CustomConstraint )
- else if CompareText( key, 'DataSize' ) = 0 then
+ else if CompareText( string(key), 'DataSize' ) = 0 then
Result := VariantAsPyObject( FField.DataSize )
- else if CompareText( key, 'DataType' ) = 0 then
+ else if CompareText( string(key), 'DataType' ) = 0 then
Result := VariantAsPyObject( FField.DataType )
- else if CompareText( key, 'DefaultExpression' ) = 0 then
+ else if CompareText( string(key), 'DefaultExpression' ) = 0 then
Result := VariantAsPyObject( FField.DefaultExpression )
- else if CompareText( key, 'DisplayLabel' ) = 0 then
+ else if CompareText( string(key), 'DisplayLabel' ) = 0 then
Result := VariantAsPyObject( FField.DisplayLabel )
- else if CompareText( key, 'DisplayName' ) = 0 then
+ else if CompareText( string(key), 'DisplayName' ) = 0 then
Result := VariantAsPyObject( FField.DisplayName )
- else if CompareText( key, 'DisplayText' ) = 0 then
+ else if CompareText( string(key), 'DisplayText' ) = 0 then
Result := VariantAsPyObject( FField.DisplayText )
- else if CompareText( key, 'DisplayWidth' ) = 0 then
+ else if CompareText( string(key), 'DisplayWidth' ) = 0 then
Result := VariantAsPyObject( FField.DisplayWidth )
- else if CompareText( key, 'EditMask' ) = 0 then
+ else if CompareText( string(key), 'EditMask' ) = 0 then
Result := VariantAsPyObject( FField.EditMask )
- else if CompareText( key, 'FieldKind' ) = 0 then
+ else if CompareText( string(key), 'FieldKind' ) = 0 then
Result := VariantAsPyObject( FField.FieldKind )
- else if CompareText( key, 'FieldName' ) = 0 then
+ else if CompareText( string(key), 'FieldName' ) = 0 then
Result := VariantAsPyObject( FField.FieldName)
- else if CompareText( key, 'FieldNo' ) = 0 then
+ else if CompareText( string(key), 'FieldNo' ) = 0 then
Result := VariantAsPyObject( FField.FieldNo )
- else if CompareText( key, 'HasConstraints' ) = 0 then
+ else if CompareText( string(key), 'HasConstraints' ) = 0 then
Result := VariantAsPyObject( FField.HasConstraints )
- else if CompareText( key, 'ImportedConstraint' ) = 0 then
+ else if CompareText( string(key), 'ImportedConstraint' ) = 0 then
Result := VariantAsPyObject( FField.ImportedConstraint )
- else if CompareText( key, 'Index' ) = 0 then
+ else if CompareText( string(key), 'Index' ) = 0 then
Result := VariantAsPyObject( FField.Index )
- else if CompareText( key, 'IsBlob' ) = 0 then
+ else if CompareText( string(key), 'IsBlob' ) = 0 then
Result := VariantAsPyObject( FField.IsBlob)
- else if CompareText( key, 'IsIndexField' ) = 0 then
+ else if CompareText( string(key), 'IsIndexField' ) = 0 then
Result := VariantAsPyObject( FField.IsIndexField )
- else if CompareText( key, 'IsNull' ) = 0 then
+ else if CompareText( string(key), 'IsNull' ) = 0 then
Result := VariantAsPyObject( FField.IsNull )
- else if CompareText( key, 'KeyFields' ) = 0 then
+ else if CompareText( string(key), 'KeyFields' ) = 0 then
Result := VariantAsPyObject( FField.KeyFields )
- else if CompareText( key, 'Lookup' ) = 0 then
+ else if CompareText( string(key), 'Lookup' ) = 0 then
Result := VariantAsPyObject( FField.Lookup )
- else if CompareText( key, 'LookupCache' ) = 0 then
+ else if CompareText( string(key), 'LookupCache' ) = 0 then
Result := VariantAsPyObject( FField.LookupCache )
- else if CompareText( key, 'LookupDataset' ) = 0 then
+ else if CompareText( string(key), 'LookupDataset' ) = 0 then
Result := ReturnNone
- else if CompareText( key, 'LookupKeyFields' ) = 0 then
+ else if CompareText( string(key), 'LookupKeyFields' ) = 0 then
Result := VariantAsPyObject( FField.LookupKeyFields )
- else if CompareText( key, 'LookupList' ) = 0 then
+ else if CompareText( string(key), 'LookupList' ) = 0 then
Result := ReturnNone
- else if CompareText( key, 'LookupResultField' ) = 0 then
+ else if CompareText( string(key), 'LookupResultField' ) = 0 then
Result := VariantAsPyObject( FField.LookupResultField )
- else if CompareText( key, 'NewValue' ) = 0 then
+ else if CompareText( string(key), 'NewValue' ) = 0 then
Result := VariantAsPyObject( FField.NewValue )
- else if CompareText( key, 'Offset' ) = 0 then
+ else if CompareText( string(key), 'Offset' ) = 0 then
Result := VariantAsPyObject( FField.Offset )
- else if CompareText( key, 'OldValue' ) = 0 then
+ else if CompareText( string(key), 'OldValue' ) = 0 then
Result := VariantAsPyObject( FField.OldValue )
- else if CompareText( key, 'Origin' ) = 0 then
+ else if CompareText( string(key), 'Origin' ) = 0 then
Result := VariantAsPyObject( FField.Origin )
- else if CompareText( key, 'ReadOnly' ) = 0 then
+ else if CompareText( string(key), 'ReadOnly' ) = 0 then
Result := VariantAsPyObject( FField.ReadOnly )
- else if CompareText( key, 'Required' ) = 0 then
+ else if CompareText( string(key), 'Required' ) = 0 then
Result := VariantAsPyObject( FField.Required )
- else if CompareText( key, 'Size' ) = 0 then
+ else if CompareText( string(key), 'Size' ) = 0 then
Result := VariantAsPyObject( FField.Size )
- else if CompareText( key, 'Text' ) = 0 then
+ else if CompareText( string(key), 'Text' ) = 0 then
Result := VariantAsPyObject( FField.Text )
- else if CompareText( key, 'ValidChars' ) = 0 then
+ else if CompareText( string(key), 'ValidChars' ) = 0 then
Result := ReturnNone
- else if CompareText( key, 'Value' ) = 0 then
+ else if CompareText( string(key), 'Value' ) = 0 then
Result := VariantAsPyObject( FField.Value )
- else if CompareText( key, 'Visible' ) = 0 then
+ else if CompareText( string(key), 'Visible' ) = 0 then
Result := VariantAsPyObject( FField.Visible )
- else if CompareText( key, 'OnChange' ) = 0 then
+ else if CompareText( string(key), 'OnChange' ) = 0 then
Result := ReturnEvent( FOnChange )
- else if CompareText( key, 'OnGetText' ) = 0 then
+ else if CompareText( string(key), 'OnGetText' ) = 0 then
Result := ReturnEvent( FOnGetText )
- else if CompareText( key, 'OnSetText' ) = 0 then
+ else if CompareText( string(key), 'OnSetText' ) = 0 then
Result := ReturnEvent( FOnSetText )
- else if CompareText( key, 'OnValidate' ) = 0 then
+ else if CompareText( string(key), 'OnValidate' ) = 0 then
Result := ReturnEvent( FOnValidate )
else
Result := inherited GetAttr(key);
@@ -555,216 +682,216 @@ function TPyField.SetAttr(key : PAnsiChar; value : PPyObject) : Integer;
if not CheckField then
Exit;
try
- if CompareText( key, 'Alignment' ) = 0 then
+ if CompareText( string(key), 'Alignment' ) = 0 then
begin
FField.Alignment := TAlignment(PyObjectAsVariant( value ));
Result := 0;
end
- else if CompareText( key, 'AsBoolean' ) = 0 then
+ else if CompareText( string(key), 'AsBoolean' ) = 0 then
begin
FField.AsBoolean := PyObjectAsVariant( value );
Result := 0;
end
- else if CompareText( key, 'AsDateTime' ) = 0 then
+ else if CompareText( string(key), 'AsDateTime' ) = 0 then
begin
FField.AsDateTime := PyObjectAsVariant( value );
Result := 0;
end
- else if CompareText( key, 'AsFloat' ) = 0 then
+ else if CompareText( string(key), 'AsFloat' ) = 0 then
begin
FField.AsFloat := PyObjectAsVariant( value );
Result := 0;
end
- else if CompareText( key, 'AsInteger' ) = 0 then
+ else if CompareText( string(key), 'AsInteger' ) = 0 then
begin
FField.AsInteger := PyObjectAsVariant( value );
Result := 0;
end
- else if CompareText( key, 'AsString' ) = 0 then
+ else if CompareText( string(key), 'AsString' ) = 0 then
begin
FField.AsString := PyObjectAsVariant( value );
Result := 0;
end
- else if CompareText( key, 'CanModify' ) = 0 then
+ else if CompareText( string(key), 'CanModify' ) = 0 then
begin
Result := 0;
end
- else if CompareText( key, 'ConstraintErrorMessage' ) = 0 then
+ else if CompareText( string(key), 'ConstraintErrorMessage' ) = 0 then
begin
FField.ConstraintErrorMessage := PyObjectAsVariant( value );
Result := 0;
end
- else if CompareText( key, 'CurValue' ) = 0 then
+ else if CompareText( string(key), 'CurValue' ) = 0 then
begin
Result := 0;
end
- else if CompareText( key, 'CustomConstraint' ) = 0 then
+ else if CompareText( string(key), 'CustomConstraint' ) = 0 then
begin
FField.CustomConstraint := PyObjectAsVariant( value );
Result := 0;
end
- else if CompareText( key, 'DataSize' ) = 0 then
+ else if CompareText( string(key), 'DataSize' ) = 0 then
begin
Result := 0;
end
- else if CompareText( key, 'DataType' ) = 0 then
+ else if CompareText( string(key), 'DataType' ) = 0 then
begin
Result := 0;
end
- else if CompareText( key, 'DefaultExpression' ) = 0 then
+ else if CompareText( string(key), 'DefaultExpression' ) = 0 then
begin
FField.DefaultExpression := PyObjectAsVariant( value );
Result := 0;
end
- else if CompareText( key, 'DisplayLabel' ) = 0 then
+ else if CompareText( string(key), 'DisplayLabel' ) = 0 then
begin
FField.DisplayLabel := PyObjectAsVariant( value );
Result := 0;
end
- else if CompareText( key, 'DisplayName' ) = 0 then
+ else if CompareText( string(key), 'DisplayName' ) = 0 then
begin
Result := 0;
end
- else if CompareText( key, 'DisplayText' ) = 0 then
+ else if CompareText( string(key), 'DisplayText' ) = 0 then
begin
Result := 0;
end
- else if CompareText( key, 'DisplayWidth' ) = 0 then
+ else if CompareText( string(key), 'DisplayWidth' ) = 0 then
begin
FField.DisplayWidth := PyObjectAsVariant( value );
Result := 0;
end
- else if CompareText( key, 'EditMask' ) = 0 then
+ else if CompareText( string(key), 'EditMask' ) = 0 then
begin
FField.EditMask := PyObjectAsVariant( value );
Result := 0;
end
- else if CompareText( key, 'FieldKind' ) = 0 then
+ else if CompareText( string(key), 'FieldKind' ) = 0 then
begin
FField.FieldKind := PyObjectAsVariant( value );
Result := 0;
end
- else if CompareText( key, 'FieldName' ) = 0 then
+ else if CompareText( string(key), 'FieldName' ) = 0 then
begin
FField.FieldName:= PyObjectAsVariant( value );
Result := 0;
end
- else if CompareText( key, 'FieldNo' ) = 0 then
+ else if CompareText( string(key), 'FieldNo' ) = 0 then
begin
Result := 0;
end
- else if CompareText( key, 'HasConstraints' ) = 0 then
+ else if CompareText( string(key), 'HasConstraints' ) = 0 then
begin
Result := 0;
end
- else if CompareText( key, 'ImportedConstraint' ) = 0 then
+ else if CompareText( string(key), 'ImportedConstraint' ) = 0 then
begin
FField.ImportedConstraint := PyObjectAsVariant( value );
Result := 0;
end
- else if CompareText( key, 'Index' ) = 0 then
+ else if CompareText( string(key), 'Index' ) = 0 then
begin
FField.Index := PyObjectAsVariant( value );
Result := 0;
end
- else if CompareText( key, 'IsBlob' ) = 0 then
+ else if CompareText( string(key), 'IsBlob' ) = 0 then
begin
Result := 0;
end
- else if CompareText( key, 'IsIndexField' ) = 0 then
+ else if CompareText( string(key), 'IsIndexField' ) = 0 then
begin
Result := 0;
end
- else if CompareText( key, 'IsNull' ) = 0 then
+ else if CompareText( string(key), 'IsNull' ) = 0 then
begin
Result := 0;
end
- else if CompareText( key, 'KeyFields' ) = 0 then
+ else if CompareText( string(key), 'KeyFields' ) = 0 then
begin
FField.KeyFields := PyObjectAsVariant( value );
Result := 0;
end
- else if CompareText( key, 'Lookup' ) = 0 then
+ else if CompareText( string(key), 'Lookup' ) = 0 then
begin
FField.Lookup := PyObjectAsVariant( value );
Result := 0;
end
- else if CompareText( key, 'LookupCache' ) = 0 then
+ else if CompareText( string(key), 'LookupCache' ) = 0 then
begin
FField.LookupCache := PyObjectAsVariant( value );
Result := 0;
end
- else if CompareText( key, 'LookupDataset' ) = 0 then
+ else if CompareText( string(key), 'LookupDataset' ) = 0 then
begin
Result := 0;
end
- else if CompareText( key, 'LookupKeyFields' ) = 0 then
+ else if CompareText( string(key), 'LookupKeyFields' ) = 0 then
begin
FField.LookupKeyFields := PyObjectAsVariant( value );
Result := 0;
end
- else if CompareText( key, 'LookupList' ) = 0 then
+ else if CompareText( string(key), 'LookupList' ) = 0 then
begin
Result := 0;
end
- else if CompareText( key, 'LookupResultField' ) = 0 then
+ else if CompareText( string(key), 'LookupResultField' ) = 0 then
begin
FField.LookupResultField := PyObjectAsVariant( value );
Result := 0;
end
- else if CompareText( key, 'NewValue' ) = 0 then
+ else if CompareText( string(key), 'NewValue' ) = 0 then
begin
FField.NewValue := PyObjectAsVariant( value );
Result := 0;
end
- else if CompareText( key, 'Offset' ) = 0 then
+ else if CompareText( string(key), 'Offset' ) = 0 then
begin
Result := 0;
end
- else if CompareText( key, 'OldValue' ) = 0 then
+ else if CompareText( string(key), 'OldValue' ) = 0 then
begin
Result := 0;
end
- else if CompareText( key, 'Origin' ) = 0 then
+ else if CompareText( string(key), 'Origin' ) = 0 then
begin
FField.Origin := PyObjectAsVariant( value );
Result := 0;
end
- else if CompareText( key, 'ReadOnly' ) = 0 then
+ else if CompareText( string(key), 'ReadOnly' ) = 0 then
begin
FField.ReadOnly := PyObjectAsVariant( value );
Result := 0;
end
- else if CompareText( key, 'Required' ) = 0 then
+ else if CompareText( string(key), 'Required' ) = 0 then
begin
FField.Required := PyObjectAsVariant( value );
Result := 0;
end
- else if CompareText( key, 'Size' ) = 0 then
+ else if CompareText( string(key), 'Size' ) = 0 then
begin
FField.Size := PyObjectAsVariant( value );
Result := 0;
end
- else if CompareText( key, 'Text' ) = 0 then
+ else if CompareText( string(key), 'Text' ) = 0 then
begin
FField.Text := PyObjectAsVariant( value );
Result := 0;
end
- else if CompareText( key, 'ValidChars' ) = 0 then
+ else if CompareText( string(key), 'ValidChars' ) = 0 then
begin
Result := 0;
end
- else if CompareText( key, 'Value' ) = 0 then
+ else if CompareText( string(key), 'Value' ) = 0 then
begin
FField.Value := PyObjectAsVariant( value );
Result := 0;
end
- else if CompareText( key, 'Visible' ) = 0 then
+ else if CompareText( string(key), 'Visible' ) = 0 then
begin
FField.Visible := PyObjectAsVariant( value );
Result := 0;
end
- else if CompareText( key, 'OnChange' ) = 0 then
+ else if CompareText( string(key), 'OnChange' ) = 0 then
begin
SetEvent( FOnChange, Value, 'OnChange', 'TField' );
if Assigned(FOnChange) then
@@ -773,7 +900,7 @@ function TPyField.SetAttr(key : PAnsiChar; value : PPyObject) : Integer;
FField.OnChange := nil;
Result := 0;
end
- else if CompareText( key, 'OnGetText' ) = 0 then
+ else if CompareText( string(key), 'OnGetText' ) = 0 then
begin
SetEvent( FOnGetText, Value, 'OnGetText', 'TField' );
if Assigned(FOnGetText) then
@@ -782,7 +909,7 @@ function TPyField.SetAttr(key : PAnsiChar; value : PPyObject) : Integer;
FField.OnGetText := nil;
Result := 0;
end
- else if CompareText( key, 'OnSetText' ) = 0 then
+ else if CompareText( string(key), 'OnSetText' ) = 0 then
begin
SetEvent( FOnSetText, Value, 'OnSetText', 'TField' );
if Assigned(FOnSetText) then
@@ -791,7 +918,7 @@ function TPyField.SetAttr(key : PAnsiChar; value : PPyObject) : Integer;
FField.OnSetText := nil;
Result := 0;
end
- else if CompareText( key, 'OnValidate' ) = 0 then
+ else if CompareText( string(key), 'OnValidate' ) = 0 then
begin
SetEvent( FOnValidate, Value, 'OnValidate', 'TField' );
if Assigned(FOnValidate) then
@@ -987,7 +1114,7 @@ function TPyField.DoIsValidChar( args : PPyObject ) : PPyObject;
begin
if PyArg_ParseTuple( args, 's:TField.IsValidChar',@s ) <> 0 then
begin
- str := s;
+ str := string(s);
if Length(str) > 0 then
c := str[1]
else
@@ -1074,6 +1201,20 @@ procedure TPyField.OnValidate( Sender : TField );
ExecuteEvent( FOnValidate, [GetSelf] );
end;
+constructor TPythonField.Create( AOwner : TComponent );
+begin
+ inherited;
+ Name := 'typeField';
+ TypeName := 'TField';
+ Module := gDBModule;
+ TypeFlags := TypeFlags + [tpfBaseType];
+ PyObjectClass := TPyField;
+ with DocString do
+ begin
+ Add( 'The TField type implements the Delphi TField VCL Object inside Python.' );
+ Add( 'The properties and methods are the same as in Delphi.' );
+ end;
+end;
{*********************************************************************
* Implementation of TDataset *
@@ -1189,75 +1330,75 @@ function TPyDataset.GetAttr(key : PAnsiChar) : PPyObject;
Exit;
end;
try
- if CompareText( key, 'Active' ) = 0 then
+ if CompareText( string(key), 'Active' ) = 0 then
Result := VariantAsPyObject( Dataset.Active )
- else if CompareText( key, 'BOF' ) = 0 then
+ else if CompareText( string(key), 'BOF' ) = 0 then
Result := VariantAsPyObject( Dataset.BOF )
- else if CompareText( key, 'CanModify' ) = 0 then
+ else if CompareText( string(key), 'CanModify' ) = 0 then
Result := VariantAsPyObject( Dataset.CanModify )
- else if CompareText( key, 'EOF' ) = 0 then
+ else if CompareText( string(key), 'EOF' ) = 0 then
Result := VariantAsPyObject( Dataset.EOF )
- else if CompareText( key, 'FieldCount' ) = 0 then
+ else if CompareText( string(key), 'FieldCount' ) = 0 then
Result := VariantAsPyObject( Dataset.FieldCount )
- else if CompareText( key, 'Filter' ) = 0 then
+ else if CompareText( string(key), 'Filter' ) = 0 then
Result := VariantAsPyObject( Dataset.Filter )
- else if CompareText( key, 'Filtered' ) = 0 then
+ else if CompareText( string(key), 'Filtered' ) = 0 then
Result := VariantAsPyObject( Dataset.Filtered )
- else if CompareText( key, 'Found' ) = 0 then
+ else if CompareText( string(key), 'Found' ) = 0 then
Result := VariantAsPyObject( Dataset.Found )
- else if CompareText( key, 'Modified' ) = 0 then
+ else if CompareText( string(key), 'Modified' ) = 0 then
Result := VariantAsPyObject( Dataset.Modified )
- else if CompareText( key, 'RecNo' ) = 0 then
+ else if CompareText( string(key), 'RecNo' ) = 0 then
Result := VariantAsPyObject( Dataset.RecNo )
- else if CompareText( key, 'RecordCount' ) = 0 then
+ else if CompareText( string(key), 'RecordCount' ) = 0 then
Result := VariantAsPyObject( Dataset.RecordCount )
- else if CompareText( key, 'RecordSize' ) = 0 then
+ else if CompareText( string(key), 'RecordSize' ) = 0 then
Result := VariantAsPyObject( Dataset.RecordSize )
- else if CompareText( key, 'State' ) = 0 then
+ else if CompareText( string(key), 'State' ) = 0 then
Result := VariantAsPyObject( Integer(Dataset.State) )
- else if CompareText( key, 'AfterClose' ) = 0 then
+ else if CompareText( string(key), 'AfterClose' ) = 0 then
Result := ReturnEvent( FAfterClose )
- else if CompareText( key, 'AfterOpen' ) = 0 then
+ else if CompareText( string(key), 'AfterOpen' ) = 0 then
Result := ReturnEvent( FAfterOpen )
- else if CompareText( key, 'AfterScroll' ) = 0 then
+ else if CompareText( string(key), 'AfterScroll' ) = 0 then
Result := ReturnEvent( FAfterScroll )
- else if CompareText( key, 'BeforeClose' ) = 0 then
+ else if CompareText( string(key), 'BeforeClose' ) = 0 then
Result := ReturnEvent( FBeforeClose )
- else if CompareText( key, 'BeforeOpen' ) = 0 then
+ else if CompareText( string(key), 'BeforeOpen' ) = 0 then
Result := ReturnEvent( FBeforeOpen )
- else if CompareText( key, 'BeforeScroll' ) = 0 then
+ else if CompareText( string(key), 'BeforeScroll' ) = 0 then
Result := ReturnEvent( FBeforeScroll )
- else if CompareText( key, 'AfterCancel' ) = 0 then
+ else if CompareText( string(key), 'AfterCancel' ) = 0 then
Result := ReturnEvent( FAfterCancel)
- else if CompareText( key, 'AfterDelete' ) = 0 then
+ else if CompareText( string(key), 'AfterDelete' ) = 0 then
Result := ReturnEvent( FAfterDelete)
- else if CompareText( key, 'AfterEdit' ) = 0 then
+ else if CompareText( string(key), 'AfterEdit' ) = 0 then
Result := ReturnEvent( FAfterEdit)
- else if CompareText( key, 'AfterInsert' ) = 0 then
+ else if CompareText( string(key), 'AfterInsert' ) = 0 then
Result := ReturnEvent( FAfterInsert)
- else if CompareText( key, 'AfterPost' ) = 0 then
+ else if CompareText( string(key), 'AfterPost' ) = 0 then
Result := ReturnEvent( FAfterPost)
- else if CompareText( key, 'BeforeCancel' ) = 0 then
+ else if CompareText( string(key), 'BeforeCancel' ) = 0 then
Result := ReturnEvent( FBeforeCancel)
- else if CompareText( key, 'BeforeDelete' ) = 0 then
+ else if CompareText( string(key), 'BeforeDelete' ) = 0 then
Result := ReturnEvent( FBeforeDelete)
- else if CompareText( key, 'BeforeEdit' ) = 0 then
+ else if CompareText( string(key), 'BeforeEdit' ) = 0 then
Result := ReturnEvent( FBeforeEdit)
- else if CompareText( key, 'BeforeInsert' ) = 0 then
+ else if CompareText( string(key), 'BeforeInsert' ) = 0 then
Result := ReturnEvent( FBeforeInsert)
- else if CompareText( key, 'BeforePost' ) = 0 then
+ else if CompareText( string(key), 'BeforePost' ) = 0 then
Result := ReturnEvent( FBeforePost)
- else if CompareText( key, 'OnCalcFields' ) = 0 then
+ else if CompareText( string(key), 'OnCalcFields' ) = 0 then
Result := ReturnEvent( FOnCalcFields)
- else if CompareText( key, 'OnDeleteError' ) = 0 then
+ else if CompareText( string(key), 'OnDeleteError' ) = 0 then
Result := ReturnEvent( FOnDeleteError)
- else if CompareText( key, 'OnEditError' ) = 0 then
+ else if CompareText( string(key), 'OnEditError' ) = 0 then
Result := ReturnEvent( FOnEditError)
- else if CompareText( key, 'OnFilterRecord' ) = 0 then
+ else if CompareText( string(key), 'OnFilterRecord' ) = 0 then
Result := ReturnEvent( FOnFilterRecord)
- else if CompareText( key, 'OnNewRecord' ) = 0 then
+ else if CompareText( string(key), 'OnNewRecord' ) = 0 then
Result := ReturnEvent( FOnNewRecord)
- else if CompareText( key, 'OnPostError' ) = 0 then
+ else if CompareText( string(key), 'OnPostError' ) = 0 then
Result := ReturnEvent( FOnPostError)
else
Result := inherited GetAttr(key);
@@ -1279,177 +1420,177 @@ function TPyDataset.SetAttr(key : PAnsiChar; value : PPyObject) : Integer;
if not CheckDataset then
Exit;
try
- if CompareText( key, 'Active' ) = 0 then
+ if CompareText( string(key), 'Active' ) = 0 then
begin
Dataset.Active := PyObjectAsVariant( value );
Result := 0;
end
- else if CompareText( key, 'BOF' ) = 0 then
+ else if CompareText( string(key), 'BOF' ) = 0 then
begin
Result := 0;
end
- else if CompareText( key, 'CanModify' ) = 0 then
+ else if CompareText( string(key), 'CanModify' ) = 0 then
begin
Result := 0;
end
- else if CompareText( key, 'EOF' ) = 0 then
+ else if CompareText( string(key), 'EOF' ) = 0 then
begin
Result := 0;
end
- else if CompareText( key, 'FieldCount' ) = 0 then
+ else if CompareText( string(key), 'FieldCount' ) = 0 then
begin
Result := 0;
end
- else if CompareText( key, 'Filter' ) = 0 then
+ else if CompareText( string(key), 'Filter' ) = 0 then
begin
Dataset.Filter := PyObjectAsVariant( value );
Result := 0;
end
- else if CompareText( key, 'Filtered' ) = 0 then
+ else if CompareText( string(key), 'Filtered' ) = 0 then
begin
Dataset.Filtered := PyObjectAsVariant( value );
Result := 0;
end
- else if CompareText( key, 'Found' ) = 0 then
+ else if CompareText( string(key), 'Found' ) = 0 then
begin
Result := 0;
end
- else if CompareText( key, 'Modified' ) = 0 then
+ else if CompareText( string(key), 'Modified' ) = 0 then
begin
Result := 0;
end
- else if CompareText( key, 'RecNo' ) = 0 then
+ else if CompareText( string(key), 'RecNo' ) = 0 then
begin
Dataset.RecNo := PyObjectAsVariant( value );
Result := 0;
end
- else if CompareText( key, 'RecordCount' ) = 0 then
+ else if CompareText( string(key), 'RecordCount' ) = 0 then
begin
Result := 0;
end
- else if CompareText( key, 'RecordSize' ) = 0 then
+ else if CompareText( string(key), 'RecordSize' ) = 0 then
begin
Result := 0;
end
- else if CompareText( key, 'State' ) = 0 then
+ else if CompareText( string(key), 'State' ) = 0 then
begin
Result := 0;
end
- else if CompareText( key, 'AfterClose' ) = 0 then
+ else if CompareText( string(key), 'AfterClose' ) = 0 then
begin
SetEvent( FAfterClose, Value, 'AfterClose', 'TDataset' );
Dataset.AfterClose := SetDatasetEvent( FAfterClose, AfterClose );
Result := 0;
end
- else if CompareText( key, 'AfterOpen' ) = 0 then
+ else if CompareText( string(key), 'AfterOpen' ) = 0 then
begin
SetEvent( FAfterOpen, Value, 'AfterOpen', 'TDataset' );
Dataset.AfterOpen := SetDatasetEvent( FAfterOpen, AfterOpen );
Result := 0;
end
- else if CompareText( key, 'AfterScroll' ) = 0 then
+ else if CompareText( string(key), 'AfterScroll' ) = 0 then
begin
SetEvent( FAfterScroll, Value, 'AfterScroll', 'TDataset' );
Dataset.AfterScroll := SetDatasetEvent( FAfterScroll, AfterScroll );
Result := 0;
end
- else if CompareText( key, 'BeforeClose' ) = 0 then
+ else if CompareText( string(key), 'BeforeClose' ) = 0 then
begin
SetEvent( FBeforeClose, Value, 'BeforeClose', 'TDataset' );
Dataset.BeforeClose := SetDatasetEvent( FBeforeClose, BeforeClose );
Result := 0;
end
- else if CompareText( key, 'BeforeOpen' ) = 0 then
+ else if CompareText( string(key), 'BeforeOpen' ) = 0 then
begin
SetEvent( FBeforeOpen, Value, 'BeforeOpen', 'TDataset' );
Dataset.BeforeOpen := SetDatasetEvent( FBeforeOpen, BeforeOpen );
Result := 0;
end
- else if CompareText( key, 'BeforeScroll' ) = 0 then
+ else if CompareText( string(key), 'BeforeScroll' ) = 0 then
begin
SetEvent( FBeforeScroll, Value, 'BeforeScroll', 'TDataset' );
Dataset.BeforeScroll := SetDatasetEvent( FBeforeScroll, BeforeScroll );
Result := 0;
end
- else if CompareText( key, 'AfterCancel' ) = 0 then
+ else if CompareText( string(key), 'AfterCancel' ) = 0 then
begin
SetEvent( FAfterCancel, Value, 'AfterCancel', 'TDataset' );
Dataset.AfterCancel := SetDatasetEvent( FAfterCancel, AfterCancel);
Result := 0;
end
- else if CompareText( key, 'AfterDelete' ) = 0 then
+ else if CompareText( string(key), 'AfterDelete' ) = 0 then
begin
SetEvent( FAfterDelete, Value, 'AfterDelete', 'TDataset' );
Dataset.AfterDelete := SetDatasetEvent( FAfterDelete, AfterDelete);
Result := 0;
end
- else if CompareText( key, 'AfterEdit' ) = 0 then
+ else if CompareText( string(key), 'AfterEdit' ) = 0 then
begin
SetEvent( FAfterEdit, Value, 'AfterEdit', 'TDataset' );
Dataset.AfterEdit := SetDatasetEvent( FAfterEdit, AfterEdit);
Result := 0;
end
- else if CompareText( key, 'AfterInsert' ) = 0 then
+ else if CompareText( string(key), 'AfterInsert' ) = 0 then
begin
SetEvent( FAfterInsert, Value, 'AfterInsert', 'TDataset' );
Dataset.AfterInsert := SetDatasetEvent( FAfterInsert, AfterInsert);
Result := 0;
end
- else if CompareText( key, 'AfterPost' ) = 0 then
+ else if CompareText( string(key), 'AfterPost' ) = 0 then
begin
SetEvent( FAfterPost, Value, 'AfterPost', 'TDataset' );
Dataset.AfterPost := SetDatasetEvent( FAfterPost, AfterPost);
Result := 0;
end
- else if CompareText( key, 'BeforeCancel' ) = 0 then
+ else if CompareText( string(key), 'BeforeCancel' ) = 0 then
begin
SetEvent( FBeforeCancel, Value, 'BeforeCancel', 'TDataset' );
Dataset.BeforeCancel := SetDatasetEvent( FBeforeCancel, BeforeCancel);
Result := 0;
end
- else if CompareText( key, 'BeforeDelete' ) = 0 then
+ else if CompareText( string(key), 'BeforeDelete' ) = 0 then
begin
SetEvent( FBeforeDelete, Value, 'BeforeDelete', 'TDataset' );
Dataset.BeforeDelete := SetDatasetEvent( FBeforeDelete, BeforeDelete);
Result := 0;
end
- else if CompareText( key, 'BeforeEdit' ) = 0 then
+ else if CompareText( string(key), 'BeforeEdit' ) = 0 then
begin
SetEvent( FBeforeEdit, Value, 'BeforeEdit', 'TDataset' );
Dataset.BeforeEdit := SetDatasetEvent( FBeforeEdit, BeforeEdit);
Result := 0;
end
- else if CompareText( key, 'BeforeInsert' ) = 0 then
+ else if CompareText( string(key), 'BeforeInsert' ) = 0 then
begin
SetEvent( FBeforeInsert, Value, 'BeforeInsert', 'TDataset' );
Dataset.BeforeInsert := SetDatasetEvent( FBeforeInsert, BeforeInsert);
Result := 0;
end
- else if CompareText( key, 'BeforePost' ) = 0 then
+ else if CompareText( string(key), 'BeforePost' ) = 0 then
begin
SetEvent( FBeforePost, Value, 'BeforePost', 'TDataset' );
Dataset.BeforePost := SetDatasetEvent( FBeforePost, BeforePost);
Result := 0;
end
- else if CompareText( key, 'OnCalcFields' ) = 0 then
+ else if CompareText( string(key), 'OnCalcFields' ) = 0 then
begin
SetEvent( FOnCalcFields, Value, 'OnCalcFields', 'TDataset' );
Dataset.OnCalcFields := SetDatasetEvent( FOnCalcFields, OnCalcFields);
Result := 0;
end
- else if CompareText( key, 'OnDeleteError' ) = 0 then
+ else if CompareText( string(key), 'OnDeleteError' ) = 0 then
begin
SetEvent( FOnDeleteError, Value, 'OnDeleteError', 'TDataset' );
Dataset.OnDeleteError := SetDatasetErrorEvent( FOnDeleteError, OnDeleteError );
Result := 0;
end
- else if CompareText( key, 'OnEditError' ) = 0 then
+ else if CompareText( string(key), 'OnEditError' ) = 0 then
begin
SetEvent( FOnEditError, Value, 'OnEditError', 'TDataset' );
Dataset.OnEditError := SetDatasetErrorEvent( FOnEditError, OnEditError );
Result := 0;
end
- else if CompareText( key, 'OnFilterRecord' ) = 0 then
+ else if CompareText( string(key), 'OnFilterRecord' ) = 0 then
begin
SetEvent( FOnFilterRecord, Value, 'OnFilterRecord', 'TDataset' );
if Assigned(FOnFilterRecord) then
@@ -1458,13 +1599,13 @@ function TPyDataset.SetAttr(key : PAnsiChar; value : PPyObject) : Integer;
Dataset.OnFilterRecord := nil;
Result := 0;
end
- else if CompareText( key, 'OnNewRecord' ) = 0 then
+ else if CompareText( string(key), 'OnNewRecord' ) = 0 then
begin
SetEvent( FOnNewRecord, Value, 'OnNewRecord', 'TDataset' );
Dataset.OnNewRecord := SetDatasetEvent( FOnNewRecord, OnNewRecord);
Result := 0;
end
- else if CompareText( key, 'OnPostError' ) = 0 then
+ else if CompareText( string(key), 'OnPostError' ) = 0 then
begin
SetEvent( FOnPostError, Value, 'OnPostError', 'TDataset' );
Dataset.OnPostError := SetDatasetErrorEvent( FOnPostError, OnPostError );
@@ -1489,7 +1630,7 @@ function TPyDataset.Repr : PPyObject;
// Sequence services
-function TPyDataset.SqLength : Integer;
+function TPyDataset.SqLength : NativeInt;
begin
if CheckDataset then
Result := Dataset.RecordCount
@@ -1497,7 +1638,7 @@ function TPyDataset.SqLength : Integer;
Result := -1;
end;
-function TPyDataset.SqItem( idx : Integer ) : PPyObject;
+function TPyDataset.SqItem( idx : NativeInt ) : PPyObject;
begin
if CheckDataset then
begin
@@ -1514,7 +1655,7 @@ function TPyDataset.SqItem( idx : Integer ) : PPyObject;
begin
Result := nil;
with GetPythonEngine do
- PyErr_SetString (PyExc_IndexError^, PAnsiChar(Format('Index %d out of range (%d,%d)',[idx, 0, Dataset.RecordCount-1])));
+ PyErr_SetString (PyExc_IndexError^, PAnsiChar(AnsiString(Format('Index %d out of range (%d,%d)',[idx, 0, Dataset.RecordCount-1]))));
Exit;
end;
try
@@ -1604,7 +1745,7 @@ function TPyDataset.FieldNamesAsTuple : PPyObject;
Result := PyTuple_New(Dataset.FieldCount);
for i := 0 to Dataset.FieldCount - 1 do
with Dataset.Fields[i] do
- PyTuple_SetItem( Result, i, PyString_FromString( PAnsiChar(FieldName) ) );
+ PyTuple_SetItem( Result, i, VariantAsPyObject(Variant(FieldName)) );
end;
end;
@@ -1625,6 +1766,7 @@ function TPyDataset.FieldsAsDict : PPyObject;
var
i : Integer;
obj : PPyObject;
+ _fieldName : PPyObject;
begin
with GetPythonEngine do
begin
@@ -1633,8 +1775,10 @@ function TPyDataset.FieldsAsDict : PPyObject;
with Dataset.Fields[i] do
begin
obj := VariantAsPyObject( AsVariant );
- PyDict_SetItemString( Result, PAnsiChar(FieldName), obj );
+ _fieldName := VariantAsPyObject(Variant(FieldName));
+ PyDict_SetItem( Result, _fieldName, obj );
Py_XDecRef(obj);
+ Py_XDecRef(_fieldName);
end;
end;
end;
@@ -2194,7 +2338,7 @@ function TPyDataset.DoFields( args : PPyObject ) : PPyObject;
else
begin
Result := nil;
- PyErr_SetString (PyExc_AttributeError^, PAnsiChar(Format('Value out of range : %d', [idx])));
+ PyErr_SetString (PyExc_AttributeError^, PAnsiChar(AnsiString(Format('Value out of range : %d', [idx]))));
end;
end
else // the arguments were not right
@@ -2235,7 +2379,7 @@ function TPyDataset.DoFieldByName( args : PPyObject ) : PPyObject;
else
begin
Result := nil;
- PyErr_SetString (PyExc_AttributeError^, PAnsiChar(Format('Unknown field "%s"', [String(s)])));
+ PyErr_SetString (PyExc_AttributeError^, PAnsiChar(AnsiString(Format('Unknown field "%s"', [String(s)]))));
end;
end
else // the arguments were not right
@@ -2549,6 +2693,24 @@ procedure TPyDataset.OnPostError( Dataset : TDataset; E: EDatabaseError; var Act
end;
end;
+constructor TPythonDataset.Create( AOwner : TComponent );
+begin
+ inherited;
+ Name := 'typeDataset';
+ TypeName := 'TDataset';
+ Services.Sequence := [ssLength, ssItem];
+ Module := gDBModule;
+ TypeFlags := TypeFlags + [tpfBaseType];
+ PyObjectClass := TPyDataset;
+ with DocString do
+ begin
+ Add( 'The TDataset type implements the Delphi TDataset VCL Object inside Python.' );
+ Add( 'The properties and methods are the same as in Delphi.' );
+ Add( 'A TDataset can not be instancied, because it''s a virtual class.' );
+ Add( 'It''s used as an interface to any Dataset subclass.');
+ end;
+end;
+
{*********************************************************************
* Implementation of TVarArg *
@@ -2581,7 +2743,7 @@ function TVarArg.GetAttr(key : PAnsiChar) : PPyObject;
begin
with GetPythonEngine do
begin
- if CompareText( key, 'Value' ) = 0 then
+ if CompareText( string(key), 'Value' ) = 0 then
begin
Result := FValue;
if not Assigned(Result) then
@@ -2597,7 +2759,7 @@ function TVarArg.SetAttr(key : PAnsiChar; value : PPyObject) : Integer;
begin
with GetPythonEngine do
begin
- if CompareText( key, 'Value' ) = 0 then
+ if CompareText( string(key), 'Value' ) = 0 then
begin
Py_XDecRef(FValue);
FValue := value;
@@ -2612,20 +2774,38 @@ function TVarArg.SetAttr(key : PAnsiChar; value : PPyObject) : Integer;
function TVarArg.Repr : PPyObject;
begin
with GetPythonEngine do
- Result := PyString_FromString( PAnsiChar(PyObjectAsString(FValue)) );
+ Result := PyString_FromString( PAnsiChar(AnsiString(PyObjectAsString(FValue))) );
+end;
+
+constructor TPythonVarArg.Create( AOwner : TComponent );
+begin
+ inherited;
+ Name := 'typeVarArg';
+ TypeName := 'VarArg';
+ Module := gDBModule;
+ PyObjectClass := TVarArg;
+ with DocString do
+ begin
+ Add( 'a VarArg object contains a single property Value,' );
+ Add( 'which you can read and write in order to change' );
+ Add( 'an argument in an Event.' );
+ Add( 'if you try to print the VarArg, it will print the Value' );
+ Add( 'property.' );
+ end;
end;
{*********************************************************************
* Global functions *
*********************************************************************}
-var
- Initialized : Boolean = False;
-procedure Initialize( Owner : TEngineClient );
+procedure CreateComponents( AOwner : TComponent );
begin
- if pyDB.Initialized then
+ if Assigned(gDBModule) then
Exit;
- pyDB.Initialized := True;
+ gDBModule := TPythonDB.Create(AOwner);
+ gDatasetType := TPythonDataset.Create(AOwner);
+ gFieldType := TPythonField.Create(AOwner);
+ gVarArgType := TPythonVarArg.Create(AOwner);
end;
procedure SetEvent( var EventSlot : PPyObject; Event : PPyObject; const EventName, ClassName : String );
@@ -2708,5 +2888,26 @@ procedure ExecuteEvent( Event : PPyObject; Args : array of Const );
end;
end;
+function NewDataset( aDataset : TDataset; IsOwner : Boolean ) : PPyObject;
+begin
+ if not Assigned(gDBModule) then
+ begin
+ CreateComponents(nil);
+ gDBModule.Engine := GetPythonEngine;
+ gDBModule.Initialize;
+ gDatasetType.Engine := GetPythonEngine;
+ gDatasetType.Initialize;
+ gFieldType.Engine := GetPythonEngine;
+ gFieldType.Initialize;
+ gVarArgType.Engine := GetPythonEngine;
+ gVarArgType.Initialize;
+ end;
+ Result := gDatasetType.CreateInstance;
+ with PythonToDelphi(Result) as TPyDataset do
+ begin
+ FSharedObject.Owner := IsOwner;
+ FSharedObject.Data := aDataset;
+ end;
+end;
end.
diff --git a/PythonForDelphi/Demos/Demo10/pyDBTables.pas b/PythonForDelphi/Demos/Demo10/pyDBTables.pas
index d5fd9a41..6a709bf3 100644
--- a/PythonForDelphi/Demos/Demo10/pyDBTables.pas
+++ b/PythonForDelphi/Demos/Demo10/pyDBTables.pas
@@ -1,15 +1,40 @@
+{$I Definition.Inc}
+
unit pyDBTables;
-interface
+{-------------------------------------------------------------------------------
+ $Header: /P4D/PythonForDelphi/Components/Sources/VCL/pyDBTables.pas 1 03-04-09 19:25 Morgan $
+ Copyright © MMM Inc. 2003 - All Rights Reserved.
+ ------------------------------------------------------------------------------
+ Author: Morgan Martinet
-{$I Definition.Inc}
+ Description:
+
+ ------------------------------------------------------------------------------
+ $Log: /P4D/PythonForDelphi/Components/Sources/VCL/pyDBTables.pas $
+ *
+ * 1 03-04-09 19:25 Morgan
+ * initial check-in
+
+-------------------------------------------------------------------------------}
+
+interface
uses
- Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
+ Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
Variants, PythonEngine, StdCtrls, ExtCtrls, ComCtrls,
DB, DBTables, pyDB;
type
+{*********************************************************************
+ * DBTables module *
+ *********************************************************************}
+ TPythonDBTables = class(TPythonModule)
+ public
+ constructor Create( AOwner : TComponent ); override;
+ procedure Initialize; override;
+ end;
+
{*********************************************************************
* Interface of TBDEDataset *
*********************************************************************}
@@ -43,7 +68,6 @@ TPyBDEDataset = class(TPyDataset)
procedure OnUpdateRecord( Dataset : TDataset; UpdateKind: TUpdateKind; var ua:TUpdateAction);
end;
-
{*********************************************************************
* Interface of TDBDataset *
*********************************************************************}
@@ -72,7 +96,6 @@ TPyDBDataset = class(TPyBDEDataset)
{*********************************************************************
* Interface of TTable *
*********************************************************************}
-
TPyTable = class(TPyDBDataset)
// Constructors & Destructors
@@ -126,6 +149,11 @@ TPyTable = class(TPyDBDataset)
function DoFindNearest( args : PPyObject ) : PPyObject; cdecl;
end;
+ TPythonTable = class( TPythonType)
+ public
+ constructor Create( AOwner : TComponent ); override;
+ end;
+
{*********************************************************************
* Interface of TQuery *
*********************************************************************}
@@ -155,18 +183,66 @@ TPyQuery = class(TPyDBDataset)
function DoExecSQL( args : PPyObject ) : PPyObject; cdecl;
end;
+ TPythonQuery = class( TPythonType)
+ public
+ constructor Create( AOwner : TComponent ); override;
+ end;
+
{*********************************************************************
* Global functions *
*********************************************************************}
- procedure Initialize( Owner : TEngineClient );
+ procedure CreateComponents( AOwner : TComponent );
{********************************************************************
* Global variables *
*********************************************************************}
-//var
+var
+ gDBTablesModule : TPythonModule;
+ gTableType : TPythonType;
+ gQueryType : TPythonType;
implementation
+{*********************************************************************
+ * DBTables module *
+ *********************************************************************}
+
+constructor TPythonDBTables.Create( AOwner : TComponent );
+begin
+ inherited;
+ ModuleName := 'DBTables';
+ Name := 'modDBTables';
+ with DocString do
+ begin
+ Add( 'This module contains several Object Types that' );
+ Add( 'will let you work with the Borland BDE and access' );
+ Add( 'a database.' );
+ Add( '' );
+ Add( 'CreateTTable() -> creates a TTable instance' );
+ Add( 'CreateTQuery() -> creates a TQuery instance' );
+ end;
+end;
+
+procedure TPythonDBTables.Initialize;
+begin
+ inherited;
+ // Values for type TLockType
+ SetVarFromVariant( 'ltReadLock', 0 );
+ SetVarFromVariant( 'ltWriteLock', 1 );
+ // Values for type TIndexOptions
+ SetVarFromVariant( 'ixPrimary', 0 );
+ SetVarFromVariant( 'ixUnique', 1 );
+ SetVarFromVariant( 'ixDescending', 2 );
+ SetVarFromVariant( 'ixCaseInsensitive', 3 );
+ SetVarFromVariant( 'ixExpression', 4 );
+ // Values for type TUpdateAction
+ SetVarFromVariant( 'uaFail', 0 );
+ SetVarFromVariant( 'uaAbort', 1 );
+ SetVarFromVariant( 'uaSkip', 2 );
+ SetVarFromVariant( 'uaRetry', 3 );
+ SetVarFromVariant( 'uaApplied', 4 );
+end;
+
{*********************************************************************
* Implementation of TBDEDataset *
*********************************************************************}
@@ -202,9 +278,9 @@ function TPyBDEDataset.GetAttr(key : PAnsiChar) : PPyObject;
Exit;
end;
try
- if CompareText( key, 'OnUpdateError' ) = 0 then
+ if CompareText( string(key), 'OnUpdateError' ) = 0 then
Result := ReturnEvent( FOnUpdateError )
- else if CompareText( key, 'OnUpdateRecord' ) = 0 then
+ else if CompareText( string(key), 'OnUpdateRecord' ) = 0 then
Result := ReturnEvent( FOnUpdateRecord )
else
Result := inherited GetAttr(key);
@@ -226,7 +302,7 @@ function TPyBDEDataset.SetAttr(key : PAnsiChar; value : PPyObject) : Integer;
if not CheckDataset then
Exit;
try
- if CompareText( key, 'OnUpdateError' ) = 0 then
+ if CompareText( string(key), 'OnUpdateError' ) = 0 then
begin
SetEvent( FOnUpdateError, Value, 'OnUpdateError', 'TField' );
if Assigned(FOnUpdateError) then
@@ -235,7 +311,7 @@ function TPyBDEDataset.SetAttr(key : PAnsiChar; value : PPyObject) : Integer;
BDEDataset.OnUpdateError := nil;
Result := 0;
end
- else if CompareText( key, 'OnUpdateRecord' ) = 0 then
+ else if CompareText( string(key), 'OnUpdateRecord' ) = 0 then
begin
SetEvent( FOnUpdateRecord, Value, 'OnUpdateRecord', 'TField' );
if Assigned(FOnUpdateRecord) then
@@ -293,7 +369,6 @@ procedure TPyBDEDataset.AppendProperties( List : PPyObject );
// Events
////////////////
-
procedure TPyBDEDataset.OnUpdateError( Dataset : TDataset; E: EDatabaseError; UpdateKind: TUpdateKind; var ua:TUpdateAction);
var
v : PPyObject;
@@ -358,9 +433,9 @@ function TPyDBDataset.GetAttr(key : PAnsiChar) : PPyObject;
Exit;
end;
try
- if CompareText( key, 'DatabaseName' ) = 0 then
+ if CompareText( string(key), 'DatabaseName' ) = 0 then
Result := VariantAsPyObject( DBDataset.DatabaseName )
- else if CompareText( key, 'SessionName' ) = 0 then
+ else if CompareText( string(key), 'SessionName' ) = 0 then
Result := VariantAsPyObject( DBDataset.SessionName )
else
Result := inherited GetAttr(key);
@@ -382,12 +457,12 @@ function TPyDBDataset.SetAttr(key : PAnsiChar; value : PPyObject) : Integer;
if not CheckDataset then
Exit;
try
- if CompareText( key, 'DatabaseName' ) = 0 then
+ if CompareText( string(key), 'DatabaseName' ) = 0 then
begin
DBDataset.DatabaseName := PyObjectAsVariant( value );
Result := 0;
end
- else if CompareText( key, 'SessionName' ) = 0 then
+ else if CompareText( string(key), 'SessionName' ) = 0 then
begin
DBDataset.SessionName := PyObjectAsVariant( value );
Result := 0;
@@ -467,15 +542,15 @@ function TPyTable.GetAttr(key : PAnsiChar) : PPyObject;
Exit;
end;
try
- if CompareText( key, 'IndexName' ) = 0 then
+ if CompareText( string(key), 'IndexName' ) = 0 then
Result := VariantAsPyObject( Table.IndexName )
- else if CompareText( key, 'ReadOnly' ) = 0 then
+ else if CompareText( string(key), 'ReadOnly' ) = 0 then
Result := VariantAsPyObject( Table.ReadOnly )
- else if CompareText( key, 'TableLevel' ) = 0 then
+ else if CompareText( string(key), 'TableLevel' ) = 0 then
Result := VariantAsPyObject( Table.TableLevel )
- else if CompareText( key, 'TableName' ) = 0 then
+ else if CompareText( string(key), 'TableName' ) = 0 then
Result := VariantAsPyObject( Table.TableName )
- else if CompareText( key, 'TableType' ) = 0 then
+ else if CompareText( string(key), 'TableType' ) = 0 then
Result := VariantAsPyObject( Integer(Table.TableType) )
else
Result := inherited GetAttr(key);
@@ -497,27 +572,27 @@ function TPyTable.SetAttr(key : PAnsiChar; value : PPyObject) : Integer;
if not CheckDataset then
Exit;
try
- if CompareText( key, 'IndexName' ) = 0 then
+ if CompareText( string(key), 'IndexName' ) = 0 then
begin
Table.IndexName := PyObjectAsVariant( value );
Result := 0;
end
- else if CompareText( key, 'ReadOnly' ) = 0 then
+ else if CompareText( string(key), 'ReadOnly' ) = 0 then
begin
Table.ReadOnly := PyObjectAsVariant( value );
Result := 0;
end
- else if CompareText( key, 'TableLevel' ) = 0 then
+ else if CompareText( string(key), 'TableLevel' ) = 0 then
begin
Table.TableLevel := PyObjectAsVariant( value );
Result := 0;
end
- else if CompareText( key, 'TableName' ) = 0 then
+ else if CompareText( string(key), 'TableName' ) = 0 then
begin
Table.TableName := PyObjectAsVariant( value );
Result := 0;
end
- else if CompareText( key, 'TableType' ) = 0 then
+ else if CompareText( string(key), 'TableType' ) = 0 then
begin
Table.TableType := TTableType(PyObjectAsVariant( value ));
Result := 0;
@@ -1018,7 +1093,7 @@ function TPyTable.DoAddIndex( args : PPyObject ) : PPyObject; cdecl;
if CheckDataset and (PyArg_ParseTuple( args, 'ssO:TTable.AddIndex',@aName, @fields, @options ) <> 0) then
begin
// Do action
- AddIndex( aName, fields, options );
+ AddIndex( string(aName), string(fields), options );
// Finally, we return nothing
Result := ReturnNone;
end
@@ -1046,7 +1121,7 @@ function TPyTable.DoCloseIndexFile( args : PPyObject ) : PPyObject; cdecl;
if CheckDataset and (PyArg_ParseTuple( args, 's:TTable.CloseIndexFile',@aName ) <> 0) then
begin
// Do action
- Table.CloseIndexFile( aName );
+ Table.CloseIndexFile( string(aName) );
// Finally, we return nothing
Result := ReturnNone;
end
@@ -1100,7 +1175,7 @@ function TPyTable.DoDeleteIndex( args : PPyObject ) : PPyObject; cdecl;
if CheckDataset and (PyArg_ParseTuple( args, 's:TTable.DeleteIndex',@aName ) <> 0) then
begin
// Do action
- Table.DeleteIndex( aName );
+ Table.DeleteIndex( string(aName) );
// Finally, we return nothing
Result := ReturnNone;
end
@@ -1204,7 +1279,7 @@ function TPyTable.DoOpenIndexFile( args : PPyObject ) : PPyObject; cdecl;
if CheckDataset and (PyArg_ParseTuple( args, 's:TTable.OpenIndexFile',@aName ) <> 0) then
begin
// Do action
- Table.OpenIndexFile( aName );
+ Table.OpenIndexFile( string(aName) );
// Finally, we return nothing
Result := ReturnNone;
end
@@ -1232,7 +1307,7 @@ function TPyTable.DoRenameTable( args : PPyObject ) : PPyObject; cdecl;
if CheckDataset and (PyArg_ParseTuple( args, 's:TTable.RenameTable',@newName ) <> 0) then
begin
// Do action
- Table.RenameTable( newName );
+ Table.RenameTable( string(newName) );
// Finally, we return nothing
Result := ReturnNone;
end
@@ -1380,6 +1455,21 @@ function TPyTable.DoFindNearest( args : PPyObject ) : PPyObject; cdecl;
end;
end;
+constructor TPythonTable.Create( AOwner : TComponent );
+begin
+ inherited;
+ Name := 'typeTable';
+ TypeName := 'TTable';
+ Services.Sequence := [ssLength, ssItem];
+ Module := gDBTablesModule;
+ TypeFlags := TypeFlags + [tpfBaseType];
+ PyObjectClass := TPyTable;
+ with DocString do
+ begin
+ Add( 'The TTable type implements the Delphi TTable VCL Object inside Python.' );
+ Add( 'The properties and methods are the same as in Delphi.' );
+ end;
+end;
{*********************************************************************
* Implementation of TQuery *
@@ -1407,23 +1497,23 @@ function TPyQuery.GetAttr(key : PAnsiChar) : PPyObject;
Exit;
end;
try
- if CompareText( key, 'Constrained' ) = 0 then
+ if CompareText( string(key), 'Constrained' ) = 0 then
Result := VariantAsPyObject( Query.Constrained )
- else if CompareText( key, 'Local' ) = 0 then
+ else if CompareText( string(key), 'Local' ) = 0 then
Result := VariantAsPyObject( Query.Local)
- else if CompareText( key, 'ParamCheck' ) = 0 then
+ else if CompareText( string(key), 'ParamCheck' ) = 0 then
Result := VariantAsPyObject( Query.ParamCheck )
- else if CompareText( key, 'ParamCount' ) = 0 then
+ else if CompareText( string(key), 'ParamCount' ) = 0 then
Result := VariantAsPyObject( Query.ParamCount )
- else if CompareText( key, 'Prepared' ) = 0 then
+ else if CompareText( string(key), 'Prepared' ) = 0 then
Result := VariantAsPyObject( Query.Prepared )
- else if CompareText( key, 'RequestLive' ) = 0 then
+ else if CompareText( string(key), 'RequestLive' ) = 0 then
Result := VariantAsPyObject( Query.RequestLive )
- else if CompareText( key, 'RowsAffected' ) = 0 then
+ else if CompareText( string(key), 'RowsAffected' ) = 0 then
Result := VariantAsPyObject( Query.RowsAffected )
- else if CompareText( key, 'SQL' ) = 0 then
+ else if CompareText( string(key), 'SQL' ) = 0 then
Result := StringsToPyList( Query.SQL)
- else if CompareText( key, 'UniDirectional' ) = 0 then
+ else if CompareText( string(key), 'UniDirectional' ) = 0 then
Result := VariantAsPyObject( Query.UniDirectional )
else
Result := inherited GetAttr(key);
@@ -1445,44 +1535,44 @@ function TPyQuery.SetAttr(key : PAnsiChar; value : PPyObject) : Integer;
if not CheckDataset then
Exit;
try
- if CompareText( key, 'Constrained' ) = 0 then
+ if CompareText( string(key), 'Constrained' ) = 0 then
begin
Query.Constrained := PyObjectAsVariant( value );
Result := 0;
end
- else if CompareText( key, 'Local' ) = 0 then
+ else if CompareText( string(key), 'Local' ) = 0 then
begin
Result := 0;
end
- else if CompareText( key, 'ParamCheck' ) = 0 then
+ else if CompareText( string(key), 'ParamCheck' ) = 0 then
begin
Query.ParamCheck := PyObjectAsVariant( value );
Result := 0;
end
- else if CompareText( key, 'ParamCount' ) = 0 then
+ else if CompareText( string(key), 'ParamCount' ) = 0 then
begin
Result := 0;
end
- else if CompareText( key, 'Prepared' ) = 0 then
+ else if CompareText( string(key), 'Prepared' ) = 0 then
begin
Query.Prepared := PyObjectAsVariant( value );
Result := 0;
end
- else if CompareText( key, 'RequestLive' ) = 0 then
+ else if CompareText( string(key), 'RequestLive' ) = 0 then
begin
Query.RequestLive := PyObjectAsVariant( value );
Result := 0;
end
- else if CompareText( key, 'RowsAffected' ) = 0 then
+ else if CompareText( string(key), 'RowsAffected' ) = 0 then
begin
Result := 0;
end
- else if CompareText( key, 'SQL' ) = 0 then
+ else if CompareText( string(key), 'SQL' ) = 0 then
begin
PyListToStrings( value, Query.SQL );
Result := 0;
end
- else if CompareText( key, 'UniDirectional' ) = 0 then
+ else if CompareText( string(key), 'UniDirectional' ) = 0 then
begin
Query.UniDirectional := PyObjectAsVariant( value );
Result := 0;
@@ -1622,18 +1712,32 @@ function TPyQuery.DoExecSQL( args : PPyObject ) : PPyObject;
end;
end;
+constructor TPythonQuery.Create( AOwner : TComponent );
+begin
+ inherited;
+ Name := 'typeQuery';
+ TypeName := 'TQuery';
+ Services.Sequence := [ssLength, ssItem];
+ Module := gDBTablesModule;
+ PyObjectClass := TPyQuery;
+ with DocString do
+ begin
+ Add( 'The TQuery type implements the Delphi TQuery VCL Object inside Python.' );
+ Add( 'The properties and methods are the same as in Delphi.' );
+ end;
+end;
+
{*********************************************************************
* Global functions *
*********************************************************************}
-var
- Initialized : Boolean = False;
-procedure Initialize( Owner : TEngineClient );
+procedure CreateComponents( AOwner : TComponent );
begin
- if pyDBTables.Initialized then
+ if Assigned(gDBTablesModule) then
Exit;
- pyDBTables.Initialized := True;
+ gDBTablesModule := TPythonDBTables.Create(AOwner);
+ gTableType := TPythonTable.Create(AOwner);
+ gQueryType := TPythonQuery.Create(AOwner);
end;
-
end.
diff --git a/PythonForDelphi/Demos/Demo10_FireDAC/Demo.ini b/PythonForDelphi/Demos/Demo10_FireDAC/Demo.ini
new file mode 100644
index 00000000..a815e5b7
--- /dev/null
+++ b/PythonForDelphi/Demos/Demo10_FireDAC/Demo.ini
@@ -0,0 +1,26 @@
+[MSSQL_DB]
+BaseDriverID=MSSQL
+DriverID=MSSQL_2008
+ODBCDriver=SQL Server Native Client 11.0
+Server=XXX\YYY
+Database=XXX
+OSAuthent=No
+User_Name=XXX
+Password=XXX
+MetaDefCatalog=XX
+MetaDefSchema=XXX
+ExtendedMetadata=True
+VariantFormat=Binary
+Encrypt=No
+MARS=Yes
+
+[Ora_DB]
+DriverID=OraXE
+Database=localhost:1521/XE
+User_Name=XXX
+Password=YYY
+CharacterSet=UTF8
+
+[SQLite_DB]
+DriverID=SQLite
+Database=Demo.s3db
diff --git a/PythonForDelphi/Demos/Demo10_FireDAC/Demo.s3db b/PythonForDelphi/Demos/Demo10_FireDAC/Demo.s3db
new file mode 100644
index 00000000..b330da86
Binary files /dev/null and b/PythonForDelphi/Demos/Demo10_FireDAC/Demo.s3db differ
diff --git a/PythonForDelphi/Demos/Demo10_FireDAC/Demo10.dpr b/PythonForDelphi/Demos/Demo10_FireDAC/Demo10.dpr
new file mode 100644
index 00000000..efe452ab
--- /dev/null
+++ b/PythonForDelphi/Demos/Demo10_FireDAC/Demo10.dpr
@@ -0,0 +1,13 @@
+program Demo10;
+
+uses
+ Forms,
+ fmMain in 'fmMain.pas' {Main};
+
+{$R *.res}
+
+begin
+ Application.Initialize;
+ Application.CreateForm(TMain, Main);
+ Application.Run;
+end.
diff --git a/PythonForDelphi/Demos/Demo10_FireDAC/Demo10.dproj b/PythonForDelphi/Demos/Demo10_FireDAC/Demo10.dproj
new file mode 100644
index 00000000..c270a21b
--- /dev/null
+++ b/PythonForDelphi/Demos/Demo10_FireDAC/Demo10.dproj
@@ -0,0 +1,566 @@
+
+
+ {1D701B96-D47C-4AD0-BE2E-830C95586BC9}
+ Demo10.dpr
+ Debug
+ DCC32
+ 18.3
+ VCL
+ True
+ Win64
+ 2
+ Application
+
+
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Cfg_1
+ true
+ true
+
+
+ true
+ Cfg_1
+ true
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Cfg_2
+ true
+ true
+
+
+ true
+ Cfg_2
+ true
+ true
+
+
+ Demo10.exe
+ 00400000
+ x86
+ Demo10
+ Vcl;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;System;Xml;Data;Datasnap;Web;Soap;Winapi;$(DCC_Namespace)
+ 1032
+ CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments=
+ .\$(Platform)\$(Config)
+ ..\..\Components\Sources\Core;$(DCC_UnitSearchPath)
+
+
+ System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace)
+ Debug
+ true
+ CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments=;ProgramID=com.embarcadero.$(MSBuildProjectName)
+ 1033
+ $(BDS)\bin\default_app.manifest
+ Demo10_Icon1.ico
+ true
+ $(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_44.png
+ $(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_150.png
+
+
+ Demo10_Icon1.ico
+ $(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_44.png
+ $(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_150.png
+ System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;$(DCC_Namespace)
+ Debug
+ 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=
+ 1033
+ $(BDS)\bin\default_app.manifest
+
+
+ false
+ RELEASE;$(DCC_Define)
+ 0
+ 0
+
+
+ true
+ true
+
+
+ true
+ true
+
+
+ DEBUG;USE_FASTMM4_LEAK_MONITOR;FullDebugMode;LogMemoryLeakDetailToFile;$(DCC_Define)
+
+
+ true
+ true
+ true
+ 1033
+ CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments=;ProgramID=com.embarcadero.$(MSBuildProjectName)
+
+
+ true
+ true
+ 1033
+ CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments=
+ false
+ $(BDS)\bin\delphi_PROJECTICON.ico
+
+
+
+ MainSource
+
+
+
+
+
+ Cfg_2
+ Base
+
+
+ Base
+
+
+ Cfg_1
+ Base
+
+
+
+
+ Delphi.Personality.12
+ VCLApplication
+
+
+
+ Demo10.dpr
+
+
+ False
+ True
+ False
+
+
+ False
+ False
+ 1
+ 0
+ 0
+ 0
+ False
+ False
+ False
+ False
+ False
+ 1032
+ 1253
+
+
+
+
+ 1.0.0.0
+
+
+
+
+
+ 1.0.0.0
+
+
+
+ Microsoft Office 2000 Sample Automation Server Wrapper Components
+ Microsoft Office XP Sample Automation Server Wrapper Components
+
+
+
+ False
+ True
+
+
+
+
+ Demo10.exe
+ true
+
+
+
+
+ 1
+
+
+ Contents\MacOS
+ 0
+
+
+
+
+ classes
+ 1
+
+
+
+
+ library\lib\armeabi-v7a
+ 1
+
+
+
+
+ library\lib\armeabi
+ 1
+
+
+
+
+ library\lib\mips
+ 1
+
+
+
+
+ library\lib\armeabi-v7a
+ 1
+
+
+
+
+ res\drawable
+ 1
+
+
+
+
+ res\values
+ 1
+
+
+
+
+ res\drawable
+ 1
+
+
+
+
+ res\drawable-xxhdpi
+ 1
+
+
+
+
+ res\drawable-ldpi
+ 1
+
+
+
+
+ res\drawable-mdpi
+ 1
+
+
+
+
+ res\drawable-hdpi
+ 1
+
+
+
+
+ res\drawable-xhdpi
+ 1
+
+
+
+
+ res\drawable-small
+ 1
+
+
+
+
+ res\drawable-normal
+ 1
+
+
+
+
+ res\drawable-large
+ 1
+
+
+
+
+ res\drawable-xlarge
+ 1
+
+
+
+
+ 1
+
+
+ 1
+
+
+ 0
+
+
+
+
+ 1
+ .framework
+
+
+ 0
+
+
+
+
+ 1
+ .dylib
+
+
+ 0
+ .dll;.bpl
+
+
+
+
+ 1
+ .dylib
+
+
+ 1
+ .dylib
+
+
+ 1
+ .dylib
+
+
+ 1
+ .dylib
+
+
+ 0
+ .bpl
+
+
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
+
+
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF
+ 1
+
+
+ ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF
+ 1
+
+
+
+
+
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
+
+
+
+
+ Contents\Resources
+ 1
+
+
+
+
+ library\lib\armeabi-v7a
+ 1
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
+ 0
+
+
+
+
+ 1
+
+
+ 1
+
+
+
+
+ Assets
+ 1
+
+
+ Assets
+ 1
+
+
+
+
+ Assets
+ 1
+
+
+ Assets
+ 1
+
+
+
+
+
+
+
+
+
+
+
+
+ 12
+
+
+
+
diff --git a/PythonForDelphi/Demos/Demo10_FireDAC/Demo10.res b/PythonForDelphi/Demos/Demo10_FireDAC/Demo10.res
new file mode 100644
index 00000000..3c461d33
Binary files /dev/null and b/PythonForDelphi/Demos/Demo10_FireDAC/Demo10.res differ
diff --git a/PythonForDelphi/Demos/Demo10_FireDAC/Example1.py b/PythonForDelphi/Demos/Demo10_FireDAC/Example1.py
new file mode 100644
index 00000000..a791f159
--- /dev/null
+++ b/PythonForDelphi/Demos/Demo10_FireDAC/Example1.py
@@ -0,0 +1,65 @@
+import DBFireDac
+
+# Create and open the table
+T = DBFireDac.TFDTable(None)
+T.ConnectionDefName = "SQLite_DB"
+T.TableName = "Customer"
+T.Active = True #or use T.Open()
+
+# Display columns
+print ("Columns: ", T.FieldNamesAsTuple())
+
+LastInvoiceDate = T.FieldByName("LastInvoiceDate")
+
+# For each record of the table
+T.First()
+while not T.EOF:
+ # Get all the fields in a list
+ A = []
+ for i in range( 0, T.FieldCount ):
+ A.append( T.Fields(i).Value )
+ # Print the current record number and the list
+ print ("Rec.", T.RecNo, ":", A)
+ # Edit record
+ T.Edit()
+ T.FieldByName("TaxRate").Value = 2.5
+ # Increments date by one day
+ D = LastInvoiceDate.Value
+ if D[2] < 28:
+ D2 = D[:2]+(D[2]+1,)+D[3:] # this is tuple arithmetic !
+ else:
+ D2 = D[:2]+(1,)+D[3:] # this is tuple arithmetic !
+ LastInvoiceDate.Value = D2
+ T.Post()
+ # Get next record
+ T.Next()
+
+# Print some fields by their names
+F = T.FieldByName("Company")
+print (F, F.FieldName, "=", F.Value)
+
+# Use the TFields and print the list of companies
+T.First()
+while not T.EOF:
+ print (F.AsString)
+ T.Next()
+
+# Print the fields as a dictionary
+D = T.FieldsAsDict()
+print (D)
+print ("COMPANY:", D["COMPANY"]) # <- case-sensitive
+
+T.Close()
+
+T.TableName = "Dummy"
+try:
+ T.Open()
+except DBFireDac.DBError:
+ print ("could not open table ", T.TableName)
+
+#delete fields
+del F
+del LastInvoiceDate
+
+# delete the table
+del T
diff --git a/PythonForDelphi/Demos/Demo10_FireDAC/Example2.py b/PythonForDelphi/Demos/Demo10_FireDAC/Example2.py
new file mode 100644
index 00000000..8c8f0be2
--- /dev/null
+++ b/PythonForDelphi/Demos/Demo10_FireDAC/Example2.py
@@ -0,0 +1,76 @@
+import DBFireDac
+
+# Get the TTable object associated to
+# the delphi table displayed on right
+# It is done when you click on Execute
+T = DBFireDac.T
+
+# Display TableName
+print ("TableName: ", T.TableName)
+
+# Display columns
+print ("Columns: ")
+for i in T.FieldNamesAsTuple():
+ print (" ", i)
+
+T.CancelRange()
+# For each record of the table
+for i in T: # <- required ContainerAccess !!!
+ print ("Rec.", T.RecNo, ":", i)
+
+# Print some fields by their names
+print ("Rec.", T.RecNo, ": ", "Company: ", T.FieldByName("Company").Value)
+
+# check state
+if not T.State in [DBFireDac.dsEdit, DBFireDac.dsInsert]:
+ print ("Table is not edited")
+
+# access the table like an array
+print ("Index 10; Row 11: ", T[10]) # Row 11 <- required ContainerAccess !!!
+print ("Index 10; Row 11 - First field: ", T[10][1]) # second field of row 11 <- required ContainerAccess !!!
+
+# locate a record
+if T.Locate( "City;State", ["Largo","FL"], [] ):
+ print ("Found RecNo:", T.RecNo, " for Locate(Key: 'City;State', Value: [Largo,FL])")
+if T.Locate( "Company", "BLUE SPORTS", [DBFireDac.loCaseInsensitive] ):
+ print ("Found RecNo:", T.RecNo, " for Locate(Key: 'Company', Value: [BLUE SPORTS])")
+if T.Locate( "Company", "ISLAND", [DBFireDac.loCaseInsensitive, DBFireDac.loPartialKey] ):
+ print ("Found RecNo:", T.RecNo, " for Locate(Key: 'Company', Value: [ISLAND])")
+
+# lookup a record
+print ("Lookup 'CustNo;Company' for Key: 'City;State', Value: [Largo,FL] -> ", T.Lookup( "City;State", ["Largo","FL"], "CustNo;Company" ))
+
+# define a range
+print ("-----------------------------------------------------------")
+print ("Names of Indexes:", T.GetIndexNames())
+T.IndexName = "SK1_CUSTOMER"
+T.SetRange( ["Unisco"], ["Unisco"] )
+for i in T:
+ print ("Rec.", T.RecNo, ":", i)
+T.CancelRange()
+
+print ("-----------------------------------------------------------")
+# Find a record
+if T.FindKey( ['Unisco'] ):
+ print ("Unisco found !")
+else:
+ print ("Could not find Unisco !")
+
+# Find the nearest record
+T.FindNearest( ['Ocean'] )
+print ("Find nearest Ocean :", T.FieldsAsTuple())
+
+# Print all doc strings of an instance's methods
+def PrintDocOf( inst ):
+ print ("--------------------- Type ", type(inst).__name__, "---------------------")
+ if type(inst).__doc__:
+ print (type(inst).__doc__)
+print ("-----------------------------------------------------------")
+print ("Documentation:")
+print
+print ("Module DBFireDac:")
+print (DBFireDac.__doc__)
+PrintDocOf(T)
+print ("-----------------------------------------------------------")
+
+
diff --git a/PythonForDelphi/Demos/Demo10_FireDAC/Example3.py b/PythonForDelphi/Demos/Demo10_FireDAC/Example3.py
new file mode 100644
index 00000000..25c31409
--- /dev/null
+++ b/PythonForDelphi/Demos/Demo10_FireDAC/Example3.py
@@ -0,0 +1,54 @@
+import DBFireDac
+from datetime import datetime
+
+# Get the TTable object associated to
+# the delphi table displayed on right
+# It is done when you click on Execute
+T = DBFireDac.T
+
+# Display columns
+print ("Columns: ")
+for i in T.FieldNamesAsTuple():
+ print (" ", i)
+
+# For each record of the table
+print ("Company name for each record of table : ")
+T.First()
+while not T.EOF:
+ # Print the current record number and the Company
+ print ("Rec.", T.RecNo, "; Company: ", T.FieldByName("Company").Value)
+ # Get next record
+ T.Next()
+
+# check state
+if not T.State in [DBFireDac.dsEdit, DBFireDac.dsInsert]:
+ print ("Table is not edited")
+
+# Find and edit a record
+T.IndexName = "SK1_CUSTOMER"
+if T.FindKey( ['Unisco'] ):
+ print ("Unisco found !")
+ T.Edit()
+ T.FieldByName('ADDR2').AsString = 'Egal'
+ T.FieldByName('LASTINVOICEDATE').AsDateTime = datetime.today()
+ T.Post()
+ print ("New values for ADDR2='", T.FieldByName('ADDR2').AsString, "'and LASTINVOICEDATE=", T.FieldByName('LASTINVOICEDATE').AsString)
+else:
+ print ("Could not find Unisco !")
+
+# New Company: Append or Delete
+if T.FindKey( ['Test-Company'] ):
+ # Delete record
+ T.Delete()
+ print ("New Company 'Test-Company' deleted !")
+else:
+ # New record
+ T.Append()
+ T.FieldByName('COMPANY').AsString = 'Test-Company'
+ T.FieldByName('ADDR1').AsString = 'Marktplatz 1'
+ T.FieldByName('CITY').AsString = 'Köln'
+ T.FieldByName('LASTINVOICEDATE').AsDateTime = datetime.today()
+ T.Post()
+ print ("New Company 'Test-Company' created !")
+
+
diff --git a/PythonForDelphi/Demos/Demo10_FireDAC/Example4.py b/PythonForDelphi/Demos/Demo10_FireDAC/Example4.py
new file mode 100644
index 00000000..b134a04f
--- /dev/null
+++ b/PythonForDelphi/Demos/Demo10_FireDAC/Example4.py
@@ -0,0 +1,30 @@
+import DBFireDac
+
+# Create and open the Query
+Q = DBFireDac.TFDQuery(None)
+Q.ConnectionDefName = "SQLite_DB"
+Q.SQL.Text = """select *
+from ORDERS
+"""
+
+Q.Open() # or Q.Active = True
+
+# Display columns
+print ("Columns: ", Q.FieldNamesAsTuple())
+# For each record of the table
+Q.First()
+while not Q.EOF:
+ # Get all the fields in a list
+ A = []
+ for i in range( 0, Q.FieldCount ):
+ A.append( Q.Fields(i).AsString )
+ # Print the current record number and the list
+ print ("Rec.", Q.RecNo, ":", A)
+ # Get next record
+ Q.Next()
+#
+Q.Close()
+
+# delete the Query
+del Q
+
diff --git a/PythonForDelphi/Demos/Demo10_FireDAC/FDDrivers.ini b/PythonForDelphi/Demos/Demo10_FireDAC/FDDrivers.ini
new file mode 100644
index 00000000..20790300
--- /dev/null
+++ b/PythonForDelphi/Demos/Demo10_FireDAC/FDDrivers.ini
@@ -0,0 +1,19 @@
+[ADDrivers.ini]
+Encoding=UTF8
+
+[OraXE]
+BaseDriverID=Ora
+VendorHome=XE
+
+[MSSQL_2005]
+BaseDriverID=MSSQL
+ODBCDriver=SQL SERVER
+
+[MSSQL_2008]
+BaseDriverID=MSSQL
+ODBCDriver=SQL Server Native Client 11.0
+
+[MSSQL_2012]
+BaseDriverID=MSSQL
+ODBCDriver=SQL Server Native Client 11.0
+
diff --git a/PythonForDelphi/Demos/Demo10_FireDAC/fmMain.dfm b/PythonForDelphi/Demos/Demo10_FireDAC/fmMain.dfm
new file mode 100644
index 00000000..f0bc771f
Binary files /dev/null and b/PythonForDelphi/Demos/Demo10_FireDAC/fmMain.dfm differ
diff --git a/PythonForDelphi/Demos/Demo10_FireDAC/fmMain.pas b/PythonForDelphi/Demos/Demo10_FireDAC/fmMain.pas
new file mode 100644
index 00000000..87cd283f
--- /dev/null
+++ b/PythonForDelphi/Demos/Demo10_FireDAC/fmMain.pas
@@ -0,0 +1,302 @@
+unit fmMain;
+
+interface
+
+uses
+ Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
+ System.Types, System.UITypes,
+ ComCtrls, ExtCtrls, StdCtrls, PythonEngine, PythonGUIInputOutput, Db,
+ Grids, DBGrids, Datasnap.DBClient, FireDAC.Stan.Intf, FireDAC.Stan.Option,
+ FireDAC.Stan.Error, FireDAC.UI.Intf, FireDAC.Phys.Intf, FireDAC.Stan.Def,
+ FireDAC.Stan.Pool, FireDAC.Stan.Async, FireDAC.Phys, FireDAC.FMXUI.Wait,
+ FireDAC.Stan.Param, FireDAC.DatS, FireDAC.DApt.Intf, FireDAC.DApt,
+ FireDAC.Comp.Client, FireDAC.Comp.DataSet, FireDAC.Comp.UI,
+ FireDAC.Phys.SQLite, FireDAC.Phys.SQLiteDef, FireDAC.Stan.ExprFuncs,
+ WrapDelphi, WrapFireDac, SynEditHighlighter, SynHighlighterPython, SynEdit,
+ SynEditCodeFolding, sqlTimSt, FireDAC.VCLUI.Wait;
+
+type
+ TMain = class(TForm)
+ RichEdit1: TRichEdit;
+ Splitter1: TSplitter;
+ PythonGUIInputOutput: TPythonGUIInputOutput;
+ modDBFireDac: TPythonModule;
+ dsrcCustomer: TDataSource;
+ DataSource2: TDataSource;
+ Panel6: TPanel;
+ btnSQLTest: TButton;
+ cobxConnSQLServer: TComboBox;
+ Label5: TLabel;
+ Connection: TFDConnection;
+ mqSrcTables: TFDMetaInfoQuery;
+ SynPythonSyn: TSynPythonSyn;
+ PythonEngine: TPythonEngine;
+ tblCustomer: TFDTable;
+ PageControl: TPageControl;
+ TabSheet1: TTabSheet;
+ Splitter7: TSplitter;
+ SynEditScript1: TSynEdit;
+ Panel7: TPanel;
+ Label1: TLabel;
+ Label2: TLabel;
+ btnExecuteExample1: TButton;
+ TabSheet2: TTabSheet;
+ Splitter3: TSplitter;
+ Panel1: TPanel;
+ btnExecuteExample2: TButton;
+ DBGrid1: TDBGrid;
+ SynEditScript2: TSynEdit;
+ TabSheet4: TTabSheet;
+ Splitter4: TSplitter;
+ Panel3: TPanel;
+ btnExecuteExample3: TButton;
+ DBGrid2: TDBGrid;
+ SynEditScript3: TSynEdit;
+ TabSheet5: TTabSheet;
+ Splitter2: TSplitter;
+ Panel2: TPanel;
+ btnExecuteExample4: TButton;
+ SynEditScript4: TSynEdit;
+ PyDelphiWrapper: TPyDelphiWrapper;
+ procedure btnExecuteExample1Click(Sender: TObject);
+ procedure btnExecuteExample2Click(Sender: TObject);
+ procedure Table1CalcFields(DataSet: TDataSet);
+ procedure btnExecuteExample4Click(Sender: TObject);
+ procedure btnExecuteExample3Click(Sender: TObject);
+ procedure modDBFireDacInitialization(Sender: TObject);
+ procedure FormShow(Sender: TObject);
+ procedure btnSQLTestClick(Sender: TObject);
+ procedure FormDestroy(Sender: TObject);
+ procedure PageControlChange(Sender: TObject);
+ private
+ function DBConnectionClosedCheck(aConnectionDefName: String): Boolean;
+ public
+ end;
+
+var
+ Main: TMain;
+
+
+implementation
+
+{$R *.DFM}
+
+
+procedure TMain.FormShow(Sender: TObject);
+var
+ i: Integer;
+ l_sStr: String;
+begin
+ SynEditScript1.Lines.LoadFromFile( 'Example1.py' );
+ SynEditScript2.Lines.LoadFromFile( 'Example2.py' );
+ SynEditScript3.Lines.LoadFromFile( 'Example3.py' );
+ SynEditScript4.Lines.LoadFromFile( 'Example4.py' );
+ //
+ PageControl.ActivePage := TabSheet1;
+ //
+ RichEdit1.Lines.Clear;
+ cobxConnSQLServer.ItemIndex := -1;
+ if FileExists('FDDrivers.ini') then begin
+ FDManager.DriverDefFileName := 'FDDrivers.ini';
+ FDManager.DriverDefFileAutoLoad := True;
+ end
+ else begin
+ l_sStr := 'Die Ini-Datei "FDDrivers.ini" existiert nicht!';
+ RichEdit1.Lines.Add(l_sStr);
+ MessageDlg(l_sStr, TMsgDlgType.mtError, [TMsgDlgBtn.mbOK], 0);
+ Close;
+ end;
+ if FileExists('Demo.ini') then begin
+ FDManager.ConnectionDefFileName := 'Demo.ini';
+ try
+ FDManager.LoadConnectionDefFile;
+ FDManager.GetConnectionNames(cobxConnSQLServer.Items);
+ for i := 0 to cobxConnSQLServer.Items.Count-1 do begin
+ l_sStr := UpperCase(cobxConnSQLServer.Items[i]);
+ if (Pos('SQLITE',l_sStr) > 0) and (cobxConnSQLServer.ItemIndex < 0) then begin
+ cobxConnSQLServer.ItemIndex := i;
+ break;
+ end;
+ end;
+ except
+ on E: Exception do begin
+ l_sStr := 'Exception: ' + E.Message;
+ RichEdit1.Lines.Add(l_sStr);
+ MessageDlg(l_sStr, TMsgDlgType.mtError, [TMsgDlgBtn.mbOK], 0);
+ end;
+ end;
+ end
+ else begin
+ l_sStr := 'Die Ini-Datei "Demo.ini" existiert nicht!';
+ RichEdit1.Lines.Add(l_sStr);
+ MessageDlg(l_sStr, TMsgDlgType.mtError, [TMsgDlgBtn.mbOK], 0);
+ Close;
+ end;
+end;
+
+procedure TMain.FormDestroy(Sender: TObject);
+begin
+ if Connection.Connected then
+ Connection.Close;
+end;
+
+procedure TMain.btnSQLTestClick(Sender: TObject);
+var
+ l_sStr, l_sConnName: String;
+begin
+ RichEdit1.Lines.Clear;
+ l_sConnName := cobxConnSQLServer.Items[cobxConnSQLServer.ItemIndex];
+ l_sStr := UpperCase(l_sConnName);
+ if Pos('ORA',l_sStr) > 0 then begin
+ RichEdit1.Lines.Add('Oracle Parameter:');
+ end
+ else if Pos('MSSQL',l_sStr) > 0 then begin
+ RichEdit1.Lines.Add('MS SQL Server Parameter:');
+ end
+ else if Pos('SQLITE',l_sStr) > 0 then begin
+ RichEdit1.Lines.Add('SQLite Parameter:');
+ end
+ else begin
+ RichEdit1.Lines.Add('Unkown database type!');
+ exit;
+ end;
+ if self.DBConnectionClosedCheck(l_sConnName) then
+ RichEdit1.Lines.Add('Database was connected!')
+ else
+ RichEdit1.Lines.Add('Database was not connected!');
+end;
+
+function TMain.DBConnectionClosedCheck(aConnectionDefName: String): Boolean;
+var
+ l_sStr: String;
+ l_oDef: IFDStanConnectionDef;
+begin
+ Result := True;
+ if Connection.Connected then
+ Connection.Close;
+ if Connection.ConnectionDefName <> aConnectionDefName then begin
+ l_oDef := FDManager.ConnectionDefs.ConnectionDefByName(aConnectionDefName);
+ Connection.Params.Clear;
+ Connection.Params.AddStrings(l_oDef.Params);
+ Connection.ConnectionDefName := aConnectionDefName;
+ //
+ try
+ Connection.Connected := True;
+ if Connection.Connected then begin
+ Result := True;
+ Connection.Close;
+ end;
+ except
+ on E: Exception do begin
+ Result := False;
+ l_sStr := 'Exception: ' + E.Message;
+ RichEdit1.Lines.Add(l_sStr);
+ end;
+ end;
+ end;
+end;
+
+procedure TMain.Table1CalcFields(DataSet: TDataSet);
+begin
+ Dataset.FieldByName('Demo').AsString := Dataset.FieldByName('State').AsString + ' - ' +
+ Dataset.FieldByName('Zip').AsString;
+end;
+
+procedure TMain.modDBFireDacInitialization(Sender: TObject);
+begin
+// pyDBFireDac.g_oDBModule := Sender as TPythonModule;
+ with Sender as TPythonModule do begin
+ with DocString do begin
+ Add( 'This module contains several Object Types that' );
+ Add( 'will let you work with FireDAC and access' );
+ Add( 'a database.' );
+ Add( '' );
+ Add( 'CreateDBTable() -> creates a TFDTable instance' );
+ Add( 'CreateDBQuery() -> creates a TFDQuery instance' );
+ end;
+ with Errors.Add do begin
+ Name := 'DBError';
+ ErrorType := etClass; // <- !!! Must ...
+ end;
+ end;
+end;
+
+procedure TMain.PageControlChange(Sender: TObject);
+begin
+ if PageControl.TabIndex = 1 then begin
+ // Example2
+ if not tblCustomer.Active then
+ tblCustomer.Active := True;
+ end
+ else begin
+ if tblCustomer.Active then
+ tblCustomer.Active := False;
+ end;
+end;
+
+procedure TMain.btnExecuteExample1Click(Sender: TObject);
+var
+ l_sConnName: String;
+begin
+ l_sConnName := cobxConnSQLServer.Items[cobxConnSQLServer.ItemIndex];
+ if self.DBConnectionClosedCheck(l_sConnName) then begin
+ with GetPythonEngine do begin
+ ExecStrings( SynEditScript1.Lines );
+ end;
+ end;
+end;
+
+procedure TMain.btnExecuteExample2Click(Sender: TObject);
+var
+ pyObj : PPyObject;
+begin
+ // Instantiate a new Python object TPyTable
+ pyObj := PyDelphiWrapper.Wrap(tblCustomer);
+ with GetPythonEngine do begin
+ // Define a new variable "T" in the DB module
+ modDBFireDac.SetVar( 'T', pyObj );
+ Py_XDecRef(pyObj);
+ // Excecute the script
+ ExecStrings( SynEditScript2.Lines );
+ end;
+end;
+
+procedure TMain.btnExecuteExample3Click(Sender: TObject);
+var
+ pyObj : PPyObject;
+ l_oTable: TFDTable;
+begin
+ // connect the Datasource2 to the Python Table
+ l_oTable := TFDTable.Create(Self);
+ l_oTable.TableName := 'Customer';
+ l_oTable.Connection := Connection;
+ Datasource2.Dataset := l_oTable;
+ l_oTable.Open();
+
+ pyObj := PyDelphiWrapper.Wrap(l_oTable, soOwned);
+ with GetPythonEngine do begin
+ // Define a new variable "T" in the DB module
+ modDBFireDac.SetVar( 'T', pyObj );
+ Py_XDecRef(pyObj);
+ // Excecute the script
+ ExecStrings( SynEditScript3.Lines );
+ end;
+end;
+
+procedure TMain.btnExecuteExample4Click(Sender: TObject);
+var
+ l_sConnName: String;
+begin
+ l_sConnName := cobxConnSQLServer.Items[cobxConnSQLServer.ItemIndex];
+ if self.DBConnectionClosedCheck(l_sConnName) then begin
+ with PythonEngine do
+ ExecStrings( SynEditScript4.Lines );
+ end;
+end;
+
+initialization
+ ReportMemoryLeaksOnShutdown := True;
+finalization
+ CheckSynchronize;
+end.
+
diff --git a/PythonForDelphi/Demos/Demo11/SortThds.pas b/PythonForDelphi/Demos/Demo11/SortThds.pas
index 268a2451..d9b0cae1 100644
--- a/PythonForDelphi/Demos/Demo11/SortThds.pas
+++ b/PythonForDelphi/Demos/Demo11/SortThds.pas
@@ -6,12 +6,7 @@ interface
uses
Classes,
-{$IFDEF MSWINDOWS}
Graphics, ExtCtrls,
-{$ENDIF}
-{$IFDEF LINUX}
- QGraphics, QExtCtrls,
-{$ENDIF}
PythonEngine;
type
@@ -38,7 +33,7 @@ TSortThread = class(TPythonThread)
public
property value[i: integer]: integer read getvalue; default;
- constructor Create( ainterp: PPyInterpreterState; script: TStrings;
+ constructor Create( AThreadExecMode: TThreadExecMode; script: TStrings;
module: TPythonModule; apyfuncname: string;
Box: TPaintBox; var SortArray: array of Integer);
@@ -56,7 +51,7 @@ procedure PaintLine(Canvas: TCanvas; I, Len: Integer);
{ TSortThread }
-constructor TSortThread.Create( ainterp: PPyInterpreterState; script: TStrings;
+constructor TSortThread.Create( AThreadExecMode: TThreadExecMode; script: TStrings;
module: TPythonModule; apyfuncname: string;
Box: TPaintBox; var SortArray: array of Integer);
begin
@@ -67,7 +62,7 @@ constructor TSortThread.Create( ainterp: PPyInterpreterState; script: TStrings;
FSortArray := @SortArray;
FSize := High(SortArray) - Low(SortArray) + 1;
FreeOnTerminate := True;
- InterpreterState := ainterp;
+ ThreadExecMode := AThreadExecMode;
inherited Create(False);
end;
diff --git a/PythonForDelphi/Demos/Demo11/ThSort.pas b/PythonForDelphi/Demos/Demo11/ThSort.pas
index 9b3fdf42..6066f700 100644
--- a/PythonForDelphi/Demos/Demo11/ThSort.pas
+++ b/PythonForDelphi/Demos/Demo11/ThSort.pas
@@ -6,13 +6,8 @@ interface
uses
SysUtils, Classes,
-{$IFDEF MSWINDOWS}
Windows, Messages, Graphics, Controls, Forms, Dialogs,
ExtCtrls, StdCtrls,
-{$ENDIF}
-{$IFDEF LINUX}
- QForms, QDialogs, QStdCtrls, QControls, QExtCtrls,
-{$ENDIF}
PythonEngine;
type
@@ -50,7 +45,7 @@ TThreadSortForm = class(TForm)
ThreadsRunning: Integer;
procedure RandomizeArrays;
procedure ThreadDone(Sender: TObject);
- procedure InitThreads(interp: PPyInterpreterState; script: TStrings);
+ procedure InitThreads(ThreadExecMode: TThreadExecMode; script: TStrings);
function SortModule_GetValue( pself, args : PPyObject ) : PPyObject; cdecl;
function SortModule_Swap( pself, args : PPyObject ) : PPyObject; cdecl;
@@ -108,22 +103,21 @@ procedure TThreadSortForm.FormCreate(Sender: TObject);
RandomizeArrays;
end;
-procedure TThreadSortForm.InitThreads(interp: PPyInterpreterState; script: TStrings);
+procedure TThreadSortForm.InitThreads(ThreadExecMode: TThreadExecMode; script: TStrings);
begin
RandomizeArrays;
ThreadsRunning := 3;
with GetPythonEngine do
begin
- OwnThreadState := PyThreadState_Get;
- PyEval_ReleaseThread(OwnThreadState);
+ OwnThreadState := PyEval_SaveThread;
- with TSortThread.Create( interp, script, SortModule, 'SortFunc1',
+ with TSortThread.Create( ThreadExecMode, script, SortModule, 'SortFunc1',
BubbleSortBox, BubbleSortArray) do
OnTerminate := ThreadDone;
- with TSortThread.Create( interp, script, SortModule, 'SortFunc2',
+ with TSortThread.Create( ThreadExecMode, script, SortModule, 'SortFunc2',
SelectionSortBox, SelectionSortArray) do
OnTerminate := ThreadDone;
- with TSortThread.Create( interp, script, SortModule, 'SortFunc3',
+ with TSortThread.Create( ThreadExecMode, script, SortModule, 'SortFunc3',
QuickSortBox, QuickSortArray) do
OnTerminate := ThreadDone;
end;
@@ -137,13 +131,13 @@ procedure TThreadSortForm.Start2BtnClick(Sender: TObject);
with GetPythonEngine do
begin
ExecStrings(PythonMemo.Lines);
- self.InitThreads(PyThreadState_Get.interp,nil);
+ self.InitThreads(emNewState,nil);
end;
end;
procedure TThreadSortForm.StartBtnClick(Sender: TObject);
begin
- InitThreads(nil,PythonMemo.Lines);
+ InitThreads(emNewInterpreter,PythonMemo.Lines);
//PythonEngine1.ExecStrings(PythonMemo.Lines);
end;
@@ -180,7 +174,7 @@ procedure TThreadSortForm.ThreadDone(Sender: TObject);
Dec(ThreadsRunning);
if ThreadsRunning = 0 then
begin
- GetPythonEngine.PyEval_AcquireThread(OwnThreadState);
+ GetPythonEngine.PyEval_RestoreThread(OwnThreadState);
StartBtn.Enabled := True;
Start2Btn.Enabled := True;
ArraysRandom := False;
diff --git a/PythonForDelphi/Demos/Demo11/ThrdDemo.dpr b/PythonForDelphi/Demos/Demo11/ThrdDemo.dpr
index e30aa5eb..1a995c75 100644
--- a/PythonForDelphi/Demos/Demo11/ThrdDemo.dpr
+++ b/PythonForDelphi/Demos/Demo11/ThrdDemo.dpr
@@ -1,17 +1,9 @@
-// JCL_DEBUG_EXPERT_GENERATEJDBG OFF
-// JCL_DEBUG_EXPERT_INSERTJDBG OFF
-// JCL_DEBUG_EXPERT_DELETEMAPFILE OFF
program ThrdDemo;
{$I Definition.Inc}
uses
-{$IFDEF MSWINDOWS}
Forms,
-{$ENDIF}
-{$IFDEF LINUX}
- QForms,
-{$ENDIF}
ThSort in 'ThSort.pas' {ThreadSortForm},
SortThds in 'SortThds.pas';
diff --git a/PythonForDelphi/Demos/Demo16/Example1/Project1.dof b/PythonForDelphi/Demos/Demo16/Example1/Project1.dof
deleted file mode 100644
index a3bc2aa7..00000000
--- a/PythonForDelphi/Demos/Demo16/Example1/Project1.dof
+++ /dev/null
@@ -1,93 +0,0 @@
-[FileVersion]
-Version=6.0
-[Compiler]
-A=8
-B=0
-C=1
-D=1
-E=0
-F=0
-G=1
-H=1
-I=1
-J=0
-K=0
-L=1
-M=0
-N=1
-O=1
-P=1
-Q=0
-R=0
-S=0
-T=0
-U=0
-V=1
-W=0
-X=1
-Y=1
-Z=1
-ShowHints=1
-ShowWarnings=1
-UnitAliases=WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;
-[Linker]
-MapFile=0
-OutputObjs=0
-ConsoleApp=1
-DebugInfo=0
-RemoteSymbols=0
-MinStackSize=16384
-MaxStackSize=1048576
-ImageBase=4194304
-ExeDescription=
-[Directories]
-OutputDir=
-UnitOutputDir=
-PackageDLLOutputDir=
-PackageDCPOutputDir=
-SearchPath=
-Packages=dxBarD6;dxcomnd6;rtl;dxBarDBNavD6;dbrtl;dxBarExtItemsD6;dxBarExtDBItemsD6;dxsbD6;dxdbtrD6;dxtrmdD6;dxmdsd6;dxInsD6;dxDBEdD6;dxEdtrD6;dxObjInsD6;vcldb;dxorgcD6;dxdborD6;vcl;vclx;fc3000v6;EQTLD6;ECQDBCD6;EQDBTLD6;EQGridD6;dxGrEdD6;dxExELD6;dxELibD6;dxPSCoreD6;dxPsPrVwAdvD6;dxPSLnksD6;dxPSTLLnkD6;dxPSdxDBTLLnkD6;dxPSdxDBCtrlLnkD6;dxPSdxDBGrLnkD6;dxPSdxDBTVLnkD6;dxPSdxInsLnkD6;dxPSdxOCLnkD6;dxPSdxDBOCLnkD6;rbTDBC61;rbRCL66;rbCIDE66;rbIDE66;rbBDE66;rbRIDE66;rbRAP66;rbDBDE66;rbDAD66;rbDIDE66;rbUSER66;rbDB66;rbADO66;adortl;rbDBE66;dbxcds;dbexpress;rbIBE66;ibxpress;dxMasterViewD6;RxCtl6;VclSmp;RxDB6;RxBDE6
-Conditionals=
-DebugSourceDirs=
-UsePackages=0
-[Parameters]
-RunParams=
-HostApplication=
-Launcher=
-UseLauncher=0
-DebugCWD=
-[Language]
-ActiveLang=
-ProjectLang=
-RootDir=D:\Program Files\Borland\Delphi6\Bin\
-[Version Info]
-IncludeVerInfo=0
-AutoIncBuild=0
-MajorVer=1
-MinorVer=0
-Release=0
-Build=0
-Debug=0
-PreRelease=0
-Special=0
-Private=0
-DLL=0
-Locale=1033
-CodePage=1252
-[Version Info Keys]
-CompanyName=
-FileDescription=
-FileVersion=1.0.0.0
-InternalName=
-LegalCopyright=
-LegalTrademarks=
-OriginalFilename=
-ProductName=
-ProductVersion=1.0.0.0
-Comments=
-[Excluded Packages]
-d:\Program Files\Developer Express Inc\ExpressInspector\Delphi 6\Lib\dcldxExRwD6.bpl=ExpressInspector Extended Rows
-d:\Program Files\Developer Express Inc\ExpressPrinting System\Delphi 6\Lib\dxPSTeeChartD6.bpl=ExpressPrinting System ReportLink for TeeChart by Developer Express Inc.
-d:\Program Files\Developer Express Inc\ExpressPrinting System\Delphi 6\Lib\dxPSDBTeeChartD6.bpl=ExpressPrinting System ReportLink for DBTeeChart by Developer Express Inc.
-d:\Program Files\Developer Express Inc\ExpressPrinting System\Delphi 6\Lib\dxPSdxMVLnkD6.bpl=ExpressPrinting System ReportLink for ExpressMasterView by Developer Express Inc.
-d:\Program Files\Developer Express Inc\ExpressPrinting System\Delphi 6\Lib\dxPSdxFCLnkD6.bpl=ExpressPrinting System ReportLinks for ExpressFlowChart by Developer Express Inc.
diff --git a/PythonForDelphi/Demos/Demo16/Example1/Project1.dpr b/PythonForDelphi/Demos/Demo16/Example1/Project1.dpr
index 34e6006c..7a68fc98 100644
--- a/PythonForDelphi/Demos/Demo16/Example1/Project1.dpr
+++ b/PythonForDelphi/Demos/Demo16/Example1/Project1.dpr
@@ -3,12 +3,7 @@ program Project1;
{$I Definition.Inc}
uses
-{$IFDEF MSWINDOWS}
Forms,
-{$ENDIF}
-{$IFDEF LINUX}
- QForms,
-{$ENDIF}
Unit1 in 'Unit1.pas' {Form1};
{$R *.res}
diff --git a/PythonForDelphi/Demos/Demo16/Example1/Unit1.pas b/PythonForDelphi/Demos/Demo16/Example1/Unit1.pas
index 16ae03b3..9f67b561 100644
--- a/PythonForDelphi/Demos/Demo16/Example1/Unit1.pas
+++ b/PythonForDelphi/Demos/Demo16/Example1/Unit1.pas
@@ -6,13 +6,8 @@ interface
uses
SysUtils, Classes,
-{$IFDEF MSWINDOWS}
Windows, Messages, Graphics, Controls, Forms, Dialogs,
StdCtrls, ExtCtrls, ComCtrls,
-{$ENDIF}
-{$IFDEF LINUX}
- QForms, QDialogs, QStdCtrls, QControls, QExtCtrls,
-{$ENDIF}
PythonEngine, PythonGUIInputOutput;
type
@@ -43,13 +38,11 @@ TForm1 = class(TForm)
procedure PythonDelphiVar1ExtSetData(Sender: TObject; Data: PPyObject);
procedure PythonDelphiVar1Change(Sender: TObject);
private
- { Déclarations privées }
FProperties : PPyObject;
function CreateProperties : PPyObject;
procedure UpdateProperties( props : PPyObject );
public
- { Déclarations publiques }
end;
var
diff --git a/PythonForDelphi/Demos/Demo16/Example2/Project1.dof b/PythonForDelphi/Demos/Demo16/Example2/Project1.dof
deleted file mode 100644
index a3bc2aa7..00000000
--- a/PythonForDelphi/Demos/Demo16/Example2/Project1.dof
+++ /dev/null
@@ -1,93 +0,0 @@
-[FileVersion]
-Version=6.0
-[Compiler]
-A=8
-B=0
-C=1
-D=1
-E=0
-F=0
-G=1
-H=1
-I=1
-J=0
-K=0
-L=1
-M=0
-N=1
-O=1
-P=1
-Q=0
-R=0
-S=0
-T=0
-U=0
-V=1
-W=0
-X=1
-Y=1
-Z=1
-ShowHints=1
-ShowWarnings=1
-UnitAliases=WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;
-[Linker]
-MapFile=0
-OutputObjs=0
-ConsoleApp=1
-DebugInfo=0
-RemoteSymbols=0
-MinStackSize=16384
-MaxStackSize=1048576
-ImageBase=4194304
-ExeDescription=
-[Directories]
-OutputDir=
-UnitOutputDir=
-PackageDLLOutputDir=
-PackageDCPOutputDir=
-SearchPath=
-Packages=dxBarD6;dxcomnd6;rtl;dxBarDBNavD6;dbrtl;dxBarExtItemsD6;dxBarExtDBItemsD6;dxsbD6;dxdbtrD6;dxtrmdD6;dxmdsd6;dxInsD6;dxDBEdD6;dxEdtrD6;dxObjInsD6;vcldb;dxorgcD6;dxdborD6;vcl;vclx;fc3000v6;EQTLD6;ECQDBCD6;EQDBTLD6;EQGridD6;dxGrEdD6;dxExELD6;dxELibD6;dxPSCoreD6;dxPsPrVwAdvD6;dxPSLnksD6;dxPSTLLnkD6;dxPSdxDBTLLnkD6;dxPSdxDBCtrlLnkD6;dxPSdxDBGrLnkD6;dxPSdxDBTVLnkD6;dxPSdxInsLnkD6;dxPSdxOCLnkD6;dxPSdxDBOCLnkD6;rbTDBC61;rbRCL66;rbCIDE66;rbIDE66;rbBDE66;rbRIDE66;rbRAP66;rbDBDE66;rbDAD66;rbDIDE66;rbUSER66;rbDB66;rbADO66;adortl;rbDBE66;dbxcds;dbexpress;rbIBE66;ibxpress;dxMasterViewD6;RxCtl6;VclSmp;RxDB6;RxBDE6
-Conditionals=
-DebugSourceDirs=
-UsePackages=0
-[Parameters]
-RunParams=
-HostApplication=
-Launcher=
-UseLauncher=0
-DebugCWD=
-[Language]
-ActiveLang=
-ProjectLang=
-RootDir=D:\Program Files\Borland\Delphi6\Bin\
-[Version Info]
-IncludeVerInfo=0
-AutoIncBuild=0
-MajorVer=1
-MinorVer=0
-Release=0
-Build=0
-Debug=0
-PreRelease=0
-Special=0
-Private=0
-DLL=0
-Locale=1033
-CodePage=1252
-[Version Info Keys]
-CompanyName=
-FileDescription=
-FileVersion=1.0.0.0
-InternalName=
-LegalCopyright=
-LegalTrademarks=
-OriginalFilename=
-ProductName=
-ProductVersion=1.0.0.0
-Comments=
-[Excluded Packages]
-d:\Program Files\Developer Express Inc\ExpressInspector\Delphi 6\Lib\dcldxExRwD6.bpl=ExpressInspector Extended Rows
-d:\Program Files\Developer Express Inc\ExpressPrinting System\Delphi 6\Lib\dxPSTeeChartD6.bpl=ExpressPrinting System ReportLink for TeeChart by Developer Express Inc.
-d:\Program Files\Developer Express Inc\ExpressPrinting System\Delphi 6\Lib\dxPSDBTeeChartD6.bpl=ExpressPrinting System ReportLink for DBTeeChart by Developer Express Inc.
-d:\Program Files\Developer Express Inc\ExpressPrinting System\Delphi 6\Lib\dxPSdxMVLnkD6.bpl=ExpressPrinting System ReportLink for ExpressMasterView by Developer Express Inc.
-d:\Program Files\Developer Express Inc\ExpressPrinting System\Delphi 6\Lib\dxPSdxFCLnkD6.bpl=ExpressPrinting System ReportLinks for ExpressFlowChart by Developer Express Inc.
diff --git a/PythonForDelphi/Demos/Demo16/Example2/Project1.dpr b/PythonForDelphi/Demos/Demo16/Example2/Project1.dpr
index 34e6006c..7a68fc98 100644
--- a/PythonForDelphi/Demos/Demo16/Example2/Project1.dpr
+++ b/PythonForDelphi/Demos/Demo16/Example2/Project1.dpr
@@ -3,12 +3,7 @@ program Project1;
{$I Definition.Inc}
uses
-{$IFDEF MSWINDOWS}
Forms,
-{$ENDIF}
-{$IFDEF LINUX}
- QForms,
-{$ENDIF}
Unit1 in 'Unit1.pas' {Form1};
{$R *.res}
diff --git a/PythonForDelphi/Demos/Demo16/Example2/Unit1.pas b/PythonForDelphi/Demos/Demo16/Example2/Unit1.pas
index 2a02289f..1c597e16 100644
--- a/PythonForDelphi/Demos/Demo16/Example2/Unit1.pas
+++ b/PythonForDelphi/Demos/Demo16/Example2/Unit1.pas
@@ -6,13 +6,8 @@ interface
uses
Classes, SysUtils,
-{$IFDEF MSWINDOWS}
Windows, Messages, Graphics, Controls, Forms, Dialogs,
StdCtrls, ComCtrls, ExtCtrls,
-{$ENDIF}
-{$IFDEF LINUX}
- QForms, QDialogs, QStdCtrls, QControls, QExtCtrls,
-{$ENDIF}
PythonEngine, PythonGUIInputOutput;
type
@@ -40,13 +35,10 @@ TForm1 = class(TForm)
procedure Button1Click(Sender: TObject);
procedure PythonModule1Initialization(Sender: TObject);
private
- { Déclarations privées }
-
function GetProperty(pSelf, Args : PPyObject) : PPyObject; cdecl;
function SetProperty(pSelf, Args : PPyObject) : PPyObject; cdecl;
function GetPropertyList(pSelf, Args : PPyObject) : PPyObject; cdecl;
public
- { Déclarations publiques }
end;
var
diff --git a/PythonForDelphi/Demos/Demo17/Project1.dof b/PythonForDelphi/Demos/Demo17/Project1.dof
deleted file mode 100644
index a3bc2aa7..00000000
--- a/PythonForDelphi/Demos/Demo17/Project1.dof
+++ /dev/null
@@ -1,93 +0,0 @@
-[FileVersion]
-Version=6.0
-[Compiler]
-A=8
-B=0
-C=1
-D=1
-E=0
-F=0
-G=1
-H=1
-I=1
-J=0
-K=0
-L=1
-M=0
-N=1
-O=1
-P=1
-Q=0
-R=0
-S=0
-T=0
-U=0
-V=1
-W=0
-X=1
-Y=1
-Z=1
-ShowHints=1
-ShowWarnings=1
-UnitAliases=WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;
-[Linker]
-MapFile=0
-OutputObjs=0
-ConsoleApp=1
-DebugInfo=0
-RemoteSymbols=0
-MinStackSize=16384
-MaxStackSize=1048576
-ImageBase=4194304
-ExeDescription=
-[Directories]
-OutputDir=
-UnitOutputDir=
-PackageDLLOutputDir=
-PackageDCPOutputDir=
-SearchPath=
-Packages=dxBarD6;dxcomnd6;rtl;dxBarDBNavD6;dbrtl;dxBarExtItemsD6;dxBarExtDBItemsD6;dxsbD6;dxdbtrD6;dxtrmdD6;dxmdsd6;dxInsD6;dxDBEdD6;dxEdtrD6;dxObjInsD6;vcldb;dxorgcD6;dxdborD6;vcl;vclx;fc3000v6;EQTLD6;ECQDBCD6;EQDBTLD6;EQGridD6;dxGrEdD6;dxExELD6;dxELibD6;dxPSCoreD6;dxPsPrVwAdvD6;dxPSLnksD6;dxPSTLLnkD6;dxPSdxDBTLLnkD6;dxPSdxDBCtrlLnkD6;dxPSdxDBGrLnkD6;dxPSdxDBTVLnkD6;dxPSdxInsLnkD6;dxPSdxOCLnkD6;dxPSdxDBOCLnkD6;rbTDBC61;rbRCL66;rbCIDE66;rbIDE66;rbBDE66;rbRIDE66;rbRAP66;rbDBDE66;rbDAD66;rbDIDE66;rbUSER66;rbDB66;rbADO66;adortl;rbDBE66;dbxcds;dbexpress;rbIBE66;ibxpress;dxMasterViewD6;RxCtl6;VclSmp;RxDB6;RxBDE6
-Conditionals=
-DebugSourceDirs=
-UsePackages=0
-[Parameters]
-RunParams=
-HostApplication=
-Launcher=
-UseLauncher=0
-DebugCWD=
-[Language]
-ActiveLang=
-ProjectLang=
-RootDir=D:\Program Files\Borland\Delphi6\Bin\
-[Version Info]
-IncludeVerInfo=0
-AutoIncBuild=0
-MajorVer=1
-MinorVer=0
-Release=0
-Build=0
-Debug=0
-PreRelease=0
-Special=0
-Private=0
-DLL=0
-Locale=1033
-CodePage=1252
-[Version Info Keys]
-CompanyName=
-FileDescription=
-FileVersion=1.0.0.0
-InternalName=
-LegalCopyright=
-LegalTrademarks=
-OriginalFilename=
-ProductName=
-ProductVersion=1.0.0.0
-Comments=
-[Excluded Packages]
-d:\Program Files\Developer Express Inc\ExpressInspector\Delphi 6\Lib\dcldxExRwD6.bpl=ExpressInspector Extended Rows
-d:\Program Files\Developer Express Inc\ExpressPrinting System\Delphi 6\Lib\dxPSTeeChartD6.bpl=ExpressPrinting System ReportLink for TeeChart by Developer Express Inc.
-d:\Program Files\Developer Express Inc\ExpressPrinting System\Delphi 6\Lib\dxPSDBTeeChartD6.bpl=ExpressPrinting System ReportLink for DBTeeChart by Developer Express Inc.
-d:\Program Files\Developer Express Inc\ExpressPrinting System\Delphi 6\Lib\dxPSdxMVLnkD6.bpl=ExpressPrinting System ReportLink for ExpressMasterView by Developer Express Inc.
-d:\Program Files\Developer Express Inc\ExpressPrinting System\Delphi 6\Lib\dxPSdxFCLnkD6.bpl=ExpressPrinting System ReportLinks for ExpressFlowChart by Developer Express Inc.
diff --git a/PythonForDelphi/Demos/Demo17/Project1.dpr b/PythonForDelphi/Demos/Demo17/Project1.dpr
index 34e6006c..7a68fc98 100644
--- a/PythonForDelphi/Demos/Demo17/Project1.dpr
+++ b/PythonForDelphi/Demos/Demo17/Project1.dpr
@@ -3,12 +3,7 @@ program Project1;
{$I Definition.Inc}
uses
-{$IFDEF MSWINDOWS}
Forms,
-{$ENDIF}
-{$IFDEF LINUX}
- QForms,
-{$ENDIF}
Unit1 in 'Unit1.pas' {Form1};
{$R *.res}
diff --git a/PythonForDelphi/Demos/Demo17/Unit1.pas b/PythonForDelphi/Demos/Demo17/Unit1.pas
index 56dc722a..524c0565 100644
--- a/PythonForDelphi/Demos/Demo17/Unit1.pas
+++ b/PythonForDelphi/Demos/Demo17/Unit1.pas
@@ -6,13 +6,8 @@ interface
uses
SysUtils, Classes,
-{$IFDEF MSWINDOWS}
Windows, Messages, Graphics, Controls, Forms, Dialogs,
StdCtrls, ComCtrls, ExtCtrls,
-{$ENDIF}
-{$IFDEF LINUX}
- QForms, QDialogs, QStdCtrls, QControls, QExtCtrls,
-{$ENDIF}
Variants, PythonEngine, PythonGUIInputOutput;
type
@@ -33,9 +28,7 @@ TForm1 = class(TForm)
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
private
- { Déclarations privées }
public
- { Déclarations publiques }
end;
diff --git a/PythonForDelphi/Demos/Demo21/Project1.dof b/PythonForDelphi/Demos/Demo21/Project1.dof
deleted file mode 100644
index a3bc2aa7..00000000
--- a/PythonForDelphi/Demos/Demo21/Project1.dof
+++ /dev/null
@@ -1,93 +0,0 @@
-[FileVersion]
-Version=6.0
-[Compiler]
-A=8
-B=0
-C=1
-D=1
-E=0
-F=0
-G=1
-H=1
-I=1
-J=0
-K=0
-L=1
-M=0
-N=1
-O=1
-P=1
-Q=0
-R=0
-S=0
-T=0
-U=0
-V=1
-W=0
-X=1
-Y=1
-Z=1
-ShowHints=1
-ShowWarnings=1
-UnitAliases=WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;
-[Linker]
-MapFile=0
-OutputObjs=0
-ConsoleApp=1
-DebugInfo=0
-RemoteSymbols=0
-MinStackSize=16384
-MaxStackSize=1048576
-ImageBase=4194304
-ExeDescription=
-[Directories]
-OutputDir=
-UnitOutputDir=
-PackageDLLOutputDir=
-PackageDCPOutputDir=
-SearchPath=
-Packages=dxBarD6;dxcomnd6;rtl;dxBarDBNavD6;dbrtl;dxBarExtItemsD6;dxBarExtDBItemsD6;dxsbD6;dxdbtrD6;dxtrmdD6;dxmdsd6;dxInsD6;dxDBEdD6;dxEdtrD6;dxObjInsD6;vcldb;dxorgcD6;dxdborD6;vcl;vclx;fc3000v6;EQTLD6;ECQDBCD6;EQDBTLD6;EQGridD6;dxGrEdD6;dxExELD6;dxELibD6;dxPSCoreD6;dxPsPrVwAdvD6;dxPSLnksD6;dxPSTLLnkD6;dxPSdxDBTLLnkD6;dxPSdxDBCtrlLnkD6;dxPSdxDBGrLnkD6;dxPSdxDBTVLnkD6;dxPSdxInsLnkD6;dxPSdxOCLnkD6;dxPSdxDBOCLnkD6;rbTDBC61;rbRCL66;rbCIDE66;rbIDE66;rbBDE66;rbRIDE66;rbRAP66;rbDBDE66;rbDAD66;rbDIDE66;rbUSER66;rbDB66;rbADO66;adortl;rbDBE66;dbxcds;dbexpress;rbIBE66;ibxpress;dxMasterViewD6;RxCtl6;VclSmp;RxDB6;RxBDE6
-Conditionals=
-DebugSourceDirs=
-UsePackages=0
-[Parameters]
-RunParams=
-HostApplication=
-Launcher=
-UseLauncher=0
-DebugCWD=
-[Language]
-ActiveLang=
-ProjectLang=
-RootDir=D:\Program Files\Borland\Delphi6\Bin\
-[Version Info]
-IncludeVerInfo=0
-AutoIncBuild=0
-MajorVer=1
-MinorVer=0
-Release=0
-Build=0
-Debug=0
-PreRelease=0
-Special=0
-Private=0
-DLL=0
-Locale=1033
-CodePage=1252
-[Version Info Keys]
-CompanyName=
-FileDescription=
-FileVersion=1.0.0.0
-InternalName=
-LegalCopyright=
-LegalTrademarks=
-OriginalFilename=
-ProductName=
-ProductVersion=1.0.0.0
-Comments=
-[Excluded Packages]
-d:\Program Files\Developer Express Inc\ExpressInspector\Delphi 6\Lib\dcldxExRwD6.bpl=ExpressInspector Extended Rows
-d:\Program Files\Developer Express Inc\ExpressPrinting System\Delphi 6\Lib\dxPSTeeChartD6.bpl=ExpressPrinting System ReportLink for TeeChart by Developer Express Inc.
-d:\Program Files\Developer Express Inc\ExpressPrinting System\Delphi 6\Lib\dxPSDBTeeChartD6.bpl=ExpressPrinting System ReportLink for DBTeeChart by Developer Express Inc.
-d:\Program Files\Developer Express Inc\ExpressPrinting System\Delphi 6\Lib\dxPSdxMVLnkD6.bpl=ExpressPrinting System ReportLink for ExpressMasterView by Developer Express Inc.
-d:\Program Files\Developer Express Inc\ExpressPrinting System\Delphi 6\Lib\dxPSdxFCLnkD6.bpl=ExpressPrinting System ReportLinks for ExpressFlowChart by Developer Express Inc.
diff --git a/PythonForDelphi/Demos/Demo21/Project1.dpr b/PythonForDelphi/Demos/Demo21/Project1.dpr
index 34e6006c..7a68fc98 100644
--- a/PythonForDelphi/Demos/Demo21/Project1.dpr
+++ b/PythonForDelphi/Demos/Demo21/Project1.dpr
@@ -3,12 +3,7 @@ program Project1;
{$I Definition.Inc}
uses
-{$IFDEF MSWINDOWS}
Forms,
-{$ENDIF}
-{$IFDEF LINUX}
- QForms,
-{$ENDIF}
Unit1 in 'Unit1.pas' {Form1};
{$R *.res}
diff --git a/PythonForDelphi/Demos/Demo21/Unit1.pas b/PythonForDelphi/Demos/Demo21/Unit1.pas
index 12ec4ee9..340d6750 100644
--- a/PythonForDelphi/Demos/Demo21/Unit1.pas
+++ b/PythonForDelphi/Demos/Demo21/Unit1.pas
@@ -6,13 +6,8 @@ interface
uses
Classes, SysUtils,
-{$IFDEF MSWINDOWS}
Windows, Messages, Graphics, Controls, Forms, Dialogs,
StdCtrls, ComCtrls, ExtCtrls,
-{$ENDIF}
-{$IFDEF LINUX}
- QForms, QDialogs, QStdCtrls, QControls, QExtCtrls,
-{$ENDIF}
PythonEngine, PythonGUIInputOutput;
type
@@ -39,9 +34,7 @@ TForm1 = class(TForm)
procedure PythonType1Events0Execute(Sender: TObject; PSelf,
Args: PPyObject; var Result: PPyObject);
private
- { Déclarations privées }
public
- { Déclarations publiques }
end;
// This is a Delphi class implementing a new Python type
diff --git a/PythonForDelphi/Demos/Demo22/Project1.dof b/PythonForDelphi/Demos/Demo22/Project1.dof
deleted file mode 100644
index 3313f39c..00000000
--- a/PythonForDelphi/Demos/Demo22/Project1.dof
+++ /dev/null
@@ -1,90 +0,0 @@
-[FileVersion]
-Version=6.0
-[Compiler]
-A=8
-B=0
-C=1
-D=1
-E=0
-F=0
-G=1
-H=1
-I=1
-J=1
-K=0
-L=1
-M=0
-N=1
-O=1
-P=1
-Q=0
-R=0
-S=0
-T=0
-U=0
-V=1
-W=0
-X=1
-Y=1
-Z=1
-ShowHints=1
-ShowWarnings=1
-UnitAliases=WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;
-[Linker]
-MapFile=0
-OutputObjs=0
-ConsoleApp=1
-DebugInfo=0
-RemoteSymbols=0
-MinStackSize=16384
-MaxStackSize=1048576
-ImageBase=4194304
-ExeDescription=
-[Directories]
-OutputDir=
-UnitOutputDir=
-PackageDLLOutputDir=
-PackageDCPOutputDir=
-SearchPath=
-Packages=Vcl50;Vclx50;VclSmp50;Vcldb50;vclado50;ibevnt50;Vclbde50;vcldbx50;Qrpt50;TeeUI50;TeeDB50;Tee50;Dss50;TeeQR50;VCLIB50;Vclmid50;vclie50;Inetdb50;Inet50;NMFast50;webmid50;dclocx50;dclaxserver50;VM;MyKardexComponents
-Conditionals=
-DebugSourceDirs=
-UsePackages=0
-[Parameters]
-RunParams=
-HostApplication=
-Launcher=
-UseLauncher=0
-DebugCWD=
-[Language]
-ActiveLang=
-ProjectLang=
-RootDir=
-[Version Info]
-IncludeVerInfo=0
-AutoIncBuild=0
-MajorVer=1
-MinorVer=0
-Release=0
-Build=0
-Debug=0
-PreRelease=0
-Special=0
-Private=0
-DLL=0
-Locale=1033
-CodePage=1252
-[Version Info Keys]
-CompanyName=
-FileDescription=
-FileVersion=1.0.0.0
-InternalName=
-LegalCopyright=
-LegalTrademarks=
-OriginalFilename=
-ProductName=
-ProductVersion=1.0.0.0
-Comments=
-[Excluded Packages]
-C:\Program Files\PythonForDelphi\Components\PythonVCL_d5.bpl=VCL Components for Python
-d:\program files\borland\delphi6\Bin\dclite50.bpl=Borland Integrated Translation Environment
diff --git a/PythonForDelphi/Demos/Demo22/Project1.dpr b/PythonForDelphi/Demos/Demo22/Project1.dpr
index 34e6006c..7a68fc98 100644
--- a/PythonForDelphi/Demos/Demo22/Project1.dpr
+++ b/PythonForDelphi/Demos/Demo22/Project1.dpr
@@ -3,12 +3,7 @@ program Project1;
{$I Definition.Inc}
uses
-{$IFDEF MSWINDOWS}
Forms,
-{$ENDIF}
-{$IFDEF LINUX}
- QForms,
-{$ENDIF}
Unit1 in 'Unit1.pas' {Form1};
{$R *.res}
diff --git a/PythonForDelphi/Demos/Demo22/Unit1.pas b/PythonForDelphi/Demos/Demo22/Unit1.pas
index cba6638a..5b758d30 100644
--- a/PythonForDelphi/Demos/Demo22/Unit1.pas
+++ b/PythonForDelphi/Demos/Demo22/Unit1.pas
@@ -6,13 +6,8 @@ interface
uses
Classes, SysUtils,
-{$IFDEF MSWINDOWS}
Windows, Messages, Graphics, Controls, Forms, Dialogs,
StdCtrls, ComCtrls, ExtCtrls,
-{$ENDIF}
-{$IFDEF LINUX}
- QForms, QDialogs, QStdCtrls, QControls, QExtCtrls,
-{$ENDIF}
PythonEngine, PythonGUIInputOutput;
type
@@ -30,9 +25,7 @@ TForm1 = class(TForm)
procedure Button3Click(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
private
- { Déclarations privées }
public
- { Déclarations publiques }
end;
diff --git a/PythonForDelphi/Demos/Demo23/Project1.dof b/PythonForDelphi/Demos/Demo23/Project1.dof
deleted file mode 100644
index 3313f39c..00000000
--- a/PythonForDelphi/Demos/Demo23/Project1.dof
+++ /dev/null
@@ -1,90 +0,0 @@
-[FileVersion]
-Version=6.0
-[Compiler]
-A=8
-B=0
-C=1
-D=1
-E=0
-F=0
-G=1
-H=1
-I=1
-J=1
-K=0
-L=1
-M=0
-N=1
-O=1
-P=1
-Q=0
-R=0
-S=0
-T=0
-U=0
-V=1
-W=0
-X=1
-Y=1
-Z=1
-ShowHints=1
-ShowWarnings=1
-UnitAliases=WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;
-[Linker]
-MapFile=0
-OutputObjs=0
-ConsoleApp=1
-DebugInfo=0
-RemoteSymbols=0
-MinStackSize=16384
-MaxStackSize=1048576
-ImageBase=4194304
-ExeDescription=
-[Directories]
-OutputDir=
-UnitOutputDir=
-PackageDLLOutputDir=
-PackageDCPOutputDir=
-SearchPath=
-Packages=Vcl50;Vclx50;VclSmp50;Vcldb50;vclado50;ibevnt50;Vclbde50;vcldbx50;Qrpt50;TeeUI50;TeeDB50;Tee50;Dss50;TeeQR50;VCLIB50;Vclmid50;vclie50;Inetdb50;Inet50;NMFast50;webmid50;dclocx50;dclaxserver50;VM;MyKardexComponents
-Conditionals=
-DebugSourceDirs=
-UsePackages=0
-[Parameters]
-RunParams=
-HostApplication=
-Launcher=
-UseLauncher=0
-DebugCWD=
-[Language]
-ActiveLang=
-ProjectLang=
-RootDir=
-[Version Info]
-IncludeVerInfo=0
-AutoIncBuild=0
-MajorVer=1
-MinorVer=0
-Release=0
-Build=0
-Debug=0
-PreRelease=0
-Special=0
-Private=0
-DLL=0
-Locale=1033
-CodePage=1252
-[Version Info Keys]
-CompanyName=
-FileDescription=
-FileVersion=1.0.0.0
-InternalName=
-LegalCopyright=
-LegalTrademarks=
-OriginalFilename=
-ProductName=
-ProductVersion=1.0.0.0
-Comments=
-[Excluded Packages]
-C:\Program Files\PythonForDelphi\Components\PythonVCL_d5.bpl=VCL Components for Python
-d:\program files\borland\delphi6\Bin\dclite50.bpl=Borland Integrated Translation Environment
diff --git a/PythonForDelphi/Demos/Demo23/Project1.dpr b/PythonForDelphi/Demos/Demo23/Project1.dpr
index 34e6006c..7a68fc98 100644
--- a/PythonForDelphi/Demos/Demo23/Project1.dpr
+++ b/PythonForDelphi/Demos/Demo23/Project1.dpr
@@ -3,12 +3,7 @@ program Project1;
{$I Definition.Inc}
uses
-{$IFDEF MSWINDOWS}
Forms,
-{$ENDIF}
-{$IFDEF LINUX}
- QForms,
-{$ENDIF}
Unit1 in 'Unit1.pas' {Form1};
{$R *.res}
diff --git a/PythonForDelphi/Demos/Demo23/Unit1.pas b/PythonForDelphi/Demos/Demo23/Unit1.pas
index 18fe49cf..217bc3bf 100644
--- a/PythonForDelphi/Demos/Demo23/Unit1.pas
+++ b/PythonForDelphi/Demos/Demo23/Unit1.pas
@@ -6,13 +6,8 @@ interface
uses
Classes, SysUtils,
-{$IFDEF MSWINDOWS}
Windows, Messages, Graphics, Controls, Forms, Dialogs,
StdCtrls, ComCtrls, ExtCtrls,
-{$ENDIF}
-{$IFDEF LINUX}
- QForms, QDialogs, QStdCtrls, QControls, QExtCtrls,
-{$ENDIF}
PythonEngine, PythonGUIInputOutput;
type
@@ -33,9 +28,7 @@ TForm1 = class(TForm)
procedure PythonInputOutput1SendData(Sender: TObject;
const Data: String);
private
- { Déclarations privées }
public
- { Déclarations publiques }
end;
diff --git a/PythonForDelphi/Demos/Demo25/VarPythUnitTest.dof b/PythonForDelphi/Demos/Demo25/VarPythUnitTest.dof
deleted file mode 100644
index d5f8ddef..00000000
--- a/PythonForDelphi/Demos/Demo25/VarPythUnitTest.dof
+++ /dev/null
@@ -1,150 +0,0 @@
-[FileVersion]
-Version=7.0
-[Compiler]
-A=8
-B=0
-C=1
-D=1
-E=0
-F=0
-G=1
-H=1
-I=1
-J=0
-K=0
-L=1
-M=0
-N=1
-O=0
-P=1
-Q=0
-R=0
-S=0
-T=0
-U=0
-V=1
-W=0
-X=1
-Y=1
-Z=1
-ShowHints=1
-ShowWarnings=1
-UnitAliases=WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;
-NamespacePrefix=
-SymbolDeprecated=1
-SymbolLibrary=0
-SymbolPlatform=0
-UnitLibrary=0
-UnitPlatform=0
-UnitDeprecated=1
-HResultCompat=1
-HidingMember=1
-HiddenVirtual=1
-Garbage=1
-BoundsError=1
-ZeroNilCompat=1
-StringConstTruncated=1
-ForLoopVarVarPar=1
-TypedConstVarPar=1
-AsgToTypedConst=1
-CaseLabelRange=1
-ForVariable=1
-ConstructingAbstract=1
-ComparisonFalse=1
-ComparisonTrue=1
-ComparingSignedUnsigned=1
-CombiningSignedUnsigned=1
-UnsupportedConstruct=1
-FileOpen=1
-FileOpenUnitSrc=1
-BadGlobalSymbol=1
-DuplicateConstructorDestructor=1
-InvalidDirective=1
-PackageNoLink=1
-PackageThreadVar=1
-ImplicitImport=1
-HPPEMITIgnored=1
-NoRetVal=1
-UseBeforeDef=1
-ForLoopVarUndef=1
-UnitNameMismatch=1
-NoCFGFileFound=1
-MessageDirective=1
-ImplicitVariants=1
-UnicodeToLocale=1
-LocaleToUnicode=1
-ImagebaseMultiple=1
-SuspiciousTypecast=1
-PrivatePropAccessor=1
-UnsafeType=0
-UnsafeCode=0
-UnsafeCast=0
-[Linker]
-MapFile=0
-OutputObjs=0
-ConsoleApp=1
-DebugInfo=0
-RemoteSymbols=0
-MinStackSize=16384
-MaxStackSize=1048576
-ImageBase=4194304
-ExeDescription=
-[Directories]
-OutputDir=
-UnitOutputDir=
-PackageDLLOutputDir=
-PackageDCPOutputDir=
-SearchPath=$(DELPHI)\Lib\Debug
-Packages=vcl;rtl;dbrtl;adortl;vcldb;vclx;bdertl;vcldbx;ibxpress;dsnap;cds;bdecds;qrpt;teeui;teedb;tee;dss;teeqr;visualclx;visualdbclx;dsnapcrba;dsnapcon;VclSmp;vclshlctrls;vclie;xmlrtl;inet;inetdbbde;inetdbxpress;inetdb;nmfast;webdsnap;websnap;dbexpress;dbxcds;indy;dclOffice2k;dxcomnd6;EQTLD6;dxEdtrD6;ECQDBCD6;EQDBTLD6;EQGridD6;dxGrEdD6;dxExELD6;dxELibD6;dxBarD6;dxBarDBNavD6;dxBarExtItemsD6;dxBarExtDBItemsD6;dxsbD6;dxDBEdD6;dxInsD6;dxExRwD6;dxmdsd6;dxorgcD6;dxdborD6;dxPageControlD6;Python_d6;PythonVCL_d6
-Conditionals=
-DebugSourceDirs=
-UsePackages=0
-[Parameters]
-RunParams=
-HostApplication=
-Launcher=
-UseLauncher=0
-DebugCWD=
-[Language]
-ActiveLang=
-ProjectLang=
-RootDir=
-[Version Info]
-IncludeVerInfo=0
-AutoIncBuild=0
-MajorVer=1
-MinorVer=0
-Release=0
-Build=0
-Debug=0
-PreRelease=0
-Special=0
-Private=0
-DLL=0
-Locale=1033
-CodePage=1252
-[Version Info Keys]
-CompanyName=
-FileDescription=
-FileVersion=1.0.0.0
-InternalName=
-LegalCopyright=
-LegalTrademarks=
-OriginalFilename=
-ProductName=
-ProductVersion=1.0.0.0
-Comments=
-[Excluded Packages]
-C:\Program Files\Developer Express Inc\ExpressPrinting System\Delphi 7\Lib\dxPSTLLnkD7.bpl=ExpressPrinting System ReportLink for ExpressQuantumTreeList by Developer Express Inc.
-C:\Program Files\Developer Express Inc\ExpressPrinting System\Delphi 7\Lib\dxPSdxDBTLLnkD7.bpl=ExpressPrinting System ReportLink for ExpressQuantumDBTreeList by Developer Express Inc.
-C:\Program Files\Developer Express Inc\ExpressPrinting System\Delphi 7\Lib\dxPSdxDBGrLnkD7.bpl=ExpressPrinting System ReportLink for ExpressQuantumGrid by Developer Express Inc.
-C:\Program Files\Developer Express Inc\ExpressPrinting System\Delphi 7\Lib\dxPSdxDBTVLnkD7.bpl=ExpressPrinting System ReportLink for ExpressDBTree by Developer Express Inc.
-C:\Program Files\Developer Express Inc\ExpressPrinting System\Delphi 7\Lib\dxPSdxInsLnkD7.bpl=ExpressPrinting System ReportLink for ExpressInspector by Developer Express Inc.
-C:\Program Files\Developer Express Inc\ExpressPrinting System\Delphi 7\Lib\dxPSdxOILnkD7.bpl=ExpressPrinting System ReportLink for ExpressRTTIInspector by Developer Express Inc.
-C:\Program Files\Developer Express Inc\ExpressPrinting System\Delphi 7\Lib\dxPSdxMVLnkD7.bpl=ExpressPrinting System ReportLink for ExpressMasterView by Developer Express Inc.
-C:\Program Files\Developer Express Inc\ExpressPrinting System\Delphi 7\Lib\dxPSdxOCLnkD7.bpl=ExpressPrinting System ReportLinks for ExpressOrgChart by Developer Express Inc.
-C:\Program Files\Developer Express Inc\ExpressPrinting System\Delphi 7\Lib\dxPSdxDBOCLnkD7.bpl=ExpressPrinting System ReportLinks for ExpressDBOrgChart by Developer Express Inc.
-C:\Program Files\Developer Express Inc\ExpressPrinting System\Delphi 7\Lib\dxPSdxFCLnkD7.bpl=ExpressPrinting System ReportLinks for ExpressFlowChart by Developer Express Inc.
-C:\Program Files\Developer Express Inc\ExpressPrinting System\Delphi 7\Lib\dxPSdxLCLnkD7.bpl=ExpressPrinting System ReportLink for ExpressLayoutControl by Developer Express Inc.
-C:\Program Files\Developer Express Inc\ExpressPrinting System\Delphi 7\Lib\dxPscxTLLnkD7.bpl=ExpressPrinting System ReportLink for ExpressQuantumTreeList 4 by Developer Express Inc.
-C:\Program Files\Developer Express Inc\ExpressPrinting System\Delphi 7\Lib\dxPScxPCProdD7.bpl=ExpressPrinting System ContainerProducer for ExpressPageControl 2 by Developer Express Inc.
diff --git a/PythonForDelphi/Demos/Demo25/VarPythUnitTest.dpr b/PythonForDelphi/Demos/Demo25/VarPythUnitTest.dpr
index 917b40f5..13933b07 100644
--- a/PythonForDelphi/Demos/Demo25/VarPythUnitTest.dpr
+++ b/PythonForDelphi/Demos/Demo25/VarPythUnitTest.dpr
@@ -1,15 +1,7 @@
-// JCL_DEBUG_EXPERT_GENERATEJDBG OFF
-// JCL_DEBUG_EXPERT_INSERTJDBG OFF
-// JCL_DEBUG_EXPERT_DELETEMAPFILE OFF
program VarPythUnitTest;
uses
-{$IFDEF MSWINDOWS}
Forms,
-{$ENDIF}
-{$IFDEF LINUX}
- QForms,
-{$ENDIF}
fmMain in 'fmMain.pas' {TMain};
{$R *.res}
diff --git a/PythonForDelphi/Demos/Demo25/VarPythUnitTest.kof b/PythonForDelphi/Demos/Demo25/VarPythUnitTest.kof
deleted file mode 100644
index 95425b51..00000000
--- a/PythonForDelphi/Demos/Demo25/VarPythUnitTest.kof
+++ /dev/null
@@ -1,61 +0,0 @@
-[Compiler]
-A=8
-B=0
-C=1
-D=1
-E=0
-F=0
-G=1
-H=1
-I=1
-J=0
-K=0
-L=1
-M=0
-N=1
-O=1
-P=1
-Q=0
-R=0
-S=0
-T=0
-U=0
-V=1
-W=0
-X=1
-Y=1
-Z=1
-ShowHints=1
-ShowWarnings=1
-UnitAliases=
-
-[Linker]
-MapFile=0
-OutputObjs=0
-ConsoleApp=1
-DebugInfo=0
-RemoteSymbols=0
-MinStackSize=16384
-MaxStackSize=1048576
-ImageBase=4194304
-ExeDescription=
-DynamicLoader=/lib/ld-linux.so.2
-
-[Directories]
-OutputDir=
-UnitOutputDir=
-PackageDLLOutputDir=
-PackageDCPOutputDir=
-SearchPath=
-Packages=
-Conditionals=
-DebugSourceDirs=
-UsePackages=0
-
-[Parameters]
-RunParams=
-HostApplication=
-Launcher=/usr/X11R6/bin/xterm -T KylixDebuggerOutput -e bash -i -c %debuggee%
-UseLauncher=0
-DebugCWD=
-
diff --git a/PythonForDelphi/Demos/Demo25/fmMain.pas b/PythonForDelphi/Demos/Demo25/fmMain.pas
index 2287db46..5c9a9f61 100644
--- a/PythonForDelphi/Demos/Demo25/fmMain.pas
+++ b/PythonForDelphi/Demos/Demo25/fmMain.pas
@@ -6,13 +6,8 @@ interface
uses
Classes, SysUtils, Variants,
-{$IFDEF MSWINDOWS}
Windows, Messages, Graphics, Controls, Forms,
Dialogs, ExtCtrls, StdCtrls, ComCtrls,
-{$ENDIF}
-{$IFDEF LINUX}
- QGraphics, QControls, QForms, QDialogs, QExtCtrls, QStdCtrls, QComCtrls,
-{$ENDIF}
PythonEngine, PythonGUIInputOutput, Contnrs;
type
@@ -69,12 +64,7 @@ implementation
uses VarPyth;
-{$IFDEF MSWINDOWS}
{$R *.dfm}
-{$ENDIF}
-{$IFDEF LINUX}
-{$R *.xfm}
-{$ENDIF}
procedure TMain.Log( const AText : String );
begin
@@ -270,14 +260,12 @@ procedure TMain.btnTestIntegersClick(Sender: TObject);
Assert( b+1 = big+1 );
Assert( b*2 = big*2 );
Assert( b div 2 = big div 2 );
-{$IFDEF PYTHON23_OR_HIGHER}
c := VarPythonCreate(True);
Assert(VarIsBool(c));
Assert(VarIsTrue(c));
c := VarPythonCreate(False);
Assert(VarIsBool(c));
Assert(not VarIsTrue(c));
-{$ENDIF}
// Done!
Log('Integer test was Ok.');
@@ -828,9 +816,7 @@ procedure TMain.btnTestMappingsClick(Sender: TObject);
procedure TMain.btnTestDatesClick(Sender: TObject);
var
a, b, _timeMod : Variant;
-{$IFDEF PYTHON23_OR_HIGHER}
c : Variant;
-{$ENDIF}
_date, _date2 : TDateTime;
_year, _month, _day : Word;
_year2, _month2, _day2 : Word;
@@ -876,7 +862,6 @@ procedure TMain.btnTestDatesClick(Sender: TObject);
Assert( _min2 = _min );
Assert( _sec2 = _sec );
-{$IFDEF PYTHON23_OR_HIGHER}
// test new datetime module
_timeMod := Import('datetime'); // get the datetime module of Python
//or _timeMod := DatetimeModule; // get the datetime module of Python
@@ -1003,7 +988,6 @@ procedure TMain.btnTestDatesClick(Sender: TObject);
finally
GetPythonEngine.DatetimeConversionMode := dcmToTuple;
end;
-{$ENDIF}
// Done!
Log('Dates test was Ok.');
end;
diff --git a/PythonForDelphi/Demos/Demo25/fmMain.xfm b/PythonForDelphi/Demos/Demo25/fmMain.xfm
deleted file mode 100644
index 76c766ef..00000000
--- a/PythonForDelphi/Demos/Demo25/fmMain.xfm
+++ /dev/null
@@ -1,289 +0,0 @@
-object Main: TMain
- Left = 145
- Top = 76
- Width = 769
- Height = 561
- VertScrollBar.Range = 356
- ActiveControl = Memo1
- Caption = 'VarPyth unit tests'
- Color = clButton
- Font.Color = clText
- Font.Height = 11
- Font.Name = 'MS Sans Serif'
- Font.Pitch = fpVariable
- Font.Style = []
- Font.Weight = 0
- ParentFont = False
- OnCreate = FormCreate
- PixelsPerInch = 96
- TextHeight = 13
- TextWidth = 5
- object Splitter1: TSplitter
- Left = 0
- Top = 249
- Width = 769
- Height = 5
- Cursor = crVSplit
- Align = alTop
- end
- object Memo1: TMemo
- Left = 0
- Top = 0
- Width = 769
- Height = 249
- Align = alTop
- TabOrder = 0
- end
- object Panel1: TPanel
- Left = 0
- Top = 459
- Width = 769
- Height = 102
- Align = alBottom
- BevelOuter = bvNone
- TabOrder = 1
- object ProgressBar1: TProgressBar
- Left = 0
- Top = 86
- Width = 769
- Height = 16
- Align = alBottom
- Visible = False
- end
- object Label1: TLabel
- Left = 616
- Top = 59
- Width = 24
- Height = 13
- Caption = 'times'
- end
- object btnExecuteScript: TButton
- Left = 8
- Top = 8
- Width = 89
- Height = 25
- Caption = 'E&xecute Script'
- TabOrder = 0
- OnClick = btnExecuteScriptClick
- end
- object btnTestIntegers: TButton
- Left = 128
- Top = 8
- Width = 75
- Height = 25
- Caption = 'Test Integers'
- TabOrder = 1
- OnClick = btnTestIntegersClick
- end
- object btnTestFloats: TButton
- Left = 216
- Top = 8
- Width = 75
- Height = 25
- Caption = 'Test Floats'
- TabOrder = 2
- OnClick = btnTestFloatsClick
- end
- object btnTestSequences: TButton
- Left = 392
- Top = 8
- Width = 89
- Height = 25
- Caption = 'Test Sequences'
- TabOrder = 3
- OnClick = btnTestSequencesClick
- end
- object btnTestMappings: TButton
- Left = 488
- Top = 8
- Width = 89
- Height = 25
- Caption = 'Test Mappings'
- TabOrder = 4
- OnClick = btnTestMappingsClick
- end
- object btnTestObjects: TButton
- Left = 664
- Top = 8
- Width = 75
- Height = 25
- Caption = 'Test Objects'
- TabOrder = 5
- OnClick = btnTestObjectsClick
- end
- object btnTestStrings: TButton
- Left = 304
- Top = 8
- Width = 75
- Height = 25
- Caption = 'Test Strings'
- TabOrder = 6
- OnClick = btnTestStringsClick
- end
- object cbIntegers: TCheckBox
- Left = 128
- Top = 33
- Width = 73
- Height = 17
- Caption = 'Included'
- Checked = True
- State = cbChecked
- TabOrder = 7
- end
- object cbFloats: TCheckBox
- Left = 216
- Top = 33
- Width = 73
- Height = 17
- Caption = 'Included'
- Checked = True
- State = cbChecked
- TabOrder = 8
- end
- object cbStrings: TCheckBox
- Left = 304
- Top = 33
- Width = 73
- Height = 17
- Caption = 'Included'
- Checked = True
- State = cbChecked
- TabOrder = 9
- end
- object cbSequences: TCheckBox
- Left = 392
- Top = 33
- Width = 73
- Height = 17
- Caption = 'Included'
- Checked = True
- State = cbChecked
- TabOrder = 10
- end
- object cbMappings: TCheckBox
- Left = 488
- Top = 33
- Width = 73
- Height = 17
- Caption = 'Included'
- Checked = True
- State = cbChecked
- TabOrder = 11
- end
- object cbObjects: TCheckBox
- Left = 664
- Top = 33
- Width = 73
- Height = 17
- Caption = 'Included'
- Checked = True
- State = cbChecked
- TabOrder = 12
- end
- object btnRunSelectedTests: TButton
- Left = 128
- Top = 56
- Width = 121
- Height = 25
- Caption = 'Run selected tests once'
- TabOrder = 13
- OnClick = btnRunSelectedTestsClick
- end
- object edtTestCount: TEdit
- Left = 568
- Top = 56
- Width = 41
- Height = 21
- TabOrder = 14
- Text = '1000'
- end
- object btnRunNTimes: TButton
- Left = 400
- Top = 56
- Width = 163
- Height = 25
- Caption = 'Run selected tests n times'
- TabOrder = 16
- OnClick = btnRunNTimesClick
- end
- object btnTestDates: TButton
- Left = 584
- Top = 8
- Width = 75
- Height = 25
- Caption = 'Test Dates'
- TabOrder = 18
- OnClick = btnTestDatesClick
- end
- object cbDates: TCheckBox
- Left = 584
- Top = 33
- Width = 77
- Height = 17
- Caption = 'Included'
- Checked = True
- State = cbChecked
- TabOrder = 17
- end
- end
- object Memo2: TMemo
- Left = 0
- Top = 254
- Width = 769
- Height = 205
- Align = alClient
- Lines.Strings = (
- 'class Foo:'
- ' def __init__(Self):'
- ' Self.Value = 0'
- ''
- ' def __del__(Self):'
- ' print "delete", Self'
- ''
- ' def Inc(Self, AValue = 1):'
- ' Self.Value = Self.Value + AValue'
- ''
- ' def GetSelf(Self):'
- ' return Self'
- ''
- ' def GetValue(Self):'
- ' return Self.Value'
- ''
- ' def SetABC(Self, A, B, C):'
- ' Self.A = A'
- ' Self.B = B'
- ' Self.C = C'
- ''
- ' def Add(Self, AFooInst):'
- ' Self.Value = Self.Value + AFooInst.Value'
- ''
- 'class Bar(Foo):'
- ' def Inc(Self, AValue = 1):'
- ' Self.Value = Self.Value - AValue'
- 'def Add(a, b):'
- ' return a + b'
- ''
- 'f = Foo()'
- 'print "Created", f'
- 'f.Inc()'
- 'f.Inc(2)'
- ''
- 'b = Bar()'
- 'b.Inc()'
- 'b.Inc(2)')
- TabOrder = 2
- end
- object PythonEngine1: TPythonEngine
- DllName = 'python15.dll'
- APIVersion = 1007
- RegVersion = '1.5'
- IO = PythonGUIInputOutput1
- Left = 192
- Top = 48
- end
- object PythonGUIInputOutput1: TPythonGUIInputOutput
- Output = Memo1
- Left = 232
- Top = 48
- end
-end
diff --git a/PythonForDelphi/Demos/Demo26/Project1.CW3 b/PythonForDelphi/Demos/Demo26/Project1.CW3
deleted file mode 100644
index ca5706f1..00000000
--- a/PythonForDelphi/Demos/Demo26/Project1.CW3
+++ /dev/null
@@ -1,68 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/PythonForDelphi/Demos/Demo26/Project1.conf b/PythonForDelphi/Demos/Demo26/Project1.conf
deleted file mode 100644
index 84e6d103..00000000
--- a/PythonForDelphi/Demos/Demo26/Project1.conf
+++ /dev/null
@@ -1,32 +0,0 @@
--$A8
--$B-
--$C+
--$D+
--$E-
--$F-
--$G+
--$H+
--$I+
--$J-
--$K-
--$L+
--$M-
--$N+
--$O+
--$P+
--$Q-
--$R-
--$S-
--$T-
--$U-
--$V+
--$W-
--$X+
--$YD
--$Z1
--cg
--H+
--W+
--M
--$M16384,1048576
--K$00400000
diff --git a/PythonForDelphi/Demos/Demo26/Project1.dof b/PythonForDelphi/Demos/Demo26/Project1.dof
deleted file mode 100644
index 0395a90b..00000000
--- a/PythonForDelphi/Demos/Demo26/Project1.dof
+++ /dev/null
@@ -1,243 +0,0 @@
-[FileVersion]
-Version=7.0
-[Compiler]
-A=8
-B=0
-C=1
-D=1
-E=0
-F=0
-G=1
-H=1
-I=1
-J=1
-K=0
-L=1
-M=0
-N=1
-O=0
-P=1
-Q=0
-R=0
-S=0
-T=0
-U=0
-V=1
-W=0
-X=1
-Y=1
-Z=1
-ShowHints=1
-ShowWarnings=1
-UnitAliases=WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;
-NamespacePrefix=
-SymbolDeprecated=1
-SymbolLibrary=1
-SymbolPlatform=1
-UnitLibrary=1
-UnitPlatform=1
-UnitDeprecated=1
-HResultCompat=1
-HidingMember=1
-HiddenVirtual=1
-Garbage=1
-BoundsError=1
-ZeroNilCompat=1
-StringConstTruncated=1
-ForLoopVarVarPar=1
-TypedConstVarPar=1
-AsgToTypedConst=1
-CaseLabelRange=1
-ForVariable=1
-ConstructingAbstract=1
-ComparisonFalse=1
-ComparisonTrue=1
-ComparingSignedUnsigned=1
-CombiningSignedUnsigned=1
-UnsupportedConstruct=1
-FileOpen=1
-FileOpenUnitSrc=1
-BadGlobalSymbol=1
-DuplicateConstructorDestructor=1
-InvalidDirective=1
-PackageNoLink=1
-PackageThreadVar=1
-ImplicitImport=1
-HPPEMITIgnored=1
-NoRetVal=1
-UseBeforeDef=1
-ForLoopVarUndef=1
-UnitNameMismatch=1
-NoCFGFileFound=1
-MessageDirective=1
-ImplicitVariants=1
-UnicodeToLocale=1
-LocaleToUnicode=1
-ImagebaseMultiple=1
-SuspiciousTypecast=1
-PrivatePropAccessor=1
-UnsafeType=0
-UnsafeCode=0
-UnsafeCast=0
-[Linker]
-MapFile=0
-OutputObjs=0
-ConsoleApp=1
-DebugInfo=0
-RemoteSymbols=0
-MinStackSize=16384
-MaxStackSize=1048576
-ImageBase=4194304
-ExeDescription=
-[Directories]
-OutputDir=
-UnitOutputDir=
-PackageDLLOutputDir=
-PackageDCPOutputDir=
-SearchPath=$(DELPHI)\Lib\Debug
-Packages=Vcl50;Vclx50;VclSmp50;Vcldb50;vclado50;ibevnt50;Vclbde50;vcldbx50;Qrpt50;TeeUI50;TeeDB50;Tee50;Dss50;TeeQR50;VCLIB50;Vclmid50;vclie50;Inetdb50;Inet50;NMFast50;webmid50;dclocx50;dclaxserver50;Indy50;VM;rbCIDE55;rbIDE55;rbRCL55;rbBDE55;rbDBDE55;rbDAD55;rbDIDE55;rbUSER55;rbDB55;rbADO55;rbIBE55
-Conditionals=
-DebugSourceDirs=
-UsePackages=0
-[Parameters]
-RunParams=
-HostApplication=
-Launcher=
-UseLauncher=0
-DebugCWD=
-[Language]
-ActiveLang=
-ProjectLang=$00000409
-RootDir=
-[Version Info]
-IncludeVerInfo=0
-AutoIncBuild=0
-MajorVer=1
-MinorVer=0
-Release=0
-Build=0
-Debug=0
-PreRelease=0
-Special=0
-Private=0
-DLL=0
-Locale=1033
-CodePage=1252
-[Excluded Packages]
-c:\program files\borland\delphi7\RBuilder\Lib\dclRBC77.bpl=ReportBuilder TeeChart 4.04 Components
-c:\program files\borland\delphi7\RBuilder\Lib\dclDAD77.bpl=ReportBuilder Data Access Environment
-c:\program files\borland\delphi7\RBuilder\Lib\dclRBU77.bpl=ReportBuilder Sample Components
-C:\Program Files\Borland\Delphi7\\RBuilder\Lib\dclRBE77.bpl=ReportBuilder Enterprise
-C:\Program Files\Borland\Delphi7\\RBuilder\Lib\dclRAP77.bpl=ReportBuilder RAP Language
-C:\Program Files\RemObjects Software\Pascal Script for Delphi\Dcu\D7\PascalScript_Core_D7.bpl=RemObjects Pascal Script - Core Package
-c:\program files\borland\delphi7\Projects\Bpl\Tiger.bpl=Tiger Framework
-c:\program files\borland\delphi7\Projects\Bpl\VirtualTreesD7D.bpl=Virtual Treeview design time package
-c:\program files\borland\delphi7\Projects\Bpl\VirtualExplorerListviewExD7D.bpl=Virtual ExplorerListviewEx Designtime Package
-C:\Program Files\Borland\Delphi7\Projects\Bpl\tb2k_d7.bpl=Toolbar2000 Components (Jordan Russell)
-C:\Program Files\Borland\Delphi7\Projects\Bpl\tbx_d7.bpl=Toolbar2000 -- TBX Extensions (Alex Denisov)
-C:\PROGRA~1\Borland\Delphi7\Projects\Bpl\JclDebugIdeD70.bpl=JCL Debug IDE extension for Delphi 7
-C:\PROGRA~1\Borland\Delphi7\Projects\Bpl\ProjectAnalyzerD70.bpl=JCL Project Analyzer for Delphi 7
-C:\PROGRA~1\Borland\Delphi7\Projects\Bpl\IdeOpenDlgFavoriteD70.bpl=JCL Open and Save IDE dialogs with favorite folders for Delphi 7
-C:\Program Files\Borland\Delphi7\Projects\Bpl\JvAppFrmD7D.bpl=JVCL Application and Form Components
-C:\Program Files\Borland\Delphi7\Projects\Bpl\JvCoreD7D.bpl=JVCL Core Components
-C:\Program Files\Borland\Delphi7\Projects\Bpl\JvBandsD7D.bpl=JVCL Band Objects
-C:\Program Files\Borland\Delphi7\Projects\Bpl\JvBDED7D.bpl=JVCL BDE Components
-C:\Program Files\Borland\Delphi7\Projects\Bpl\JvDBD7D.bpl=JVCL Database Components
-C:\Program Files\Borland\Delphi7\Projects\Bpl\JvCmpD7D.bpl=JVCL Non-Visual Components
-C:\Program Files\Borland\Delphi7\Projects\Bpl\JvCryptD7D.bpl=JVCL Encryption and Compression Components
-C:\Program Files\Borland\Delphi7\Projects\Bpl\JvCtrlsD7D.bpl=JVCL Visual Controls
-C:\Program Files\Borland\Delphi7\Projects\Bpl\JvCustomD7D.bpl=JVCL Custom Controls
-C:\Program Files\Borland\Delphi7\Projects\Bpl\JvDlgsD7D.bpl=JVCL Dialog Components
-C:\Program Files\Borland\Delphi7\Projects\Bpl\JvDockingD7D.bpl=JVCL Docking Components
-C:\Program Files\Borland\Delphi7\Projects\Bpl\JvDotNetCtrlsD7D.bpl=JVCL DotNet Controls
-C:\Program Files\Borland\Delphi7\Projects\Bpl\JvEDID7D.bpl=JVCL EDI Components Designtime Package
-C:\Program Files\Borland\Delphi7\Projects\Bpl\JvGlobusD7D.bpl=JVCL Globus Components
-C:\Program Files\Borland\Delphi7\Projects\Bpl\JvHMID7D.bpl=JVCL HMI Controls design time unit
-C:\Program Files\Borland\Delphi7\Projects\Bpl\JvInspectorD7D.bpl=JVCL Inspector Components
-C:\Program Files\Borland\Delphi7\Projects\Bpl\JvInterpreterD7D.bpl=JVCL Interpreter Components
-C:\Program Files\Borland\Delphi7\Projects\Bpl\JvJansD7D.bpl=JVCL Jans Components
-C:\Program Files\Borland\Delphi7\Projects\Bpl\JvManagedThreadsD7D.bpl=JVCL Managed Threads
-C:\Program Files\Borland\Delphi7\Projects\Bpl\JvMMD7D.bpl=JVCL Multimedia and Image Components
-C:\Program Files\Borland\Delphi7\Projects\Bpl\JvNetD7D.bpl=JVCL Network Components
-C:\Program Files\Borland\Delphi7\Projects\Bpl\JvPageCompsD7D.bpl=JVCL Page Style Components
-C:\Program Files\Borland\Delphi7\Projects\Bpl\JvPluginD7D.bpl=JVCL Plugin Components
-C:\Program Files\Borland\Delphi7\Projects\Bpl\JvPrintPreviewD7D.bpl=JVCL Print Preview Components
-C:\Program Files\Borland\Delphi7\Projects\Bpl\JvStdCtrlsD7D.bpl=JVCL Standard Controls
-C:\Program Files\Borland\Delphi7\Projects\Bpl\JvSystemD7D.bpl=JVCL System Components
-C:\Program Files\Borland\Delphi7\Projects\Bpl\JvTimeFrameworkD7D.bpl=JVCL Time Framework
-C:\Program Files\Borland\Delphi7\Projects\Bpl\JvUIBD7D.bpl=JVCL Unified Interbase Components
-C:\Program Files\Borland\Delphi7\Projects\Bpl\JvValidatorsD7D.bpl=JVCL Validators and Error Provider Components
-C:\Program Files\Borland\Delphi7\Projects\Bpl\JvWizardD7D.bpl=JVCL Wizard Design Time Package
-C:\Program Files\Borland\Delphi7\Projects\Bpl\JvXPCtrlsD7D.bpl=JVCL XP Controls
-c:\program files\borland\delphi7\Projects\Bpl\ehs_d7.bpl=EC Software Help Suite
-c:\program files\borland\delphi7\Projects\Bpl\tbxdsgn_d7.bpl=Toolbar2000 -- TBX Extensions Design Package (Alex Denisov)
-C:\Program Files\Borland\Delphi7\Projects\Bpl\tb2kdsgn_d7.bpl=Toolbar2000 Design Package (Jordan Russell)
-c:\program files\borland\delphi7\Projects\Bpl\TBXSwitcherItemDsgn_d7.bpl=(untitled)
-c:\program files\borland\delphi7\Projects\Bpl\dclusr70.bpl=Borland User Components
-c:\program files\borland\delphi7\Projects\Bpl\VirtualShellToolsD7D.bpl=Virtual Shell Tools Designtime Package
-C:\Program Files\madCollection\madBasic\Delphi 7\madBasic_.bpl=madBasic 1.1k - www.madshi.net
-C:\Program Files\madCollection\madBasic\Delphi 7\madHelp_.bpl=madHelp 1.1a - www.madshi.net
-C:\Program Files\madCollection\madDisAsm\Delphi 7\madDisAsm_.bpl=madDisAsm 2.1b - www.madshi.net
-C:\Program Files\madCollection\madExcept\Delphi 7\madExcept_.bpl=madExcept 2.7g - www.madshi.net
-C:\Program Files\madCollection\madExcept\Delphi 7\madExceptVcl_.bpl=madExceptVcl 2.0c - www.madshi.net
-C:\Program Files\madCollection\madExcept\Delphi 7\madExceptIde_.bpl=madExceptIde 1.0d - www.madshi.net
-C:\Program Files\madCollection\madExcept\Delphi 7\madExceptWizard_.bpl=madExceptWizard 2.7e - www.madshi.net
-C:\Program Files\Developer Express.VCL\Library\Delphi7\dclcxLibraryVCLD7.bpl=Express Cross Platform Library (VCL Edition) by Developer Express Inc.
-C:\Program Files\Developer Express.VCL\Library\Delphi7\dcldxBarD7.bpl=ExpressBars by Developer Express Inc.
-C:\Program Files\Developer Express.VCL\Library\Delphi7\dcldxBarDBNavD7.bpl=ExpressBars DBNavigator by Developer Express Inc.
-C:\Program Files\Developer Express.VCL\Library\Delphi7\dcldxBarExtDBItemsD7.bpl=ExpressBars extended DB items by Developer Express Inc.
-C:\Program Files\Developer Express.VCL\Library\Delphi7\dcldxBarExtItemsD7.bpl=ExpressBars extended items by Developer Express Inc.
-C:\Program Files\Developer Express.VCL\Library\Delphi7\dcldxDockingD7.bpl=ExpressDocking Library by Developer Express Inc.
-C:\Program Files\Developer Express.VCL\Library\Delphi7\dcldxsbD7.bpl=ExpressSideBar by Developer Express Inc.
-C:\Program Files\Developer Express.VCL\Library\Delphi7\dclcxEditorsVCLD7.bpl=ExpressEditors Library 5 (VCL Edition) by Developer Express Inc.
-C:\Program Files\Developer Express.VCL\Library\Delphi7\dclcxExtEditorsVCLD7.bpl=ExpressExtendedEditors Library 5 (VCL Edition) by Developer Express Inc.
-C:\Program Files\Developer Express.VCL\Library\Delphi7\dclcxPageControlVCLD7.bpl=Express Cross Platform PageControl (VCL Edition) by Developer Express Inc.
-C:\Program Files\Developer Express.VCL\Library\Delphi7\dclcxGridVCLD7.bpl=ExpressQuantumGrid 5 (VCL Edition) by Developer Express Inc.
-C:\Program Files\Developer Express.VCL\Library\Delphi7\dclcxSchedulerVCLD7.bpl=ExpressScheduler (VCL Edition) by Developer Express Inc.
-C:\Program Files\Developer Express.VCL\Library\Delphi7\dclcxTreeListVCLD7.bpl=ExpressQuantumTreeList 4 (VCL Edition) by Developer Express Inc.
-C:\Program Files\Developer Express.VCL\Library\Delphi7\dcldxEdtrD7.bpl=Express inplace editors
-C:\Program Files\Developer Express.VCL\Library\Delphi7\dcldxELibD7.bpl=ExpressEditors Library by Developer Express Inc.
-C:\Program Files\Developer Express.VCL\Library\Delphi7\dclcxVerticalGridVCLD7.bpl=ExpressVerticalGrid (VCL Edition) by Developer Express Inc.
-C:\Program Files\Developer Express.VCL\Library\Delphi7\dclcxSpreadSheetVCLD7.bpl=ExpressSpreadSheet (VCL Edition) by Developer Express Inc.
-C:\Program Files\Developer Express.VCL\Library\Delphi7\dcldxNavBarD7.bpl=ExpressNavBar by Developer Express Inc.
-C:\Program Files\Developer Express.VCL\Library\Delphi7\dclcxWebD7.bpl=ExpressWeb Framework by Developer Express Inc.
-C:\Program Files\Developer Express.VCL\Library\Delphi7\dclcxWebPascalScriptD7.bpl=Pascal Script Engine for EWF by Developer Express Inc.
-C:\Program Files\Developer Express.VCL\Library\Delphi7\dclcxWebSnapD7.bpl=ExpressWebPage Module for WebSnap Application by Developer Express Inc.
-C:\Program Files\Developer Express.VCL\Library\Delphi7\dclcxWebTeeChartD7.bpl=WebTeeChart for EWF by Developer Express Inc.
-C:\Program Files\Developer Express.VCL\Library\Delphi7\dcldxMasterViewD7.bpl=ExpressMasterView by Developer Express Inc.
-C:\Program Files\Developer Express.VCL\Library\Delphi7\dcldxmdsD7.bpl=ExpressMemData by Developer Express Inc.
-C:\Program Files\Developer Express.VCL\Library\Delphi7\dcldxdbtrD7.bpl=ExpressDBTree by Developer Express Inc.
-C:\Program Files\Developer Express.VCL\Library\Delphi7\dcldxtrmdD7.bpl=ExpressTreePrintedDataSet by Developer Express Inc.
-C:\Program Files\Developer Express.VCL\Library\Delphi7\dcldxOrgCD7.bpl=ExpressOrgChart by Developer Express Inc.
-C:\Program Files\Developer Express.VCL\Library\Delphi7\dcldxDBOrD7.bpl=ExpressDBOrgChart by Developer Express Inc.
-C:\Program Files\Developer Express.VCL\Library\Delphi7\dcldxFlowChartD7.bpl=ExpressFlowChart by Developer Express Inc.
-C:\Program Files\Developer Express.VCL\Library\Delphi7\dcldxLayoutControlD7.bpl=ExpressLayout Control by Developer Express Inc.
-C:\WINDOWS\system32\dxLayoutControldxEditAdaptersD7.bpl=ExpressLayoutControl Adapters for ExpressEditors Library by Developer Express Inc.
-C:\WINDOWS\system32\dxLayoutControlcxEditAdaptersD7.bpl=ExpressLayoutControl Adapters for ExpressEditors Library 5 by Developer Express Inc.
-C:\Program Files\Developer Express.VCL\Library\Delphi7\dclECQDBCD7.bpl=ExpressQuantumDBControl by Developer Express Inc.
-C:\Program Files\Developer Express.VCL\Library\Delphi7\dclEQTLD7.bpl=ExpressQuantumTreeList by Developer Express Inc.
-C:\Program Files\Developer Express.VCL\Library\Delphi7\dclEQDBTLD7.bpl=ExpressQuantumDBTreeList by Developer Express Inc.
-C:\Program Files\Developer Express.VCL\Library\Delphi7\dcldxInsD7.bpl=ExpressInspector by Developer Express Inc.
-C:\Program Files\Developer Express.VCL\Library\Delphi7\dcldxObjInsD7.bpl=ExpressRTTIInspector by Developer Express Inc.
-C:\Program Files\Developer Express.VCL\Library\Delphi7\dcldxPSCoreD7.bpl=ExpressPrinting System (core 3.1) by Developer Express Inc.
-C:\WINDOWS\system32\dxPSTeeChartD7.bpl=ExpressPrinting System ReportLink for TeeChart by Developer Express Inc.
-C:\WINDOWS\system32\dxPsPrVwAdvD7.bpl=ExpressPrinting System Advanced Preview Window by Developer Express Inc.
-C:\WINDOWS\system32\dxPSLnksD7.bpl=ExpressPrinting System ReportLinks (Standard) by Developer Express Inc.
-C:\WINDOWS\system32\dxPSdxInsLnkD7.bpl=ExpressPrinting System ReportLink for ExpressInspector by Developer Express Inc.
-C:\WINDOWS\system32\dxPSdxOCLnkD7.bpl=ExpressPrinting System ReportLinks for ExpressOrgChart by Developer Express Inc.
-C:\WINDOWS\system32\dxPSdxMVLnkD7.bpl=ExpressPrinting System ReportLink for ExpressMasterView by Developer Express Inc.
-C:\WINDOWS\system32\dxPSdxLCLnkD7.bpl=ExpressPrinting System ReportLink for ExpressLayoutControl by Developer Express Inc.
-C:\WINDOWS\system32\dxPSdxOILnkD7.bpl=ExpressPrinting System ReportLink for ExpressRTTIInspector by Developer Express Inc.
-C:\WINDOWS\system32\dxPSdxFCLnkD7.bpl=ExpressPrinting System ReportLinks for ExpressFlowChart by Developer Express Inc.
-C:\WINDOWS\system32\dxPSdxDBTVLnkD7.bpl=ExpressPrinting System ReportLink for ExpressDBTree by Developer Express Inc.
-C:\WINDOWS\system32\dxPSdxDBOCLnkD7.bpl=ExpressPrinting System ReportLinks for ExpressDBOrgChart by Developer Express Inc.
-C:\WINDOWS\system32\dxPSDBTeeChartD7.bpl=ExpressPrinting System ReportLink for DBTeeChart by Developer Express Inc.
-C:\WINDOWS\system32\dxPScxCommonD7.bpl=ExpressPrinting System Cross Platform Library by Developer Express Inc.
-C:\WINDOWS\system32\dxPscxTLLnkD7.bpl=ExpressPrinting System ReportLink for ExpressQuantumTreeList 4 by Developer Express Inc.
-C:\WINDOWS\system32\dxPScxSSLnkD7.bpl=ExpressPrinting System ReportLink for ExpressSpreadSheet by Developer Express Inc.
-C:\WINDOWS\system32\dxPScxSchedulerLnkD7.bpl=ExpressPrinting System ReportLink for ExpressScheduler by Developer Express Inc.
-C:\WINDOWS\system32\dxPScxPCProdD7.bpl=ExpressPrinting System ContainerProducer for ExpressPageControl 2 by Developer Express Inc.
-C:\WINDOWS\system32\dxPScxGridLnkD7.bpl=ExpressPrinting System ReportLink for ExpressQuantumGrid 5 by Developer Express Inc.
-C:\WINDOWS\system32\dxPScxExtCommonD7.bpl=ExpressPrinting System Extended Cross Platform Library by Developer Express Inc.
-C:\WINDOWS\system32\dxPScxVGridLnkD7.bpl=ExpressPrinting System ReportLink for ExpressVerticalGrid by Developer Express Inc.
-c:\program files\borland\delphi7\Projects\Bpl\SynEdit_D7.bpl=SynEdit component suite
diff --git a/PythonForDelphi/Demos/Demo26/Project1.dpr b/PythonForDelphi/Demos/Demo26/Project1.dpr
index 34e6006c..7a68fc98 100644
--- a/PythonForDelphi/Demos/Demo26/Project1.dpr
+++ b/PythonForDelphi/Demos/Demo26/Project1.dpr
@@ -3,12 +3,7 @@ program Project1;
{$I Definition.Inc}
uses
-{$IFDEF MSWINDOWS}
Forms,
-{$ENDIF}
-{$IFDEF LINUX}
- QForms,
-{$ENDIF}
Unit1 in 'Unit1.pas' {Form1};
{$R *.res}
diff --git a/PythonForDelphi/Demos/Demo26/Project1.kof b/PythonForDelphi/Demos/Demo26/Project1.kof
deleted file mode 100644
index 6ad26fc6..00000000
--- a/PythonForDelphi/Demos/Demo26/Project1.kof
+++ /dev/null
@@ -1,61 +0,0 @@
-[Compiler]
-A=8
-B=0
-C=1
-D=1
-E=0
-F=0
-G=1
-H=1
-I=1
-J=0
-K=0
-L=1
-M=0
-N=1
-O=1
-P=1
-Q=0
-R=0
-S=0
-T=0
-U=0
-V=1
-W=0
-X=1
-Y=1
-Z=1
-ShowHints=1
-ShowWarnings=1
-UnitAliases=
-
-[Linker]
-MapFile=0
-OutputObjs=0
-ConsoleApp=1
-DebugInfo=0
-RemoteSymbols=0
-MinStackSize=16384
-MaxStackSize=1048576
-ImageBase=4194304
-ExeDescription=
-DynamicLoader=/lib/ld-linux.so.2
-
-[Directories]
-OutputDir=
-UnitOutputDir=
-PackageDLLOutputDir=
-PackageDCPOutputDir=
-SearchPath=
-Packages=
-Conditionals=
-DebugSourceDirs=
-UsePackages=0
-
-[Parameters]
-RunParams=
-HostApplication=
-Launcher=/usr/X11R6/bin/xterm -T KylixDebuggerOutput -e bash -i -c %debuggee%
-UseLauncher=0
-DebugCWD=
-
diff --git a/PythonForDelphi/Demos/Demo26/Unit1.pas b/PythonForDelphi/Demos/Demo26/Unit1.pas
index c0ce8cd0..27ad4a85 100644
--- a/PythonForDelphi/Demos/Demo26/Unit1.pas
+++ b/PythonForDelphi/Demos/Demo26/Unit1.pas
@@ -6,13 +6,8 @@ interface
uses
SysUtils, Classes,
-{$IFDEF MSWINDOWS}
Windows, Messages, Graphics, Controls, Forms, Dialogs,
StdCtrls, ExtCtrls, ComCtrls,
-{$ENDIF}
-{$IFDEF LINUX}
- QForms, QStdCtrls, QControls, QExtCtrls,
-{$ENDIF}
PythonEngine, PythonGUIInputOutput;
type
@@ -29,9 +24,9 @@ TForm1 = class(TForm)
procedure Button1Click(Sender: TObject);
procedure PythonType1Initialization(Sender: TObject);
private
- { Déclarations privées }
+ { D�clarations priv�es }
public
- { Déclarations publiques }
+ { D�clarations publiques }
end;
// This is a Delphi class implementing a new Python type
diff --git a/PythonForDelphi/Demos/Demo28/Project1.conf b/PythonForDelphi/Demos/Demo28/Project1.conf
deleted file mode 100644
index 84e6d103..00000000
--- a/PythonForDelphi/Demos/Demo28/Project1.conf
+++ /dev/null
@@ -1,32 +0,0 @@
--$A8
--$B-
--$C+
--$D+
--$E-
--$F-
--$G+
--$H+
--$I+
--$J-
--$K-
--$L+
--$M-
--$N+
--$O+
--$P+
--$Q-
--$R-
--$S-
--$T-
--$U-
--$V+
--$W-
--$X+
--$YD
--$Z1
--cg
--H+
--W+
--M
--$M16384,1048576
--K$00400000
diff --git a/PythonForDelphi/Demos/Demo28/Project1.dof b/PythonForDelphi/Demos/Demo28/Project1.dof
deleted file mode 100644
index 72c886ef..00000000
--- a/PythonForDelphi/Demos/Demo28/Project1.dof
+++ /dev/null
@@ -1,148 +0,0 @@
-[FileVersion]
-Version=7.0
-[Compiler]
-A=8
-B=0
-C=1
-D=1
-E=0
-F=0
-G=1
-H=1
-I=1
-J=1
-K=0
-L=1
-M=0
-N=1
-O=1
-P=1
-Q=0
-R=0
-S=0
-T=0
-U=0
-V=1
-W=0
-X=1
-Y=1
-Z=1
-ShowHints=1
-ShowWarnings=1
-UnitAliases=WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;
-NamespacePrefix=
-SymbolDeprecated=1
-SymbolLibrary=1
-SymbolPlatform=1
-UnitLibrary=1
-UnitPlatform=1
-UnitDeprecated=1
-HResultCompat=1
-HidingMember=1
-HiddenVirtual=1
-Garbage=1
-BoundsError=1
-ZeroNilCompat=1
-StringConstTruncated=1
-ForLoopVarVarPar=1
-TypedConstVarPar=1
-AsgToTypedConst=1
-CaseLabelRange=1
-ForVariable=1
-ConstructingAbstract=1
-ComparisonFalse=1
-ComparisonTrue=1
-ComparingSignedUnsigned=1
-CombiningSignedUnsigned=1
-UnsupportedConstruct=1
-FileOpen=1
-FileOpenUnitSrc=1
-BadGlobalSymbol=1
-DuplicateConstructorDestructor=1
-InvalidDirective=1
-PackageNoLink=1
-PackageThreadVar=1
-ImplicitImport=1
-HPPEMITIgnored=1
-NoRetVal=1
-UseBeforeDef=1
-ForLoopVarUndef=1
-UnitNameMismatch=1
-NoCFGFileFound=1
-MessageDirective=1
-ImplicitVariants=1
-UnicodeToLocale=1
-LocaleToUnicode=1
-ImagebaseMultiple=1
-SuspiciousTypecast=1
-PrivatePropAccessor=1
-UnsafeType=0
-UnsafeCode=0
-UnsafeCast=0
-[Linker]
-MapFile=0
-OutputObjs=0
-ConsoleApp=1
-DebugInfo=0
-RemoteSymbols=0
-MinStackSize=16384
-MaxStackSize=1048576
-ImageBase=4194304
-ExeDescription=
-[Directories]
-OutputDir=
-UnitOutputDir=
-PackageDLLOutputDir=
-PackageDCPOutputDir=
-SearchPath=
-Packages=Vcl50;Vclx50;VclSmp50;Vcldb50;vclado50;ibevnt50;Vclbde50;vcldbx50;Qrpt50;VCLIB50;Vclmid50;vclie50;Inetdb50;Inet50;NMFast50;webmid50;dclocx50;dclaxserver50;Indy50;VM;rbCIDE55;rbIDE55;rbRCL55;rbBDE55;rbDBDE55;rbDAD55;rbDIDE55;rbUSER55;rbDB55;rbADO55;rbIBE55;VMREPORTBUILDER
-Conditionals=
-DebugSourceDirs=
-UsePackages=0
-[Parameters]
-RunParams=
-HostApplication=
-Launcher=
-UseLauncher=0
-DebugCWD=
-[Language]
-ActiveLang=
-ProjectLang=$00000409
-RootDir=
-[Version Info]
-IncludeVerInfo=0
-AutoIncBuild=0
-MajorVer=1
-MinorVer=0
-Release=0
-Build=0
-Debug=0
-PreRelease=0
-Special=0
-Private=0
-DLL=0
-Locale=1033
-CodePage=1252
-[Version Info Keys]
-CompanyName=
-FileDescription=
-FileVersion=1.0.0.0
-InternalName=
-LegalCopyright=
-LegalTrademarks=
-OriginalFilename=
-ProductName=
-ProductVersion=1.0.0.0
-Comments=
-[Excluded Packages]
-C:\Program Files\Developer Express Inc\ExpressPrinting System\Delphi 7\Lib\dxPSTLLnkD7.bpl=ExpressPrinting System ReportLink for ExpressQuantumTreeList by Developer Express Inc.
-C:\Program Files\Developer Express Inc\ExpressPrinting System\Delphi 7\Lib\dxPSdxDBTLLnkD7.bpl=ExpressPrinting System ReportLink for ExpressQuantumDBTreeList by Developer Express Inc.
-C:\Program Files\Developer Express Inc\ExpressPrinting System\Delphi 7\Lib\dxPSdxDBGrLnkD7.bpl=ExpressPrinting System ReportLink for ExpressQuantumGrid by Developer Express Inc.
-C:\Program Files\Developer Express Inc\ExpressPrinting System\Delphi 7\Lib\dxPSdxInsLnkD7.bpl=ExpressPrinting System ReportLink for ExpressInspector by Developer Express Inc.
-C:\Program Files\Developer Express Inc\ExpressPrinting System\Delphi 7\Lib\dxPSdxOILnkD7.bpl=ExpressPrinting System ReportLink for ExpressRTTIInspector by Developer Express Inc.
-C:\Program Files\Developer Express Inc\ExpressPrinting System\Delphi 7\Lib\dxPSdxMVLnkD7.bpl=ExpressPrinting System ReportLink for ExpressMasterView by Developer Express Inc.
-C:\Program Files\Developer Express Inc\ExpressPrinting System\Delphi 7\Lib\dxPSdxOCLnkD7.bpl=ExpressPrinting System ReportLinks for ExpressOrgChart by Developer Express Inc.
-C:\Program Files\Developer Express Inc\ExpressPrinting System\Delphi 7\Lib\dxPSdxDBOCLnkD7.bpl=ExpressPrinting System ReportLinks for ExpressDBOrgChart by Developer Express Inc.
-C:\Program Files\Developer Express Inc\ExpressPrinting System\Delphi 7\Lib\dxPSdxFCLnkD7.bpl=ExpressPrinting System ReportLinks for ExpressFlowChart by Developer Express Inc.
-C:\Program Files\Developer Express Inc\ExpressPrinting System\Delphi 7\Lib\dxPSdxLCLnkD7.bpl=ExpressPrinting System ReportLink for ExpressLayoutControl by Developer Express Inc.
-C:\Program Files\Developer Express Inc\ExpressPrinting System\Delphi 7\Lib\dxPscxTLLnkD7.bpl=ExpressPrinting System ReportLink for ExpressQuantumTreeList 4 by Developer Express Inc.
diff --git a/PythonForDelphi/Demos/Demo28/Project1.dpr b/PythonForDelphi/Demos/Demo28/Project1.dpr
index 34e6006c..7a68fc98 100644
--- a/PythonForDelphi/Demos/Demo28/Project1.dpr
+++ b/PythonForDelphi/Demos/Demo28/Project1.dpr
@@ -3,12 +3,7 @@ program Project1;
{$I Definition.Inc}
uses
-{$IFDEF MSWINDOWS}
Forms,
-{$ENDIF}
-{$IFDEF LINUX}
- QForms,
-{$ENDIF}
Unit1 in 'Unit1.pas' {Form1};
{$R *.res}
diff --git a/PythonForDelphi/Demos/Demo28/Project1.kof b/PythonForDelphi/Demos/Demo28/Project1.kof
deleted file mode 100644
index 6ad26fc6..00000000
--- a/PythonForDelphi/Demos/Demo28/Project1.kof
+++ /dev/null
@@ -1,61 +0,0 @@
-[Compiler]
-A=8
-B=0
-C=1
-D=1
-E=0
-F=0
-G=1
-H=1
-I=1
-J=0
-K=0
-L=1
-M=0
-N=1
-O=1
-P=1
-Q=0
-R=0
-S=0
-T=0
-U=0
-V=1
-W=0
-X=1
-Y=1
-Z=1
-ShowHints=1
-ShowWarnings=1
-UnitAliases=
-
-[Linker]
-MapFile=0
-OutputObjs=0
-ConsoleApp=1
-DebugInfo=0
-RemoteSymbols=0
-MinStackSize=16384
-MaxStackSize=1048576
-ImageBase=4194304
-ExeDescription=
-DynamicLoader=/lib/ld-linux.so.2
-
-[Directories]
-OutputDir=
-UnitOutputDir=
-PackageDLLOutputDir=
-PackageDCPOutputDir=
-SearchPath=
-Packages=
-Conditionals=
-DebugSourceDirs=
-UsePackages=0
-
-[Parameters]
-RunParams=
-HostApplication=
-Launcher=/usr/X11R6/bin/xterm -T KylixDebuggerOutput -e bash -i -c %debuggee%
-UseLauncher=0
-DebugCWD=
-
diff --git a/PythonForDelphi/Demos/Demo28/Unit1.pas b/PythonForDelphi/Demos/Demo28/Unit1.pas
index bcac8c89..ff408160 100644
--- a/PythonForDelphi/Demos/Demo28/Unit1.pas
+++ b/PythonForDelphi/Demos/Demo28/Unit1.pas
@@ -6,13 +6,8 @@ interface
uses
Classes, SysUtils,
-{$IFDEF MSWINDOWS}
Windows, Messages, Graphics, Controls, Forms, Dialogs,
StdCtrls, ComCtrls, ExtCtrls,
-{$ENDIF}
-{$IFDEF LINUX}
- QForms, QDialogs, QStdCtrls, QControls, QExtCtrls,
-{$ENDIF}
PythonEngine, PythonGUIInputOutput;
type
@@ -89,9 +84,7 @@ TForm1 = class(TForm)
procedure ptStringListCreate(Sender: TObject);
procedure ptStringListIteratorCreate(Sender: TObject);
private
- { Déclarations privées }
public
- { Déclarations publiques }
end;
@@ -101,12 +94,7 @@ TForm1 = class(TForm)
implementation
-{$IFDEF MSWINDOWS}
{$R *.DFM}
-{$ENDIF}
-{$IFDEF LINUX}
-{$R *.xfm}
-{$ENDIF}
procedure TForm1.Button1Click(Sender: TObject);
begin
diff --git a/PythonForDelphi/Demos/Demo28/Unit1.xfm b/PythonForDelphi/Demos/Demo28/Unit1.xfm
deleted file mode 100644
index 215ff8d1..00000000
Binary files a/PythonForDelphi/Demos/Demo28/Unit1.xfm and /dev/null differ
diff --git a/PythonForDelphi/Demos/Demo29/Project1.dof b/PythonForDelphi/Demos/Demo29/Project1.dof
deleted file mode 100644
index a1de42b4..00000000
--- a/PythonForDelphi/Demos/Demo29/Project1.dof
+++ /dev/null
@@ -1,148 +0,0 @@
-[FileVersion]
-Version=7.0
-[Compiler]
-A=8
-B=0
-C=1
-D=1
-E=0
-F=0
-G=1
-H=1
-I=1
-J=0
-K=0
-L=1
-M=0
-N=1
-O=1
-P=1
-Q=0
-R=0
-S=0
-T=0
-U=0
-V=1
-W=0
-X=1
-Y=1
-Z=1
-ShowHints=1
-ShowWarnings=1
-UnitAliases=WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;
-NamespacePrefix=
-SymbolDeprecated=1
-SymbolLibrary=1
-SymbolPlatform=1
-UnitLibrary=1
-UnitPlatform=1
-UnitDeprecated=1
-HResultCompat=1
-HidingMember=1
-HiddenVirtual=1
-Garbage=1
-BoundsError=1
-ZeroNilCompat=1
-StringConstTruncated=1
-ForLoopVarVarPar=1
-TypedConstVarPar=1
-AsgToTypedConst=1
-CaseLabelRange=1
-ForVariable=1
-ConstructingAbstract=1
-ComparisonFalse=1
-ComparisonTrue=1
-ComparingSignedUnsigned=1
-CombiningSignedUnsigned=1
-UnsupportedConstruct=1
-FileOpen=1
-FileOpenUnitSrc=1
-BadGlobalSymbol=1
-DuplicateConstructorDestructor=1
-InvalidDirective=1
-PackageNoLink=1
-PackageThreadVar=1
-ImplicitImport=1
-HPPEMITIgnored=1
-NoRetVal=1
-UseBeforeDef=1
-ForLoopVarUndef=1
-UnitNameMismatch=1
-NoCFGFileFound=1
-MessageDirective=1
-ImplicitVariants=1
-UnicodeToLocale=1
-LocaleToUnicode=1
-ImagebaseMultiple=1
-SuspiciousTypecast=1
-PrivatePropAccessor=1
-UnsafeType=0
-UnsafeCode=0
-UnsafeCast=0
-[Linker]
-MapFile=0
-OutputObjs=0
-ConsoleApp=1
-DebugInfo=0
-RemoteSymbols=0
-MinStackSize=16384
-MaxStackSize=1048576
-ImageBase=4194304
-ExeDescription=
-[Directories]
-OutputDir=
-UnitOutputDir=
-PackageDLLOutputDir=
-PackageDCPOutputDir=
-SearchPath=
-Packages=vcl;rtl;vclx;indy;inet;xmlrtl;vclie;inetdbbde;inetdbxpress;dbrtl;dsnap;dsnapcon;vcldb;soaprtl;VclSmp;dbexpress;dbxcds;inetdb;bdertl;vcldbx;webdsnap;websnap;adortl;ibxpress;teeui;teedb;tee;dss;visualclx;visualdbclx;vclactnband;vclshlctrls;IntrawebDB_50_70;Intraweb_50_70;Rave50CLX;Rave50VCL;dclOfficeXP;cxEditorsVCLD7;cxLibraryVCLD7;dxThemeD7;cxDataD7;cxExtEditorsVCLD7;cxGridVCLD7;cxGridUtilsVCLD7;dxNavBarD7;cxPageControlVCLD7;dxBarD7;dxComnD7;dxBarDBNavD7;dxBarExtItemsD7;dxBarExtDBItemsD7;dxsbD7;dxDockingD7;dxmdsD7;dxdbtrD7;dxtrmdD7;cxSpreadSheetVCLD7;cxCommonEditingVCLD7;cxVerticalGridVCLD7;dxPSCoreD7;dxPsPrVwAdvD7;dxPSLnksD7;dxPSTeeChartD7;dxPSDBTeeChartD7;dxPScxCommonD7;dxPScxExtCommonD7;dxPScxSSLnkD7;dxPScxGridLnkD7;rbTDBC77;rbDBDE77;rbDAD77;rbDIDE77;rbUSER77;rbRCL77;rbBDE77;rbIDE77;rbCIDE77;rbRIDE77;rbRAP77;madBasic_;madDisAsm_;Tiger;SynEdit_D7;dxPScxVGridLnkD7;dxPSdxDBTVLnkD7;dxPScxPCProdD7
-Conditionals=
-DebugSourceDirs=
-UsePackages=0
-[Parameters]
-RunParams=
-HostApplication=
-Launcher=
-UseLauncher=0
-DebugCWD=
-[Language]
-ActiveLang=
-ProjectLang=
-RootDir=
-[Version Info]
-IncludeVerInfo=0
-AutoIncBuild=0
-MajorVer=1
-MinorVer=0
-Release=0
-Build=0
-Debug=0
-PreRelease=0
-Special=0
-Private=0
-DLL=0
-Locale=4105
-CodePage=1252
-[Version Info Keys]
-CompanyName=
-FileDescription=
-FileVersion=1.0.0.0
-InternalName=
-LegalCopyright=
-LegalTrademarks=
-OriginalFilename=
-ProductName=
-ProductVersion=1.0.0.0
-Comments=
-[Excluded Packages]
-C:\Program Files\Developer Express Inc\ExpressPrinting System\Delphi 7\Lib\dxPSTLLnkD7.bpl=ExpressPrinting System ReportLink for ExpressQuantumTreeList by Developer Express Inc.
-C:\Program Files\Developer Express Inc\ExpressPrinting System\Delphi 7\Lib\dxPSdxDBTLLnkD7.bpl=ExpressPrinting System ReportLink for ExpressQuantumDBTreeList by Developer Express Inc.
-C:\Program Files\Developer Express Inc\ExpressPrinting System\Delphi 7\Lib\dxPSdxDBGrLnkD7.bpl=ExpressPrinting System ReportLink for ExpressQuantumGrid by Developer Express Inc.
-C:\Program Files\Developer Express Inc\ExpressPrinting System\Delphi 7\Lib\dxPSdxInsLnkD7.bpl=ExpressPrinting System ReportLink for ExpressInspector by Developer Express Inc.
-C:\Program Files\Developer Express Inc\ExpressPrinting System\Delphi 7\Lib\dxPSdxOILnkD7.bpl=ExpressPrinting System ReportLink for ExpressRTTIInspector by Developer Express Inc.
-C:\Program Files\Developer Express Inc\ExpressPrinting System\Delphi 7\Lib\dxPSdxMVLnkD7.bpl=ExpressPrinting System ReportLink for ExpressMasterView by Developer Express Inc.
-C:\Program Files\Developer Express Inc\ExpressPrinting System\Delphi 7\Lib\dxPSdxOCLnkD7.bpl=ExpressPrinting System ReportLinks for ExpressOrgChart by Developer Express Inc.
-C:\Program Files\Developer Express Inc\ExpressPrinting System\Delphi 7\Lib\dxPSdxDBOCLnkD7.bpl=ExpressPrinting System ReportLinks for ExpressDBOrgChart by Developer Express Inc.
-C:\Program Files\Developer Express Inc\ExpressPrinting System\Delphi 7\Lib\dxPSdxFCLnkD7.bpl=ExpressPrinting System ReportLinks for ExpressFlowChart by Developer Express Inc.
-C:\Program Files\Developer Express Inc\ExpressPrinting System\Delphi 7\Lib\dxPSdxLCLnkD7.bpl=ExpressPrinting System ReportLink for ExpressLayoutControl by Developer Express Inc.
-C:\Program Files\Developer Express Inc\ExpressPrinting System\Delphi 7\Lib\dxPscxTLLnkD7.bpl=ExpressPrinting System ReportLink for ExpressQuantumTreeList 4 by Developer Express Inc.
diff --git a/PythonForDelphi/Demos/Demo29/Project1.dpr b/PythonForDelphi/Demos/Demo29/Project1.dpr
index 8d0a35f3..1faa1f9c 100644
--- a/PythonForDelphi/Demos/Demo29/Project1.dpr
+++ b/PythonForDelphi/Demos/Demo29/Project1.dpr
@@ -1,6 +1,3 @@
-// JCL_DEBUG_EXPERT_GENERATEJDBG OFF
-// JCL_DEBUG_EXPERT_INSERTJDBG OFF
-// JCL_DEBUG_EXPERT_DELETEMAPFILE OFF
program Project1;
uses
diff --git a/PythonForDelphi/Demos/Demo29/Project1.dproj b/PythonForDelphi/Demos/Demo29/Project1.dproj
index 1f6b5738..488cd6fd 100644
--- a/PythonForDelphi/Demos/Demo29/Project1.dproj
+++ b/PythonForDelphi/Demos/Demo29/Project1.dproj
@@ -1,134 +1,156 @@
-
-
- {2F621E09-DAC5-4AB2-83F7-BD019D49AAF2}
- Project1.dpr
- Debug
- DCC32
- 13.4
- VCL
- True
- Win32
- 1
- Application
-
-
- true
-
-
- true
- Base
- true
-
-
- true
- Base
- true
-
-
- true
- Base
- true
-
-
- true
- Base
- true
-
-
- Vcl;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;System;Xml;Data;Datasnap;Web;Soap;Winapi;$(DCC_Namespace)
- 4105
- CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments=
- Project1.exe
- 00400000
- x86
-
-
- Project1_Icon.ico
-
-
- $(BDS)\bin\default_app.manifest
- 1033
- true
- Project1_Icon.ico
- CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments=
- System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace)
-
-
- false
- RELEASE;$(DCC_Define)
- 0
- false
-
-
- DEBUG;$(DCC_Define)
-
-
-
- MainSource
-
-
-
-
-
- Cfg_2
- Base
-
-
- Base
-
-
- Cfg_1
- Base
-
-
-
-
- Delphi.Personality.12
- VCLApplication
-
-
-
- Project1.dpr
-
-
- False
- True
- False
-
-
- False
- False
- 1
- 0
- 0
- 0
- False
- False
- False
- False
- False
- 4105
- 1252
-
-
-
-
- 1.0.0.0
-
-
-
-
-
- 1.0.0.0
-
-
-
-
- False
- True
-
-
- 12
-
-
-
+
+
+ {2F621E09-DAC5-4AB2-83F7-BD019D49AAF2}
+ Project1.dpr
+ Debug
+ DCC32
+ 18.7
+ VCL
+ True
+ Win32
+ 1
+ Application
+
+
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Cfg_2
+ true
+ true
+
+
+ Vcl;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;System;Xml;Data;Datasnap;Web;Soap;Winapi;$(DCC_Namespace)
+ 4105
+ CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments=
+ Project1.exe
+ 00400000
+ x86
+ Project1
+
+
+ $(BDS)\bin\default_app.manifest
+ 1033
+ true
+ Project1_Icon.ico
+ true
+ System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace)
+ $(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_44.png
+ $(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_150.png
+
+
+ Project1_Icon.ico
+ $(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_44.png
+ $(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_150.png
+
+
+ false
+ RELEASE;$(DCC_Define)
+ 0
+ 0
+
+
+ DEBUG;$(DCC_Define)
+
+
+ Debug
+ true
+ 1033
+ $(BDS)\bin\delphi_PROJECTICON.ico
+ true
+
+
+
+ MainSource
+
+
+
+
+
+ Cfg_2
+ Base
+
+
+ Base
+
+
+ Cfg_1
+ Base
+
+
+
+
+ Delphi.Personality.12
+ VCLApplication
+
+
+
+ Project1.dpr
+
+
+ False
+ True
+ False
+
+
+ False
+ False
+ 1
+ 0
+ 0
+ 0
+ False
+ False
+ False
+ False
+ False
+ 4105
+ 1252
+
+
+
+
+ 1.0.0.0
+
+
+
+
+
+ 1.0.0.0
+
+
+
+ Microsoft Office 2000 Sample Automation Server Wrapper Components
+ Microsoft Office XP Sample Automation Server Wrapper Components
+
+
+
+ True
+ False
+
+
+ 12
+
+
+
diff --git a/PythonForDelphi/Demos/Demo29/Project1.res b/PythonForDelphi/Demos/Demo29/Project1.res
index fbaca376..aff75aeb 100644
Binary files a/PythonForDelphi/Demos/Demo29/Project1.res and b/PythonForDelphi/Demos/Demo29/Project1.res differ
diff --git a/PythonForDelphi/Demos/Demo29/Unit1.dfm b/PythonForDelphi/Demos/Demo29/Unit1.dfm
index f557d9f9..e394b150 100644
--- a/PythonForDelphi/Demos/Demo29/Unit1.dfm
+++ b/PythonForDelphi/Demos/Demo29/Unit1.dfm
@@ -2,7 +2,7 @@ object Form1: TForm1
Left = 218
Top = 18
Caption = 'Form1'
- ClientHeight = 731
+ ClientHeight = 743
ClientWidth = 668
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
@@ -17,11 +17,12 @@ object Form1: TForm1
Left = 8
Top = 8
Width = 657
- Height = 329
+ Height = 289
+ AutoSize = True
end
object Button1: TButton
Left = 8
- Top = 352
+ Top = 312
Width = 97
Height = 25
Caption = 'Open Picture...'
@@ -30,7 +31,7 @@ object Form1: TForm1
end
object Button2: TButton
Left = 196
- Top = 352
+ Top = 312
Width = 105
Height = 25
Caption = 'Execute'
@@ -39,25 +40,32 @@ object Form1: TForm1
end
object Memo1: TMemo
Left = 8
- Top = 520
+ Top = 471
Width = 657
- Height = 281
+ Height = 330
Lines.Strings = (
- 'import StringIO'
- 'import Image'
+ '# This demo requires the module pillow (PIL)'
+
+ '# You can use "pip install Pillow" from a command prompt to ins' +
+ 'tall Pillow'
+ ''
+ 'from io import BytesIO'
+ 'from PIL import Image'
+ 'import sys'
''
'def ProcessImage(data):'
- ' stream = StringIO.StringIO(data)'
+ ' print(sys.version)'
+ ' stream = BytesIO(data)'
' im = Image.open(stream)'
- ' print "Processing image %s of %d bytes" % (im.format, len(data' +
- '))'
- ' new_im = im.rotate(90)'
+ ' print ("Processing image %s of %d bytes" % (im.format, len(dat' +
+ 'a)))'
+ ' new_im = im.rotate(90, expand=True)'
' new_im.format = im.format'
' return new_im'
' '
'def ImageToString(image):'
- ' stream = StringIO.StringIO()'
+ ' stream = BytesIO()'
' image.save(stream, image.format)'
' return stream.getvalue()')
ScrollBars = ssBoth
@@ -65,7 +73,7 @@ object Form1: TForm1
end
object Memo2: TMemo
Left = 8
- Top = 392
+ Top = 352
Width = 657
Height = 113
ScrollBars = ssBoth
@@ -73,12 +81,10 @@ object Form1: TForm1
end
object chkUseDC: TCheckBox
Left = 336
- Top = 356
+ Top = 316
Width = 193
Height = 17
Caption = 'Use Device Context'
- Checked = True
- State = cbChecked
TabOrder = 4
end
object OpenPictureDialog1: TOpenPictureDialog
@@ -87,9 +93,9 @@ object Form1: TForm1
end
object PythonEngine1: TPythonEngine
AutoUnload = False
- DllName = 'python27.dll'
+ DllName = 'python36.dll'
APIVersion = 1013
- RegVersion = '2.7'
+ RegVersion = '3.6'
UseLastKnownVersion = False
IO = PythonGUIInputOutput1
Left = 168
diff --git a/PythonForDelphi/Demos/Demo29/Unit1.pas b/PythonForDelphi/Demos/Demo29/Unit1.pas
index 60704606..57cd85d6 100644
--- a/PythonForDelphi/Demos/Demo29/Unit1.pas
+++ b/PythonForDelphi/Demos/Demo29/Unit1.pas
@@ -1,5 +1,11 @@
unit Unit1;
-
+{
+ Demonstrates the manipulation of images on the Delphi side using python.
+ Requires the Pillow python module.
+ Istall using pip (pip install Pillow).
+ Currently the code is setup for Python 3.x, but Python 2 can be supported
+ with minor changes. (io.Bytes should be replaced with StringIO.StringIO)
+}
interface
uses
@@ -31,7 +37,9 @@ TForm1 = class(TForm)
implementation
uses
- VarPyth, jpeg;
+ VarPyth,
+ Math,
+ jpeg;
{$R *.dfm}
@@ -85,9 +93,11 @@ procedure TForm1.Button2Click(Sender: TObject);
var
_im : Variant;
_stream : TMemoryStream;
- _hdc : Variant;
_dib : Variant;
- S : AnsiString;
+ pargs: PPyObject;
+ presult :PPyObject;
+ P : PAnsiChar;
+ Len : NativeInt;
begin
if (Image1.Picture.Graphic = nil) or Image1.Picture.Graphic.Empty then
raise Exception.Create('You must first select an image');
@@ -95,16 +105,28 @@ procedure TForm1.Button2Click(Sender: TObject);
_im := MainModule.ProcessImage(ImageToPyStr(Image1.Picture.Graphic));
if not chkUseDC.Checked then
begin
- {
- TODO :
- Needs fixing. Probably has to do with images containing null bytes which
- cannot be converted to ansistrings.
- }
- ShowMessage('This does not work and needs fixing');
+ // We have to call PyString_AsStringAndSize because the image may contain zeros
+ with GetPythonEngine do begin
+ pargs := MakePyTuple([ExtractPythonObjectFrom(_im)]);
+ try
+ try
+ presult := PyEval_CallObjectWithKeywords(
+ ExtractPythonObjectFrom(MainModule.ImageToString), pargs, nil);
+ if (PyString_AsStringAndSize(presult, P, Len) < 0) or (P = nil) then begin
+ ShowMessage('This does not work and needs fixing');
+ Abort;
+ end;
+ finally
+ Py_XDECREF(pResult);
+ end;
+ finally
+ Py_DECREF(pargs);
+ end;
+ end;
+
_stream := TMemoryStream.Create();
try
- S := MainModule.ImageToString(_im);
- _stream.Write(PAnsiChar(S)^, Length(S));
+ _stream.Write(P^, Len);
_stream.Position := 0;
Image1.Picture.Graphic.LoadFromStream(_stream);
finally
@@ -113,11 +135,10 @@ procedure TForm1.Button2Click(Sender: TObject);
end
else
begin
- Image1.Picture.Bitmap.Width := Image1.Width;
- Image1.Picture.Bitmap.Height := Image1.Height;
- _hdc := Import('ImageWin').HDC(Image1.Picture.Bitmap.Canvas.Handle);
- _dib := Import('ImageWin').Dib(_im);
- _dib.expose(_hdc);
+ Image1.Picture.Bitmap.SetSize(Image1.Width, Image1.Height);
+ _dib := Import('PIL.ImageWin').Dib(_im);
+ Image1.Picture.Bitmap.SetSize(Image1.Height, Image1.Width);
+ _dib.expose(NativeInt(Image1.Picture.Bitmap.Canvas.Handle));
end;
end;
diff --git a/PythonForDelphi/Demos/Demo30/Project1.conf b/PythonForDelphi/Demos/Demo30/Project1.conf
deleted file mode 100644
index 84e6d103..00000000
--- a/PythonForDelphi/Demos/Demo30/Project1.conf
+++ /dev/null
@@ -1,32 +0,0 @@
--$A8
--$B-
--$C+
--$D+
--$E-
--$F-
--$G+
--$H+
--$I+
--$J-
--$K-
--$L+
--$M-
--$N+
--$O+
--$P+
--$Q-
--$R-
--$S-
--$T-
--$U-
--$V+
--$W-
--$X+
--$YD
--$Z1
--cg
--H+
--W+
--M
--$M16384,1048576
--K$00400000
diff --git a/PythonForDelphi/Demos/Demo30/Project1.dof b/PythonForDelphi/Demos/Demo30/Project1.dof
deleted file mode 100644
index 72c886ef..00000000
--- a/PythonForDelphi/Demos/Demo30/Project1.dof
+++ /dev/null
@@ -1,148 +0,0 @@
-[FileVersion]
-Version=7.0
-[Compiler]
-A=8
-B=0
-C=1
-D=1
-E=0
-F=0
-G=1
-H=1
-I=1
-J=1
-K=0
-L=1
-M=0
-N=1
-O=1
-P=1
-Q=0
-R=0
-S=0
-T=0
-U=0
-V=1
-W=0
-X=1
-Y=1
-Z=1
-ShowHints=1
-ShowWarnings=1
-UnitAliases=WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;
-NamespacePrefix=
-SymbolDeprecated=1
-SymbolLibrary=1
-SymbolPlatform=1
-UnitLibrary=1
-UnitPlatform=1
-UnitDeprecated=1
-HResultCompat=1
-HidingMember=1
-HiddenVirtual=1
-Garbage=1
-BoundsError=1
-ZeroNilCompat=1
-StringConstTruncated=1
-ForLoopVarVarPar=1
-TypedConstVarPar=1
-AsgToTypedConst=1
-CaseLabelRange=1
-ForVariable=1
-ConstructingAbstract=1
-ComparisonFalse=1
-ComparisonTrue=1
-ComparingSignedUnsigned=1
-CombiningSignedUnsigned=1
-UnsupportedConstruct=1
-FileOpen=1
-FileOpenUnitSrc=1
-BadGlobalSymbol=1
-DuplicateConstructorDestructor=1
-InvalidDirective=1
-PackageNoLink=1
-PackageThreadVar=1
-ImplicitImport=1
-HPPEMITIgnored=1
-NoRetVal=1
-UseBeforeDef=1
-ForLoopVarUndef=1
-UnitNameMismatch=1
-NoCFGFileFound=1
-MessageDirective=1
-ImplicitVariants=1
-UnicodeToLocale=1
-LocaleToUnicode=1
-ImagebaseMultiple=1
-SuspiciousTypecast=1
-PrivatePropAccessor=1
-UnsafeType=0
-UnsafeCode=0
-UnsafeCast=0
-[Linker]
-MapFile=0
-OutputObjs=0
-ConsoleApp=1
-DebugInfo=0
-RemoteSymbols=0
-MinStackSize=16384
-MaxStackSize=1048576
-ImageBase=4194304
-ExeDescription=
-[Directories]
-OutputDir=
-UnitOutputDir=
-PackageDLLOutputDir=
-PackageDCPOutputDir=
-SearchPath=
-Packages=Vcl50;Vclx50;VclSmp50;Vcldb50;vclado50;ibevnt50;Vclbde50;vcldbx50;Qrpt50;VCLIB50;Vclmid50;vclie50;Inetdb50;Inet50;NMFast50;webmid50;dclocx50;dclaxserver50;Indy50;VM;rbCIDE55;rbIDE55;rbRCL55;rbBDE55;rbDBDE55;rbDAD55;rbDIDE55;rbUSER55;rbDB55;rbADO55;rbIBE55;VMREPORTBUILDER
-Conditionals=
-DebugSourceDirs=
-UsePackages=0
-[Parameters]
-RunParams=
-HostApplication=
-Launcher=
-UseLauncher=0
-DebugCWD=
-[Language]
-ActiveLang=
-ProjectLang=$00000409
-RootDir=
-[Version Info]
-IncludeVerInfo=0
-AutoIncBuild=0
-MajorVer=1
-MinorVer=0
-Release=0
-Build=0
-Debug=0
-PreRelease=0
-Special=0
-Private=0
-DLL=0
-Locale=1033
-CodePage=1252
-[Version Info Keys]
-CompanyName=
-FileDescription=
-FileVersion=1.0.0.0
-InternalName=
-LegalCopyright=
-LegalTrademarks=
-OriginalFilename=
-ProductName=
-ProductVersion=1.0.0.0
-Comments=
-[Excluded Packages]
-C:\Program Files\Developer Express Inc\ExpressPrinting System\Delphi 7\Lib\dxPSTLLnkD7.bpl=ExpressPrinting System ReportLink for ExpressQuantumTreeList by Developer Express Inc.
-C:\Program Files\Developer Express Inc\ExpressPrinting System\Delphi 7\Lib\dxPSdxDBTLLnkD7.bpl=ExpressPrinting System ReportLink for ExpressQuantumDBTreeList by Developer Express Inc.
-C:\Program Files\Developer Express Inc\ExpressPrinting System\Delphi 7\Lib\dxPSdxDBGrLnkD7.bpl=ExpressPrinting System ReportLink for ExpressQuantumGrid by Developer Express Inc.
-C:\Program Files\Developer Express Inc\ExpressPrinting System\Delphi 7\Lib\dxPSdxInsLnkD7.bpl=ExpressPrinting System ReportLink for ExpressInspector by Developer Express Inc.
-C:\Program Files\Developer Express Inc\ExpressPrinting System\Delphi 7\Lib\dxPSdxOILnkD7.bpl=ExpressPrinting System ReportLink for ExpressRTTIInspector by Developer Express Inc.
-C:\Program Files\Developer Express Inc\ExpressPrinting System\Delphi 7\Lib\dxPSdxMVLnkD7.bpl=ExpressPrinting System ReportLink for ExpressMasterView by Developer Express Inc.
-C:\Program Files\Developer Express Inc\ExpressPrinting System\Delphi 7\Lib\dxPSdxOCLnkD7.bpl=ExpressPrinting System ReportLinks for ExpressOrgChart by Developer Express Inc.
-C:\Program Files\Developer Express Inc\ExpressPrinting System\Delphi 7\Lib\dxPSdxDBOCLnkD7.bpl=ExpressPrinting System ReportLinks for ExpressDBOrgChart by Developer Express Inc.
-C:\Program Files\Developer Express Inc\ExpressPrinting System\Delphi 7\Lib\dxPSdxFCLnkD7.bpl=ExpressPrinting System ReportLinks for ExpressFlowChart by Developer Express Inc.
-C:\Program Files\Developer Express Inc\ExpressPrinting System\Delphi 7\Lib\dxPSdxLCLnkD7.bpl=ExpressPrinting System ReportLink for ExpressLayoutControl by Developer Express Inc.
-C:\Program Files\Developer Express Inc\ExpressPrinting System\Delphi 7\Lib\dxPscxTLLnkD7.bpl=ExpressPrinting System ReportLink for ExpressQuantumTreeList 4 by Developer Express Inc.
diff --git a/PythonForDelphi/Demos/Demo30/Project1.dpr b/PythonForDelphi/Demos/Demo30/Project1.dpr
index 34e6006c..7a68fc98 100644
--- a/PythonForDelphi/Demos/Demo30/Project1.dpr
+++ b/PythonForDelphi/Demos/Demo30/Project1.dpr
@@ -3,12 +3,7 @@ program Project1;
{$I Definition.Inc}
uses
-{$IFDEF MSWINDOWS}
Forms,
-{$ENDIF}
-{$IFDEF LINUX}
- QForms,
-{$ENDIF}
Unit1 in 'Unit1.pas' {Form1};
{$R *.res}
diff --git a/PythonForDelphi/Demos/Demo30/Project1.kof b/PythonForDelphi/Demos/Demo30/Project1.kof
deleted file mode 100644
index 6ad26fc6..00000000
--- a/PythonForDelphi/Demos/Demo30/Project1.kof
+++ /dev/null
@@ -1,61 +0,0 @@
-[Compiler]
-A=8
-B=0
-C=1
-D=1
-E=0
-F=0
-G=1
-H=1
-I=1
-J=0
-K=0
-L=1
-M=0
-N=1
-O=1
-P=1
-Q=0
-R=0
-S=0
-T=0
-U=0
-V=1
-W=0
-X=1
-Y=1
-Z=1
-ShowHints=1
-ShowWarnings=1
-UnitAliases=
-
-[Linker]
-MapFile=0
-OutputObjs=0
-ConsoleApp=1
-DebugInfo=0
-RemoteSymbols=0
-MinStackSize=16384
-MaxStackSize=1048576
-ImageBase=4194304
-ExeDescription=
-DynamicLoader=/lib/ld-linux.so.2
-
-[Directories]
-OutputDir=
-UnitOutputDir=
-PackageDLLOutputDir=
-PackageDCPOutputDir=
-SearchPath=
-Packages=
-Conditionals=
-DebugSourceDirs=
-UsePackages=0
-
-[Parameters]
-RunParams=
-HostApplication=
-Launcher=/usr/X11R6/bin/xterm -T KylixDebuggerOutput -e bash -i -c %debuggee%
-UseLauncher=0
-DebugCWD=
-
diff --git a/PythonForDelphi/Demos/Demo30/Unit1.pas b/PythonForDelphi/Demos/Demo30/Unit1.pas
index bcc2c09b..ae4edfef 100644
--- a/PythonForDelphi/Demos/Demo30/Unit1.pas
+++ b/PythonForDelphi/Demos/Demo30/Unit1.pas
@@ -6,13 +6,8 @@ interface
uses
Classes, SysUtils,
-{$IFDEF MSWINDOWS}
Windows, Messages, Graphics, Controls, Forms, Dialogs,
StdCtrls, ComCtrls, ExtCtrls,
-{$ENDIF}
-{$IFDEF LINUX}
- QForms, QDialogs, QStdCtrls, QControls, QExtCtrls,
-{$ENDIF}
PythonEngine, PythonGUIInputOutput;
type
@@ -32,9 +27,7 @@ TForm1 = class(TForm)
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
private
- { Déclarations privées }
public
- { Déclarations publiques }
end;
@@ -47,12 +40,7 @@ implementation
uses
VarPyth;
-{$IFDEF MSWINDOWS}
{$R *.DFM}
-{$ENDIF}
-{$IFDEF LINUX}
-{$R *.xfm}
-{$ENDIF}
procedure TForm1.Button1Click(Sender: TObject);
var
diff --git a/PythonForDelphi/Demos/Demo30/Unit1.xfm b/PythonForDelphi/Demos/Demo30/Unit1.xfm
deleted file mode 100644
index 215ff8d1..00000000
Binary files a/PythonForDelphi/Demos/Demo30/Unit1.xfm and /dev/null differ
diff --git a/PythonForDelphi/Demos/Demo31/Project1.dof b/PythonForDelphi/Demos/Demo31/Project1.dof
deleted file mode 100644
index 6a923c34..00000000
--- a/PythonForDelphi/Demos/Demo31/Project1.dof
+++ /dev/null
@@ -1,136 +0,0 @@
-[FileVersion]
-Version=7.0
-[Compiler]
-A=8
-B=0
-C=1
-D=1
-E=0
-F=0
-G=1
-H=1
-I=1
-J=0
-K=0
-L=1
-M=0
-N=1
-O=0
-P=1
-Q=0
-R=0
-S=0
-T=0
-U=0
-V=1
-W=0
-X=1
-Y=1
-Z=1
-ShowHints=1
-ShowWarnings=1
-UnitAliases=WinTypes=Windows;WinProcs=Windows;DbiTypes=BDE;DbiProcs=BDE;DbiErrs=BDE;
-NamespacePrefix=
-SymbolDeprecated=1
-SymbolLibrary=1
-SymbolPlatform=1
-UnitLibrary=1
-UnitPlatform=1
-UnitDeprecated=1
-HResultCompat=1
-HidingMember=1
-HiddenVirtual=1
-Garbage=1
-BoundsError=1
-ZeroNilCompat=1
-StringConstTruncated=1
-ForLoopVarVarPar=1
-TypedConstVarPar=1
-AsgToTypedConst=1
-CaseLabelRange=1
-ForVariable=1
-ConstructingAbstract=1
-ComparisonFalse=1
-ComparisonTrue=1
-ComparingSignedUnsigned=1
-CombiningSignedUnsigned=1
-UnsupportedConstruct=1
-FileOpen=1
-FileOpenUnitSrc=1
-BadGlobalSymbol=1
-DuplicateConstructorDestructor=1
-InvalidDirective=1
-PackageNoLink=1
-PackageThreadVar=1
-ImplicitImport=1
-HPPEMITIgnored=1
-NoRetVal=1
-UseBeforeDef=1
-ForLoopVarUndef=1
-UnitNameMismatch=1
-NoCFGFileFound=1
-MessageDirective=1
-ImplicitVariants=1
-UnicodeToLocale=1
-LocaleToUnicode=1
-ImagebaseMultiple=1
-SuspiciousTypecast=1
-PrivatePropAccessor=1
-UnsafeType=0
-UnsafeCode=0
-UnsafeCast=0
-[Linker]
-MapFile=0
-OutputObjs=0
-ConsoleApp=1
-DebugInfo=0
-RemoteSymbols=0
-MinStackSize=16384
-MaxStackSize=1048576
-ImageBase=4194304
-ExeDescription=
-[Directories]
-OutputDir=
-UnitOutputDir=
-PackageDLLOutputDir=
-PackageDCPOutputDir=
-SearchPath=$(DELPHI)\Lib\Debug;C:\PROGRA~1\Jedi\JVCL30~1\jcl\lib\D7\debug
-Packages=vcl;rtl;indy;inet;xmlrtl;vclie;inetdbbde;inetdbxpress;vclx;dbrtl;dsnap;dsnapcon;vcldb;soaprtl;VclSmp;dbexpress;dbxcds;inetdb;bdertl;vcldbx;webdsnap;websnap;adortl;ibxpress;teeui;teedb;tee;dss;visualclx;visualdbclx;vclactnband;vclshlctrls;IntrawebDB_50_70;Intraweb_50_70;Rave50CLX;Rave50VCL;dclOfficeXP;rbTDBC77;rbDBDE77;rbDAD77;rbDIDE77;rbUSER77;rbRCL77;rbBDE77;rbIDE77;rbCIDE77;rbRIDE77;rbRAP77;cxLibraryVCLD7;dxBarD7;dxComnD7;dxBarDBNavD7;dxBarExtDBItemsD7;dxBarExtItemsD7;dxDockingD7;dxsbD7;cxPageControlVCLD7;cxEditorsVCLD7;dxThemeD7;cxDataD7;cxExtEditorsVCLD7;cxGridVCLD7;cxSchedulerVCLD7;dxEdtrD7;dxELibD7;cxVerticalGridVCLD7;cxSpreadSheetVCLD7;dxNavBarD7;dxmdsD7;dxdbtrD7;dxtrmdD7;dxorgcD7;dxdborD7;dxFlowChartD7;dxDBEdD7;dxInsD7;dxObjInsD7;dxPSCoreD7;dxPSTeeChartD7;dxPsPrVwAdvD7;dxPSLnksD7;dxPSdxInsLnkD7;dxPSdxOCLnkD7;dxPSdxOILnkD7;dxPSdxFCLnkD7;dxPSdxDBTVLnkD7;dxPSdxDBOCLnkD7;dxPSDBTeeChartD7;dxPScxCommonD7;dxPScxSSLnkD7;dxPScxPCProdD7;dxPScxGridLnkD7;dxPScxExtCommonD7;dxPScxVGridLnkD7;Tiger;madBasic_;madDisAsm_;VirtualTreesD7;VirtualShellToolsD7;VirtualExplorerListviewExD7;DJcl;JvStdCtrlsD7R;JvAppFrmD7R;JvCoreD7R;JvBandsD7R;JvBDED7R;JvDBD7R;JvDlgsD7R;JvCmpD7R;JvCryptD7R;JvCtrlsD7R;JvCustomD7R;JvDockingD7R;JvDotNetCtrlsD7R;JvEDID7R;qrpt;JvGlobusD7R;JvHMID7R;JvInspectorD7R;JvInterpreterD7R;JvJansD7R;JvManagedThreadsD7R;JvMMD7R;JvNetD7R;JvPageCompsD7R;JvPluginD7R;JvPrintPreviewD7R;JvSystemD7R;JvTimeFrameworkD7R;JvUIBD7R;JvValidatorsD7R;JvWizardD7R;JvXPCtrlsD7R
-Conditionals=
-DebugSourceDirs=
-UsePackages=0
-[Parameters]
-RunParams=
-HostApplication=
-Launcher=
-UseLauncher=0
-DebugCWD=
-[Language]
-ActiveLang=
-ProjectLang=
-RootDir=C:\Program Files\Borland\Delphi7\Bin\
-[Version Info]
-IncludeVerInfo=0
-AutoIncBuild=0
-MajorVer=1
-MinorVer=0
-Release=0
-Build=0
-Debug=0
-PreRelease=0
-Special=0
-Private=0
-DLL=0
-Locale=4105
-CodePage=1252
-[Version Info Keys]
-CompanyName=
-FileDescription=
-FileVersion=1.0.0.0
-InternalName=
-LegalCopyright=
-LegalTrademarks=
-OriginalFilename=
-ProductName=
-ProductVersion=1.0.0.0
-Comments=
diff --git a/PythonForDelphi/Demos/Demo31/Project1.dpr b/PythonForDelphi/Demos/Demo31/Project1.dpr
index e19c95d4..62ae3011 100644
--- a/PythonForDelphi/Demos/Demo31/Project1.dpr
+++ b/PythonForDelphi/Demos/Demo31/Project1.dpr
@@ -5,14 +5,15 @@ program Project1;
uses
Forms,
Unit1 in 'Unit1.pas' {Form1},
- WrapDelphiExtCtrls in '..\..\Components\Sources\Core\WrapDelphiExtCtrls.pas',
- WrapDelphiTypes in '..\..\Components\Sources\Core\WrapDelphiTypes.pas',
Unit2 in 'Unit2.pas' {TestForm},
- WrapDelphiWindows in '..\..\Components\Sources\Core\WrapDelphiWindows.pas',
- WrapDelphiComCtrls in '..\..\Components\Sources\Core\WrapDelphiComCtrls.pas',
- WrapDelphiGrids in '..\..\Components\Sources\Core\WrapDelphiGrids.pas',
- WrapDelphiGraphics in '..\..\Components\Sources\Core\WrapDelphiGraphics.pas',
- WrapDelphiButtons in '..\..\Components\Sources\Core\WrapDelphiButtons.pas';
+ WrapDelphiExtCtrls,
+ WrapDelphiTypes,
+ WrapDelphiWindows,
+ WrapDelphiComCtrls,
+ WrapDelphiGrids,
+ WrapDelphiGraphics,
+ WrapDelphiButtons,
+ WrapDelphiDialogs;
{$R *.res}
diff --git a/PythonForDelphi/Demos/Demo31/Project1.dproj b/PythonForDelphi/Demos/Demo31/Project1.dproj
index f7200dc2..8a3a0dd0 100644
--- a/PythonForDelphi/Demos/Demo31/Project1.dproj
+++ b/PythonForDelphi/Demos/Demo31/Project1.dproj
@@ -4,10 +4,10 @@
Project1.dpr
Debug
DCC32
- 16.1
+ 18.7
VCL
True
- Win64
+ Win32
3
Application
@@ -34,6 +34,18 @@
Base
true
+
+ true
+ Cfg_2
+ true
+ true
+
+
+ true
+ Cfg_2
+ true
+ true
+
Project1
Vcl;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;System;Xml;Data;Datasnap;Web;Soap;Winapi;$(DCC_Namespace)
@@ -49,6 +61,9 @@
System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace)
1033
$(BDS)\bin\default_app.manifest
+ true
+ $(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_44.png
+ $(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_150.png
true
@@ -56,6 +71,9 @@
1033
$(BDS)\bin\default_app.manifest
Project1_Icon.ico
+ true
+ $(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_44.png
+ $(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_150.png
false
@@ -66,6 +84,22 @@
DEBUG;$(DCC_Define)
+
+ Debug
+ true
+ 1033
+ $(BDS)\bin\delphi_PROJECTICON.ico
+ true
+ true
+
+
+ Debug
+ true
+ 1033
+ $(BDS)\bin\delphi_PROJECTICON.ico
+ true
+ true
+
MainSource
@@ -73,16 +107,9 @@
-
-
-
-
-
-
-
Cfg_2
Base
@@ -136,13 +163,647 @@
1.0.0.0
+
+ Microsoft Office 2000 Sample Automation Server Wrapper Components
+ Microsoft Office XP Sample Automation Server Wrapper Components
+
True
True
+
+
+
+ Project1.exe
+ true
+
+
+
+
+ 1
+
+
+ 0
+
+
+
+
+ classes
+ 1
+
+
+
+
+ res\xml
+ 1
+
+
+
+
+ library\lib\armeabi-v7a
+ 1
+
+
+
+
+ library\lib\armeabi
+ 1
+
+
+
+
+ library\lib\mips
+ 1
+
+
+
+
+ library\lib\armeabi-v7a
+ 1
+
+
+
+
+ res\drawable
+ 1
+
+
+
+
+ res\values
+ 1
+
+
+
+
+ res\values-v21
+ 1
+
+
+
+
+ res\values
+ 1
+
+
+
+
+ res\drawable
+ 1
+
+
+
+
+ res\drawable-xxhdpi
+ 1
+
+
+
+
+ res\drawable-ldpi
+ 1
+
+
+
+
+ res\drawable-mdpi
+ 1
+
+
+
+
+ res\drawable-hdpi
+ 1
+
+
+
+
+ res\drawable-xhdpi
+ 1
+
+
+
+
+ res\drawable-mdpi
+ 1
+
+
+
+
+ res\drawable-hdpi
+ 1
+
+
+
+
+ res\drawable-xhdpi
+ 1
+
+
+
+
+ res\drawable-xxhdpi
+ 1
+
+
+
+
+ res\drawable-xxxhdpi
+ 1
+
+
+
+
+ res\drawable-small
+ 1
+
+
+
+
+ res\drawable-normal
+ 1
+
+
+
+
+ res\drawable-large
+ 1
+
+
+
+
+ res\drawable-xlarge
+ 1
+
+
+
+
+ res\values
+ 1
+
+
+
+
+ 1
+
+
+ 1
+
+
+ 0
+
+
+
+
+ 1
+ .framework
+
+
+ 1
+ .framework
+
+
+ 0
+
+
+
+
+ 1
+ .dylib
+
+
+ 1
+ .dylib
+
+
+ 0
+ .dll;.bpl
+
+
+
+
+ 1
+ .dylib
+
+
+ 1
+ .dylib
+
+
+ 1
+ .dylib
+
+
+ 1
+ .dylib
+
+
+ 1
+ .dylib
+
+
+ 0
+ .bpl
+
+
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
+
+
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF
+ 1
+
+
+ ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF
+ 1
+
+
+
+
+
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
+
+
+
+
+
+ Contents\Resources
+ 1
+
+
+ Contents\Resources
+ 1
+
+
+
+
+ library\lib\armeabi-v7a
+ 1
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
+ 0
+
+
+
+
+ 1
+
+
+ 1
+
+
+
+
+ Assets
+ 1
+
+
+ Assets
+ 1
+
+
+
+
+ Assets
+ 1
+
+
+ Assets
+ 1
+
+
+
+
+
+
+
+
+
+
+
+
12
+
diff --git a/PythonForDelphi/Demos/Demo31/Project1.res b/PythonForDelphi/Demos/Demo31/Project1.res
index b6d7cb18..a04757b0 100644
Binary files a/PythonForDelphi/Demos/Demo31/Project1.res and b/PythonForDelphi/Demos/Demo31/Project1.res differ
diff --git a/PythonForDelphi/Demos/Demo31/Unit1.dfm b/PythonForDelphi/Demos/Demo31/Unit1.dfm
index 60cdd97b..a35fe2a5 100644
Binary files a/PythonForDelphi/Demos/Demo31/Unit1.dfm and b/PythonForDelphi/Demos/Demo31/Unit1.dfm differ
diff --git a/PythonForDelphi/Demos/Demo31/Unit1.pas b/PythonForDelphi/Demos/Demo31/Unit1.pas
index bc52f9a7..540569cc 100644
--- a/PythonForDelphi/Demos/Demo31/Unit1.pas
+++ b/PythonForDelphi/Demos/Demo31/Unit1.pas
@@ -6,13 +6,8 @@ interface
uses
SysUtils, Classes,
-{$IFDEF MSWINDOWS}
Windows, Messages, Graphics, Controls, Forms, Dialogs,
StdCtrls, ExtCtrls, ComCtrls,
-{$ENDIF}
-{$IFDEF LINUX}
- QForms, QStdCtrls, QControls, QExtCtrls,
-{$ENDIF}
PythonEngine, PythonGUIInputOutput, WrapDelphi, ActnList, System.Actions;
type
@@ -157,6 +152,29 @@ function TTestClass.QueryInterface(const IID: TGUID; out Obj): HResult;
Result := E_NOINTERFACE;
end;
+{$IFDEF EXTENDED_RTTI}
+{TTestRTTIAccess}
+type
+ TFruit = (Apple, Banana, Orange);
+ TFruits = set of TFruit;
+
+TTestRTTIAccess = class
+private
+ FFruit: TFruit;
+ FFruits: TFruits;
+public
+ FruitField :TFruit;
+ FruitsField: TFruits;
+ StringField: string;
+ DoubleField: double;
+ ObjectField : TObject;
+ procedure BuyFruits(AFruits: TFruits);
+ procedure SetFormCaption(Form: TForm; ACaption: string);
+ property Fruit: TFruit read FFruit write FFruit;
+ property Fruits: TFruits read FFruits write FFruits;
+end;
+{$ENDIF}
+
{ TForm1 }
procedure TForm1.Button1Click(Sender: TObject);
@@ -177,15 +195,26 @@ procedure TForm1.Button1Click(Sender: TObject);
PythonModule.SetVar( 'DVar', p );
PyEngine.Py_DecRef(p);
+{$IFDEF EXTENDED_RTTI}
+ // Then wrap the an instance our TTestRTTIAccess
+ // It will allow us to to test access to public fields and methods as well
+ // public (as well as published) properties.
+ // This time we would like the object to be destroyed when the PyObject
+ // is destroyed, so we need to set its Owned property to True;
+ p := PyDelphiWrapper.Wrap(TTestRTTIAccess.Create, soOwned);
+ PythonModule.SetVar( 'rtti_var', p );
+ PyEngine.Py_DecRef(p);
+{$ENDIF}
+
p := PyEngine.PyInt_FromLong(Trunc(System.CompilerVersion));
PythonModule.SetVar( 'DelphiVersion', p );
PyEngine.Py_DecRef(p);
// Excecute the script
+ PyEngine.CheckError;
PyEngine.ExecStrings( memo1.Lines );
end;
-
procedure TForm1.FormCreate(Sender: TObject);
begin
PyDelphiWrapper := TPyDelphiWrapper.Create(Self); // no need to destroy
@@ -207,4 +236,20 @@ procedure TForm1.actTestExecute(Sender: TObject);
Import('spam').DVar.IValue := 1;
end;
+{$IFDEF EXTENDED_RTTI}
+{ TTestRTTIAccess }
+
+procedure TTestRTTIAccess.BuyFruits(AFruits: TFruits);
+begin
+ Fruits := AFruits;
+end;
+
+procedure TTestRTTIAccess.SetFormCaption(Form: TForm; ACaption: string);
+begin
+ Form.Caption := 'From TTestRTTIAccess';
+end;
+{$ENDIF}
+
+initialization
+ ReportMemoryLeaksOnShutdown := DebugHook <> 0;
end.
diff --git a/PythonForDelphi/Demos/Demo32/Project1.dpr b/PythonForDelphi/Demos/Demo32/Project1.dpr
index 34e6006c..e50fa466 100644
--- a/PythonForDelphi/Demos/Demo32/Project1.dpr
+++ b/PythonForDelphi/Demos/Demo32/Project1.dpr
@@ -1,14 +1,11 @@
+// JCL_DEBUG_EXPERT_GENERATEJDBG OFF
+// JCL_DEBUG_EXPERT_INSERTJDBG OFF
program Project1;
{$I Definition.Inc}
uses
-{$IFDEF MSWINDOWS}
Forms,
-{$ENDIF}
-{$IFDEF LINUX}
- QForms,
-{$ENDIF}
Unit1 in 'Unit1.pas' {Form1};
{$R *.res}
diff --git a/PythonForDelphi/Demos/Demo32/Project1.dproj b/PythonForDelphi/Demos/Demo32/Project1.dproj
index b5826909..e792d344 100644
--- a/PythonForDelphi/Demos/Demo32/Project1.dproj
+++ b/PythonForDelphi/Demos/Demo32/Project1.dproj
@@ -1,138 +1,153 @@
-
-
- {26D3B086-D6C0-40C9-820A-269741BAC910}
- Project1.dpr
- Debug
- DCC32
- 13.4
- VCL
- True
- Win32
- 1
- Application
-
-
- true
-
-
- true
- Base
- true
-
-
- true
- Base
- true
-
-
- true
- Base
- true
-
-
- true
- Base
- true
-
-
- Vcl;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;System;Xml;Data;Datasnap;Web;Soap;Winapi;$(DCC_Namespace)
- CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments=
- 1032
- Project1.exe
- 00400000
- x86
-
-
- Project1_Icon.ico
-
-
- true
- Project1_Icon.ico
- Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace)
- 1033
- $(BDS)\bin\default_app.manifest
- CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments=
-
-
- false
- RELEASE;$(DCC_Define)
- 0
- false
-
-
- DEBUG;$(DCC_Define)
-
-
-
- MainSource
-
-
-
-
-
- Cfg_2
- Base
-
-
- Base
-
-
- Cfg_1
- Base
-
-
-
-
- Delphi.Personality.12
- VCLApplication
-
-
-
- Project1.dpr
-
-
- False
- True
- False
-
-
- False
- False
- 1
- 0
- 0
- 0
- False
- False
- False
- False
- False
- 1032
- 1253
-
-
-
-
- 1.0.0.0
-
-
-
-
-
- 1.0.0.0
-
-
-
- Microsoft Office 2000 Sample Automation Server Wrapper Components
- Microsoft Office XP Sample Automation Server Wrapper Components
-
-
-
- False
- True
-
-
- 12
-
-
-
+
+
+ {26D3B086-D6C0-40C9-820A-269741BAC910}
+ Project1.dpr
+ Debug
+ DCC32
+ 16.1
+ VCL
+ True
+ Win64
+ 3
+ Application
+
+
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Cfg_2
+ true
+ true
+
+
+ Project1
+ Vcl;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;System;Xml;Data;Datasnap;Web;Soap;Winapi;$(DCC_Namespace)
+ CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments=
+ 1032
+ Project1.exe
+ 00400000
+ x86
+
+
+ true
+ Project1_Icon.ico
+ System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace)
+ 1033
+ $(BDS)\bin\default_app.manifest
+
+
+ System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;$(DCC_Namespace)
+ $(BDS)\bin\default_app.manifest
+ true
+ 1033
+ Project1_Icon.ico
+
+
+ false
+ RELEASE;$(DCC_Define)
+ 0
+ 0
+
+
+ DEBUG;$(DCC_Define)
+
+
+ $(BDS)\bin\delphi_PROJECTICON.ico
+ 1033
+ true
+
+
+
+ MainSource
+
+
+
+
+
+ Cfg_2
+ Base
+
+
+ Base
+
+
+ Cfg_1
+ Base
+
+
+
+
+ Delphi.Personality.12
+ VCLApplication
+
+
+
+ Project1.dpr
+
+
+ False
+ True
+ False
+
+
+ False
+ False
+ 1
+ 0
+ 0
+ 0
+ False
+ False
+ False
+ False
+ False
+ 1032
+ 1253
+
+
+
+
+ 1.0.0.0
+
+
+
+
+
+ 1.0.0.0
+
+
+
+ Microsoft Office 2000 Sample Automation Server Wrapper Components
+ Microsoft Office XP Sample Automation Server Wrapper Components
+
+
+
+ True
+ True
+
+
+ 12
+
+
+
diff --git a/PythonForDelphi/Demos/Demo32/Project1.res b/PythonForDelphi/Demos/Demo32/Project1.res
index 3f7606cf..0f3facb9 100644
Binary files a/PythonForDelphi/Demos/Demo32/Project1.res and b/PythonForDelphi/Demos/Demo32/Project1.res differ
diff --git a/PythonForDelphi/Demos/Demo32/Unit1.dfm b/PythonForDelphi/Demos/Demo32/Unit1.dfm
index 07eb931c..25978023 100644
Binary files a/PythonForDelphi/Demos/Demo32/Unit1.dfm and b/PythonForDelphi/Demos/Demo32/Unit1.dfm differ
diff --git a/PythonForDelphi/Demos/Demo32/Unit1.pas b/PythonForDelphi/Demos/Demo32/Unit1.pas
index ecc760e5..14df2bbf 100644
--- a/PythonForDelphi/Demos/Demo32/Unit1.pas
+++ b/PythonForDelphi/Demos/Demo32/Unit1.pas
@@ -8,21 +8,12 @@
{$I Definition.Inc}
-{$IFNDEF DELPHI7_OR_HIGHER}
- This project requires Delphi7 or later to compile!!!
-{$ENDIF}
-
interface
uses
SysUtils, Classes,
-{$IFDEF MSWINDOWS}
Windows, Messages, Graphics, Controls, Forms, Dialogs,
StdCtrls, ExtCtrls, ComCtrls,
-{$ENDIF}
-{$IFDEF LINUX}
- QForms, QStdCtrls, QControls, QExtCtrls,
-{$ENDIF}
WrapDelphi, WrapDelphiClasses,
PythonEngine, PythonGUIInputOutput;
@@ -40,9 +31,7 @@ TForm1 = class(TForm)
procedure Button1Click(Sender: TObject);
procedure PyDelphiWrapperInitialization(Sender: TObject);
private
- { Déclarations privées }
public
- { Déclarations publiques }
end;
{
diff --git a/PythonForDelphi/Demos/Demo33/SortThds.pas b/PythonForDelphi/Demos/Demo33/SortThds.pas
index cf0aad52..a1ab554a 100644
--- a/PythonForDelphi/Demos/Demo33/SortThds.pas
+++ b/PythonForDelphi/Demos/Demo33/SortThds.pas
@@ -6,12 +6,7 @@ interface
uses
Classes,
-{$IFDEF MSWINDOWS}
- Graphics, ExtCtrls,
-{$ENDIF}
-{$IFDEF LINUX}
- QGraphics, QExtCtrls,
-{$ENDIF}
+ Graphics, ExtCtrls, Forms,
PythonEngine;
type
@@ -40,7 +35,7 @@ TSortThread = class(TPythonThread)
public
property value[i: integer]: integer read getvalue; default;
- constructor Create( ainterp: PPyInterpreterState; script: TStrings;
+ constructor Create( AThreadExecMode: TThreadExecMode; script: TStrings;
module: TPythonModule; apyfuncname: string;
Box: TPaintBox; var SortArray: array of Integer);
@@ -59,7 +54,7 @@ procedure PaintLine(Canvas: TCanvas; I, Len: Integer);
{ TSortThread }
-constructor TSortThread.Create( ainterp: PPyInterpreterState; script: TStrings;
+constructor TSortThread.Create( AThreadExecMode: TThreadExecMode; script: TStrings;
module: TPythonModule; apyfuncname: string;
Box: TPaintBox; var SortArray: array of Integer);
begin
@@ -70,7 +65,7 @@ constructor TSortThread.Create( ainterp: PPyInterpreterState; script: TStrings;
FSortArray := @SortArray;
FSize := High(SortArray) - Low(SortArray) + 1;
FreeOnTerminate := True;
- InterpreterState := ainterp;
+ ThreadExecMode := AThreadExecMode;
inherited Create(False);
end;
@@ -88,6 +83,7 @@ procedure TSortThread.DoVisualSwap;
var t: integer;
pi,pj: pinteger;
begin
+ Application.ProcessMessages;
with FBox do
begin
Canvas.Pen.Color := clBtnFace;
@@ -126,24 +122,25 @@ procedure TSortThread.ExecuteWithPython;
var pyfunc: PPyObject;
begin
running := true;
- with GetPythonEngine do
- begin
- if Assigned(FModule) and (ThreadExecMode = emNewInterpreter) then
- FModule.InitializeForNewInterpreter;
- if Assigned(fScript) then
- ExecStrings(fScript);
- pyfunc := FindFunction( ExecModule, fpyfuncname);
- if Assigned(pyfunc) then
- try
- EvalFunction(pyfunc,[NativeInt(self),0,FSize]);
- except
-
- end;
-
- Py_DecRef(pyfunc);
-
+ try
+ with GetPythonEngine do
+ begin
+ if Assigned(FModule) and (ThreadExecMode = emNewInterpreter) then
+ FModule.InitializeForNewInterpreter;
+ if Assigned(fScript) then
+ ExecStrings(fScript);
+ pyfunc := FindFunction( ExecModule, fpyfuncname);
+ if Assigned(pyfunc) then
+ try
+ EvalFunction(pyfunc,[NativeInt(self),0,FSize]);
+ except
+ end;
+
+ Py_DecRef(pyfunc);
+ end;
+ finally
+ running := false;
end;
- running := false;
end;
procedure TSortThread.Stop;
diff --git a/PythonForDelphi/Demos/Demo33/ThSort.pas b/PythonForDelphi/Demos/Demo33/ThSort.pas
index c2416687..9db2eac6 100644
--- a/PythonForDelphi/Demos/Demo33/ThSort.pas
+++ b/PythonForDelphi/Demos/Demo33/ThSort.pas
@@ -6,13 +6,8 @@ interface
uses
SysUtils, Classes,
-{$IFDEF MSWINDOWS}
Windows, Messages, Graphics, Controls, Forms, Dialogs,
ExtCtrls, StdCtrls,
-{$ENDIF}
-{$IFDEF LINUX}
- QForms, QDialogs, QStdCtrls, QControls, QExtCtrls,
-{$ENDIF}
PythonEngine, PythonGUIInputOutput, SortThds;
type
@@ -52,7 +47,7 @@ TThreadSortForm = class(TForm)
ThreadsRunning: Integer;
procedure RandomizeArrays;
procedure ThreadDone(Sender: TObject);
- procedure InitThreads(interp: PPyInterpreterState; script: TStrings);
+ procedure InitThreads(ThreadExecMode: TThreadExecMode; script: TStrings);
function SortModule_GetValue( pself, args : PPyObject ) : PPyObject; cdecl;
function SortModule_Swap( pself, args : PPyObject ) : PPyObject; cdecl;
@@ -69,13 +64,11 @@ TThreadSortForm = class(TForm)
implementation
-
-
{$R *.dfm}
type
PSortArray = ^TSortArray;
- TSortArray = array[0..176] of Integer;
+ TSortArray = array[0..200] of Integer;
var
ArraysRandom: Boolean;
@@ -114,24 +107,23 @@ procedure TThreadSortForm.FormCreate(Sender: TObject);
RandomizeArrays;
end;
-procedure TThreadSortForm.InitThreads(interp: PPyInterpreterState; script: TStrings);
+procedure TThreadSortForm.InitThreads(ThreadExecMode: TThreadExecMode; script: TStrings);
begin
RandomizeArrays;
ThreadsRunning := 3;
with GetPythonEngine do
begin
- OwnThreadState := PyThreadState_Get;
- PyEval_ReleaseThread(OwnThreadState);
+ OwnThreadState := PyEval_SaveThread;
- Thread1 := TSortThread.Create( interp, script, SortModule, 'SortFunc1',
+ Thread1 := TSortThread.Create( ThreadExecMode, script, SortModule, 'SortFunc1',
BubbleSortBox, BubbleSortArray);
Thread1.OnTerminate := ThreadDone;
- Thread2 := TSortThread.Create( interp, script, SortModule, 'SortFunc2',
+ Thread2 := TSortThread.Create( ThreadExecMode, script, SortModule, 'SortFunc2',
SelectionSortBox, SelectionSortArray);
Thread2.OnTerminate := ThreadDone;
- Thread3 := TSortThread.Create( interp, script, SortModule, 'SortFunc3',
+ Thread3 := TSortThread.Create( ThreadExecMode, script, SortModule, 'SortFunc3',
QuickSortBox, QuickSortArray);
Thread3.OnTerminate := ThreadDone;
@@ -146,13 +138,13 @@ procedure TThreadSortForm.Start2BtnClick(Sender: TObject);
with GetPythonEngine do
begin
ExecStrings(PythonMemo.Lines);
- self.InitThreads(PyThreadState_Get.interp,nil);
+ self.InitThreads(emNewState,nil);
end;
end;
procedure TThreadSortForm.StartBtnClick(Sender: TObject);
begin
- InitThreads(nil,PythonMemo.Lines);
+ InitThreads(emNewInterpreter,PythonMemo.Lines);
//PythonEngine1.ExecStrings(PythonMemo.Lines);
end;
@@ -189,10 +181,13 @@ procedure TThreadSortForm.ThreadDone(Sender: TObject);
Dec(ThreadsRunning);
if ThreadsRunning = 0 then
begin
- GetPythonEngine.PyEval_AcquireThread(OwnThreadState);
+ GetPythonEngine.PyEval_RestoreThread(OwnThreadState);
StartBtn.Enabled := True;
Start2Btn.Enabled := True;
ArraysRandom := False;
+ Thread1 := nil;
+ Thread2 := nil;
+ Thread3 := nil;
end;
end;
@@ -247,9 +242,9 @@ procedure TThreadSortForm.SortModuleInitialization(Sender: TObject);
procedure TThreadSortForm.Button1Click(Sender: TObject);
begin
- Thread1.Stop();
- Thread2.Stop();
- Thread3.Stop();
+ if Assigned(Thread1) and not Thread1.Finished then Thread1.Stop();
+ if Assigned(Thread2) and not Thread2.Finished then Thread2.Stop();
+ if Assigned(Thread3) and not Thread3.Finished then Thread3.Stop();
end;
procedure TThreadSortForm.FormCloseQuery(Sender: TObject;
diff --git a/PythonForDelphi/Demos/Demo33/ThrdDemo.dpr b/PythonForDelphi/Demos/Demo33/ThrdDemo.dpr
index 25398ff6..9e202ad1 100644
--- a/PythonForDelphi/Demos/Demo33/ThrdDemo.dpr
+++ b/PythonForDelphi/Demos/Demo33/ThrdDemo.dpr
@@ -1,6 +1,3 @@
-// JCL_DEBUG_EXPERT_GENERATEJDBG OFF
-// JCL_DEBUG_EXPERT_INSERTJDBG OFF
-// JCL_DEBUG_EXPERT_DELETEMAPFILE OFF
program ThrdDemo;
uses
diff --git a/PythonForDelphi/Demos/Demo33/ThrdDemo.dproj b/PythonForDelphi/Demos/Demo33/ThrdDemo.dproj
index 87805686..b59aa1ee 100644
--- a/PythonForDelphi/Demos/Demo33/ThrdDemo.dproj
+++ b/PythonForDelphi/Demos/Demo33/ThrdDemo.dproj
@@ -1,108 +1,195 @@
-
-
- {9e78092e-5a16-44b9-97bf-b879c252b4ba}
- Debug
- AnyCPU
- DCC32
- ThrdDemo.exe
- ThrdDemo.dpr
- 12.0
- Debug
-
-
- true
-
-
- true
- Base
- true
-
-
- true
- Base
- true
-
-
- ThrdDemo.exe
-
-
- 7.0
- False
- False
- 0
- RELEASE;$(DCC_Define)
-
-
- 7.0
- DEBUG;JVCLThemesEnabled;COMPILER5_UP;PS_USESSUPPORT;$(DCC_Define)
- C:\Users\alex\python4delphi-read-only\PythonForDelphi\Components\Sources\Core;$(DCC_UnitSearchPath)
- C:\Users\alex\python4delphi-read-only\PythonForDelphi\Components\Sources\Core;$(DCC_ResourcePath)
- C:\Users\alex\python4delphi-read-only\PythonForDelphi\Components\Sources\Core;$(DCC_ObjPath)
- C:\Users\alex\python4delphi-read-only\PythonForDelphi\Components\Sources\Core;$(DCC_IncludePath)
-
-
- Delphi.Personality.12
-
-
-
-
- False
- True
- False
-
-
- False
- False
- 1
- 0
- 0
- 0
- False
- False
- False
- False
- False
- 1049
- 1251
-
-
-
-
- 1.0.0.0
-
-
-
-
-
- 1.0.0.0
-
-
-
- ThrdDemo.dpr
-
-
-
- 12
-
-
-
- MainSource
-
-
-
-
-
-
- Base
-
-
- Cfg_2
- Base
-
-
- Cfg_1
- Base
-
-
-
-
+
+
+ {9e78092e-5a16-44b9-97bf-b879c252b4ba}
+ Debug
+ DCC32
+ ThrdDemo.exe
+ ThrdDemo.dpr
+ 18.4
+ Debug
+ VCL
+ True
+ Win64
+ 3
+ Application
+
+
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Cfg_1
+ true
+ true
+
+
+ true
+ Cfg_1
+ true
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Cfg_2
+ true
+ true
+
+
+ true
+ Cfg_2
+ true
+ true
+
+
+ ThrdDemo.exe
+ ThrdDemo
+ Vcl;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;System;Xml;Data;Datasnap;Web;Soap;Winapi;$(DCC_Namespace)
+ 1049
+ CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments=
+
+
+ Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace)
+ Debug
+ true
+ CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments=;ProgramID=com.embarcadero.$(MSBuildProjectName)
+ 1033
+ $(BDS)\bin\default_app.manifest
+ ThrdDemo_Icon.ico
+ true
+ $(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_44.png
+ $(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_150.png
+
+
+ $(BDS)\bin\default_app.manifest
+ ThrdDemo_Icon.ico
+ true
+ $(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_44.png
+ $(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_150.png
+ System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;$(DCC_Namespace)
+ Debug
+ 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=
+ 1033
+
+
+ 7.0
+ 0
+ False
+ 0
+ RELEASE;$(DCC_Define)
+
+
+ true
+ true
+
+
+ true
+ true
+
+
+ 7.0
+ DEBUG;JVCLThemesEnabled;COMPILER5_UP;PS_USESSUPPORT;$(DCC_Define)
+ C:\Users\alex\python4delphi-read-only\PythonForDelphi\Components\Sources\Core;$(DCC_UnitSearchPath)
+ C:\Users\alex\python4delphi-read-only\PythonForDelphi\Components\Sources\Core;$(DCC_ResourcePath)
+ C:\Users\alex\python4delphi-read-only\PythonForDelphi\Components\Sources\Core;$(DCC_ObjPath)
+ C:\Users\alex\python4delphi-read-only\PythonForDelphi\Components\Sources\Core;$(DCC_IncludePath)
+
+
+ true
+ true
+
+
+ true
+ true
+
+
+ Delphi.Personality.12
+
+
+
+
+ False
+ True
+ False
+
+
+ False
+ False
+ 1
+ 0
+ 0
+ 0
+ False
+ False
+ False
+ False
+ False
+ 1049
+ 1251
+
+
+
+
+ 1.0.0.0
+
+
+
+
+
+ 1.0.0.0
+
+
+
+ ThrdDemo.dpr
+
+
+
+ True
+ True
+
+
+ 12
+
+
+
+ MainSource
+
+
+
+
+
+
+ Cfg_2
+ Base
+
+
+ Base
+
+
+ Cfg_1
+ Base
+
+
+
+
+
diff --git a/PythonForDelphi/Demos/Demo34/Project1.dpr b/PythonForDelphi/Demos/Demo34/Project1.dpr
new file mode 100644
index 00000000..7a68fc98
--- /dev/null
+++ b/PythonForDelphi/Demos/Demo34/Project1.dpr
@@ -0,0 +1,15 @@
+program Project1;
+
+{$I Definition.Inc}
+
+uses
+ Forms,
+ Unit1 in 'Unit1.pas' {Form1};
+
+{$R *.res}
+
+begin
+ Application.Initialize;
+ Application.CreateForm(TForm1, Form1);
+ Application.Run;
+end.
diff --git a/PythonForDelphi/Demos/Demo34/Project1.dproj b/PythonForDelphi/Demos/Demo34/Project1.dproj
new file mode 100644
index 00000000..b4f73f07
--- /dev/null
+++ b/PythonForDelphi/Demos/Demo34/Project1.dproj
@@ -0,0 +1,558 @@
+
+
+ {910E2A03-F875-4153-9E58-3434C6D9AB6F}
+ Project1.dpr
+ Debug
+ DCC32
+ 18.3
+ VCL
+ True
+ Win32
+ 3
+ Application
+
+
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Cfg_1
+ true
+ true
+
+
+ true
+ Cfg_1
+ true
+ true
+
+
+ true
+ Base
+ true
+
+
+ true
+ Cfg_2
+ true
+ true
+
+
+ true
+ Cfg_2
+ true
+ true
+
+
+ Project1.exe
+ 00400000
+ x86
+ Project1
+ Vcl;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;System;Xml;Data;Datasnap;Web;Soap;Winapi;$(DCC_Namespace)
+ 1033
+ CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments=
+
+
+ System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace)
+ Debug
+ true
+ CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments=;ProgramID=com.embarcadero.$(MSBuildProjectName)
+ 1033
+ $(BDS)\bin\default_app.manifest
+ Project1_Icon.ico
+ true
+ $(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_44.png
+ $(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_150.png
+
+
+ Project1_Icon.ico
+ $(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_44.png
+ $(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_150.png
+ System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;$(DCC_Namespace)
+ Debug
+ 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
+
+
+ false
+ RELEASE;$(DCC_Define)
+ 0
+ 0
+
+
+ true
+ true
+
+
+ true
+ true
+
+
+ DEBUG;$(DCC_Define)
+
+
+ true
+ true
+
+
+ true
+ true
+ 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=
+
+
+
+ MainSource
+
+
+
+
+
+ Cfg_2
+ Base
+
+
+ Base
+
+
+ Cfg_1
+ Base
+
+
+
+
+ Delphi.Personality.12
+ VCLApplication
+
+
+
+ Project1.dpr
+
+
+ False
+ True
+ False
+
+
+ False
+ False
+ 1
+ 0
+ 0
+ 0
+ False
+ False
+ False
+ False
+ False
+ 1033
+ 1252
+
+
+
+
+ 1.0.0.0
+
+
+
+
+
+ 1.0.0.0
+
+
+
+ Microsoft Office 2000 Sample Automation Server Wrapper Components
+ Microsoft Office XP Sample Automation Server Wrapper Components
+
+
+
+ True
+ True
+
+
+
+
+ Project1.exe
+ true
+
+
+
+
+ 1
+
+
+ Contents\MacOS
+ 0
+
+
+
+
+ classes
+ 1
+
+
+
+
+ library\lib\armeabi-v7a
+ 1
+
+
+
+
+ library\lib\armeabi
+ 1
+
+
+
+
+ library\lib\mips
+ 1
+
+
+
+
+ library\lib\armeabi-v7a
+ 1
+
+
+
+
+ res\drawable
+ 1
+
+
+
+
+ res\values
+ 1
+
+
+
+
+ res\drawable
+ 1
+
+
+
+
+ res\drawable-xxhdpi
+ 1
+
+
+
+
+ res\drawable-ldpi
+ 1
+
+
+
+
+ res\drawable-mdpi
+ 1
+
+
+
+
+ res\drawable-hdpi
+ 1
+
+
+
+
+ res\drawable-xhdpi
+ 1
+
+
+
+
+ res\drawable-small
+ 1
+
+
+
+
+ res\drawable-normal
+ 1
+
+
+
+
+ res\drawable-large
+ 1
+
+
+
+
+ res\drawable-xlarge
+ 1
+
+
+
+
+ 1
+
+
+ 1
+
+
+ 0
+
+
+
+
+ 1
+ .framework
+
+
+ 0
+
+
+
+
+ 1
+ .dylib
+
+
+ 0
+ .dll;.bpl
+
+
+
+
+ 1
+ .dylib
+
+
+ 1
+ .dylib
+
+
+ 1
+ .dylib
+
+
+ 1
+ .dylib
+
+
+ 0
+ .bpl
+
+
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+ 0
+
+
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
+
+
+ 1
+
+
+
+
+ ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF
+ 1
+
+
+ ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF
+ 1
+
+
+
+
+
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
+
+
+
+
+ Contents\Resources
+ 1
+
+
+
+
+ library\lib\armeabi-v7a
+ 1
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
+ 1
+
+
+ 0
+
+
+
+
+ 1
+
+
+ 1
+
+
+
+
+ Assets
+ 1
+
+
+ Assets
+ 1
+
+
+
+
+ Assets
+ 1
+
+
+ Assets
+ 1
+
+
+
+
+
+
+
+
+
+
+
+
+ 12
+
+
+
+
diff --git a/PythonForDelphi/Demos/Demo34/Project1.res b/PythonForDelphi/Demos/Demo34/Project1.res
new file mode 100644
index 00000000..4aaa52b5
Binary files /dev/null and b/PythonForDelphi/Demos/Demo34/Project1.res differ
diff --git a/PythonForDelphi/Demos/Demo34/Project1_Icon.ico b/PythonForDelphi/Demos/Demo34/Project1_Icon.ico
new file mode 100644
index 00000000..9d0e1f36
Binary files /dev/null and b/PythonForDelphi/Demos/Demo34/Project1_Icon.ico differ
diff --git a/PythonForDelphi/Demos/Demo34/Unit1.dfm b/PythonForDelphi/Demos/Demo34/Unit1.dfm
new file mode 100644
index 00000000..d99467ee
Binary files /dev/null and b/PythonForDelphi/Demos/Demo34/Unit1.dfm differ
diff --git a/PythonForDelphi/Demos/Demo34/Unit1.pas b/PythonForDelphi/Demos/Demo34/Unit1.pas
new file mode 100644
index 00000000..3eeaaa4b
--- /dev/null
+++ b/PythonForDelphi/Demos/Demo34/Unit1.pas
@@ -0,0 +1,351 @@
+unit Unit1;
+
+{$I Definition.Inc}
+
+interface
+
+uses
+ SysUtils, Classes,
+ Windows, Messages, Graphics, Controls, Forms, Dialogs,
+ StdCtrls, ExtCtrls, ComCtrls, PythonVersions,
+ PythonEngine, PythonGUIInputOutput;
+
+type
+ TForm1 = class(TForm)
+ Splitter1: TSplitter;
+ Memo1: TMemo;
+ Panel1: TPanel;
+ Button1: TButton;
+ PythonGUIInputOutput1: TPythonGUIInputOutput;
+ Memo2: TMemo;
+ cbPyVersions: TComboBox;
+ Label1: TLabel;
+ procedure Button1Click(Sender: TObject);
+ procedure PythonType1Initialization(Sender: TObject);
+ 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;
+
+ // This is a Delphi class implementing a new Python type
+ // it must derive from TPyObject or one of its descendants.
+ // 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;
+
+ // Constructors & Destructors
+ constructor Create( APythonType : TPythonType ); override;
+ constructor CreateWith( PythonType : TPythonType; args : PPyObject ); override;
+
+ // Type services
+ ////////////////
+
+ // Basic services
+ function Repr : PPyObject; override;
+
+ // Class methods
+ class procedure RegisterMethods( PythonType : TPythonType ); override;
+ class procedure RegisterMembers( PythonType : TPythonType ); override;
+ class procedure RegisterGetSets( PythonType : TPythonType ); override;
+
+ // Methods of TPyPoint
+ procedure OffsetBy( dx, dy : Integer );
+
+ // Interface methods
+ function DoOffsetBy( args : PPyObject ) : PPyObject; cdecl;
+ function DoRaiseError( args : PPyObject ) : PPyObject; cdecl;
+ end;
+
+var
+ Form1: TForm1;
+
+implementation
+
+{$R *.dfm}
+
+procedure TForm1.cbPyVersionsSelect(Sender: TObject);
+begin
+ CreatePythonComponents
+end;
+
+procedure TForm1.CreatePythonComponents;
+begin
+ if cbPyVersions.ItemIndex <0 then begin
+ ShowMessage('No Python version is selected');
+ Exit;
+ end;
+
+ // Destroy P4D components
+ FreeAndNil(PythonEngine1);
+ FreeAndNil(PythonType1);
+ FreeAndNil(PythonModule1);
+
+ { TPythonEngine }
+ PythonEngine1 := TPythonEngine.Create(Self);
+ PyVersions[cbPyVersions.ItemIndex].AssignTo(PythonEngine1);
+
+ PythonEngine1.IO := PythonGUIInputOutput1;
+
+
+ { TPythonModule }
+ PythonModule1 := TPythonModule.Create(Self);
+
+ PythonModule1.Name := 'PythonModule1';
+ PythonModule1.Engine := PythonEngine1;
+ PythonModule1.ModuleName := 'spam';
+ with PythonModule1.Errors.Add do begin
+ Name := 'PointError';
+ ErrorType := etClass;
+ end;
+ with PythonModule1.Errors.Add do begin
+ Name := 'EBadPoint';
+ ErrorType := etClass;
+ ParentClass.Name := 'PointError';
+ end;
+
+ { TPythonType }
+ PythonType1 := TPythonType.Create(Self);
+
+ PythonType1.Name := 'PythonType1';
+ PythonType1.Engine := PythonEngine1;
+ PythonType1.OnInitialization := PythonType1Initialization;
+ PythonType1.TypeName := 'Point';
+ PythonType1.Prefix := 'Create';
+ PythonType1.Services.Basic := [bsRepr,bsStr,bsGetAttrO,bsSetAttrO];
+ PythonType1.TypeFlags :=
+ [tpfHaveGetCharBuffer,tpfHaveSequenceIn,tpfHaveInplaceOps,
+ tpfHaveRichCompare,tpfHaveWeakRefs,tpfHaveIter,tpfHaveClass,tpfBaseType];
+ PythonType1.Module := PythonModule1;
+
+ PythonEngine1.LoadDll;
+end;
+
+procedure TForm1.FormCreate(Sender: TObject);
+Var
+ PyVersion : TPythonVersion;
+begin
+ PyVersions := GetRegisteredPythonVersions;
+ for PyVersion in PyVersions do
+ cbPyVersions.Items.Add(PyVersion.DisplayName);
+ if cbPyVersions.Items.Count > 0 then begin
+ cbPyVersions.ItemIndex := 0;
+ CreatePythonComponents;
+ end;
+end;
+
+
+// First, we need to initialize the property PyObjectClass with
+// the class of our Type object
+procedure TForm1.PythonType1Initialization(Sender: TObject);
+begin
+ PythonType1.PyObjectClass := TPyPoint;
+end;
+
+// We override the constructors
+
+constructor TPyPoint.Create( APythonType : TPythonType );
+begin
+ inherited;
+ x := 0;
+ y := 0;
+end;
+
+// 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.
+
+constructor TPyPoint.CreateWith( PythonType : TPythonType; args : PPyObject );
+begin
+ inherited;
+ with GetPythonEngine do
+ begin
+ if PyArg_ParseTuple( args, 'ii:CreatePoint',@x, @y ) = 0 then
+ exit;
+ end;
+end;
+
+// Then we override the needed services
+
+function TPyPoint.Repr : PPyObject;
+begin
+ with GetPythonEngine do
+ Result := VariantAsPyObject(Format('(%d, %d)',[x, y]));
+ // or Result := PyString_FromString( PAnsiChar(Format('(%d, %d)',[x, y])) );
+end;
+
+// get/set functions
+function TPyPoint_GetName( obj : PPyObject; context : Pointer) : PPyObject; cdecl;
+begin
+ with GetPythonEngine do
+ Result := PyString_FromString(PAnsiChar(AnsiString(TPyPoint(PythonToDelphi(obj)).Name)));
+end;
+
+function TPyPoint_SetName( obj, value : PPyObject; context : Pointer) : integer; cdecl;
+begin
+ with GetPythonEngine do
+ begin
+ if PyString_Check(value) then
+ begin
+ TPyPoint(PythonToDelphi(obj)).Name := PyObjectAsVariant(value);
+ Result := 0;
+ end
+ else
+ begin
+ Result := -1;
+ PyErr_SetString(PyExc_AttributeError^, 'attribute Name expected a string value');
+ end;
+ end;
+end;
+
+// Class methods
+// We register the methods of our type
+
+class procedure TPyPoint.RegisterMethods( PythonType : TPythonType );
+begin
+ inherited;
+ with PythonType do
+ begin
+ AddMethod( 'OffsetBy', @TPyPoint.DoOffsetBy, 'Point.OffsetBy( dx, dy )' );
+ AddMethod( 'RaiseError', @TPyPoint.DoRaiseError, 'Point.RaiseError()' );
+ end;
+end;
+
+class procedure TPyPoint.RegisterMembers( PythonType : TPythonType );
+begin
+ with PythonType do
+ begin
+ AddMember( 'x', mtInt, NativeInt(@TPyPoint(nil).x), mfDefault, 'x coordinate');
+ AddMember( 'y', mtInt, NativeInt(@TPyPoint(nil).y), mfDefault, 'y coordinate');
+ end;
+end;
+
+class procedure TPyPoint.RegisterGetSets( PythonType : TPythonType );
+begin
+ with PythonType do
+ begin
+ AddGetSet('Name', TPyPoint_GetName, TPyPoint_SetName, 'Name of a point', nil);
+ end;
+end;
+
+// Methods of TPyPoint
+// They do the real actions on the object
+// It's better to split the functions that interface
+// Delphi to Python and the functions that do the
+// real implementation.
+
+procedure TPyPoint.OffsetBy( dx, dy : Integer );
+begin
+ Inc( x, dx );
+ Inc( y, dy );
+end;
+
+// Interface methods
+// They will be called directly by Python, so we extract the
+// python arguments and we call the method that will really do
+// the action.
+
+function TPyPoint.DoOffsetBy( args : PPyObject ) : PPyObject;
+var
+ 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
+ begin
+ // if it's ok, then we call the method that does the job
+ // with the correct arguments
+ OffsetBy( dx, dy );
+ // Finally, we return nothing
+ Result := ReturnNone;
+ end
+ else // the arguments were not right
+ Result := nil;
+ end;
+end;
+
+// Here's an example of how you can raise errors defined
+// in the module linked to our type.
+function TPyPoint.DoRaiseError( args : PPyObject ) : PPyObject;
+begin
+ with GetPythonEngine do
+ begin
+ // We adjust the transmitted self argument
+ Adjust(@Self);
+ // This is a simple call:
+ //GetModule.RaiseError( 'PointError', 'this is an example of raising an error !' );
+ // This is an advanced call:
+ // We provide the instance vars as a dictionary, so that we can intercept the
+ // error with "except" and extract informations from the error object.
+ // ArrayToPyDict needs a list of pairs: varName (string), varValue (anything)
+ GetModule.RaiseErrorObj( 'EBadPoint', 'this is an example of raising an error !',
+ ArrayToPyDict( ['a', 1, 'b', 2, 'c', 3] ) );
+ Result := nil;
+ end;
+end;
+
+/////////////////////////////////////////////////
+
+
+procedure TForm1.Button1Click(Sender: TObject);
+var
+ 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
+ // because it will do some initialization. You can use CreateInstanceWith
+ // if you want to transmit some Python arguments.
+ // We receive a Python object pointer
+ p := PythonType1.CreateInstance;
+ PythonEngine1.CheckError;
+ // 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;
+ // Add variable "myPoint" in the module "spam".
+ // So you'll access to the var in the module called spam with:
+ // import spam
+ // print spam.myPoint
+ PythonModule1.SetVar( 'myPoint', p );
+ PythonEngine1.Py_DecRef(p);
+ {
+ Of course, if you want to retrieve a Python var from a module,
+ just use the PythonModule1.GetVar or PythonModule1.GetVarAsVariant
+ Example:
+ p := PythonModule1.GetVar('myPoint');
+ if Assigned(p) then
+ begin
+ DelphiPoint := PythonToDelphi(p) as TPyPoint;
+ ...
+ Py_XDecRef(p);
+ end;
+
+ end; }
+ // Excecute the script
+ PythonEngine1.ExecStrings( memo1.Lines );
+ // Add the following line at the end of the script:
+ // print spam.myPoint
+
+ // Note, that you must not free the delphi point yourself.
+ // Instead use the GetPythonEngine.Py_XDECREF(obj) method,
+ // because the object may be used by another Python object.
+end;
+
+end.
diff --git a/PythonForDelphi/Demos/FPC/Demo01/fpc-res.or b/PythonForDelphi/Demos/FPC/Demo01/fpc-res.or
deleted file mode 100644
index 17d61c85..00000000
Binary files a/PythonForDelphi/Demos/FPC/Demo01/fpc-res.or and /dev/null differ
diff --git a/PythonForDelphi/Demos/FPC/Demo06/Project1.lpi b/PythonForDelphi/Demos/FPC/Demo06/Project1.lpi
index 4b4bfea4..21a8b55f 100644
--- a/PythonForDelphi/Demos/FPC/Demo06/Project1.lpi
+++ b/PythonForDelphi/Demos/FPC/Demo06/Project1.lpi
@@ -1,18 +1,16 @@
-
+
-
+
-
-
@@ -26,28 +24,24 @@
-
+
-
-
+
-
-
-
-
-
-
+
+
+
@@ -56,176 +50,75 @@
-
-
-
-
-
-
+
+
+
+
-
-
-
-
+
-
-
-
-
-
-
-
+
+
+
+
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
+
-
+
@@ -239,14 +132,17 @@
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
diff --git a/PythonForDelphi/Demos/FPC/Demo06/Project1.lpr b/PythonForDelphi/Demos/FPC/Demo06/Project1.lpr
index b2943a89..0d555335 100644
--- a/PythonForDelphi/Demos/FPC/Demo06/Project1.lpr
+++ b/PythonForDelphi/Demos/FPC/Demo06/Project1.lpr
@@ -7,7 +7,7 @@
Forms, Interfaces,
{$ENDIF}
{$IFDEF LINUX}
- QForms,
+ Forms, Interfaces,
{$ENDIF}
Unit1 in 'Unit1.pas' {Form1};
diff --git a/PythonForDelphi/Demos/FPC/Demo06/Project1.res b/PythonForDelphi/Demos/FPC/Demo06/Project1.res
index 7c6cf3e4..877868cb 100644
Binary files a/PythonForDelphi/Demos/FPC/Demo06/Project1.res and b/PythonForDelphi/Demos/FPC/Demo06/Project1.res differ
diff --git a/PythonForDelphi/Demos/FPC/Demo06/Unit1.lfm b/PythonForDelphi/Demos/FPC/Demo06/Unit1.lfm
index 94a42c35..c02dca2b 100644
--- a/PythonForDelphi/Demos/FPC/Demo06/Unit1.lfm
+++ b/PythonForDelphi/Demos/FPC/Demo06/Unit1.lfm
@@ -1,30 +1,32 @@
object Form1: TForm1
Left = 233
- Height = 337
+ Height = 500
Top = 175
- Width = 528
+ Width = 800
+ ActiveControl = Button1
Caption = 'Demo of Python'
- ClientHeight = 337
- ClientWidth = 528
+ ClientHeight = 500
+ ClientWidth = 800
Color = clBtnFace
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
- LCLVersion = '0.9.30.2'
+ LCLVersion = '1.8.0.6'
+ Visible = False
object Splitter1: TSplitter
Cursor = crVSplit
Left = 0
Height = 3
Top = 145
- Width = 528
+ Width = 800
Align = alTop
ResizeAnchor = akTop
end
object Memo1: TMemo
Left = 0
- Height = 121
+ Height = 284
Top = 148
- Width = 528
+ Width = 800
Align = alClient
Lines.Strings = (
'import sys'
@@ -46,15 +48,15 @@ object Form1: TForm1
object Panel1: TPanel
Left = 0
Height = 68
- Top = 269
- Width = 528
+ Top = 432
+ Width = 800
Align = alBottom
BevelOuter = bvNone
ClientHeight = 68
- ClientWidth = 528
+ ClientWidth = 800
TabOrder = 0
object Button1: TButton
- Left = 6
+ Left = 40
Height = 25
Top = 8
Width = 115
@@ -90,19 +92,18 @@ object Form1: TForm1
TabOrder = 3
end
object Edit1: TEdit
- Left = 368
- Height = 21
- Top = 32
- Width = 161
+ Left = 500
+ Height = 20
+ Top = 8
+ Width = 150
TabOrder = 4
- Text = 'Edit1'
end
end
object Memo2: TMemo
Left = 0
Height = 145
Top = 0
- Width = 528
+ Width = 800
Align = alTop
Lines.Strings = (
'Memo2'
diff --git a/PythonForDelphi/Demos/FPC/Demo06/Unit1.pas b/PythonForDelphi/Demos/FPC/Demo06/Unit1.pas
index 76f79034..a41cc1d9 100644
--- a/PythonForDelphi/Demos/FPC/Demo06/Unit1.pas
+++ b/PythonForDelphi/Demos/FPC/Demo06/Unit1.pas
@@ -6,17 +6,16 @@ interface
uses
SysUtils, Classes,
-{$IFDEF MSWINDOWS}
Windows, Messages, Graphics, Controls, Forms, Dialogs,
StdCtrls, ComCtrls, ExtCtrls,
-{$ENDIF}
-{$IFDEF LINUX}
- QForms, QDialogs, QStdCtrls, QControls, QExtCtrls,
-{$ENDIF}
PythonEngine, PythonGUIInputOutput;
type
+
+ { TForm1 }
+
TForm1 = class(TForm)
+ Edit1: TEdit;
PythonEngine1: TPythonEngine;
Memo1: TMemo;
PythonType1: TPythonType;
@@ -30,7 +29,6 @@ TForm1 = class(TForm)
SaveDialog1: TSaveDialog;
PythonDelphiVar1: TPythonDelphiVar;
Button4: TButton;
- Edit1: TEdit;
PythonGUIInputOutput1: TPythonGUIInputOutput;
Memo2: TMemo;
procedure Button1Click(Sender: TObject);
@@ -43,9 +41,9 @@ TForm1 = class(TForm)
procedure PythonDelphiVar1GetData(Sender: TObject; var Data: Variant);
procedure PythonDelphiVar1SetData(Sender: TObject; Data: Variant);
private
- { Déclarations privées }
+ { D�clarations priv�es }
public
- { Déclarations publiques }
+ { D�clarations publiques }
end;
PyPointRec = record
@@ -170,9 +168,7 @@ function PyPoint_getattr(obj : PPyObject; key : PAnsiChar) : PPyObject; cdecl;
else
begin
// Else check for a method
- Result := Py_FindMethod( MethodsByName('PythonType1'), obj, key);
- // or we could write, because it's quicker:
- // Result := Py_FindMethod( Form1.PythonType1.MethodsData, obj, key);
+ Result := PyObject_GenericGetAttr(obj, PyString_FromString(key));
if not Assigned(Result) then
PyErr_SetString (PyExc_AttributeError^, PAnsiChar(Format('Unknown attribute "%s"',[key])));
end;
diff --git a/PythonForDelphi/Demos/FPC/Demo25/fpc-res.or b/PythonForDelphi/Demos/FPC/Demo25/fpc-res.or
deleted file mode 100644
index 3676804f..00000000
Binary files a/PythonForDelphi/Demos/FPC/Demo25/fpc-res.or and /dev/null differ
diff --git a/PythonForDelphi/Demos/readme.txt b/PythonForDelphi/Demos/readme.txt
new file mode 100644
index 00000000..f48d1b21
--- /dev/null
+++ b/PythonForDelphi/Demos/readme.txt
@@ -0,0 +1,35 @@
+Demo01 A simple Python evaluator
+Demo02 Evaluate a Python expression
+Demo03 Defining Python/Delphi vars
+Demo04 Defining Python/Delphi vars (advanced case)
+Demo05 Defining a new Module
+Demo06 Defining a new Type
+Demo07 Using Delphi methods as Python functions
+Demo08 Using Delphi classes for new Python types
+Demo09 Making a Python module as a Dll
+Demo10 Mapping Delphi VCL components inside Python using TPythonDatabase (BDE - not changed)
+Demo10_FireDAC Database demo using FireDAC
+Demo11 Using Threads inside Python
+Demo12 Using PythonAtom. -> Deprecated since Delphi 6, See VarPyth instead
+Demo13 Using TPythonDatabase. (BDE - not changed)
+Demo14 Making a Dll with TPythonDatabase (BDE - not changed)
+Demo15 Using a TDataset descendant with Python, except TTable and TQuery. (BDE - not changed)
+Demo16 Using a TDelphiVar or Module methods ? (Kylix ready)
+Demo17 Using variant arrays of 2 dimensions (Kylix ready)
+Demo18 C++ Builder: using the Python Dll in a console application
+Demo19 C++ Builder: this is a replicate of the Delphi Demo05
+Demo20 C++ Builder: this is a replicate of the Delphi Demo08
+Demo21 Using Events in TPythonModule or TPythonType (Kylix ready)
+Demo22 Using Threading, Windows Console and Command line arguments (Kylix ready)
+Demo23 Using Threading and Delphi log window. (Kylix ready)
+Demo24 Using TAtomPythonEngine (Deprecated since Delphi 6, See VarPyth instead)
+Demo25 Using VarPyth.pas (Kylix ready)
+Demo26 Demo8 revisited to allow the new Python type to be subclassed
+Demo27 Container indexing
+Demo28 Iterator (Kylix ready)
+Demo29 Using Python Imaging Library (PIL)
+Demo30 Using Named Parameters (Kylix ready)
+Demo31 Using WrapDelphi to access Delphi Form attributes (Requires Delphi5 or later)
+Demo32 Demo08 revisited using WrapDelphi (Requires Delphi7 or later)
+Demo33 Using Threads inside Python
+Demo34 Dynamically creating, destroying and recreating PythonEngine. Uses PythonVersions
diff --git a/PythonForDelphi/Readme.txt b/PythonForDelphi/Readme.txt
index e7245f0d..ce22b912 100644
--- a/PythonForDelphi/Readme.txt
+++ b/PythonForDelphi/Readme.txt
@@ -62,6 +62,8 @@ INSTALLATION:
1) Install the core components
~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ For recent versions of Delphi, install the "Python_d" package located in the
+ Components folder and add the folder "...\Components\Sources\Core".
For Delphi 3, install the "Python_d3" package located in the Components folder
and add the folder "...\Components\Sources\Core".
@@ -81,6 +83,9 @@ INSTALLATION:
2) Install the VCL components (this is optional)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ For recent versions of Delphi, install the "PythonVCL_d" package located in the
+ Components folder and add the folder "...\Components\Sources\Core".
+
For Delphi 3, install the "PythonVCL_d3" package located in the Components folder
and add the folder "...\Components\Sources\VCL".
@@ -96,17 +101,8 @@ INSTALLATION:
For Delphi 7, install the "PythonVCL_d7" package located in the Components folder
and add the folder "...\Components\Sources\VCL".
- 3) Build PythonIDE (This is optional)
- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-
- You can download the latest build of this application from
- http://mmm-experts.com/Downloads.aspx?ProductId=4
-
- If you want to rebuild PythonIDE by yourself, you must look at PythonIDE\Readme.txt
- for the required component packages to install first.
-
- 3) Build Modules\Delphi\Delphi.dpr (This is optional)
+ 3) Build Modules\Delphi\Delphi.dpr (This is optional and unsupported)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Once the project is build you can either extend the Python path with ..\Modules or
@@ -120,14 +116,6 @@ NOTE:
Don't forget to look at the tutorial file (tutorial.txt) which introduces the
demos.
- Visit the site http://starship.python.net/crew/mhammond/ and get the last version
- of Pythonwin. It's a really good Python IDE, that you must have for serious
- Python programming and debugging !
-
-UPDATE:
-~~~~~~~
- You'll find the latest version at http://mmm-experts.com/
-
DISTRIBUTION:
~~~~~~~~~~~~~
You are free to distribute your applications built with Python for Delphi,
diff --git a/PythonForDelphi/To do.txt b/PythonForDelphi/To do.txt
deleted file mode 100644
index c21b55af..00000000
--- a/PythonForDelphi/To do.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-- nothing special !
-
diff --git a/PythonForDelphi/Tutorial.txt b/PythonForDelphi/Tutorial.txt
index 55a1239e..9e2285f7 100644
--- a/PythonForDelphi/Tutorial.txt
+++ b/PythonForDelphi/Tutorial.txt
@@ -832,6 +832,15 @@ Enhanced Demo 11 showing how to properly interrupt running
threads.
--------------------------------------------------------------
+--------------------------------------------------------------
+34) Dynamically creating, destroying and recreating PythonEngine
+--------------------------------------------------------------
+Demo 26 revisited to demonstrate the use of the new
+PythonVersions.pas unit. It also shows how to create
+destroy and recreate PythonEngine etc. using code without
+the Visual components.
+--------------------------------------------------------------
+
That's all folks !!!
Hope this helps to build cool Python/Delphi applications.
diff --git a/PythonVCL/Components/PythonVCL_d3.res b/PythonVCL/Components/PythonVCL_d3.res
deleted file mode 100644
index 36f26e23..00000000
Binary files a/PythonVCL/Components/PythonVCL_d3.res and /dev/null differ
diff --git a/README.md b/README.md
index c2cb10eb..1b61c1ce 100644
--- a/README.md
+++ b/README.md
@@ -6,3 +6,5 @@ Python for Delphi (P4D) is a set of free components that wrap up the Python dll
* **Wrapping of Delphi objects for use in python scripts using RTTI (WrapDelphi.pas)**
P4D makes it very easy to use python as a scripting language for Delphi applications. It comes with an extensive range of demos and tutorials.
+
+Delphinus-Support
diff --git a/Install/AfterInstallPyScripter.txt b/Unsupported/Install/AfterInstallPyScripter.txt
similarity index 100%
rename from Install/AfterInstallPyScripter.txt
rename to Unsupported/Install/AfterInstallPyScripter.txt
diff --git a/Install/Andy Bulka Tutorials.url b/Unsupported/Install/Andy Bulka Tutorials.url
similarity index 100%
rename from Install/Andy Bulka Tutorials.url
rename to Unsupported/Install/Andy Bulka Tutorials.url
diff --git a/Install/BeforeInstallPyScripter.txt b/Unsupported/Install/BeforeInstallPyScripter.txt
similarity index 100%
rename from Install/BeforeInstallPyScripter.txt
rename to Unsupported/Install/BeforeInstallPyScripter.txt
diff --git a/Install/Copy of PythonForDelphi.wse b/Unsupported/Install/Copy of PythonForDelphi.wse
similarity index 100%
rename from Install/Copy of PythonForDelphi.wse
rename to Unsupported/Install/Copy of PythonForDelphi.wse
diff --git a/Install/Dll/P4D.dof b/Unsupported/Install/Dll/P4D.dof
similarity index 100%
rename from Install/Dll/P4D.dof
rename to Unsupported/Install/Dll/P4D.dof
diff --git a/Install/Dll/P4D.dpr b/Unsupported/Install/Dll/P4D.dpr
similarity index 100%
rename from Install/Dll/P4D.dpr
rename to Unsupported/Install/Dll/P4D.dpr
diff --git a/Install/Dll/P4D.res b/Unsupported/Install/Dll/P4D.res
similarity index 100%
rename from Install/Dll/P4D.res
rename to Unsupported/Install/Dll/P4D.res
diff --git a/Install/Dll/PythonTitle.bmp b/Unsupported/Install/Dll/PythonTitle.bmp
similarity index 100%
rename from Install/Dll/PythonTitle.bmp
rename to Unsupported/Install/Dll/PythonTitle.bmp
diff --git a/Install/Dll/Test/Project1.dof b/Unsupported/Install/Dll/Test/Project1.dof
similarity index 100%
rename from Install/Dll/Test/Project1.dof
rename to Unsupported/Install/Dll/Test/Project1.dof
diff --git a/Install/Dll/Test/Project1.dpr b/Unsupported/Install/Dll/Test/Project1.dpr
similarity index 100%
rename from Install/Dll/Test/Project1.dpr
rename to Unsupported/Install/Dll/Test/Project1.dpr
diff --git a/Install/Dll/Test/Project1.res b/Unsupported/Install/Dll/Test/Project1.res
similarity index 100%
rename from Install/Dll/Test/Project1.res
rename to Unsupported/Install/Dll/Test/Project1.res
diff --git a/Install/Dll/Test/Unit1.dfm b/Unsupported/Install/Dll/Test/Unit1.dfm
similarity index 100%
rename from Install/Dll/Test/Unit1.dfm
rename to Unsupported/Install/Dll/Test/Unit1.dfm
diff --git a/Install/Dll/Test/Unit1.pas b/Unsupported/Install/Dll/Test/Unit1.pas
similarity index 100%
rename from Install/Dll/Test/Unit1.pas
rename to Unsupported/Install/Dll/Test/Unit1.pas
diff --git a/Install/Dll/fmDelphiInstall.dfm b/Unsupported/Install/Dll/fmDelphiInstall.dfm
similarity index 100%
rename from Install/Dll/fmDelphiInstall.dfm
rename to Unsupported/Install/Dll/fmDelphiInstall.dfm
diff --git a/Install/Dll/fmDelphiInstall.pas b/Unsupported/Install/Dll/fmDelphiInstall.pas
similarity index 100%
rename from Install/Dll/fmDelphiInstall.pas
rename to Unsupported/Install/Dll/fmDelphiInstall.pas
diff --git a/Install/Dll/python.bmp b/Unsupported/Install/Dll/python.bmp
similarity index 100%
rename from Install/Dll/python.bmp
rename to Unsupported/Install/Dll/python.bmp
diff --git a/Install/Home Site.URL b/Unsupported/Install/Home Site.URL
similarity index 100%
rename from Install/Home Site.URL
rename to Unsupported/Install/Home Site.URL
diff --git a/Install/Mark Hammond Pythonwin.URL b/Unsupported/Install/Mark Hammond Pythonwin.URL
similarity index 100%
rename from Install/Mark Hammond Pythonwin.URL
rename to Unsupported/Install/Mark Hammond Pythonwin.URL
diff --git a/Install/PyScripter.iss b/Unsupported/Install/PyScripter.iss
similarity index 100%
rename from Install/PyScripter.iss
rename to Unsupported/Install/PyScripter.iss
diff --git a/Install/PyScripterForPython23.gi2 b/Unsupported/Install/PyScripterForPython23.gi2
similarity index 100%
rename from Install/PyScripterForPython23.gi2
rename to Unsupported/Install/PyScripterForPython23.gi2
diff --git a/Install/PyScripterForPython24.gi2 b/Unsupported/Install/PyScripterForPython24.gi2
similarity index 100%
rename from Install/PyScripterForPython24.gi2
rename to Unsupported/Install/PyScripterForPython24.gi2
diff --git a/Install/Python official site.URL b/Unsupported/Install/Python official site.URL
similarity index 100%
rename from Install/Python official site.URL
rename to Unsupported/Install/Python official site.URL
diff --git a/Install/PythonForDelphi.wse b/Unsupported/Install/PythonForDelphi.wse
similarity index 100%
rename from Install/PythonForDelphi.wse
rename to Unsupported/Install/PythonForDelphi.wse
diff --git a/Install/PythonTitle.bmp b/Unsupported/Install/PythonTitle.bmp
similarity index 100%
rename from Install/PythonTitle.bmp
rename to Unsupported/Install/PythonTitle.bmp
diff --git a/Unsupported/Install/README.md b/Unsupported/Install/README.md
new file mode 100644
index 00000000..144b296f
--- /dev/null
+++ b/Unsupported/Install/README.md
@@ -0,0 +1 @@
+** THIS FOLDER IS FOR THE P4D INSTALLER WHICH IS CURRENTLY NOT SUPPORTED **
diff --git a/Install/ReadMe.txt b/Unsupported/Install/ReadMe.txt
similarity index 100%
rename from Install/ReadMe.txt
rename to Unsupported/Install/ReadMe.txt
diff --git a/Install/Yahoo! Groups pythonfordelphi.url b/Unsupported/Install/Yahoo! Groups pythonfordelphi.url
similarity index 100%
rename from Install/Yahoo! Groups pythonfordelphi.url
rename to Unsupported/Install/Yahoo! Groups pythonfordelphi.url
diff --git a/Install/python.bmp b/Unsupported/Install/python.bmp
similarity index 100%
rename from Install/python.bmp
rename to Unsupported/Install/python.bmp
diff --git a/PythonVCL/Components/PythonVCL_d3.dpk b/Unsupported/PythonVCL/Components/PythonVCL_d3.dpk
similarity index 100%
rename from PythonVCL/Components/PythonVCL_d3.dpk
rename to Unsupported/PythonVCL/Components/PythonVCL_d3.dpk
diff --git a/PythonForDelphi/Components/PythonVCL_d3.res b/Unsupported/PythonVCL/Components/PythonVCL_d3.res
similarity index 100%
rename from PythonForDelphi/Components/PythonVCL_d3.res
rename to Unsupported/PythonVCL/Components/PythonVCL_d3.res
diff --git a/PythonVCL/Components/Sources/VCL/D3/Delphi_Classes.pas b/Unsupported/PythonVCL/Components/Sources/VCL/D3/Delphi_Classes.pas
similarity index 100%
rename from PythonVCL/Components/Sources/VCL/D3/Delphi_Classes.pas
rename to Unsupported/PythonVCL/Components/Sources/VCL/D3/Delphi_Classes.pas
diff --git a/PythonVCL/Components/Sources/VCL/D3/Delphi_Controls.pas b/Unsupported/PythonVCL/Components/Sources/VCL/D3/Delphi_Controls.pas
similarity index 100%
rename from PythonVCL/Components/Sources/VCL/D3/Delphi_Controls.pas
rename to Unsupported/PythonVCL/Components/Sources/VCL/D3/Delphi_Controls.pas
diff --git a/PythonVCL/Components/Sources/VCL/D3/Delphi_Dialogs.pas b/Unsupported/PythonVCL/Components/Sources/VCL/D3/Delphi_Dialogs.pas
similarity index 100%
rename from PythonVCL/Components/Sources/VCL/D3/Delphi_Dialogs.pas
rename to Unsupported/PythonVCL/Components/Sources/VCL/D3/Delphi_Dialogs.pas
diff --git a/PythonVCL/Components/Sources/VCL/D3/Delphi_ExtCtrls.pas b/Unsupported/PythonVCL/Components/Sources/VCL/D3/Delphi_ExtCtrls.pas
similarity index 100%
rename from PythonVCL/Components/Sources/VCL/D3/Delphi_ExtCtrls.pas
rename to Unsupported/PythonVCL/Components/Sources/VCL/D3/Delphi_ExtCtrls.pas
diff --git a/PythonVCL/Components/Sources/VCL/D3/Delphi_Forms.pas b/Unsupported/PythonVCL/Components/Sources/VCL/D3/Delphi_Forms.pas
similarity index 100%
rename from PythonVCL/Components/Sources/VCL/D3/Delphi_Forms.pas
rename to Unsupported/PythonVCL/Components/Sources/VCL/D3/Delphi_Forms.pas
diff --git a/PythonVCL/Components/Sources/VCL/D3/Delphi_Graphics.pas b/Unsupported/PythonVCL/Components/Sources/VCL/D3/Delphi_Graphics.pas
similarity index 100%
rename from PythonVCL/Components/Sources/VCL/D3/Delphi_Graphics.pas
rename to Unsupported/PythonVCL/Components/Sources/VCL/D3/Delphi_Graphics.pas
diff --git a/PythonVCL/Components/Sources/VCL/D3/Delphi_Menus.pas b/Unsupported/PythonVCL/Components/Sources/VCL/D3/Delphi_Menus.pas
similarity index 100%
rename from PythonVCL/Components/Sources/VCL/D3/Delphi_Menus.pas
rename to Unsupported/PythonVCL/Components/Sources/VCL/D3/Delphi_Menus.pas
diff --git a/PythonVCL/Components/Sources/VCL/D3/Delphi_StdCtrls.pas b/Unsupported/PythonVCL/Components/Sources/VCL/D3/Delphi_StdCtrls.pas
similarity index 100%
rename from PythonVCL/Components/Sources/VCL/D3/Delphi_StdCtrls.pas
rename to Unsupported/PythonVCL/Components/Sources/VCL/D3/Delphi_StdCtrls.pas
diff --git a/PythonVCL/Components/Sources/VCL/D3/Delphi_System.pas b/Unsupported/PythonVCL/Components/Sources/VCL/D3/Delphi_System.pas
similarity index 100%
rename from PythonVCL/Components/Sources/VCL/D3/Delphi_System.pas
rename to Unsupported/PythonVCL/Components/Sources/VCL/D3/Delphi_System.pas
diff --git a/PythonVCL/Components/Sources/VCL/D3/PyDelphiAssoc.pas b/Unsupported/PythonVCL/Components/Sources/VCL/D3/PyDelphiAssoc.pas
similarity index 100%
rename from PythonVCL/Components/Sources/VCL/D3/PyDelphiAssoc.pas
rename to Unsupported/PythonVCL/Components/Sources/VCL/D3/PyDelphiAssoc.pas
diff --git a/PythonVCL/Components/Sources/VCL/D3/PyRecords.pas b/Unsupported/PythonVCL/Components/Sources/VCL/D3/PyRecords.pas
similarity index 100%
rename from PythonVCL/Components/Sources/VCL/D3/PyRecords.pas
rename to Unsupported/PythonVCL/Components/Sources/VCL/D3/PyRecords.pas
diff --git a/PythonVCL/Components/Sources/VCL/D3/PyVarArg.pas b/Unsupported/PythonVCL/Components/Sources/VCL/D3/PyVarArg.pas
similarity index 100%
rename from PythonVCL/Components/Sources/VCL/D3/PyVarArg.pas
rename to Unsupported/PythonVCL/Components/Sources/VCL/D3/PyVarArg.pas
diff --git a/PythonVCL/Components/Sources/VCL/D3/Py_Misc.pas b/Unsupported/PythonVCL/Components/Sources/VCL/D3/Py_Misc.pas
similarity index 100%
rename from PythonVCL/Components/Sources/VCL/D3/Py_Misc.pas
rename to Unsupported/PythonVCL/Components/Sources/VCL/D3/Py_Misc.pas
diff --git a/PythonVCL/Components/Sources/VCL/D3/PythonVclStd.dcr b/Unsupported/PythonVCL/Components/Sources/VCL/D3/PythonVclStd.dcr
similarity index 100%
rename from PythonVCL/Components/Sources/VCL/D3/PythonVclStd.dcr
rename to Unsupported/PythonVCL/Components/Sources/VCL/D3/PythonVclStd.dcr
diff --git a/PythonVCL/Components/Sources/VCL/D3/PythonVclStd.pas b/Unsupported/PythonVCL/Components/Sources/VCL/D3/PythonVclStd.pas
similarity index 100%
rename from PythonVCL/Components/Sources/VCL/D3/PythonVclStd.pas
rename to Unsupported/PythonVCL/Components/Sources/VCL/D3/PythonVclStd.pas
diff --git a/PythonVCL/Components/Sources/VCL/D3/Python_Classes.pas b/Unsupported/PythonVCL/Components/Sources/VCL/D3/Python_Classes.pas
similarity index 100%
rename from PythonVCL/Components/Sources/VCL/D3/Python_Classes.pas
rename to Unsupported/PythonVCL/Components/Sources/VCL/D3/Python_Classes.pas
diff --git a/PythonVCL/Components/Sources/VCL/D3/Python_Controls.pas b/Unsupported/PythonVCL/Components/Sources/VCL/D3/Python_Controls.pas
similarity index 100%
rename from PythonVCL/Components/Sources/VCL/D3/Python_Controls.pas
rename to Unsupported/PythonVCL/Components/Sources/VCL/D3/Python_Controls.pas
diff --git a/PythonVCL/Components/Sources/VCL/D3/Python_Dialogs.pas b/Unsupported/PythonVCL/Components/Sources/VCL/D3/Python_Dialogs.pas
similarity index 100%
rename from PythonVCL/Components/Sources/VCL/D3/Python_Dialogs.pas
rename to Unsupported/PythonVCL/Components/Sources/VCL/D3/Python_Dialogs.pas
diff --git a/PythonVCL/Components/Sources/VCL/D3/Python_ExtCtrls.pas b/Unsupported/PythonVCL/Components/Sources/VCL/D3/Python_ExtCtrls.pas
similarity index 100%
rename from PythonVCL/Components/Sources/VCL/D3/Python_ExtCtrls.pas
rename to Unsupported/PythonVCL/Components/Sources/VCL/D3/Python_ExtCtrls.pas
diff --git a/PythonVCL/Components/Sources/VCL/D3/Python_Forms.pas b/Unsupported/PythonVCL/Components/Sources/VCL/D3/Python_Forms.pas
similarity index 100%
rename from PythonVCL/Components/Sources/VCL/D3/Python_Forms.pas
rename to Unsupported/PythonVCL/Components/Sources/VCL/D3/Python_Forms.pas
diff --git a/PythonVCL/Components/Sources/VCL/D3/Python_Graphics.pas b/Unsupported/PythonVCL/Components/Sources/VCL/D3/Python_Graphics.pas
similarity index 100%
rename from PythonVCL/Components/Sources/VCL/D3/Python_Graphics.pas
rename to Unsupported/PythonVCL/Components/Sources/VCL/D3/Python_Graphics.pas
diff --git a/PythonVCL/Components/Sources/VCL/D3/Python_Menus.pas b/Unsupported/PythonVCL/Components/Sources/VCL/D3/Python_Menus.pas
similarity index 100%
rename from PythonVCL/Components/Sources/VCL/D3/Python_Menus.pas
rename to Unsupported/PythonVCL/Components/Sources/VCL/D3/Python_Menus.pas
diff --git a/PythonVCL/Components/Sources/VCL/D3/Python_StdCtrls.pas b/Unsupported/PythonVCL/Components/Sources/VCL/D3/Python_StdCtrls.pas
similarity index 100%
rename from PythonVCL/Components/Sources/VCL/D3/Python_StdCtrls.pas
rename to Unsupported/PythonVCL/Components/Sources/VCL/D3/Python_StdCtrls.pas
diff --git a/PythonVCL/Components/Sources/VCL/D3/Python_System.pas b/Unsupported/PythonVCL/Components/Sources/VCL/D3/Python_System.pas
similarity index 100%
rename from PythonVCL/Components/Sources/VCL/D3/Python_System.pas
rename to Unsupported/PythonVCL/Components/Sources/VCL/D3/Python_System.pas
diff --git a/PythonVCL/Components/Sources/VCL/D4/Delphi_ActnList.pas b/Unsupported/PythonVCL/Components/Sources/VCL/D4/Delphi_ActnList.pas
similarity index 100%
rename from PythonVCL/Components/Sources/VCL/D4/Delphi_ActnList.pas
rename to Unsupported/PythonVCL/Components/Sources/VCL/D4/Delphi_ActnList.pas
diff --git a/PythonVCL/Components/Sources/VCL/D4/Delphi_Classes.pas b/Unsupported/PythonVCL/Components/Sources/VCL/D4/Delphi_Classes.pas
similarity index 100%
rename from PythonVCL/Components/Sources/VCL/D4/Delphi_Classes.pas
rename to Unsupported/PythonVCL/Components/Sources/VCL/D4/Delphi_Classes.pas
diff --git a/PythonVCL/Components/Sources/VCL/D4/Delphi_Controls.pas b/Unsupported/PythonVCL/Components/Sources/VCL/D4/Delphi_Controls.pas
similarity index 100%
rename from PythonVCL/Components/Sources/VCL/D4/Delphi_Controls.pas
rename to Unsupported/PythonVCL/Components/Sources/VCL/D4/Delphi_Controls.pas
diff --git a/PythonVCL/Components/Sources/VCL/D4/Delphi_Dialogs.pas b/Unsupported/PythonVCL/Components/Sources/VCL/D4/Delphi_Dialogs.pas
similarity index 100%
rename from PythonVCL/Components/Sources/VCL/D4/Delphi_Dialogs.pas
rename to Unsupported/PythonVCL/Components/Sources/VCL/D4/Delphi_Dialogs.pas
diff --git a/PythonVCL/Components/Sources/VCL/D4/Delphi_ExtCtrls.pas b/Unsupported/PythonVCL/Components/Sources/VCL/D4/Delphi_ExtCtrls.pas
similarity index 100%
rename from PythonVCL/Components/Sources/VCL/D4/Delphi_ExtCtrls.pas
rename to Unsupported/PythonVCL/Components/Sources/VCL/D4/Delphi_ExtCtrls.pas
diff --git a/PythonVCL/Components/Sources/VCL/D4/Delphi_Forms.pas b/Unsupported/PythonVCL/Components/Sources/VCL/D4/Delphi_Forms.pas
similarity index 100%
rename from PythonVCL/Components/Sources/VCL/D4/Delphi_Forms.pas
rename to Unsupported/PythonVCL/Components/Sources/VCL/D4/Delphi_Forms.pas
diff --git a/PythonVCL/Components/Sources/VCL/D4/Delphi_Graphics.pas b/Unsupported/PythonVCL/Components/Sources/VCL/D4/Delphi_Graphics.pas
similarity index 100%
rename from PythonVCL/Components/Sources/VCL/D4/Delphi_Graphics.pas
rename to Unsupported/PythonVCL/Components/Sources/VCL/D4/Delphi_Graphics.pas
diff --git a/PythonVCL/Components/Sources/VCL/D4/Delphi_ImgList.pas b/Unsupported/PythonVCL/Components/Sources/VCL/D4/Delphi_ImgList.pas
similarity index 100%
rename from PythonVCL/Components/Sources/VCL/D4/Delphi_ImgList.pas
rename to Unsupported/PythonVCL/Components/Sources/VCL/D4/Delphi_ImgList.pas
diff --git a/PythonVCL/Components/Sources/VCL/D4/Delphi_Menus.pas b/Unsupported/PythonVCL/Components/Sources/VCL/D4/Delphi_Menus.pas
similarity index 100%
rename from PythonVCL/Components/Sources/VCL/D4/Delphi_Menus.pas
rename to Unsupported/PythonVCL/Components/Sources/VCL/D4/Delphi_Menus.pas
diff --git a/PythonVCL/Components/Sources/VCL/D4/Delphi_StdCtrls.pas b/Unsupported/PythonVCL/Components/Sources/VCL/D4/Delphi_StdCtrls.pas
similarity index 100%
rename from PythonVCL/Components/Sources/VCL/D4/Delphi_StdCtrls.pas
rename to Unsupported/PythonVCL/Components/Sources/VCL/D4/Delphi_StdCtrls.pas
diff --git a/PythonVCL/Components/Sources/VCL/D4/Delphi_System.pas b/Unsupported/PythonVCL/Components/Sources/VCL/D4/Delphi_System.pas
similarity index 100%
rename from PythonVCL/Components/Sources/VCL/D4/Delphi_System.pas
rename to Unsupported/PythonVCL/Components/Sources/VCL/D4/Delphi_System.pas
diff --git a/PythonVCL/Components/Sources/VCL/D4/PyDelphiAssoc.pas b/Unsupported/PythonVCL/Components/Sources/VCL/D4/PyDelphiAssoc.pas
similarity index 100%
rename from PythonVCL/Components/Sources/VCL/D4/PyDelphiAssoc.pas
rename to Unsupported/PythonVCL/Components/Sources/VCL/D4/PyDelphiAssoc.pas
diff --git a/PythonVCL/Components/Sources/VCL/D4/PyRecords.pas b/Unsupported/PythonVCL/Components/Sources/VCL/D4/PyRecords.pas
similarity index 100%
rename from PythonVCL/Components/Sources/VCL/D4/PyRecords.pas
rename to Unsupported/PythonVCL/Components/Sources/VCL/D4/PyRecords.pas
diff --git a/PythonVCL/Components/Sources/VCL/D4/PyVarArg.pas b/Unsupported/PythonVCL/Components/Sources/VCL/D4/PyVarArg.pas
similarity index 100%
rename from PythonVCL/Components/Sources/VCL/D4/PyVarArg.pas
rename to Unsupported/PythonVCL/Components/Sources/VCL/D4/PyVarArg.pas
diff --git a/PythonVCL/Components/Sources/VCL/D4/Py_Misc.pas b/Unsupported/PythonVCL/Components/Sources/VCL/D4/Py_Misc.pas
similarity index 100%
rename from PythonVCL/Components/Sources/VCL/D4/Py_Misc.pas
rename to Unsupported/PythonVCL/Components/Sources/VCL/D4/Py_Misc.pas
diff --git a/PythonVCL/Components/Sources/VCL/D4/PythonVclStd.pas b/Unsupported/PythonVCL/Components/Sources/VCL/D4/PythonVclStd.pas
similarity index 100%
rename from PythonVCL/Components/Sources/VCL/D4/PythonVclStd.pas
rename to Unsupported/PythonVCL/Components/Sources/VCL/D4/PythonVclStd.pas
diff --git a/PythonVCL/Components/Sources/VCL/D4/Python_ActnList.pas b/Unsupported/PythonVCL/Components/Sources/VCL/D4/Python_ActnList.pas
similarity index 100%
rename from PythonVCL/Components/Sources/VCL/D4/Python_ActnList.pas
rename to Unsupported/PythonVCL/Components/Sources/VCL/D4/Python_ActnList.pas
diff --git a/PythonVCL/Components/Sources/VCL/D4/Python_Classes.pas b/Unsupported/PythonVCL/Components/Sources/VCL/D4/Python_Classes.pas
similarity index 100%
rename from PythonVCL/Components/Sources/VCL/D4/Python_Classes.pas
rename to Unsupported/PythonVCL/Components/Sources/VCL/D4/Python_Classes.pas
diff --git a/PythonVCL/Components/Sources/VCL/D4/Python_Controls.pas b/Unsupported/PythonVCL/Components/Sources/VCL/D4/Python_Controls.pas
similarity index 100%
rename from PythonVCL/Components/Sources/VCL/D4/Python_Controls.pas
rename to Unsupported/PythonVCL/Components/Sources/VCL/D4/Python_Controls.pas
diff --git a/PythonVCL/Components/Sources/VCL/D4/Python_Dialogs.pas b/Unsupported/PythonVCL/Components/Sources/VCL/D4/Python_Dialogs.pas
similarity index 100%
rename from PythonVCL/Components/Sources/VCL/D4/Python_Dialogs.pas
rename to Unsupported/PythonVCL/Components/Sources/VCL/D4/Python_Dialogs.pas
diff --git a/PythonVCL/Components/Sources/VCL/D4/Python_ExtCtrls.pas b/Unsupported/PythonVCL/Components/Sources/VCL/D4/Python_ExtCtrls.pas
similarity index 100%
rename from PythonVCL/Components/Sources/VCL/D4/Python_ExtCtrls.pas
rename to Unsupported/PythonVCL/Components/Sources/VCL/D4/Python_ExtCtrls.pas
diff --git a/PythonVCL/Components/Sources/VCL/D4/Python_Forms.pas b/Unsupported/PythonVCL/Components/Sources/VCL/D4/Python_Forms.pas
similarity index 100%
rename from PythonVCL/Components/Sources/VCL/D4/Python_Forms.pas
rename to Unsupported/PythonVCL/Components/Sources/VCL/D4/Python_Forms.pas
diff --git a/PythonVCL/Components/Sources/VCL/D4/Python_Graphics.pas b/Unsupported/PythonVCL/Components/Sources/VCL/D4/Python_Graphics.pas
similarity index 100%
rename from PythonVCL/Components/Sources/VCL/D4/Python_Graphics.pas
rename to Unsupported/PythonVCL/Components/Sources/VCL/D4/Python_Graphics.pas
diff --git a/PythonVCL/Components/Sources/VCL/D4/Python_ImgList.pas b/Unsupported/PythonVCL/Components/Sources/VCL/D4/Python_ImgList.pas
similarity index 100%
rename from PythonVCL/Components/Sources/VCL/D4/Python_ImgList.pas
rename to Unsupported/PythonVCL/Components/Sources/VCL/D4/Python_ImgList.pas
diff --git a/PythonVCL/Components/Sources/VCL/D4/Python_Menus.pas b/Unsupported/PythonVCL/Components/Sources/VCL/D4/Python_Menus.pas
similarity index 100%
rename from PythonVCL/Components/Sources/VCL/D4/Python_Menus.pas
rename to Unsupported/PythonVCL/Components/Sources/VCL/D4/Python_Menus.pas
diff --git a/PythonVCL/Components/Sources/VCL/D4/Python_StdCtrls.pas b/Unsupported/PythonVCL/Components/Sources/VCL/D4/Python_StdCtrls.pas
similarity index 100%
rename from PythonVCL/Components/Sources/VCL/D4/Python_StdCtrls.pas
rename to Unsupported/PythonVCL/Components/Sources/VCL/D4/Python_StdCtrls.pas
diff --git a/PythonVCL/Components/Sources/VCL/D4/Python_System.pas b/Unsupported/PythonVCL/Components/Sources/VCL/D4/Python_System.pas
similarity index 100%
rename from PythonVCL/Components/Sources/VCL/D4/Python_System.pas
rename to Unsupported/PythonVCL/Components/Sources/VCL/D4/Python_System.pas
diff --git a/PythonVCL/Lib/delphi/D3/Classes.py b/Unsupported/PythonVCL/Lib/delphi/D3/Classes.py
similarity index 100%
rename from PythonVCL/Lib/delphi/D3/Classes.py
rename to Unsupported/PythonVCL/Lib/delphi/D3/Classes.py
diff --git a/PythonVCL/Lib/delphi/D3/Controls.py b/Unsupported/PythonVCL/Lib/delphi/D3/Controls.py
similarity index 100%
rename from PythonVCL/Lib/delphi/D3/Controls.py
rename to Unsupported/PythonVCL/Lib/delphi/D3/Controls.py
diff --git a/PythonVCL/Lib/delphi/D3/ExtCtrls.py b/Unsupported/PythonVCL/Lib/delphi/D3/ExtCtrls.py
similarity index 100%
rename from PythonVCL/Lib/delphi/D3/ExtCtrls.py
rename to Unsupported/PythonVCL/Lib/delphi/D3/ExtCtrls.py
diff --git a/PythonVCL/Lib/delphi/D3/Forms.py b/Unsupported/PythonVCL/Lib/delphi/D3/Forms.py
similarity index 100%
rename from PythonVCL/Lib/delphi/D3/Forms.py
rename to Unsupported/PythonVCL/Lib/delphi/D3/Forms.py
diff --git a/PythonVCL/Lib/delphi/D3/Graphics.py b/Unsupported/PythonVCL/Lib/delphi/D3/Graphics.py
similarity index 100%
rename from PythonVCL/Lib/delphi/D3/Graphics.py
rename to Unsupported/PythonVCL/Lib/delphi/D3/Graphics.py
diff --git a/PythonVCL/Lib/delphi/D3/Menus.py b/Unsupported/PythonVCL/Lib/delphi/D3/Menus.py
similarity index 100%
rename from PythonVCL/Lib/delphi/D3/Menus.py
rename to Unsupported/PythonVCL/Lib/delphi/D3/Menus.py
diff --git a/PythonVCL/Lib/delphi/D3/StdCtrls.py b/Unsupported/PythonVCL/Lib/delphi/D3/StdCtrls.py
similarity index 100%
rename from PythonVCL/Lib/delphi/D3/StdCtrls.py
rename to Unsupported/PythonVCL/Lib/delphi/D3/StdCtrls.py
diff --git a/PythonVCL/Lib/delphi/D3/System.py b/Unsupported/PythonVCL/Lib/delphi/D3/System.py
similarity index 100%
rename from PythonVCL/Lib/delphi/D3/System.py
rename to Unsupported/PythonVCL/Lib/delphi/D3/System.py
diff --git a/PythonVCL/Lib/delphi/D4/ActnList.py b/Unsupported/PythonVCL/Lib/delphi/D4/ActnList.py
similarity index 100%
rename from PythonVCL/Lib/delphi/D4/ActnList.py
rename to Unsupported/PythonVCL/Lib/delphi/D4/ActnList.py
diff --git a/PythonVCL/Lib/delphi/D4/Classes.py b/Unsupported/PythonVCL/Lib/delphi/D4/Classes.py
similarity index 100%
rename from PythonVCL/Lib/delphi/D4/Classes.py
rename to Unsupported/PythonVCL/Lib/delphi/D4/Classes.py
diff --git a/PythonVCL/Lib/delphi/D4/Controls.py b/Unsupported/PythonVCL/Lib/delphi/D4/Controls.py
similarity index 100%
rename from PythonVCL/Lib/delphi/D4/Controls.py
rename to Unsupported/PythonVCL/Lib/delphi/D4/Controls.py
diff --git a/PythonVCL/Lib/delphi/D4/Dialogs.py b/Unsupported/PythonVCL/Lib/delphi/D4/Dialogs.py
similarity index 100%
rename from PythonVCL/Lib/delphi/D4/Dialogs.py
rename to Unsupported/PythonVCL/Lib/delphi/D4/Dialogs.py
diff --git a/PythonVCL/Lib/delphi/D4/ExtCtrls.py b/Unsupported/PythonVCL/Lib/delphi/D4/ExtCtrls.py
similarity index 100%
rename from PythonVCL/Lib/delphi/D4/ExtCtrls.py
rename to Unsupported/PythonVCL/Lib/delphi/D4/ExtCtrls.py
diff --git a/PythonVCL/Lib/delphi/D4/Forms.py b/Unsupported/PythonVCL/Lib/delphi/D4/Forms.py
similarity index 100%
rename from PythonVCL/Lib/delphi/D4/Forms.py
rename to Unsupported/PythonVCL/Lib/delphi/D4/Forms.py
diff --git a/PythonVCL/Lib/delphi/D4/Graphics.py b/Unsupported/PythonVCL/Lib/delphi/D4/Graphics.py
similarity index 100%
rename from PythonVCL/Lib/delphi/D4/Graphics.py
rename to Unsupported/PythonVCL/Lib/delphi/D4/Graphics.py
diff --git a/PythonVCL/Lib/delphi/D4/ImgList.py b/Unsupported/PythonVCL/Lib/delphi/D4/ImgList.py
similarity index 100%
rename from PythonVCL/Lib/delphi/D4/ImgList.py
rename to Unsupported/PythonVCL/Lib/delphi/D4/ImgList.py
diff --git a/PythonVCL/Lib/delphi/D4/Menus.py b/Unsupported/PythonVCL/Lib/delphi/D4/Menus.py
similarity index 100%
rename from PythonVCL/Lib/delphi/D4/Menus.py
rename to Unsupported/PythonVCL/Lib/delphi/D4/Menus.py
diff --git a/PythonVCL/Lib/delphi/D4/StdCtrls.py b/Unsupported/PythonVCL/Lib/delphi/D4/StdCtrls.py
similarity index 100%
rename from PythonVCL/Lib/delphi/D4/StdCtrls.py
rename to Unsupported/PythonVCL/Lib/delphi/D4/StdCtrls.py
diff --git a/PythonVCL/Lib/delphi/D4/System.py b/Unsupported/PythonVCL/Lib/delphi/D4/System.py
similarity index 100%
rename from PythonVCL/Lib/delphi/D4/System.py
rename to Unsupported/PythonVCL/Lib/delphi/D4/System.py
diff --git a/PythonVCL/PyDelphi/Childwin.dfm b/Unsupported/PythonVCL/PyDelphi/Childwin.dfm
similarity index 100%
rename from PythonVCL/PyDelphi/Childwin.dfm
rename to Unsupported/PythonVCL/PyDelphi/Childwin.dfm
diff --git a/PythonVCL/PyDelphi/Childwin.pas b/Unsupported/PythonVCL/PyDelphi/Childwin.pas
similarity index 100%
rename from PythonVCL/PyDelphi/Childwin.pas
rename to Unsupported/PythonVCL/PyDelphi/Childwin.pas
diff --git a/PythonVCL/PyDelphi/Components used/Mruflist.pas b/Unsupported/PythonVCL/PyDelphi/Components used/Mruflist.pas
similarity index 100%
rename from PythonVCL/PyDelphi/Components used/Mruflist.pas
rename to Unsupported/PythonVCL/PyDelphi/Components used/Mruflist.pas
diff --git a/PythonVCL/PyDelphi/Lisp.py b/Unsupported/PythonVCL/PyDelphi/Lisp.py
similarity index 100%
rename from PythonVCL/PyDelphi/Lisp.py
rename to Unsupported/PythonVCL/PyDelphi/Lisp.py
diff --git a/PythonVCL/PyDelphi/MAIN.dfm b/Unsupported/PythonVCL/PyDelphi/MAIN.dfm
similarity index 100%
rename from PythonVCL/PyDelphi/MAIN.dfm
rename to Unsupported/PythonVCL/PyDelphi/MAIN.dfm
diff --git a/PythonVCL/PyDelphi/Main.pas b/Unsupported/PythonVCL/PyDelphi/Main.pas
similarity index 100%
rename from PythonVCL/PyDelphi/Main.pas
rename to Unsupported/PythonVCL/PyDelphi/Main.pas
diff --git a/PythonVCL/PyDelphi/Misc.pas b/Unsupported/PythonVCL/PyDelphi/Misc.pas
similarity index 100%
rename from PythonVCL/PyDelphi/Misc.pas
rename to Unsupported/PythonVCL/PyDelphi/Misc.pas
diff --git a/PythonVCL/PyDelphi/NewMemoryManager.pas b/Unsupported/PythonVCL/PyDelphi/NewMemoryManager.pas
similarity index 100%
rename from PythonVCL/PyDelphi/NewMemoryManager.pas
rename to Unsupported/PythonVCL/PyDelphi/NewMemoryManager.pas
diff --git a/PythonVCL/PyDelphi/PyDelphi.dof b/Unsupported/PythonVCL/PyDelphi/PyDelphi.dof
similarity index 100%
rename from PythonVCL/PyDelphi/PyDelphi.dof
rename to Unsupported/PythonVCL/PyDelphi/PyDelphi.dof
diff --git a/PythonVCL/PyDelphi/PyDelphi.dpr b/Unsupported/PythonVCL/PyDelphi/PyDelphi.dpr
similarity index 100%
rename from PythonVCL/PyDelphi/PyDelphi.dpr
rename to Unsupported/PythonVCL/PyDelphi/PyDelphi.dpr
diff --git a/PythonVCL/PyDelphi/PyDelphi.ico b/Unsupported/PythonVCL/PyDelphi/PyDelphi.ico
similarity index 100%
rename from PythonVCL/PyDelphi/PyDelphi.ico
rename to Unsupported/PythonVCL/PyDelphi/PyDelphi.ico
diff --git a/PythonVCL/PyDelphi/PyDelphi.res b/Unsupported/PythonVCL/PyDelphi/PyDelphi.res
similarity index 100%
rename from PythonVCL/PyDelphi/PyDelphi.res
rename to Unsupported/PythonVCL/PyDelphi/PyDelphi.res
diff --git a/PythonVCL/PyDelphi/PyDelphiForm.dfm b/Unsupported/PythonVCL/PyDelphi/PyDelphiForm.dfm
similarity index 100%
rename from PythonVCL/PyDelphi/PyDelphiForm.dfm
rename to Unsupported/PythonVCL/PyDelphi/PyDelphiForm.dfm
diff --git a/PythonVCL/PyDelphi/SetPath.py b/Unsupported/PythonVCL/PyDelphi/SetPath.py
similarity index 100%
rename from PythonVCL/PyDelphi/SetPath.py
rename to Unsupported/PythonVCL/PyDelphi/SetPath.py
diff --git a/PythonVCL/PyDelphi/To do.txt b/Unsupported/PythonVCL/PyDelphi/To do.txt
similarity index 100%
rename from PythonVCL/PyDelphi/To do.txt
rename to Unsupported/PythonVCL/PyDelphi/To do.txt
diff --git a/PythonVCL/PyDelphi/fmAbout.dfm b/Unsupported/PythonVCL/PyDelphi/fmAbout.dfm
similarity index 100%
rename from PythonVCL/PyDelphi/fmAbout.dfm
rename to Unsupported/PythonVCL/PyDelphi/fmAbout.dfm
diff --git a/PythonVCL/PyDelphi/fmAbout.pas b/Unsupported/PythonVCL/PyDelphi/fmAbout.pas
similarity index 100%
rename from PythonVCL/PyDelphi/fmAbout.pas
rename to Unsupported/PythonVCL/PyDelphi/fmAbout.pas
diff --git a/PythonVCL/PyDelphi/fmFind.dfm b/Unsupported/PythonVCL/PyDelphi/fmFind.dfm
similarity index 100%
rename from PythonVCL/PyDelphi/fmFind.dfm
rename to Unsupported/PythonVCL/PyDelphi/fmFind.dfm
diff --git a/PythonVCL/PyDelphi/fmFind.pas b/Unsupported/PythonVCL/PyDelphi/fmFind.pas
similarity index 100%
rename from PythonVCL/PyDelphi/fmFind.pas
rename to Unsupported/PythonVCL/PyDelphi/fmFind.pas
diff --git a/PythonVCL/PyDelphi/fmOutput.dfm b/Unsupported/PythonVCL/PyDelphi/fmOutput.dfm
similarity index 100%
rename from PythonVCL/PyDelphi/fmOutput.dfm
rename to Unsupported/PythonVCL/PyDelphi/fmOutput.dfm
diff --git a/PythonVCL/PyDelphi/fmOutput.pas b/Unsupported/PythonVCL/PyDelphi/fmOutput.pas
similarity index 100%
rename from PythonVCL/PyDelphi/fmOutput.pas
rename to Unsupported/PythonVCL/PyDelphi/fmOutput.pas
diff --git a/PythonVCL/PyDelphi/fmReplace.dfm b/Unsupported/PythonVCL/PyDelphi/fmReplace.dfm
similarity index 100%
rename from PythonVCL/PyDelphi/fmReplace.dfm
rename to Unsupported/PythonVCL/PyDelphi/fmReplace.dfm
diff --git a/PythonVCL/PyDelphi/fmReplace.pas b/Unsupported/PythonVCL/PyDelphi/fmReplace.pas
similarity index 100%
rename from PythonVCL/PyDelphi/fmReplace.pas
rename to Unsupported/PythonVCL/PyDelphi/fmReplace.pas
diff --git a/PythonVCL/PyDelphi/fmTraceBack.dfm b/Unsupported/PythonVCL/PyDelphi/fmTraceBack.dfm
similarity index 100%
rename from PythonVCL/PyDelphi/fmTraceBack.dfm
rename to Unsupported/PythonVCL/PyDelphi/fmTraceBack.dfm
diff --git a/PythonVCL/PyDelphi/fmTraceBack.pas b/Unsupported/PythonVCL/PyDelphi/fmTraceBack.pas
similarity index 100%
rename from PythonVCL/PyDelphi/fmTraceBack.pas
rename to Unsupported/PythonVCL/PyDelphi/fmTraceBack.pas
diff --git a/PythonVCL/PyDelphi/qrPrintText.dfm b/Unsupported/PythonVCL/PyDelphi/qrPrintText.dfm
similarity index 100%
rename from PythonVCL/PyDelphi/qrPrintText.dfm
rename to Unsupported/PythonVCL/PyDelphi/qrPrintText.dfm
diff --git a/PythonVCL/PyDelphi/qrPrintText.pas b/Unsupported/PythonVCL/PyDelphi/qrPrintText.pas
similarity index 100%
rename from PythonVCL/PyDelphi/qrPrintText.pas
rename to Unsupported/PythonVCL/PyDelphi/qrPrintText.pas
diff --git a/PythonVCL/PyDelphi/test.py b/Unsupported/PythonVCL/PyDelphi/test.py
similarity index 100%
rename from PythonVCL/PyDelphi/test.py
rename to Unsupported/PythonVCL/PyDelphi/test.py
diff --git a/PythonVCL/PyDelphi/test2.py b/Unsupported/PythonVCL/PyDelphi/test2.py
similarity index 100%
rename from PythonVCL/PyDelphi/test2.py
rename to Unsupported/PythonVCL/PyDelphi/test2.py
diff --git a/Unsupported/PythonVCL/README.md b/Unsupported/PythonVCL/README.md
new file mode 100644
index 00000000..d590c226
--- /dev/null
+++ b/Unsupported/PythonVCL/README.md
@@ -0,0 +1 @@
+** THIS FOLDER CONTAINS DATED STUFF WHICH IS NO LONGER SUPPORTED **
diff --git a/PythonVCL/Readme.txt b/Unsupported/PythonVCL/Readme.txt
similarity index 100%
rename from PythonVCL/Readme.txt
rename to Unsupported/PythonVCL/Readme.txt
diff --git a/PythonVCL/VCL Generator/ReadMe.txt b/Unsupported/PythonVCL/VCL Generator/ReadMe.txt
similarity index 100%
rename from PythonVCL/VCL Generator/ReadMe.txt
rename to Unsupported/PythonVCL/VCL Generator/ReadMe.txt
diff --git a/PythonVCL/VCL Generator/Standard_d3.prj b/Unsupported/PythonVCL/VCL Generator/Standard_d3.prj
similarity index 100%
rename from PythonVCL/VCL Generator/Standard_d3.prj
rename to Unsupported/PythonVCL/VCL Generator/Standard_d3.prj
diff --git a/PythonVCL/VCL Generator/Standard_d4.prj b/Unsupported/PythonVCL/VCL Generator/Standard_d4.prj
similarity index 100%
rename from PythonVCL/VCL Generator/Standard_d4.prj
rename to Unsupported/PythonVCL/VCL Generator/Standard_d4.prj
diff --git a/PythonVCL/VCL Generator/VCLGenerator.dof b/Unsupported/PythonVCL/VCL Generator/VCLGenerator.dof
similarity index 100%
rename from PythonVCL/VCL Generator/VCLGenerator.dof
rename to Unsupported/PythonVCL/VCL Generator/VCLGenerator.dof
diff --git a/PythonVCL/VCL Generator/VCLGenerator.dpr b/Unsupported/PythonVCL/VCL Generator/VCLGenerator.dpr
similarity index 100%
rename from PythonVCL/VCL Generator/VCLGenerator.dpr
rename to Unsupported/PythonVCL/VCL Generator/VCLGenerator.dpr
diff --git a/PythonVCL/VCL Generator/VCLGenerator.res b/Unsupported/PythonVCL/VCL Generator/VCLGenerator.res
similarity index 100%
rename from PythonVCL/VCL Generator/VCLGenerator.res
rename to Unsupported/PythonVCL/VCL Generator/VCLGenerator.res
diff --git a/PythonVCL/VCL Generator/fmAbout.dfm b/Unsupported/PythonVCL/VCL Generator/fmAbout.dfm
similarity index 100%
rename from PythonVCL/VCL Generator/fmAbout.dfm
rename to Unsupported/PythonVCL/VCL Generator/fmAbout.dfm
diff --git a/PythonVCL/VCL Generator/fmAbout.pas b/Unsupported/PythonVCL/VCL Generator/fmAbout.pas
similarity index 100%
rename from PythonVCL/VCL Generator/fmAbout.pas
rename to Unsupported/PythonVCL/VCL Generator/fmAbout.pas
diff --git a/PythonVCL/VCL Generator/fmMain.dfm b/Unsupported/PythonVCL/VCL Generator/fmMain.dfm
similarity index 100%
rename from PythonVCL/VCL Generator/fmMain.dfm
rename to Unsupported/PythonVCL/VCL Generator/fmMain.dfm
diff --git a/PythonVCL/VCL Generator/fmMain.pas b/Unsupported/PythonVCL/VCL Generator/fmMain.pas
similarity index 100%
rename from PythonVCL/VCL Generator/fmMain.pas
rename to Unsupported/PythonVCL/VCL Generator/fmMain.pas
diff --git a/PythonVCL/VCL Generator/fmOptions.dfm b/Unsupported/PythonVCL/VCL Generator/fmOptions.dfm
similarity index 100%
rename from PythonVCL/VCL Generator/fmOptions.dfm
rename to Unsupported/PythonVCL/VCL Generator/fmOptions.dfm
diff --git a/PythonVCL/VCL Generator/fmOptions.pas b/Unsupported/PythonVCL/VCL Generator/fmOptions.pas
similarity index 100%
rename from PythonVCL/VCL Generator/fmOptions.pas
rename to Unsupported/PythonVCL/VCL Generator/fmOptions.pas
diff --git a/PythonVCL/VCL Generator/fmSettings.dfm b/Unsupported/PythonVCL/VCL Generator/fmSettings.dfm
similarity index 100%
rename from PythonVCL/VCL Generator/fmSettings.dfm
rename to Unsupported/PythonVCL/VCL Generator/fmSettings.dfm
diff --git a/PythonVCL/VCL Generator/fmSettings.pas b/Unsupported/PythonVCL/VCL Generator/fmSettings.pas
similarity index 100%
rename from PythonVCL/VCL Generator/fmSettings.pas
rename to Unsupported/PythonVCL/VCL Generator/fmSettings.pas
diff --git a/PythonVCL/VCL Generator/log.txt b/Unsupported/PythonVCL/VCL Generator/log.txt
similarity index 100%
rename from PythonVCL/VCL Generator/log.txt
rename to Unsupported/PythonVCL/VCL Generator/log.txt
diff --git a/PythonVCL/VCL Generator/options.dat b/Unsupported/PythonVCL/VCL Generator/options.dat
similarity index 100%
rename from PythonVCL/VCL Generator/options.dat
rename to Unsupported/PythonVCL/VCL Generator/options.dat
diff --git a/PythonVCL/VCL Generator/to do.txt b/Unsupported/PythonVCL/VCL Generator/to do.txt
similarity index 100%
rename from PythonVCL/VCL Generator/to do.txt
rename to Unsupported/PythonVCL/VCL Generator/to do.txt
diff --git a/PythonVCL/VCL Generator/unHash.pas b/Unsupported/PythonVCL/VCL Generator/unHash.pas
similarity index 100%
rename from PythonVCL/VCL Generator/unHash.pas
rename to Unsupported/PythonVCL/VCL Generator/unHash.pas
diff --git a/PythonVCL/VCL Generator/unMisc.pas b/Unsupported/PythonVCL/VCL Generator/unMisc.pas
similarity index 100%
rename from PythonVCL/VCL Generator/unMisc.pas
rename to Unsupported/PythonVCL/VCL Generator/unMisc.pas
diff --git a/PythonVCL/VCL Generator/unParser.pas b/Unsupported/PythonVCL/VCL Generator/unParser.pas
similarity index 100%
rename from PythonVCL/VCL Generator/unParser.pas
rename to Unsupported/PythonVCL/VCL Generator/unParser.pas
diff --git a/PythonVCL/VCL Generator/unUnitParser.pas b/Unsupported/PythonVCL/VCL Generator/unUnitParser.pas
similarity index 100%
rename from PythonVCL/VCL Generator/unUnitParser.pas
rename to Unsupported/PythonVCL/VCL Generator/unUnitParser.pas
diff --git a/Unsupported/README.md b/Unsupported/README.md
new file mode 100644
index 00000000..d590c226
--- /dev/null
+++ b/Unsupported/README.md
@@ -0,0 +1 @@
+** THIS FOLDER CONTAINS DATED STUFF WHICH IS NO LONGER SUPPORTED **