Changeset a281ab8 in sasview for src/sas/qtgui/DataExplorer.py


Ignore:
Timestamp:
Jun 15, 2016 5:57:34 AM (8 years ago)
Author:
Piotr Rozyczko <piotr.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:
1042dba
Parents:
5032ea68
Message:

Prototype DE↔perspective api based on QStandardItem.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/sas/qtgui/DataExplorer.py

    r5032ea68 ra281ab8  
    1616# UI 
    1717from UI.TabbedFileLoadUI import DataLoadWidget 
     18 
     19# This is how to get data1/2D from the model item 
     20# data = [selected_items[0].child(0).data().toPyObject()] 
    1821 
    1922class DataExplorerWindow(DataLoadWidget): 
     
    150153            retval = msgbox.exec_() 
    151154            return 
    152         # Dig up data from model 
    153         data = [selected_items[0].child(0).data().toPyObject()] 
     155 
     156        # Dig up the item 
     157        data = selected_items 
    154158 
    155159        # TODO 
     
    157161 
    158162        # Notify the GuiManager about the send request 
    159         self._perspective.setData(data_list=data) 
     163        self._perspective.setData(data_item=data) 
    160164 
    161165 
     
    272276            message = "Loading Data Complete! " 
    273277        message += log_msg 
    274         return (output, message) 
     278        return output, message 
    275279 
    276280    def getWlist(self): 
     
    375379 
    376380 
    377     def loadComplete(self, output, message=""): 
     381    def loadComplete(self, output): 
    378382        """ 
    379383        Post message to status bar and update the data manager 
    380384        """ 
    381385        self.model.reset() 
     386        assert(type(output), tuple) 
     387 
     388        output_data = output[0] 
     389        message = output[1] 
    382390        # Notify the manager of the new data available 
    383391        self.communicate.statusBarUpdateSignal.emit(message) 
    384         self.communicate.fileDataReceivedSignal.emit(output) 
    385         self.manager.add_data(data_list=output) 
     392        self.communicate.fileDataReceivedSignal.emit(output_data) 
     393        self.manager.add_data(data_list=output_data) 
    386394 
    387395    def updateModel(self, data, p_file): 
     
    429437    def updateModelFromPerspective(self, model_item): 
    430438        """ 
    431         """ 
    432         # Overwrite the index with what we got from the perspective 
     439        Receive an update model item from a perspective 
     440        Make sure it is valid and if so, replace it in the model 
     441        """ 
     442        # Assert the correct type 
    433443        if type(model_item) != QtGui.QStandardItem: 
    434444            msg = "Wrong data type returned from calculations." 
    435445            raise AttributeError, msg 
     446        # Assert other properties 
     447 
     448        # Remove the original item         
     449 
     450        # Add the current item 
    436451        # self.model.insertRow(model_item) 
     452 
    437453        # Reset the view 
    438454        self.model.reset() 
Note: See TracChangeset for help on using the changeset viewer.