[Tool] GUI for installing and updating mods from GitHub

Morn76
Member
Posts: 659
Joined: Sun Feb 16, 2014 19:45

[Tool] GUI for installing and updating mods from GitHub

by Morn76 » Post

This project has been discontinued.
Last edited by Morn76 on Sat Oct 26, 2019 09:01, edited 106 times in total.

User avatar
rubenwardy
Moderator
Posts: 6972
Joined: Tue Jun 12, 2012 18:11
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy
Location: Bristol, United Kingdom
Contact:

by rubenwardy » Post

Nice.

Have you made sure it is forward compatible?

Ie, using print (msg), which works on both versions.
Renewed Tab (my browser add-on) | Donate | Mods | Minetest Modding Book

Hello profile reader

Morn76
Member
Posts: 659
Joined: Sun Feb 16, 2014 19:45

by Morn76 » Post

Yes. I only use a single print statement / function anyway. :-)

I actually started this as a Python 3 script, but tkFileDialog does not seem to exist in Python 3 anymore, at least I could not find it. Has it been renamed to something else? Very strange. But apart from Tk module name issues, the script should work in Python 3 unchanged I think.

P.S. Aha, according to 2to3 the correct import statement for Python 3 would have been "from tkinter.filedialog import *".
Last edited by Morn76 on Fri Mar 07, 2014 01:42, edited 1 time in total.

User avatar
Evergreen
Member
Posts: 2135
Joined: Sun Jan 06, 2013 01:22
GitHub: 4Evergreen4
IRC: EvergreenTree
In-game: Evergreen
Location: A forest in the midwest
Contact:

by Evergreen » Post

I suggest using pygtk instead of tk. It looks nicer imo.
Back from the dead!

Morn76
Member
Posts: 659
Joined: Sun Feb 16, 2014 19:45

by Morn76 » Post

Yes, but GTK would be another dependency, while Tkinter comes with Python. Linux has advanced package managers like pacman, so installing dependencies is not a problem, but on Windows and OS X they are quite annoying. And this thing is more geared towards Windows. Because on Linux I can just navigate to a mod folder with Dolphin, press F4, and type 'git pull'.

I may do an upgraded version, but I think I would be using PyQT. And I will keep the more simple, ugly interface around too. :-)

Morn76
Member
Posts: 659
Joined: Sun Feb 16, 2014 19:45

by Morn76 » Post

Script updated: Now it also works with Python 3.

User avatar
Evergreen
Member
Posts: 2135
Joined: Sun Jan 06, 2013 01:22
GitHub: 4Evergreen4
IRC: EvergreenTree
In-game: Evergreen
Location: A forest in the midwest
Contact:

by Evergreen » Post

Morn76 wrote:Yes, but GTK would be another dependency, while Tkinter comes with Python. Linux has advanced package managers like pacman, so installing dependencies is not a problem, but on Windows and OS X they are quite annoying. And this thing is more geared towards Windows. Because on Linux I can just navigate to a mod folder with Dolphin, press F4, and type 'git pull'.

I may do an upgraded version, but I think I would be using PyQT. And I will keep the more simple, ugly interface around too. :-)
That's a valid reason. I guess pygtk is just a personal preference.
EDIT: Actually, I'm learning to use pygtk so I might actually try converting it ...(maybe)
Last edited by Evergreen on Fri Mar 07, 2014 12:38, edited 1 time in total.
Back from the dead!

Morn76
Member
Posts: 659
Joined: Sun Feb 16, 2014 19:45

by Morn76 » Post

Evergreen wrote:That's a valid reason. I guess pygtk is just a personal preference.
EDIT: Actually, I'm learning to use pygtk so I might actually try converting it ...(maybe)
I've looked at PyGTK code and found it not very Pythonic. It's just a minimal wrapper for the C library. More complicated than Tkinter and not necessarily hugely more powerful, unless you need some modern widgets that Tk's basic 1980s-style widget types do not offer. But for basic widgets like buttons, entries, text boxes, etc. it's not a very big improvement IMO, neither in the coding nor in the looks department.

I mainly use KDE on Linux, so with Qt, I could integrate this tool into the KDE task bar so it could e.g. check for updates once daily. And you draw the GUI with Qt Designer I think, no coding necessary. Now that is what I call a modern GUI toolkit. :-)

P.S. Of course I'm not trying to dissuade you from porting to GTK if you want to. I don't hate GTK when others do the work for me. ;-)

