[f721030] | 1 | import sys |
---|
[0cd8612] | 2 | import os |
---|
[9e426c1] | 3 | import subprocess |
---|
| 4 | import logging |
---|
| 5 | import json |
---|
| 6 | import webbrowser |
---|
[f721030] | 7 | |
---|
[4992ff2] | 8 | from PyQt5.QtWidgets import * |
---|
| 9 | from PyQt5.QtGui import * |
---|
[d6b8a1d] | 10 | from PyQt5.QtCore import Qt, QLocale, QUrl |
---|
[1042dba] | 11 | |
---|
| 12 | from twisted.internet import reactor |
---|
[dc5ef15] | 13 | # General SAS imports |
---|
| 14 | from sas.qtgui.Utilities.ConnectionProxy import ConnectionProxy |
---|
[83eb5208] | 15 | from sas.qtgui.Utilities.SasviewLogger import XStream |
---|
[fef38e8] | 16 | |
---|
[83eb5208] | 17 | import sas.qtgui.Utilities.LocalConfig as LocalConfig |
---|
| 18 | import sas.qtgui.Utilities.GuiUtils as GuiUtils |
---|
| 19 | |
---|
[fef38e8] | 20 | import sas.qtgui.Utilities.ObjectLibrary as ObjectLibrary |
---|
[3b3b40b] | 21 | from sas.qtgui.Utilities.TabbedModelEditor import TabbedModelEditor |
---|
| 22 | from sas.qtgui.Utilities.PluginManager import PluginManager |
---|
[83eb5208] | 23 | from sas.qtgui.MainWindow.UI.AcknowledgementsUI import Ui_Acknowledgements |
---|
| 24 | from sas.qtgui.MainWindow.AboutBox import AboutBox |
---|
| 25 | from sas.qtgui.MainWindow.WelcomePanel import WelcomePanel |
---|
[fef38e8] | 26 | |
---|
[dc5ef15] | 27 | from sas.qtgui.MainWindow.DataManager import DataManager |
---|
[83eb5208] | 28 | |
---|
| 29 | from sas.qtgui.Calculators.SldPanel import SldPanel |
---|
| 30 | from sas.qtgui.Calculators.DensityPanel import DensityPanel |
---|
| 31 | from sas.qtgui.Calculators.KiessigPanel import KiessigPanel |
---|
| 32 | from sas.qtgui.Calculators.SlitSizeCalculator import SlitSizeCalculator |
---|
[28a09b0] | 33 | from sas.qtgui.Calculators.GenericScatteringCalculator import GenericScatteringCalculator |
---|
[01cda57] | 34 | from sas.qtgui.Calculators.ResolutionCalculatorPanel import ResolutionCalculatorPanel |
---|
[d5c5d3d] | 35 | from sas.qtgui.Calculators.DataOperationUtilityPanel import DataOperationUtilityPanel |
---|
[f721030] | 36 | |
---|
| 37 | # Perspectives |
---|
[83eb5208] | 38 | import sas.qtgui.Perspectives as Perspectives |
---|
[6c8fb2c] | 39 | from sas.qtgui.Perspectives.Fitting.FittingPerspective import FittingWindow |
---|
[d4881f6a] | 40 | from sas.qtgui.MainWindow.DataExplorer import DataExplorerWindow, DEFAULT_PERSPECTIVE |
---|
[f51ed67] | 41 | |
---|
[4992ff2] | 42 | class Acknowledgements(QDialog, Ui_Acknowledgements): |
---|
[f51ed67] | 43 | def __init__(self, parent=None): |
---|
[4992ff2] | 44 | QDialog.__init__(self, parent) |
---|
[f51ed67] | 45 | self.setupUi(self) |
---|
[f721030] | 46 | |
---|
| 47 | class GuiManager(object): |
---|
| 48 | """ |
---|
| 49 | Main SasView window functionality |
---|
| 50 | """ |
---|
[6fd4e36] | 51 | def __init__(self, parent=None): |
---|
[f721030] | 52 | """ |
---|
[257bd57] | 53 | Initialize the manager as a child of MainWindow. |
---|
[f721030] | 54 | """ |
---|
[6fd4e36] | 55 | self._workspace = parent |
---|
[f721030] | 56 | self._parent = parent |
---|
| 57 | |
---|
[d6b8a1d] | 58 | # Decide on a locale |
---|
| 59 | QLocale.setDefault(QLocale('en_US')) |
---|
| 60 | |
---|
[f721030] | 61 | # Add signal callbacks |
---|
| 62 | self.addCallbacks() |
---|
| 63 | |
---|
| 64 | # Create the data manager |
---|
[1042dba] | 65 | # TODO: pull out all required methods from DataManager and reimplement |
---|
| 66 | self._data_manager = DataManager() |
---|
[f721030] | 67 | |
---|
| 68 | # Create action triggers |
---|
| 69 | self.addTriggers() |
---|
| 70 | |
---|
[d4881f6a] | 71 | # Currently displayed perspective |
---|
[5236449] | 72 | self._current_perspective = None |
---|
| 73 | |
---|
[d4881f6a] | 74 | # Populate the main window with stuff |
---|
[0cd8612] | 75 | self.addWidgets() |
---|
[f721030] | 76 | |
---|
[0cd8612] | 77 | # Fork off logging messages to the Log Window |
---|
[8cb6cd6] | 78 | XStream.stdout().messageWritten.connect(self.listWidget.insertPlainText) |
---|
| 79 | XStream.stderr().messageWritten.connect(self.listWidget.insertPlainText) |
---|
| 80 | |
---|
[0cd8612] | 81 | # Log the start of the session |
---|
| 82 | logging.info(" --- SasView session started ---") |
---|
| 83 | # Log the python version |
---|
| 84 | logging.info("Python: %s" % sys.version) |
---|
[9e426c1] | 85 | |
---|
[e540cd2] | 86 | # Set up the status bar |
---|
| 87 | self.statusBarSetup() |
---|
[f721030] | 88 | |
---|
[9e426c1] | 89 | # Needs URL like path, so no path.join() here |
---|
[b0c5e8c] | 90 | self._helpLocation = GuiUtils.HELP_DIRECTORY_LOCATION + "/index.html" |
---|
[9e426c1] | 91 | |
---|
| 92 | # Current tutorial location |
---|
[b0c5e8c] | 93 | self._tutorialLocation = os.path.abspath(os.path.join(GuiUtils.HELP_DIRECTORY_LOCATION, |
---|
[9e426c1] | 94 | "_downloads", |
---|
[31c5b58] | 95 | "Tutorial.pdf")) |
---|
[8353d90] | 96 | |
---|
[0cd8612] | 97 | def addWidgets(self): |
---|
| 98 | """ |
---|
| 99 | Populate the main window with widgets |
---|
| 100 | |
---|
| 101 | TODO: overwrite close() on Log and DR widgets so they can be hidden/shown |
---|
| 102 | on request |
---|
| 103 | """ |
---|
| 104 | # Add FileDialog widget as docked |
---|
[630155bd] | 105 | self.filesWidget = DataExplorerWindow(self._parent, self, manager=self._data_manager) |
---|
[2a432e7] | 106 | ObjectLibrary.addObject('DataExplorer', self.filesWidget) |
---|
[0cd8612] | 107 | |
---|
[4992ff2] | 108 | self.dockedFilesWidget = QDockWidget("Data Explorer", self._workspace) |
---|
[7969b9c] | 109 | self.dockedFilesWidget.setFloating(False) |
---|
[0cd8612] | 110 | self.dockedFilesWidget.setWidget(self.filesWidget) |
---|
[83d6249] | 111 | |
---|
[0cd8612] | 112 | # Disable maximize/minimize and close buttons |
---|
[4992ff2] | 113 | self.dockedFilesWidget.setFeatures(QDockWidget.NoDockWidgetFeatures) |
---|
| 114 | |
---|
[7969b9c] | 115 | #self._workspace.workspace.addDockWidget(Qt.LeftDockWidgetArea, self.dockedFilesWidget) |
---|
| 116 | self._workspace.addDockWidget(Qt.LeftDockWidgetArea, self.dockedFilesWidget) |
---|
[0cd8612] | 117 | |
---|
| 118 | # Add the console window as another docked widget |
---|
[4992ff2] | 119 | self.logDockWidget = QDockWidget("Log Explorer", self._workspace) |
---|
[0cd8612] | 120 | self.logDockWidget.setObjectName("LogDockWidget") |
---|
[4992ff2] | 121 | |
---|
| 122 | self.listWidget = QTextBrowser() |
---|
[0cd8612] | 123 | self.logDockWidget.setWidget(self.listWidget) |
---|
[7969b9c] | 124 | self._workspace.addDockWidget(Qt.BottomDockWidgetArea, self.logDockWidget) |
---|
[0cd8612] | 125 | |
---|
| 126 | # Add other, minor widgets |
---|
| 127 | self.ackWidget = Acknowledgements() |
---|
| 128 | self.aboutWidget = AboutBox() |
---|
[8353d90] | 129 | self.welcomePanel = WelcomePanel() |
---|
[0cd8612] | 130 | |
---|
[1d85b5e] | 131 | # Add calculators - floating for usability |
---|
| 132 | self.SLDCalculator = SldPanel(self) |
---|
| 133 | self.DVCalculator = DensityPanel(self) |
---|
[a8ec5b1] | 134 | self.KIESSIGCalculator = KiessigPanel(self) |
---|
[abc5e70] | 135 | self.SlitSizeCalculator = SlitSizeCalculator(self) |
---|
[28a09b0] | 136 | self.GENSASCalculator = GenericScatteringCalculator(self) |
---|
[01cda57] | 137 | self.ResolutionCalculator = ResolutionCalculatorPanel(self) |
---|
[d5c5d3d] | 138 | self.DataOperation = DataOperationUtilityPanel(self) |
---|
[83d6249] | 139 | |
---|
[e540cd2] | 140 | def statusBarSetup(self): |
---|
| 141 | """ |
---|
| 142 | Define the status bar. |
---|
| 143 | | <message label> .... | Progress Bar | |
---|
| 144 | |
---|
| 145 | Progress bar invisible until explicitly shown |
---|
| 146 | """ |
---|
[4992ff2] | 147 | self.progress = QProgressBar() |
---|
[e540cd2] | 148 | self._workspace.statusbar.setSizeGripEnabled(False) |
---|
| 149 | |
---|
[4992ff2] | 150 | self.statusLabel = QLabel() |
---|
[e540cd2] | 151 | self.statusLabel.setText("Welcome to SasView") |
---|
[8cb6cd6] | 152 | self._workspace.statusbar.addPermanentWidget(self.statusLabel, 1) |
---|
[e540cd2] | 153 | self._workspace.statusbar.addPermanentWidget(self.progress, stretch=0) |
---|
[8cb6cd6] | 154 | self.progress.setRange(0, 100) |
---|
[e540cd2] | 155 | self.progress.setValue(0) |
---|
| 156 | self.progress.setTextVisible(True) |
---|
| 157 | self.progress.setVisible(False) |
---|
| 158 | |
---|
[9d266d2] | 159 | def fileWasRead(self, data): |
---|
[f721030] | 160 | """ |
---|
[f82ab8c] | 161 | Callback for fileDataReceivedSignal |
---|
[f721030] | 162 | """ |
---|
| 163 | pass |
---|
[481ff26] | 164 | |
---|
[e90988c] | 165 | def showHelp(self, url): |
---|
| 166 | """ |
---|
| 167 | Open a local url in the default browser |
---|
| 168 | """ |
---|
| 169 | location = GuiUtils.HELP_DIRECTORY_LOCATION + url |
---|
| 170 | try: |
---|
| 171 | webbrowser.open('file://' + os.path.realpath(location)) |
---|
| 172 | except webbrowser.Error as ex: |
---|
| 173 | logging.warning("Cannot display help. %s" % ex) |
---|
| 174 | |
---|
[8cb6cd6] | 175 | def workspace(self): |
---|
| 176 | """ |
---|
| 177 | Accessor for the main window workspace |
---|
| 178 | """ |
---|
| 179 | return self._workspace.workspace |
---|
| 180 | |
---|
[83d6249] | 181 | def perspectiveChanged(self, perspective_name): |
---|
| 182 | """ |
---|
| 183 | Respond to change of the perspective signal |
---|
| 184 | """ |
---|
| 185 | # Close the previous perspective |
---|
[9e54199] | 186 | self.clearPerspectiveMenubarOptions(self._current_perspective) |
---|
[83d6249] | 187 | if self._current_perspective: |
---|
[b1e36a3] | 188 | self._current_perspective.setClosable() |
---|
[7c487846] | 189 | #self._workspace.workspace.removeSubWindow(self._current_perspective) |
---|
[83d6249] | 190 | self._current_perspective.close() |
---|
[7c487846] | 191 | self._workspace.workspace.removeSubWindow(self._current_perspective) |
---|
[83d6249] | 192 | # Default perspective |
---|
[811bec1] | 193 | self._current_perspective = Perspectives.PERSPECTIVES[str(perspective_name)](parent=self) |
---|
[9c391946] | 194 | |
---|
[8ac3551] | 195 | self.setupPerspectiveMenubarOptions(self._current_perspective) |
---|
| 196 | |
---|
[d1955d67] | 197 | subwindow = self._workspace.workspace.addSubWindow(self._current_perspective) |
---|
[4992ff2] | 198 | |
---|
[9c391946] | 199 | # Resize to the workspace height |
---|
[fbfc488] | 200 | workspace_height = self._workspace.workspace.sizeHint().height() |
---|
| 201 | perspective_size = self._current_perspective.sizeHint() |
---|
| 202 | perspective_width = perspective_size.width() |
---|
| 203 | self._current_perspective.resize(perspective_width, workspace_height-10) |
---|
[d1955d67] | 204 | # Resize the mdi area to match the widget within |
---|
| 205 | subwindow.resize(subwindow.minimumSizeHint()) |
---|
[7969b9c] | 206 | |
---|
[83d6249] | 207 | self._current_perspective.show() |
---|
| 208 | |
---|
[f721030] | 209 | def updatePerspective(self, data): |
---|
| 210 | """ |
---|
[71361f0] | 211 | Update perspective with data sent. |
---|
[f721030] | 212 | """ |
---|
| 213 | assert isinstance(data, list) |
---|
| 214 | if self._current_perspective is not None: |
---|
[b3e8629] | 215 | self._current_perspective.setData(list(data.values())) |
---|
[f721030] | 216 | else: |
---|
| 217 | msg = "No perspective is currently active." |
---|
| 218 | logging.info(msg) |
---|
[481ff26] | 219 | |
---|
[f721030] | 220 | def communicator(self): |
---|
[257bd57] | 221 | """ Accessor for the communicator """ |
---|
[f721030] | 222 | return self.communicate |
---|
| 223 | |
---|
| 224 | def perspective(self): |
---|
[257bd57] | 225 | """ Accessor for the perspective """ |
---|
[f721030] | 226 | return self._current_perspective |
---|
| 227 | |
---|
[e540cd2] | 228 | def updateProgressBar(self, value): |
---|
| 229 | """ |
---|
| 230 | Update progress bar with the required value (0-100) |
---|
| 231 | """ |
---|
[8cb6cd6] | 232 | assert -1 <= value <= 100 |
---|
[e540cd2] | 233 | if value == -1: |
---|
| 234 | self.progress.setVisible(False) |
---|
| 235 | return |
---|
| 236 | if not self.progress.isVisible(): |
---|
| 237 | self.progress.setTextVisible(True) |
---|
| 238 | self.progress.setVisible(True) |
---|
| 239 | |
---|
| 240 | self.progress.setValue(value) |
---|
| 241 | |
---|
[f721030] | 242 | def updateStatusBar(self, text): |
---|
| 243 | """ |
---|
[71361f0] | 244 | Set the status bar text |
---|
[f721030] | 245 | """ |
---|
[e540cd2] | 246 | self.statusLabel.setText(text) |
---|
[f721030] | 247 | |
---|
[1042dba] | 248 | def createGuiData(self, item, p_file=None): |
---|
| 249 | """ |
---|
| 250 | Access the Data1D -> plottable Data1D conversion |
---|
| 251 | """ |
---|
| 252 | return self._data_manager.create_gui_data(item, p_file) |
---|
[f721030] | 253 | |
---|
| 254 | def setData(self, data): |
---|
| 255 | """ |
---|
| 256 | Sends data to current perspective |
---|
| 257 | """ |
---|
| 258 | if self._current_perspective is not None: |
---|
[b3e8629] | 259 | self._current_perspective.setData(list(data.values())) |
---|
[f721030] | 260 | else: |
---|
| 261 | msg = "Guiframe does not have a current perspective" |
---|
| 262 | logging.info(msg) |
---|
| 263 | |
---|
[9e426c1] | 264 | def quitApplication(self): |
---|
| 265 | """ |
---|
| 266 | Close the reactor and exit nicely. |
---|
| 267 | """ |
---|
| 268 | # Display confirmation messagebox |
---|
| 269 | quit_msg = "Are you sure you want to exit the application?" |
---|
[4992ff2] | 270 | reply = QMessageBox.question( |
---|
[481ff26] | 271 | self._parent, |
---|
[7451b88] | 272 | 'Information', |
---|
[481ff26] | 273 | quit_msg, |
---|
[4992ff2] | 274 | QMessageBox.Yes, |
---|
| 275 | QMessageBox.No) |
---|
[9e426c1] | 276 | |
---|
| 277 | # Exit if yes |
---|
[4992ff2] | 278 | if reply == QMessageBox.Yes: |
---|
[7451b88] | 279 | reactor.callFromThread(reactor.stop) |
---|
| 280 | return True |
---|
| 281 | |
---|
| 282 | return False |
---|
[9e426c1] | 283 | |
---|
| 284 | def checkUpdate(self): |
---|
| 285 | """ |
---|
| 286 | Check with the deployment server whether a new version |
---|
| 287 | of the application is available. |
---|
| 288 | A thread is started for the connecting with the server. The thread calls |
---|
| 289 | a call-back method when the current version number has been obtained. |
---|
| 290 | """ |
---|
| 291 | version_info = {"version": "0.0.0"} |
---|
[dc5ef15] | 292 | c = ConnectionProxy(LocalConfig.__update_URL__, LocalConfig.UPDATE_TIMEOUT) |
---|
[9e426c1] | 293 | response = c.connect() |
---|
[71361f0] | 294 | if response is None: |
---|
| 295 | return |
---|
| 296 | try: |
---|
| 297 | content = response.read().strip() |
---|
| 298 | logging.info("Connected to www.sasview.org. Latest version: %s" |
---|
| 299 | % (content)) |
---|
| 300 | version_info = json.loads(content) |
---|
| 301 | self.processVersion(version_info) |
---|
[b3e8629] | 302 | except ValueError as ex: |
---|
[71361f0] | 303 | logging.info("Failed to connect to www.sasview.org:", ex) |
---|
[481ff26] | 304 | |
---|
[f82ab8c] | 305 | def processVersion(self, version_info): |
---|
[9e426c1] | 306 | """ |
---|
| 307 | Call-back method for the process of checking for updates. |
---|
| 308 | This methods is called by a VersionThread object once the current |
---|
| 309 | version number has been obtained. If the check is being done in the |
---|
| 310 | background, the user will not be notified unless there's an update. |
---|
| 311 | |
---|
| 312 | :param version: version string |
---|
| 313 | """ |
---|
| 314 | try: |
---|
| 315 | version = version_info["version"] |
---|
| 316 | if version == "0.0.0": |
---|
| 317 | msg = "Could not connect to the application server." |
---|
| 318 | msg += " Please try again later." |
---|
| 319 | self.communicate.statusBarUpdateSignal.emit(msg) |
---|
| 320 | |
---|
[cee5c78] | 321 | elif version.__gt__(LocalConfig.__version__): |
---|
[9e426c1] | 322 | msg = "Version %s is available! " % str(version) |
---|
[f82ab8c] | 323 | if "download_url" in version_info: |
---|
| 324 | webbrowser.open(version_info["download_url"]) |
---|
[9e426c1] | 325 | else: |
---|
[f82ab8c] | 326 | webbrowser.open(LocalConfig.__download_page__) |
---|
[9e426c1] | 327 | self.communicate.statusBarUpdateSignal.emit(msg) |
---|
| 328 | else: |
---|
| 329 | msg = "You have the latest version" |
---|
| 330 | msg += " of %s" % str(LocalConfig.__appname__) |
---|
| 331 | self.communicate.statusBarUpdateSignal.emit(msg) |
---|
| 332 | except: |
---|
| 333 | msg = "guiframe: could not get latest application" |
---|
[b3e8629] | 334 | msg += " version number\n %s" % sys.exc_info()[1] |
---|
[9e426c1] | 335 | logging.error(msg) |
---|
[f82ab8c] | 336 | msg = "Could not connect to the application server." |
---|
| 337 | msg += " Please try again later." |
---|
| 338 | self.communicate.statusBarUpdateSignal.emit(msg) |
---|
[9e426c1] | 339 | |
---|
[8353d90] | 340 | def showWelcomeMessage(self): |
---|
| 341 | """ Show the Welcome panel """ |
---|
| 342 | self._workspace.workspace.addSubWindow(self.welcomePanel) |
---|
| 343 | self.welcomePanel.show() |
---|
| 344 | |
---|
[f721030] | 345 | def addCallbacks(self): |
---|
| 346 | """ |
---|
[9e426c1] | 347 | Method defining all signal connections for the gui manager |
---|
[f721030] | 348 | """ |
---|
[0cd8612] | 349 | self.communicate = GuiUtils.Communicate() |
---|
[9d266d2] | 350 | self.communicate.fileDataReceivedSignal.connect(self.fileWasRead) |
---|
[f721030] | 351 | self.communicate.statusBarUpdateSignal.connect(self.updateStatusBar) |
---|
| 352 | self.communicate.updatePerspectiveWithDataSignal.connect(self.updatePerspective) |
---|
[e540cd2] | 353 | self.communicate.progressBarUpdateSignal.connect(self.updateProgressBar) |
---|
[83d6249] | 354 | self.communicate.perspectiveChangedSignal.connect(self.perspectiveChanged) |
---|
[cbcdd2c] | 355 | self.communicate.updateTheoryFromPerspectiveSignal.connect(self.updateTheoryFromPerspective) |
---|
[d48cc19] | 356 | self.communicate.plotRequestedSignal.connect(self.showPlot) |
---|
[3b3b40b] | 357 | self.communicate.plotFromFilenameSignal.connect(self.showPlotFromFilename) |
---|
[d5c5d3d] | 358 | self.communicate.updateModelFromDataOperationPanelSignal.connect(self.updateModelFromDataOperationPanel) |
---|
[f721030] | 359 | |
---|
| 360 | def addTriggers(self): |
---|
| 361 | """ |
---|
| 362 | Trigger definitions for all menu/toolbar actions. |
---|
| 363 | """ |
---|
| 364 | # File |
---|
| 365 | self._workspace.actionLoadData.triggered.connect(self.actionLoadData) |
---|
| 366 | self._workspace.actionLoad_Data_Folder.triggered.connect(self.actionLoad_Data_Folder) |
---|
| 367 | self._workspace.actionOpen_Project.triggered.connect(self.actionOpen_Project) |
---|
| 368 | self._workspace.actionOpen_Analysis.triggered.connect(self.actionOpen_Analysis) |
---|
| 369 | self._workspace.actionSave.triggered.connect(self.actionSave) |
---|
| 370 | self._workspace.actionSave_Analysis.triggered.connect(self.actionSave_Analysis) |
---|
| 371 | self._workspace.actionQuit.triggered.connect(self.actionQuit) |
---|
| 372 | # Edit |
---|
| 373 | self._workspace.actionUndo.triggered.connect(self.actionUndo) |
---|
| 374 | self._workspace.actionRedo.triggered.connect(self.actionRedo) |
---|
| 375 | self._workspace.actionCopy.triggered.connect(self.actionCopy) |
---|
| 376 | self._workspace.actionPaste.triggered.connect(self.actionPaste) |
---|
| 377 | self._workspace.actionReport.triggered.connect(self.actionReport) |
---|
| 378 | self._workspace.actionReset.triggered.connect(self.actionReset) |
---|
| 379 | self._workspace.actionExcel.triggered.connect(self.actionExcel) |
---|
| 380 | self._workspace.actionLatex.triggered.connect(self.actionLatex) |
---|
| 381 | |
---|
| 382 | # View |
---|
| 383 | self._workspace.actionShow_Grid_Window.triggered.connect(self.actionShow_Grid_Window) |
---|
| 384 | self._workspace.actionHide_Toolbar.triggered.connect(self.actionHide_Toolbar) |
---|
| 385 | self._workspace.actionStartup_Settings.triggered.connect(self.actionStartup_Settings) |
---|
| 386 | self._workspace.actionCategry_Manager.triggered.connect(self.actionCategry_Manager) |
---|
| 387 | # Tools |
---|
| 388 | self._workspace.actionData_Operation.triggered.connect(self.actionData_Operation) |
---|
| 389 | self._workspace.actionSLD_Calculator.triggered.connect(self.actionSLD_Calculator) |
---|
| 390 | self._workspace.actionDensity_Volume_Calculator.triggered.connect(self.actionDensity_Volume_Calculator) |
---|
[363fbfa] | 391 | self._workspace.actionKeissig_Calculator.triggered.connect(self.actionKiessig_Calculator) |
---|
| 392 | #self._workspace.actionKIESSING_Calculator.triggered.connect(self.actionKIESSING_Calculator) |
---|
[f721030] | 393 | self._workspace.actionSlit_Size_Calculator.triggered.connect(self.actionSlit_Size_Calculator) |
---|
| 394 | self._workspace.actionSAS_Resolution_Estimator.triggered.connect(self.actionSAS_Resolution_Estimator) |
---|
| 395 | self._workspace.actionGeneric_Scattering_Calculator.triggered.connect(self.actionGeneric_Scattering_Calculator) |
---|
| 396 | self._workspace.actionPython_Shell_Editor.triggered.connect(self.actionPython_Shell_Editor) |
---|
| 397 | self._workspace.actionImage_Viewer.triggered.connect(self.actionImage_Viewer) |
---|
| 398 | # Fitting |
---|
| 399 | self._workspace.actionNew_Fit_Page.triggered.connect(self.actionNew_Fit_Page) |
---|
| 400 | self._workspace.actionConstrained_Fit.triggered.connect(self.actionConstrained_Fit) |
---|
| 401 | self._workspace.actionCombine_Batch_Fit.triggered.connect(self.actionCombine_Batch_Fit) |
---|
| 402 | self._workspace.actionFit_Options.triggered.connect(self.actionFit_Options) |
---|
[06ce180] | 403 | self._workspace.actionGPU_Options.triggered.connect(self.actionGPU_Options) |
---|
[f721030] | 404 | self._workspace.actionFit_Results.triggered.connect(self.actionFit_Results) |
---|
| 405 | self._workspace.actionChain_Fitting.triggered.connect(self.actionChain_Fitting) |
---|
[3b3b40b] | 406 | self._workspace.actionAdd_Custom_Model.triggered.connect(self.actionAdd_Custom_Model) |
---|
[f721030] | 407 | self._workspace.actionEdit_Custom_Model.triggered.connect(self.actionEdit_Custom_Model) |
---|
[3b3b40b] | 408 | self._workspace.actionManage_Custom_Models.triggered.connect(self.actionManage_Custom_Models) |
---|
[f721030] | 409 | # Window |
---|
| 410 | self._workspace.actionCascade.triggered.connect(self.actionCascade) |
---|
[e540cd2] | 411 | self._workspace.actionTile.triggered.connect(self.actionTile) |
---|
[f721030] | 412 | self._workspace.actionArrange_Icons.triggered.connect(self.actionArrange_Icons) |
---|
| 413 | self._workspace.actionNext.triggered.connect(self.actionNext) |
---|
| 414 | self._workspace.actionPrevious.triggered.connect(self.actionPrevious) |
---|
| 415 | # Analysis |
---|
| 416 | self._workspace.actionFitting.triggered.connect(self.actionFitting) |
---|
| 417 | self._workspace.actionInversion.triggered.connect(self.actionInversion) |
---|
| 418 | self._workspace.actionInvariant.triggered.connect(self.actionInvariant) |
---|
[8ac3551] | 419 | self._workspace.actionCorfunc.triggered.connect(self.actionCorfunc) |
---|
[f721030] | 420 | # Help |
---|
| 421 | self._workspace.actionDocumentation.triggered.connect(self.actionDocumentation) |
---|
| 422 | self._workspace.actionTutorial.triggered.connect(self.actionTutorial) |
---|
| 423 | self._workspace.actionAcknowledge.triggered.connect(self.actionAcknowledge) |
---|
| 424 | self._workspace.actionAbout.triggered.connect(self.actionAbout) |
---|
| 425 | self._workspace.actionCheck_for_update.triggered.connect(self.actionCheck_for_update) |
---|
| 426 | |
---|
| 427 | #============ FILE ================= |
---|
| 428 | def actionLoadData(self): |
---|
| 429 | """ |
---|
[9e426c1] | 430 | Menu File/Load Data File(s) |
---|
[f721030] | 431 | """ |
---|
[5032ea68] | 432 | self.filesWidget.loadFile() |
---|
[f721030] | 433 | |
---|
| 434 | def actionLoad_Data_Folder(self): |
---|
| 435 | """ |
---|
[9e426c1] | 436 | Menu File/Load Data Folder |
---|
[f721030] | 437 | """ |
---|
[5032ea68] | 438 | self.filesWidget.loadFolder() |
---|
[f721030] | 439 | |
---|
| 440 | def actionOpen_Project(self): |
---|
| 441 | """ |
---|
[630155bd] | 442 | Menu Open Project |
---|
[f721030] | 443 | """ |
---|
[630155bd] | 444 | self.filesWidget.loadProject() |
---|
[f721030] | 445 | |
---|
| 446 | def actionOpen_Analysis(self): |
---|
| 447 | """ |
---|
| 448 | """ |
---|
| 449 | print("actionOpen_Analysis TRIGGERED") |
---|
| 450 | pass |
---|
| 451 | |
---|
| 452 | def actionSave(self): |
---|
| 453 | """ |
---|
[630155bd] | 454 | Menu Save Project |
---|
[f721030] | 455 | """ |
---|
[630155bd] | 456 | self.filesWidget.saveProject() |
---|
[f721030] | 457 | |
---|
| 458 | def actionSave_Analysis(self): |
---|
| 459 | """ |
---|
| 460 | """ |
---|
| 461 | print("actionSave_Analysis TRIGGERED") |
---|
[481ff26] | 462 | |
---|
[f721030] | 463 | pass |
---|
| 464 | |
---|
| 465 | def actionQuit(self): |
---|
| 466 | """ |
---|
[1042dba] | 467 | Close the reactor, exit the application. |
---|
[f721030] | 468 | """ |
---|
[9e426c1] | 469 | self.quitApplication() |
---|
[f721030] | 470 | |
---|
| 471 | #============ EDIT ================= |
---|
| 472 | def actionUndo(self): |
---|
| 473 | """ |
---|
| 474 | """ |
---|
| 475 | print("actionUndo TRIGGERED") |
---|
| 476 | pass |
---|
| 477 | |
---|
| 478 | def actionRedo(self): |
---|
| 479 | """ |
---|
| 480 | """ |
---|
| 481 | print("actionRedo TRIGGERED") |
---|
| 482 | pass |
---|
| 483 | |
---|
| 484 | def actionCopy(self): |
---|
| 485 | """ |
---|
| 486 | """ |
---|
| 487 | print("actionCopy TRIGGERED") |
---|
| 488 | pass |
---|
| 489 | |
---|
| 490 | def actionPaste(self): |
---|
| 491 | """ |
---|
| 492 | """ |
---|
| 493 | print("actionPaste TRIGGERED") |
---|
| 494 | pass |
---|
| 495 | |
---|
| 496 | def actionReport(self): |
---|
| 497 | """ |
---|
| 498 | """ |
---|
| 499 | print("actionReport TRIGGERED") |
---|
| 500 | pass |
---|
| 501 | |
---|
| 502 | def actionReset(self): |
---|
| 503 | """ |
---|
| 504 | """ |
---|
[0cd8612] | 505 | logging.warning(" *** actionOpen_Analysis logging *******") |
---|
| 506 | print("actionReset print TRIGGERED") |
---|
| 507 | sys.stderr.write("STDERR - TRIGGERED") |
---|
[f721030] | 508 | pass |
---|
| 509 | |
---|
| 510 | def actionExcel(self): |
---|
| 511 | """ |
---|
| 512 | """ |
---|
| 513 | print("actionExcel TRIGGERED") |
---|
| 514 | pass |
---|
| 515 | |
---|
| 516 | def actionLatex(self): |
---|
| 517 | """ |
---|
| 518 | """ |
---|
| 519 | print("actionLatex TRIGGERED") |
---|
| 520 | pass |
---|
| 521 | |
---|
| 522 | #============ VIEW ================= |
---|
| 523 | def actionShow_Grid_Window(self): |
---|
| 524 | """ |
---|
| 525 | """ |
---|
| 526 | print("actionShow_Grid_Window TRIGGERED") |
---|
| 527 | pass |
---|
| 528 | |
---|
| 529 | def actionHide_Toolbar(self): |
---|
| 530 | """ |
---|
[e540cd2] | 531 | Toggle toolbar vsibility |
---|
[f721030] | 532 | """ |
---|
[e540cd2] | 533 | if self._workspace.toolBar.isVisible(): |
---|
| 534 | self._workspace.actionHide_Toolbar.setText("Show Toolbar") |
---|
| 535 | self._workspace.toolBar.setVisible(False) |
---|
| 536 | else: |
---|
| 537 | self._workspace.actionHide_Toolbar.setText("Hide Toolbar") |
---|
| 538 | self._workspace.toolBar.setVisible(True) |
---|
[f721030] | 539 | pass |
---|
| 540 | |
---|
| 541 | def actionStartup_Settings(self): |
---|
| 542 | """ |
---|
| 543 | """ |
---|
| 544 | print("actionStartup_Settings TRIGGERED") |
---|
| 545 | pass |
---|
| 546 | |
---|
| 547 | def actionCategry_Manager(self): |
---|
| 548 | """ |
---|
| 549 | """ |
---|
| 550 | print("actionCategry_Manager TRIGGERED") |
---|
| 551 | pass |
---|
| 552 | |
---|
| 553 | #============ TOOLS ================= |
---|
| 554 | def actionData_Operation(self): |
---|
| 555 | """ |
---|
| 556 | """ |
---|
[f0bb711] | 557 | self.communicate.sendDataToPanelSignal.emit(self._data_manager.get_all_data()) |
---|
[d5c5d3d] | 558 | |
---|
| 559 | self.DataOperation.show() |
---|
[f721030] | 560 | |
---|
| 561 | def actionSLD_Calculator(self): |
---|
| 562 | """ |
---|
| 563 | """ |
---|
[1d85b5e] | 564 | self.SLDCalculator.show() |
---|
[f721030] | 565 | |
---|
| 566 | def actionDensity_Volume_Calculator(self): |
---|
| 567 | """ |
---|
| 568 | """ |
---|
[1d85b5e] | 569 | self.DVCalculator.show() |
---|
[f721030] | 570 | |
---|
[363fbfa] | 571 | def actionKiessig_Calculator(self): |
---|
| 572 | """ |
---|
| 573 | """ |
---|
| 574 | #self.DVCalculator.show() |
---|
| 575 | self.KIESSIGCalculator.show() |
---|
| 576 | |
---|
[f721030] | 577 | def actionSlit_Size_Calculator(self): |
---|
| 578 | """ |
---|
| 579 | """ |
---|
[a8ec5b1] | 580 | self.SlitSizeCalculator.show() |
---|
[f721030] | 581 | |
---|
| 582 | def actionSAS_Resolution_Estimator(self): |
---|
| 583 | """ |
---|
| 584 | """ |
---|
[01cda57] | 585 | self.ResolutionCalculator.show() |
---|
[f721030] | 586 | |
---|
| 587 | def actionGeneric_Scattering_Calculator(self): |
---|
| 588 | """ |
---|
| 589 | """ |
---|
[28a09b0] | 590 | self.GENSASCalculator.show() |
---|
[f721030] | 591 | |
---|
| 592 | def actionPython_Shell_Editor(self): |
---|
| 593 | """ |
---|
[1af348e] | 594 | Display the Jupyter console as a docked widget. |
---|
[f721030] | 595 | """ |
---|
[fef38e8] | 596 | # Import moved here for startup performance reasons |
---|
| 597 | from sas.qtgui.Utilities.IPythonWidget import IPythonWidget |
---|
[1af348e] | 598 | terminal = IPythonWidget() |
---|
| 599 | |
---|
| 600 | # Add the console window as another docked widget |
---|
[4992ff2] | 601 | self.ipDockWidget = QDockWidget("IPython", self._workspace) |
---|
[1af348e] | 602 | self.ipDockWidget.setObjectName("IPythonDockWidget") |
---|
| 603 | self.ipDockWidget.setWidget(terminal) |
---|
[fbfc488] | 604 | self._workspace.addDockWidget(Qt.RightDockWidgetArea, self.ipDockWidget) |
---|
[f721030] | 605 | |
---|
| 606 | def actionImage_Viewer(self): |
---|
| 607 | """ |
---|
| 608 | """ |
---|
| 609 | print("actionImage_Viewer TRIGGERED") |
---|
| 610 | pass |
---|
| 611 | |
---|
| 612 | #============ FITTING ================= |
---|
| 613 | def actionNew_Fit_Page(self): |
---|
| 614 | """ |
---|
[60af928] | 615 | Add a new, empty Fit page in the fitting perspective. |
---|
[f721030] | 616 | """ |
---|
[60af928] | 617 | # Make sure the perspective is correct |
---|
| 618 | per = self.perspective() |
---|
| 619 | if not isinstance(per, FittingWindow): |
---|
| 620 | return |
---|
| 621 | per.addFit(None) |
---|
[f721030] | 622 | |
---|
| 623 | def actionConstrained_Fit(self): |
---|
| 624 | """ |
---|
[676f137] | 625 | Add a new Constrained and Simult. Fit page in the fitting perspective. |
---|
[f721030] | 626 | """ |
---|
[676f137] | 627 | per = self.perspective() |
---|
| 628 | if not isinstance(per, FittingWindow): |
---|
| 629 | return |
---|
| 630 | per.addConstraintTab() |
---|
[f721030] | 631 | |
---|
| 632 | def actionCombine_Batch_Fit(self): |
---|
| 633 | """ |
---|
| 634 | """ |
---|
| 635 | print("actionCombine_Batch_Fit TRIGGERED") |
---|
| 636 | pass |
---|
| 637 | |
---|
| 638 | def actionFit_Options(self): |
---|
| 639 | """ |
---|
| 640 | """ |
---|
[2d0e0c1] | 641 | if getattr(self._current_perspective, "fit_options_widget"): |
---|
| 642 | self._current_perspective.fit_options_widget.show() |
---|
[f721030] | 643 | pass |
---|
| 644 | |
---|
[06ce180] | 645 | def actionGPU_Options(self): |
---|
| 646 | """ |
---|
[9863343] | 647 | Load the OpenCL selection dialog if the fitting perspective is active |
---|
[06ce180] | 648 | """ |
---|
[9863343] | 649 | if hasattr(self._current_perspective, "gpu_options_widget"): |
---|
[06ce180] | 650 | self._current_perspective.gpu_options_widget.show() |
---|
| 651 | pass |
---|
| 652 | |
---|
[f721030] | 653 | def actionFit_Results(self): |
---|
| 654 | """ |
---|
| 655 | """ |
---|
| 656 | print("actionFit_Results TRIGGERED") |
---|
| 657 | pass |
---|
| 658 | |
---|
| 659 | def actionChain_Fitting(self): |
---|
| 660 | """ |
---|
| 661 | """ |
---|
| 662 | print("actionChain_Fitting TRIGGERED") |
---|
| 663 | pass |
---|
| 664 | |
---|
[3b3b40b] | 665 | def actionAdd_Custom_Model(self): |
---|
| 666 | """ |
---|
| 667 | """ |
---|
| 668 | self.model_editor = TabbedModelEditor(self) |
---|
| 669 | self.model_editor.show() |
---|
| 670 | |
---|
[f721030] | 671 | def actionEdit_Custom_Model(self): |
---|
| 672 | """ |
---|
| 673 | """ |
---|
[3b3b40b] | 674 | self.model_editor = TabbedModelEditor(self, edit_only=True) |
---|
| 675 | self.model_editor.show() |
---|
| 676 | |
---|
| 677 | def actionManage_Custom_Models(self): |
---|
| 678 | """ |
---|
| 679 | """ |
---|
| 680 | self.model_manager = PluginManager(self) |
---|
| 681 | self.model_manager.show() |
---|
[f721030] | 682 | |
---|
| 683 | #============ ANALYSIS ================= |
---|
| 684 | def actionFitting(self): |
---|
| 685 | """ |
---|
[9e54199] | 686 | Change to the Fitting perspective |
---|
[f721030] | 687 | """ |
---|
[9e54199] | 688 | self.perspectiveChanged("Fitting") |
---|
[8ac3551] | 689 | # Notify other widgets |
---|
| 690 | self.filesWidget.onAnalysisUpdate("Fitting") |
---|
[f721030] | 691 | |
---|
| 692 | def actionInversion(self): |
---|
| 693 | """ |
---|
[9e54199] | 694 | Change to the Inversion perspective |
---|
[f721030] | 695 | """ |
---|
[d4881f6a] | 696 | self.perspectiveChanged("Inversion") |
---|
[8ac3551] | 697 | self.filesWidget.onAnalysisUpdate("Inversion") |
---|
[f721030] | 698 | |
---|
| 699 | def actionInvariant(self): |
---|
| 700 | """ |
---|
[9e54199] | 701 | Change to the Invariant perspective |
---|
[f721030] | 702 | """ |
---|
[9e54199] | 703 | self.perspectiveChanged("Invariant") |
---|
[8ac3551] | 704 | self.filesWidget.onAnalysisUpdate("Invariant") |
---|
| 705 | |
---|
| 706 | def actionCorfunc(self): |
---|
| 707 | """ |
---|
| 708 | Change to the Corfunc perspective |
---|
| 709 | """ |
---|
| 710 | self.perspectiveChanged("Corfunc") |
---|
| 711 | self.filesWidget.onAnalysisUpdate("Corfunc") |
---|
[f721030] | 712 | |
---|
| 713 | #============ WINDOW ================= |
---|
| 714 | def actionCascade(self): |
---|
| 715 | """ |
---|
[e540cd2] | 716 | Arranges all the child windows in a cascade pattern. |
---|
[f721030] | 717 | """ |
---|
[e540cd2] | 718 | self._workspace.workspace.cascade() |
---|
[f721030] | 719 | |
---|
[e540cd2] | 720 | def actionTile(self): |
---|
[f721030] | 721 | """ |
---|
[e540cd2] | 722 | Tile workspace windows |
---|
[f721030] | 723 | """ |
---|
[e540cd2] | 724 | self._workspace.workspace.tile() |
---|
[f721030] | 725 | |
---|
| 726 | def actionArrange_Icons(self): |
---|
| 727 | """ |
---|
[e540cd2] | 728 | Arranges all iconified windows at the bottom of the workspace |
---|
[f721030] | 729 | """ |
---|
[e540cd2] | 730 | self._workspace.workspace.arrangeIcons() |
---|
[f721030] | 731 | |
---|
| 732 | def actionNext(self): |
---|
| 733 | """ |
---|
[e540cd2] | 734 | Gives the input focus to the next window in the list of child windows. |
---|
[f721030] | 735 | """ |
---|
[e540cd2] | 736 | self._workspace.workspace.activateNextWindow() |
---|
[f721030] | 737 | |
---|
| 738 | def actionPrevious(self): |
---|
| 739 | """ |
---|
[e540cd2] | 740 | Gives the input focus to the previous window in the list of child windows. |
---|
[f721030] | 741 | """ |
---|
[e540cd2] | 742 | self._workspace.workspace.activatePreviousWindow() |
---|
[f721030] | 743 | |
---|
| 744 | #============ HELP ================= |
---|
| 745 | def actionDocumentation(self): |
---|
| 746 | """ |
---|
[9e426c1] | 747 | Display the documentation |
---|
| 748 | |
---|
| 749 | TODO: use QNetworkAccessManager to assure _helpLocation is valid |
---|
[f721030] | 750 | """ |
---|
[e90988c] | 751 | self.showHelp(self._helpLocation) |
---|
[f721030] | 752 | |
---|
| 753 | def actionTutorial(self): |
---|
| 754 | """ |
---|
[9e426c1] | 755 | Open the tutorial PDF file with default PDF renderer |
---|
[f721030] | 756 | """ |
---|
[9e426c1] | 757 | # Not terribly safe here. Shell injection warning. |
---|
| 758 | # isfile() helps but this probably needs a better solution. |
---|
| 759 | if os.path.isfile(self._tutorialLocation): |
---|
| 760 | result = subprocess.Popen([self._tutorialLocation], shell=True) |
---|
[f721030] | 761 | |
---|
| 762 | def actionAcknowledge(self): |
---|
| 763 | """ |
---|
[9e426c1] | 764 | Open the Acknowledgements widget |
---|
[f721030] | 765 | """ |
---|
[9e426c1] | 766 | self.ackWidget.show() |
---|
[f721030] | 767 | |
---|
| 768 | def actionAbout(self): |
---|
| 769 | """ |
---|
[9e426c1] | 770 | Open the About box |
---|
[f721030] | 771 | """ |
---|
[f82ab8c] | 772 | # Update the about box with current version and stuff |
---|
| 773 | |
---|
| 774 | # TODO: proper sizing |
---|
| 775 | self.aboutWidget.show() |
---|
[f721030] | 776 | |
---|
| 777 | def actionCheck_for_update(self): |
---|
| 778 | """ |
---|
[9e426c1] | 779 | Menu Help/Check for Update |
---|
[f721030] | 780 | """ |
---|
[9e426c1] | 781 | self.checkUpdate() |
---|
| 782 | |
---|
[cbcdd2c] | 783 | def updateTheoryFromPerspective(self, index): |
---|
| 784 | """ |
---|
| 785 | Catch the theory update signal from a perspective |
---|
| 786 | Send the request to the DataExplorer for updating the theory model. |
---|
| 787 | """ |
---|
| 788 | self.filesWidget.updateTheoryFromPerspective(index) |
---|
| 789 | |
---|
[d5c5d3d] | 790 | def updateModelFromDataOperationPanel(self, new_item, new_datalist_item): |
---|
| 791 | """ |
---|
| 792 | :param new_item: item to be added to list of loaded files |
---|
| 793 | :param new_datalist_item: |
---|
| 794 | """ |
---|
[4992ff2] | 795 | if not isinstance(new_item, QStandardItem) or \ |
---|
[d5c5d3d] | 796 | not isinstance(new_datalist_item, dict): |
---|
| 797 | msg = "Wrong data type returned from calculations." |
---|
[b3e8629] | 798 | raise AttributeError(msg) |
---|
[d5c5d3d] | 799 | |
---|
| 800 | self.filesWidget.model.appendRow(new_item) |
---|
| 801 | self._data_manager.add_data(new_datalist_item) |
---|
| 802 | |
---|
[3b3b40b] | 803 | def showPlotFromFilename(self, filename): |
---|
| 804 | """ |
---|
| 805 | Pass the show plot request to the data explorer |
---|
| 806 | """ |
---|
| 807 | if hasattr(self, "filesWidget"): |
---|
| 808 | self.filesWidget.displayFile(filename=filename, is_data=True) |
---|
| 809 | |
---|
[d48cc19] | 810 | def showPlot(self, plot): |
---|
| 811 | """ |
---|
| 812 | Pass the show plot request to the data explorer |
---|
| 813 | """ |
---|
| 814 | if hasattr(self, "filesWidget"): |
---|
| 815 | self.filesWidget.displayData(plot) |
---|
[9e54199] | 816 | |
---|
| 817 | def uncheckAllMenuItems(self, menuObject): |
---|
| 818 | """ |
---|
| 819 | Uncheck all options in a given menu |
---|
| 820 | """ |
---|
| 821 | menuObjects = menuObject.actions() |
---|
| 822 | |
---|
| 823 | for menuItem in menuObjects: |
---|
| 824 | menuItem.setChecked(False) |
---|
| 825 | |
---|
| 826 | def checkAnalysisOption(self, analysisMenuOption): |
---|
| 827 | """ |
---|
| 828 | Unchecks all the items in the analysis menu and checks the item passed |
---|
| 829 | """ |
---|
| 830 | self.uncheckAllMenuItems(self._workspace.menuAnalysis) |
---|
| 831 | analysisMenuOption.setChecked(True) |
---|
| 832 | |
---|
| 833 | def clearPerspectiveMenubarOptions(self, perspective): |
---|
| 834 | """ |
---|
| 835 | When closing a perspective, clears the menu bar |
---|
| 836 | """ |
---|
| 837 | for menuItem in self._workspace.menuAnalysis.actions(): |
---|
| 838 | menuItem.setChecked(False) |
---|
| 839 | |
---|
| 840 | if isinstance(self._current_perspective, Perspectives.PERSPECTIVES["Fitting"]): |
---|
| 841 | self._workspace.menubar.removeAction(self._workspace.menuFitting.menuAction()) |
---|
| 842 | |
---|
| 843 | def setupPerspectiveMenubarOptions(self, perspective): |
---|
| 844 | """ |
---|
| 845 | When setting a perspective, sets up the menu bar |
---|
| 846 | """ |
---|
| 847 | if isinstance(perspective, Perspectives.PERSPECTIVES["Fitting"]): |
---|
| 848 | self.checkAnalysisOption(self._workspace.actionFitting) |
---|
| 849 | # Put the fitting menu back in |
---|
| 850 | # This is a bit involved but it is needed to preserve the menu ordering |
---|
| 851 | self._workspace.menubar.removeAction(self._workspace.menuWindow.menuAction()) |
---|
| 852 | self._workspace.menubar.removeAction(self._workspace.menuHelp.menuAction()) |
---|
| 853 | self._workspace.menubar.addAction(self._workspace.menuFitting.menuAction()) |
---|
| 854 | self._workspace.menubar.addAction(self._workspace.menuWindow.menuAction()) |
---|
| 855 | self._workspace.menubar.addAction(self._workspace.menuHelp.menuAction()) |
---|
| 856 | elif isinstance(perspective, Perspectives.PERSPECTIVES["Invariant"]): |
---|
| 857 | self.checkAnalysisOption(self._workspace.actionInvariant) |
---|
[8ac3551] | 858 | elif isinstance(perspective, Perspectives.PERSPECTIVES["Inversion"]): |
---|
| 859 | self.checkAnalysisOption(self._workspace.actionInversion) |
---|
| 860 | elif isinstance(perspective, Perspectives.PERSPECTIVES["Corfunc"]): |
---|
| 861 | self.checkAnalysisOption(self._workspace.actionCorfunc) |
---|