本文整理汇总了Python中kivy.storage.jsonstore.JsonStore.keys方法的典型用法代码示例。如果您正苦于以下问题:Python JsonStore.keys方法的具体用法?Python JsonStore.keys怎么用?Python JsonStore.keys使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kivy.storage.jsonstore.JsonStore
的用法示例。
在下文中一共展示了JsonStore.keys方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: on_enter
# 需要导入模块: from kivy.storage.jsonstore import JsonStore [as 别名]
# 或者: from kivy.storage.jsonstore.JsonStore import keys [as 别名]
def on_enter(self, *args):
feeds=JsonStore("UmutRss.json")
if len(self.grid.children)>0:
self.grid.clear_widgets()
self.grid.bind(minimum_height=self.grid.setter("height"))
for feed in feeds.keys():
title=feeds.get(feed)["title"]
url=feeds.get(feed)["url"]
btn=MButton(text=title,height=65)
btn.urls=url
btn.bind(on_press=self.next_screen)
self.grid.add_widget(btn)
示例2: __init__
# 需要导入模块: from kivy.storage.jsonstore import JsonStore [as 别名]
# 或者: from kivy.storage.jsonstore.JsonStore import keys [as 别名]
def __init__(self, **kwargs):
kwargs['cols'] = 2
super(MainView, self).__init__(**kwargs)
# def build(self):
# global store
project_store = JsonStore('projectlist.json')
self.list_adapter = ListAdapter(data=[("Project " + r + ' ' + project_store[r]['profile']['projecttitle'])
for r in project_store.keys()],
cls=ListItemButton,
sorted_keys=[])
self.list_adapter.bind(on_selection_change=self.callback)
list_view = ListView(adapter=self.list_adapter)
self.add_widget(list_view)
示例3: OctoOverlay
# 需要导入模块: from kivy.storage.jsonstore import JsonStore [as 别名]
# 或者: from kivy.storage.jsonstore.JsonStore import keys [as 别名]
class OctoOverlay(FloatLayout):
octo = ObjectProperty(None)
sb = ObjectProperty(None)
settings_string = StringProperty(u'...')#Things I wanted:
data_dir = ''
def settingsPressed(self):
self.octo.size=(0,0)
self.sb.size=(0,0)
self.octo.size_hint=(0,0)
self.oed = OctoEditServer()
self.oed.doneButton.bind(on_press=self.settingsReturn)
self.add_widget(self.oed)
def settingsReturn(self,val):
self.remove_widget(self.oed)
self.sb.size=(45,45)
self.octo.size_hint=(1,1)
try:
config = {}
config['name'] = self.oed.ids['name'].text
config['address'] = self.oed.ids['address'].text
config['username'] = self.oed.ids['username'].text
config['password'] = encrypt(self.oed.ids['password'].text)
self.store.put(config['name'],
name=config['name'],
address=config['address'],
username=config['username'],
password=config['password'])
self.octo.addServer(config)
except:
pass
def loadServers(self):
self.store = JsonStore(join(self.data_dir, 'hosts.json'))
for key in self.store.keys():
self.octo.addServer(self.store.get(key))
示例4: addStory
# 需要导入模块: from kivy.storage.jsonstore import JsonStore [as 别名]
# 或者: from kivy.storage.jsonstore.JsonStore import keys [as 别名]
class addStory(object):
'''
This class is used for adding story to the game
Syntax for the story is a key based dictionary, these keys are hexadacimal numbers
that will be used to track progress. Starting point is 1, so if scenario 1 had 3
possible options then there would be 11, 12, and 13. If 13 had 2 options then it would
be 131, and 132. This will continue until there is a string of 16 characters
basic syntax: {key
'''
def __init__(self):
self.File = raw_input("Which story would you like to edit?\n\n").lower()
self.data = JsonStore(self.File + '.json')
self.start = 1 #default start code
if self.data.count(): #If file has been started
print '\nLooking for where you left off...\n'
keys = self.data.keys()
leftOff = int(keys[len(keys) - 1])
print ('It seems like you left off at event number'
' %d, so let\'s move on to number %d.'
% (leftOff, leftOff + 1)
)
self.start = leftOff
self.addToDBLoop(self.start)
def addToDBLoop(self, number):
event = raw_input('What is event number %d?\n' % number).lower()
optionsStr = raw_input(('What are the available options for player?\n'
'If none just type \'none\'.\n')).lower().split()
c = 0
options = {}
for o in optionsStr:
c += 1
options[o] = str(number) + str(c)
self.data.put(str(number), event = event, options = options)
示例5: JsonStore
# 需要导入模块: from kivy.storage.jsonstore import JsonStore [as 别名]
# 或者: from kivy.storage.jsonstore.JsonStore import keys [as 别名]
__author__ = 'karinamarie'
from kivy.storage.jsonstore import JsonStore
from kivy.event import EventDispatcher
import json
import csv
import wx
import wx.grid as gridlib
storej = JsonStore('projectlist.json')
p = []
for key in storej.keys():
p.append(key)
print p
# Write CSV Header
# f.writerow(["pk", "model", "codename", "name", "content_type"])
def make_csv(project):
# define & clear lists for each project number
list = []
profilelist = []
contentlist = []
print project + ' project'
file = ('%s.csv' % (project))
f = csv.writer(open(file, "wb+"))
for key in storej.get((project)):
list.append(key)
print list # [profile, content]