Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Pedro Henrique Kopper
SADAPMAP
Commits
6785ac5f
Commit
6785ac5f
authored
Nov 16, 2017
by
Alisson Claudino
Browse files
Bug na mudança de escala
parent
74d75898
Changes
2
Hide whitespace changes
Inline
Side-by-side
Interface/Graph.py
View file @
6785ac5f
...
...
@@ -5,7 +5,7 @@ class Graph(pyqtgraph.GraphicsLayout):
index
=
1
def
__init__
(
self
,
x_range
,
y_range
,
x_size
,
y_size
,
color1
,
color2
):
def
__init__
(
self
,
x_range
,
y_range
,
x_size
,
y_size
,
color1
,
color2
,
name1
,
name2
):
super
(
Graph
,
self
).
__init__
()
self
.
x_range
=
x_range
self
.
y_range
=
y_range
...
...
@@ -13,10 +13,14 @@ class Graph(pyqtgraph.GraphicsLayout):
self
.
y_size
=
y_size
self
.
color1
=
color1
self
.
color2
=
color2
self
.
name1
=
name1
self
.
name2
=
name2
self
.
p1
=
self
.
addPlot
()
self
.
curve1
=
self
.
p1
.
plot
(
pen
=
color1
)
self
.
curve2
=
self
.
p1
.
plot
(
pen
=
color2
)
self
.
p1
.
addLegend
()
self
.
curve1
=
self
.
p1
.
plot
(
pen
=
color1
,
name
=
self
.
name1
)
self
.
curve2
=
self
.
p1
.
plot
(
pen
=
color2
,
name
=
self
.
name2
)
self
.
p1
.
showGrid
(
True
,
True
)
self
.
setPreferredSize
(
self
.
x_size
,
self
.
y_size
)
self
.
p1
.
setXRange
(
0
,
self
.
x_range
,
padding
=
0
)
self
.
p1
.
setYRange
(
0
,
self
.
y_range
,
padding
=
0
)
...
...
@@ -57,9 +61,11 @@ class Graph(pyqtgraph.GraphicsLayout):
self
.
y1
=
[]
self
.
y2
=
[]
self
.
index
=
0
self
.
clear
(
)
self
.
removeItem
(
self
.
p1
)
self
.
p1
=
self
.
addPlot
()
self
.
p1
.
setXRange
(
0
,
self
.
x_range
,
padding
=
0
)
self
.
p1
.
setYRange
(
0
,
self
.
y_range
,
padding
=
0
)
self
.
curve1
=
self
.
p1
.
plot
(
pen
=
self
.
color1
)
self
.
curve2
=
self
.
p1
.
plot
(
pen
=
self
.
color2
)
\ No newline at end of file
self
.
p1
.
addLegend
()
self
.
curve1
=
self
.
p1
.
plot
(
pen
=
self
.
color1
,
name
=
self
.
name1
)
self
.
curve2
=
self
.
p1
.
plot
(
pen
=
self
.
color2
,
name
=
self
.
name2
)
self
.
p1
.
showGrid
(
True
,
True
)
\ No newline at end of file
Interface/SystemEngine.py
View file @
6785ac5f
...
...
@@ -18,7 +18,7 @@ class SystemEngine(object):
self
.
uiCalibra1
=
Ui_MainWindow
()
self
.
uiCalibra1
.
setupUi
(
self
.
dialog
)
self
.
uiCalibra1
.
serialListPanel
(
self
.
ser1
.
portList
)
self
.
layout
=
Graph
(
100
,
3
75
00
,
900
,
6
00
,
'r'
,
'g'
)
self
.
layout
=
Graph
(
100
,
3
00
00
,
900
,
5
00
,
'r'
,
'g'
,
"Força"
,
"Tensão no Calibrante"
)
self
.
scene
=
QtGui
.
QGraphicsScene
()
self
.
scene
.
addItem
(
self
.
layout
)
self
.
uiCalibra1
.
sceneSelector
(
self
.
scene
)
...
...
@@ -34,17 +34,14 @@ class SystemEngine(object):
readData
=
self
.
ser1
.
read
()
# Lê o dado da serial
readData
=
readData
.
decode
(
'utf8'
)
dado
=
readData
.
split
(
' '
,
3
)
print
(
dado
)
try
:
self
.
x_scale
=
int
(
self
.
uiCalibra1
.
t_max
.
text
())
except
ValueError
:
self
.
x_scale
=
100
if
(
self
.
x_scale
!=
self
.
prev_x_scale
):
try
:
self
.
layout
.
setGraphScale
(
int
(
self
.
x_scale
),
32700
)
except
:
print
(
"Err0r"
)
self
.
layout
.
setGraphScale
(
int
(
self
.
x_scale
),
32700
)
self
.
prev_x_scale
=
self
.
x_scale
self
.
uiCalibra1
.
forcaLabel
.
setText
(
str
(
dado
[
0
])
+
" Tonf"
)
self
.
uiCalibra1
.
calibranteLabel
.
setText
(
str
(
dado
[
1
].
split
()[
0
])
+
" mV"
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment