1.1 --- a/OpenSecurity/bin/ui/credentials_dialog.py Tue Sep 30 13:06:37 2014 +0200
1.2 +++ b/OpenSecurity/bin/ui/credentials_dialog.py Thu Oct 02 13:18:22 2014 +0200
1.3 @@ -34,6 +34,11 @@
1.4
1.5 import sys
1.6
1.7 +if sys.platform == 'win32' or sys.platform == 'cygwin':
1.8 + import win32api
1.9 + import win32con
1.10 + import win32gui
1.11 +
1.12 from PyQt4 import QtCore
1.13 from PyQt4 import QtGui
1.14
1.15 @@ -71,6 +76,12 @@
1.16 size = self.geometry()
1.17 self.move((screen.width() - size.width()) / 2, (screen.height() - size.height()) / 2)
1.18
1.19 + t = QtCore.QTimer(self)
1.20 + t.timeout.connect(self.force_foreground)
1.21 + t.setInterval(0)
1.22 + t.setSingleShot(True)
1.23 + t.start()
1.24 +
1.25
1.26 def clicked_about(self):
1.27
1.28 @@ -92,6 +103,17 @@
1.29 self.accept()
1.30
1.31
1.32 + def force_foreground(self):
1.33 +
1.34 + """Force ourselves into foreground"""
1.35 + if sys.platform == 'win32' or sys.platform == 'cygwin':
1.36 + w = self
1.37 + while not w.nativeParentWidget() is None:
1.38 + w = w.nativeParentWidget()
1.39 + win32gui.BringWindowToTop(int(w.effectiveWinId()))
1.40 + win32gui.SetForegroundWindow(int(w.effectiveWinId()))
1.41 +
1.42 +
1.43 def set_user_text(user_text):
1.44
1.45 """Set a text to explain which credentials we need."""
1.46 @@ -99,6 +121,8 @@
1.47
1.48
1.49 if __name__ == "__main__":
1.50 + if sys.platform == 'win32' or sys.platform == 'cygwin':
1.51 + win32gui.SystemParametersInfo(win32con.SPI_SETFOREGROUNDLOCKTIMEOUT, 0, win32con.SPIF_SENDWININICHANGE | win32con.SPIF_UPDATEINIFILE)
1.52 a = QtGui.QApplication(sys.argv)
1.53 d = CredentialsDialog()
1.54 d.show()
2.1 --- a/OpenSecurity/bin/ui/keyfile_dialog.py Tue Sep 30 13:06:37 2014 +0200
2.2 +++ b/OpenSecurity/bin/ui/keyfile_dialog.py Thu Oct 02 13:18:22 2014 +0200
2.3 @@ -35,6 +35,11 @@
2.4 import base64
2.5 import sys
2.6
2.7 +if sys.platform == 'win32' or sys.platform == 'cygwin':
2.8 + import win32api
2.9 + import win32con
2.10 + import win32gui
2.11 +
2.12 from PyQt4 import QtCore
2.13 from PyQt4 import QtGui
2.14
2.15 @@ -76,6 +81,12 @@
2.16 size = self.geometry()
2.17 self.move((screen.width() - size.width()) / 2, (screen.height() - size.height()) / 2)
2.18
2.19 + t = QtCore.QTimer(self)
2.20 + t.timeout.connect(self.force_foreground)
2.21 + t.setInterval(0)
2.22 + t.setSingleShot(True)
2.23 + t.start()
2.24 +
2.25
2.26 def clicked_about(self):
2.27
2.28 @@ -118,6 +129,17 @@
2.29 self.accept()
2.30
2.31
2.32 + def force_foreground(self):
2.33 +
2.34 + """Force ourselves into foreground"""
2.35 + if sys.platform == 'win32' or sys.platform == 'cygwin':
2.36 + w = self
2.37 + while not w.nativeParentWidget() is None:
2.38 + w = w.nativeParentWidget()
2.39 + win32gui.BringWindowToTop(int(w.effectiveWinId()))
2.40 + win32gui.SetForegroundWindow(int(w.effectiveWinId()))
2.41 +
2.42 +
2.43 def set_user_text(user_text):
2.44
2.45 """Set a text to explain which password we need."""
2.46 @@ -125,6 +147,8 @@
2.47
2.48
2.49 if __name__ == "__main__":
2.50 + if sys.platform == 'win32' or sys.platform == 'cygwin':
2.51 + win32gui.SystemParametersInfo(win32con.SPI_SETFOREGROUNDLOCKTIMEOUT, 0, win32con.SPIF_SENDWININICHANGE | win32con.SPIF_UPDATEINIFILE)
2.52 a = QtGui.QApplication(sys.argv)
2.53 d = KeyfileDialog()
2.54 d.show()
3.1 --- a/OpenSecurity/bin/ui/password_dialog.py Tue Sep 30 13:06:37 2014 +0200
3.2 +++ b/OpenSecurity/bin/ui/password_dialog.py Thu Oct 02 13:18:22 2014 +0200
3.3 @@ -34,6 +34,11 @@
3.4
3.5 import sys
3.6
3.7 +if sys.platform == 'win32' or sys.platform == 'cygwin':
3.8 + import win32api
3.9 + import win32con
3.10 + import win32gui
3.11 +
3.12 from PyQt4 import QtCore
3.13 from PyQt4 import QtGui
3.14
3.15 @@ -70,6 +75,12 @@
3.16 screen = QtGui.QDesktopWidget().screenGeometry()
3.17 size = self.geometry()
3.18 self.move((screen.width() - size.width()) / 2, (screen.height() - size.height()) / 2)
3.19 +
3.20 + t = QtCore.QTimer(self)
3.21 + t.timeout.connect(self.force_foreground)
3.22 + t.setInterval(0)
3.23 + t.setSingleShot(True)
3.24 + t.start()
3.25
3.26
3.27 def clicked_about(self):
3.28 @@ -89,6 +100,17 @@
3.29 self.accept()
3.30
3.31
3.32 + def force_foreground(self):
3.33 +
3.34 + """Force ourselves into foreground"""
3.35 + if sys.platform == 'win32' or sys.platform == 'cygwin':
3.36 + w = self
3.37 + while not w.nativeParentWidget() is None:
3.38 + w = w.nativeParentWidget()
3.39 + win32gui.BringWindowToTop(int(w.effectiveWinId()))
3.40 + win32gui.SetForegroundWindow(int(w.effectiveWinId()))
3.41 +
3.42 +
3.43 def set_user_text(user_text):
3.44
3.45 """Set a text to explain which password we need."""
3.46 @@ -96,8 +118,11 @@
3.47
3.48
3.49 if __name__ == "__main__":
3.50 + if sys.platform == 'win32' or sys.platform == 'cygwin':
3.51 + win32gui.SystemParametersInfo(win32con.SPI_SETFOREGROUNDLOCKTIMEOUT, 0, win32con.SPIF_SENDWININICHANGE | win32con.SPIF_UPDATEINIFILE)
3.52 a = QtGui.QApplication(sys.argv)
3.53 d = PasswordDialog()
3.54 + d.setWindowModality(QtCore.Qt.ApplicationModal)
3.55 d.show()
3.56 sys.exit(a.exec_())
3.57