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


Python ConfigService.getAppDataDirectory方法代码示例

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


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

示例1: __init__

# 需要导入模块: from mantid.kernel import ConfigService [as 别名]
# 或者: from mantid.kernel.ConfigService import getAppDataDirectory [as 别名]
    def __init__(self, multifileinterpreter, main_window=None, globalfiguremanager=None):
        """
        Project Recovery class is aimed at allowing you to recovery your workbench project should you crash for whatever
         reason
        :param multifileinterpreter: MultiPythonFileInterpreter; An object that is used in workbench to represent the
        python script editor
        :param main_window: A reference to the main window object to be used as a parent to the project recovery GUIs
        :param globalfiguremanager: Based on the globalfiguremanager object expects an object with a dictionary on
        cls/self.figs for the object passed here which contains all of the plots open/needed to be saved
        """
        self._recovery_directory = os.path.join(ConfigService.getAppDataDirectory(),
                                                self.recovery_workbench_recovery_name)
        self._recovery_directory_hostname = os.path.join(self.recovery_directory, socket.gethostname())
        self._recovery_directory_pid = os.path.join(self.recovery_directory_hostname, str(os.getpid()))

        self._recovery_order_workspace_history_file = os.path.join(ConfigService.getAppDataDirectory(),
                                                                   self.recovery_ordered_recovery_file_name)

        self.recovery_enabled = ("true" == ConfigService[RECOVERY_ENABLED_KEY].lower())
        self.maximum_num_checkpoints = int(ConfigService[NO_OF_CHECKPOINTS_KEY])
        self.time_between_saves = int(ConfigService[SAVING_TIME_KEY])  # seconds

        # The recovery GUI's presenter is set when needed
        self.recovery_presenter = None

        self.thread_on = False

        # Set to true by workbench on close to kill the thread on completion of project save
        self.closing_workbench = False

        # Recovery loader and saver
        self.loader = ProjectRecoveryLoader(self, multi_file_interpreter=multifileinterpreter, main_window=main_window)
        self.saver = ProjectRecoverySaver(self, globalfiguremanager)
开发者ID:mantidproject,项目名称:mantid,代码行数:35,代码来源:projectrecovery.py

示例2: test_constructor_settings_are_set

# 需要导入模块: from mantid.kernel import ConfigService [as 别名]
# 或者: from mantid.kernel.ConfigService import getAppDataDirectory [as 别名]
    def test_constructor_settings_are_set(self):
        # Test the paths set in the constructor that are generated.
        self.assertEqual(self.pr.recovery_directory,
                         os.path.join(ConfigService.getAppDataDirectory(), "workbench-recovery"))
        self.assertEqual(self.pr.recovery_directory_hostname,
                         os.path.join(ConfigService.getAppDataDirectory(), "workbench-recovery", socket.gethostname()))
        self.assertEqual(self.pr.recovery_directory_pid,
                         os.path.join(ConfigService.getAppDataDirectory(), "workbench-recovery", socket.gethostname(),
                                      str(os.getpid())))
        self.assertEqual(self.pr.recovery_order_workspace_history_file,
                         os.path.join(ConfigService.getAppDataDirectory(), "ordered_recovery.py"))

        # Test config service values
        self.assertEqual(self.pr.time_between_saves, int(ConfigService[SAVING_TIME_KEY]))
        self.assertEqual(self.pr.maximum_num_checkpoints, int(ConfigService[NO_OF_CHECKPOINTS_KEY]))
        self.assertEqual(self.pr.recovery_enabled, ("true" == ConfigService[RECOVERY_ENABLED_KEY].lower()))
开发者ID:mantidproject,项目名称:mantid,代码行数:18,代码来源:test_projectrecovery.py

示例3: get_properties_directory

# 需要导入模块: from mantid.kernel import ConfigService [as 别名]
# 或者: from mantid.kernel.ConfigService import getAppDataDirectory [as 别名]
def get_properties_directory():
    return ConfigService.getAppDataDirectory()
开发者ID:mantidproject,项目名称:mantid,代码行数:4,代码来源:retrieve_recovery_files.py


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