Take a command and stick it at the end of the buffer (with python prompts inserted if required).
(self,bufLines, oldPrompt = None)
| 326 | line = line[:-1] |
| 327 | return line |
| 328 | def AppendToPrompt(self,bufLines, oldPrompt = None): |
| 329 | " Take a command and stick it at the end of the buffer (with python prompts inserted if required)." |
| 330 | self.flush() |
| 331 | lastLineNo = self.GetLineCount()-1 |
| 332 | line = self.DoGetLine(lastLineNo) |
| 333 | if oldPrompt and line==oldPrompt: |
| 334 | self.SetSel(self.GetTextLength()-len(oldPrompt), self.GetTextLength()) |
| 335 | self.ReplaceSel(sys.ps1) |
| 336 | elif (line!=str(sys.ps1)): |
| 337 | if len(line)!=0: self.write('\n') |
| 338 | self.write(sys.ps1) |
| 339 | self.flush() |
| 340 | self.idle.text.mark_set("iomark", "end-1c") |
| 341 | if not bufLines: |
| 342 | return |
| 343 | terms = (["\n" + sys.ps2] * (len(bufLines)-1)) + [''] |
| 344 | for bufLine, term in zip(bufLines, terms): |
| 345 | if bufLine.strip(): |
| 346 | self.write( bufLine + term ) |
| 347 | self.flush() |
| 348 | |
| 349 | def EnsureNoPrompt(self): |
| 350 | # Get ready to write some text NOT at a Python prompt. |
no test coverage detected