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
dc597ac5
Commit
dc597ac5
authored
Mar 01, 2012
by
Luke Campagnola
Browse files
fixes for pyside compatibility
parent
9baa0116
Changes
15
Hide whitespace changes
Inline
Side-by-side
Qt.py
View file @
dc597ac5
## Do all Qt imports from here to allow easier PyQt / PySide compatibility
#
from PySide import QtGui, QtCore, QtOpenGL, QtSvg
from
PyQt4
import
QtGui
,
QtCore
,
QtOpenGL
,
QtSvg
if
not
hasattr
(
QtCore
,
'Signal'
):
QtCore
.
Signal
=
QtCore
.
pyqtSignal
from
PySide
import
QtGui
,
QtCore
,
QtOpenGL
,
QtSvg
#
from PyQt4 import QtGui, QtCore, QtOpenGL, QtSvg
#
if not hasattr(QtCore, 'Signal'):
#
QtCore.Signal = QtCore.pyqtSignal
examples/Arrow.py
View file @
dc597ac5
...
...
@@ -4,7 +4,7 @@ import sys, os
sys
.
path
.
insert
(
0
,
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
'..'
,
'..'
))
import
numpy
as
np
from
Py
Qt
4
import
QtGui
,
QtCore
from
pyqtgraph.
Qt
import
QtGui
,
QtCore
import
pyqtgraph
as
pg
...
...
examples/CLIexample.py
View file @
dc597ac5
...
...
@@ -3,7 +3,7 @@ import sys, os
sys
.
path
.
insert
(
0
,
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
'..'
,
'..'
))
from
Py
Qt
4
import
QtGui
,
QtCore
from
pyqtgraph.
Qt
import
QtGui
,
QtCore
import
numpy
as
np
import
pyqtgraph
as
pg
...
...
examples/GradientEditor.py
View file @
dc597ac5
...
...
@@ -4,7 +4,7 @@ import sys, os
sys
.
path
.
insert
(
0
,
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
'..'
,
'..'
))
import
numpy
as
np
from
Py
Qt
4
import
QtGui
,
QtCore
from
pyqtgraph.
Qt
import
QtGui
,
QtCore
import
pyqtgraph
as
pg
...
...
examples/GraphicsLayout.py
View file @
dc597ac5
...
...
@@ -2,7 +2,7 @@
import
sys
,
os
sys
.
path
.
insert
(
0
,
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
'..'
,
'..'
))
from
Py
Qt
4
import
QtGui
,
QtCore
from
pyqtgraph.
Qt
import
QtGui
,
QtCore
import
pyqtgraph
as
pg
import
user
...
...
examples/HistogramLUT.py
View file @
dc597ac5
...
...
@@ -5,7 +5,7 @@ sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..', '..'))
import
numpy
as
np
import
scipy.ndimage
as
ndi
from
Py
Qt
4
import
QtGui
,
QtCore
from
pyqtgraph.
Qt
import
QtGui
,
QtCore
import
pyqtgraph
as
pg
...
...
examples/MultiPlotWidget.py
View file @
dc597ac5
...
...
@@ -7,7 +7,7 @@ sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..', '..'))
from
scipy
import
random
from
numpy
import
linspace
from
Py
Qt
4
import
QtGui
,
QtCore
from
pyqtgraph.
Qt
import
QtGui
,
QtCore
import
pyqtgraph
as
pg
from
pyqtgraph
import
MultiPlotWidget
try
:
...
...
examples/PlotSpeedTest.py
View file @
dc597ac5
...
...
@@ -5,7 +5,7 @@ import sys, os, time
sys
.
path
.
insert
(
0
,
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
'..'
,
'..'
))
from
Py
Qt
4
import
QtGui
,
QtCore
from
pyqtgraph.
Qt
import
QtGui
,
QtCore
import
numpy
as
np
import
pyqtgraph
as
pg
...
...
examples/PlotWidget.py
View file @
dc597ac5
...
...
@@ -5,7 +5,7 @@ import sys, os
sys
.
path
.
insert
(
0
,
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
'..'
,
'..'
))
from
Py
Qt
4
import
QtGui
,
QtCore
from
pyqtgraph.
Qt
import
QtGui
,
QtCore
import
numpy
as
np
import
pyqtgraph
as
pg
...
...
examples/Plotting.py
View file @
dc597ac5
...
...
@@ -5,7 +5,7 @@ import sys, os
sys
.
path
.
insert
(
0
,
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
'..'
,
'..'
))
from
Py
Qt
4
import
QtGui
,
QtCore
from
pyqtgraph.
Qt
import
QtGui
,
QtCore
import
numpy
as
np
import
pyqtgraph
as
pg
...
...
examples/ScatterPlot.py
View file @
dc597ac5
...
...
@@ -3,7 +3,7 @@ import sys, os
## Add path to library (just for examples; you do not need this)
sys
.
path
.
insert
(
0
,
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
'..'
,
'..'
))
from
Py
Qt
4
import
QtGui
,
QtCore
from
pyqtgraph.
Qt
import
QtGui
,
QtCore
import
pyqtgraph
as
pg
import
numpy
as
np
...
...
examples/VideoSpeedTest.py
View file @
dc597ac5
...
...
@@ -5,7 +5,7 @@ import sys, os, time
sys
.
path
.
insert
(
0
,
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
'..'
,
'..'
))
from
Py
Qt
4
import
QtGui
,
QtCore
from
pyqtgraph.
Qt
import
QtGui
,
QtCore
import
numpy
as
np
import
pyqtgraph
as
pg
from
pyqtgraph
import
RawImageWidget
...
...
examples/ViewBox.py
View file @
dc597ac5
...
...
@@ -8,7 +8,7 @@ sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..', '..'))
#from scipy import random
import
numpy
as
np
from
Py
Qt
4
import
QtGui
,
QtCore
from
pyqtgraph.
Qt
import
QtGui
,
QtCore
import
pyqtgraph
as
pg
app
=
QtGui
.
QApplication
([])
...
...
examples/__main__.py
View file @
dc597ac5
from
PyQt4
import
QtCore
,
QtGui
import
sys
,
os
## make sure this pyqtgraph is importable before any others
sys
.
path
.
insert
(
0
,
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
'..'
,
'..'
))
from
pyqtgraph.Qt
import
QtCore
,
QtGui
from
exampleLoaderTemplate
import
Ui_Form
import
os
,
sys
from
collections
import
OrderedDict
...
...
@@ -98,4 +102,4 @@ def run():
app
.
exec_
()
if
__name__
==
'__main__'
:
run
()
\ No newline at end of file
run
()
graphicsItems/GraphicsItemMethods.py
View file @
dc597ac5
...
...
@@ -51,7 +51,6 @@ class GraphicsItemMethods(object):
if
hasattr
(
p
,
'implements'
)
and
p
.
implements
(
'ViewBox'
):
self
.
_viewBox
=
weakref
.
ref
(
p
)
break
return
self
.
_viewBox
()
## If we made it this far, _viewBox is definitely not None
def
forgetViewBox
(
self
):
...
...
@@ -78,7 +77,10 @@ class GraphicsItemMethods(object):
if
view
is
None
:
return
None
if
hasattr
(
view
,
'implements'
)
and
view
.
implements
(
'ViewBox'
):
return
self
.
itemTransform
(
view
.
innerSceneItem
())[
0
]
tr
=
self
.
itemTransform
(
view
.
innerSceneItem
())
if
isinstance
(
tr
,
tuple
):
tr
=
tr
[
0
]
## difference between pyside and pyqt
return
tr
else
:
return
self
.
sceneTransform
()
#return self.deviceTransform(view.viewportTransform())
...
...
@@ -102,7 +104,11 @@ class GraphicsItemMethods(object):
view
=
self
.
getViewBox
()
if
view
is
None
:
return
None
bounds
=
self
.
mapRectFromView
(
view
.
viewRect
()).
normalized
()
bounds
=
self
.
mapRectFromView
(
view
.
viewRect
())
if
bounds
is
None
:
return
None
bounds
=
bounds
.
normalized
()
## nah.
#for p in self.getBoundingParents():
...
...
@@ -246,7 +252,10 @@ class GraphicsItemMethods(object):
if
relativeItem
is
None
:
relativeItem
=
self
.
parentItem
()
tr
=
self
.
itemTransform
(
relativeItem
)[
0
]
tr
=
self
.
itemTransform
(
relativeItem
)
if
isinstance
(
tr
,
tuple
):
## difference between pyside and pyqt
tr
=
tr
[
0
]
vec
=
tr
.
map
(
Point
(
1
,
0
))
-
tr
.
map
(
Point
(
0
,
0
))
return
Point
(
vec
).
angle
(
Point
(
1
,
0
))
...
...
Write
Preview
Supports
Markdown
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