qtpy icon indicating copy to clipboard operation
qtpy copied to clipboard

Circular attempt for bindings

Open dpizetta opened this issue 6 years ago • 11 comments

Hi, I'd like to implement a change for setup the binding in a circular form. Here is an example.

If the preference list is [pyqt5, pyside2, pyqt, pyside]:

  • choosing pyqt, if it is not found, it should try pyside, pyqt5, pyside2;
  • choosing pyside2, if it is not found, it should try pyqt, pyside2, pyqt5;

I think this would improve the auto setup and even the message that the "qtpy.PythonQtError: No Qt bindings could be found", because if you choose the last one, all the previous are not tested, so it is not "not found" actually.

Let me know what do you think about it, tks

dpizetta avatar May 21 '18 14:05 dpizetta

@dpizetta it sounds like a good idea :-) @ccordoba12 ?

Just for context, is there any particular issues on your side that would directly benefit from this? Like an example of what was the problem?

goanpeca avatar May 21 '18 15:05 goanpeca

I would add that we need to add an else check so that if the last item in the list is not found, it should say something regarding that, instead of saying that it failed to use whatever binding check came last. Pyside at the moment, which is misleading

goanpeca avatar May 21 '18 15:05 goanpeca

@dpizetta, I like it! But things should not be circular. Instead we should always prefer the bindings for the same Qt major version, then the other ones. And the PyQt bindings should be preferred over the PySide ones because they are more stable.

So, according to what you post above:

  • choosing pyside, if it is not found, it should try pyqt, pyqt5, pyside2;
  • choosing pyqt, if it is not found, it should try pyside, pyqt5, pyside2;
  • choosing pyside2, if it is not found, it should try pyqt5, pyqt, pyside

ccordoba12 avatar May 21 '18 15:05 ccordoba12

Hi @goanpeca , @ccordoba12 thank you. I agree with your comments. Implementing this proposal also include the additional feature from @goanpeca. I'll post PR soon.

dpizetta avatar May 21 '18 17:05 dpizetta

Thanks @dpizetta :-) !

goanpeca avatar May 21 '18 17:05 goanpeca

@goanpeca > Just for context, is there any particular issues on your side that would directly benefit from this? Like an example of what was the problem? Sorry, I miss this question. The main problem is: if you choose the last one, i.e PySide, but it is not installed, it wouldn't try the other ones. So I think it should be nice to have this feature. In addition, I would like to add some functions that can be useful for other users, ex. get_available_api, that returns installed qt bindings..etc. I practically finished the code, but I would like to add more information about the changes to be well documented.

dpizetta avatar May 25 '18 21:05 dpizetta

I think what he meant is that if all four bindings are tried and none is found, then qtpy should print a message saying precisely that.

If that happens right now, then we're printing a message about the lack of PySide (the last binding we look for its presence), which confuses users because they think they need to install PySide (to fulfill Spyder requirements, for example).

ccordoba12 avatar May 25 '18 22:05 ccordoba12

Any date for this milestone?

dpizetta avatar Jan 25 '19 14:01 dpizetta

@ccordoba12 do we have an estimated date, or is this the next major one?

goanpeca avatar May 05 '19 18:05 goanpeca

As soon as someone reviews PR #156. @goanpeca, can you take care of that?

ccordoba12 avatar May 05 '19 22:05 ccordoba12

Sure will do :-)

goanpeca avatar May 05 '19 22:05 goanpeca