This script generates all the boilerplate for a Main window class with menu, using QT and PyDev.
This script works using two json configuration files:
- vars.json
- menus.json
There are two example files in this project. Change them as you want. The explanation of the fields is as follow:
- $.main_window_class: Name of the class that will be generated (string).
- $.window: Values of the window (object).
- $.window.title: Title shown in the main window (string).
- $.window.width: Width of the window (integer).
- $.window.height: Height of the window (integer).
- $: Array with all the main options.
- $[*]: Object with the main option (the one visible in the menu bar).
- $[*].text: Visible text of the main option (string).
- $[*].options: Suboptions, nested in the main option (array).
- $[].options[].type: Type of the option. If this value is "separator", adds a separator and ignores the rest of the fields. It it's "option", the generator adds an option and uses the rest of the values. No more values are contemplated apart from this two (string).
- $[].options[].text: Text shown in the suboption (string).
- $[].options[].action: Name of the method that will be executed as callback of the option. If this methos is "exit_app" then adds the code that closes the program.
In order to run the program, fill the json files properly and simply type:
python generate-menus-class.py
This should generate the main class that will be executable.