Set PySide to all ambiguous QtGui and QtCore calls

This commit is contained in:
Jose Luis Cercos-Pita 2014-10-03 10:42:15 +02:00 committed by Yorik van Havre
parent 537e759142
commit 4de77a921a

View File

@ -35,18 +35,18 @@ try:
from matplotlib.backends.backend_qt4agg import NavigationToolbar2QTAgg as NavigationToolbar from matplotlib.backends.backend_qt4agg import NavigationToolbar2QTAgg as NavigationToolbar
from matplotlib.figure import Figure from matplotlib.figure import Figure
except ImportError: except ImportError:
msg = QtGui.QApplication.translate( msg = PySide.QtGui.QApplication.translate(
"plot_console", "plot_console",
"matplotlib not found, so Plot module can not be loaded", "matplotlib not found, so Plot module can not be loaded",
None, None,
QtGui.QApplication.UnicodeUTF8) PySide.QtGui.QApplication.UnicodeUTF8)
FreeCAD.Console.PrintMessage(msg + '\n') FreeCAD.Console.PrintMessage(msg + '\n')
raise ImportError("matplotlib not installed") raise ImportError("matplotlib not installed")
def getMainWindow(): def getMainWindow():
""" Return the FreeCAD main window. """ """ Return the FreeCAD main window. """
toplevel = QtGui.qApp.topLevelWidgets() toplevel = PySide.QtGui.qApp.topLevelWidgets()
for i in toplevel: for i in toplevel:
if i.metaObject().className() == "Gui::MainWindow": if i.metaObject().className() == "Gui::MainWindow":
return i return i
@ -364,11 +364,11 @@ class Line():
return plt.getp(self.line, prop) return plt.getp(self.line, prop)
class Plot(QtGui.QWidget): class Plot(PySide.QtGui.QWidget):
def __init__(self, def __init__(self,
winTitle="plot", winTitle="plot",
parent=None, parent=None,
flags=QtCore.Qt.WindowFlags(0)): flags=PySide.QtCore.Qt.WindowFlags(0)):
"""Construct a new plot widget. """Construct a new plot widget.
Keyword arguments: Keyword arguments:
@ -376,7 +376,7 @@ class Plot(QtGui.QWidget):
parent -- Widget parent. parent -- Widget parent.
flags -- QWidget flags flags -- QWidget flags
""" """
QtGui.QWidget.__init__(self, parent, flags) PySide.QtGui.QWidget.__init__(self, parent, flags)
self.setWindowTitle(winTitle) self.setWindowTitle(winTitle)
# Create matplotlib canvas # Create matplotlib canvas
self.fig = Figure() self.fig = Figure()
@ -390,7 +390,7 @@ class Plot(QtGui.QWidget):
self.axes.yaxis.set_ticks_position('left') self.axes.yaxis.set_ticks_position('left')
self.axes.spines['right'].set_color('none') self.axes.spines['right'].set_color('none')
# Setup layout # Setup layout
vbox = QtGui.QVBoxLayout() vbox = PySide.QtGui.QVBoxLayout()
vbox.addWidget(self.canvas) vbox.addWidget(self.canvas)
self.setLayout(vbox) self.setLayout(vbox)
# Active series # Active series