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


Python config.get_user_config函数代码示例

本文整理汇总了Python中ubuntuone.syncdaemon.config.get_user_config函数的典型用法代码示例。如果您正苦于以下问题:Python get_user_config函数的具体用法?Python get_user_config怎么用?Python get_user_config使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: setUp

    def setUp(self):
        yield super(BaseTwistedTestCase, self).setUp()
        self.__root = None

        # Patch the user home
        self.home_dir = self.mktemp("ubuntuonehacker")
        self.patch(platform, "user_home", self.home_dir)

        # use the config from the branch
        new_get_config_files = lambda: [os.path.join(os.environ["ROOTDIR"], "data", "syncdaemon.conf")]
        self.patch(config, "get_config_files", new_get_config_files)

        # fake a very basic config file with sane defaults for the tests
        config_dir = self.mktemp("config")
        self.config_file = os.path.join(config_dir, "syncdaemon.conf")
        with open(self.config_file, "w") as fp:
            fp.write("[bandwidth_throttling]\n")
            fp.write("on = False\n")
            fp.write("read_limit = -1\n")
            fp.write("write_limit = -1\n")
        # invalidate the current config
        config._user_config = None
        config.get_user_config(config_file=self.config_file)

        self.log = logging.getLogger("ubuntuone.SyncDaemon.TEST")
        self.log.info("starting test %s.%s", self.__class__.__name__, self._testMethodName)
        self.patch(action_queue.tunnel_runner, "TunnelRunner", self.tunnel_runner_class)
开发者ID:magicicada-bot,项目名称:magicicada-client,代码行数:27,代码来源:testcase.py

示例2: __init__

 def __init__(self, fsm, vm, status_frontend):
     """Initialize this instance with the FSM and VM."""
     self.fsm = fsm
     self.vm = vm
     self.status_frontend = status_frontend
     user_conf = config.get_user_config()
     self.show_all_notifications = user_conf.get_show_all_notifications()
开发者ID:thnguyn2,项目名称:ECE_527_MP,代码行数:7,代码来源:status_listener.py

示例3: set_throttling_limits

 def set_throttling_limits(self, download, upload,
                      reply_handler=None, error_handler=None):
     """Set the read and write limits. The expected values are bytes/sec."""
     logger.debug("called set_throttling_limits")
     try:
         # modify and save the config file
         user_config = config.get_user_config()
         user_config.set_throttling_read_limit(download)
         user_config.set_throttling_write_limit(upload)
         user_config.save()
         # modify AQ settings
         aq = self.action_queue
         if download == -1:
             download = None
         if upload == -1:
             upload = None
         aq.readLimit = download
         aq.writeLimit = upload
         if reply_handler:
             reply_handler()
         # pylint: disable-msg=W0703
     except Exception, e:
         if error_handler:
             error_handler(e)
         else:
             raise
开发者ID:Alberto-Beralix,项目名称:Beralix,代码行数:26,代码来源:interaction_interfaces.py

示例4: _set_throttling_enabled

 def _set_throttling_enabled(self, enabled):
     """Set throttling enabled value and save the config"""
     # modify and save the config file
     user_config = config.get_user_config()
     user_config.set_throttling(enabled)
     user_config.save()
     # modify AQ settings
     if enabled:
         self.action_queue.enable_throttling()
     else:
         self.action_queue.disable_throttling()
开发者ID:Alberto-Beralix,项目名称:Beralix,代码行数:11,代码来源:interaction_interfaces.py

示例5: set_throttling_limits

    def set_throttling_limits(self, download, upload):
        """Set the read and write limits. The expected values are bytes/sec."""
        # modify and save the config file
        user_config = config.get_user_config()
        user_config.set_throttling_read_limit(download)
        user_config.set_throttling_write_limit(upload)
        user_config.save()

        # modify AQ settings
        if download == -1:
            download = None
        if upload == -1:
            upload = None
        self.action_queue.readLimit = download
        self.action_queue.writeLimit = upload
