Example #1
0
 def importList(self):
     filename = tkFileDialog.askopenfilename(filetypes = (("Tldr Files", "*.tldr"),))
     if str(filename) == "":
         return
     tldr_parse = TldrParser(filename)
     list_name = filename[:-5].split('/')[-1]
     if self.db.importList(list_name, tldr_parse.getWordList(), tldr_parse.getSource(), tldr_parse.getDateEdited(), tldr_parse.getListSize()):
         self.lists_list_pane.insert(list_name)
     else:
         print "List with that name already exists!!!"
     self.db.commit()
Example #2
0
 def exportList(self):
     filename = tkFileDialog.asksaveasfilename(filetypes = (("Tldr Files", "*.tldr"),), initialfile = self.lists_list_pane.get())
     if str(filename) == "":
         return
     export_list = self.db.getList(self.lists_list_pane.get())[0]
     word_list = self.db.getWords(self.lists_list_pane.get())
     word_dict = {}
     for word in word_list:
         word = word[0]
         word_record = self.db.getWord(word)[0]
         word_dict[word] = [word_record[2],word_record[3],word_record[4]]
     tldr_parse = TldrParser()
     tldr_parse.setWordList(word_dict)
     tldr_parse.setSource(export_list[2])
     tldr_parse.setDateEdited(str(date.today()))
     tldr_parse.setListSize(export_list[4])
     tldr_parse.writetldr(filename)