Commit 73fe7b45 authored by Gabriel Monnerat's avatar Gabriel Monnerat

erp5_document_scanner: few improvements

parent 7f3417da
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="PythonScript" module="Products.PythonScripts.PythonScript"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>Script_magic</string> </key>
<value> <int>3</int> </value>
</item>
<item>
<key> <string>_bind_names</string> </key>
<value>
<object>
<klass>
<global name="NameAssignments" module="Shared.DC.Scripts.Bindings"/>
</klass>
<tuple/>
<state>
<dictionary>
<item>
<key> <string>_asgns</string> </key>
<value>
<dictionary>
<item>
<key> <string>name_container</string> </key>
<value> <string>container</string> </value>
</item>
<item>
<key> <string>name_context</string> </key>
<value> <string>context</string> </value>
</item>
<item>
<key> <string>name_m_self</string> </key>
<value> <string>script</string> </value>
</item>
<item>
<key> <string>name_subpath</string> </key>
<value> <string>traverse_subpath</string> </value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</state>
</object>
</value>
</item>
<item>
<key> <string>_params</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>Base_getDocumentScannerSelectionName</string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -2,12 +2,9 @@ import json
portal = context.getPortalObject()
active_preference = portal.portal_preferences.getActiveUserPreference()
if not active_preference:
active_preference = portal.portal_preferences.getActivePreference()
canvas_data = active_preference and \
json.loads(active_preference.getPreferredCroppedCanvasData("{}")) or {}
canvas_data = portal.portal_selections.getSelectionParamsFor(
context.Base_getDocumentScannerSelectionName(),
REQUEST=context.REQUEST) or {}
canvas_data["dialog_method"] = context.Base_storeDocumentFromCameraInActiveProcess.getId()
......
......@@ -6,14 +6,13 @@ translateString = portal.Base_translateString
gadget_data = json.loads(document_scanner_gadget)
image_str = decodestring(gadget_data.pop("input_value"))
preferred_cropped_canvas_data = json.dumps(gadget_data["preferred_cropped_canvas_data"])
preferred_cropped_canvas_data = gadget_data["preferred_cropped_canvas_data"] or {}
active_preference = portal.portal_preferences.getActiveUserPreference()
if not active_preference:
active_preference = portal.portal_preferences.getActivePreference()
if active_preference and preferred_cropped_canvas_data:
active_preference.setPreferredCroppedCanvasData(preferred_cropped_canvas_data)
portal.portal_selections.setSelectionParamsFor(
context.Base_getDocumentScannerSelectionName(),
preferred_cropped_canvas_data,
context.REQUEST
)
if not image_str:
if batch_mode:
......
......@@ -53,9 +53,10 @@ div[data-gadget-scope="field_your_document_scanner_gadget"] {
.reset-btn, .confirm-btn, .edit-btn, .take-picture-btn,
.capture-btn, .change-camera-btn, .confirm-btn {
font-size: 44px;
color: #212529;
padding: 0 16px 0 16px;
padding: 3pt;
border: 1px solid rgba(0, 0, 0, 0.14);
border-radius: 0.325em;
}
.take-picture-btn, .capture-btn, .confirm-btn,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment