diff --git a/PythonForDelphi/Components/PythonForDelphiXE7.groupproj b/PythonForDelphi/Components/PythonForDelphiXE7.groupproj new file mode 100644 index 00000000..3b700937 --- /dev/null +++ b/PythonForDelphi/Components/PythonForDelphiXE7.groupproj @@ -0,0 +1,48 @@ + + + {3F1B5C58-8875-44B9-8208-8138A676D4EC} + + + + + + + + + + + Default.Personality.12 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/PythonForDelphi/Components/PythonForDelphiXE7.groupproj.local b/PythonForDelphi/Components/PythonForDelphiXE7.groupproj.local new file mode 100644 index 00000000..12de1ef6 --- /dev/null +++ b/PythonForDelphi/Components/PythonForDelphiXE7.groupproj.local @@ -0,0 +1,7 @@ + + + + + + + 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_XE2.dproj b/PythonForDelphi/Components/PythonVCL_XE2.dproj new file mode 100644 index 00000000..16c8e545 --- /dev/null +++ b/PythonForDelphi/Components/PythonVCL_XE2.dproj @@ -0,0 +1,158 @@ + + + {B9FBC25B-B6EB-40C4-A381-FD3D8C19461D} + PythonVCL_XE2.dpk + True + Debug + 3 + Package + VCL + 16.1 + Win32 + + + true + + + true + Base + true + + + true + Base + true + + + true + Base + true + + + true + Base + true + + + true + Base + true + + + true + Base + true + + + true + Base + true + + + true + Cfg_2 + true + true + + + PythonVCL_XE2 + false + 1 + true + true + false + false + false + VCL Components for Python + true + false + CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments=;CFBundleName= + 00400000 + Vcl;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;System;Xml;Data;Datasnap;Web;Soap;Winapi;$(DCC_Namespace) + 1049 + + + rtl;dbrtl;$(DCC_UsePackage) + package=com.embarcadero.$(MSBuildProjectName);label=$(MSBuildProjectName);versionCode=1;versionName=1.0.0;persistent=False;restoreAnyVersion=False;installLocation=preferExternal;largeHeap=False;theme=TitleBar;hardwareAccelerated=true + Debug + + + rtl;dbrtl;$(DCC_UsePackage) + + + rtl;dbrtl;$(DCC_UsePackage) + + + rtl;vcl;dbrtl;Python_XE2;$(DCC_UsePackage) + System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace) + true + 1033 + CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments= + + + rtl;vcl;dbrtl;Python_XE2;$(DCC_UsePackage) + System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;$(DCC_Namespace) + true + 1033 + CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments= + + + 0 + RELEASE;$(DCC_Define) + false + 0 + + + DEBUG;$(DCC_Define) + false + true + + + CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments= + + + + MainSource + + + + + + + + + + + Cfg_2 + Base + + + Base + + + Cfg_1 + Base + + + + Delphi.Personality.12 + Package + + + + PythonVCL_XE2.dpk + + + + False + False + False + True + True + + + 12 + + + + diff --git a/PythonForDelphi/Components/PythonVCL_XE2.dproj.local b/PythonForDelphi/Components/PythonVCL_XE2.dproj.local new file mode 100644 index 00000000..b3811b7e --- /dev/null +++ b/PythonForDelphi/Components/PythonVCL_XE2.dproj.local @@ -0,0 +1,2 @@ + + diff --git a/PythonForDelphi/Components/PythonVCL_XE2.res b/PythonForDelphi/Components/PythonVCL_XE2.res new file mode 100644 index 00000000..27efe49b Binary files /dev/null and b/PythonForDelphi/Components/PythonVCL_XE2.res differ diff --git a/PythonForDelphi/Components/Python_XE2.dproj b/PythonForDelphi/Components/Python_XE2.dproj new file mode 100644 index 00000000..7de7eadd --- /dev/null +++ b/PythonForDelphi/Components/Python_XE2.dproj @@ -0,0 +1,156 @@ + + + {A8F30A4E-42D4-4329-9DD4-018FD3C67D17} + Python_XE2.dpk + True + Debug + 3 + Package + VCL + 16.1 + Win32 + + + true + + + true + Base + true + + + true + Base + true + + + true + Base + true + + + true + Base + true + + + true + Base + true + + + true + Base + true + + + true + Base + true + + + true + Cfg_2 + true + true + + + Python_XE2 + false + false + true + true + false + false + Components for Python + true + false + CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments=;CFBundleName= + 00400000 + Vcl;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;System;Xml;Data;Datasnap;Web;Soap;Winapi;System.Win;$(DCC_Namespace) + 1049 + + + rtl;$(DCC_UsePackage) + package=com.embarcadero.$(MSBuildProjectName);label=$(MSBuildProjectName);versionCode=1;versionName=1.0.0;persistent=False;restoreAnyVersion=False;installLocation=preferExternal;largeHeap=False;theme=TitleBar;hardwareAccelerated=true + Debug + + + rtl;$(DCC_UsePackage) + + + rtl;$(DCC_UsePackage) + + + rtl;vcl;$(DCC_UsePackage) + true + Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace) + 1033 + CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments= + + + rtl;vcl;$(DCC_UsePackage) + true + Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;$(DCC_Namespace) + 1033 + CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments= + + + 0 + RELEASE;$(DCC_Define) + false + 0 + + + DEBUG;$(DCC_Define) + false + true + + + CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments= + + + + MainSource + + + + + + + + + + Cfg_2 + Base + + + Base + + + Cfg_1 + Base + + + + Delphi.Personality.12 + Package + + + + Python_XE2.dpk + + + + False + False + False + True + True + + + 12 + + + + diff --git a/PythonForDelphi/Components/Python_XE2.dproj.local b/PythonForDelphi/Components/Python_XE2.dproj.local new file mode 100644 index 00000000..b3811b7e --- /dev/null +++ b/PythonForDelphi/Components/Python_XE2.dproj.local @@ -0,0 +1,2 @@ + + diff --git a/PythonForDelphi/Components/Python_XE2.res b/PythonForDelphi/Components/Python_XE2.res new file mode 100644 index 00000000..27efe49b Binary files /dev/null and b/PythonForDelphi/Components/Python_XE2.res differ diff --git a/PythonForDelphi/Components/Sources/Core/PythonEngine.pas b/PythonForDelphi/Components/Sources/Core/PythonEngine.pas index 9900134a..535d13a2 100644 --- a/PythonForDelphi/Components/Sources/Core/PythonEngine.pas +++ b/PythonForDelphi/Components/Sources/Core/PythonEngine.pas @@ -1374,7 +1374,7 @@ EPyWindowsError = class (EPyOSError); {$IF not Defined(FPC) and (CompilerVersion >= 23)} [ComponentPlatformsAttribute(pidWin32 or pidWin64)] - {$IFEND} + {$ENDIF} TPythonInputOutput = class(TComponent) protected FMaxLines : Integer; @@ -1508,7 +1508,8 @@ TPythonInterface=class(TDynamicDll) DLL_PyString_FromString: function( str: PAnsiChar): PPyObject; cdecl; DLL_Py_FlushLine:procedure; cdecl; - + DLL_PyCFunction_New: function(md:PPyMethodDef;ob:PPyObject):PPyObject; cdecl; + DLL_PyCFunction_NewEx: function(md:PPyMethodDef;ob:PPyObject; ob1:PPyObject):PPyObject; cdecl; protected FInitialized: Boolean; FFinalizing: Boolean; @@ -1707,8 +1708,6 @@ TPythonInterface=class(TDynamicDll) PySys_SetArgv: procedure( argc: Integer; argv: PPAnsiChar); cdecl; PySys_SetArgv3000: procedure( argc: Integer; argv: PPWideChar); cdecl; - PyCFunction_New: function(md:PPyMethodDef;ob:PPyObject):PPyObject; cdecl; - PyCFunction_NewEx: function(md:PPyMethodDef;self, ob:PPyObject):PPyObject; cdecl; // Removed. Use PyEval_CallObjectWithKeywords with third argument nil // PyEval_CallObject: function(callable_obj, args:PPyObject):PPyObject; cdecl; PyEval_CallObjectWithKeywords:function (callable_obj, args, kw:PPyObject):PPyObject; cdecl; @@ -2051,7 +2050,7 @@ TPythonInterface=class(TDynamicDll) function PyString_FromString( str: PAnsiChar): PPyObject; virtual; abstract; function PyString_AsDelphiString( ob: PPyObject): string; virtual; abstract; procedure Py_FlushLine; cdecl; - + function PyCFunction_New(md:PPyMethodDef;ob:PPyObject):PPyObject; cdecl; // Constructors & Destructors constructor Create(AOwner: TComponent); override; @@ -2115,7 +2114,7 @@ TPythonTraceback = class {$IF not Defined(FPC) and (CompilerVersion >= 23)} [ComponentPlatformsAttribute(pidWin32 or pidWin64)] - {$IFEND} + {$ENDIF} TPythonEngine = class(TPythonInterface) private FInitScript: TStrings; @@ -2583,7 +2582,7 @@ TErrors = class(TCollection) {$IF not Defined(FPC) and (CompilerVersion >= 23)} [ComponentPlatformsAttribute(pidWin32 or pidWin64)] - {$IFEND} + {$ENDIF} TPythonModule = class(TMethodsContainer) protected FModuleName : AnsiString; @@ -2848,7 +2847,7 @@ TTypeServices = class(TPersistent) // that creates instances of itself. {$IF not Defined(FPC) and (CompilerVersion >= 23)} [ComponentPlatformsAttribute(pidWin32 or pidWin64)] - {$IFEND} + {$ENDIF} TPythonType = class(TGetSetContainer) protected FType : PyTypeObject; @@ -2936,7 +2935,7 @@ TPythonType = class(TGetSetContainer) {$IF not Defined(FPC) and (CompilerVersion >= 23)} [ComponentPlatformsAttribute(pidWin32 or pidWin64)] - {$IFEND} + {$ENDIF} TPythonDelphiVar = class( TEngineClient ) protected FModule : AnsiString; @@ -3757,11 +3756,10 @@ procedure TPythonInterface.MapDll; PySys_SetArgv3000 := Import('PySys_SetArgv'); Py_Exit := Import('Py_Exit'); - if IsPython3000 then - PyCFunction_NewEx :=Import('PyCFunction_NewEx') + if ((FMajorVersion = 3) and (FMinorVersion >= 4)) or (FMajorVersion > 3) then + DLL_PyCFunction_NewEx := Import('PyCFunction_NewEx') else - PyCFunction_New :=Import('PyCFunction_New'); - + DLL_PyCFunction_New :=Import('PyCFunction_New'); PyEval_CallObjectWithKeywords:=Import('PyEval_CallObjectWithKeywords'); PyEval_GetFrame :=Import('PyEval_GetFrame'); @@ -4372,6 +4370,14 @@ procedure TPythonInterface.Py_FlushLine; cdecl; DLL_Py_FlushLine; end; +function TPythonInterface.PyCFunction_New(md:PPyMethodDef;ob:PPyObject):PPyObject; cdecl; +begin + if Assigned(DLL_PyCFunction_New) then + Result := DLL_PyCFunction_New(md, ob) + else + Result := DLL_PyCFunction_NewEx(md, ob, nil); +end; + (*******************************************************) (** **) (** class TPythonTraceback **) @@ -8210,7 +8216,6 @@ procedure TPythonType.ReallocMembers; procedure TPythonType.ReallocMethods; begin inherited; -exit; if tpfBaseType in TypeFlags then FType.tp_methods := MethodsData; end; @@ -8925,10 +8930,7 @@ procedure TPythonType.AddTypeVar; FCreateFuncDef.ml_meth := GetOfObjectCallBack( TCallBack(meth), 2, ctCDECL); FCreateFuncDef.ml_flags := METH_VARARGS; FCreateFuncDef.ml_doc := PAnsiChar(FCreateFuncDoc); - if GetPythonEngine.IsPython3000 then - FCreateFunc := Engine.PyCFunction_NewEx(@FCreateFuncDef, nil, nil) - else - FCreateFunc := Engine.PyCFunction_New(@FCreateFuncDef, nil); + FCreateFunc := Engine.PyCFunction_New(@FCreateFuncDef, nil); end; Assert(Assigned(FCreateFunc)); end; diff --git a/PythonForDelphi/Components/Sources/Core/VarPyth.rst b/PythonForDelphi/Components/Sources/Core/VarPyth.rst new file mode 100644 index 00000000..03a11e3d --- /dev/null +++ b/PythonForDelphi/Components/Sources/Core/VarPyth.rst @@ -0,0 +1,34 @@ + +# hash value = 61888190 +varpyth.smultidimensionalpropsnotsupported='Multi-dimensional sequences o'+ +'r mappings are not supported in Python' + + +# hash value = 209853316 +varpyth.scantconvertarg='Can'#39't convert argument #%d of %s into a Pyth'+ +'on object' + + +# hash value = 198061570 +varpyth.sbothoperandsofintdividemustbeintegers='Both operands of an integ'+ +'er division must be of type integer' + + +# hash value = 229549924 +varpyth.scantconvertkeytopythonobject='Can'#39't convert Key into a Pytho'+ +'n object' + + +# hash value = 68458372 +varpyth.scantconvertvaluetopythonobject='Can'#39't convert Value into a P'+ +'ython object' + + +# hash value = 232876276 +varpyth.scantcreatenewsequenceobject='Can'#39't create a new sequence obj'+ +'ect' + + +# hash value = 196548996 +varpyth.sexpectedpythonvariant='Expected a Python variant' + diff --git a/PythonForDelphi/Components/Sources/Core/WrapDelphi.pas b/PythonForDelphi/Components/Sources/Core/WrapDelphi.pas index 5e632be7..cd09d0d4 100644 --- a/PythonForDelphi/Components/Sources/Core/WrapDelphi.pas +++ b/PythonForDelphi/Components/Sources/Core/WrapDelphi.pas @@ -2689,10 +2689,7 @@ procedure TPyDelphiWrapper.CreatePyFunc(AModule: TPythonModule; AMethodDef: PPyM begin d := PyModule_GetDict(FModule.Module); Assert(Assigned(d)); - if IsPython3000 then - PyDict_SetItemString( d, AMethodDef^.ml_name, PyCFunction_NewEx(AMethodDef, nil, nil)) - else - PyDict_SetItemString( d, AMethodDef^.ml_name, PyCFunction_New(AMethodDef, nil)); + PyDict_SetItemString( d, AMethodDef^.ml_name, PyCFunction_New(AMethodDef, nil)); end; end; diff --git a/PythonForDelphi/Components/Sources/VCL/pyDB.pas b/PythonForDelphi/Components/Sources/VCL/pyDB.pas index 0e109e53..00c17cf3 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; @@ -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 diff --git a/PythonForDelphi/Components/Sources/VCL/pyDBTables.pas b/PythonForDelphi/Components/Sources/VCL/pyDBTables.pas index 747f1801..6a709bf3 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,4 @@ procedure CreateComponents( AOwner : TComponent ); gQueryType := TPythonQuery.Create(AOwner); end; - end. diff --git a/PythonForDelphi/Components/p4dlaz.lpk b/PythonForDelphi/Components/p4dlaz.lpk index e364ad4b..d5cd2850 100644 --- a/PythonForDelphi/Components/p4dlaz.lpk +++ b/PythonForDelphi/Components/p4dlaz.lpk @@ -1,14 +1,15 @@ - + - + - + - + - + + @@ -17,14 +18,8 @@ - - - - - - - + @@ -104,8 +99,11 @@ + + + + - diff --git a/PythonForDelphi/Components/up4dlaz.pas b/PythonForDelphi/Components/up4dlaz.pas new file mode 100644 index 00000000..1f2dee6b --- /dev/null +++ b/PythonForDelphi/Components/up4dlaz.pas @@ -0,0 +1,28 @@ +{ This file was automatically created by Lazarus. Do not edit! + This source is only used to compile and install the package. + } + +unit uP4DLaz; + +interface + +uses + PythonEngine, PythonGUIInputOutput, MethodCallBack, WrapDelphiWindows, + TinyWideStrings, VarPyth, WrapDelphi, WrapDelphiActnList, WrapDelphiButtons, + WrapDelphiClasses, WrapDelphiComCtrls, WrapDelphiControls, + WrapDelphiExtCtrls, WrapDelphiForms, WrapDelphiGraphics, WrapDelphiGrids, + WrapDelphiStdCtrls, WrapDelphiTypes, WrapDelphiVCL, LazarusPackageIntf; + +implementation + +procedure Register; +begin + RegisterUnit('PythonEngine', @PythonEngine.Register); + RegisterUnit('PythonGUIInputOutput', @PythonGUIInputOutput.Register); + RegisterUnit('WrapDelphi', @WrapDelphi.Register); + RegisterUnit('uP4DLaz', @uP4DLaz.Register); +end; + +initialization + RegisterPackage('P4DLaz', @Register); +end. diff --git a/PythonForDelphi/Demos/Demo01/Project1.dproj b/PythonForDelphi/Demos/Demo01/Project1.dproj index 359c290a..e61758d8 100644 --- a/PythonForDelphi/Demos/Demo01/Project1.dproj +++ b/PythonForDelphi/Demos/Demo01/Project1.dproj @@ -1,151 +1,134 @@ - - - {CA67512A-3B3A-48FD-8952-5503337690C4} - 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= - 1033 - 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 - - - true - $(BDS)\bin\default_app.manifest - System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;$(DCC_Namespace) - Project1_Icon.ico - - - false - RELEASE;$(DCC_Define) - 0 - 0 - - - DEBUG;$(DCC_Define) - - - $(BDS)\bin\delphi_PROJECTICON.ico - true - - - - MainSource - - -
Form1
-
- - 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 - - - 12 - - -
+ + + {CA67512A-3B3A-48FD-8952-5503337690C4} + 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= + 1033 + 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 + + +
Form1
+
+ + 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 + + + + + False + True + + + 12 + + +
diff --git a/PythonForDelphi/Demos/Demo02/Project1_Icon.ico b/PythonForDelphi/Demos/Demo02/Project1_Icon.ico new file mode 100644 index 00000000..1998c2db Binary files /dev/null and b/PythonForDelphi/Demos/Demo02/Project1_Icon.ico differ diff --git a/PythonForDelphi/Demos/Demo03/Project1_Icon.ico b/PythonForDelphi/Demos/Demo03/Project1_Icon.ico new file mode 100644 index 00000000..9d0e1f36 Binary files /dev/null and b/PythonForDelphi/Demos/Demo03/Project1_Icon.ico differ diff --git a/PythonForDelphi/Demos/Demo10/Demo10.dproj b/PythonForDelphi/Demos/Demo10/Demo10.dproj index 1b98b520..da8e6053 100644 --- a/PythonForDelphi/Demos/Demo10/Demo10.dproj +++ b/PythonForDelphi/Demos/Demo10/Demo10.dproj @@ -1,107 +1,140 @@ - - - {1D701B96-D47C-4AD0-BE2E-830C95586BC9} - Demo10.dpr - Debug - DCC32 - 12.0 - - - true - - - true - Base - true - - - true - Base - true - - - WinTypes=Windows;WinProcs=Windows;$(DCC_UnitAlias) - Demo10.exe - 00400000 - x86 - - - false - RELEASE;$(DCC_Define) - 0 - false - - - DEBUG;$(DCC_Define) - - - - MainSource - - -
Main
-
- - - - Base - - - Cfg_2 - 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 - - - - 12 - -
+ + + {1D701B96-D47C-4AD0-BE2E-830C95586BC9} + Demo10.dpr + Debug + DCC32 + 15.4 + True + 1 + Application + VCL + Win32 + + + 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;Bde;$(DCC_Namespace) + 1032 + Demo10 + CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments= + Demo10.exe + 00400000 + x86 + + + 1033 + true + $(BDS)\bin\default_app.manifest + Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace) + Demo10_Icon.ico + + + Demo10_Icon.ico + + + false + RELEASE;$(DCC_Define) + 0 + 0 + + + DEBUG;$(DCC_Define) + + + + MainSource + + +
Main
+
+ + + + 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 + + + + True + False + + + 12 + + +
diff --git a/PythonForDelphi/Demos/Demo10/Demo10.res b/PythonForDelphi/Demos/Demo10/Demo10.res index cfdbb79b..74691e26 100644 Binary files a/PythonForDelphi/Demos/Demo10/Demo10.res and b/PythonForDelphi/Demos/Demo10/Demo10.res differ diff --git a/PythonForDelphi/Demos/Demo10/Demo10_Icon.ico b/PythonForDelphi/Demos/Demo10/Demo10_Icon.ico new file mode 100644 index 00000000..9d0e1f36 Binary files /dev/null and b/PythonForDelphi/Demos/Demo10/Demo10_Icon.ico differ 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/Demo29/Unit1.dfm b/PythonForDelphi/Demos/Demo29/Unit1.dfm index f557d9f9..8a17a093 100644 --- a/PythonForDelphi/Demos/Demo29/Unit1.dfm +++ b/PythonForDelphi/Demos/Demo29/Unit1.dfm @@ -89,7 +89,7 @@ object Form1: TForm1 AutoUnload = False DllName = 'python27.dll' APIVersion = 1013 - RegVersion = '2.7' + RegVersion = '3.4' UseLastKnownVersion = False IO = PythonGUIInputOutput1 Left = 168 diff --git a/PythonForDelphi/Demos/Demo30/Project1_Icon.ico b/PythonForDelphi/Demos/Demo30/Project1_Icon.ico new file mode 100644 index 00000000..9d0e1f36 Binary files /dev/null and b/PythonForDelphi/Demos/Demo30/Project1_Icon.ico differ diff --git a/PythonForDelphi/Demos/Demo31/Project1.dproj b/PythonForDelphi/Demos/Demo31/Project1.dproj index f7200dc2..6758eeda 100644 --- a/PythonForDelphi/Demos/Demo31/Project1.dproj +++ b/PythonForDelphi/Demos/Demo31/Project1.dproj @@ -1,148 +1,148 @@ - - - {13782AFF-38C4-49AC-BA0A-8FAFC09245D8} - Project1.dpr - Debug - DCC32 - 16.1 - VCL - True - Win64 - 3 - Application - - - true - - - true - Base - true - - - true - Base - true - - - true - Base - true - - - true - Base - 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= - 4105 - 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 - - - true - System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;$(DCC_Namespace) - 1033 - $(BDS)\bin\default_app.manifest - Project1_Icon.ico - - - false - RELEASE;$(DCC_Define) - 0 - 0 - - - DEBUG;$(DCC_Define) - - - - MainSource - - -
Form1
-
- - - -
TestForm
-
- - - - - - - 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 - - - - - True - True - - - 12 - - -
+ + + {13782AFF-38C4-49AC-BA0A-8FAFC09245D8} + Project1.dpr + Debug + DCC32 + 13.4 + VCL + True + Win32 + 3 + 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= + 4105 + Project1.exe + 00400000 + x86 + + + true + System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;$(DCC_Namespace) + 1033 + $(BDS)\bin\default_app.manifest + Project1_Icon.ico + + + 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 + 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 + + +
Form1
+
+ + + +
TestForm
+
+ + + + + + + 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 + + + + + True + True + + + 12 + + +
diff --git a/PythonForDelphi/Demos/Demo31/Project1.res b/PythonForDelphi/Demos/Demo31/Project1.res index b6d7cb18..904914fe 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..17960a9c 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..c8857dd4 100644 --- a/PythonForDelphi/Demos/Demo31/Unit1.pas +++ b/PythonForDelphi/Demos/Demo31/Unit1.pas @@ -13,7 +13,7 @@ interface {$IFDEF LINUX} QForms, QStdCtrls, QControls, QExtCtrls, {$ENDIF} - PythonEngine, PythonGUIInputOutput, WrapDelphi, ActnList, System.Actions; + PythonEngine, PythonGUIInputOutput, WrapDelphi, ActnList; type TForm1 = class(TForm) diff --git a/PythonForDelphi/Demos/Demo33/ThrdDemo_Icon.ico b/PythonForDelphi/Demos/Demo33/ThrdDemo_Icon.ico new file mode 100644 index 00000000..379ec80d Binary files /dev/null and b/PythonForDelphi/Demos/Demo33/ThrdDemo_Icon.ico differ