Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add params to at-command & helper, expose take_snapshot #19

Merged
merged 1 commit into from
Apr 8, 2023

Conversation

smartin015
Copy link
Contributor

@smartin015 smartin015 commented Apr 6, 2023

Continuing work on #16.

  • Update @bedready and check_bed to support additional parameters for selecting saved references and custom match percentages.
  • Add case-insensitive matching (e.g. @BEDREADY, @BedReady, and @bedready all perform the check).
  • Expose take_snapshot method as a helper so snapshots could be acquired automatically (e.g. upon print completion)
  • Deduplicate image comparison code
  • Show both the source and test image in popups

To match against filename.jpg with a match percentage of 80% via at-command:

@BEDREADY filename.jpg 0.8

Plugin example:

def on_after_startup(self):
  helpers = self._plugin_manager.get_helpers("Bed Ready", "check_bed")
  if helpers and "check_bed" in helpers:
    self.check_bed = helpers["check_bed"]
    self.take_snapshot = helpers["take_snapshot"]

# Later in the plugin....

self.take_snapshot("new_snapshot.jpg")
self.check_bed("new_snapshot.jpg", 0.8)

Example of popup changes:

image

@smartin015 smartin015 changed the title Add params to at-command, helper method Add params to at-command & helper, expose take_snapshot Apr 6, 2023
@jneilliii
Copy link
Owner

I think maybe your example for using the helper is wrong. Should be something like this?

def on_after_startup(self):
  helpers = self._plugin_manager.get_helpers("bedready", "check_bed", "take_snapshot")
  if helpers and "check_bed" in helpers:
    self.check_bed = helpers["check_bed"]
  if helpers and "take_snapshot" in helpers:
    self.take_snapshot = helpers["take_snapshot"]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants