PyUnit/UnittestDialog.py

branch
5_1_x
changeset 1485
b0d0ddac7012
parent 1001
c4aa6e1a23b7
child 1493
876e068d632d
--- a/PyUnit/UnittestDialog.py	Sat Dec 10 14:01:44 2011 +0100
+++ b/PyUnit/UnittestDialog.py	Sat Dec 10 13:59:28 2011 +0100
@@ -38,14 +38,17 @@
     """
     unittestFile = pyqtSignal(str, int, int)
     
-    def __init__(self,prog = None,dbs = None,ui = None,parent = None,name = None):
+    def __init__(self, prog = None, dbs = None, ui = None, fromEric = False,
+                 parent = None, name = None):
         """
         Constructor
         
         @param prog filename of the program to open
         @param dbs reference to the debug server object. It is an indication
-                whether we were called from within the eric5 IDE
+            whether we were called from within the eric5 IDE
         @param ui reference to the UI object
+        @param fromEric flag indicating an instantiation from within the
+            eric IDE (boolean)
         @param parent parent widget of this dialog (QWidget)
         @param name name of this dialog (string)
         """
@@ -70,6 +73,7 @@
         self.startButton.setDefault(True)
         
         self.dbs = dbs
+        self.__fromEric = fromEric
         
         self.setWindowFlags(
             self.windowFlags() | Qt.WindowFlags(Qt.WindowContextHelpButtonHint))
@@ -104,7 +108,16 @@
             self.dbs.utStopTest.connect(self.testFinished)
             self.dbs.utTestFailed.connect(self.testFailed)
             self.dbs.utTestErrored.connect(self.testErrored)
+    
+    def keyPressEvent(self, evt):
+        """
+        Protected slot to handle key press events.
         
+        @param evt key press event to handle (QKeyEvent)
+        """
+        if evt.key() == Qt.Key_Escape and self.__fromEric:
+            self.close()
+    
     def __setProgressColor(self, color):
         """
         Private methode to set the color of the progress color label.

eric ide

mercurial