Commit 1c83eca5 authored by Antoine Lima's avatar Antoine Lima

Fixed exessive keyboard grab

parent 35fca230
......@@ -48,7 +48,7 @@ class MainWin(QtWidgets.QMainWindow):
self.ui.panels.setCurrentIndex(0)
self.ui.panels.currentWidget().setFocus()
self.ui.panels.currentWidget().grabKeyboard()
self.ui.panels.setFocusProxy(self.ui.panels.currentWidget())
self.ui.panels.currentWidget().load()
self.displaySystemTime()
self.startTimer(1000)
......
......@@ -32,19 +32,20 @@ class Module(QtWidgets.QWidget):
logging.error('Unknown panel {}'.format(new_type))
else:
# Unfocus the current module
self.mainwin.ui.panels.currentWidget().releaseKeyboard()
if QApplication.focusWidget() != None:
QApplication.focusWidget().clearFocus()
# Swap modules by unloading, changing the ui then loading
self.mainwin.modules[curmod_idx].unload()
self.mainwin.ui.panels.setCurrentIndex(newmod_idx)
self.mainwin.ui.panels.setFocusProxy(self.mainwin.modules[newmod_idx])
self.mainwin.modules[newmod_idx].setFocus()
self.mainwin.modules[newmod_idx].load()
# Select first element of the Module
self.mainwin.modules[newmod_idx].focusNextChild()
self.mainwin.modules[newmod_idx].focusPreviousChild()
self.mainwin.modules[newmod_idx].grabKeyboard()
self.mainwin.modules[newmod_idx].focusPreviousChild()
def send(self, to, **kwargs):
mod_idx = self.mainwin.findMod(to)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment