本文整理汇总了Python中form.Form.get_values方法的典型用法代码示例。如果您正苦于以下问题:Python Form.get_values方法的具体用法?Python Form.get_values怎么用?Python Form.get_values使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类form.Form
的用法示例。
在下文中一共展示了Form.get_values方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: new_record
# 需要导入模块: from form import Form [as 别名]
# 或者: from form.Form import get_values [as 别名]
def new_record(self, event):
"""Insert new record.
Get values by presenting an empty form"""
# does user want to fill with template ?
template_name = None
# show template chooser only if there are some templates
if len(self.tpl_files) > 0:
template_chooser = TemplateChooser(None, self.project_dir, self.tpl_files)
if template_chooser.ShowModal() == wx.ID_CANCEL:
return
elif template_chooser.ShowModal() == wx.ID_OK:
template_name = template_chooser.chosentemplate
template_chooser.Destroy()
if template_name == None:
form = Form(None, self.fields_file, 'Fill in the values')
else:
template_vals = yaml.load(open(template_name))
form = Form(None, self.fields_file, 'Fill in the values', template_vals)
if form.ShowModal() == wx.ID_OK:
form.get_values()
# Initialise lock as open
form.vals['LOCK_STATUS'] = 'unlocked'
self.records.insert_record(form.vals)
# recreate index
#self.register.index_summary = self.records.create_index()
self.register.refresh_records()
form.Destroy()
示例2: new_template
# 需要导入模块: from form import Form [as 别名]
# 或者: from form.Form import get_values [as 别名]
def new_template(self, event):
"""Create a new template"""
form = Form(None, self.fields_file, 'Fill in the values for template')
if form.ShowModal() == wx.ID_OK:
form.get_values()
template_vals = form.vals
form.Destroy()
# get template name
name_entry = wx.TextEntryDialog(None, 'Enter name for template')
if name_entry.ShowModal() == wx.ID_OK:
template_name = name_entry.GetValue()
if not template_name.endswith('.tpl'):
template_name += '.tpl'
template_name = os.path.join(self.project_dir, template_name)
else:
return
# write the template
yaml.dump(template_vals, open(template_name, 'w'))