Example #1
0
    def run(self, data):
        """
        Carga Vocabulario, pone widgets a estado inicial y
        carga primera palabra.
        """
        topic, _dict = data
        self.user = _dict
        parser = SafeConfigParser()
        metadata = os.path.join(topic, "topic.ini")
        parser.read(metadata)

        self.cabecera.titulo.set_text("Topic: " + parser.get('topic', 'title'))

        self.derecha.run()
        vocabulario = get_vocabulario(topic, _dict)
        if len(vocabulario) > 14:
            vocabulario = vocabulario[:15]
        self.show()
        if vocabulario:
            self.vocabulario = vocabulario
            self.topic = topic
            self.index_select = 0
            gobject.timeout_add(500, self.__load, self.index_select)
        else:
            self.topic = topic
            dialog = Dialog("Come back tomorrow!", self.get_toplevel(),
                ("OK", gtk.RESPONSE_ACCEPT),
                "You've memorized all flashcards for today.")
            dialog.run()
            dialog.destroy()
            self.emit("video", self.topic)
def probar(n):

    for dias in range(0, n):

        today = datetime.date.today()
        target = today + datetime.timedelta(dias)

        try:
            old_vocab = vocabulario[:]
        except NameError:
            old_vocab = []

        vocabulario = get_vocabulario("Topics/Topic_4",
                                      _dict,
                                      force_date=target)
        vocabulario = map(lambda x: x[1], vocabulario)

        print "= Fecha", target

        #for item in vocabulario:

        #print list(difflib.unified_diff(old_vocab, vocabulario))
        print len(vocabulario)
        #pprint.pprint (vocabulario)
        grabar(n)
def grabar(n=0):

    today = datetime.date.today()
    target = today + datetime.timedelta(n)

    vocabulario = get_vocabulario(topic, _dict, force_date=target)
    vocabulario = map(lambda x: x[1], vocabulario)

    for item in vocabulario:
        #if random.choice([True, False]):
        n = random.choice([3, 5])
        guardar(_dict, os.path.abspath(topic), item, n, force_date=target)
def grabar(n=0):

    today = datetime.date.today()
    target = today + datetime.timedelta(n)

    vocabulario = get_vocabulario(topic, _dict, force_date=target)
    vocabulario = map(lambda x: x[1], vocabulario)

    for item in vocabulario:
        #if random.choice([True, False]):
        n = random.choice([3,5])
        guardar(_dict, os.path.abspath(topic), item, n, force_date=target)
def probar(n):

    for dias in range(0,n):

        today = datetime.date.today()
        target = today + datetime.timedelta(dias)

        try:
            old_vocab = vocabulario[:]
        except NameError:
            old_vocab = []

        vocabulario = get_vocabulario("Topics/Topic_4", _dict, force_date=target)
        vocabulario = map(lambda x: x[1], vocabulario)

        print "= Fecha", target

        #for item in vocabulario:

        #print list(difflib.unified_diff(old_vocab, vocabulario))
        print len(vocabulario)
        #pprint.pprint (vocabulario)
        grabar(n)