Changeset 4992ff2 in sasview for src/sas/qtgui/Calculators


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

Location:
src/sas/qtgui/Calculators
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • 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: 
Note: See TracChangeset for help on using the changeset viewer.