qltool 0.2.6__tar.gz → 0.2.7__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {qltool-0.2.6 → qltool-0.2.7}/.bumpversion.cfg +1 -1
- qltool-0.2.7/.pi/settings.json +52 -0
- qltool-0.2.7/PKG-INFO +83 -0
- qltool-0.2.7/README.md +69 -0
- {qltool-0.2.6 → qltool-0.2.7}/README.org +5 -0
- qltool-0.2.7/fence.jsonc +175 -0
- {qltool-0.2.6 → qltool-0.2.7}/pyproject.toml +1 -1
- {qltool-0.2.6 → qltool-0.2.7}/src/qltool/client.py +4 -31
- {qltool-0.2.6 → qltool-0.2.7}/src/qltool/main.py +91 -19
- qltool-0.2.6/PKG-INFO +0 -152
- qltool-0.2.6/README.md +0 -138
- {qltool-0.2.6 → qltool-0.2.7}/.gitignore +0 -0
- {qltool-0.2.6 → qltool-0.2.7}/MANIFEST.in +0 -0
- {qltool-0.2.6 → qltool-0.2.7}/src/qltool/__init__.py +0 -0
- {qltool-0.2.6 → qltool-0.2.7}/src/qltool/data/ql570 +0 -0
- {qltool-0.2.6 → qltool-0.2.7}/src/qltool/data/ql570.c +0 -0
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
{
|
|
2
|
+
"packages": [
|
|
3
|
+
{
|
|
4
|
+
"source": "https://github.com/jaromrax/Crossbar",
|
|
5
|
+
"autoload": false,
|
|
6
|
+
"extensions": [
|
|
7
|
+
"-src/index.ts"
|
|
8
|
+
]
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
"source": "https://github.com/jaromrax/pi-advisor",
|
|
12
|
+
"autoload": false,
|
|
13
|
+
"extensions": [
|
|
14
|
+
"-dist/index.js"
|
|
15
|
+
]
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
"source": "git:github.com/jaromrax/pi-pass-secrets",
|
|
19
|
+
"autoload": false,
|
|
20
|
+
"extensions": [
|
|
21
|
+
"-index.ts"
|
|
22
|
+
]
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"source": "git:github.com/jaromrax/pi-podman-containers",
|
|
26
|
+
"autoload": false,
|
|
27
|
+
"skills": [
|
|
28
|
+
"-skills/podman-containers/SKILL.md"
|
|
29
|
+
]
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"source": "npm:pi-intercom",
|
|
33
|
+
"autoload": false,
|
|
34
|
+
"extensions": [
|
|
35
|
+
"-index.ts"
|
|
36
|
+
],
|
|
37
|
+
"skills": [
|
|
38
|
+
"-skills/pi-intercom/SKILL.md"
|
|
39
|
+
]
|
|
40
|
+
},
|
|
41
|
+
{
|
|
42
|
+
"source": "npm:trelly",
|
|
43
|
+
"autoload": false,
|
|
44
|
+
"skills": [
|
|
45
|
+
"-skills/README.md",
|
|
46
|
+
"-skills/trelly/SKILL.md",
|
|
47
|
+
"-skills/trelly-card-display.md",
|
|
48
|
+
"-skills/trelly-mcp/SKILL.md"
|
|
49
|
+
]
|
|
50
|
+
}
|
|
51
|
+
]
|
|
52
|
+
}
|
qltool-0.2.7/PKG-INFO
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: qltool
|
|
3
|
+
Version: 0.2.7
|
|
4
|
+
Summary: PRINT simple labels on ql700
|
|
5
|
+
Requires-Python: >=3.10
|
|
6
|
+
Requires-Dist: click>=8.2.1
|
|
7
|
+
Requires-Dist: console>=0.9911
|
|
8
|
+
Requires-Dist: importlib-resources>=6.5.2
|
|
9
|
+
Requires-Dist: opencv-python>=4.12.0.88
|
|
10
|
+
Requires-Dist: paho-mqtt>=2.1.0
|
|
11
|
+
Requires-Dist: pillow>=11.3.0
|
|
12
|
+
Requires-Dist: qrcode>=8.2
|
|
13
|
+
Description-Content-Type: text/markdown
|
|
14
|
+
|
|
15
|
+
# qltool 0.1.14
|
|
16
|
+
|
|
17
|
+
*tool to print some useful stuff with ql700 brother printer*
|
|
18
|
+
|
|
19
|
+
- It is just a wrapper around the great `ql570.c` of Asbjørn Sloth
|
|
20
|
+
Tønnesen, Marc Juul and Luca Zimmermann
|
|
21
|
+
|
|
22
|
+
## Installation
|
|
23
|
+
|
|
24
|
+
``` {.bash org-language="sh"}
|
|
25
|
+
pip3 install qltool
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Usage - standard print
|
|
29
|
+
|
|
30
|
+
``` {.bash org-language="sh"}
|
|
31
|
+
#---------text
|
|
32
|
+
rm /tmp/tmp_qrcode.png ; uv run src/qltool/main.py "Ahoj
|
|
33
|
+
aaa
|
|
34
|
+
456 8jgqy 789 456 456 " --font-size 55 --font-size 45
|
|
35
|
+
|
|
36
|
+
# ---- create QR
|
|
37
|
+
|
|
38
|
+
uv run src/qltool/main.py "ahoj
|
|
39
|
+
momo
|
|
40
|
+
123 456 789 jjj" -p -q
|
|
41
|
+
|
|
42
|
+
# -------- use any image/qrcode
|
|
43
|
+
uv run src/qltool/main.py "Užaj jetů" --qr /tmp/baba.png
|
|
44
|
+
|
|
45
|
+
uv run src/qltool/main.py "Už je tuná" --qr /tmp/baba.png -p
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Using mqtt client
|
|
49
|
+
|
|
50
|
+
`qltool_client`
|
|
51
|
+
|
|
52
|
+
``` {.bash org-language="sh"}
|
|
53
|
+
# DO
|
|
54
|
+
qltool_client # somewhere...
|
|
55
|
+
### examples:
|
|
56
|
+
export D=`date +"%H:%M:%S"`; mosquitto_pub -t qltool/print -m "hoho $D -q -p"
|
|
57
|
+
|
|
58
|
+
# blocking...
|
|
59
|
+
mosquitto_pub -t qltool/print -m "hoho secondline thirdline -q "
|
|
60
|
+
|
|
61
|
+
# NEVER USE THIS:
|
|
62
|
+
watch -n 10 'export D=`date +"%H:%M:%S"`; mosquitto_pub -t qltool/print -m "\"hoho asdas\" \"jeli $D\" -q "'
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Org-mode inventory - broken now
|
|
66
|
+
|
|
67
|
+
If this function is somewhere in the `.emacs` configfiles ...
|
|
68
|
+
|
|
69
|
+
It selects two fields fromthe TABLE and puts -q option.
|
|
70
|
+
|
|
71
|
+
You point to a line of a table and `c-c q`{.verbatim} or
|
|
72
|
+
`c-c w`{.verbatim} will view/print the code for inventory.
|
|
73
|
+
|
|
74
|
+
whatever id name owner location
|
|
75
|
+
---------- ------------- --------------------------- ------- ----------
|
|
76
|
+
123 D4-12345678 najaka blbost z inventury Pepa Home
|
|
77
|
+
|
|
78
|
+
and this is run
|
|
79
|
+
`./bin_qltool.py "id: D4-12345678; name: najaka blbost z inventury owner:Pepa " -q`
|
|
80
|
+
|
|
81
|
+
\## LAST DEVELOPMENTS IN BANNER MODE mosquitto~pub~ -t qltool/print -m
|
|
82
|
+
\'KLADIVA INBUS --banner --font-size 220 -p\' uv run src/qltool/main.py
|
|
83
|
+
\$\'KLADIVA`\nINBUS`{=latex}\' --banner --font-size 220
|
qltool-0.2.7/README.md
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
# qltool 0.1.14
|
|
2
|
+
|
|
3
|
+
*tool to print some useful stuff with ql700 brother printer*
|
|
4
|
+
|
|
5
|
+
- It is just a wrapper around the great `ql570.c` of Asbjørn Sloth
|
|
6
|
+
Tønnesen, Marc Juul and Luca Zimmermann
|
|
7
|
+
|
|
8
|
+
## Installation
|
|
9
|
+
|
|
10
|
+
``` {.bash org-language="sh"}
|
|
11
|
+
pip3 install qltool
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Usage - standard print
|
|
15
|
+
|
|
16
|
+
``` {.bash org-language="sh"}
|
|
17
|
+
#---------text
|
|
18
|
+
rm /tmp/tmp_qrcode.png ; uv run src/qltool/main.py "Ahoj
|
|
19
|
+
aaa
|
|
20
|
+
456 8jgqy 789 456 456 " --font-size 55 --font-size 45
|
|
21
|
+
|
|
22
|
+
# ---- create QR
|
|
23
|
+
|
|
24
|
+
uv run src/qltool/main.py "ahoj
|
|
25
|
+
momo
|
|
26
|
+
123 456 789 jjj" -p -q
|
|
27
|
+
|
|
28
|
+
# -------- use any image/qrcode
|
|
29
|
+
uv run src/qltool/main.py "Užaj jetů" --qr /tmp/baba.png
|
|
30
|
+
|
|
31
|
+
uv run src/qltool/main.py "Už je tuná" --qr /tmp/baba.png -p
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Using mqtt client
|
|
35
|
+
|
|
36
|
+
`qltool_client`
|
|
37
|
+
|
|
38
|
+
``` {.bash org-language="sh"}
|
|
39
|
+
# DO
|
|
40
|
+
qltool_client # somewhere...
|
|
41
|
+
### examples:
|
|
42
|
+
export D=`date +"%H:%M:%S"`; mosquitto_pub -t qltool/print -m "hoho $D -q -p"
|
|
43
|
+
|
|
44
|
+
# blocking...
|
|
45
|
+
mosquitto_pub -t qltool/print -m "hoho secondline thirdline -q "
|
|
46
|
+
|
|
47
|
+
# NEVER USE THIS:
|
|
48
|
+
watch -n 10 'export D=`date +"%H:%M:%S"`; mosquitto_pub -t qltool/print -m "\"hoho asdas\" \"jeli $D\" -q "'
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Org-mode inventory - broken now
|
|
52
|
+
|
|
53
|
+
If this function is somewhere in the `.emacs` configfiles ...
|
|
54
|
+
|
|
55
|
+
It selects two fields fromthe TABLE and puts -q option.
|
|
56
|
+
|
|
57
|
+
You point to a line of a table and `c-c q`{.verbatim} or
|
|
58
|
+
`c-c w`{.verbatim} will view/print the code for inventory.
|
|
59
|
+
|
|
60
|
+
whatever id name owner location
|
|
61
|
+
---------- ------------- --------------------------- ------- ----------
|
|
62
|
+
123 D4-12345678 najaka blbost z inventury Pepa Home
|
|
63
|
+
|
|
64
|
+
and this is run
|
|
65
|
+
`./bin_qltool.py "id: D4-12345678; name: najaka blbost z inventury owner:Pepa " -q`
|
|
66
|
+
|
|
67
|
+
\## LAST DEVELOPMENTS IN BANNER MODE mosquitto~pub~ -t qltool/print -m
|
|
68
|
+
\'KLADIVA INBUS --banner --font-size 220 -p\' uv run src/qltool/main.py
|
|
69
|
+
\$\'KLADIVA`\nINBUS`{=latex}\' --banner --font-size 220
|
|
@@ -147,3 +147,8 @@ You point to a line of a table and =c-c q= or =c-c w= will view/print the code f
|
|
|
147
147
|
|
|
148
148
|
and this is run
|
|
149
149
|
~./bin_qltool.py "id: D4-12345678; name: najaka blbost z inventury owner:Pepa " -q~
|
|
150
|
+
|
|
151
|
+
|
|
152
|
+
## LAST DEVELOPMENTS IN BANNER MODE
|
|
153
|
+
mosquitto_pub -t qltool/print -m 'KLADIVA INBUS --banner --font-size 220 -p'
|
|
154
|
+
uv run src/qltool/main.py $'KLADIVA\nINBUS' --banner --font-size 220
|
qltool-0.2.7/fence.jsonc
ADDED
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
// Starter config generated by `fence config init`; this file extends "code".
|
|
2
|
+
// Rules from "code" are inherited and not shown below.
|
|
3
|
+
// Add your project-specific overrides in this file.
|
|
4
|
+
// Run `fence --list-templates` to see available templates.
|
|
5
|
+
// Configuration reference: https://github.com/fencesandbox/fence/blob/main/docs/configuration.md
|
|
6
|
+
{
|
|
7
|
+
"network": {
|
|
8
|
+
"deniedDomains": ["lupa.cz"],
|
|
9
|
+
"allowedDomains": ["*"],
|
|
10
|
+
"allowLocalOutbound": true,
|
|
11
|
+
"allowLocalOutboundPorts": [3128, 1080],
|
|
12
|
+
"httpProxyPort":3128,
|
|
13
|
+
"socksProxyPort":1080
|
|
14
|
+
},
|
|
15
|
+
"filesystem": {
|
|
16
|
+
"defaultDenyRead": true,
|
|
17
|
+
"allowRead": [
|
|
18
|
+
"~/DATA/pv_live_rec/logs/*",
|
|
19
|
+
".",
|
|
20
|
+
"./**",
|
|
21
|
+
"/usr",
|
|
22
|
+
"/lib",
|
|
23
|
+
"/lib64",
|
|
24
|
+
"/bin",
|
|
25
|
+
"/tmp/**",
|
|
26
|
+
"/var/log/lxini/**",
|
|
27
|
+
"~/.tmux.conf",
|
|
28
|
+
"~/.bashrc",
|
|
29
|
+
"~/.password-store/**",
|
|
30
|
+
"~/.gnupg",
|
|
31
|
+
"~/.gnupg/*",
|
|
32
|
+
"~/.gnupg/**",
|
|
33
|
+
"/run/user/1000/gnupg/**",
|
|
34
|
+
"/run/user/1000/gnupg/**",
|
|
35
|
+
"~/.local/bin/env",
|
|
36
|
+
"~/.npm-global/lib/node_modules/**",
|
|
37
|
+
"~/.npm-global/bin/**",
|
|
38
|
+
"~/44_lxc/**"
|
|
39
|
+
],
|
|
40
|
+
"allowWrite": [
|
|
41
|
+
".",
|
|
42
|
+
// Temp files
|
|
43
|
+
"/tmp",
|
|
44
|
+
|
|
45
|
+
// Local cache, needed by tools like `uv`
|
|
46
|
+
"~/.cache/**",
|
|
47
|
+
|
|
48
|
+
// Claude Code
|
|
49
|
+
"~/.claude*",
|
|
50
|
+
"~/.claude/**",
|
|
51
|
+
|
|
52
|
+
// Amp
|
|
53
|
+
"~/.amp",
|
|
54
|
+
|
|
55
|
+
// Codex
|
|
56
|
+
"~/.codex/**",
|
|
57
|
+
|
|
58
|
+
// Cursor
|
|
59
|
+
"~/.cursor/**",
|
|
60
|
+
|
|
61
|
+
// OpenCode
|
|
62
|
+
"~/.opencode/**",
|
|
63
|
+
"~/.local/state/**",
|
|
64
|
+
|
|
65
|
+
// Gemini CLI
|
|
66
|
+
"~/.gemini/**",
|
|
67
|
+
|
|
68
|
+
// Factory CLI (droid)
|
|
69
|
+
"~/.factory/**",
|
|
70
|
+
|
|
71
|
+
// Pi
|
|
72
|
+
"~/.pi/**",
|
|
73
|
+
|
|
74
|
+
// Copilot
|
|
75
|
+
"~/.copilot/**",
|
|
76
|
+
|
|
77
|
+
// Kiro CLI
|
|
78
|
+
"~/.kiro/**",
|
|
79
|
+
"~/Library/Application Support/kiro-cli/**",
|
|
80
|
+
|
|
81
|
+
// Package manager caches
|
|
82
|
+
"~/.npm/_cacache",
|
|
83
|
+
"~/.npm/_npx",
|
|
84
|
+
"~/.cache",
|
|
85
|
+
"~/.bun/**",
|
|
86
|
+
|
|
87
|
+
// Cargo cache (Rust, used by Codex)
|
|
88
|
+
"~/.cargo/registry/**",
|
|
89
|
+
"~/.cargo/git/**",
|
|
90
|
+
"~/.cargo/.package-cache",
|
|
91
|
+
|
|
92
|
+
// Shell completion cache
|
|
93
|
+
"~/.zcompdump*",
|
|
94
|
+
|
|
95
|
+
// XDG directories for app configs/data
|
|
96
|
+
"~/.local/share/**",
|
|
97
|
+
"~/.config/**",
|
|
98
|
+
"~/.gnupg",
|
|
99
|
+
"~/.gnupg/*",
|
|
100
|
+
"~/.gnupg/**",
|
|
101
|
+
"/run/user/1000/gnupg/**",
|
|
102
|
+
"/run/user/1000/gnupg/**",
|
|
103
|
+
"./**"
|
|
104
|
+
],
|
|
105
|
+
"denyRead": [
|
|
106
|
+
// SSH private keys and config
|
|
107
|
+
"~/.ssh/id_*",
|
|
108
|
+
"~/.ssh/config",
|
|
109
|
+
"~/.ssh/*.pem",
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
// Cloud provider credentials
|
|
113
|
+
"~/.aws/**",
|
|
114
|
+
"~/.config/gcloud/**",
|
|
115
|
+
"~/.kube/**",
|
|
116
|
+
|
|
117
|
+
// Docker config (may contain registry auth)
|
|
118
|
+
"~/.docker/**",
|
|
119
|
+
|
|
120
|
+
// Package manager auth tokens
|
|
121
|
+
"~/.pypirc",
|
|
122
|
+
"~/.netrc",
|
|
123
|
+
"~/.git-credentials",
|
|
124
|
+
"~/.cargo/credentials",
|
|
125
|
+
"~/.cargo/credentials.toml"
|
|
126
|
+
]
|
|
127
|
+
},
|
|
128
|
+
"command": {
|
|
129
|
+
"useDefaults": true,
|
|
130
|
+
"deny": [
|
|
131
|
+
// Git commands that modify remote state
|
|
132
|
+
"git push",
|
|
133
|
+
"git reset",
|
|
134
|
+
"git clean",
|
|
135
|
+
"git checkout --",
|
|
136
|
+
"git rebase",
|
|
137
|
+
"git merge",
|
|
138
|
+
|
|
139
|
+
// Package publishing commands
|
|
140
|
+
"npm publish",
|
|
141
|
+
"pnpm publish",
|
|
142
|
+
"yarn publish",
|
|
143
|
+
"cargo publish",
|
|
144
|
+
"twine upload",
|
|
145
|
+
"gem push",
|
|
146
|
+
|
|
147
|
+
// Privilege escalation
|
|
148
|
+
"sudo",
|
|
149
|
+
|
|
150
|
+
// GitHub CLI commands that modify remote state
|
|
151
|
+
"gh pr create",
|
|
152
|
+
"gh pr merge",
|
|
153
|
+
"gh pr close",
|
|
154
|
+
"gh pr reopen",
|
|
155
|
+
"gh pr review",
|
|
156
|
+
"gh pr comment",
|
|
157
|
+
"gh release create",
|
|
158
|
+
"gh release delete",
|
|
159
|
+
"gh repo create",
|
|
160
|
+
"gh repo fork",
|
|
161
|
+
"gh repo delete",
|
|
162
|
+
"gh issue create",
|
|
163
|
+
"gh issue close",
|
|
164
|
+
"gh issue comment",
|
|
165
|
+
"gh gist create",
|
|
166
|
+
"gh workflow run",
|
|
167
|
+
"gh api",
|
|
168
|
+
"gh auth login",
|
|
169
|
+
"gh secret set",
|
|
170
|
+
"gh secret delete",
|
|
171
|
+
"gh variable set",
|
|
172
|
+
"gh variable delete"
|
|
173
|
+
]
|
|
174
|
+
}
|
|
175
|
+
}
|
|
@@ -42,37 +42,10 @@ def on_message(client, userdata, msg):
|
|
|
42
42
|
|
|
43
43
|
text = data.decode("utf8")
|
|
44
44
|
|
|
45
|
-
|
|
46
|
-
print(
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
Q = False
|
|
50
|
-
P = False
|
|
51
|
-
lines = []
|
|
52
|
-
for i, obj in enumerate(blocks):
|
|
53
|
-
|
|
54
|
-
print(f"#{i}# {obj}")
|
|
55
|
-
|
|
56
|
-
if obj.find("-") < 0:
|
|
57
|
-
lines.append(obj)
|
|
58
|
-
elif obj == "-q":
|
|
59
|
-
print("create qr")
|
|
60
|
-
Q = True
|
|
61
|
-
lines.append("-q")
|
|
62
|
-
elif obj == "-p":
|
|
63
|
-
print("print")
|
|
64
|
-
lines.append("-p")
|
|
65
|
-
P = True
|
|
66
|
-
elif obj == "--font-size":
|
|
67
|
-
FS = obj[i + 1]
|
|
68
|
-
|
|
69
|
-
if FS is None:
|
|
70
|
-
FS = 72
|
|
71
|
-
|
|
72
|
-
print( f" {lines}, {FS}, create qr ={Q}, print {P}")
|
|
73
|
-
#cli( lines, font_size=FS, qr_create=Q, do_print=P)
|
|
74
|
-
#cli( lines, qr_create=Q, do_print=P)
|
|
75
|
-
res = call_with_runner( lines )
|
|
45
|
+
args = shlex.split(text)
|
|
46
|
+
print(args)
|
|
47
|
+
|
|
48
|
+
res = call_with_runner(args)
|
|
76
49
|
for i in res:
|
|
77
50
|
print(i)
|
|
78
51
|
print("")
|
|
@@ -80,11 +80,71 @@ def get_data_path():
|
|
|
80
80
|
# =====================================================================
|
|
81
81
|
#
|
|
82
82
|
# ----------------------------------------------------------------------
|
|
83
|
-
def
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
83
|
+
def _read(f):
|
|
84
|
+
try:
|
|
85
|
+
with open(f) as fh:
|
|
86
|
+
return fh.read().strip()
|
|
87
|
+
except Exception:
|
|
88
|
+
return ""
|
|
89
|
+
|
|
90
|
+
def list_lp_candidates():
|
|
91
|
+
"""Find /dev/usb/lp* candidates, enriched with USB VID/PID via sysfs.
|
|
92
|
+
Returns list of dicts: {dev, name, vid, pid, manufacturer, product}.
|
|
93
|
+
Works even when /dev/usb is invisible but /sys/class/usbmisc is not."""
|
|
94
|
+
names = {}
|
|
95
|
+
for p in glob.glob("/sys/class/usbmisc/lp*"):
|
|
96
|
+
names[os.path.basename(p)] = p
|
|
97
|
+
for p in glob.glob("/dev/usb/lp*"):
|
|
98
|
+
names.setdefault(os.path.basename(p), p)
|
|
99
|
+
out = []
|
|
100
|
+
for name in sorted(names):
|
|
101
|
+
sysfs = f"/sys/class/usbmisc/{name}"
|
|
102
|
+
base = f"{sysfs}/device/.."
|
|
103
|
+
out.append({
|
|
104
|
+
"dev": f"/dev/usb/{name}",
|
|
105
|
+
"name": name,
|
|
106
|
+
"vid": _read(f"{base}/idVendor").lower(),
|
|
107
|
+
"pid": _read(f"{base}/idProduct").lower(),
|
|
108
|
+
"manufacturer": _read(f"{base}/manufacturer"),
|
|
109
|
+
"product": _read(f"{base}/product"),
|
|
110
|
+
})
|
|
111
|
+
return out
|
|
112
|
+
|
|
113
|
+
def check_lpx(prefer_vid="04f9"):
|
|
114
|
+
"""Auto-detect printer device. Prefers Brother (VID 04f9), else single/first."""
|
|
115
|
+
cands = list_lp_candidates()
|
|
116
|
+
if not cands:
|
|
117
|
+
raise RuntimeError(
|
|
118
|
+
"No LP device found (checked /dev/usb/lp* + /sys/class/usbmisc/lp*). "
|
|
119
|
+
"The image was created OK - only the printer device is missing. "
|
|
120
|
+
"Try: ls -l /dev/usb/ ; lsusb -d 04f9: ; "
|
|
121
|
+
"unplug/replug + power on the printer, then "
|
|
122
|
+
"sudo modprobe usblp && ls -l /dev/usb/lp*. "
|
|
123
|
+
"If the node appears under another name, pass it with -d/--device."
|
|
124
|
+
)
|
|
125
|
+
if len(cands) == 1:
|
|
126
|
+
c = cands[0]
|
|
127
|
+
print(f"i... auto-detected printer: {c['dev']} "
|
|
128
|
+
f"({c['manufacturer']} {c['product']} {c['vid']}:{c['pid']})".strip())
|
|
129
|
+
return c["dev"]
|
|
130
|
+
# multiple: prefer Brother VID (covers QL-500/570/700/800/1100...)
|
|
131
|
+
if prefer_vid:
|
|
132
|
+
matches = [c for c in cands if c["vid"] == prefer_vid.lower()]
|
|
133
|
+
if len(matches) == 1:
|
|
134
|
+
c = matches[0]
|
|
135
|
+
print(f"i... auto-detected Brother printer: {c['dev']} "
|
|
136
|
+
f"({c['manufacturer']} {c['product']} {c['vid']}:{c['pid']})".strip())
|
|
137
|
+
return c["dev"]
|
|
138
|
+
if len(matches) > 1:
|
|
139
|
+
lst = ", ".join(m["dev"] for m in matches)
|
|
140
|
+
print(f"W... multiple Brother printers ({lst}), using {matches[0]['dev']} - "
|
|
141
|
+
f"override with -d/--device")
|
|
142
|
+
return matches[0]["dev"]
|
|
143
|
+
lst = ", ".join(f"{c['dev']} [{c['manufacturer']} {c['product']} "
|
|
144
|
+
f"{c['vid']}:{c['pid']}]".strip() for c in cands)
|
|
145
|
+
print(f"W... multiple LP devices ({lst}), using {cands[0]['dev']} - "
|
|
146
|
+
f"override with -d/--device")
|
|
147
|
+
return cands[0]["dev"]
|
|
88
148
|
|
|
89
149
|
# =====================================================================
|
|
90
150
|
#
|
|
@@ -217,14 +277,14 @@ def rotate_mono_90(img, clockwise=True):
|
|
|
217
277
|
# =====================================================================
|
|
218
278
|
#
|
|
219
279
|
# ----------------------------------------------------------------------
|
|
220
|
-
def make_banner_image(
|
|
280
|
+
def make_banner_image(lines, paper_width=714, font_size=None, pad=13):
|
|
221
281
|
"""
|
|
222
282
|
Create a banner image with text running along the paper length.
|
|
223
283
|
|
|
224
284
|
Creates a horizontal text image with dimensions (text_length x 714).
|
|
225
285
|
This is NOT rotated - sent to printer as-is so text prints along paper length.
|
|
226
286
|
|
|
227
|
-
-
|
|
287
|
+
- lines: one or more strings stacked vertically
|
|
228
288
|
- paper_width: width of the paper (714px for 62mm) - used as height here
|
|
229
289
|
- font_size: font size (uses CLI font_size or default)
|
|
230
290
|
- pad: padding around text
|
|
@@ -238,14 +298,25 @@ def make_banner_image(text, paper_width=714, font_size=None, pad=13):
|
|
|
238
298
|
font = ImageFont.load_default()
|
|
239
299
|
|
|
240
300
|
PAD = int((FSIZ / 36) * pad)
|
|
301
|
+
|
|
302
|
+
if isinstance(lines, str):
|
|
303
|
+
lines = lines.split("\n")
|
|
304
|
+
lines = [line for line in lines if line != ""]
|
|
305
|
+
if not lines:
|
|
306
|
+
raise ValueError("Provide at least 1 line.")
|
|
241
307
|
|
|
242
308
|
# Measure the text
|
|
243
309
|
tmp = Image.new("L", (10000, 1000), 255)
|
|
244
310
|
draw_tmp = ImageDraw.Draw(tmp)
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
311
|
+
line_sizes = []
|
|
312
|
+
for line in lines:
|
|
313
|
+
bbox = draw_tmp.textbbox((0, 0), line, font=font)
|
|
314
|
+
line_sizes.append((bbox[2] - bbox[0], bbox[3] - bbox[1]))
|
|
315
|
+
|
|
316
|
+
text_width = max(w for w, _ in line_sizes)
|
|
317
|
+
spacing = int(0.2 * (line_sizes[0][1] if line_sizes else 12)) or 4
|
|
318
|
+
text_height = sum(h for _, h in line_sizes) + spacing * (len(lines) - 1)
|
|
319
|
+
print(f"D... Banner text measurements: text_width={text_width}, text_height={text_height}, lines={len(lines)}, PAD={PAD}")
|
|
249
320
|
|
|
250
321
|
# Create horizontal text image: width = text length + padding, height = paper width
|
|
251
322
|
# Banners are NOT rotated - they are sent to printer as-is with height=714
|
|
@@ -256,11 +327,12 @@ def make_banner_image(text, paper_width=714, font_size=None, pad=13):
|
|
|
256
327
|
im = Image.new("RGB", (img_width, img_height), "white")
|
|
257
328
|
draw = ImageDraw.Draw(im)
|
|
258
329
|
|
|
259
|
-
# Center the text vertically
|
|
260
|
-
x = PAD
|
|
330
|
+
# Center the text block vertically and each line horizontally.
|
|
261
331
|
y = (img_height - text_height) // 2
|
|
262
|
-
|
|
263
|
-
|
|
332
|
+
for (line_width, line_height), line in zip(line_sizes, lines):
|
|
333
|
+
x = PAD + max((text_width - line_width) // 2, 0)
|
|
334
|
+
draw.text((x, y), line, font=font, fill=0)
|
|
335
|
+
y += line_height + spacing
|
|
264
336
|
|
|
265
337
|
return im
|
|
266
338
|
|
|
@@ -407,7 +479,7 @@ def make_bw_text_with_qr(lines,
|
|
|
407
479
|
@click.version_option(version("qltool"), prog_name="qltool")
|
|
408
480
|
@click.argument("lines", nargs=-1, required=True)
|
|
409
481
|
@click.option("-p", "--print", "do_print", is_flag=True, default=False, help="Send to printer (calls ql570).")
|
|
410
|
-
@click.option("-d", "--device", "device", default=None, help="Printer device (
|
|
482
|
+
@click.option("-d", "--device", "device", default=None, help="Printer device (default: auto-detect Brother /dev/usb/lp*).")
|
|
411
483
|
@click.option("-f", "--format", "fmt", default=62, help="Format code for ql570 (default 62 at the width of 714).")
|
|
412
484
|
@click.option("--width", default=714, show_default=True, help="Total image width.")
|
|
413
485
|
@click.option("--gray", "gray", default=50, show_default=True, help="Gray bias percent (0..100), default 50.")
|
|
@@ -463,9 +535,9 @@ def cli(lines, do_print, device, fmt, width, gray, font_size, qr_path, qr_create
|
|
|
463
535
|
|
|
464
536
|
im = None
|
|
465
537
|
if banner:
|
|
466
|
-
# Banner mode:
|
|
467
|
-
|
|
468
|
-
im = make_banner_image(
|
|
538
|
+
# Banner mode: text runs along paper length, with optional stacked lines.
|
|
539
|
+
banner_lines = lines[0].split("\n")
|
|
540
|
+
im = make_banner_image(banner_lines, paper_width=714, font_size=font_size)
|
|
469
541
|
print(f"D... Banner image size: {im.size}")
|
|
470
542
|
elif use_qr_version:
|
|
471
543
|
im = make_bw_text_with_qr(list(lines), my_qr_path, width=714, font_size=font_size)
|
qltool-0.2.6/PKG-INFO
DELETED
|
@@ -1,152 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.4
|
|
2
|
-
Name: qltool
|
|
3
|
-
Version: 0.2.6
|
|
4
|
-
Summary: PRINT simple labels on ql700
|
|
5
|
-
Requires-Python: >=3.10
|
|
6
|
-
Requires-Dist: click>=8.2.1
|
|
7
|
-
Requires-Dist: console>=0.9911
|
|
8
|
-
Requires-Dist: importlib-resources>=6.5.2
|
|
9
|
-
Requires-Dist: opencv-python>=4.12.0.88
|
|
10
|
-
Requires-Dist: paho-mqtt>=2.1.0
|
|
11
|
-
Requires-Dist: pillow>=11.3.0
|
|
12
|
-
Requires-Dist: qrcode>=8.2
|
|
13
|
-
Description-Content-Type: text/markdown
|
|
14
|
-
|
|
15
|
-
# qltool 0.2.4
|
|
16
|
-
|
|
17
|
-
*Tool to print labels with Brother QL-700/QL-570 label printer*
|
|
18
|
-
|
|
19
|
-
A wrapper around the excellent `ql570.c` by Asbjørn Sloth Tønnesen, Marc Juul and Luca Zimmermann.
|
|
20
|
-
|
|
21
|
-
## Features
|
|
22
|
-
|
|
23
|
-
- Print text labels (1-3 lines)
|
|
24
|
-
- Print QR codes with text
|
|
25
|
-
- Print banners (text along paper length)
|
|
26
|
-
- Custom font sizes
|
|
27
|
-
- MQTT client for remote printing
|
|
28
|
-
- Preview before printing
|
|
29
|
-
|
|
30
|
-
## Installation
|
|
31
|
-
|
|
32
|
-
Using `uv` (recommended):
|
|
33
|
-
|
|
34
|
-
```bash
|
|
35
|
-
uv pip install -e .
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
Or with pip:
|
|
39
|
-
|
|
40
|
-
```bash
|
|
41
|
-
pip3 install qltool
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
## Usage
|
|
45
|
-
|
|
46
|
-
### Standard Label Print
|
|
47
|
-
|
|
48
|
-
Print 1-3 lines of text:
|
|
49
|
-
|
|
50
|
-
```bash
|
|
51
|
-
# Preview only
|
|
52
|
-
uv run src/qltool/main.py "Line 1" "Line 2" "Line 3" --font-size 40
|
|
53
|
-
|
|
54
|
-
# Print with specific font size
|
|
55
|
-
uv run src/qltool/main.py "Hello World" "Second line" -p --font-size 55
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
### QR Code Labels
|
|
59
|
-
|
|
60
|
-
```bash
|
|
61
|
-
# Generate and print QR code with text
|
|
62
|
-
uv run src/qltool/main.py "Item: 12345" "Location: Office" -q -p
|
|
63
|
-
|
|
64
|
-
# Use existing QR image
|
|
65
|
-
uv run src/qltool/main.py "Scan me" --qr /path/to/qrcode.png -p
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
### Banner Mode (Text along paper length)
|
|
69
|
-
|
|
70
|
-
```bash
|
|
71
|
-
# Preview banner
|
|
72
|
-
uv run src/qltool/main.py "Long text banner" --banner --font-size 40
|
|
73
|
-
|
|
74
|
-
# Print banner
|
|
75
|
-
uv run src/qltool/main.py "STS Chvojkovice-Brod" --banner --font-size 40 -p
|
|
76
|
-
```
|
|
77
|
-
|
|
78
|
-
### Command Options
|
|
79
|
-
|
|
80
|
-
- `-p, --print` - Send to printer (without this, shows preview)
|
|
81
|
-
- `-q, --qr` - Generate QR code
|
|
82
|
-
- `--qr PATH` - Use existing QR image
|
|
83
|
-
- `--banner` - Create banner (text along paper length)
|
|
84
|
-
- `--font-size N` - Set font size (default: 72)
|
|
85
|
-
- `--width N` - Set image width in pixels (default: 714 for 62mm tape)
|
|
86
|
-
- `--gray N` - Gray bias 0-100 (default: 50)
|
|
87
|
-
- `-d, --device` - Specify printer device (default: auto-detect /dev/usb/lp*)
|
|
88
|
-
|
|
89
|
-
## MQTT Client
|
|
90
|
-
|
|
91
|
-
Run the MQTT client for remote printing:
|
|
92
|
-
|
|
93
|
-
```bash
|
|
94
|
-
qltool_client
|
|
95
|
-
```
|
|
96
|
-
|
|
97
|
-
Send print jobs via MQTT:
|
|
98
|
-
|
|
99
|
-
```bash
|
|
100
|
-
# Simple print
|
|
101
|
-
mosquitto_pub -t qltool/print -m "Hello World -p"
|
|
102
|
-
|
|
103
|
-
# With QR code
|
|
104
|
-
mosquitto_pub -t qltool/print -m "Inventory Item -q -p"
|
|
105
|
-
|
|
106
|
-
# Banner
|
|
107
|
-
mosquitto_pub -t qltool/print -m "Long banner text --banner -p"
|
|
108
|
-
```
|
|
109
|
-
|
|
110
|
-
## Development
|
|
111
|
-
|
|
112
|
-
Run directly from source:
|
|
113
|
-
|
|
114
|
-
```bash
|
|
115
|
-
# Preview
|
|
116
|
-
uv run src/qltool/main.py "Test text" --font-size 40
|
|
117
|
-
|
|
118
|
-
# Print
|
|
119
|
-
uv run src/qltool/main.py "Test text" --font-size 40 -p
|
|
120
|
-
```
|
|
121
|
-
|
|
122
|
-
## Requirements
|
|
123
|
-
|
|
124
|
-
- Brother QL-700 or QL-570 printer
|
|
125
|
-
- User must be in `lp` group for printer access
|
|
126
|
-
- Linux with USB lp device support (`/dev/usb/lp*`)
|
|
127
|
-
|
|
128
|
-
## Org-mode Integration (Inventory)
|
|
129
|
-
|
|
130
|
-
For Emacs org-mode table integration:
|
|
131
|
-
|
|
132
|
-
```elisp
|
|
133
|
-
;; Add to .emacs
|
|
134
|
-
(defun print-inventory-item ()
|
|
135
|
-
"Print current org table row as label"
|
|
136
|
-
(interactive)
|
|
137
|
-
;; Your implementation here
|
|
138
|
-
)
|
|
139
|
-
```
|
|
140
|
-
|
|
141
|
-
Example table format:
|
|
142
|
-
|
|
143
|
-
| ID | Name | Owner | Location |
|
|
144
|
-
|-------------|-----------------------------|-------|----------|
|
|
145
|
-
| D4-12345678 | Sample inventory item | Pepa | Home |
|
|
146
|
-
|
|
147
|
-
The tool can extract ID and name fields to generate QR-coded inventory labels.
|
|
148
|
-
|
|
149
|
-
## Credits
|
|
150
|
-
|
|
151
|
-
- `ql570.c` driver by Asbjørn Sloth Tønnesen, Marc Juul and Luca Zimmermann
|
|
152
|
-
- Built with Python, Click, Pillow, and OpenCV
|
qltool-0.2.6/README.md
DELETED
|
@@ -1,138 +0,0 @@
|
|
|
1
|
-
# qltool 0.2.4
|
|
2
|
-
|
|
3
|
-
*Tool to print labels with Brother QL-700/QL-570 label printer*
|
|
4
|
-
|
|
5
|
-
A wrapper around the excellent `ql570.c` by Asbjørn Sloth Tønnesen, Marc Juul and Luca Zimmermann.
|
|
6
|
-
|
|
7
|
-
## Features
|
|
8
|
-
|
|
9
|
-
- Print text labels (1-3 lines)
|
|
10
|
-
- Print QR codes with text
|
|
11
|
-
- Print banners (text along paper length)
|
|
12
|
-
- Custom font sizes
|
|
13
|
-
- MQTT client for remote printing
|
|
14
|
-
- Preview before printing
|
|
15
|
-
|
|
16
|
-
## Installation
|
|
17
|
-
|
|
18
|
-
Using `uv` (recommended):
|
|
19
|
-
|
|
20
|
-
```bash
|
|
21
|
-
uv pip install -e .
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
Or with pip:
|
|
25
|
-
|
|
26
|
-
```bash
|
|
27
|
-
pip3 install qltool
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
## Usage
|
|
31
|
-
|
|
32
|
-
### Standard Label Print
|
|
33
|
-
|
|
34
|
-
Print 1-3 lines of text:
|
|
35
|
-
|
|
36
|
-
```bash
|
|
37
|
-
# Preview only
|
|
38
|
-
uv run src/qltool/main.py "Line 1" "Line 2" "Line 3" --font-size 40
|
|
39
|
-
|
|
40
|
-
# Print with specific font size
|
|
41
|
-
uv run src/qltool/main.py "Hello World" "Second line" -p --font-size 55
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
### QR Code Labels
|
|
45
|
-
|
|
46
|
-
```bash
|
|
47
|
-
# Generate and print QR code with text
|
|
48
|
-
uv run src/qltool/main.py "Item: 12345" "Location: Office" -q -p
|
|
49
|
-
|
|
50
|
-
# Use existing QR image
|
|
51
|
-
uv run src/qltool/main.py "Scan me" --qr /path/to/qrcode.png -p
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
### Banner Mode (Text along paper length)
|
|
55
|
-
|
|
56
|
-
```bash
|
|
57
|
-
# Preview banner
|
|
58
|
-
uv run src/qltool/main.py "Long text banner" --banner --font-size 40
|
|
59
|
-
|
|
60
|
-
# Print banner
|
|
61
|
-
uv run src/qltool/main.py "STS Chvojkovice-Brod" --banner --font-size 40 -p
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
### Command Options
|
|
65
|
-
|
|
66
|
-
- `-p, --print` - Send to printer (without this, shows preview)
|
|
67
|
-
- `-q, --qr` - Generate QR code
|
|
68
|
-
- `--qr PATH` - Use existing QR image
|
|
69
|
-
- `--banner` - Create banner (text along paper length)
|
|
70
|
-
- `--font-size N` - Set font size (default: 72)
|
|
71
|
-
- `--width N` - Set image width in pixels (default: 714 for 62mm tape)
|
|
72
|
-
- `--gray N` - Gray bias 0-100 (default: 50)
|
|
73
|
-
- `-d, --device` - Specify printer device (default: auto-detect /dev/usb/lp*)
|
|
74
|
-
|
|
75
|
-
## MQTT Client
|
|
76
|
-
|
|
77
|
-
Run the MQTT client for remote printing:
|
|
78
|
-
|
|
79
|
-
```bash
|
|
80
|
-
qltool_client
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
Send print jobs via MQTT:
|
|
84
|
-
|
|
85
|
-
```bash
|
|
86
|
-
# Simple print
|
|
87
|
-
mosquitto_pub -t qltool/print -m "Hello World -p"
|
|
88
|
-
|
|
89
|
-
# With QR code
|
|
90
|
-
mosquitto_pub -t qltool/print -m "Inventory Item -q -p"
|
|
91
|
-
|
|
92
|
-
# Banner
|
|
93
|
-
mosquitto_pub -t qltool/print -m "Long banner text --banner -p"
|
|
94
|
-
```
|
|
95
|
-
|
|
96
|
-
## Development
|
|
97
|
-
|
|
98
|
-
Run directly from source:
|
|
99
|
-
|
|
100
|
-
```bash
|
|
101
|
-
# Preview
|
|
102
|
-
uv run src/qltool/main.py "Test text" --font-size 40
|
|
103
|
-
|
|
104
|
-
# Print
|
|
105
|
-
uv run src/qltool/main.py "Test text" --font-size 40 -p
|
|
106
|
-
```
|
|
107
|
-
|
|
108
|
-
## Requirements
|
|
109
|
-
|
|
110
|
-
- Brother QL-700 or QL-570 printer
|
|
111
|
-
- User must be in `lp` group for printer access
|
|
112
|
-
- Linux with USB lp device support (`/dev/usb/lp*`)
|
|
113
|
-
|
|
114
|
-
## Org-mode Integration (Inventory)
|
|
115
|
-
|
|
116
|
-
For Emacs org-mode table integration:
|
|
117
|
-
|
|
118
|
-
```elisp
|
|
119
|
-
;; Add to .emacs
|
|
120
|
-
(defun print-inventory-item ()
|
|
121
|
-
"Print current org table row as label"
|
|
122
|
-
(interactive)
|
|
123
|
-
;; Your implementation here
|
|
124
|
-
)
|
|
125
|
-
```
|
|
126
|
-
|
|
127
|
-
Example table format:
|
|
128
|
-
|
|
129
|
-
| ID | Name | Owner | Location |
|
|
130
|
-
|-------------|-----------------------------|-------|----------|
|
|
131
|
-
| D4-12345678 | Sample inventory item | Pepa | Home |
|
|
132
|
-
|
|
133
|
-
The tool can extract ID and name fields to generate QR-coded inventory labels.
|
|
134
|
-
|
|
135
|
-
## Credits
|
|
136
|
-
|
|
137
|
-
- `ql570.c` driver by Asbjørn Sloth Tønnesen, Marc Juul and Luca Zimmermann
|
|
138
|
-
- Built with Python, Click, Pillow, and OpenCV
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|