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


Python Settings.loadSettings方法代码示例

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


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

示例1: initGallery

# 需要导入模块: from settings import Settings [as 别名]
# 或者: from settings.Settings import loadSettings [as 别名]
 def initGallery(self, path):
     """
     Creates new gallery basic structure.
     """
     logger.debug('Creating new gallery structure...')
     
     configpath = os.path.join(path, self.CONFIGDIR)
     thumbpath = os.path.join(configpath, self.THUMBDIR)
     
     # create config folder and files
     if not os.path.isdir(configpath):
         os.mkdir(configpath)
     if not os.path.isdir(thumbpath):
         os.mkdir(thumbpath)
     DatabaseModel(configpath)
     setmod = Settings(configpath)
     setmod.loadSettings()
     setmod.saveSettings()
开发者ID:gitter-badger,项目名称:EH-file-manager,代码行数:20,代码来源:gallery_manager.py

示例2: __init__

# 需要导入模块: from settings import Settings [as 别名]
# 或者: from settings.Settings import loadSettings [as 别名]
	def __init__(self):
		try:
			self.currentSettings = Settings.loadSettings(System.fileName)
		except(IOError):
			print 'No settings file found, reverting to default settings...'
			self.currentSettings = Settings()
			self.currentSettings.saveSettings(self.fileName)
						
		self.manager = Manager()
		self.sharedData = self.manager.dict()
		self.sharedData.update({
			'pad' : 'on',
			'sensors' : self.manager.list([Sensor(4), Sensor(17)]),
			'temp' : 0,
			'hum' : 0,
			'alarms' : self.manager.dict(), #if map empty => all green
			'fan_in' : 0.5,
			'fan_out': 0.5
		})		
		
		self.sharedData.update(self.currentSettings.set_d)
开发者ID:tibor0991,项目名称:OBM-BOB,代码行数:23,代码来源:system.py

示例3: GalleryManager

# 需要导入模块: from settings import Settings [as 别名]
# 或者: from settings.Settings import loadSettings [as 别名]
class GalleryManager():
    """
    Main class of application
    """
    CONFIGDIR = '.config'
    THUMBDIR = 'thumb'
    COOKIEFILE = 'cookies.yaml'
    THUMB_MAXSIZE = 180, 270
    
    # reserved category (folder) names
    RESERVED = {'new_dir':'_new', 'unsorted_dir':'_unsorted'}
    
    def __init__(self, gallerypath=''):
        self.gallerypath = str(gallerypath)
        
        self.configpath = None
        self.thumbpath = None
        
        self.dbmodel = None
        self.settings = None
        self.ehfetcher = None
        self.fakkufetcher = None
        
        if self.gallerypath is not '':
            self.openPath(self.gallerypath)
            
    def close(self):
        """
        Closes connection to gallery.
        """
        self.dbmodel.closeDatabase()
    
    def openPath(self, path):
        """
        Open path as a gallery and creates connection to its database. If path is not gallery creates empty gallery structure.
        """
        self.gallerypath = os.path.abspath(str(path))
        # checks if path is existing gallery. if not creates one.
        if self.isGallery(self.gallerypath) is False:
            self.initGallery(self.gallerypath)
        
        # def paths
        self.configpath = os.path.join(self.gallerypath, self.CONFIGDIR)
        self.thumbpath = os.path.join(self.configpath, self.THUMBDIR)
        
        # load settings
        self.settings = Settings(self.configpath)
        self.settings.loadSettings()
            
        # open connection to database
        self.dbmodel = DatabaseModel(self.configpath)
        self.dbmodel.openDatabase()   
        
        # init fetchers
        self.ehfetcher = EHFetcher(self)
        self.fakkufetcher = FakkuFetcher()
    
    def isGallery(self, path):
        """
        Checks if path leads to existing gallery.
        """
        configpath = os.path.join(str(path), self.CONFIGDIR)
        thumbpath = os.path.join(configpath, self.THUMBDIR)
        
        if os.path.isdir(configpath):
            database_path = os.path.join(configpath, DatabaseModel.FILENAME)
            
            if os.path.isfile(database_path) and os.path.isdir(thumbpath):
                logger.debug('isGallery: given path is existing gallery.')
                return True
            
        logger.debug('isGallery: given path is not gallery.')
        return False
        
    def initGallery(self, path):
        """
        Creates new gallery basic structure.
        """
        logger.debug('Creating new gallery structure...')
        
        configpath = os.path.join(path, self.CONFIGDIR)
        thumbpath = os.path.join(configpath, self.THUMBDIR)
        
        # create config folder and files
        if not os.path.isdir(configpath):
            os.mkdir(configpath)
        if not os.path.isdir(thumbpath):
            os.mkdir(thumbpath)
        DatabaseModel(configpath)
        setmod = Settings(configpath)
        setmod.loadSettings()
        setmod.saveSettings()
        
        # create default category folders
        # TODO - show confirm dialog before touching files
        #self.initFolders(path, setmod) # disabled for now
                
    def initFolders(self, path, settings): 
        # TODO - decide if use or remove
        """
#.........这里部分代码省略.........
开发者ID:gitter-badger,项目名称:EH-file-manager,代码行数:103,代码来源:gallery_manager.py

示例4: ButtonTestScreen

# 需要导入模块: from settings import Settings [as 别名]
# 或者: from settings.Settings import loadSettings [as 别名]
from numberchangescreen import NumberChangeScreen
from teamassign import TeamAssignScreen
from buttontest import ButtonTestScreen
from mainscreen import MainScreen
from matchoptionsscreen import MatchOptionsScreen
from systemoptionsscreen import SystemOptionsScreen
from runmatchscreen import RunMatchScreen
from About import AboutScreen
from systemtests import SystemTestsScreen
from robotasignmentscreen import RobotAssignmentScreen
from matchsetup import PrepareMatchScreen
from startmatch import StartMatchScreen
from bluetoothtests import BluetoothTestsScreen
from settings import Settings

Settings.loadSettings()

# each one of these calls instantiates an object that ends-up on the
# superclass "Screen" array of screens.  Screen switching is handled
# by finding a specific screen in this array.  The names of the screens
# are hard-coded within all of the screens as they link from one to
# another.
#
# Current list of screens and names:
#
#     ButtonTestScreen() - "ButtonTestScreen"
#     OptionScreen() - "option"
#     MatchSetupScreen() - "

# All of the match info is stored in match object
MatchObject = Match()
开发者ID:ChapResearch,项目名称:ChapR-FCS,代码行数:33,代码来源:main.py


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