示例#1
0
 def deleteDocument(self, docmodel = None):
     """
     Delete the source document from the central repository.
     """
     if not docmodel is None:
         #Build the path from the model variable values.
         fileName, fileExt = guess_extension(docmodel.file_name)
     
         #Qt always expects the file separator be be "/" regardless of platform.
         absPath = self.networkPath + "/" + "%d"%(docmodel.doc_type) + "/" +\
                   docmodel.doc_identifier + fileExt
         
         return QFile.remove(absPath)
     
     else:
         return QFile.remove(self.destinationPath)
示例#2
0
    def absolute_document_path(self, document_widget):
        """
        Build the absolute document path using info from the document widget.
        :param document_widget: Instance of document widget.
        :return: Absolute path of the supporting document.
        :rtype: str
        """
        abs_path = ""

        file_manager = document_widget.fileManager
        if not file_manager is None:
            network_repository = file_manager.networkPath
            file_id = document_widget.file_identifier()
            doc_type = document_widget.documentType()
            file_name, file_extension = guess_extension(document_widget.displayName())

            abs_path = network_repository + "/" + doc_type + "/" + file_id + file_extension

        return abs_path