Beispiel #1
0
    def __init__(self):
        Curso.__init__(self)
        Form.__init__(self)

        self.id_curso = None
        self.set_title("Asistencias")

        fieldsFrame = Frame(self.root, padding=10)
        fieldsFrame.grid(row=0, column=0, padx=10, pady=10)

        lbl_date = Label(fieldsFrame, text="Seleccione la fecha:", width=20)
        lbl_date.grid(row=0, column=0, columnspan=20)

        self.date = StringVar()
        self.cb_date = Combobox(fieldsFrame, textvariable=self.date, width=36,
                                state="readonly")
        self.cb_date.grid(row=1, column=0, columnspan=36, pady=(5,10))

        lbl_inscriptos = Label(fieldsFrame, text="Seleccione los inscriptos que asistieron:", width=40)
        lbl_inscriptos.grid(row=2, column=0, columnspan=40)

        self.listaPersonas = Listbox(fieldsFrame, highlightthickness=0, selectmode="extended", 
                                     height=25, width=40)
        self.listaPersonas.grid(row=3, column=0, columnspan=40, pady=(5,10))

        btn_aceptar = Button(fieldsFrame, text="Aceptar", width=16,
                             command=lambda: self.update_asistencia())
        btn_aceptar.grid(row=4, column=0, columnspan=16)
        
        btn_cancelar = Button(fieldsFrame, text="Cancelar", width=16,
                              command=self.hide)
        btn_cancelar.grid(row=4, column=26, columnspan=16)
Beispiel #2
0
    def __init__(self):
        Curso.__init__(self)
        Form.__init__(self)

        self.id_register = None

        self.fieldsFrame = Frame(self.root, relief="groove", padding=(15,15))
        self.fieldsFrame.grid(row=0, column=0, padx=10, pady=10)

        lbl_name = Label(self.fieldsFrame, text="Nombre: ", width=10)
        lbl_name.grid(row=1, column=0, columnspan=10)

        name = StringVar()
        e_name = Entry(self.fieldsFrame, textvariable=name, width=40)
        e_name.grid(row=2, column=0, columnspan=40, pady=(0,15))

        lbl_date_start = Label(self.fieldsFrame, text="Fecha de inicio: ", width=15)
        lbl_date_start.grid(row=3, column=0, columnspan=15)

        date_start = StringVar()
        e_date_start = Entry(self.fieldsFrame, textvariable=date_start, width=30)
        e_date_start.grid(row=4, column=0, columnspan=30, pady=(0,15))
        e_date_start.config(state="readonly")

        btn_start = Button(self.fieldsFrame, text="...", width=8,
                           command=lambda: date_start.set(DatePicker(self.fieldsFrame).selection()))
        btn_start.grid(row=4, column=30, columnspan=8, padx=(3,0), pady=(0,15))

        lbl_date_end = Label(self.fieldsFrame, text="Fecha de fin: ", width=15)
        lbl_date_end.grid(row=5, column=0, columnspan=15)

        date_end = StringVar()
        e_date_end = Entry(self.fieldsFrame, textvariable=date_end, width=30)
        e_date_end.grid(row=6, column=0, columnspan=30, pady=(0,15))
        e_date_end.config(state="readonly")

        btn_end = Button(self.fieldsFrame, text="...", width=8,
                           command=lambda: date_end.set(DatePicker(self.fieldsFrame).selection()))
        btn_end.grid(row=6, column=30, columnspan=8, padx=(3,0), pady=(0,15))

        lbl_workload = Label(self.fieldsFrame, text="Carga horaria: ", width=15)
        lbl_workload.grid(row=7, column=0, columnspan=15)

        workload = StringVar()
        e_workload = Entry(self.fieldsFrame, textvariable=workload, width=40)
        e_workload.grid(row=8, column=0, columnspan=40, pady=(0,15))

        lbl_place = Label(self.fieldsFrame, text="Lugar: ", width=10)
        lbl_place.grid(row=9, column=0, columnspan=10)

        place = StringVar()
        e_place = Entry(self.fieldsFrame, textvariable=place, width=40)
        e_place.grid(row=10, column=0, columnspan=40, pady=(0,15))

        super().set_fields({"nombre":name, "fecha_inicio":date_start, "fecha_fin":date_end,
                            "carga_horaria":workload, "lugar_dictado":place})

        name.trace("w", lambda *args: self.validate_str(name, *args))
        workload.trace("w", lambda *args: self.validate_int(workload, *args))
        place.trace("w", lambda *args: self.validate_place(place, *args))
Beispiel #3
0
 def __init__(self, parent, **kwargs):
   self.form = {
     'Title': 'Getting More Complicated',
     'Parts':  OrderedDict([
       (('Test Nested Growables', Form.G), [
         (OrderedDict([
            (('Inner Growable', Form.G), [
              StaticText(label = 'This Test is a bit less likely to work.')
            ])
          ]),
          OrderedDict([
            (('Inner Growable 2', Form.G), [
              StaticText(label = 'This Test is a bit less likely to work.')
            ])
          ])),
         [(StaticText(label = "Inner 1"),
           StaticText(label = "Inner 2"),
           OrderedDict([
             (('Inner Growable 2', Form.G), [
               StaticText(label = 'This Test is a bit less likely to work.'),
               (CheckBox(name = 'Check1', label = "A few samples."),
                StaticText(label = "Like This."))
             ])
           ]),
           StaticText(label = "Another Inner"))]
       ])
     ])
   }
   Form.__init__(self, parent, **kwargs)
Beispiel #4
0
    def __init__(self, ge, fields, items):
        Form.__init__(self, 27, 78)

        list_max_width = 76
        list_max_height = 4096
        self.view_point = 0
        self.win_list = curses.newpad(list_max_height, list_max_width)
        #self.win_list.box()
        self.ge = ge

        self.pad.box()
        self.items = []
        self.fields = fields
        self.list_items = []

        self.line_height = 3
        self.line_width = 72
        self.lines_per_page = 6
        self.current = 0

        self.header = self.pad.derwin(3, 72, 1, 3)
        #self.header.box()
        for field in self.fields:
            self.header.addstr(1, 2 + field[0], field[1])
        self.pad.hline(3, 3, 0, 72)
Beispiel #5
0
def main(project_name_param_, assets_param, assets_out_of_scope):
    project_name = project_name_param_
    project = Project(project_name)
    assets = assets_param
    project.set_assets(assets)
    project.save_project()
    scan_instance = Scan(project)
    scan_instance.save_scan()
    for asset in assets:
        asset_instance = Asset(scan_instance, asset)
        asset_subdomains = asset_instance.get_subdomains()
        asset_id = asset_instance.save_asset()
        for subdomain in asset_subdomains:
            subdomain_instance = Subdomain(asset_id, subdomain, assets_out_of_scope)
            subdomain_links = subdomain_instance.parse_links()
            subdomain_id = subdomain_instance.save_subdomain()
            for link in subdomain_links:
                if link in assets_out_of_scope: continue
                link_instance = Link(subdomain_id, link)
                link_instance.process_link()
                link_id = link_instance.save_link()
                forms = link_instance.forms
                for form_index in range(len(forms)):
                    form = forms[form_index]
                    form_instance = Form(link_id, form, form_index)
                    form_instance.save_form()
Beispiel #6
0
    def __init__(self, form_type):
        Curso.__init__(self)
        Form.__init__(self)

        self.id_curso = None
        self.form_type = form_type

        fieldsFrame = Frame(self.root, padding=10)
        fieldsFrame.grid(row=0, column=0, padx=10, pady=(0,10))

        lbl_select = Label(fieldsFrame, text="Seleccione los docentes:", width=26)
        lbl_select.grid(row=0, column=0, columnspan=26)

        self.listaPersonas = Listbox(fieldsFrame, highlightthickness=0, selectmode="extended", 
                                     height=25, width=40)
        self.listaPersonas.grid(row=1, column=0, columnspan=40, pady=(5,10))

        btn_aceptar = Button(fieldsFrame, text="Aceptar", width=16)
        btn_aceptar.grid(row=2, column=0, columnspan=16)

        btn_cancelar = Button(fieldsFrame, text="Cancelar", width=16,
                              command=self.hide)
        btn_cancelar.grid(row=2, column=24, columnspan=16)

        if form_type == "add":
            self.set_title("Agregar docentes")
            btn_aceptar.config(command=lambda: self.add_docente())

        elif form_type == "remove":
            self.set_title("Eliminar docentes")
            btn_aceptar.config(command=lambda: self.remove_docente())
Beispiel #7
0
    def __init__(self):
        Docente.__init__(self)

        Form.__init__(self)
    
        self.fieldsFrame = Frame(self.root, relief="groove", padding=(15,15))
        self.fieldsFrame.grid(row=0, column=0, padx=10, pady=10)

        lbl_dni = Label(self.fieldsFrame, text="DNI: ", width=10)
        lbl_dni.grid(row=1, column=0, columnspan=10)

        dni = StringVar() 
        e_dni = Entry(self.fieldsFrame, textvariable=dni, width=40)
        e_dni.grid(row=2, column=0, columnspan=40, pady=(0,15))

        lbl_name = Label(self.fieldsFrame, text="Nombre: ", width=10)
        lbl_name.grid(row=3, column=0, columnspan=10)

        name = StringVar()
        e_name = Entry(self.fieldsFrame, textvariable=name, width=40)
        e_name.grid(row=4, column=0, columnspan=40, pady=(0,15))

        lbl_surname = Label(self.fieldsFrame, text="Apellido: ", width=10)
        lbl_surname.grid(row=5, column=0, columnspan=10)

        surname = StringVar()
        e_surname = Entry(self.fieldsFrame, textvariable=surname, width=40)
        e_surname.grid(row=6, column=0, columnspan=40, pady=(0,15))

        lbl_email = Label(self.fieldsFrame, text="Email: ", width=10)
        lbl_email.grid(row=7, column=0, columnspan=10)

        email = StringVar()
        e_email = Entry(self.fieldsFrame, textvariable=email, width=40)
        e_email.grid(row=8, column=0, columnspan=40, pady=(0,15))

        lbl_phone = Label(self.fieldsFrame, text="Teléfono: ", width=10)
        lbl_phone.grid(row=9, column=0, columnspan=10)

        phone = StringVar()
        e_phone = Entry(self.fieldsFrame, textvariable=phone, width=40)
        e_phone.grid(row=10, column=0, columnspan=40, pady=(0,15))

        lbl_title = Label(self.fieldsFrame, text="Título: ", width=10)
        lbl_title.grid(row=11, column=0, columnspan=10)

        title = StringVar()
        e_title = Entry(self.fieldsFrame, textvariable=title, width=40)
        e_title.grid(row=12, column=0, columnspan=40, pady=(0,15))

        super().set_fields({"dni":dni, "nombre":name, "apellido":surname, 
                            "email":email, "telefono":phone, "titulo":title})

        dni.trace("w",     lambda *args: self.validate_dni(dni, *args))
        name.trace("w",    lambda *args: self.validate_str(name, *args))
        surname.trace("w", lambda *args: self.validate_str(surname, *args))
        phone.trace("w",   lambda *args: self.validate_phone(phone, *args))
        title.trace("w",   lambda *args: self.validate_str(title, *args))
Beispiel #8
0
 def test_isComplete(self):
     f = Form(Model())
     f.require("age")
     assert not f.isComplete()
     f["age"] = 15
     assert f.isComplete()
     f.require("name","prefill")
     assert not f.isComplete()
     f["name"] = "fred"
     assert f.isComplete()
Beispiel #9
0
 def __init__(self, parent, **kwargs):
   self.form = {
     'Title': "Demo with Growable Regions",
     'Parts':  OrderedDict([
       (('Growable Form', Form.G), [
         StaticText(label = "This Box Sizer will use up available space.")
       ])
     ])
   }
   Form.__init__(self, parent, **kwargs)
Beispiel #10
0
    def __init__(self):
        super(LibraryApp, self).__init__()
        ui_path = os.path.join(self.ROOT_DIR, 'exemplul_2.ui')
        loadUi(ui_path, self)

        self.form = Form()
        self.form.closeEvent = self.CloseEvent
        self.search_btn.clicked.connect(self.search)
        self.save_as_file_btn.clicked.connect(self.save_as_file)
        self.rabbit_mq = RabbitMq(self)
        self.add_book_btn.clicked.connect(lambda: self.form.exec())
Beispiel #11
0
 def __init__(self, parent, **kwargs):
   self.form = {
     'Title': "Demo Form 1",
     'Parts':  OrderedDict([
       ('Test Section', [
         StaticText(label = "This is the first form in our demo."),
         StaticText(label = "It is not terribly complicated."),
         StaticText(label = "Down here is a button that will let us proceed."),
         Button(label = "Click Me To Proceed", name = "Continue", proportion = 0)
       ])
     ])
   }
   Form.__init__(self, parent, **kwargs)
Beispiel #12
0
    def show(self):

        for i in range(len(self.list_items)):
            if self.current == i:
                if self.focused():
                    self.list_items[i].bkgd(curses.color_pair(1))
                else:
                    self.list_items[i].bkgd(curses.color_pair(3))
            else:
                self.list_items[i].bkgd(curses.color_pair(2))

        Form.show(self)
        self.win_list.refresh(self.view_point, 0, 8, 2, self.rows, self.cols)
Beispiel #13
0
    def testValidation(self):
        f = Form(Model())
        try:
            gotError = 0
            f.update({"limited":"bad value",
                      "age":"bad type",
                      "sparky":"bad field"})
        except ValueError:
            gotError = 1

        assert gotError, "expected ValueError"
        assert "age" in f.errors
        assert "limited" in f.errors
        assert "sparky" not in f.errors
Beispiel #14
0
 def testBothways(self):
     f = Form(Model())
     f.model.name = "fred"
     assert f["name"] == "fred"
     f["name"] = "rufus"
     assert f.model.name == "rufus"
     assert f["name"] == "rufus"
Beispiel #15
0
 def fetch(self):
     try:
         with open(f'{self.path}{self.file}', 'r') as file:
             dictionaries = json.load(file)
             completed_forms = []
             for item in dictionaries:
                 form = Form(item['form']['name'])
                 for question in item['form']['questions']:
                     if question['type'] == 'TEXT':
                         form.questions.append(
                             TextQuestion(question['question']))
                     elif question['type'] == 'NUMBER':
                         form.questions.append(
                             NumberQuestion(question['question']))
                     elif question['type'] == 'DROPDOWN':
                         form.questions.append(
                             DropdownQuestion(question['question'],
                                              question['options']))
                     elif question['type'] == 'DATE':
                         form.questions.append(
                             DateQuestion(question['question']))
                 completed_form = CompletedForm(form)
                 answers = []
                 for answer in item['answers']:
                     answers.append(Answer(answer['answer']))
                 completed_form.answers = answers
                 completed_forms.append(completed_form)
             self.completed_forms = completed_forms
             return completed_forms
     except Exception as error:
         pass
Beispiel #16
0
 def eat_forms(self, forms):
     for form in forms:
         form = Form(form)
         if self.is_a_new_form(form):
             #do some processing
             self.forms_queue.put(form)
             self.seen_forms.append(form)
Beispiel #17
0
    def __init__(self, form_type):
        Curso.__init__(self)
        Form.__init__(self)

        self.id_curso = None
        self.form_type = form_type

        fieldsFrame = Frame(self.root, padding=10)
        fieldsFrame.grid(row=0, column=0, padx=10, pady=10)

        lbl_alumnos = Label(fieldsFrame, width=30)
        lbl_alumnos.grid(row=2, column=0, columnspan=30)

        self.listaPersonas = Listbox(fieldsFrame, highlightthickness=0, selectmode="extended", 
                                     height=25, width=40)
        self.listaPersonas.grid(row=3, column=0, columnspan=40, pady=(5,10))

        btn_aceptar = Button(fieldsFrame, text="Aceptar", width=16)
        btn_aceptar.grid(row=4, column=0, columnspan=16)
        
        btn_cancelar = Button(fieldsFrame, text="Cancelar", width=16,
                              command=self.hide)
        btn_cancelar.grid(row=4, column=26, columnspan=16)

        if form_type == "add":
            self.set_title("Inscribir alumnos")
            lbl_alumnos.config(text="Seleccione los alumnos:")

            lbl_date = Label(fieldsFrame, text="Seleccione la fecha:", width=20)
            lbl_date.grid(row=0, column=0, columnspan=20)

            self.date = StringVar()
            e_date = Entry(fieldsFrame, textvariable=self.date, width=30)
            e_date.grid(row=1, column=0, columnspan=30, pady=(0,10))
            e_date.config(state="readonly")

            btn_date = Button(fieldsFrame, text="...", width=8,
                            command=lambda: self.date.set(DatePicker(fieldsFrame).selection()))
            btn_date.grid(row=1, column=32, columnspan=8, pady=(0,10))

            btn_aceptar.config(command=lambda: self.add_cursante())

        elif form_type == "remove":
            self.set_title("Remover inscriptos")
            lbl_alumnos.config(text="Seleccione los inscriptos:")
            btn_aceptar.config(command=lambda: self.remove_cursante())
Beispiel #18
0
 def __init__(self, parent, **kwargs):
   self.form = {
     'Title': "Nexted Containers",
     'Parts':  OrderedDict([
       (('Test Nested Growables', Form.G), [
         OrderedDict([
           (('Inner Growable', Form.G), [
             StaticText(label = 'This Test is a bit less likely to work.')
           ])
         ]),
         OrderedDict([
           (('Inner Growable 2', Form.G), [
             StaticText(label = 'This Test is a bit less likely to work.')
           ])
         ])
       ])
     ])
   }
   Form.__init__(self, parent, **kwargs)
Beispiel #19
0
 def toSearchByWord(self):
     self.ui = Form()
     self.ui.setOptionsMenu(self.toMenu, self.toRegulatedData, self.toGraph,
                            self.toSearchByWord, self.toDashboard,
                            self.toAllData, self.toResidenceBigData,
                            self.toProcessesBigData,
                            self.toResidenceAndProcessesBigData,
                            self.toDataInventary)
     self.MainWindow.move(600, 100)
     self.ui.setupUi(self.MainWindow)
Beispiel #20
0
    def form(self, **kwds):
        from PortletContent import PortletContent
        wrapper = PortletContent()

        from Form import Form
        item = Form(**kwds)
        wrapper.content = item

        self.contents.append(wrapper)
        return item
Beispiel #21
0
 def run_form(self):
     """
     Runs a form
     Params:
         None
     Returns:
         None
     """
     if (Constants.FORM_FILES[self.block_count] is None):
         self.next_block()
         return
     #Parsing questionnaire data and creating form
     data_frame = pandas.read_excel(Constants.FORM_FILES[self.block_count])
     form_output = defaultdict(list)  #Output stream
     Form(self.win, data_frame, form_output, self.timer, self)
def index():
    keyword = ""
    if request.method == 'POST':
        answers = []
        keyword = request.form['keywordInput']
        option = request.form['radioMethod']
        if request.files:
            files = request.files.getlist('sourceFile')
            for file in files:
                if file.filename == "" or file.filename == " " or file.filename == None:
                    print("NAMELESS FILE")
                    redirect(request.url)
                try:
                    file.save(
                        path.join(app.config["FILE_UPLOADS"], file.filename))
                    print("File saved")
                except Exception as e:
                    print(e)
                    print("NO FILES UPLOADED")
                form = Form(file.filename, keyword, option)
                form.readFile()
                answers.append(form)

        try:
            return render_template('index.html',
                                   keyword=keyword,
                                   answers=answers)
            return redirect(request.url)
        except Exception as e:
            return "There was an issue processing the files"
            return render_template('index.html',
                                   keyword=keyword,
                                   answers=answers)

    else:
        return render_template("index.html", keyword=keyword)
Beispiel #23
0
    def __init__(self):
        self.evalDialog = QtWidgets.QMainWindow()
        self.new_screen = Form()
        self.new_screen.setupUi(self.evalDialog)

        self.EvaluateWindow = QtWidgets.QMainWindow()
        self.eval_screen = Box()
        self.eval_screen.setupUi(self.EvaluateWindow)

        self.openDialog = QtWidgets.QMainWindow()
        self.open_screen = Ui_openWindow()
        self.open_screen.setupUi(self.openDialog)

        self.scoreDialog = QtWidgets.QMainWindow()
        self.score_screen = Ui_ScoreWindow()
        self.score_screen.setupUi(self.scoreDialog)
Beispiel #24
0
def _create():
    c_form = Form("Création")
    c_form.add_text("Nom du compte")

    c_form.fill(stdscr)

    if not c_form.cancelled:
        db_name, = c_form.retrieve()
        if var['opened_db'] != "":
            close_database(var['f_db'])

        var['f_db'] = create_database(db_name)

    var['cancelled'] = True
Beispiel #25
0
def _load():
    l_form = Form("Ouverture")
    l_form.add_text("Nom du compte")

    l_form.fill(stdscr)

    if not l_form.cancelled:
        db_name, = l_form.retrieve()
        if var['opened_db'] != "":
            close_database(var['f_db'])

        var['f_db'] = open_database(db_name)

    var['cancelled'] = True
Beispiel #26
0
    def editteam(self, team, **kwargs):
        if not 'team_id' in kwargs:
            team = self.getteam(team, None)
            if not team: raise cpy.HTTPRedirect("/admin/lsteam/")
            team_info = { 'team_id':      (team.id, []),
                          'name':         (team.name, []),
                          'description':  (team.description or "", []),
                          'fullsize':     (team.fullsize or "", [])}
        else:
            team_info = kwargs

        __form = kwargs.get("__form", None)
        if __form: form = PartialForm(self._editteamform, Form.Decode(__form))
        else:      form = PartialForm(self._editteamform, team_info)

        return ("editteam", {"form": form, "team": team})
Beispiel #27
0
    def addteam_(self, **kwargs):
        success, serial = self._addteamform.Validate(kwargs)
        if not success:
            raise cpy.HTTPRedirect("/admin/addteam?%s" % Form.Encode(serial))

        session = Session()
        team = Team(kwargs['name'], 
                    kwargs['thumb'],
                    kwargs['fullsize'],
                    encrypt(kwargs['password']),
                    1,
                    kwargs['description'])
        session.save(team)
        session.commit()
        session.close()

        raise cpy.HTTPRedirect("/admin/lsteam/")
Beispiel #28
0
def _del():
    if var['opened_db'] != "":
        d_form = Form("Suppression")
        d_form.add_carousel("Supprimer " + var['opened_db'], ["Non", "Oui"])

        d_form.fill(stdscr)

        if not d_form.cancelled:
            confirmation, = d_form.retrieve()
            if confirmation == "Oui":
                delete_database(var['f_db'])
    else:
        log("Suppression impossible, pas de compte ouvert.", 1)

    var['cancelled'] = True
Beispiel #29
0
    def handle_starting_form(self, attrs):
        """
        This method handles a new form opening event.
        Called from handle_starttag
        :param attrs: The attributes of the form
        :return: None
        """
        # First, get the relevant attributes
        form_method = ""
        form_action = ""
        for attr in attrs:
            if attr[0] == A_ACTION:
                form_action = attr[1]
            elif attr[0] == A_METHOD:
                form_method = attr[1]

        self._forms.append(Form(form_method, form_action, self._url))
