def connectSignals(self):
        """ connectSignals() -> None
        Connect Plug-in specific signals

        """
        QBuilderWindow.connectSignals(self)
        trigger_actions = [
            (self.expandBranchAction, self.expandBranch),
            (self.collapseBranchAction, self.collapseBranch),
            (self.collapseAllAction, self.collapseAll),
            (self.hideBranchAction, self.hideBranch),
            (self.showAllAction, self.showAll),
            (self.resetViewAction, self.resetView),
            (self.focusViewAction, self.focusView),
            (self.timeStatsAllAction, self.timeStatsAll),
            (self.timeStatsAction, self.timeStatsSelection),
            (self.snapshotAction, self.createSnapshot),
            (self.visDiffAction, self.visDiffSelection),
            (self.copyOperationAction, self.copyOperation),
            (self.copySequenceAction, self.copySequence),
            (self.pasteOperationAction, self.pasteOperation),
            ]
        for (emitter, receiver) in trigger_actions:
            self.connect(emitter, QtCore.SIGNAL('triggered()'), receiver)

        self.connect(self.keepViewAction,
                     QtCore.SIGNAL('toggled(bool)'),
                     self.keepViewChanged)
 def event(self, e):
     """ event(e: QEvent)
     Parse QPluginOperationEvent and store it to Visrails
     """
     if (e.type()==QPluginOperationEvent.eventType) \
     and (self.viewManager.currentWidget()!=None):
         controller = self.viewManager.currentWidget().controller
         if e.fromVersion>=0:
             self.changeVersionWithoutUpdatingApp(e.fromVersion)
         controller.update_scene_script(e.name, e.details, e.snapshot, e.operations)
         return False
     return QBuilderWindow.event(self, e)
    def createWindows(self):
        """ createWindows() -> None
        Create and configure all GUI widgets including the builder
        
        """
        self.setupSplashScreen()
        metalstyle = self.configuration.check('useMacBrushedMetalStyle')
        if metalstyle:
            #to make all widgets to have the mac's nice looking
            self.installEventFilter(self)

        # This is so that we don't import too many things before we
        # have to. Otherwise, requirements are checked too late.
        from gui.builder_window import QBuilderWindow

        self.builderWindow = QBuilderWindow()
        self.builderWindow.show()
        self.visDiffParent = QtGui.QWidget(None, QtCore.Qt.ToolTip)
        self.visDiffParent.resize(0,0)
    def newVistrail(self):
        """ newVistrail() -> None
        Start a new vistrail

        """

        # may have cancelled the new
        if not QBuilderWindow.newVistrail(self):
            return

        self.viewModeChanged(1)

        # Pre-compute default values for existing nodes in a new scene
        controller = self.viewManager.currentWidget().controller
        controller.store_preset_attributes()
        self.connect(controller,
                     QtCore.SIGNAL('versionWasChanged'),
                     self.versionSelectionChange)
        self.updateAddonToolBar(self.viewManager.currentWidget())
        CaptureAPI.afterNewVistrail()
