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


Python MythSettings.get方法代码示例

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


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

示例1: test_constructor_NonExistentSettingsFilesLoadsDefaults

# 需要导入模块: from mythbox.settings import MythSettings [as 别名]
# 或者: from mythbox.settings.MythSettings import get [as 别名]
 def test_constructor_NonExistentSettingsFilesLoadsDefaults(self):
     when(self.platform).getScriptDataDir().thenReturn(self.sandbox)
     s = MythSettings(self.platform, self.translator)
     self.assertEquals("localhost", s.get("mysql_host"))
     self.assertEquals("3306", s.get("mysql_port"))
     self.assertEquals("mythconverg", s.get("mysql_database"))
     self.assertEquals("mythtv", s.get("mysql_user"))
     self.assertEquals("change_me", s.get("mysql_password"))
开发者ID:Berimor66,项目名称:mythbox,代码行数:10,代码来源:test_settings.py

示例2: test_When_existing_setting_changed_to_different_value_Then_event_published_to_bus

# 需要导入模块: from mythbox.settings import MythSettings [as 别名]
# 或者: from mythbox.settings.MythSettings import get [as 别名]
    def test_When_existing_setting_changed_to_different_value_Then_event_published_to_bus(self):
        # Setup
        when(self.platform).getScriptDataDir().thenReturn(self.sandbox)
        s = MythSettings(self.platform, self.translator, bus=self.bus)

        # Test
        s.get("mysql_host")
        s.put("mysql_host", "foo")

        # Verify
        verify(self.bus, 1).publish(any(dict))
开发者ID:Berimor66,项目名称:mythbox,代码行数:13,代码来源:test_settings.py

示例3: test_constructor_LoadExistingSettingsFile

# 需要导入模块: from mythbox.settings import MythSettings [as 别名]
# 或者: from mythbox.settings.MythSettings import get [as 别名]
    def test_constructor_LoadExistingSettingsFile(self):
        # Setup
        settingsDir = os.path.join("resources", "test")
        settingsFile = "test_mythtv_settings.xml"
        when(self.platform).getScriptDataDir().thenReturn(settingsDir)

        # Test
        s = MythSettings(self.platform, self.translator, settingsFile)

        # Verify
        self.assertEquals("test_host", s.get("mysql_host"))
        self.assertEquals("9999", s.get("mysql_port"))
        self.assertEquals("test_database", s.get("mysql_database"))
        self.assertEquals("test_user", s.get("mysql_user"))
        self.assertEquals("test_password", s.get("mysql_password"))
开发者ID:Berimor66,项目名称:mythbox,代码行数:17,代码来源:test_settings.py

示例4: test_getRecordingDirs_SingleDirectory

# 需要导入模块: from mythbox.settings import MythSettings [as 别名]
# 或者: from mythbox.settings.MythSettings import get [as 别名]
 def test_getRecordingDirs_SingleDirectory(self):
     when(self.platform).getScriptDataDir().thenReturn(self.sandbox)
     settings = MythSettings(self.platform, self.translator)
     settings.put("paths_recordedprefix", "/mnt/mythtv")
     log.debug("Recording prefix = %s" % settings.get("paths_recordedprefix"))
     dirs = settings.getRecordingDirs()
     self.assertEquals(1, len(dirs))
     self.assertEquals("/mnt/mythtv", dirs[0])
开发者ID:Berimor66,项目名称:mythbox,代码行数:10,代码来源:test_settings.py

示例5: test_getRecordingDirs_ManyDirectories

# 需要导入模块: from mythbox.settings import MythSettings [as 别名]
# 或者: from mythbox.settings.MythSettings import get [as 别名]
 def test_getRecordingDirs_ManyDirectories(self):
     when(self.platform).getScriptDataDir().thenReturn(self.sandbox)
     settings = MythSettings(self.platform, self.translator)
     settings.put("paths_recordedprefix", os.pathsep.join(["a", "b", "c"]))
     log.debug("Recording prefix = %s" % settings.get("paths_recordedprefix"))
     dirs = settings.getRecordingDirs()
     self.assertEquals(3, len(dirs))
     self.assertEquals(["a", "b", "c"], dirs)
开发者ID:Berimor66,项目名称:mythbox,代码行数:10,代码来源:test_settings.py

示例6: test_When_setting_has_a_unicode_value_Then_saving_and_loading_should_still_work

