Skip to content

Commit

Permalink
improve logging when inserting into many slots
Browse files Browse the repository at this point in the history
  • Loading branch information
ndepaola committed Mar 28, 2024
1 parent bbd2f0e commit 8d76ab6
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions desktop-tool/src/driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -344,15 +344,14 @@ def upload_image(self, image: CardImage, max_tries: int = 3) -> Optional[str]:
@exception_retry_skip_handler
def insert_image(self, pid: Optional[str], image: CardImage, slots: list[int]) -> None:
"""
Inserts the image identified by `pid` into `image.slots`.
If `slots` is specified, fill the image into those slots instead.
Inserts the image identified by `pid` into `slots`.
"""

self.wait_until_javascript_object_is_defined("PageLayout.prototype.applyDragPhoto")

if pid:
self.set_state(self.state, f'Inserting "{image.name}"')
for slot in slots:
for i, slot in enumerate(slots, start=1):
self.set_state(state=self.state, action=f"Inserting {image.name} into slot {slot+1} ({i}/{len(slots)})")
# Insert the card into each slot and wait for the page to load before continuing
self.execute_javascript(
f'PageLayout.prototype.applyDragPhoto({self.get_element_for_slot_js(slot)}, 0, "{pid}")'
Expand Down

0 comments on commit 8d76ab6

Please sign in to comment.