Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
W
web app
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ICNML
web app
Commits
63158bb2
Commit
63158bb2
authored
5 years ago
by
Marco De Donno
Browse files
Options
Downloads
Patches
Plain Diff
Move the retrieve of the template zones in a dedicated function
parent
38dc245d
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
module.py
+34
-30
34 additions, 30 deletions
module.py
with
34 additions
and
30 deletions
module.py
+
34
−
30
View file @
63158bb2
...
...
@@ -1497,36 +1497,7 @@ def submission_tenprint( id, tid ):
############################################################################
sql
=
"""
SELECT
tenprint_zones.pc, tl_x, tl_y, br_x, br_y, angle, pc.name
FROM tenprint_zones
JOIN tenprint_zones_location ON tenprint_zones.pc = tenprint_zones_location.pc
JOIN pc ON tenprint_zones.pc = pc.id
WHERE
card = %s AND
tenprint_zones_location.side = %s
ORDER BY pc
"""
r
=
config
.
db
.
query
(
sql
,
(
file
[
'
template
'
],
t
,
)
).
fetchall
()
zones
=
[]
for
pc
,
tl_x
,
tl_y
,
br_x
,
br_y
,
angle
,
pc_name
in
r
:
tl_x
=
float_or_null
(
tl_x
)
tl_y
=
float_or_null
(
tl_y
)
br_x
=
float_or_null
(
br_x
)
br_y
=
float_or_null
(
br_y
)
zones
.
append
(
{
"
pc
"
:
pc
,
"
tl_x
"
:
tl_x
,
"
tl_y
"
:
tl_y
,
"
br_x
"
:
br_x
,
"
br_y
"
:
br_y
,
"
angle
"
:
angle
,
"
pc_name
"
:
pc_name
}
)
zones
=
get_tenprint_template_zones
(
file
[
'
template
'
],
t
)
datacolumns
=
[
'
tl_x
'
,
'
tl_y
'
,
'
br_x
'
,
'
br_y
'
,
'
angle
'
]
############################################################################
...
...
@@ -1597,6 +1568,39 @@ def submission_file_set_note( id, t, file ):
################################################################################
# Tenprint templates
def
get_tenprint_template_zones
(
id
,
t
):
sql
=
"""
SELECT
tenprint_zones.pc, tl_x, tl_y, br_x, br_y, angle, pc.name
FROM tenprint_zones
JOIN tenprint_zones_location ON tenprint_zones.pc = tenprint_zones_location.pc
JOIN pc ON tenprint_zones.pc = pc.id
WHERE
card = %s AND
tenprint_zones_location.side = %s
ORDER BY pc
"""
r
=
config
.
db
.
query
(
sql
,
(
id
,
t
,
)
).
fetchall
()
zones
=
[]
for
pc
,
tl_x
,
tl_y
,
br_x
,
br_y
,
angle
,
pc_name
in
r
:
tl_x
=
float_or_null
(
tl_x
)
tl_y
=
float_or_null
(
tl_y
)
br_x
=
float_or_null
(
br_x
)
br_y
=
float_or_null
(
br_y
)
zones
.
append
(
{
"
pc
"
:
pc
,
"
tl_x
"
:
tl_x
,
"
tl_y
"
:
tl_y
,
"
br_x
"
:
br_x
,
"
br_y
"
:
br_y
,
"
angle
"
:
angle
,
"
pc_name
"
:
pc_name
}
)
return
zones
@app.route
(
baseurl
+
'
/tenprint_template/<id>/<t>
'
)
@login_required
def
tp_template
(
id
,
t
):
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment