From f897c7ce8d1250fcff381623c5b60f0c6337f33f Mon Sep 17 00:00:00 2001 From: ingvar1995 Date: Mon, 27 Mar 2017 00:04:32 +0300 Subject: [PATCH] unlock screen crash fixed --- toxygen/main.py | 13 +++++++++---- toxygen/settings.py | 1 + 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/toxygen/main.py b/toxygen/main.py index a4c3ddc..8c51fd2 100644 --- a/toxygen/main.py +++ b/toxygen/main.py @@ -238,19 +238,24 @@ class Toxygen: exit = m.addAction(QtGui.QApplication.translate('tray', 'Exit', None, QtGui.QApplication.UnicodeUTF8)) def show_window(): + s = Settings.get_instance() + def show(): if not self.ms.isActiveWindow(): self.ms.setWindowState(self.ms.windowState() & ~QtCore.Qt.WindowMinimized | QtCore.Qt.WindowActive) self.ms.activateWindow() self.ms.show() - if not Settings.get_instance().locked: + if not s.locked: show() else: def correct_pass(): show() - Settings.get_instance().locked = False - self.p = UnlockAppScreen(toxes.ToxES.get_instance(), correct_pass) - self.p.show() + s.locked = False + s.unlockScreen = False + if not s.unlockScreen: + s.unlockScreen = True + self.p = UnlockAppScreen(toxes.ToxES.get_instance(), correct_pass) + self.p.show() def tray_activated(reason): if reason == QtGui.QSystemTrayIcon.DoubleClick: diff --git a/toxygen/settings.py b/toxygen/settings.py index 21b5431..9604250 100644 --- a/toxygen/settings.py +++ b/toxygen/settings.py @@ -35,6 +35,7 @@ class Settings(dict, Singleton): smileys.SmileyLoader(self) self.locked = False self.closing = False + self.unlockScreen = False p = pyaudio.PyAudio() input_devices = output_devices = 0 for i in range(p.get_device_count()):