Beispiel #30
0
 def add_form(self):
     print('Nuevo Formulario')
     print('Nombre: ', end='')
     name = input()
     if name == '':
         print('[ERROR] Nombre invalido')
         return
     new_form = Form(name)
     opt = ''
     while opt != '0':
         print(f'[1] Agregar pregunta [2] Guardar formulario [0] Salir')
         opt = input()
         if opt == '1':
             self.select_type(new_form)
         elif opt == '2':
             self.form_service.forms.append(new_form)
             self.form_service.store()
             break
Beispiel #31
0
    def editteam_(self, **kwargs):
        success, serial = self._editteamform.Validate(kwargs)
        if not success:
            raise cpy.HTTPRedirect("/admin/editteam?%s" % Form.Encode(serial))

        session = Session()
        #TODO: load the team, see what's different, and change those fields
        team = session.query(Team).filter_by(id=kwargs["team_id"]).first()
        if team.name != kwargs["name"]: 
            team.name = kwargs.name
        if team.description != kwargs["description"]: 
            team.description = kwargs["description"]
        if team.fullsize != kwargs["fullsize"]:
            team.fullsize = kwargs["fullsize"]
        if "password" in kwargs:
            team.password = encrypt(kwargs["password"])
        session.commit()
        session.close()
        raise cpy.HTTPRedirect("/admin/lsteam/")
Beispiel #32
0
 def fetch(self):
     try:
         with open(f'{self.path}{self.file}', 'r') as file:
             dictionaries = json.load(file)
             forms = []
             for item in dictionaries:
                 new_form = Form(item['name'])
                 for question in item['questions']:
                     if question['type'] == 'TEXT':
                         new_form.questions.append(TextQuestion(question['question']))
                     elif question['type'] == 'NUMBER':
                         new_form.questions.append(NumberQuestion(question['question']))
                     elif question['type'] == 'DROPDOWN':
                         new_form.questions.append(DropdownQuestion(question['question'], question['options']))
                     elif question['type'] == 'DATE':
                         new_form.questions.append(DateQuestion(question['question']))
                 forms.append(new_form)
             self.forms = forms
             return forms
     except Exception as error:
         pass
Beispiel #33
0
def _remove():
    if var['opened_db'] != "" and var['id_list'] != []:
        r_id = var['id_list'][var['selected']]
        db = var['f_db'].cursor()
        db.execute("SELECT name FROM payments WHERE id = ?", (r_id, ))
        r_name, = db.fetchone()

        r_form = Form("Suppression d'un paiement")
        r_form.add_carousel("Supprimer '{0}' ?".format(r_name), ["Non", "Oui"])

        r_form.fill(stdscr)

        if not r_form.cancelled:
            confirmation, = r_form.retrieve()
            if confirmation == "Oui":
                delete_payment(db, r_id)
                var['f_db'].commit()
                var['changed'] = True
                var['id_list'].pop(var['selected'])
Beispiel #34
0
    def test_keys(self):
        f = Form(Model())
        keys = list(f.keys())
        keys.sort()
        assert keys == ["age","limited","name","prefill"], keys

        # and for non-strongboxes...
        # (YAGNI, probably, but it might help someone else)
        class Gronk: pass
        g = Gronk()
        g.a = 1
        g.b = 2
        g.c = 3
        g._ = "hidden"
        f = Form(g)
        keys = list(f.keys())
        keys.sort()
        assert keys == ["a","b","c"]
Beispiel #35
0
 def bind(self):
   Form.bind(self)
   for name in self.elements.keys():
     self.Bind(wx.EVT_BUTTON, lambda e, f = globals()[name]: FormDialog(self, f, modal = True), name)
Beispiel #36
0
 def bind(self):
   self.Bind(wx.EVT_BUTTON, self.onContinue, 'Continue')
   Form.bind(self)
Beispiel #37
0
 def test_ToDict(self):
     f = Form(Model())
     assert f.toDict() == {"name":"",
                           "age":None,
                           "prefill":"example",
                           "limited":"a"}