P.P.S. Another toolkit possibility is wxWidgets. I think it uses GTK on Linux and native widgets on Windows. I've tried this out once in a project because GTK looked a bit too convoluted and it wasn't so bad actually.
Last edited by Morn76 on Fri Mar 07, 2014 13:17, edited 1 time in total.

4aiman
Member
Posts: 1208
Joined: Mon Jul 30, 2012 05:47

by 4aiman » Post

Neat :)
Could it be done so, that one could change the repo?
Sometimes authors discontinue their stuff and a new modder takes over within his/her own repo.
*cough* search for mods on githug would be great *cough*

User avatar
Krock
Developer
Posts: 4649
Joined: Thu Oct 03, 2013 07:48
GitHub: SmallJoker
Location: Switzerland
Contact:

by Krock » Post

Useful tool.
Maybe could you add a "small database", so it gets the URL of the GutHub repo automatically?
With this way, I would need to search the creator / forum thread first.
Look, I programmed a bug for you. >> Mod Search Engine << - Mods by Krock - DuckDuckGo mod search bang: !mtmod <keyword here>

User avatar
rubenwardy
Moderator
Posts: 6972
Joined: Tue Jun 12, 2012 18:11
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy
Location: Bristol, United Kingdom
Contact:

by rubenwardy » Post

You could use the mmdb API, or you could search github.
Renewed Tab (my browser add-on) | Donate | Mods | Minetest Modding Book

Hello profile reader

Morn76
Member
Posts: 659
Joined: Sun Feb 16, 2014 19:45

by Morn76 » Post

Those are very good ideas. The built-in Minetest modstore never has anything I want or need, so a decent list of the best forks for each mod might be handy.

Also, I think the tool should be smarter because the GitHub repo name is sometimes different from the mod folder name. If the GH repo is called minetest-foo but the correct folder name is mods/foo the tool should rename things accordingly.

Morn76
Member
Posts: 659
Joined: Sun Feb 16, 2014 19:45

by Morn76 » Post

I have added a simple mod database to the tool (under "Browse mods") in v3.0. Click "Select", then "Add" in the main window.

The current list is from the Stampy world map thread, so it is not very complete yet. Suggestions for inclusion are welcome.
Last edited by Morn76 on Sat Mar 08, 2014 08:28, edited 1 time in total.

Morn76
Member
Posts: 659
Joined: Sun Feb 16, 2014 19:45

by Morn76 » Post

New version (v3.5) now with more included mods in the database
Last edited by Morn76 on Wed Feb 11, 2015 13:41, edited 2 times in total.

Morn76
Member
Posts: 659
Joined: Sun Feb 16, 2014 19:45

by Morn76 » Post

4aiman wrote:Neat :)
Could it be done so, that one could change the repo?
Sometimes authors discontinue their stuff and a new modder takes over within his/her own repo.
I think in that case it would be better to delete the existing repo folder e.g. from your file manager, then clone the repo from the new maintainer URL.

It is possible to redefine the upstream URL for a repository ("git remote set-url origin"), but I really want to keep this program simple and not introduce anything that might mess with existing git repos in the mods folder. So I want to limit it to "git clone" and "git pull" essentially, because those two are pretty safe.

User avatar
PilzAdam
Member
Posts: 4026
Joined: Fri Jul 20, 2012 16:19
GitHub: PilzAdam
IRC: PilzAdam
Location: Germany

by PilzAdam » Post

Wow, nice!

This is already a lot more useful than MMDB.

It would be cool to a have a list of the mods that are in your mod directory and an option to just update a single one. I usually have my indev mods there too, and a merge would mess them up.

Morn76
Member
Posts: 659
Joined: Sun Feb 16, 2014 19:45

by Morn76 » Post

PilzAdam wrote: It would be cool to a have a list of the mods that are in your mod directory and an option to just update a single one. I usually have my indev mods there too, and a merge would mess them up.
Maybe the program could check each directory for a file that serves as a flag, e.g. "._MTGITSYNC_IGNORE_" and a directory that contains it would get skipped during updates. Because e.g. showing a scrollable list of installed mods with checkboxes in front of them would be very difficult or even impossible with Tk widgets. Most people will probably just want to update everything, so thís could be more of an advanced, slightly hidden feature for mod devs only.

Morn76
Member
Posts: 659
Joined: Sun Feb 16, 2014 19:45

by Morn76 » Post

