def _HideOtherWindows(self): from hydrus.client.gui import ClientGUI for tlw in QW.QApplication.topLevelWidgets(): if isinstance(tlw, ClientGUI.FrameGUI): pass if tlw == self.window(): continue if not isinstance(tlw, (ClientGUITopLevelWindows.Frame, ClientGUITopLevelWindows.MainFrame, ClientGUITopLevelWindows.NewDialog)): continue if ClientGUIFunctions.IsQtAncestor(self, tlw, through_tlws=True): continue if isinstance(tlw, ClientGUI.FrameGUI) and not self._hide_main_gui: continue if not tlw.isVisible() or tlw.isMinimized(): continue tlw.hide() self._windows_hidden.append(tlw)
def keyPressEvent( self, event ): ( modifier, key ) = ClientGUIShortcuts.ConvertKeyEventToSimpleTuple( event ) current_focus = QW.QApplication.focusWidget() event_from_us = current_focus is not None and ClientGUIFunctions.IsQtAncestor( current_focus, self ) if event_from_us and key == QC.Qt.Key_Escape: self._TryEndModal( QW.QDialog.Rejected ) else: QP.Dialog.keyPressEvent( self, event )