Skip to content

Commit

Permalink
Tried to fix multiple windows and disappearing icon after pairing #16
Browse files Browse the repository at this point in the history
  • Loading branch information
rogama25 committed Apr 11, 2021
1 parent 142d2c0 commit 8ec6208
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/UBUVoiceAssistant/GUI/link_mycroft.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,8 @@ def hide_all_elements(self):

def closeEvent(self, event: QtGui.QCloseEvent) -> None:
if self.done:
self.closed_signal.emit() # type: ignore
self.closed_signal.emit()
time.sleep(2) # type: ignore
event.accept()
else:
self.close_window = MessageBox(_("Are you sure?"))
Expand Down
10 changes: 7 additions & 3 deletions src/UBUVoiceAssistant/GUI/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ def __init__(self):
self.btnLogin.clicked.connect(self.on_login)
self.update_texts()
self.mycroft_started = False
self.finished = False
self.timer = QtCore.QTimer()
self.timer.timeout.connect(self.check_mycroft_started)
self.show()
Expand Down Expand Up @@ -138,15 +139,18 @@ def check_mycroft_started(self):
self.timer.stop()
self.starting_window.done = True
self.starting_window.close()
print("Pairing file:", path.isfile(path.expanduser("~/.mycroft/identity/identity2.json")))
if not path.isfile(path.expanduser("~/.mycroft/identity/identity2.json")):
self.new_window = LinkMycroft(self.bus)
self.new_window.show()
self.hide()
self.new_window.closed_signal.connect(self.check_mycroft_started)
else:
self.new_window = ChatWindow(self.bus, self.ws)
self.new_window.show()
self.hide()
if not self.finished:
self.new_window = ChatWindow(self.bus, self.ws)
self.new_window.show()
self.hide()
self.finished = True

def set_reconnect_1s(self, event = None):
print("Set reconnect time")
Expand Down

0 comments on commit 8ec6208

Please sign in to comment.