Changeset 4992ff2 in sasview


Ignore:
Timestamp:
Nov 9, 2017 8:43:07 AM (6 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

Files:
49 edited

Legend:

Unmodified
Added
Removed
  • run.py

    rf4a1433 r4992ff2  
    118118    # Import the sasview package from root/sasview as sas.sasview.  It would 
    119119    # be better to just store the package in src/sas/sasview. 
    120     import sas 
    121     #sas.sasview = import_package('sas.sasview', joinpath(root, 'sasview')) 
    122     sas.sasview = import_package('sas.sasview', joinpath(root, 'src','sas','sasview')) 
     120    #import sas 
     121    #sas.sasview = import_package('sas.sasview', joinpath(root, 'src','sas','sasview')) 
    123122 
    124123    # Compiled modules need to be pulled from the build directory. 
     
    138137    import sas.sascalc.calculator 
    139138    sas.sascalc.calculator.core = import_package('sas.sascalc.calculator.core', 
    140                                                  joinpath(build_path, 'sas', 'sascalc', 'calculator', 'core')) 
     139                                  joinpath(build_path, 'sas', 'sascalc', 'calculator', 'core')) 
    141140 
    142141    sys.path.append(build_path) 
  • src/sas/qtgui/Calculators/DataOperationUtilityPanel.py

    r7fb471d r4992ff2  
    44import copy 
    55 
    6 from PyQt4 import QtGui 
    7 from PyQt4 import QtCore 
     6from PyQt5 import QtCore 
     7from PyQt5 import QtGui 
     8from PyQt5 import QtWidgets 
    89 
    910from sas.qtgui.Plotting.PlotterData import Data1D 
     
    1920 
    2021 
    21 class DataOperationUtilityPanel(QtGui.QDialog, Ui_DataOperationUtility): 
     22class DataOperationUtilityPanel(QtWidgets.QDialog, Ui_DataOperationUtility): 
    2223    def __init__(self, parent=None): 
    2324        super(DataOperationUtilityPanel, self).__init__() 
     
    5758        self.txtNumber.setValidator(QtGui.QDoubleValidator()) 
    5859 
    59         self.layoutOutput = QtGui.QHBoxLayout() 
    60         self.layoutData1 = QtGui.QHBoxLayout() 
    61         self.layoutData2 = QtGui.QHBoxLayout() 
     60        self.layoutOutput = QtWidgets.QHBoxLayout() 
     61        self.layoutData1 = QtWidgets.QHBoxLayout() 
     62        self.layoutData2 = QtWidgets.QHBoxLayout() 
    6263 
    6364        # Create default layout for initial graphs (when they are still empty) 
     
    383384    def newPlot(self, graph, layout): 
    384385        """ Create template for graphs with default '?' layout""" 
    385         assert isinstance(graph, QtGui.QGraphicsView) 
    386         assert isinstance(layout, QtGui.QHBoxLayout) 
     386        assert isinstance(graph, QtWidgets.QGraphicsView) 
     387        assert isinstance(layout, QtWidgets.QHBoxLayout) 
    387388 
    388389        # clear layout 
     
    399400        """ plot data in graph after clearing its layout """ 
    400401 
    401         assert isinstance(graph, QtGui.QGraphicsView) 
    402         assert isinstance(layout, QtGui.QHBoxLayout) 
     402        assert isinstance(graph, QtWidgets.QGraphicsView) 
     403        assert isinstance(layout, QtWidgets.QHBoxLayout) 
    403404 
    404405        # clear layout 
     
    455456    def prepareSubgraphWithData(self, data): 
    456457        """ Create graphics view containing scene with string """ 
    457         scene = QtGui.QGraphicsScene() 
     458        scene = QtWidgets.QGraphicsScene() 
    458459        scene.addText(str(data)) 
    459460 
    460         subgraph = QtGui.QGraphicsView() 
     461        subgraph = QtWidgets.QGraphicsView() 
    461462        subgraph.setScene(scene) 
    462463 
  • src/sas/qtgui/Calculators/DensityPanel.py

    • Property mode changed from 100755 to 100644
    rb3e8629 r4992ff2  
    22import logging 
    33import functools 
    4 from PyQt4 import QtGui, QtCore 
     4from PyQt5 import QtCore 
     5from PyQt5 import QtGui 
     6from PyQt5 import QtWidgets 
    57 
    68from periodictable import formula as Formula 
     
    3941 
    4042 
    41 class DensityPanel(QtGui.QDialog): 
     43class DensityPanel(QtWidgets.QDialog): 
    4244 
    4345    def __init__(self, parent=None): 
     
    6870        self.ui.editMassDensity.textEdited.connect(functools.partial(self.setMode, MODES.DENSITY_TO_VOLUME)) 
    6971 
    70         self.ui.buttonBox.button(QtGui.QDialogButtonBox.Reset).clicked.connect(self.modelReset) 
    71         self.ui.buttonBox.button(QtGui.QDialogButtonBox.Help).clicked.connect(self.displayHelp) 
     72        self.ui.buttonBox.button(QtWidgets.QDialogButtonBox.Reset).clicked.connect(self.modelReset) 
     73        self.ui.buttonBox.button(QtWidgets.QDialogButtonBox.Help).clicked.connect(self.displayHelp) 
    7274 
    7375    def setupModel(self): 
     
    8385 
    8486    def setupMapper(self): 
    85         self.mapper = QtGui.QDataWidgetMapper(self) 
     87        self.mapper = QtWidgets.QDataWidgetMapper(self) 
    8688        self.mapper.setModel(self.model) 
    8789        self.mapper.setOrientation(QtCore.Qt.Vertical) 
     
    9294        self.mapper.addMapping(self.ui.editMassDensity     , MODEL.MASS_DENSITY) 
    9395 
    94         self.mapper.toFirst() 
     96        # FIXME DOESNT WORK WITH QT5 
     97        #self.mapper.toFirst() 
    9598 
    9699    def dataChanged(self, top, bottom): 
  • src/sas/qtgui/Calculators/GenericScatteringCalculator.py

    r7fb471d r4992ff2  
    55import time 
    66 
    7 from PyQt4 import QtGui 
    8 from PyQt4 import QtCore 
     7from PyQt5 import QtCore 
     8from PyQt5 import QtGui 
     9from PyQt5 import QtWidgets 
     10 
    911from twisted.internet import threads 
    1012 
     
    2729 
    2830 
    29 class GenericScatteringCalculator(QtGui.QDialog, Ui_GenericScatteringCalculator): 
     31class GenericScatteringCalculator(QtWidgets.QDialog, Ui_GenericScatteringCalculator): 
    3032 
    3133    trigger_plot_3d = QtCore.pyqtSignal() 
     
    129131        """ 
    130132        try: 
    131             self.datafile = QtGui.QFileDialog.getOpenFileName( 
     133            self.datafile = QtWidgets.QFileDialog.getOpenFileName( 
    132134                self, "Choose a file", "", "All Gen files (*.OMF *.omf) ;;" 
    133135                                          "SLD files (*.SLD *.sld);;PDB files (*.pdb *.PDB);; " 
     
    607609            'directory': default_name, 
    608610            'filter': 'SLD file (*.sld)', 
    609             'options': QtGui.QFileDialog.DontUseNativeDialog} 
     611            'options': QtWidgets.QFileDialog.DontUseNativeDialog} 
    610612        # Query user for filename. 
    611         filename = str(QtGui.QFileDialog.getSaveFileName(**kwargs)) 
     613        filename = str(QtWidgets.QFileDialog.getSaveFileName(**kwargs)) 
    612614        if filename: 
    613615            try: 
     
    830832 
    831833 
    832 class Plotter3D(QtGui.QDialog, Plotter3DWidget): 
     834class Plotter3D(QtWidgets.QDialog, Plotter3DWidget): 
    833835    def __init__(self, parent=None, graph_title=''): 
    834836        self.graph_title = graph_title 
    835         QtGui.QDialog.__init__(self) 
     837        QtWidgets.QDialog.__init__(self) 
    836838        Plotter3DWidget.__init__(self, manager=parent) 
    837839        self.setWindowTitle(self.graph_title) 
  • src/sas/qtgui/Calculators/KiessigPanel.py

    • Property mode changed from 100755 to 100644
    rb3e8629 r4992ff2  
    1 from PyQt4 import QtGui 
    2 from PyQt4 import QtCore 
     1from PyQt5 import QtCore 
     2from PyQt5 import QtGui 
     3from PyQt5 import QtWidgets 
    34 
    45from sas.qtgui.UI import main_resources_rc 
     
    1011 
    1112 
    12 class KiessigPanel(QtGui.QDialog, Ui_KiessigPanel): 
     13class KiessigPanel(QtWidgets.QDialog, Ui_KiessigPanel): 
    1314    def __init__(self, parent=None): 
    1415        super(KiessigPanel, self).__init__() 
  • src/sas/qtgui/Calculators/ResolutionCalculatorPanel.py

    r7fb471d r4992ff2  
    44instrumental parameters. 
    55""" 
    6 from PyQt4 import QtGui 
    7 from PyQt4 import QtCore 
     6from PyQt5 import QtCore 
     7from PyQt5 import QtGui 
     8from PyQt5 import QtWidgets 
    89 
    910from twisted.internet import threads 
     
    3334 
    3435 
    35 class ResolutionCalculatorPanel(QtGui.QDialog, Ui_ResolutionCalculatorPanel): 
     36class ResolutionCalculatorPanel(QtWidgets.QDialog, Ui_ResolutionCalculatorPanel): 
    3637    """ 
    3738    compute resolution in 2D 
     
    315316        """ On Spectrum Combobox event""" 
    316317        if self.cbCustomSpectrum.currentText() == 'Add New': 
    317             datafile = QtGui.QFileDialog.getOpenFileName( 
     318            datafile = QtWidgets.QFileDialog.getOpenFileName( 
    318319                self, "Choose a spectral distribution file", "", 
    319320                "All files (*.*)", 
    320                 QtGui.QFileDialog.DontUseNativeDialog) 
     321                QtWidgets.QFileDialog.DontUseNativeDialog) 
    321322 
    322323            if datafile is None or str(datafile) == '': 
     
    721722        self.plotter.scale = 'linear' 
    722723        self.plotter.cmap = None 
    723         layout = QtGui.QHBoxLayout() 
     724        layout = QtWidgets.QHBoxLayout() 
    724725        layout.setContentsMargins(0, 0, 0, 0) 
    725726        self.graphicsView.setLayout(layout) 
  • src/sas/qtgui/Calculators/SldPanel.py

    r7fb471d r4992ff2  
    11# global 
    22import logging 
    3 from PyQt4 import QtGui, QtCore 
     3from PyQt5 import QtCore 
     4from PyQt5 import QtGui 
     5from PyQt5 import QtWidgets 
    46 
    57from periodictable import formula as Formula 
     
    9799 
    98100 
    99 class SldPanel(QtGui.QDialog): 
     101class SldPanel(QtWidgets.QDialog): 
    100102 
    101103    def __init__(self, parent=None): 
     
    133135 
    134136        # signals 
    135         self.ui.buttonBox.button(QtGui.QDialogButtonBox.Reset).clicked.connect(self.modelReset) 
    136         self.ui.buttonBox.button(QtGui.QDialogButtonBox.Help).clicked.connect(self.displayHelp) 
     137        self.ui.buttonBox.button(QtWidgets.QDialogButtonBox.Reset).clicked.connect(self.modelReset) 
     138        self.ui.buttonBox.button(QtWidgets.QDialogButtonBox.Help).clicked.connect(self.displayHelp) 
    137139 
    138140    def setupModel(self): 
     
    145147            self.model.setItem(key, QtGui.QStandardItem()) 
    146148 
    147         QtCore.QObject.connect( 
    148             self.model, 
    149             QtCore.SIGNAL("dataChanged(QModelIndex,QModelIndex)"), 
    150             self.dataChanged) 
     149        self.model.dataChanged.connect(self.dataChanged) 
     150        #QtCore.QObject.connect( 
     151        #    self.model, 
     152        #    QtCore.SIGNAL("dataChanged(QModelIndex,QModelIndex)"), 
     153        #    self.dataChanged) 
    151154 
    152155        self.modelReset() 
    153156 
    154157    def setupMapper(self): 
    155         self.mapper = QtGui.QDataWidgetMapper(self) 
     158        self.mapper = QtWidgets.QDataWidgetMapper(self) 
    156159        self.mapper.setModel(self.model) 
    157160        self.mapper.setOrientation(QtCore.Qt.Vertical) 
    158  
    159161        self.mapper.addMapping(self.ui.editMolecularFormula, MODEL.MOLECULAR_FORMULA) 
    160162        self.mapper.addMapping(self.ui.editMassDensity     , MODEL.MASS_DENSITY) 
     
    164166            self.mapper.addMapping(edit, key) 
    165167 
    166         self.mapper.toFirst() 
     168        # FIXME DOESNT WORK WITH QT5 
     169        #self.mapper.toFirst() 
    167170 
    168171    def dataChanged(self, top, bottom): 
  • src/sas/qtgui/Calculators/SlitSizeCalculator.py

    r7fb471d r4992ff2  
    55import sys 
    66 
    7 from PyQt4 import QtGui 
    8 from PyQt4 import QtCore 
     7from PyQt5 import QtCore 
     8from PyQt5 import QtGui 
     9from PyQt5 import QtWidgets 
    910 
    1011from sas.qtgui.UI import main_resources_rc 
     
    1617 
    1718 
    18 class SlitSizeCalculator(QtGui.QDialog, Ui_SlitSizeCalculator): 
     19class SlitSizeCalculator(QtWidgets.QDialog, Ui_SlitSizeCalculator): 
    1920    """ 
    2021    Provides the slit length calculator GUI. 
     
    7576        # Location is automatically saved - no need to keep track of the last dir 
    7677        # But only with Qt built-in dialog (non-platform native) 
    77         path = QtGui.QFileDialog.getOpenFileName(self, "Choose a file", "", 
     78        path = QtWidgets.QFileDialog.getOpenFileName(self, "Choose a file", "", 
    7879                                                 "SAXSess 1D data (*.txt *.TXT *.dat *.DAT)", 
    79                                                  QtGui.QFileDialog.DontUseNativeDialog) 
     80                                                 None, 
     81                                                 QtWidgets.QFileDialog.DontUseNativeDialog) 
    8082 
    8183        if path is None: 
  • src/sas/qtgui/GUITests.py

    rf4a1433 r4992ff2  
    11import unittest 
    22import sys 
    3 from PyQt4 import QtGui 
     3from PyQt5 import QtGui 
     4from PyQt5 import QtWidgets 
    45 
    56# Prepare the general QApplication instance 
    6 app = QtGui.QApplication(sys.argv) 
     7app = QtWidgets.QApplication(sys.argv) 
    78 
    89# Main Window 
  • src/sas/qtgui/MainWindow/AboutBox.py

    • Property mode changed from 100755 to 100644
    rb3e8629 r4992ff2  
    11import functools 
    2 from PyQt4 import QtGui 
     2from PyQt5 import QtWidgets 
    33 
    44import sas.sasview 
     
    1010from .UI.AboutUI import Ui_AboutUI 
    1111 
    12 class AboutBox(QtGui.QDialog, Ui_AboutUI): 
     12class AboutBox(QtWidgets.QDialog, Ui_AboutUI): 
    1313    def __init__(self, parent=None): 
    1414        super(AboutBox, self).__init__(parent) 
  • src/sas/qtgui/MainWindow/DataExplorer.py

    r7fb471d r4992ff2  
    55import logging 
    66 
    7 from PyQt4 import QtCore 
    8 from PyQt4 import QtGui 
    9 from PyQt4 import QtWebKit 
    10 from PyQt4.Qt import QMutex 
     7from PyQt5 import QtCore 
     8from PyQt5 import QtGui 
     9from PyQt5 import QtWidgets 
     10from PyQt5 import QtWebKitWidgets 
    1111 
    1212from twisted.internet import threads 
     
    4848        self.loader = Loader() 
    4949        self.manager = manager if manager is not None else DataManager() 
    50         self.txt_widget = QtGui.QTextEdit(None) 
     50        self.txt_widget = QtWidgets.QTextEdit(None) 
    5151 
    5252        # Be careful with twisted threads. 
    53         self.mutex = QMutex() 
     53        self.mutex = QtCore.QMutex() 
    5454 
    5555        # Active plots 
     
    6969 
    7070        # Display HTML content 
    71         self._helpView = QtWebKit.QWebView() 
     71        self._helpView = QtWebKitWidgets.QWebView() 
    7272 
    7373        # Fill in the perspectives combo 
     
    9898 
    9999        # Proxy model for showing a subset of Data1D/Data2D content 
    100         self.data_proxy = QtGui.QSortFilterProxyModel(self) 
     100        self.data_proxy = QtCore.QSortFilterProxyModel(self) 
    101101        self.data_proxy.setSourceModel(self.model) 
    102102 
     
    108108 
    109109        # Proxy model for showing a subset of Theory content 
    110         self.theory_proxy = QtGui.QSortFilterProxyModel(self) 
     110        self.theory_proxy = QtCore.QSortFilterProxyModel(self) 
    111111        self.theory_proxy.setSourceModel(self.theory_model) 
    112112 
     
    182182        Opens the Qt "Open File..." dialog 
    183183        """ 
     184        print("A") 
    184185        path_str = self.chooseFiles() 
    185186        if not path_str: 
     
    192193        Opens the Qt "Open Folder..." dialog 
    193194        """ 
    194         folder = QtGui.QFileDialog.getExistingDirectory(self, "Choose a directory", "", 
    195               QtGui.QFileDialog.ShowDirsOnly | QtGui.QFileDialog.DontUseNativeDialog) 
     195        folder = QtWidgets.QFileDialog.getExistingDirectory(self, "Choose a directory", "", None, 
     196              QtWidgets.QFileDialog.ShowDirsOnly | QtWidgets.QFileDialog.DontUseNativeDialog) 
    196197        if folder is None: 
    197198            return 
     
    216217            'caption'   : 'Open Project', 
    217218            'filter'    : 'Project (*.json);;All files (*.*)', 
    218             'options'   : QtGui.QFileDialog.DontUseNativeDialog 
     219            'options'   : QtWidgets.QFileDialog.DontUseNativeDialog 
    219220        } 
    220         filename = str(QtGui.QFileDialog.getOpenFileName(**kwargs)) 
     221        filename = str(QtWidgets.QFileDialog.getOpenFileName(**kwargs)) 
    221222        if filename: 
    222223            load_thread = threads.deferToThread(self.readProject, filename) 
    223224            load_thread.addCallback(self.readProjectComplete) 
    224225            load_thread.addErrback(self.readProjectFailed) 
     226 
     227    def loadFailed(self, reason): 
     228        """ 
     229        """ 
     230        print("file load FAILED: ", reason) 
     231        pass 
    225232 
    226233    def readProjectFailed(self, reason): 
     
    248255 
    249256        self.manager.assign(manager) 
     257        self.model.beginResetModel() 
    250258        for id, item in self.manager.get_all_data().items(): 
    251259            self.updateModel(item.data, item.path) 
    252260 
    253         self.model.reset() 
     261        self.model.endResetModel() 
    254262 
    255263    def saveProject(self): 
     
    261269            'caption'   : 'Save Project', 
    262270            'filter'    : 'Project (*.json)', 
    263             'options'   : QtGui.QFileDialog.DontUseNativeDialog 
     271            'options'   : QtWidgets.QFileDialog.DontUseNativeDialog 
    264272        } 
    265         filename = str(QtGui.QFileDialog.getSaveFileName(**kwargs)) 
     273        filename = str(QtWidgets.QFileDialog.getSaveFileName(**kwargs)) 
    266274        if filename: 
    267275            self.communicator.statusBarUpdateSignal.emit("Saving Project... %s\n" % os.path.basename(filename)) 
     
    617625        # Location is automatically saved - no need to keep track of the last dir 
    618626        # But only with Qt built-in dialog (non-platform native) 
    619         paths = QtGui.QFileDialog.getOpenFileNames(self, "Choose a file", "", 
    620                 wlist, QtGui.QFileDialog.DontUseNativeDialog) 
     627        paths = QtWidgets.QFileDialog.getOpenFileNames(self, "Choose a file", "", 
     628                wlist, None, QtWidgets.QFileDialog.DontUseNativeDialog) 
    621629        if paths is None: 
    622630            return 
     
    835843        """ 
    836844        # Create a custom menu based on actions defined in the UI file 
    837         self.context_menu = QtGui.QMenu(self) 
     845        self.context_menu = QtWidgets.QMenu(self) 
    838846        self.context_menu.addAction(self.actionDataInfo) 
    839847        self.context_menu.addAction(self.actionSaveAs) 
     
    10711079        # If so, delete them 
    10721080        # TODO: fix this to resemble GuiUtils.updateModelItemWithPlot 
    1073         #  
     1081        # 
     1082        self.model.beginResetModel() 
    10741083        current_tab_name = model_item.text()[:2] 
    10751084        for current_index in range(self.theory_model.rowCount()): 
     
    10791088 
    10801089        # Reset the view 
    1081         self.model.reset() 
     1090        self.model.endResetModel() 
    10821091 
    10831092        # Reset the view 
  • src/sas/qtgui/MainWindow/DroppableDataLoadWidget.py

    rcd2cc745 r4992ff2  
    11# global 
    2 from PyQt4 import QtGui, QtCore 
     2from PyQt5 import QtCore 
     3from PyQt5 import QtGui 
     4from PyQt5 import QtWidgets 
    35 
    46# UI 
     
    68from sas.qtgui.MainWindow.UI.DataExplorerUI import Ui_DataLoadWidget 
    79 
    8 class DroppableDataLoadWidget(QtGui.QTabWidget, Ui_DataLoadWidget): 
     10class DroppableDataLoadWidget(QtWidgets.QTabWidget, Ui_DataLoadWidget): 
    911    """ 
    1012    Overwrite drag and drop methods in the base class 
  • src/sas/qtgui/MainWindow/GuiManager.py

    rcee5c78 r4992ff2  
    66import webbrowser 
    77 
    8 from PyQt4 import QtCore 
    9 from PyQt4 import QtGui 
    10 from PyQt4 import QtWebKit 
     8from PyQt5.QtWidgets import * 
     9from PyQt5.QtGui import * 
     10from PyQt5.QtCore import Qt 
     11from PyQt5.QtWebKitWidgets import QWebView 
    1112 
    1213from twisted.internet import reactor 
     
    3839from sas.qtgui.MainWindow.DataExplorer import DataExplorerWindow 
    3940 
    40 class Acknowledgements(QtGui.QDialog, Ui_Acknowledgements): 
     41class Acknowledgements(QDialog, Ui_Acknowledgements): 
    4142    def __init__(self, parent=None): 
    42         QtGui.QDialog.__init__(self, parent) 
     43        QDialog.__init__(self, parent) 
    4344        self.setupUi(self) 
    4445 
     
    7778        # Invoke the initial perspective 
    7879        self.perspectiveChanged("Fitting") 
    79  
    8080        self.addWidgets() 
    8181 
     
    9494        # Show the Welcome panel 
    9595        self.welcomePanel = WelcomePanel() 
    96         self._workspace.workspace.addWindow(self.welcomePanel) 
     96        self._workspace.workspace.addSubWindow(self.welcomePanel) 
    9797 
    9898        # Current help file 
    99         self._helpView = QtWebKit.QWebView() 
     99        self._helpView = QWebView() 
    100100        # Needs URL like path, so no path.join() here 
    101101        self._helpLocation = GuiUtils.HELP_DIRECTORY_LOCATION + "/index.html" 
     
    116116        ObjectLibrary.addObject('DataExplorer', self.filesWidget) 
    117117 
    118         self.dockedFilesWidget = QtGui.QDockWidget("Data Explorer", self._workspace) 
     118        self.dockedFilesWidget = QDockWidget("Data Explorer", self._workspace) 
     119        self.dockedFilesWidget.setFloating(True) 
    119120        self.dockedFilesWidget.setWidget(self.filesWidget) 
    120121 
    121122        # Disable maximize/minimize and close buttons 
    122         self.dockedFilesWidget.setFeatures(QtGui.QDockWidget.NoDockWidgetFeatures) 
    123         self._workspace.addDockWidget(QtCore.Qt.LeftDockWidgetArea, 
    124                                       self.dockedFilesWidget) 
     123        self.dockedFilesWidget.setFeatures(QDockWidget.NoDockWidgetFeatures) 
     124        self.dockedFilesWidget.setFeatures(Qt.LeftDockWidgetArea) 
     125 
     126        self._workspace.workspace.addDockWidget(Qt.LeftDockWidgetArea, self.dockedFilesWidget) 
    125127 
    126128        # Add the console window as another docked widget 
    127         self.logDockWidget = QtGui.QDockWidget("Log Explorer", self._workspace) 
     129        self.logDockWidget = QDockWidget("Log Explorer", self._workspace) 
    128130        self.logDockWidget.setObjectName("LogDockWidget") 
    129         self.listWidget = QtGui.QTextBrowser() 
     131 
     132        self.listWidget = QTextBrowser() 
    130133        self.logDockWidget.setWidget(self.listWidget) 
    131         self._workspace.addDockWidget(QtCore.Qt.BottomDockWidgetArea, 
    132                                       self.logDockWidget) 
     134        self._workspace.workspace.addDockWidget(Qt.BottomDockWidgetAre, self.logDockWidget)  
    133135 
    134136        # Add other, minor widgets 
     
    152154        Progress bar invisible until explicitly shown 
    153155        """ 
    154         self.progress = QtGui.QProgressBar() 
     156        self.progress = QProgressBar() 
    155157        self._workspace.statusbar.setSizeGripEnabled(False) 
    156158 
    157         self.statusLabel = QtGui.QLabel() 
     159        self.statusLabel = QLabel() 
    158160        self.statusLabel.setText("Welcome to SasView") 
    159161        self._workspace.statusbar.addPermanentWidget(self.statusLabel, 1) 
     
    194196        self._current_perspective = Perspectives.PERSPECTIVES[str(perspective_name)](parent=self) 
    195197 
    196         self.setupPerspectiveMenubarOptions(self._current_perspective) 
    197         self._workspace.workspace.addWindow(self._current_perspective) 
     198        self._workspace.workspace.addSubWindow(self._current_perspective) 
     199 
    198200        # Resize to the workspace height 
    199201        workspace_height = self._workspace.workspace.sizeHint().height() 
     
    265267        # Display confirmation messagebox 
    266268        quit_msg = "Are you sure you want to exit the application?" 
    267         reply = QtGui.QMessageBox.question( 
     269        reply = QMessageBox.question( 
    268270            self._parent, 
    269271            'Information', 
    270272            quit_msg, 
    271             QtGui.QMessageBox.Yes, 
    272             QtGui.QMessageBox.No) 
     273            QMessageBox.Yes, 
     274            QMessageBox.No) 
    273275 
    274276        # Exit if yes 
    275         if reply == QtGui.QMessageBox.Yes: 
     277        if reply == QMessageBox.Yes: 
    276278            reactor.callFromThread(reactor.stop) 
    277279            return True 
     
    587589 
    588590        # Add the console window as another docked widget 
    589         self.ipDockWidget = QtGui.QDockWidget("IPython", self._workspace) 
     591        self.ipDockWidget = QDockWidget("IPython", self._workspace) 
    590592        self.ipDockWidget.setObjectName("IPythonDockWidget") 
    591593        self.ipDockWidget.setWidget(terminal) 
    592         self._workspace.addDockWidget(QtCore.Qt.RightDockWidgetArea, 
    593                                       self.ipDockWidget) 
     594        self._workspace.workspace.addSubWindow(self.ipDockWidget, Qt.RightDockWidgetArea) 
    594595 
    595596    def actionImage_Viewer(self): 
     
    716717        TODO: use QNetworkAccessManager to assure _helpLocation is valid 
    717718        """ 
    718         self._helpView.load(QtCore.QUrl(self._helpLocation)) 
     719        self._helpView.load(QUrl(self._helpLocation)) 
    719720        self._helpView.show() 
    720721 
     
    761762        :param new_datalist_item: 
    762763        """ 
    763         if not isinstance(new_item, QtGui.QStandardItem) or \ 
     764        if not isinstance(new_item, QStandardItem) or \ 
    764765                not isinstance(new_datalist_item, dict): 
    765766            msg = "Wrong data type returned from calculations." 
  • src/sas/qtgui/MainWindow/MainWindow.py

    • Property mode changed from 100755 to 100644
    rb3e8629 r4992ff2  
    11# UNLESS EXEPTIONALLY REQUIRED TRY TO AVOID IMPORTING ANY MODULES HERE 
    22# ESPECIALLY ANYTHING IN SAS, SASMODELS NAMESPACE 
    3 from PyQt4 import QtGui 
     3#from PyQt4 import QtGui 
     4from PyQt5.QtWidgets import * 
     5from PyQt5.QtGui import * 
    46 
    57# Local UI 
     
    1012import sas.qtgui.Utilities.SasviewLogger 
    1113 
    12 class MainSasViewWindow(QtGui.QMainWindow, Ui_MainWindow): 
     14class MainSasViewWindow(QMainWindow, Ui_MainWindow): 
    1315    # Main window of the application 
    1416    def __init__(self, parent=None): 
     
    1719 
    1820        # define workspace for dialogs. 
    19         self.workspace = QtGui.QWorkspace(self) 
     21        self.workspace = QMdiArea(self) 
    2022        self.setCentralWidget(self.workspace) 
    2123 
    2224        # Create the gui manager 
    2325        from .GuiManager import GuiManager 
    24         self.guiManager = GuiManager(self) 
     26        try: 
     27            self.guiManager = GuiManager(self) 
     28        except Exception as ex: 
     29            print("EXCEPTION: ", ex) 
    2530 
    2631    def closeEvent(self, event): 
     
    3742    """ 
    3843    # TODO: standardize path to images 
    39     pixmap = QtGui.QPixmap("src/sas/qtgui/images/SVwelcome_mini.png") 
    40     splashScreen = QtGui.QSplashScreen(pixmap) 
     44    pixmap = QPixmap("src/sas/qtgui/images/SVwelcome_mini.png") 
     45    splashScreen = QSplashScreen(pixmap) 
    4146    return splashScreen 
    4247 
    4348def run(): 
    44     app = QtGui.QApplication([]) 
     49    app = QApplication([]) 
    4550 
    4651    # Main must have reference to the splash screen, so making it explicit 
     
    5560    # DO NOT move the following import to the top! 
    5661    # (unless you know what you're doing) 
    57     import qt4reactor 
     62    import qt5reactor 
    5863    # Using the Qt4 reactor wrapper from https://github.com/ghtdak/qtreactor 
    59     qt4reactor.install() 
     64    qt5reactor.install() 
    6065 
    6166    # DO NOT move the following import to the top! 
  • src/sas/qtgui/MainWindow/WelcomePanel.py

    rcd2cc745 r4992ff2  
    22import sys 
    33import os 
    4 from PyQt4 import QtCore 
    5 from PyQt4 import QtGui 
    6 from PyQt4 import QtWebKit 
     4 
     5from PyQt5 import QtWidgets 
    76 
    87import sas.sasview 
     
    1312from sas.qtgui.MainWindow.UI.WelcomePanelUI import Ui_WelcomePanelUI 
    1413 
    15 class WelcomePanel(QtGui.QDialog, Ui_WelcomePanelUI): 
     14class WelcomePanel(QtWidgets.QDialog, Ui_WelcomePanelUI): 
    1615    def __init__(self, parent=None): 
    1716        super(WelcomePanel, self).__init__(parent) 
  • src/sas/qtgui/Perspectives/Fitting/FittingOptions.py

    • Property mode changed from 100755 to 100644
    rb3e8629 r4992ff2  
    44import types 
    55 
    6 from PyQt4 import QtCore 
    7 from PyQt4 import QtGui 
    8 from PyQt4 import QtWebKit 
     6from PyQt5 import QtCore 
     7from PyQt5 import QtGui 
     8from PyQt5 import QtWidgets 
     9from PyQt5 import QtWebKitWidgets 
    910 
    1011from sas.qtgui.UI import images_rc 
     
    2122 
    2223 
    23 class FittingOptions(QtGui.QDialog, Ui_FittingOptions): 
     24class FittingOptions(QtWidgets.QDialog, Ui_FittingOptions): 
    2425    """ 
    2526    Hard-coded version of the fit options dialog available from BUMPS. 
     
    5253 
    5354        # Handle the Apply button click 
    54         self.buttonBox.button(QtGui.QDialogButtonBox.Ok).clicked.connect(self.onApply) 
     55        self.buttonBox.button(QtWidgets.QDialogButtonBox.Ok).clicked.connect(self.onApply) 
    5556        # handle the Help button click 
    56         self.buttonBox.button(QtGui.QDialogButtonBox.Help).clicked.connect(self.onHelp) 
     57        self.buttonBox.button(QtWidgets.QDialogButtonBox.Help).clicked.connect(self.onHelp) 
    5758 
    5859        # Handle the combo box changes 
     
    7172 
    7273        # OK has to be initialized to True, after initial validator setup 
    73         self.buttonBox.button(QtGui.QDialogButtonBox.Ok).setEnabled(True) 
     74        self.buttonBox.button(QtWidgets.QDialogButtonBox.Ok).setEnabled(True) 
    7475 
    7576        # Display HTML content 
    76         self.helpView = QtWebKit.QWebView() 
     77        self.helpView = QtWebKitWidgets.QWebView() 
    7778 
    7879    def assignValidators(self): 
     
    104105        if state == QtGui.QValidator.Acceptable: 
    105106            color = '' # default 
    106             self.buttonBox.button(QtGui.QDialogButtonBox.Ok).setEnabled(True) 
     107            self.buttonBox.button(QtWidgets.QDialogButtonBox.Ok).setEnabled(True) 
    107108        else: 
    108109            color = '#fff79a' # yellow 
    109             self.buttonBox.button(QtGui.QDialogButtonBox.Ok).setEnabled(False) 
     110            self.buttonBox.button(QtWidgets.QDialogButtonBox.Ok).setEnabled(False) 
    110111 
    111112        sender.setStyleSheet('QLineEdit { background-color: %s }' % color) 
     
    134135 
    135136        # OK has to be reinitialized to True 
    136         self.buttonBox.button(QtGui.QDialogButtonBox.Ok).setEnabled(True) 
     137        self.buttonBox.button(QtWidgets.QDialogButtonBox.Ok).setEnabled(True) 
    137138 
    138139    def onApply(self): 
     
    148149            """ 
    149150            widget = self.widgetFromOption(option) 
    150             new_value = widget.currentText() if isinstance(widget, QtGui.QComboBox) \ 
     151            new_value = widget.currentText() if isinstance(widget, QtWidgets.QComboBox) \ 
    151152                else float(widget.text()) 
    152153            self.config.values[self.current_fitter_id][option] = new_value 
  • src/sas/qtgui/Perspectives/Fitting/FittingPerspective.py

    rb3e8629 r4992ff2  
    11import numpy 
    22 
    3 from PyQt4 import QtCore 
    4 from PyQt4 import QtGui 
     3from PyQt5 import QtCore 
     4from PyQt5 import QtGui 
     5from PyQt5 import QtWidgets 
    56 
    67from bumps import options 
     
    1415#from sas.qtgui.Perspectives.Fitting import ModelUtilities 
    1516 
    16 class FittingWindow(QtGui.QTabWidget): 
     17class FittingWindow(QtWidgets.QTabWidget): 
    1718    """ 
    1819    """ 
    1920    name = "Fitting" # For displaying in the combo box in DataExplorer 
    2021    def __init__(self, parent=None, data=None): 
     22 
    2123        super(FittingWindow, self).__init__() 
    2224 
  • src/sas/qtgui/Perspectives/Fitting/FittingUtilities.py

    rcee5c78 r4992ff2  
    11from copy import deepcopy 
    22 
    3 from PyQt4 import QtGui 
    4 from PyQt4 import QtCore 
     3from PyQt5 import QtCore 
     4from PyQt5 import QtGui 
     5from PyQt5 import QtWidgets 
    56 
    67import numpy 
  • src/sas/qtgui/Perspectives/Fitting/FittingWidget.py

    r7fb471d r4992ff2  
    99import numpy as np 
    1010 
    11 from PyQt4 import QtGui 
    12 from PyQt4 import QtCore 
    13 from PyQt4 import QtWebKit 
     11from PyQt5 import QtCore 
     12from PyQt5 import QtGui 
     13from PyQt5 import QtWidgets 
     14from PyQt5 import QtWebKitWidgets 
    1415 
    1516from sasmodels import product 
     
    7475        return QtGui.QStandardItemModel.headerData(self, section, orientation, role) 
    7576 
    76 class FittingWidget(QtGui.QWidget, Ui_FittingWidgetUI): 
     77class FittingWidget(QtWidgets.QWidget, Ui_FittingWidgetUI): 
    7778    """ 
    7879    Main widget for selecting form and structure factor models 
     
    121122 
    122123        # Display HTML content 
    123         self.helpView = QtWebKit.QWebView() 
     124        self.helpView = QtWebKitWidgets.QWebView() 
    124125 
    125126        # New font to display angstrom symbol 
     
    233234        """ 
    234235        # Options widget 
    235         layout = QtGui.QGridLayout() 
     236        layout = QtWidgets.QGridLayout() 
    236237        self.options_widget = OptionsWidget(self, self.logic) 
    237238        layout.addWidget(self.options_widget) 
     
    239240 
    240241        # Smearing widget 
    241         layout = QtGui.QGridLayout() 
     242        layout = QtWidgets.QGridLayout() 
    242243        self.smearing_widget = SmearingWidget(self) 
    243244        layout.addWidget(self.smearing_widget) 
     
    254255 
    255256        # Magnetic angles explained in one picture 
    256         self.magneticAnglesWidget = QtGui.QWidget() 
    257         labl = QtGui.QLabel(self.magneticAnglesWidget) 
     257        self.magneticAnglesWidget = QtWidgets.QWidget() 
     258        labl = QtWidgets.QLabel(self.magneticAnglesWidget) 
    258259        pixmap = QtGui.QPixmap(GuiUtils.IMAGES_DIRECTORY_LOCATION + '/M_angles_pic.bmp') 
    259260        labl.setPixmap(pixmap) 
     
    274275        self.lstParams.setModel(self._model_model) 
    275276        self.readCategoryInfo() 
     277 
    276278        self.model_parameters = None 
    277279 
     
    307309        self.lstParams.customContextMenuRequested.connect(self.showModelDescription) 
    308310        self.lstParams.setAttribute(QtCore.Qt.WA_MacShowFocusRect, False) 
    309  
    310311        # Poly model displayed in poly list 
    311312        self.lstPoly.setModel(self._poly_model) 
     
    466467            msg += "You must select a model to get information on this" 
    467468 
    468         menu = QtGui.QMenu() 
    469         label = QtGui.QLabel(msg) 
     469        menu = QtWidgets.QMenu() 
     470        label = QtWidgets.QLabel(msg) 
    470471        action = QtGui.QWidgetAction(self) 
    471472        action.setDefaultWidget(label) 
     
    915916        self.lstParams.resizeColumnToContents(4) 
    916917        self.lstParams.resizeColumnToContents(5) 
    917         self.lstParams.setSizePolicy(QtGui.QSizePolicy.MinimumExpanding, QtGui.QSizePolicy.Expanding) 
     918        self.lstParams.setSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.Expanding) 
    918919 
    919920        self.has_error_column = True 
     
    12301231        # Adjust the table cells width 
    12311232        self.lstParams.resizeColumnToContents(0) 
    1232         self.lstParams.setSizePolicy(QtGui.QSizePolicy.MinimumExpanding, QtGui.QSizePolicy.Expanding) 
     1233        self.lstParams.setSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.Expanding) 
    12331234 
    12341235        # Now we claim the model has been loaded 
     
    15361537        table.verticalHeader().setVisible(False) 
    15371538        table.setAlternatingRowColors(True) 
    1538         table.setSizePolicy(QtGui.QSizePolicy.MinimumExpanding, QtGui.QSizePolicy.Expanding) 
    1539         table.setSelectionBehavior(QtGui.QAbstractItemView.SelectRows) 
     1539        table.setSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.Expanding) 
     1540        table.setSelectionBehavior(QtWidgets.QAbstractItemView.SelectRows) 
    15401541        table.resizeColumnsToContents() 
    15411542 
    15421543        # Header 
    15431544        header = table.horizontalHeader() 
    1544         header.setResizeMode(QtGui.QHeaderView.ResizeToContents) 
    1545  
    1546         header.ResizeMode(QtGui.QHeaderView.Interactive) 
     1545        header.setSectionResizeMode(QtWidgets.QHeaderView.ResizeToContents) 
     1546        header.ResizeMode(QtWidgets.QHeaderView.Interactive) 
     1547 
     1548        # Qt5: the following 2 lines crash - figure out why! 
    15471549        # Resize column 0 and 7 to content 
    1548         header.setResizeMode(0, QtGui.QHeaderView.ResizeToContents) 
    1549         header.setResizeMode(7, QtGui.QHeaderView.ResizeToContents) 
     1550        #header.setSectionResizeMode(0, QtWidgets.QHeaderView.ResizeToContents) 
     1551        #header.setSectionResizeMode(7, QtWidgets.QHeaderView.ResizeToContents) 
    15501552 
    15511553    def setPolyModel(self): 
     
    16001602 
    16011603        # All possible polydisp. functions as strings in combobox 
    1602         func = QtGui.QComboBox() 
     1604        func = QtWidgets.QComboBox() 
    16031605        func.addItems([str(name_disp) for name_disp in POLYDISPERSITY_MODELS.keys()]) 
    16041606        # Set the default index 
     
    16831685        Show the load file dialog and loads requested data into state 
    16841686        """ 
    1685         datafile = QtGui.QFileDialog.getOpenFileName( 
    1686             self, "Choose a weight file", "", "All files (*.*)", 
    1687             QtGui.QFileDialog.DontUseNativeDialog) 
     1687        datafile = QtWidgets.QFileDialog.getOpenFileName( 
     1688            self, "Choose a weight file", "", "All files (*.*)", None, 
     1689            QtWidgets.QFileDialog.DontUseNativeDialog) 
    16881690 
    16891691        if datafile is None or str(datafile)=='': 
     
    17841786        item1 = QtGui.QStandardItem(param_name) 
    17851787 
    1786         func = QtGui.QComboBox() 
     1788        func = QtWidgets.QComboBox() 
    17871789        # Available range of shells displayed in the combobox 
    17881790        func.addItems([str(i) for i in range(param_length+1)]) 
  • src/sas/qtgui/Perspectives/Fitting/OptionsWidget.py

    • Property mode changed from 100755 to 100644
    rb3e8629 r4992ff2  
    33""" 
    44import numpy as np 
    5 from PyQt4 import QtGui 
    6 from PyQt4 import QtCore 
     5from PyQt5 import QtCore 
     6from PyQt5 import QtGui 
     7from PyQt5 import QtWidgets 
    78 
    89from sas.qtgui.Plotting.PlotterData import Data2D 
     
    2122    'LOG_SPACED'] 
    2223 
    23 class DataWidgetMapper(QtGui.QDataWidgetMapper): 
     24class DataWidgetMapper(QtWidgets.QDataWidgetMapper): 
    2425    """ 
    2526    Custom version of the standard QDataWidgetMapper allowing for proper 
     
    3233            super(DataWidgetMapper, self).addMapping(widget, section, propertyName) 
    3334 
    34         if isinstance(widget, QtGui.QComboBox): 
     35        if isinstance(widget, QtWidgets.QComboBox): 
    3536            delegate = self.itemDelegate() 
    3637            widget.currentIndexChanged.connect(lambda: delegate.commitData.emit(widget)) 
    3738 
    38         elif isinstance(widget, QtGui.QCheckBox): 
     39        elif isinstance(widget, QtWidgets.QCheckBox): 
    3940            delegate = self.itemDelegate() 
    4041            widget.stateChanged.connect(lambda: delegate.commitData.emit(widget)) 
    4142 
    42 class OptionsWidget(QtGui.QWidget, Ui_tabOptions): 
     43class OptionsWidget(QtWidgets.QWidget, Ui_tabOptions): 
    4344    plot_signal = QtCore.pyqtSignal() 
    4445    def __init__(self, parent=None, logic=None): 
     
    5253 
    5354        # Weight radio box group 
    54         self.weightingGroup = QtGui.QButtonGroup() 
     55        self.weightingGroup = QtWidgets.QButtonGroup() 
    5556        self.weighting = 0 
    5657 
     
    114115        self.mapper.addMapping(self.txtNpts,     MODEL.index('NPTS')) 
    115116        self.mapper.addMapping(self.chkLogData,  MODEL.index('LOG_SPACED')) 
    116         self.mapper.toFirst() 
     117        # FIXME DOESNT WORK WITH QT5 
     118        #self.mapper.toFirst() 
    117119 
    118120    def toggleLogData(self, isChecked): 
  • src/sas/qtgui/Perspectives/Fitting/SmearingWidget.py

    • Property mode changed from 100755 to 100644
    rb3e8629 r4992ff2  
    22Widget/logic for smearing data. 
    33""" 
    4 from PyQt4 import QtGui 
    5 from PyQt4 import QtCore 
     4from PyQt5 import QtCore 
     5from PyQt5 import QtGui 
     6from PyQt5 import QtWidgets 
    67 
    78from sas.qtgui.Plotting.PlotterData import Data1D 
     
    1112from sas.qtgui.Perspectives.Fitting.UI.SmearingWidgetUI import Ui_SmearingWidgetUI 
    1213 
    13 class DataWidgetMapper(QtGui.QDataWidgetMapper): 
     14class DataWidgetMapper(QtWidgets.QDataWidgetMapper): 
    1415    """ 
    1516    Custom version of the standard QDataWidgetMapper allowing for proper 
     
    2223            super(DataWidgetMapper, self).addMapping(widget, section, propertyName) 
    2324 
    24         if isinstance(widget, QtGui.QComboBox): 
     25        if isinstance(widget, QtWidgets.QComboBox): 
    2526            delegate = self.itemDelegate() 
    2627            widget.currentIndexChanged.connect(lambda: delegate.commitData.emit(widget)) 
     
    3536    'ACCURACY'] 
    3637 
    37 class SmearingWidget(QtGui.QWidget, Ui_SmearingWidgetUI): 
     38class SmearingWidget(QtWidgets.QWidget, Ui_SmearingWidgetUI): 
    3839    def __init__(self, parent=None): 
    3940        super(SmearingWidget, self).__init__() 
     
    8384        self.mapper.addMapping(self.cbSmearing,   MODEL.index('SMEARING')) 
    8485        self.mapper.addMapping(self.cbAccuracy,   MODEL.index('ACCURACY')) 
    85         self.mapper.toFirst() 
     86 
     87        # FIXME DOESNT WORK WITH QT5 
     88        #self.mapper.toFirst() 
    8689 
    8790    def updateSmearing(self, data=None): 
  • src/sas/qtgui/Perspectives/Fitting/ViewDelegate.py

    r02f1d12 r4992ff2  
    1 from PyQt4 import QtGui 
    2 from PyQt4 import QtCore 
     1from PyQt5 import QtCore 
     2from PyQt5 import QtGui 
     3from PyQt5 import QtWidgets 
    34 
    45import sas.qtgui.Utilities.GuiUtils as GuiUtils 
    56 
    6 class ModelViewDelegate(QtGui.QStyledItemDelegate): 
     7class ModelViewDelegate(QtWidgets.QStyledItemDelegate): 
    78    """ 
    89    Custom delegate for appearance and behavior control of the model view 
     
    1213        Overwrite generic constructor to allow for some globals 
    1314        """ 
    14         super(QtGui.QStyledItemDelegate, self).__init__() 
     15        super(QtWidgets.QStyledItemDelegate, self).__init__() 
    1516 
    1617        # Main parameter table view columns 
     
    4344        if index.column() in self.fancyColumns(): 
    4445            # Units - present in nice HTML 
    45             options = QtGui.QStyleOptionViewItemV4(option) 
     46            #options = QtWidgets.QStyleOptionViewItemV4(option) 
     47            options = QtWidgets.QStyleOptionViewItem(option) 
    4648            self.initStyleOption(options,index) 
    4749 
     
    5759            # delete the original content 
    5860            options.text = "" 
    59             style.drawControl(QtGui.QStyle.CE_ItemViewItem, options, painter, options.widget); 
     61            style.drawControl(QtWidgets.QStyle.CE_ItemViewItem, options, painter, options.widget); 
    6062 
    6163            context = QtGui.QAbstractTextDocumentLayout.PaintContext() 
    62             textRect = style.subElementRect(QtGui.QStyle.SE_ItemViewItemText, options) 
     64            textRect = style.subElementRect(QtWidgets.QStyle.SE_ItemViewItemText, options) 
    6365 
    6466            painter.save() 
     
    7072        else: 
    7173            # Just the default paint 
    72             QtGui.QStyledItemDelegate.paint(self, painter, option, index) 
     74            QtWidgets.QStyledItemDelegate.paint(self, painter, option, index) 
    7375 
    7476    def createEditor(self, widget, option, index): 
     
    7981            return 0 
    8082        if index.column() == self.param_value: #only in the value column 
    81             editor = QtGui.QLineEdit(widget) 
     83            editor = QtWidgets.QLineEdit(widget) 
    8284            validator = QtGui.QDoubleValidator() 
    8385            editor.setValidator(validator) 
     
    100102                # balloon popup? tooltip? cell background colour flash? 
    101103                return 
    102         QtGui.QStyledItemDelegate.setModelData(self, editor, model, index) 
    103  
    104  
    105 class PolyViewDelegate(QtGui.QStyledItemDelegate): 
     104        QtWidgets.QStyledItemDelegate.setModelData(self, editor, model, index) 
     105 
     106 
     107class PolyViewDelegate(QtWidgets.QStyledItemDelegate): 
    106108    """ 
    107109    Custom delegate for appearance and behavior control of the polydispersity view 
     
    116118        Overwrite generic constructor to allow for some globals 
    117119        """ 
    118         super(QtGui.QStyledItemDelegate, self).__init__() 
     120        super(QtWidgets.QStyledItemDelegate, self).__init__() 
    119121 
    120122        self.poly_parameter = 0 
     
    160162            return None 
    161163        elif index.column() in self.editableParameters(): 
    162             self.editor = QtGui.QLineEdit(widget) 
     164            self.editor = QtWidgets.QLineEdit(widget) 
    163165            validator = QtGui.QDoubleValidator() 
    164166            self.editor.setValidator(validator) 
    165167            return self.editor 
    166168        else: 
    167             QtGui.QStyledItemDelegate.createEditor(self, widget, option, index) 
     169            QtWidgets.QStyledItemDelegate.createEditor(self, widget, option, index) 
    168170 
    169171    def paint(self, painter, option, index): 
     
    173175        if index.column() in (self.poly_min, self.poly_max): 
    174176            # Units - present in nice HTML 
    175             options = QtGui.QStyleOptionViewItemV4(option) 
     177            options = QtWidgets.QStyleOptionViewItem(option) 
    176178            self.initStyleOption(options,index) 
    177179 
     
    187189            # delete the original content 
    188190            options.text = "" 
    189             style.drawControl(QtGui.QStyle.CE_ItemViewItem, options, painter, options.widget); 
     191            style.drawControl(QtWidgets.QStyle.CE_ItemViewItem, options, painter, options.widget); 
    190192 
    191193            context = QtGui.QAbstractTextDocumentLayout.PaintContext() 
    192             textRect = style.subElementRect(QtGui.QStyle.SE_ItemViewItemText, options) 
     194            textRect = style.subElementRect(QtWidgets.QStyle.SE_ItemViewItemText, options) 
    193195 
    194196            painter.save() 
     
    200202        else: 
    201203            # Just the default paint 
    202             QtGui.QStyledItemDelegate.paint(self, painter, option, index) 
    203  
    204 class MagnetismViewDelegate(QtGui.QStyledItemDelegate): 
     204            QtWidgets.QStyledItemDelegate.paint(self, painter, option, index) 
     205 
     206class MagnetismViewDelegate(QtWidgets.QStyledItemDelegate): 
    205207    """ 
    206208    Custom delegate for appearance and behavior control of the magnetism view 
     
    210212        Overwrite generic constructor to allow for some globals 
    211213        """ 
    212         super(QtGui.QStyledItemDelegate, self).__init__() 
     214        super(QtWidgets.QStyledItemDelegate, self).__init__() 
    213215 
    214216        self.mag_parameter = 0 
     
    238240            return 0 
    239241        if index.column() in self.editableParameters(): 
    240             editor = QtGui.QLineEdit(widget) 
     242            editor = QtWidgets.QLineEdit(widget) 
    241243            validator = QtGui.QDoubleValidator() 
    242244            editor.setValidator(validator) 
    243245            return editor 
    244246        else: 
    245             QtGui.QStyledItemDelegate.createEditor(self, widget, option, index) 
     247            QtWidgets.QStyledItemDelegate.createEditor(self, widget, option, index) 
    246248 
    247249    def paint(self, painter, option, index): 
     
    251253        if index.column() in (self.mag_min, self.mag_max, self.mag_unit): 
    252254            # Units - present in nice HTML 
    253             options = QtGui.QStyleOptionViewItemV4(option) 
     255            options = QtWidgets.QStyleOptionViewItem(option) 
    254256            self.initStyleOption(options,index) 
    255257 
     
    265267            # delete the original content 
    266268            options.text = "" 
    267             style.drawControl(QtGui.QStyle.CE_ItemViewItem, options, painter, options.widget); 
     269            style.drawControl(QtWidgets.QStyle.CE_ItemViewItem, options, painter, options.widget); 
    268270 
    269271            context = QtGui.QAbstractTextDocumentLayout.PaintContext() 
    270             textRect = style.subElementRect(QtGui.QStyle.SE_ItemViewItemText, options) 
     272            textRect = style.subElementRect(QtWidgets.QStyle.SE_ItemViewItemText, options) 
    271273 
    272274            painter.save() 
     
    278280        else: 
    279281            # Just the default paint 
    280             QtGui.QStyledItemDelegate.paint(self, painter, option, index) 
     282            QtWidgets.QStyledItemDelegate.paint(self, painter, option, index) 
  • src/sas/qtgui/Perspectives/Invariant/InvariantDetails.py

    • Property mode changed from 100755 to 100644
    rb3e8629 r4992ff2  
    11import sys 
    22import os 
    3 from PyQt4 import QtCore 
    4 from PyQt4 import QtGui 
     3from PyQt5 import QtCore 
     4from PyQt5 import QtGui 
     5from PyQt5 import QtWidgets 
    56 
    67# local 
     
    89from .InvariantUtils import WIDGETS 
    910 
    10 class DetailsDialog(QtGui.QDialog, Ui_Dialog): 
     11class DetailsDialog(QtWidgets.QDialog, Ui_Dialog): 
    1112    """ 
    1213    """ 
  • src/sas/qtgui/Perspectives/Invariant/InvariantPerspective.py

    r7fb471d r4992ff2  
    22import sys 
    33import os 
    4 from PyQt4 import QtCore 
    5 from PyQt4 import QtGui 
    6 from PyQt4 import QtWebKit 
     4from PyQt5 import QtCore 
     5from PyQt5 import QtGui 
     6from PyQt5 import QtWidgets 
     7from PyQt5 import QtWebKitWidgets 
    78 
    89from twisted.internet import threads 
     
    3536        self._model.appendRow(item) 
    3637 
    37 class InvariantWindow(QtGui.QDialog, Ui_tabbedInvariantUI): 
     38class InvariantWindow(QtWidgets.QDialog, Ui_tabbedInvariantUI): 
    3839    # The controller which is responsible for managing signal slots connections 
    3940    # for the gui and providing an interface to the data model. 
     
    6162        self._model_item = QtGui.QStandardItem() 
    6263 
    63         self._helpView = QtWebKit.QWebView() 
     64        self._helpView = QtWebKitWidgets.QWebView() 
    6465        self.detailsDialog = DetailsDialog(self) 
    6566 
     
    502503    def setupMapper(self): 
    503504        # Set up the mapper. 
    504         self.mapper = QtGui.QDataWidgetMapper(self) 
     505        self.mapper = QtWidgets.QDataWidgetMapper(self) 
    505506        self.mapper.setOrientation(QtCore.Qt.Vertical) 
    506507        self.mapper.setModel(self.model) 
     
    543544        self.mapper.addMapping(self.lineEdit_18, WIDGETS.W_INVARIANT_ERR) 
    544545 
    545         self.mapper.toFirst() 
     546        # FIXME DOESNT WORK WITH QT5 
     547        #self.mapper.toFirst() 
    546548 
    547549    def setData(self, data_item, is_batch=False): 
     
    644646        """ 
    645647        return False 
    646  
    647 if __name__ == "__main__": 
    648     app = QtGui.QApplication([]) 
    649     import qt4reactor 
    650     qt4reactor.install() 
    651     # DO NOT move the following import to the top! 
    652     # (unless you know what you're doing) 
    653     from twisted.internet import reactor 
    654     dlg = InvariantWindow(reactor) 
    655     dlg.show() 
    656     reactor.run() 
  • src/sas/qtgui/Plotting/AddText.py

    r83eb5208 r4992ff2  
    1 from PyQt4 import QtGui 
     1from PyQt5 import QtCore 
     2from PyQt5 import QtGui 
     3from PyQt5 import QtWidgets 
    24 
    35import sas.sasview 
     
    57from sas.qtgui.Plotting.UI.AddTextUI import Ui_AddText 
    68 
    7 class AddText(QtGui.QDialog, Ui_AddText): 
     9class AddText(QtWidgets.QDialog, Ui_AddText): 
    810    """ Simple GUI for a single line text query """ 
    911    def __init__(self, parent=None): 
  • src/sas/qtgui/Plotting/BoxSum.py

    rcd2cc745 r4992ff2  
    22Allows users to modify the box slicer parameters. 
    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# Local UI 
     
    910from sas.qtgui.Plotting.UI.BoxSumUI import Ui_BoxSumUI 
    1011 
    11 class BoxSum(QtGui.QDialog, Ui_BoxSumUI): 
     12class BoxSum(QtWidgets.QDialog, Ui_BoxSumUI): 
    1213    apply_signal = QtCore.pyqtSignal(tuple, str) 
    1314    def __init__(self, parent=None, model=None): 
  • src/sas/qtgui/Plotting/ColorMap.py

    • Property mode changed from 100755 to 100644
    rb3e8629 r4992ff2  
    22Allows users to change the range of the current graph 
    33""" 
    4 from PyQt4 import QtGui 
    5 from PyQt4 import QtCore 
     4from PyQt5 import QtCore 
     5from PyQt5 import QtGui 
     6from PyQt5 import QtWidgets 
    67import sas.qtgui.path_prepare 
    78 
     
    1011import numpy 
    1112 
    12 from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas 
     13from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg as FigureCanvas 
    1314from sas.qtgui.Plotting.PlotterData import Data2D 
    1415from sas.qtgui.Utilities.GuiUtils import formatNumber 
     
    2122from sas.qtgui.Plotting.UI.ColorMapUI import Ui_ColorMapUI 
    2223 
    23 class ColorMap(QtGui.QDialog, Ui_ColorMapUI): 
     24class ColorMap(QtWidgets.QDialog, Ui_ColorMapUI): 
    2425    apply_signal = QtCore.pyqtSignal(tuple, str) 
    2526    def __init__(self, parent=None, cmap=None, vmin=0.0, vmax=100.0, data=None): 
     
    7172 
    7273        # Handle the Reset button click 
    73         self.buttonBox.button(QtGui.QDialogButtonBox.Reset).clicked.connect(self.onReset) 
     74        self.buttonBox.button(QtWidgets.QDialogButtonBox.Reset).clicked.connect(self.onReset) 
    7475 
    7576        # Handle the Apply button click 
    76         self.buttonBox.button(QtGui.QDialogButtonBox.Apply).clicked.connect(self.onApply) 
     77        self.buttonBox.button(QtWidgets.QDialogButtonBox.Apply).clicked.connect(self.onApply) 
    7778 
    7879        # Handle the amplitude setup 
     
    161162        self.slider.setOrientation(QtCore.Qt.Horizontal) 
    162163 
    163         self.slider_label = QtGui.QLabel() 
     164        self.slider_label = QtWidgets.QLabel() 
    164165        self.slider_label.setText("Drag the sliders to adjust color range.") 
    165166 
     
    192193        self.canvas = FigureCanvas(self.fig) 
    193194 
    194         layout = QtGui.QVBoxLayout() 
     195        layout = QtWidgets.QVBoxLayout() 
    195196        layout.addWidget(self.slider_label) 
    196197        layout.addWidget(self.slider) 
  • src/sas/qtgui/Plotting/LinearFit.py

    • Property mode changed from 100755 to 100644
    rb3e8629 r4992ff2  
    44import re 
    55import numpy 
    6 from PyQt4 import QtGui 
    7 from PyQt4 import QtCore 
     6from PyQt5 import QtCore 
     7from PyQt5 import QtGui 
     8from PyQt5 import QtWidgets 
    89 
    910from sas.qtgui.Utilities.GuiUtils import formatNumber 
     
    1718from sas.qtgui.Plotting.UI.LinearFitUI import Ui_LinearFitUI 
    1819 
    19 class LinearFit(QtGui.QDialog, Ui_LinearFitUI): 
     20class LinearFit(QtWidgets.QDialog, Ui_LinearFitUI): 
    2021    def __init__(self, parent=None, 
    2122                 data=None, 
  • src/sas/qtgui/Plotting/MaskEditor.py

    rdc5ef15 r4992ff2  
    1 from PyQt4 import QtGui 
     1from PyQt5 import QtCore 
     2from PyQt5 import QtGui 
     3from PyQt5 import QtWidgets 
    24 
    35from sas.qtgui.Plotting.PlotterData import Data2D 
     
    810from sas.qtgui.Plotting.Plotter2D import Plotter2DWidget 
    911 
    10 class MaskEditor(QtGui.QDialog, Ui_MaskEditorUI): 
     12class MaskEditor(QtWidgets.QDialog, Ui_MaskEditorUI): 
    1113    def __init__(self, parent=None, data=None): 
    1214        super(MaskEditor, self).__init__() 
     
    2325        self.plotter.data = self.data 
    2426 
    25         layout = QtGui.QHBoxLayout() 
     27        layout = QtWidgets.QHBoxLayout() 
    2628        layout.setContentsMargins(0, 0, 0, 0) 
    2729        self.frame.setLayout(layout) 
  • src/sas/qtgui/Plotting/PlotProperties.py

    • Property mode changed from 100755 to 100644
    rb3e8629 r4992ff2  
    1 from PyQt4 import QtGui 
     1from PyQt5 import QtCore 
     2from PyQt5 import QtGui 
     3from PyQt5 import QtWidgets 
    24 
    35from sas.qtgui.Plotting.PlotUtilities import COLORS, SHAPES 
     
    68from sas.qtgui.Plotting.UI.PlotPropertiesUI import Ui_PlotPropertiesUI 
    79 
    8 class PlotProperties(QtGui.QDialog, Ui_PlotPropertiesUI): 
     10class PlotProperties(QtWidgets.QDialog, Ui_PlotPropertiesUI): 
    911    """ Dialog for modification of single plot properties """ 
    1012    def __init__(self, 
  • src/sas/qtgui/Plotting/Plotter.py

    rcee5c78 r4992ff2  
    1 from PyQt4 import QtGui 
    2 from PyQt4 import QtCore 
     1from PyQt5 import QtCore 
     2from PyQt5 import QtGui 
     3from PyQt5 import QtWidgets 
     4 
    35import functools 
    46import copy 
     
    1921    1D Plot widget for use with a QDialog 
    2022    """ 
     23    updatePlot = QtCore.pyqtSignal(tuple) 
    2124    def __init__(self, parent=None, manager=None, quickplot=False): 
    2225        super(PlotterWidget, self).__init__(parent, manager=manager, quickplot=quickplot) 
     
    4144        # Add a slot for receiving update signal from LinearFit 
    4245        # NEW style signals 
    43         #self.updatePlot = QtCore.pyqtSignal(tuple) 
    44         # self.updatePlot.connect(self.onFitDisplay) 
     46        self.updatePlot.connect(self.onFitDisplay) 
    4547        # OLD style signals 
    46         QtCore.QObject.connect(self, QtCore.SIGNAL('updatePlot'), self.onFitDisplay) 
     48        # QtCore.QObject.connect(self, QtCore.SIGNAL('updatePlot'), self.onFitDisplay) 
    4749 
    4850    @property 
     
    272274        Show a dialog allowing axes rescaling 
    273275        """ 
    274         if self.properties.exec_() == QtGui.QDialog.Accepted: 
     276        if self.properties.exec_() == QtWidgets.QDialog.Accepted: 
    275277            self.xLogLabel, self.yLogLabel = self.properties.getValues() 
    276278            self.xyTransform(self.xLogLabel, self.yLogLabel) 
     
    280282        Show a dialog allowing adding custom text to the chart 
    281283        """ 
    282         if self.addText.exec_() == QtGui.QDialog.Accepted: 
     284        if self.addText.exec_() == QtWidgets.QDialog.Accepted: 
    283285            # Retrieve the new text, its font and color 
    284286            extra_text = self.addText.text() 
     
    332334        """ 
    333335        # min and max of data 
    334         if self.setRange.exec_() == QtGui.QDialog.Accepted: 
     336        if self.setRange.exec_() == QtWidgets.QDialog.Accepted: 
    335337            x_range = self.setRange.xrange() 
    336338            y_range = self.setRange.yrange() 
     
    366368                    xlabel=self.xLogLabel, 
    367369                    ylabel=self.yLogLabel) 
    368         if fit_dialog.exec_() == QtGui.QDialog.Accepted: 
     370        if fit_dialog.exec_() == QtWidgets.QDialog.Accepted: 
    369371            return 
    370372 
     
    443445                                marker_size=marker_size, 
    444446                                legend=legend) 
    445         if plotPropertiesWidget.exec_() == QtGui.QDialog.Accepted: 
     447        if plotPropertiesWidget.exec_() == QtWidgets.QDialog.Accepted: 
    446448            # Update Data1d 
    447449            selected_plot.markersize = plotPropertiesWidget.markersize() 
     
    700702 
    701703 
    702 class Plotter(QtGui.QDialog, PlotterWidget): 
     704class Plotter(QtWidgets.QDialog, PlotterWidget): 
    703705    def __init__(self, parent=None, quickplot=False): 
    704706 
    705         QtGui.QDialog.__init__(self) 
     707        QtWidgets.QDialog.__init__(self) 
    706708        PlotterWidget.__init__(self, parent=self, manager=parent, quickplot=quickplot) 
    707709        icon = QtGui.QIcon() 
  • src/sas/qtgui/Plotting/Plotter2D.py

    rcee5c78 r4992ff2  
    44import functools 
    55 
    6 from PyQt4 import QtGui 
    7 from PyQt4 import QtCore 
     6from PyQt5 import QtCore 
     7from PyQt5 import QtGui 
     8from PyQt5 import QtWidgets 
    89 
    910DEFAULT_CMAP = pylab.cm.jet 
     11 
     12#import sys 
     13#print("SYS.PATH = ", sys.path) 
     14import matplotlib as mpl 
     15mpl.use("Qt5Agg") 
     16 
    1017from mpl_toolkits.mplot3d import Axes3D 
    1118 
     
    365372        color_map_dialog.apply_signal.connect(self.onApplyMap) 
    366373 
    367         if color_map_dialog.exec_() == QtGui.QDialog.Accepted: 
     374        if color_map_dialog.exec_() == QtWidgets.QDialog.Accepted: 
    368375            self.onApplyMap(color_map_dialog.norm(), color_map_dialog.cmap()) 
    369376 
     
    503510 
    504511 
    505 class Plotter2D(QtGui.QDialog, Plotter2DWidget): 
     512class Plotter2D(QtWidgets.QDialog, Plotter2DWidget): 
    506513    """ 
    507514    Plotter widget implementation 
    508515    """ 
    509516    def __init__(self, parent=None, quickplot=False, dimension=2): 
    510         QtGui.QDialog.__init__(self) 
     517        QtWidgets.QDialog.__init__(self) 
    511518        Plotter2DWidget.__init__(self, manager=parent, quickplot=quickplot, dimension=dimension) 
    512519        icon = QtGui.QIcon() 
  • 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 
  • src/sas/qtgui/Plotting/ScaleProperties.py

    rcd2cc745 r4992ff2  
    1 from PyQt4 import QtGui 
     1from PyQt5 import QtCore 
     2from PyQt5 import QtGui 
     3from PyQt5 import QtWidgets 
    24 
    35import sas.sasview 
     
    2022    view_values[5]: [0, 4], # Kratky 
    2123} 
    22 class ScaleProperties(QtGui.QDialog, Ui_scalePropertiesUI): 
     24class ScaleProperties(QtWidgets.QDialog, Ui_scalePropertiesUI): 
    2325    def __init__(self, parent=None, init_scale_x='x', init_scale_y='y'): 
    2426        super(ScaleProperties, self).__init__(parent) 
  • src/sas/qtgui/Plotting/SetGraphRange.py

    rcd2cc745 r4992ff2  
    22Allows users to change the range of the current graph 
    33""" 
    4 from PyQt4 import QtGui 
     4from PyQt5 import QtCore 
     5from PyQt5 import QtGui 
     6from PyQt5 import QtWidgets 
    57 
    68# Local UI 
     
    810from sas.qtgui.Plotting.UI.SetGraphRangeUI import Ui_setGraphRangeUI 
    911 
    10 class SetGraphRange(QtGui.QDialog, Ui_setGraphRangeUI): 
     12class SetGraphRange(QtWidgets.QDialog, Ui_setGraphRangeUI): 
    1113    def __init__(self, parent=None, x_range=(0.0, 0.0), y_range=(0.0, 0.0)): 
    1214        super(SetGraphRange, self).__init__() 
  • src/sas/qtgui/Plotting/SlicerModel.py

    rcee5c78 r4992ff2  
    1 from PyQt4 import QtGui 
    2 from PyQt4 import QtCore 
     1from PyQt5 import QtGui 
    32 
    43import sas.qtgui.Utilities.GuiUtils as GuiUtils 
  • src/sas/qtgui/Plotting/SlicerParameters.py

    rcd2cc745 r4992ff2  
    44import numpy 
    55import functools 
    6 from PyQt4 import QtGui 
    7 from PyQt4 import QtCore 
    8 from PyQt4 import QtWebKit 
     6from PyQt5 import QtCore 
     7from PyQt5 import QtGui 
     8from PyQt5 import QtWidgets 
     9from PyQt5 import QtWebKitWidgets 
    910 
    1011# Local UI 
     
    1213from sas.qtgui.Plotting.UI.SlicerParametersUI import Ui_SlicerParametersUI 
    1314 
    14 class SlicerParameters(QtGui.QDialog, Ui_SlicerParametersUI): 
     15class SlicerParameters(QtWidgets.QDialog, Ui_SlicerParametersUI): 
    1516    """ 
    1617    Interaction between the QTableView and the underlying model, 
     
    4445 
    4546        # Display Help on clicking the button 
    46         self.buttonBox.button(QtGui.QDialogButtonBox.Help).clicked.connect(self.onHelp) 
     47        self.buttonBox.button(QtWidgets.QDialogButtonBox.Help).clicked.connect(self.onHelp) 
    4748 
    4849        # Close doesn't trigger closeEvent automatically, so force it 
    49         self.buttonBox.button(QtGui.QDialogButtonBox.Close).clicked.connect(functools.partial(self.closeEvent, None)) 
     50        self.buttonBox.button(QtWidgets.QDialogButtonBox.Close).clicked.connect(functools.partial(self.closeEvent, None)) 
    5051 
    5152        # Disable row number display 
    5253        self.lstParams.verticalHeader().setVisible(False) 
    5354        self.lstParams.setAlternatingRowColors(True) 
    54         self.lstParams.setSizePolicy(QtGui.QSizePolicy.MinimumExpanding, QtGui.QSizePolicy.Expanding) 
     55        self.lstParams.setSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.Expanding) 
    5556 
    5657        # Header properties for nicer display 
    5758        header = self.lstParams.horizontalHeader() 
    58         header.setResizeMode(QtGui.QHeaderView.Stretch) 
     59        header.setSectionResizeMode(QtWidgets.QHeaderView.Stretch) 
    5960        header.setStretchLastSection(True) 
    6061 
     
    8687        location = "docs/sphinx-docs/build/html" + \ 
    8788            "/user/sasgui/guiframe/graph_help.html#d-data-averaging" 
    88         self.helpView = QtWebKit.QWebView() 
     89        self.helpView = QtWebKitWidgets.QWebView() 
    8990        self.helpView.load(QtCore.QUrl(location)) 
    9091        self.helpView.show() 
    9192 
    9293 
    93 class ProxyModel(QtGui.QIdentityProxyModel): 
     94class ProxyModel(QtCore.QIdentityProxyModel): 
    9495    """ 
    9596    Trivial proxy model with custom column edit flag 
     
    117118        return flags 
    118119 
    119 class PositiveDoubleEditor(QtGui.QLineEdit): 
     120class PositiveDoubleEditor(QtWidgets.QLineEdit): 
    120121    # a signal to tell the delegate when we have finished editing 
    121122    editingFinished = QtCore.Signal() 
     
    136137 
    137138 
    138 class EditDelegate(QtGui.QStyledItemDelegate): 
     139class EditDelegate(QtWidgets.QStyledItemDelegate): 
    139140    refocus_signal = QtCore.pyqtSignal(int, int) 
    140141    def __init__(self, parent=None, validate_method=None): 
     
    155156                return self.editor 
    156157        else: 
    157                 return QtGui.QStyledItemDelegate.createEditor(self, parent, option, index) 
     158                return QtWidgets.QStyledItemDelegate.createEditor(self, parent, option, index) 
    158159 
    159160    def setModelData(self, editor, model, index): 
  • src/sas/qtgui/Plotting/Slicers/AnnulusSlicer.py

    rcee5c78 r4992ff2  
    11import numpy 
    2 from PyQt4 import QtGui 
    3 from PyQt4 import QtCore 
    42 
    53import sas.qtgui.Utilities.GuiUtils as GuiUtils 
  • src/sas/qtgui/Plotting/Slicers/BoxSlicer.py

    rcee5c78 r4992ff2  
    11import numpy 
    2 from PyQt4 import QtGui 
    3 from PyQt4 import QtCore 
    42 
    53from .BaseInteractor import BaseInteractor 
  • src/sas/qtgui/Plotting/Slicers/BoxSum.py

    rcee5c78 r4992ff2  
    44""" 
    55import numpy 
    6 from PyQt4 import QtGui 
    7 from PyQt4 import QtCore 
     6from PyQt5 import QtGui 
     7 
    88from sas.qtgui.Utilities.GuiUtils import formatNumber 
    99 
  • src/sas/qtgui/Plotting/Slicers/SectorSlicer.py

    rcee5c78 r4992ff2  
    33""" 
    44import numpy 
    5 from PyQt4 import QtGui 
    6 from PyQt4 import QtCore 
    75 
    86from .BaseInteractor import BaseInteractor 
  • src/sas/qtgui/Plotting/UnitTesting/SlicerParametersTest.py

    r7fb471d r4992ff2  
    3737        '''Test the GUI in its default state''' 
    3838        #self.widget.mapper 
    39         self.assertIsInstance(self.widget.proxy, QtGui.QIdentityProxyModel) 
     39        self.assertIsInstance(self.widget.proxy, QtCore.QIdentityProxyModel) 
    4040        self.assertIsInstance(self.widget.lstParams.itemDelegate(), QtGui.QStyledItemDelegate) 
    4141        self.assertTrue(self.widget.lstParams.model().columnReadOnly(0)) 
  • src/sas/qtgui/Plotting/WindowTitle.py

    r83eb5208 r4992ff2  
    33from "Graph_n" to any ASCII text. 
    44""" 
    5 from PyQt4 import QtGui 
     5from PyQt5 import QtWidgets 
    66 
    77from sas.qtgui.Plotting.UI.WindowTitleUI import Ui_WindowTitle 
    88 
    9 class WindowTitle(QtGui.QDialog, Ui_WindowTitle): 
     9class WindowTitle(QtWidgets.QDialog, Ui_WindowTitle): 
    1010    """ Simple GUI for a single line text query """ 
    1111    def __init__(self, parent=None, new_title=""): 
  • src/sas/qtgui/Plotting/rangeSlider.py

    • Property mode changed from 100755 to 100644
    r83eb5208 r4992ff2  
    2323""" 
    2424 
    25 from PyQt4 import QtGui, QtCore 
    26  
    27 class RangeSlider(QtGui.QSlider): 
     25from PyQt5 import QtCore 
     26from PyQt5 import QtGui 
     27from PyQt5 import QtWidgets 
     28 
     29class RangeSlider(QtWidgets.QSlider): 
    2830    """ A slider for ranges. 
    2931     
     
    4648        self._high = self.maximum() 
    4749         
    48         self.pressed_control = QtGui.QStyle.SC_None 
    49         self.hover_control = QtGui.QStyle.SC_None 
     50        self.pressed_control = QtWidgets.QStyle.SC_None 
     51        self.hover_control = QtWidgets.QStyle.SC_None 
    5052        self.click_offset = 0 
    5153         
     
    9092 
    9193        for i, value in enumerate([self._low, self._high]): 
    92             opt = QtGui.QStyleOptionSlider() 
     94            opt = QtWidgets.QStyleOptionSlider() 
    9395            self.initStyleOption(opt) 
    9496 
     
    107109                slider_max = gr.bottom() - handle_length + 1 
    108110 
    109             opt.subControls = QtGui.QStyle.SC_SliderGroove | QtGui.QStyle.SC_SliderHandle 
     111            opt.subControls = QtWidgets.QStyle.SC_SliderGroove | QtWidgets.QStyle.SC_SliderHandle 
    110112 
    111113            # draw the first slider with inverted appearance, then the second  
     
    131133                # do not highlight the second part when has focus to avoid  
    132134                # drawing of partially overlapped semi-transparent backgrounds 
    133                 opt.state &= ~QtGui.QStyle.State_HasFocus 
     135                opt.state &= ~QtWidgets.QStyle.State_HasFocus 
    134136 
    135137                opt.sliderValue = 0 
     
    157159 
    158160            if self.tickPosition() != self.NoTicks: 
    159                 opt.subControls |= QtGui.QStyle.SC_SliderTickmarks 
     161                opt.subControls |= QtWidgets.QStyle.SC_SliderTickmarks 
    160162 
    161163            if self.pressed_control: 
    162164                opt.activeSubControls = self.pressed_control 
    163                 opt.state |= QtGui.QStyle.State_Sunken 
     165                opt.state |= QtWidgets.QStyle.State_Sunken 
    164166            else: 
    165167                opt.activeSubControls = self.hover_control 
    166168 
    167             style.drawComplexControl(QtGui.QStyle.CC_Slider, opt, painter, self) 
     169            style.drawComplexControl(QtWidgets.QStyle.CC_Slider, opt, painter, self) 
    168170             
    169171         
     
    181183                 
    182184        if button: 
    183             opt = QtGui.QStyleOptionSlider() 
     185            opt = QtWidgets.QStyleOptionSlider() 
    184186            self.initStyleOption(opt) 
    185187 
     
    206208 
    207209            if self.active_slider == 0: 
    208                 self.pressed_control = QtGui.QStyle.SC_SliderHandle 
     210                self.pressed_control = QtWidgets.QStyle.SC_SliderHandle 
    209211                self.click_offset = self.__pixelPosToRangeValue(self.__pick(event.pos())) 
    210212                self.triggerAction(self.SliderMove) 
     
    215217 
    216218    def mouseReleaseEvent(self, event): 
    217         if self.pressed_control != QtGui.QStyle.SC_SliderHandle: 
     219        if self.pressed_control != QtWidgets.QStyle.SC_SliderHandle: 
    218220            event.ignore() 
    219221            return 
    220222 
    221223        self.setSliderDown(False) 
    222         return QtGui.QSlider.mouseReleaseEvent(self, event) 
     224        return QtWidgets.QSlider.mouseReleaseEvent(self, event) 
    223225                                 
    224226    def mouseMoveEvent(self, event): 
    225         if self.pressed_control != QtGui.QStyle.SC_SliderHandle: 
     227        if self.pressed_control != QtWidgets.QStyle.SC_SliderHandle: 
    226228            event.ignore() 
    227229            return 
     
    229231        event.accept() 
    230232        new_pos = self.__pixelPosToRangeValue(self.__pick(event.pos())) 
    231         opt = QtGui.QStyleOptionSlider() 
     233        opt = QtWidgets.QStyleOptionSlider() 
    232234        self.initStyleOption(opt) 
    233235 
     
    274276            
    275277    def __pixelPosToRangeValue(self, pos): 
    276         opt = QtGui.QStyleOptionSlider() 
     278        opt = QtWidgets.QStyleOptionSlider() 
    277279        self.initStyleOption(opt) 
    278280        style = QtGui.QApplication.style() 
  • src/sas/qtgui/Utilities/GuiUtils.py

    rcee5c78 r4992ff2  
    1414import logging 
    1515 
    16 from PyQt4 import QtCore 
    17 from PyQt4 import QtGui 
     16from PyQt5 import QtCore 
     17from PyQt5 import QtGui 
     18from PyQt5 import QtWidgets 
    1819 
    1920from periodictable import formula as Formula 
     
    309310    object_item = QtGui.QStandardItem() 
    310311    object_item.setText(name) 
    311     #object_item.setData(QtCore.QVariant(update_data)) 
    312312    object_item.setData(update_data) 
    313313 
     
    586586    } 
    587587    # Query user for filename. 
    588     filename = QtGui.QFileDialog.getSaveFileName(**kwargs) 
     588    filename = QtWidgets.QFileDialog.getSaveFileName(**kwargs) 
    589589 
    590590    # User cancelled. 
     
    618618    } 
    619619    # Query user for filename. 
    620     filename = QtGui.QFileDialog.getSaveFileName(**kwargs) 
     620    filename = QtWidgets.QFileDialog.getSaveFileName(**kwargs) 
    621621 
    622622    # User cancelled. 
  • src/sas/qtgui/Utilities/IPythonWidget.py

    rfef38e8 r4992ff2  
    1 from PyQt4 import QtCore, QtGui, QtSvg 
     1from PyQt5 import QtCore 
     2from PyQt5 import QtGui 
     3from PyQt5 import QtWidgets 
     4 
     5##from PyQt4 import QtSvg 
    26 
    37def new_load_qt(api_options): 
  • src/sas/qtgui/Utilities/SasviewLogger.py

    • Property mode changed from 100755 to 100644
    rb3e8629 r4992ff2  
    33import logging 
    44 
    5 from PyQt4 import QtCore 
     5from PyQt5.QtCore import * 
    66 
    77 
    8 class XStream(QtCore.QObject): 
     8class XStream(QObject): 
    99    _stdout = None 
    1010    _stderr = None 
    11     messageWritten = QtCore.pyqtSignal(str) 
     11    messageWritten = pyqtSignal(str) 
    1212 
    1313    def flush(self): 
  • src/sas/qtgui/convertUI.py

    rb3e8629 r4992ff2  
    44def pyrrc(in_file, out_file): 
    55    """ Run the pyrcc4 script""" 
    6     execute = 'pyrcc4 -py3 %s -o %s' % (in_file, out_file) 
     6    execute = 'pyrcc5 %s -o %s' % (in_file, out_file) 
    77    os.system(execute) 
    88 
    99def pyuic(in_file, out_file): 
    1010    """ Run the pyuic5 script""" 
    11     execute = 'pyuic4 -o %s %s' % (out_file, in_file) 
     11    execute = 'pyuic5 -o %s %s' % (out_file, in_file) 
    1212    os.system(execute) 
    1313 
  • src/sas/sasgui/plottools/config.py

    r092a3d9 r4992ff2  
    3232#plot_version = "0.98" 
    3333#plot_backend = "WXAgg" 
    34 plot_backend = "Qt4Agg" 
     34print("SET MPL BACKEND TO Qt5") 
     35plot_backend = "Qt5Agg" 
    3536 
    3637# Sort out matplotlib version 
Note: See TracChangeset for help on using the changeset viewer.