Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Load Form Props from memory #25

Open
zwm88 opened this issue Apr 12, 2022 · 3 comments
Open

Load Form Props from memory #25

zwm88 opened this issue Apr 12, 2022 · 3 comments
Assignees
Labels
enhancement New feature or request

Comments

@zwm88
Copy link

zwm88 commented Apr 12, 2022

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.

@lmbelo lmbelo self-assigned this Apr 12, 2022
@lmbelo lmbelo added the enhancement New feature or request label Apr 12, 2022
@lmbelo
Copy link
Member

lmbelo commented Apr 12, 2022

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.

@zwm88
Copy link
Author

zwm88 commented Apr 12, 2022

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.

@lmbelo
Copy link
Member

lmbelo commented Apr 14, 2022

Thank you for your suggestion @zwm88. I will put some work on it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants