#
table = self.the_material_view.the_model
row = table.item
input_1 = table.item(row,0).text().strip()
input_2 = table.item(row,1).text().strip()
input_3 = table.item(row,2).text().strip()
filename
= QFileDialog.
getSaveFileName(self, self.
tr('Save File'),
os.getcwd(), self.tr("xml files (*.xml);; All files(.txt)"))
file = open(filename[0],"w")
file.write('<name>{name}</name>\n'.format(name=input_1))
file.write('<material_type>{material_type}</material_type>\n'.format(material_type=input_2))
file.write('<density>{density}</density>\n'.format(density=input_3))
for row in range(3):
for column in range(3):
if table.cellWidget(row, column) == True:
file.write('<c{row}{col}>{data}</c{row}{col}>\n'.format(row=row + 1, col=column + 1,
data=table.item(row, column).text().strip()) + "\n")
#
table = self.the_material_view.the_model
row = table.item
input_1 = table.item(row,0).text().strip()
input_2 = table.item(row,1).text().strip()
input_3 = table.item(row,2).text().strip()
filename = QFileDialog.getSaveFileName(self, self.tr('Save File'),
os.getcwd(), self.tr("xml files (*.xml);; All files(.txt)"))
file = open(filename[0],"w")
file.write('<name>{name}</name>\n'.format(name=input_1))
file.write('<material_type>{material_type}</material_type>\n'.format(material_type=input_2))
file.write('<density>{density}</density>\n'.format(density=input_3))
for row in range(3):
for column in range(3):
if table.cellWidget(row, column) == True:
file.write('<c{row}{col}>{data}</c{row}{col}>\n'.format(row=row + 1, col=column + 1,
data=table.item(row, column).text().strip()) + "\n")
To copy to clipboard, switch view to plain text mode
Bookmarks