示例#1
0
 def open(self, file_path=None):
     try:
         if file_path is None or file_path is False:
             file_path = File.showOpenFileDialog()
         if file_path != "":
             self.documents_controller.openDocument(file_path)
     except Exception as e:
         Dialogs.showError(e)
示例#2
0
	def open(self, file_path=None):
		try:
			if file_path is None:
				file_path = File.showOpenFileDialog()
			if file_path != "":
				self.documents_controller.openDocument(file_path)
		except Exception, e:
			Dialogs.showError(e)
示例#3
0
	def title(self):
		"""
		The title of a document is the file name of the document or
		"Untitled [ID]" if the document is untitled.
		"""
		if self.isUntitled():
			title = "Untitled %d" % self.id
		else:
			title = File.getFileNameFromFilePath(self.file_path)
		return title
示例#4
0
    def title(self):
        """
		The title of a document is the file name of the document or
		"Untitled [ID]" if the document is untitled.
		"""
        if self.isUntitled():
            title = "Untitled %d" % self.id
        else:
            title = File.getFileNameFromFilePath(self.file_path)
        return title
示例#5
0
	def open(self):
		"""
		To open the document, we read the content from the file path and un-
		dirty the document.
		"""
		try:
			if File.exists(self.file_path):
				(self.preamble, self.source) = documentIO.readPreambleAndSourceFromFilePath(self.file_path)
			self.dirty = False
		except Exception as e:
			raise DocumentError("The document cannot be opened: %s" % str(e))
示例#6
0
    def open(self):
        """
		To open the document, we read the content from the file path and un-
		dirty the document.
		"""
        try:
            if File.exists(self.file_path):
                (self.preamble,
                 self.source) = documentIO.readPreambleAndSourceFromFilePath(
                     self.file_path)
            self.dirty = False
        except Exception as e:
            raise DocumentError("The document cannot be opened: %s" % str(e))
示例#7
0
 def _readFileLines(self):
     content = File.readContentFromFilePath(self.file_path)
     self.file_lines = content.split("\n")
示例#8
0
 def _checkFileExists(self):
     if not File.exists(self.file_path):
         raise DocumentReaderError("The file does not exist")
示例#9
0
 def _writeSourceCodeToFile(self):
     File.writeContentToFilePath(self.latex_source, self.source_file_path)
示例#10
0
def writeDocumentToFilePath(template, document, file_path):
    content = buildFileContentFromDocument(template, document)
    File.writeContentToFilePath(content, file_path)
示例#11
0
 def saveAs(self):
     file_path = File.showSaveFileDialog(self.view, self._getDocumentFileName())
     if file_path:
         self.model.file_path = file_path
         self.model.save()
示例#12
0
	def initController(self):
		self.view.setImage(":/icon_about.png")
		self.view.setInfoHTML(File.readContentFromFilePath(":/about.html"))
示例#13
0
	def initController(self):
		self.view.setImage(":/icon_about.png")
		self.view.setInfoHTML(File.readContentFromFilePath(":/about.html"))
示例#14
0
	def _readFileLines(self):
		content = File.readContentFromFilePath(self.file_path)
		self.file_lines = content.split("\n")
示例#15
0
	def _checkFileExists(self):
		if not File.exists(self.file_path):
			raise DocumentReaderError("The file does not exist")
示例#16
0
 def saveAs(self):
     file_path = File.showSaveFileDialog(self.view,
                                         self._getDocumentFileName())
     if file_path:
         self.model.file_path = file_path
         self.model.save()
示例#17
0
def writeDocumentToFilePath(template, document, file_path):
	content = buildFileContentFromDocument(template, document)
	File.writeContentToFilePath(content, file_path)
示例#18
0
	def _writeSourceCodeToFile(self):
		File.writeContentToFilePath(self.latex_source, self.source_file_path)