Ignore:
Timestamp:
Mar 8, 2017 7:35:49 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:
cbcdd2c
Parents:
86f88d1
Message:

Default datasets for fitting SASVIEW-498

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/sas/qtgui/Perspectives/Fitting/FittingPerspective.py

    r6f7f652 r5236449  
    55from PyQt4 import QtGui 
    66 
     7import sas.qtgui.GuiUtils as GuiUtils 
     8 
    79from FittingWidget import FittingWidget 
    810 
     
    1012    """ 
    1113    """ 
     14    updateTheoryFromPerspectiveSignal =  QtCore.pyqtSignal(QtGui.QStandardItem) 
    1215    name = "Fitting" # For displaying in the combo box in DataExplorer 
    1316    def __init__(self, manager=None, parent=None, data=None): 
     
    4144        self.setWindowTitle('Fit panel - Active Fitting Optimizer: %s' % self.optimizer) 
    4245 
     46        self.communicate = GuiUtils.Communicate() 
     47 
    4348    def addFit(self, data): 
    4449        """ 
    4550        Add a new tab for passed data 
    4651        """ 
    47         tab     = FittingWidget(manager=self.manager, parent=self.parent, data=data) 
     52        tab     = FittingWidget(manager=self.manager, parent=self.parent, data=data, id=self.maxIndex+1) 
    4853        self.tabs.append(tab) 
    4954        self.maxIndex += 1 
    5055        self.addTab(tab, self.tabName()) 
     56        tab.signalTheory.connect(self.passSignal) 
    5157 
    5258    def tabName(self): 
     
    7783        """ 
    7884        Assign new dataset to the fitting instance 
     85        Obtain a QStandardItem object and dissect it to get Data1D/2D 
     86        Pass it over to the calculator 
    7987        """ 
    8088        assert(data_item is not None) 
    8189 
    82         # Find an unassigned tab. 
     90        if not isinstance(data_item, list): 
     91            msg = "Incorrect type passed to the Fitting Perspective" 
     92            raise AttributeError, msg 
     93 
     94        if not isinstance(data_item[0], QtGui.QStandardItem): 
     95            msg = "Incorrect type passed to the Fitting Perspective" 
     96            raise AttributeError, msg 
     97 
     98        self._model_item = data_item[0] 
     99 
     100        # Extract data on 1st child - this is the Data1D/2D component 
     101        data = GuiUtils.dataFromItem(self._model_item) 
     102 
     103        # self.model.item(WIDGETS.W_FILENAME).setData(QtCore.QVariant(self._model_item.text())) 
     104 
     105        # Find the first unassigned tab. 
    83106        # If none, open a new tab. 
    84107        available_tabs = list(map(lambda tab:tab.acceptsData(), self.tabs)) 
     
    90113 
    91114 
     115    def passSignal(self, theory_item): 
     116        """ 
     117        """ 
     118        self.updateTheoryFromPerspectiveSignal.emit(theory_item) 
     119 
    92120if __name__ == "__main__": 
    93121    app = QtGui.QApplication([]) 
Note: See TracChangeset for help on using the changeset viewer.