Ignore:
Timestamp:
Oct 26, 2017 5:55:59 AM (7 years ago)
Author:
krzywon
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:
e32b120
Parents:
6cbf8a5
Message:

Finished P(r) GUI. Added basic methods for closing window.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/sas/qtgui/Perspectives/PrInversion/PrInversionPerspective.py

    r6cbf8a5 rd2d0441e  
    1 from PyQt4 import QtGui 
     1from PyQt4 import QtGui, QtCore, QtWebKit 
    22 
    33# sas-global 
    4 from sas.sascalc.invariant import invariant 
    5 from sas.qtgui.Plotting.PlotterData import Data1D 
    6 import sas.qtgui.Utilities.GuiUtils as GuiUtils 
     4#import sas.qtgui.Utilities.GuiUtils as GuiUtils 
    75 
    86# pr inversion gui elements 
    9 from sas.qtgui.Perspectives.PrInversion.UI.TabbedPrInversionUI import Ui_PrInversion 
     7from sas.qtgui.Perspectives.PrInversion.UI.TabbedPrInversionUI import \ 
     8    Ui_PrInversion 
    109 
    1110class PrInversionWindow(QtGui.QTabWidget, Ui_PrInversion): 
     
    2120        self.setWindowTitle("P(r) Inversion Perspective") 
    2221 
    23         self.parent = parent 
     22        self._manager = parent 
     23 
     24        self._model_item = QtGui.QStandardItem() 
     25        self._helpView = QtWebKit.QWebView() 
    2426        self._data = data 
    2527 
     
    2729        self._allow_close = False 
    2830 
    29         self.communicate = self.parent.communicator() 
     31        # Let's choose the Standard Item Model. 
     32        self.model = QtGui.QStandardItemModel(self) 
     33 
     34    def allowBatch(self): 
     35        return False 
     36 
     37    def setClosable(self, value=True): 
     38        """ 
     39        Allow outsiders close this widget 
     40        """ 
     41        assert isinstance(value, bool) 
     42        self._allow_close = value 
     43 
     44    def closeEvent(self, event): 
     45        """ 
     46        Overwrite QDialog close method to allow for custom widget close 
     47        """ 
     48        if self._allow_close: 
     49            # reset the closability flag 
     50            self.setClosable(value=False) 
     51            event.accept() 
     52        else: 
     53            event.ignore() 
     54            # Maybe we should just minimize 
     55            self.setWindowState(QtCore.Qt.WindowMinimized) 
Note: See TracChangeset for help on using the changeset viewer.