Example #1
0
 def on_buttonBox_rejected(self):
     # If there are any changes to the data, ask the user to save them
     if self.tree_view.model().dirty:
         question = 'Do you want to save your changes before closing?'
         user_answer = common_dialogs.save_before_close(question)
         if user_answer == common_dialogs.YES:
             self.on_buttonBox_accepted()
         elif user_answer == common_dialogs.NO:
             self.close()
         else:
             return # Cancel
     self.close()
Example #2
0
 def on_buttonBox_rejected(self):
     # If there are any changes to the data, ask the user to save them
     if self.tree_view.model().dirty:
         question = "Do you want to save your changes before closing?"
         user_answer = common_dialogs.save_before_close(question)
         if user_answer == common_dialogs.YES:
             self.on_buttonBox_accepted()
         elif user_answer == common_dialogs.NO:
             pass
         else:
             return  # Cancel
     self.close()
Example #3
0
 def okToCloseProject(self):
     '''
     Called before an operation that causes this project to close.
     If the project contains changes; ask if the user wants to save them,
     discard them or cancel the operation.
     @return: True if the user wishes to proceed with the closing operation.
     '''
     if not self.project.dirty: return True
     question = 'Do you want to save your changes before closing the project?'
     user_answer = common_dialogs.save_before_close(question)
     if user_answer == common_dialogs.YES:
         ok_flag, msg = self.project.save() # cancels on failed save
         if not ok_flag:
             MessageBox.error(self, "Could not save project", str(msg))
             return False
         return True
     elif user_answer == common_dialogs.NO:
         self.project.dirty = False
         return True
     else:
         return False