FAForever / client

FAF Python Client
GNU General Public License v3.0
74 stars 88 forks source link

Make it async #432

Closed Keksilton closed 2 years ago

Keksilton commented 7 years ago

It would be cool if you make loading page contents in async way(some async implementations or just use different thread for this)

duk3luk3 commented 7 years ago

@diwersan7 do you know how to do that in (py)qt?

Keksilton commented 7 years ago

@duk3luk3 I don't know python 😞

duk3luk3 commented 7 years ago

There are some ways this can be done:

It's probably a good idea to delay any work on this until after we've transitioned to using python3.

Keksilton commented 7 years ago

In C# I would use threading option, to load web content in different thread and then load it to display( also in c# it's done in web browser element, which doesn't cause window freezes)

duk3luk3 commented 7 years ago

So as it turns out, Qt of course has support for this built-in. It has QNetworkAccessManager to make non-blocking web requests, and it has QThread / QThreadPool / QRunnable to put tasks into threads.

Obviously some work has already gone into that with various "Download Managers" implemented in the client code. I think the easiest avenue to make the client a lot more responsive is to hunt down all urllib uses and turn them into properly dispatched QNetworkAccessManager uses.

507 is a good example where this is happening.

It's still a good idea to delay any work on this until after we've finished the python3 transition, but that's hit some roadblocks because of travis.

Keksilton commented 7 years ago

Nice to hear that.

duk3luk3 commented 7 years ago

The map downloader is now in use. It's pretty slick.

duk3luk3 commented 7 years ago

Remaining imports of urllib:

We want those gone.