Beispiel #1
0
    def modify_word(self,word_to_change=None):
        
        if word_to_change==None:
            choices_list=[]
            for word in self.__content.keys():
                choices_list.append(word)
            if len(choices_list)>0:
                word_to_change=easygui.choicebox(msg='Pick the item that you want to change', title='Change a Word', choices=choices_list)
        
        if not word_to_change==None:
            previous_translation=self.__content[word_to_change]["Definition/Translation/Association"]
            previous_group=str(self.__content[word_to_change]["Group"])
            input_modif=easygui.multenterbox(msg='Enter the new definition for the word: '+word_to_change,fields=("Word","Translation","Group"),values=(word_to_change,str(previous_translation),previous_group))
            if not input_modif==None:
                if input_modif[0]==word_to_change:
                    self.__content[word_to_change]["Definition/Translation/Association"]=input_modif[1]
                    self.__content[word_to_change]["Group"]=int(input_modif[2])
                else :
                    del self.__content[word_to_change]
                    word=input_modif[0]
                    translation=input_modif[1]
                    """Group=int(input_modif[2])"""
                    Group=0
                    Last_Interogation_Date=None
                    Time_since_the_last_interogation=None
                    Time_before_the_next_interogation=0

                    self.__content[word]={"Word":word,"Definition/Translation/Association":translation,"Group":Group,
                                          "Last Interogation Date":Last_Interogation_Date,
                                          "Number of Days since the last interogation":Time_since_the_last_interogation,
                                          "Number of Days before the next interogation":Time_before_the_next_interogation}
Beispiel #2
0
    def add_word(self):
        '''
        Method which Allow adding a word in the dictionary by a GUI
        '''
        word_input=easygui.multenterbox(msg='Add Word', title='Add Word',fields=('Word',"Definition/Translation/Association"), values=("Bonjour","Guten Tag"))
        
        if not word_input==None:
            word=word_input[0]
            translation=word_input[1]
            Group=0
            Last_Interogation_Date=None
            Time_since_the_last_interogation=None
            Time_before_the_next_interogation=0

            self.__content[word]={"Word":word,"Definition/Translation/Association":translation,"Group":Group,
                                  "Last Interogation Date":Last_Interogation_Date,
                                  "Number of Days since the last interogation":Time_since_the_last_interogation,
                                  "Number of Days before the next interogation":Time_before_the_next_interogation}
            self.save(self.__uploaded_dictionary_file_path)
            msg   = "We have add the word: "+word+" (Translation: "+translation+") in the dictionry"
            choices = ["Add Word Again","Main Menu","Cancel"]
            reply=easygui.buttonbox(msg,choices=choices)
        else:
            reply="Main Menu"
        if reply=="Add Word Again":
            self.add_word()
        elif reply=="Cancel":
            del  self.__content[word]
        else :
            pass
Beispiel #3
0
 def gen_param_prompt(self, msg="Fill in fields", title="Prompt", defaults=[]):
     """Prompts the user to enter various map generation parameters, and returns
     them as a dictionary.
     """
     # Add generic info to end of the message displayed in the prompt window
     msg += "  Leave seed blank for a random seed."
     # Fields in the prompt
     fields = ("Width", "Height", "Seed")
     # Prompt user for data
     values = easygui.multenterbox(msg, title, fields, defaults)
     # Check if user canceled/closed the prompt
     if values is None:
         return None
     # Creat dictionary, change strings to other types as needed
     params = {
     'width' : int(values[0]),
     'height' : int(values[1]),
     'seed': values[2]
     }
     # If seed field was left empty, set seed to none to indicate random seed selection
     if params['seed'] == '':
         params['seed'] = None
     return params
Beispiel #4
0
        if __mode__==None:
            pass
        elif re.search("Learn",__mode__) is not None:
            dictionary_of_work.create_new_interogation(
                list=[],
                number_of_word_to_learn=__number_of_word_to_learn_by_serie__,
                day_in_advance=__day_in_advance__,
                mode="marathon")
        elif re.search("Add Words",__mode__) is not None:
            dictionary_of_work.add_word()
        elif re.search("Delete Words",__mode__) is not None:
            dictionary_of_work.del_word()
        elif re.search("Modify Words",__mode__) is not None:
            dictionary_of_work.modify_word()
        elif re.search("Modify Configuration",__mode__) is not None:
            config_dict=easygui.multenterbox(msg='Configuation', title='Configuration Box', 
            fields=('Number of word by interogation',"Number of day in advance"), values=(str(__number_of_word_to_learn_by_serie__),str(__day_in_advance__)))
            if not config_dict==None:
                __number_of_word_to_learn_by_serie__=int(config_dict[0])

                __day_in_advance__=int(config_dict[1])
                
        elif re.search("Get Statistic",__mode__) is not None:
            dictionary_of_work.stat_display()
        elif re.search("Create a Dictionary",__mode__) is not None:
            old_dictionary_file_path=copy.copy(dictionary_file_path)
            dictionary_file_path=easygui.filesavebox(default="dictionary_name.csv")
            if not dictionary_file_path==None:
                dictionary_of_work=dictionary.dictionary()
                dictionary_of_work.save(dictionary_file_path)
            else:
                dictionary_file_path=old_dictionary_file_path