This commit is contained in:
devdesk 2023-06-14 13:35:51 +03:00
parent 970ab2ff72
commit 2d73bf25fb
2 changed files with 23 additions and 38 deletions

View File

@ -2,14 +2,29 @@
fancy name, QL-570 text formater fancy name, QL-570 text formater
using the Brother QL family with support for linux.
label printer controled by [brother-ql](https://brother-ql.net/index.html) project
### TODO ### TODO
- use as printer - use as printer
- works, but cant detect the length of text, will output a set (page?) length - works, but cant detect the length of text, will output a set (page?) length
- fix missing font defentions - fix missing font defentions
- fail to take into account letter width - fail to take into account letter width
- set output image size as spec
```
Name Printable px Description
62 696 (62mm endless)
```
- telegram bot (!) - telegram bot (!)
## Permissions
```bash
echo 'SUBSYSTEMS=="usb", ATTRS{idVendor}=="04f9", ATTRS{idProduct}=="2028", MODE="0777"' | sudo tee /etc/udev/rules.d/52-QL-BROTHER.rules
#reload udev rules
sudo udevadm control --reload-rules && sudo udevadm trigger
```
## CLI ## CLI
`sudo brother_ql -b pyusb --model QL-570 -p usb://0x04f9:0x2028/000M12345678 print -l 62 logo.png` `sudo brother_ql -b pyusb --model QL-570 -p usb://0x04f9:0x2028/000M12345678 print -l 62 logo.png`
## python ## python
@ -29,29 +44,13 @@ then check
find ~/.config/inkscape/ -type l find ~/.config/inkscape/ -type l
``` ```
takes from the [inkscape-silhouette](https://github.com/fablabnbg/inkscape-silhouette) extension, as in, how to install. ## using ql_brother web UI
(brother_ql_web](https://github.com/pklaus/brother_ql_web.git) has a web GUI and an restAPI(!)
```bash ```bash
$ git clone https://github.com/fablabnbg/inkscape-silhouette git clone https://github.com/pklaus/brother_ql_web.git
Cloning into 'inkscape-silhouette'... cd brother_ql_web
remote: Enumerating objects: 2764, done. python -m venv venv
remote: Counting objects: 100% (795/795), done. source venv/bin/activate;
remote: Compressing objects: 100% (364/364), done. pip install -r requirements.txt
remote: Total 2764 (delta 483), reused 657 (delta 416), pack-reused 1969 ./brother_ql_web.py
Receiving objects: 100% (2764/2764), 8.53 MiB | 3.64 MiB/s, done.
Resolving deltas: 100% (1786/1786), done.
$ cd inkscape-silhouette/
$ make install-local
mkdir -p locale
mkdir -p /home/devdesk/.config/inkscape/extensions
cp -r silhouette /home/devdesk/.config/inkscape/extensions
install -m 755 *silhouette*.py /home/devdesk/.config/inkscape/extensions
install -m 644 *.inx /home/devdesk/.config/inkscape/extensions
cp -r locale /home/devdesk/.config/inkscape/extensions
mkdir -p /home/devdesk/.config/inkscape/templates
install -m 644 templates/*.svg /home/devdesk/.config/inkscape/templates
``` ```

View File

@ -21,26 +21,12 @@ class ExportAndRunScript(inkex.EffectExtension):
# Get the IDs of the selected elements # Get the IDs of the selected elements
selected_ids = ",".join(element.get('id') for element in selection.values()) selected_ids = ",".join(element.get('id') for element in selection.values())
# Convert objects to paths
self.convert_to_path(selected_ids)
# Run the Inkscape CLI command to export the selection to a PNG # Run the Inkscape CLI command to export the selection to a PNG
self.run_export_command(selected_ids, png_file_path) self.run_export_command(selected_ids, png_file_path)
# Run the bash script on the exported PNG # Run the bash script on the exported PNG
self.run_script_on_png(png_file_path) self.run_script_on_png(png_file_path)
def convert_to_path(self, selected_ids):
# Create a command that calls Inkscape's command line interface to convert objects to paths
command = [
"inkscape",
"--select={}".format(selected_ids),
"--verb=ObjectToPath",
self.options.input_file
]
# Run the command
subprocess.check_call(command)
def run_export_command(self, selected_ids, png_file_path): def run_export_command(self, selected_ids, png_file_path):
# Create a command that calls Inkscape's command line interface to export the selection to a PNG # Create a command that calls Inkscape's command line interface to export the selection to a PNG