本文整理汇总了Python中settings.settings函数的典型用法代码示例。如果您正苦于以下问题:Python settings函数的具体用法?Python settings怎么用?Python settings使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了settings函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test_setters_and_signals
def test_setters_and_signals(self):
"""
Checks the singleton properties of settings as well as setters,
signals and save behavior.
"""
s = settings.settings()
s2 = settings.settings()
changed = defaultdict(lambda: False)
def track_changed(onwhat, name):
def slot():
changed[name] = True
getattr(onwhat, name + "_changed").connect(slot)
track_changed(s, "main_window_geometry")
track_changed(s, "main_window_state")
s.main_window_geometry = QtCore.QByteArray("hi")
self.assertTrue(changed["main_window_geometry"])
self.assertEqual(s2.main_window_geometry, QtCore.QByteArray("hi"))
s.main_window_state = QtCore.QByteArray("there")
self.assertTrue(changed["main_window_state"])
self.assertEqual(s2.main_window_state, QtCore.QByteArray("there"))
s.save()
self.assertEqual(self.settings_mock.values["main_window_geometry"],
QtCore.QByteArray("hi"))
self.assertEqual(self.settings_mock.values["main_window_state"],
QtCore.QByteArray("there"))
开发者ID:hacst,项目名称:LogikSimPython,代码行数:32,代码来源:test_settings.py
示例2: __init__
def __init__(self,s3conn=None,bucket=None):
if not s3conn:
s3conn = S3.AWSAuthConnection(settings('AWS_ACCESS_KEY_ID'),settings('AWS_SECRET_ACCESS_KEY'))
self.s3conn = s3conn
if not bucket:
bucket = settings('APP_BUCKET')
self.bucket = bucket
开发者ID:topher515,项目名称:piles.io,代码行数:7,代码来源:contentstore.py
示例3: nereden
def nereden(self):
dosya = QFileDialog.getOpenFileName(self, "", settings().value("Genel/Yol").toString())
if dosya == "":
pass
elif QFile.exists(dosya):
from os.path import abspath, dirname
settings().setValue("Genel/Yol", abspath(dirname(str(dosya))))
self.neredenEdit.setText(dosya)
else:
QMessageBox.warning(self, self.trUtf8("Hata!"), self.trUtf8("Böyle bir dosya mevcut değil!"))
开发者ID:mthnzbk,项目名称:parcala,代码行数:10,代码来源:dogrula.py
示例4: nereye
def nereye(self):
dosya = QFileDialog.getSaveFileName(self, "", settings().value("Genel/Yol").toString())
if not dosya == "":
if dosya[-3:] == "001":
self.nereyeEdit.setText(dosya)
from os.path import abspath, dirname
settings().setValue("Genel/Yol", abspath(dirname(str(dosya))))
return
self.nereyeEdit.setText(dosya+".001")
from os.path import abspath, dirname
settings().setValue("Genel/Yol", abspath(dirname(str(dosya))))
开发者ID:mthnzbk,项目名称:parcala,代码行数:11,代码来源:parcala.py
示例5: FormatChangeLog
def FormatChangeLog(changelog, name, connection):
localsettings = settings.settings(False)
localsettings.GetSettings()
output = name + "\n\n"
count = 0
for a in changelog.split("$$$"):
date = a.split("%%%")[0]
userid = a.split("%%%")[1]
try:
action = "SELECT Name FROM user WHERE ID = " + str(userid)
results = db.SendSQL(action, connection)
username = results[0][0]
except:
username = localsettings.dictionary["userdeleted"][localsettings.language]
output = output + date + " - " + username + "\n"
count = count + 1
if count == 10:
break
return output.strip()
开发者ID:cyncyncyn,项目名称:evette,代码行数:29,代码来源:miscmethods.py
示例6: __init__
def __init__(self):
self.config = settings()
pathToData = self.config.users_token
self.connection = sqlite3.connect(pathToData, check_same_thread=False)
self.cursor = self.connection.cursor()
self.cursor.execute('''CREATE TABLE if not exists users (chatID COUNTER CONSTRAINT PrimaryKey PRIMARY KEY,
token Text(100) NOT NULL)''')
开发者ID:always-smiling,项目名称:WaveRiderChatbot,代码行数:7,代码来源:poster.py
示例7: load_channels_from_settings
def load_channels_from_settings(self):
try:
common.dbg_log('channel_list::load_channels_from_settings', 'enter_function')
self.Data = []
set = settings.settings()
xmldoc = set.parse()
if xmldoc != None:
category = xmldoc.getElementsByTagName('category')
for node_cat in category:
setting = node_cat.getElementsByTagName('setting')
for node_set in setting :
if 'id' in node_set.attributes.keys() and not node_set.getAttribute('id').find('channel_sep_'):
offset = len('channel_sep_')
index = node_set.getAttribute('id')[offset:]
enabled = common.__addon__.getSetting('channel_enable_'+index)
if enabled == 'true':
oname = node_set.getAttribute('label')
uname = common.__addon__.getSetting('channel_name_'+index)
icon = common.__addon__.getSetting('channel_icon_'+index)
chn = channel(index, oname, uname, icon, common.correction)
self.Data.append(chn)
common.dbg_log('channel_list::load_channels_from_settings', oname.encode('utf-8') + '(' + index + ')')
common.dbg_log('channel_list::load_channels_from_settings', 'exit_function')
except Exception, e:
common.dbg_log('channel_list::load_channels_from_settings', 'ERROR: (' + repr(e) + ')', common.logErorr)
开发者ID:nkvoronov,项目名称:script.epg.vsetv,代码行数:25,代码来源:channel.py
示例8: rekonfiguruj
def rekonfiguruj(self):
# metoda do zmiany ustawien w programie
self.ust.p_sr = self.ust.p_pr
self.ust.p_w = self.ust.p_pr
self.ust.headers = []
self.ust.ostat_zapis = self.ust.p_pr
self.sett = settings(self.ust)
# wylacz niepotrzebne ustawienia
self.sett.g_ref_lineEdit.setEnabled(False)
self.sett.g_working_lineEdit.setEnabled(False)
self.sett.g_headers.clear()
self.sett.g_headers.setEnabled(False)
przyciski = [
self.sett.g_toHeaders,
self.sett.g_upHeader,
self.sett.g_downHeader,
self.sett.g_delHeader,
self.sett.g_firstHeader,
self.sett.g_lastHeader,
self.sett.g_working_choose,
self.sett.g_ref_choose,
]
for przycisk in przyciski:
przycisk.setEnabled(False)
self.sett.exec_()
if self.sett.restart:
self.defpol = [';'.join([x, self.ust.defpol[x]])
for x in self.ust.defpol_index]
self.resetujMetadane()
开发者ID:PawelKra,项目名称:LDB_Pomiary,代码行数:32,代码来源:LDB_Pomiar.py
示例9: __init__
def __init__(self, basepath, username, project, *args, **kwargs):
self._xmlparser = ET.XMLParser(load_dtd = True)
self._xmlparser.resolvers.add(PrefixResolver())
self._htmlparser = ET.HTMLParser(encoding='utf-8')
try:
self._app_config = settings()
self._appdir = os.path.join(self._app_config['InstallSettings']['installdir'],"kolekti")
except :
self._app_config = {'InstallSettings':{'installdir':os.path.realpath( __file__), 'kolektiversion':"0.7"}}
self._appdir = os.path.dirname(os.path.realpath( __file__ ))
if basepath is not None:
if basepath[-1]==os.path.sep:
basepath = basepath[:-1]
self._basepath = basepath
self._username = username
self._project = project
self._path = os.path.join(basepath, username, project)
self.project_settings = self.get_project_config(self._path)
self._version = self.project_settings.get('version')
开发者ID:kolekti,项目名称:kolekti,代码行数:26,代码来源:common.py
示例10: __init__
def __init__(self, city):
self.urlPath = "http://www.flickr.com/map?place_id="
self.flickrPlaces = dict()
self.flickrPlaces["istambul"] = "6NGXevKbAphp2QAz"
self.flickrPlaces["london"] = ".2P4je.dBZgMyQ"
self.flickrPlaces["new+york"] = "hVUWVhqbBZlZSrZU"
self.flickrPlaces["tokio"] = "V5QAdQebApgw_9XH"
self.flickrPlaces["barcelona"] = "2HQ7FIeeBJ_vRb8"
self.flickrPlaces["paris"] = "bV4EOqafAJnqoz4"
self.flickrPlaces["berlin"] = "sRdiycKfApRGrrU"
self.flickrPlaces["mexicodf"] = "MuLDKdiYAJo.QrA"
self.flickrPlaces["rome"] = "xbTF9RCeA51vjuk"
self.flickrPlaces["praha"] = "UEddssmbAZwXVqZt7g"
self.flickrPlaces["moscou"] = "ZLXvFuGbAJ6JI5bc"
self.flickrPlaces["san+francisco"] = "kH8dLOubBZRvX_YZ"
self.flickrPlaces["new+delhi"] = "7gGxOnGbApgQ3.2i2g"
self.flickrPlaces["vienna"] = "wL4AEK2cBJ0UQdc"
self.flickrPlaces["rosario"] = "vzJ2RFBSUbveaB0"
self.flickrPlaces["buenos+aires"] = "SG5jj75SUbqEFrc"
self.flickrPlaces["sau+paulo"] = "ou6W9HJTUL1op5q6RA"
self.flickrPlaces["adelaide"] = "xTgz9S9QUrMLZbpQ"
#http://www.flickr.com/places/info/466862
self.settings = settings()
self.setCity(city)
self.managerDB = managerDB()
self.flickr = flickrapi.FlickrAPI(self.settings.flickr_api_key, self.settings.flickr_api_secret)
self.lastRhythm = 0
self.minimHistoric = 10
开发者ID:mcanet,项目名称:the_rhythm_of_city,代码行数:30,代码来源:flickr.py
示例11: closeEvent
def closeEvent(self, event):
s = settings()
# Save layout
s.main_window_geometry = self.saveGeometry()
s.main_window_state = self.saveState()
event.accept()
开发者ID:LogikSim,项目名称:LogikSimPython,代码行数:7,代码来源:main_window.py
示例12: authed_get_url
def authed_get_url(self,path):
path = path.strip('/') # Normalize path by dropping extra begin/end slashes
auth_gen = S3.QueryStringAuthGenerator(settings('AWS_ACCESS_KEY_ID'),settings('AWS_SECRET_ACCESS_KEY'), is_secure=False) #PP_BUCKET)
# if not expires:
# expires = datetime.datetime.now() + datetime.timedelta(0,60*10) # In 10 min
# auth_gen.set_expires(expires)
uri = auth_gen.get(self.bucket,path)
# We actually want to `unquote` the `/` char to allow for prettier key URLs
#i = uri.index('?')
#lside = uri[:i].replace('%2F','/')
#rside = uri[i:]
return uri
开发者ID:topher515,项目名称:piles.io,代码行数:16,代码来源:contentstore.py
示例13: __init__
def __init__(self, screen): # {{{
## curses options
curses.curs_set(0)
cui.color.setColor()
self.stdscr = screen
self.stdscr.keypad(1)
self.settings = settings()
self.initSrvlst()
self.initMenus()
self.focusedWidget = self.srvlst
panel.update_panels()
curses.doupdate()
self.startQuery()
## Main Loop -- have to catch all quit events here
while True:
key = self.stdscr.getch()
if key in cui.KEY_QUIT:
self.quit()
break
if key in cui.KEY_LAUNCH and self.focusedWidget == self.srvlst:
self.launch()
self.quit()
break
else:
self.handleInput(key)
curses.doupdate() # }}}
开发者ID:kalhartt,项目名称:cursow,代码行数:34,代码来源:cursow.py
示例14: main
def main(command):
log_proc = S3LogProcessor(settings('LOG_BUCKET'), settings('LOG_BUCKET_PREFIX'), db)
usage_meter = UsageMeter()
if command == 'nuke':
print "Resetting log markers, Removing all usage events"
db.usage_events.remove()
log_proc.reset_log_marker()
if command == 'nuke' or command == 'reset':
print "resetting mapreduce markers"
usage_meter.reset()
if command == 'update':
# Pull updates from S3 logs
print "Process Amazon logs"
log_proc.process_new_logs()
# Update usage stats in DB
print "Calculate usage from logs"
usage_meter.update()
开发者ID:topher515,项目名称:piles.io,代码行数:17,代码来源:usage.py
示例15: test_default_configuration
def test_default_configuration(self):
"""
Checks the default configuration and presence of all properties.
"""
s = settings.settings()
self.assertEqual(s.main_window_geometry, QtCore.QByteArray())
self.assertEqual(s.main_window_state, QtCore.QByteArray())
开发者ID:hacst,项目名称:LogikSimPython,代码行数:8,代码来源:test_settings.py
示例16: __getlnk
def __getlnk(self):
params = settings()
if(params.getSettings()):
try:
lnk = MySQLdb.connect(params.host,params.user,params.password,params.db)
return lnk
except Exception, e:
print e
开发者ID:BioinfUD,项目名称:Mafa_Web,代码行数:8,代码来源:connector.py
示例17: ShowChangeLog
def ShowChangeLog(name, changelog, connection):
localsettings = settings.settings(False)
localsettings.GetSettings()
changelog = FormatChangeLog(changelog, name, connection)
output = wx.MessageDialog(None, changelog, localsettings.dictionary["changelog"][localsettings.language], wx.OK)
output.ShowModal()
开发者ID:cyncyncyn,项目名称:evette,代码行数:8,代码来源:miscmethods.py
示例18: front
def front():
s = session(request)
authed = s.get('authenticated')
if not authed:
return redirect('/login')
pile = authed['piles'][0]
if not pile:
return abort(404,'Your user account (%s) does not have a Pile associated with it. Please report this error!' % user_ent['email'])
return redirect('http://'+settings('CONTENT_DOMAIN') +'/app#'+pile['name'])
开发者ID:topher515,项目名称:piles.io,代码行数:9,代码来源:app.py
示例19: __init__
def __init__(self):
__settings = settings.settings(self.default_cli())
self.templates = __settings.templates
self.variables = __settings.variables
self.passwords = __settings.passwords
self.projectDir = os.path.dirname(os.path.abspath(__file__))
self.blocks_directory = os.path.join(os.path.dirname(os.path.abspath(__file__)), __settings.blocks_path)
self.templates_directory = os.path.join(os.path.dirname(os.path.abspath(__file__)), __settings.templates_path)
开发者ID:Manu343726,项目名称:biiblock_generator,代码行数:9,代码来源:generate.py
示例20: test_error_handling
def test_error_handling(self):
s = SettingsMock()
s.status_value = QtCore.QSettings.FormatError
self.assertRaises(Exception, settings.setup_settings, s)
s = SettingsMock()
settings.setup_settings(s)
s.status_value = QtCore.QSettings.AccessError
self.assertRaises(Exception, settings.settings().save)
开发者ID:hacst,项目名称:LogikSimPython,代码行数:9,代码来源:test_settings.py
注:本文中的settings.settings函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论