コード例 #1
0
def createDictFromConfig():
    """ Read the configuration from scipion/config/scipionbox.conf.
     A dictionary will be created where each key will be a section starting
     by MICROSCOPE:, all variables that are in the GLOBAL section will be
     inherited by default.
    """
    # Read from users' config file.
    confGlobalDict = OrderedDict()
    confDict = OrderedDict()

    cp = ConfigParser()
    cp.optionxform = str  # keep case (stackoverflow.com/questions/1611799)

    confFile = pw.getConfigPath("scipionbox.conf")

    print "Reading conf file: ", confFile
    cp.read(confFile)

    GLOBAL = "GLOBAL"
    MICROSCOPE = "MICROSCOPE:"

    if not GLOBAL in cp.sections():
        raise Exception("Missing section %s in %s" % (GLOBAL, confFile))
    else:
        for opt in cp.options(GLOBAL):
            confGlobalDict[opt] = cp.get(GLOBAL, opt)

    for section in cp.sections():
        if section != GLOBAL and section.startswith(MICROSCOPE):
            sectionDict = OrderedDict(confGlobalDict)
            for opt in cp.options(section):
                sectionDict[opt] = cp.get(section, opt)
            confDict[section.replace(MICROSCOPE, '')] = sectionDict

    return confDict
コード例 #2
0
def createDictFromConfig():
    """ Read the configuration from scipion/config/scipionbox.conf.
     A dictionary will be created where each key will be a section starting
     by MICROSCOPE:, all variables that are in the GLOBAL section will be
     inherited by default.
    """
    # Read from users' config file.
    confGlobalDict = OrderedDict()
    confDict = OrderedDict()

    cp = ConfigParser()
    cp.optionxform = str  # keep case (stackoverflow.com/questions/1611799)

    confFile = pw.getConfigPath("scipionbox.conf")

    print "Reading conf file: ", confFile
    cp.read(confFile)

    GLOBAL = "GLOBAL"
    MICROSCOPE = "MICROSCOPE:"

    if not GLOBAL in cp.sections():
        raise Exception("Missing section %s in %s" % (GLOBAL, confFile))
    else:
        for opt in cp.options(GLOBAL):
            confGlobalDict[opt] = cp.get(GLOBAL, opt)

    for section in cp.sections():
        if section != GLOBAL and section.startswith(MICROSCOPE):
            sectionDict = OrderedDict(confGlobalDict)
            for opt in cp.options(section):
                sectionDict[opt] = cp.get(section, opt)
            confDict[section.replace(MICROSCOPE, '')] = sectionDict

    return confDict
コード例 #3
0
    def _getHTMLTemplatePath(self):
        """ Returns the path of the customized template at
        config/execution.summary.html or the standard scipion HTML template"""
        # Try if there is a customized template
        template = getConfigPath('execution.summary.html')

        if not os.path.exists(template):
            template = getTemplatePath('execution.summary.template.html')
        else:
            print("Customized HTML template found at %s." % template)
        return template
コード例 #4
0
    def _openConfigFile(self, configFile, userOnly=False):
        """ Open an Scipion configuration file, if the user have one defined,
        also open that one with the defined text editor.
        """
        if not userOnly:
            _open_cmd(pw.getConfigPath(configFile))

        userHostConf = os.path.join(pwutils.getHomePath(), '.config',
                                    'scipion', configFile)
        if os.path.exists(userHostConf):
            _open_cmd(userHostConf)
コード例 #5
0
ファイル: report_html.py プロジェクト: I2PC/scipion
    def _getHTMLTemplatePath(self):
        """ Returns the path of the customized template at
        config/execution.summary.html or the standard scipion HTML template"""
        # Try if there is a customized template
        template = getConfigPath('execution.summary.html')

        if not os.path.exists(template):
            template = getTemplatePath('execution.summary.template.html')
        else:
            print("Customized HTML template found at %s." % template)
        return template
コード例 #6
0
ファイル: project.py プロジェクト: I2PC/scipion
    def _openConfigFile(self, configFile, userOnly=False):
        """ Open an Scipion configuration file, if the user have one defined,
        also open that one with the defined text editor.
        """
        if not userOnly:
            _open_cmd(pw.getConfigPath(configFile))

        userHostConf = os.path.join(pwutils.getHomePath(),
                                    '.config', 'scipion', configFile)
        if os.path.exists(userHostConf):
            _open_cmd(userHostConf)
コード例 #7
0
 def onGeneral(self):
     # Config -> General
     _open_cmd(pw.getConfigPath('scipion.conf'))
コード例 #8
0
ファイル: pw_tutorial.py プロジェクト: I2PC/scipion
def getWorkflow(workflow):
    """ Return the full workflow path from
    the Scipion folder + config/workflows/
    """
    return pw.getConfigPath('workflows', workflow)
コード例 #9
0
ファイル: project.py プロジェクト: I2PC/scipion
 def onGeneral(self):
     # Config -> General
     _open_cmd(pw.getConfigPath('scipion.conf'))
コード例 #10
0
ファイル: pw_tutorial.py プロジェクト: yaizar/scipion-docker
def getWorkflow(workflow):
    """ Return the full workflow path from
    the Scipion folder + config/workflows/
    """
    return pw.getConfigPath('workflows', workflow)