Ignore:
Timestamp:
Mar 23, 2017 7:53:10 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:
9934e48
Parents:
29eb947
Message:

FittingWidget? code review SASVIEW-561

File:
1 edited

Legend:

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

    r811bec1 rb1e36a3  
    4242        self.tabCloseRequested.connect(self.tabCloses) 
    4343 
     44        # Perspective window not allowed to close by default 
     45        self._allow_close = False 
     46 
    4447        self.setWindowTitle('Fit panel - Active Fitting Optimizer: %s' % self.optimizer) 
     48 
     49    def setClosable(self, value=True): 
     50        """ 
     51        Allow outsiders close this widget 
     52        """ 
     53        assert isinstance(value, bool) 
     54 
     55        self._allow_close = value 
     56 
     57    def closeEvent(self, event): 
     58        """ 
     59        Overwrite QDialog close method to allow for custom widget close 
     60        """ 
     61        if self._allow_close: 
     62            # reset the closability flag 
     63            self.setClosable(value=False) 
     64            event.accept() 
     65        else: 
     66            event.ignore() 
     67            # Maybe we should just minimize 
     68            self.setWindowState(QtCore.Qt.WindowMinimized) 
    4569 
    4670    def addFit(self, data): 
Note: See TracChangeset for help on using the changeset viewer.