tf2classic / TF2CDownloader

Cross-platform utility for automatically downloading and installing TF2 Classic
GNU General Public License v3.0
48 stars 14 forks source link

Implement a real frontend #8

Open chloecormier opened 2 years ago

chloecormier commented 2 years ago

If nothing else, we need a combined progress bar that includes downloading and extraction (since users keep closing the window before the extraction finishes after they notice that the download is done). Preferably, we can also use real GUI dialog boxes to ask the user yes/no questions where they can answer by clicking a button, and to leverage a filepicker for selecting things like your desired sourcemods path.

PyQt5 seems like the standard solution here, but it's also a big library that increases the executable size, and we'll still need to make everything available through the CLI for dedicated servers using the tool.

Proposal: Use a TUI framework instead. They're hardly intimidating if they're pretty and abstracted enough, they'll work fine even on dedicated servers, they're (maybe?) easier to implement, they don't inflate the binary size as much, and they're mostly built with Python in mind, rather than being a set of Python bindings on top of a huge library.

Projects worth looking at: https://github.com/Textualize/rich (for basic text theming - would be easy to implement in the short-term) (now in-use) https://github.com/Textualize/textual (derived from the last one. a complete UI framework - based on CSS, which should make it easier) https://github.com/bczsalba/pytermgui (mainly interesting because you can write your interface in YAML) https://github.com/jwlodek/py_cui (supposedly similar to Tkinter)

This isn't comprehensive. Even if we used a TUI library, we might just use Tkinter's filepicker since that's harder to do in an intuitive way from the terminal. Tkinter is a built-in module, trivial to access and use for basic needs like that, and uses the native filepicker on Windows.

MaartenS11 commented 2 years ago

Another option would maybe be to use webview. This renders the UI using the render engine from the browsers you already have installed on your machine, on windows being Edge and on linux webkitgtk. By doing this, it doesn't have to be bundled and keeps the executable size small.

For python there are the pywebview bindings.

pywebview does not bundle a heavy GUI toolkit or web renderer with it keeping the executable size small. pywebview is compatible with Python 3.

I haven't personally used it but it has always seemed like a reasonable option to me.

flleeppyy commented 2 years ago

Is this project completely set on python? or is there chance to switch to Java? It would make things simpler in terms of UI and executable size because of Swing

MaartenS11 commented 2 years ago

Is this project completely set on python? or is there chance to switch to Java? It would make things simpler in terms of UI and executable size because of Swing

I personally really like java and would consider using it here but can you really make the executable super small? The jar can be small for sure but packing in java itself using jpackage for example will end up with a relatively big executable as far as I'm aware.

Just shipping a jar would mostly work but you will always end up having people who don't have java installed and don't know how to run it because of that.

flleeppyy commented 2 years ago

A lot of people have Java, and its rare that i come across someone who doesn't have Java already installed. And even then, getting Java is extremely easy if you're downloading Orcale Java. Otherwise stuff like Adoptium might take a bit more time, but most users are on 64-bit windows machines and you could just link it on your page.

Technochips commented 2 years ago

I don't think providing a gigantic file, or forcing people to install Java is a very good idea. No, not everyone has Java installed. It would be ridiculous to require Java to install the game when the game itself doesn't require Java.

In my opinon, if I could, I would've rewritten this application in C or something.

chloecormier commented 2 years ago

I don't have time to consider rewriting it right now anyways, but I was always most interested in a Nim port. All of the advantages of C, and interoperability with C, but with an easier migration path. Wouldn't require the Java runtime or anything else - the base binary size is like 50kb - and it has good native UI libraries available.

JoeAnonymous commented 6 months ago

Necrobumping this issue to point to IUP, which is a C based library that runs on Windows and Linux. https://www.tecgraf.puc-rio.br/iup/

I have also been working on my own incredibly barebones installer. There is no main menu right now, because i am still implementing all the use cases. Right now it is capable of downloading and unzipping files. applying updates and verifying installation is intended to be done with butler.

If anyone wishes, i am willing to upload what little work i have done on this to github.