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
using the Brother QL family with support for linux.
label printer controled by [brother-ql](https://brother-ql.net/index.html) project
### TODO
- use as printer
- works, but cant detect the length of text, will output a set (page?) length
- fix missing font defentions
- fail to take into account letter width
- set output image size as spec
```
Name Printable px Description
62 696 (62mm endless)
```
- 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
`sudo brother_ql -b pyusb --model QL-570 -p usb://0x04f9:0x2028/000M12345678 print -l 62 logo.png`
## python
@ -29,29 +44,13 @@ then check
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
$ git clone https://github.com/fablabnbg/inkscape-silhouette
Cloning into 'inkscape-silhouette'...
remote: Enumerating objects: 2764, done.
remote: Counting objects: 100% (795/795), done.
remote: Compressing objects: 100% (364/364), done.
remote: Total 2764 (delta 483), reused 657 (delta 416), pack-reused 1969
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
git clone https://github.com/pklaus/brother_ql_web.git
cd brother_ql_web
python -m venv venv
source venv/bin/activate;
pip install -r requirements.txt
./brother_ql_web.py
```

View File

@ -21,26 +21,12 @@ class ExportAndRunScript(inkex.EffectExtension):
# Get the IDs of the selected elements
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
self.run_export_command(selected_ids, png_file_path)
# Run the bash script on the exported PNG
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):
# Create a command that calls Inkscape's command line interface to export the selection to a PNG