Ignore:
Timestamp:
Mar 23, 2017 9:53:10 AM (8 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/Invariant/InvariantPerspective.py

    r0979dfb rb1e36a3  
    7878        self._data = None 
    7979        self._path = "" 
     80 
     81        self._allow_close = False 
    8082 
    8183        # Mask file selector 
     
    106108        self.setupMapper() 
    107109 
    108     #def closeEvent(self, event): 
    109     #    """ 
    110     #    Overwrite the default close method of QWidget 
    111     #    """ 
    112     #    # No close on perspectives - one must always be active. 
    113     #    event.ignore() 
     110    def setClosable(self, value=True): 
     111        """ 
     112        Allow outsiders close this widget 
     113        """ 
     114        assert isinstance(value, bool) 
     115 
     116        self._allow_close = value 
     117 
     118    def closeEvent(self, event): 
     119        """ 
     120        Overwrite QDialog close method to allow for custom widget close 
     121        """ 
     122        if self._allow_close: 
     123            # reset the closability flag 
     124            self.setClosable(value=False) 
     125            event.accept() 
     126        else: 
     127            event.ignore() 
     128            # Maybe we should just minimize 
     129            self.setWindowState(QtCore.Qt.WindowMinimized) 
    114130 
    115131    def communicator(self): 
Note: See TracChangeset for help on using the changeset viewer.