Changeset 9e54199 in sasview


Ignore:
Timestamp:
Oct 26, 2017 8:47:30 AM (7 years ago)
Author:
Tim Snow <tim.snow@…>
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:
749b715
Parents:
02c11b04
Message:

Implementing ticket SVCC-112

Analysis menu now changes perspectives, handling the option checking behaviour as well. In addition the fitting menu appears and disappears as and when the user is in the fitting perspective.

File:
1 edited

Legend:

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

    r9863343 r9e54199  
    180180        Respond to change of the perspective signal 
    181181        """ 
     182 
     183        # Save users from themselves... 
     184        if isinstance(self._current_perspective, Perspectives.PERSPECTIVES[str(perspective_name)]): 
     185            self.setupPerspectiveMenubarOptions(self._current_perspective) 
     186            return 
     187 
    182188        # Close the previous perspective 
     189        self.clearPerspectiveMenubarOptions(self._current_perspective) 
    183190        if self._current_perspective: 
    184191            self._current_perspective.setClosable() 
     
    187194        self._current_perspective = Perspectives.PERSPECTIVES[str(perspective_name)](parent=self) 
    188195 
     196        self.setupPerspectiveMenubarOptions(self._current_perspective) 
    189197        self._workspace.workspace.addWindow(self._current_perspective) 
    190198        # Resize to the workspace height 
     
    650658    def actionFitting(self): 
    651659        """ 
    652         """ 
    653         print("actionFitting TRIGGERED") 
    654         pass 
     660        Change to the Fitting perspective 
     661        """ 
     662        self.perspectiveChanged("Fitting") 
    655663 
    656664    def actionInversion(self): 
    657665        """ 
    658         """ 
     666        Change to the Inversion perspective 
     667        """ 
     668        # For now we'll just update the analysis menu status but when the inversion is implemented delete from here 
     669        self.checkAnalysisOption(self._workspace.actionInversion) 
    659670        print("actionInversion TRIGGERED") 
    660         pass 
     671        # to here and uncomment the following line 
     672        # self.perspectiveChanged("Inversion") 
    661673 
    662674    def actionInvariant(self): 
    663675        """ 
    664         """ 
    665         print("actionInvariant TRIGGERED") 
    666         pass 
     676        Change to the Invariant perspective 
     677        """ 
     678        self.perspectiveChanged("Invariant") 
    667679 
    668680    #============ WINDOW ================= 
     
    763775        if hasattr(self, "filesWidget"): 
    764776            self.filesWidget.displayData(plot) 
     777 
     778    def uncheckAllMenuItems(self, menuObject): 
     779        """ 
     780        Uncheck all options in a given menu 
     781        """ 
     782        menuObjects = menuObject.actions() 
     783 
     784        for menuItem in menuObjects: 
     785            menuItem.setChecked(False) 
     786 
     787    def checkAnalysisOption(self, analysisMenuOption): 
     788        """ 
     789        Unchecks all the items in the analysis menu and checks the item passed 
     790        """ 
     791        self.uncheckAllMenuItems(self._workspace.menuAnalysis) 
     792        analysisMenuOption.setChecked(True) 
     793 
     794    def clearPerspectiveMenubarOptions(self, perspective): 
     795        """ 
     796        When closing a perspective, clears the menu bar 
     797        """ 
     798        for menuItem in self._workspace.menuAnalysis.actions(): 
     799            menuItem.setChecked(False) 
     800 
     801        if isinstance(self._current_perspective, Perspectives.PERSPECTIVES["Fitting"]): 
     802            self._workspace.menubar.removeAction(self._workspace.menuFitting.menuAction()) 
     803 
     804    def setupPerspectiveMenubarOptions(self, perspective): 
     805        """ 
     806        When setting a perspective, sets up the menu bar 
     807        """ 
     808        if isinstance(perspective, Perspectives.PERSPECTIVES["Fitting"]): 
     809            self.checkAnalysisOption(self._workspace.actionFitting) 
     810            # Put the fitting menu back in 
     811            # This is a bit involved but it is needed to preserve the menu ordering 
     812            self._workspace.menubar.removeAction(self._workspace.menuWindow.menuAction()) 
     813            self._workspace.menubar.removeAction(self._workspace.menuHelp.menuAction()) 
     814            self._workspace.menubar.addAction(self._workspace.menuFitting.menuAction()) 
     815            self._workspace.menubar.addAction(self._workspace.menuWindow.menuAction()) 
     816            self._workspace.menubar.addAction(self._workspace.menuHelp.menuAction()) 
     817        elif isinstance(perspective, Perspectives.PERSPECTIVES["Invariant"]): 
     818            self.checkAnalysisOption(self._workspace.actionInvariant) 
     819        # elif isinstance(perspective, Perspectives.PERSPECTIVES["Inversion"]): 
     820        #     self.checkAnalysisOption(self._workspace.actionInversion) 
Note: See TracChangeset for help on using the changeset viewer.