import pprint
 
import xml.dom.minidom
from xml.dom.minidom import Node
 
def moveParticles(src, dest):
    doc = xml.dom.minidom.parse(src)
     
    offsets = {
        #'posX' : -213,
        #'posY' : 98,
        'posX' : 695 - 502,
        'posY' : 352 - 240,
    }

    for node in doc.getElementsByTagName("ParticleSystem")[0].getElementsByTagName("ParticleEmitter"):
        vis_params = node.getElementsByTagName("VisualParams")[0]
        for key, value in offsets.items():
            vis_params.setAttribute(key, str(float(vis_params.getAttribute(key)) + value))
        #vis_params.setAttribute("posX", float(vis_params.getAttribute("posX")) + offset_x)
        #print vis_params.getAttribute("posX")

    doc.writexml(open(dest, 'w'))

moveParticles('_svech.ps', 'svech.ps')
print 'ok'