-
Notifications
You must be signed in to change notification settings - Fork 45
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
Qt Implementation Dependency Injection? #16
Comments
I am not very familiar with the quamash source with respect to that. Other projects (such as matplotlib) which have variable dependencies usually have a module which you can load beforehand and where you can set options:
In absence of that, quamash should fail to load, I think (In face of ambiguity, refuse the temptation to guess — Zen of Python): Most applications will only work with exactly one of the packages. Ideally, the system would work in a way so that the type of the Qt application which is passed to the event loop determines which package to use. I wonder however how feasible that is, considering that the event loop itself already has a dependency on Qt (as it seems from looking into unix.py and windows.py; I have not looked closely though). With a system as used by matplotlib, one could however provide a helper function such as just my thoughts :) |
Another thought I had was looking for which modules are already loaded (in |
Maybe there could be a quamash.initialize function where you specify which Qt wrapper to use (i.e., 'PyQt4', 'PyQt5' or 'PySide'). Eventually, if you pass None, Quamash could pick one automatically. For example:
|
Seems people think this is a good idea? All solutions require some
|
I am not sure I like that metaprogramming part. It may introduce a lot of complexity which can be easily avoided by putting QEventLoop (and related classes) into a separate module (e.g. At least for a first iteration this seems more reasonable. Extending this to a more flexible approach should be possible in the future. |
Well I'm thinking of the things that need to happen: A subclass of QThread is needed to make QThreadWorkers (QThreadExecutor & I think that's it. On Fri, Jan 9, 2015 at 1:36 PM, Jonas Wielicki notifications@github.com
|
I'm working on this in https://github.com/harvimt/quamash/tree/depinject It works just not on windows (yet) |
The current system where quamash loads the first Qt Implementation it finds or one in an environment variable is hacky.
Additionally since version, author and license are loaded from init.py, a Qt Implementation (doesn't matter which one) needs to be available when setup.py is used. It would be nice if a source install could be done without PyQt/PySide being present. Even if that's unusual.
A lazy-load dependency injection type system that decides which Qt implementation to use at instantiation time could be really slick, or it could just be even more hackish.
@aknuds1 @horazont thoughts?
The text was updated successfully, but these errors were encountered: