Exemplo n.º 1
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 default():
    """ default() -> ConfigurationObject
    Returns the default configuration of VisTrails
    
    """

    base_dir = {
        'abstractionsDirectory': (None, str),
        'alwaysShowDebugPopup': False,
        'autosave': True,
        'dataDirectory': (None, str),
        'dbDefault': False,
#        'debugSignals': False,
        'defaultFileType':system.vistrails_default_file_type(),
        'detachHistoryView': False,
        'dotVistrails': system.default_dot_vistrails(),
        'executeWorkflows': False,
        'fileDirectory': (None, str),
#        'evolutionGraph': (None, str),
        'interactiveMode': True,
        'logFile': (None, str),
        'logger': default_logger(),
        'maxMemory': (None, int),
        'maximizeWindows': False,
        'maxRecentVistrails': 5,
        'migrateTags': False,
        'minMemory': (None, int),
        'multiHeads': False,
        'nologger': True,
        'packageDirectory': (None, str),
        'pythonPrompt': False,
        'recentVistrailList': (None, str),
        'repositoryLocalPath': (None, str),
        'repositoryHTTPURL': "http://www.vistrails.org/packages",
        'reviewMode': False,
        'rootDirectory': (None, str),
        'shell': default_shell(),
        'showScrollbars': True,
        'showMovies': True,
        'showSplash': True,
        'showSpreadsheetOnly': False,
        'spreadsheetDumpCells': (None, str),
        'spreadsheetDumpPDF': False,
        'staticRegistry': (None, str),
        'thumbs': default_thumbs(),
        'upgradeOn': True,
        'upgradeDelay': True,
        'upgradeModuleFailPrompt': True,
        'useCache': True,
        'userPackageDirectory': (None, str),
        'verbosenessLevel': (None, int),
#        'workflowGraph': (None, str),
#        'workflowInfo': (None, str),
        'webRepositoryLogin': (None, str),
        'webRepositoryURL': "http://www.crowdlabs.org",
        'isInServerMode': False,
        }
    specific_dir = add_specific_config(base_dir)
    return ConfigurationObject(**specific_dir)
Exemplo n.º 3
0
def untitled_locator():
    basename = 'untitled' + vistrails_default_file_type()
    config = get_vistrails_configuration()
    if config:
        dot_vistrails = config.dotVistrails
    else:
        dot_vistrails = default_dot_vistrails()
    fullname = os.path.join(dot_vistrails, basename)
    return FileLocator(fullname)
def untitled_locator():
    basename = 'untitled' + vistrails_default_file_type()
    config = get_vistrails_configuration()
    if config:
        dot_vistrails = config.dotVistrails
    else:
        dot_vistrails = default_dot_vistrails()
    fullname = os.path.join(dot_vistrails, basename)
    return FileLocator(fullname)
Exemplo n.º 5
0
def default():
    """ default() -> ConfigurationObject
    Returns the default configuration of VisTrails
    
    """

    base_dir = {
        'autosave': True,
        'dataDirectory': (None, str),
        'dbDefault': False,
        'debugSignals': False,
        'dotVistrails': system.default_dot_vistrails(),
        'fileDirectory': (None, str),
        'defaultFileType':system.vistrails_default_file_type(),
        'interactiveMode': True,
        'logger': default_logger(),
        'maxMemory': (None, int),
        'maximizeWindows': False,
        'minMemory': (None, int),
        'multiHeads': False,
        'nologger': True,
        'packageDirectory': (None, str),
        'pythonPrompt': False,
        'rootDirectory': (None, str),
        'shell': default_shell(),
        'showMovies': True,
        'showSplash': True,
        'useCache': True,
        'userPackageDirectory': (None, str),
        'verbosenessLevel': (None, int),
        'spreadsheetDumpCells': (None, str),
        'executeWorkflows': False,
        'showSpreadsheetOnly': False,
        }
    specific_dir = add_specific_config(base_dir)
    return ConfigurationObject(**specific_dir)
def initialize():
    global global_db, local_db, search_dbs, compress_by_default, db_access, \
        git_bin, tar_bin, debug
    
    if configuration.check('git_bin'):
        git_bin = configuration.git_bin
    if git_bin.startswith("@executable_path/"):
        non_expand_path = git_bin
        git_bin = get_executable_path(git_bin[len("@executable_path/"):])
        if git_bin is not None:
            configuration.git_bin = non_expand_path
    if git_bin is None:
        git_bin = 'git'
        configuration.git_bin = git_bin

    if configuration.check('tar_bin'):
        tar_bin = configuration.tar_bin
    if tar_bin.startswith("@executable_path/"):
        non_expand_path = tar_bin
        tar_bin = get_executable_path(tar_bin[len("@executable_path/"):])
        if tar_bin is not None:
            configuration.tar_bin = non_expand_path
    if tar_bin is None:
        tar_bin = 'tar'
        configuration.tar_bin = tar_bin
        
    if configuration.check('compress_by_default'):
        compress_by_default = configuration.compress_by_default
    if configuration.check('debug'):
        debug = configuration.debug
    if configuration.check('global_db'):
        global_db = configuration.global_db
    if configuration.check('local_db'):
        local_db = configuration.local_db
        if not os.path.exists(local_db):
            raise Exception('local_db "%s" does not exist' % local_db)
    else:
        local_db = os.path.join(default_dot_vistrails(), 'persistent_files')
        if not os.path.exists(local_db):
            try:
                os.mkdir(local_db)
            except:
                raise Exception('local_db "%s" does not exist' % local_db)

    git_init(local_db)
    debug_print('creating DatabaseAccess')
    db_path = os.path.join(local_db, '.files.db')
    db_access = DatabaseAccessSingleton(db_path)
    debug_print('done', db_access)
    
    search_dbs = [local_db,]
    if configuration.check('search_dbs'):
        try:
            check_paths = eval(configuration.search_dbs)
        except:
            print "*** persistence error: cannot parse search_dbs ***"
        for path in check_paths:
            if os.path.exists(path):
                search_dbs.append(path)
            else:
                print '*** persistence warning: cannot find path "%s"' % path
Exemplo n.º 7
0
def initialize():
    global global_db, local_db, search_dbs, compress_by_default, db_access, \
        git_bin, tar_bin, debug

    if configuration.check('git_bin'):
        git_bin = configuration.git_bin
    if git_bin.startswith("@executable_path/"):
        non_expand_path = git_bin
        git_bin = get_executable_path(git_bin[len("@executable_path/"):])
        if git_bin is not None:
            configuration.git_bin = non_expand_path
    if git_bin is None:
        git_bin = 'git'
        configuration.git_bin = git_bin

    if configuration.check('tar_bin'):
        tar_bin = configuration.tar_bin
    if tar_bin.startswith("@executable_path/"):
        non_expand_path = tar_bin
        tar_bin = get_executable_path(tar_bin[len("@executable_path/"):])
        if tar_bin is not None:
            configuration.tar_bin = non_expand_path
    if tar_bin is None:
        tar_bin = 'tar'
        configuration.tar_bin = tar_bin

    if configuration.check('compress_by_default'):
        compress_by_default = configuration.compress_by_default
    if configuration.check('debug'):
        debug = configuration.debug
    if configuration.check('global_db'):
        global_db = configuration.global_db
    if configuration.check('local_db'):
        local_db = configuration.local_db
        if not os.path.exists(local_db):
            raise Exception('local_db "%s" does not exist' % local_db)
    else:
        local_db = os.path.join(default_dot_vistrails(), 'persistent_files')
        if not os.path.exists(local_db):
            try:
                os.mkdir(local_db)
            except:
                raise Exception('local_db "%s" does not exist' % local_db)

    git_init(local_db)
    debug_print('creating DatabaseAccess')
    db_path = os.path.join(local_db, '.files.db')
    db_access = DatabaseAccessSingleton(db_path)
    debug_print('done', db_access)

    search_dbs = [
        local_db,
    ]
    if configuration.check('search_dbs'):
        try:
            check_paths = eval(configuration.search_dbs)
        except:
            print "*** persistence error: cannot parse search_dbs ***"
        for path in check_paths:
            if os.path.exists(path):
                search_dbs.append(path)
            else:
                print '*** persistence warning: cannot find path "%s"' % path