Skip to content

Commit 5aaa829

Browse files
committed
Exposing members at SetupType time
1 parent 1cdb4f3 commit 5aaa829

File tree

2 files changed

+43
-10
lines changed

2 files changed

+43
-10
lines changed

Fixup/FixupGui.pas

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
unit FixupGui;
2+
3+
interface
4+
5+
{$IFDEF MACOS}
6+
uses
7+
Macapi.AppKit;
8+
{$ENDIF}
9+
10+
{$IFDEF MACOS}
11+
procedure _FixUp(); cdecl;
12+
{$ELSE}
13+
procedure FixUp(); cdecl;
14+
{$ENDIF}
15+
16+
exports
17+
{$IFDEF MACOS}
18+
_FixUp;
19+
{$ELSE}
20+
FixUp;
21+
{$ENDIF}
22+
23+
implementation
24+
25+
{$IFDEF MACOS}
26+
procedure _FixUp(); cdecl; export;
27+
begin
28+
//Avoid the shared library deadlock when GUI has not been initialized
29+
TNSScreen.Wrap(TNSScreen.OCClass.mainScreen);
30+
end;
31+
{$ELSE}
32+
procedure FixUp(); cdecl; export;
33+
begin
34+
35+
end;
36+
{$ENDIF}
37+
38+
end.

Source/WrapDelphi.pas

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3063,11 +3063,6 @@ class procedure TPyDelphiObject.RegisterGetSets(PythonType: TPythonType);
30633063
AddGetSet('__owned__', @TPyDelphiObject.Get_Owned, @TPyDelphiObject.Set_Owned,
30643064
'Returns True if the wrapper owns the Delphi instance.', nil);
30653065
end;
3066-
3067-
{$IFDEF EXPOSE_MEMBERS}
3068-
ExposeFields(DelphiObjectClass, PythonType, PythonType.Owner as TPyDelphiWrapper, true);
3069-
ExposeProperties(DelphiObjectClass, PythonType, PythonType.Owner as TPyDelphiWrapper, true);
3070-
{$ENDIF EXPOSE_MEMBERS}
30713066
end;
30723067

30733068
class procedure TPyDelphiObject.RegisterMethods(PythonType: TPythonType);
@@ -3090,11 +3085,6 @@ class procedure TPyDelphiObject.RegisterMethods(PythonType: TPythonType);
30903085
'If the object is a container (TStrings, TComponent...), it returns the content of the sequence as a Python list object.');
30913086
PythonType.AddMethod('__dir__', @TPyDelphiObject.Dir_Wrapper,
30923087
'Returns the list of all methods, fields and properties of this instance.');
3093-
3094-
{$IFDEF EXPOSE_MEMBERS}
3095-
ExposeMethods(DelphiObjectClass, PythonType,PythonType.Owner as TPyDelphiWrapper,
3096-
true, [], ['CPP_ABI_1', 'CPP_ABI_2', 'CPP_ABI_3']);
3097-
{$ENDIF EXPOSE_MEMBERS}
30983088
end;
30993089

31003090
function TPyDelphiObject.Repr: PPyObject;
@@ -3325,6 +3315,11 @@ class procedure TPyDelphiObject.SetupType(PythonType: TPythonType);
33253315
//Try to load the class doc string from doc server
33263316
if TPythonDocServer.Instance.ReadTypeDocStr(DelphiObjectClass.ClassInfo, LDocStr) then
33273317
PythonType.DocString.Text := LDocStr;
3318+
3319+
ExposeMethods(DelphiObjectClass, PythonType,PythonType.Owner as TPyDelphiWrapper,
3320+
true, [], ['CPP_ABI_1', 'CPP_ABI_2', 'CPP_ABI_3']);
3321+
ExposeFields(DelphiObjectClass, PythonType, PythonType.Owner as TPyDelphiWrapper, true);
3322+
ExposeProperties(DelphiObjectClass, PythonType, PythonType.Owner as TPyDelphiWrapper, true);
33283323
{$ENDIF EXPOSE_MEMBERS}
33293324
end;
33303325

0 commit comments

Comments
 (0)