Jump to content

pyscripter

Members
  • Content Count

    778
  • Joined

  • Last visited

  • Days Won

    41

Everything posted by pyscripter

  1. Then try the following before loading the engine: - Create a TPythonInputOutput - Set the PythonEngine IO property to the TPythonInputOutput - Set the RedirectIO property to True.
  2. Looks like the python module is trying to write to the console. Do you use TPythonGUIInputOutput linked to the PythonEngine? If not try setting UseWindowsConsole to True.
  3. Did you mask exceptions (MaskFPUExceptions · pyscripter/python4delphi Wiki (github.com)? If yes, have you checked sys.version and sys.path to make sure they are the same as in stand alone python?
  4. pyscripter

    How to distribute a project

    You can either install python and PyPDF2 in the target machine or distribute an embedded version of Python with your app. If you follow the second route, have a look at Embarcadero/PythonEnviroments: Components to simplify the deployment for Python environments for Delphi applications using Python4Delphi. (github.com).
  5. Did you use the GetIt version? If not have you read Installation · pyscripter/python4delphi Wiki (github.com)?
  6. pyscripter

    Vcl issues

    I have recently submitted two Vcl related quality issue reports: https://quality.embarcadero.com/browse/RSP-41987 https://quality.embarcadero.com/browse/RSP-41988 The first one relates to a change in TCustomForm.SetParent introduced in Delphi Alexandria. It broke docking behaviour, but there may be other applications affected. One way to work around it is to set the form AutoScroll property to True. Question: Are there any undesired consequences of doing this? The second report relates to the fact that TControlForm.ChangeScale is not used and there is no good available options to achieve what you do when you overwrite ChangeScale in custom controls. Question: Am I missing something? Is there a good way to execute some code whenever the form dpi is changed?
  7. pyscripter

    Debug issue with Numpy loading

    Have you read these: MaskFPUExceptions · pyscripter/python4delphi Wiki (github.com) FindingPython · pyscripter/python4delphi Wiki (github.com) with reference to Anaconda?
  8. pyscripter

    VCL Handling of dpi changes - poor performance

    This is an old thread, but I have just noticed that Delphi 11 deals with this issue by calling the new LockDrawing/UnlockDrawing wrapper around WM_SETREDRAW in DoBeforeMonitorDpiChanged/DoAfterMonitorDpiChanged. They have also fixed https://quality.embarcadero.com/browse/RSP-30931. It seems to work reasonably well now.
  9. See [RSP-41949] LSP does not work when project includes modified file found in the search path - Embarcadero Technologies for details. Has anyone been bitten by this? Code Insight now works in my PyScripter project. I thought that cyclic unit dependencies may be the cause and spent quite a bit of time reducing them. I guess, that this was time well spent, but it was not the source of the LSP failures.
  10. It turns out that the causes of LSP failure were more complex than I originally thought. In the attached project in TestCI-JclSysUtils LSP does not work. The project is relatively simple. It has three units Unit1.pas (a form with one button) uCommonFunctions.pas (contains three functions) JclSysUtils (an exact copy of the Jcl unit) With Jcl installed it compiles and runs fine. Here is the interesting thing. LSP starts working if: either you remove an unused import of JclPeImage from the uses clauses of uCommonFunctions or you remove the "forked" JclSysUtils from the project. Looks like LSP is a lot more fragile than is should be. I was without IDE support in my a project, since Delphi 11.2 was released and it took substantial effort and a bit of luck to restore it. TestCI-JclSysUtils.zip
  11. @programmerdelphi2k You are right. It works with WinApi.Messages. I have added another project with JclSysUtils instead of WinApi.Messages. The project will compile fine if you have Jcl installed. LSP fails with that project. It also fails if you use System.Variants instead of WinApi.Messages. But in that case the project does not compile. I will try to find out what triggers the failure.
  12. @Brandon Staggs Could you please try the minimal project attached to the QA report. Does it work for you? I think the bug affects units that either use directly the forked units or units that depend on such units.
  13. pyscripter

    Turbo SynEdit & Font Ligatures

    Development of SynEdit at PyScripter has been moved to and merged with TurboPack SynEdit. The focus of the development is to modernize the code base and enhance the functionality (sometimes at the expense of backward compatibility). In addition to the earlier enhancements and fixes two more features have been recently added: Per-monitor DPI awareness Support for Font Ligatures (new option eoShowLigatures) Fonts like Cascadia Code and Fira Code contain ligatures relevant to programming. See this article for details. Are you using font ligatures? Do you like them? See sample. Thanks to vhanla for contributing the ligature support.
  14. PyScripter, an Open Source, freely available Python IDE written in Delphi, has reached 1 million downloads from Sourceforge. This is in addition to many millions of downloads from its earlier home at the now defunct Google Code and an unknown number of downloads from other distribution channels. Historic note: The initial motivation was to build a good scripting solution for Delphi applications. About 20 years ago Microsoft was still promoting ActiveX scripting and Windows Script Engines (such as vbScript and jScript) as the way of building scripting solutions for Windows applications (one of many Microsoft technologies that was all but abandoned). At that time Python was relatively unknown, but it so happened that it was available as a Windows Script Engine and I looked into it. I loved the clean syntax, the expressiveness and conciseness of the language. Other things I liked were duck typing, batteries included, strong object orientation (everything is an object) etc.. The first iteration was an IDE (editor/debugger) for ActiveX Script Engines. But there were many bugs and limitations of Active Scripting both on the Microsoft/Windows side and the Python side. I then came across Python4Delphi which at the time was maintained by a Canadian developer Morgan Martinet. I started contributing to that project and later become its main maintainer, when Morgan's interested shifted to other things. I also developed a simple Python IDE which was named PyScripter and was originally distributed alongside Python4Delphi. There was very few Python IDEs available at the time and somehow the project became known in the Python community and instantly popular. For me, developing PyScripter was just a hobby, but I received a lot of encouragement and kept on improving it. I was also making some income from donations and Google AdSense. Both PyScripter and Python4Delphi were later moved to Google Code. Python popularity was steadily increasing and at the peak of PyScripter's popularity around 2010, there were hundreds of thousands of downloads the days following each new release. More recently as we all know Python became one of the most popular programming languages, but at the same time there was strong competition to PyScripter from freely available commercial grade IDE's such as Jetbrains PyCharm and Microsoft's Visual Studio and Visual Studio Code. PyScripter was almost abandoned when Google Code closed down due to my frustration, but after a couple of years of inactivity the project was moved to Github and development resumed. Downloads are available through Sourceforge, since 2016. Through the years PyScripter has kept a large and loyal group of followers. I get many comments along the lines "I have tried VSCode, I have tried PyCharm, but I keep going back to PyScripter". PyScripter is also quite widely used in many Universities for introducing Python to students. And almost 20 years after its first release, PyScripter is still going strong...
  15. pyscripter

    PyScripter reached 1 million downloads from Sourceforge

    PyScripter has reached 1.5 million downloads. This is just from Sourceforge and does not include downloads from Embarcadero, many other download sites and forks such as GuiPy. What is quite satisfying is that there is no country in the world without downloads. Greenland for instance, a vast country with a population of only 56000, has 7 downloads.
  16. When I debug my application, just before exiting, I see some strange messages in the Events log, such as: Debug Output: onecore\com\combase\winrt\error\restrictederror.cpp(945)\combase.dll!00007FFD636832D1: (caller: 00007FFD6358BCC5) ReturnHr(4) tid(b80) 80070490 Element not found. Process PyScripter.exe (14872) All messages are related to winrt, however I am not explicitly using winrt. Any clues? Should I worry?
  17. Could you post a sample project that demonstrates the issue?
  18. Firstly, let me say that my work on SynEdit has moved back to pyscripter/SynEdit for reasons explained here. The newest enhancement to SynEdit is accessibility support. Now, SynEdit fully supports screen readers such as Windows Narrator and NVDA. The support is much better than, for instance, in Visual Studio Code. The implementation is not based on the older Microsoft Active Accessibility (MSAA), but on the newer Microsoft UI Automation. Microsoft UI Automation has been around since 2005 and is available to all Windows versions, since Windows XP. In addition to making applications accessible, it can also be used by automated UI testing tools. Despite been available for almost 20 years, Delphi does not provide the relevant header translations (See RSP-41898), which complicated the implementation. I also could not find any other complete Delphi implementation of UI automation. So, the SynEdit implementation may serve as a guide to how to implement UI Automation in other controls. Further details can be found here.
  19. If you want to preserve globals in script execution you need to use the ExecString(s) overload with the locals, globals parameters.
  20. Python code needs to be properly indented (see for instance Python Indentation (w3schools.com)). Otherwise you will get the IndentationError you show above. If you want to built your own interpreter, a good starting point is the InteractiveInterpeter class of the code module. The runsource method will tell you whether the input is incomplete and more input is required.
  21. I am not sure what the issue you are trying to solve is. You can have the statement: from oct2py import Oct2Py or just import oct2py within different python modules or functions. It does not result in the module being reimported. If it has been already imported it just uses the already imported one and there is no speed penalty. The same applies to the VarPyth Import statement.
  22. pyscripter

    Looking for SVG support in Delphi?

    In an earlier thread I presented an Interface-based access to native Windows (Direct2D) SVG support for Delphi applications. This has now been integrated into the SVGIconImageList components by @Carlo Barazzetta. Carlo is a kind of master of ImageLists (among other things). Have a look at his IconFontsImageList for instance. His SVGIconImageList component was based on the work of Martin Walter who must be a great programmer. His SVG component covered almost every SVG element and was well structured and cleanly written. There were numerous bugs and issues though, which, to a large extent, were fixed over the last few weeks and the code was refactored and optimized. Finally, @Vincent Parrett contributed a virtual version of the Image List, mirroring Delphi's VirtualImageList. So in its current form the component features: An SVGImageCollection component that inherits from Delphi's CustomImageCollection and thus is compatible with VirtualImageList A choice of SVG engines: the pascal one based on Martin's work which is using GDI+ and the native Windows one which is using Direct2D. Other SVG engines can be plugged-in with minimum effort. Excellent design support with a nice and effective SVGImageCollection editor developed by Carlo and the built-in VirtualImageList editor. Support for changing the opacity and color of the SVGs including using GrayScale. If you adopt Material Design for example and you use VCL styles, you can adjust the icon color to the style. Compatibility with older Delphi versions going back to XE6. It is free and open-source Svgs are vastly superior to bitmaps because they are typically tiny text files and scale perfectly. So, you do not need to ship with your application multiple resolutions of your images to match the DPI of the monitors. And there is a vast number of free SVGs to cover most needs. IMHO the combination of SVGImageCollection with Delphi's VirtualImageList is the best available solution (commercial ones included) for building DPI-aware Windows applications. Give it a try.
  23. pyscripter

    How to use PyArg_ParseTupleAndKeywords

    Demo32 demonstrates how to use PyArg_ParseTupleAndKeywords.
  24. pyscripter

    How to catch if the object is assigned None

    Not so simple: python - Overriding __setattr__ at runtime - Stack Overflow
×