Python Forum

Full Version: Correct/proper way to create save files
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I'm not sure I've designed my app correctly/properly. It works, but should I have done it differently?

I've got two questions but my Flatpak question is probably for another day/post/forum.

It's a basic bookkeeping app using Gtk, Python, sqlite3 and packaged up and run using Flatpak. Up until a few days ago I used Flatseal to allow all Flatpak apps access to /home (filesystem=home). Everything worked well and as I expected.

This is what happens when the app is used...
When a user starts the app they need to create a new database, ie. /home/user/new_database.sqlite3
My app has a 'save' button. When new_database.sqlite3 is created there is also a copy created as /home/user/.my_app/new_database/working
Any interactions in the app are applied to the 'working' file. If the user clicks 'save' then that working file is copied to new_database.sqlite3.

I've also included a snapshot feature so a user can go back in time to any previous save. These snapshots are saved alongside the 'working' file but with a datetime added to the filename.

Would this be a correct/proper way of doing what I want the app to do? Since learning Python I've found lot's of help in how to write Python but not so much on how to write/design an app, if that makes sense.

My Flatpak query is related to new_database.sqlite3 now (since disabling filesystem=home) being named things like .xdp-new_database.sqlite3-6znxzN whereas 'working' is still 'working' and the snapshots are still new_database+datetime. I realise it's because of sandboxing and I'm reading up on portals etc but I'd be less confused if 'working' and the snapshots were also renamed.

Thank you for any help!