Esempio n. 1
0
    for section in default_Preferences.sections():
        if not Preferences.has_section(section):
            Preferences.add_section(section)
            change = True
        for option in default_Preferences.options(section):
            if not Preferences.has_option(section, option):
                value = default_Preferences.get(section, option)
                Preferences.set(section, option, value)
                change = True
    if change:
        Preferences.write(open(conf_dir + "pychemqtrc", "w"))

# FIXME: This file might not to be useful but for now I use it to save project
# configuration data
if not os.path.isfile(conf_dir + "pychemqtrc_temporal"):
    Config = firstrun.config()
    Config.write(open(conf_dir + "pychemqtrc_temporal", "w"))

# Checking costindex
if not os.path.isfile(conf_dir + "CostIndex.dat"):
        orig = os.path.join(os.environ["pychemqt"], "dat", "costindex.dat")
        with open(orig) as cost_index:
            lista = cost_index.readlines()[-1].split(" ")
            with open(conf_dir + "CostIndex.dat", "w") as archivo:
                for data in lista:
                    archivo.write(data.replace(os.linesep, "") + os.linesep)

# Checking currency rates
origen = os.path.join(os.environ["pychemqt"], "dat", "moneda.dat")
shutil.copy(origen, conf_dir + "moneda.dat")
Esempio n. 2
0
            change = True
        for option in default_Preferences.options(section):
            if not Preferences.has_option(section, option):
                value = default_Preferences.get(section, option)
                Preferences.set(section, option, value)
                change = True
                logging.warning("Using default configuration option for " +
                                "%s:%s" % (section, option) +
                                ", run preferences dialog for configure")
    if change:
        Preferences.write(open(conf_dir + "pychemqtrc", "w"))

# FIXME: This file might not to be useful but for now I use it to save project
# configuration data
if not os.path.isfile(conf_dir + "pychemqtrc_temporal"):
    Config = firstrun.config()
    Config.write(open(conf_dir + "pychemqtrc_temporal", "w"))

# Checking costindex
splash.showMessage(
    QtWidgets.QApplication.translate("pychemqt", "Checking cost index..."))
if not os.path.isfile(conf_dir + "CostIndex.dat"):
    orig = os.path.join(os.environ["pychemqt"], "dat", "costindex.dat")
    with open(orig) as cost_index:
        lista = cost_index.readlines()[-1].split(" ")
        with open(conf_dir + "CostIndex.dat", "w") as archivo:
            for data in lista:
                archivo.write(data.replace(os.linesep, "") + os.linesep)

# Checking currency rates
splash.showMessage(