Comments (7)
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:
import matplotlib
# selects backend
matplotlib.use("gtkagg")
# only here the dependencies are used
import matplotlib.pyplot as pyplot
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 make_loop_for_application
which (a) inspects the Application object for the correct package to use, (b) calls use
(or however that method would be called in quamash) and (c) imports the event loop, creates one and returns it.
just my thoughts :)
from quamash.
Another thought I had was looking for which modules are already loaded (in sys.modules
) and pick whichever of the Qt packages was loaded. This is still guesswork, but better (and easier to implement) than the current approach I think.
from quamash.
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:
quamash.initialize('PyQt5')
from quamash.
Seems people think this is a good idea? All solutions require some
inspection/metaprogramming with regards to dynamically injecting a parent
class.
On Jan 9, 2015 4:47 AM, "Arve Knudsen" [email protected] wrote:
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:quamash.initialize('PyQt5')
—
Reply to this email directly or view it on GitHub
#16 (comment).
from quamash.
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. quamash.eventloop
) and requiring the user to configure quamash before importing (from) that module.
At least for a first iteration this seems more reasonable. Extending this to a more flexible approach should be possible in the future.
from quamash.
Well I'm thinking of the things that need to happen:
A subclass of QThread is needed to make QThreadWorkers (QThreadExecutor &
QThreadWorker could totally be moved to a new module)
QObject needs to be subclassed in order for call_soon_threadsafe to work,
but this QObject subclass with custom signal need not necessarily be
QEventLoop. Finally, some sort of generic factory to create QSocketListener
instances is needed.
I think that's it.
On Fri, Jan 9, 2015 at 1:36 PM, Jonas Wielicki [email protected]
wrote:
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. quamash.eventloop) and requiring
the user to configure quamash before importing (from) that module.At least for a first iteration this seems more reasonable. Extending this
to a more flexible approach should be possible in the future.—
Reply to this email directly or view it on GitHub
#16 (comment).
from quamash.
I'm working on this in https://github.com/harvimt/quamash/tree/depinject
It works just not on windows (yet)
from quamash.
Related Issues (20)
- Interest in creating a conda-forge package
- asyncio.async is deprecated since python 3.4.4, use asyncio.ensure_future instead HOT 4
- exceptions not set on pending futures
- unnecessary warnings HOT 6
- Release tagging HOT 1
- PipeServer closure race
- asyncio.create_task is not working
- Intalling quamash using PIP forces install of both pyside2 and pyqt5 HOT 9
- [Bug or Feature Requests] aioredis connect raise 'Event callback failed'
- Problem with Anaconda HOT 1
- the anaconda navigator dose not open HOT 1
- call asyncio.sleep(0.1) RuntimeError: no running event loop
- AttributeError: module 'collections' has no attribute 'Mapping' HOT 1
- [python3.10] implicit float to int conversion
- Update package on PyPI?
- Release 0.6.2 HOT 5
- RuntimeError: no running event loop HOT 1
- Module 'collections' has no attribute 'Mapping' HOT 1
- collections.Mapping has been removed HOT 1
- SyntaxError: Non-ASCII character in quamash/__init__.py
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from quamash.