Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a 'save as' function to the file menu #89

Closed
ma19fr opened this issue Jan 22, 2017 · 4 comments
Closed

Add a 'save as' function to the file menu #89

ma19fr opened this issue Jan 22, 2017 · 4 comments
Labels
DNA GUI Issues related to the graphical user interface feature request

Comments

@ma19fr
Copy link

ma19fr commented Jan 22, 2017

The auto-save function is not always helpful - especially if you can not choose a different file to save-as in the beginning.

Maybe it is possible, that DNA saves the file in a backup-file and before you close a it, DNA asks to save it separately.

@leifeld
Copy link
Owner

leifeld commented Jan 22, 2017

Data are saved automatically in DNA 2.0 because the data architecture is different compared to DNA 1.32. The data used to be saved in an XML-based text file. XML is serial. This means it is only possible to save everything at once or nothing at all. The new file format is an SQL or SQLite database. In relational databases, you don't overwrite files but rather connect to the database and execute SQL commands. Thus, every action is committed to the database as it occurs. This is necessary because it permits concurrent database access by multiple users. If there are two users, A and B, and A's actions are not saved for a while, then B may be operating on an outdated version of the file. Therefore team work, which is at the core of the new data architecture, requires instantaneous saving of all changes.

That said, I may be able to add a backup function, which automatically stores a complete copy of the current database. However, this is only possible with file-based databases, not with remote SQL access. Alternatively, I could ask the user if a backup copy should be saved. Optionally, additional backups could be created every n minutes or hours or once a day or something like that, but it's not clear how that would work without completely filling up the hard drive. Input on this would be appreciated.

Additionally, a save-as function could be added to the file menu, which would simply create a copy of the file (like the backup, but the user can determine the file name).

Let me know what you think makes most sense, and I'll consider it.

@ma19fr
Copy link
Author

ma19fr commented Jan 22, 2017

Thank you for the detailed answer - that all makes sense!
I wasn't thinking about multiple users and didn't use a SQL database before...

Still, I think a save-as function could be helpful (especially if you are not working with multiple users).

Is it possible to add an undo-function? That would help a lot (sometimes) and would relativize the auto-save function.

@leifeld
Copy link
Owner

leifeld commented Jan 22, 2017

OK, I'll take note of the 'save as' function and implement it when I'm done with some of the other stuff.

An undo function would be great, but it is a hell of a lot of work to create, so I won't prioritize this for now. I think it's more important to get the export functions up to speed right now. There was a previous issue (#26) on the topic of undo/redo functionality, but already then I decided it was too much work and shouldn't be prioritized. To implement it, one would basically have to write a class that represents all actions (such as adding or deleting a document, updating meta-data, adding/deleting/modifying coders, updating the attribute manager, adding/deleting/updating statements etc.) in an abstract way, and then build a data structure where these instances are put on two different stacks, one for committing them and one for reverting them. So that would really require some thorough changes...

@leifeld leifeld changed the title Auto-save Add a 'save as' function to the file menu Jan 22, 2017
@leifeld leifeld added DNA GUI Issues related to the graphical user interface and removed version 2.0 labels Feb 17, 2019
@leifeld
Copy link
Owner

leifeld commented Jan 17, 2022

DNA 3.0 is in preparation. I have revisited the issue while redesigning the architecture of DNA. Unfortunately, it does not seem like a viable option at this point. It would not be practical for multiple coders, and DNA 3.0 focuses on this using remote databases. It also creates much bigger complexity in the code. I made a first attempt at implementing an event stack for any database changes in order to make them accessible for undo, redo, and save functions. But it got so complicated in the end that it was just not worth it.

However, there are two other new functionalities that may at least mitigate the problem somewhat. First, in DNA 3.0 it will be possible to show window decoration around the statement popup windows, which means you can save or cancel changes in statements. This should come in handy if you start editing a statement and then forget what was previously written in one of the variables. In that case, you can just cancel and get the old value back. Second, there will be a message log. It records all database changes you make, and you should be able to look at this record to see when you did what. It's possible to export the log file in XML or JSON format as well. So not quite what you are asking for, but perhaps helpful.

@leifeld leifeld closed this as completed Jan 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
DNA GUI Issues related to the graphical user interface feature request
Projects
None yet
Development

No branches or pull requests

2 participants