本文整理汇总了Python中settings.load函数的典型用法代码示例。如果您正苦于以下问题:Python load函数的具体用法?Python load怎么用?Python load使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了load函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: startup
def startup():
settings.load('settings.ini')
db.setup()
logging.getLogger().info("Checking database integrity.")
#db.connection.execute("VACUUM")
logging.getLogger().info("Integrity check complete. Continuing.")
示例2: finish
def finish(self):
newres = not self.resbuttons.buttonmap[settings.size].selected
newwin = not self.wbuttons.buttonmap[settings.fullscreen].selected
for buttonset in self.buttonsets:
for button in buttonset.buttons:
if button.selected:
button.confirm()
context.pop()
settings.save()
settings.load()
if newres or newwin:
vista.init()
示例3: load
def load():
print "main.load"
settings.load()
window = mc.GetActiveWindow()
window.GetControl(1).SetVisible(False)
focus_control = __restore_menu(window, __menu)
if focus_control:
print "SETTING focus in LOAD"
focus(focus_control)
else:
__set_title('Main')
window.GetList(MAIN_LIST_ID).SetVisible(True)
window.GetControl(1).SetVisible(True)
示例4: main
def main():
#start the game running
try:
# poke_types.load_data() #load pokemon type data
# pokemon.load_data()
map.load_data()
settings.load(g)
g.save = savegame.SaveGame(g) #initialize a new savegame manager
g.reset() #reset the game
g.mainloop() #start the main loop
except error.QuitException: #if it was just a forced quit
pass
except Exception as e: #if it's any other exception
error.exception_handler(g, e) #pass it to exception handler
g.keeprunning = False
示例5: set_properties
def set_properties(self):
# Load the settings
settings = Settings()
settings.load()
# Get the checkboxes
x11_forward = self.builder.get_object("chk_enable_x11")
request_compression = self.builder.get_object("chk_request_compress")
force_ipv4 = self.builder.get_object("radio_force_ipv4")
force_ipv6 = self.builder.get_object("radio_force_ipv6")
# Set the config
x11_forward.set_active(bool(settings.x11_forward))
request_compression.set_active(bool(settings.request_compression))
force_ipv4.set_active(bool(settings.force_ipv4))
force_ipv6.set_active(bool(settings.force_ipv6))
示例6: _set_subs_lang
def _set_subs_lang(self, subs):
if subs is not None:
sub_settings = settings.load("subtitles")
if 'lang' in sub_settings:
subs['lang'] = sub_settings['lang']
else:
subs['lang'] = 'eng'
return subs
示例7: _set_subs_lang
def _set_subs_lang(self, subs):
if subs is not None:
sub_settings = settings.load("subtitles")
if "lang" in sub_settings:
subs["lang"] = sub_settings["lang"]
else:
subs["lang"] = "eng"
return subs
示例8: _refresh
def _refresh(self):
channels = []
cpaths = glob.glob(path.join(locations.CHAN_PATH, CHANID_GLOB))
for p in cpaths:
channels.append(Channel(p, False))
cpaths = glob.glob(path.join(locations.PLUGIN_PATH, CHANID_GLOB))
for p in cpaths:
channels.append(Channel(p, True))
self.channels = sorted(channels, key=lambda chan: chan.getTitle().upper())
self.settings = settings.load("channels")
示例9: getpath
def getpath(force_select=False):
filename = settings.load().get("tzpath", "")
if not filename or force_select:
FILE_OPTS = ___ = dict()
___["title"] = u"Locate the 桶裝出貨表 file."
___["defaultextension"] = ".xls"
___["filetypes"] = [("Excel files", ".xls"), ("all files", ".*")]
___["initialdir"] = u"T:\\Users\\chairman\\Documents\\"
___["initialfile"] = u"桶裝出貨表.xls"
filename = os.path.normpath(tkFileDialog.askopenfilename(**FILE_OPTS))
settings.update(tzpath=filename)
return filename
示例10: _refresh
def _refresh(self):
channels = []
cpaths = glob.glob(path.join(locations.CHAN_PATH, CHANID_GLOB))
for p in cpaths:
try:
channels.append(Channel(p, False))
except ImportError:
pass
cpaths = glob.glob(path.join(locations.PLUGIN_PATH, CHANID_GLOB))
for p in cpaths:
try:
channels.append(Channel(p, True))
except ImportError:
pass
# Ignore channels with no image
channels = filter(lambda chan: chan.imageExists(), channels)
self.channels = sorted(channels, key=lambda chan: chan.getTitle().upper())
self.settings = settings.load("channels")
示例11: int
-si, --splitinto: number of files the source archive should be split into. If not specified, the number of files is
determined based on the archive rows limit config value
-c, --clear: delete all files from the archives directory before splitting
-v, --verbose: verbose mode
"""
import argparse
import os
import sys
sys.path.insert(0, os.path.realpath(os.path.join(os.path.dirname(__file__), '../../../../lib')))
from plugins.ucnk_conc_persistence3 import ArchMan
import settings
conf_path = os.path.realpath(os.path.join(os.path.dirname(__file__), '../../../../conf/config.xml'))
settings.load(conf_path)
plugin_conf = settings.get('plugins', 'conc_persistence3')
db_path = plugin_conf.get('ucnk:archive_db_path')
rows_limit = int(plugin_conf.get('ucnk:archive_rows_limit'))
arch_man = ArchMan(db_path, rows_limit)
parser = argparse.ArgumentParser()
parser.add_argument("source_archive", help="full path to the source archive db file")
parser.add_argument("-si", "--splitinto", help="number of files the source archive should be split into")
parser.add_argument("-c", "--clear", action="store_true", help="clear the archives directory before splitting")
parser.add_argument("-v", "--verbose", action="store_true", help="verbose mode")
args = parser.parse_args()
source_path = args.source_archive
if not os.path.exists(source_path):
示例12: quit
#!/usr/bin/python
from settings import load
from experiment import ExperimentSet
import traceback, sys, os
if __name__ == "__main__":
# Read arguments
try:
settingsfile = sys.argv[1]
print "Settings file: " + settingsfile
except IndexError:
print "Bad parameters, should be 'python engine.py settingsfile'"
quit()
# Generate variables
settings = load(settingsfile)
# Create and run the experiment
experiments = ExperimentSet(settings)
experiments.run()
print "Experiments concluded :)"
示例13: handleKnownUser
import action
import user
import iptv
#####################################################################
# Prerequisites #
#####################################################################
settings_file = '.settings.conf'
users_file = '.users.json'
handlers_dir = 'actions/'
# Table for global data storing
public = table.Table()
# Load settings
config = settings.load(settings_file)
# Load users list
users = user.UserStore(users_file)
# Load action handlers
actions = action.ActionStore()
actions.load(handlers_dir)
#####################################################################
# XMPP specific methods #
#####################################################################
def handleKnownUser(connection, message, params):
data = params.data
user = params.self
handler, match = actions.select(data, user.access or 0)
示例14: controller_class
controller_class = self.load_controller_class(environ['PATH_INFO'])
app = controller_class(request=request, ui_lang=ui_lang)
status, headers, sid_is_valid, body = app.run()
response = Response(response=body, status=status, headers=headers)
if not sid_is_valid:
curr_data = dict(request.session)
request.session = sessions.new()
request.session.update(curr_data)
request.session.modified = True
if request.session.should_save:
sessions.save(request.session)
response.set_cookie(sessions.get_cookie_name(), request.session.sid)
return response(environ, start_response)
settings.load(path=CONF_PATH)
if settings.get('global', 'manatee_path', None):
sys.path.insert(0, settings.get('global', 'manatee_path'))
# please note that some environments may provide umask setting themselves
if settings.get('global', 'umask', None):
os.umask(int(settings.get('global', 'umask'), 8))
if not settings.get_bool('global', 'maintenance'):
application = KonTextWsgiApp()
else:
application = MaintenanceWsgiApp()
robots_path = os.path.join(os.path.dirname(__file__), 'files/robots.txt')
if os.path.isfile(robots_path):
示例15: get_db
import settings
def get_db(conf):
return redis.StrictRedis(host=conf['default:host'], port=int(conf['default:port']), db=int(conf['default:id']))
if __name__ == '__main__':
import argparse
argparser = argparse.ArgumentParser(description="RedisDB clean-up utility")
argparser.add_argument('clean_what', metavar="ACTION", help="what item group should be cleaned (session, concordance)")
args = argparser.parse_args()
patterns = {
'session': 'session:*',
'concordance': 'concordance:*'
}
if not args.clean_what in patterns:
raise ValueError('Unknown action: %s' % args.clean_what)
settings.load('%s/conf/config.xml' % app_path)
db = get_db(settings.get('plugins', 'db'))
keys = db.keys(patterns[args.clean_what])
i = 0
for key in keys:
db.delete(key)
print('deleted: %s' % key)
i += 1
print('Finished deleting %d keys' % i)