Merge branch 'fix/print-dialog-scroll-and-layout'
@@ -2786,7 +2786,7 @@ checksum = "2f3a9f18d041e6d0e102a0a46750538147e5e8992d3b4873aaafee2520b00ce3"
2786
2786
2787
2787
[[package]]
2788
2788
name = "posprint"
2789
version = "0.4.0"
2789
version = "0.5.0"
2790
2790
dependencies = [
2791
2791
"barcoders",
2792
2792
"base64",
@@ -2786,7 +2786,7 @@ checksum = "2f3a9f18d041e6d0e102a0a46750538147e5e8992d3b4873aaafee2520b00ce3"2786
2786
2787
[[package]]2787
[[package]]2788
name = "posprint"2788
name = "posprint"2789
version = "0.4.0"2789
version = "0.5.0"2790
dependencies = [2790
dependencies = [2791
"barcoders",2791
"barcoders",2792
"base64",2792
"base64",@@ -1,6 +1,6 @@
1
1
[package]
2
2
name = "posprint"
3
version = "0.4.0"
3
version = "0.5.0"
4
4
edition = "2021"
5
5
rust-version = "1.88"
6
6
description = "Designer for POS-print documents"
@@ -1,6 +1,6 @@1
[package]
1
[package]
2
name = "posprint"
2
name = "posprint"
3
version = "0.4.0"
3
version = "0.5.0"
4
edition = "2021"
4
edition = "2021"
5
rust-version = "1.88"
5
rust-version = "1.88"
6
description = "Designer for POS-print documents"
6
description = "Designer for POS-print documents"
@@ -6,7 +6,7 @@ Cross-platform designer for POS (point-of-sale) receipt documents. Edit template
6
6
7
7
## Status
8
8
9
**v0.4.0** — `posprint://` deep links, live preview in print-only mode, remote `@image` URLs, inline checkboxes, nested lists.
9
**v0.5.0** — Scrollable printer picker, USB-serial filtering, AUR publishing, `posprint://` deep links, live print-only preview.
10
10
11
11
## Build and run
12
12
@@ -6,7 +6,7 @@ Cross-platform designer for POS (point-of-sale) receipt documents. Edit template6
6
7
## Status7
## Status8
8
9
**v0.4.0** — `posprint://` deep links, live preview in print-only mode, remote `@image` URLs, inline checkboxes, nested lists.9
**v0.5.0** — Scrollable printer picker, USB-serial filtering, AUR publishing, `posprint://` deep links, live print-only preview.10
10
11
## Build and run11
## Build and run12
12
@@ -272,7 +272,7 @@ Receipt: ${DocumentNumber}
272
272
273
273
## GUI printing
274
274
275
1. **Print** → enter parameters → choose a printer → **Print**.
275
1. **Print** → enter parameters → choose a printer → **Print** (next to Refresh). Close with the window ✕.
276
276
277
277
Printers may appear as:
278
278
@@ -272,7 +272,7 @@ Receipt: ${DocumentNumber}272
272
273
## GUI printing273
## GUI printing274
274
275
1. **Print** → enter parameters → choose a printer → **Print**.275
1. **Print** → enter parameters → choose a printer → **Print** (next to Refresh). Close with the window ✕.276
276
277
Printers may appear as:277
Printers may appear as:278
278
@@ -101,7 +101,8 @@ pub trait PrinterTransport {
101
101
102
102
- One field per unique `${Parameter}`.
103
103
- Printer list: USB printer-class, Windows spooler (Windows), and connected USB-serial devices (Refresh button). Empty motherboard serial ports are omitted; use manual entry for those.
104
- The printer list scrolls when long so Cancel / Print stay reachable.
104
- **Print** sits next to **Refresh**; close the dialog with the window ✕.
105
- The printer list uses a fixed-height scroll area so long lists stay usable.
105
106
- Optional manual serial port / queue name.
106
107
- While open, the main Design UI is disabled (including editor autocomplete).
107
108
- Errors shown inline (parse, open, write, barcode validation).
@@ -101,7 +101,8 @@ pub trait PrinterTransport {101
101
102
- One field per unique `${Parameter}`.102
- One field per unique `${Parameter}`.103
- Printer list: USB printer-class, Windows spooler (Windows), and connected USB-serial devices (Refresh button). Empty motherboard serial ports are omitted; use manual entry for those.103
- Printer list: USB printer-class, Windows spooler (Windows), and connected USB-serial devices (Refresh button). Empty motherboard serial ports are omitted; use manual entry for those.104
- The printer list scrolls when long so Cancel / Print stay reachable.104
- **Print** sits next to **Refresh**; close the dialog with the window ✕.105
- The printer list uses a fixed-height scroll area so long lists stay usable.105
- Optional manual serial port / queue name.106
- Optional manual serial port / queue name.106
- While open, the main Design UI is disabled (including editor autocomplete).107
- While open, the main Design UI is disabled (including editor autocomplete).107
- Errors shown inline (parse, open, write, barcode validation).108
- Errors shown inline (parse, open, write, barcode validation).@@ -1,6 +1,6 @@
1
1
# Maintainer: posprint contributors
2
2
pkgname=posprint
3
pkgver=0.4.0
3
pkgver=0.5.0
4
4
pkgrel=1
5
5
pkgdesc="Designer for POS-print documents with live preview and USB ESC/POS printing"
6
6
arch=('x86_64')
@@ -1,6 +1,6 @@1
# Maintainer: posprint contributors1
# Maintainer: posprint contributors2
pkgname=posprint2
pkgname=posprint3
pkgver=0.4.03
pkgver=0.5.04
pkgrel=14
pkgrel=15
pkgdesc="Designer for POS-print documents with live preview and USB ESC/POS printing"5
pkgdesc="Designer for POS-print documents with live preview and USB ESC/POS printing"6
arch=('x86_64')6
arch=('x86_64')@@ -1,6 +1,6 @@
1
1
pkgbase = posprint
2
2
pkgdesc = Designer for POS-print documents with live preview and USB ESC/POS printing
3
pkgver = 0.4.0
3
pkgver = 0.5.0
4
4
pkgrel = 1
5
5
url = https://gitlab.com/Timfa/posprint
6
6
arch = x86_64
@@ -21,7 +21,7 @@ pkgbase = posprint
21
21
depends = freetype2
22
22
depends = libglvnd
23
23
options = !lto
24
source = https://gitlab.com/Timfa/posprint/-/archive/0.4.0/posprint-0.4.0.tar.gz
25
sha256sums = b54a73c38deb9c57388039b00fd451038264b6fa3694348456108fb3c117f923
24
source = https://gitlab.com/Timfa/posprint/-/archive/0.5.0/posprint-0.5.0.tar.gz
25
sha256sums = SKIP
26
26
27
27
pkgname = posprint
@@ -1,6 +1,6 @@1
pkgbase = posprint1
pkgbase = posprint2
pkgdesc = Designer for POS-print documents with live preview and USB ESC/POS printing2
pkgdesc = Designer for POS-print documents with live preview and USB ESC/POS printing3
pkgver = 0.4.03
pkgver = 0.5.04
pkgrel = 14
pkgrel = 15
url = https://gitlab.com/Timfa/posprint5
url = https://gitlab.com/Timfa/posprint6
arch = x86_646
arch = x86_64@@ -21,7 +21,7 @@ pkgbase = posprint21
depends = freetype221
depends = freetype222
depends = libglvnd22
depends = libglvnd23
options = !lto23
options = !lto24
source = https://gitlab.com/Timfa/posprint/-/archive/0.4.0/posprint-0.4.0.tar.gz24
source = https://gitlab.com/Timfa/posprint/-/archive/0.5.0/posprint-0.5.0.tar.gz25
sha256sums = b54a73c38deb9c57388039b00fd451038264b6fa3694348456108fb3c117f92325
sha256sums = SKIP26
26
27
pkgname = posprint27
pkgname = posprint@@ -1,6 +1,6 @@
1
1
# Maintainer: posprint contributors
2
2
pkgname=posprint
3
pkgver=0.4.0
3
pkgver=0.5.0
4
4
pkgrel=1
5
5
pkgdesc="Designer for POS-print documents with live preview and USB ESC/POS printing"
6
6
arch=('x86_64')
@@ -1,6 +1,6 @@1
# Maintainer: posprint contributors1
# Maintainer: posprint contributors2
pkgname=posprint2
pkgname=posprint3
pkgver=0.4.03
pkgver=0.5.04
pkgrel=14
pkgrel=15
pkgdesc="Designer for POS-print documents with live preview and USB ESC/POS printing"5
pkgdesc="Designer for POS-print documents with live preview and USB ESC/POS printing"6
arch=('x86_64')6
arch=('x86_64')@@ -405,18 +405,17 @@ impl eframe::App for PosPrintApp {
405
405
egui::Window::new("Print")
406
406
.collapsible(false)
407
407
.resizable(true)
408
.default_size([420.0, 520.0])
408
409
.open(&mut open)
409
410
.show(ctx, |ui| {
410
match self.print_dialog.show_ui(ui, "Cancel") {
411
PrintDialogAction::Cancel => self.close_print_dialog(),
411
match self.print_dialog.show_ui(ui) {
412
412
PrintDialogAction::Print => self.execute_print(),
413
413
PrintDialogAction::None => {}
414
414
}
415
415
});
416
416
if !open {
417
self.apply_print_dialog_params_to_preview();
417
self.close_print_dialog();
418
418
}
419
self.show_print_dialog = open;
420
419
}
421
420
422
421
ctx.send_viewport_cmd(egui::ViewportCommand::Title(self.title()));
@@ -405,18 +405,17 @@ impl eframe::App for PosPrintApp {405
egui::Window::new("Print")
405
egui::Window::new("Print")
406
.collapsible(false)
406
.collapsible(false)
407
.resizable(true)
407
.resizable(true)
408
.default_size([420.0, 520.0])
408
.open(&mut open)
409
.open(&mut open)
409
.show(ctx, |ui| {
410
.show(ctx, |ui| {
410
match self.print_dialog.show_ui(ui, "Cancel") {
411
match self.print_dialog.show_ui(ui) {
411
PrintDialogAction::Cancel => self.close_print_dialog(),
412
PrintDialogAction::Print => self.execute_print(),
412
PrintDialogAction::Print => self.execute_print(),
413
PrintDialogAction::None => {}
413
PrintDialogAction::None => {}
414
}
414
}
415
});
415
});
416
if !open {
416
if !open {
417
self.apply_print_dialog_params_to_preview();
417
self.close_print_dialog();
418
}
418
}
419
self.show_print_dialog = open;
420
}
419
}
421
420
422
ctx.send_viewport_cmd(egui::ViewportCommand::Title(self.title()));
421
ctx.send_viewport_cmd(egui::ViewportCommand::Title(self.title()));
@@ -206,38 +206,46 @@ impl PrintDialog {
206
206
.map(|p| &p.target)
207
207
}
208
208
209
pub fn show_ui(&mut self, ui: &mut egui::Ui, cancel_label: &str) -> PrintDialogAction {
209
pub fn show_ui(&mut self, ui: &mut egui::Ui) -> PrintDialogAction {
210
let mut action = PrintDialogAction::None;
211
210
212
ui.heading("Parameters");
211
213
if self.param_specs.is_empty() {
212
214
ui.label("No parameters in this template.");
213
215
} else {
214
for spec in self.param_specs.clone() {
215
ui.horizontal(|ui| {
216
match spec.kind {
217
ParamKind::Text => {
218
ui.label(format!("{}:", spec.name));
219
let entry = self
220
.param_inputs
221
.entry(spec.name.clone())
222
.or_insert_with(String::new);
223
ui.text_edit_singleline(entry);
224
}
225
ParamKind::Bool => {
226
let mut checked = self
227
.param_inputs
228
.get(&spec.name)
229
.and_then(|v| parse_bool_value(v))
230
.unwrap_or(false);
231
if ui.checkbox(&mut checked, &spec.name).changed() {
232
self.param_inputs.insert(
233
spec.name.clone(),
234
if checked { "true" } else { "false" }.into(),
235
);
216
egui::ScrollArea::vertical()
217
.id_salt("print_dialog_params")
218
.max_height(140.0)
219
.auto_shrink([false, true])
220
.show(ui, |ui| {
221
for spec in self.param_specs.clone() {
222
ui.horizontal(|ui| {
223
match spec.kind {
224
ParamKind::Text => {
225
ui.label(format!("{}:", spec.name));
226
let entry = self
227
.param_inputs
228
.entry(spec.name.clone())
229
.or_insert_with(String::new);
230
ui.text_edit_singleline(entry);
231
}
232
ParamKind::Bool => {
233
let mut checked = self
234
.param_inputs
235
.get(&spec.name)
236
.and_then(|v| parse_bool_value(v))
237
.unwrap_or(false);
238
if ui.checkbox(&mut checked, &spec.name).changed() {
239
self.param_inputs.insert(
240
spec.name.clone(),
241
if checked { "true" } else { "false" }.into(),
242
);
243
}
244
}
236
245
}
237
}
246
});
238
247
}
239
248
});
240
}
241
249
}
242
250
243
251
ui.separator();
@@ -249,6 +257,9 @@ impl PrintDialog {
249
257
{
250
258
self.refresh_printers();
251
259
}
260
if ui.button("Print").clicked() {
261
action = PrintDialogAction::Print;
262
}
252
263
if self.printers_loading {
253
264
ui.spinner();
254
265
ui.label("Discovering printers…");
@@ -269,13 +280,15 @@ impl PrintDialog {
269
280
"No printers found. Connect a USB POS printer, refresh, or enter a port/queue manually.",
270
281
);
271
282
} else {
272
// Keep Cancel/Print reachable when many devices are listed.
273
let list_height = (self.printers.len() as f32 * 22.0).clamp(44.0, 180.0);
283
// Fixed height so wheel scrolling works; avoid nesting inside another ScrollArea.
284
const PRINTER_LIST_HEIGHT: f32 = 220.0;
274
285
egui::ScrollArea::vertical()
275
286
.id_salt("print_dialog_printer_list")
276
.max_height(list_height)
277
.auto_shrink([false, true])
287
.max_height(PRINTER_LIST_HEIGHT)
288
.min_scrolled_height(PRINTER_LIST_HEIGHT)
289
.auto_shrink([false, false])
278
290
.show(ui, |ui| {
291
ui.set_min_width(ui.available_width());
279
292
for (i, printer) in self.printers.iter().enumerate() {
280
293
ui.selectable_value(
281
294
&mut self.selected_printer,
@@ -290,15 +303,6 @@ impl PrintDialog {
290
303
ui.colored_label(egui::Color32::RED, err);
291
304
}
292
305
293
let mut action = PrintDialogAction::None;
294
ui.horizontal(|ui| {
295
if ui.button(cancel_label).clicked() {
296
action = PrintDialogAction::Cancel;
297
}
298
if ui.button("Print").clicked() {
299
action = PrintDialogAction::Print;
300
}
301
});
302
306
action
303
307
}
304
308
}
@@ -306,6 +310,5 @@ impl PrintDialog {
306
310
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
307
311
pub enum PrintDialogAction {
308
312
None,
309
Cancel,
310
313
Print,
311
314
}
@@ -206,38 +206,46 @@ impl PrintDialog {206
.map(|p| &p.target)
206
.map(|p| &p.target)
207
}
207
}
208
208
209
pub fn show_ui(&mut self, ui: &mut egui::Ui, cancel_label: &str) -> PrintDialogAction {
209
pub fn show_ui(&mut self, ui: &mut egui::Ui) -> PrintDialogAction {
210
let mut action = PrintDialogAction::None;
211
210
ui.heading("Parameters");
212
ui.heading("Parameters");
211
if self.param_specs.is_empty() {
213
if self.param_specs.is_empty() {
212
ui.label("No parameters in this template.");
214
ui.label("No parameters in this template.");
213
} else {
215
} else {
214
for spec in self.param_specs.clone() {
216
egui::ScrollArea::vertical()
215
ui.horizontal(|ui| {
217
.id_salt("print_dialog_params")
216
match spec.kind {
218
.max_height(140.0)
217
ParamKind::Text => {
219
.auto_shrink([false, true])
218
ui.label(format!("{}:", spec.name));
220
.show(ui, |ui| {
219
let entry = self
221
for spec in self.param_specs.clone() {
220
.param_inputs
222
ui.horizontal(|ui| {
221
.entry(spec.name.clone())
223
match spec.kind {
222
.or_insert_with(String::new);
224
ParamKind::Text => {
223
ui.text_edit_singleline(entry);
225
ui.label(format!("{}:", spec.name));
224
}
226
let entry = self
225
ParamKind::Bool => {
227
.param_inputs
226
let mut checked = self
228
.entry(spec.name.clone())
227
.param_inputs
229
.or_insert_with(String::new);
228
.get(&spec.name)
230
ui.text_edit_singleline(entry);
229
.and_then(|v| parse_bool_value(v))
231
}
230
.unwrap_or(false);
232
ParamKind::Bool => {
231
if ui.checkbox(&mut checked, &spec.name).changed() {
233
let mut checked = self
232
self.param_inputs.insert(
234
.param_inputs
233
spec.name.clone(),
235
.get(&spec.name)
234
if checked { "true" } else { "false" }.into(),
236
.and_then(|v| parse_bool_value(v))
235
);
237
.unwrap_or(false);
238
if ui.checkbox(&mut checked, &spec.name).changed() {
239
self.param_inputs.insert(
240
spec.name.clone(),
241
if checked { "true" } else { "false" }.into(),
242
);
243
}
244
}
236
}
245
}
237
}
246
});
238
}
247
}
239
});
248
});
240
}
241
}
249
}
242
250
243
ui.separator();
251
ui.separator();
@@ -249,6 +257,9 @@ impl PrintDialog {249
{
257
{
250
self.refresh_printers();
258
self.refresh_printers();
251
}
259
}
260
if ui.button("Print").clicked() {
261
action = PrintDialogAction::Print;
262
}
252
if self.printers_loading {
263
if self.printers_loading {
253
ui.spinner();
264
ui.spinner();
254
ui.label("Discovering printers…");
265
ui.label("Discovering printers…");
@@ -269,13 +280,15 @@ impl PrintDialog {269
"No printers found. Connect a USB POS printer, refresh, or enter a port/queue manually.",
280
"No printers found. Connect a USB POS printer, refresh, or enter a port/queue manually.",
270
);
281
);
271
} else {
282
} else {
272
// Keep Cancel/Print reachable when many devices are listed.
283
// Fixed height so wheel scrolling works; avoid nesting inside another ScrollArea.
273
let list_height = (self.printers.len() as f32 * 22.0).clamp(44.0, 180.0);
284
const PRINTER_LIST_HEIGHT: f32 = 220.0;
274
egui::ScrollArea::vertical()
285
egui::ScrollArea::vertical()
275
.id_salt("print_dialog_printer_list")
286
.id_salt("print_dialog_printer_list")
276
.max_height(list_height)
287
.max_height(PRINTER_LIST_HEIGHT)
277
.auto_shrink([false, true])
288
.min_scrolled_height(PRINTER_LIST_HEIGHT)
289
.auto_shrink([false, false])
278
.show(ui, |ui| {
290
.show(ui, |ui| {
291
ui.set_min_width(ui.available_width());
279
for (i, printer) in self.printers.iter().enumerate() {
292
for (i, printer) in self.printers.iter().enumerate() {
280
ui.selectable_value(
293
ui.selectable_value(
281
&mut self.selected_printer,
294
&mut self.selected_printer,
@@ -290,15 +303,6 @@ impl PrintDialog {290
ui.colored_label(egui::Color32::RED, err);
303
ui.colored_label(egui::Color32::RED, err);
291
}
304
}
292
305
293
let mut action = PrintDialogAction::None;
294
ui.horizontal(|ui| {
295
if ui.button(cancel_label).clicked() {
296
action = PrintDialogAction::Cancel;
297
}
298
if ui.button("Print").clicked() {
299
action = PrintDialogAction::Print;
300
}
301
});
302
action
306
action
303
}
307
}
304
}
308
}
@@ -306,6 +310,5 @@ impl PrintDialog {306
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
310
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
307
pub enum PrintDialogAction {
311
pub enum PrintDialogAction {
308
None,
312
None,
309
Cancel,
310
Print,
313
Print,
311
}
314
}
@@ -168,21 +168,14 @@ impl eframe::App for PrintOnlyApp {
168
168
egui::vec2(ui.available_width(), available.y),
169
169
egui::Layout::top_down(egui::Align::Min),
170
170
|ui| {
171
egui::ScrollArea::vertical()
172
.auto_shrink([false; 2])
173
.show(ui, |ui| {
174
action = self.dialog.show_ui(ui, "Cancel");
175
});
171
// No outer ScrollArea: nested scroll steals wheel events from the printer list.
172
action = self.dialog.show_ui(ui);
176
173
},
177
174
);
178
175
});
179
176
});
180
177
181
178
match action {
182
PrintDialogAction::Cancel => {
183
self.dialog.apply_inputs_to_last_params();
184
self.request_exit();
185
}
186
179
PrintDialogAction::Print => {
187
180
if self
188
181
.dialog
@@ -168,21 +168,14 @@ impl eframe::App for PrintOnlyApp {168
egui::vec2(ui.available_width(), available.y),
168
egui::vec2(ui.available_width(), available.y),
169
egui::Layout::top_down(egui::Align::Min),
169
egui::Layout::top_down(egui::Align::Min),
170
|ui| {
170
|ui| {
171
egui::ScrollArea::vertical()
171
// No outer ScrollArea: nested scroll steals wheel events from the printer list.
172
.auto_shrink([false; 2])
172
action = self.dialog.show_ui(ui);
173
.show(ui, |ui| {
174
action = self.dialog.show_ui(ui, "Cancel");
175
});
176
},
173
},
177
);
174
);
178
});
175
});
179
});
176
});
180
177
181
match action {
178
match action {
182
PrintDialogAction::Cancel => {
183
self.dialog.apply_inputs_to_last_params();
184
self.request_exit();
185
}
186
PrintDialogAction::Print => {
179
PrintDialogAction::Print => {
187
if self
180
if self
188
.dialog
181
.dialog