Pidgeot / python-lnp

Cross-platform re-implementation of the Lazy Newb Pack launcher.
ISC License
65 stars 10 forks source link

Can't install graphics #102

Closed Pidgeot closed 4 years ago

Pidgeot commented 4 years ago

Hi,

I'm using the Linux Lazy Newb Pack and just updated to version 04024r2-x64. Changelog says it updated to PyLNP 0.9.2a. After this I cannot install graphics packs any longer. When I press the button nothing happens.

With version 04024r1-x64 of the newb pack installing graphics works. There is no version mentioned in PyLNP about menu in that tho so no idea which version it is.

I downloaded PyLNP_0.9.3-linux-x64.tar.xz from bitbucket and replaced the files in the starter pack but I still can't install graphics.

Any ideas?

[Issue created by eq_tolbin: 2015-02-28]

[Comment created by Pidgeot: 2015-02-28] Okay, so I think I've figured out where the problem is occuring. Technical explanation follows:

When files are being downloaded, this happens in a separate thread in order to keep the UI responsive. In order to keep the user informed, the UI is notified in various situations so it can show appropriate messages.

Because most UI frameworks - including Tkinter - do not allow interaction with the UI from other threads; anything that changes in the UI has to be done from the UI thread. To accomplish this, I need to raise an event on the UI thread, but I also need to limit how frequently the event is triggered, since otherwise, Tkinter can't keep up and ends up crashing. This is done using a semaphore. Some messages are unimportant, so they just get skipped if the semaphore isn't available, but other are more important (e.g. changing the UI), and the program will wait for the semaphore to be available (which will happen shortly after the venet has been processed).

Something is causing the wait for this semaphore to never end on Linux. I don't yet know why this happens, but I can see that it does. Once I figure out how to fix it, I'll make an updated build and close this issue.

UPDATE: Apparently this happens because Tkinter never adds the event to its message queue, so the semaphore is never released. Now to figure out why that is...

UPDATE 2: Apparently I've been mistaken; the way I generate the event also isn't allowed to be called outside the thread, so that's why it fails. Will look at alternative solutions.

[Comment created by eq_tolbin: 2015-02-28] I tried most of the packs in the list, Spacefox, wanderlust, afro etc. Phoebus seems to be the default pack since it's colored green.

There are no error messages that I can see. Nothing happens when pressing the "install graphics" button. Output log is empty after trying to install the graphics pack.

[Comment created by Pidgeot: 2015-02-28] Which pack are you trying to install? Do you get any error messages? Is anything shown in File > Output Log after trying to install a pack?

[Comment created by eq_tolbin: 2015-02-28] Yup, that worked, I was able to install the Spacefox graphics by placing that file in the Baselines folder.

I had to press the install button two times. First time it extracted the zip file in the Baselines folder and the second time it installed it. When pressing the button for the second time it asked me to confirm if I wanted to install the graphics.

Thanks for the workaround.

[Comment created by eq_tolbin: 2015-02-28] Hm, it seems the version of PyLNP included in the r2 version of the newb pack creates the "Baselines" folder as does the 0.9.3 version of PyLNP.

When pressing the "Install Graphics" button I see there is a tempfile created in the Baselines folder. The size appears to be 8kB and not growing. I've waited for about 10 minutes and the size doesn't change.

Pressing "Install Graphics" again does nothing.

[Comment created by Pidgeot: 2015-02-28] To work around the issue for now, download this file and place it in the Baselines directory - it will bypass the normal download.

[Comment created by Pidgeot: 2015-02-28] Okay, so after a bit of testing, I think I've narrowed down the problem.

IIRC, @BeauBouchard was still using PyLNP 0.8 before this r2 release, and one of the changes for 0.9 required the creation of a new subfolder in the LNP folder. This folder isn't created automatically in the binaries (commit 3d756af takes care of it, but this has not been put in a binary yet), so that's at least part of the reason it fails.

Please try creating a folder named Baselines (or baselines) in the LNP folder (the one containing folders named about, graphics, defaults, etc.), then try installing a pack.

Normally, you should now be informed that a file needs to be downloaded, and asked to proceed (or, alternatively, you'll just be informed that it's about to happen), as well as show a download status area at the bottom of the window - but it seems like something is preventing all of that from happening. You will need to keep PyLNP open until you see a .zip file in the LNP/Baselines folder; at that point, try installing the pack again. (Before the download is complete, you should expect to see a file starting with tmp in the Baselines directory - as long as this is present, it's still downloading.) Expect this to take a few minutes; if you want a visual progress indicator, download the Windows version of Dwarf Fortress manually and place the ZIP file in the Baselines folder. Once the download is complete, try again, and it should work (I recommend keeping the 0.9.3 PyLNP binary).

In the meantime, I will try to figure out why the UI is failing on Linux...

[Comment created by eq_tolbin: 2015-02-28] Just wanted to let you know that I tried PyLNP 0.9.4 with a new installation of the newb pack and it downloaded and installed graphics without any problems.

Thank you.

[Comment created by Pidgeot: 2015-02-28] Handle cross-thread events more correctly, using Python's queue (fixes #65) Bump version number to 0.9.4

→ <<cset 0ddce7f4e3df>>