Builder customisation¶
Here are Andrew’s notes:
Customising Application Builder
The Application Builder project is located in the ‘builder’ folder of the distribution. This project is used to create a new version of App Builder using an older version. The project has everything needed to develop the Builder further. The application is started as any other Jam.py application. The development process is similar to the development of a regular Jam.py application, except that all server code must be located in the task Server module. All functions in Server module that are called from client code using the server method should be registered in the register_events function at the end of the module using the register method, and server item events should be defined in this function. After making and testing changes, the “Prepare files” button is used. The application will create necessary files in the jam_files folder. If the folder does not exist, it will create one. Content of this folder should be copied to the jam folder of the Jam.py distribution package.
Accessing Application Builder app
When a web application is created with wsgi.py, the builder Task tree is created – the admin object. The admin loads the task using get_info method from the builder_structure.info file that was saved when the “Prepare files” button was clicked. This is done in the admin.py module that is located in the admin folder of the package. The task tree of the project is created when the first request is received by the web application. The task.py module from the “admin” folder of the package contains the code that creates the project Task tree. It uses the administrator user to read the data from admin.sqlite database. To speed up the process, the information from corresponding tables is loaded to dictionaries.
First, start with forking Jam.py-v7.
Next, clone your fork:
git clone https://github.com/YourGitHubName/jam-py-v7.git
and start the server:
cd jam-py-v7/builder
./server.py
Open a Web browser and enter
127.0.0.1:8080/builder.html
in the address bar. This is the application builder source. Hence, everything
displayed within the builder.html page when building the application, is a direct
result of modifying anything in here.
Open a Web browser and enter
127.0.0.1:8080
in the address bar. This is the application builder content displayed as usual for any
Jam.py application. However, it has one additional feature, the Prepare files button.
The application features and look directly depend on Jam.py installed version. No changes made within a builder will show in here if the newer run time files were not installed.
After customisation is finished, the Prepare files clicked, we copy all the
files from jam_files folder into to distribution folders:
cp -fr jam_files/* ../jam/.
On MS Windows:
xcopy jam_files\* ..\jam\. /E /H /C /I /Y
To increase the Jam.py version number, we edit below file:
vi ../jam/__init__.py
We can now install updated version as usual with the new version number.
If all good to go, commit and create a Github pull request with the changes.
For the project maintainers, to initiate Github Actions, accomodate tag number below:
git push && git tag 7.0.XX && git push --tags