def __init__(self, file_path=None): super(DocumentModel, self).__init__() self.id = self._createDocumentId() self._preamble = Preferences.getPreambleTemplate() self._source = DocumentModel.DEFAULT_SOURCE self._dirty = False self._file_path = file_path
def save(self): """ To save the document, we write the content to the file path and un- dirty the document. """ try: template = Preferences.getLatexFileTemplate() documentIO.writeDocumentToFilePath(template, self, self.file_path) self.dirty = False except Exception, e: raise DocumentError("The document cannot be saved: %s" % unicode(e))
def isEmpty(self): return self.preamble == Preferences.getPreambleTemplate() and self.source == DocumentModel.DEFAULT_SOURCE
def isEmpty(self): return (self.preamble == Preferences.getPreambleTemplate() and self.source == DocumentModel.DEFAULT_SOURCE)