本文整理汇总了Python中kivy.storage.jsonstore.JsonStore方法的典型用法代码示例。如果您正苦于以下问题:Python jsonstore.JsonStore方法的具体用法?Python jsonstore.JsonStore怎么用?Python jsonstore.JsonStore使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kivy.storage.jsonstore
的用法示例。
在下文中一共展示了jsonstore.JsonStore方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_store
# 需要导入模块: from kivy.storage import jsonstore [as 别名]
# 或者: from kivy.storage.jsonstore import JsonStore [as 别名]
def get_store(cls):
"""
Returns the full user Store object instance.
"""
store_path = cls.get_store_path()
store = JsonStore(store_path)
return store
示例2: init_settings
# 需要导入模块: from kivy.storage import jsonstore [as 别名]
# 或者: from kivy.storage.jsonstore import JsonStore [as 别名]
def init_settings(self):
#app = App.get_running_app()
from os.path import join as os_path_join
self.store = JsonStore(os_path_join(self.user_data_dir, 'storage'))
# gui persistent settings
try:
self.example_property = self.store.get('example_property_section')['example_property']
#Logger.info('StorageMdl: found stored gui_multi: {}'.format(self.gui_multi))
except KeyError:
self.example_property = 2.0
#Logger.info('StorageMdl: failed to find gui_multi, setting default')
示例3: build
# 需要导入模块: from kivy.storage import jsonstore [as 别名]
# 或者: from kivy.storage.jsonstore import JsonStore [as 别名]
def build(self):
self.store = JsonStore(os.path.join(self.user_data_dir, 'ninetyperten.json'))
sm = NinetyPerTenScreenManager(self.store)
main_screen = MainScreen(
name=MAIN_SCREEN_NAME,
)
hist_screen = HistoryScreen(
name=HISTORY_SCREEN_NAME
)
sm.add_widget(main_screen)
sm.add_widget(hist_screen)
return sm
示例4: store_data
# 需要导入模块: from kivy.storage import jsonstore [as 别名]
# 或者: from kivy.storage.jsonstore import JsonStore [as 别名]
def store_data(self, token):
"""
Stores the 'token' in json format.
"""
store = JsonStore('data.json')
store.put('creds', token=token)
show_cloudcb(self.manager, token)
示例5: get_data
# 需要导入模块: from kivy.storage import jsonstore [as 别名]
# 或者: from kivy.storage.jsonstore import JsonStore [as 别名]
def get_data(self, key):
store = JsonStore('data.json')
if store.exists(key):
return store.get(key)['token']
return None
示例6: __init__
# 需要导入模块: from kivy.storage import jsonstore [as 别名]
# 或者: from kivy.storage.jsonstore import JsonStore [as 别名]
def __init__(self):
self._access_lock = RLock()
self.modules = {}
with self._access_lock:
self.store = JsonStore('persist.json')
示例7: __init__
# 需要导入模块: from kivy.storage import jsonstore [as 别名]
# 或者: from kivy.storage.jsonstore import JsonStore [as 别名]
def __init__(self, data_dir, name, do_date=False, do_hour=False, **kwargs):
super(DBInterface, self).__init__(**kwargs)
self.ensure_dir(data_dir)
if do_date:
if do_hour:
date = self.convert_time_to_json_ymdh(self.get_time())
else:
date = self.convert_time_to_json_ymd(self.get_time())
json_name = data_dir + name + '-' + date + '.json'
reset_json_name = (
data_dir + name + '-' + date + '-reset_timers.json')
else:
json_name = data_dir + name + '.json'
reset_json_name = data_dir + name + '-reset_timers.json'
self.data = data = JsonStore(json_name)
self.reset_timers = reset_timers = JsonStore(reset_json_name)
self.sync = Clock.create_trigger(self.trigger_sync)
self.check_reset(0.)
Clock.schedule_interval(self.check_reset, 60.)
示例8: reloadSchedule
# 需要导入模块: from kivy.storage import jsonstore [as 别名]
# 或者: from kivy.storage.jsonstore import JsonStore [as 别名]
def reloadSchedule():
with scheduleLock:
schedule.clear()
activeSched = None
with thermostatLock:
thermoSched = JsonStore( "thermostat_schedule.json" )
if holdControl != "down" :
if heatControl.state == "down":
activeSched = thermoSched[ "heat" ]
log( LOG_LEVEL_INFO, CHILD_DEVICE_SCHEDULER, MSG_SUBTYPE_CUSTOM + "/load", "heat" )
if useTestSchedule:
activeSched = getTestSchedule()
log( LOG_LEVEL_INFO, CHILD_DEVICE_SCHEDULER, MSG_SUBTYPE_CUSTOM + "/load", "test" )
print "Using Test Schedule!!!"
if activeSched != None:
for day, entries in activeSched.iteritems():
for i, entry in enumerate( entries ):
getattr( schedule.every(), day ).at( entry[ 0 ] ).do( setScheduledTemp, entry[ 1 ] )
log( LOG_LEVEL_DEBUG, CHILD_DEVICE_SCHEDULER, MSG_SUBTYPE_TEXT, "Set " + day + ", at: " + entry[ 0 ] + " = " + str( entry[ 1 ] ) + scaleUnits )
##############################################################################
# #
# Web Server Interface #
# #
##############################################################################
##############################################################################
# encoding: UTF-8 #
# Form based authentication for CherryPy. Requires the #
# Session tool to be loaded. #
##############################################################################
示例9: reloadSchedule
# 需要导入模块: from kivy.storage import jsonstore [as 别名]
# 或者: from kivy.storage.jsonstore import JsonStore [as 别名]
def reloadSchedule():
with scheduleLock:
schedule.clear()
activeSched = None
with thermostatLock:
thermoSched = JsonStore( "thermostat_schedule.json" )
if holdControl.state != "down":
if heatControl.state == "down":
activeSched = thermoSched[ "heat" ]
log( LOG_LEVEL_INFO, CHILD_DEVICE_SCHEDULER, MSG_SUBTYPE_CUSTOM + "/load", "heat" )
elif coolControl.state == "down":
activeSched = thermoSched[ "cool" ]
log( LOG_LEVEL_INFO, CHILD_DEVICE_SCHEDULER, MSG_SUBTYPE_CUSTOM + "/load", "cool" )
if useTestSchedule:
activeSched = getTestSchedule()
log( LOG_LEVEL_INFO, CHILD_DEVICE_SCHEDULER, MSG_SUBTYPE_CUSTOM + "/load", "test" )
print "Using Test Schedule!!!"
if activeSched != None:
for day, entries in activeSched.iteritems():
for i, entry in enumerate( entries ):
getattr( schedule.every(), day ).at( entry[ 0 ] ).do( setScheduledTemp, entry[ 1 ] )
log( LOG_LEVEL_DEBUG, CHILD_DEVICE_SCHEDULER, MSG_SUBTYPE_TEXT, "Set " + day + ", at: " + entry[ 0 ] + " = " + str( entry[ 1 ] ) + scaleUnits )
##############################################################################
# #
# Web Server Interface #
# #
##############################################################################