예제 #1
0
def init_match(root='/home/fibel/Primer_v1/'):
    global g_front, g_back, display_front, display_back, root_dir
    root_dir = root
    display_back = driver_it8951.IT8951()
    display_back.init(screen="back")
    display_front = driver_it8951.IT8951()
    display_front.init()
    white_image = Image.new("1", (600, 800), color='#FFFFFF')
    display_front.load_image(0,
                             0,
                             white_image,
                             img_addr=display_front.img_addr)
    display_back.load_image(0, 0, white_image, img_addr=display_back.img_addr)
    display_front.display_buffer_area(0, 0, 800, 600, 2,
                                      display_front.img_addr)
    display_back.display_buffer_area(0, 0, 800, 600, 2, display_back.img_addr)
    g_back = gesture(busno=3, caseflag=1)
    g_front = gesture(busno=1, caseflag=0)
def init_BDLP(root='/home/fibel/Primer_v1/'):
    global g,driver,root_dir
    root_dir=root
    driver=driver_it8951.IT8951()
    driver.init(screen="back")
    try:
        g=gesture(busno=3)
    except:
        g="NO SENSOR"
예제 #3
0
def init(voice='ddh',
         script='schola',
         illustrator='',
         root='/home/fibel/Primer_v1/',
         lexikon='/home/fibel/Primer_v1/Lexikon/',
         curriculum='Lesen',
         thema='Tiere',
         lesson='1',
         folio_amount=10,
         label_height=100,
         screen="front"):
    #have to do this horrible assigments because of the bloody-blood 'name "whatever" is parameter and global' error
    global g, default_voice, font, img_author, lexikon_dir, root_dir, topic_dir, lesson_dir, deck_dir, max_labels, driver, pointers, pointer, lock, loaded_foliae, folio_links, active_label, start_load, fa, labels, default_voice, title_height
    default_voice = voice
    font = script
    img_author = illustrator
    root_dir = root
    lexikon_dir = lexikon
    topic_dir = root_dir + '/' + curriculum + '/' + thema
    lesson_dir = topic_dir + '/Lectiones/' + lesson + '/'
    deck_dir = lesson_dir + 'Deck/'
    max_labels = folio_amount
    title_height = label_height
    #ACTIVATE AUDIO
    #fa=fibelaudio()
    #fa.run()

    #if len(sys.argv)>3:
    #    max_labels=int(sys.argv[3])
    #else:
    #    max_labels=10

    driver = driver_it8951.IT8951()
    #driver.init(partial=True)
    driver.init(screen=screen)

    pointers = dict()
    old_pointer = 0
    start_load = time.time()
    loaded_foliae = 0
    lock = threading.Condition()
    folio_links = sorted(sample(os.listdir(deck_dir), max_labels))
    labels = [
        re.sub("^\d+[\-.]", "", folio_link) for folio_link in folio_links
    ]
    active_label = ""
    pointer = driver.img_addr

    #ACTIVATE AUDIO
    #fa=fibelaudio()
    #fa.run()

    try:
        g = gesture()
    except:
        g = "NO SENSOR"
예제 #4
0
font = 'Fonts/schola.otf'
margin_width = 20
color = 0


def pntr(id):
    global display
    return display.img_addr + id * (2 * display.width * display.height + 1)


pntr_id = 0

from Fibel.input.gesture import *

g = gesture()
cursor = 0

while (True):
    cmd = g.get_gesture()
    if cmd is not 'R':
        time.sleep(0.1)
        continue
#for text in texts:
    text = texts[cursor]
    cursor += 1
    word_pointers = []
    #word_pointers.append([])
    #folio = FolioText((int(display.width),int(display.height/2)), word_pointers[pntr_id])
    folio = FolioText((int(display.height), int(display.width / 1)),
                      word_pointers)