def onSaveAs(self, event): """ Respond to the "Save As" menu command. @type event: wx.Event @param event: Event associated with this function. """ fileDialog = wx.FileDialog(self._view, defaultDir=self._view.filePath, defaultFile=self._view.fileName + '.cw', wildcard='Cabel Workspace Files (*.cw)|*.cw', style=wx.SAVE|wx.OVERWRITE_PROMPT) if fileDialog.ShowModal() == wx.ID_OK: fileLocation = fileDialog.GetPath() generator = XmlGenerator(fileLocation) erg = generator.writeWorkspace(self._view) if erg[0]: self._saved = True self._pushToRecentFiles(fileLocation) else: d = wx.MessageDialog(self._view, "Error while writing File " + fileLocation + ".\n\nException text:\n" + str(erg[1]), "Writing Error", wx.OK | wx.ICON_ERROR) d.ShowModal() d.Destroy() fileDialog.Destroy()
def onSaveAs(self, event): """ Respond to the "Save As" menu command. @type event: wx.Event @param event: Event associated with this function. """ fileDialog = wx.FileDialog( self._view, defaultDir=self._view.filePath, defaultFile=self._view.fileName + '.cw', wildcard='Cabel Workspace Files (*.cw)|*.cw', style=wx.SAVE | wx.OVERWRITE_PROMPT) if fileDialog.ShowModal() == wx.ID_OK: fileLocation = fileDialog.GetPath() generator = XmlGenerator(fileLocation) erg = generator.writeWorkspace(self._view) if erg[0]: self._saved = True self._pushToRecentFiles(fileLocation) else: d = wx.MessageDialog( self._view, "Error while writing File " + fileLocation + ".\n\nException text:\n" + str(erg[1]), "Writing Error", wx.OK | wx.ICON_ERROR) d.ShowModal() d.Destroy() fileDialog.Destroy()
def onSave(self, event): """ Respond to the "Save" menu command. @type event: wx.Event @param event: Event associated with this function. """ if self._view.fileName == '': self.onSaveAs(event) else: fileLocation = os.path.join(self._view.filePath, self._view.fileName + '.cw') generator = XmlGenerator(fileLocation) erg = generator.writeWorkspace(self._view) self._saved = erg[0] if not self._saved: d = wx.MessageDialog(self._view, "Error while writing File " + fileLocation + ".\n\nException text:\n" + str(erg[1]), "Writing Error", wx.OK | wx.ICON_ERROR) d.ShowModal() d.Destroy()
def onSave(self, event): """ Respond to the "Save" menu command. @type event: wx.Event @param event: Event associated with this function. """ if self._view.fileName == '': self.onSaveAs(event) else: fileLocation = os.path.join(self._view.filePath, self._view.fileName + '.cw') generator = XmlGenerator(fileLocation) erg = generator.writeWorkspace(self._view) self._saved = erg[0] if not self._saved: d = wx.MessageDialog( self._view, "Error while writing File " + fileLocation + ".\n\nException text:\n" + str(erg[1]), "Writing Error", wx.OK | wx.ICON_ERROR) d.ShowModal() d.Destroy()