class LatexManager(): ''' A class to control the LatexFramework ''' def __init__(self, project_name='main', tex_file=''): self.errors = [] self.messages = [] self.Latex = LatexFramework(project_name) self.tex = tex_file self.name = str(project_name) def createProject(self): ''' Create a new Project ''' self.Latex.createProject() def listProjects(self): ''' List all available projects ''' self.Latex.listFiles(PROJECT_DIR) project_list = self.Latex.readFile('ls.txt', LOG_DIR) return project_list def listPackages(self): ''' Lists all available LaTeX classes for this project. ''' self.Latex.listFiles(PCKG_DIR) pkg_list = self.Latex.readFile('ls.txt', LOG_DIR) return pkg_list def listImages(self): ''' Lists all images available for that project. ''' self.Latex.listFiles(PROJECT_DIR + self.name + '/images') img_list = self.Latex.readFile('ls.txt', LOG_DIR) return img_list def compileProject(self): ''' Compiles the PDF of the project. ''' self.Latex.LatexToPDF(self.tex) def addPackage(self, package): ''' Adds a specified LaTeX class to the project. ''' self.Latex.copyFile(package, PROJECT_DIR + self.name + '/packages') def addImage(self, image): ''' Adds a specified image to the project. ''' self.Latex.copyFile(image, PROJECT_DIR + self.name + '/images') def readTex(self): ''' Reads a specified file. ''' tex_info = self.Latex.readFile(self.tex, PROJECT_DIR + self.name + '/tex') return tex_info def saveFile(self, file, new_file): ''' Takes information and saves it to the file, backing up the old one. ''' self.Latex.saveFile(file, new_file, PROJECT_DIR + self.name + '/tex')