New in version v3.6:
  • "Web page" button which opens the GitHub page for a mod in your web browser. (Which in most cases has a link to a forum thread or at least a decent README.)
  • A flag to skip some directories during updates, see the green text in the first post for a description. This is mainly intended for mod devs.

Morn76
Member
Posts: 659
Joined: Sun Feb 16, 2014 19:45

by Morn76 » Post

Version v3.8 has some nice improvements compared to v3.6, e.g. spaces in folder names are no longer a problem. (Normally GitHub repos should not contain spaces, but you never know. And I suppose this might have affected Windows users who keep Minetest in e.g. "My Documents".)

And the official license is CC0, which is basically WTFPL without the swear words. :-)

I think this program now has pretty much all the functionality you can expect from a Tk app; anything beyond that (e.g. a built-in GitHub browser or whatever) would require a more powerful widget set like Wx, GTK, or Qt.
Last edited by Morn76 on Sun Apr 27, 2014 19:41, edited 2 times in total.

dgm5555
Member
Posts: 245
Joined: Tue Apr 08, 2014 19:45

Re: [Tool] Python GUI for installing and updating mods from

by dgm5555 » Post

Great app, wish I'd seen it months ago!
oddly under ubuntu 14.04 tkinter isn't installed by default, so you have install python-tk (for 2.7), or python3-tk from the repository (then it works fine)
Just clicking in the path, typing the mods directory path and clicking out didn't update the path (it was still looking for /home/martin/...), but this was only apparent when looking in the terminal, the error didn't appear in the application window.
I must have been a little dense, but I also spent a minute clicking "Update now" before realising that wasn't actually the button which added the current mod. Perhaps making the addmod more obvious and renaming the update to "Update All"
Also if you try to clone a GH but the folder already exists, the old 'temp' folder is left behind in the MT-GitSync dir, and causes subsequent errors even if the original folder is deleted (ie the script should delete the temp folder on error, or display a message to enable overwrite).
Also is it possible on the next version to have the browse listbox resizable?
Also trying to think if it would be helpful or not to mention in your user instructions that you can edit the modtable in the py script if you want to change the output folder name (eg if the mod is set up incorrectly).
Tx

Morn76
Member
Posts: 659
Joined: Sun Feb 16, 2014 19:45

Re: [Tool] Python GUI for installing and updating mods from

by Morn76 » Post

Thanks for your suggestions, dgm5555! I've made a new version (3.10).
dgm5555 wrote:Great app, wish I'd seen it months ago!
It only exists since last month, so that would have been impossible. :-)
dgm5555 wrote: oddly under ubuntu 14.04 tkinter isn't installed by default, so you have install python-tk (for 2.7), or python3-tk from the repository (then it works fine)
Noted now in README and forum post.
dgm5555 wrote: Just clicking in the path, typing the mods directory path and clicking out didn't update the path (it was still looking for /home/martin/...), but this was only apparent when looking in the terminal, the error didn't appear in the application window.
Made it so the text box can no longer be selected/typed in. I agree it was not very consistent because the mod name box can be typed in and will use what's inside the text box.
dgm5555 wrote: I must have been a little dense, but I also spent a minute clicking "Update now" before realising that wasn't actually the button which added the current mod. Perhaps making the addmod more obvious and renaming the update to "Update All"
Renamed the buttons a bit.
dgm5555 wrote: Also if you try to clone a GH but the folder already exists, the old 'temp' folder is left behind in the MT-GitSync dir, and causes subsequent errors even if the original folder is deleted (ie the script should delete the temp folder on error, or display a message to enable overwrite).
This is kind of by purpose. Following the KISS philosophy, I don't want this script to remove anything, ever. That is up to the user. Even if the script *thinks* it is just removing a useless folder, it might not be. So failing noisily on bad moves where e.g. the target already exists is a good thing IMO.
dgm5555 wrote: Also is it possible on the next version to have the browse listbox resizable?
Resizable is difficult in Tkinter, so I've increased the number of visible lines from the default of 10 to 25.
dgm5555 wrote: Also trying to think if it would be helpful or not to mention in your user instructions that you can edit the modtable in the py script if you want to change the output folder name (eg if the mod is set up incorrectly).
Tx
I've put this in the README too. I suppose the list of mods could easily be made an external file too, e.g. a csv-formatted text file. It was just for my convenience that I wanted to minimize the number of files. But in princriple I know that separating code and data is a good idea. :-)

Morn76
Member
Posts: 659
Joined: Sun Feb 16, 2014 19:45

Re: [Tool] GUI for installing and updating mods from GitHub

