Source code for pymt.events.printer

from ..portprinter.port_printer import PortPrinter
from ..utils import as_cwd


[docs]class PrintEvent: def __init__(self, *args, **kwds): # self._printer = PortPrinter.from_dict(kwds) self._run_dir = kwds.pop("run_dir", ".") self._kwds = kwds
[docs] def initialize(self, *args): with as_cwd(self._run_dir): self._printer = PortPrinter.from_dict(self._kwds) self._printer.open()
[docs] def run(self, time): with as_cwd(self._run_dir): self._printer.write()
[docs] def finalize(self): with as_cwd(self._run_dir): self._printer.close()