Exemple #1
0
 def show_table(self):
     form = Form()
     form.add(w.SubmitWidget, "prev", "prev")
     form.add(w.SubmitWidget, "next", "next")
     if form.is_submitted():
         if form["prev"]:
             self.table.cycle.prev()
         elif form["next"]:
             self.table.cycle.next()
     return htmltext(self.table.render()) + form.render()
Exemple #2
0
def stopper():
    stop = get_field("stop")
    if stop:
        player.kill()
        return simplepage(body = "%s stopped." % song)
    else:
        f = Form()
        f.add_submit("stop", "Stop")
        return simplepage(body= ("Playing %s" % song) +
                          f.render())
Exemple #3
0
 def select_histo(self):
     form = Form()
     form.add(w.SingleSelectWidget, "kind", options=["genre", "nation"])
     form.add(w.SubmitWidget, "submit", "Choose!")
     if form.is_submitted():
         return self.show_histo(form["kind"])
     else:
         return form.render()
Exemple #4
0
 def form_with_submit(self):
     form = Form()
     form.add(StringWidget, "Telefono", value="XXX")
     form.add(SubmitWidget, "submit", value="ok")
     if not form.is_submitted():
         return form.render()
     else:
         return self.thank_you(form["Telefono"])
Exemple #5
0
 def mutande(self):
     msg = htmltext("""
     Abbiamo disponili i seguenti modelli: <br/> <br/>
     A. mutanda modello base <br/>
     B. mutandina di pizzo per signore <br/>
     C. mutandone ascellare modello Fantozzi <br/>
     """)
     form = Form()
     form.add(CheckboxWidget, "modelloA", value=0)
     form.add(CheckboxWidget, "modelloB", value=0)
     form.add(CheckboxWidget, "modelloC", value=1)
     form.add(SubmitWidget, "submit", "Compra!")
     return msg + form.render()
Exemple #6
0
 def add_book(self):
     form = Form()
     for field in Book.FIELDS:
         form.add(StringWidget, field, title=field)
     form.add(SubmitWidget, "submit")
     if not form.is_submitted():
         return form.render()
     else:
         self.db.add_book(*[form[field] for field in Book.FIELDS])
         self.db.commit()
         return "A new book has been added!"
Exemple #7
0
 def select_histo(self):
     form = Form()
     form.add(w.SingleSelectWidget, "kind", options=["genre", "nation"])
     form.add(w.SubmitWidget, "submit", "Choose!")
     if form.is_submitted():
         return self.show_histo(form["kind"])
     else:
         return form.render()
Exemple #8
0
 def maketable(self):
     #yield "<div align='center'>"
     if self.ismultipage:
         form = Form()
         form.add(SubmitWidget, "prev", "Prev")
         form.add(SubmitWidget, "next", "Next")
         if form["next"]: # is submitted
             self.sect = self.section.next()
         if form["prev"]: # is submitted
             self.sect = self.section.prev()
         yield "Page #%s of %s" % (self.section.index+1, len(self.section))
     yield "<table border='1'>"
     if self.header:
         yield self.makerow(self.header)
     for row in self.sect:
         yield self.makerow(row)
     yield "</table>"
     if self.ismultipage:
         yield form.render()
Exemple #9
0
 def maketable(self):
     if self.ismultipage:
         form = Form()
         form.add(SubmitWidget, "prev", "Prev")
         form.add(SubmitWidget, "next", "Next")
         if form["next"]:  # is submitted
             self.sect = self.section.next()
         if form["prev"]:  # is submitted
             self.sect = self.section.prev()
         yield "Page #%s of %s" % (self.section.index + 1, len(
             self.section))
     yield "<table border='1'>"
     if self.header:
         yield self.makerow(self.header)
     for row in self.sect:
         yield self.makerow(row)
     yield "</table>"
     if self.ismultipage:
         yield form.render()
Exemple #10
0
 def mutande(self):
     msg = htmltext("""
     Abbiamo disponili i seguenti modelli: <br/> <br/>
     A. mutanda modello base <br/>
     B. mutandina di pizzo per signore <br/>
     C. mutandone ascellare modello Fantozzi <br/>
     """)
     form = Form()
     form.add(CheckboxWidget, "modelloA", value=0)
     form.add(CheckboxWidget, "modelloB", value=0)
     form.add(CheckboxWidget, "modelloC", value=1)
     form.add(SubmitWidget, "submit", "Compra!")
     return msg  + form.render()
Exemple #11
0
 def edit_book(self):
     ""
     form = Form()
     for field in Book.FIELDS:
         form.add(StringWidget, field, title=field,
                  value=getattr(self.currentbook, field))
     form.add(SubmitWidget, "submit")
     if not form.is_submitted():
         return form.render()
     else:
         self.db.edit_book(self.currentbook.dbkey,
                           *[form[field] for field in Book.FIELDS])
         self.db.commit()
         return "The book has been edited!"
Exemple #12
0
 def calzini(self):
     msg = htmltext("""
     Abbiamo disponili i seguenti modelli: <br/> <br/>
     A. Calzettone lungo da neve <br/>
     B. Calzino di seta estivo <br/>
     C. Calzino nero lutto <br/>
     """)
     form = Form()
     form.add(RadiobuttonsWidget, "calzini", options=list("ABC"))
     form.add(SubmitWidget, "submit", "Compra!")
     return msg + form.render()
Exemple #13
0
def selector(songs):
    global player, song
    chosen = get_field("select")
    if chosen:
        song = chosen
        player = play(song)
        redirect("stopper") # works with Mozilla, but not with lynx/elinks
    else:
        f = Form()
        f.add_single_select("select", options=songs)
        f.add_submit("play", "Play!")
        return f.render()
Exemple #14
0
 def show_table(self):
     form = Form()
     form.add(w.SubmitWidget, "prev", "prev")
     form.add(w.SubmitWidget, "next", "next")
     if form.is_submitted():
         if form["prev"]:
             self.table.cycle.prev()
         elif form["next"]:
             self.table.cycle.next()
     return htmltext(self.table.render()) + form.render()
Exemple #15
0
 def calzini(self):
     msg = htmltext("""
     Abbiamo disponili i seguenti modelli: <br/> <br/>
     A. Calzettone lungo da neve <br/>
     B. Calzino di seta estivo <br/>
     C. Calzino nero lutto <br/>
     """)
     form = Form()
     form.add(RadiobuttonsWidget, "calzini", options=list("ABC"))
     form.add(SubmitWidget, "submit", "Compra!")
     return msg  + form.render()
Exemple #16
0
def user_passwd_form():
    form = Form()
    form.add(StringWidget, "un", title="Username")
    form.add(PasswordWidget, "pw", title="Password")
    form.add(SubmitWidget, "submit", "Submit")
    return form
Exemple #17
0
def un_pw_form():
    form = Form()
    form.add(StringWidget, 'username', title="Username")
    form.add(PasswordWidget, 'password', title="Password")
    form.add(SubmitWidget, "submit", "Submit")
    return form
Exemple #18
0
def un_pw_form():
    form = Form()
    form.add(StringWidget, 'username', title="Username")
    form.add(PasswordWidget, 'password', title="Password")
    form.add(SubmitWidget, "submit", "Submit")
    return form
Exemple #19
0
def user_passwd_form():
    form = Form()
    form.add(StringWidget, "un", title="Username")
    form.add(PasswordWidget, "pw", title="Password")
    form.add(SubmitWidget, "submit", "Submit")
    return form