Skip to content
GitLab
Menu
Projects
Groups
Snippets
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
Show whitespace changes
Inline
Side-by-side
__init__.py
View file @
600008b7
...
@@ -78,6 +78,8 @@ elif rcParams['backend'] == u'GTKAgg':
...
@@ -78,6 +78,8 @@ elif rcParams['backend'] == u'GTKAgg':
from
.myWin_GTKAgg
import
MyWin_GTKAgg
as
MyWin
from
.myWin_GTKAgg
import
MyWin_GTKAgg
as
MyWin
elif
rcParams
[
'backend'
]
==
u
'WXAgg'
:
elif
rcParams
[
'backend'
]
==
u
'WXAgg'
:
from
.myWin_WXAgg
import
MyWin_WXAgg
as
MyWin
from
.myWin_WXAgg
import
MyWin_WXAgg
as
MyWin
elif
rcParams
[
'backend'
]
==
u
'Qt4Agg'
:
from
.myWin_Qt4Agg
import
MyWin_Qt4Agg
as
MyWin
else
:
else
:
print
(
SEVR
+
"The backend you choosed is not supported interactive mode not available"
)
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
...
@@ -28,7 +28,7 @@ D_OFORMAT = 'png' # default format for ouput
D_DEBUG
=
True
# default debug value
D_DEBUG
=
True
# default debug value
# PLOTTING CONFIGURATION -----------------------------------------------
# PLOTTING CONFIGURATION -----------------------------------------------
# BACKEND: u'TKAgg', u'GTKAgg', u'WXAgg'
# BACKEND: u'TKAgg', u'GTKAgg', u'WXAgg'
, u'Qt4Agg'
rcParams
[
'backend'
]
=
u
'WXAgg'
rcParams
[
'backend'
]
=
u
'WXAgg'
# FONT
# FONT
...
...
myWin_Qt4Agg.py
View file @
600008b7
...
@@ -53,10 +53,14 @@ from . import _G_WINDOWS
...
@@ -53,10 +53,14 @@ from . import _G_WINDOWS
from
.
import
np
from
.
import
np
#~ from matplotlib.backends.backend_gtkagg import FigureManagerGTKAgg, FigureCanvasGTKAgg
#~ from matplotlib.backends.backend_gtkagg import FigureManagerGTKAgg, FigureCanvasGTKAgg
# For the QtAgg backend
# Test mpl version:
from
matplotlib.backends
import
qt4_compat
from
matplotlib
import
__version__
as
mplvers
use_pyside
=
qt4_compat
.
QT_API
==
qt4_compat
.
QT_API_PYSIDE
if
use_pyside
:
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
from
PySide
import
QtGui
,
QtCore
else
:
else
:
from
PyQt4
import
QtGui
,
QtCore
from
PyQt4
import
QtGui
,
QtCore
...
@@ -64,7 +68,7 @@ from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg
...
@@ -64,7 +68,7 @@ from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg
# Class MyWin Overwriting the disgusting Matplotlib.FigureManager class
# Class MyWin Overwriting the disgusting Matplotlib.FigureManager class
class
MyWin_
GTK
Agg
(
FigureCanvasQTAgg
):
class
MyWin_
Qt4
Agg
(
QtGui
.
QMainWindow
):
# CONSTRUCTOR ------------------------------------------------------
# CONSTRUCTOR ------------------------------------------------------
def
__init__
(
self
,
fig
,
show
=
True
,
*
args
,
**
kwargs
):
def
__init__
(
self
,
fig
,
show
=
True
,
*
args
,
**
kwargs
):
...
@@ -115,15 +119,31 @@ class MyWin_GTKAgg(FigureCanvasQTAgg):
...
@@ -115,15 +119,31 @@ class MyWin_GTKAgg(FigureCanvasQTAgg):
if
(
debug
):
if
(
debug
):
print
(
INFO
+
"Used GTKAgg backend."
)
print
(
INFO
+
"Used GTKAgg backend."
)
QtGui
.
QApplication
([
''
])
# create the canvas
# create the canvas
FigureCanvasQTAgg
.
__init__
(
self
,
fig
)
canvas
=
FigureCanvasQTAgg
.
__init__
(
self
,
fig
)
self
.
setParent
(
parent
)
#~ canvas
.setParent(parent)
FigureCanvasQTAgg
.
setSizePolicy
(
self
,
FigureCanvasQTAgg
.
setSizePolicy
(
self
,
QtGui
.
QSizePolicy
.
Expanding
,
QtGui
.
QSizePolicy
.
Expanding
,
QtGui
.
QSizePolicy
.
Expanding
)
QtGui
.
QSizePolicy
.
Expanding
)
FigureCanvasQTAgg
.
updateGeometry
(
self
)
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
# bound the figure to the window
self
.
canvas
.
figure
.
boundedToWin
=
True
self
.
canvas
.
figure
.
boundedToWin
=
True
self
.
canvas
.
figure
.
fignum
=
num
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