Skip to content

Commit

Permalink
Merging remote changes
Browse files Browse the repository at this point in the history
  • Loading branch information
andim committed Apr 2, 2018
2 parents cdb6c5b + 0dadbe5 commit 22bf0fa
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions source/easyleed/gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -1294,7 +1294,15 @@ def saveCenter(self):
"Save the center location to a file",
filename))
if filename:
self.worker.saveCenter(filename)
if hasattr(self, "worker"):
self.worker.saveCenter(filename)
else:
import csv
center = [["Energy","Center x","Center y"],
[self.current_energy, self.scene.center.x(), self.scene.center.y()]]
with open(filename, "w") as f:
writer = csv.writer(f, delimiter=',', lineterminator='\n')
writer.writerows(center)

def loadCenter(self):
"""Load Center location from csv file"""
Expand Down Expand Up @@ -1440,7 +1448,6 @@ def saveCenter(self, filename):
"""save center location"""
spots = self.parent().scene.spots
centerCols = ['Energy']
for s in range(len(spots)):
centerCols.extend(['Center x', 'Center y'])
centerCols.extend(['Center x', 'Center y'])
self.pdframe[centerCols].to_csv(filename, sep=',', index=False)

0 comments on commit 22bf0fa

Please sign in to comment.