Skip to content

Commit

Permalink
Arch: alternate export method for schedules
Browse files Browse the repository at this point in the history
  • Loading branch information
yorikvanhavre committed Oct 15, 2016
1 parent a68364e commit 8c59d59
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions src/Mod/Arch/ArchSchedule.py
Expand Up @@ -322,9 +322,23 @@ def importCSV(self):

def exportCSV(self):
if self.obj:
filename = QtGui.QFileDialog.getSaveFileName(QtGui.qApp.activeWindow(), translate("Arch","Export CSV File"), None, "CSV file (*.csv)");
if filename:
self.obj.Result.exportFile(str(filename[0].encode("utf8")))
if self.obj.Result:
filename = QtGui.QFileDialog.getSaveFileName(QtGui.qApp.activeWindow(), translate("Arch","Export CSV File"), None, "CSV file (*.csv)");
if filename:
# the following line crashes, couldn't fnid out why
# self.obj.Result.exportFile(str(filename[0].encode("utf8")))
import csv
if not("Up-to-date" in self.obj.State):
self.obj.Proxy.execute(self.obj)
numrows = len(self.obj.Description)+1
with open(filename[0].encode("utf8"), 'wb') as csvfile:
csvfile = csv.writer(csvfile,delimiter="\t")
for i in range(numrows):
r = []
for j in ["A","B","C"]:
r.append(self.obj.Result.getContents(j+str(i+1)))
csvfile.writerow(r)
print "successfully exported ",filename[0]

def select(self):
if self.form.list.currentRow() >= 0:
Expand Down

0 comments on commit 8c59d59

Please sign in to comment.