Ejemplo n.º 1
0
        elif number==max_:
            max_p = max_p+","+person
    if max_p is not None:
        content += "  " + max_p + "\n"
sub_page.content = content

def award_show(award):
    content = colours.Foreground.GREEN+award[0]+colours.Foreground.DEFAULT+"\n"
    max_len = 0
    for person in award[1]:
        max_len = max(max_len,len(person))
    for person,number in award[1].items():
        content += person + (" "*(max_len-len(person)))
        content += sub_page.colours.Foreground.RED+"|"+sub_page.colours.Foreground.DEFAULT
        for i in range(number):
            content += choice(sub_page.colours.Foreground.non_boring)
            content += u"o_O"+sub_page.colours.Foreground.DEFAULT
        content += "\n"
    return content

def title(text):
    return colour_print(printer.text_to_ascii(text))

tea_page = Page("457")
tea_page.content = title("Tea Annawards") + "\n\n" + award_show(awards[0]) + "\n" + award_show(awards[1])
tea_page.in_index = False

other_page = Page("458")
other_page.content = title("Other Annawards") + "\n\n" + award_show(awards[2]) + "\n" + award_show(awards[3]) + "\n" + award_show(awards[4]) + "\n" + award_show(awards[5])
other_page.in_index = False
Ejemplo n.º 2
0
import os
from page import Page
from colours import colour_print
from printer import instance as printer

page_number = os.path.splitext(os.path.basename(__file__))[0]
sub_page = Page(page_number)
sub_page.title = "Page Not Found"
sub_page.in_index=False
sub_page.content = colour_print(printer.text_to_ascii("404", padding={"left": 30}))
sub_page.content += "\n\n"
sub_page.content += colour_print(printer.text_to_ascii("Page Not Found", padding={"left": 2}))
Ejemplo n.º 3
0
import os
from page import Page
import colours
from printer import instance as printer

r1 = Page("581")
r1.title = "Bad Tempered Cake"
r1.in_index = False
r1.content = (colours.colour_print(
    printer.text_to_ascii("bad tempered cake"),
    colours.Background.RED,
    colours.Foreground.BLUE) +
"""
1/2 lb    Rich tea and/or digestive biscuits
    4 oz    Margarine
    1 dsp   Sugar
    3 dsp   Cocoa
    3 dsp   Drinking chocolate
1 1/2 tbsp  Golden syrup
    2 oz    Sultanas
    2 bars  Milk chocolate

1. Break the biscuits.
2. Melt the margarine, sugar, cocoa, drinking chocolate and syrup over a medium
   heat.
3. Mix with biscuits and sultanas and press down in baking tray.
4. Cover with melted milk chocolate.
5. Leave in the fridge to set""")

r2 = Page("582")
r2.title = "Huda Friendship Cake"