Sat, 10 Dec 2011 13:59:28 +0100
Added the function to close the unit test dialog by pressing the Esc key.
PyUnit/UnittestDialog.py | file | annotate | diff | comparison | revisions | |
UI/UserInterface.py | file | annotate | diff | comparison | revisions |
--- a/PyUnit/UnittestDialog.py Sat Dec 03 12:28:34 2011 +0100 +++ b/PyUnit/UnittestDialog.py Sat Dec 10 13:59:28 2011 +0100 @@ -40,14 +40,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) """ @@ -72,6 +75,7 @@ self.startButton.setDefault(True) self.dbs = dbs + self.__fromEric = fromEric self.setWindowFlags( self.windowFlags() | Qt.WindowFlags(Qt.WindowContextHelpButtonHint)) @@ -111,7 +115,16 @@ self.dbs.utTestSkipped.connect(self.testSkipped) self.dbs.utTestFailedExpected.connect(self.testFailedExpected) self.dbs.utTestSucceededUnexpected.connect(self.testSucceededUnexpected) + + 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.
--- a/UI/UserInterface.py Sat Dec 03 12:28:34 2011 +0100 +++ b/UI/UserInterface.py Sat Dec 10 13:59:28 2011 +0100 @@ -449,7 +449,8 @@ self.numbersViewer.insertNumber.connect(self.viewmanager.insertNumber) # Generate the unittest dialog - self.unittestDialog = UnittestDialog(None, self.debuggerUI.debugServer, self) + self.unittestDialog = UnittestDialog(None, self.debuggerUI.debugServer, self, + fromEric=True) self.unittestDialog.unittestFile.connect(self.viewmanager.setFileLine) # Generate the find in project files dialog