MCPcopy Create free account
hub / github.com/pyqtgraph/pyqtgraph / loadFile

Method loadFile

pyqtgraph/examples/ExampleApp.py:524–541  ·  view source on GitHub ↗
(self, *, edited=False)

Source from the content-addressed store, hash-verified

522 return None
523
524 def loadFile(self, *, edited=False):
525 # make *edited* keyword-only so it is not confused for extra arguments
526 # sent by ui signals
527 qtLib = self.ui.qtLibCombo.currentText()
528 env = dict(os.environ, PYQTGRAPH_QT_LIB=qtLib)
529 example_path = os.path.abspath(os.path.dirname(__file__))
530 path = os.path.dirname(os.path.dirname(example_path))
531 env['PYTHONPATH'] = f'{path}'
532 if edited:
533 proc = subprocess.Popen([sys.executable, '-'], stdin=subprocess.PIPE, cwd=example_path, env=env)
534 code = self.ui.codeView.toPlainText().encode('UTF-8')
535 proc.stdin.write(code)
536 proc.stdin.close()
537 else:
538 fn = self.currentFile()
539 if fn is None:
540 return
541 subprocess.Popen([sys.executable, fn], cwd=path, env=env)
542
543 def showFile(self):
544 fn = self.currentFile()

Callers 1

runEditedCodeMethod · 0.95

Calls 4

currentFileMethod · 0.95
toPlainTextMethod · 0.80
writeMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected