Merge lp:~soliloque/simple-scan/burst into lp:~simple-scan-team/simple-scan/trunk

Proposed by soliloque
Status: Merged
Merged at revision: 951
Proposed branch: lp:~soliloque/simple-scan/burst
Merge into: lp:~simple-scan-team/simple-scan/trunk
Diff against target: 124 lines (+47/-3)
3 files modified
data/simple-scan.ui (+29/-1)
src/scanner.vala (+10/-2)
src/ui.vala (+8/-0)
To merge this branch: bzr merge lp:~soliloque/simple-scan/burst
Reviewer Review Type Date Requested Status
Robert Ancell Approve
Review via email: mp+321243@code.launchpad.net

Commit message

Add burst mode scan type

Description of the change

As a simple-scan user, I routinely scan documents unfit for the charger because of binding or because it is made of thick paper. As of now, we must use the Single scan type and reach for the scan button for every page. This patch introduce a new scan type that use the flatbed, like Single, but run in burst mode, ie, after a scan is complete, it will automatically start another scan so we don't have to reach for the scan button but we can concentrate on putting the next page on the flatbed. This allow for faster, more pleasant, scanning.

To post a comment you must log in.
Revision history for this message
Robert Ancell (robert-ancell) wrote :

Great idea!

I've committed this with a few changes:
- Replaced some tab characters with spaces
- Renamed from burst to batch (seems the conventional name for this)
- Simplified a bit of the code.

I was wondering if it would be useful to have a configurable delay between scans in case you need more time to switch pages. What do you think?

Thanks!

review: Approve
Revision history for this message
soliloque (soliloque) wrote :

I think a configurable delay would be a nice addition. Let me send you a
new patch with this in a few days.

Have a nice day.

Le 2017-03-28 23:54, "Robert Ancell" <email address hidden> a écrit :

> Review: Approve
>
> Great idea!
>
> I've committed this with a few changes:
> - Replaced some tab characters with spaces
> - Renamed from burst to batch (seems the conventional name for this)
> - Simplified a bit of the code.
>
> I was wondering if it would be useful to have a configurable delay between
> scans in case you need more time to switch pages. What do you think?
>
> Thanks!
> --
> https://code.launchpad.net/~soliloque/simple-scan/burst/+merge/321243
> You are the owner of lp:~soliloque/simple-scan/burst.
>

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'data/simple-scan.ui'
2--- data/simple-scan.ui 2016-03-17 01:51:46 +0000
3+++ data/simple-scan.ui 2017-03-29 03:37:33 +0000
4@@ -275,7 +275,7 @@
5 <accelerator key="1" signal="activate" modifiers="GDK_CONTROL_MASK"/>
6 <signal name="activate" handler="scan_button_clicked_cb" swapped="no"/>
7 </object>
8- </child>
9+ </child>
10 <child>
11 <object class="GtkMenuItem" id="scan_all_menuitem">
12 <property name="visible">True</property>
13@@ -287,6 +287,16 @@
14 </object>
15 </child>
16 <child>
17+ <object class="GtkMenuItem" id="burst_menuitem">
18+ <property name="visible">True</property>
19+ <property name="can_focus">False</property>
20+ <property name="label" translatable="yes" comments="Scan menu item to scan continuously from the flatbed">_Multiple Pages From Flatbed</property>
21+ <property name="use_underline">True</property>
22+ <accelerator key="m" signal="activate" modifiers="GDK_CONTROL_MASK"/>
23+ <signal name="activate" handler="burst_button_clicked_cb" swapped="no"/>
24+ </object>
25+ </child>
26+ <child>
27 <object class="GtkMenuItem" id="stop_scan_menuitem">
28 <property name="visible">True</property>
29 <property name="sensitive">False</property>
30@@ -1318,6 +1328,15 @@
31 </object>
32 </child>
33 <child>
34+ <object class="GtkMenuItem" id="burst_button_menuitem">
35+ <property name="visible">True</property>
36+ <property name="can_focus">False</property>
37+ <property name="label" translatable="yes" comments="Toolbar scan menu item to scan continuously from the flatbed">_Multiple Pages From Flatbed</property>
38+ <property name="use_underline">True</property>
39+ <signal name="activate" handler="burst_button_clicked_cb" swapped="no"/>
40+ </object>
41+ </child>
42+ <child>
43 <object class="GtkSeparatorMenuItem" id="menuitem1">
44 <property name="visible">True</property>
45 <property name="can_focus">False</property>
46@@ -1368,6 +1387,15 @@
47 </object>
48 </child>
49 <child>
50+ <object class="GtkMenuItem" id="burst_button_hb_menuitem">
51+ <property name="visible">True</property>
52+ <property name="can_focus">False</property>
53+ <property name="label" translatable="yes" comments="Toolbar scan menu item to scan continuously from the flatbed">_Multiple Pages From Flatbed</property>
54+ <property name="use_underline">True</property>
55+ <signal name="activate" handler="burst_button_clicked_cb" swapped="no"/>
56+ </object>
57+ </child>
58+ <child>
59 <object class="GtkSeparatorMenuItem" id="menuitem3">
60 <property name="visible">True</property>
61 <property name="can_focus">False</property>
62
63=== modified file 'src/scanner.vala'
64--- src/scanner.vala 2015-10-12 14:40:07 +0000
65+++ src/scanner.vala 2017-03-29 03:37:33 +0000
66@@ -69,7 +69,8 @@
67 SINGLE,
68 ADF_FRONT,
69 ADF_BACK,
70- ADF_BOTH
71+ ADF_BOTH,
72+ BURST
73 }
74
75 public class ScanOptions
76@@ -964,6 +965,11 @@
77 if (!set_constrained_string_option (handle, option, index, adf_sources, null))
78 warning ("Unable to set duplex ADF source, please file a bug");
79 break;
80+ case ScanType.BURST:
81+ if (!set_default_option (handle, option, index))
82+ if (!set_constrained_string_option (handle, option, index, flatbed_sources, null))
83+ warning ("Unable to set single page source, please file a bug");
84+ break;
85 }
86 }
87
88@@ -1040,7 +1046,7 @@
89 if (option != null)
90 {
91 if (option.type == Sane.ValueType.BOOL)
92- set_bool_option (handle, option, index, job.type != ScanType.SINGLE, null);
93+ set_bool_option (handle, option, index, (job.type != ScanType.SINGLE) && (job.type != ScanType.BURST), null);
94 }
95
96 /* Disable compression, we will compress after scanning */
97@@ -1550,6 +1556,8 @@
98 return "ScanType.ADF_BACK";
99 case ScanType.ADF_BOTH:
100 return "ScanType.ADF_BOTH";
101+ case ScanType.BURST:
102+ return "ScanType.BURST";
103 default:
104 return "%d".printf (type);
105 }
106
107=== modified file 'src/ui.vala'
108--- src/ui.vala 2016-11-28 10:08:17 +0000
109+++ src/ui.vala 2017-03-29 03:37:33 +0000
110@@ -897,6 +897,14 @@
111 }
112 }
113
114+ [GtkCallback]
115+ private void burst_button_clicked_cb (Gtk.Widget widget)
116+ {
117+ var options = make_scan_options ();
118+ options.type = ScanType.BURST;
119+ start_scan (selected_device, options);
120+ }
121+
122 [GtkCallback]
123 private void preferences_button_clicked_cb (Gtk.Widget widget)
124 {

Subscribers

People subscribed via source and target branches