Exemple #1
0
    def showItem(self, item, col):
        (v_name, v_id, log_id, v_version, version_name, e_id, ts_start, ts_end,
         user, completed, thumb) = item.wf_exec
        config = self.config
        locator = \
           DBLocator(config['host'],
                     config['port'],
                     config['db'],
                     config['user'],
                     config['passwd'],
                     config['name'],
                     obj_id=v_id,
                     obj_type='vistrail',
                     workflow_exec=ts_start,
                     connection_id=config.get('id', None))
        #print "url:", locator.to_url()
        import vistrails.gui.application
        app = vistrails.gui.application.get_vistrails_application()
        open_vistrail = app.builderWindow.open_vistrail_without_prompt

        workflow_exec = locator.kwargs.get('workflow_exec', None)
        args = {}
        if workflow_exec:
            args['workflow_exec'] = workflow_exec
        args['version'] = version_name if version_name else v_version
        open_vistrail(locator, **args)
Exemple #2
0
def get_save_db_locator_from_gui(parent, obj_type, locator=None):
    config, name = QOpenDBWindow.getSaveDBObject(obj_type)
    if config == {} or name == '':
        return None
    return DBLocator(config['host'],
                     config['port'],
                     config['db'],
                     config['user'],
                     config['passwd'],
                     name,
                     obj_id=None,
                     obj_type=obj_type,
                     connection_id=config.get('id', None))
Exemple #3
0
def get_load_db_locator_from_gui(parent, obj_type):
    config, obj_id, obj_name = QOpenDBWindow.getOpenDBObject(obj_type)
    if config == {} or obj_id == -1:
        return None
    return DBLocator(config['host'],
                     config['port'],
                     config['db'],
                     config['user'],
                     config['passwd'],
                     obj_name,
                     obj_id=obj_id,
                     obj_type=obj_type,
                     connection_id=config.get('id', None))
Exemple #4
0
    def setFigureInfo(self, opt_dict):
        self.doCheckLink(True, opt_dict)

        if 'showworkflow' in opt_dict:
            self.figure_type.setCurrentIndex(1)
        elif 'showtree' in opt_dict:
            self.figure_type.setCurrentIndex(2)
        else:
            self.figure_type.setCurrentIndex(0)

        if 'version' in opt_dict:
            self.figure_version.setText(str(opt_dict['version']))
        else:
            self.figure_version.setText("")
        if 'tag' in opt_dict:
            self.figure_tag.setEditText(str(opt_dict['tag'])[1:-1])
        else:
            self.figure_tag.setEditText("")

        if '_args' in opt_dict:
            self.graphicx_edit.setText(opt_dict['_args'])

        # build locator
        if 'filename' in opt_dict:
            # set using basedir of tex file
            fname = opt_dict['filename']
            if not os.path.isabs(fname):
                source_dir = os.path.dirname(str(self.source_edit.text()))
                #print 'source_dir:', str(self.source_edit.text()), source_dir
                fname = os.path.join(source_dir, fname)

            locator = FileLocator(fname)
        elif 'host' in opt_dict:
            if 'port' not in opt_dict:
                opt_dict['port'] = '3306'
            port = int(opt_dict['port'])
            locator = DBLocator(opt_dict['host'],
                                port,
                                opt_dict['db'],
                                '',
                                '',
                                obj_id=opt_dict['vtid'])
        else:
            locator = None
        if locator is not None:
            self.figure_ref.setText(locator.to_url())
        else:
            self.figure_ref.setText("")
        self.figure_ref.locator = locator

        self.readImage(opt_dict)
Exemple #5
0
 def unserialize(text):
     """ unserialize(text) -> RecentVistrailList """
     root = ElementTree.fromstring(text)
     if root.tag != 'recentVistrails':
         return None
     vtlist = RecentVistrailList()
     for node in root.getchildren():
         loc = FileLocator.from_xml(node)
         if loc is None:
             loc = DBLocator.from_xml(node, include_name=True)
         if loc is not None:
             vtlist.locators.append(loc)
             vtlist.locators_map[loc.name] = loc
     return vtlist
 def unserialize(text):
     """ unserialize(text) -> RecentVistrailList """
     root = ElementTree.fromstring(text)
     if root.tag != "recentVistrails":
         return None
     vtlist = RecentVistrailList()
     for node in root.getchildren():
         loc = FileLocator.from_xml(node)
         if loc is None:
             loc = DBLocator.from_xml(node, include_name=True)
         if loc is not None:
             vtlist.locators.append(loc)
             vtlist.locators_map[loc.name] = loc
     return vtlist
Exemple #7
0
 def showItem(self, item, col):
     (v_name, v_id, v_version, version_name, time, user, thumb) = \
      item.workflow
     config = self.config
     locator = \
        DBLocator(config['host'],
                  config['port'],
                  config['db'],
                  config['user'],
                  config['passwd'],
                  config['name'],
                  obj_id=v_id,
                  obj_type='vistrail',
                  connection_id=config.get('id', None))
     #print "url:", locator.to_url()
     import vistrails.gui.application
     app = vistrails.gui.application.get_vistrails_application()
     open_vistrail = app.builderWindow.open_vistrail_without_prompt
     args = {}
     args['version'] = version_name if version_name else v_version
     #print "args", args
     open_vistrail(locator, **args)
Exemple #8
0
    def process_interactive_input(self):
        pe = None
        usedb = False
        if self.temp_configuration.check('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)
                locator = None
                if f_name is None:
                    debug.critical("Could not find file %s" % filename)
                    return False
                elif not usedb:
                    locator = FileLocator(os.path.abspath(f_name))
                    #_vnode and _vtag will be set when a .vtl file is open and
                    # it can be either a FileLocator or a DBLocator

                elif usedb:
                    locator = DBLocator(
                        host=self.temp_configuration.check('host'),
                        port=self.temp_configuration.check('port') or 3306,
                        database=self.temp_configuration.check('db'),
                        user='',
                        passwd='',
                        obj_id=f_name,
                        obj_type=None,
                        connection_id=None)
                if locator:
                    if self.temp_configuration.check('parameterExploration'):
                        pe = version
                        version = None
                    else:
                        if hasattr(locator, '_vnode') and \
                                locator._vnode is not None:
                            version = 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
                    execute = self.temp_configuration.check('execute')
                    mashuptrail = None
                    mashupversion = None
                    if hasattr(locator, '_mshptrail'):
                        mashuptrail = locator._mshptrail
                    if hasattr(locator, '_mshpversion'):
                        mashupversion = locator._mshpversion
                        if mashupversion:
                            execute = True
                    if self.temp_configuration.showWindow:
                        self.showBuilderWindow()
                    self.builderWindow.open_vistrail_without_prompt(
                        locator,
                        version,
                        execute,
                        mashuptrail=mashuptrail,
                        mashupVersion=mashupversion)

                    if self.temp_configuration.check('parameterExploration'):
                        self.builderWindow.executeParameterExploration(pe)

        return True