| | 1057 | self.startCommandLine(cmd) |
| | 1058 | |
| | 1059 | def expandCommandLine(self, cmd): |
| | 1060 | """Expand the command line to include the filename of the buffer""" |
| | 1061 | if '%' in cmd: |
| | 1062 | cmd = cmd % self.buffer.getFilename() |
| | 1063 | else: |
| | 1064 | cmd = "%s %s" % (cmd, self.buffer.getFilename()) |
| | 1065 | return cmd |
| | 1066 | |
| | 1067 | def startCommandLine(self, cmd): |
| | 1068 | """Attempt to create a process using the command line""" |
| | 1069 | if hasattr(self, 'process'): |
| | 1070 | self.frame.setStatusText("Already running a process.") |
| | 1071 | else: |
| | 1072 | if self.buffer.readonly or not self.classprefs.autosave_before_run: |
| | 1073 | msg = "You must save this file to the local filesystem\nbefore you can run it through the interpreter." |
| | 1074 | dlg = wx.MessageDialog(wx.GetApp().GetTopWindow(), msg, "Save the file!", wx.OK | wx.ICON_ERROR ) |
| | 1075 | retval=dlg.ShowModal() |
| | 1076 | return |
| | 1077 | else: |
| | 1078 | self.save() |
| | 1079 | |
| | 1080 | cmd = self.expandCommandLine(cmd) |