Baby steps[python]: Gamejectder

Yes, that sounds like the problem. When starting applications from Tracker, they run with /boot/home as the current directory, which means relative paths won’t work. You can use the way that Begasus pointed to change to the current directory, or, what’s probably better for a native app, you would store the png and other data in resources (accessed with BResource) directly inside the executable, instead of separate files. But I don’t know if that’s possible from Python.

Good day,

Well, I did the test @Starcrasher pointed out, launching from /home directory through the Terminal and the issue is there too. So the issue is there.

Actually, I presumably added the image files in the ‘setup.py’ file:

data_files=[
    ('icons', [
        'gamejectder/xtra/icons/BaseFolder-mod.rdef',
        'gamejectder/xtra/icons/BaseFolder.rdef',
        'gamejectder/xtra/icons/BaseProject.rdef',
        'gamejectder/xtra/icons/Final.rdef',
        'gamejectder/xtra/icons/Final.rsrc',
        'gamejectder/xtra/icons/WorkInProgress.rdef',
        'gamejectder/xtra/icons/WorkInProgress.rsrc'
    ]),
    ('images', ['gamejectder/xtra/images/gamejectder-about.png'])
],

Though I presume it’s not working properly, most likely because I need to do more research on Python (among other things, how setuptools works), Cython and Haiku. Just need time to get on with it. I think I need to rethink the folder structure of the project and research more about paths.

The method of adding data into resources inside execs, as @PulkoMandy said should be the way to go, but I presume Python does not work like that, and I thought what the setup.py file would take care of it. It seems it doesn’t. More research needed.

Checking out what @Begasus pointed out, seems that it could be the way to go, adapting it to the Python code. Getting the path instead of coding the path. I’ll add the changes and check the result, and try to improve the setup.py file in order to get it to do what “I want”. :sweat_smile:

I also checked the crash report, as @donn said, but I had never done any debugging before, so I just look at the text inside the file and feel like some witches are flying around my head doing crazy things… :rofl:
Can’t find anything that relates to the images inside the text file, though it might be written in a way that looks like swahili to me. Again, more time to learn about this.

Well, Python, Cython, Haiku, Git, Debug… plenty of stuff to research and keep me busy when I get free time slot… :laughing:

Don’t give up. We’ll get there.

Thanks all.
Regards,
RR

Well, looks like there is also this in Python, found out just now (importlib.resources). Will add the proper code next time Haiku gets a freetime slot and see what happens.

Thanks,
Regards,
RR

Good day,

Finally I got some freetime slot for Haiku and came back to the research on Python, PyQt, Cython… to try to get things working. Here is the result:

Gamejectder

All right. The image shows “SUCCESS!”.

Gamejectder, the Python application, is launched with double click from the folder Gamejectder that is shown in the image. Its icon appears on the Deskbar, the Application ‘logo’ appears in the About dialog (need to change the name of the About Dialog though), and creates all the folders with their assigned colors.

Now, this success is partial. I still have to clean up the code and finish up some things. Besides, I presume there is a better way to keep the libraries together instead of having a bunch of .so files running around.

I made a big mistake here, trying to get all .rdef files used for the icons inside the application. It didn’t work. Finally I opted to generate the .rdef files and their .rsrc at runtime in a temporary folder inside /home/config/settings. This approach seemed more reasonable and, as after the process completion, the app does a cleanup of that folder, so no trace left, and no crap left polluting the /home/config/settings folder. Why didn’t I think about this before… :rofl: :rofl: :rofl:

Regarding the About window image, I used the importlib.resources (I found about it just recently), but the image is not packed, is kept as is, just as a PNG file. I presume there is another way to do this, though not sure yet. Still needs research, though for now, this approach works. The Terminal window in the image shows the files that make the program where each .so file matches a python module (.py file). I have to test if I can pack them all together into a single .so library.

Now I have to put some order into all notes I took to get here, clean the notes up, verify everything again, and then replicate the process with another single application that is waiting inside the drawer.
Hopefully this new one will take less time.

Also, I have to merge this changes into the branch without messing anything :scream: :scream: :scream:, and prepare an hpkg for others to test.

In the end, should move away from Qt, and get into the Native API. That will take longer. :slightly_smiling_face:

Well, this is another baby step. Let’s keep walking.

Thanks all.
Regards,
RR

1 Like

Maybe /home/config/cache would be a better place than /home/config/settings to generate files?

I give you a tip, i do this too. Create a project folder for Settings in /boot/home/config/settings and a user project folder in /boot/home. Here you can save project files and temp files. If you want that people can make your folder not visible add a . in front of it (like our one /boot/home/.besly)

Please do not use dot-folders, they arent Haiku conform.

Yes. Best use something like finddir B_SYSTEM_TEMP_DIRECTORY (or B_SYSTEM_CACHE_DIRECTORY if the files are supposed to be kept for a while). Or their USER counterparts.

Why? In development Status of haiku this option is deactivated. But it is present sience be OS (haiku user guide tracker - hide dotfiles).

If every one place there user files in home you get mass of files and folders, then i am happy to make them not viewable.

Because that are Haiku rules. And to be honest it is a good thing.
Config files obviously should never be hidden.
Grouping cache files or tmp files helps to find them if necessary. Sometimes, you need to wipe manually cache of an app for example. It is also useful to monitor resources used.
When people have an hidden folder, they are putting all kinds of files in without wondering if there’s a better place and it soon becomes a mess. Even if there’s a little progress and they try to group things, see what happens on a linux distrib. I wouldn’t want my Haiku Home folder to look like that.

2 Likes

This is true, and we have a menu option to open this folders.

Because dotfolders are an ugly unix hack and we try to not litter all around in the users homefolder. There are specific folders for cache/data/settings/etc. use them instead.

If it is not already around, do a tutorial for developers to inform about this information (and more if this is needed)