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

Added ability to configure ZBar options per symbol #58

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

saml-dev
Copy link

Changes:

  • added optional config parameter to pyzbar.pyzbar.decode
  • the structure is a nested dictionary where the keys are ZBarSymbol objects, and the values are dicts of ZBarConfig-value key-value pairs

Explanation:
I am submitting this PR to accomodate our use case of using I25 barcodes that are only 2 digits. ZBar defaults to a minimum length of 6 for I25 codes, and we had no way to change that in the current pyzbar. While I was in the code, I figured I would make it generic to allow changing any config option(s) for any symbol.

The structure of the config object is admittedly a bit complicated. I decided to make it a nested dict for 2 reasons:

  1. to allow changing barcode settings for each individual code rather than for all codes
  2. to allow passing only the config object without passing the symbols object

Changes:
- added optional config parameter to pyzbar.pyzbar.decode
- the structure is a nested dictionary where the keys are ZBarSymbol objects, and the values are dicts of ZBarConfig-value key-value pairs

Explanation:
I am submitting this PR to accomodate our use case of using I25 barcodes that are only 2 digits. ZBar defaults to a minimum length of 6 for I25 codes, and we had no way to change that in the current pyzbar. While I was in the code, I figured I would make it generic to allow changing any config option(s) for any symbol.

The structure of the config object is admittedly a bit complicated. I decided to make it a nested dict for 2 reasons:
1. to allow changing barcode settings for each individual code rather than for all codes
2. to allow passing only the config object without passing the symbols object
@coveralls
Copy link

Coverage Status

Coverage increased (+0.04%) to 98.14% when pulling 1bce396 on SamLewis0602:feature/config-options into 833b375 on NaturalHistoryMuseum:master.

@saml-dev
Copy link
Author

@quicklizard99 Please let me know if this could be included in the next release as it includes changes we need for our use of pyzbar at Chick-fil-A. If not we will have to build our own package based on my fork. Thanks.

@saml-dev
Copy link
Author

saml-dev commented May 8, 2019

@quicklizard99 any updates? We are hoping to continue using the main repo rather than our own fork.

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