Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
anselm
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
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
vaclab
anselm
Commits
89a341c4
Commit
89a341c4
authored
6 years ago
by
Wact B. Prot
Browse files
Options
Downloads
Patches
Plain Diff
some more get
parent
8e72424b
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
anselm.py
+7
-2
7 additions, 2 deletions
anselm.py
anselm/worker.py
+11
-10
11 additions, 10 deletions
anselm/worker.py
with
18 additions
and
12 deletions
anselm.py
+
7
−
2
View file @
89a341c4
...
...
@@ -36,6 +36,7 @@ class Anselm(System):
def
add_device_line
(
self
):
self
.
current_grid_line
+=
1
line
=
self
.
current_grid_line
line_key
=
self
.
get_line_key
(
line
)
...
...
@@ -112,6 +113,7 @@ class Anselm(System):
self
.
log
.
debug
(
"
task: {}
"
.
format
(
task
))
def
auxobj_selected
(
self
,
combo
,
line
):
doc_id
=
combo
.
currentText
()
line_key
=
self
.
get_line_key
(
line
)
...
...
@@ -131,6 +133,7 @@ class Anselm(System):
self
.
grid
.
addWidget
(
widget
,
line
,
col
)
def
make_combo
(
self
,
item_list
,
first_item
=
'
select
'
):
combo
=
QComboBox
(
self
.
win
)
if
first_item
:
...
...
@@ -139,17 +142,20 @@ class Anselm(System):
for
item
in
item_list
:
combo
.
addItem
(
item
)
return
combo
def
get_line_key
(
self
,
line
):
return
'
line_{}
'
.
format
(
line
)
def
run_device
(
self
,
line
):
line_key
=
self
.
get_line_key
(
line
)
task
=
None
self
.
log
.
info
(
"
start device at line {}
"
.
format
(
line
))
if
line_key
in
self
.
state
:
if
'
task
'
in
self
.
state
[
line_key
]:
task
=
self
.
state
[
line_key
][
'
task
'
]
task
=
self
.
state
.
get
(
line_key
).
get
(
'
task
'
)
else
:
self
.
log
.
error
(
"
no task selected at line {}
"
.
format
(
line
))
if
task
:
...
...
@@ -161,4 +167,3 @@ if __name__ == '__main__':
app
=
QApplication
(
sys
.
argv
)
ex
=
Anselm
()
sys
.
exit
(
app
.
exec_
())
This diff is collapsed.
Click to expand it.
anselm/worker.py
+
11
−
10
View file @
89a341c4
...
...
@@ -8,27 +8,28 @@ class Worker(System):
def
__init__
(
self
):
super
().
__init__
()
relay_dict
=
self
.
config
[
'
relay
'
]
relay_dict
=
self
.
config
.
get
(
'
relay
'
)
self
.
relay_dict
=
relay_dict
self
.
relay_url
=
"
http://{}:{}
"
.
format
(
relay_dict
[
'
host
'
]
,
relay_dict
[
'
port
'
]
)
self
.
relay_url
=
"
http://{}:{}
"
.
format
(
relay_dict
.
get
(
'
host
'
)
,
relay_dict
.
get
(
'
port
'
)
self
.
headers
=
{
'
content-type
'
:
'
application/json
'
}
def
run
(
self
,
task
):
acc
=
task
[
'
Action
'
]
acc
=
task
.
get
(
'
Action
'
)
if
acc
:
if
acc
==
"
TCP
"
:
self
.
relay_worker
(
task
)
else
:
self
.
log
.
error
(
"
task contains no action
"
)
if
acc
==
"
TCP
"
:
self
.
relay_worker
(
task
)
def
relay_worker
(
self
,
task
):
req
=
requests
.
post
(
self
.
relay_url
,
data
=
json
.
dumps
(
task
),
headers
=
self
.
headers
)
res
=
req
.
json
()
if
'
Result
'
in
res
:
print
(
res
[
'
Result
'
]
)
print
(
res
.
get
(
'
Result
'
)
)
print
(
self
.
state
)
print
(
"
dddddddddddddddddd
"
)
if
'
ToExchange
'
in
res
:
print
(
res
[
'
ToExchange
'
]
)
print
(
res
.
get
(
'
ToExchange
'
)
)
\ No newline at end of file
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