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
Yori Fournier
myplotlib
Commits
600008b7
Commit
600008b7
authored
Mar 08, 2017
by
Philipp Gast
Browse files
added infrastructure in other files
parent
2af2ac44
Changes
3
Hide whitespace changes
Inline
Side-by-side
__init__.py
View file @
600008b7
...
...
@@ -78,6 +78,8 @@ elif rcParams['backend'] == u'GTKAgg':
from
.myWin_GTKAgg
import
MyWin_GTKAgg
as
MyWin
elif
rcParams
[
'backend'
]
==
u
'WXAgg'
:
from
.myWin_WXAgg
import
MyWin_WXAgg
as
MyWin
elif
rcParams
[
'backend'
]
==
u
'Qt4Agg'
:
from
.myWin_Qt4Agg
import
MyWin_Qt4Agg
as
MyWin
else
:
print
(
SEVR
+
"The backend you choosed is not supported interactive mode not available"
)
...
...
config-default.py
View file @
600008b7
...
...
@@ -28,7 +28,7 @@ D_OFORMAT = 'png' # default format for ouput
D_DEBUG
=
True
# default debug value
# PLOTTING CONFIGURATION -----------------------------------------------
# BACKEND: u'TKAgg', u'GTKAgg', u'WXAgg'
# BACKEND: u'TKAgg', u'GTKAgg', u'WXAgg'
, u'Qt4Agg'
rcParams
[
'backend'
]
=
u
'WXAgg'
# FONT
...
...
myWin_Qt4Agg.py
View file @
600008b7
...
...
@@ -53,10 +53,14 @@ from . import _G_WINDOWS
from
.
import
np
#~ from matplotlib.backends.backend_gtkagg import FigureManagerGTKAgg, FigureCanvasGTKAgg
# For the QtAgg backend
from
matplotlib.backends
import
qt4_compat
use_pyside
=
qt4_compat
.
QT_API
==
qt4_compat
.
QT_API_PYSIDE
if
use_pyside
:
# Test mpl version:
from
matplotlib
import
__version__
as
mplvers
if
int
(
mplvers
.
replace
(
'.'
,
''
)[:
3
])
<
150
:
from
matplotlib.backends
import
qt4_compat
as
qtc
else
:
from
matplotlib.backends
import
qt_compat
as
qtc
if
qtc
.
QT_API
==
qtc
.
QT_API_PYSIDE
:
from
PySide
import
QtGui
,
QtCore
else
:
from
PyQt4
import
QtGui
,
QtCore
...
...
@@ -64,7 +68,7 @@ from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg
# Class MyWin Overwriting the disgusting Matplotlib.FigureManager class
class
MyWin_
GTK
Agg
(
FigureCanvasQTAgg
):
class
MyWin_
Qt4
Agg
(
QtGui
.
QMainWindow
):
# CONSTRUCTOR ------------------------------------------------------
def
__init__
(
self
,
fig
,
show
=
True
,
*
args
,
**
kwargs
):
...
...
@@ -115,15 +119,31 @@ class MyWin_GTKAgg(FigureCanvasQTAgg):
if
(
debug
):
print
(
INFO
+
"Used GTKAgg backend."
)
QtGui
.
QApplication
([
''
])
# create the canvas
FigureCanvasQTAgg
.
__init__
(
self
,
fig
)
self
.
setParent
(
parent
)
canvas
=
FigureCanvasQTAgg
.
__init__
(
self
,
fig
)
#~ canvas
.setParent(parent)
FigureCanvasQTAgg
.
setSizePolicy
(
self
,
QtGui
.
QSizePolicy
.
Expanding
,
QtGui
.
QSizePolicy
.
Expanding
)
FigureCanvasQTAgg
.
updateGeometry
(
self
)
# create main window
QtGui
.
QMainWindow
.
__init__
(
self
)
self
.
setAttribute
(
QtCore
.
Qt
.
WA_DeleteOnClose
)
self
.
setWindowTitle
(
"Fig"
+
str
(
num
))
self
.
main_widget
=
QtGui
.
QWidget
(
self
)
l
=
QtGui
.
QVBoxLayout
(
self
.
main_widget
)
l
.
addWidget
(
canvas
)
self
.
main_widget
.
setFocus
()
self
.
setCentralWidget
(
self
.
main_widget
)
# bound the figure to the window
self
.
canvas
.
figure
.
boundedToWin
=
True
self
.
canvas
.
figure
.
fignum
=
num
...
...
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