Exemple #1
0
	def load(self):
		ret=inp_get_token_array(self.file_name, self.token)
		if ret!=False:									#We have found the file and got the token
			self.ui.text.setText("\n".join(ret))
		else:	
			self.ui.text.setText(_("New file"))

			if inp_check_ver(self.file_name, "1.0")==True:	#The file exists but there is no token.
				lines=[]
				inp_load_file(lines,self.file_name)
				lines=inp_add_token(lines,self.token,self.ui.text.toPlainText())
				print("written to 1",self.file_name)
				inp_save_lines(self.file_name,lines)
			else:											#The file does not exist or there is an error
				lines=inp_new_file()
				lines=inp_add_token(lines,self.token,self.ui.text.toPlainText())
				print("written to 2",self.file_name,lines)
				inp_save_lines(self.file_name,lines)
Exemple #2
0
    def load(self):
        ret = inp_get_token_array(self.file_name, self.token)
        if ret != False:  #We have found the file and got the token
            self.ui.text.setText("\n".join(ret))
        else:
            self.ui.text.setText(_("New file"))

            if inp_check_ver(
                    self.file_name,
                    "1.0") == True:  #The file exists but there is no token.
                lines = []
                lines = inp_load_file(self.file_name)
                lines = inp_add_token(lines, self.token,
                                      self.ui.text.toPlainText())
                print("written to 1", self.file_name)
                inp_save_lines_to_file(self.file_name, lines)
            else:  #The file does not exist or there is an error
                lines = inp_new_file()
                lines = inp_add_token(lines, self.token,
                                      self.ui.text.toPlainText())
                print("written to 2", self.file_name, lines)
                inp_save_lines_to_file(self.file_name, lines)
Exemple #3
0
    def gen_file(self):
        make_new = True
        lines = inp_load_file(self.file_name)
        if lines != False:
            if inp_check_ver(self.file_name, "1.0") == True:
                make_new = False

        if make_new == True:
            lines = []
            lines.append("#ref_website")
            lines.append("")
            lines.append("#ref_research_group")
            lines.append("")
            lines.append("#ref_authors")
            lines.append("")
            lines.append("#ref_jounral")
            lines.append("")
            lines.append("#ref_title")
            lines.append("")
            lines.append("#ref_volume")
            lines.append("")
            lines.append("#ref_pages")
            lines.append("")
            lines.append("#ref_year")
            lines.append("")
            lines.append("#ref_md5")
            lines.append("")
            lines.append("#ref_doi")
            lines.append("")
            lines.append("#ref_unformatted")
            lines.append("")
            lines.append("#ver")
            lines.append("1.0")
            lines.append("#end")

            inp_save_lines_to_file(self.file_name, lines)