Improvements

This commit is contained in:
Ircama
2024-08-13 18:01:12 +02:00
parent b9048b5bcd
commit 58dbd5cfd8
6 changed files with 136 additions and 72 deletions

View File

@@ -212,27 +212,21 @@ pyinstaller epson_print_conf.spec -- --default
Then run the executable file created in the *dist/* folder, which has the same options of `ui.py`.
An alternative way to create the executable file from *ui.py* without using *epson_print_conf.spec* is the following:
```bash
pyinstaller --onefile ui.py --name epson_print_conf --hidden-import babel.numbers --windowed
```
A file named *gui.py* is also included (similar to *ui.py*), which automatically loads a previously created configuration file that has to be named *printer_conf.pickle*, merging it with the program configuration. (See below the *parse_devices.py* utility.) To build the executable program with this file instead of the default *ui.py*, run the following command:
It is also possible to automatically load a previously created configuration file that has to be named *epson_print_conf.pickle*, merging it with the program configuration. (See below the *parse_devices.py* utility.) To build the executable program with this file, run the following command:
```bash
pip install pyinstaller # if not yet installed
curl -o devices.xml https://codeberg.org/attachments/147f41a3-a6ea-45f6-8c2a-25bac4495a1d
python3 parse_devices.py -a 192.168.178.29 -s XP-205 -p printer_conf.pickle # use your default IP address and printer model as default settings for the GUI
python3 parse_devices.py -a 192.168.178.29 -s XP-205 -p epson_print_conf.pickle # use your default IP address and printer model as default settings for the GUI
pyinstaller epson_print_conf.spec
```
When the build operation is completed, you can run the executable program created in the *dist/* folder. It does not have options, embeds the *printer_conf.pickle* file and starts with the default IP address and printer model defined in the build phase.
This repository includes a Windows *epson_print_conf.exe* executable file which is automatically generated by a [GitHub Action](.github/workflows/build.yml). It is packaged in a ZIP file named *epson_print_conf.zip* and uploaded into the [Releases](https://github.com/Ircama/epson_print_conf/releases/latest) folder.
When embedding *epson_print_conf.pickle*, the created program does not have options and starts with the default IP address and printer model defined in the build phase.
As mentioned in the [documentation](https://pyinstaller.org/en/stable/), PyInstaller supports Windows, MacOS X, Linux and other UNIX Operating Systems. It creates an executable file which is only compatible with the operating system that is used to build the asset.
This repository includes a Windows *epson_print_conf.exe* executable file which is automatically generated by a [GitHub Action](.github/workflows/build.yml). It is packaged in a ZIP file named *epson_print_conf.zip* and uploaded into the [Releases](https://github.com/Ircama/epson_print_conf/releases/latest) folder.
## Utilities and notes
### parse_devices.py
@@ -291,6 +285,8 @@ Generate printer configuration from devices.xml
The output is better formatted when also installing [black](https://pypi.org/project/black/).
The program does not provide *printer_head_id* and *Power off timer*.
### find_printers.py
*find_printers.py* can be executed via `python find_printers.py` and prints the list of the discovered printers to the standard output. It is internally used as a library by *ui.py*.