Python Forum
Correct/proper way to create save files
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Correct/proper way to create save files
#1
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!
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Compare 2 files for duplicates and save the differences cubangt 2 917 Sep-12-2024, 03:55 PM
Last Post: cubangt
  Pyserial issues with proper loops and binary jttolleson 16 5,564 Nov-02-2023, 08:39 PM
Last Post: deanhystad
  how to save to multiple locations during save cubangt 1 1,256 Oct-23-2023, 10:16 PM
Last Post: deanhystad
  change directory of save of python files akbarza 3 3,250 Jul-23-2023, 08:30 AM
Last Post: Gribouillis
  does not save in other path than opened files before icode 3 2,764 Jun-23-2023, 07:25 PM
Last Post: snippsat
  Create new folders and copy files cocobolli 3 4,174 Mar-22-2023, 10:23 AM
Last Post: Gribouillis
  Getting proper x,y axis values pyhill00 8 3,687 Jul-29-2022, 06:48 PM
Last Post: pyhill00
  How to save files in a separate directory Scordomaniac 3 13,810 Mar-16-2022, 10:17 AM
Last Post: Gribouillis
  Proper way to do the OR statement? Mark17 5 2,781 Mar-01-2022, 01:54 PM
Last Post: Mark17
  Python code to read second line from CSV files and create a master CSV file sh1704 1 3,435 Feb-13-2022, 07:13 PM
Last Post: menator01

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020