Jump to content

pyscripter

Members
  • Content Count

    974
  • Joined

  • Last visited

  • Days Won

    61

Everything posted by pyscripter

  1. pyscripter

    Component with sub-property event

    It works with Components if you call SetSubComponent or set csSubComponent. Then Events are displayed. e.g, So you can change TTestSub to inherit from TComponent.
  2. pyscripter

    Component with sub-property event

    You need to overwrite the TTestSub.GetOwner.
  3. This is roughly what I had in mind. Suggestions: Have one event with an Enumerated parameter TExecOutput = (eoStdout, eoStdErr) Pass to the callback only the newly added bytes in a TBytes. They can be easily converted to strings using the ISshClient encoding. Keep the output as is. The user has a choice of not providing a callback. The overhead is small.
  4. This is how it is designed to work. I will add an event that is triggered whenever output is added. Add an event to access partial output of ISshExec.Exec · Issue #20 · pyscripter/Ssh-Pascal
  5. ISshExec.Exec was substantially revised and now works in non-blocking mode. Are you using the latest source? Are you using the latest linssh2 binaries? You can execute ISshExec in a thread. Note that then it can be cancelled from the main thread using ISshExec.Cancel. Also you memory leak in TSshExec.Exec · Issue #18 · pyscripter/Ssh-Pascal has been fixed. Can you confirm that?
  6. pyscripter

    TreeView Child Node Data

    In the latest commits, I have added the ability to handle pointer fields and properties. They are converted to python integers. So you could store for example an integer to the TTreeNode.Data. You could also store pointers to python objects using ctypes. See for example the following: from ctypes import py_object, pointer, addressof, cast, POINTER # Create a py_object original = "Hello" py_obj = py_object(original) # Get its address addr = addressof(py_obj) # e.g., 0x7f8b5c403020 # Recover the py_object py_ptr = cast(addr, POINTER(py_object)) recovered_py_obj = py_ptr.contents recovered = recovered_py_obj.value print(recovered) # "Hello" print(original is recovered) # True (same object) addr is an int type (python integer) that can be stored in Delphi pointer property.
  7. pyscripter

    TreeView Child Node Data

    TTreeNode.Data is a Pointer property and WrapDelphi does not support raw pointer properties. The only pointer property supported is PPyObject. So if your wrapped class had a property declared as PPyObject it would work. This also explains the error message. To be able to use the Data property you would need to modify the TTreeNode wrapper and do some custom wrapping of the TreeNode.Data property. Alternatively you could save whatever info you need to store in a python data structure (possibly dict for easy access).
  8. pyscripter

    Rapid.Generics revamp

    @Alex7691Good work. It is useful to have a drop-in fast generics replacement. A couple of questions: Is there an impact on code size? I see a lot of code included that it is not directly related to generics. (e.g. TSyncSpinlock, TSyncLocker, TaggedPointer, TCustomObject. TLiteCustomObject etc.). Are they actually essential for the rapid collections?
  9. I am trying to link an .obj file generated using Visual Studio from C file. The C file makes Windows calls such as VirtualFree; When I try to compile the Delphi source code with {$L} directive in 32 bits Delphi complains about [dcc32 Error] ExtPCRE.pas(889): E2065 Unsatisfied forward or external declaration: '__imp__VirtualFree@12' Is there a way to resolve this without changing the C code? In 64 bits the name comes undecorated as __imp_VirtualFree and I am resolving this as: type TVirtualFree = function(lpAddress: Pointer; dwSize: SIZE_T; dwFreeType: DWORD): BOOL; stdcall; const __imp_VirtualFree: TVirtualFree = WinApi.Windows.VirtualFree; Is this correct? And a related question fpc provides for the following syntax: Var MyVar : MyType; external name ’varname’; The effect of this declaration is twofold: No space is allocated for this variable. The name of the variable used in the assembler code is varname. This is a case sensitive name, so you must be careful. Can you achieve the same somehow in Delphi?
  10. pyscripter

    TTaskDialogs not working with Delphi Styles

    I believe they do among other styles. (see images in the home page) @Carlo Barazzetta Can you enlighten us on this?
  11. pyscripter

    TTaskDialogs not working with Delphi Styles

    Good alternative styled Task Dialog implementation: EtheaDev/StyledComponents: Components similar to Delphi VCL Buttons, Toolbar, DbNavigator, BindNavigator, ButtonGroup and CategoryButtons with Custom Graphic Styles, and an advanced, full-customizable TaskDialog, also with animations!
  12. pyscripter

    TTaskDialogs not working with Delphi Styles

    [RSP-41990] Style the Windows Task dialog (Vcl) - Embarcadero Technologies
  13. Not quite. See for instance Ohh...WinUI3 is really dead! - When can we expect the announcement? · microsoft/microsoft-ui-xaml · Discussion #9417 The Microsoft strategy for GUI App development is utterly messed up: WinForms WPF Xamarin Forms UWP WinUI3 MAUI And there is no longer a GUI designer. You have to develop XAML in a text editor. Discussion: WinUI 3.0 XAML Designer · Issue #5917 · microsoft/microsoft-ui-xaml
  14. pyscripter

    GExperts for Delphi 12.3?

    FWIW, the latest version of GExperts from Experimental GExperts Version – twm's blog installs and works fine here with Delphi 12.3.
  15. Yes I do notice the difference. However I do not have 10.4 installed to compere. Delphi 12 behaves the same as Delphi 11 though.
  16. Are you using Vcl? Are you using styles? I can see that in your images the form title bars are styled differently. I don't see that in a simple dialog: Delphi 11: Client width 269, Width 285 Delphi 12: Same.
  17. pyscripter

    Delphi 12.3 is available

    Four of my reported issues were fixed in 12.3: TStackPanel spacing property is not DPI scaled - RAD Studio Service - Jira Service Management Unnecessary painting of styled scrollbars on mouse move - RAD Studio Service - Jira Service Management Memory leak when you use Vcl.IMouse - RAD Studio Service - Jira Service Management The Panning Window is not DPI scaled - RAD Studio Service - Jira Service Management Four are still open.
  18. pyscripter

    Delphi 12.3 is available

    This is the 64 bit IDE. My problem was that the Win64 platform was not available. After trying many things, I had to do a full uninstall/install to get the platform available again.
  19. pyscripter

    Delphi 12.3 is available

    After upgrading to 12.3 I do not get the Win64 platform. Only Win32. Anyone has the same issue? Any ideas how to fix it?
  20. pyscripter

    MainModule.varname is cached?

    Of course it does. What you are doing is like running the following python script: exec("a = 1; print(a)") exec("b = 1; print(a)") a is created in the first statement and still exists when the second statement is executed. but if you do exec("a = 1; print(a)", {}, {}) exec("b = 1; print(a)", {}, {}) then the second statement raises an error. ExecFile has the following signature: procedure ExecFile(const FileName: string; locals: PPyObject = nil; globals: PPyObject = nil); If you provide no arguments for locals and globals, the code is executed in the namespace of the __main__ module. If you do not want this to happen then you should provide empty dictionaries as arguments for the locals and globals parameters (or just the locals). But then MainModule.VALUE will raise an error. Example code (not tested): var Py := GetPythonEngine; var NewDict := NewPythonDict; Py.ExecFile('python1.py', ExtractPythonObjectFrom(NewDict)); var val := NewDict.GetItem("VALUE"); NewDict := NewPythonDict; Py.ExecFile('python2.py', ExtractPythonObject(NewDict)); val := NewDict.GetItem("VALUE"); // will raise an error since VALUE does not exist VarClear(NewDict);
  21. pyscripter

    MainModule.varname is cached?

    Indeed. Python variables are reference counted. As long as you keep a reference the python object it refers to is kept alive. When you have a statement like: var s:Variant :=MainModule.MYVALUE s is a custom variant that stores the python reference. The variable will be dereferenced, when s goes out of scope or you explicitly clear s (VarClear(s)).
  22. The following will not compile (error: class property accessor can be a class field or a static class method) : TTest = class private class function GetName: string; virtual; abstract; public class property Name: string read GetName; end; whilst the following does: TTest = class private class function GetName: string; virtual; abstract; public property Name: string read GetName; end; My question is that since you can have virtual class methods, why not properties that behave accordingly? In SmallTalk, the first object oriented language, you have a distinction between: instance variables (aka properties) class variables (aka class properties - one per class including subclasses) class instance variables (one per class, subclasses can change the value)
  23. pyscripter

    Virtual class methods and properties

    The issue was closed within minutes... Explanation:
  24. pyscripter

    Virtual class methods and properties

    Issue submitted: https://embt.atlassian.net/servicedesk/customer/portal/1/RSS-2959
  25. pyscripter

    Virtual class methods and properties

    I was really asking whether you see any technical reason that I am missing. Because, otherwise it is such an obvious omission.
×