def __init__(self, parent=0): super(APStatus, self).__init__(parent) self.timer = QtCore.QTimer() self.split_window = QtGui.QHBoxLayout() guageWindow = QtGui.QGridLayout() self.currentThreadLabel = QtGui.QLabel('0') currentthread = self.create_info_box('CURRENT THREADS', 'infor', self.currentThreadLabel) self.sectionTimeLabel = QtGui.QLabel('00:00') currentTime = self.create_info_box('UPTIME', 'infor', self.sectionTimeLabel) guageWindow.addLayout(currentthread, 1, 1) guageWindow.addLayout(currentTime, 0, 1) self.AP_name = QtGui.QLabel( self.FSettings.Settings.get_setting('accesspoint', 'ssid')) self.AP_BSSID = QtGui.QLabel( self.FSettings.Settings.get_setting('accesspoint', 'bssid')) self.AP_Channel = QtGui.QLabel( self.FSettings.Settings.get_setting('accesspoint', 'channel')) self.AP_NetworkApdater = QtGui.QLabel( self.FSettings.Settings.get_setting('accesspoint', 'interfaceAP')) self.AP_ROUTER = QtGui.QLabel( self.FSettings.Settings.get_setting('dhcp', 'router')) self.AP_DHCP_range = QtGui.QLabel( self.FSettings.Settings.get_setting('dhcp', 'range')) self.AP_Security = QtGui.QLabel('') self.update_security_label( self.FSettings.Settings.get_setting('accesspoint', 'enable_Security', format=bool)) self.group_AccessPoint = QtGui.QGroupBox() self.form_window = AutoGridLayout() self.form_window.setSpacing(10) self.group_AccessPoint.setTitle('Access Point') self.form_window.addNextWidget(QtGui.QLabel('AP Name:')) self.form_window.addNextWidget(self.AP_name) self.form_window.addNextWidget(QtGui.QLabel('BSSID:')) self.form_window.addNextWidget(self.AP_BSSID) self.form_window.addNextWidget(QtGui.QLabel('Channel:')) self.form_window.addNextWidget(self.AP_Channel) self.form_window.addNextWidget(QtGui.QLabel('Network Adapter:')) self.form_window.addNextWidget(self.AP_NetworkApdater) self.form_window.addNextWidget(QtGui.QLabel('Router:')) self.form_window.addNextWidget(self.AP_ROUTER) self.form_window.addNextWidget(QtGui.QLabel('DHCP:')) self.form_window.addNextWidget(self.AP_DHCP_range) self.form_window.addNextWidget(QtGui.QLabel('Security Password:')) self.form_window.addNextWidget(self.AP_Security) self.form_window.addItem( QtGui.QSpacerItem(40, 10, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding)) self.group_AccessPoint.setLayout(self.form_window) self.split_window.addWidget(self.group_AccessPoint) self.split_window.addLayout(guageWindow) self.mainlayout.addLayout(self.split_window)
def __init__(self,mainWindow ): QVBoxLayout.__init__(self) self.mainLayout = QFormLayout() self.main_method = mainWindow self.scrollwidget = QWidget() self.scrollwidget.setLayout(self.mainLayout) self.scroll = QScrollArea() self.scroll.setWidgetResizable(True) self.scroll.setWidget(self.scrollwidget) self.split_window = QHBoxLayout() guageWindow = QGridLayout() self.currentThreadLabel = QLabel('0') currentthread = self.create_info_box('CURRENT THREADS', 'infor', self.currentThreadLabel) self.sectionTimeLabel = QLabel('00:00') currentTime = self.create_info_box('UPTIME', 'infor', self.sectionTimeLabel) guageWindow.addLayout(currentthread, 1, 1) guageWindow.addLayout(currentTime, 0, 1) self.AP_name = QLabel(self.main_method.EditApName.text()) self.AP_BSSID = QLabel(self.main_method.EditBSSID.text()) self.AP_Channel = QLabel(self.main_method.EditChannel.text()) self.AP_NetworkApdater = QLabel(self.main_method.selectCard.currentText()) self.AP_ROUTER = QLabel(self.main_method.DHCP['router']) self.AP_DHCP_range = QLabel(self.main_method.DHCP['range']) self.AP_Security = QLabel('') self.update_security_label(self.main_method.GroupApPassphrase.isChecked()) self.group_AccessPoint = QGroupBox() self.form_window = AutoGridLayout() self.form_window.setSpacing(10) self.group_AccessPoint.setTitle('Access Point') self.form_window.addNextWidget(QLabel('AP Name:')) self.form_window.addNextWidget(self.AP_name) self.form_window.addNextWidget(QLabel('BSSID:')) self.form_window.addNextWidget(self.AP_BSSID) self.form_window.addNextWidget(QLabel('Channel:')) self.form_window.addNextWidget(self.AP_Channel) self.form_window.addNextWidget(QLabel('Network Adapter:')) self.form_window.addNextWidget(self.AP_NetworkApdater) self.form_window.addNextWidget(QLabel('Router:')) self.form_window.addNextWidget(self.AP_ROUTER) self.form_window.addNextWidget(QLabel('DHCP:')) self.form_window.addNextWidget(self.AP_DHCP_range) self.form_window.addNextWidget(QLabel('Security Password:')) self.form_window.addNextWidget(self.AP_Security) self.form_window.addItem(QSpacerItem(40, 10, QSizePolicy.Minimum, QSizePolicy.Expanding)) self.group_AccessPoint.setLayout(self.form_window) self.split_window.addWidget(self.group_AccessPoint) self.split_window.addLayout(guageWindow) self.mainLayout.addRow(self.split_window) self.layout = QHBoxLayout() self.layout.addWidget(self.scroll) self.addLayout(self.layout)
class StatusAccessPoint(QtGui.QVBoxLayout): ''' dashboard infor Acccess Point ''' def __init__(self, mainWindow): QtGui.QVBoxLayout.__init__(self) self.mainLayout = QtGui.QFormLayout() self.main_method = mainWindow self.scrollwidget = QtGui.QWidget() self.scrollwidget.setLayout(self.mainLayout) self.scroll = QtGui.QScrollArea() self.scroll.setWidgetResizable(True) self.scroll.setWidget(self.scrollwidget) self.split_window = QtGui.QHBoxLayout() guageWindow = QtGui.QGridLayout() self.currentThreadLabel = QtGui.QLabel('0') currentthread = self.create_info_box('CURRENT THREADS', 'infor', self.currentThreadLabel) self.sectionTimeLabel = QtGui.QLabel('00:00') currentTime = self.create_info_box('UPTIME', 'infor', self.sectionTimeLabel) guageWindow.addLayout(currentthread, 1, 1) guageWindow.addLayout(currentTime, 0, 1) self.AP_name = QtGui.QLabel(self.main_method.EditApName.text()) self.AP_BSSID = QtGui.QLabel(self.main_method.EditBSSID.text()) self.AP_Channel = QtGui.QLabel(self.main_method.EditChannel.text()) self.AP_NetworkApdater = QtGui.QLabel( self.main_method.selectCard.currentText()) self.AP_ROUTER = QtGui.QLabel(self.main_method.DHCP['router']) self.AP_DHCP_range = QtGui.QLabel(self.main_method.DHCP['range']) self.AP_Security = QtGui.QLabel('') self.update_security_label( self.main_method.GroupApPassphrase.isChecked()) self.group_AccessPoint = QtGui.QGroupBox() self.form_window = AutoGridLayout() self.form_window.setSpacing(10) self.group_AccessPoint.setTitle('Access Point') self.form_window.addNextWidget(QtGui.QLabel('AP Name:')) self.form_window.addNextWidget(self.AP_name) self.form_window.addNextWidget(QtGui.QLabel('BSSID:')) self.form_window.addNextWidget(self.AP_BSSID) self.form_window.addNextWidget(QtGui.QLabel('Channel:')) self.form_window.addNextWidget(self.AP_Channel) self.form_window.addNextWidget(QtGui.QLabel('Network Adapter:')) self.form_window.addNextWidget(self.AP_NetworkApdater) self.form_window.addNextWidget(QtGui.QLabel('Router:')) self.form_window.addNextWidget(self.AP_ROUTER) self.form_window.addNextWidget(QtGui.QLabel('DHCP:')) self.form_window.addNextWidget(self.AP_DHCP_range) self.form_window.addNextWidget(QtGui.QLabel('Security Password:'******'router']) self.AP_DHCP_range.setText(self.main_method.DHCP['range']) self.update_security_label( self.main_method.GroupApPassphrase.isChecked()) def start_timer(self): self.timer = QtCore.QTimer() self.now = 0 self.update_timer() self.timer.timeout.connect(self.tick_timer) self.timer.start(1000) def update_timer(self): self.runtime = ('%d:%02d' % (self.now / 60, self.now % 60)) self.sectionTimeLabel.setText(self.runtime) self.currentThreadLabel.setText( str(len(self.main_method.Apthreads['RougeAP']) - 1)) def tick_timer(self): self.now += 1 self.update_timer() def stop_timer(self): self.timer.stop() self.sectionTimeLabel.setText('00:00') self.currentThreadLabel.setText('0') def update_security_label(self, bool): if bool: self.AP_Security.setText('[ON]') self.AP_Security.setStyleSheet('QLabel { color : green; }') else: self.AP_Security.setText('[OFF]') self.AP_Security.setStyleSheet('QLabel { color : #df1f1f; }') def create_info_box(self, labelText, objectName, valueLabel): infoBox = QtGui.QVBoxLayout() infoBox.setSpacing(0) label = QtGui.QLabel(labelText) label.setObjectName('label') valueLabel.setAlignment(QtCore.Qt.AlignCenter) valueLabel.setObjectName(objectName) infoBox.addWidget(label) infoBox.addWidget(valueLabel) return infoBox
class APStatus(HomeDisplay): Name = "AP Status" ID = "APStatus" ''' dashboard infor Acccess Point ''' def __init__(self,parent=0): super(APStatus, self).__init__(parent) self.timer = QtCore.QTimer() self.mainLayout = QtGui.QFormLayout() self.scrollwidget = QtGui.QWidget() self.scrollwidget.setLayout(self.mainLayout) self.scroll = QtGui.QScrollArea() self.scroll.setWidgetResizable(True) self.scroll.setWidget(self.scrollwidget) self.split_window = QtGui.QHBoxLayout() guageWindow = QtGui.QGridLayout() self.currentThreadLabel = QtGui.QLabel('0') currentthread = self.create_info_box('CURRENT THREADS', 'infor', self.currentThreadLabel) self.sectionTimeLabel = QtGui.QLabel('00:00') currentTime = self.create_info_box('UPTIME', 'infor', self.sectionTimeLabel) guageWindow.addLayout(currentthread, 1, 1) guageWindow.addLayout(currentTime, 0, 1) self.AP_name = QtGui.QLabel(self.FSettings.Settings.get_setting('accesspoint', 'ssid')) self.AP_BSSID = QtGui.QLabel(self.FSettings.Settings.get_setting('accesspoint', 'bssid')) self.AP_Channel = QtGui.QLabel(self.FSettings.Settings.get_setting('accesspoint', 'channel')) self.AP_NetworkApdater = QtGui.QLabel(self.FSettings.Settings.get_setting('accesspoint', 'interfaceAP')) self.AP_ROUTER = QtGui.QLabel(self.FSettings.Settings.get_setting('dhcp', 'router')) self.AP_DHCP_range = QtGui.QLabel(self.FSettings.Settings.get_setting('dhcp', 'range')) self.AP_Security = QtGui.QLabel('') self.update_security_label(self.FSettings.Settings.get_setting('accesspoint', 'enable_Security', format=bool)) self.group_AccessPoint = QtGui.QGroupBox() self.form_window = AutoGridLayout() self.form_window.setSpacing(10) self.group_AccessPoint.setTitle('Access Point') self.form_window.addNextWidget(QtGui.QLabel('AP Name:')) self.form_window.addNextWidget(self.AP_name) self.form_window.addNextWidget(QtGui.QLabel('BSSID:')) self.form_window.addNextWidget(self.AP_BSSID) self.form_window.addNextWidget(QtGui.QLabel('Channel:')) self.form_window.addNextWidget(self.AP_Channel) self.form_window.addNextWidget(QtGui.QLabel('Network Adapter:')) self.form_window.addNextWidget(self.AP_NetworkApdater) self.form_window.addNextWidget(QtGui.QLabel('Router:')) self.form_window.addNextWidget(self.AP_ROUTER) self.form_window.addNextWidget(QtGui.QLabel('DHCP:')) self.form_window.addNextWidget(self.AP_DHCP_range) self.form_window.addNextWidget(QtGui.QLabel('Security Password:'******'accesspoint', 'ssid')) self.AP_BSSID.setText(self.FSettings.Settings.get_setting('accesspoint', 'bssid')) self.AP_Channel.setText(self.FSettings.Settings.get_setting('accesspoint', 'channel')) self.AP_NetworkApdater.setText(self.FSettings.Settings.get_setting('accesspoint', 'interfaceAP')) self.AP_ROUTER.setText(self.FSettings.Settings.get_setting('dhcp', 'router')) self.AP_DHCP_range.setText(self.FSettings.Settings.get_setting('dhcp', 'range')) self.update_security_label(self.FSettings.Settings.get_setting('accesspoint', 'enable_Security', format=bool)) def start_timer(self): self.now = 0 self.update_timer() self.timer.timeout.connect(self.tick_timer) self.timer.start(1000) def update_timer(self): self.runtime = ('%d:%02d' % (self.now / 60, self.now % 60)) self.sectionTimeLabel.setText(self.runtime) self.currentThreadLabel.setText(self.FSettings.Settings.get_setting('runningconfig', 'totalthread')) def tick_timer(self): self.now += 1 self.update_timer() def stop_timer(self): self.timer.stop() self.sectionTimeLabel.setText('00:00') self.currentThreadLabel.setText('0') def update_security_label(self, bool): if bool: self.AP_Security.setText('[ON]') self.AP_Security.setStyleSheet('QLabel { color : green; }') else: self.AP_Security.setText('[OFF]') self.AP_Security.setStyleSheet('QLabel { color : #df1f1f; }') def create_info_box(self, labelText, objectName, valueLabel): infoBox = QtGui.QVBoxLayout() infoBox.setSpacing(0) label = QtGui.QLabel(labelText) label.setObjectName('label') valueLabel.setAlignment(QtCore.Qt.AlignCenter) valueLabel.setObjectName(objectName) infoBox.addWidget(label) infoBox.addWidget(valueLabel) return infoBox
class APStatus(HomeDisplay): Name = "AP Status" ID = "APStatus" ''' dashboard infor Acccess Point ''' def __init__(self, parent=0): super(APStatus, self).__init__(parent) self.timer = QtCore.QTimer() self.split_window = QtGui.QHBoxLayout() guageWindow = QtGui.QGridLayout() self.currentThreadLabel = QtGui.QLabel('0') currentthread = self.create_info_box('CURRENT THREADS', 'infor', self.currentThreadLabel) self.sectionTimeLabel = QtGui.QLabel('00:00') currentTime = self.create_info_box('UPTIME', 'infor', self.sectionTimeLabel) guageWindow.addLayout(currentthread, 1, 1) guageWindow.addLayout(currentTime, 0, 1) self.AP_name = QtGui.QLabel( self.FSettings.Settings.get_setting('accesspoint', 'ssid')) self.AP_BSSID = QtGui.QLabel( self.FSettings.Settings.get_setting('accesspoint', 'bssid')) self.AP_Channel = QtGui.QLabel( self.FSettings.Settings.get_setting('accesspoint', 'channel')) self.AP_NetworkApdater = QtGui.QLabel( self.FSettings.Settings.get_setting('accesspoint', 'interfaceAP')) self.AP_ROUTER = QtGui.QLabel( self.FSettings.Settings.get_setting('dhcp', 'router')) self.AP_DHCP_range = QtGui.QLabel( self.FSettings.Settings.get_setting('dhcp', 'range')) self.AP_Security = QtGui.QLabel('') self.update_security_label( self.FSettings.Settings.get_setting('accesspoint', 'enable_Security', format=bool)) self.group_AccessPoint = QtGui.QGroupBox() self.form_window = AutoGridLayout() self.form_window.setSpacing(10) self.group_AccessPoint.setTitle('Access Point') self.form_window.addNextWidget(QtGui.QLabel('AP Name:')) self.form_window.addNextWidget(self.AP_name) self.form_window.addNextWidget(QtGui.QLabel('BSSID:')) self.form_window.addNextWidget(self.AP_BSSID) self.form_window.addNextWidget(QtGui.QLabel('Channel:')) self.form_window.addNextWidget(self.AP_Channel) self.form_window.addNextWidget(QtGui.QLabel('Network Adapter:')) self.form_window.addNextWidget(self.AP_NetworkApdater) self.form_window.addNextWidget(QtGui.QLabel('Router:')) self.form_window.addNextWidget(self.AP_ROUTER) self.form_window.addNextWidget(QtGui.QLabel('DHCP:')) self.form_window.addNextWidget(self.AP_DHCP_range) self.form_window.addNextWidget(QtGui.QLabel('Security Password:'******'accesspoint', 'ssid')) self.AP_BSSID.setText( self.FSettings.Settings.get_setting('accesspoint', 'bssid')) self.AP_Channel.setText( self.FSettings.Settings.get_setting('accesspoint', 'channel')) self.AP_NetworkApdater.setText( self.FSettings.Settings.get_setting('accesspoint', 'interfaceAP')) self.AP_ROUTER.setText( self.FSettings.Settings.get_setting('dhcp', 'router')) self.AP_DHCP_range.setText( self.FSettings.Settings.get_setting('dhcp', 'range')) self.update_security_label( self.FSettings.Settings.get_setting('accesspoint', 'enable_Security', format=bool)) def start_timer(self): self.start_time_conut = datetime.now() self.update_timer() self.timer.timeout.connect(self.tick_timer) self.timer.start(1000) def update_timer(self): self.end_time_count = datetime.now() self.sectionTimeLabel.setText( self.strfdelta((self.end_time_count - self.start_time_conut), '{hours} hs {minutes} mins')) self.currentThreadLabel.setText( self.FSettings.Settings.get_setting('runningconfig', 'totalthread')) def strfdelta(self, tdelta, fmt): # https://stackoverflow.com/questions/8906926/formatting-python-timedelta-objects d = {"D": tdelta.days} d["hours"], rem = divmod(tdelta.seconds, 3600) d["minutes"], d["seconds"] = divmod(rem, 60) return fmt.format(**d) def tick_timer(self): self.update_timer() def stop_timer(self): self.timer.stop() self.sectionTimeLabel.setText('00:00') self.currentThreadLabel.setText('0') def update_security_label(self, bool): if bool: self.AP_Security.setText('[ON]') self.AP_Security.setStyleSheet('QLabel { color : green; }') else: self.AP_Security.setText('[OFF]') self.AP_Security.setStyleSheet('QLabel { color : #df1f1f; }') def create_info_box(self, labelText, objectName, valueLabel): infoBox = QtGui.QVBoxLayout() infoBox.setSpacing(0) label = QtGui.QLabel(labelText) label.setObjectName('label') valueLabel.setAlignment(QtCore.Qt.AlignCenter) valueLabel.setObjectName(objectName) infoBox.addWidget(label) infoBox.addWidget(valueLabel) return infoBox