Esempio n. 1
0
def ask():
    user = r.get(SERVER_ADDRESS)
    path = save(user.content)
    page = HtmlPage()
    page.form_page(path, SERVER_ADDRESS)
    index = page.save()
    webbrowser.open(index)
Esempio n. 2
0
def viewer(ipuz_file_name, rendered_file_name):
    print('Converting "{}" to "{}"'.format(ipuz_file_name, rendered_file_name))
    with open(ipuz_file_name) as puzzle_file:
        ipuz_dict = ipuz.read(
            puzzle_file.read())  # may raise ipuz.IPUZException
    puzzle = crossword.from_ipuz(ipuz_dict)

    with HtmlPage(rendered_file_name) as draw:
        draw.heading(1, 'Crossword example')
        draw.heading(
            2, '{} by {}'.format(puzzle.meta['title'],
                                 puzzle.meta['publisher']))

        # draw the empty crossword board
        with draw.crossword(puzzle.block) as grid:
            for row in puzzle:
                grid.add_row([(get_literal(cell.puzzle), ' ') for cell in row])

        # container to hold clues
        with draw.column_container() as _:
            # disply ACROSS clues
            with draw.column() as _:
                draw.heading(3, 'ACROSS')
                for number, clue in puzzle.clues.across():
                    draw.line('{} {}'.format(number, clue))

            # disply DOWN clues
            with draw.column() as _:
                draw.heading(3, 'DOWN')
                for number, clue in puzzle.clues.down():
                    draw.line('{} {}'.format(number, clue))

        # draw solution
        draw.heading(2, 'Solution')
        with draw.crossword(puzzle.block) as grid:
            for row in puzzle:
                grid.add_row([(get_literal(cell.puzzle), cell.solution)
                              for cell in row])

        draw.rights(puzzle.meta['rights'])

    print('Done!')
Esempio n. 3
0
 def process(self):
     HtmlPage.process(self)
     if 'bgcolor' in self.form:
         self.bgcolor = self.form['bgcolor'].value
Esempio n. 4
0
 def __init__(self):
     HtmlPage.__init__(self, "Do Something")
     self.bgcolor = 'lightblue'
Esempio n. 5
0
 def __init__(self):
     HtmlPage.__init__(self, "Painters")
     self.style = 'body {background-color: lightblue}' \
                  'table {background-color: white}'
Esempio n. 6
0
 def __init__(self):
     HtmlPage.__init__(self, "Hello World")
Esempio n. 7
0
 def __init__(self):
     HtmlPage.__init__(self, "Hello World")
Esempio n. 8
0
 def __init__(self):
     HtmlPage.__init__(self, "Now's the time")
Esempio n. 9
0
 def __init__(self):
     HtmlPage.__init__(self, "Now's the time")
Esempio n. 10
0
 def process(self):
     HtmlPage.process(self)
     if 'bgcolor' in self.form:
         self.bgcolor = self.form['bgcolor'].value
Esempio n. 11
0
 def __init__(self):
     HtmlPage.__init__(self, "Do Something")
     self.bgcolor = 'lightblue'