Commit 600008b7 authored by Philipp Gast's avatar Philipp Gast
Browse files

added infrastructure in other files

parent 2af2ac44
......@@ -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")
......
......@@ -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
......
......@@ -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_GTKAgg(FigureCanvasQTAgg):
class MyWin_Qt4Agg(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
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment