当前位置: 首页>>代码示例>>Python>>正文


Python JsonStore.keys方法代码示例

本文整理汇总了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)
开发者ID:yahyakesenek,项目名称:Book,代码行数:14,代码来源:index.py

示例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)
开发者ID:LeroyGethroeGibbs,项目名称:LinuxApp,代码行数:15,代码来源:Form1.py

示例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))
开发者ID:Narcolapser,项目名称:bookish-octo-computing-machine,代码行数:42,代码来源:main.py

示例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)
开发者ID:Autzmosis,项目名称:dungeonGame,代码行数:39,代码来源:addStory.py

示例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]
开发者ID:LeroyGethroeGibbs,项目名称:LinuxApp,代码行数:33,代码来源:savetojson.py


注:本文中的kivy.storage.jsonstore.JsonStore.keys方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。