Skip to content

Commit

Permalink
PPF-539: really?
Browse files Browse the repository at this point in the history
  • Loading branch information
chinapandaman committed Mar 28, 2024
1 parent be367be commit 0f953f3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
2 changes: 1 addition & 1 deletion PyPDFForm/filler.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ def simple_fill(
radio_button_tracker[key] = 0
radio_button_tracker[key] += 1
if widget.value == radio_button_tracker[key] - 1:
simple_update_radio_value(annot, widget)
simple_update_radio_value(annot)
elif isinstance(widget, Dropdown) and widget.value is not None:
simple_update_dropdown_value(annot, widget)
elif isinstance(widget, Text) and widget.value:
Expand Down
13 changes: 5 additions & 8 deletions PyPDFForm/patterns.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,16 +86,13 @@ def simple_update_checkbox_value(annot: DictionaryObject) -> None:
annot[NameObject(AS)] = NameObject(Yes)


def simple_update_radio_value(annot: DictionaryObject, widget: Radio) -> None:
def simple_update_radio_value(annot: DictionaryObject) -> None:
"""Patterns to update values for radio annotations."""

if AP in annot and D in annot[AP]:
for each in annot[AP][D]: # noqa
if str(each) != Off:
annot[NameObject(AS)] = NameObject(each)
break
else:
annot[NameObject(AS)] = NameObject(f"/{widget.value}")
for each in annot[AP][D]: # noqa
if str(each) != Off:
annot[NameObject(AS)] = NameObject(each)
break


def simple_update_dropdown_value(annot: DictionaryObject, widget: Dropdown) -> None:
Expand Down

0 comments on commit 0f953f3

Please sign in to comment.