Jump to content

pyscripter

Members
  • Content Count

    778
  • Joined

  • Last visited

  • Days Won

    41

Posts posted by pyscripter


  1. I have recently submitted two Vcl related quality issue reports:

     

    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?


  2. On 3/24/2021 at 2:07 AM, Vincent Parrett said:

    I tried to fudge a BeginUpdate/EndUpdate with this :

    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.


  3. 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

    • Like 1

  4. 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.

     


  5. image.thumb.png.477d56eb6e0285208deab509935a9780.png

     

    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.

    • Like 5
    • Thanks 4

  6. 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?


  7. 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.

    • Like 6
    • Thanks 2

  8. 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.


  9. function  TPyPoint.SetAttr(key : PAnsiChar; value : PPyObject) : Integer

    is called whenever a property is set (e.g. spam.myPoint.x = 10).     So you can take an action when the object is modified.  

     

    However you are not notified when  spam.myPoint is assigned a value.

     

    To do what you would have to override the __setattr__ on the module, but this is too complicated.


  10. I wrote the code without testing, just to give you the idea.  Good that you solved the problem.

    Also instead of MainModule.builtins._input_prompt  you can use BuiltinModule._input_prompt.

     

    And the following would do.  No need to convert to AnsiString and back.

    procedure TForm1.PythonInputOutput1ReceiveUniData(Sender: TObject;
      var Data: string);
    begin
      InputQuery( 'Query from Python', BuiltinModule._input_prompt, Data);
    end;

     

    • Thanks 1

  11. Run a script like this:

     

    import builtins
    
    def myinput(prompt):
        builtins._input_prompt = prompt
        builtins._input(prompt)
    
    builtins._input = builtins.input
    builtins.input = myinput

    Then the prompt will be stored in builtins._input_prompt

×