Skip to content

Commit

Permalink
move to pyside6
Browse files Browse the repository at this point in the history
  • Loading branch information
royshil committed Apr 25, 2024
1 parent 590f52b commit 23c9215
Show file tree
Hide file tree
Showing 19 changed files with 1,928 additions and 352 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/check-format.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@ jobs:
run: pip install black

- name: Check formatting
run: black --check .
run: black --check . --exclude '/ui_.*\.py'
16 changes: 8 additions & 8 deletions camera_view.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import platform
import time
from PyQt6.QtWidgets import (
from PySide6.QtWidgets import (
QGraphicsView,
QGraphicsScene,
QGraphicsPixmapItem,
)
from PyQt6.QtCore import Qt
from PyQt6.QtGui import QImage, QPixmap, QPainter
from PyQt6.QtCore import QThread, pyqtSignal
from PySide6.QtCore import Qt
from PySide6.QtGui import QImage, QPixmap, QPainter
from PySide6.QtCore import QThread, Signal
import cv2
import numpy as np
from camera_info import CameraInfo
Expand Down Expand Up @@ -142,9 +142,9 @@ def stabilize_frame(self, frame_rgb):


class TimerThread(QThread):
update_signal = pyqtSignal(object)
update_error = pyqtSignal(object)
ocr_result_signal = pyqtSignal(list)
update_signal = Signal(object)
update_error = Signal(object)
ocr_result_signal = Signal(list)

def __init__(self, camera_info: CameraInfo, detectionTargetsStorage):
super().__init__()
Expand Down Expand Up @@ -378,7 +378,7 @@ def toggleStabilization(self, state):


class CameraView(QGraphicsView):
first_frame_received_signal = pyqtSignal()
first_frame_received_signal = Signal()

def __init__(self, camera_index, detectionTargetsStorage=None):
super().__init__()
Expand Down
22 changes: 12 additions & 10 deletions log_view.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
from os import path
import platform
from PyQt6.QtWidgets import QDialog
from PyQt6.QtCore import QTimer
from PyQt6.uic import loadUi
from PySide6.QtWidgets import QDialog
from PySide6.QtCore import QTimer
from PySide6.QtUiTools import QUiLoader
from sc_logging import log_file_path
from ui_log_view import Ui_Dialog as Ui_LogViewerDialog


class LogViewerDialog(QDialog):
def __init__(self):
super().__init__()
loadUi(path.abspath(path.join(path.dirname(__file__), "log_view.ui")), self)
self.ui = Ui_LogViewerDialog()
self.ui.setupUi(self)
self.timer = QTimer()
self.timer.timeout.connect(self.update_ui)
self.timer.start(1000) # Update UI every 1 second
self.current_log_data = ""
self.pushButton_openlogfolder.clicked.connect(self.open_log_folder)
self.ui.pushButton_openlogfolder.clicked.connect(self.open_log_folder)

def open_log_folder(self):
# Open the folder containing the log file
Expand Down Expand Up @@ -44,10 +46,10 @@ def update_ui(self):
return
self.current_log_data = log_data
# Update the UI with the log data
self.textEdit_log.setPlainText(log_data)
if self.checkBox_autoScroll.isChecked():
self.ui.textEdit_log.setPlainText(log_data)
if self.ui.checkBox_autoScroll.isChecked():
# scroll to the bottom
self.textEdit_log.verticalScrollBar().setValue(
self.textEdit_log.verticalScrollBar().maximum()
self.ui.textEdit_log.verticalScrollBar().setValue(
self.ui.textEdit_log.verticalScrollBar().maximum()
)
self.scrollArea.ensureWidgetVisible(self.textEdit_log)
self.ui.scrollArea.ensureWidgetVisible(self.ui.textEdit_log)
Loading

0 comments on commit 23c9215

Please sign in to comment.