Closed
Description
Please provide all mandatory information!
Describe the bug (mandatory)
I am trying to use rbgroups
in the set_layer()
function but it throws an error
File "fitz/fitz.py", line 5189, in set_layer
if f != set():
NameError: name 'f' is not defined
When looking at the code, f
should be replaced by s
if rbgroups:
if type(rbgroups) not in (list, tuple):
raise ValueError("bad type: 'rbgroups'")
for x in rbgroups:
if not type(x) in (list, tuple):
raise ValueError("bad RBGroup '%s'" % x)
s = set(x).difference(ocgs)
if f != set():
raise ValueError("bad OCGs in RBGroup: %s" % s)
To Reproduce (mandatory)
Explain the steps to reproduce the behavior, For example, include a minimal code snippet, example files, etc.
doc = fitz.open()
xrefs = {}
xrefs["oc1"] = doc.add_ocg("oc1", on=False)
xrefs["oc2"] = doc.add_ocg("oc2", on=True)
xrefs["oc3"] = doc.add_ocg("oc3", on=False)
xrefs["oc4"] = doc.add_ocg("oc4", on=False)
doc.set_layer(-1, on=[3], off=[4, 5, 6], rbgroups=[[4, 5, 6]])