当前位置: 首页>>代码示例>>Python>>正文


Python ConfigService.getString方法代码示例

本文整理汇总了Python中mantid.kernel.ConfigService.getString方法的典型用法代码示例。如果您正苦于以下问题:Python ConfigService.getString方法的具体用法?Python ConfigService.getString怎么用?Python ConfigService.getString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在mantid.kernel.ConfigService的用法示例。


在下文中一共展示了ConfigService.getString方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: load_current_setting_values

# 需要导入模块: from mantid.kernel import ConfigService [as 别名]
# 或者: from mantid.kernel.ConfigService import getString [as 别名]
    def load_current_setting_values(self):
        self.view.prompt_save_on_close.setChecked(CONF.get(self.PROMPT_SAVE_ON_CLOSE))
        self.view.prompt_save_editor_modified.setChecked(CONF.get(self.PROMPT_SAVE_EDITOR_MODIFIED))

        # compare lower-case, because MantidPlot will save it as lower case,
        # but Python will have the bool's first letter capitalised
        pr_enabled = ("true" == ConfigService.getString(self.PR_RECOVERY_ENABLED).lower())
        pr_time_between_recovery = int(ConfigService.getString(self.PR_TIME_BETWEEN_RECOVERY))
        pr_number_checkpoints = int(ConfigService.getString(self.PR_NUMBER_OF_CHECKPOINTS))

        self.view.project_recovery_enabled.setChecked(pr_enabled)
        self.view.time_between_recovery.setValue(pr_time_between_recovery)
        self.view.total_number_checkpoints.setValue(pr_number_checkpoints)
开发者ID:mantidproject,项目名称:mantid,代码行数:15,代码来源:presenter.py

示例2: remove_output_files

# 需要导入模块: from mantid.kernel import ConfigService [as 别名]
# 或者: from mantid.kernel.ConfigService import getString [as 别名]
def remove_output_files(list_of_names=None):
    """Removes output files created during a test."""

    # import ConfigService here to avoid:
    # RuntimeError: Pickling of "mantid.kernel._kernel.ConfigServiceImpl"
    # instances is not enabled (http://www.boost.org/libs/python/doc/v2/pickle.html)

    from mantid.kernel import ConfigService

    if not isinstance(list_of_names, list):
        raise ValueError("List of names is expected.")
    if not all(isinstance(i, str) for i in list_of_names):
        raise ValueError("Each name should be a string.")

    save_dir_path = ConfigService.getString("defaultsave.directory")
    if save_dir_path != "":  # default save directory set
        all_files = os.listdir(save_dir_path)
    else:
        all_files = os.listdir(os.getcwd())

    for filename in all_files:
        for name in list_of_names:
            if name in filename:
                full_path = os.path.join(save_dir_path, filename)
                if os.path.isfile(full_path):
                    os.remove(full_path)
                break
开发者ID:mantidproject,项目名称:mantid,代码行数:29,代码来源:AbinsTestHelpers.py

示例3: setup_checkbox_signals

# 需要导入模块: from mantid.kernel import ConfigService [as 别名]
# 或者: from mantid.kernel.ConfigService import getString [as 别名]
    def setup_checkbox_signals(self):
        self.view.show_invisible_workspaces.setChecked(
            "true" == ConfigService.getString(self.SHOW_INVISIBLE_WORKSPACES).lower())

        self.view.show_invisible_workspaces.stateChanged.connect(self.action_show_invisible_workspaces)
        self.view.project_recovery_enabled.stateChanged.connect(self.action_project_recovery_enabled)
        self.view.time_between_recovery.valueChanged.connect(self.action_time_between_recovery)
        self.view.total_number_checkpoints.valueChanged.connect(self.action_total_number_checkpoints)
开发者ID:mantidproject,项目名称:mantid,代码行数:10,代码来源:presenter.py

示例4: get_number_of_checkpoints

# 需要导入模块: from mantid.kernel import ConfigService [as 别名]
# 或者: from mantid.kernel.ConfigService import getString [as 别名]
 def get_number_of_checkpoints():
     """
     :return: int; The maximum number of checkpoints project recovery should allow
     """
     try:
         return int(ConfigService.getString("projectRecovery.numberOfCheckpoints"))
     except Exception as e:
         if isinstance(e, KeyboardInterrupt):
             raise
         # Fail silently and return 5 (the default)
         return DEFAULT_NUM_CHECKPOINTS
开发者ID:mantidproject,项目名称:mantid,代码行数:13,代码来源:projectrecoverymodel.py

示例5: __init__

# 需要导入模块: from mantid.kernel import ConfigService [as 别名]
# 或者: from mantid.kernel.ConfigService import getString [as 别名]
    def __init__(self, input_filename=None, group_name=None):

        if isinstance(input_filename, str):

            self._input_filename = input_filename
            try:
                self._hash_input_filename = self.calculate_ab_initio_file_hash()
            except IOError as err:
                logger.error(str(err))
            except ValueError as err:
                logger.error(str(err))

            # extract name of file from the full path in the platform independent way
            filename = os.path.basename(self._input_filename)

            if filename.strip() == "":
                raise ValueError("Name of the file cannot be an empty string.")

        else:
            raise ValueError("Invalid name of input file. String was expected.")

        if isinstance(group_name, str):
            self._group_name = group_name
        else:
            raise ValueError("Invalid name of the group. String was expected.")

        core_name = filename[0:filename.rfind(".")]
        save_dir_path = ConfigService.getString("defaultsave.directory")
        self._hdf_filename = os.path.join(save_dir_path, core_name + ".hdf5")  # name of hdf file

        try:
            self._advanced_parameters = self._get_advanced_parameters()
        except IOError as err:
            logger.error(str(err))
        except ValueError as err:
            logger.error(str(err))

        self._attributes = {}  # attributes for group

        # data  for group; they are expected to be numpy arrays or
        # complex data sets which have the form of Python dictionaries or list of Python
        # dictionaries
        self._data = {}
开发者ID:DanNixon,项目名称:mantid,代码行数:45,代码来源:IOmodule.py

示例6: save_directory

# 需要导入模块: from mantid.kernel import ConfigService [as 别名]
# 或者: from mantid.kernel.ConfigService import getString [as 别名]
 def save_directory(self):
     return ConfigService.getString('defaultsave.directory')
开发者ID:samueljackson92,项目名称:mantid,代码行数:4,代码来源:summation_settings.py

示例7: instrument

# 需要导入模块: from mantid.kernel import ConfigService [as 别名]
# 或者: from mantid.kernel.ConfigService import getString [as 别名]
 def instrument(self):
     return ConfigService.getString('default.instrument')
开发者ID:samueljackson92,项目名称:mantid,代码行数:4,代码来源:summation_settings.py

示例8: __init__

# 需要导入模块: from mantid.kernel import ConfigService [as 别名]
# 或者: from mantid.kernel.ConfigService import getString [as 别名]
 def __init__(self, initial_type):
     self._save_directory = ConfigService.getString('defaultsave.directory')
     self._type_factory_dict = {BinningType.SaveAsEventData: SaveAsEventData(),
                                BinningType.Custom: CustomBinning(),
                                BinningType.FromMonitors: BinningFromMonitors()}
     self._settings, self._type = self._settings_from_type(initial_type)
开发者ID:mantidproject,项目名称:mantid,代码行数:8,代码来源:summation_settings.py

示例9: test_get_number_of_checkpoints

# 需要导入模块: from mantid.kernel import ConfigService [as 别名]
# 或者: from mantid.kernel.ConfigService import getString [as 别名]
 def test_get_number_of_checkpoints(self):
     self.assertEqual(int(ConfigService.getString(NO_OF_CHECKPOINTS_KEY)),
                      self.prm.get_number_of_checkpoints())
开发者ID:mantidproject,项目名称:mantid,代码行数:5,代码来源:test_projectrecoverymodel.py


注:本文中的mantid.kernel.ConfigService.getString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。