本文整理汇总了Python中form.Form类的典型用法代码示例。如果您正苦于以下问题:Python Form类的具体用法?Python Form怎么用?Python Form使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Form类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: from_dict
def from_dict(job_dict):
job_dict.setdefault("connector", [])
job_dict["connector"] = [Form.from_dict(con_form_dict) for con_form_dict in job_dict["connector"]]
job_dict.setdefault("framework", [])
job_dict["framework"] = [Form.from_dict(framework_form_dict) for framework_form_dict in job_dict["framework"]]
if not "connection_id" in job_dict:
job_dict["connection_id"] = job_dict["connection-id"]
if not "connector_id" in job_dict:
job_dict["connector_id"] = job_dict["connector-id"]
if not "creation_user" in job_dict:
job_dict["creation_user"] = job_dict.setdefault("creation-user", "hue")
if not "creation_date" in job_dict:
job_dict["creation_date"] = job_dict.setdefault("creation-date", 0)
if not "update_user" in job_dict:
job_dict["update_user"] = job_dict.setdefault("update-user", "hue")
if not "update_date" in job_dict:
job_dict["update_date"] = job_dict.setdefault("update-date", 0)
return Job(**force_dict_to_strings(job_dict))
示例2: new_record
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()
示例3: from_dict
def from_dict(job_dict):
job_dict.setdefault('connector', [])
job_dict['connector'] = [ Form.from_dict(con_form_dict) for con_form_dict in job_dict['connector'] ]
job_dict.setdefault('framework', [])
job_dict['framework'] = [ Form.from_dict(framework_form_dict) for framework_form_dict in job_dict['framework'] ]
if not 'connection_id' in job_dict:
job_dict['connection_id'] = job_dict['connection-id']
if not 'connector_id' in job_dict:
job_dict['connector_id'] = job_dict['connector-id']
if not 'creation_user' in job_dict:
job_dict['creation_user'] = job_dict.setdefault('creation-user', 'hue')
if not 'creation_date' in job_dict:
job_dict['creation_date'] = job_dict.setdefault('creation-date', 0)
if not 'update_user' in job_dict:
job_dict['update_user'] = job_dict.setdefault('update-user', 'hue')
if not 'update_date' in job_dict:
job_dict['update_date'] = job_dict.setdefault('update-date', 0)
return Job(**job_dict)
示例4: __init__
def __init__(self):
root = Tk()
root.title(self.title)
labels = ['Server Name', 'Remote Dir', 'File Name',
'Local Dir', 'User Name?', 'Password?']
Form.__init__(self, labels, root)
self.mutex = _thread.allocate_lock()
self.threads = 0
示例5: cool
def cool():
global f
messagebox.show('hello world')
f1 = Form(caption="New Form", left=320, top=200)
btn1 = Button(f1, caption='Hello', left=5, top=5, width=200, height=100)
btn1.on_click = cool2
btn1.background = 'blue'
f1.show_modal()
print "I'm a cool app"
示例6: get_applicant
def get_applicant():
form = Form(request.form)
check = form.check()
if check == True:
Applicant.check_app_code()
Applicant.check_for_school()
return redirect(config.address+'/')
else:
return check + "\n\n Please go back to the form"
开发者ID:CodecoolBP20161,项目名称:python-school-system-with-orm-rainbow-butt-monkeys,代码行数:9,代码来源:controller.py
示例7: _form
def _form(self):
if self.__form_cache is not None:
return self.__form_cache
inputs = map(lambda x: x.field, self.get_active_fields())
# TODO: creating the form everytime might by a wrong approach...
logger.debug("Creating Form()...")
form = Form(*inputs)
form.fill(self.data)
self.__form_cache = form
return form
示例8: from_dict
def from_dict(connection_dict):
connection_dict.setdefault('connector', [])
connection_dict['connector'] = [ Form.from_dict(con_form_dict) for con_form_dict in connection_dict['connector'] ]
connection_dict.setdefault('framework', [])
connection_dict['framework'] = [ Form.from_dict(framework_form_dict) for framework_form_dict in connection_dict['framework'] ]
if not 'connector_id' in connection_dict:
connection_dict['connector_id'] = connection_dict.setdefault('connector-id', -1)
return Connection(**connection_dict)
示例9: onConnect
def onConnect(self):
Form.onConnect(self)
servername = self.content['Server Name'].get()
portnum = self.content['Port Number'].get()
self.portnum = int(portnum)
self.servername = servername
print("%s %s" % (servername, portnum))
# connect to server
self.connect(servername, int(portnum))
示例10: saveForm
def saveForm(self, submit, message=None, success=True):
"""
Method to save the details
@param message: the success message to check (optional)
@param success: whether we're looking for a confirmation (default) or failure
"""
self.startCoverage("saveForm")
f = Form(self)
result = f.saveForm(submit, message, success)
self.endCoverage()
return result
示例11: onSubmit
def onSubmit(self):
Form.onSubmit(self)
localdir = self.content['Local Dir?'].get()
portnumber = self.content['Port Number'].get()
servername = self.content['Server Name'].get()
filename = self.content['File Name'].get()
if localdir:
os.chdir(localdir)
portnumber = int(portnumber)
getfile.client(servername, portnumber, filename)
showinfo('getfilegui', 'Download complete')
if self.oneshot: Tk().quit() # else stay in last localdir
示例12: from_dict
def from_dict(framework_dict):
framework_dict.setdefault('job-forms', {})
framework_dict['job_forms'] = {}
if 'IMPORT' in framework_dict['job-forms']:
framework_dict['job_forms']['IMPORT'] = [ Form.from_dict(job_form_dict) for job_form_dict in framework_dict['job-forms']['IMPORT'] ]
if 'EXPORT' in framework_dict['job-forms']:
framework_dict['job_forms']['EXPORT'] = [ Form.from_dict(job_form_dict) for job_form_dict in framework_dict['job-forms']['EXPORT'] ]
framework_dict.setdefault('con-forms', [])
framework_dict['con_forms'] = [ Form.from_dict(con_form_dict) for con_form_dict in framework_dict['con-forms'] ]
return Framework(**framework_dict)
示例13: onSubmit
def onSubmit(self):
Form.onSubmit(self)
localdir = self.content["Local Dir?"].get()
portnumber = self.content["Port Number"].get()
servername = self.content["Server Name"].get()
filename = self.content["File Name"].get()
if localdir:
os.chdir(localdir)
portnumber = int(portnumber)
getfile.client(servername, portnumber, filename)
showinfo("getfilegui", "Download complete")
if self.oneshot:
Tk().quit() # else stay in last localdir
示例14: __init__
def __init__(self):
root = Tk()
root.title(self.title)
root.geometry("600x600")
Form.__init__(self)
self.portnum = 0
self.nextport = 0
self.servername = ""
self.filename = ""
self.socket = None
self.transfer_done = 0
self.data_transfer_done = 0
示例15: __init__
def __init__(self):
root = Tk()
root.title(self.title)
root.geometry("600x600")
labels = ['Server Name', 'Port Number']
Form.__init__(self, labels)
self.portnum = 0
self.nextport = 0
self.servername = ""
self.filename = ""
self.socket = None
self.transfer_done = 0
self.data_transfer_done = 0
self.filelist = []