Jump to content

pyscripter

Members
  • Content Count

    778
  • Joined

  • Last visited

  • Days Won

    41

Everything posted by pyscripter

  1. pyscripter

    SynEdit just got a major uplift

    I suppose it does a bit. FMX is using DirectWrite on Windows, and its graphics engine matches the constructs of DirectX (FMX.Canvas.D2D). One would have to create a VCL abstraction of DirectX that it is similar (possibly identical) to that of FMX. It could be based on Vcl's Direct2DCanvas. That would be useful in porting not just SynEdit but other components from Vcl to FMX and the opposite.
  2. pyscripter

    TSynEdit - Custom Highlighter

    - Update your SynEdit to the latest version from TurboPack/SynEdit: SynEdit is a syntax highlighting edit control, not based on the Windows common controls. (github.com) - Look at the SynGen folder. The file Highlighters-HowTo.htm explains the basic steps. You need to create a grammar file and then SynGen.exe will generate your highlighter.
  3. pyscripter

    Direct2D 1.1 canvas much slower that Direct2D 1.0

    I see you are using ID2D1HwndRenderTarget. However your project also refers to Vcl.Direct2D_1 which should be ..\..\Direct2D_1\Vcl.Direct2D_1.pas but that directory is not part of the project. I wonder whether you can share that as well.
  4. pyscripter

    Direct2D 1.1 canvas much slower that Direct2D 1.0

    By the way FMX graphics on Windows are based on DirectX and they use the IDXGIDevice stuff (units FMX.Context.DX11 and FMX.Canvas.D2D).
  5. pyscripter

    Direct2D 1.1 canvas much slower that Direct2D 1.0

    It has been a while, but did you get a better understanding of the differences in the two approaches and the reasons for the slowness?
  6. pyscripter

    Place image in a TImage

    Demo 29 might be of help.
  7. pyscripter

    [FMX] Dll not found

    Looks like it is looking for python3.3. This is no longer supported. Just check the properties of TPythonEngine. Is UseLastKnownVersion checked?
  8. pyscripter

    Can't execute from ... import

    See MaskFPUExceptions · pyscripter/python4delphi Wiki (github.com)
  9. Something like Module := Import(ModuleName) if Module.__dir__().Contains(FunctionName) then Module.FunctionName()
  10. Wrong assumption. You need to call Free on the Python side or free it from Delphi. You can examine the ownership of a Delphi object in Python using the __owned__ attribute. If __owned__ is true it will be freed automatically. When you wrap objects yourself using DelphiWrappper.Wrap, you can specify the ownership. But here you are returning the object as a function result and you cannot tell who owns the object. Objects returned as function results or by accessing properties are wrapped using Wrap(obj, soReference);
  11. Wrapping of TStrings is fully supported. You can easily turn it into a Python list if needed. Look at Demo 31, python function testTStrings.
  12. The TPythonModule is for using Delphi stuff in python scripts. To get started, look at the tutorials and demos.
  13. pyscripter

    Using the New Edge browser control

    One of the new features of Delphi 10.4 was the new TEdgeBrowser component. It is nice. However the downside is that certain steps are needed for the use and delployment of this component: Install Edge WebView2 package via GetIt. This places a Dll called WebView2Loader.dll in the redist directory of Embarcadero studio (one for win32, one for win64). The appropriate WebView2Loader.dll needs to be deployed alongside your executable. (about 300Kb). While developing you can add a post-build event to do that. Now the difficult one was that you had to replace the stable version of Edge, installed and managed by Windows, with the unstable one from the Canary Edge update channel (daily updates). Event if you did that in your own machine, few users would accept it. The new thing, that is not mentioned in the documentation, is that there is a better alternative to the third requirement. You can use the WebView2 Runtime installer which works independently from and does not interfere with your browser, and can be safely deployed in customer sites. Give it a try.
  14. pyscripter

    Can't load package Python$(Auto).bpl

    Check with https://my.embarcadero.com. If the upgrades are there then they are free.
  15. pyscripter

    Trouble installing Python4Delphi

    You can use the MultiInstaller. python4delphi/Install at master · pyscripter/python4delphi (github.com)
  16. pyscripter

    Delphi profiler

    Have a look at this: In addition to SAX parsers you may want to consider XmlLite. XMLLite is a good alternative to SAX on Windows. See the note about push and pull parsers. Similar speed and much easier to program with. And there is a Delphi wrapper (just a single unit to add to your project). In my experience XMLLite was very fast. Microsoft is using XMLLite to parse SVG files.
  17. pyscripter

    Profiler for Delphi

    I used it a couple of times and it worked well as far as instrumental profilers go.
  18. pyscripter

    OnMouseDown/Up events

    If you want this done, you may open an issue with this request at the P4D issue tracker, or even better contribute a Pull Request implementing the events you want.
  19. P4D provides the MaskFPUExceptions function for that purpose.
  20. pyscripter

    Your Delphi verion does not support COMMAND

    Do you mean that if you open just one package in Delphi it causes Delphi to freeze? Is it a specific package or any of the packages? Can you reproduce it with a different Delphi installation (possibly in a different computer)?
  21. pyscripter

    Your Delphi verion does not support COMMAND

    This is probably the result of an unstable Delphi installation. There are no similar issue reports in the P4D issue tracker. What happens if you open the packages one by one instead of opening the project group?
  22. pyscripter

    OnMouseDown/Up events

    The TMouseEvent is not handled currently by P4D. To see which events can be handled search the source code for "RegisterHandler". You could write some code to handle such events. Please see WrapDelphiEventHandlerTest under the Tests directory for how to do that and if you want submit a PR to add this to P4D.
  23. pyscripter

    Get the propt value of input()

    You cant't, at least not easily. The input function writes to stdout the message and then reads from stdin the input. The two operations are separate. You may be able to guess from what was written to sys.stdout last. But what you can do is overwrite builtins.input with your own function.
  24. I am sure this is well known but I recently discovered a new way to copy dynamic arrays: var A, B : TArray<Integer>; ... B = A; SetLength(B, Length(B)); ... Test procedure: procedure Test(); var A, B : TArray<Integer>; begin A := [1 , 2, 3]; B := A; SetLength(B, Length(B)); B[1] := 12; Assert(A[1] = 2); Assert(B[1] = 12); end; Of course Copy is simpler, but in my use case I did not want to create a copy unless it was necessary e.g. In one part of the code // create A SetLength(A, L); ... In another part of the code B = A // do stuff with B or store it as an object field If A is not recreated you save the copying operation. Not a big deal...
  25. pyscripter

    Interesting way to copy dynamic arrays.

    Try to output a again at the end of your routine.
×