unlock screen crash fixed

This commit is contained in:
ingvar1995 2017-03-27 00:04:32 +03:00
parent ba390eda91
commit f897c7ce8d
2 changed files with 10 additions and 4 deletions

View File

@ -238,19 +238,24 @@ class Toxygen:
exit = m.addAction(QtGui.QApplication.translate('tray', 'Exit', None, QtGui.QApplication.UnicodeUTF8)) exit = m.addAction(QtGui.QApplication.translate('tray', 'Exit', None, QtGui.QApplication.UnicodeUTF8))
def show_window(): def show_window():
s = Settings.get_instance()
def show(): def show():
if not self.ms.isActiveWindow(): if not self.ms.isActiveWindow():
self.ms.setWindowState(self.ms.windowState() & ~QtCore.Qt.WindowMinimized | QtCore.Qt.WindowActive) self.ms.setWindowState(self.ms.windowState() & ~QtCore.Qt.WindowMinimized | QtCore.Qt.WindowActive)
self.ms.activateWindow() self.ms.activateWindow()
self.ms.show() self.ms.show()
if not Settings.get_instance().locked: if not s.locked:
show() show()
else: else:
def correct_pass(): def correct_pass():
show() show()
Settings.get_instance().locked = False s.locked = False
self.p = UnlockAppScreen(toxes.ToxES.get_instance(), correct_pass) s.unlockScreen = False
self.p.show() if not s.unlockScreen:
s.unlockScreen = True
self.p = UnlockAppScreen(toxes.ToxES.get_instance(), correct_pass)
self.p.show()
def tray_activated(reason): def tray_activated(reason):
if reason == QtGui.QSystemTrayIcon.DoubleClick: if reason == QtGui.QSystemTrayIcon.DoubleClick:

View File

@ -35,6 +35,7 @@ class Settings(dict, Singleton):
smileys.SmileyLoader(self) smileys.SmileyLoader(self)
self.locked = False self.locked = False
self.closing = False self.closing = False
self.unlockScreen = False
p = pyaudio.PyAudio() p = pyaudio.PyAudio()
input_devices = output_devices = 0 input_devices = output_devices = 0
for i in range(p.get_device_count()): for i in range(p.get_device_count()):