FlatCAMShell.py 763 B

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