DelphiVCL4Python
DelphiVCL4Python copied to clipboard
Load Form Props from memory
Currently the LoadProps only supports loading a pydfm file. It's better to add a function to load props from a file object or a string. Therefore, we don't need to ship the pydfm file with the software release.
Well, I'm not sure if this is really useful. Having the properties configuration in a separated file makes code cleaner and it is much easier to format.
Yes, that .pydfm could be changed to a .py file which contains just a string for TForm.LoadPropsFromString(TFrmTool_UI) to use:
TfrmTool_UI =
"""
object frmTool: TfrmTool
Left = 0
Top = 0
BorderStyle = bsDialog
Caption = 'Calibration'
ClientHeight = 685
ClientWidth = 1145
Color = clBtnFace
Constraints.MinHeight = 640
Constraints.MinWidth = 1100
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
OldCreateOrder = False
Position = poScreenCenter
PixelsPerInch = 96
TextHeight = 13
end
"""
The .py file can be compiled into the release EXE by Pyinstaller. Leave no separated pydfm file that allows the end user to easily see the UI design or even change it. The Delphi4PythonExporter could be improved accordingly with such an option.
This also allows developers to hand write the UI in the code easily.
Thank you for your suggestion @zwm88. I will put some work on it.