Changeset 83d6249 in sasview for src/sas/qtgui/GuiManager.py


Ignore:
Timestamp:
Feb 16, 2017 6:06:17 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:
2bb20a5, fca1f50
Parents:
4c7dd9f
Message:

Perspectives are now switchable and can be added "dynamically"

File:
1 edited

Legend:

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

    r257bd57 r83d6249  
    2929 
    3030# Perspectives 
     31import Perspectives 
    3132from sas.qtgui.Perspectives.Invariant.InvariantPerspective import InvariantWindow 
     33from sas.qtgui.Perspectives.Fitting.FittingPerspective import FittingWindow 
    3234from sas.qtgui.DataExplorer import DataExplorerWindow 
    3335 
     
    98100                                              "_downloads", 
    99101                                              "Tutorial.pdf")) 
    100  
    101         #========================================================== 
    102         # TEMP PROTOTYPE 
    103         # Add InvariantWindow to the workspace. 
    104         self.invariantWidget = InvariantWindow(self) 
    105         self._workspace.workspace.addWindow(self.invariantWidget) 
    106  
    107         # Default perspective 
    108         self._current_perspective = self.invariantWidget 
     102        # Current displayed perspective 
     103        self._current_perspective = None 
     104 
     105        # Invoke the initial perspective 
     106        self.perspectiveChanged("Fitting") 
    109107 
    110108    def addWidgets(self): 
     
    120118        self.dockedFilesWidget = QtGui.QDockWidget("Data Explorer", self._workspace) 
    121119        self.dockedFilesWidget.setWidget(self.filesWidget) 
     120 
    122121        # Disable maximize/minimize and close buttons 
    123122        self.dockedFilesWidget.setFeatures(QtGui.QDockWidget.NoDockWidgetFeatures) 
     
    143142        self.KIESSIGCalculator = KiessigPanel(self) 
    144143        self.SlitSizeCalculator = SlitSizeCalculator(self) 
     144 
    145145    def statusBarSetup(self): 
    146146        """ 
     
    173173        """ 
    174174        return self._workspace.workspace 
     175 
     176    def perspectiveChanged(self, perspective_name): 
     177        """ 
     178        Respond to change of the perspective signal 
     179        """ 
     180        # Close the previous perspective 
     181        if self._current_perspective: 
     182            self._current_perspective.close() 
     183        # Default perspective 
     184        self._current_perspective = Perspectives.PERSPECTIVES[str(perspective_name)](self) 
     185        self._workspace.workspace.addWindow(self._current_perspective) 
     186        self._current_perspective.show() 
    175187 
    176188    def updatePerspective(self, data): 
     
    322334        self.communicate.updatePerspectiveWithDataSignal.connect(self.updatePerspective) 
    323335        self.communicate.progressBarUpdateSignal.connect(self.updateProgressBar) 
     336        self.communicate.perspectiveChangedSignal.connect(self.perspectiveChanged) 
    324337 
    325338    def addTriggers(self): 
Note: See TracChangeset for help on using the changeset viewer.