Esempio n. 1
0
 def _parseMultipleShortFiles(self):
     '''Deprecated: it is done on the selection step'''
     failed = 0
     succeed = 0
     if len(self._filenames) < 1:
         logger.info("Please, select files before parsing")
         return
     for filename in self._filenames:
         logger.info("Parsing file " + filename.split('/')[-1] +
                     " from TeX")
         try:
             self._writeups.append(ShortWriteUp.parseFromTex(filename))
             succeed += 1
             logger.info(self._writeups[-1])
             logger.info("Parsing done...")
         except Exception as ex:
             failed += 1
             logger.debug(str(ex))
             logger.info(
                 "Error in parsing the document. Please, select a file with the correct latex structure"
             )
             #TODO the error chain for getting a message to the user
     logger.info("For " + str(len(self._filenames)) +
                 " documents:\nFailed: " + str(failed) + "\nSucceed: " +
                 str(succeed))
Esempio n. 2
0
 def _loadDirectoryMultipleShort(self):
     directory = QtGui.QFileDialog.getExistingDirectory()
     logger.debug(directory)
     self._filenames = [directory + "/" + f for f in listdir(directory)]
     self.ui.loadededFilesShortTextEdit.clear()
     if len(self._filenames) < 1:
         logger.info("Please, select files before parsing")
         return
     failed = 0
     succeed = 0
     for filename in self._filenames:
         logger.info("Parsing file " + filename.split('/')[-1] +
                     " from TeX")
         try:
             self._writeups.append(ShortWriteUp.parseFromTex(filename))
             self.ui.loadededFilesShortTextEdit.insertPlainText(
                 filename.split('/')[-1] + "\n")
             succeed += 1
             logger.info(self._writeups[-1])
             logger.info("Parsing done...")
         except Exception as ex:
             failed += 1
             logger.debug(str(ex))
             logger.info(
                 "Error in parsing the document. Please, select a file with the correct latex structure"
             )
             #TODO the error chain for getting a message to the user
     logger.info("For " + str(len(self._filenames)) +
                 " documents:\nFailed: " + str(failed) + "\nSucceed: " +
                 str(succeed))
 def _parseSingleShortFile(self):
     '''Deprecated: it is done on the selection step'''
     filename = self.ui.texShortTb.toPlainText()
     logger.info("Parsing file " + filename.split('/')[-1] + " from TeX")
     try:
         writeup = ShortWriteUp.parseFromTex(filename)
         self.setWriteUp(writeup)
         logger.info("Parsing done...")
     except Exception as ex:
         logger.info("Error in parsing the document. Please, select a file with the correct latex structure")
         logger.debug(str(ex))
Esempio n. 4
0
 def _parseSingleShortFile(self):
     '''Deprecated: it is done on the selection step'''
     filename = self.ui.texShortTb.toPlainText()
     logger.info("Parsing file " + filename.split('/')[-1] + " from TeX")
     try:
         writeup = ShortWriteUp.parseFromTex(filename)
         self.setWriteUp(writeup)
         logger.info("Parsing done...")
     except Exception as ex:
         logger.info(
             "Error in parsing the document. Please, select a file with the correct latex structure"
         )
         logger.debug(str(ex))
 def _selectSingleShortFile(self):
     #TODO: I have to filter only .tex files
     filename = QtGui.QFileDialog.getOpenFileName(filter="LaTeX (*.tex)")
     logger.info("Parsing file: " + filename)
     try:
         writeup = ShortWriteUp.parseFromTex(filename)
         self.setWriteUp(writeup)
         logger.info(writeup)
         logger.info("Parsing done...")
         self.ui.texShortTb.setText(filename)
     except Exception as ex:
         logger.info("Error in parsing the document. Please, select a file with the correct latex structure")
         logger.debug(str(ex))
Esempio n. 6
0
 def _selectSingleShortFile(self):
     #TODO: I have to filter only .tex files
     filename = QtGui.QFileDialog.getOpenFileName(filter="LaTeX (*.tex)")
     logger.info("Parsing file: " + filename)
     try:
         writeup = ShortWriteUp.parseFromTex(filename)
         self.setWriteUp(writeup)
         logger.info(writeup)
         logger.info("Parsing done...")
         self.ui.texShortTb.setText(filename)
     except Exception as ex:
         logger.info(
             "Error in parsing the document. Please, select a file with the correct latex structure"
         )
         logger.debug(str(ex))
 def _parseMultipleShortFiles(self):
     '''Deprecated: it is done on the selection step'''
     failed = 0
     succeed = 0
     if len(self._filenames) < 1:
         logger.info("Please, select files before parsing")
         return
     for filename in self._filenames:
         logger.info("Parsing file " + filename.split('/')[-1] + " from TeX")
         try:
             self._writeups.append(ShortWriteUp.parseFromTex(filename))
             succeed += 1
             logger.info(self._writeups[-1])
             logger.info("Parsing done...")
         except Exception as ex:
             failed += 1
             logger.debug(str(ex))
             logger.info("Error in parsing the document. Please, select a file with the correct latex structure")
             #TODO the error chain for getting a message to the user
     logger.info("For " + str(len(self._filenames)) + " documents:\nFailed: " + str(failed) + "\nSucceed: " + str(succeed))
 def _loadDirectoryMultipleShort(self):
     directory = QtGui.QFileDialog.getExistingDirectory()
     logger.debug(directory)
     self._filenames = [directory+"/"+f for f in listdir(directory)]
     self.ui.loadededFilesShortTextEdit.clear()
     if len(self._filenames) < 1:
         logger.info("Please, select files before parsing")
         return
     failed = 0
     succeed = 0
     for filename in self._filenames:
         logger.info("Parsing file " + filename.split('/')[-1] + " from TeX")
         try:
             self._writeups.append(ShortWriteUp.parseFromTex(filename))
             self.ui.loadededFilesShortTextEdit.insertPlainText(filename.split('/')[-1]+"\n")
             succeed += 1
             logger.info(self._writeups[-1])
             logger.info("Parsing done...")
         except Exception as ex:
             failed += 1
             logger.debug(str(ex))
             logger.info("Error in parsing the document. Please, select a file with the correct latex structure")
             #TODO the error chain for getting a message to the user
     logger.info("For " + str(len(self._filenames)) + " documents:\nFailed: " + str(failed) + "\nSucceed: " + str(succeed))