gtkwave: fix error when prefix is empty, make treeopen optional
This commit is contained in:
parent
9113c1a2f9
commit
bea82efc5d
|
@ -52,6 +52,7 @@ class GTKWSave:
|
||||||
savefile: str,
|
savefile: str,
|
||||||
dumpfile: str,
|
dumpfile: str,
|
||||||
filtersdir: str = None,
|
filtersdir: str = None,
|
||||||
|
treeopen: bool = True,
|
||||||
prefix: str = "TOP.sim."):
|
prefix: str = "TOP.sim."):
|
||||||
"""Crate savefile generator for the namespace.
|
"""Crate savefile generator for the namespace.
|
||||||
|
|
||||||
|
@ -62,6 +63,7 @@ class GTKWSave:
|
||||||
self.savefile = savefile
|
self.savefile = savefile
|
||||||
self.dumpfile = dumpfile
|
self.dumpfile = dumpfile
|
||||||
self.filtersdir = filtersdir
|
self.filtersdir = filtersdir
|
||||||
|
self.treeopen = treeopen
|
||||||
if self.filtersdir is None:
|
if self.filtersdir is None:
|
||||||
self.filtersdir = os.path.dirname(self.savefile)
|
self.filtersdir = os.path.dirname(self.savefile)
|
||||||
|
|
||||||
|
@ -71,9 +73,11 @@ class GTKWSave:
|
||||||
self.file = open(self.savefile, "w")
|
self.file = open(self.savefile, "w")
|
||||||
self.gtkw = GTKWSave(self.file)
|
self.gtkw = GTKWSave(self.file)
|
||||||
self.gtkw.dumpfile(self.dumpfile)
|
self.gtkw.dumpfile(self.dumpfile)
|
||||||
modules = self.prefix.rstrip(".").split(".")
|
if self.treeopen:
|
||||||
for i in range(len(modules)):
|
modules = self.prefix.rstrip(".").split(".")
|
||||||
self.gtkw.treeopen(".".join(modules[:i + 1]))
|
for i in range(len(modules)):
|
||||||
|
if modules[i]:
|
||||||
|
self.gtkw.treeopen(".".join(modules[:i + 1]))
|
||||||
self.gtkw.sst_expanded(True)
|
self.gtkw.sst_expanded(True)
|
||||||
return self
|
return self
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue