Ignore:
Timestamp:
Nov 9, 2017 8:43:07 AM (4 years ago)
Author:
Piotr Rozyczko <rozyczko@…>
Branches:
ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc
Children:
7969b9c
Parents:
7fb471d
git-author:
Piotr Rozyczko <rozyczko@…> (10/30/17 07:50:09)
git-committer:
Piotr Rozyczko <rozyczko@…> (11/09/17 08:43:07)
Message:

Initial, in-progress version. Not really working atm. SASVIEW-787

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/sas/qtgui/Plotting/PlotterBase.py

    r7d8bebf r4992ff2  
    22import numpy 
    33 
    4 from PyQt4 import QtGui 
    5 from PyQt4 import QtCore 
     4from PyQt5 import QtCore 
     5from PyQt5 import QtGui 
     6from PyQt5 import QtWidgets 
    67 
    78# TODO: Replace the qt4agg calls below with qt5 equivalent. 
     
    910# https://www.boxcontrol.net/embedding-matplotlib-plot-on-pyqt5-gui.html 
    1011# 
    11 from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas 
    12 from matplotlib.backends.backend_qt4agg import NavigationToolbar2QT as NavigationToolbar 
     12# matplotlib.use("Qt5Agg") 
     13from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg as FigureCanvas 
     14from matplotlib.backends.backend_qt5agg import NavigationToolbar2QT as NavigationToolbar 
    1315 
    1416import matplotlib.pyplot as plt 
     
    2527import sas.qtgui.Plotting.PlotUtilities as PlotUtilities 
    2628 
    27 class PlotterBase(QtGui.QWidget): 
     29class PlotterBase(QtWidgets.QWidget): 
    2830    def __init__(self, parent=None, manager=None, quickplot=False): 
    2931        super(PlotterBase, self).__init__(parent) 
     
    4345 
    4446        # Simple window for data display 
    45         self.txt_widget = QtGui.QTextEdit(None) 
     47        self.txt_widget = QtWidgets.QTextEdit(None) 
    4648 
    4749        # Set the layout and place the canvas widget in it. 
    48         layout = QtGui.QVBoxLayout() 
    49         layout.setMargin(0) 
     50        layout = QtWidgets.QVBoxLayout() 
     51        # FIXME setMargin -> setContentsMargins in qt5 with 4 args 
     52        #layout.setContentsMargins(0) 
    5053        layout.addWidget(self.canvas) 
    5154 
     
    105108        self.canvas.mpl_connect('scroll_event', self.onMplWheel) 
    106109 
    107         self.contextMenu = QtGui.QMenu(self) 
     110        self.contextMenu = QtWidgets.QMenu(self) 
    108111 
    109112        if not quickplot: 
     
    296299        dialog.setModal(True) 
    297300        dialog.setWindowTitle("Print") 
    298         if dialog.exec_() != QtGui.QDialog.Accepted: 
     301        if dialog.exec_() != QtWidgets.QDialog.Accepted: 
    299302            return 
    300303 
     
    303306        pmap = QtGui.QPixmap.grabWidget(self) 
    304307        # Create a label with pixmap drawn 
    305         printLabel = QtGui.QLabel() 
     308        printLabel = QtWidgets.QLabel() 
    306309        printLabel.setPixmap(pmap) 
    307310 
     
    333336        titleWidget = WindowTitle(self, new_title=current_title) 
    334337        result = titleWidget.exec_() 
    335         if result != QtGui.QDialog.Accepted: 
     338        if result != QtWidgets.QDialog.Accepted: 
    336339            return 
    337340 
Note: See TracChangeset for help on using the changeset viewer.