Changeset 0849aec in sasview
- Timestamp:
- Oct 30, 2017 7:50:09 AM (7 years ago)
- 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:
- 304d082
- Parents:
- 99ea1b0
- Files:
-
- 49 edited
Legend:
- Unmodified
- Added
- Removed
-
run.py
rf4a1433 r0849aec 118 118 # Import the sasview package from root/sasview as sas.sasview. It would 119 119 # 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')) 123 122 124 123 # Compiled modules need to be pulled from the build directory. … … 138 137 import sas.sascalc.calculator 139 138 sas.sascalc.calculator.core = import_package('sas.sascalc.calculator.core', 140 139 joinpath(build_path, 'sas', 'sascalc', 'calculator', 'core')) 141 140 142 141 sys.path.append(build_path) -
src/sas/qtgui/Calculators/DataOperationUtilityPanel.py
r99ea1b0 r0849aec 4 4 import copy 5 5 6 from PyQt4 import QtGui 7 from PyQt4 import QtCore 6 from PyQt5 import QtCore 7 from PyQt5 import QtGui 8 from PyQt5 import QtWidgets 8 9 9 10 from sas.qtgui.Plotting.PlotterData import Data1D … … 19 20 20 21 21 class DataOperationUtilityPanel(Qt Gui.QDialog, Ui_DataOperationUtility):22 class DataOperationUtilityPanel(QtWidgets.QDialog, Ui_DataOperationUtility): 22 23 def __init__(self, parent=None): 23 24 super(DataOperationUtilityPanel, self).__init__() … … 57 58 self.txtNumber.setValidator(QtGui.QDoubleValidator()) 58 59 59 self.layoutOutput = Qt Gui.QHBoxLayout()60 self.layoutData1 = Qt Gui.QHBoxLayout()61 self.layoutData2 = Qt Gui.QHBoxLayout()60 self.layoutOutput = QtWidgets.QHBoxLayout() 61 self.layoutData1 = QtWidgets.QHBoxLayout() 62 self.layoutData2 = QtWidgets.QHBoxLayout() 62 63 63 64 # Create default layout for initial graphs (when they are still empty) … … 383 384 def newPlot(self, graph, layout): 384 385 """ Create template for graphs with default '?' layout""" 385 assert isinstance(graph, Qt Gui.QGraphicsView)386 assert isinstance(layout, Qt Gui.QHBoxLayout)386 assert isinstance(graph, QtWidgets.QGraphicsView) 387 assert isinstance(layout, QtWidgets.QHBoxLayout) 387 388 388 389 # clear layout … … 399 400 """ plot data in graph after clearing its layout """ 400 401 401 assert isinstance(graph, Qt Gui.QGraphicsView)402 assert isinstance(layout, Qt Gui.QHBoxLayout)402 assert isinstance(graph, QtWidgets.QGraphicsView) 403 assert isinstance(layout, QtWidgets.QHBoxLayout) 403 404 404 405 # clear layout … … 455 456 def prepareSubgraphWithData(self, data): 456 457 """ Create graphics view containing scene with string """ 457 scene = Qt Gui.QGraphicsScene()458 scene = QtWidgets.QGraphicsScene() 458 459 scene.addText(str(data)) 459 460 460 subgraph = Qt Gui.QGraphicsView()461 subgraph = QtWidgets.QGraphicsView() 461 462 subgraph.setScene(scene) 462 463 -
src/sas/qtgui/Calculators/DensityPanel.py
- Property mode changed from 100755 to 100644
rb0b09b9 r0849aec 2 2 import logging 3 3 import functools 4 from PyQt4 import QtGui, QtCore 4 from PyQt5 import QtCore 5 from PyQt5 import QtGui 6 from PyQt5 import QtWidgets 5 7 6 8 from periodictable import formula as Formula … … 39 41 40 42 41 class DensityPanel(Qt Gui.QDialog):43 class DensityPanel(QtWidgets.QDialog): 42 44 43 45 def __init__(self, parent=None): … … 68 70 self.ui.editMassDensity.textEdited.connect(functools.partial(self.setMode, MODES.DENSITY_TO_VOLUME)) 69 71 70 self.ui.buttonBox.button(Qt Gui.QDialogButtonBox.Reset).clicked.connect(self.modelReset)71 self.ui.buttonBox.button(Qt Gui.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) 72 74 73 75 def setupModel(self): … … 83 85 84 86 def setupMapper(self): 85 self.mapper = Qt Gui.QDataWidgetMapper(self)87 self.mapper = QtWidgets.QDataWidgetMapper(self) 86 88 self.mapper.setModel(self.model) 87 89 self.mapper.setOrientation(QtCore.Qt.Vertical) … … 92 94 self.mapper.addMapping(self.ui.editMassDensity , MODEL.MASS_DENSITY) 93 95 94 self.mapper.toFirst() 96 # FIXME DOESNT WORK WITH QT5 97 #self.mapper.toFirst() 95 98 96 99 def dataChanged(self, top, bottom): -
src/sas/qtgui/Calculators/GenericScatteringCalculator.py
r99ea1b0 r0849aec 5 5 import time 6 6 7 from PyQt4 import QtGui 8 from PyQt4 import QtCore 7 from PyQt5 import QtCore 8 from PyQt5 import QtGui 9 from PyQt5 import QtWidgets 10 9 11 from twisted.internet import threads 10 12 … … 27 29 28 30 29 class GenericScatteringCalculator(Qt Gui.QDialog, Ui_GenericScatteringCalculator):31 class GenericScatteringCalculator(QtWidgets.QDialog, Ui_GenericScatteringCalculator): 30 32 31 33 trigger_plot_3d = QtCore.pyqtSignal() … … 129 131 """ 130 132 try: 131 self.datafile = Qt Gui.QFileDialog.getOpenFileName(133 self.datafile = QtWidgets.QFileDialog.getOpenFileName( 132 134 self, "Choose a file", "", "All Gen files (*.OMF *.omf) ;;" 133 135 "SLD files (*.SLD *.sld);;PDB files (*.pdb *.PDB);; " … … 607 609 'directory': default_name, 608 610 'filter': 'SLD file (*.sld)', 609 'options': Qt Gui.QFileDialog.DontUseNativeDialog}611 'options': QtWidgets.QFileDialog.DontUseNativeDialog} 610 612 # Query user for filename. 611 filename = str(Qt Gui.QFileDialog.getSaveFileName(**kwargs))613 filename = str(QtWidgets.QFileDialog.getSaveFileName(**kwargs)) 612 614 if filename: 613 615 try: … … 830 832 831 833 832 class Plotter3D(Qt Gui.QDialog, Plotter3DWidget):834 class Plotter3D(QtWidgets.QDialog, Plotter3DWidget): 833 835 def __init__(self, parent=None, graph_title=''): 834 836 self.graph_title = graph_title 835 Qt Gui.QDialog.__init__(self)837 QtWidgets.QDialog.__init__(self) 836 838 Plotter3DWidget.__init__(self, manager=parent) 837 839 self.setWindowTitle(self.graph_title) -
src/sas/qtgui/Calculators/KiessigPanel.py
- Property mode changed from 100755 to 100644
rb0b09b9 r0849aec 1 from PyQt4 import QtGui 2 from PyQt4 import QtCore 1 from PyQt5 import QtCore 2 from PyQt5 import QtGui 3 from PyQt5 import QtWidgets 3 4 4 5 from sas.qtgui.UI import main_resources_rc … … 10 11 11 12 12 class KiessigPanel(Qt Gui.QDialog, Ui_KiessigPanel):13 class KiessigPanel(QtWidgets.QDialog, Ui_KiessigPanel): 13 14 def __init__(self, parent=None): 14 15 super(KiessigPanel, self).__init__() -
src/sas/qtgui/Calculators/ResolutionCalculatorPanel.py
r99ea1b0 r0849aec 4 4 instrumental parameters. 5 5 """ 6 from PyQt4 import QtGui 7 from PyQt4 import QtCore 6 from PyQt5 import QtCore 7 from PyQt5 import QtGui 8 from PyQt5 import QtWidgets 8 9 9 10 from twisted.internet import threads … … 33 34 34 35 35 class ResolutionCalculatorPanel(Qt Gui.QDialog, Ui_ResolutionCalculatorPanel):36 class ResolutionCalculatorPanel(QtWidgets.QDialog, Ui_ResolutionCalculatorPanel): 36 37 """ 37 38 compute resolution in 2D … … 315 316 """ On Spectrum Combobox event""" 316 317 if self.cbCustomSpectrum.currentText() == 'Add New': 317 datafile = Qt Gui.QFileDialog.getOpenFileName(318 datafile = QtWidgets.QFileDialog.getOpenFileName( 318 319 self, "Choose a spectral distribution file", "", 319 320 "All files (*.*)", 320 Qt Gui.QFileDialog.DontUseNativeDialog)321 QtWidgets.QFileDialog.DontUseNativeDialog) 321 322 322 323 if datafile is None or str(datafile) == '': … … 721 722 self.plotter.scale = 'linear' 722 723 self.plotter.cmap = None 723 layout = Qt Gui.QHBoxLayout()724 layout = QtWidgets.QHBoxLayout() 724 725 layout.setContentsMargins(0, 0, 0, 0) 725 726 self.graphicsView.setLayout(layout) -
src/sas/qtgui/Calculators/SldPanel.py
r99ea1b0 r0849aec 1 1 # global 2 2 import logging 3 from PyQt4 import QtGui, QtCore 3 from PyQt5 import QtCore 4 from PyQt5 import QtGui 5 from PyQt5 import QtWidgets 4 6 5 7 from periodictable import formula as Formula … … 97 99 98 100 99 class SldPanel(Qt Gui.QDialog):101 class SldPanel(QtWidgets.QDialog): 100 102 101 103 def __init__(self, parent=None): … … 133 135 134 136 # signals 135 self.ui.buttonBox.button(Qt Gui.QDialogButtonBox.Reset).clicked.connect(self.modelReset)136 self.ui.buttonBox.button(Qt Gui.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) 137 139 138 140 def setupModel(self): … … 145 147 self.model.setItem(key, QtGui.QStandardItem()) 146 148 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) 151 154 152 155 self.modelReset() 153 156 154 157 def setupMapper(self): 155 self.mapper = Qt Gui.QDataWidgetMapper(self)158 self.mapper = QtWidgets.QDataWidgetMapper(self) 156 159 self.mapper.setModel(self.model) 157 160 self.mapper.setOrientation(QtCore.Qt.Vertical) 158 159 161 self.mapper.addMapping(self.ui.editMolecularFormula, MODEL.MOLECULAR_FORMULA) 160 162 self.mapper.addMapping(self.ui.editMassDensity , MODEL.MASS_DENSITY) … … 164 166 self.mapper.addMapping(edit, key) 165 167 166 self.mapper.toFirst() 168 # FIXME DOESNT WORK WITH QT5 169 #self.mapper.toFirst() 167 170 168 171 def dataChanged(self, top, bottom): -
src/sas/qtgui/Calculators/SlitSizeCalculator.py
r99ea1b0 r0849aec 5 5 import sys 6 6 7 from PyQt4 import QtGui 8 from PyQt4 import QtCore 7 from PyQt5 import QtCore 8 from PyQt5 import QtGui 9 from PyQt5 import QtWidgets 9 10 10 11 from sas.qtgui.UI import main_resources_rc … … 16 17 17 18 18 class SlitSizeCalculator(Qt Gui.QDialog, Ui_SlitSizeCalculator):19 class SlitSizeCalculator(QtWidgets.QDialog, Ui_SlitSizeCalculator): 19 20 """ 20 21 Provides the slit length calculator GUI. … … 75 76 # Location is automatically saved - no need to keep track of the last dir 76 77 # But only with Qt built-in dialog (non-platform native) 77 path = Qt Gui.QFileDialog.getOpenFileName(self, "Choose a file", "",78 path = QtWidgets.QFileDialog.getOpenFileName(self, "Choose a file", "", 78 79 "SAXSess 1D data (*.txt *.TXT *.dat *.DAT)", 79 QtGui.QFileDialog.DontUseNativeDialog) 80 None, 81 QtWidgets.QFileDialog.DontUseNativeDialog) 80 82 81 83 if path is None: -
src/sas/qtgui/GUITests.py
rf4a1433 r0849aec 1 1 import unittest 2 2 import sys 3 from PyQt4 import QtGui 3 from PyQt5 import QtGui 4 from PyQt5 import QtWidgets 4 5 5 6 # Prepare the general QApplication instance 6 app = Qt Gui.QApplication(sys.argv)7 app = QtWidgets.QApplication(sys.argv) 7 8 8 9 # Main Window -
src/sas/qtgui/MainWindow/AboutBox.py
- Property mode changed from 100755 to 100644
rb0b09b9 r0849aec 1 1 import functools 2 from PyQt 4 import QtGui2 from PyQt5 import QtWidgets 3 3 4 4 import sas.sasview … … 10 10 from .UI.AboutUI import Ui_AboutUI 11 11 12 class AboutBox(Qt Gui.QDialog, Ui_AboutUI):12 class AboutBox(QtWidgets.QDialog, Ui_AboutUI): 13 13 def __init__(self, parent=None): 14 14 super(AboutBox, self).__init__(parent) -
src/sas/qtgui/MainWindow/DataExplorer.py
r99ea1b0 r0849aec 5 5 import logging 6 6 7 from PyQt 4import QtCore8 from PyQt 4import QtGui9 from PyQt 4 import QtWebKit10 from PyQt 4.Qt import QMutex7 from PyQt5 import QtCore 8 from PyQt5 import QtGui 9 from PyQt5 import QtWidgets 10 from PyQt5 import QtWebKitWidgets 11 11 12 12 from twisted.internet import threads … … 48 48 self.loader = Loader() 49 49 self.manager = manager if manager is not None else DataManager() 50 self.txt_widget = Qt Gui.QTextEdit(None)50 self.txt_widget = QtWidgets.QTextEdit(None) 51 51 52 52 # Be careful with twisted threads. 53 self.mutex = Q Mutex()53 self.mutex = QtCore.QMutex() 54 54 55 55 # Active plots … … 69 69 70 70 # Display HTML content 71 self._helpView = QtWebKit .QWebView()71 self._helpView = QtWebKitWidgets.QWebView() 72 72 73 73 # Fill in the perspectives combo … … 98 98 99 99 # Proxy model for showing a subset of Data1D/Data2D content 100 self.data_proxy = Qt Gui.QSortFilterProxyModel(self)100 self.data_proxy = QtCore.QSortFilterProxyModel(self) 101 101 self.data_proxy.setSourceModel(self.model) 102 102 … … 108 108 109 109 # Proxy model for showing a subset of Theory content 110 self.theory_proxy = Qt Gui.QSortFilterProxyModel(self)110 self.theory_proxy = QtCore.QSortFilterProxyModel(self) 111 111 self.theory_proxy.setSourceModel(self.theory_model) 112 112 … … 182 182 Opens the Qt "Open File..." dialog 183 183 """ 184 print("A") 184 185 path_str = self.chooseFiles() 185 186 if not path_str: … … 192 193 Opens the Qt "Open Folder..." dialog 193 194 """ 194 folder = Qt Gui.QFileDialog.getExistingDirectory(self, "Choose a directory", "",195 Qt Gui.QFileDialog.ShowDirsOnly | QtGui.QFileDialog.DontUseNativeDialog)195 folder = QtWidgets.QFileDialog.getExistingDirectory(self, "Choose a directory", "", None, 196 QtWidgets.QFileDialog.ShowDirsOnly | QtWidgets.QFileDialog.DontUseNativeDialog) 196 197 if folder is None: 197 198 return … … 216 217 'caption' : 'Open Project', 217 218 'filter' : 'Project (*.json);;All files (*.*)', 218 'options' : Qt Gui.QFileDialog.DontUseNativeDialog219 'options' : QtWidgets.QFileDialog.DontUseNativeDialog 219 220 } 220 filename = str(Qt Gui.QFileDialog.getOpenFileName(**kwargs))221 filename = str(QtWidgets.QFileDialog.getOpenFileName(**kwargs)) 221 222 if filename: 222 223 load_thread = threads.deferToThread(self.readProject, filename) 223 224 load_thread.addCallback(self.readProjectComplete) 224 225 load_thread.addErrback(self.readProjectFailed) 226 227 def loadFailed(self, reason): 228 """ 229 """ 230 print("file load FAILED: ", reason) 231 pass 225 232 226 233 def readProjectFailed(self, reason): … … 248 255 249 256 self.manager.assign(manager) 257 self.model.beginResetModel() 250 258 for id, item in self.manager.get_all_data().items(): 251 259 self.updateModel(item.data, item.path) 252 260 253 self.model. reset()261 self.model.endResetModel() 254 262 255 263 def saveProject(self): … … 261 269 'caption' : 'Save Project', 262 270 'filter' : 'Project (*.json)', 263 'options' : Qt Gui.QFileDialog.DontUseNativeDialog271 'options' : QtWidgets.QFileDialog.DontUseNativeDialog 264 272 } 265 filename = str(Qt Gui.QFileDialog.getSaveFileName(**kwargs))273 filename = str(QtWidgets.QFileDialog.getSaveFileName(**kwargs)) 266 274 if filename: 267 275 self.communicator.statusBarUpdateSignal.emit("Saving Project... %s\n" % os.path.basename(filename)) … … 617 625 # Location is automatically saved - no need to keep track of the last dir 618 626 # But only with Qt built-in dialog (non-platform native) 619 paths = Qt Gui.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) 621 629 if paths is None: 622 630 return … … 835 843 """ 836 844 # Create a custom menu based on actions defined in the UI file 837 self.context_menu = Qt Gui.QMenu(self)845 self.context_menu = QtWidgets.QMenu(self) 838 846 self.context_menu.addAction(self.actionDataInfo) 839 847 self.context_menu.addAction(self.actionSaveAs) … … 1071 1079 # If so, delete them 1072 1080 # TODO: fix this to resemble GuiUtils.updateModelItemWithPlot 1073 # 1081 # 1082 self.model.beginResetModel() 1074 1083 current_tab_name = model_item.text()[:2] 1075 1084 for current_index in range(self.theory_model.rowCount()): … … 1079 1088 1080 1089 # Reset the view 1081 self.model. reset()1090 self.model.endResetModel() 1082 1091 1083 1092 # Reset the view -
src/sas/qtgui/MainWindow/DroppableDataLoadWidget.py
rcd2cc745 r0849aec 1 1 # global 2 from PyQt4 import QtGui, QtCore 2 from PyQt5 import QtCore 3 from PyQt5 import QtGui 4 from PyQt5 import QtWidgets 3 5 4 6 # UI … … 6 8 from sas.qtgui.MainWindow.UI.DataExplorerUI import Ui_DataLoadWidget 7 9 8 class DroppableDataLoadWidget(Qt Gui.QTabWidget, Ui_DataLoadWidget):10 class DroppableDataLoadWidget(QtWidgets.QTabWidget, Ui_DataLoadWidget): 9 11 """ 10 12 Overwrite drag and drop methods in the base class -
src/sas/qtgui/MainWindow/GuiManager.py
r895e7359 r0849aec 6 6 import webbrowser 7 7 8 from PyQt4 import QtCore 9 from PyQt4 import QtGui 10 from PyQt4 import QtWebKit 8 from PyQt5.QtWidgets import * 9 from PyQt5.QtGui import * 10 from PyQt5.QtCore import Qt 11 from PyQt5.QtWebKitWidgets import QWebView 11 12 12 13 from twisted.internet import reactor … … 38 39 from sas.qtgui.MainWindow.DataExplorer import DataExplorerWindow 39 40 40 class Acknowledgements(Q tGui.QDialog, Ui_Acknowledgements):41 class Acknowledgements(QDialog, Ui_Acknowledgements): 41 42 def __init__(self, parent=None): 42 Q tGui.QDialog.__init__(self, parent)43 QDialog.__init__(self, parent) 43 44 self.setupUi(self) 44 45 … … 77 78 # Invoke the initial perspective 78 79 self.perspectiveChanged("Fitting") 79 80 80 self.addWidgets() 81 81 … … 94 94 # Show the Welcome panel 95 95 self.welcomePanel = WelcomePanel() 96 self._workspace.workspace.add Window(self.welcomePanel)96 self._workspace.workspace.addSubWindow(self.welcomePanel) 97 97 98 98 # Current help file 99 self._helpView = Q tWebKit.QWebView()99 self._helpView = QWebView() 100 100 # Needs URL like path, so no path.join() here 101 101 self._helpLocation = GuiUtils.HELP_DIRECTORY_LOCATION + "/index.html" … … 116 116 ObjectLibrary.addObject('DataExplorer', self.filesWidget) 117 117 118 self.dockedFilesWidget = QtGui.QDockWidget("Data Explorer", self._workspace) 118 self.dockedFilesWidget = QDockWidget("Data Explorer", self._workspace) 119 self.dockedFilesWidget.setFloating(True) 119 120 self.dockedFilesWidget.setWidget(self.filesWidget) 120 121 121 122 # 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) 125 127 126 128 # Add the console window as another docked widget 127 self.logDockWidget = Q tGui.QDockWidget("Log Explorer", self._workspace)129 self.logDockWidget = QDockWidget("Log Explorer", self._workspace) 128 130 self.logDockWidget.setObjectName("LogDockWidget") 129 self.listWidget = QtGui.QTextBrowser() 131 132 self.listWidget = QTextBrowser() 130 133 self.logDockWidget.setWidget(self.listWidget) 131 self._workspace.addDockWidget(QtCore.Qt.BottomDockWidgetArea, 132 self.logDockWidget) 134 self._workspace.workspace.addDockWidget(Qt.BottomDockWidgetAre, self.logDockWidget) 133 135 134 136 # Add other, minor widgets … … 152 154 Progress bar invisible until explicitly shown 153 155 """ 154 self.progress = Q tGui.QProgressBar()156 self.progress = QProgressBar() 155 157 self._workspace.statusbar.setSizeGripEnabled(False) 156 158 157 self.statusLabel = Q tGui.QLabel()159 self.statusLabel = QLabel() 158 160 self.statusLabel.setText("Welcome to SasView") 159 161 self._workspace.statusbar.addPermanentWidget(self.statusLabel, 1) … … 187 189 self._current_perspective = Perspectives.PERSPECTIVES[str(perspective_name)](parent=self) 188 190 189 self._workspace.workspace.addWindow(self._current_perspective) 191 self._workspace.workspace.addSubWindow(self._current_perspective) 192 190 193 # Resize to the workspace height 191 194 workspace_height = self._workspace.workspace.sizeHint().height() … … 257 260 # Display confirmation messagebox 258 261 quit_msg = "Are you sure you want to exit the application?" 259 reply = Q tGui.QMessageBox.question(262 reply = QMessageBox.question( 260 263 self._parent, 261 264 'Information', 262 265 quit_msg, 263 Q tGui.QMessageBox.Yes,264 Q tGui.QMessageBox.No)266 QMessageBox.Yes, 267 QMessageBox.No) 265 268 266 269 # Exit if yes 267 if reply == Q tGui.QMessageBox.Yes:270 if reply == QMessageBox.Yes: 268 271 reactor.callFromThread(reactor.stop) 269 272 return True … … 578 581 579 582 # Add the console window as another docked widget 580 self.ipDockWidget = Q tGui.QDockWidget("IPython", self._workspace)583 self.ipDockWidget = QDockWidget("IPython", self._workspace) 581 584 self.ipDockWidget.setObjectName("IPythonDockWidget") 582 585 self.ipDockWidget.setWidget(terminal) 583 self._workspace.addDockWidget(QtCore.Qt.RightDockWidgetArea, 584 self.ipDockWidget) 586 self._workspace.workspace.addSubWindow(self.ipDockWidget, Qt.RightDockWidgetArea) 585 587 586 588 def actionImage_Viewer(self): … … 695 697 TODO: use QNetworkAccessManager to assure _helpLocation is valid 696 698 """ 697 self._helpView.load(Q tCore.QUrl(self._helpLocation))699 self._helpView.load(QUrl(self._helpLocation)) 698 700 self._helpView.show() 699 701 … … 740 742 :param new_datalist_item: 741 743 """ 742 if not isinstance(new_item, Q tGui.QStandardItem) or \744 if not isinstance(new_item, QStandardItem) or \ 743 745 not isinstance(new_datalist_item, dict): 744 746 msg = "Wrong data type returned from calculations." -
src/sas/qtgui/MainWindow/MainWindow.py
- Property mode changed from 100755 to 100644
rb0b09b9 r0849aec 1 1 # UNLESS EXEPTIONALLY REQUIRED TRY TO AVOID IMPORTING ANY MODULES HERE 2 2 # ESPECIALLY ANYTHING IN SAS, SASMODELS NAMESPACE 3 from PyQt4 import QtGui 3 #from PyQt4 import QtGui 4 from PyQt5.QtWidgets import * 5 from PyQt5.QtGui import * 4 6 5 7 # Local UI … … 10 12 import sas.qtgui.Utilities.SasviewLogger 11 13 12 class MainSasViewWindow(Q tGui.QMainWindow, Ui_MainWindow):14 class MainSasViewWindow(QMainWindow, Ui_MainWindow): 13 15 # Main window of the application 14 16 def __init__(self, parent=None): … … 17 19 18 20 # define workspace for dialogs. 19 self.workspace = Q tGui.QWorkspace(self)21 self.workspace = QMdiArea(self) 20 22 self.setCentralWidget(self.workspace) 21 23 22 24 # Create the gui manager 23 25 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) 25 30 26 31 def closeEvent(self, event): … … 37 42 """ 38 43 # TODO: standardize path to images 39 pixmap = Q tGui.QPixmap("src/sas/qtgui/images/SVwelcome_mini.png")40 splashScreen = Q tGui.QSplashScreen(pixmap)44 pixmap = QPixmap("src/sas/qtgui/images/SVwelcome_mini.png") 45 splashScreen = QSplashScreen(pixmap) 41 46 return splashScreen 42 47 43 48 def run(): 44 app = Q tGui.QApplication([])49 app = QApplication([]) 45 50 46 51 # Main must have reference to the splash screen, so making it explicit … … 55 60 # DO NOT move the following import to the top! 56 61 # (unless you know what you're doing) 57 import qt 4reactor62 import qt5reactor 58 63 # Using the Qt4 reactor wrapper from https://github.com/ghtdak/qtreactor 59 qt 4reactor.install()64 qt5reactor.install() 60 65 61 66 # DO NOT move the following import to the top! -
src/sas/qtgui/MainWindow/WelcomePanel.py
rcd2cc745 r0849aec 2 2 import sys 3 3 import os 4 from PyQt4 import QtCore 5 from PyQt4 import QtGui 6 from PyQt4 import QtWebKit 4 5 from PyQt5 import QtWidgets 7 6 8 7 import sas.sasview … … 13 12 from sas.qtgui.MainWindow.UI.WelcomePanelUI import Ui_WelcomePanelUI 14 13 15 class WelcomePanel(Qt Gui.QDialog, Ui_WelcomePanelUI):14 class WelcomePanel(QtWidgets.QDialog, Ui_WelcomePanelUI): 16 15 def __init__(self, parent=None): 17 16 super(WelcomePanel, self).__init__(parent) -
src/sas/qtgui/Perspectives/Fitting/FittingOptions.py
- Property mode changed from 100755 to 100644
rb0b09b9 r0849aec 4 4 import types 5 5 6 from PyQt4 import QtCore 7 from PyQt4 import QtGui 8 from PyQt4 import QtWebKit 6 from PyQt5 import QtCore 7 from PyQt5 import QtGui 8 from PyQt5 import QtWidgets 9 from PyQt5 import QtWebKitWidgets 9 10 10 11 from sas.qtgui.UI import images_rc … … 21 22 22 23 23 class FittingOptions(Qt Gui.QDialog, Ui_FittingOptions):24 class FittingOptions(QtWidgets.QDialog, Ui_FittingOptions): 24 25 """ 25 26 Hard-coded version of the fit options dialog available from BUMPS. … … 52 53 53 54 # Handle the Apply button click 54 self.buttonBox.button(Qt Gui.QDialogButtonBox.Ok).clicked.connect(self.onApply)55 self.buttonBox.button(QtWidgets.QDialogButtonBox.Ok).clicked.connect(self.onApply) 55 56 # handle the Help button click 56 self.buttonBox.button(Qt Gui.QDialogButtonBox.Help).clicked.connect(self.onHelp)57 self.buttonBox.button(QtWidgets.QDialogButtonBox.Help).clicked.connect(self.onHelp) 57 58 58 59 # Handle the combo box changes … … 71 72 72 73 # OK has to be initialized to True, after initial validator setup 73 self.buttonBox.button(Qt Gui.QDialogButtonBox.Ok).setEnabled(True)74 self.buttonBox.button(QtWidgets.QDialogButtonBox.Ok).setEnabled(True) 74 75 75 76 # Display HTML content 76 self.helpView = QtWebKit .QWebView()77 self.helpView = QtWebKitWidgets.QWebView() 77 78 78 79 def assignValidators(self): … … 104 105 if state == QtGui.QValidator.Acceptable: 105 106 color = '' # default 106 self.buttonBox.button(Qt Gui.QDialogButtonBox.Ok).setEnabled(True)107 self.buttonBox.button(QtWidgets.QDialogButtonBox.Ok).setEnabled(True) 107 108 else: 108 109 color = '#fff79a' # yellow 109 self.buttonBox.button(Qt Gui.QDialogButtonBox.Ok).setEnabled(False)110 self.buttonBox.button(QtWidgets.QDialogButtonBox.Ok).setEnabled(False) 110 111 111 112 sender.setStyleSheet('QLineEdit { background-color: %s }' % color) … … 134 135 135 136 # OK has to be reinitialized to True 136 self.buttonBox.button(Qt Gui.QDialogButtonBox.Ok).setEnabled(True)137 self.buttonBox.button(QtWidgets.QDialogButtonBox.Ok).setEnabled(True) 137 138 138 139 def onApply(self): … … 148 149 """ 149 150 widget = self.widgetFromOption(option) 150 new_value = widget.currentText() if isinstance(widget, Qt Gui.QComboBox) \151 new_value = widget.currentText() if isinstance(widget, QtWidgets.QComboBox) \ 151 152 else float(widget.text()) 152 153 self.config.values[self.current_fitter_id][option] = new_value -
src/sas/qtgui/Perspectives/Fitting/FittingPerspective.py
- Property mode changed from 100755 to 100644
rb0b09b9 r0849aec 1 1 import numpy 2 2 3 from PyQt4 import QtCore 4 from PyQt4 import QtGui 3 from PyQt5 import QtCore 4 from PyQt5 import QtGui 5 from PyQt5 import QtWidgets 5 6 6 7 from bumps import options … … 13 14 #from sas.qtgui.Perspectives.Fitting import ModelUtilities 14 15 15 class FittingWindow(Qt Gui.QTabWidget):16 class FittingWindow(QtWidgets.QTabWidget): 16 17 """ 17 18 """ 18 19 name = "Fitting" # For displaying in the combo box in DataExplorer 19 20 def __init__(self, parent=None, data=None): 21 20 22 super(FittingWindow, self).__init__() 21 23 -
src/sas/qtgui/Perspectives/Fitting/FittingUtilities.py
r895e7359 r0849aec 1 1 from copy import deepcopy 2 2 3 from PyQt4 import QtGui 4 from PyQt4 import QtCore 3 from PyQt5 import QtCore 4 from PyQt5 import QtGui 5 from PyQt5 import QtWidgets 5 6 6 7 import numpy -
src/sas/qtgui/Perspectives/Fitting/FittingWidget.py
r99ea1b0 r0849aec 9 9 import numpy as np 10 10 11 from PyQt4 import QtGui 12 from PyQt4 import QtCore 13 from PyQt4 import QtWebKit 11 from PyQt5 import QtCore 12 from PyQt5 import QtGui 13 from PyQt5 import QtWidgets 14 from PyQt5 import QtWebKitWidgets 14 15 15 16 from sasmodels import generate … … 73 74 return QtGui.QStandardItemModel.headerData(self, section, orientation, role) 74 75 75 class FittingWidget(Qt Gui.QWidget, Ui_FittingWidgetUI):76 class FittingWidget(QtWidgets.QWidget, Ui_FittingWidgetUI): 76 77 """ 77 78 Main widget for selecting form and structure factor models … … 120 121 121 122 # Display HTML content 122 self.helpView = QtWebKit .QWebView()123 self.helpView = QtWebKitWidgets.QWebView() 123 124 124 125 # New font to display angstrom symbol … … 228 229 """ 229 230 # Options widget 230 layout = Qt Gui.QGridLayout()231 layout = QtWidgets.QGridLayout() 231 232 self.options_widget = OptionsWidget(self, self.logic) 232 233 layout.addWidget(self.options_widget) … … 234 235 235 236 # Smearing widget 236 layout = Qt Gui.QGridLayout()237 layout = QtWidgets.QGridLayout() 237 238 self.smearing_widget = SmearingWidget(self) 238 239 layout.addWidget(self.smearing_widget) … … 249 250 250 251 # Magnetic angles explained in one picture 251 self.magneticAnglesWidget = Qt Gui.QWidget()252 labl = Qt Gui.QLabel(self.magneticAnglesWidget)252 self.magneticAnglesWidget = QtWidgets.QWidget() 253 labl = QtWidgets.QLabel(self.magneticAnglesWidget) 253 254 pixmap = QtGui.QPixmap(GuiUtils.IMAGES_DIRECTORY_LOCATION + '/M_angles_pic.bmp') 254 255 labl.setPixmap(pixmap) … … 269 270 self.lstParams.setModel(self._model_model) 270 271 self.readCategoryInfo() 272 271 273 self.model_parameters = None 272 274 … … 302 304 self.lstParams.customContextMenuRequested.connect(self.showModelDescription) 303 305 self.lstParams.setAttribute(QtCore.Qt.WA_MacShowFocusRect, False) 304 305 306 # Poly model displayed in poly list 306 307 self.lstPoly.setModel(self._poly_model) … … 460 461 msg += "You must select a model to get information on this" 461 462 462 menu = Qt Gui.QMenu()463 label = Qt Gui.QLabel(msg)463 menu = QtWidgets.QMenu() 464 label = QtWidgets.QLabel(msg) 464 465 action = QtGui.QWidgetAction(self) 465 466 action.setDefaultWidget(label) … … 909 910 self.lstParams.resizeColumnToContents(4) 910 911 self.lstParams.resizeColumnToContents(5) 911 self.lstParams.setSizePolicy(Qt Gui.QSizePolicy.MinimumExpanding, QtGui.QSizePolicy.Expanding)912 self.lstParams.setSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.Expanding) 912 913 913 914 self.has_error_column = True … … 1224 1225 # Adjust the table cells width 1225 1226 self.lstParams.resizeColumnToContents(0) 1226 self.lstParams.setSizePolicy(Qt Gui.QSizePolicy.MinimumExpanding, QtGui.QSizePolicy.Expanding)1227 self.lstParams.setSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.Expanding) 1227 1228 1228 1229 # Now we claim the model has been loaded … … 1527 1528 table.verticalHeader().setVisible(False) 1528 1529 table.setAlternatingRowColors(True) 1529 table.setSizePolicy(Qt Gui.QSizePolicy.MinimumExpanding, QtGui.QSizePolicy.Expanding)1530 table.setSelectionBehavior(Qt Gui.QAbstractItemView.SelectRows)1530 table.setSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.Expanding) 1531 table.setSelectionBehavior(QtWidgets.QAbstractItemView.SelectRows) 1531 1532 table.resizeColumnsToContents() 1532 1533 1533 1534 # Header 1534 1535 header = table.horizontalHeader() 1535 header.setResizeMode(QtGui.QHeaderView.ResizeToContents) 1536 1537 header.ResizeMode(QtGui.QHeaderView.Interactive) 1536 header.setSectionResizeMode(QtWidgets.QHeaderView.ResizeToContents) 1537 header.ResizeMode(QtWidgets.QHeaderView.Interactive) 1538 1539 # Qt5: the following 2 lines crash - figure out why! 1538 1540 # Resize column 0 and 7 to content 1539 header.setResizeMode(0, QtGui.QHeaderView.ResizeToContents)1540 header.setResizeMode(7, QtGui.QHeaderView.ResizeToContents)1541 #header.setSectionResizeMode(0, QtWidgets.QHeaderView.ResizeToContents) 1542 #header.setSectionResizeMode(7, QtWidgets.QHeaderView.ResizeToContents) 1541 1543 1542 1544 def setPolyModel(self): … … 1591 1593 1592 1594 # All possible polydisp. functions as strings in combobox 1593 func = Qt Gui.QComboBox()1595 func = QtWidgets.QComboBox() 1594 1596 func.addItems([str(name_disp) for name_disp in POLYDISPERSITY_MODELS.keys()]) 1595 1597 # Set the default index … … 1674 1676 Show the load file dialog and loads requested data into state 1675 1677 """ 1676 datafile = Qt Gui.QFileDialog.getOpenFileName(1677 self, "Choose a weight file", "", "All files (*.*)", 1678 Qt Gui.QFileDialog.DontUseNativeDialog)1678 datafile = QtWidgets.QFileDialog.getOpenFileName( 1679 self, "Choose a weight file", "", "All files (*.*)", None, 1680 QtWidgets.QFileDialog.DontUseNativeDialog) 1679 1681 1680 1682 if datafile is None or str(datafile)=='': … … 1775 1777 item1 = QtGui.QStandardItem(param_name) 1776 1778 1777 func = Qt Gui.QComboBox()1779 func = QtWidgets.QComboBox() 1778 1780 # Available range of shells displayed in the combobox 1779 1781 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
rb0b09b9 r0849aec 3 3 """ 4 4 import numpy as np 5 from PyQt4 import QtGui 6 from PyQt4 import QtCore 5 from PyQt5 import QtCore 6 from PyQt5 import QtGui 7 from PyQt5 import QtWidgets 7 8 8 9 from sas.qtgui.Plotting.PlotterData import Data2D … … 21 22 'LOG_SPACED'] 22 23 23 class DataWidgetMapper(Qt Gui.QDataWidgetMapper):24 class DataWidgetMapper(QtWidgets.QDataWidgetMapper): 24 25 """ 25 26 Custom version of the standard QDataWidgetMapper allowing for proper … … 32 33 super(DataWidgetMapper, self).addMapping(widget, section, propertyName) 33 34 34 if isinstance(widget, Qt Gui.QComboBox):35 if isinstance(widget, QtWidgets.QComboBox): 35 36 delegate = self.itemDelegate() 36 37 widget.currentIndexChanged.connect(lambda: delegate.commitData.emit(widget)) 37 38 38 elif isinstance(widget, Qt Gui.QCheckBox):39 elif isinstance(widget, QtWidgets.QCheckBox): 39 40 delegate = self.itemDelegate() 40 41 widget.stateChanged.connect(lambda: delegate.commitData.emit(widget)) 41 42 42 class OptionsWidget(Qt Gui.QWidget, Ui_tabOptions):43 class OptionsWidget(QtWidgets.QWidget, Ui_tabOptions): 43 44 plot_signal = QtCore.pyqtSignal() 44 45 def __init__(self, parent=None, logic=None): … … 52 53 53 54 # Weight radio box group 54 self.weightingGroup = Qt Gui.QButtonGroup()55 self.weightingGroup = QtWidgets.QButtonGroup() 55 56 self.weighting = 0 56 57 … … 114 115 self.mapper.addMapping(self.txtNpts, MODEL.index('NPTS')) 115 116 self.mapper.addMapping(self.chkLogData, MODEL.index('LOG_SPACED')) 116 self.mapper.toFirst() 117 # FIXME DOESNT WORK WITH QT5 118 #self.mapper.toFirst() 117 119 118 120 def toggleLogData(self, isChecked): -
src/sas/qtgui/Perspectives/Fitting/SmearingWidget.py
- Property mode changed from 100755 to 100644
rb0b09b9 r0849aec 2 2 Widget/logic for smearing data. 3 3 """ 4 from PyQt4 import QtGui 5 from PyQt4 import QtCore 4 from PyQt5 import QtCore 5 from PyQt5 import QtGui 6 from PyQt5 import QtWidgets 6 7 7 8 from sas.qtgui.Plotting.PlotterData import Data1D … … 11 12 from sas.qtgui.Perspectives.Fitting.UI.SmearingWidgetUI import Ui_SmearingWidgetUI 12 13 13 class DataWidgetMapper(Qt Gui.QDataWidgetMapper):14 class DataWidgetMapper(QtWidgets.QDataWidgetMapper): 14 15 """ 15 16 Custom version of the standard QDataWidgetMapper allowing for proper … … 22 23 super(DataWidgetMapper, self).addMapping(widget, section, propertyName) 23 24 24 if isinstance(widget, Qt Gui.QComboBox):25 if isinstance(widget, QtWidgets.QComboBox): 25 26 delegate = self.itemDelegate() 26 27 widget.currentIndexChanged.connect(lambda: delegate.commitData.emit(widget)) … … 35 36 'ACCURACY'] 36 37 37 class SmearingWidget(Qt Gui.QWidget, Ui_SmearingWidgetUI):38 class SmearingWidget(QtWidgets.QWidget, Ui_SmearingWidgetUI): 38 39 def __init__(self, parent=None): 39 40 super(SmearingWidget, self).__init__() … … 83 84 self.mapper.addMapping(self.cbSmearing, MODEL.index('SMEARING')) 84 85 self.mapper.addMapping(self.cbAccuracy, MODEL.index('ACCURACY')) 85 self.mapper.toFirst() 86 87 # FIXME DOESNT WORK WITH QT5 88 #self.mapper.toFirst() 86 89 87 90 def updateSmearing(self, data=None): -
src/sas/qtgui/Perspectives/Fitting/ViewDelegate.py
r7ffa5ee9 r0849aec 1 from PyQt4 import QtGui 2 from PyQt4 import QtCore 1 from PyQt5 import QtCore 2 from PyQt5 import QtGui 3 from PyQt5 import QtWidgets 3 4 4 5 import sas.qtgui.Utilities.GuiUtils as GuiUtils 5 6 6 class ModelViewDelegate(Qt Gui.QStyledItemDelegate):7 class ModelViewDelegate(QtWidgets.QStyledItemDelegate): 7 8 """ 8 9 Custom delegate for appearance and behavior control of the model view … … 12 13 Overwrite generic constructor to allow for some globals 13 14 """ 14 super(Qt Gui.QStyledItemDelegate, self).__init__()15 super(QtWidgets.QStyledItemDelegate, self).__init__() 15 16 16 17 # Main parameter table view columns … … 43 44 if index.column() in self.fancyColumns(): 44 45 # Units - present in nice HTML 45 options = QtGui.QStyleOptionViewItemV4(option) 46 #options = QtWidgets.QStyleOptionViewItemV4(option) 47 options = QtWidgets.QStyleOptionViewItem(option) 46 48 self.initStyleOption(options,index) 47 49 … … 57 59 # delete the original content 58 60 options.text = "" 59 style.drawControl(Qt Gui.QStyle.CE_ItemViewItem, options, painter, options.widget);61 style.drawControl(QtWidgets.QStyle.CE_ItemViewItem, options, painter, options.widget); 60 62 61 63 context = QtGui.QAbstractTextDocumentLayout.PaintContext() 62 textRect = style.subElementRect(Qt Gui.QStyle.SE_ItemViewItemText, options)64 textRect = style.subElementRect(QtWidgets.QStyle.SE_ItemViewItemText, options) 63 65 64 66 painter.save() … … 70 72 else: 71 73 # Just the default paint 72 Qt Gui.QStyledItemDelegate.paint(self, painter, option, index)74 QtWidgets.QStyledItemDelegate.paint(self, painter, option, index) 73 75 74 76 def createEditor(self, widget, option, index): … … 79 81 return 0 80 82 if index.column() == self.param_value: #only in the value column 81 editor = Qt Gui.QLineEdit(widget)83 editor = QtWidgets.QLineEdit(widget) 82 84 validator = QtGui.QDoubleValidator() 83 85 editor.setValidator(validator) … … 100 102 # balloon popup? tooltip? cell background colour flash? 101 103 return 102 Qt Gui.QStyledItemDelegate.setModelData(self, editor, model, index)103 104 105 class PolyViewDelegate(Qt Gui.QStyledItemDelegate):104 QtWidgets.QStyledItemDelegate.setModelData(self, editor, model, index) 105 106 107 class PolyViewDelegate(QtWidgets.QStyledItemDelegate): 106 108 """ 107 109 Custom delegate for appearance and behavior control of the polydispersity view … … 116 118 Overwrite generic constructor to allow for some globals 117 119 """ 118 super(Qt Gui.QStyledItemDelegate, self).__init__()120 super(QtWidgets.QStyledItemDelegate, self).__init__() 119 121 120 122 self.poly_parameter = 0 … … 160 162 return None 161 163 elif index.column() in self.editableParameters(): 162 self.editor = Qt Gui.QLineEdit(widget)164 self.editor = QtWidgets.QLineEdit(widget) 163 165 validator = QtGui.QDoubleValidator() 164 166 self.editor.setValidator(validator) 165 167 return self.editor 166 168 else: 167 Qt Gui.QStyledItemDelegate.createEditor(self, widget, option, index)169 QtWidgets.QStyledItemDelegate.createEditor(self, widget, option, index) 168 170 169 171 def paint(self, painter, option, index): … … 173 175 if index.column() in (self.poly_min, self.poly_max): 174 176 # Units - present in nice HTML 175 options = Qt Gui.QStyleOptionViewItemV4(option)177 options = QtWidgets.QStyleOptionViewItem(option) 176 178 self.initStyleOption(options,index) 177 179 … … 187 189 # delete the original content 188 190 options.text = "" 189 style.drawControl(Qt Gui.QStyle.CE_ItemViewItem, options, painter, options.widget);191 style.drawControl(QtWidgets.QStyle.CE_ItemViewItem, options, painter, options.widget); 190 192 191 193 context = QtGui.QAbstractTextDocumentLayout.PaintContext() 192 textRect = style.subElementRect(Qt Gui.QStyle.SE_ItemViewItemText, options)194 textRect = style.subElementRect(QtWidgets.QStyle.SE_ItemViewItemText, options) 193 195 194 196 painter.save() … … 200 202 else: 201 203 # Just the default paint 202 Qt Gui.QStyledItemDelegate.paint(self, painter, option, index)203 204 class MagnetismViewDelegate(Qt Gui.QStyledItemDelegate):204 QtWidgets.QStyledItemDelegate.paint(self, painter, option, index) 205 206 class MagnetismViewDelegate(QtWidgets.QStyledItemDelegate): 205 207 """ 206 208 Custom delegate for appearance and behavior control of the magnetism view … … 210 212 Overwrite generic constructor to allow for some globals 211 213 """ 212 super(Qt Gui.QStyledItemDelegate, self).__init__()214 super(QtWidgets.QStyledItemDelegate, self).__init__() 213 215 214 216 self.mag_parameter = 0 … … 238 240 return 0 239 241 if index.column() in self.editableParameters(): 240 editor = Qt Gui.QLineEdit(widget)242 editor = QtWidgets.QLineEdit(widget) 241 243 validator = QtGui.QDoubleValidator() 242 244 editor.setValidator(validator) 243 245 return editor 244 246 else: 245 Qt Gui.QStyledItemDelegate.createEditor(self, widget, option, index)247 QtWidgets.QStyledItemDelegate.createEditor(self, widget, option, index) 246 248 247 249 def paint(self, painter, option, index): … … 251 253 if index.column() in (self.mag_min, self.mag_max, self.mag_unit): 252 254 # Units - present in nice HTML 253 options = Qt Gui.QStyleOptionViewItemV4(option)255 options = QtWidgets.QStyleOptionViewItem(option) 254 256 self.initStyleOption(options,index) 255 257 … … 265 267 # delete the original content 266 268 options.text = "" 267 style.drawControl(Qt Gui.QStyle.CE_ItemViewItem, options, painter, options.widget);269 style.drawControl(QtWidgets.QStyle.CE_ItemViewItem, options, painter, options.widget); 268 270 269 271 context = QtGui.QAbstractTextDocumentLayout.PaintContext() 270 textRect = style.subElementRect(Qt Gui.QStyle.SE_ItemViewItemText, options)272 textRect = style.subElementRect(QtWidgets.QStyle.SE_ItemViewItemText, options) 271 273 272 274 painter.save() … … 278 280 else: 279 281 # Just the default paint 280 Qt Gui.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
rb0b09b9 r0849aec 1 1 import sys 2 2 import os 3 from PyQt4 import QtCore 4 from PyQt4 import QtGui 3 from PyQt5 import QtCore 4 from PyQt5 import QtGui 5 from PyQt5 import QtWidgets 5 6 6 7 # local … … 8 9 from .InvariantUtils import WIDGETS 9 10 10 class DetailsDialog(Qt Gui.QDialog, Ui_Dialog):11 class DetailsDialog(QtWidgets.QDialog, Ui_Dialog): 11 12 """ 12 13 """ -
src/sas/qtgui/Perspectives/Invariant/InvariantPerspective.py
r99ea1b0 r0849aec 2 2 import sys 3 3 import os 4 from PyQt4 import QtCore 5 from PyQt4 import QtGui 6 from PyQt4 import QtWebKit 4 from PyQt5 import QtCore 5 from PyQt5 import QtGui 6 from PyQt5 import QtWidgets 7 from PyQt5 import QtWebKitWidgets 7 8 8 9 from twisted.internet import threads … … 35 36 self._model.appendRow(item) 36 37 37 class InvariantWindow(Qt Gui.QDialog, Ui_tabbedInvariantUI):38 class InvariantWindow(QtWidgets.QDialog, Ui_tabbedInvariantUI): 38 39 # The controller which is responsible for managing signal slots connections 39 40 # for the gui and providing an interface to the data model. … … 61 62 self._model_item = QtGui.QStandardItem() 62 63 63 self._helpView = QtWebKit .QWebView()64 self._helpView = QtWebKitWidgets.QWebView() 64 65 self.detailsDialog = DetailsDialog(self) 65 66 … … 502 503 def setupMapper(self): 503 504 # Set up the mapper. 504 self.mapper = Qt Gui.QDataWidgetMapper(self)505 self.mapper = QtWidgets.QDataWidgetMapper(self) 505 506 self.mapper.setOrientation(QtCore.Qt.Vertical) 506 507 self.mapper.setModel(self.model) … … 543 544 self.mapper.addMapping(self.lineEdit_18, WIDGETS.W_INVARIANT_ERR) 544 545 545 self.mapper.toFirst() 546 # FIXME DOESNT WORK WITH QT5 547 #self.mapper.toFirst() 546 548 547 549 def setData(self, data_item, is_batch=False): … … 644 646 """ 645 647 return False 646 647 if __name__ == "__main__":648 app = QtGui.QApplication([])649 import qt4reactor650 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 reactor654 dlg = InvariantWindow(reactor)655 dlg.show()656 reactor.run() -
src/sas/qtgui/Plotting/AddText.py
r83eb5208 r0849aec 1 from PyQt4 import QtGui 1 from PyQt5 import QtCore 2 from PyQt5 import QtGui 3 from PyQt5 import QtWidgets 2 4 3 5 import sas.sasview … … 5 7 from sas.qtgui.Plotting.UI.AddTextUI import Ui_AddText 6 8 7 class AddText(Qt Gui.QDialog, Ui_AddText):9 class AddText(QtWidgets.QDialog, Ui_AddText): 8 10 """ Simple GUI for a single line text query """ 9 11 def __init__(self, parent=None): -
src/sas/qtgui/Plotting/BoxSum.py
rcd2cc745 r0849aec 2 2 Allows users to modify the box slicer parameters. 3 3 """ 4 from PyQt4 import QtGui 5 from PyQt4 import QtCore 4 from PyQt5 import QtCore 5 from PyQt5 import QtGui 6 from PyQt5 import QtWidgets 6 7 7 8 # Local UI … … 9 10 from sas.qtgui.Plotting.UI.BoxSumUI import Ui_BoxSumUI 10 11 11 class BoxSum(Qt Gui.QDialog, Ui_BoxSumUI):12 class BoxSum(QtWidgets.QDialog, Ui_BoxSumUI): 12 13 apply_signal = QtCore.pyqtSignal(tuple, str) 13 14 def __init__(self, parent=None, model=None): -
src/sas/qtgui/Plotting/ColorMap.py
- Property mode changed from 100755 to 100644
rb0b09b9 r0849aec 2 2 Allows users to change the range of the current graph 3 3 """ 4 from PyQt4 import QtGui 5 from PyQt4 import QtCore 4 from PyQt5 import QtCore 5 from PyQt5 import QtGui 6 from PyQt5 import QtWidgets 6 7 import sas.qtgui.path_prepare 7 8 … … 10 11 import numpy 11 12 12 from matplotlib.backends.backend_qt 4agg import FigureCanvasQTAgg as FigureCanvas13 from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg as FigureCanvas 13 14 from sas.qtgui.Plotting.PlotterData import Data2D 14 15 from sas.qtgui.Utilities.GuiUtils import formatNumber … … 21 22 from sas.qtgui.Plotting.UI.ColorMapUI import Ui_ColorMapUI 22 23 23 class ColorMap(Qt Gui.QDialog, Ui_ColorMapUI):24 class ColorMap(QtWidgets.QDialog, Ui_ColorMapUI): 24 25 apply_signal = QtCore.pyqtSignal(tuple, str) 25 26 def __init__(self, parent=None, cmap=None, vmin=0.0, vmax=100.0, data=None): … … 71 72 72 73 # Handle the Reset button click 73 self.buttonBox.button(Qt Gui.QDialogButtonBox.Reset).clicked.connect(self.onReset)74 self.buttonBox.button(QtWidgets.QDialogButtonBox.Reset).clicked.connect(self.onReset) 74 75 75 76 # Handle the Apply button click 76 self.buttonBox.button(Qt Gui.QDialogButtonBox.Apply).clicked.connect(self.onApply)77 self.buttonBox.button(QtWidgets.QDialogButtonBox.Apply).clicked.connect(self.onApply) 77 78 78 79 # Handle the amplitude setup … … 161 162 self.slider.setOrientation(QtCore.Qt.Horizontal) 162 163 163 self.slider_label = Qt Gui.QLabel()164 self.slider_label = QtWidgets.QLabel() 164 165 self.slider_label.setText("Drag the sliders to adjust color range.") 165 166 … … 192 193 self.canvas = FigureCanvas(self.fig) 193 194 194 layout = Qt Gui.QVBoxLayout()195 layout = QtWidgets.QVBoxLayout() 195 196 layout.addWidget(self.slider_label) 196 197 layout.addWidget(self.slider) -
src/sas/qtgui/Plotting/LinearFit.py
- Property mode changed from 100755 to 100644
rb0b09b9 r0849aec 4 4 import re 5 5 import numpy 6 from PyQt4 import QtGui 7 from PyQt4 import QtCore 6 from PyQt5 import QtCore 7 from PyQt5 import QtGui 8 from PyQt5 import QtWidgets 8 9 9 10 from sas.qtgui.Utilities.GuiUtils import formatNumber … … 17 18 from sas.qtgui.Plotting.UI.LinearFitUI import Ui_LinearFitUI 18 19 19 class LinearFit(Qt Gui.QDialog, Ui_LinearFitUI):20 class LinearFit(QtWidgets.QDialog, Ui_LinearFitUI): 20 21 def __init__(self, parent=None, 21 22 data=None, -
src/sas/qtgui/Plotting/MaskEditor.py
rdc5ef15 r0849aec 1 from PyQt4 import QtGui 1 from PyQt5 import QtCore 2 from PyQt5 import QtGui 3 from PyQt5 import QtWidgets 2 4 3 5 from sas.qtgui.Plotting.PlotterData import Data2D … … 8 10 from sas.qtgui.Plotting.Plotter2D import Plotter2DWidget 9 11 10 class MaskEditor(Qt Gui.QDialog, Ui_MaskEditorUI):12 class MaskEditor(QtWidgets.QDialog, Ui_MaskEditorUI): 11 13 def __init__(self, parent=None, data=None): 12 14 super(MaskEditor, self).__init__() … … 23 25 self.plotter.data = self.data 24 26 25 layout = Qt Gui.QHBoxLayout()27 layout = QtWidgets.QHBoxLayout() 26 28 layout.setContentsMargins(0, 0, 0, 0) 27 29 self.frame.setLayout(layout) -
src/sas/qtgui/Plotting/PlotProperties.py
- Property mode changed from 100755 to 100644
rb0b09b9 r0849aec 1 from PyQt4 import QtGui 1 from PyQt5 import QtCore 2 from PyQt5 import QtGui 3 from PyQt5 import QtWidgets 2 4 3 5 from sas.qtgui.Plotting.PlotUtilities import COLORS, SHAPES … … 6 8 from sas.qtgui.Plotting.UI.PlotPropertiesUI import Ui_PlotPropertiesUI 7 9 8 class PlotProperties(Qt Gui.QDialog, Ui_PlotPropertiesUI):10 class PlotProperties(QtWidgets.QDialog, Ui_PlotPropertiesUI): 9 11 """ Dialog for modification of single plot properties """ 10 12 def __init__(self, -
src/sas/qtgui/Plotting/Plotter.py
r895e7359 r0849aec 1 from PyQt4 import QtGui 2 from PyQt4 import QtCore 1 from PyQt5 import QtCore 2 from PyQt5 import QtGui 3 from PyQt5 import QtWidgets 4 3 5 import functools 4 6 import copy … … 19 21 1D Plot widget for use with a QDialog 20 22 """ 23 updatePlot = QtCore.pyqtSignal(tuple) 21 24 def __init__(self, parent=None, manager=None, quickplot=False): 22 25 super(PlotterWidget, self).__init__(parent, manager=manager, quickplot=quickplot) … … 41 44 # Add a slot for receiving update signal from LinearFit 42 45 # NEW style signals 43 #self.updatePlot = QtCore.pyqtSignal(tuple) 44 # self.updatePlot.connect(self.onFitDisplay) 46 self.updatePlot.connect(self.onFitDisplay) 45 47 # OLD style signals 46 QtCore.QObject.connect(self, QtCore.SIGNAL('updatePlot'), self.onFitDisplay)48 # QtCore.QObject.connect(self, QtCore.SIGNAL('updatePlot'), self.onFitDisplay) 47 49 48 50 @property … … 269 271 Show a dialog allowing axes rescaling 270 272 """ 271 if self.properties.exec_() == Qt Gui.QDialog.Accepted:273 if self.properties.exec_() == QtWidgets.QDialog.Accepted: 272 274 self.xLogLabel, self.yLogLabel = self.properties.getValues() 273 275 self.xyTransform(self.xLogLabel, self.yLogLabel) … … 277 279 Show a dialog allowing adding custom text to the chart 278 280 """ 279 if self.addText.exec_() == Qt Gui.QDialog.Accepted:281 if self.addText.exec_() == QtWidgets.QDialog.Accepted: 280 282 # Retrieve the new text, its font and color 281 283 extra_text = self.addText.text() … … 329 331 """ 330 332 # min and max of data 331 if self.setRange.exec_() == Qt Gui.QDialog.Accepted:333 if self.setRange.exec_() == QtWidgets.QDialog.Accepted: 332 334 x_range = self.setRange.xrange() 333 335 y_range = self.setRange.yrange() … … 363 365 xlabel=self.xLogLabel, 364 366 ylabel=self.yLogLabel) 365 if fit_dialog.exec_() == Qt Gui.QDialog.Accepted:367 if fit_dialog.exec_() == QtWidgets.QDialog.Accepted: 366 368 return 367 369 … … 440 442 marker_size=marker_size, 441 443 legend=legend) 442 if plotPropertiesWidget.exec_() == Qt Gui.QDialog.Accepted:444 if plotPropertiesWidget.exec_() == QtWidgets.QDialog.Accepted: 443 445 # Update Data1d 444 446 selected_plot.markersize = plotPropertiesWidget.markersize() … … 697 699 698 700 699 class Plotter(Qt Gui.QDialog, PlotterWidget):701 class Plotter(QtWidgets.QDialog, PlotterWidget): 700 702 def __init__(self, parent=None, quickplot=False): 701 703 702 Qt Gui.QDialog.__init__(self)704 QtWidgets.QDialog.__init__(self) 703 705 PlotterWidget.__init__(self, parent=self, manager=parent, quickplot=quickplot) 704 706 icon = QtGui.QIcon() -
src/sas/qtgui/Plotting/Plotter2D.py
r895e7359 r0849aec 4 4 import functools 5 5 6 from PyQt4 import QtGui 7 from PyQt4 import QtCore 6 from PyQt5 import QtCore 7 from PyQt5 import QtGui 8 from PyQt5 import QtWidgets 8 9 9 10 DEFAULT_CMAP = pylab.cm.jet 11 12 #import sys 13 #print("SYS.PATH = ", sys.path) 14 import matplotlib as mpl 15 mpl.use("Qt5Agg") 16 10 17 from mpl_toolkits.mplot3d import Axes3D 11 18 … … 365 372 color_map_dialog.apply_signal.connect(self.onApplyMap) 366 373 367 if color_map_dialog.exec_() == Qt Gui.QDialog.Accepted:374 if color_map_dialog.exec_() == QtWidgets.QDialog.Accepted: 368 375 self.onApplyMap(color_map_dialog.norm(), color_map_dialog.cmap()) 369 376 … … 503 510 504 511 505 class Plotter2D(Qt Gui.QDialog, Plotter2DWidget):512 class Plotter2D(QtWidgets.QDialog, Plotter2DWidget): 506 513 """ 507 514 Plotter widget implementation 508 515 """ 509 516 def __init__(self, parent=None, quickplot=False, dimension=2): 510 Qt Gui.QDialog.__init__(self)517 QtWidgets.QDialog.__init__(self) 511 518 Plotter2DWidget.__init__(self, manager=parent, quickplot=quickplot, dimension=dimension) 512 519 icon = QtGui.QIcon() -
src/sas/qtgui/Plotting/PlotterBase.py
r7d8bebf r0849aec 2 2 import numpy 3 3 4 from PyQt4 import QtGui 5 from PyQt4 import QtCore 4 from PyQt5 import QtCore 5 from PyQt5 import QtGui 6 from PyQt5 import QtWidgets 6 7 7 8 # TODO: Replace the qt4agg calls below with qt5 equivalent. … … 9 10 # https://www.boxcontrol.net/embedding-matplotlib-plot-on-pyqt5-gui.html 10 11 # 11 from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas 12 from matplotlib.backends.backend_qt4agg import NavigationToolbar2QT as NavigationToolbar 12 # matplotlib.use("Qt5Agg") 13 from matplotlib.backends.backend_qt5agg import FigureCanvasQTAgg as FigureCanvas 14 from matplotlib.backends.backend_qt5agg import NavigationToolbar2QT as NavigationToolbar 13 15 14 16 import matplotlib.pyplot as plt … … 25 27 import sas.qtgui.Plotting.PlotUtilities as PlotUtilities 26 28 27 class PlotterBase(Qt Gui.QWidget):29 class PlotterBase(QtWidgets.QWidget): 28 30 def __init__(self, parent=None, manager=None, quickplot=False): 29 31 super(PlotterBase, self).__init__(parent) … … 43 45 44 46 # Simple window for data display 45 self.txt_widget = Qt Gui.QTextEdit(None)47 self.txt_widget = QtWidgets.QTextEdit(None) 46 48 47 49 # 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) 50 53 layout.addWidget(self.canvas) 51 54 … … 105 108 self.canvas.mpl_connect('scroll_event', self.onMplWheel) 106 109 107 self.contextMenu = Qt Gui.QMenu(self)110 self.contextMenu = QtWidgets.QMenu(self) 108 111 109 112 if not quickplot: … … 296 299 dialog.setModal(True) 297 300 dialog.setWindowTitle("Print") 298 if dialog.exec_() != Qt Gui.QDialog.Accepted:301 if dialog.exec_() != QtWidgets.QDialog.Accepted: 299 302 return 300 303 … … 303 306 pmap = QtGui.QPixmap.grabWidget(self) 304 307 # Create a label with pixmap drawn 305 printLabel = Qt Gui.QLabel()308 printLabel = QtWidgets.QLabel() 306 309 printLabel.setPixmap(pmap) 307 310 … … 333 336 titleWidget = WindowTitle(self, new_title=current_title) 334 337 result = titleWidget.exec_() 335 if result != Qt Gui.QDialog.Accepted:338 if result != QtWidgets.QDialog.Accepted: 336 339 return 337 340 -
src/sas/qtgui/Plotting/ScaleProperties.py
rcd2cc745 r0849aec 1 from PyQt4 import QtGui 1 from PyQt5 import QtCore 2 from PyQt5 import QtGui 3 from PyQt5 import QtWidgets 2 4 3 5 import sas.sasview … … 20 22 view_values[5]: [0, 4], # Kratky 21 23 } 22 class ScaleProperties(Qt Gui.QDialog, Ui_scalePropertiesUI):24 class ScaleProperties(QtWidgets.QDialog, Ui_scalePropertiesUI): 23 25 def __init__(self, parent=None, init_scale_x='x', init_scale_y='y'): 24 26 super(ScaleProperties, self).__init__(parent) -
src/sas/qtgui/Plotting/SetGraphRange.py
rcd2cc745 r0849aec 2 2 Allows users to change the range of the current graph 3 3 """ 4 from PyQt4 import QtGui 4 from PyQt5 import QtCore 5 from PyQt5 import QtGui 6 from PyQt5 import QtWidgets 5 7 6 8 # Local UI … … 8 10 from sas.qtgui.Plotting.UI.SetGraphRangeUI import Ui_setGraphRangeUI 9 11 10 class SetGraphRange(Qt Gui.QDialog, Ui_setGraphRangeUI):12 class SetGraphRange(QtWidgets.QDialog, Ui_setGraphRangeUI): 11 13 def __init__(self, parent=None, x_range=(0.0, 0.0), y_range=(0.0, 0.0)): 12 14 super(SetGraphRange, self).__init__() -
src/sas/qtgui/Plotting/SlicerModel.py
r895e7359 r0849aec 1 from PyQt4 import QtGui 2 from PyQt4 import QtCore 1 from PyQt5 import QtGui 3 2 4 3 import sas.qtgui.Utilities.GuiUtils as GuiUtils -
src/sas/qtgui/Plotting/SlicerParameters.py
rcd2cc745 r0849aec 4 4 import numpy 5 5 import functools 6 from PyQt4 import QtGui 7 from PyQt4 import QtCore 8 from PyQt4 import QtWebKit 6 from PyQt5 import QtCore 7 from PyQt5 import QtGui 8 from PyQt5 import QtWidgets 9 from PyQt5 import QtWebKitWidgets 9 10 10 11 # Local UI … … 12 13 from sas.qtgui.Plotting.UI.SlicerParametersUI import Ui_SlicerParametersUI 13 14 14 class SlicerParameters(Qt Gui.QDialog, Ui_SlicerParametersUI):15 class SlicerParameters(QtWidgets.QDialog, Ui_SlicerParametersUI): 15 16 """ 16 17 Interaction between the QTableView and the underlying model, … … 44 45 45 46 # Display Help on clicking the button 46 self.buttonBox.button(Qt Gui.QDialogButtonBox.Help).clicked.connect(self.onHelp)47 self.buttonBox.button(QtWidgets.QDialogButtonBox.Help).clicked.connect(self.onHelp) 47 48 48 49 # Close doesn't trigger closeEvent automatically, so force it 49 self.buttonBox.button(Qt Gui.QDialogButtonBox.Close).clicked.connect(functools.partial(self.closeEvent, None))50 self.buttonBox.button(QtWidgets.QDialogButtonBox.Close).clicked.connect(functools.partial(self.closeEvent, None)) 50 51 51 52 # Disable row number display 52 53 self.lstParams.verticalHeader().setVisible(False) 53 54 self.lstParams.setAlternatingRowColors(True) 54 self.lstParams.setSizePolicy(Qt Gui.QSizePolicy.MinimumExpanding, QtGui.QSizePolicy.Expanding)55 self.lstParams.setSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.Expanding) 55 56 56 57 # Header properties for nicer display 57 58 header = self.lstParams.horizontalHeader() 58 header.set ResizeMode(QtGui.QHeaderView.Stretch)59 header.setSectionResizeMode(QtWidgets.QHeaderView.Stretch) 59 60 header.setStretchLastSection(True) 60 61 … … 86 87 location = "docs/sphinx-docs/build/html" + \ 87 88 "/user/sasgui/guiframe/graph_help.html#d-data-averaging" 88 self.helpView = QtWebKit .QWebView()89 self.helpView = QtWebKitWidgets.QWebView() 89 90 self.helpView.load(QtCore.QUrl(location)) 90 91 self.helpView.show() 91 92 92 93 93 class ProxyModel(Qt Gui.QIdentityProxyModel):94 class ProxyModel(QtCore.QIdentityProxyModel): 94 95 """ 95 96 Trivial proxy model with custom column edit flag … … 117 118 return flags 118 119 119 class PositiveDoubleEditor(Qt Gui.QLineEdit):120 class PositiveDoubleEditor(QtWidgets.QLineEdit): 120 121 # a signal to tell the delegate when we have finished editing 121 122 editingFinished = QtCore.Signal() … … 136 137 137 138 138 class EditDelegate(Qt Gui.QStyledItemDelegate):139 class EditDelegate(QtWidgets.QStyledItemDelegate): 139 140 refocus_signal = QtCore.pyqtSignal(int, int) 140 141 def __init__(self, parent=None, validate_method=None): … … 155 156 return self.editor 156 157 else: 157 return Qt Gui.QStyledItemDelegate.createEditor(self, parent, option, index)158 return QtWidgets.QStyledItemDelegate.createEditor(self, parent, option, index) 158 159 159 160 def setModelData(self, editor, model, index): -
src/sas/qtgui/Plotting/Slicers/AnnulusSlicer.py
r895e7359 r0849aec 1 1 import numpy 2 from PyQt4 import QtGui3 from PyQt4 import QtCore4 2 5 3 import sas.qtgui.Utilities.GuiUtils as GuiUtils -
src/sas/qtgui/Plotting/Slicers/BoxSlicer.py
r895e7359 r0849aec 1 1 import numpy 2 from PyQt4 import QtGui3 from PyQt4 import QtCore4 2 5 3 from .BaseInteractor import BaseInteractor -
src/sas/qtgui/Plotting/Slicers/BoxSum.py
r895e7359 r0849aec 4 4 """ 5 5 import numpy 6 from PyQt 4import QtGui7 from PyQt4 import QtCore 6 from PyQt5 import QtGui 7 8 8 from sas.qtgui.Utilities.GuiUtils import formatNumber 9 9 -
src/sas/qtgui/Plotting/Slicers/SectorSlicer.py
r895e7359 r0849aec 3 3 """ 4 4 import numpy 5 from PyQt4 import QtGui6 from PyQt4 import QtCore7 5 8 6 from .BaseInteractor import BaseInteractor -
src/sas/qtgui/Plotting/UnitTesting/SlicerParametersTest.py
r99ea1b0 r0849aec 37 37 '''Test the GUI in its default state''' 38 38 #self.widget.mapper 39 self.assertIsInstance(self.widget.proxy, Qt Gui.QIdentityProxyModel)39 self.assertIsInstance(self.widget.proxy, QtCore.QIdentityProxyModel) 40 40 self.assertIsInstance(self.widget.lstParams.itemDelegate(), QtGui.QStyledItemDelegate) 41 41 self.assertTrue(self.widget.lstParams.model().columnReadOnly(0)) -
src/sas/qtgui/Plotting/WindowTitle.py
r83eb5208 r0849aec 3 3 from "Graph_n" to any ASCII text. 4 4 """ 5 from PyQt 4 import QtGui5 from PyQt5 import QtWidgets 6 6 7 7 from sas.qtgui.Plotting.UI.WindowTitleUI import Ui_WindowTitle 8 8 9 class WindowTitle(Qt Gui.QDialog, Ui_WindowTitle):9 class WindowTitle(QtWidgets.QDialog, Ui_WindowTitle): 10 10 """ Simple GUI for a single line text query """ 11 11 def __init__(self, parent=None, new_title=""): -
src/sas/qtgui/Plotting/rangeSlider.py
- Property mode changed from 100755 to 100644
r83eb5208 r0849aec 23 23 """ 24 24 25 from PyQt4 import QtGui, QtCore 26 27 class RangeSlider(QtGui.QSlider): 25 from PyQt5 import QtCore 26 from PyQt5 import QtGui 27 from PyQt5 import QtWidgets 28 29 class RangeSlider(QtWidgets.QSlider): 28 30 """ A slider for ranges. 29 31 … … 46 48 self._high = self.maximum() 47 49 48 self.pressed_control = Qt Gui.QStyle.SC_None49 self.hover_control = Qt Gui.QStyle.SC_None50 self.pressed_control = QtWidgets.QStyle.SC_None 51 self.hover_control = QtWidgets.QStyle.SC_None 50 52 self.click_offset = 0 51 53 … … 90 92 91 93 for i, value in enumerate([self._low, self._high]): 92 opt = Qt Gui.QStyleOptionSlider()94 opt = QtWidgets.QStyleOptionSlider() 93 95 self.initStyleOption(opt) 94 96 … … 107 109 slider_max = gr.bottom() - handle_length + 1 108 110 109 opt.subControls = Qt Gui.QStyle.SC_SliderGroove | QtGui.QStyle.SC_SliderHandle111 opt.subControls = QtWidgets.QStyle.SC_SliderGroove | QtWidgets.QStyle.SC_SliderHandle 110 112 111 113 # draw the first slider with inverted appearance, then the second … … 131 133 # do not highlight the second part when has focus to avoid 132 134 # drawing of partially overlapped semi-transparent backgrounds 133 opt.state &= ~Qt Gui.QStyle.State_HasFocus135 opt.state &= ~QtWidgets.QStyle.State_HasFocus 134 136 135 137 opt.sliderValue = 0 … … 157 159 158 160 if self.tickPosition() != self.NoTicks: 159 opt.subControls |= Qt Gui.QStyle.SC_SliderTickmarks161 opt.subControls |= QtWidgets.QStyle.SC_SliderTickmarks 160 162 161 163 if self.pressed_control: 162 164 opt.activeSubControls = self.pressed_control 163 opt.state |= Qt Gui.QStyle.State_Sunken165 opt.state |= QtWidgets.QStyle.State_Sunken 164 166 else: 165 167 opt.activeSubControls = self.hover_control 166 168 167 style.drawComplexControl(Qt Gui.QStyle.CC_Slider, opt, painter, self)169 style.drawComplexControl(QtWidgets.QStyle.CC_Slider, opt, painter, self) 168 170 169 171 … … 181 183 182 184 if button: 183 opt = Qt Gui.QStyleOptionSlider()185 opt = QtWidgets.QStyleOptionSlider() 184 186 self.initStyleOption(opt) 185 187 … … 206 208 207 209 if self.active_slider == 0: 208 self.pressed_control = Qt Gui.QStyle.SC_SliderHandle210 self.pressed_control = QtWidgets.QStyle.SC_SliderHandle 209 211 self.click_offset = self.__pixelPosToRangeValue(self.__pick(event.pos())) 210 212 self.triggerAction(self.SliderMove) … … 215 217 216 218 def mouseReleaseEvent(self, event): 217 if self.pressed_control != Qt Gui.QStyle.SC_SliderHandle:219 if self.pressed_control != QtWidgets.QStyle.SC_SliderHandle: 218 220 event.ignore() 219 221 return 220 222 221 223 self.setSliderDown(False) 222 return Qt Gui.QSlider.mouseReleaseEvent(self, event)224 return QtWidgets.QSlider.mouseReleaseEvent(self, event) 223 225 224 226 def mouseMoveEvent(self, event): 225 if self.pressed_control != Qt Gui.QStyle.SC_SliderHandle:227 if self.pressed_control != QtWidgets.QStyle.SC_SliderHandle: 226 228 event.ignore() 227 229 return … … 229 231 event.accept() 230 232 new_pos = self.__pixelPosToRangeValue(self.__pick(event.pos())) 231 opt = Qt Gui.QStyleOptionSlider()233 opt = QtWidgets.QStyleOptionSlider() 232 234 self.initStyleOption(opt) 233 235 … … 274 276 275 277 def __pixelPosToRangeValue(self, pos): 276 opt = Qt Gui.QStyleOptionSlider()278 opt = QtWidgets.QStyleOptionSlider() 277 279 self.initStyleOption(opt) 278 280 style = QtGui.QApplication.style() -
src/sas/qtgui/Utilities/GuiUtils.py
r895e7359 r0849aec 14 14 import logging 15 15 16 from PyQt4 import QtCore 17 from PyQt4 import QtGui 16 from PyQt5 import QtCore 17 from PyQt5 import QtGui 18 from PyQt5 import QtWidgets 18 19 19 20 from periodictable import formula as Formula … … 309 310 object_item = QtGui.QStandardItem() 310 311 object_item.setText(name) 311 #object_item.setData(QtCore.QVariant(update_data))312 312 object_item.setData(update_data) 313 313 … … 586 586 } 587 587 # Query user for filename. 588 filename = Qt Gui.QFileDialog.getSaveFileName(**kwargs)588 filename = QtWidgets.QFileDialog.getSaveFileName(**kwargs) 589 589 590 590 # User cancelled. … … 618 618 } 619 619 # Query user for filename. 620 filename = Qt Gui.QFileDialog.getSaveFileName(**kwargs)620 filename = QtWidgets.QFileDialog.getSaveFileName(**kwargs) 621 621 622 622 # User cancelled. -
src/sas/qtgui/Utilities/IPythonWidget.py
rfef38e8 r0849aec 1 from PyQt4 import QtCore, QtGui, QtSvg 1 from PyQt5 import QtCore 2 from PyQt5 import QtGui 3 from PyQt5 import QtWidgets 4 5 ##from PyQt4 import QtSvg 2 6 3 7 def new_load_qt(api_options): -
src/sas/qtgui/Utilities/SasviewLogger.py
- Property mode changed from 100755 to 100644
rb0b09b9 r0849aec 3 3 import logging 4 4 5 from PyQt 4 import QtCore5 from PyQt5.QtCore import * 6 6 7 7 8 class XStream(Q tCore.QObject):8 class XStream(QObject): 9 9 _stdout = None 10 10 _stderr = None 11 messageWritten = QtCore.pyqtSignal(str)11 messageWritten = pyqtSignal(str) 12 12 13 13 def flush(self): -
src/sas/qtgui/convertUI.py
rb0b09b9 r0849aec 4 4 def pyrrc(in_file, out_file): 5 5 """ Run the pyrcc4 script""" 6 execute = 'pyrcc 4 -py3%s -o %s' % (in_file, out_file)6 execute = 'pyrcc5 %s -o %s' % (in_file, out_file) 7 7 os.system(execute) 8 8 9 9 def pyuic(in_file, out_file): 10 10 """ Run the pyuic5 script""" 11 execute = 'pyuic 4-o %s %s' % (out_file, in_file)11 execute = 'pyuic5 -o %s %s' % (out_file, in_file) 12 12 os.system(execute) 13 13 -
src/sas/sasgui/plottools/config.py
r092a3d9 r0849aec 32 32 #plot_version = "0.98" 33 33 #plot_backend = "WXAgg" 34 plot_backend = "Qt4Agg" 34 print("SET MPL BACKEND TO Qt5") 35 plot_backend = "Qt5Agg" 35 36 36 37 # Sort out matplotlib version
Note: See TracChangeset
for help on using the changeset viewer.