Autosave on exit

Bug #188905 reported by Bruno Bord
2
Affects Status Importance Assigned to Milestone
PyRoom
Fix Released
High
Florian Heinle

Bug Description

The program should ask if the user wants to save currently modified file(s) before shutting down.

Tags: hig usability
Bruno Bord (brunobord)
Changed in pyroom:
importance: Undecided → High
markino (marco-crosio)
Changed in pyroom:
assignee: nobody → marco-crosio
status: New → In Progress
Revision history for this message
Adam Rooke (abelianr) wrote :

Imagine this would be something of the form:

    def quit(self):
        if self.check_for_save():
                save buffers
                quit
        else:
                quit

        """ quit pyroom """

        gtk.main_quit()

def check_for_save(self):
        if buffers can undo or redo:
                dialogue: unsaved buffers do you want to save them or quit (return true or false)

Revision history for this message
Bruno Bord (brunobord) wrote :

Adam: I saw you've created a branch fixing this bug.

https://code.launchpad.net/~adamrooke/pyroom/check-for-save

Could you:

* link this bug to the branch in LP (and vice-versa)
* report here when the bug is fixed in this branch.

After that, I could merge your code to the trunk.

Many thanks.

Revision history for this message
Adam Rooke (abelianr) wrote :

Think I have a pretty decent fix for this bug now. The code isn't very pretty and I'm sure there are ways it can be made more efficent, but anyway, the fix does the following:
-on closing the main window scans through the buffers and detects if any are modified. If there are some modified asks the user if they want those files saving.
-on close a buffer with ctrl-w if it is modified asks the user if they want to save it.

Maybe there should be an option so that a user can choose if they want this feature enabled or disabled, or maybe a quiet mode where it automatically saves files.

Adam Rooke (abelianr)
Changed in pyroom:
status: In Progress → Fix Released
Adam Rooke (abelianr)
Changed in pyroom:
status: Fix Released → In Progress
Revision history for this message
Bruno Bord (brunobord) wrote :

since the code-reorganise branch has been merged into trunk, shall we close this?

Revision history for this message
Jérôme Guelfucci (jerome-guelfucci-deactivatedaccount) wrote :

I think there are still several problems with the current code :
- there is no "cancel" button on the dialog, one has to click on escape.
- when the "no" option is chosen, I get:

Traceback (most recent call last):
  File "/home/jerome/Ubuntu/Pyroom/trunk/basic_edit.py", line 120, in key_press_event
    bindings[event.keyval]()
  File "/home/jerome/Ubuntu/Pyroom/trunk/basic_edit.py", line 330, in quit
    check_unsaved.save_unsaved_on_exit(self)
  File "/home/jerome/Ubuntu/Pyroom/trunk/check_unsaved.py", line 46, in save_unsaved_on_exit
    if buffer.filename == FILE_UNNAMED:
NameError: global name 'FILE_UNNAMED' is not defined

Revision history for this message
Adam Rooke (abelianr) wrote :

Saw that file unnamed bug earlier and fixed it. Will push it later.

Will try and put a cancel button on later...its trickier than it sounds :-)

Revision history for this message
Florian Heinle (tiax) wrote :

fixed in rev 77

Changed in pyroom:
assignee: marco-crosio → tiax
status: In Progress → Fix Committed
Adam Rooke (abelianr)
Changed in pyroom:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.