class VistrailsApplicationSingleton(QtGui.QApplication):
    """
    VistrailsApplicationSingleton is the singleton of the application,
    there will be only one instance of the application during VisTrails
    
    """
    
    def __call__(self):
        """ __call__() -> VistrailsApplicationSingleton
        Return self for calling method
        
        """
        if not self._initialized:
            self.init()
        return self

    def __init__(self):
        if os.name == "nt":
            currentDir = os.getcwd()
            os.environ["PATH"] = os.environ["PATH"] + ";" + os.path.join(currentDir, "plug-ins", "vistrails", "lib", "PyQt4")

        QtGui.QApplication.__init__(self, sys.argv)
        if QtCore.QT_VERSION < 0x40200: # 0x40200 = 4.2.0
            raise core.requirements.MissingRequirement("Qt version >= 4.2")
        self._initialized = False
        qt.allowQObjects()

    def init(self, optionsDict=None):
        """ VistrailsApplicationSingleton(optionDict: dict)
                                          -> VistrailsApplicationSingleton
        Create the application with a dict of settings
        
        """
        gui.theme.initializeCurrentTheme()
        self.connect(self, QtCore.SIGNAL("aboutToQuit()"), self.finishSession)
        self.configuration = core.configuration.default()
        core.interpreter.default.connect_to_configuration(self.configuration)
        
        self.keyChain = keychain.KeyChain()
        self.setupOptions()

        # Setup configuration to default or saved preferences
        self.vistrailsStartup = core.startup.VistrailsStartup(self.configuration)
        self.temp_configuration = copy.copy(self.configuration)

        
        # now we want to open vistrails and point to a specific version
        # we will store the version in temp options as it doesn't
        # need to be persistent. We will do the same to database
        # information passed in the command line
        self.temp_options = InstanceObject(host=None,
                                           port=None,
                                           db=None,
                                           user=None,
                                           vt_id=None,
                                           parameters=None
                                           ) 

        
        # Command line options override configuration
        self.readOptions()
        if optionsDict:
            for (k, v) in optionsDict.iteritems():
                setattr(self.temp_configuration, k, v)

        interactive = self.temp_configuration.check('interactiveMode')
        if interactive:
            self.setIcon()
            self.createWindows()
            self.processEvents()
            
        self.vistrailsStartup.init()
        # ugly workaround for configuration initialization order issue
        # If we go through the configuration too late,
        # The window does not get maximized. If we do it too early,
        # there are no created windows during spreadsheet initialization.
        if interactive:
            if  self.temp_configuration.check('maximizeWindows'):
                self.builderWindow.showMaximized()
            if self.temp_configuration.check('dbDefault'):
                self.builderWindow.setDBDefault(True)
        self.runInitialization()
        self._python_environment = self.vistrailsStartup.get_python_environment()
        self._initialized = True
        
        if interactive:
            self.interactiveMode()
        else:
            return self.noninteractiveMode()
        return True

    def get_python_environment(self):
        """get_python_environment(): returns an environment that
includes local definitions from startup.py. Should only be called
after self.init()"""
        return self._python_environment

    def destroy(self):
        """ destroy() -> None
        Finalize all packages to, such as, get rid of temp files
        
        """
        if hasattr(self, 'vistrailsStartup'):
            self.vistrailsStartup.destroy()

    def __del__(self):
        """ __del__() -> None
        Make sure to finalize in the destructor
        
        """
        self.destroy()

    def _parse_vtinfo(self, info, use_filename=True):
        name = None
        version = None
        if use_filename and os.path.isfile(info):
            name = info
        else:
            data = info.split(":")
            if len(data) >= 2:
                if use_filename and os.path.isfile(str(data[0])):
                        name = str(data[0])
                elif not use_filename:
                    name = str(data[0])
                # will try to convert version to int
                # if it fails, it's a tag name
                try:
                    #maybe a tag name contains ':' in ist name
                    #so we need to bring it back together
                    rest = ":".join(data[1:])
                    version = int(rest)
                except ValueError:
                    version = str(rest)
            elif len(data) == 1:
                if use_filename and os.path.isfile(str(data[0])):
                    name = str(data[0])
                elif not use_filename:
                    name = str(data[0])
        return (name, version)
        
    def interactiveMode(self):
        """ interactiveMode() -> None
        Instantiate the GUI for interactive mode
        
        """     
        if self.temp_configuration.check('showSplash'):
            self.splashScreen.finish(self.builderWindow)
        self.builderWindow.create_first_vistrail()
        #self.builderWindow.modulePalette.treeWidget.updateFromModuleRegistry()
        #self.builderWindow.modulePalette.connect_registry_signals()
        usedb = False
        if self.temp_db_options.host:
           usedb = True
        if self.input:
            #check if versions are embedded in the filename
            for filename in self.input:
                f_name, version = self._parse_vtinfo(filename, not usedb)
                if not usedb:
                    locator = FileLocator(os.path.abspath(f_name))
                    #_vnode and _vtag will be set when a .vtl file is open and
                    # instead of a FileLocator, a DBLocator is created instead
                    if hasattr(locator, '_vnode'):
                        version = locator._vnode
                        print locator._vnode
                    if hasattr(locator,'_vtag'):
                        # if a tag is set, it should be used instead of the
                        # version number
                        if locator._vtag != '':
                            version = locator._vtag
                            print locator._vtag
                else:
                    locator = DBLocator(host=self.temp_db_options.host,
                                        port=self.temp_db_options.port,
                                        database=self.temp_db_options.db,
                                        user='',
                                        passwd='',
                                        obj_id=f_name,
                                        obj_type=None,
                                        connection_id=None)
                execute = self.temp_configuration.executeWorkflows
                self.builderWindow.open_vistrail_without_prompt(locator,
                                                                version,
                                                                execute)

        if not self.temp_configuration.showSpreadsheetOnly:
            # in some systems (Linux and Tiger) we need to make both calls
            # so builderWindow is activated
            self.builderWindow.raise_()
            self.builderWindow.activateWindow()
        else:
            self.builderWindow.hide()

    def noninteractiveMode(self):
        """ noninteractiveMode() -> None
        Run the console in non-interactive mode
        
        """
        usedb = False
        if self.temp_db_options.host:
           usedb = True
        if self.input:
            w_list = []
            for filename in self.input:
                f_name, version = self._parse_vtinfo(filename, not usedb)
                if f_name and version:
                    if not usedb:
                        locator = FileLocator(os.path.abspath(f_name))
                    else:
                        locator = DBLocator(host=self.temp_db_options.host,
                                            port=self.temp_db_options.port,
                                            database=self.temp_db_options.db,
                                            user=self.temp_db_options.user,
                                            passwd='',
                                            obj_id=f_name,
                                            obj_type=None,
                                            connection_id=None)
                    w_list.append((locator, version))
            import core.console_mode
            if self.temp_db_options.parameters == None:
                self.temp_db_options.parameters = ''
            r = core.console_mode.run(w_list,
                                      self.temp_db_options.parameters)
            return r
        else:
            debug.DebugPrint.critical("no input vistrails provided")
            return False

    def setIcon(self):
        """ setIcon() -> None
        Setup Vistrail Icon
        """
        self.setWindowIcon(gui.theme.CurrentTheme.APPLICATION_ICON)
        
    def setupSplashScreen(self):
        """ setupSplashScreen() -> None
        Create the splash-screen at startup
        
        """
        if self.temp_configuration.check('showSplash'):
            splashPath = (system.vistrails_root_directory() +
                          "/gui/resources/images/vistrails_splash.png")
            pixmap = QtGui.QPixmap(splashPath)
            self.splashScreen = QtGui.QSplashScreen(pixmap, QtCore.Qt.WindowStaysOnTopHint)
            self.splashScreen.show()

    def createWindows(self):
        """ createWindows() -> None
        Create and configure all GUI widgets including the builder
        
        """
        self.setupSplashScreen()
        metalstyle = self.configuration.check('useMacBrushedMetalStyle')
        if metalstyle:
            #to make all widgets to have the mac's nice looking
            self.installEventFilter(self)

        # This is so that we don't import too many things before we
        # have to. Otherwise, requirements are checked too late.
        from gui.builder_window import QBuilderWindow

        self.builderWindow = QBuilderWindow()
        self.builderWindow.show()
        self.visDiffParent = QtGui.QWidget(None, QtCore.Qt.ToolTip)
        self.visDiffParent.resize(0,0)
        
    def setupOptions(self):
        """ setupOptions() -> None
        Check and store all command-line arguments
        
        """
        add = command_line.CommandLineParser.add_option
        add("-S", "--startup", action="store", type="str", default=None,
            dest="dotVistrails",
            help="Set startup file (default is ~/.vistrails/startup.py)")
        add("-?", action="help",
            help="show this help message and exit")
        add("-v", "--version", action="callback",
            callback=lambda option, opt, value, parser: self.printVersion(),
            help="print version information and quit")
        add("-V", "--verbose", action="store", type="int", default=None,
            dest="verbose", help="set verboseness level (0--2, "
            "default=0, higher means more verbose)")
        add("-n", "--nosplash", action="store_false",
            default = None,
            help="don't display splash on startup")
        add("-c", "--cache", action="store", type="int", default=None,
            dest="cache", help="enable/disable caching")
        add("-m", "--movies", action="store", type="int", default=None,
            dest="movies", help="set automatic movie creation on spreadsheet "
            "(0 or 1, default=1. Set this to zero to work around vtk bug with "
            "offscreen renderer and opengl texture3d mappers)")
        add("-s", "--multiheads", action="store_true",
            default = None,
            help="display the builder and spreadsheet on different screens "
            "(if available)")
        add("-x", "--maximized", action="store_true",
            default = None,
            help="Maximize VisTrails windows at startup")
        add("-b", "--noninteractive", action="store_true",
            default = None,
            help="run in non-interactive mode")
        add("-e", "--dumpcells", action="store", dest="dumpcells",
            default = None,
            help="when running in non-interactive mode, directory to dump "
            "spreadsheet cells before exiting")
        add("-l", "--nologger", action="store_true",
            default = None,
            help="disable the logging")
        add("-d", "--debugsignals", action="store_true",
            default = None,
            help="debug Qt Signals")
        add("-a", "--parameters", action="store", dest="parameters",
            help="workflow parameter settings (non-interactive mode only)")
        add("-t", "--host", action="store", dest="host",
            help="hostname or ip address of database server")
        add("-r", "--port", action="store", type="int", default=3306,
            dest="port", help="database port")
        add("-f", "--db", action="store", dest="db",
            help="database name")
        add("-u", "--user", action="store", dest="user",
            help="database username")
        add("-i", "--showspreadsheetonly", action="store_true",
            default = None,
            help="only the spreadsheet will be shown. This implies -w was given.\
The builder window can be accessed by a spreadsheet menu option.")
        add("-w", "--executeworkflows", action="store_true",
            default = None,
            help="The workflows will be executed")
        command_line.CommandLineParser.parse_options()

    def printVersion(self):
        """ printVersion() -> None
        Print version of Vistrail and exit
        
        """
        print system.about_string()
        sys.exit(0)

    def readOptions(self):
        """ readOptions() -> None
        Read arguments from the command line
        
        """
        get = command_line.CommandLineParser().get_option
        if get('nosplash')!=None:
            self.temp_configuration.showSplash = bool(get('nosplash'))
        if get('debugsignals')!=None:
            self.temp_configuration.debugSignals = bool(get('debugsignals'))
        if get('dotVistrails')!=None:
            self.temp_configuration.dotVistrails = get('dotVistrails')
        if not self.configuration.check('dotVistrails'):
            self.configuration.dotVistrails = system.default_dot_vistrails()
            self.temp_configuration.dotVistrails = system.default_dot_vistrails()
        if get('multiheads')!=None:
            self.temp_configuration.multiHeads = bool(get('multiheads'))
        if get('maximized')!=None:
            self.temp_configuration.maximizeWindows = bool(get('maximized'))
        if get('movies')!=None:
            self.temp_configuration.showMovies = bool(get('movies'))
        if get('cache')!=None:
            self.temp_configuration.useCache = bool(get('cache'))
        if get('verbose')!=None:
            self.temp_configuration.verbosenessLevel = get('verbose')
        if get('noninteractive')!=None:
            self.temp_configuration.interactiveMode = \
                                                  not bool(get('noninteractive'))
            if get('dumpcells') != None:
                self.temp_configuration.spreadsheetDumpCells = get('dumpcells')
        if get('executeworkflows') != None:
            self.temp_configuration.executeWorkflows = \
                                            bool(get('executeworkflows'))
        if get('showspreadsheetonly') != None:
            self.temp_configuration.showSpreadsheetOnly = \
                                            bool(get('showspreadsheetonly'))
            # asking to show only the spreadsheet will force the workflows to
            # be executed
            if self.temp_configuration.showSpreadsheetOnly:
                self.temp_configuration.executeWorkflows = True
            
        self.temp_db_options = InstanceObject(host=get('host'),
                                                 port=get('port'),
                                                 db=get('db'),
                                                 user=get('user'),
                                                 parameters=get('parameters')
                                                 )
        if get('nologger')!=None:
            self.temp_configuration.nologger = bool(get('nologger'))
        self.input = command_line.CommandLineParser().positional_arguments()
        
    def runInitialization(self):
        """ runInitialization() -> None
        Run init script on the user folder
        
        """
        def initBookmarks():
            """loadBookmarkCollection() -> None
            Init BookmarksManager and creates .vistrails folder if it 
            does not exist 

            """
            if (not os.path.isdir(self.configuration.dotVistrails) and 
                not os.path.isfile(self.configuration.dotVistrails)):
                #create .vistrails dir
                os.mkdir(self.configuration.dotVistrails)

            # This is so that we don't import too many things before we
            # have to. Otherwise, requirements are checked too late.
           # import gui.bookmark_window
           # gui.bookmark_window.initBookmarks(system.default_bookmarks_file())    
            
        #initBookmarks()
        self.showSplash = self.configuration.showSplash

    def finishSession(self):
        core.interpreter.cached.CachedInterpreter.cleanup()
   
    def eventFilter(self, o, event):
        """eventFilter(obj,event)-> boolean
        This will filter all create events and will set on the WA_MacMetalStyle
        attribute of a QWidget.
        
        """
        if(event.type() == QtCore.QEvent.Create and 
           issubclass(type(o),QtGui.QWidget) and
           type(o) != QtGui.QSplashScreen):
            o.setAttribute(QtCore.Qt.WA_MacMetalStyle)
        return QtGui.QApplication.eventFilter(self,o,event)

    def save_configuration(self):
        """ save_configuration() -> None
        Save the current vistrail configuration to the startup.xml file.
        This is required to capture changes to the configuration that we 
        make programmatically during the session, ie., browsed directories or
        window sizes.

        """
        dom = self.vistrailsStartup.startup_dom()
        doc = dom.documentElement
        configuration_element = enter_named_element(doc, 'configuration')
        doc.removeChild(configuration_element)
        self.configuration.write_to_dom(dom, doc)
        self.vistrailsStartup.write_startup_dom(dom)
        dom.unlink()
    def __init__(self, parent=None):
        QBuilderWindow.__init__(self, parent)
        self.descriptionWidget = QtGui.QLabel()
        self.progressLabel = QtGui.QLabel()
        self.progressLabel.setMaximumWidth(80)
        self.progressLabel.setMinimumWidth(80)
        self.progressWidget = QtGui.QProgressBar()
        self.progressWidget.setRange(0,100)
        self.statusBar().addWidget(self.descriptionWidget,1)
        self.statusBar().addWidget(self.progressLabel,1)
        self.statusBar().addWidget(self.progressWidget,1)
        self.statusWarning = None
        self.descriptionWidget.hide()
        self.progressLabel.hide()
        self.progressWidget.hide()

        self.title = CaptureAPI.getPluginTitle()
        self.setWindowTitle(self.title)
        self.setWindowIcon(CurrentTheme.APPLICATION_ICON)
        #self.modulePalette.toolWindow().destroy()
        self.updateApp = False
        self.timeStatsWindow = None

        if core.system.systemType in ['Darwin']:
            self.menuBar().setAttribute(QtCore.Qt.WA_MacSmallSize)
            self.menuBar().setAttribute(QtCore.Qt.WA_MacMetalStyle)

        self.searchToolBar = QSearchToolBar(self)
        self.addToolBar(QtCore.Qt.BottomToolBarArea, self.searchToolBar)

        self.addToolBarBreak(QtCore.Qt.BottomToolBarArea)

        self.playbackToolBar = QPlaybackToolBar(self)
        self.addToolBar(QtCore.Qt.BottomToolBarArea, self.playbackToolBar)

        self.addonToolBar.addAction(self.keepViewAction)
        self.addonToolBar.addAction(self.searchToolBar.toggleViewAction())
        self.addonToolBar.addAction(self.playbackToolBar.toggleViewAction())

        self.toolsMenu.addSeparator()
        self.toolsMenu.addAction(self.searchToolBar.toggleViewAction())
        self.toolsMenu.addAction(self.playbackToolBar.toggleViewAction())

        self.interactionToolBar._selectCursorAction.setToolTip('Select')
        self.interactionToolBar._selectCursorAction.setStatusTip('Select versions and edit the tree view')
        self.interactionToolBar._panCursorAction.setToolTip('Pan')
        self.interactionToolBar._panCursorAction.setStatusTip('Pan the tree view (Shift + Click)')
        self.interactionToolBar._zoomCursorAction.setToolTip('Zoom')
        self.interactionToolBar._zoomCursorAction.setStatusTip('Zoom the tree view (Ctrl + Click)')

        self.connect(self.viewManager,
                     QtCore.SIGNAL('currentVistrailChanged'),
                     self.updateAddonToolBar)

        geometry = CaptureAPI.getPreference('VisTrailsBuilderWindowGeometry')
        if geometry!='':
            self.restoreGeometry(QtCore.QByteArray.fromBase64(QtCore.QByteArray(geometry)))
            desktop = QtGui.QDesktopWidget()
            if desktop.screenNumber(self)==-1:
                self.move(desktop.screenGeometry().topLeft())

        alwaysOnTop = int(CaptureAPI.getPreference('VisTrailsAlwaysOnTop'))
        if alwaysOnTop:
            self.setWindowFlags(self.windowFlags() | QtCore.Qt.WindowStaysOnTopHint)
 def resizeEvent(self, event):
     """ Save current window settings right away"""
     self.saveWindowPreferences()
     return QBuilderWindow.resizeEvent(self, event)
    def createActions(self):
        """ createActions() -> None
        Construct Plug-in specific actions

        """
        QBuilderWindow.createActions(self)

        # Modify Core Actions
        self.redoAction.setShortcuts(['Shift+Z','Ctrl+Y'])
        self.quitVistrailsAction = QtGui.QAction('Quit Plug-In', self)
        self.quitVistrailsAction.setShortcut('Ctrl+Q')
        self.quitVistrailsAction.setStatusTip('Exit Plug-In')
        self.editPreferencesAction.setStatusTip('Edit plug-in preferences')
        self.helpAction = QtGui.QAction(self.tr('About Provenance Explorer...'), self)

        # Create plugin specific actions
        self.keepViewAction = QtGui.QAction(CurrentTheme.VIEW_ON_ICON, 'Lock View', self)
        self.keepViewAction.setEnabled(True)
        self.keepViewAction.setCheckable(True)
        if int(CaptureAPI.getPreference('VisTrailsUseRecordedViews')):
            self.keepViewAction.setChecked(0)
            self.keepViewAction.setIcon(CurrentTheme.VIEW_OFF_ICON)
        else:
            self.keepViewAction.setChecked(1)
        self.keepViewAction.setStatusTip('Lock the current view settings while navigating versions')

        self.expandBranchAction = QtGui.QAction('Expand Branch', self)
        self.expandBranchAction.setEnabled(True)
        self.expandBranchAction.setStatusTip('Expand all versions in the tree below the current version')

        self.collapseBranchAction = QtGui.QAction('Collapse Branch', self)
        self.collapseBranchAction.setEnabled(True)
        self.collapseBranchAction.setStatusTip('Collapse all expanded versions in the tree below the current version')

        self.collapseAllAction = QtGui.QAction('Collapse All', self)
        self.collapseAllAction.setEnabled(True)
        self.collapseAllAction.setStatusTip('Collapse all expanded branches of the tree')

        self.hideBranchAction = QtGui.QAction('Hide Branch', self)
        if core.system.systemType in ['Darwin']:
            self.hideBranchAction.setShortcut('Meta+H')
        else:
            self.hideBranchAction.setShortcut('Ctrl+H')
        self.hideBranchAction.setEnabled(True)
        self.hideBranchAction.setStatusTip('Hide all versions in the tree including and below the current version')

        self.showAllAction = QtGui.QAction('Show All', self)
        self.showAllAction.setEnabled(True)
        self.showAllAction.setStatusTip('Show all hidden versions')

        self.resetViewAction = QtGui.QAction('Frame All', self)
        if core.system.systemType in ['Darwin']:
            self.resetViewAction.setShortcut('Meta+A')
        else:
            self.resetViewAction.setShortcut('A')
        self.resetViewAction.setShortcutContext(QtCore.Qt.WidgetShortcut)
        self.resetViewAction.setStatusTip('Reset tree view to show all versions')

        self.focusViewAction = QtGui.QAction('Frame Selection', self)
        if core.system.systemType in ['Darwin']:
            self.focusViewAction.setShortcut('Meta+F')
        else:
            self.focusViewAction.setShortcut('F')
        self.focusViewAction.setShortcutContext(QtCore.Qt.WidgetShortcut)
        self.focusViewAction.setStatusTip('Reset tree view to show selected version')

        self.timeStatsAllAction = QtGui.QAction('Compute Statistics', self)
        self.timeStatsAllAction.setEnabled(True)
        self.timeStatsAllAction.setStatusTip('Show time statistics for entire version tree')
        
        self.timeStatsAction = QtGui.QAction('Compute Sequence Statistics...', self)
        self.timeStatsAction.setEnabled(True)
        self.timeStatsAction.setStatusTip('Show time statistics between two versions')

        self.snapshotAction = QtGui.QAction('Create Snapshot', self)
        self.snapshotAction.setEnabled(False)
        self.snapshotAction.setStatusTip('Create a new version with the contents of the current scene')

        self.visDiffAction = QtGui.QAction('Compute Visual Difference...', self)
        self.visDiffAction.setEnabled(True)
        self.visDiffAction.setStatusTip('Visually display differences between two versions')

        self.copyOperationAction = QtGui.QAction('Copy', self)
        self.copyOperationAction.setShortcut('Ctrl+C')
        self.copyOperationAction.setEnabled(True)
        self.copyOperationAction.setStatusTip('Copy the selected operation to the clipboard')

        self.copySequenceAction = QtGui.QAction('Copy Sequence...', self)
        self.copySequenceAction.setEnabled(True)
        self.copySequenceAction.setStatusTip('Copy a sequence of operations to the clipboard')

        self.pasteOperationAction = QtGui.QAction('Paste', self)
        self.pasteOperationAction.setShortcut('Ctrl+V')
        self.pasteOperationAction.setEnabled(False)
        self.pasteOperationAction.setStatusTip('Paste operations from the clipboard to selected version')

        # Reader
        if CaptureAPI.isReadOnly():
            self.newVistrailAction.setText('&New (Pro)')
            self.newVistrailAction.setEnabled(False)
            self.saveFileAction.setText('&Save (Pro)')
            self.saveFileAction.setEnabled(False)
            self.saveFileAsAction.setText('Save as... (Pro)')
            self.saveFileAsAction.setEnabled(False)
            self.timeStatsAllAction.setText('Compute Statistics... (Pro)')
            self.timeStatsAllAction.setEnabled(False)
            self.timeStatsAction.setText('Compute Sequence Statistics... (Pro)')
            self.timeStatsAction.setEnabled(False)
            self.snapshotAction.setText('Take Snapshot (Pro)')
            self.snapshotAction.setEnabled(False)
            self.copyOperationAction.setText('Copy (Pro)')
            self.copyOperationAction.setEnabled(False)
            self.copySequenceAction.setText('Copy Sequence... (Pro)')
            self.copySequenceAction.setEnabled(False)
            self.pasteOperationAction.setText('Paste (Pro)')
            self.pasteOperationAction.setEnabled(False)
            self.hideBranchAction.setText('Hide Branch (Pro)')
            self.hideBranchAction.setEnabled(False)
            self.showAllAction.setText('Show All (Pro)')
            self.showAllAction.setEnabled(False)
    def open_vistrail(self, locator_class):
        """ open_vistrail(locator_class: locator) -> None

        """
        QBuilderWindow.open_vistrail(self, locator_class)
        self.updateAddonToolBar(self.viewManager.currentWidget())