Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
slu-totem-compressor
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
cs
gui
slu-totem-compressor
Commits
1eab9fa0
Commit
1eab9fa0
authored
4 years ago
by
Lorenzo Pivetta
Browse files
Options
Downloads
Patches
Plain Diff
Initial import
parent
2ee9e6e8
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Makefile
+18
-0
18 additions, 0 deletions
Makefile
src/slu-totem-compressor.py
+352
-0
352 additions, 0 deletions
src/slu-totem-compressor.py
with
370 additions
and
0 deletions
Makefile
0 → 100644
+
18
−
0
View file @
1eab9fa0
NAME
=
slu-totem-compressor-gui
MAIN
=
slu-totem-compressor.py
DIRNAME
=
$(
NAME:-gui
=
)
PY_FILES
+=
$(
wildcard src/
*
.py
)
default
:
bin ${PY_FILES}
@
cp
${
PY_FILES
}
bin/
${
DIRNAME
}
@
echo
"#!/bin/bash
\n
exec /runtime/bin/
${
DIRNAME
}
/
${
MAIN
}
"
>
bin/
${
NAME
}
@
chmod
+x bin/
${
NAME
}
bin/
${
DIRNAME
}
/
${
MAIN
}
bin
:
@
test
-d
$@
||
mkdir
-p
$@
/
${
DIRNAME
}
clean
:
@
rm
-fr
bin/ src/
*
~
.PHONY
:
clean
This diff is collapsed.
Click to expand it.
src/slu-totem-compressor.py
0 → 100644
+
352
−
0
View file @
1eab9fa0
#!/usr/bin/python
from
__future__
import
division
import
sys
import
PyTango
from
PyQt4.QtCore
import
*
from
PyQt4.QtGui
import
*
import
numpy
as
np
import
time
global
massimo
massimo
=
27.3
global
minimo
minimo
=
15.3
global
devprodic
devprodic
=
{}
devprodic
[
'
motor1
'
]
=
PyTango
.
DeviceProxy
(
'
slu/motor/trls_slu.02
'
)
devprodic
[
'
motor2
'
]
=
PyTango
.
DeviceProxy
(
'
slu/motor/trls_slu.04
'
)
devprodic
[
'
ranges
'
]
=
PyTango
.
DeviceProxy
(
'
slu/misc/ranges
'
)
class
MainWindow
(
QDialog
):
def
__init__
(
self
,
parent
=
None
):
super
(
MainWindow
,
self
).
__init__
(
parent
)
self
.
compressor1pos
=
QLineEdit
(
""
)
self
.
compressor1pos
.
setReadOnly
(
1
)
self
.
compressor1pos
.
setStyleSheet
(
"
background-color: rgb(237, 237, 237)
"
)
self
.
compressor2pos
=
QLineEdit
(
""
)
self
.
compressor2pos
.
setReadOnly
(
1
)
self
.
compressor2pos
.
setStyleSheet
(
"
background-color: rgb(237, 237, 237)
"
)
self
.
state_motor1
=
QLineEdit
(
""
)
self
.
state_motor1
.
setReadOnly
(
1
)
self
.
state_motor2
=
QLineEdit
(
""
)
self
.
state_motor2
.
setReadOnly
(
1
)
self
.
comune_inputabs
=
QLineEdit
(
""
)
self
.
comune_inputrel
=
QLineEdit
(
""
)
self
.
comune_goto
=
QPushButton
(
"
Go to
"
)
self
.
comune_goto
.
clicked
.
connect
(
self
.
comando_comune_goto
)
self
.
comune_b
=
QPushButton
(
"
<
"
)
self
.
comune_b
.
clicked
.
connect
(
self
.
comando_comune_b
)
self
.
comune_f
=
QPushButton
(
"
>
"
)
self
.
comune_f
.
clicked
.
connect
(
self
.
comando_comune_f
)
self
.
comune_stop
=
QPushButton
(
"
STOP
"
)
self
.
comune_stop
.
clicked
.
connect
(
self
.
comando_comune_stop
)
#self.cb_stimaritardo = QCheckBox("Start delay record")
#self.cb_stimaritardo.clicked.connect(self.comando_delay_record)
#self.stimaritardo = QLineEdit("")
#self.stimaritardo.setReadOnly(1)
#self.stimaritardo.setStyleSheet("background-color: rgb(237, 237, 237)")
#self.stimaritardo.setDisabled(1)
self
.
motore1_pos
=
QLineEdit
(
""
)
self
.
motore1_pos
.
setReadOnly
(
1
)
self
.
motore1_pos
.
setStyleSheet
(
"
background-color: rgb(237, 237, 237)
"
)
self
.
motore1_offset_read
=
QLineEdit
(
""
)
self
.
motore1_offset_read
.
setReadOnly
(
1
)
self
.
motore1_offset_read
.
setStyleSheet
(
"
background-color: rgb(237, 237, 237)
"
)
self
.
motore1_offset_write
=
QLineEdit
(
""
)
self
.
motore1_offset_change
=
QPushButton
(
"
Change
"
)
self
.
motore1_offset_change
.
clicked
.
connect
(
self
.
comando_motor1_change
)
self
.
motore1_posabs
=
QLineEdit
(
""
)
self
.
motore1_goto
=
QPushButton
(
"
Go to
"
)
self
.
motore1_goto
.
clicked
.
connect
(
self
.
comando_motor1_goto
)
self
.
motore1_stop
=
QPushButton
(
"
STOP
"
)
self
.
motore1_stop
.
clicked
.
connect
(
self
.
comando_motor1_stop
)
self
.
motore1_stop
.
setMinimumHeight
(
150
)
self
.
motore1_b
=
QPushButton
(
"
<
"
)
self
.
motore1_b
.
clicked
.
connect
(
self
.
comando_motor1_b
)
self
.
motore1_posrel
=
QLineEdit
(
""
)
self
.
motore1_f
=
QPushButton
(
"
>
"
)
self
.
motore1_f
.
clicked
.
connect
(
self
.
comando_motor1_f
)
self
.
motore1_status
=
QLineEdit
(
""
)
self
.
motore1_status
.
setReadOnly
(
1
)
self
.
motore1_init
=
QPushButton
(
"
INIT
"
)
self
.
motore1_init
.
clicked
.
connect
(
self
.
comando_motor1_init
)
self
.
motore2_pos
=
QLineEdit
(
""
)
self
.
motore2_pos
.
setReadOnly
(
1
)
self
.
motore2_pos
.
setStyleSheet
(
"
background-color: rgb(237, 237, 237)
"
)
self
.
motore2_offset_read
=
QLineEdit
(
""
)
self
.
motore2_offset_read
.
setReadOnly
(
1
)
self
.
motore2_offset_read
.
setStyleSheet
(
"
background-color: rgb(237, 237, 237)
"
)
self
.
motore2_offset_write
=
QLineEdit
(
""
)
self
.
motore2_offset_change
=
QPushButton
(
"
Change
"
)
self
.
motore2_offset_change
.
clicked
.
connect
(
self
.
comando_motor2_change
)
self
.
motore2_posabs
=
QLineEdit
(
""
)
self
.
motore2_goto
=
QPushButton
(
"
Go to
"
)
self
.
motore2_goto
.
clicked
.
connect
(
self
.
comando_motor2_goto
)
self
.
motore2_stop
=
QPushButton
(
"
STOP
"
)
self
.
motore2_stop
.
clicked
.
connect
(
self
.
comando_motor2_stop
)
self
.
motore2_stop
.
setMinimumHeight
(
150
)
self
.
motore2_b
=
QPushButton
(
"
<
"
)
self
.
motore2_b
.
clicked
.
connect
(
self
.
comando_motor2_b
)
self
.
motore2_posrel
=
QLineEdit
(
""
)
self
.
motore2_f
=
QPushButton
(
"
>
"
)
self
.
motore2_f
.
clicked
.
connect
(
self
.
comando_motor2_f
)
self
.
motore2_status
=
QLineEdit
(
""
)
self
.
motore2_status
.
setReadOnly
(
1
)
self
.
motore2_init
=
QPushButton
(
"
INIT
"
)
self
.
motore2_init
.
clicked
.
connect
(
self
.
comando_motor2_init
)
self
.
contienitab
=
QTabWidget
()
self
.
tab1
=
QWidget
()
self
.
tab2
=
QWidget
()
self
.
tab3
=
QWidget
()
#self.tab4 = QWidget()
self
.
contienitab
.
addTab
(
self
.
tab1
,
"
Compressor
"
)
self
.
contienitab
.
addTab
(
self
.
tab2
,
"
trls_slu.02
"
)
self
.
contienitab
.
addTab
(
self
.
tab3
,
"
trls_slu.04
"
)
#self.contienitab.addTab(self.tab4, "Info")
lot1
=
QGridLayout
()
lot1
.
addWidget
(
QLabel
(
"
ABSOLUTE Movement
"
),
0
,
0
,
1
,
4
)
lot1
.
addWidget
(
self
.
comune_inputabs
,
0
,
4
,
1
,
3
)
lot1
.
addWidget
(
self
.
comune_goto
,
0
,
7
,
1
,
3
)
lot1
.
addWidget
(
self
.
comune_stop
,
0
,
10
,
1
,
1
)
lot1
.
addWidget
(
QLabel
(
"
RELATIVE Movement
"
),
1
,
0
,
1
,
4
)
lot1
.
addWidget
(
self
.
comune_b
,
1
,
4
,
1
,
2
)
lot1
.
addWidget
(
self
.
comune_inputrel
,
1
,
6
,
1
,
3
)
lot1
.
addWidget
(
self
.
comune_f
,
1
,
9
,
1
,
2
)
#lot1.addWidget(QLabel("Delay"), 2, 0, 1, 4)
#lot1.addWidget(self.cb_stimaritardo, 2, 4, 1, 3)
#lot1.addWidget(self.stimaritardo, 2, 7, 1, 3)
self
.
tab1
.
setLayout
(
lot1
)
self
.
tab1
.
layout
().
setSizeConstraint
(
QLayout
.
SetFixedSize
)
lot2
=
QGridLayout
()
lot2
.
addWidget
(
QLabel
(
"
Position
"
),
0
,
0
,
1
,
1
)
lot2
.
addWidget
(
self
.
motore1_pos
,
0
,
1
,
1
,
1
)
lot2
.
addWidget
(
self
.
motore1_posabs
,
0
,
2
,
1
,
1
)
lot2
.
addWidget
(
self
.
motore1_goto
,
0
,
3
,
1
,
1
)
lot2
.
addWidget
(
self
.
motore1_b
,
1
,
1
,
1
,
1
)
lot2
.
addWidget
(
self
.
motore1_posrel
,
1
,
2
,
1
,
1
)
lot2
.
addWidget
(
self
.
motore1_f
,
1
,
3
,
1
,
1
)
lot2
.
addWidget
(
QLabel
(
"
Offset
"
),
2
,
0
,
1
,
1
)
lot2
.
addWidget
(
self
.
motore1_offset_read
,
2
,
1
,
1
,
1
)
lot2
.
addWidget
(
self
.
motore1_offset_write
,
2
,
2
,
1
,
1
)
lot2
.
addWidget
(
self
.
motore1_offset_change
,
2
,
3
,
1
,
1
)
lot2
.
addWidget
(
QLabel
(
"
Status
"
),
3
,
0
,
1
,
1
)
lot2
.
addWidget
(
self
.
motore1_status
,
3
,
1
,
1
,
2
)
lot2
.
addWidget
(
self
.
motore1_init
,
3
,
3
,
1
,
1
)
lot2
.
addWidget
(
self
.
motore1_stop
,
0
,
4
,
4
,
1
)
self
.
tab2
.
setLayout
(
lot2
)
self
.
tab2
.
layout
().
setSizeConstraint
(
QLayout
.
SetFixedSize
)
lot3
=
QGridLayout
()
lot3
.
addWidget
(
QLabel
(
"
Position
"
),
0
,
0
,
1
,
1
)
lot3
.
addWidget
(
self
.
motore2_pos
,
0
,
1
,
1
,
1
)
lot3
.
addWidget
(
self
.
motore2_posabs
,
0
,
2
,
1
,
1
)
lot3
.
addWidget
(
self
.
motore2_goto
,
0
,
3
,
1
,
1
)
lot3
.
addWidget
(
self
.
motore2_b
,
1
,
1
,
1
,
1
)
lot3
.
addWidget
(
self
.
motore2_posrel
,
1
,
2
,
1
,
1
)
lot3
.
addWidget
(
self
.
motore2_f
,
1
,
3
,
1
,
1
)
lot3
.
addWidget
(
QLabel
(
"
Offset
"
),
2
,
0
,
1
,
1
)
lot3
.
addWidget
(
self
.
motore2_offset_read
,
2
,
1
,
1
,
1
)
lot3
.
addWidget
(
self
.
motore2_offset_write
,
2
,
2
,
1
,
1
)
lot3
.
addWidget
(
self
.
motore2_offset_change
,
2
,
3
,
1
,
1
)
lot3
.
addWidget
(
QLabel
(
"
Status
"
),
3
,
0
,
1
,
1
)
lot3
.
addWidget
(
self
.
motore2_status
,
3
,
1
,
1
,
2
)
lot3
.
addWidget
(
self
.
motore2_init
,
3
,
3
,
1
,
1
)
lot3
.
addWidget
(
self
.
motore2_stop
,
0
,
4
,
4
,
1
)
self
.
tab3
.
setLayout
(
lot3
)
self
.
tab3
.
layout
().
setSizeConstraint
(
QLayout
.
SetFixedSize
)
lo
=
QGridLayout
()
lo
.
addWidget
(
QLabel
(
"
Compressor 1 State & Position
"
),
0
,
0
,
1
,
3
)
lo
.
addWidget
(
self
.
state_motor1
,
1
,
1
,
1
,
1
)
lo
.
addWidget
(
self
.
compressor1pos
,
1
,
2
,
1
,
1
)
lo
.
addWidget
(
QLabel
(
"
Compressor 2 State & Position
"
),
0
,
4
,
1
,
3
)
lo
.
addWidget
(
self
.
state_motor2
,
1
,
5
,
1
,
1
)
lo
.
addWidget
(
self
.
compressor2pos
,
1
,
6
,
1
,
1
)
lo
.
addWidget
(
self
.
contienitab
,
2
,
0
,
1
,
7
)
self
.
setLayout
(
lo
)
self
.
layout
().
setSizeConstraint
(
QLayout
.
SetFixedSize
)
self
.
setStyleSheet
(
"
QDialog {background-color: rgb(200, 255, 200)}
"
+
"
QGroupBox {background-color: rgb(210, 255, 210)}
"
)
self
.
setWindowTitle
(
"
SLU TOTEM COMPRESSOR
"
)
self
.
show
()
self
.
timer
=
QBasicTimer
()
self
.
timer
.
start
(
1000
,
self
)
def
timerEvent
(
self
,
event
):
self
.
update
()
def
__del__
(
self
):
self
.
timer
.
stop
()
pass
def
update
(
self
):
chiamata_motor_1
=
devprodic
[
'
motor1
'
].
read_attributes
([
'
Position
'
,
'
State
'
,
'
Status
'
,
'
NegativeLimitSwitch
'
,
'
PositiveLimitSwitch
'
])
self
.
state_motor1
.
setText
(
str
(
chiamata_motor_1
[
1
].
value
))
self
.
motore1_pos
.
setText
(
str
(
round
(
chiamata_motor_1
[
0
].
value
,
3
)))
self
.
motore1_status
.
setText
(
str
(
chiamata_motor_1
[
2
].
value
))
chiamata_motor_2
=
devprodic
[
'
motor2
'
].
read_attributes
([
'
Position
'
,
'
State
'
,
'
Status
'
,
'
NegativeLimitSwitch
'
,
'
PositiveLimitSwitch
'
])
self
.
state_motor2
.
setText
(
str
(
chiamata_motor_2
[
1
].
value
))
self
.
motore2_pos
.
setText
(
str
(
round
(
chiamata_motor_2
[
0
].
value
,
3
)))
self
.
motore2_status
.
setText
(
str
(
chiamata_motor_2
[
2
].
value
))
chiamata_offset
=
devprodic
[
'
ranges
'
].
read_attributes
([
'
Totem_compressor_Motor_1_offset
'
,
'
Totem_compressor_Motor_2_offset
'
])
self
.
motore1_offset_read
.
setText
(
str
(
chiamata_offset
[
0
].
value
))
self
.
motore2_offset_read
.
setText
(
str
(
chiamata_offset
[
1
].
value
))
self
.
compressor1pos
.
setText
(
str
(
round
(
chiamata_offset
[
0
].
value
-
chiamata_motor_1
[
0
].
value
,
3
)))
self
.
compressor2pos
.
setText
(
str
(
round
(
chiamata_offset
[
1
].
value
-
chiamata_motor_2
[
0
].
value
,
3
)))
if
chiamata_motor_1
[
3
].
value
or
chiamata_motor_1
[
4
].
value
:
self
.
state_motor1
.
setStyleSheet
(
"
background-color: #ff0000
"
)
self
.
state_motor1
.
setText
(
'
L.S. activated!!
'
)
else
:
self
.
state_motor1
.
setStyleSheet
(
"
background-color: #ffffff
"
)
if
chiamata_motor_2
[
3
].
value
or
chiamata_motor_2
[
4
].
value
:
self
.
state_motor2
.
setStyleSheet
(
"
background-color: #ff0000
"
)
self
.
state_motor2
.
setText
(
'
L.S. activated!!
'
)
else
:
self
.
state_motor2
.
setStyleSheet
(
"
background-color: #ffffff
"
)
def
comando_comune_goto
(
self
):
gol
=
float
(
self
.
comune_inputabs
.
text
())
if
gol
<=
massimo
and
gol
>=
minimo
:
gol1
=
devprodic
[
'
ranges
'
].
Totem_compressor_Motor_1_offset
-
gol
gol2
=
devprodic
[
'
ranges
'
].
Totem_compressor_Motor_2_offset
-
gol
devprodic
[
'
motor1
'
].
write_attribute
(
'
AxisCurrentPosition
'
,
gol1
)
devprodic
[
'
motor2
'
].
write_attribute
(
'
AxisCurrentPosition
'
,
gol2
)
else
:
self
.
msgBox
=
QMessageBox
()
self
.
msgBox
.
setIcon
(
QMessageBox
.
Question
)
self
.
msgBox
.
setStandardButtons
(
QMessageBox
.
Ok
)
self
.
msgBox
.
setText
(
"
Max gap is
"
+
str
(
massimo
)
+
"
mm. Min gap is
"
+
str
(
minimo
)
+
"
mm.
"
)
risp
=
self
.
msgBox
.
exec_
()
time
.
sleep
(
0.5
)
semaf1
=
str
(
devprodic
[
'
motor1
'
].
state
())
semaf2
=
str
(
devprodic
[
'
motor2
'
].
state
())
liberitutti
=
0
while
semaf1
==
'
MOVING
'
or
semaf2
==
'
MOVING
'
or
liberitutti
==
0
and
liberitutti
!=
10
:
print
(
'
i =
'
+
str
(
liberitutti
)
+
'
m1:
'
+
semaf1
+
'
, m2:
'
+
semaf2
)
liberitutti
=
liberitutti
+
1
time
.
sleep
(
0.3
)
semaf1
=
str
(
devprodic
[
'
motor1
'
].
state
())
semaf2
=
str
(
devprodic
[
'
motor2
'
].
state
())
def
comando_comune_b
(
self
):
gol
=
float
(
self
.
comune_inputrel
.
text
())
if
float
(
self
.
compressor2pos
.
text
())
-
gol
>=
minimo
or
float
(
self
.
compressor1pos
.
text
())
-
gol
>=
minimo
:
#print(float(self.compressor2pos.text()) - gol)
devprodic
[
'
motor1
'
].
command_inout
(
'
AxisGoToRelativePosition
'
,
gol
)
devprodic
[
'
motor2
'
].
command_inout
(
'
AxisGoToRelativePosition
'
,
gol
)
else
:
self
.
msgBox
=
QMessageBox
()
self
.
msgBox
.
setIcon
(
QMessageBox
.
Question
)
self
.
msgBox
.
setStandardButtons
(
QMessageBox
.
Ok
)
self
.
msgBox
.
setText
(
"
Max gap is
"
+
str
(
massimo
)
+
"
mm. Min gap is
"
+
str
(
minimo
)
+
"
mm.
"
)
risp
=
self
.
msgBox
.
exec_
()
time
.
sleep
(
0.5
)
semaf1
=
str
(
devprodic
[
'
motor1
'
].
state
())
semaf2
=
str
(
devprodic
[
'
motor2
'
].
state
())
liberitutti
=
0
while
semaf1
==
'
MOVING
'
or
semaf2
==
'
MOVING
'
or
liberitutti
==
0
and
liberitutti
!=
10
:
print
(
'
i =
'
+
str
(
liberitutti
)
+
'
m1:
'
+
semaf1
+
'
, m2:
'
+
semaf2
)
liberitutti
=
liberitutti
+
1
time
.
sleep
(
0.3
)
semaf1
=
str
(
devprodic
[
'
motor1
'
].
state
())
semaf2
=
str
(
devprodic
[
'
motor2
'
].
state
())
def
comando_comune_f
(
self
):
gol
=
float
(
self
.
comune_inputrel
.
text
())
if
float
(
self
.
compressor2pos
.
text
())
+
gol
<=
massimo
or
float
(
self
.
compressor1pos
.
text
())
+
gol
<=
massimo
:
#print(float(self.compressor2pos.text()) + gol)
devprodic
[
'
motor1
'
].
command_inout
(
'
AxisGoToRelativePosition
'
,
-
gol
)
devprodic
[
'
motor2
'
].
command_inout
(
'
AxisGoToRelativePosition
'
,
-
gol
)
else
:
self
.
msgBox
=
QMessageBox
()
self
.
msgBox
.
setIcon
(
QMessageBox
.
Question
)
self
.
msgBox
.
setStandardButtons
(
QMessageBox
.
Ok
)
self
.
msgBox
.
setText
(
"
Max gap is
"
+
str
(
massimo
)
+
"
mm. Min gap is
"
+
str
(
minimo
)
+
"
mm.
"
)
risp
=
self
.
msgBox
.
exec_
()
time
.
sleep
(
0.5
)
semaf1
=
str
(
devprodic
[
'
motor1
'
].
state
())
semaf2
=
str
(
devprodic
[
'
motor2
'
].
state
())
liberitutti
=
0
while
semaf1
==
'
MOVING
'
or
semaf2
==
'
MOVING
'
or
liberitutti
==
0
and
liberitutti
!=
10
:
print
(
'
i =
'
+
str
(
liberitutti
)
+
'
m1:
'
+
semaf1
+
'
, m2:
'
+
semaf2
)
liberitutti
=
liberitutti
+
1
time
.
sleep
(
0.3
)
semaf1
=
str
(
devprodic
[
'
motor1
'
].
state
())
semaf2
=
str
(
devprodic
[
'
motor2
'
].
state
())
def
comando_comune_stop
(
self
):
devprodic
[
'
motor1
'
].
axisstop
()
devprodic
[
'
motor2
'
].
axisstop
()
#def comando_delay_record(self):
#self.stimaritardo.setDisabled(0)
def
comando_motor1_change
(
self
):
gol
=
float
(
self
.
motore1_offset_write
.
text
())
devprodic
[
'
ranges
'
].
write_attribute
(
'
Totem_compressor_Motor_1_offset
'
,
gol
)
def
comando_motor1_goto
(
self
):
gol
=
float
(
self
.
motore1_posabs
.
text
())
devprodic
[
'
motor1
'
].
write_attribute
(
'
AxisCurrentPosition
'
,
gol
)
def
comando_motor1_stop
(
self
):
devprodic
[
'
motor1
'
].
axisstop
()
def
comando_motor1_b
(
self
):
gol
=
float
(
self
.
motore1_posrel
.
text
())
devprodic
[
'
motor1
'
].
command_inout
(
'
AxisGoToRelativePosition
'
,
-
gol
)
def
comando_motor1_f
(
self
):
gol
=
float
(
self
.
motore1_posrel
.
text
())
devprodic
[
'
motor1
'
].
command_inout
(
'
AxisGoToRelativePosition
'
,
gol
)
def
comando_motor1_init
(
self
):
devprodic
[
'
motor1
'
].
AxisInit
()
def
comando_motor2_change
(
self
):
gol
=
float
(
self
.
motore2_offset_write
.
text
())
devprodic
[
'
ranges
'
].
write_attribute
(
'
Totem_compressor_Motor_2_offset
'
,
gol
)
def
comando_motor2_goto
(
self
):
gol
=
float
(
self
.
motore2_posabs
.
text
())
devprodic
[
'
motor2
'
].
write_attribute
(
'
AxisCurrentPosition
'
,
gol
)
def
comando_motor2_stop
(
self
):
devprodic
[
'
motor2
'
].
axisstop
()
def
comando_motor2_b
(
self
):
gol
=
float
(
self
.
motore2_posrel
.
text
())
devprodic
[
'
motor2
'
].
command_inout
(
'
AxisGoToRelativePosition
'
,
-
gol
)
def
comando_motor2_f
(
self
):
gol
=
float
(
self
.
motore2_posrel
.
text
())
devprodic
[
'
motor2
'
].
command_inout
(
'
AxisGoToRelativePosition
'
,
gol
)
def
comando_motor2_init
(
self
):
devprodic
[
'
motor2
'
].
AxisInit
()
#####################
if
__name__
==
'
__main__
'
:
app
=
QApplication
([])
try
:
tmpdim
=
sys
.
argv
[
1
]
tmpdim
=
tmpdim
.
split
(
'
x
'
)
dimensione
=
[
float
(
tmpdim
[
0
]),
float
(
tmpdim
[
1
])]
except
:
screen
=
QDesktopWidget
().
screenGeometry
()
larghezzaaltezza
=
[
screen
.
width
(),
screen
.
height
()]
print
(
larghezzaaltezza
)
if
max
(
larghezzaaltezza
)
>
3000
:
dimensione
=
max
(
larghezzaaltezza
)
*
0.38
elif
max
(
larghezzaaltezza
)
>
2000
:
dimensione
=
max
(
larghezzaaltezza
)
*
0.6
elif
max
(
larghezzaaltezza
)
>
1000
:
dimensione
=
max
(
larghezzaaltezza
)
*
0.7
else
:
dimensione
=
max
(
larghezzaaltezza
)
*
2
font_pannello
=
QFont
(
"
Arial
"
,
round
(
dimensione
/
150.0
),
-
1
,
False
)
app
.
setFont
(
font_pannello
)
window
=
MainWindow
()
window
.
resize
(
larghezzaaltezza
[
0
]
/
6
,
larghezzaaltezza
[
1
]
/
6
)
window
.
show
()
app
.
exec_
()
This diff is collapsed.
Click to expand it.
Preview
0%
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