Skip to content
This repository

Cancel in qt console closeevent should trigger event.ignore() #933

Closed
wants to merge 1 commit into from

3 participants

Jens H Nielsen Min RK Evan Patterson
Jens H Nielsen

When quitting ipython using for example the file quit option ipython quits even if you press cancel.
This pull request fixes that by inserting event.ignore() in the code the runs when cancel is pressed
and indenting the event.accept() so that it is only triggered when the yes button is pressed.

From the qt documentation and tutorials that I could find this seems to be the right way of using closeevent.

Min RK
Owner

makes sense.

Evan Patterson
Collaborator

I committed this without a merge, but GitHub hasn't clued in. Thanks for the fix!

Evan Patterson epatters closed this October 26, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 1 unique commit by 1 author.

Oct 26, 2011
Jens H Nielsen Make cancel in the close dialog behave right. Triggers event.ignore()…
… when

canceling
e098e43
This page is out of date. Refresh to see the latest.

Showing 1 changed file with 2 additions and 2 deletions. Show diff stats Hide diff stats

  1. 4  IPython/frontend/qt/console/mainwindow.py
4  IPython/frontend/qt/console/mainwindow.py
@@ -835,6 +835,7 @@ def closeEvent(self, event):
835 835
             reply = okay
836 836
         
837 837
         if reply == cancel:
  838
+            event.ignore()
838 839
             return
839 840
         if reply == okay:
840 841
             while self.tab_widget.count() >= 1:
@@ -842,6 +843,5 @@ def closeEvent(self, event):
842 843
                 widget = self.active_frontend
843 844
                 widget._confirm_exit = False
844 845
                 self.close_tab(widget)
845  
-        
846  
-        event.accept()
  846
+            event.accept()
847 847
 
Commit_comment_tip

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.