1 from __future__
import division, print_function, absolute_import
4 from PyQt5.QtCore
import Qt
5 from PyQt5
import uic, QtWidgets
6 from thread_qt
import WifiThread
8 qtCreatorFile =
"mainwindow.ui" 9 Ui_MainWindow, QtBaseClass = uic.loadUiType(qtCreatorFile)
13 QtWidgets.QMainWindow.__init__(self)
14 Ui_MainWindow.__init__(self)
17 self.status_label.setAutoFillBackground(
True)
20 self.status_palette_connected.setColor(self.status_label.backgroundRole(), Qt.green)
21 self.status_palette_connected.setColor(self.status_label.foregroundRole(), Qt.black)
24 self.status_palette_disconnected.setColor(self.status_label.backgroundRole(), Qt.yellow)
25 self.status_palette_disconnected.setColor(self.status_label.foregroundRole(), Qt.black)
28 self.status_palette_paused.setColor(self.status_label.backgroundRole(), Qt.gray)
29 self.status_palette_paused.setColor(self.status_label.foregroundRole(), Qt.black)
32 self.wifi_thread.updated.connect(self.
handler)
33 self.wifi_thread.start()
36 if self.wifi_thread.wifi_active:
37 text = self.wifi_thread.wifi_ssid
40 text =
'no connection' 43 self.status_label.setPalette(palette);
44 self.status_label.setText(text)
46 if __name__ ==
"__main__":
47 app = QtWidgets.QApplication(sys.argv)
status_palette_disconnected