Ignore:
Timestamp:
Nov 9, 2017 6: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 05:50:09)
git-committer:
Piotr Rozyczko <rozyczko@…> (11/09/17 06:43:07)
Message:

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

File:
1 edited

Legend:

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