class Practice3(Practice):

    displayMode = DisplayMode.overlap
    ## TTS
    # @var TTS
    reader = None

    def __init__(self, master=None, article=None, **kw):
        self.reader = TTS(True)
        super().__init__(master, article, **kw)

    def onLoad(self):
        super().onLoad()
        self.reader.play(self.article.texts[self.line])

    def onClosing(self):
        self.reader.stop()
        super().onClosing()
Exemplo n.º 2
0
# Load the sets
known = load_set_cache(SET_CACHE_FILE)
if known is None:
	print "Processing magic sets"
	known = match_card.load_sets(BASE_SET_DIR, SETS)
	print "Saving sets to cache file %s" % (SET_CACHE_FILE)
	save_set_cache(SET_CACHE_FILE, known)
print "Magic sets loaded and ready"

cam = cv.CreateCameraCapture(-1)	# Camera, -1 indicates autofind
#cam = cv.CreateCameraCapture(1)
# TODO: detect failed to load camera, CAN NOT simply check if cam is None

scan_card.setup_windows() # win, snapshot, match, background
tts = TTS()		# Load test to speech festival
cache = match_card.GradientCache(BASE_SET_DIR)	# memory cache
scanCard = ScanCard(cam)
matchCard = MatchCard(BASE_SET_DIR)
csv = MagicAssistantCSV(CSV_FILE, append=True)

while True:
	capture = scanCard.check_for_card()
	if capture is not None:
		print "Card captured, proceeding to find a match"
		(card, set_name), is_sure = match_card.match_card(capture, known, cache)

		# Display matched information
		if is_sure == True:
			print "\tMatch Found!"
			res = matchCard.set(set_name, card)
 def __init__(self, master=None, article=None, **kw):
     self.reader = TTS(True)
     super().__init__(master, article, **kw)
Exemplo n.º 4
0
# Load the sets
known = load_set_cache(SET_CACHE_FILE)
if known is None:
    print "Processing magic sets"
    known = match_card.load_sets(BASE_SET_DIR, SETS)
    print "Saving sets to cache file %s" % (SET_CACHE_FILE)
    save_set_cache(SET_CACHE_FILE, known)
print "Magic sets loaded and ready"

cam = cv.CreateCameraCapture(-1)  # Camera, -1 indicates autofind
#cam = cv.CreateCameraCapture(1)
# TODO: detect failed to load camera, CAN NOT simply check if cam is None

scan_card.setup_windows()  # win, snapshot, match, background
tts = TTS()  # Load test to speech festival
cache = match_card.GradientCache(BASE_SET_DIR)  # memory cache
scanCard = ScanCard(cam)
matchCard = MatchCard(BASE_SET_DIR)
csv = MagicAssistantCSV(CSV_FILE, append=True)

while True:
    capture = scanCard.check_for_card()
    if capture is not None:
        print "Card captured, proceeding to find a match"
        (card,
         set_name), is_sure = match_card.match_card(capture, known, cache)

        # Display matched information
        if is_sure == True:
            print "\tMatch Found!"