Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Léo-Paul Géneau
erp5
Commits
640a5e02
Commit
640a5e02
authored
Mar 31, 2020
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
erp5_document_scanner: handle caman error
parent
a06535ce
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
20 deletions
+31
-20
bt5/erp5_document_scanner/PathTemplateItem/web_page_module/scanner_gadget_document_scanner_js.js
...tem/web_page_module/scanner_gadget_document_scanner_js.js
+29
-18
bt5/erp5_document_scanner/PathTemplateItem/web_page_module/scanner_gadget_document_scanner_js.xml
...em/web_page_module/scanner_gadget_document_scanner_js.xml
+2
-2
No files found.
bt5/erp5_document_scanner/PathTemplateItem/web_page_module/scanner_gadget_document_scanner_js.js
View file @
640a5e02
...
@@ -126,23 +126,28 @@
...
@@ -126,23 +126,28 @@
caman
.
Store
.
flush
(
true
);
caman
.
Store
.
flush
(
true
);
}
}
return
new
Promise
(
function
(
resolve
)
{
return
new
Promise
(
function
(
resolve
,
reject
)
{
// XXX the correct usage is `new Caman()` but the library does not support it
// XXX the correct usage is `new Caman()` but the library does not support it
local_caman
=
caman
(
canvas
,
null
,
function
()
{
local_caman
=
caman
(
canvas
,
null
,
function
()
{
if
(
settings
.
brightness
&&
settings
.
brightness
!==
0
)
{
try
{
this
.
brightness
(
settings
.
brightness
);
if
(
settings
.
brightness
&&
settings
.
brightness
!==
0
)
{
}
this
.
brightness
(
settings
.
brightness
);
if
(
settings
.
contrast
&&
settings
.
contrast
!==
0
)
{
}
this
.
contrast
(
settings
.
contrast
);
if
(
settings
.
contrast
&&
settings
.
contrast
!==
0
)
{
}
this
.
contrast
(
settings
.
contrast
);
if
(
settings
.
enable_greyscale
)
{
}
this
.
greyscale
();
if
(
settings
.
enable_greyscale
)
{
}
this
.
greyscale
();
this
.
render
(
function
()
{
}
// XXX canceller should be called automatically ?
this
.
render
(
function
()
{
// XXX canceller should be called automatically ?
canceller
();
resolve
();
});
}
catch
(
error
)
{
canceller
();
canceller
();
re
solve
(
);
re
ject
(
error
);
}
);
}
});
});
return
local_caman
;
return
local_caman
;
},
canceller
);
},
canceller
);
...
@@ -480,10 +485,13 @@
...
@@ -480,10 +485,13 @@
return
blob
;
return
blob
;
}
}
var
canvas
;
var
div
;
return
new
RSVP
.
Queue
(
createImageBitmap
(
blob
))
return
new
RSVP
.
Queue
(
createImageBitmap
(
blob
))
.
push
(
function
(
bitmap
)
{
.
push
(
function
(
bitmap
)
{
canvas
=
domsugar
(
'
canvas
'
);
var
canvas
=
domsugar
(
'
canvas
'
);
// Caman expect the canvas to be in a container
// in order to replace it when resizing
div
=
domsugar
(
'
div
'
,
[
canvas
]);
canvas
.
width
=
bitmap
.
width
;
canvas
.
width
=
bitmap
.
width
;
canvas
.
height
=
bitmap
.
height
;
canvas
.
height
=
bitmap
.
height
;
...
@@ -492,7 +500,7 @@
...
@@ -492,7 +500,7 @@
return
handleCaman
(
canvas
,
settings
);
return
handleCaman
(
canvas
,
settings
);
})
})
.
push
(
function
()
{
.
push
(
function
()
{
return
promiseCanvasToBlob
(
canvas
);
return
promiseCanvasToBlob
(
div
.
firstElementChild
);
});
});
}
}
...
@@ -529,7 +537,10 @@
...
@@ -529,7 +537,10 @@
return
image_capture
.
getPhotoCapabilities
();
return
image_capture
.
getPhotoCapabilities
();
})
})
.
push
(
function
(
capabilities
)
{
.
push
(
function
(
capabilities
)
{
return
image_capture
.
takePhoto
({
imageWidth
:
capabilities
.
imageWidth
.
max
});
return
image_capture
.
takePhoto
({
imageWidth
:
capabilities
.
imageWidth
.
max
,
imageHeight
:
capabilities
.
imageHeight
.
max
});
})
})
.
push
(
function
(
blob
)
{
.
push
(
function
(
blob
)
{
gadget
.
detached_promise_dict
.
media_stream
.
cancel
(
'
Not needed anymore, as captured
'
);
gadget
.
detached_promise_dict
.
media_stream
.
cancel
(
'
Not needed anymore, as captured
'
);
...
...
bt5/erp5_document_scanner/PathTemplateItem/web_page_module/scanner_gadget_document_scanner_js.xml
View file @
640a5e02
...
@@ -244,7 +244,7 @@
...
@@ -244,7 +244,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
serial
</string>
</key>
<key>
<string>
serial
</string>
</key>
<value>
<string>
982.5
7254.54695.8721
</string>
</value>
<value>
<string>
982.5
8248.12377.39526
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
state
</string>
</key>
<key>
<string>
state
</string>
</key>
...
@@ -262,7 +262,7 @@
...
@@ -262,7 +262,7 @@
</tuple>
</tuple>
<state>
<state>
<tuple>
<tuple>
<float>
1585
584566.97
</float>
<float>
1585
644055.38
</float>
<string>
UTC
</string>
<string>
UTC
</string>
</tuple>
</tuple>
</state>
</state>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment