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

suggestion: move examples.demo_opts.get_device() into core #178

Open
BeauSlim opened this issue Jul 16, 2020 · 5 comments
Open

suggestion: move examples.demo_opts.get_device() into core #178

BeauSlim opened this issue Jul 16, 2020 · 5 comments

Comments

@BeauSlim
Copy link

BeauSlim commented Jul 16, 2020

I've been messing around with a library I'm writing and trying it with numerous displays, including an ssd1306, an ili9341 and an st7789 in addition to the pygame emulator. A config file (same file name, different contents) helps when testing on different displays, so I have used examples' get_device() as a start.

While it isn't difficult to do

from luma.core import cmdline
parser = cmdline.create_parser(description='luma config')
config = cmdline.load_config('device.conf')
args = parser.parse_args(config)
device = cmdline.create_device(args)

It occurs to me that something like device=conf2dev(dev_conf='device.conf') might be useful for users in general and really should be built into luma.core. Probably just the file-based config not the command line stuff, since that might be messy.

Or maybe the use of config files should just be documented better?

Either way I'm happy to work it up as a pull request.

@thijstriemstra
Copy link
Collaborator

Either way I'm happy to work it up as a pull request.

Sounds good!

@rm-hull
Copy link
Owner

rm-hull commented Jul 21, 2020

Would be good, yes please.

Something like device = create_device_from(filename='ssd1306.conf') seems self-descriptive.
Also the use of config files should definitely be better documented too but only if you have time

@BeauSlim
Copy link
Author

Cool. Thanks for guidance on the preferred naming. I'll give the docs a try as well.
Something has come up on my end so it might be a couple weeks.

@thijstriemstra
Copy link
Collaborator

ping @BeauSlim

@BeauSlim
Copy link
Author

Sorry for leaving this hanging. My laptop died and I could no longer code all comfy on my couch. I have a shiny new M1 Air now, this is still on my list and I should have some time soon.

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

No branches or pull requests

3 participants