本文整理匯總了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 #
# #
##############################################################################