本文整理汇总了Python中settings.set函数的典型用法代码示例。如果您正苦于以下问题:Python set函数的具体用法?Python set怎么用?Python set使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了set函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: OnMove
def OnMove(self, event):
"""
Event handler for moving window
"""
x, y = self.GetPosition()
settings.set("win.commstest.pos.x", x)
settings.set("win.commstest.pos.y", y)
开发者ID:BenFenner,项目名称:freeems-tuner,代码行数:7,代码来源:commsTestFrame.py
示例2: _dispatch_builtin_command
def _dispatch_builtin_command(self, command):
self._reset()
magic, category, key, value = command.split(':')
if magic == 'builtin':
if category == 'settings':
try:
value = eval(value)
except e:
logging.exception(e)
return False
if key == 'romanrule':
self._charbuf.compile(value)
self._charbuf_alter.compile(value)
elif key == 'use_title':
title.setenabled(value)
settings.set(key, value)
settings.save()
return True
elif category == 'task':
if key == 'switch':
window_id = int(value)
if window_id == 0:
self._session.blur_process()
else:
self._draw_nothing(self._output)
self._inputmode.reset()
self._reset()
self._screen.taskswitch(window_id)
return False
return False
开发者ID:saitoha,项目名称:sentimental-skk,代码行数:31,代码来源:input.py
示例3: _getYottaClientUUID
def _getYottaClientUUID():
import uuid
current_uuid = settings.get('uuid')
if current_uuid is None:
current_uuid = u'%s' % uuid.uuid4()
settings.set('uuid', current_uuid)
return current_uuid
开发者ID:xingdl2007,项目名称:yotta,代码行数:7,代码来源:registry_access.py
示例4: test_SettingOverwriting
def test_SettingOverwriting(self):
# test that values are updated when settings are overwritten
s = settings.set('an_index',is_global=IS_GLOBAL,value=12345)
t = settings.set('an_index',is_global=IS_GLOBAL,value=67890)
self.assert_(s.key() == t.key(), "Set function should not create new objects when existig objects with the same index exist")
self.assert_(s.value == 12345, "Initial value should remain in initial object")
self.assert_(t.value == 67890, "Updated value should overwrite old value")
开发者ID:DrZoot,项目名称:pglib,代码行数:7,代码来源:test_Settings.py
示例5: _generateAndSaveKeys
def _generateAndSaveKeys(registry=None):
registry = registry or Registry_Base_URL
k = rsa.generate_private_key(public_exponent=65537, key_size=2048, backend=default_backend())
privatekey_pem = k.private_bytes(
serialization.Encoding.PEM, serialization.PrivateFormat.PKCS8, serialization.NoEncryption()
)
pubkey_pem = k.public_key().public_bytes(
serialization.Encoding.PEM, serialization.PublicFormat.SubjectPublicKeyInfo
)
if _isPublicRegistry(registry):
settings.setProperty("keys", "private", privatekey_pem.decode("ascii"))
settings.setProperty("keys", "public", pubkey_pem.decode("ascii"))
else:
sources = _getSources()
keys = None
for s in sources:
if _sourceMatches(s, registry):
if not "keys" in s:
s["keys"] = dict()
keys = s["keys"]
break
if keys is None:
keys = dict()
sources.append({"type": "registry", "url": registry, "keys": keys})
keys["private"] = privatekey_pem.decode("ascii")
keys["public"] = pubkey_pem.decode("ascii")
settings.set("sources", sources)
return pubkey_pem, privatekey_pem
开发者ID:stevenewey,项目名称:yotta,代码行数:30,代码来源:registry_access.py
示例6: onResize
def onResize(self, event):
'''Record new size'''
key = 'ui.commsdiagnostics.row.size.'
r = 0
while r < self.GetNumberCols():
settings.set(key+str(r), self.GetColSize(r))
r += 1
开发者ID:karrikoivusalo,项目名称:freeems-tuner,代码行数:7,代码来源:commsDiagnostics.py
示例7: add_to_ignore
def add_to_ignore(self):
gallery = self.gallery_widget.gallery
app_constants.IGNORE_PATHS.append(gallery.path)
settings.set(app_constants.IGNORE_PATHS, 'Application', 'ignore paths')
if self.gallery_widget.parent_widget.gallery_layout.count() == 1:
self.gallery_widget.parent_widget.close()
else:
self.gallery_widget.close()
开发者ID:darmstard,项目名称:happypanda,代码行数:8,代码来源:app.py
示例8: test_settingTypes
def test_settingTypes(self):
# test the creation of settings with different types
for k,v in supported_types.iteritems():
s = settings.set(k,is_global=IS_GLOBAL, value=v[0])
self.assert_(s,k+" should create a valid settings object")
for k,v in unsupported_types.iteritems():
s = settings.set(k,is_global=IS_GLOBAL, value=v[0])
self.assert_(s == None, "Unsupported types should return None")
开发者ID:DrZoot,项目名称:pglib,代码行数:8,代码来源:test_Settings.py
示例9: deauthorize
def deauthorize(registry=None):
registry = registry or Registry_Base_URL
if _isPublicRegistry(registry):
if settings.get('keys'):
settings.set('keys', dict())
else:
sources = [s for s in _getSources() if not _sourceMatches(s, registry)]
settings.set('sources', sources)
开发者ID:xingdl2007,项目名称:yotta,代码行数:8,代码来源:registry_access.py
示例10: accept_edit
def accept_edit(self):
gallerydb.execute(database.db.DBBase.begin, True)
app_constants.APPEND_TAGS_GALLERIES = self.tags_append.isChecked()
settings.set(app_constants.APPEND_TAGS_GALLERIES, 'Application', 'append tags to gallery')
for g in self._edit_galleries:
self.make_gallery(g)
self.delayed_close()
gallerydb.execute(database.db.DBBase.end, True)
开发者ID:Pewpews,项目名称:happypanda,代码行数:8,代码来源:gallerydialog.py
示例11: delete_file
def delete_file(filename):
tries = 10
while os.path.exists(filename) and tries > 0:
settings.set('ChannelsUpdated', 0, settingsFile)
try:
os.remove(filename)
break
except:
tries -= 1
开发者ID:Nemeziz,项目名称:Dixie-Deans-XBMC-Repo,代码行数:9,代码来源:deleteDB.py
示例12: test_SettingHierarchy
def test_SettingHierarchy(self):
# test that user settings overwrite global settings where they are present
g = settings.set('an_index',is_global=True,value='global value')
u = settings.set('an_index',value='user value')
self.assert_(g.key() != u.key(),"User settings should not overwrite global settings")
s_one = settings.get('an_index') #should be global
self.assert_(s_one['value'] == 'global value',"settings.get should return the global value unless user_first is set")
s_two = settings.get('an_index',user_first=True)
self.assert_(s_two['value'] == 'user value',"User setting should be returned in favour of the global setting when user_first is True")
开发者ID:DrZoot,项目名称:pglib,代码行数:9,代码来源:test_Settings.py
示例13: _static_processing
def _static_processing(self):
self.logger.info("Static processing thread starting")
idx = -1
# resume processing with the last image the user looked at
last_img = settings.get('processing/last_img', None)
for i, image_name in enumerate(self.images):
if image_name == last_img:
self.idx = i
break
while True:
with self.condition:
# wait until the user hits a key
while idx == self.idx and not self.do_stop and not self.do_refresh:
self.condition.wait()
if self.do_stop:
break
idx = self.idx
self.do_refresh = False
# if the index is valid, then process an image
if idx < len(self.images) and idx >= 0:
image_name = self.images[idx]
self.logger.info("Opening %s" % image_name)
img = cv2.imread(image_name)
if img is None:
self.logger.error("Error opening %s: could not read file" % (image_name))
self.camera_widget.set_error()
self.idx += self.idx_increment
continue
try:
target_data = self.detector.process_image(img)
except:
logutil.log_exception(self.logger, 'error processing image')
self.camera_widget.set_error(img)
else:
settings.set('processing/last_img', image_name)
settings.save()
self.logger.info('Finished processing')
# note that you cannot typically interact with the UI
# from another thread -- but this function is special
self.camera_widget.set_target_data(target_data)
self.logger.info("Static processing thread exiting")
开发者ID:Twinters007,项目名称:FRC-2014,代码行数:56,代码来源:image_capture.py
示例14: delete_file
def delete_file(filename):
dixie.SetSetting("epg.date", "2000-01-01")
tries = 10
while os.path.exists(filename) and tries > 0:
settings.set("ChannelsUpdated", 0, settingsFile)
try:
os.remove(filename)
break
except:
tries -= 1
开发者ID:noobsandnerds,项目名称:noobsandnerds,代码行数:10,代码来源:deleteDB.py
示例15: start_up
def start_up(self):
hello = ["Hello!", "Hi!", "Onii-chan!", "Senpai!", "Hisashiburi!", "Welcome!", "Okaerinasai!", "Welcome back!", "Hajimemashite!"]
self.notification_bar.add_text("{} Please don't hesitate to report any bugs you find.".format(hello[random.randint(0, len(hello)-1)])+
" Go to Settings -> About -> Bug Reporting for more info!")
level = 5
def normalize_first_time():
settings.set(level, 'Application', 'first time level')
settings.save()
def done(status=True):
gallerydb.DatabaseEmitter.RUN = True
if app_constants.FIRST_TIME_LEVEL != level:
normalize_first_time()
if app_constants.ENABLE_MONITOR and\
app_constants.MONITOR_PATHS and all(app_constants.MONITOR_PATHS):
self.init_watchers()
if app_constants.LOOK_NEW_GALLERY_STARTUP:
if self.manga_list_view.gallery_model.db_emitter.count == app_constants.GALLERY_DATA:
self.scan_for_new_galleries()
else:
self.manga_list_view.gallery_model.db_emitter.DONE.connect(self.scan_for_new_galleries)
self.download_manager = pewnet.Downloader()
app_constants.DOWNLOAD_MANAGER = self.download_manager
self.download_manager.start_manager(4)
if app_constants.FIRST_TIME_LEVEL < 4:
log_i('Invoking first time level {}'.format(4))
settings.set([], 'Application', 'monitor paths')
settings.set([], 'Application', 'ignore paths')
app_constants.MONITOR_PATHS = []
app_constants.IGNORE_PATHS = []
settings.save()
done()
elif app_constants.FIRST_TIME_LEVEL < 5:
log_i('Invoking first time level {}'.format(5))
app_widget = misc.ApplicationPopup(self)
app_widget.note_info.setText("<font color='red'>IMPORTANT:</font> Application restart is required when done")
app_widget.restart_info.hide()
self.admin_db = gallerydb.AdminDB()
self.admin_db.moveToThread(app_constants.GENERAL_THREAD)
self.admin_db.DONE.connect(done)
self.admin_db.DONE.connect(lambda: app_constants.NOTIF_BAR.add_text("Application requires a restart"))
self.admin_db.DONE.connect(self.admin_db.deleteLater)
self.admin_db.DATA_COUNT.connect(app_widget.prog.setMaximum)
self.admin_db.PROGRESS.connect(app_widget.prog.setValue)
self.admin_db_method_invoker.connect(self.admin_db.rebuild_db)
self.admin_db_method_invoker.connect(app_widget.show)
app_widget.adjustSize()
db_p = os.path.join(os.path.split(database.db_constants.DB_PATH)[0], 'sadpanda.db')
self.admin_db_method_invoker.emit(db_p)
else:
done()
开发者ID:darmstard,项目名称:happypanda,代码行数:52,代码来源:app.py
示例16: save_teams
def save_teams():
r = api.method('/me/teams')
if r.status_code == 200:
teams = r.json()
if len(teams) > 0:
settings.set(teams=teams)
for team in teams:
save_image('http:' + team["thumbUrl"], 'team-' + team['name'])
n.notify("AndBang Workflow Success", "Your teams were saved!", "Teams: " + ', '.join([team["name"] for team in teams]))
else:
n.notify("AndBang Workflow Error", "No teams were saved", "Please create one at http://andbang.com")
else:
n.notify("AndBang Workflow Error", resp["message"], "")
开发者ID:ezanol,项目名称:andbang-alfred,代码行数:13,代码来源:server.py
示例17: load_settings
def load_settings(self):
settings = ConfigParser.ConfigParser()
# Fill defaults
settings.add_section("main")
settings.set("main", "save-before-build", "True")
settings.set("main", "ptp-debug", "False")
filename = self.get_settings_filename()
if os.path.isfile(filename):
with open(filename, "r") as f:
settings.readfp(f)
return settings
开发者ID:MrPablozOne,项目名称:Bakalarka_Kaira,代码行数:13,代码来源:app.py
示例18: POST
def POST(self):
"""
Save settings
:return:
"""
inputs = web.input(jobs=[])
cfg = settings.get()
cfg["master"] = inputs.serveraddress
cfg["jobs"] = inputs.jobs
settings.set(cfg)
return self.GET()
开发者ID:inorton,项目名称:jenkinsboard,代码行数:14,代码来源:webserver.py
示例19: select_source
def select_source():
mc.ShowDialogWait()
window = mc.GetActiveWindow()
list = window.GetList(SOURCES_LIST_ID)
sourceitem = list.GetItem(list.GetFocusedItem())
username = settings.get('megaupload.username')
password = settings.get('megaupload.password')
cookie = settings.get('megaupload.cookie')
print "MU: %s, %s, %s" % (username, password, cookie)
mu = megaupload.MegaUpload(username, password, cookie)
settings.set('megaupload.cookie', mu.get_cookie())
link, name, wait, cookie = mu.resolve(sourceitem.GetPath())
hide_popup()
wd = waitdialog.WaitDialog('Megaupload', 'Waiting for link to activate')
wd.wait(wait, waitdialog_callback, (link, name, cookie))
开发者ID:rlf,项目名称:icefilms-boxee,代码行数:15,代码来源:main.py
示例20: setAPIKey
def setAPIKey(registry, api_key):
""" Set the api key for accessing a registry. This is only necessary for
development/test registries.
"""
if (registry is None) or (registry == Registry_Base_URL):
return
sources = _getSources()
source = None
for s in sources:
if _sourceMatches(s, registry):
source = s
if source is None:
source = {"type": "registry", "url": registry}
sources.append(source)
source["apikey"] = api_key
settings.set("sources", sources)
开发者ID:stevenewey,项目名称:yotta,代码行数:16,代码来源:registry_access.py
注:本文中的settings.set函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论