本文整理汇总了Python中kivy.storage.jsonstore.JsonStore.items方法的典型用法代码示例。如果您正苦于以下问题:Python JsonStore.items方法的具体用法?Python JsonStore.items怎么用?Python JsonStore.items使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kivy.storage.jsonstore.JsonStore
的用法示例。
在下文中一共展示了JsonStore.items方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from kivy.storage.jsonstore import JsonStore [as 别名]
# 或者: from kivy.storage.jsonstore.JsonStore import items [as 别名]
def __init__(self, the_app):
super(FinalForm, self).__init__()
self.the_app = the_app
self.statements = {}
store = JsonStore('final_statements.json').get('final_statements')
for key, value in store.items():
self.statements[key] = {}
for k,v in value.items():
self.statements[key][k] = v
title_txt = u"כל הכבוד!"
self.title.text = title_txt[::-1]
statement_layout = BoxLayout(orientation="vertical")
self.statement_label = []
statement_layout.add_widget(BoxLayout(size_hint_y=0.3))
for k in range(0,4):
self.statement_label.append(Label(font_size=40,
font_name="fonts/the_font.ttf",
halign='center', size_hint_y=0.4,
color=[0,0,0, 1]))
statement_layout.add_widget(self.statement_label[-1])
self.add_widget(statement_layout)
end_text = u"סיום"
self.end_button.text = end_text[::-1]
self.end_button.bind(on_press=self.next)
示例2: __init__
# 需要导入模块: from kivy.storage.jsonstore import JsonStore [as 别名]
# 或者: from kivy.storage.jsonstore.JsonStore import items [as 别名]
def __init__(self, the_app):
super(ConsentForm, self).__init__()
self.the_app = the_app
self.dict = {'title':self.title,
'body':self.body,
'checkbox_txt':self.checkbox_txt,
'button':self.button}
store = JsonStore('consent_form.json').get('agreement')
for key, value in store.items():
self.dict[key].text = value[::-1]
self.body_labels = []
txt = self.dict['body'].text
new_lines = HebrewManagement.multiline(txt, 50)
for nl in new_lines[::-1]:
self.body_labels.append(Label(text=nl,
font_name="fonts/the_font",
font_size=36,
color=[0,0,0,1]))
self.dict['body'].add_widget(self.body_labels[-1])
示例3: __init__
# 需要导入模块: from kivy.storage.jsonstore import JsonStore [as 别名]
# 或者: from kivy.storage.jsonstore.JsonStore import items [as 别名]
def __init__(self):
self.dict = {'q_in_page': [], 'qu_title': "", 'qu_description': "", 'ques': {},
'ans': {}, 'next_button': "", 'prev_button': ""}
store = JsonStore('questions.json', encoding='utf-8').get('questionnaire')
for key, value in store.items():
if key in ['qu_title', 'next_button', 'prev_button', 'questions']:
self.dict[key] = value[::-1]
if key in ['qu_description', 'ques', 'ans']:
self.dict[key] = {}
for kqa, qa in value.items():
self.dict[key][kqa] = qa[::-1]
if key in ['q_in_page']:
self.dict[key] = int(value)
self.dict['ques'] = collections.OrderedDict(sorted(self.dict['ques'].items()))
self.dict['ans'] = collections.OrderedDict(sorted(self.dict['ans'].items()))
k_page = 0
k_page_ques = 0
self.page_dict = []
for k, v in self.dict['ques'].items():
if k_page_ques == 0:
page_questions = {}
page_questions[k] = v
k_page_ques += 1
if k_page_ques == self.dict['q_in_page']:
new_page = {}
new_page['ques'] = page_questions
new_page = collections.OrderedDict(sorted(new_page.items()))
self.page_dict.append(new_page)
k_page_ques = 0
for pd in self.page_dict:
for k,v in self.dict.items():
if k != 'ques':
pd[k] = v
示例4: __init__
# 需要导入模块: from kivy.storage.jsonstore import JsonStore [as 别名]
# 或者: from kivy.storage.jsonstore.JsonStore import items [as 别名]
def __init__(self, the_app):
super(DetailsForm, self).__init__()
self.the_app = the_app
with self.canvas.before:
self.rect = Rectangle(source="back3.png")
self.bind(size=self._update_rect, pos=self._update_rect)
dict = {}
self.answers = {}
store = JsonStore("details.json").get("details")
for key, value in store.items():
if key in ["FirstName", "LastName", "Email", "end_button", "details_title", "Age"]:
dict[key] = value[::-1]
if key in ["Gender", "Faculty"]:
dict[key] = {}
for kqa, qa in value.items():
if kqa == "text":
dict[key][kqa] = qa[::-1]
elif kqa != "ages":
dict[key][kqa] = []
for k, v in value[kqa].items():
dict[key][kqa].append(v[::-1])
else:
dict[key][kqa] = []
age = 10
while age < 100:
dict[key][kqa].append(str(age))
age += 1
layoutup = BoxLayout(orientation="vertical")
layoutup.add_widget(BoxLayout(size_hint_y=0.3))
layoutup.add_widget(
Label(
text=dict["details_title"],
font_size=50,
font_name="fonts/the_font.ttf",
halign="right",
size_hint_y=0.2,
color=[0, 0, 0, 1],
)
)
layout = GridLayout(cols=7, rows=8)
# === first line ===
layout.add_widget(BoxLayout(size_hint_x=0.2, size_hint_y=0.4))
self.age_text = LoggedTextInput(size_hint_x=0.5, font_size=40, input_filter="int", size_hint_y=0.4)
self.age_text.bind(text=self.age_text.on_text_change)
self.age_text.name = "age"
if "age" in self.what_to_include:
layout.add_widget(self.age_text)
layout.add_widget(
Label(
text=dict["Age"],
font_size=30,
font_name="fonts/the_font.ttf",
halign="right",
size_hint_y=0.4,
color=[0, 0, 0, 1],
)
)
else:
layout.add_widget(BoxLayout())
layout.add_widget(BoxLayout())
self.email_text = LoggedTextInput(size_hint_x=2, font_size=32, size_hint_y=0.4)
self.email_text.bind(text=self.email_text.on_text_change)
self.email_text.name = "email"
if "email" in self.what_to_include:
layout.add_widget(self.email_text)
layout.add_widget(
Label(
text=dict["Email"],
font_size=30,
font_name="fonts/the_font.ttf",
halign="right",
size_hint_y=0.4,
color=[0, 0, 0, 1],
)
)
else:
layout.add_widget(BoxLayout())
layout.add_widget(BoxLayout())
# === second line ===
# layout.add_widget(BoxLayout(size_hint_x=0.2))
# gender spinner
print(dict["Gender"]["Genders"])
self.gender_spinner = LoggedSpinner(
text=dict["Gender"]["Genders"][0],
values=dict["Gender"]["Genders"],
size=(50, 50),
font_name="fonts/the_font.ttf",
font_size=40,
size_hint_y=0.4,
option_cls=MySpinnerOption,
)
#.........这里部分代码省略.........
示例5: __init__
# 需要导入模块: from kivy.storage.jsonstore import JsonStore [as 别名]
# 或者: from kivy.storage.jsonstore.JsonStore import items [as 别名]
def __init__(self):
super(QuestionsForm, self).__init__()
with self.canvas.before:
#Color(0, 1, 0, 1) # green; colors range from 0-1 instead of 0-255
self.rect = Rectangle(source='back2.png')
self.bind(size=self._update_rect, pos=self._update_rect)
dict = {'q_in_page':[], 'qu_title': "", 'qu_description': "", 'ques': {},
'ans': {}, 'next_button': "", 'prev_button': ""}
self.answers={}
store = JsonStore('questions.json').get('questionnaire')
#self.add_widget(Label(text=store.get("questionnaire")["qu_title"][::-1], font_name="DejaVuSans.ttf"))
#tree = ET.fromstring(txt)
for key, value in store.items():
if key in ['qu_title','next_button','prev_button','questions']:
dict[key] = value[::-1]
# print('qu_title',dict[child.tag])
if key in ['qu_description','ques','ans']:
dict[key] = {}
for kqa, qa in value.items():
dict[key][kqa] = qa[::-1]
layout = GridLayout(cols=len(dict['ans'])+2, rows=len(dict['ques'])+1,row_default_height=40)
layoutup = BoxLayout(orientation='vertical')
layoutup.add_widget(Label(text=dict['qu_title'],font_size=50,font_name="DejaVuSans.ttf",halign='right',size_hint_y=0.2,color= [1, 0, 1, 1]))
layoutup.add_widget(BoxLayout(size_hint_y=0.5))
layoutup.add_widget(Label(text=dict['qu_description']['d1'],font_name="DejaVuSans.ttf",font_size=40,halign='right', size_hint_y=0.1))
layoutup.add_widget(Label(text=dict['qu_description']['d2'],font_name="DejaVuSans.ttf",font_size=40,halign='right', size_hint_y=0.1))
layoutup.add_widget(Label(text=dict['qu_description']['d3'],font_name="DejaVuSans.ttf",font_size=40,halign='right', size_hint_y=0.1))
layoutup.add_widget(BoxLayout(size_hint_y=0.2))
q_counter=0
for ques in dict['ques']:
layout.add_widget(BoxLayout(size_hint_x=0.05))
q_counter+=1
if q_counter==1:
for ans in dict['ans']:
print(ans)
layout.add_widget(Label(size_hint_x=0.1,text=dict['ans'][ans],font_name="DejaVuSans.ttf",halign='right'))
layout.add_widget(Label(text="תולאש",font_name="DejaVuSans.ttf",halign='right',orientation='vertical'))
layout.add_widget(BoxLayout(size_hint_x=0.1))
for ans in dict['ans']:
ab = AnswerButton(size_hint_x=0.15,text="", group=str(q_counter),)
ab.question = ques
ab.answer = ans
ab.form = self
layout.add_widget(ab)
#CHECK ID AND KEEP THE CLICK VALUE
layout.add_widget(Label(halign='right',text=dict['ques'][ques],font_name="DejaVuSans.ttf",orientation='vertical', font_size=30))
layoutup.add_widget(layout)
layoutup.add_widget(BoxLayout())
layoutbuttons = BoxLayout(size_hint_y=0.2)
layoutbuttons.add_widget(Button(background_color= [1, 0, 1, 1],
text=dict['next_button'],font_size=20,font_name="DejaVuSans.ttf",halign='right'))
layoutbuttons.add_widget(BoxLayout(size_hint_x=0.2))
layoutbuttons.add_widget(Button(background_color= [1, 0, 1, 1],
text=dict['prev_button'],font_size=20,font_name="DejaVuSans.ttf",halign='right'))
layoutup.add_widget(layoutbuttons)
self.add_widget(layoutup)