def checkFile(queue, code, filePath, fileEncoding): tmp = os.path.join(constants.getAppTempDirectory(), QFileInfo(filePath).fileName()) if os.path.isdir(tmp): return with open(tmp, "wb") as f: if sys.version_info[0] == 3: code = bytes(code, fileEncoding) else: code = code.encode(fileEncoding) f.write(code) fileType = detect_file_type(tmp) output = os.path.join(constants.getAppTempDirectory(), QFileInfo(tmp).baseName() + fileType[2]) status, messages = compiler.compile(tmp, fileType, outputFilename=output) queue.put(messages)
def openFile(self, filePath, replaceTabsBySpaces=True, encoding=None, detectEncoding=False): pyqode.core.QCodeEdit.openFile(self, filePath, replaceTabsBySpaces, encoding, detectEncoding) self.__fileType = detect_file_type(filePath)