# 需要导入模块: from mythbox.settings import MythSettings [as 别名]
# 或者: from mythbox.settings.MythSettings import get [as 别名]
    def test_When_setting_has_a_unicode_value_Then_saving_and_loading_should_still_work(self):
        when(self.platform).getScriptDataDir().thenReturn(self.sandbox)
        s = MythSettings(self.platform, self.translator)
        unicodeStr = u"Königreich der Himmel"
        s.put("recordings_selected_group", unicodeStr)
        s.save()

        s2 = MythSettings(self.platform, self.translator)
        actualStr = s2.get("recordings_selected_group")
        self.assertTrue(unicodeStr == actualStr)
        self.assertTrue(isinstance(unicodeStr, unicode))
开发者ID:Berimor66,项目名称:mythbox,代码行数:13,代码来源:test_settings.py

示例7: BootStrapper

# 需要导入模块: from mythbox.settings import MythSettings [as 别名]
# 或者: from mythbox.settings.MythSettings import get [as 别名]
class BootStrapper(object):
    
    def __init__(self, splash):
        self.log = None
        self.platform = None
        self.stage = 'Initializing'
        self.shell = None
        self.splash = splash
        self.failSilent = False
        
    def run(self):
        try:
            try:
                self.bootstrapLogger()
                self.bootstrapPlatform()
                self.bootstrapEventBus()            
                self.bootstrapCaches()
                self.bootstrapSettings()
                self.bootstrapUpdater()
                self.bootstrapFeeds()
                # TODO: Re-enable when twisted not loaded from dist-packages
                #self.bootstrapDebugShell()
                self.bootstrapHomeScreen()
            except Exception, ex:
                if not self.failSilent:
                    self.handleFailure(ex)
        finally:
            if self.splash:
                self.splash.close()
            
    def handleFailure(self, cause):
        msg = 'MythBox:%s - Error: %s' % (self.stage, cause)
        xbmc.log(msg)
        print traceback.print_exc()
        if self.log:
            self.log.exception(str(cause))
        xbmcgui.Dialog().ok('MythBox Error', 'Stage: %s' % self.stage, 'Exception: %s' % str(cause))
        
    def updateProgress(self, msg):
        self.log.info(msg)

    def bootstrapLogger(self):
        import logging
        import logging.config
        self.stage = 'Initializing Logger'
        
        import xbmcaddon
        scriptDir = xbmcaddon.Addon('script.mythbox').getAddonInfo('path')
        loggerIniFile = os.path.join(scriptDir, 'mythbox_log.ini')

        # needs to be in local scope for fileConfig to find it
        from mythbox.log import XbmcLogHandler
        
        xbmc.log('MythBox: loggerIniFile = %s' % loggerIniFile)
        logging.config.fileConfig(loggerIniFile)
        self.log = logging.getLogger('mythbox.core')
        self.log.info('Mythbox Logger Initialized')

    def bootstrapPlatform(self):
        self.stage = 'Initializing Platform'
        import mythbox.platform
        self.platform = mythbox.platform.getPlatform()
        self.platform.addLibsToSysPath()
        sys.setcheckinterval(0)
        cacheDir = self.platform.getCacheDir()
        from mythbox.util import requireDir
        requireDir(cacheDir)
        
        self.log.info('MythBox %s Initialized' % self.platform.addonVersion())

    def bootstrapEventBus(self):
        self.bus = EventBus()

    def bootstrapCaches(self):
        self.stage = 'Initializing Caches'
        
        from mythbox.util import NativeTranslator
        from mythbox.filecache import FileCache, HttpResolver, MythThumbnailFileCache
        from mythbox.mythtv.resolver import MythChannelIconResolver, MythThumbnailResolver 
        from os.path import join

        from mythbox.mythtv.cache import DomainCache
        self.domainCache = DomainCache(bus=self.bus)
        
        cacheDir = self.platform.getCacheDir()
        self.translator = NativeTranslator(self.platform.getScriptDir())
        self.mythThumbnailCache = MythThumbnailFileCache(join(cacheDir, 'thumbnail'), MythThumbnailResolver(), self.bus, self.domainCache)
        self.mythChannelIconCache = FileCache(join(cacheDir, 'channel'), MythChannelIconResolver())
        self.httpCache = FileCache(join(cacheDir, 'http'), HttpResolver())
        
        self.cachesByName = {
            'mythThumbnailCache'  : self.mythThumbnailCache, 
            'mythChannelIconCache': self.mythChannelIconCache, 
            'httpCache'           : self.httpCache,
            'domainCache'         : self.domainCache
        }

    def bootstrapSettings(self):
        self.stage = 'Initializing Settings'
        from mythbox.settings import MythSettings
#.........这里部分代码省略.........
开发者ID:analogue,项目名称:mythbox,代码行数:103,代码来源:bootstrapper.py


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