FlatCAMShell.py 715 B

12345678910111213141516171819202122232425
  1. import termwidget
  2. class FCShell(termwidget.TermWidget):
  3. def __init__(self, sysShell, *args):
  4. termwidget.TermWidget.__init__(self, *args)
  5. self._sysShell = sysShell
  6. def is_command_complete(self, text):
  7. def skipQuotes(text):
  8. quote = text[0]
  9. text = text[1:]
  10. endIndex = str(text).index(quote)
  11. return text[endIndex:]
  12. while text:
  13. if text[0] in ('"', "'"):
  14. try:
  15. text = skipQuotes(text)
  16. except ValueError:
  17. return False
  18. text = text[1:]
  19. return True
  20. def child_exec_command(self, text):
  21. self._sysShell.exec_command(text)