by Morn76 » Post

P.S. I've moved the mod table to a .csv file for easier editing in 3.11. Forks with updates to the .csv are welcome. Hint, hint. :-)

By the way, the .csv does not have to be sorted alphabetically (because the script sorts it anyway after reading). But maybe it makes it a bit easier to see which mods are already included.

dgm5555
Member
Posts: 245
Joined: Tue Apr 08, 2014 19:45

Re: [Tool] GUI for installing and updating mods from GitHub

by dgm5555 » Post

OK my next request then is that the tool accesses an online page which stores the names of the mods and can save names of 'unknown' mods, thus everyone can contribute, and if it was really smart, could track rates of downloads. Perhaps it could use/modify the modstore list from the MT menu (though I find MT-gitsync tidier)...

Also without some sort of auto-merging/listing of unknown mods, a list like the following is impossible to figure out what's new or known, and takes ages to manually compare lists (probably why you don't get many contributors):-
minermoder27/carts
Adding minermoder27/carts... cloned... moved... done!
Adding rubenwardy/food... cloned... moved... done!
Adding Zeg9/minetest-itemframes... cloned... renamed... moved... done!
Adding mdoege/minetest-hatches... cloned... moved... done!
Adding Jeija/minetest-mod-mesecons... cloned... moved... done!
Adding bdjnk/mini_sun... cloned... moved... done!
Adding Neuromancer56/phonics... cloned... moved... done!
Adding Sokomine/locks... cloned... moved... done!
Adding Sokomine/mobf_animals... cloned... moved... done!

Also can MT-GitSync automatically update itself? The MT-GitSync folder doesn't seem to be listed when I click update all despite being in the mods folder.

Morn76
Member
Posts: 659
Joined: Sun Feb 16, 2014 19:45

Re: [Tool] GUI for installing and updating mods from GitHub

by Morn76 » Post

dgm5555 wrote:OK my next request then is that the tool accesses an online page which stores the names of the mods and can save names of 'unknown' mods, thus everyone can contribute, and if it was really smart, could track rates of downloads. Perhaps it could use/modify the modstore list from the MT menu (though I find MT-gitsync tidier)...
There is also the Minetest mod database ( mmdb/ ), which has been suggested as a data source for MT-GitSync earlier in the thread. But the thing is, they only have four pages of mods, so I think it's hardly worth the effort to integrate this with MT-GitSync. In fact neither the modstore nor the mod database seem to get a lot of updates or attention.
dgm5555 wrote: Also without some sort of auto-merging/listing of unknown mods, a list like the following is impossible to figure out what's new or known, and takes ages to manually compare lists (probably why you don't get many contributors)
True, then again the built-in mod list was never intended to be an exhaustive list of every single Minetest mod on GitHub. There are so many, especially if you count every fork. That list would be impossible to maintain, even in a crowdsourced fashion.

Instead the list was supposed to help new MT users find some commonly installed and popular mods. Especially also for features that are standard in MC but not implemented in minetest_game: carts, mobs, TNT, hunger, mesecons, beds, arrows, those kinds of things. I don't want to clutter the list too much with obscure mods that only a few users are interested in.
dgm5555 wrote: Also can MT-GitSync automatically update itself? The MT-GitSync folder doesn't seem to be listed when I click update all despite being in the mods folder.
My assumption was that many users will get MT-GitSync as a ZIP file, which of course also makes it harder to update itself. Just pulling random raw files from GitHub could be flaky and is generally not a good idea for code that is executed.

Maybe MT-GitSync could check if it is inside its own git repo and if it's not, check itself out into a subdirectory. And then if you run the git repo version, it could do git pull. But would users understand that? And just removing files from the working directory or something like that is dangerous, see my earlier comments about removing files or directories. So basically a full auto-update without git makes me a bit queasy.

Perhaps the way to go would be to pull automatic updates for modlist.csv from GitHub (that's pretty safe, especially if there is error handling in the script for a corrupted modlist). For the main program, maybe just do a version check against GitHub and inform the user when a new version is available.

Sokomine
Member
Posts: 4276
Joined: Sun Sep 09, 2012 17:31
GitHub: Sokomine
IRC: Sokomine
In-game: Sokomine

Re: [Tool] GUI for installing and updating mods from GitHub

by Sokomine » Post

Morn76 wrote: In fact neither the modstore nor the mod database seem to get a lot of updates or attention.
It would be great if more modders could add their mods there. Installing from the mmdb is pretty easy.

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests