Hi all,
Im writing a little python program that goes through an XML file and does some replacement of tags. It takes three arguments, a path from whcih it creates a directory tree, the XML file its reading and the xml file its outputting to. It works fine from the command line just passing in arguments. As its not just for me, i thought id put a Qt front on it. Below is the majority of the Qt front. MOVtoMXF is the class that does all the replacement. So you can see that im basically just grabbing strings and feeding them into the class that ive already made and tested.
class Form(QDialog):
def ConnectButtons(self):
self.connect(self.pathBrowseB, SIGNAL("clicked()"), self.pathFileBrowse)
self.connect(self.xmlFileBrowseB, SIGNAL("clicked()"), self.xmlFileBrowse)
self.connect(self.outputFileBrowseB, SIGNAL("clicked()"), self.outputFileBrowse)
def accept(self):
path = self.pathBox.displayText()
xmlFile = self.xmlFileBox.displayText()
outFileName = self.outfileNameBox.displayText()
print path + " " + xmlFile + " " + outFileName
mov1 = MOVtoMXF.MOVtoMXF(path, xmlFile, outFileName)
mov1.ScanFile()
self.done()
def pathFileBrowse(self):
file = str(QFileDialog.getExistingDirectory(self, "Select Directory"))
self.pathBox.setText(file)
def xmlFileBrowse(self):
file = str(QFileDialog.getOpenFileName(self, "Save File"))
self.xmlFileBox.setText(file)
def outputFileBrowse(self):
file = str(QFileDialog.getSaveFileName(self, "Save File"))
self.outfileNameBox.setText(file)
the probelm is that when i feed in a Path, it now comes back with an error, either the directory doesnt exist, or if I have a trailing slash on the end that
File "/System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/posixpath.py", line 62, in join elif path == '' or path.endswith('/'):
I think its probably some mismatch between the QFileDialog, the QString its passing back and the string the my python expects. but im not sure how to go about fixing it.
Im running on Max OS X 10.5.6 pyQt 4.4.4 QT 4.4.0
thanks for any help you can give.
Mark