Ben1152000 / sootty

A command-line tool for displaying vcd waveforms.
BSD 3-Clause "New" or "Revised" License
44 stars 12 forks source link

Feature/option storage #17

Closed Ben1152000 closed 2 years ago

Ben1152000 commented 2 years ago

This PR includes a significant refactor of the code-base up to this point, moving functionality around, adding test cases, and introducing a Style class. This class keeps track of the styling options used by the Visualizer, and can be easily extended to create custom styles. Here is the new way to use sootty from the REPL:

from sootty import WireTrace, Visualizer, Style

# Create wiretrace object from vcd file:
wiretrace = WireTrace.from_vcd_file("example/example1.vcd")

# Convert wiretrace to svg:
image = Visualizer(Style.Dark).to_svg(wiretrace, start=0, length=8)

# Display to stdout:
image.display()

The limit expressions might also be stored somehow, but they would anyway have to be recomputed for the new wiretrace. I'm not sure if this fully closes #11, input would be appreciated :-)