Skip to content

Commit

Permalink
wxGUI tplot: fix an error when exporting csv file from g.gui.tplot (#690
Browse files Browse the repository at this point in the history
)
  • Loading branch information
lbartoletti committed Jun 13, 2020
1 parent 884f986 commit 0bc5ac3
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions gui/wxpython/tplot/frame.py
Expand Up @@ -272,7 +272,7 @@ def _layout(self):
self.controlPanelSizerVector.Fit(self)
self.ntb.AddPage(page=self.controlPanelVector, text=_('STVDS'),
name='STVDS')

# ------------ITEMS IN NOTEBOOK PAGE (LABELS)------------------------
self.controlPanelLabels = wx.Panel(parent=self.ntb, id=wx.ID_ANY)
self.titleLabel = StaticText(parent=self.controlPanelLabels,
Expand Down Expand Up @@ -651,14 +651,14 @@ def _writeCSV(self, x, y):
zipped = list(zip(x, *y))
else:
zipped = list(zip(x, y))
with open(self.csvpath, "wb") as fi:
with open(self.csvpath, "w", newline='') as fi:
writer = csv.writer(fi)
if self.header:
head = ["Time"]
head.extend(self.yticksNames)
writer.writerow(head)
writer.writerows(zipped)

def drawR(self):
ycsv = []
xcsv = []
Expand Down Expand Up @@ -799,7 +799,7 @@ def OnRedraw(self, event=None):
if (os.path.exists(self.csvpath) and not self.overwrite):
dlg = wx.MessageDialog(self, _("{pa} already exists, do you want "
"to overwrite?".format(pa=self.csvpath)),
_("File exists"),
_("File exists"),
wx.OK | wx.CANCEL | wx.ICON_QUESTION)
if dlg.ShowModal() != wx.ID_OK:
dlg.Destroy()
Expand Down

0 comments on commit 0bc5ac3

Please sign in to comment.