Changeset 9d23e4c in sasview for src


Ignore:
Timestamp:
Dec 3, 2018 5:48:31 AM (6 years ago)
Author:
wojciech
Branches:
ESS_GUI_batch_fitting
Parents:
d9e7792
Message:

Fixing tables Plot activation/deactivation for batch fitting

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/sas/qtgui/Utilities/GridPanel.py

    rc4c4957 r9d23e4c  
    5959            model_name = output_data[0][0].model.id 
    6060            self.tabWidget.setTabToolTip(0, model_name) 
     61        self.tabWidget.currentChanged.connect(self.onTabChanged) 
    6162 
    6263    def closeEvent(self, event): 
     
    195196        """ 
    196197        rows = [s.row() for s in self.currentTable().selectionModel().selectedRows()] 
    197         if not rows: 
    198             msg = "Nothing to plot!" 
    199             self.parent.communicate.statusBarUpdateSignal.emit(msg) 
    200             return 
    201198        data = self.dataFromTable(self.currentTable()) 
    202199        # data['Data'] -> ['filename1', 'filename2', ...] 
     
    210207                # data messed up. 
    211208                return 
     209 
     210    def onSelectionChanged(self): 
     211        """ 
     212        Deactivates plot if no rows are selected 
     213        """ 
     214        selected_rows = len(self.currentTable().selectionModel().selectedRows()) 
     215        if selected_rows == 0: 
     216            self.cmdPlot.setEnabled(False) 
     217        else: 
     218            self.cmdPlot.setEnabled(True) 
     219 
     220    def onTabChanged(self): 
     221        """ 
     222        Resets settings when tab is change to avoid problems with plotting 
     223        """ 
     224        self.currentTable().selectRow(0) 
     225        self.cmdPlot.setEnabled(True) 
    212226 
    213227    @classmethod 
     
    401415        # resize content 
    402416        widget.resizeColumnsToContents() 
     417        widget.selectRow(0) 
     418        widget.itemSelectionChanged.connect(self.onSelectionChanged) 
    403419 
    404420    @classmethod 
Note: See TracChangeset for help on using the changeset viewer.