Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Benjamin Jakimow
EO Time Series Viewer
Commits
4aeaf619
Commit
4aeaf619
authored
Feb 07, 2011
by
Luke Campagnola
Browse files
Merge changes from lp:~ibressler/pyqtgraph/devel
parents
c5539296
1efb60a9
Changes
4
Hide whitespace changes
Inline
Side-by-side
GraphicsView.py
View file @
4aeaf619
...
...
@@ -226,15 +226,14 @@ class GraphicsView(QtGui.QGraphicsView):
def
wheelEvent
(
self
,
ev
):
QtGui
.
QGraphicsView
.
wheelEvent
(
self
,
ev
)
if
not
self
.
mouseEnabled
:
return
QtGui
.
QGraphicsView
.
wheelEvent
(
self
,
ev
)
sc
=
1.001
**
ev
.
delta
()
#self.scale *= sc
#self.updateMatrix()
self
.
scale
(
sc
,
sc
)
def
setAspectLocked
(
self
,
s
):
self
.
aspectLocked
=
s
...
...
PlotItem.py
View file @
4aeaf619
...
...
@@ -953,7 +953,7 @@ class PlotItem(QtGui.QGraphicsWidget):
if
arr
.
ndim
!=
1
:
raise
Exception
(
"Array must be 1D to plot (shape is %s)"
%
arr
.
shape
)
if
x
is
None
:
x
=
arange
(
arr
.
shape
[
0
])
x
=
np
.
arange
(
arr
.
shape
[
0
])
if
x
.
ndim
!=
1
:
raise
Exception
(
"X array must be 1D to plot (shape is %s)"
%
x
.
shape
)
c
=
PlotCurveItem
(
arr
,
x
=
x
)
...
...
examples/test_PlotWidget.py
View file @
4aeaf619
...
...
@@ -5,6 +5,7 @@ import sys, os
sys
.
path
.
append
(
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
'..'
,
'..'
))
from
scipy
import
random
from
numpy
import
array
,
arange
from
PyQt4
import
QtGui
,
QtCore
from
pyqtgraph.PlotWidget
import
*
from
pyqtgraph.graphicsItems
import
*
...
...
@@ -90,4 +91,4 @@ for i in range(0, 5):
yd
,
xd
=
rand
(
10000
)
pw2
.
plot
(
y
=
yd
*
(
j
+
1
),
x
=
xd
,
params
=
{
'iter'
:
i
,
'val'
:
j
})
#
app.exec_()
app
.
exec_
()
graphicsItems.py
View file @
4aeaf619
...
...
@@ -1458,8 +1458,10 @@ class ScaleItem(QtGui.QGraphicsWidget):
else
:
xs
=
bounds
.
width
()
/
dif
tickPositions
=
set
()
# remembers positions of previously drawn ticks
## draw ticks and text
for
i
in
[
i1
,
i1
+
1
,
i1
+
2
]:
## draw three different intervals
## draw three different intervals, long ticks first
for
i
in
reversed
([
i1
,
i1
+
1
,
i1
+
2
]):
if
i
>
len
(
intervals
):
continue
## spacing for this interval
...
...
@@ -1503,7 +1505,11 @@ class ScaleItem(QtGui.QGraphicsWidget):
if
p1
[
1
-
axis
]
<
0
:
continue
p
.
setPen
(
QtGui
.
QPen
(
QtGui
.
QColor
(
100
,
100
,
100
,
a
)))
p
.
drawLine
(
Point
(
p1
),
Point
(
p2
))
# draw tick only if there is none
tickPos
=
p1
[
1
-
axis
]
if
tickPos
not
in
tickPositions
:
p
.
drawLine
(
Point
(
p1
),
Point
(
p2
))
tickPositions
.
add
(
tickPos
)
if
i
==
textLevel
:
if
abs
(
v
)
<
.
001
or
abs
(
v
)
>=
10000
:
vstr
=
"%g"
%
(
v
*
self
.
scale
)
...
...
@@ -1728,7 +1734,16 @@ class ViewBox(QtGui.QGraphicsWidget):
#self.replot(autoRange=False)
#self.updateMatrix()
def
wheelEvent
(
self
,
ev
):
mask
=
np
.
array
(
self
.
mouseEnabled
,
dtype
=
np
.
float
)
degree
=
ev
.
delta
()
/
8.0
;
dif
=
np
.
array
([
degree
,
degree
])
s
=
((
mask
*
0.02
)
+
1
)
**
dif
center
=
Point
(
self
.
childGroup
.
transform
().
inverted
()[
0
].
map
(
ev
.
pos
()))
self
.
scaleBy
(
s
,
center
)
self
.
emit
(
QtCore
.
SIGNAL
(
'rangeChangedManually'
),
self
.
mouseEnabled
)
ev
.
accept
()
def
mouseMoveEvent
(
self
,
ev
):
QtGui
.
QGraphicsWidget
.
mouseMoveEvent
(
self
,
ev
)
pos
=
np
.
array
([
ev
.
pos
().
x
(),
ev
.
pos
().
y
()])
...
...
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