Allow groups to start closed
authorCesar Strauss <cestrauss@gmail.com>
Sun, 21 Feb 2021 17:10:10 +0000 (14:10 -0300)
committerCesar Strauss <cestrauss@gmail.com>
Sun, 21 Feb 2021 17:11:59 +0000 (14:11 -0300)
src/nmutil/gtkw.py

index b3cf6470ad6a19b48233d6ba0cd33c00c485604d..f26fc00cf17b1e0be1977f1c699aff5a37eb35d7 100644 (file)
@@ -50,6 +50,7 @@ def write_gtkw(gtkw_name, vcd_name, gtkw_dom, gtkw_style=None,
     * display: alternate text to display in the signal pane
     * comment: comment to display in the signal pane
     * bit: select a bit from a wide signal. MSB is zero, unfortunately
+    * closed (for groups): this group starts closed
 
     **gtkw_dom format**
 
@@ -163,9 +164,14 @@ def write_gtkw(gtkw_name, vcd_name, gtkw_dom, gtkw_style=None,
                     del node_style['submodule']
                 # emit the group delimiters and walk over the child list
                 if children is not None:
+                    # see whether this group starts closed
+                    closed = False
+                    if 'closed' in node_style:
+                        closed = node_style['closed']
+                        del node_style['closed']  # do not inherit
                     # only emit a group if it has a name
                     if isinstance(node_name, str):
-                        gtkw.begin_group(node_name)
+                        gtkw.begin_group(node_name, closed)
                     # pass on the group style to its children
                     walk(children, node_style)
                     if isinstance(node_name, str):