Beispiel #1
0
class SaveCommand(Command):
	""" Save the file for all the objects in the scene. """		
	def __init__(self, mainWindow):
		Command.__init__(self)
		self.mainWindow = mainWindow
		self.prototypeManager = PrototypeManager()
		
	def execute(self, filename):
		doc = QtXml.QDomDocument( "Geometric Constraints" )
		root = doc.createElement( "Objects" )
		doc.appendChild( root );

		for prtObject in self.prototypeManager.prtObjects:
			if not prtObject.ghost:
				root.appendChild(prtObject.save(doc))
		root.appendChild(self.prototypeManager.save(doc))
		
		file = QtCore.QFile(filename)
		if file.open(QtCore.QIODevice.WriteOnly): 
			ts = QtCore.QTextStream(file)
			ts << doc.toString()
			file.close()
Beispiel #2
0
class SaveCommand(Command):
    """ Save the file for all the objects in the scene. """
    def __init__(self, mainWindow):
        Command.__init__(self)
        self.mainWindow = mainWindow
        self.prototypeManager = PrototypeManager()

    def execute(self, filename):
        doc = QtXml.QDomDocument("Geometric Constraints")
        root = doc.createElement("Objects")
        doc.appendChild(root)

        for prtObject in self.prototypeManager.prtObjects:
            if not prtObject.ghost:
                root.appendChild(prtObject.save(doc))
        root.appendChild(self.prototypeManager.save(doc))

        file = QtCore.QFile(filename)
        if file.open(QtCore.QIODevice.WriteOnly):
            ts = QtCore.QTextStream(file)
            ts << doc.toString()
            file.close()