def item_selected(self, widget_item, column):            
        locator = None
        entity = None
        if hasattr(widget_item, 'entity') and widget_item.entity is not None:
            entity = widget_item.entity
            locator = entity.locator()
        elif isinstance(widget_item, QVistrailListLatestItem) and \
             hasattr(widget_item.parent().parent(), 'entity') and \
             widget_item.parent().parent().entity is not None:
            entity = widget_item.parent().parent().entity
            locator = entity.locator()
        elif not isinstance(widget_item, QVistrailListLatestItem):
            # no valid item selected
            return
        from vistrails.gui.vistrails_window import _app
        open_vistrail = _app.open_vistrail_without_prompt
        set_current_locator = _app.set_current_locator

        if not locator or isinstance(locator, UntitledLocator):
            # assuming an unsaved vistrail - need to use view
            vistrail_widget = widget_item
            view = None
            while view is None and vistrail_widget is not None:
                if hasattr(vistrail_widget, 'window'):
                    view = vistrail_widget.window
                    break
                elif (hasattr(vistrail_widget, 'entity') and
                      hasattr(vistrail_widget.entity, '_window')):
                    view = vistrail_widget.entity._window
                    break
                vistrail_widget = vistrail_widget.parent()

            if vistrail_widget == widget_item:
                # do nothing - view is already selected
                return
            is_execution = False
            version = None
            if isinstance(widget_item, QVistrailListLatestItem):
                version = view.controller.vistrail.get_latest_version()
            elif hasattr(widget_item, 'entity'):
                if hasattr(widget_item, 'executionList'):
                    version = widget_item.entity.name
                else:
                    is_execution = True
                    version = widget_item.parent().entity.name
            if not version:
                # assume execution
                version = str(widget_item.parent().text(0))
            if isinstance(version, str):
                try:
                    version = \
                        view.controller.vistrail.get_version_number(version)
                except Exception:
                    version = None
            if self.searchMode:
                self.search_result_selected(view, version)
            else:
                _app.change_view(view)
                if version:
                    view.version_selected(version, True, double_click=True)

            if is_execution:
                _app.qactions['provenance'].trigger()
                workflow_exec = widget_item.entity.name
                view.log_view.set_exec_by_id(workflow_exec) or \
                 view.log_view.set_exec_by_date(workflow_exec)
            return

        args = {}
        args['version'] = locator.kwargs.get('version_node', None) or \
                          locator.kwargs.get('version_tag', None)
        args['parameterExploration']=locator.kwargs.get('parameterExploration',
                                                        None)
        vistrail_widget = widget_item
        vistrail_entity = entity
        version = None
        if args['version']:
            vistrail_widget = widget_item.parent()
            vistrail_entity = entity.parent
            locator = vistrail_entity.locator()
            version = args['version']

        if args['parameterExploration']:
            args['parameterExploration'] = int(args['parameterExploration'])
            vistrail_widget = widget_item.parent().parent()
            vistrail_entity = entity.parent
            locator = vistrail_entity.locator()

        workflow_exec = locator.kwargs.get('workflow_exec', None)
        if workflow_exec:
            args['workflow_exec'] = workflow_exec
            vistrail_widget = widget_item.parent().parent()
            vistrail_entity = entity.parent.parent
            locator = vistrail_entity.locator()
            locator.update_from_gui(self)

        if isinstance(widget_item, QVistrailListLatestItem):
            # find the latest item (max action id)
            vistrail = widget_item.parent().parent().window.controller.vistrail
            args['version'] = vistrail.get_latest_version()
            version = vistrail.get_latest_version()
        locator.update_from_gui(self)
        if not locator.is_valid():
            debug.critical("File not found: '%s'. Entry will be deleted." % locator.to_url())
            vistrail_widget.parent().removeChild(vistrail_widget)
            self.collection.delete_entity(vistrail_entity)
            self.collection.commit()

        view = _app.ensureVistrail(locator)
        if self.searchMode:
            self.search_result_selected(view, version)
        else:
            if view:
                self.ensureNotDiffView()
            open_vistrail(locator, **args)
            if view is None or not view.is_abstraction:
                set_current_locator(locator)
            if view and isinstance(entity, MashupEntity):
                # I am assuming that double-clicking a mashup, the user wants to
                # run the mashup
                # if it is doubele-clicked without the vistrail being open we 
                #should open the vistrail
                self.open_mashup(entity)
            if view and isinstance(entity, ParameterExplorationEntity):
                # I am assuming that double-clicking a p.e., the user wants to
                # run it
                # if it is double-clicked without the vistrail being open we 
                #should open the vistrail
                self.open_parameter_exploration(entity)
browse this module
dataset/ETHPy150Open VisTrails/VisTrails/vistrails/gui/collection/workspace.py/QVistrailList.item_selected--crossover with--dataset/ETHPy150Open enthought/envisage/envisage/developer/code_browser/tests/code_browser_test_case.py/CodeBrowserTestCase.test_browse_this_module