def __init__(self, path, settings, session): QMainWindow.__init__(self) self.settings = settings self.course_tree_widget = CourseTreeWidget(path, settings, session) self.file_list_widget = FileListWidget() self.download_dir_tree_widget = DownloadDirTreeWidget(settings['download_path']) self.file_downloader = FileDownloaderWidget() self.vSplitter = QSplitter(Qt.Vertical) self.hSplitter1 = QSplitter(Qt.Horizontal) self.hSplitter2 = QSplitter(Qt.Horizontal) self.hSplitter1.addWidget(self.course_tree_widget) self.hSplitter1.addWidget(self.file_list_widget) self.hSplitter2.addWidget(self.download_dir_tree_widget) self.hSplitter2.addWidget(self.file_downloader) self.vSplitter.addWidget(self.hSplitter1) self.vSplitter.addWidget(self.hSplitter2) self.maxWidth = QGuiApplication.primaryScreen().size().width() self.maxHeight = QGuiApplication.primaryScreen().size().height() self.hSplitter1.setSizes([self.maxWidth, self.maxWidth]) self.hSplitter2.setSizes([self.maxWidth, self.maxWidth]) self.vSplitter.setSizes([self.maxHeight, self.maxHeight]) mainWidget = QWidget(self) mainLayout = QGridLayout() mainWidget.setLayout(mainLayout) mainLayout.addWidget(self.vSplitter) self.course_tree_widget.signal.clearFileListWidget.connect(self.file_list_widget.clear) self.course_tree_widget.signal.appendRowFileListWidget.connect(self.file_list_widget.appendRow) self.course_tree_widget.signal.addDownloadTask.connect(self.file_downloader.addDownloadTask) self.setCentralWidget(mainWidget) self.init_menubar() self.setWindowTitle("ABookDownloader Dev") self.showMaximized()
def show_images(self): #print(self.filename) self.base_image.load(self.filename) self.real_size = (self.base_image.width(), self.base_image.height()) screen = QGuiApplication.primaryScreen() screenSize = screen.availableSize() sy = int((screenSize.height() - 20) / 2) sx = int((screenSize.width() - 20) / 2) if not self.base_image_scaled: self.base_image_scaled = self.base_image.scaled( sx, sy, Qt.KeepAspectRatio) self.setGeometry(sx - int(self.base_image_scaled.width()), sy - int(self.base_image_scaled.height() / 2), self.base_image_scaled.width() * 2, self.base_image_scaled.height()) else: self.base_image_scaled = self.base_image.scaled( int(self.base_image_scaled.width()), int(self.base_image_scaled.height()), Qt.KeepAspectRatio) self.setGeometry(sx - int(self.base_image_scaled.width()), sy - int(self.base_image_scaled.height() / 2), self.base_image_scaled.width() * 2, self.base_image_scaled.height()) self.baseLabel.setPixmap(QPixmap.fromImage(self.base_image_scaled)) #self.miniLabel.setPixmap(QPixmap.fromImage(self.base_image)) self.get_face_image()
def _check_compatibility(self): # If we cause black screen then hide ourself out of shame... screenshot = QGuiApplication.primaryScreen().grabWindow(0) image = qpixmap_to_np(screenshot) if is_color_percent_gte(image, color=[0, 0, 0], percent=0.95): self.logger.warning( "Detected black screen condition. Disabling overlay") self.hide()
def centerPositionWindow(self): self.ui.frame_workingSpace.show() screen = QScreen.geometry(QGuiApplication.primaryScreen()) widthHalf, heightHalf = self.sizePercentOfScreen(0.5, 0.5) self.setGeometry( QStyle.alignedRect(Qt.LeftToRight, Qt.AlignCenter, QSize(widthHalf, heightHalf), screen)) self.setFixedSize(widthHalf, heightHalf)
def sizePercentOfScreen(self, aplhaWindth: float, aplhaHeight: float) -> Tuple[int, int]: """ Initiate size and location of window """ screen = QScreen.availableSize(QGuiApplication.primaryScreen()) windowWidth = (screen.width()) * aplhaWindth windowHeight = (screen.height()) * aplhaHeight return windowWidth, windowHeight
def mousePressEvent(self, event): self._mousePressed = True self._mousePos = event.globalPos() self._windowPos = self._window.pos() self._sizeW = self._window.width() self._sizeH = self._window.height() screen = QGuiApplication.primaryScreen() screenRect = screen.geometry() self._screenSizeW = screenRect.width() self._screenSizeH = screenRect.height()
def grab_desktop(self, x, y, w, h) -> np.ndarray: screen = QGuiApplication.primaryScreen() pixmap = screen.grabWindow(0, x, y, w, h) image = qpixmap_to_np(pixmap) if _debug_dump_file: logger.debug("dumping file") np_save_image(image, "/tmp/qtshot.bmp") return image
def window_setup(self): self.adjustSize() self.setGeometry( QStyle.alignedRect( Qt.LeftToRight, Qt.AlignCenter, self.size(), QGuiApplication.primaryScreen().availableGeometry(), )) self.setWindowTitle("Saharah Paper") self.setWindowIcon(QIcon(f"{sys.argv[0]}/assets/app_icon.png"))
def initGeometryWindow(self, aplhaPosX: float, aplhaPosY: float, aplhaWindth: float, aplhaHeight: float) -> None: """ Initiate size and location of window """ screen = QScreen.availableSize(QGuiApplication.primaryScreen()) pos_x = (screen.width()) * aplhaPosX pos_y = (screen.height()) * aplhaPosY windowWidth = (screen.width()) * aplhaWindth windowHeight = (screen.height()) * aplhaHeight self.setGeometry(pos_x, pos_y, windowWidth, windowHeight) self.setFixedSize(windowWidth, windowHeight)
def initUI(self): self.setCentralWidget(self.view) screen = QGuiApplication.primaryScreen() screenGeometry = screen.geometry() screenHeight = screenGeometry.height() screenWidth = screenGeometry.width() self.setGeometry((screenWidth / 2) - (self.width / 2), (screenHeight / 2) - (self.height / 2), self.width, self.height) self.setWindowTitle(self.title) self.setWindowIcon(QIcon('contacts.png')) self.statusBar().showMessage('Ready') newAction = QAction(QIcon('add.png'), '&Add', self) newAction.setShortcut('Ins') newAction.setStatusTip('New contact') newAction.triggered.connect(self.addrow) delAction = QAction(QIcon('delete.png'), '&Delete', self) delAction.setShortcut('Del') delAction.setStatusTip('Delete contact') delAction.triggered.connect(self.delrow) refreshAction = QAction(QIcon('refresh.png'), '&Refresh', self) refreshAction.setShortcut('F5') refreshAction.setStatusTip('Refresh') refreshAction.triggered.connect(self.refresh) exitAction = QAction(QIcon('exit.png'), '&Exit', self) exitAction.setShortcut('Ctrl+Q') exitAction.setStatusTip('Exit application') exitAction.triggered.connect(self.close) self.menubar = self.menuBar() self.fileMenu = self.menubar.addMenu('&Database') self.fileMenu.addAction(refreshAction) self.fileMenu.addSeparator() self.fileMenu.addAction(exitAction) self.fileMenu = self.menubar.addMenu('&Contact') self.fileMenu.addAction(newAction) self.fileMenu.addAction(delAction) self.toolbar = self.addToolBar('Contacts') self.toolbar.addAction(refreshAction) self.toolbar.addSeparator() self.toolbar.addAction(newAction) self.toolbar.addAction(delAction) self.toolbar.addSeparator() self.toolbar.addAction(exitAction) self.show()
def __init__(self): super(MainWindow, self).__init__() self.setWindowTitle('Qt DataVisualization 3D Bars') self.bars = QtDataVisualization.Q3DBars() self.columnAxis = QtDataVisualization.QCategory3DAxis() self.columnAxis.setTitle('Columns') self.columnAxis.setTitleVisible(True) self.columnAxis.setLabels(['Column1', 'Column2']) self.columnAxis.setLabelAutoRotation(30) self.rowAxis = QtDataVisualization.QCategory3DAxis() self.rowAxis.setTitle('Rows') self.rowAxis.setTitleVisible(True) self.rowAxis.setLabels(['Row1', 'Row2']) self.rowAxis.setLabelAutoRotation(30) self.valueAxis = QtDataVisualization.QValue3DAxis() self.valueAxis.setTitle('Values') self.valueAxis.setTitleVisible(True) self.valueAxis.setRange(0, 5) self.bars.setRowAxis(self.rowAxis) self.bars.setColumnAxis(self.columnAxis) self.bars.setValueAxis(self.valueAxis) self.series = QtDataVisualization.QBar3DSeries() self.arrayData = [[1, 2], [3, 4]] self.series.dataProxy().addRows(dataToBarDataArray(self.arrayData)) self.bars.setPrimarySeries(self.series) self.container = QWidget.createWindowContainer(self.bars) if not self.bars.hasContext(): print("Couldn't initialize the OpenGL context.") sys.exit(-1) camera = self.bars.scene().activeCamera() camera.setYRotation(22.5) geometry = QGuiApplication.primaryScreen().geometry() size = geometry.height() * 3 / 4 self.container.setMinimumSize(size, size) self.container.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) self.container.setFocusPolicy(Qt.StrongFocus) self.setCentralWidget(self.container)
def grab_game(self) -> np.ndarray: if (time.monotonic() - self.__game_last_grab) * 1000 < self.refresh_rate: return self.__game_last_image screen = QGuiApplication.primaryScreen() pixmap = screen.grabWindow(self.qwindow.winId()) image = qpixmap_to_np(pixmap) if _debug_dump_file: logger.debug("dumping file") np_save_image(image, "/tmp/qtshot.bmp") self.__game_last_image = image self.__game_last_grab = time.monotonic() return self.__game_last_image
def _check_compatibility(self): # If we cause black screen then hide ourself out of shame... screenshot = QGuiApplication.primaryScreen().grabWindow(0) image = qpixmap_to_np(screenshot) black_pixels = np.count_nonzero( np.all(image[:, :, :3] == [0, 0, 0], axis=-1)) total_pixels = len(image[:, :, 0].flatten()) black_percent = black_pixels / total_pixels self.logger.debug("Screen black ratio %.2f%%", black_percent * 100) if black_percent > 0.95: self.logger.warning( "Detected black screen at %.2f%%. Disabling overlay", black_percent * 100, ) self.hide()
def __init__(self): super(MainWindow, self).__init__(None) self.layout = QVBoxLayout() self.setLayout(self.layout) self.setWindowTitle("Graphvizer Viewer") # Default window size screen_rect = QGuiApplication.primaryScreen().availableGeometry() self.resize(screen_rect.width() * 3/5, screen_rect.height() * 4/5) # Add a button button = QPushButton("New Tab") button.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed) self.layout.addWidget(button) # Add TabWidget tab_widget = TabWidget() self.layout.addWidget(tab_widget) # Create a new tab when the button is pressed button.clicked.connect(tab_widget.new_tab)
def testCharts(self): self.series = QtCharts.QPieSeries() self.series.append("Jane", 1) self.series.append("Joe", 2) self.series.append("Andy", 3) self.series.append("Barbara", 4) self.series.append("Axel", 5) slice = self.series.slices()[1] slice.setExploded() slice.setLabelVisible() self.chart = QtCharts.QChart() self.chart.addSeries(self.series) chartView = QtCharts.QChartView(self.chart) screenSize = QGuiApplication.primaryScreen().geometry().size() chartView.resize(screenSize / 2) chartView.show() QTimer.singleShot(500, self.app.quit) self.app.exec_()
def screenshot(self): self.hasResult = False # 对鼠标移动事件进行监听 self.setMouseTracking(True) # 标识开始截图 self.startFlag = True self.endFlag = False # 休眠0.3秒 time.sleep(0.1) # 调整窗口大小 用于展示当前页面图 self.setGeometry(0, 0, self.screen.width(), self.screen.height()) # 截全屏 self.desktop_pix = QPixmap(QGuiApplication.primaryScreen().grabWindow(0)) self.blurry_pix = pix_add_blurry(self.desktop_pix, 0.3) # 设置画笔 self.palette.setBrush(self.backgroundRole(), QBrush(self.blurry_pix)) self.setPalette(self.palette) # 显示 self.show()
def shoot_screen(self, windo=0): screen = QGuiApplication.primaryScreen() window = QWindow() window = self.windowHandle() if window: screen = window.screen() if not screen: return if type(windo) in (list, tuple): self.original_pixmap = screen.grabWindow( QApplication.desktop().winId(), *windo) else: self.original_pixmap = screen.grabWindow( QApplication.desktop().winId(), windo) self.update_screenshot_label() # self.new_screenshot_button.setDisabled(False) # if self.hide_this_window_check_box.isChecked(): self.show()
def get_screen_image(bounding_box=None): """ Get screen image. :param bounding_box: [tuple] The image rectangle in screen, formatted in (left, upper, width, height). :returns: [QPixmap or None] Screen image. """ screen = QGuiApplication.primaryScreen() if not screen: logging.error("Failed to get 'QScreen' object.") return None if bounding_box: return screen.grabWindow(0, x=bounding_box[0], y=bounding_box[1], width=bounding_box[2], height=bounding_box[3]) else: return screen.grabWindow(0)
def __init__(self, popup_type, text, focus): super(PopupWindow, self).__init__() msgbox = self # Set window center of screen msgbox.setGeometry( QStyle.alignedRect( Qt.LeftToRight, Qt.AlignCenter, self.size(), QGuiApplication.primaryScreen().availableGeometry(), ), ) msgbox.setWindowIcon(QIcon("static/images/main_icon.png")) title = "Network Assistant" if popup_type == "warning": msgbox.warning(self, title, text) focus.setFocus()
def cut_window(self, x0, y0, wide, high): pqscreen = QGuiApplication.primaryScreen() pixmap2 = pqscreen.grabWindow(self.winId(), x0, y0, wide, high) pixmap2.save('pridict.png')
def startProgram(self, page): screen = QScreen.availableSize(QGuiApplication.primaryScreen()) if ((self.geometry().width()) / (screen.width()) <= 0.05): self.expand() self.ui.stackedWidget.setCurrentWidget(page)
def __init__(self, test_name: str, reference_image: QPixmap, generated_image: QPixmap): super(ApprovalDialog, self).__init__() self.setWindowTitle(test_name) main_layout = QVBoxLayout(self) ref_image = QLabel() ref_image.setPixmap(reference_image) gen_image = QLabel() gen_image.setPixmap(generated_image) scroll_area = QScrollArea() self.layout().addWidget(scroll_area) screen_width, screen_height = QGuiApplication.primaryScreen().size( ).toTuple() if reference_image.width() + gen_image.width() >= screen_width: self.image_layout = QVBoxLayout() else: self.image_layout = QHBoxLayout() self.image_layout.addStretch() self.image_layout.addWidget(ref_image) self.image_layout.addWidget(gen_image) self.image_layout.addStretch() scroll_area.setWidget(QWidget()) scroll_area.setWidgetResizable(True) scroll_area.widget().setSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.MinimumExpanding) scroll_area.setSizePolicy(QSizePolicy.MinimumExpanding, QSizePolicy.Maximum) scroll_area.widget().setLayout(self.image_layout) def _sizeHint(): orig_size = scroll_area.widget().sizeHint() orig_size.setHeight(orig_size.height() + 20) orig_size.setWidth(orig_size.width() + 20) if orig_size.width() > screen_width - 20: orig_size.setWidth(screen_width - 20) if orig_size.height() > screen_height - 20: orig_size.setHeight(screen_height - 20) return orig_size scroll_area.sizeHint = _sizeHint button_box = QDialogButtonBox() button_box.addButton( "Reject", QDialogButtonBox.RejectRole).clicked.connect(self.reject) button_box.addButton(QDialogButtonBox.Ignore).clicked.connect( self._on_ignore) button_box.addButton("Accept as new Reference", QDialogButtonBox.ApplyRole).clicked.connect( self._on_overwrite) main_layout.addWidget(scroll_area) main_layout.addWidget(button_box, alignment=Qt.AlignCenter)
lines = file.readlines() self.reddit = praw.Reddit(client_id=lines[0].strip(), client_secret=lines[1].strip(), password=lines[2].strip(), user_agent=lines[3].strip(), username=lines[4].strip()) return self.reddit.subreddit("quotes") def change_size(self): self.move( QPoint(self.w / 2 - self.width() / 2, self.h - self.height() - 10)) print(self.label.height()) print(self.y()) w = 0 h = 0 if __name__ == "__main__": app = QtWidgets.QApplication([]) screen_size = QGuiApplication.primaryScreen().availableGeometry() widget = NewWidget() widget.w, widget.h = screen_size.width(), screen_size.height() print(widget.h) widget.resize(200, 100) widget.show() widget.move(widget.w / 2 - widget.minimumWidth() / 2, widget.h - widget.height()) widget.setWindowTitle("Motivational quotes") sys.exit(app.exec_())
def __init__(self): self.screens = QGuiApplication.screens() self.primary = QGuiApplication.primaryScreen() if self.primary in self.screens: self.screens.remove(self.primary)
def __init__(self, pid=0, filename=0): super().__init__() #self.resize(800,600) self.pid = pid #print(filename) self.filename = filename layout = QHBoxLayout() self.baseLabel = MovableLabel() self.baseLabel.setFrameShape(QFrame.StyledPanel) self.baseLabel.setAlignment(Qt.AlignCenter) self.baseLabel.getRectCoords.connect(self.getRectCoordsSlot) self.miniLabel = QLabel() self.miniLabel.setAlignment(Qt.AlignCenter) self.base_image = QImage() self.mini_image = QImage() self.base_image_scaled = 0 #self.filename = 0 self.pix = 0 self.currentIndex = 0 self.real_size = 0 layout.addWidget(self.baseLabel) layout.addWidget(self.miniLabel) def openMenu(position): menu = QMenu() openAction = menu.addAction('Открыть') saveAction = menu.addAction('Сохранить') menu.addSeparator() nextAction = menu.addAction('Следующий') menu.addSeparator() quitAction = menu.addAction('Выход') action = menu.exec_(self.mapToGlobal(position)) if action == openAction: fileName = QFileDialog.getOpenFileName( self, "Изображение", "photos", "Фото (*.png *.jpg *.bmp *.JPG)") if len(fileName) > 1: self.filename = fileName[0] self.show_images() if action == saveAction: if self.filename: print('os.path.basename(self.filename)') path = os.path.basename(self.filename) root_ext = os.path.splitext(path) print(root_ext) if self.pid: root_ext = [str(pid) + '_001'] minifile = os.path.join( os.path.join('photos', 'miniatures'), root_ext[0] + '.png') if self.pix: self.pix.save(minifile, "PNG") print(minifile) if action == nextAction: if self.base_image: self.get_face_image() if action == quitAction: self.close() self.setContextMenuPolicy(Qt.CustomContextMenu) self.customContextMenuRequested.connect(openMenu) self.setLayout(layout) if self.filename: self.show_images() else: screen = QGuiApplication.primaryScreen() screenSize = screen.availableSize() sy = int((screenSize.height() - 20) / 4) sx = int((screenSize.width() - 20) / 4) self.setGeometry(sx, sy, int(screenSize.width() / 4), int(screenSize.height() / 4))
def __init__(self, ui_fil, parent=None): super(MainWindow, self).__init__(parent) self.ui_file = QFile(ui_fil) self.ui_file.open(QFile.ReadOnly) self.loader = QUiLoader() self.loader.setLanguageChangeEnabled(True) self.window = self.loader.load(self.ui_file) self.window.setGeometry(50, 50, 860, 640) self.window.setWindowIcon(QIcon('icons/icons8-wi-fi-64.png')) self.ui_file.close() self.trans = QTranslator() self.trans.load('lang/pl_PL.qm') self.conn_baudrates = [ "9600", "115200", "300", "1200", "2400", "4800", "14400", "19200", "31250", "38400", "57600" ] self.conn_boards = ["ESP32", "ESP8266"] self.widget_tab = self.window.findChild(QTabWidget, 'tabWidget') self.widget_tab.setIconSize(QSize(36, 36)) self.widget_tab.setTabIcon(0, QIcon('icons/icons8-automatic-64.png')) self.widget_tab.setTabIcon(1, QIcon('icons/icons8-bar-chart-50.png')) self.widget_tab.setTabIcon(2, QIcon('icons/icons8-menu-64.png')) self.widget_tab.setTabIcon(3, QIcon('icons/icons8-timeline-64.png')) self.widget_tab.setTabIcon(4, QIcon('icons/icons8-bluetooth-50.png')) self.widget_tab.setTabIcon(5, QIcon('icons/icons8-console-64.png')) self.lang_combo_box = self.window.findChild(QComboBox, 'lang_combo_box') self.lang_combo_box.addItem("English") self.lang_combo_box.addItem("Polski") self.lang_combo_box.currentTextChanged.connect(self.change_language) self.serial_port_box = self.window.findChild(QComboBox, 'serial_port_box') self.baud_rate_box = self.window.findChild(QComboBox, 'baud_rate_box') self.select_board_box = self.window.findChild(QComboBox, 'select_board_box') self.scan_time_edit = self.window.findChild(QTimeEdit, 'scan_time_edit') self.wifi_scan_box = self.window.findChild(QCheckBox, 'wifi_scan_box') self.blue_scan_box = self.window.findChild(QCheckBox, 'blue_scan_box') self.save_data_check = self.window.findChild(QCheckBox, 'save_data_check') self.connection_status_edit = self.window.findChild( QLineEdit, 'connection_status_edit') self.start_button = self.window.findChild(QPushButton, 'start_button') self.stop_button = self.window.findChild(QPushButton, 'stop_button') self.stop_button.setEnabled(False) self.vertical_wifi_layout = self.window.findChild( QVBoxLayout, 'verticalLayout_5') self.wifi_list_view = self.window.findChild(QListWidget, 'wifi_list_view') self.wifi_list_view.setIconSize(QSize(64, 64)) self.vertical_timeline_layout = self.window.findChild( QVBoxLayout, 'verticalLayout_7') self.blue_list_view = self.window.findChild(QListWidget, 'blue_list_view') self.blue_list_view.setIconSize(QSize(64, 64)) self.console_logging_check = self.window.findChild( QCheckBox, 'console_logging_check') self.console_autoscroll_check = self.window.findChild( QCheckBox, 'console_autoscroll_check') self.console_text_edit = self.window.findChild(QTextEdit, 'console_text_edit') self.select_board_box.activated[str].connect(self.change_board) #Settings tab for i in self.conn_baudrates: self.baud_rate_box.addItem(i) for i in self.conn_boards: self.select_board_box.addItem(i) self.connection_status_edit.setText('Not connected') self.connection_status_edit.setStyleSheet( "background: red; color: white; font-size: 14px; border-width: 1px; \ border-style: solid; border-radius: 2px; border-color: red;") thread1 = ReadSerialPortsThread.ReadSerialPortsThread(self) thread1.add_serial_port.connect( lambda p: self.serial_port_box.addItem(p)) thread1.remove_serial_port.connect( lambda p: self.serial_port_box.removeItem( self.serial_port_box.findText(p))) thread1.start() thread2 = MakeSerialConnection.MakeSerialConnection(self) thread4 = WriteToDatabase.WriteToDatabase(self) self.serial_port_box.currentTextChanged.connect(thread2.get_curr_port) self.baud_rate_box.activated[str].connect(thread2.get_curr_baud) self.select_board_box.activated[str].connect(thread2.get_curr_board) self.scan_time_edit.timeChanged.connect(thread2.get_curr_time) self.start_button.clicked.connect(thread2.start) self.stop_button.clicked.connect(thread2.stop_serial_communication) self.wifi_scan_box.clicked.connect(thread2.get_wifi_check) self.blue_scan_box.clicked.connect(thread2.get_blue_check) self.save_data_check.clicked.connect(thread2.enable_saving_to_db) self.save_data_check.clicked.connect(thread4.enable_saving_data_func) self.lang_combo_box.currentTextChanged.connect( lambda s: thread2.get_current_lang(s)) thread2.baud_box_state.connect( lambda b: self.baud_rate_box.setEnabled(b)) thread2.port_box_state.connect( lambda b: self.serial_port_box.setEnabled(b)) thread2.board_box_state.connect( lambda b: self.select_board_box.setEnabled(b)) thread2.time_edit_state.connect( lambda b: self.scan_time_edit.setEnabled(b)) thread2.wifi_check_state.connect( lambda b: self.wifi_scan_box.setEnabled(b)) thread2.blue_check_state.connect( lambda b: self.blue_scan_box.setEnabled(b)) thread2.serial_port_placeholder.connect( lambda t: self.serial_port_box.addItem(t)) thread2.serial_port_clear.connect(self.serial_port_box.clear) thread2.send_text_signal.connect( lambda t: self.console_text_edit.append(t)) thread2.start_btn_state.connect( lambda b: self.start_button.setEnabled(b)) thread2.stop_btn_state.connect( lambda b: self.stop_button.setEnabled(b)) thread2.conn_stat_text.connect( lambda t: self.connection_status_edit.setText(t)) thread2.conn_stat_style.connect( lambda s: self.connection_status_edit.setStyleSheet(s)) #Wi-Fi Chart tab self.chart = QtCharts.QChart() self.axis_x = QtCharts.QValueAxis() self.axis_y = QtCharts.QValueAxis() self.line_series = QtCharts.QLineSeries() self.line_series.append(QPoint(0, 0)) self.chart.setAxisX(self.axis_x, self.line_series) self.axis_x.setRange(2400, 2483) self.axis_x.setTickCount(10) self.axis_x.setMinorTickCount(4) self.axis_x.applyNiceNumbers() self.axis_x.setTitleText("Frequency [MHz]") self.chart.setAxisY(self.axis_y, self.line_series) self.axis_y.setRange(-100, -30) self.axis_y.applyNiceNumbers() self.axis_y.setTickCount(9) self.axis_y.setMinorTickCount(4) self.axis_y.setTitleText("RSSI [dBm]") self.chart.legend().setVisible(True) self.chart.legend().setAlignment(Qt.AlignRight) self.chart.setBackgroundRoundness(0) self.chart_view = QtCharts.QChartView(self.chart) self.chart_view.setRenderHint(QPainter.Antialiasing) self.vertical_wifi_layout.addWidget(self.chart_view) #WiFi List tab thread2.clear_wifi_list.connect(self.wifi_list_view.clear) thread2.append_wifi_list_item.connect( lambda i: self.wifi_list_view.addItem(i)) thread2.append_wifi_timeline_data.connect( lambda d: self.append_data(d)) thread2.save_wifi_timeline_data.connect( lambda t: thread4.update_db_file(t)) thread2.clear_wifi_series.connect(self.chart.removeAllSeries) thread2.add_wifi_series.connect(lambda s: self.chart.addSeries(s)) thread2.set_axis_x_series.connect( lambda s: self.chart.setAxisX(self.axis_x, s)) thread2.set_axis_y_series.connect( lambda s: self.chart.setAxisY(self.axis_y, s)) thread2.wifi_data_to_func.connect( lambda d: thread2.append_wifi_data(d)) thread2.wifi_data_to_func.connect( lambda d: thread2.append_data_to_wifi_graph(d)) thread2.wifi_data_to_func.connect( lambda d: thread2.append_data_to_wifi_timeline(d)) thread2.blue_data_to_func.connect( lambda d: thread2.append_blue_data(d)) #Wi-Fi Timeline tab self.wifi_channels_occupancy_array = [] self.wifi_channels_timestamps = [] self.deleted_empty_vals = False self.freeze_graph_bool_val = False self.last_item = 0 self.graph_item_color = QColor(255, 195, 0) self.bars = QtDataVisualization.Q3DBars() self.column_axis = QtDataVisualization.QCategory3DAxis() self.column_axis.setTitle('Channels') self.column_axis.setTitleVisible(True) self.column_axis.setLabels([ 'Channel 1', 'Channel 2', 'Channel 3', 'Channel 4', 'Channel 5', 'Channel 6', 'Channel 7', 'Channel 8', 'Channel 9', 'Channel 10', 'Channel 11', 'Channel 12', 'Channel 13' ]) self.column_axis.setLabelAutoRotation(45) self.column_axis.setAutoAdjustRange(True) self.row_axis = QtDataVisualization.QCategory3DAxis() self.row_axis.setTitle('Timeline') self.row_axis.setTitleVisible(True) self.value_axis = QtDataVisualization.QValue3DAxis() self.value_axis.setTitle('RSSI [dBm]') self.value_axis.setTitleVisible(True) self.value_axis.setRange(-100, -10) self.bars.setRowAxis(self.row_axis) self.bars.setColumnAxis(self.column_axis) self.bars.setValueAxis(self.value_axis) self.bars.setBarSpacingRelative(False) self.bars.setFloorLevel(-100) self.series = QtDataVisualization.QBar3DSeries() self.array_data = [[]] self.series.dataProxy().addRows( self.data_to_bar_data_array(self.array_data)) self.series.setBaseColor(self.graph_item_color) self.bars.setPrimarySeries(self.series) self.container = QWidget.createWindowContainer(self.bars) if not self.bars.hasContext(): print("Couldn't initialize the OpenGL context") sys.exit(-1) camera = self.bars.scene().activeCamera() camera.setXRotation(-45.0) camera.setYRotation(22.5) geometry = QGuiApplication.primaryScreen().geometry() size = geometry.height() * 3 / 4 self.container.setMinimumSize(size, size) self.container.setSizePolicy(QSizePolicy.Ignored, QSizePolicy.Ignored) self.container.setFocusPolicy(Qt.StrongFocus) self.append_data([ -100, -80, -100, -80, -100, -80, -100, -80, -100, -80, -100, -80, -100 ]) self.nav_layout_h = QHBoxLayout() self.freeze_check = QCheckBox() self.freeze_check.setText("Freeze") self.freeze_check.clicked.connect(self.enable_scrolling_data) self.freeze_check.stateChanged.connect(self.freeze_graph) self.prev_button = QPushButton() self.prev_button.setText("Previous") self.prev_button.setEnabled(False) self.prev_button.clicked.connect(self.previous_data) self.next_button = QPushButton() self.next_button.setText("Next") self.next_button.setEnabled(False) self.next_button.clicked.connect(self.next_data) self.nav_layout_h.addWidget(self.freeze_check) self.nav_layout_h.addWidget(self.prev_button) self.nav_layout_h.addWidget(self.next_button) self.load_data_check = QCheckBox() self.load_data_check.setText("Load archival data") self.load_data_check.clicked.connect(self.enable_load_data) self.load_data_combo = QComboBox() self.load_data_combo.addItem("No data found") self.load_data_combo.setEnabled(False) self.load_data_btn = QPushButton() self.load_data_btn.setText("Load") self.load_data_btn.setEnabled(False) self.nav_layout_h2 = QHBoxLayout() self.nav_layout_h2.addWidget(self.load_data_check) self.nav_layout_h2.addWidget(self.load_data_combo) self.nav_layout_h2.addWidget(self.load_data_btn) thread4.start() thread4.remove_defualt_item.connect( lambda: self.load_data_combo.clear()) thread4.append_available_day.connect( lambda s: self.load_data_combo.addItem(s)) thread4.send_data_from_database.connect( lambda t: self.append_data_from_database(t)) self.load_data_combo.currentTextChanged.connect( lambda t: thread4.get_curr_table(t)) self.load_data_btn.clicked.connect(thread4.load_data_button) self.vertical_timeline_layout.addWidget(self.container) self.vertical_timeline_layout.addLayout(self.nav_layout_h) self.vertical_timeline_layout.addLayout(self.nav_layout_h2) #Bluetooth tab thread2.clear_blue_list.connect(self.blue_list_view.clear) thread2.append_blue_list_item.connect( lambda i: self.blue_list_view.addItem(i)) #Console tab self.console_autoscroll_check.stateChanged.connect( self.enable_auto_scroll) thread3 = WriteToFile.WriteToFile(self) self.console_logging_check.stateChanged.connect(thread3.enable_logging) thread2.send_text_signal.connect(lambda t: thread3.write_to_file(t)) self.window.show()