source: sasview/src/sas/qtgui/GuiManager.py @ 9f25bce

ESS_GUIESS_GUI_DocsESS_GUI_batch_fittingESS_GUI_bumps_abstractionESS_GUI_iss1116ESS_GUI_iss879ESS_GUI_iss959ESS_GUI_openclESS_GUI_orderingESS_GUI_sync_sascalc
Last change on this file since 9f25bce was 6fd4e36, checked in by Piotr Rozyczko <rozyczko@…>, 8 years ago

Chi2 display + minor refactoring

  • Property mode set to 100644
File size: 24.0 KB
RevLine 
[f721030]1import sys
[0cd8612]2import os
[9e426c1]3import subprocess
4import logging
5import json
6import webbrowser
[f721030]7
8from PyQt4 import QtCore
9from PyQt4 import QtGui
[1042dba]10from PyQt4 import QtWebKit
11
12from twisted.internet import reactor
[f721030]13# General SAS imports
[31c5b58]14
[1042dba]15from sas.sasgui.guiframe.data_manager import DataManager
[9e426c1]16from sas.sasgui.guiframe.proxy import Connection
[31c5b58]17from sas.qtgui.SasviewLogger import XStream
18import sas.qtgui.LocalConfig as LocalConfig
19import sas.qtgui.GuiUtils as GuiUtils
20from sas.qtgui.UI.AcknowledgementsUI import Ui_Acknowledgements
21from sas.qtgui.AboutBox import AboutBox
22from sas.qtgui.IPythonWidget import IPythonWidget
23from sas.qtgui.WelcomePanel import WelcomePanel
[9e426c1]24
[31c5b58]25from sas.qtgui.SldPanel import SldPanel
26from sas.qtgui.DensityPanel import DensityPanel
[363fbfa]27from sas.qtgui.KiessigPanel import KiessigPanel
[a8ec5b1]28from sas.qtgui.SlitSizeCalculator import SlitSizeCalculator
[f721030]29
30# Perspectives
[83d6249]31import Perspectives
[31c5b58]32from sas.qtgui.Perspectives.Invariant.InvariantPerspective import InvariantWindow
[83d6249]33from sas.qtgui.Perspectives.Fitting.FittingPerspective import FittingWindow
[31c5b58]34from sas.qtgui.DataExplorer import DataExplorerWindow
[f51ed67]35
36class Acknowledgements(QtGui.QDialog, Ui_Acknowledgements):
37    def __init__(self, parent=None):
38        QtGui.QDialog.__init__(self, parent)
39        self.setupUi(self)
[f721030]40
41class GuiManager(object):
42    """
43    Main SasView window functionality
44    """
[31c5b58]45    ## TODO: CHANGE FOR SHIPPED PATH IN RELEASE
46    HELP_DIRECTORY_LOCATION = "docs/sphinx-docs/build/html"
[9e426c1]47
[6fd4e36]48    def __init__(self, parent=None):
[f721030]49        """
[257bd57]50        Initialize the manager as a child of MainWindow.
[f721030]51        """
[6fd4e36]52        self._workspace = parent
[f721030]53        self._parent = parent
54
[6fd4e36]55        # Reactor - singleton
[f721030]56        self.setReactor(reactor)
57
58        # Add signal callbacks
59        self.addCallbacks()
60
61        # Create the data manager
[1042dba]62        # TODO: pull out all required methods from DataManager and reimplement
63        self._data_manager = DataManager()
[f721030]64
65        # Create action triggers
66        self.addTriggers()
67
68        # Populate menus with dynamic data
[481ff26]69        #
[f721030]70        # Analysis/Perspectives - potentially
71        # Window/current windows
72        #
73        # Widgets
74        #
[5236449]75        # Current displayed perspective
76        self._current_perspective = None
77
78        # Invoke the initial perspective
79        self.perspectiveChanged("Fitting")
80
[0cd8612]81        self.addWidgets()
[f721030]82
[0cd8612]83        # Fork off logging messages to the Log Window
[8cb6cd6]84        XStream.stdout().messageWritten.connect(self.listWidget.insertPlainText)
85        XStream.stderr().messageWritten.connect(self.listWidget.insertPlainText)
86
[0cd8612]87        # Log the start of the session
88        logging.info(" --- SasView session started ---")
89        # Log the python version
90        logging.info("Python: %s" % sys.version)
[9e426c1]91
[e540cd2]92        # Set up the status bar
93        self.statusBarSetup()
[9e426c1]94
[f721030]95        # Show the Welcome panel
96        self.welcomePanel = WelcomePanel()
97        self._workspace.workspace.addWindow(self.welcomePanel)
98
[1042dba]99        # Current help file
100        self._helpView = QtWebKit.QWebView()
[9e426c1]101        # Needs URL like path, so no path.join() here
102        self._helpLocation = self.HELP_DIRECTORY_LOCATION + "/index.html"
103
104        # Current tutorial location
[31c5b58]105        self._tutorialLocation = os.path.abspath(os.path.join(self.HELP_DIRECTORY_LOCATION,
[9e426c1]106                                              "_downloads",
[31c5b58]107                                              "Tutorial.pdf"))
[0cd8612]108    def addWidgets(self):
109        """
110        Populate the main window with widgets
111
112        TODO: overwrite close() on Log and DR widgets so they can be hidden/shown
113        on request
114        """
115        # Add FileDialog widget as docked
[630155bd]116        self.filesWidget = DataExplorerWindow(self._parent, self, manager=self._data_manager)
[0cd8612]117
118        self.dockedFilesWidget = QtGui.QDockWidget("Data Explorer", self._workspace)
119        self.dockedFilesWidget.setWidget(self.filesWidget)
[83d6249]120
[0cd8612]121        # Disable maximize/minimize and close buttons
122        self.dockedFilesWidget.setFeatures(QtGui.QDockWidget.NoDockWidgetFeatures)
123        self._workspace.addDockWidget(QtCore.Qt.LeftDockWidgetArea,
124                                      self.dockedFilesWidget)
125
126        # Add the console window as another docked widget
127        self.logDockWidget = QtGui.QDockWidget("Log Explorer", self._workspace)
128        self.logDockWidget.setObjectName("LogDockWidget")
129        self.listWidget = QtGui.QTextBrowser()
130        self.logDockWidget.setWidget(self.listWidget)
131        self._workspace.addDockWidget(QtCore.Qt.BottomDockWidgetArea,
132                                      self.logDockWidget)
133
134        # Add other, minor widgets
135        self.ackWidget = Acknowledgements()
136        self.aboutWidget = AboutBox()
137
[1d85b5e]138        # Add calculators - floating for usability
139        self.SLDCalculator = SldPanel(self)
140        self.DVCalculator = DensityPanel(self)
[363fbfa]141        #self.KIESSIGCalculator = DensityPanel(self)#KiessigPanel(self)
[a8ec5b1]142        self.KIESSIGCalculator = KiessigPanel(self)
[abc5e70]143        self.SlitSizeCalculator = SlitSizeCalculator(self)
[83d6249]144
[e540cd2]145    def statusBarSetup(self):
146        """
147        Define the status bar.
148        | <message label> .... | Progress Bar |
149
150        Progress bar invisible until explicitly shown
151        """
152        self.progress = QtGui.QProgressBar()
153        self._workspace.statusbar.setSizeGripEnabled(False)
154
155        self.statusLabel = QtGui.QLabel()
156        self.statusLabel.setText("Welcome to SasView")
[8cb6cd6]157        self._workspace.statusbar.addPermanentWidget(self.statusLabel, 1)
[e540cd2]158        self._workspace.statusbar.addPermanentWidget(self.progress, stretch=0)
[8cb6cd6]159        self.progress.setRange(0, 100)
[e540cd2]160        self.progress.setValue(0)
161        self.progress.setTextVisible(True)
162        self.progress.setVisible(False)
163
[f721030]164    def fileRead(self, data):
165        """
[f82ab8c]166        Callback for fileDataReceivedSignal
[f721030]167        """
168        pass
[481ff26]169
[8cb6cd6]170    def workspace(self):
171        """
172        Accessor for the main window workspace
173        """
174        return self._workspace.workspace
175
[83d6249]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:
[b1e36a3]182            self._current_perspective.setClosable()
[83d6249]183            self._current_perspective.close()
184        # Default perspective
[811bec1]185        self._current_perspective = Perspectives.PERSPECTIVES[str(perspective_name)](parent=self)
[83d6249]186        self._workspace.workspace.addWindow(self._current_perspective)
187        self._current_perspective.show()
188
[f721030]189    def updatePerspective(self, data):
190        """
191        """
192        assert isinstance(data, list)
193        if self._current_perspective is not None:
194            self._current_perspective.setData(data.values())
195        else:
196            msg = "No perspective is currently active."
197            logging.info(msg)
[481ff26]198
199
[f721030]200    def communicator(self):
[257bd57]201        """ Accessor for the communicator """
[f721030]202        return self.communicate
203
204    def reactor(self):
[257bd57]205        """ Accessor for the reactor """
[f721030]206        return self._reactor
207
208    def setReactor(self, reactor):
[257bd57]209        """ Reactor setter """
[f721030]210        self._reactor = reactor
211
212    def perspective(self):
[257bd57]213        """ Accessor for the perspective """
[f721030]214        return self._current_perspective
215
[e540cd2]216    def updateProgressBar(self, value):
217        """
218        Update progress bar with the required value (0-100)
219        """
[8cb6cd6]220        assert -1 <= value <= 100
[e540cd2]221        if value == -1:
222            self.progress.setVisible(False)
223            return
224        if not self.progress.isVisible():
225            self.progress.setTextVisible(True)
226            self.progress.setVisible(True)
227
228        self.progress.setValue(value)
229
[f721030]230    def updateStatusBar(self, text):
231        """
232        """
[e540cd2]233        #self._workspace.statusbar.showMessage(text)
234        self.statusLabel.setText(text)
[f721030]235
[1042dba]236    def createGuiData(self, item, p_file=None):
237        """
238        Access the Data1D -> plottable Data1D conversion
239        """
240        return self._data_manager.create_gui_data(item, p_file)
[f721030]241
242    def setData(self, data):
243        """
244        Sends data to current perspective
245        """
246        if self._current_perspective is not None:
247            self._current_perspective.setData(data.values())
248        else:
249            msg = "Guiframe does not have a current perspective"
250            logging.info(msg)
251
[9e426c1]252    def quitApplication(self):
253        """
254        Close the reactor and exit nicely.
255        """
256        # Display confirmation messagebox
257        quit_msg = "Are you sure you want to exit the application?"
258        reply = QtGui.QMessageBox.question(
[481ff26]259            self._parent,
[7451b88]260            'Information',
[481ff26]261            quit_msg,
262            QtGui.QMessageBox.Yes,
263            QtGui.QMessageBox.No)
[9e426c1]264
265        # Exit if yes
[7451b88]266        if reply == QtGui.QMessageBox.Yes:
267            reactor.callFromThread(reactor.stop)
268            return True
269
270        return False
[9e426c1]271
272    def checkUpdate(self):
273        """
274        Check with the deployment server whether a new version
275        of the application is available.
276        A thread is started for the connecting with the server. The thread calls
277        a call-back method when the current version number has been obtained.
278        """
279        version_info = {"version": "0.0.0"}
280        c = Connection(LocalConfig.__update_URL__, LocalConfig.UPDATE_TIMEOUT)
281        response = c.connect()
282        if response is not None:
283            try:
284                content = response.read().strip()
285                logging.info("Connected to www.sasview.org. Latest version: %s"
286                             % (content))
287                version_info = json.loads(content)
[8cb6cd6]288            except ValueError, ex:
289                logging.info("Failed to connect to www.sasview.org:", ex)
[481ff26]290        self.processVersion(version_info)
291
[f82ab8c]292    def processVersion(self, version_info):
[9e426c1]293        """
294        Call-back method for the process of checking for updates.
295        This methods is called by a VersionThread object once the current
296        version number has been obtained. If the check is being done in the
297        background, the user will not be notified unless there's an update.
298
299        :param version: version string
300        """
301        try:
302            version = version_info["version"]
303            if version == "0.0.0":
304                msg = "Could not connect to the application server."
305                msg += " Please try again later."
306                #self.SetStatusText(msg)
307                self.communicate.statusBarUpdateSignal.emit(msg)
308
309            elif cmp(version, LocalConfig.__version__) > 0:
310                msg = "Version %s is available! " % str(version)
[f82ab8c]311                if "download_url" in version_info:
312                    webbrowser.open(version_info["download_url"])
[9e426c1]313                else:
[f82ab8c]314                    webbrowser.open(LocalConfig.__download_page__)
[9e426c1]315                self.communicate.statusBarUpdateSignal.emit(msg)
316            else:
317                msg = "You have the latest version"
318                msg += " of %s" % str(LocalConfig.__appname__)
319                self.communicate.statusBarUpdateSignal.emit(msg)
320        except:
321            msg = "guiframe: could not get latest application"
322            msg += " version number\n  %s" % sys.exc_value
323            logging.error(msg)
[f82ab8c]324            msg = "Could not connect to the application server."
325            msg += " Please try again later."
326            self.communicate.statusBarUpdateSignal.emit(msg)
[9e426c1]327
[f721030]328    def addCallbacks(self):
329        """
[9e426c1]330        Method defining all signal connections for the gui manager
[f721030]331        """
[0cd8612]332        self.communicate = GuiUtils.Communicate()
[f721030]333        self.communicate.fileDataReceivedSignal.connect(self.fileRead)
334        self.communicate.statusBarUpdateSignal.connect(self.updateStatusBar)
335        self.communicate.updatePerspectiveWithDataSignal.connect(self.updatePerspective)
[e540cd2]336        self.communicate.progressBarUpdateSignal.connect(self.updateProgressBar)
[83d6249]337        self.communicate.perspectiveChangedSignal.connect(self.perspectiveChanged)
[cbcdd2c]338        self.communicate.updateTheoryFromPerspectiveSignal.connect(self.updateTheoryFromPerspective)
[f721030]339
340    def addTriggers(self):
341        """
342        Trigger definitions for all menu/toolbar actions.
343        """
344        # File
345        self._workspace.actionLoadData.triggered.connect(self.actionLoadData)
346        self._workspace.actionLoad_Data_Folder.triggered.connect(self.actionLoad_Data_Folder)
347        self._workspace.actionOpen_Project.triggered.connect(self.actionOpen_Project)
348        self._workspace.actionOpen_Analysis.triggered.connect(self.actionOpen_Analysis)
349        self._workspace.actionSave.triggered.connect(self.actionSave)
350        self._workspace.actionSave_Analysis.triggered.connect(self.actionSave_Analysis)
351        self._workspace.actionQuit.triggered.connect(self.actionQuit)
352        # Edit
353        self._workspace.actionUndo.triggered.connect(self.actionUndo)
354        self._workspace.actionRedo.triggered.connect(self.actionRedo)
355        self._workspace.actionCopy.triggered.connect(self.actionCopy)
356        self._workspace.actionPaste.triggered.connect(self.actionPaste)
357        self._workspace.actionReport.triggered.connect(self.actionReport)
358        self._workspace.actionReset.triggered.connect(self.actionReset)
359        self._workspace.actionExcel.triggered.connect(self.actionExcel)
360        self._workspace.actionLatex.triggered.connect(self.actionLatex)
361
362        # View
363        self._workspace.actionShow_Grid_Window.triggered.connect(self.actionShow_Grid_Window)
364        self._workspace.actionHide_Toolbar.triggered.connect(self.actionHide_Toolbar)
365        self._workspace.actionStartup_Settings.triggered.connect(self.actionStartup_Settings)
366        self._workspace.actionCategry_Manager.triggered.connect(self.actionCategry_Manager)
367        # Tools
368        self._workspace.actionData_Operation.triggered.connect(self.actionData_Operation)
369        self._workspace.actionSLD_Calculator.triggered.connect(self.actionSLD_Calculator)
370        self._workspace.actionDensity_Volume_Calculator.triggered.connect(self.actionDensity_Volume_Calculator)
[363fbfa]371        self._workspace.actionKeissig_Calculator.triggered.connect(self.actionKiessig_Calculator)
372        #self._workspace.actionKIESSING_Calculator.triggered.connect(self.actionKIESSING_Calculator)
[f721030]373        self._workspace.actionSlit_Size_Calculator.triggered.connect(self.actionSlit_Size_Calculator)
374        self._workspace.actionSAS_Resolution_Estimator.triggered.connect(self.actionSAS_Resolution_Estimator)
375        self._workspace.actionGeneric_Scattering_Calculator.triggered.connect(self.actionGeneric_Scattering_Calculator)
376        self._workspace.actionPython_Shell_Editor.triggered.connect(self.actionPython_Shell_Editor)
377        self._workspace.actionImage_Viewer.triggered.connect(self.actionImage_Viewer)
378        # Fitting
379        self._workspace.actionNew_Fit_Page.triggered.connect(self.actionNew_Fit_Page)
380        self._workspace.actionConstrained_Fit.triggered.connect(self.actionConstrained_Fit)
381        self._workspace.actionCombine_Batch_Fit.triggered.connect(self.actionCombine_Batch_Fit)
382        self._workspace.actionFit_Options.triggered.connect(self.actionFit_Options)
383        self._workspace.actionFit_Results.triggered.connect(self.actionFit_Results)
384        self._workspace.actionChain_Fitting.triggered.connect(self.actionChain_Fitting)
385        self._workspace.actionEdit_Custom_Model.triggered.connect(self.actionEdit_Custom_Model)
386        # Window
387        self._workspace.actionCascade.triggered.connect(self.actionCascade)
[e540cd2]388        self._workspace.actionTile.triggered.connect(self.actionTile)
[f721030]389        self._workspace.actionArrange_Icons.triggered.connect(self.actionArrange_Icons)
390        self._workspace.actionNext.triggered.connect(self.actionNext)
391        self._workspace.actionPrevious.triggered.connect(self.actionPrevious)
392        # Analysis
393        self._workspace.actionFitting.triggered.connect(self.actionFitting)
394        self._workspace.actionInversion.triggered.connect(self.actionInversion)
395        self._workspace.actionInvariant.triggered.connect(self.actionInvariant)
396        # Help
397        self._workspace.actionDocumentation.triggered.connect(self.actionDocumentation)
398        self._workspace.actionTutorial.triggered.connect(self.actionTutorial)
399        self._workspace.actionAcknowledge.triggered.connect(self.actionAcknowledge)
400        self._workspace.actionAbout.triggered.connect(self.actionAbout)
401        self._workspace.actionCheck_for_update.triggered.connect(self.actionCheck_for_update)
402
403    #============ FILE =================
404    def actionLoadData(self):
405        """
[9e426c1]406        Menu File/Load Data File(s)
[f721030]407        """
[5032ea68]408        self.filesWidget.loadFile()
[f721030]409
410    def actionLoad_Data_Folder(self):
411        """
[9e426c1]412        Menu File/Load Data Folder
[f721030]413        """
[5032ea68]414        self.filesWidget.loadFolder()
[f721030]415
416    def actionOpen_Project(self):
417        """
[630155bd]418        Menu Open Project
[f721030]419        """
[630155bd]420        self.filesWidget.loadProject()
[f721030]421
422    def actionOpen_Analysis(self):
423        """
424        """
425        print("actionOpen_Analysis TRIGGERED")
426        pass
427
428    def actionSave(self):
429        """
[630155bd]430        Menu Save Project
[f721030]431        """
[630155bd]432        self.filesWidget.saveProject()
[f721030]433
434    def actionSave_Analysis(self):
435        """
436        """
437        print("actionSave_Analysis TRIGGERED")
[481ff26]438
[f721030]439        pass
440
441    def actionQuit(self):
442        """
[1042dba]443        Close the reactor, exit the application.
[f721030]444        """
[9e426c1]445        self.quitApplication()
[f721030]446
447    #============ EDIT =================
448    def actionUndo(self):
449        """
450        """
451        print("actionUndo TRIGGERED")
452        pass
453
454    def actionRedo(self):
455        """
456        """
457        print("actionRedo TRIGGERED")
458        pass
459
460    def actionCopy(self):
461        """
462        """
463        print("actionCopy TRIGGERED")
464        pass
465
466    def actionPaste(self):
467        """
468        """
469        print("actionPaste TRIGGERED")
470        pass
471
472    def actionReport(self):
473        """
474        """
475        print("actionReport TRIGGERED")
476        pass
477
478    def actionReset(self):
479        """
480        """
[0cd8612]481        logging.warning(" *** actionOpen_Analysis logging *******")
482        print("actionReset print TRIGGERED")
483        sys.stderr.write("STDERR - TRIGGERED")
[f721030]484        pass
485
486    def actionExcel(self):
487        """
488        """
489        print("actionExcel TRIGGERED")
490        pass
491
492    def actionLatex(self):
493        """
494        """
495        print("actionLatex TRIGGERED")
496        pass
497
498    #============ VIEW =================
499    def actionShow_Grid_Window(self):
500        """
501        """
502        print("actionShow_Grid_Window TRIGGERED")
503        pass
504
505    def actionHide_Toolbar(self):
506        """
[e540cd2]507        Toggle toolbar vsibility
[f721030]508        """
[e540cd2]509        if self._workspace.toolBar.isVisible():
510            self._workspace.actionHide_Toolbar.setText("Show Toolbar")
511            self._workspace.toolBar.setVisible(False)
512        else:
513            self._workspace.actionHide_Toolbar.setText("Hide Toolbar")
514            self._workspace.toolBar.setVisible(True)
[f721030]515        pass
516
517    def actionStartup_Settings(self):
518        """
519        """
520        print("actionStartup_Settings TRIGGERED")
521        pass
522
523    def actionCategry_Manager(self):
524        """
525        """
526        print("actionCategry_Manager TRIGGERED")
527        pass
528
529    #============ TOOLS =================
530    def actionData_Operation(self):
531        """
532        """
533        print("actionData_Operation TRIGGERED")
534        pass
535
536    def actionSLD_Calculator(self):
537        """
538        """
[1d85b5e]539        self.SLDCalculator.show()
[f721030]540
541    def actionDensity_Volume_Calculator(self):
542        """
543        """
[1d85b5e]544        self.DVCalculator.show()
[f721030]545
[363fbfa]546    def actionKiessig_Calculator(self):
547        """
548        """
549        #self.DVCalculator.show()
550        self.KIESSIGCalculator.show()
551
[f721030]552    def actionSlit_Size_Calculator(self):
553        """
554        """
[a8ec5b1]555        self.SlitSizeCalculator.show()
[f721030]556
557    def actionSAS_Resolution_Estimator(self):
558        """
559        """
560        print("actionSAS_Resolution_Estimator TRIGGERED")
561        pass
562
563    def actionGeneric_Scattering_Calculator(self):
564        """
565        """
566        print("actionGeneric_Scattering_Calculator TRIGGERED")
567        pass
568
569    def actionPython_Shell_Editor(self):
570        """
[1af348e]571        Display the Jupyter console as a docked widget.
[f721030]572        """
[1af348e]573        terminal = IPythonWidget()
574
575        # Add the console window as another docked widget
576        self.ipDockWidget = QtGui.QDockWidget("IPython", self._workspace)
577        self.ipDockWidget.setObjectName("IPythonDockWidget")
578        self.ipDockWidget.setWidget(terminal)
579        self._workspace.addDockWidget(QtCore.Qt.RightDockWidgetArea,
580                                      self.ipDockWidget)
[f721030]581
582    def actionImage_Viewer(self):
583        """
584        """
585        print("actionImage_Viewer TRIGGERED")
586        pass
587
588    #============ FITTING =================
589    def actionNew_Fit_Page(self):
590        """
[60af928]591        Add a new, empty Fit page in the fitting perspective.
[f721030]592        """
[60af928]593        # Make sure the perspective is correct
594        per = self.perspective()
595        if not isinstance(per, FittingWindow):
596            return
597        per.addFit(None)
[f721030]598
599    def actionConstrained_Fit(self):
600        """
601        """
602        print("actionConstrained_Fit TRIGGERED")
603        pass
604
605    def actionCombine_Batch_Fit(self):
606        """
607        """
608        print("actionCombine_Batch_Fit TRIGGERED")
609        pass
610
611    def actionFit_Options(self):
612        """
613        """
614        print("actionFit_Options TRIGGERED")
615        pass
616
617    def actionFit_Results(self):
618        """
619        """
620        print("actionFit_Results TRIGGERED")
621        pass
622
623    def actionChain_Fitting(self):
624        """
625        """
626        print("actionChain_Fitting TRIGGERED")
627        pass
628
629    def actionEdit_Custom_Model(self):
630        """
631        """
632        print("actionEdit_Custom_Model TRIGGERED")
633        pass
634
635    #============ ANALYSIS =================
636    def actionFitting(self):
637        """
638        """
639        print("actionFitting TRIGGERED")
640        pass
641
642    def actionInversion(self):
643        """
644        """
645        print("actionInversion TRIGGERED")
646        pass
647
648    def actionInvariant(self):
649        """
650        """
651        print("actionInvariant TRIGGERED")
652        pass
653
654    #============ WINDOW =================
655    def actionCascade(self):
656        """
[e540cd2]657        Arranges all the child windows in a cascade pattern.
[f721030]658        """
[e540cd2]659        self._workspace.workspace.cascade()
[f721030]660
[e540cd2]661    def actionTile(self):
[f721030]662        """
[e540cd2]663        Tile workspace windows
[f721030]664        """
[e540cd2]665        self._workspace.workspace.tile()
[f721030]666
667    def actionArrange_Icons(self):
668        """
[e540cd2]669        Arranges all iconified windows at the bottom of the workspace
[f721030]670        """
[e540cd2]671        self._workspace.workspace.arrangeIcons()
[f721030]672
673    def actionNext(self):
674        """
[e540cd2]675        Gives the input focus to the next window in the list of child windows.
[f721030]676        """
[e540cd2]677        self._workspace.workspace.activateNextWindow()
[f721030]678
679    def actionPrevious(self):
680        """
[e540cd2]681        Gives the input focus to the previous window in the list of child windows.
[f721030]682        """
[e540cd2]683        self._workspace.workspace.activatePreviousWindow()
[f721030]684
685    #============ HELP =================
686    def actionDocumentation(self):
687        """
[9e426c1]688        Display the documentation
689
690        TODO: use QNetworkAccessManager to assure _helpLocation is valid
[f721030]691        """
[1042dba]692        self._helpView.load(QtCore.QUrl(self._helpLocation))
693        self._helpView.show()
[f721030]694
695    def actionTutorial(self):
696        """
[9e426c1]697        Open the tutorial PDF file with default PDF renderer
[f721030]698        """
[9e426c1]699        # Not terribly safe here. Shell injection warning.
700        # isfile() helps but this probably needs a better solution.
701        if os.path.isfile(self._tutorialLocation):
702            result = subprocess.Popen([self._tutorialLocation], shell=True)
[f721030]703
704    def actionAcknowledge(self):
705        """
[9e426c1]706        Open the Acknowledgements widget
[f721030]707        """
[9e426c1]708        self.ackWidget.show()
[f721030]709
710    def actionAbout(self):
711        """
[9e426c1]712        Open the About box
[f721030]713        """
[f82ab8c]714        # Update the about box with current version and stuff
715
716        # TODO: proper sizing
717        self.aboutWidget.show()
[f721030]718
719    def actionCheck_for_update(self):
720        """
[9e426c1]721        Menu Help/Check for Update
[f721030]722        """
[9e426c1]723        self.checkUpdate()
724
[cbcdd2c]725    def updateTheoryFromPerspective(self, index):
726        """
727        Catch the theory update signal from a perspective
728        Send the request to the DataExplorer for updating the theory model.
729        """
730        self.filesWidget.updateTheoryFromPerspective(index)
731
732
[f721030]733
Note: See TracBrowser for help on using the repository browser.