當前位置: 首頁>>代碼示例>>Python>>正文


Python form.Form類代碼示例

本文整理匯總了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))
開發者ID:Kewtt,項目名稱:hue,代碼行數:26,代碼來源:job.py

示例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()
開發者ID:RajaS,項目名稱:Reporter,代碼行數:35,代碼來源:report_manager.py

示例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)
開發者ID:Web5design,項目名稱:hue,代碼行數:26,代碼來源:job.py

示例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
開發者ID:andrej2704,項目名稱:network,代碼行數:8,代碼來源:getfilegui.py

示例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"
開發者ID:todd-x86,項目名稱:tkplus,代碼行數:9,代碼來源:tkplus.py

示例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
開發者ID:jtojnar,項目名稱:foris,代碼行數:10,代碼來源:fapi.py

示例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)
開發者ID:Jack-coastal,項目名稱:hue,代碼行數:11,代碼來源:connection.py

示例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))
開發者ID:superxu,項目名稱:COMPSCI711,代碼行數:11,代碼來源:client.py

示例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
開發者ID:AnithaT,項目名稱:eden,代碼行數:11,代碼來源:actions.py

示例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
開發者ID:inteljack,項目名稱:EL6183-Digital-Signal-Processing-Lab-2015-Fall,代碼行數:12,代碼來源:getfilegui.py

示例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)
開發者ID:Jack-coastal,項目名稱:hue,代碼行數:12,代碼來源:framework.py

示例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
開發者ID:shantanuo,項目名稱:pp4p,代碼行數:13,代碼來源:getfilegui.py

示例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
開發者ID:superxu,項目名稱:COMPSCI711,代碼行數:14,代碼來源:cache.py

示例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 = []
開發者ID:superxu,項目名稱:COMPSCI711,代碼行數:14,代碼來源:client.py


注:本文中的form.Form類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。