开发者ID:magicicada-bot,项目名称:magicicada-client,代码行数:15,代码来源:interaction_interfaces.py

示例6: enable_files_sync

 def enable_files_sync(self, enabled):
     """Enable/disable files sync."""
     config = get_user_config()
     was_enabled = config.get_files_sync_enabled()
     self.log.debug('enable_files_sync: enable? %r was enabled? %r',
                    enabled, was_enabled)
     if was_enabled:
         yield self.client.config.set_files_sync_enabled(enabled)
         config.set_files_sync_enabled(enabled)
         if not enabled:
             # User requested the service to be disabled
             self.quit()
     else:
         if enabled:
             config.set_files_sync_enabled(True)
             config.save()
             self.start()
开发者ID:Alberto-Beralix,项目名称:Beralix,代码行数:17,代码来源:tools.py

示例7: show_all_notifications_enabled

 def show_all_notifications_enabled(self):
     """Return the show_all_notifications config value."""
     return config.get_user_config().get_show_all_notifications()
开发者ID:Alberto-Beralix,项目名称:Beralix,代码行数:3,代码来源:interaction_interfaces.py

示例8: set_autoconnect_enabled

 def set_autoconnect_enabled(self, enabled):
     """Enable syncdaemon autoconnect."""
     user_config = config.get_user_config()
     user_config.set_autoconnect(enabled)
     user_config.save()
开发者ID:Alberto-Beralix,项目名称:Beralix,代码行数:5,代码来源:interaction_interfaces.py

示例9: autoconnect_enabled

 def autoconnect_enabled(self):
     """Return the autoconnect config value."""
     return config.get_user_config().get_autoconnect()
开发者ID:Alberto-Beralix,项目名称:Beralix,代码行数:3,代码来源:interaction_interfaces.py

示例10: files_sync_enabled

 def files_sync_enabled(self):
     """Return the files_sync_enabled config value."""
     logger.debug('called files_sync_enabled')
     return config.get_user_config().get_files_sync_enabled()
开发者ID:Alberto-Beralix,项目名称:Beralix,代码行数:4,代码来源:interaction_interfaces.py

示例11: set_files_sync_enabled

 def set_files_sync_enabled(self, enabled):
     """Enable/disable file sync service."""
     logger.debug('called set_files_sync_enabled %d', enabled)
     user_config = config.get_user_config()
     user_config.set_files_sync_enabled(bool(int(enabled)))
     user_config.save()
开发者ID:Alberto-Beralix,项目名称:Beralix,代码行数:6,代码来源:interaction_interfaces.py

示例12: disable_share_autosubscribe

 def disable_share_autosubscribe(self):
     """Enable UDF autosubscribe."""
     user_config = config.get_user_config()
     user_config.set_share_autosubscribe(False)
     user_config.save()
开发者ID:Alberto-Beralix,项目名称:Beralix,代码行数:5,代码来源:interaction_interfaces.py

示例13: files_sync_enabled

 def files_sync_enabled(self):
     """Return the files_sync_enabled config value."""
     return config.get_user_config().get_files_sync_enabled()
开发者ID:magicicada-bot,项目名称:magicicada-client,代码行数:3,代码来源:interaction_interfaces.py

示例14: enable_udf_autosubscribe

 def enable_udf_autosubscribe(self):
     """Enable UDF autosubscribe."""
     user_config = config.get_user_config()
     user_config.set_udf_autosubscribe(True)
     user_config.save()
开发者ID:Alberto-Beralix,项目名称:Beralix,代码行数:5,代码来源:interaction_interfaces.py

示例15: is_files_sync_enabled

 def is_files_sync_enabled(self):
     """Check if files sync is enabled."""
     self.log.debug('is_files_sync_enabled')
     return get_user_config().get_files_sync_enabled()
开发者ID:Alberto-Beralix,项目名称:Beralix,代码行数:4,代码来源:tools.py


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