Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
K
kort-client
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
AlekSIS®
Libraries
kort-client
Commits
a1d8f89d
Verified
Commit
a1d8f89d
authored
1 year ago
by
Jonathan Weth
Browse files
Options
Downloads
Patches
Plain Diff
Improve logging
parent
352268f3
Branches
master
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
kort_client/api.py
+0
-1
0 additions, 1 deletion
kort_client/api.py
kort_client/run.py
+11
-3
11 additions, 3 deletions
kort_client/run.py
with
11 additions
and
4 deletions
kort_client/api.py
+
0
−
1
View file @
a1d8f89d
...
...
@@ -42,7 +42,6 @@ class KortAPI:
def
get_next_job
(
self
,
printer_id
:
int
)
->
Optional
[
dict
[
str
,
Any
]]:
r
=
self
.
_do_request
(
"
GET
"
,
"
next_job
"
,
[
printer_id
])
print
(
r
)
if
r
.
get
(
"
status
"
)
==
"
no_job
"
:
return
None
return
r
...
...
This diff is collapsed.
Click to expand it.
kort_client/run.py
+
11
−
3
View file @
a1d8f89d
...
...
@@ -43,6 +43,9 @@ class PrintClient:
fg
=
"
red
"
,
)
if
self
.
card_detector_in_process
and
self
.
card_detector
:
click
.
secho
(
f
"
Abort card detection process with card detector
{
self
.
card_detector
.
id
}
"
)
self
.
card_detector
.
abort
()
else
:
printer_status
=
"
online
"
...
...
@@ -66,6 +69,9 @@ class PrintClient:
self
.
printer_id
,
"
offline
"
,
"
Printer client was stopped by user.
"
)
if
self
.
card_detector
and
self
.
card_detector_in_process
:
click
.
secho
(
f
"
Abort card detection process with card detector
{
self
.
card_detector
.
id
}
"
)
self
.
card_detector
.
abort
()
raise
...
...
@@ -93,7 +99,6 @@ class PrintClient:
def
step
(
self
):
self
.
printer_config
=
self
.
api
.
get_printer
()
print
(
self
.
printer_config
)
self
.
printer_id
=
self
.
printer_config
[
"
id
"
]
...
...
@@ -102,11 +107,11 @@ class PrintClient:
self
.
card_detector_in_process
=
False
if
self
.
card_detector
:
self
.
interactive
=
self
.
card_detector
.
interactive
click
.
secho
(
f
"
Clear card detector
{
self
.
card_detector
.
id
}
"
)
self
.
card_detector
.
clear
()
next_job
=
self
.
api
.
get_next_job
(
self
.
printer_id
)
print
(
next_job
)
if
next_job
:
job_id
=
next_job
[
"
id
"
]
click
.
secho
(
"
Got new print job {}
"
.
format
(
next_job
),
fg
=
"
green
"
)
...
...
@@ -118,7 +123,9 @@ class PrintClient:
if
not
self
.
printer_config
.
get
(
"
generate_number_on_server
"
):
# Now do something to set the number, but irrelevant for this example
click
.
secho
(
"
Generate number on server disabled
"
,
fg
=
"
yellow
"
)
click
.
secho
(
"
Generate number on server disabled, read chip number
"
,
fg
=
"
yellow
"
)
if
self
.
card_detector
:
self
.
card_detector_in_process
=
True
chip_number
=
self
.
card_detector
.
read_id
()
...
...
@@ -131,6 +138,7 @@ class PrintClient:
raise
KortClientException
(
"
No card detector configured
"
)
if
self
.
with_printer
and
next_job
[
"
card
"
][
"
chip_number
"
]:
click
.
secho
(
"
Download card PDF file ...
"
)
# Download PDF file
with
tempfile
.
NamedTemporaryFile
(
"
wb
"
)
as
f
:
r
=
requests
.
get
(
...
...
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