Merge branch 'feat/vision'
5
.gitignore
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
saved_frames/
|
||||
archive
|
||||
__pycache__
|
||||
.~lock*
|
||||
*.log
|
@ -1 +0,0 @@
|
||||
,clemens,cps-aio-001,01.07.2024 13:17,file:///home/clemens/.config/libreoffice/4;
|
149
CameraStream.py
Normal file
@ -0,0 +1,149 @@
|
||||
import cv2
|
||||
import os
|
||||
from datetime import datetime
|
||||
from ultralytics import YOLO
|
||||
|
||||
class YOLOv8CameraStream:
|
||||
def __init__(self, model_path: str, camera_source=0, confidence_threshold=0.5, save_threshold=0.9,
|
||||
log_file="detections.log", logging_level="high"):
|
||||
self.model = YOLO(model_path)
|
||||
self.camera_source = camera_source
|
||||
self.confidence_threshold = confidence_threshold
|
||||
self.default_confidence_threshold = confidence_threshold
|
||||
self.save_threshold = save_threshold
|
||||
self.default_save_threshold = save_threshold
|
||||
self.log_file = log_file
|
||||
self.logging_level = logging_level
|
||||
self.cap = cv2.VideoCapture(camera_source)
|
||||
|
||||
# Create directories for saved frames and archived logs if they don't exist
|
||||
os.makedirs("saved_frames", exist_ok=True)
|
||||
os.makedirs("archive", exist_ok=True)
|
||||
|
||||
# Initialize display settings
|
||||
self.show_thresholds = True
|
||||
|
||||
def log_detection(self, label, confidence):
|
||||
timestamp = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
|
||||
self.check_log_size() # Check log size before logging
|
||||
with open(self.log_file, "a") as log:
|
||||
log.write(f"{timestamp} - Detected: {label} with confidence {confidence:.2f}\n")
|
||||
|
||||
def check_log_size(self):
|
||||
"""Checks the size of the log file and archives it if it exceeds 5 MB."""
|
||||
if os.path.exists(self.log_file) and os.path.getsize(self.log_file) > 5 * 1024 * 1024: # 5 MB
|
||||
timestamp = datetime.now().strftime("%Y%m%d_%H%M%S")
|
||||
archived_log_file = f"archive/{self.log_file}_{timestamp}.log"
|
||||
os.rename(self.log_file, archived_log_file) # Rename the old log file
|
||||
print(f"Archived old log file to {archived_log_file}")
|
||||
# Create a new log file
|
||||
open(self.log_file, 'w').close() # Create an empty log file
|
||||
|
||||
def save_frame(self, frame, label):
|
||||
timestamp = datetime.now().strftime("%Y%m%d_%H%M%S")
|
||||
filename = f"saved_frames/{label}_{timestamp}.jpg"
|
||||
cv2.imwrite(filename, frame)
|
||||
print(f"Frame saved: {filename}")
|
||||
|
||||
def get_color_for_confidence(self, confidence):
|
||||
if confidence > 0.75:
|
||||
return (0, 255, 0)
|
||||
elif confidence > 0.5:
|
||||
return (0, 255, 255)
|
||||
else:
|
||||
return (0, 0, 255)
|
||||
|
||||
def process_frame(self, frame):
|
||||
results = self.model.predict(frame)
|
||||
for result in results:
|
||||
for box in result.boxes:
|
||||
confidence = float(box.conf.item())
|
||||
if self.logging_level == "high" and confidence < self.save_threshold:
|
||||
continue
|
||||
|
||||
if confidence > self.confidence_threshold:
|
||||
x1, y1, x2, y2 = map(int, box.xyxy[0])
|
||||
class_id = int(box.cls.item())
|
||||
label = f"{result.names[class_id]} {confidence:.2f}"
|
||||
color = self.get_color_for_confidence(confidence)
|
||||
cv2.rectangle(frame, (x1, y1), (x2, y2), color, 2)
|
||||
cv2.putText(frame, label, (x1, y1 - 10), cv2.FONT_HERSHEY_SIMPLEX, 0.5, color, 2)
|
||||
|
||||
self.log_detection(result.names[class_id], confidence)
|
||||
|
||||
if confidence > self.save_threshold:
|
||||
self.save_frame(frame, result.names[class_id])
|
||||
|
||||
if self.show_thresholds:
|
||||
self.display_thresholds(frame)
|
||||
self.display_keyboard_options(frame)
|
||||
|
||||
return frame
|
||||
|
||||
def display_thresholds(self, frame):
|
||||
text = f"Confidence Threshold: {self.confidence_threshold:.2f} | Save Threshold: {self.save_threshold:.2f}"
|
||||
cv2.putText(frame, text, (10, 30), cv2.FONT_HERSHEY_SIMPLEX, 0.6, (255, 255, 255), 2)
|
||||
|
||||
def display_keyboard_options(self, frame):
|
||||
options = [
|
||||
"Keyboard Controls:",
|
||||
"'c' - Increase Confidence Threshold | 'v' - Decrease Confidence Threshold",
|
||||
"'s' - Increase Save Threshold | 'x' - Decrease Save Threshold",
|
||||
"'t' - Toggle Threshold Display | 'r' - Reset Thresholds to Default",
|
||||
"'q' - Quit"
|
||||
]
|
||||
for i, option in enumerate(options):
|
||||
cv2.putText(frame, option, (10, 50 + i * 20), cv2.FONT_HERSHEY_SIMPLEX, 0.5, (255, 255, 255), 1)
|
||||
|
||||
def adjust_thresholds(self):
|
||||
print("\nPress 'c' to increase confidence threshold, 'v' to decrease it.")
|
||||
print("Press 's' to increase save threshold, 'x' to decrease it.")
|
||||
print("Press 't' to toggle threshold display, 'r' to reset thresholds to default.")
|
||||
print("Press 'q' to quit the program.\n")
|
||||
|
||||
def start(self):
|
||||
if not self.cap.isOpened():
|
||||
print("Error: Could not open video source.")
|
||||
return
|
||||
|
||||
self.adjust_thresholds()
|
||||
|
||||
while True:
|
||||
ret, frame = self.cap.read()
|
||||
if not ret:
|
||||
print("Error: Failed to capture frame.")
|
||||
break
|
||||
|
||||
processed_frame = self.process_frame(frame)
|
||||
cv2.imshow("YOLOv8 Camera Stream", processed_frame)
|
||||
|
||||
key = cv2.waitKey(1) & 0xFF
|
||||
if key == ord('q'):
|
||||
break
|
||||
elif key == ord('c'):
|
||||
self.confidence_threshold = min(self.confidence_threshold + 0.05, 1.0)
|
||||
print(f"Confidence threshold increased to {self.confidence_threshold:.2f}")
|
||||
elif key == ord('v'):
|
||||
self.confidence_threshold = max(self.confidence_threshold - 0.05, 0.0)
|
||||
print(f"Confidence threshold decreased to {self.confidence_threshold:.2f}")
|
||||
elif key == ord('s'):
|
||||
self.save_threshold = min(self.save_threshold + 0.05, 1.0)
|
||||
print(f"Save threshold increased to {self.save_threshold:.2f}")
|
||||
elif key == ord('x'):
|
||||
self.save_threshold = max(self.save_threshold - 0.05, 0.0)
|
||||
print(f"Save threshold decreased to {self.save_threshold:.2f}")
|
||||
elif key == ord('t'):
|
||||
self.show_thresholds = not self.show_thresholds
|
||||
print(f"Threshold display toggled to {'on' if self.show_thresholds else 'off'}")
|
||||
elif key == ord('r'):
|
||||
self.confidence_threshold = self.default_confidence_threshold
|
||||
self.save_threshold = self.default_save_threshold
|
||||
print("Thresholds reset to default values.")
|
||||
|
||||
self.cap.release()
|
||||
cv2.destroyAllWindows()
|
||||
|
||||
# Run the object detection stream
|
||||
if __name__ == "__main__":
|
||||
yolo_stream = YOLOv8CameraStream(model_path="models/yolov8m_seg_e300.pt", logging_level="high")
|
||||
yolo_stream.start()
|
@ -24,14 +24,23 @@ import time
|
||||
import threading
|
||||
|
||||
|
||||
# db_config = {
|
||||
# 'user': 'dbUser',
|
||||
# 'password': 'dbPassword',
|
||||
# 'host': '127.0.0.1', # 'host': 'localhost',
|
||||
# 'database': 'projectGeislinger',
|
||||
# 'port': 3306 # Standard port for MariaDB
|
||||
# }
|
||||
|
||||
db_config = {
|
||||
'user': 'dbUser',
|
||||
'password': 'dbPassword',
|
||||
'host': 'localhost',
|
||||
'host': '127.0.0.1', # 'host': 'localhost',
|
||||
'database': 'projectGeislinger',
|
||||
'port': 3306 # Standard port for MariaDB
|
||||
}
|
||||
|
||||
|
||||
# Establishing the connection
|
||||
conn = mariadb.connect(**db_config)
|
||||
# Create a cursor to execute queries
|
||||
|
@ -27,7 +27,7 @@ import threading
|
||||
db_config = {
|
||||
'user': 'dbUser',
|
||||
'password': 'dbPassword',
|
||||
'host': 'localhost',
|
||||
'host': '127.0.0.1', # 'host': 'localhost',
|
||||
'database': 'projectGeislinger',
|
||||
'port': 3306 # Standard port for MariaDB
|
||||
}
|
||||
|
1117
bjoerntest10.py
Normal file
222
bjoerntest2.py
Normal file
@ -0,0 +1,222 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Form implementation generated from reading ui file 'testbjoern2.ui'
|
||||
#
|
||||
# Created by: PyQt5 UI code generator 5.15.11
|
||||
#
|
||||
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
|
||||
# run again. Do not edit this file unless you know what you are doing.
|
||||
|
||||
|
||||
from PyQt5 import QtCore, QtGui, QtWidgets
|
||||
|
||||
|
||||
class Ui_MainWindow(object):
|
||||
def setupUi(self, MainWindow):
|
||||
MainWindow.setObjectName("MainWindow")
|
||||
MainWindow.resize(1090, 675)
|
||||
self.centralwidget = QtWidgets.QWidget(MainWindow)
|
||||
self.centralwidget.setObjectName("centralwidget")
|
||||
self.btn1 = QtWidgets.QPushButton(self.centralwidget)
|
||||
self.btn1.setGeometry(QtCore.QRect(900, 80, 111, 25))
|
||||
self.btn1.setObjectName("btn1")
|
||||
self.AuftragsdetailsTable = QtWidgets.QTableWidget(self.centralwidget)
|
||||
self.AuftragsdetailsTable.setGeometry(QtCore.QRect(10, 10, 661, 192))
|
||||
self.AuftragsdetailsTable.setEditTriggers(QtWidgets.QAbstractItemView.NoEditTriggers)
|
||||
self.AuftragsdetailsTable.setObjectName("AuftragsdetailsTable")
|
||||
self.AuftragsdetailsTable.setColumnCount(5)
|
||||
self.AuftragsdetailsTable.setRowCount(1)
|
||||
item = QtWidgets.QTableWidgetItem()
|
||||
self.AuftragsdetailsTable.setVerticalHeaderItem(0, item)
|
||||
item = QtWidgets.QTableWidgetItem()
|
||||
font = QtGui.QFont()
|
||||
font.setPointSize(8)
|
||||
item.setFont(font)
|
||||
self.AuftragsdetailsTable.setHorizontalHeaderItem(0, item)
|
||||
item = QtWidgets.QTableWidgetItem()
|
||||
font = QtGui.QFont()
|
||||
font.setPointSize(8)
|
||||
item.setFont(font)
|
||||
self.AuftragsdetailsTable.setHorizontalHeaderItem(1, item)
|
||||
item = QtWidgets.QTableWidgetItem()
|
||||
font = QtGui.QFont()
|
||||
font.setPointSize(8)
|
||||
item.setFont(font)
|
||||
self.AuftragsdetailsTable.setHorizontalHeaderItem(2, item)
|
||||
item = QtWidgets.QTableWidgetItem()
|
||||
font = QtGui.QFont()
|
||||
font.setPointSize(8)
|
||||
item.setFont(font)
|
||||
self.AuftragsdetailsTable.setHorizontalHeaderItem(3, item)
|
||||
item = QtWidgets.QTableWidgetItem()
|
||||
font = QtGui.QFont()
|
||||
font.setPointSize(8)
|
||||
item.setFont(font)
|
||||
self.AuftragsdetailsTable.setHorizontalHeaderItem(4, item)
|
||||
item = QtWidgets.QTableWidgetItem()
|
||||
self.AuftragsdetailsTable.setItem(0, 0, item)
|
||||
self.label = QtWidgets.QLabel(self.centralwidget)
|
||||
self.label.setGeometry(QtCore.QRect(900, 20, 121, 17))
|
||||
self.label.setObjectName("label")
|
||||
self.textEdit = QtWidgets.QTextEdit(self.centralwidget)
|
||||
self.textEdit.setGeometry(QtCore.QRect(860, 40, 221, 31))
|
||||
self.textEdit.setObjectName("textEdit")
|
||||
self.bauteilTypBtn = QtWidgets.QPushButton(self.centralwidget)
|
||||
self.bauteilTypBtn.setGeometry(QtCore.QRect(60, 340, 161, 25))
|
||||
self.bauteilTypBtn.setObjectName("bauteilTypBtn")
|
||||
self.bauteiltypTextbox = QtWidgets.QTextEdit(self.centralwidget)
|
||||
self.bauteiltypTextbox.setGeometry(QtCore.QRect(230, 340, 221, 31))
|
||||
self.bauteiltypTextbox.setObjectName("bauteiltypTextbox")
|
||||
self.label_3 = QtWidgets.QLabel(self.centralwidget)
|
||||
self.label_3.setGeometry(QtCore.QRect(250, 320, 181, 20))
|
||||
self.label_3.setObjectName("label_3")
|
||||
self.label_4 = QtWidgets.QLabel(self.centralwidget)
|
||||
self.label_4.setGeometry(QtCore.QRect(520, 320, 67, 17))
|
||||
self.label_4.setObjectName("label_4")
|
||||
self.textEdit_3 = QtWidgets.QTextEdit(self.centralwidget)
|
||||
self.textEdit_3.setGeometry(QtCore.QRect(460, 340, 191, 31))
|
||||
self.textEdit_3.setObjectName("textEdit_3")
|
||||
self.checkBox = QtWidgets.QCheckBox(self.centralwidget)
|
||||
self.checkBox.setGeometry(QtCore.QRect(70, 410, 151, 23))
|
||||
self.checkBox.setChecked(False)
|
||||
self.checkBox.setObjectName("checkBox")
|
||||
self.graphicsView = QtWidgets.QGraphicsView(self.centralwidget)
|
||||
self.graphicsView.setGeometry(QtCore.QRect(800, 280, 256, 192))
|
||||
self.graphicsView.setObjectName("graphicsView")
|
||||
MainWindow.setCentralWidget(self.centralwidget)
|
||||
self.menubar = QtWidgets.QMenuBar(MainWindow)
|
||||
self.menubar.setGeometry(QtCore.QRect(0, 0, 1090, 22))
|
||||
self.menubar.setObjectName("menubar")
|
||||
MainWindow.setMenuBar(self.menubar)
|
||||
self.statusbar = QtWidgets.QStatusBar(MainWindow)
|
||||
self.statusbar.setObjectName("statusbar")
|
||||
MainWindow.setStatusBar(self.statusbar)
|
||||
|
||||
self.retranslateUi(MainWindow)
|
||||
QtCore.QMetaObject.connectSlotsByName(MainWindow)
|
||||
|
||||
def retranslateUi(self, MainWindow):
|
||||
_translate = QtCore.QCoreApplication.translate
|
||||
MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow"))
|
||||
self.btn1.setText(_translate("MainWindow", "load Auftrag"))
|
||||
item = self.AuftragsdetailsTable.verticalHeaderItem(0)
|
||||
item.setText(_translate("MainWindow", "T1"))
|
||||
item = self.AuftragsdetailsTable.horizontalHeaderItem(0)
|
||||
item.setText(_translate("MainWindow", "Pos.-Nr"))
|
||||
item = self.AuftragsdetailsTable.horizontalHeaderItem(1)
|
||||
item.setText(_translate("MainWindow", "Matnr mit hoechster Version"))
|
||||
item = self.AuftragsdetailsTable.horizontalHeaderItem(2)
|
||||
item.setText(_translate("MainWindow", "Bezeichnung + Werkstoff"))
|
||||
item = self.AuftragsdetailsTable.horizontalHeaderItem(3)
|
||||
item.setText(_translate("MainWindow", "Menge"))
|
||||
item = self.AuftragsdetailsTable.horizontalHeaderItem(4)
|
||||
item.setText(_translate("MainWindow", "Lgort"))
|
||||
__sortingEnabled = self.AuftragsdetailsTable.isSortingEnabled()
|
||||
self.AuftragsdetailsTable.setSortingEnabled(False)
|
||||
item = self.AuftragsdetailsTable.item(0, 0)
|
||||
item.setText(_translate("MainWindow", "I1"))
|
||||
self.AuftragsdetailsTable.setSortingEnabled(__sortingEnabled)
|
||||
self.label.setText(_translate("MainWindow", "Auftragsnummer:"))
|
||||
self.textEdit.setHtml(_translate("MainWindow", "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
|
||||
"<html><head><meta name=\"qrichtext\" content=\"1\" /><meta charset=\"utf-8\" /><style type=\"text/css\">\n"
|
||||
"p, li { white-space: pre-wrap; }\n"
|
||||
"hr { height: 1px; border-width: 0; }\n"
|
||||
"li.unchecked::marker { content: \"\\2610\"; }\n"
|
||||
"li.checked::marker { content: \"\\2612\"; }\n"
|
||||
"</style></head><body style=\" font-family:\'Sans Serif\'; font-size:9pt; font-weight:400; font-style:normal;\">\n"
|
||||
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:\'Ubuntu\'; font-size:11pt;\"><br /></p></body></html>"))
|
||||
self.bauteilTypBtn.setText(_translate("MainWindow", "Bauteiltype erkennen"))
|
||||
self.bauteiltypTextbox.setHtml(_translate("MainWindow", "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
|
||||
"<html><head><meta name=\"qrichtext\" content=\"1\" /><meta charset=\"utf-8\" /><style type=\"text/css\">\n"
|
||||
"p, li { white-space: pre-wrap; }\n"
|
||||
"hr { height: 1px; border-width: 0; }\n"
|
||||
"li.unchecked::marker { content: \"\\2610\"; }\n"
|
||||
"li.checked::marker { content: \"\\2612\"; }\n"
|
||||
"</style></head><body style=\" font-family:\'Sans Serif\'; font-size:9pt; font-weight:400; font-style:normal;\">\n"
|
||||
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:\'Ubuntu\'; font-size:11pt;\"><br /></p></body></html>"))
|
||||
self.label_3.setText(_translate("MainWindow", "Bezeichnung"))
|
||||
self.label_4.setText(_translate("MainWindow", "Pos.-Nr:"))
|
||||
self.checkBox.setText(_translate("MainWindow", "Bauteiltype locked"))
|
||||
|
||||
|
||||
|
||||
import sys
|
||||
import cv2
|
||||
#from PyQt5 import QtCore, QtWidgets, QtGui
|
||||
|
||||
class CameraStreamApp(QtWidgets.QMainWindow):
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
self.initUI()
|
||||
|
||||
# OpenCV video capture (0 for the default camera)
|
||||
self.cap = None # Initialize capture as None (stream starts on button click)
|
||||
|
||||
# Timer for updating the frame
|
||||
self.timer = QtCore.QTimer(self)
|
||||
self.timer.timeout.connect(self.update_frame)
|
||||
|
||||
def initUI(self):
|
||||
self.setWindowTitle("Camera Stream")
|
||||
|
||||
# Create a QGraphicsView widget
|
||||
self.graphicsView = QtWidgets.QGraphicsView(self)
|
||||
self.graphicsView.setGeometry(QtCore.QRect(50, 50, 640, 480))
|
||||
self.graphicsView.setObjectName("graphicsView")
|
||||
|
||||
# Create a QGraphicsScene to hold the frame
|
||||
self.scene = QtWidgets.QGraphicsScene()
|
||||
self.graphicsView.setScene(self.scene)
|
||||
|
||||
# Create a button to start the camera stream
|
||||
self.startButton = QtWidgets.QPushButton('Start Camera', self)
|
||||
self.startButton.setGeometry(QtCore.QRect(50, 550, 120, 40)) # Position the button below the view
|
||||
self.startButton.clicked.connect(self.start_camera)
|
||||
|
||||
# Show the main window
|
||||
self.setGeometry(100, 100, 800, 600)
|
||||
self.show()
|
||||
|
||||
def start_camera(self):
|
||||
# Start OpenCV video capture (only if not already started)
|
||||
if self.cap is None:
|
||||
self.cap = cv2.VideoCapture(0)
|
||||
if not self.cap.isOpened():
|
||||
print("Error: Unable to open the camera.")
|
||||
return
|
||||
self.timer.start(30) # Start the timer to update the frame every 30ms (about 33 FPS)
|
||||
|
||||
def update_frame(self):
|
||||
if self.cap:
|
||||
ret, frame = self.cap.read() # Capture frame from the camera
|
||||
if ret:
|
||||
# Convert the frame from BGR (OpenCV format) to RGB
|
||||
frame = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)
|
||||
|
||||
# Convert the frame to QImage
|
||||
h, w, ch = frame.shape
|
||||
bytes_per_line = ch * w
|
||||
qt_image = QtGui.QImage(frame.data, w, h, bytes_per_line, QtGui.QImage.Format_RGB888)
|
||||
|
||||
# Add the QImage to a QPixmap
|
||||
pixmap = QtGui.QPixmap.fromImage(qt_image)
|
||||
|
||||
# Update the scene with the new pixmap
|
||||
self.scene.clear()
|
||||
self.scene.addPixmap(pixmap)
|
||||
|
||||
def closeEvent(self, event):
|
||||
# Release the camera when the application is closed
|
||||
if self.cap is not None:
|
||||
self.cap.release()
|
||||
event.accept()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
import sys
|
||||
app = QtWidgets.QApplication(sys.argv)
|
||||
MainWindow = QtWidgets.QMainWindow()
|
||||
ui = Ui_MainWindow()
|
||||
ui.setupUi(MainWindow)
|
||||
MainWindow.show()
|
||||
sys.exit(app.exec_())
|
181
bjoerntest3.py
Normal file
@ -0,0 +1,181 @@
|
||||
from PyQt5 import QtCore, QtGui, QtWidgets
|
||||
import cv2
|
||||
import sys
|
||||
|
||||
class Ui_MainWindow(object):
|
||||
def setupUi(self, MainWindow):
|
||||
MainWindow.setObjectName("MainWindow")
|
||||
MainWindow.resize(1090, 675)
|
||||
self.centralwidget = QtWidgets.QWidget(MainWindow)
|
||||
self.centralwidget.setObjectName("centralwidget")
|
||||
self.btn1 = QtWidgets.QPushButton(self.centralwidget)
|
||||
self.btn1.setGeometry(QtCore.QRect(900, 80, 111, 25))
|
||||
self.btn1.setObjectName("btn1")
|
||||
self.AuftragsdetailsTable = QtWidgets.QTableWidget(self.centralwidget)
|
||||
self.AuftragsdetailsTable.setGeometry(QtCore.QRect(10, 10, 661, 192))
|
||||
self.AuftragsdetailsTable.setEditTriggers(QtWidgets.QAbstractItemView.NoEditTriggers)
|
||||
self.AuftragsdetailsTable.setObjectName("AuftragsdetailsTable")
|
||||
self.AuftragsdetailsTable.setColumnCount(5)
|
||||
self.AuftragsdetailsTable.setRowCount(1)
|
||||
item = QtWidgets.QTableWidgetItem()
|
||||
self.AuftragsdetailsTable.setVerticalHeaderItem(0, item)
|
||||
item = QtWidgets.QTableWidgetItem()
|
||||
font = QtGui.QFont()
|
||||
font.setPointSize(8)
|
||||
item.setFont(font)
|
||||
self.AuftragsdetailsTable.setHorizontalHeaderItem(0, item)
|
||||
item = QtWidgets.QTableWidgetItem()
|
||||
font.setPointSize(8)
|
||||
item.setFont(font)
|
||||
self.AuftragsdetailsTable.setHorizontalHeaderItem(1, item)
|
||||
item = QtWidgets.QTableWidgetItem()
|
||||
font.setPointSize(8)
|
||||
item.setFont(font)
|
||||
self.AuftragsdetailsTable.setHorizontalHeaderItem(2, item)
|
||||
item = QtWidgets.QTableWidgetItem()
|
||||
font.setPointSize(8)
|
||||
item.setFont(font)
|
||||
self.AuftragsdetailsTable.setHorizontalHeaderItem(3, item)
|
||||
item = QtWidgets.QTableWidgetItem()
|
||||
font.setPointSize(8)
|
||||
item.setFont(font)
|
||||
self.AuftragsdetailsTable.setHorizontalHeaderItem(4, item)
|
||||
item = QtWidgets.QTableWidgetItem()
|
||||
self.AuftragsdetailsTable.setItem(0, 0, item)
|
||||
self.label = QtWidgets.QLabel(self.centralwidget)
|
||||
self.label.setGeometry(QtCore.QRect(900, 20, 121, 17))
|
||||
self.label.setObjectName("label")
|
||||
self.textEdit = QtWidgets.QTextEdit(self.centralwidget)
|
||||
self.textEdit.setGeometry(QtCore.QRect(860, 40, 221, 31))
|
||||
self.textEdit.setObjectName("textEdit")
|
||||
self.bauteilTypBtn = QtWidgets.QPushButton(self.centralwidget)
|
||||
self.bauteilTypBtn.setGeometry(QtCore.QRect(60, 340, 161, 25))
|
||||
self.bauteilTypBtn.setObjectName("bauteilTypBtn")
|
||||
self.bauteiltypTextbox = QtWidgets.QTextEdit(self.centralwidget)
|
||||
self.bauteiltypTextbox.setGeometry(QtCore.QRect(230, 340, 221, 31))
|
||||
self.bauteiltypTextbox.setObjectName("bauteiltypTextbox")
|
||||
self.label_3 = QtWidgets.QLabel(self.centralwidget)
|
||||
self.label_3.setGeometry(QtCore.QRect(250, 320, 181, 20))
|
||||
self.label_3.setObjectName("label_3")
|
||||
self.label_4 = QtWidgets.QLabel(self.centralwidget)
|
||||
self.label_4.setGeometry(QtCore.QRect(520, 320, 67, 17))
|
||||
self.label_4.setObjectName("label_4")
|
||||
self.textEdit_3 = QtWidgets.QTextEdit(self.centralwidget)
|
||||
self.textEdit_3.setGeometry(QtCore.QRect(460, 340, 191, 31))
|
||||
self.textEdit_3.setObjectName("textEdit_3")
|
||||
self.checkBox = QtWidgets.QCheckBox(self.centralwidget)
|
||||
self.checkBox.setGeometry(QtCore.QRect(70, 410, 151, 23))
|
||||
self.checkBox.setChecked(False)
|
||||
self.checkBox.setObjectName("checkBox")
|
||||
self.graphicsView = QtWidgets.QGraphicsView(self.centralwidget)
|
||||
self.graphicsView.setGeometry(QtCore.QRect(800, 280, 256, 192))
|
||||
self.graphicsView.setObjectName("graphicsView")
|
||||
MainWindow.setCentralWidget(self.centralwidget)
|
||||
self.menubar = QtWidgets.QMenuBar(MainWindow)
|
||||
self.menubar.setGeometry(QtCore.QRect(0, 0, 1090, 22))
|
||||
self.menubar.setObjectName("menubar")
|
||||
MainWindow.setMenuBar(self.menubar)
|
||||
self.statusbar = QtWidgets.QStatusBar(MainWindow)
|
||||
self.statusbar.setObjectName("statusbar")
|
||||
MainWindow.setStatusBar(self.statusbar)
|
||||
|
||||
self.retranslateUi(MainWindow)
|
||||
QtCore.QMetaObject.connectSlotsByName(MainWindow)
|
||||
|
||||
def retranslateUi(self, MainWindow):
|
||||
_translate = QtCore.QCoreApplication.translate
|
||||
MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow"))
|
||||
self.btn1.setText(_translate("MainWindow", "load Auftrag"))
|
||||
self.label.setText(_translate("MainWindow", "Auftragsnummer:"))
|
||||
self.bauteilTypBtn.setText(_translate("MainWindow", "Bauteiltype erkennen"))
|
||||
self.label_3.setText(_translate("MainWindow", "Bezeichnung"))
|
||||
self.label_4.setText(_translate("MainWindow", "Pos.-Nr:"))
|
||||
self.checkBox.setText(_translate("MainWindow", "Bauteiltype locked"))
|
||||
|
||||
|
||||
class CameraStreamApp(QtWidgets.QMainWindow):
|
||||
def __init__(self, ui):
|
||||
super().__init__()
|
||||
self.ui = ui
|
||||
self.cap = None # Initialize capture as None (stream starts on button click)
|
||||
|
||||
# Timer for updating the frame
|
||||
self.timer = QtCore.QTimer(self)
|
||||
self.timer.timeout.connect(self.update_frame)
|
||||
|
||||
# Set up the camera stream button
|
||||
self.ui.btn1.clicked.connect(self.start_camera)
|
||||
|
||||
# Set up the graphics view and scene
|
||||
self.scene = QtWidgets.QGraphicsScene(self)
|
||||
self.ui.graphicsView.setScene(self.scene)
|
||||
|
||||
def start_camera(self):
|
||||
# Start OpenCV video capture (only if not already started)
|
||||
if self.cap is None:
|
||||
self.cap = cv2.VideoCapture(0)
|
||||
if not self.cap.isOpened():
|
||||
print("Error: Unable to open the camera.")
|
||||
return
|
||||
self.timer.start(30) # Start the timer to update the frame every 30ms (about 33 FPS)
|
||||
|
||||
# def update_frame(self):
|
||||
# if self.cap:
|
||||
# ret, frame = self.cap.read() # Capture frame from the camera
|
||||
# if ret:
|
||||
# # Convert the frame from BGR (OpenCV format) to RGB
|
||||
# frame = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)
|
||||
|
||||
# # Convert the frame to QImage
|
||||
# h, w, ch = frame.shape
|
||||
# bytes_per_line = ch * w
|
||||
# qt_image = QtGui.QImage(frame.data, w, h, bytes_per_line, QtGui.QImage.Format_RGB888)
|
||||
|
||||
# # Add the QImage to a QPixmap
|
||||
# pixmap = QtGui.QPixmap.fromImage(qt_image)
|
||||
|
||||
# # Update the scene with the new pixmap
|
||||
# self.scene.clear()
|
||||
# self.scene.addPixmap(pixmap)
|
||||
|
||||
def update_frame(self):
|
||||
if self.cap:
|
||||
ret, frame = self.cap.read() # Capture frame from the camera
|
||||
if ret:
|
||||
# Convert the frame from BGR (OpenCV format) to RGB
|
||||
frame = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)
|
||||
|
||||
# Convert the frame to QImage
|
||||
h, w, ch = frame.shape
|
||||
bytes_per_line = ch * w
|
||||
qt_image = QtGui.QImage(frame.data, w, h, bytes_per_line, QtGui.QImage.Format_RGB888)
|
||||
|
||||
# Add the QImage to a QPixmap
|
||||
pixmap = QtGui.QPixmap.fromImage(qt_image)
|
||||
|
||||
# Get the size of the graphicsView and scale the pixmap to fit
|
||||
view_size = self.ui.graphicsView.size()
|
||||
scaled_pixmap = pixmap.scaled(view_size, QtCore.Qt.KeepAspectRatio)
|
||||
|
||||
# Update the scene with the scaled pixmap
|
||||
self.scene.clear()
|
||||
self.scene.addPixmap(scaled_pixmap)
|
||||
|
||||
def closeEvent(self, event):
|
||||
# Release the camera when the application is closed
|
||||
if self.cap is not None:
|
||||
self.cap.release()
|
||||
event.accept()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
app = QtWidgets.QApplication(sys.argv)
|
||||
MainWindow = QtWidgets.QMainWindow()
|
||||
ui = Ui_MainWindow()
|
||||
ui.setupUi(MainWindow)
|
||||
|
||||
# Initialize the CameraStreamApp with the UI
|
||||
camera_app = CameraStreamApp(ui)
|
||||
|
||||
MainWindow.show()
|
||||
sys.exit(app.exec_())
|
154
bjoerntest4.py
Normal file
@ -0,0 +1,154 @@
|
||||
from PyQt5 import QtCore, QtGui, QtWidgets
|
||||
import cv2
|
||||
import sys
|
||||
from CameraStream import YOLOv8CameraStream # Import the YOLOv8CameraStream class
|
||||
|
||||
class Ui_MainWindow(object):
|
||||
def setupUi(self, MainWindow):
|
||||
MainWindow.setObjectName("MainWindow")
|
||||
MainWindow.resize(1090, 675)
|
||||
self.centralwidget = QtWidgets.QWidget(MainWindow)
|
||||
self.centralwidget.setObjectName("centralwidget")
|
||||
self.btn1 = QtWidgets.QPushButton(self.centralwidget)
|
||||
self.btn1.setGeometry(QtCore.QRect(900, 80, 111, 25))
|
||||
self.btn1.setObjectName("btn1")
|
||||
self.AuftragsdetailsTable = QtWidgets.QTableWidget(self.centralwidget)
|
||||
self.AuftragsdetailsTable.setGeometry(QtCore.QRect(10, 10, 661, 192))
|
||||
self.AuftragsdetailsTable.setEditTriggers(QtWidgets.QAbstractItemView.NoEditTriggers)
|
||||
self.AuftragsdetailsTable.setObjectName("AuftragsdetailsTable")
|
||||
self.AuftragsdetailsTable.setColumnCount(5)
|
||||
self.AuftragsdetailsTable.setRowCount(1)
|
||||
item = QtWidgets.QTableWidgetItem()
|
||||
self.AuftragsdetailsTable.setVerticalHeaderItem(0, item)
|
||||
item = QtWidgets.QTableWidgetItem()
|
||||
font = QtGui.QFont()
|
||||
font.setPointSize(8)
|
||||
item.setFont(font)
|
||||
self.AuftragsdetailsTable.setHorizontalHeaderItem(0, item)
|
||||
item = QtWidgets.QTableWidgetItem()
|
||||
font.setPointSize(8)
|
||||
item.setFont(font)
|
||||
self.AuftragsdetailsTable.setHorizontalHeaderItem(1, item)
|
||||
item = QtWidgets.QTableWidgetItem()
|
||||
font.setPointSize(8)
|
||||
item.setFont(font)
|
||||
self.AuftragsdetailsTable.setHorizontalHeaderItem(2, item)
|
||||
item = QtWidgets.QTableWidgetItem()
|
||||
font.setPointSize(8)
|
||||
item.setFont(font)
|
||||
self.AuftragsdetailsTable.setHorizontalHeaderItem(3, item)
|
||||
item = QtWidgets.QTableWidgetItem()
|
||||
font.setPointSize(8)
|
||||
item.setFont(font)
|
||||
self.AuftragsdetailsTable.setHorizontalHeaderItem(4, item)
|
||||
item = QtWidgets.QTableWidgetItem()
|
||||
self.AuftragsdetailsTable.setItem(0, 0, item)
|
||||
self.label = QtWidgets.QLabel(self.centralwidget)
|
||||
self.label.setGeometry(QtCore.QRect(900, 20, 121, 17))
|
||||
self.label.setObjectName("label")
|
||||
self.textEdit = QtWidgets.QTextEdit(self.centralwidget)
|
||||
self.textEdit.setGeometry(QtCore.QRect(860, 40, 221, 31))
|
||||
self.textEdit.setObjectName("textEdit")
|
||||
self.bauteilTypBtn = QtWidgets.QPushButton(self.centralwidget)
|
||||
self.bauteilTypBtn.setGeometry(QtCore.QRect(60, 340, 161, 25))
|
||||
self.bauteilTypBtn.setObjectName("bauteilTypBtn")
|
||||
self.bauteiltypTextbox = QtWidgets.QTextEdit(self.centralwidget)
|
||||
self.bauteiltypTextbox.setGeometry(QtCore.QRect(230, 340, 221, 31))
|
||||
self.bauteiltypTextbox.setObjectName("bauteiltypTextbox")
|
||||
self.label_3 = QtWidgets.QLabel(self.centralwidget)
|
||||
self.label_3.setGeometry(QtCore.QRect(250, 320, 181, 20))
|
||||
self.label_3.setObjectName("label_3")
|
||||
self.label_4 = QtWidgets.QLabel(self.centralwidget)
|
||||
self.label_4.setGeometry(QtCore.QRect(520, 320, 67, 17))
|
||||
self.label_4.setObjectName("label_4")
|
||||
self.textEdit_3 = QtWidgets.QTextEdit(self.centralwidget)
|
||||
self.textEdit_3.setGeometry(QtCore.QRect(460, 340, 191, 31))
|
||||
self.textEdit_3.setObjectName("textEdit_3")
|
||||
self.checkBox = QtWidgets.QCheckBox(self.centralwidget)
|
||||
self.checkBox.setGeometry(QtCore.QRect(70, 410, 151, 23))
|
||||
self.checkBox.setChecked(False)
|
||||
self.checkBox.setObjectName("checkBox")
|
||||
self.graphicsView = QtWidgets.QGraphicsView(self.centralwidget)
|
||||
self.graphicsView.setGeometry(QtCore.QRect(800, 280, 256, 192))
|
||||
self.graphicsView.setObjectName("graphicsView")
|
||||
MainWindow.setCentralWidget(self.centralwidget)
|
||||
self.menubar = QtWidgets.QMenuBar(MainWindow)
|
||||
self.menubar.setGeometry(QtCore.QRect(0, 0, 1090, 22))
|
||||
self.menubar.setObjectName("menubar")
|
||||
MainWindow.setMenuBar(self.menubar)
|
||||
self.statusbar = QtWidgets.QStatusBar(MainWindow)
|
||||
self.statusbar.setObjectName("statusbar")
|
||||
MainWindow.setStatusBar(self.statusbar)
|
||||
|
||||
self.retranslateUi(MainWindow)
|
||||
QtCore.QMetaObject.connectSlotsByName(MainWindow)
|
||||
|
||||
def retranslateUi(self, MainWindow):
|
||||
_translate = QtCore.QCoreApplication.translate
|
||||
MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow"))
|
||||
self.btn1.setText(_translate("MainWindow", "load Auftrag"))
|
||||
self.label.setText(_translate("MainWindow", "Auftragsnummer:"))
|
||||
self.bauteilTypBtn.setText(_translate("MainWindow", "Bauteiltype erkennen"))
|
||||
self.label_3.setText(_translate("MainWindow", "Bezeichnung"))
|
||||
self.label_4.setText(_translate("MainWindow", "Pos.-Nr:"))
|
||||
self.checkBox.setText(_translate("MainWindow", "Bauteiltype locked"))
|
||||
|
||||
class CameraStreamApp(QtWidgets.QMainWindow):
|
||||
def __init__(self, ui):
|
||||
super().__init__()
|
||||
self.ui = ui
|
||||
self.yolo_stream = None # Initialize YOLOv8CameraStream as None
|
||||
self.timer = QtCore.QTimer(self)
|
||||
self.timer.timeout.connect(self.update_frame)
|
||||
self.ui.btn1.clicked.connect(self.start_camera) # start camera if button LoadAuftrag is clicked
|
||||
self.scene = QtWidgets.QGraphicsScene(self)
|
||||
self.ui.graphicsView.setScene(self.scene)
|
||||
|
||||
def start_camera(self):
|
||||
# Start the YOLOv8 camera stream (only if not already started)
|
||||
if self.yolo_stream is None:
|
||||
self.yolo_stream = YOLOv8CameraStream(model_path="models/yolov8m_seg_e300.pt", logging_level="high")
|
||||
# self.yolo_stream.start() # Start the YOLOv8 stream
|
||||
self.timer.start(30) # Start the timer to update the frame every 30ms (about 33 FPS)
|
||||
|
||||
def update_frame(self):
|
||||
# Update the frame from YOLOv8 stream
|
||||
if self.yolo_stream:
|
||||
ret, frame = self.yolo_stream.cap.read() # Capture frame from YOLOv8 stream
|
||||
if ret:
|
||||
# Convert the frame from BGR (OpenCV format) to RGB
|
||||
frame = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)
|
||||
|
||||
# Convert the frame to QImage
|
||||
h, w, ch = frame.shape
|
||||
bytes_per_line = ch * w
|
||||
qt_image = QtGui.QImage(frame.data, w, h, bytes_per_line, QtGui.QImage.Format_RGB888)
|
||||
|
||||
# Add the QImage to a QPixmap
|
||||
pixmap = QtGui.QPixmap.fromImage(qt_image)
|
||||
|
||||
# Get the size of the graphicsView and scale the pixmap to fit
|
||||
view_size = self.ui.graphicsView.size()
|
||||
scaled_pixmap = pixmap.scaled(view_size, QtCore.Qt.KeepAspectRatio)
|
||||
|
||||
# Update the scene with the scaled pixmap
|
||||
self.scene.clear()
|
||||
self.scene.addPixmap(scaled_pixmap)
|
||||
|
||||
def closeEvent(self, event):
|
||||
# Release the camera when the application is closed
|
||||
if self.yolo_stream is not None:
|
||||
self.yolo_stream.cap.release()
|
||||
event.accept()
|
||||
|
||||
if __name__ == "__main__":
|
||||
app = QtWidgets.QApplication(sys.argv)
|
||||
MainWindow = QtWidgets.QMainWindow()
|
||||
ui = Ui_MainWindow()
|
||||
ui.setupUi(MainWindow)
|
||||
|
||||
# Initialize the CameraStreamApp with the UI
|
||||
camera_app = CameraStreamApp(ui)
|
||||
|
||||
MainWindow.show()
|
||||
sys.exit(app.exec_())
|
159
bjoerntest5.py
Normal file
@ -0,0 +1,159 @@
|
||||
from PyQt5 import QtCore, QtGui, QtWidgets
|
||||
import cv2
|
||||
import sys
|
||||
from CameraStream import YOLOv8CameraStream # Import the YOLOv8CameraStream class
|
||||
|
||||
class Ui_MainWindow(object):
|
||||
def setupUi(self, MainWindow):
|
||||
MainWindow.setObjectName("MainWindow")
|
||||
MainWindow.resize(1090, 675)
|
||||
self.centralwidget = QtWidgets.QWidget(MainWindow)
|
||||
self.centralwidget.setObjectName("centralwidget")
|
||||
self.btn1 = QtWidgets.QPushButton(self.centralwidget)
|
||||
self.btn1.setGeometry(QtCore.QRect(900, 80, 111, 25))
|
||||
self.btn1.setObjectName("btn1")
|
||||
self.AuftragsdetailsTable = QtWidgets.QTableWidget(self.centralwidget)
|
||||
self.AuftragsdetailsTable.setGeometry(QtCore.QRect(10, 10, 661, 192))
|
||||
self.AuftragsdetailsTable.setEditTriggers(QtWidgets.QAbstractItemView.NoEditTriggers)
|
||||
self.AuftragsdetailsTable.setObjectName("AuftragsdetailsTable")
|
||||
self.AuftragsdetailsTable.setColumnCount(5)
|
||||
self.AuftragsdetailsTable.setRowCount(1)
|
||||
item = QtWidgets.QTableWidgetItem()
|
||||
self.AuftragsdetailsTable.setVerticalHeaderItem(0, item)
|
||||
item = QtWidgets.QTableWidgetItem()
|
||||
font = QtGui.QFont()
|
||||
font.setPointSize(8)
|
||||
item.setFont(font)
|
||||
self.AuftragsdetailsTable.setHorizontalHeaderItem(0, item)
|
||||
item = QtWidgets.QTableWidgetItem()
|
||||
font.setPointSize(8)
|
||||
item.setFont(font)
|
||||
self.AuftragsdetailsTable.setHorizontalHeaderItem(1, item)
|
||||
item = QtWidgets.QTableWidgetItem()
|
||||
font.setPointSize(8)
|
||||
item.setFont(font)
|
||||
self.AuftragsdetailsTable.setHorizontalHeaderItem(2, item)
|
||||
item = QtWidgets.QTableWidgetItem()
|
||||
font.setPointSize(8)
|
||||
item.setFont(font)
|
||||
self.AuftragsdetailsTable.setHorizontalHeaderItem(3, item)
|
||||
item = QtWidgets.QTableWidgetItem()
|
||||
font.setPointSize(8)
|
||||
item.setFont(font)
|
||||
self.AuftragsdetailsTable.setHorizontalHeaderItem(4, item)
|
||||
item = QtWidgets.QTableWidgetItem()
|
||||
self.AuftragsdetailsTable.setItem(0, 0, item)
|
||||
self.label = QtWidgets.QLabel(self.centralwidget)
|
||||
self.label.setGeometry(QtCore.QRect(900, 20, 121, 17))
|
||||
self.label.setObjectName("label")
|
||||
self.textEdit = QtWidgets.QTextEdit(self.centralwidget)
|
||||
self.textEdit.setGeometry(QtCore.QRect(860, 40, 221, 31))
|
||||
self.textEdit.setObjectName("textEdit")
|
||||
self.bauteilTypBtn = QtWidgets.QPushButton(self.centralwidget)
|
||||
self.bauteilTypBtn.setGeometry(QtCore.QRect(60, 340, 161, 25))
|
||||
self.bauteilTypBtn.setObjectName("bauteilTypBtn")
|
||||
self.bauteiltypTextbox = QtWidgets.QTextEdit(self.centralwidget)
|
||||
self.bauteiltypTextbox.setGeometry(QtCore.QRect(230, 340, 221, 31))
|
||||
self.bauteiltypTextbox.setObjectName("bauteiltypTextbox")
|
||||
self.label_3 = QtWidgets.QLabel(self.centralwidget)
|
||||
self.label_3.setGeometry(QtCore.QRect(250, 320, 181, 20))
|
||||
self.label_3.setObjectName("label_3")
|
||||
self.label_4 = QtWidgets.QLabel(self.centralwidget)
|
||||
self.label_4.setGeometry(QtCore.QRect(520, 320, 67, 17))
|
||||
self.label_4.setObjectName("label_4")
|
||||
self.textEdit_3 = QtWidgets.QTextEdit(self.centralwidget)
|
||||
self.textEdit_3.setGeometry(QtCore.QRect(460, 340, 191, 31))
|
||||
self.textEdit_3.setObjectName("textEdit_3")
|
||||
self.checkBox = QtWidgets.QCheckBox(self.centralwidget)
|
||||
self.checkBox.setGeometry(QtCore.QRect(70, 410, 151, 23))
|
||||
self.checkBox.setChecked(False)
|
||||
self.checkBox.setObjectName("checkBox")
|
||||
self.graphicsView = QtWidgets.QGraphicsView(self.centralwidget)
|
||||
self.graphicsView.setGeometry(QtCore.QRect(800, 280, 256, 192))
|
||||
self.graphicsView.setObjectName("graphicsView")
|
||||
MainWindow.setCentralWidget(self.centralwidget)
|
||||
self.menubar = QtWidgets.QMenuBar(MainWindow)
|
||||
self.menubar.setGeometry(QtCore.QRect(0, 0, 1090, 22))
|
||||
self.menubar.setObjectName("menubar")
|
||||
MainWindow.setMenuBar(self.menubar)
|
||||
self.statusbar = QtWidgets.QStatusBar(MainWindow)
|
||||
self.statusbar.setObjectName("statusbar")
|
||||
MainWindow.setStatusBar(self.statusbar)
|
||||
|
||||
self.retranslateUi(MainWindow)
|
||||
QtCore.QMetaObject.connectSlotsByName(MainWindow)
|
||||
|
||||
def retranslateUi(self, MainWindow):
|
||||
_translate = QtCore.QCoreApplication.translate
|
||||
MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow"))
|
||||
self.btn1.setText(_translate("MainWindow", "load Auftrag"))
|
||||
self.label.setText(_translate("MainWindow", "Auftragsnummer:"))
|
||||
self.bauteilTypBtn.setText(_translate("MainWindow", "Bauteiltype erkennen"))
|
||||
self.label_3.setText(_translate("MainWindow", "Bezeichnung"))
|
||||
self.label_4.setText(_translate("MainWindow", "Pos.-Nr:"))
|
||||
self.checkBox.setText(_translate("MainWindow", "Bauteiltype locked"))
|
||||
|
||||
class CameraStreamApp(QtWidgets.QMainWindow):
|
||||
def __init__(self, ui):
|
||||
super().__init__()
|
||||
self.ui = ui
|
||||
self.yolo_stream = None # Initialize YOLOv8CameraStream as None
|
||||
self.timer = QtCore.QTimer(self)
|
||||
self.timer.timeout.connect(self.update_frame)
|
||||
self.ui.btn1.clicked.connect(self.start_camera) # start camera if button LoadAuftrag is clicked
|
||||
self.scene = QtWidgets.QGraphicsScene(self)
|
||||
self.ui.graphicsView.setScene(self.scene)
|
||||
|
||||
def start_camera(self):
|
||||
# Start the YOLOv8 camera stream (only if not already started)
|
||||
if self.yolo_stream is None:
|
||||
self.yolo_stream = YOLOv8CameraStream(model_path="models/yolov8m_seg_e300.pt", logging_level="high")
|
||||
# self.yolo_stream.start() # Start the YOLOv8 stream
|
||||
self.timer.start(30) # Start the timer to update the frame every 30ms (about 33 FPS)
|
||||
|
||||
def update_frame(self):
|
||||
# Update the frame from YOLOv8 stream
|
||||
if self.yolo_stream:
|
||||
ret, frame = self.yolo_stream.cap.read() # Capture frame from YOLOv8 stream
|
||||
|
||||
if ret:
|
||||
# new part including processing via yolo model
|
||||
processed_frame = self.yolo_stream.process_frame(frame)
|
||||
|
||||
# Convert the frame from BGR (OpenCV format) to RGB
|
||||
# frame = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)
|
||||
frame = cv2.cvtColor(processed_frame, cv2.COLOR_BGR2RGB) # might change nomenclature later?
|
||||
|
||||
# Convert the frame to QImage
|
||||
h, w, ch = frame.shape
|
||||
bytes_per_line = ch * w
|
||||
qt_image = QtGui.QImage(frame.data, w, h, bytes_per_line, QtGui.QImage.Format_RGB888)
|
||||
|
||||
# Add the QImage to a QPixmap
|
||||
pixmap = QtGui.QPixmap.fromImage(qt_image)
|
||||
|
||||
# Get the size of the graphicsView and scale the pixmap to fit
|
||||
view_size = self.ui.graphicsView.size()
|
||||
scaled_pixmap = pixmap.scaled(view_size, QtCore.Qt.KeepAspectRatio)
|
||||
|
||||
# Update the scene with the scaled pixmap
|
||||
self.scene.clear()
|
||||
self.scene.addPixmap(scaled_pixmap)
|
||||
|
||||
def closeEvent(self, event):
|
||||
# Release the camera when the application is closed
|
||||
if self.yolo_stream is not None:
|
||||
self.yolo_stream.cap.release()
|
||||
event.accept()
|
||||
|
||||
if __name__ == "__main__":
|
||||
app = QtWidgets.QApplication(sys.argv)
|
||||
MainWindow = QtWidgets.QMainWindow()
|
||||
ui = Ui_MainWindow()
|
||||
ui.setupUi(MainWindow)
|
||||
|
||||
# Initialize the CameraStreamApp with the UI
|
||||
camera_app = CameraStreamApp(ui)
|
||||
|
||||
MainWindow.show()
|
||||
sys.exit(app.exec_())
|
138
bjoerntest6.py
Normal file
@ -0,0 +1,138 @@
|
||||
from PyQt5 import QtCore, QtGui, QtWidgets
|
||||
import cv2
|
||||
import sys
|
||||
from CameraStream import YOLOv8CameraStream # Import the YOLOv8CameraStream class
|
||||
|
||||
class Ui_MainWindow(object):
|
||||
def setupUi(self, MainWindow):
|
||||
MainWindow.setObjectName("MainWindow")
|
||||
MainWindow.resize(1090, 675)
|
||||
self.centralwidget = QtWidgets.QWidget(MainWindow)
|
||||
self.centralwidget.setObjectName("centralwidget")
|
||||
|
||||
# Create a vertical layout
|
||||
self.layout = QtWidgets.QVBoxLayout(self.centralwidget)
|
||||
|
||||
# Add your widgets to the layout
|
||||
self.AuftragsdetailsTable = QtWidgets.QTableWidget(self.centralwidget)
|
||||
self.AuftragsdetailsTable.setEditTriggers(QtWidgets.QAbstractItemView.NoEditTriggers)
|
||||
self.AuftragsdetailsTable.setColumnCount(5)
|
||||
self.AuftragsdetailsTable.setRowCount(1)
|
||||
self.layout.addWidget(self.AuftragsdetailsTable)
|
||||
|
||||
self.label = QtWidgets.QLabel(self.centralwidget)
|
||||
self.layout.addWidget(self.label)
|
||||
|
||||
self.textEdit = QtWidgets.QTextEdit(self.centralwidget)
|
||||
self.layout.addWidget(self.textEdit)
|
||||
|
||||
self.bauteilTypBtn = QtWidgets.QPushButton(self.centralwidget)
|
||||
self.layout.addWidget(self.bauteilTypBtn)
|
||||
|
||||
self.bauteiltypTextbox = QtWidgets.QTextEdit(self.centralwidget)
|
||||
self.layout.addWidget(self.bauteiltypTextbox)
|
||||
|
||||
self.label_3 = QtWidgets.QLabel(self.centralwidget)
|
||||
self.layout.addWidget(self.label_3)
|
||||
|
||||
self.label_4 = QtWidgets.QLabel(self.centralwidget)
|
||||
self.layout.addWidget(self.label_4)
|
||||
|
||||
self.textEdit_3 = QtWidgets.QTextEdit(self.centralwidget)
|
||||
self.layout.addWidget(self.textEdit_3)
|
||||
|
||||
self.checkBox = QtWidgets.QCheckBox(self.centralwidget)
|
||||
self.layout.addWidget(self.checkBox)
|
||||
|
||||
# Create the QGraphicsView
|
||||
self.graphicsView = QtWidgets.QGraphicsView(self.centralwidget)
|
||||
self.layout.addWidget(self.graphicsView)
|
||||
|
||||
# Add a button to the layout
|
||||
self.btn1 = QtWidgets.QPushButton(self.centralwidget)
|
||||
self.layout.addWidget(self.btn1)
|
||||
|
||||
# Set the layout for the central widget
|
||||
self.centralwidget.setLayout(self.layout)
|
||||
|
||||
MainWindow.setCentralWidget(self.centralwidget)
|
||||
self.menubar = QtWidgets.QMenuBar(MainWindow)
|
||||
MainWindow.setMenuBar(self.menubar)
|
||||
self.statusbar = QtWidgets.QStatusBar(MainWindow)
|
||||
MainWindow.setStatusBar(self.statusbar)
|
||||
|
||||
self.retranslateUi(MainWindow)
|
||||
QtCore.QMetaObject.connectSlotsByName(MainWindow)
|
||||
|
||||
def retranslateUi(self, MainWindow):
|
||||
_translate = QtCore.QCoreApplication.translate
|
||||
MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow"))
|
||||
self.btn1.setText(_translate("MainWindow", "load Auftrag"))
|
||||
self.label.setText(_translate("MainWindow", "Auftragsnummer:"))
|
||||
self.bauteilTypBtn.setText(_translate("MainWindow", "Bauteiltype erkennen"))
|
||||
self.label_3.setText(_translate("MainWindow", "Bezeichnung"))
|
||||
self.label_4.setText(_translate("MainWindow", "Pos.-Nr:"))
|
||||
self.checkBox.setText(_translate("MainWindow", "Bauteiltype locked"))
|
||||
|
||||
class CameraStreamApp(QtWidgets.QMainWindow):
|
||||
def __init__(self, ui):
|
||||
super().__init__()
|
||||
self.ui = ui
|
||||
self.yolo_stream = None # Initialize YOLOv8CameraStream as None
|
||||
self.timer = QtCore.QTimer(self)
|
||||
self.timer.timeout.connect(self.update_frame)
|
||||
self.ui.btn1.clicked.connect(self.start_camera) # start camera if button LoadAuftrag is clicked
|
||||
self.scene = QtWidgets.QGraphicsScene(self)
|
||||
self.ui.graphicsView.setScene(self.scene)
|
||||
|
||||
def start_camera(self):
|
||||
# Start the YOLOv8 camera stream (only if not already started)
|
||||
if self.yolo_stream is None:
|
||||
self.yolo_stream = YOLOv8CameraStream(model_path="models/yolov8m_seg_e300.pt", logging_level="high")
|
||||
self.timer.start(30) # Start the timer to update the frame every 30ms (about 33 FPS)
|
||||
|
||||
def update_frame(self):
|
||||
# Update the frame from YOLOv8 stream
|
||||
if self.yolo_stream:
|
||||
ret, frame = self.yolo_stream.cap.read() # Capture frame from YOLOv8 stream
|
||||
|
||||
if ret:
|
||||
# Process frame via YOLO model
|
||||
processed_frame = self.yolo_stream.process_frame(frame)
|
||||
|
||||
# Convert the frame from BGR (OpenCV format) to RGB
|
||||
frame = cv2.cvtColor(processed_frame, cv2.COLOR_BGR2RGB)
|
||||
|
||||
# Convert the frame to QImage
|
||||
h, w, ch = frame.shape
|
||||
bytes_per_line = ch * w
|
||||
qt_image = QtGui.QImage(frame.data, w, h, bytes_per_line, QtGui.QImage.Format_RGB888)
|
||||
|
||||
# Add the QImage to a QPixmap
|
||||
pixmap = QtGui.QPixmap.fromImage(qt_image)
|
||||
|
||||
# Get the size of the graphicsView and scale the pixmap to fit
|
||||
view_size = self.ui.graphicsView.size()
|
||||
scaled_pixmap = pixmap.scaled(view_size, QtCore.Qt.KeepAspectRatio)
|
||||
|
||||
# Update the scene with the scaled pixmap
|
||||
self.scene.clear()
|
||||
self.scene.addPixmap(scaled_pixmap)
|
||||
|
||||
def closeEvent(self, event):
|
||||
# Release the camera when the application is closed
|
||||
if self.yolo_stream is not None:
|
||||
self.yolo_stream.cap.release()
|
||||
event.accept()
|
||||
|
||||
if __name__ == "__main__":
|
||||
app = QtWidgets.QApplication(sys.argv)
|
||||
MainWindow = QtWidgets.QMainWindow()
|
||||
ui = Ui_MainWindow()
|
||||
ui.setupUi(MainWindow)
|
||||
|
||||
# Initialize the CameraStreamApp with the UI
|
||||
camera_app = CameraStreamApp(ui)
|
||||
|
||||
MainWindow.show()
|
||||
sys.exit(app.exec_())
|
142
bjoerntest7.py
Normal file
@ -0,0 +1,142 @@
|
||||
from PyQt5 import QtCore, QtGui, QtWidgets
|
||||
import cv2
|
||||
import sys
|
||||
from CameraStream import YOLOv8CameraStream # Import the YOLOv8CameraStream class
|
||||
|
||||
class Ui_MainWindow(object):
|
||||
def setupUi(self, MainWindow):
|
||||
MainWindow.setObjectName("MainWindow")
|
||||
MainWindow.resize(1090, 675)
|
||||
self.centralwidget = QtWidgets.QWidget(MainWindow)
|
||||
self.centralwidget.setObjectName("centralwidget")
|
||||
|
||||
# Create a horizontal layout for the main window
|
||||
self.layout = QtWidgets.QHBoxLayout(self.centralwidget)
|
||||
|
||||
# Left Column (Can be empty or have some widgets)
|
||||
self.left_column = QtWidgets.QWidget(self.centralwidget)
|
||||
self.left_layout = QtWidgets.QVBoxLayout(self.left_column)
|
||||
|
||||
# You can add more widgets to the left column here if needed
|
||||
self.label = QtWidgets.QLabel("Left Column (Empty)", self.left_column)
|
||||
self.left_layout.addWidget(self.label)
|
||||
|
||||
# Add left column widget to the main layout
|
||||
self.layout.addWidget(self.left_column)
|
||||
|
||||
# Right Column
|
||||
self.right_column = QtWidgets.QWidget(self.centralwidget)
|
||||
self.right_layout = QtWidgets.QVBoxLayout(self.right_column)
|
||||
|
||||
# Add your widgets to the right layout
|
||||
self.AuftragsdetailsTable = QtWidgets.QTableWidget(self.right_column)
|
||||
self.AuftragsdetailsTable.setEditTriggers(QtWidgets.QAbstractItemView.NoEditTriggers)
|
||||
self.AuftragsdetailsTable.setColumnCount(5)
|
||||
self.AuftragsdetailsTable.setRowCount(1)
|
||||
self.right_layout.addWidget(self.AuftragsdetailsTable)
|
||||
|
||||
self.textEdit = QtWidgets.QTextEdit(self.right_column)
|
||||
self.right_layout.addWidget(self.textEdit)
|
||||
|
||||
self.bauteilTypBtn = QtWidgets.QPushButton("Bauteiltype erkennen", self.right_column)
|
||||
self.right_layout.addWidget(self.bauteilTypBtn)
|
||||
|
||||
self.bauteiltypTextbox = QtWidgets.QTextEdit(self.right_column)
|
||||
self.right_layout.addWidget(self.bauteiltypTextbox)
|
||||
|
||||
self.label_3 = QtWidgets.QLabel("Bezeichnung", self.right_column)
|
||||
self.right_layout.addWidget(self.label_3)
|
||||
|
||||
self.label_4 = QtWidgets.QLabel("Pos.-Nr:", self.right_column)
|
||||
self.right_layout.addWidget(self.label_4)
|
||||
|
||||
self.textEdit_3 = QtWidgets.QTextEdit(self.right_column)
|
||||
self.right_layout.addWidget(self.textEdit_3)
|
||||
|
||||
self.checkBox = QtWidgets.QCheckBox("Bauteiltype locked", self.right_column)
|
||||
self.right_layout.addWidget(self.checkBox)
|
||||
|
||||
# Create the QGraphicsView
|
||||
self.graphicsView = QtWidgets.QGraphicsView(self.right_column)
|
||||
self.right_layout.addWidget(self.graphicsView)
|
||||
|
||||
# Add right column widget to the main layout
|
||||
self.layout.addWidget(self.right_column)
|
||||
|
||||
MainWindow.setCentralWidget(self.centralwidget)
|
||||
self.menubar = QtWidgets.QMenuBar(MainWindow)
|
||||
MainWindow.setMenuBar(self.menubar)
|
||||
self.statusbar = QtWidgets.QStatusBar(MainWindow)
|
||||
MainWindow.setStatusBar(self.statusbar)
|
||||
|
||||
self.retranslateUi(MainWindow)
|
||||
QtCore.QMetaObject.connectSlotsByName(MainWindow)
|
||||
|
||||
def retranslateUi(self, MainWindow):
|
||||
_translate = QtCore.QCoreApplication.translate
|
||||
MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow"))
|
||||
self.bauteilTypBtn.setText(_translate("MainWindow", "Bauteiltype erkennen"))
|
||||
# Add more translations as needed
|
||||
|
||||
class CameraStreamApp(QtWidgets.QMainWindow):
|
||||
def __init__(self, ui):
|
||||
super().__init__()
|
||||
self.ui = ui
|
||||
self.yolo_stream = None # Initialize YOLOv8CameraStream as None
|
||||
self.timer = QtCore.QTimer(self)
|
||||
self.timer.timeout.connect(self.update_frame)
|
||||
self.ui.bauteilTypBtn.clicked.connect(self.start_camera) # Connect the button to start the camera
|
||||
self.scene = QtWidgets.QGraphicsScene(self)
|
||||
self.ui.graphicsView.setScene(self.scene)
|
||||
|
||||
def start_camera(self):
|
||||
# Start the YOLOv8 camera stream (only if not already started)
|
||||
if self.yolo_stream is None:
|
||||
self.yolo_stream = YOLOv8CameraStream(model_path="models/yolov8m_seg_e300.pt", logging_level="high")
|
||||
self.timer.start(30) # Start the timer to update the frame every 30ms (about 33 FPS)
|
||||
|
||||
def update_frame(self):
|
||||
# Update the frame from YOLOv8 stream
|
||||
if self.yolo_stream:
|
||||
ret, frame = self.yolo_stream.cap.read() # Capture frame from YOLOv8 stream
|
||||
|
||||
if ret:
|
||||
# Process frame via YOLO model
|
||||
processed_frame = self.yolo_stream.process_frame(frame)
|
||||
|
||||
# Convert the frame from BGR (OpenCV format) to RGB
|
||||
frame = cv2.cvtColor(processed_frame, cv2.COLOR_BGR2RGB)
|
||||
|
||||
# Convert the frame to QImage
|
||||
h, w, ch = frame.shape
|
||||
bytes_per_line = ch * w
|
||||
qt_image = QtGui.QImage(frame.data, w, h, bytes_per_line, QtGui.QImage.Format_RGB888)
|
||||
|
||||
# Add the QImage to a QPixmap
|
||||
pixmap = QtGui.QPixmap.fromImage(qt_image)
|
||||
|
||||
# Get the size of the graphicsView and scale the pixmap to fit
|
||||
view_size = self.ui.graphicsView.size()
|
||||
scaled_pixmap = pixmap.scaled(view_size, QtCore.Qt.KeepAspectRatio)
|
||||
|
||||
# Update the scene with the scaled pixmap
|
||||
self.scene.clear()
|
||||
self.scene.addPixmap(scaled_pixmap)
|
||||
|
||||
def closeEvent(self, event):
|
||||
# Release the camera when the application is closed
|
||||
if self.yolo_stream is not None:
|
||||
self.yolo_stream.cap.release()
|
||||
event.accept()
|
||||
|
||||
if __name__ == "__main__":
|
||||
app = QtWidgets.QApplication(sys.argv)
|
||||
MainWindow = QtWidgets.QMainWindow()
|
||||
ui = Ui_MainWindow()
|
||||
ui.setupUi(MainWindow)
|
||||
|
||||
# Initialize the CameraStreamApp with the UI
|
||||
camera_app = CameraStreamApp(ui)
|
||||
|
||||
MainWindow.show()
|
||||
sys.exit(app.exec_())
|
159
bjoerntest8.py
Normal file
@ -0,0 +1,159 @@
|
||||
from PyQt5 import QtCore, QtGui, QtWidgets
|
||||
import cv2
|
||||
import sys
|
||||
from CameraStream import YOLOv8CameraStream # Import the YOLOv8CameraStream class
|
||||
|
||||
class Ui_MainWindow(object):
|
||||
def setupUi(self, MainWindow):
|
||||
MainWindow.setObjectName("MainWindow")
|
||||
MainWindow.resize(1090, 675)
|
||||
self.centralwidget = QtWidgets.QWidget(MainWindow)
|
||||
self.centralwidget.setObjectName("centralwidget")
|
||||
self.btn1 = QtWidgets.QPushButton(self.centralwidget)
|
||||
self.btn1.setGeometry(QtCore.QRect(900, 80, 111, 25))
|
||||
self.btn1.setObjectName("btn1")
|
||||
self.AuftragsdetailsTable = QtWidgets.QTableWidget(self.centralwidget)
|
||||
self.AuftragsdetailsTable.setGeometry(QtCore.QRect(10, 10, 661, 192))
|
||||
self.AuftragsdetailsTable.setEditTriggers(QtWidgets.QAbstractItemView.NoEditTriggers)
|
||||
self.AuftragsdetailsTable.setObjectName("AuftragsdetailsTable")
|
||||
self.AuftragsdetailsTable.setColumnCount(5)
|
||||
self.AuftragsdetailsTable.setRowCount(1)
|
||||
item = QtWidgets.QTableWidgetItem()
|
||||
self.AuftragsdetailsTable.setVerticalHeaderItem(0, item)
|
||||
item = QtWidgets.QTableWidgetItem()
|
||||
font = QtGui.QFont()
|
||||
font.setPointSize(8)
|
||||
item.setFont(font)
|
||||
self.AuftragsdetailsTable.setHorizontalHeaderItem(0, item)
|
||||
item = QtWidgets.QTableWidgetItem()
|
||||
font.setPointSize(8)
|
||||
item.setFont(font)
|
||||
self.AuftragsdetailsTable.setHorizontalHeaderItem(1, item)
|
||||
item = QtWidgets.QTableWidgetItem()
|
||||
font.setPointSize(8)
|
||||
item.setFont(font)
|
||||
self.AuftragsdetailsTable.setHorizontalHeaderItem(2, item)
|
||||
item = QtWidgets.QTableWidgetItem()
|
||||
font.setPointSize(8)
|
||||
item.setFont(font)
|
||||
self.AuftragsdetailsTable.setHorizontalHeaderItem(3, item)
|
||||
item = QtWidgets.QTableWidgetItem()
|
||||
font.setPointSize(8)
|
||||
item.setFont(font)
|
||||
self.AuftragsdetailsTable.setHorizontalHeaderItem(4, item)
|
||||
item = QtWidgets.QTableWidgetItem()
|
||||
self.AuftragsdetailsTable.setItem(0, 0, item)
|
||||
self.label = QtWidgets.QLabel(self.centralwidget)
|
||||
self.label.setGeometry(QtCore.QRect(900, 20, 121, 17))
|
||||
self.label.setObjectName("label")
|
||||
self.textEdit = QtWidgets.QTextEdit(self.centralwidget)
|
||||
self.textEdit.setGeometry(QtCore.QRect(860, 40, 221, 31))
|
||||
self.textEdit.setObjectName("textEdit")
|
||||
self.bauteilTypBtn = QtWidgets.QPushButton(self.centralwidget)
|
||||
self.bauteilTypBtn.setGeometry(QtCore.QRect(60, 340, 161, 25))
|
||||
self.bauteilTypBtn.setObjectName("bauteilTypBtn")
|
||||
self.bauteiltypTextbox = QtWidgets.QTextEdit(self.centralwidget)
|
||||
self.bauteiltypTextbox.setGeometry(QtCore.QRect(230, 340, 221, 31))
|
||||
self.bauteiltypTextbox.setObjectName("bauteiltypTextbox")
|
||||
self.label_3 = QtWidgets.QLabel(self.centralwidget)
|
||||
self.label_3.setGeometry(QtCore.QRect(250, 320, 181, 20))
|
||||
self.label_3.setObjectName("label_3")
|
||||
self.label_4 = QtWidgets.QLabel(self.centralwidget)
|
||||
self.label_4.setGeometry(QtCore.QRect(520, 320, 67, 17))
|
||||
self.label_4.setObjectName("label_4")
|
||||
self.textEdit_3 = QtWidgets.QTextEdit(self.centralwidget)
|
||||
self.textEdit_3.setGeometry(QtCore.QRect(460, 340, 191, 31))
|
||||
self.textEdit_3.setObjectName("textEdit_3")
|
||||
self.checkBox = QtWidgets.QCheckBox(self.centralwidget)
|
||||
self.checkBox.setGeometry(QtCore.QRect(70, 410, 151, 23))
|
||||
self.checkBox.setChecked(False)
|
||||
self.checkBox.setObjectName("checkBox")
|
||||
self.graphicsView = QtWidgets.QGraphicsView(self.centralwidget)
|
||||
self.graphicsView.setGeometry(QtCore.QRect(1100, 20, int(640*1.2), int(480*1.2))) # position and size of camera frame
|
||||
self.graphicsView.setObjectName("graphicsView")
|
||||
MainWindow.setCentralWidget(self.centralwidget)
|
||||
self.menubar = QtWidgets.QMenuBar(MainWindow)
|
||||
self.menubar.setGeometry(QtCore.QRect(0, 0, 1090, 22))
|
||||
self.menubar.setObjectName("menubar")
|
||||
MainWindow.setMenuBar(self.menubar)
|
||||
self.statusbar = QtWidgets.QStatusBar(MainWindow)
|
||||
self.statusbar.setObjectName("statusbar")
|
||||
MainWindow.setStatusBar(self.statusbar)
|
||||
|
||||
self.retranslateUi(MainWindow)
|
||||
QtCore.QMetaObject.connectSlotsByName(MainWindow)
|
||||
|
||||
def retranslateUi(self, MainWindow):
|
||||
_translate = QtCore.QCoreApplication.translate
|
||||
MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow"))
|
||||
self.btn1.setText(_translate("MainWindow", "load Auftrag"))
|
||||
self.label.setText(_translate("MainWindow", "Auftragsnummer:"))
|
||||
self.bauteilTypBtn.setText(_translate("MainWindow", "Bauteiltype erkennen"))
|
||||
self.label_3.setText(_translate("MainWindow", "Bezeichnung"))
|
||||
self.label_4.setText(_translate("MainWindow", "Pos.-Nr:"))
|
||||
self.checkBox.setText(_translate("MainWindow", "Bauteiltype locked"))
|
||||
|
||||
class CameraStreamApp(QtWidgets.QMainWindow):
|
||||
def __init__(self, ui):
|
||||
super().__init__()
|
||||
self.ui = ui
|
||||
self.yolo_stream = None # Initialize YOLOv8CameraStream as None
|
||||
self.timer = QtCore.QTimer(self)
|
||||
self.timer.timeout.connect(self.update_frame)
|
||||
self.ui.btn1.clicked.connect(self.start_camera) # start camera if button LoadAuftrag is clicked
|
||||
self.scene = QtWidgets.QGraphicsScene(self)
|
||||
self.ui.graphicsView.setScene(self.scene)
|
||||
|
||||
def start_camera(self):
|
||||
# Start the YOLOv8 camera stream (only if not already started)
|
||||
if self.yolo_stream is None:
|
||||
self.yolo_stream = YOLOv8CameraStream(model_path="models/yolov8m_seg_e300.pt", logging_level="high")
|
||||
# self.yolo_stream.start() # Start the YOLOv8 stream
|
||||
self.timer.start(30) # Start the timer to update the frame every 30ms (about 33 FPS)
|
||||
|
||||
def update_frame(self):
|
||||
# Update the frame from YOLOv8 stream
|
||||
if self.yolo_stream:
|
||||
ret, frame = self.yolo_stream.cap.read() # Capture frame from YOLOv8 stream
|
||||
|
||||
if ret:
|
||||
# new part including processing via yolo model
|
||||
processed_frame = self.yolo_stream.process_frame(frame)
|
||||
|
||||
# Convert the frame from BGR (OpenCV format) to RGB
|
||||
# frame = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)
|
||||
frame = cv2.cvtColor(processed_frame, cv2.COLOR_BGR2RGB) # might change nomenclature later?
|
||||
|
||||
# Convert the frame to QImage
|
||||
h, w, ch = frame.shape
|
||||
bytes_per_line = ch * w
|
||||
qt_image = QtGui.QImage(frame.data, w, h, bytes_per_line, QtGui.QImage.Format_RGB888)
|
||||
|
||||
# Add the QImage to a QPixmap
|
||||
pixmap = QtGui.QPixmap.fromImage(qt_image)
|
||||
|
||||
# Get the size of the graphicsView and scale the pixmap to fit
|
||||
view_size = self.ui.graphicsView.size()
|
||||
scaled_pixmap = pixmap.scaled(view_size, QtCore.Qt.KeepAspectRatio)
|
||||
|
||||
# Update the scene with the scaled pixmap
|
||||
self.scene.clear()
|
||||
self.scene.addPixmap(scaled_pixmap)
|
||||
|
||||
def closeEvent(self, event):
|
||||
# Release the camera when the application is closed
|
||||
if self.yolo_stream is not None:
|
||||
self.yolo_stream.cap.release()
|
||||
event.accept()
|
||||
|
||||
if __name__ == "__main__":
|
||||
app = QtWidgets.QApplication(sys.argv)
|
||||
MainWindow = QtWidgets.QMainWindow()
|
||||
ui = Ui_MainWindow()
|
||||
ui.setupUi(MainWindow)
|
||||
|
||||
# Initialize the CameraStreamApp with the UI
|
||||
camera_app = CameraStreamApp(ui)
|
||||
|
||||
MainWindow.show()
|
||||
sys.exit(app.exec_())
|
910
bjoerntest9.py
Normal file
@ -0,0 +1,910 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Form implementation generated from reading ui file 'test.ui'
|
||||
#
|
||||
# Created by: PyQt5 UI code generator 5.15.9
|
||||
#
|
||||
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
|
||||
# run again. Do not edit this file unless you know what you are doing.
|
||||
|
||||
|
||||
########## beim Static workflow funktionieren die Threads ab dem zweiten nicht mehr
|
||||
|
||||
#from PyQt5 import QApplication, QMainWindow, QPushButton, QVBoxLayout, QWidget, QProgressBar
|
||||
from PyQt5 import QtCore, QtGui, QtWidgets
|
||||
from PyQt5.QtWidgets import QApplication, QComboBox
|
||||
from PyQt5.QtCore import QTimer, QThread, pyqtSignal, QObject
|
||||
from PyQt5.QtGui import QColor
|
||||
|
||||
import serial
|
||||
import binascii
|
||||
import math
|
||||
import mariadb
|
||||
import time
|
||||
import threading
|
||||
|
||||
from CameraStream import YOLOv8CameraStream # Import the YOLOv8CameraStream class
|
||||
import cv2
|
||||
|
||||
|
||||
db_config = {
|
||||
'user': 'dbUser',
|
||||
'password': 'dbPassword',
|
||||
'host': '127.0.0.1', # 'host': 'localhost',
|
||||
'database': 'projectGeislinger',
|
||||
'port': 3306 # Standard port for MariaDB
|
||||
}
|
||||
|
||||
# Establishing the connection
|
||||
conn = mariadb.connect(**db_config)
|
||||
# Create a cursor to execute queries
|
||||
cursor = conn.cursor()
|
||||
|
||||
# # Konfiguration der seriellen Schnittstelle
|
||||
# ser = serial.Serial('/dev/ttyUSB0', 9600)
|
||||
|
||||
# Configuration of the serial port
|
||||
try:
|
||||
ser = serial.Serial('/dev/serial/by-id/usb-Silicon_Labs_CP2102_USB_to_UART_Bridge_Controller_0001-if00-port0', 9600)
|
||||
print("Serial port connected successfully.")
|
||||
except serial.SerialException:
|
||||
ser = None
|
||||
print("Warning: Serial port not found. Continuing without serial connection. Only working for demo-purposes.")
|
||||
|
||||
waageEingeschwungen = False
|
||||
|
||||
|
||||
def wahrscheinlichkeitsDichte(x,mue, var):
|
||||
# in der Funktion wird der Wahrscheinlichkeitsdichtenwert der Variable x für eine bestimmte Normalverteilung berechnet
|
||||
standardabweichung = var**0.5
|
||||
|
||||
result = 1/(standardabweichung * (2*math.pi)**0.5 ) * math.exp(-0.5 * ((x-mue)/standardabweichung)**2)
|
||||
|
||||
return result
|
||||
|
||||
def calcWahrscheinlichkeitFromDichte(x,mue, var):
|
||||
# in der Funktion wird die Wahrscheinlichkeit via der Wahrscheinlichkeitsdichte berechnet, indem das Verhältnis aus der dem Bauteil zugehörigen Wahrscheinlichkeitsdichte zu der maximalen Wahrscheinlichkeitsdichte berechnet wird
|
||||
p1 = wahrscheinlichkeitsDichte(x,mue, var)
|
||||
p_max = wahrscheinlichkeitsDichte(mue,mue, var)
|
||||
|
||||
return p1/p_max
|
||||
|
||||
|
||||
|
||||
#class Worker(QThread):
|
||||
class Worker(QObject):
|
||||
#progress = pyqtSignal(int)
|
||||
objectDetectionStartSignal = pyqtSignal(str)
|
||||
objectDetectionFinishedSignal = pyqtSignal(int, object)
|
||||
|
||||
checkWaageStartSignal = pyqtSignal(int, int, str)
|
||||
checkWaageUpdateSignal = pyqtSignal(int, int)
|
||||
checkWaageFinishedSignal = pyqtSignal(int)
|
||||
|
||||
waageStoppedSignal = pyqtSignal(int)
|
||||
stopLoopSignal = pyqtSignal(bool) #das Signal wird verwendet um direkt den stopLoop-Wert zu ändern (also kein Funktionsaufruf)
|
||||
|
||||
stopLoop = False
|
||||
btTypeIsSet = False
|
||||
correctBtNr = False
|
||||
|
||||
|
||||
def __init__(self):
|
||||
super(Worker, self).__init__()
|
||||
stopLoop = False
|
||||
|
||||
|
||||
def getDataOfArticleType(self, allArticles, articleType):
|
||||
# die Funktion geht die Liste mit allen Artikeln durch und gibt jenen Eintrag, welcher mit dem "articleType" übereinstimmt zurück
|
||||
for i in allArticles:
|
||||
if i[1] == articleType:
|
||||
return i
|
||||
|
||||
return -1
|
||||
|
||||
def waageNichtEingeschwungenOutput(self):
|
||||
print("Die Waage ist noch nicht eingeschwungen - Ergebnisse sind dadurch noch fehlerhaft.")
|
||||
|
||||
def readWaage(self):
|
||||
# in folgender Funktion wird die Waage ausgelesen
|
||||
|
||||
#print("connection is open: ", ser.is_open) #Debuggingausgabe
|
||||
#print("port to which it is connected: ", ser.portstr) #Debuggingausgabe
|
||||
|
||||
|
||||
if ser.is_open == False:
|
||||
ser.open()
|
||||
|
||||
|
||||
#an die Waage den Befehl senden, dass sie ausgelesen werden soll
|
||||
ser.write(b'getWeight\n')
|
||||
#ser.write(b'tare\n')
|
||||
serialString = ser.readline().decode('utf-8').rstrip() #Auslesen des Serial-Strings/der Messung der Waage
|
||||
|
||||
# wenn am Ende des Strings kg steht, dann ist die Waage eingeschwungen - das wird hiermit überprüft
|
||||
lenString = len(serialString)-1
|
||||
if serialString[lenString] == "g" and serialString[lenString-1] == "k":
|
||||
#print("ist eingeschwungen") #Debuggingausgabe
|
||||
waageEingeschwungen = True
|
||||
else:
|
||||
print("die Waage ist noch nicht eingeschwungen")
|
||||
waageEingeschwungen = False
|
||||
|
||||
#aus dem String werden alle Zeichen, welche nicht zur Darstellung der Zahl benötigt werden entfernt
|
||||
intString = ""
|
||||
for i in serialString:
|
||||
if i=="-" or i=="0" or i=="." or i=="1" or i=="2" or i=="3" or i=="4" or i=="5" or i=="6" or i=="7" or i=="8" or i=="9":
|
||||
intString = intString + i
|
||||
print("Wert, welcher von der Waage ausgelesen wurde: " + intString + "kg")
|
||||
## Waage auslesen - ENDE
|
||||
|
||||
ser.close()
|
||||
#print("connection is open: ", ser.is_open) #Debuggingausgabe
|
||||
|
||||
return waageEingeschwungen, intString
|
||||
|
||||
def objectTypeDetectionThread(self, auftragsnummer):
|
||||
# in dieser Funktion wird der Typ des Bauteils automatisch erkannt
|
||||
|
||||
#print("objectTypeDetectionThread - Running in thread:", threading.current_thread().name) #Debuggausgabe
|
||||
|
||||
# Parameterdefinition
|
||||
propDensVect = []
|
||||
|
||||
self.btTypeIsSet = False
|
||||
|
||||
while(self.btTypeIsSet == False and self.stopLoop == False):
|
||||
|
||||
# Auslesen der Waage
|
||||
waageEingeschwungen, intString = self.readWaage()
|
||||
if waageEingeschwungen == False:
|
||||
self.waageNichtEingeschwungenOutput()
|
||||
else:
|
||||
|
||||
# Datenbankabfrage
|
||||
sql_query = "SELECT Auftraege.id, EinzelteilID, Auftragsnummer, Anzahl, Einzelteile.id, Bezeichnung, CAST(projectGeislinger.Einzelteile.GewichtMittelwert AS CHAR), CAST(projectGeislinger.Einzelteile.GewichtVarianz AS CHAR) FROM projectGeislinger.Auftraege, projectGeislinger.Einzelteile where projectGeislinger.Auftraege.EinzelteilID = projectGeislinger.Einzelteile.id AND projectGeislinger.Auftraege.Auftragsnummer = " + auftragsnummer
|
||||
cursor.execute(sql_query)
|
||||
auftragEinzelteilDaten = cursor.fetchall()
|
||||
|
||||
'''
|
||||
# Display data #Debugausgabe
|
||||
print("Ausgabe der Auftragsdetails des obigen Auftrags, inklusive Einzelteildetails:")
|
||||
for row in auftragEinzelteilDaten:
|
||||
print(row)
|
||||
'''
|
||||
|
||||
# in der Folge werden alle Wahrscheinlichkeitsdichten der Auftragsbauteile berechnet und in dem Vektor gesammelt
|
||||
for row in auftragEinzelteilDaten:
|
||||
propDensVect.append([wahrscheinlichkeitsDichte(float(intString),float(row[6]), float(row[7])), row[1], row[5]])
|
||||
|
||||
# Jenen Eintrag des propDensVect raussuchen, welcher die größte Wahrscheinlichkeitsdichte beinhaltet
|
||||
maxpropDens = 0
|
||||
einzelteilID = 0
|
||||
rowData = None
|
||||
for row in propDensVect:
|
||||
if row[0] > maxpropDens:
|
||||
maxpropDens = row[0]
|
||||
einzelteilID = row[1]
|
||||
rowData = row
|
||||
|
||||
# überprüfen, ob das aufliegende Bauteil in der Auftragstabelle vorhanden ist
|
||||
if(einzelteilID == 0):
|
||||
print("Es wurde kein Bauteil aus der Auftragsliste (Tabelle) erkannt.")
|
||||
else:
|
||||
print("Bei dem Bauteil" , einzelteilID , "wurde die höchste Wahrscheinlichkeitsdichte berechnet.")
|
||||
|
||||
# Wahrscheinlichkeit berechnen, dass das angegebene Bauteil auch wirklich diesem entspricht
|
||||
prop = 0
|
||||
for row in auftragEinzelteilDaten:
|
||||
if row[1] == einzelteilID:
|
||||
prop = calcWahrscheinlichkeitFromDichte(float(intString),float(row[6]), float(row[7]))
|
||||
break
|
||||
print("Die Wahrscheinlichkeit, dass es das Bauteil ist, beträgt: ", prop)
|
||||
|
||||
# den Bool auf true setzen, damit die Schleife beendet wird - dieser wird auf True gesetzt, wenn ein Bauteiltyp erkannt wird
|
||||
self.btTypeIsSet = True
|
||||
|
||||
if(self.stopLoop == False):
|
||||
# ein Signal zurück an den MainThreat senden, mit den Infos/Ergebnissen, der Typenbestimmung
|
||||
self.objectDetectionFinishedSignal.emit(einzelteilID, rowData)
|
||||
else:
|
||||
self.waageStoppedSignal.emit(einzelteilID)
|
||||
|
||||
def checkWaageThread(self, einzelteilID, teileZuViel, auftragsnummer):
|
||||
|
||||
self.correctBtNr = False
|
||||
prevAnzahl = 0
|
||||
anzahl = 0
|
||||
einzelteilID = einzelteilID
|
||||
|
||||
while (self.correctBtNr == False and self.stopLoop == False):
|
||||
|
||||
#überprüfen, ob die Waage eingeschwungen ist (und damit korrekte Ergebnisse liefert)
|
||||
waageEingeschwungen, intString = self.readWaage()
|
||||
if waageEingeschwungen == False:
|
||||
self.waageNichtEingeschwungenOutput()
|
||||
else:
|
||||
|
||||
# Datenbankabfrage - holen der Auftrags- und Bauteilinfos
|
||||
sql_query = "SELECT Auftraege.id, EinzelteilID, Auftragsnummer, Anzahl, Einzelteile.id, Bezeichnung, CAST(projectGeislinger.Einzelteile.GewichtMittelwert AS CHAR), CAST(projectGeislinger.Einzelteile.GewichtVarianz AS CHAR) FROM projectGeislinger.Auftraege, projectGeislinger.Einzelteile where projectGeislinger.Auftraege.EinzelteilID = projectGeislinger.Einzelteile.id AND projectGeislinger.Auftraege.Auftragsnummer = " + auftragsnummer
|
||||
cursor.execute(sql_query)
|
||||
auftragDaten = cursor.fetchall()
|
||||
|
||||
'''
|
||||
# Display data - zum Debuggen
|
||||
print("Ausgabe der Auftragsdetails:")
|
||||
print("id|EinzelteilID|Auftragsnummer|Anzahl")
|
||||
for row in auftragDaten:
|
||||
print(row)
|
||||
'''
|
||||
|
||||
#auslesen, wie viele Bauteile des Types laut Auftrag vorhanden sein sollen
|
||||
anzBauteile_soll = 0
|
||||
idVorhanden = False
|
||||
|
||||
for row in auftragDaten:
|
||||
if row[1] == einzelteilID:
|
||||
anzBauteile_soll = row[3]
|
||||
idVorhanden = True
|
||||
|
||||
if(idVorhanden == False):
|
||||
print("Die gewählte Pos.Nr ist nicht in der Auftragsliste (Tabelle) vorhanden.")
|
||||
return
|
||||
|
||||
# Berechnen der Wahrscheinlichkeitsdichten - der Betrag aller Wahrscheinlichkeitsdichten werden im propDensVect gespeichert
|
||||
propDensVect = []
|
||||
articleData = self.getDataOfArticleType(auftragDaten, einzelteilID)
|
||||
for i in range(1,anzBauteile_soll+teileZuViel+1):
|
||||
# Mathematische Sätze, auf welchen die Berechnung basiert:
|
||||
# seien X1,..., Xn unabhängige Zufallsvariablen die N(mue_i, sigma_i^2) verteilt sind, dann ist X = X1+...+Xn - N(mue, sigma^2) verteilt mit mue=mue1+...+mue_n, sigma^2 = sigma_1^2+...+sigma_n^2
|
||||
mueGes = float(articleData[6])*i # Berechnen des äquivalenten Mittelwert
|
||||
varGes = float(articleData[7])*i # Berechnen der äquivalenten Varianz
|
||||
propDensVect.append([wahrscheinlichkeitsDichte(float(intString),mueGes, varGes), i])
|
||||
|
||||
# durch den propDensVect iterieren und jenen Eintrag mit der höchsten Wahrscheinlichkeitsdichte raussuchen
|
||||
maxpropDens = 0
|
||||
for row in propDensVect:
|
||||
if row[0] > maxpropDens:
|
||||
maxpropDens = row[0]
|
||||
anzahl = row[1]
|
||||
|
||||
# damit nur etwas gemacht wird (zb ein Updatesignal an den Hauptthread zurücksenden), wenn sich die berechnete Anzahl ändert
|
||||
if prevAnzahl != anzahl:
|
||||
prevAnzahl = anzahl
|
||||
|
||||
# Die Wahrscheinlichkeit berechnen, dass das obige Ergebnis auch dem Bauteil entspricht
|
||||
if anzahl > 0:
|
||||
for row in auftragDaten:
|
||||
if row[1] == einzelteilID:
|
||||
prop = calcWahrscheinlichkeitFromDichte(float(intString),float(row[6])*anzahl, float(row[7])*anzahl)
|
||||
break
|
||||
print("Die Wahrscheinlichkeit, dass es das Bauteil ist, beträgt: ", prop)
|
||||
|
||||
# wenn genug Bauteile vorhanden sind, dann soll die Schleife beendet werden
|
||||
if (anzahl == anzBauteile_soll):
|
||||
self.correctBtNr = True
|
||||
|
||||
# Konsolenausgabe
|
||||
if maxpropDens > 0:
|
||||
print("Bei der Anzahl" , anzahl , "des Bauteiltypes", einzelteilID, ",wurde die höchste Wahrscheinlichkeitsdichte berechnet.")
|
||||
self.checkWaageUpdateSignal.emit(einzelteilID, anzahl)
|
||||
|
||||
else:
|
||||
print("Von der ausgewählten Bauteiltype liegt die berechnete Wahrscheinlichkeit bei 0, dass zwischen 0 und", anzBauteile_soll+teileZuViel, "Bauteilen auf der Waage liegen.")
|
||||
print("Falls die korrekte Anzhl an Bauteilen auf der Waage liegt, könnte der Fehler in einer falschen Kalibrierung der Waage liegen (TARE).")
|
||||
|
||||
if(self.stopLoop == False):
|
||||
self.checkWaageFinishedSignal.emit(einzelteilID)
|
||||
else:
|
||||
self.waageStoppedSignal.emit(einzelteilID)
|
||||
|
||||
|
||||
|
||||
|
||||
class Ui_MainWindow(object):
|
||||
def setupUi(self, MainWindow):
|
||||
self.auftragsnummer = ""
|
||||
self.teileZuViel = 0 # Anzahl an Bauteilen, welche zu viel drinnen sein können - der Parameter kann selbst gesetzt werden #####
|
||||
self.correctBtNr = False
|
||||
self.btTypeIsSet = False
|
||||
|
||||
|
||||
MainWindow.setObjectName("MainWindow")
|
||||
MainWindow.resize(1090, 675)
|
||||
self.centralwidget = QtWidgets.QWidget(MainWindow)
|
||||
self.centralwidget.setObjectName("centralwidget")
|
||||
self.btn1 = QtWidgets.QPushButton(self.centralwidget)
|
||||
self.btn1.setGeometry(QtCore.QRect(700, 45, 111, 25))
|
||||
self.btn1.setObjectName("btn1")
|
||||
self.AuftragsdetailsTable = QtWidgets.QTableWidget(self.centralwidget)
|
||||
self.AuftragsdetailsTable.setGeometry(QtCore.QRect(10, 300, 661, 192))
|
||||
self.AuftragsdetailsTable.setObjectName("AuftragsdetailsTable")
|
||||
self.AuftragsdetailsTable.setColumnCount(7)
|
||||
self.AuftragsdetailsTable.setRowCount(0)
|
||||
item = QtWidgets.QTableWidgetItem()
|
||||
font = QtGui.QFont()
|
||||
font.setPointSize(8)
|
||||
item.setFont(font)
|
||||
self.AuftragsdetailsTable.setHorizontalHeaderItem(0, item)
|
||||
item = QtWidgets.QTableWidgetItem()
|
||||
font = QtGui.QFont()
|
||||
font.setPointSize(8)
|
||||
item.setFont(font)
|
||||
self.AuftragsdetailsTable.setHorizontalHeaderItem(1, item)
|
||||
item = QtWidgets.QTableWidgetItem()
|
||||
font = QtGui.QFont()
|
||||
font.setPointSize(8)
|
||||
item.setFont(font)
|
||||
self.AuftragsdetailsTable.setHorizontalHeaderItem(2, item)
|
||||
item = QtWidgets.QTableWidgetItem()
|
||||
font = QtGui.QFont()
|
||||
font.setPointSize(8)
|
||||
item.setFont(font)
|
||||
self.AuftragsdetailsTable.setHorizontalHeaderItem(3, item)
|
||||
item = QtWidgets.QTableWidgetItem()
|
||||
font = QtGui.QFont()
|
||||
font.setPointSize(8)
|
||||
item.setFont(font)
|
||||
self.AuftragsdetailsTable.setHorizontalHeaderItem(5, item)
|
||||
item = QtWidgets.QTableWidgetItem()
|
||||
font = QtGui.QFont()
|
||||
font.setPointSize(8)
|
||||
item.setFont(font)
|
||||
self.AuftragsdetailsTable.setHorizontalHeaderItem(4, item)
|
||||
item = QtWidgets.QTableWidgetItem()
|
||||
font = QtGui.QFont()
|
||||
font.setPointSize(8)
|
||||
item.setFont(font)
|
||||
self.AuftragsdetailsTable.setHorizontalHeaderItem(6, item)
|
||||
|
||||
self.label = QtWidgets.QLabel(self.centralwidget)
|
||||
self.label.setGeometry(QtCore.QRect(500, 20, 121, 17))
|
||||
self.label.setObjectName("label")
|
||||
self.textEdit = QtWidgets.QTextEdit(self.centralwidget)
|
||||
self.textEdit.setGeometry(QtCore.QRect(450, 40, 221, 31))
|
||||
self.textEdit.setObjectName("textEdit")
|
||||
self.bauteilTypBtn = QtWidgets.QPushButton(self.centralwidget)
|
||||
self.bauteilTypBtn.setGeometry(QtCore.QRect(700, 150, 161, 25))
|
||||
self.bauteilTypBtn.setObjectName("bauteilTypBtn")
|
||||
self.checkWaageBtn = QtWidgets.QPushButton(self.centralwidget)
|
||||
self.checkWaageBtn.setGeometry(QtCore.QRect(700, 460, 161, 25))
|
||||
self.checkWaageBtn.setObjectName("checkWaageBtn")
|
||||
self.stopLoopBtn = QtWidgets.QPushButton(self.centralwidget)
|
||||
self.stopLoopBtn.setGeometry(QtCore.QRect(700, 500, 161, 25))
|
||||
self.stopLoopBtn.setObjectName("stopLoopBtn")
|
||||
self.waageTareBtn = QtWidgets.QPushButton(self.centralwidget)
|
||||
self.waageTareBtn.setGeometry(QtCore.QRect(700, 100, 161, 25))
|
||||
self.waageTareBtn.setObjectName("waageTareBtn")
|
||||
self.bauteiltypTextbox = QtWidgets.QTextEdit(self.centralwidget)
|
||||
self.bauteiltypTextbox.setGeometry(QtCore.QRect(700, 290, 221, 31))
|
||||
self.bauteiltypTextbox.setObjectName("bauteiltypTextbox")
|
||||
self.BezeichnungLabel = QtWidgets.QLabel(self.centralwidget)
|
||||
self.BezeichnungLabel.setGeometry(QtCore.QRect(700, 270, 181, 20))
|
||||
self.BezeichnungLabel.setObjectName("BezeichnungLabel")
|
||||
self.PosNrLabel = QtWidgets.QLabel(self.centralwidget)
|
||||
self.PosNrLabel.setGeometry(QtCore.QRect(700, 200, 67, 17))
|
||||
self.PosNrLabel.setObjectName("PosNrLabel")
|
||||
self.PosNrTxtFeld = QtWidgets.QTextEdit(self.centralwidget)
|
||||
self.PosNrTxtFeld.setGeometry(QtCore.QRect(700, 220, 191, 31))
|
||||
self.BezeichnungLabel.setObjectName("BezeichnungLabel")
|
||||
self.teileZuVielLabel = QtWidgets.QLabel(self.centralwidget)
|
||||
self.teileZuVielLabel.setGeometry(QtCore.QRect(700, 350, 350, 17))
|
||||
self.teileZuVielLabel.setObjectName("teileZuVielLabel")
|
||||
self.teileZuVielTxtFeld = QtWidgets.QTextEdit(self.centralwidget)
|
||||
self.teileZuVielTxtFeld.setGeometry(QtCore.QRect(700, 370, 191, 31))
|
||||
MainWindow.setCentralWidget(self.centralwidget)
|
||||
self.menubar = QtWidgets.QMenuBar(MainWindow)
|
||||
self.menubar.setGeometry(QtCore.QRect(0, 0, 1090, 22))
|
||||
self.menubar.setObjectName("menubar")
|
||||
MainWindow.setMenuBar(self.menubar)
|
||||
self.statusbar = QtWidgets.QStatusBar(MainWindow)
|
||||
self.statusbar.setObjectName("statusbar")
|
||||
MainWindow.setStatusBar(self.statusbar)
|
||||
self.checkBox = QtWidgets.QCheckBox(self.centralwidget)
|
||||
self.checkBox.setGeometry(QtCore.QRect(700, 10, 151, 23))
|
||||
self.checkBox.setObjectName("checkBox")
|
||||
|
||||
# button and checkbox for camera workflow + graphicsview widget
|
||||
self.startCamBtn = QtWidgets.QPushButton(self.centralwidget)
|
||||
self.startCamBtn.setGeometry(QtCore.QRect(900, 45, 161, 25))
|
||||
self.startCamBtn.setObjectName("startCamBtn")
|
||||
self.stopCamBtn = QtWidgets.QPushButton(self.centralwidget)
|
||||
self.stopCamBtn.setGeometry(QtCore.QRect(900, 45+25, 161, 25))
|
||||
self.stopCamBtn.setObjectName("stopCamBtn")
|
||||
self.camWorkFlowcheckBox = QtWidgets.QCheckBox(self.centralwidget)
|
||||
self.camWorkFlowcheckBox.setGeometry(QtCore.QRect(900, 10, 151, 23))
|
||||
self.camWorkFlowcheckBox.setObjectName("camWorkFlowcheckBox")
|
||||
self.graphicsView = QtWidgets.QGraphicsView(self.centralwidget)
|
||||
self.graphicsView.setGeometry(QtCore.QRect(1100, 20, int(640*1.2), int(480*1.2))) # position and size of camera frame
|
||||
self.graphicsView.setObjectName("graphicsView")
|
||||
|
||||
#self.myTestLambda = lambda: self.worker.checkWaageStartSignal.emit(einzelteilID, self.teileZuViel, self.auftragsnummer)
|
||||
|
||||
'''
|
||||
item = QtWidgets.QTableWidgetItem()
|
||||
font = QtGui.QFont()
|
||||
font.setPointSize(8)
|
||||
item.setFont(font)
|
||||
self.AuftragsdetailsTable.setVerticalHeaderItem(0,item)
|
||||
'''
|
||||
self.retranslateUi(MainWindow)
|
||||
QtCore.QMetaObject.connectSlotsByName(MainWindow)
|
||||
|
||||
def retranslateUi(self, MainWindow):
|
||||
_translate = QtCore.QCoreApplication.translate
|
||||
MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow"))
|
||||
self.btn1.setText(_translate("MainWindow", "load Auftrag"))
|
||||
self.btn1.clicked.connect(self.auftragsBtnClicked)
|
||||
item = self.AuftragsdetailsTable.horizontalHeaderItem(0)
|
||||
item.setText(_translate("MainWindow", "Pos.-Nr"))
|
||||
item = self.AuftragsdetailsTable.horizontalHeaderItem(1)
|
||||
item.setText(_translate("MainWindow", "Matnr mit hoechster Version"))
|
||||
item = self.AuftragsdetailsTable.horizontalHeaderItem(2)
|
||||
item.setText(_translate("MainWindow", "Bezeichnung + Werkstoff"))
|
||||
item = self.AuftragsdetailsTable.horizontalHeaderItem(3)
|
||||
item.setText(_translate("MainWindow", "Soll-Menge"))
|
||||
item = self.AuftragsdetailsTable.horizontalHeaderItem(4)
|
||||
item.setText(_translate("MainWindow", "Ist-Menge"))
|
||||
item = self.AuftragsdetailsTable.horizontalHeaderItem(5)
|
||||
item.setText(_translate("MainWindow", "Lgort"))
|
||||
item = self.AuftragsdetailsTable.horizontalHeaderItem(6)
|
||||
item.setText(_translate("MainWindow", "set Farbe"))
|
||||
|
||||
self.label.setText(_translate("MainWindow", "Auftragsnummer:"))
|
||||
self.bauteilTypBtn.setText(_translate("MainWindow", "Bauteiltyp erkennen"))
|
||||
self.bauteilTypBtn.clicked.connect(self.objectTypeDetection)
|
||||
self.AuftragsdetailsTable.cellClicked.connect(self.onTableCellClick)
|
||||
#self.AuftragsdetailsTable.setEditTriggers(QtWidgets.QTableWidget.NoEditTriggers)
|
||||
#item = self.AuftragsdetailsTable.verticalHeaderItem(0)
|
||||
#item.setText(_translate("MainWindow", "test"))
|
||||
self.BezeichnungLabel.setText(_translate("MainWindow", "Bezeichnung"))
|
||||
self.PosNrLabel.setText(_translate("MainWindow", "Pos.-Nr:"))
|
||||
self.teileZuVielLabel.setText(_translate("MainWindow", "Zu prüfende Teileanzahl über Auftragsanzahl:"))
|
||||
self.teileZuVielTxtFeld.setText(str(self.teileZuViel))
|
||||
self.checkWaageBtn.setText(_translate("MainWindow", "check Waage"))
|
||||
self.checkWaageBtn.clicked.connect(self.checkWaage)
|
||||
self.stopLoopBtn.setText(_translate("MainWindow", "stop loop"))
|
||||
self.stopLoopBtn.clicked.connect(self.stopLoopClicked)
|
||||
self.waageTareBtn.setText(_translate("MainWindow", "Waage tarieren"))
|
||||
self.waageTareBtn.clicked.connect(self.onTareClick)
|
||||
self.checkBox.setText(_translate("MainWindow", "static workflow"))
|
||||
self.checkBox.clicked.connect(self.onCheckboxCheck)
|
||||
|
||||
# new camera workflow
|
||||
self.startCamBtn.setText(_translate("MainWindow", "Start Camera"))
|
||||
# self.startCamBtn.clicked.connect(self.startCamBtnClicked)
|
||||
self.stopCamBtn.setText(_translate("MainWindow", "Stop Camera"))
|
||||
self.camWorkFlowcheckBox.setText(_translate("MainWindow", "Camera Workflow"))
|
||||
# self.camWorkFlowcheckBox.clicked.connect(self.onCheckboxCheck)
|
||||
|
||||
def onTareClick(self):
|
||||
#Tarieren der Waage
|
||||
if ser.is_open == False:
|
||||
ser.open()
|
||||
ser.write(b'tare\n')
|
||||
ser.close()
|
||||
|
||||
|
||||
def onCheckboxCheck(self):
|
||||
if self.checkBox.isChecked() == True:
|
||||
print("static workflow activated")
|
||||
else:
|
||||
print("static workflow deactivated")
|
||||
|
||||
def getRowNr(self, posNr):
|
||||
for i in range(0,self.AuftragsdetailsTable.rowCount()):
|
||||
if(self.AuftragsdetailsTable.item(i,0).text() == str(posNr)):
|
||||
return i
|
||||
# brauche ich hier vermutlich nicht mehr - ist in den Worker Thread kopiert worden
|
||||
def waageNichtEingeschwungenOutput(self):
|
||||
print("Die Waage ist noch nicht eingeschwungen - Ergebnisse sind dadurch noch fehlerhaft.")
|
||||
|
||||
def onTableCellClick(self):
|
||||
self.PosNrTxtFeld.setText(self.AuftragsdetailsTable.item(self.AuftragsdetailsTable.currentRow(),0).text())
|
||||
self.bauteiltypTextbox.setText(self.AuftragsdetailsTable.item(self.AuftragsdetailsTable.currentRow(),2).text())
|
||||
|
||||
def setAuftragsnummer(self):
|
||||
self.auftragsnummer = self.textEdit.toPlainText()
|
||||
if(not self.auftragsnummer):
|
||||
self.auftragsnummer = ""
|
||||
self.textEdit.setText("")
|
||||
|
||||
def checkAuftragsnummerEmpty(self):
|
||||
if self.auftragsnummer == "":
|
||||
print("Das Auftragsnummernfeld ist leer.")
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
|
||||
def checkPosNrEmpty(self):
|
||||
if self.PosNrTxtFeld.toPlainText() == "":
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
|
||||
|
||||
# eventuell benötigt man die Funktion hier nicht mehr, da sie zu den Threads kopiert wurde
|
||||
def getDataOfArticleType(self, allArticles, articleType):
|
||||
# die Funktion geht die Liste mit allen Artikeln durch und gibt jenen Eintrag, welcher mit dem "articleType" übereinstimmt zurück
|
||||
for i in allArticles:
|
||||
if i[1] == articleType:
|
||||
return i
|
||||
return -1
|
||||
|
||||
def updateGUI(self):
|
||||
self.PosNrLabel.repaint() #GUI aktualisieren
|
||||
QApplication.processEvents() #GUI aktualisieren
|
||||
|
||||
def setRowColor(self, rowID,r,g,b):
|
||||
self.AuftragsdetailsTable.item(rowID, 0).setBackground(QtGui.QColor(r,g,b))
|
||||
self.AuftragsdetailsTable.item(rowID, 1).setBackground(QtGui.QColor(r,g,b))
|
||||
self.AuftragsdetailsTable.item(rowID, 2).setBackground(QtGui.QColor(r,g,b))
|
||||
self.AuftragsdetailsTable.item(rowID, 3).setBackground(QtGui.QColor(r,g,b))
|
||||
self.AuftragsdetailsTable.item(rowID, 4).setBackground(QtGui.QColor(r,g,b))
|
||||
self.AuftragsdetailsTable.item(rowID, 5).setBackground(QtGui.QColor(r,g,b))
|
||||
|
||||
#wird hier vermutlich nicht mehr benötigt - wurde in die Workerklasse kopiert
|
||||
def readWaage(self):
|
||||
# in folgender Funktion wird die Waage ausgelesen
|
||||
|
||||
#print("connection is open: ", ser.is_open) #Debuggingausgabe
|
||||
#print("port to which it is connected: ", ser.portstr) #Debuggingausgabe
|
||||
self.checkPosNrEmpty()
|
||||
|
||||
if ser.is_open == False:
|
||||
ser.open()
|
||||
|
||||
|
||||
#an die Waage den Befehl senden, dass sie ausgelesen werden soll
|
||||
ser.write(b'getWeight\n')
|
||||
#ser.write(b'tare\n')
|
||||
serialString = ser.readline().decode('utf-8').rstrip() #Auslesen des Serial-Strings/der Messung der Waage
|
||||
|
||||
# wenn am Ende des Strings kg steht, dann ist die Waage eingeschwungen - das wird hiermit überprüft
|
||||
lenString = len(serialString)-1
|
||||
if serialString[lenString] == "g" and serialString[lenString-1] == "k":
|
||||
#print("ist eingeschwungen") #Debuggingausgabe
|
||||
waageEingeschwungen = True
|
||||
else:
|
||||
print("die Waage ist noch nicht eingeschwungen")
|
||||
waageEingeschwungen = False
|
||||
|
||||
#aus dem String werden alle Zeichen, welche nicht zur Darstellung der Zahl benötigt werden entfernt
|
||||
intString = ""
|
||||
for i in serialString:
|
||||
if i=="-" or i=="0" or i=="." or i=="1" or i=="2" or i=="3" or i=="4" or i=="5" or i=="6" or i=="7" or i=="8" or i=="9":
|
||||
intString = intString + i
|
||||
print("Wert, welcher von der Waage ausgelesen wurde: " + intString + "kg")
|
||||
## Waage auslesen - ENDE
|
||||
|
||||
ser.close()
|
||||
#print("connection is open: ", ser.is_open) #Debuggingausgabe
|
||||
|
||||
return waageEingeschwungen, intString
|
||||
|
||||
def auftragsBtnClicked(self):
|
||||
databaseQueryWorking = False #wird für die Überprüfung, ob die Datenbankabfrage fehlerhaft ist, verwendet
|
||||
auftragEinzelteilDaten = []
|
||||
|
||||
self.setAuftragsnummer()
|
||||
if(not self.checkAuftragsnummerEmpty()):
|
||||
|
||||
sql_query = "SELECT Auftraege.id, EinzelteilID, Auftragsnummer, Anzahl, Einzelteile.id, Bezeichnung, CAST(projectGeislinger.Einzelteile.GewichtMittelwert AS CHAR), CAST(projectGeislinger.Einzelteile.GewichtVarianz AS CHAR) FROM projectGeislinger.Auftraege, projectGeislinger.Einzelteile where projectGeislinger.Auftraege.EinzelteilID = projectGeislinger.Einzelteile.id AND projectGeislinger.Auftraege.Auftragsnummer = " + self.auftragsnummer
|
||||
try:
|
||||
cursor.execute(sql_query)
|
||||
# Fetch results
|
||||
auftragEinzelteilDaten = cursor.fetchall()
|
||||
databaseQueryWorking = True
|
||||
except:
|
||||
print("Fehler in der Datenbankabfrage.")
|
||||
|
||||
|
||||
|
||||
if databaseQueryWorking==True and len(auftragEinzelteilDaten)>0:
|
||||
'''
|
||||
# Display data
|
||||
print("Ausgabe der Auftragsdetails des obigen Auftrags, inklusive Einzelteildetails:")
|
||||
for row in auftragEinzelteilDaten:
|
||||
if str(row[2]) == self.auftragsnummer:
|
||||
print("passt")
|
||||
print(row)
|
||||
'''
|
||||
|
||||
### die Auftragsdaten in die Tabelle laden
|
||||
self.AuftragsdetailsTable.setRowCount(len(auftragEinzelteilDaten))
|
||||
self.item = QtWidgets.QTableWidgetItem()
|
||||
counter = 0
|
||||
for row in auftragEinzelteilDaten:
|
||||
self.item = QtWidgets.QTableWidgetItem()
|
||||
self.AuftragsdetailsTable.setItem(counter, 0, self.item)
|
||||
self.item.setText(str(row[1]))
|
||||
self.item.setFlags(self.item.flags() & ~QtCore.Qt.ItemIsEditable)
|
||||
self.item = QtWidgets.QTableWidgetItem()
|
||||
self.AuftragsdetailsTable.setItem(counter, 1, self.item)
|
||||
self.item.setFlags(self.item.flags() & ~QtCore.Qt.ItemIsEditable)
|
||||
self.item = QtWidgets.QTableWidgetItem()
|
||||
self.AuftragsdetailsTable.setItem(counter, 2, self.item)
|
||||
self.item.setText(str(row[5]))
|
||||
self.item.setFlags(self.item.flags() & ~QtCore.Qt.ItemIsEditable)
|
||||
self.item = QtWidgets.QTableWidgetItem()
|
||||
self.AuftragsdetailsTable.setItem(counter, 3, self.item)
|
||||
self.item.setText(str(row[3]))
|
||||
self.item.setFlags(self.item.flags() & ~QtCore.Qt.ItemIsEditable)
|
||||
self.item = QtWidgets.QTableWidgetItem()
|
||||
self.AuftragsdetailsTable.setItem(counter, 4, self.item)
|
||||
self.item.setText(str("0"))
|
||||
self.item = QtWidgets.QTableWidgetItem()
|
||||
self.AuftragsdetailsTable.setItem(counter, 5, self.item)
|
||||
self.item.setFlags(self.item.flags() & ~QtCore.Qt.ItemIsEditable)
|
||||
|
||||
# Dropdown für Farben in die 6. Spalte einfügen
|
||||
#self.item = QtWidgets.QTableWidgetItem()
|
||||
#self.AuftragsdetailsTable.setItem(counter, 6, self.item)
|
||||
combo = QComboBox()
|
||||
combo.addItems(["Farbe", "Weiß", "Orange", "Grün"])
|
||||
combo.currentIndexChanged.connect(lambda index, rowId =counter: self.change_row_color(rowId, index))
|
||||
self.AuftragsdetailsTable.setCellWidget(counter, 6, combo)
|
||||
counter = counter +1
|
||||
|
||||
elif(databaseQueryWorking==True and len(auftragEinzelteilDaten)==0):
|
||||
print("Es wurde in der Datenbank kein Auftrag mit dieser Auftragsnummer gefunden.")
|
||||
|
||||
def change_row_color(self, row, color_index):
|
||||
if(color_index == 1):
|
||||
self.setRowColor(row,255,255,255)
|
||||
if(color_index == 2):
|
||||
self.setRowColor(row,255,165,0)
|
||||
if(color_index == 3):
|
||||
self.setRowColor(row,0,255,0)
|
||||
|
||||
|
||||
|
||||
|
||||
def stopLoopClicked(self):
|
||||
# damit wird beim Klick auf den Stopbutton der stopLoop-boolWert in der Workerklasse auf true gesetzt -> der Stop des Threads wird initiiert
|
||||
if hasattr(self, 'objectDetectionWorker'):
|
||||
self.objectDetectionWorker.stopLoopSignal.emit(True)
|
||||
|
||||
if hasattr(self, 'checkWaageWorker'):
|
||||
self.checkWaageWorker.stopLoopSignal.emit(True)
|
||||
|
||||
def checkWaage(self):
|
||||
#print("Running in thread:", threading.current_thread().name) # Debuggingausgabe
|
||||
QApplication.processEvents()
|
||||
|
||||
# die Loopvariable des Workers auf False setzten, damit die Schleife durchgelaufen wird (diese wird zum Abbruch der Schleife benötigt -> siehe stopLoop)
|
||||
#self.checkWaageWorker.stopLoopSignal.emit(False)
|
||||
|
||||
# überprüfen, ob der Auftrag geladen wurde
|
||||
if(self.AuftragsdetailsTable.item(0,0) == None):
|
||||
print("Der Auftrag muss zuerst geladen werden.")
|
||||
return
|
||||
|
||||
# überprüfen, ob ein Bauteiltyp gesetzt wurde
|
||||
if(self.checkPosNrEmpty()==True and self.checkBox.isChecked() == False):
|
||||
print("Das Pos.-Nr.-Feld ist leer.")
|
||||
return
|
||||
|
||||
# den GUI Wert von Textfeld TeileZuViel in die Variable schreiben
|
||||
self.teileZuViel = int(float(self.teileZuVielTxtFeld.toPlainText()))
|
||||
self.teileZuVielTxtFeld.setText(str(self.teileZuViel))
|
||||
|
||||
einzelteilID = -1 # Initialisieren der Variable mit einem Defaultwert, welcher nie eingenommen werden können sollte
|
||||
if (self.checkBox.isChecked() == False):
|
||||
#übernehmen der BauteilID aus dem Feld Pos.-Nr - wenn der Workflow dynamisch gewählt wurde
|
||||
einzelteilID = int(self.PosNrTxtFeld.toPlainText())
|
||||
else:
|
||||
# wenn der Workflow statisch gesetzt wurde, dann soll das erste Item aus der Auftragsliste geladen werden, von welchem noch nicht genug Bauteile auf der Waage liegen
|
||||
for i in range(0,self.AuftragsdetailsTable.rowCount()):
|
||||
if self.AuftragsdetailsTable.item(i,3).text() != self.AuftragsdetailsTable.item(i,4).text():
|
||||
einzelteilID = int(self.AuftragsdetailsTable.item(i,0).text())
|
||||
self.PosNrTxtFeld.setText(str(self.AuftragsdetailsTable.item(i,0).text()))
|
||||
self.bauteiltypTextbox.setText(str(self.AuftragsdetailsTable.item(i,2).text()))
|
||||
break
|
||||
|
||||
if einzelteilID == -1:
|
||||
# den Thread beenden
|
||||
self.checkWaageThread.quit()
|
||||
self.checkWaageThread.wait()
|
||||
try:
|
||||
self.checkWaageThread.started.disconnect() # Trenne das Signal, damit es beim nächsten Start keine Konflikte gibt
|
||||
print("Der Thread wurde beendet.")
|
||||
except:
|
||||
print("Disconnecting the thread did not work.")
|
||||
return
|
||||
|
||||
|
||||
#zum setzen den Farbe der gesamten Reihe auf Orange
|
||||
self.setRowColor(self.getRowNr(einzelteilID),255,165,0)
|
||||
|
||||
# den Thread starten, welcher die Bauteilanzahl überprüft
|
||||
self.checkWaageWorker = Worker()
|
||||
self.checkWaageThread = QThread()
|
||||
|
||||
self.checkWaageWorker.moveToThread(self.checkWaageThread)
|
||||
|
||||
self.checkWaageWorker.checkWaageStartSignal.connect(self.checkWaageWorker.checkWaageThread)
|
||||
self.checkWaageWorker.checkWaageUpdateSignal.connect(self.checkWaageUpdate)
|
||||
self.checkWaageWorker.checkWaageFinishedSignal.connect(self.checkWaageFinished)
|
||||
self.checkWaageWorker.waageStoppedSignal.connect(self.threadStopped)
|
||||
self.checkWaageWorker.stopLoopSignal.connect(lambda status: setattr(self.checkWaageWorker, 'stopLoop', status)) #wird fürs aktive Stoppen des Threads benötigt
|
||||
|
||||
self.checkWaageThread.started.connect(lambda: self.checkWaageWorker.checkWaageStartSignal.emit(einzelteilID, self.teileZuViel, self.auftragsnummer))
|
||||
self.checkWaageThread.start()
|
||||
|
||||
def checkWaageUpdate(self, einzelteilID, anzahl):
|
||||
# die Funktion updated die (vom Thread) berechnete Bauteilanzahl in der GUI
|
||||
self.AuftragsdetailsTable.item(self.getRowNr(einzelteilID), 4).setText(str(anzahl)) # in die Tabelle die Anzahl an berechneten Bauteilen reinschreiben
|
||||
|
||||
def checkWaageFinished(self, einzelteilID):
|
||||
self.setRowColor(self.getRowNr(einzelteilID),0,255,0) #zum setzen den Farbe der gesamten Reihe auf Grün
|
||||
|
||||
# den Thread beenden
|
||||
self.checkWaageThread.quit()
|
||||
self.checkWaageThread.wait()
|
||||
|
||||
# auch wenn die Länge der Liste überschritten wurde
|
||||
# wenn der statische Workflow aktiviert ist, dann soll die checkwaage-funktion erneut aufgerufen werden
|
||||
if(self.checkBox.isChecked() == True):
|
||||
self.checkWaage()
|
||||
|
||||
# GUI updaten
|
||||
#self.updateGUI()
|
||||
|
||||
def objectTypeDetection(self):
|
||||
# in dieser Funktion wird der Typ des Bauteils automatisch erkannt
|
||||
|
||||
# wenn der statische Workflow ausgewählt wurde, dann soll die checkWaage Funktion aufgerufen werden, auch wenn die detectBauteiltyp-Funkion aufgerufen wurde
|
||||
if self.checkBox.isChecked() == True:
|
||||
self.checkWaage()
|
||||
return
|
||||
|
||||
'''
|
||||
if(self.checkPosNrEmpty()==True):
|
||||
print("Das Pos.-Nr.-Feld ist leer.")
|
||||
return
|
||||
'''
|
||||
|
||||
# die Loopvariable des Workers auf False setzten, damit die Schleife durchgelaufen wird (diese wird zum Abbruch der Schleife benötigt -> siehe stopLoop)
|
||||
#self.objectDetectionWorker.stopLoopSignal.emit(False)
|
||||
|
||||
# überprüfen, ob der Auftrag in die Tabelle geladen wurde
|
||||
if(self.AuftragsdetailsTable.item(0,0) == None):
|
||||
print("Der Auftrag muss zuerst geladen werden.")
|
||||
return
|
||||
|
||||
# speichert den Wert, welcher im Textfeld steht in Variablen im Code
|
||||
self.setAuftragsnummer()
|
||||
|
||||
# starten des Threats, welcher den Bauteiltyp zurück gibt
|
||||
self.objectDetectionWorker = Worker()
|
||||
self.objectDetectionThread = QThread()
|
||||
|
||||
self.objectDetectionWorker.moveToThread(self.objectDetectionThread)
|
||||
|
||||
self.objectDetectionWorker.objectDetectionStartSignal.connect(self.objectDetectionWorker.objectTypeDetectionThread)
|
||||
self.objectDetectionWorker.objectDetectionFinishedSignal.connect(self.objectTypeDetectionFinished)
|
||||
self.objectDetectionWorker.waageStoppedSignal.connect(self.threadStopped)
|
||||
self.objectDetectionWorker.stopLoopSignal.connect(lambda status: setattr(self.objectDetectionWorker, 'stopLoop', status)) #wird fürs aktive Stoppen des Threads benötigt
|
||||
|
||||
self.objectDetectionThread.started.connect(lambda: self.objectDetectionWorker.objectDetectionStartSignal.emit(self.auftragsnummer))
|
||||
self.objectDetectionThread.start()
|
||||
|
||||
def objectTypeDetectionFinished(self, einzelteilID, rowData):
|
||||
# wenn der Typ des Objektes erkannt wurde, dann soll die Funktion aufgerufen werden
|
||||
|
||||
# Schreiben der Bauteiltype und Pos.-Nr in die jeweiligen Felder
|
||||
self.PosNrTxtFeld.setText(str(rowData[1]))
|
||||
self.bauteiltypTextbox.setText(rowData[2])
|
||||
|
||||
# setzt den Boolean, um aus der Schleife raus zu gehen
|
||||
self.btTypeIsSet = True
|
||||
|
||||
#zum setzen den Farbe der gesamten Reihe auf Orange
|
||||
self.setRowColor(self.getRowNr(einzelteilID),255,165,0)
|
||||
|
||||
# den Thread beenden
|
||||
self.objectDetectionThread.quit()
|
||||
self.objectDetectionThread.wait()
|
||||
|
||||
'''
|
||||
try:
|
||||
self.objectDetectionThread.started.disconnect() # Trenne das Signal, damit es beim nächsten Start keine Konflikte gibt
|
||||
except:
|
||||
print(f"Error while disconnecting: {e}")
|
||||
print("Disconnecting the thread did not work.")
|
||||
'''
|
||||
|
||||
# wenn der Bauteiltyp erkannt wurde, dann soll die GUI aktualisiert werden und anschließend die CheckWaage-Funktion aufgerufen werden
|
||||
self.updateGUI()
|
||||
self.checkWaage()
|
||||
|
||||
def threadStopped(self, einzelteilID):
|
||||
# wenn kein Bauteil erkannt wurde, dann ist die EinzenteilID = 0
|
||||
if(einzelteilID > 0):
|
||||
self.setRowColor(self.getRowNr(einzelteilID),255,255,255) #zum setzen den Farbe der gesamten Reihe auf Weiß
|
||||
|
||||
# den Thread beenden
|
||||
if hasattr(self, 'objectDetectionThread'):
|
||||
self.objectDetectionThread.quit()
|
||||
self.objectDetectionThread.wait()
|
||||
print("Der ObjektDetection-Thread wurde beendet.")
|
||||
|
||||
if hasattr(self, 'checkWaageThread'):
|
||||
self.checkWaageThread.quit()
|
||||
self.checkWaageThread.wait()
|
||||
print("Der CheckWaage-Thread wurde beendet.")
|
||||
|
||||
# new class for Camera Object detection with YOLOv8
|
||||
class CameraStreamApp(QtWidgets.QMainWindow):
|
||||
def __init__(self, ui):
|
||||
super().__init__()
|
||||
self.ui = ui
|
||||
self.yolo_stream = None # Initialize YOLOv8CameraStream as None
|
||||
self.timer = QtCore.QTimer(self)
|
||||
self.timer.timeout.connect(self.update_frame)
|
||||
self.ui.startCamBtn.clicked.connect(self.start_camera) # start camera if button LoadAuftrag is clicked
|
||||
self.scene = QtWidgets.QGraphicsScene(self)
|
||||
self.ui.graphicsView.setScene(self.scene)
|
||||
|
||||
def start_camera(self):
|
||||
# Start the YOLOv8 camera stream (only if not already started)
|
||||
if self.yolo_stream is None:
|
||||
self.yolo_stream = YOLOv8CameraStream(model_path="models/yolov8m_seg_e300.pt", logging_level="high")
|
||||
# self.yolo_stream.start() # Start the YOLOv8 stream
|
||||
self.timer.start(30) # Start the timer to update the frame every 30ms (about 33 FPS)
|
||||
|
||||
def update_frame(self):
|
||||
# Update the frame from YOLOv8 stream
|
||||
if self.yolo_stream:
|
||||
ret, frame = self.yolo_stream.cap.read() # Capture frame from YOLOv8 stream
|
||||
|
||||
if ret:
|
||||
# new part including processing via yolo model
|
||||
processed_frame = self.yolo_stream.process_frame(frame)
|
||||
|
||||
# Convert the frame from BGR (OpenCV format) to RGB
|
||||
# frame = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)
|
||||
frame = cv2.cvtColor(processed_frame, cv2.COLOR_BGR2RGB) # might change nomenclature later?
|
||||
|
||||
# Convert the frame to QImage
|
||||
h, w, ch = frame.shape
|
||||
bytes_per_line = ch * w
|
||||
qt_image = QtGui.QImage(frame.data, w, h, bytes_per_line, QtGui.QImage.Format_RGB888)
|
||||
|
||||
# Add the QImage to a QPixmap
|
||||
pixmap = QtGui.QPixmap.fromImage(qt_image)
|
||||
|
||||
# Get the size of the graphicsView and scale the pixmap to fit
|
||||
view_size = self.ui.graphicsView.size()
|
||||
scaled_pixmap = pixmap.scaled(view_size, QtCore.Qt.KeepAspectRatio)
|
||||
|
||||
# Update the scene with the scaled pixmap
|
||||
self.scene.clear()
|
||||
self.scene.addPixmap(scaled_pixmap)
|
||||
|
||||
def closeEvent(self, event):
|
||||
# Release the camera when the application is closed
|
||||
if self.yolo_stream is not None:
|
||||
self.yolo_stream.cap.release()
|
||||
event.accept()
|
||||
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
import sys
|
||||
app = QtWidgets.QApplication(sys.argv)
|
||||
MainWindow = QtWidgets.QMainWindow()
|
||||
ui = Ui_MainWindow()
|
||||
ui.setupUi(MainWindow)
|
||||
|
||||
# Initialize the CameraStreamApp with the UI
|
||||
camera_app = CameraStreamApp(ui)
|
||||
|
||||
MainWindow.show()
|
||||
sys.exit(app.exec_())
|
||||
|
||||
|
||||
|
||||
|
||||
|
24
compose.yml
Normal file
@ -0,0 +1,24 @@
|
||||
# Use root/example as user/password credentials
|
||||
version: '3.1'
|
||||
|
||||
services:
|
||||
|
||||
db:
|
||||
image: mariadb
|
||||
restart: always
|
||||
environment:
|
||||
MARIADB_ROOT_PASSWORD: example
|
||||
MARIADB_USER: dbUser
|
||||
MARIADB_PASSWORD: dbPassword
|
||||
MARIADB_DATABASE: projectGeislinger
|
||||
ports:
|
||||
- 3306:3306
|
||||
# network_mode: host
|
||||
# volumes:
|
||||
# - /tmp/mysql.sock:/tmp/mysql.sock
|
||||
|
||||
adminer:
|
||||
image: adminer
|
||||
restart: always
|
||||
ports:
|
||||
- 8082:8080
|
17
environment.yaml
Normal file
@ -0,0 +1,17 @@
|
||||
name: geislinger
|
||||
channels:
|
||||
- conda-forge
|
||||
- nvidia
|
||||
- pytorch
|
||||
dependencies:
|
||||
- pip=24.2
|
||||
- python=3.11
|
||||
- ultralytics=8
|
||||
- mariadb
|
||||
- pytorch
|
||||
- torchvision
|
||||
- torchaudio
|
||||
- pytorch-cuda=11.8
|
||||
- opencv
|
||||
- pyqt
|
||||
- pyserial
|
47
mariadb-test.py
Normal file
@ -0,0 +1,47 @@
|
||||
import mariadb
|
||||
import sys
|
||||
|
||||
# # Database connection parameters
|
||||
# host = "127.0.0.1" # host = "localhost" # or the IP of the machine if accessed remotely
|
||||
# port = 3306
|
||||
# user = "root"
|
||||
# password = "my-secret-pw" # Update with your password
|
||||
# database = "mydatabase" # Replace with your actual database name
|
||||
|
||||
db_config = {
|
||||
'user': 'dbUser',
|
||||
'password': 'dbPassword',
|
||||
'host': '127.0.0.1', # 'host': 'localhost',
|
||||
'database': 'projectGeislinger',
|
||||
'port': 3306 # Standard port for MariaDB
|
||||
}
|
||||
|
||||
try:
|
||||
# Establish a connection
|
||||
# conn = mariadb.connect(
|
||||
# user=user,
|
||||
# password=password,
|
||||
# host=host,
|
||||
# port=port,
|
||||
# database=database
|
||||
# )
|
||||
|
||||
conn = mariadb.connect(**db_config)
|
||||
|
||||
print("Connection successful!")
|
||||
|
||||
# Create a cursor object
|
||||
cur = conn.cursor()
|
||||
|
||||
# Example query
|
||||
cur.execute("SELECT VERSION()")
|
||||
result = cur.fetchone()
|
||||
print(f"MariaDB version: {result[0]}")
|
||||
|
||||
except mariadb.Error as e:
|
||||
print(f"Error connecting to MariaDB: {e}")
|
||||
sys.exit(1)
|
||||
|
||||
finally:
|
||||
if conn:
|
||||
conn.close()
|
BIN
models/best_8n.pt
Normal file
BIN
models/yolov10n_e300.pt
Normal file
BIN
models/yolov10n_e300_openvino_model/best.bin
Normal file
10826
models/yolov10n_e300_openvino_model/best.xml
Normal file
33
models/yolov10n_e300_openvino_model/metadata.yaml
Normal file
@ -0,0 +1,33 @@
|
||||
description: Ultralytics YOLOv10n model trained on rf_version2/geisi2-4/data.yaml
|
||||
author: Ultralytics
|
||||
date: '2024-09-24T13:16:48.802051'
|
||||
version: 8.2.100
|
||||
license: AGPL-3.0 License (https://ultralytics.com/license)
|
||||
docs: https://docs.ultralytics.com
|
||||
stride: 32
|
||||
task: detect
|
||||
batch: 1
|
||||
imgsz:
|
||||
- 640
|
||||
- 640
|
||||
names:
|
||||
0: box
|
||||
1: hand
|
||||
2: oring_100_b
|
||||
3: oring_40_b
|
||||
4: oring_d105
|
||||
5: oring_d300_b
|
||||
6: oring_l1150
|
||||
7: oring_l380_b
|
||||
8: oring_l500
|
||||
9: oring_l600
|
||||
10: oring_l650_b
|
||||
11: ring_40mm
|
||||
12: ring_45mm
|
||||
13: ring_58mm
|
||||
14: schraube_sk_m10x25
|
||||
15: schraube_sk_m10x30
|
||||
16: schraube_sk_m10x45
|
||||
17: schraube_sk_m12x20
|
||||
18: schraube_sk_m12x50
|
||||
19: table
|
BIN
models/yolov8m_seg_e300.pt
Normal file
BIN
models/yolov8n.pt
Normal file
53
sainsmartrelay.py
Normal file
@ -0,0 +1,53 @@
|
||||
import subprocess
|
||||
|
||||
class SainsmartRelay:
|
||||
def __init__(self, executable="sainsmartrelay"):
|
||||
self.executable = executable
|
||||
|
||||
def _run_command(self, args):
|
||||
try:
|
||||
result = subprocess.run(
|
||||
[self.executable] + args,
|
||||
stdout=subprocess.PIPE,
|
||||
stderr=subprocess.PIPE,
|
||||
text=True,
|
||||
check=True
|
||||
)
|
||||
return result.stdout.strip()
|
||||
except subprocess.CalledProcessError as e:
|
||||
print(f"Error: {e.stderr.strip()}")
|
||||
return None
|
||||
|
||||
def turn_on(self, relays):
|
||||
"""Turn on specified relays."""
|
||||
relays_str = ','.join(map(str, relays)) if isinstance(relays, (list, tuple)) else str(relays)
|
||||
return self._run_command(["--on", relays_str])
|
||||
|
||||
def turn_off(self, relays):
|
||||
"""Turn off specified relays."""
|
||||
relays_str = ','.join(map(str, relays)) if isinstance(relays, (list, tuple)) else str(relays)
|
||||
return self._run_command(["--off", relays_str])
|
||||
|
||||
def get_status(self, relays="all"):
|
||||
"""Get the status of specified relays."""
|
||||
return self._run_command(["--status", str(relays)])
|
||||
|
||||
def find_all_devices(self):
|
||||
"""Find all connected FTDI devices."""
|
||||
return self._run_command(["--findall"])
|
||||
|
||||
# Example usage:
|
||||
if __name__ == "__main__":
|
||||
relay = SainsmartRelay()
|
||||
|
||||
# Turn on relay 1
|
||||
print(relay.turn_on(1))
|
||||
|
||||
# Turn off all relays
|
||||
print(relay.turn_off("all"))
|
||||
|
||||
# Get the status of all relays
|
||||
print(relay.get_status())
|
||||
|
||||
# Find all FTDI devices
|
||||
print(relay.find_all_devices())
|
BIN
saved_frames/hand_20241025_105036.jpg
Normal file
After Width: | Height: | Size: 82 KiB |
BIN
saved_frames/hand_20241025_105916.jpg
Normal file
After Width: | Height: | Size: 75 KiB |
BIN
saved_frames/hand_20241025_105917.jpg
Normal file
After Width: | Height: | Size: 78 KiB |
BIN
saved_frames/hand_20241025_105918.jpg
Normal file
After Width: | Height: | Size: 78 KiB |
BIN
saved_frames/hand_20241025_105919.jpg
Normal file
After Width: | Height: | Size: 78 KiB |
BIN
saved_frames/hand_20241025_105920.jpg
Normal file
After Width: | Height: | Size: 78 KiB |
BIN
saved_frames/hand_20241025_105921.jpg
Normal file
After Width: | Height: | Size: 78 KiB |
BIN
saved_frames/hand_20241025_110016.jpg
Normal file
After Width: | Height: | Size: 81 KiB |
BIN
saved_frames/hand_20241025_110017.jpg
Normal file
After Width: | Height: | Size: 80 KiB |
BIN
saved_frames/hand_20241025_110018.jpg
Normal file
After Width: | Height: | Size: 78 KiB |
BIN
saved_frames/hand_20241025_110021.jpg
Normal file
After Width: | Height: | Size: 75 KiB |
BIN
saved_frames/hand_20241025_110028.jpg
Normal file
After Width: | Height: | Size: 78 KiB |
BIN
saved_frames/hand_20241025_110031.jpg
Normal file
After Width: | Height: | Size: 81 KiB |
BIN
saved_frames/hand_20241025_110032.jpg
Normal file
After Width: | Height: | Size: 82 KiB |
BIN
saved_frames/hand_20241025_114821.jpg
Normal file
After Width: | Height: | Size: 78 KiB |
BIN
saved_frames/hand_20241025_114826.jpg
Normal file
After Width: | Height: | Size: 78 KiB |
BIN
saved_frames/hand_20241025_114827.jpg
Normal file
After Width: | Height: | Size: 77 KiB |
BIN
saved_frames/hand_20241025_120810.jpg
Normal file
After Width: | Height: | Size: 78 KiB |
BIN
saved_frames/hand_20241025_120811.jpg
Normal file
After Width: | Height: | Size: 78 KiB |
BIN
saved_frames/hand_20241025_120813.jpg
Normal file
After Width: | Height: | Size: 78 KiB |
BIN
saved_frames/hand_20241025_121052.jpg
Normal file
After Width: | Height: | Size: 74 KiB |
BIN
saved_frames/hand_20241028_081631.jpg
Normal file
After Width: | Height: | Size: 88 KiB |
BIN
saved_frames/hand_20241028_090057.jpg
Normal file
After Width: | Height: | Size: 73 KiB |
BIN
saved_frames/hand_20241028_090058.jpg
Normal file
After Width: | Height: | Size: 73 KiB |
BIN
saved_frames/hand_20241028_095023.jpg
Normal file
After Width: | Height: | Size: 112 KiB |
BIN
saved_frames/hand_20241028_095024.jpg
Normal file
After Width: | Height: | Size: 82 KiB |
BIN
saved_frames/hand_20241028_095025.jpg
Normal file
After Width: | Height: | Size: 83 KiB |
BIN
saved_frames/hand_20241028_095026.jpg
Normal file
After Width: | Height: | Size: 120 KiB |
BIN
saved_frames/hand_20241028_095027.jpg
Normal file
After Width: | Height: | Size: 113 KiB |
BIN
saved_frames/hand_20241028_095028.jpg
Normal file
After Width: | Height: | Size: 122 KiB |
BIN
saved_frames/hand_20241028_095029.jpg
Normal file
After Width: | Height: | Size: 120 KiB |
BIN
saved_frames/hand_20241028_095030.jpg
Normal file
After Width: | Height: | Size: 124 KiB |
BIN
saved_frames/hand_20241028_095031.jpg
Normal file
After Width: | Height: | Size: 118 KiB |
BIN
saved_frames/oring_d300_b_20241028_095016.jpg
Normal file
After Width: | Height: | Size: 60 KiB |
BIN
saved_frames/ring_58mm_20241025_114822.jpg
Normal file
After Width: | Height: | Size: 80 KiB |
BIN
saved_frames/ring_58mm_20241025_114823.jpg
Normal file
After Width: | Height: | Size: 78 KiB |
BIN
saved_frames/ring_58mm_20241025_114824.jpg
Normal file
After Width: | Height: | Size: 80 KiB |
BIN
saved_frames/ring_58mm_20241025_114825.jpg
Normal file
After Width: | Height: | Size: 74 KiB |
BIN
saved_frames/schraube_sk_m10x45_20241025_110317.jpg
Normal file
After Width: | Height: | Size: 80 KiB |
230
test.ui
Normal file
@ -0,0 +1,230 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>MainWindow</class>
|
||||
<widget class="QMainWindow" name="MainWindow">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>1090</width>
|
||||
<height>675</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>MainWindow</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="centralwidget">
|
||||
<widget class="QPushButton" name="btn1">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>900</x>
|
||||
<y>80</y>
|
||||
<width>111</width>
|
||||
<height>25</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>load Auftrag</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QTableWidget" name="AuftragsdetailsTable">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>10</y>
|
||||
<width>661</width>
|
||||
<height>192</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="editTriggers">
|
||||
<set>QAbstractItemView::NoEditTriggers</set>
|
||||
</property>
|
||||
<row>
|
||||
<property name="text">
|
||||
<string>T1</string>
|
||||
</property>
|
||||
</row>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Pos.-Nr</string>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>8</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Matnr mit hoechster Version</string>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>8</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Bezeichnung + Werkstoff</string>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>8</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Menge</string>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>8</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Lgort</string>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>8</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
</column>
|
||||
<item row="0" column="0">
|
||||
<property name="text">
|
||||
<string>I1</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>900</x>
|
||||
<y>20</y>
|
||||
<width>121</width>
|
||||
<height>17</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Auftragsnummer:</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QTextEdit" name="textEdit">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>860</x>
|
||||
<y>40</y>
|
||||
<width>221</width>
|
||||
<height>31</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="html">
|
||||
<string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
||||
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
||||
p, li { white-space: pre-wrap; }
|
||||
</style></head><body style=" font-family:'Ubuntu'; font-size:11pt; font-weight:400; font-style:normal;">
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="bauteilTypBtn">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>450</x>
|
||||
<y>350</y>
|
||||
<width>161</width>
|
||||
<height>25</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Bauteiltype erkennen</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QTextEdit" name="bauteiltypTextbox">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>620</x>
|
||||
<y>350</y>
|
||||
<width>221</width>
|
||||
<height>31</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="html">
|
||||
<string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
||||
<html><head><meta name="qrichtext" content="1" /><style type="text/css">
|
||||
p, li { white-space: pre-wrap; }
|
||||
</style></head><body style=" font-family:'Ubuntu'; font-size:11pt; font-weight:400; font-style:normal;">
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>640</x>
|
||||
<y>330</y>
|
||||
<width>181</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Bezeichnung</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>910</x>
|
||||
<y>330</y>
|
||||
<width>67</width>
|
||||
<height>17</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Pos.-Nr:</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QTextEdit" name="textEdit_3">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>850</x>
|
||||
<y>350</y>
|
||||
<width>191</width>
|
||||
<height>31</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QCheckBox" name="checkBox">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>460</x>
|
||||
<y>420</y>
|
||||
<width>151</width>
|
||||
<height>23</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Bauteiltype locked</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QMenuBar" name="menubar">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>1090</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QStatusBar" name="statusbar"/>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
274
test2.ui.py
Normal file
@ -0,0 +1,274 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>MainWindow</class>
|
||||
<widget class="QMainWindow" name="MainWindow">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>1374</width>
|
||||
<height>725</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>MainWindow</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="centralwidget">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<widget class="QTableWidget" name="AuftragsdetailsTable">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>30</x>
|
||||
<y>200</y>
|
||||
<width>591</width>
|
||||
<height>371</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="autoFillBackground">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="editTriggers">
|
||||
<set>QAbstractItemView::NoEditTriggers</set>
|
||||
</property>
|
||||
<row>
|
||||
<property name="text">
|
||||
<string>T1</string>
|
||||
</property>
|
||||
</row>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Pos.-Nr</string>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>8</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Matnr mit hoechster Version</string>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>8</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Bezeichnung + Werkstoff</string>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>8</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Menge</string>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>8</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Lgort</string>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>8</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
</column>
|
||||
<item row="0" column="0">
|
||||
<property name="text">
|
||||
<string>I1</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
<widget class="QGroupBox" name="groupBox">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>9</x>
|
||||
<y>9</y>
|
||||
<width>611</width>
|
||||
<height>151</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="title">
|
||||
<string>Bauteile</string>
|
||||
</property>
|
||||
<widget class="QFrame" name="frame">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>170</x>
|
||||
<y>30</y>
|
||||
<width>221</width>
|
||||
<height>71</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<widget class="QTextEdit" name="bauteiltypTextbox">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>31</x>
|
||||
<y>34</y>
|
||||
<width>269</width>
|
||||
<height>76</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="html">
|
||||
<string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
||||
<html><head><meta name="qrichtext" content="1" /><meta charset="utf-8" /><style type="text/css">
|
||||
p, li { white-space: pre-wrap; }
|
||||
hr { height: 1px; border-width: 0; }
|
||||
li.unchecked::marker { content: "\2610"; }
|
||||
li.checked::marker { content: "\2612"; }
|
||||
</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;">
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Ubuntu'; font-size:11pt;"><br /></p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>31</x>
|
||||
<y>11</y>
|
||||
<width>73</width>
|
||||
<height>17</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Bezeichnung</string>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QWidget" name="">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>420</x>
|
||||
<y>40</y>
|
||||
<width>171</width>
|
||||
<height>71</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>Pos.-Nr:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QTextEdit" name="textEdit_3"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>20</x>
|
||||
<y>40</y>
|
||||
<width>161</width>
|
||||
<height>81</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<item>
|
||||
<widget class="QPushButton" name="bauteilTypBtn">
|
||||
<property name="text">
|
||||
<string>Bauteiltype erkennen</string>
|
||||
</property>
|
||||
<property name="checkable">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="autoDefault">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="default">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="flat">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkBox">
|
||||
<property name="text">
|
||||
<string>Bauteiltype locked</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QWidget" name="">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>640</x>
|
||||
<y>20</y>
|
||||
<width>351</width>
|
||||
<height>571</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_2">
|
||||
<property name="title">
|
||||
<string>Auftrag</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>32</y>
|
||||
<width>331</width>
|
||||
<height>481</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Auftragsnummer:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="btn1">
|
||||
<property name="text">
|
||||
<string>load Auftrag</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGraphicsView" name="graphicsView"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QStatusBar" name="statusbar"/>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
130
test_ui.py
Normal file
@ -0,0 +1,130 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Form implementation generated from reading ui file '/home/bjoern/git/GeislingerProject/test.ui'
|
||||
#
|
||||
# Created by: PyQt5 UI code generator 5.15.11
|
||||
#
|
||||
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
|
||||
# run again. Do not edit this file unless you know what you are doing.
|
||||
|
||||
|
||||
from PyQt5 import QtCore, QtGui, QtWidgets
|
||||
|
||||
|
||||
class Ui_MainWindow(object):
|
||||
def setupUi(self, MainWindow):
|
||||
MainWindow.setObjectName("MainWindow")
|
||||
MainWindow.resize(1090, 675)
|
||||
self.centralwidget = QtWidgets.QWidget(MainWindow)
|
||||
self.centralwidget.setObjectName("centralwidget")
|
||||
self.btn1 = QtWidgets.QPushButton(self.centralwidget)
|
||||
self.btn1.setGeometry(QtCore.QRect(900, 80, 111, 25))
|
||||
self.btn1.setObjectName("btn1")
|
||||
self.AuftragsdetailsTable = QtWidgets.QTableWidget(self.centralwidget)
|
||||
self.AuftragsdetailsTable.setGeometry(QtCore.QRect(10, 10, 661, 192))
|
||||
self.AuftragsdetailsTable.setEditTriggers(QtWidgets.QAbstractItemView.NoEditTriggers)
|
||||
self.AuftragsdetailsTable.setObjectName("AuftragsdetailsTable")
|
||||
self.AuftragsdetailsTable.setColumnCount(5)
|
||||
self.AuftragsdetailsTable.setRowCount(1)
|
||||
item = QtWidgets.QTableWidgetItem()
|
||||
self.AuftragsdetailsTable.setVerticalHeaderItem(0, item)
|
||||
item = QtWidgets.QTableWidgetItem()
|
||||
font = QtGui.QFont()
|
||||
font.setPointSize(8)
|
||||
item.setFont(font)
|
||||
self.AuftragsdetailsTable.setHorizontalHeaderItem(0, item)
|
||||
item = QtWidgets.QTableWidgetItem()
|
||||
font = QtGui.QFont()
|
||||
font.setPointSize(8)
|
||||
item.setFont(font)
|
||||
self.AuftragsdetailsTable.setHorizontalHeaderItem(1, item)
|
||||
item = QtWidgets.QTableWidgetItem()
|
||||
font = QtGui.QFont()
|
||||
font.setPointSize(8)
|
||||
item.setFont(font)
|
||||
self.AuftragsdetailsTable.setHorizontalHeaderItem(2, item)
|
||||
item = QtWidgets.QTableWidgetItem()
|
||||
font = QtGui.QFont()
|
||||
font.setPointSize(8)
|
||||
item.setFont(font)
|
||||
self.AuftragsdetailsTable.setHorizontalHeaderItem(3, item)
|
||||
item = QtWidgets.QTableWidgetItem()
|
||||
font = QtGui.QFont()
|
||||
font.setPointSize(8)
|
||||
item.setFont(font)
|
||||
self.AuftragsdetailsTable.setHorizontalHeaderItem(4, item)
|
||||
item = QtWidgets.QTableWidgetItem()
|
||||
self.AuftragsdetailsTable.setItem(0, 0, item)
|
||||
self.label = QtWidgets.QLabel(self.centralwidget)
|
||||
self.label.setGeometry(QtCore.QRect(900, 20, 121, 17))
|
||||
self.label.setObjectName("label")
|
||||
self.textEdit = QtWidgets.QTextEdit(self.centralwidget)
|
||||
self.textEdit.setGeometry(QtCore.QRect(860, 40, 221, 31))
|
||||
self.textEdit.setObjectName("textEdit")
|
||||
self.bauteilTypBtn = QtWidgets.QPushButton(self.centralwidget)
|
||||
self.bauteilTypBtn.setGeometry(QtCore.QRect(450, 350, 161, 25))
|
||||
self.bauteilTypBtn.setObjectName("bauteilTypBtn")
|
||||
self.bauteiltypTextbox = QtWidgets.QTextEdit(self.centralwidget)
|
||||
self.bauteiltypTextbox.setGeometry(QtCore.QRect(620, 350, 221, 31))
|
||||
self.bauteiltypTextbox.setObjectName("bauteiltypTextbox")
|
||||
self.label_3 = QtWidgets.QLabel(self.centralwidget)
|
||||
self.label_3.setGeometry(QtCore.QRect(640, 330, 181, 20))
|
||||
self.label_3.setObjectName("label_3")
|
||||
self.label_4 = QtWidgets.QLabel(self.centralwidget)
|
||||
self.label_4.setGeometry(QtCore.QRect(910, 330, 67, 17))
|
||||
self.label_4.setObjectName("label_4")
|
||||
self.textEdit_3 = QtWidgets.QTextEdit(self.centralwidget)
|
||||
self.textEdit_3.setGeometry(QtCore.QRect(850, 350, 191, 31))
|
||||
self.textEdit_3.setObjectName("textEdit_3")
|
||||
self.checkBox = QtWidgets.QCheckBox(self.centralwidget)
|
||||
self.checkBox.setGeometry(QtCore.QRect(460, 420, 151, 23))
|
||||
self.checkBox.setChecked(False)
|
||||
self.checkBox.setObjectName("checkBox")
|
||||
MainWindow.setCentralWidget(self.centralwidget)
|
||||
self.menubar = QtWidgets.QMenuBar(MainWindow)
|
||||
self.menubar.setGeometry(QtCore.QRect(0, 0, 1090, 22))
|
||||
self.menubar.setObjectName("menubar")
|
||||
MainWindow.setMenuBar(self.menubar)
|
||||
self.statusbar = QtWidgets.QStatusBar(MainWindow)
|
||||
self.statusbar.setObjectName("statusbar")
|
||||
MainWindow.setStatusBar(self.statusbar)
|
||||
|
||||
self.retranslateUi(MainWindow)
|
||||
QtCore.QMetaObject.connectSlotsByName(MainWindow)
|
||||
|
||||
def retranslateUi(self, MainWindow):
|
||||
_translate = QtCore.QCoreApplication.translate
|
||||
MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow"))
|
||||
self.btn1.setText(_translate("MainWindow", "load Auftrag"))
|
||||
item = self.AuftragsdetailsTable.verticalHeaderItem(0)
|
||||
item.setText(_translate("MainWindow", "T1"))
|
||||
item = self.AuftragsdetailsTable.horizontalHeaderItem(0)
|
||||
item.setText(_translate("MainWindow", "Pos.-Nr"))
|
||||
item = self.AuftragsdetailsTable.horizontalHeaderItem(1)
|
||||
item.setText(_translate("MainWindow", "Matnr mit hoechster Version"))
|
||||
item = self.AuftragsdetailsTable.horizontalHeaderItem(2)
|
||||
item.setText(_translate("MainWindow", "Bezeichnung + Werkstoff"))
|
||||
item = self.AuftragsdetailsTable.horizontalHeaderItem(3)
|
||||
item.setText(_translate("MainWindow", "Menge"))
|
||||
item = self.AuftragsdetailsTable.horizontalHeaderItem(4)
|
||||
item.setText(_translate("MainWindow", "Lgort"))
|
||||
__sortingEnabled = self.AuftragsdetailsTable.isSortingEnabled()
|
||||
self.AuftragsdetailsTable.setSortingEnabled(False)
|
||||
item = self.AuftragsdetailsTable.item(0, 0)
|
||||
item.setText(_translate("MainWindow", "I1"))
|
||||
self.AuftragsdetailsTable.setSortingEnabled(__sortingEnabled)
|
||||
self.label.setText(_translate("MainWindow", "Auftragsnummer:"))
|
||||
self.textEdit.setHtml(_translate("MainWindow", "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
|
||||
"<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
|
||||
"p, li { white-space: pre-wrap; }\n"
|
||||
"</style></head><body style=\" font-family:\'Ubuntu\'; font-size:11pt; font-weight:400; font-style:normal;\">\n"
|
||||
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p></body></html>"))
|
||||
self.bauteilTypBtn.setText(_translate("MainWindow", "Bauteiltype erkennen"))
|
||||
self.bauteiltypTextbox.setHtml(_translate("MainWindow", "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
|
||||
"<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
|
||||
"p, li { white-space: pre-wrap; }\n"
|
||||
"</style></head><body style=\" font-family:\'Ubuntu\'; font-size:11pt; font-weight:400; font-style:normal;\">\n"
|
||||
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p></body></html>"))
|
||||
self.label_3.setText(_translate("MainWindow", "Bezeichnung"))
|
||||
self.label_4.setText(_translate("MainWindow", "Pos.-Nr:"))
|
||||
self.checkBox.setText(_translate("MainWindow", "Bauteiltype locked"))
|
189
testbjoern.py
Normal file
@ -0,0 +1,189 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Form implementation generated from reading ui file 'test2.ui.py'
|
||||
#
|
||||
# Created by: PyQt5 UI code generator 5.15.11
|
||||
#
|
||||
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
|
||||
# run again. Do not edit this file unless you know what you are doing.
|
||||
|
||||
|
||||
from PyQt5 import QtCore, QtGui, QtWidgets
|
||||
import signal
|
||||
|
||||
|
||||
class Ui_MainWindow(object):
|
||||
def setupUi(self, MainWindow):
|
||||
MainWindow.setObjectName("MainWindow")
|
||||
MainWindow.resize(1374, 725)
|
||||
self.centralwidget = QtWidgets.QWidget(MainWindow)
|
||||
self.centralwidget.setEnabled(True)
|
||||
self.centralwidget.setObjectName("centralwidget")
|
||||
self.AuftragsdetailsTable = QtWidgets.QTableWidget(self.centralwidget)
|
||||
self.AuftragsdetailsTable.setGeometry(QtCore.QRect(30, 200, 591, 371))
|
||||
self.AuftragsdetailsTable.setAutoFillBackground(False)
|
||||
self.AuftragsdetailsTable.setEditTriggers(QtWidgets.QAbstractItemView.NoEditTriggers)
|
||||
self.AuftragsdetailsTable.setObjectName("AuftragsdetailsTable")
|
||||
self.AuftragsdetailsTable.setColumnCount(5)
|
||||
self.AuftragsdetailsTable.setRowCount(1)
|
||||
item = QtWidgets.QTableWidgetItem()
|
||||
self.AuftragsdetailsTable.setVerticalHeaderItem(0, item)
|
||||
item = QtWidgets.QTableWidgetItem()
|
||||
font = QtGui.QFont()
|
||||
font.setPointSize(8)
|
||||
item.setFont(font)
|
||||
self.AuftragsdetailsTable.setHorizontalHeaderItem(0, item)
|
||||
item = QtWidgets.QTableWidgetItem()
|
||||
font = QtGui.QFont()
|
||||
font.setPointSize(8)
|
||||
item.setFont(font)
|
||||
self.AuftragsdetailsTable.setHorizontalHeaderItem(1, item)
|
||||
item = QtWidgets.QTableWidgetItem()
|
||||
font = QtGui.QFont()
|
||||
font.setPointSize(8)
|
||||
item.setFont(font)
|
||||
self.AuftragsdetailsTable.setHorizontalHeaderItem(2, item)
|
||||
item = QtWidgets.QTableWidgetItem()
|
||||
font = QtGui.QFont()
|
||||
font.setPointSize(8)
|
||||
item.setFont(font)
|
||||
self.AuftragsdetailsTable.setHorizontalHeaderItem(3, item)
|
||||
item = QtWidgets.QTableWidgetItem()
|
||||
font = QtGui.QFont()
|
||||
font.setPointSize(8)
|
||||
item.setFont(font)
|
||||
self.AuftragsdetailsTable.setHorizontalHeaderItem(4, item)
|
||||
item = QtWidgets.QTableWidgetItem()
|
||||
self.AuftragsdetailsTable.setItem(0, 0, item)
|
||||
self.groupBox = QtWidgets.QGroupBox(self.centralwidget)
|
||||
self.groupBox.setGeometry(QtCore.QRect(9, 9, 611, 151))
|
||||
self.groupBox.setObjectName("groupBox")
|
||||
self.frame = QtWidgets.QFrame(self.groupBox)
|
||||
self.frame.setGeometry(QtCore.QRect(170, 30, 221, 71))
|
||||
self.frame.setFrameShape(QtWidgets.QFrame.StyledPanel)
|
||||
self.frame.setFrameShadow(QtWidgets.QFrame.Raised)
|
||||
self.frame.setObjectName("frame")
|
||||
self.bauteiltypTextbox = QtWidgets.QTextEdit(self.frame)
|
||||
self.bauteiltypTextbox.setGeometry(QtCore.QRect(31, 34, 269, 76))
|
||||
self.bauteiltypTextbox.setObjectName("bauteiltypTextbox")
|
||||
self.label_3 = QtWidgets.QLabel(self.frame)
|
||||
self.label_3.setGeometry(QtCore.QRect(31, 11, 73, 17))
|
||||
self.label_3.setObjectName("label_3")
|
||||
self.widget = QtWidgets.QWidget(self.groupBox)
|
||||
self.widget.setGeometry(QtCore.QRect(420, 40, 171, 71))
|
||||
self.widget.setObjectName("widget")
|
||||
self.verticalLayout_2 = QtWidgets.QVBoxLayout(self.widget)
|
||||
self.verticalLayout_2.setContentsMargins(0, 0, 0, 0)
|
||||
self.verticalLayout_2.setObjectName("verticalLayout_2")
|
||||
self.label_4 = QtWidgets.QLabel(self.widget)
|
||||
self.label_4.setObjectName("label_4")
|
||||
self.verticalLayout_2.addWidget(self.label_4)
|
||||
self.textEdit_3 = QtWidgets.QTextEdit(self.widget)
|
||||
self.textEdit_3.setObjectName("textEdit_3")
|
||||
self.verticalLayout_2.addWidget(self.textEdit_3)
|
||||
self.widget1 = QtWidgets.QWidget(self.groupBox)
|
||||
self.widget1.setGeometry(QtCore.QRect(20, 40, 161, 81))
|
||||
self.widget1.setObjectName("widget1")
|
||||
self.verticalLayout_3 = QtWidgets.QVBoxLayout(self.widget1)
|
||||
self.verticalLayout_3.setContentsMargins(0, 0, 0, 0)
|
||||
self.verticalLayout_3.setObjectName("verticalLayout_3")
|
||||
self.bauteilTypBtn = QtWidgets.QPushButton(self.widget1)
|
||||
self.bauteilTypBtn.setCheckable(False)
|
||||
self.bauteilTypBtn.setAutoDefault(False)
|
||||
self.bauteilTypBtn.setDefault(False)
|
||||
self.bauteilTypBtn.setFlat(False)
|
||||
self.bauteilTypBtn.setObjectName("bauteilTypBtn")
|
||||
self.verticalLayout_3.addWidget(self.bauteilTypBtn)
|
||||
self.checkBox = QtWidgets.QCheckBox(self.widget1)
|
||||
self.checkBox.setChecked(False)
|
||||
self.checkBox.setObjectName("checkBox")
|
||||
self.verticalLayout_3.addWidget(self.checkBox)
|
||||
self.widget2 = QtWidgets.QWidget(self.centralwidget)
|
||||
self.widget2.setGeometry(QtCore.QRect(640, 20, 351, 571))
|
||||
self.widget2.setObjectName("widget2")
|
||||
self.verticalLayout = QtWidgets.QVBoxLayout(self.widget2)
|
||||
self.verticalLayout.setContentsMargins(0, 0, 0, 0)
|
||||
self.verticalLayout.setObjectName("verticalLayout")
|
||||
self.groupBox_2 = QtWidgets.QGroupBox(self.widget2)
|
||||
self.groupBox_2.setObjectName("groupBox_2")
|
||||
self.widget3 = QtWidgets.QWidget(self.groupBox_2)
|
||||
self.widget3.setGeometry(QtCore.QRect(10, 32, 331, 481))
|
||||
self.widget3.setObjectName("widget3")
|
||||
self.verticalLayout_4 = QtWidgets.QVBoxLayout(self.widget3)
|
||||
self.verticalLayout_4.setContentsMargins(0, 0, 0, 0)
|
||||
self.verticalLayout_4.setObjectName("verticalLayout_4")
|
||||
self.label = QtWidgets.QLabel(self.widget3)
|
||||
self.label.setObjectName("label")
|
||||
self.verticalLayout_4.addWidget(self.label)
|
||||
self.btn1 = QtWidgets.QPushButton(self.widget3)
|
||||
self.btn1.setObjectName("btn1")
|
||||
self.verticalLayout_4.addWidget(self.btn1)
|
||||
self.graphicsView = QtWidgets.QGraphicsView(self.widget3)
|
||||
self.graphicsView.setObjectName("graphicsView")
|
||||
self.verticalLayout_4.addWidget(self.graphicsView)
|
||||
self.verticalLayout.addWidget(self.groupBox_2)
|
||||
MainWindow.setCentralWidget(self.centralwidget)
|
||||
self.statusbar = QtWidgets.QStatusBar(MainWindow)
|
||||
self.statusbar.setObjectName("statusbar")
|
||||
MainWindow.setStatusBar(self.statusbar)
|
||||
|
||||
self.retranslateUi(MainWindow)
|
||||
QtCore.QMetaObject.connectSlotsByName(MainWindow)
|
||||
|
||||
def retranslateUi(self, MainWindow):
|
||||
_translate = QtCore.QCoreApplication.translate
|
||||
MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow"))
|
||||
item = self.AuftragsdetailsTable.verticalHeaderItem(0)
|
||||
item.setText(_translate("MainWindow", "T1"))
|
||||
item = self.AuftragsdetailsTable.horizontalHeaderItem(0)
|
||||
item.setText(_translate("MainWindow", "Pos.-Nr"))
|
||||
item = self.AuftragsdetailsTable.horizontalHeaderItem(1)
|
||||
item.setText(_translate("MainWindow", "Matnr mit hoechster Version"))
|
||||
item = self.AuftragsdetailsTable.horizontalHeaderItem(2)
|
||||
item.setText(_translate("MainWindow", "Bezeichnung + Werkstoff"))
|
||||
item = self.AuftragsdetailsTable.horizontalHeaderItem(3)
|
||||
item.setText(_translate("MainWindow", "Menge"))
|
||||
item = self.AuftragsdetailsTable.horizontalHeaderItem(4)
|
||||
item.setText(_translate("MainWindow", "Lgort"))
|
||||
__sortingEnabled = self.AuftragsdetailsTable.isSortingEnabled()
|
||||
self.AuftragsdetailsTable.setSortingEnabled(False)
|
||||
item = self.AuftragsdetailsTable.item(0, 0)
|
||||
item.setText(_translate("MainWindow", "I1"))
|
||||
self.AuftragsdetailsTable.setSortingEnabled(__sortingEnabled)
|
||||
self.groupBox.setTitle(_translate("MainWindow", "Bauteile"))
|
||||
self.bauteiltypTextbox.setHtml(_translate("MainWindow", "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
|
||||
"<html><head><meta name=\"qrichtext\" content=\"1\" /><meta charset=\"utf-8\" /><style type=\"text/css\">\n"
|
||||
"p, li { white-space: pre-wrap; }\n"
|
||||
"hr { height: 1px; border-width: 0; }\n"
|
||||
"li.unchecked::marker { content: \"\\2610\"; }\n"
|
||||
"li.checked::marker { content: \"\\2612\"; }\n"
|
||||
"</style></head><body style=\" font-family:\'Sans Serif\'; font-size:9pt; font-weight:400; font-style:normal;\">\n"
|
||||
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:\'Ubuntu\'; font-size:11pt;\"><br /></p></body></html>"))
|
||||
self.label_3.setText(_translate("MainWindow", "Bezeichnung"))
|
||||
self.label_4.setText(_translate("MainWindow", "Pos.-Nr:"))
|
||||
self.bauteilTypBtn.setText(_translate("MainWindow", "Bauteiltype erkennen"))
|
||||
self.checkBox.setText(_translate("MainWindow", "Bauteiltype locked"))
|
||||
self.groupBox_2.setTitle(_translate("MainWindow", "Auftrag"))
|
||||
self.label.setText(_translate("MainWindow", "Auftragsnummer:"))
|
||||
self.btn1.setText(_translate("MainWindow", "load Auftrag"))
|
||||
|
||||
def signal_handler(sig, frame):
|
||||
QtWidgets.QApplication.quit()
|
||||
|
||||
if __name__ == "__main__":
|
||||
import sys
|
||||
app = QtWidgets.QApplication(sys.argv)
|
||||
|
||||
# Handle Ctrl+C (SIGINT) to close the application
|
||||
signal.signal(signal.SIGINT, signal_handler)
|
||||
|
||||
# Create a timer that runs in the background to process signals
|
||||
timer = QtCore.QTimer()
|
||||
timer.start(100) # Timer set to trigger every 100 ms
|
||||
timer.timeout.connect(lambda: None) # No-op to keep the event loop running
|
||||
|
||||
MainWindow = QtWidgets.QMainWindow()
|
||||
ui = Ui_MainWindow()
|
||||
ui.setupUi(MainWindow)
|
||||
MainWindow.show()
|
||||
sys.exit(app.exec_())
|
246
testbjoern2.ui
Normal file
@ -0,0 +1,246 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>MainWindow</class>
|
||||
<widget class="QMainWindow" name="MainWindow">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>1090</width>
|
||||
<height>675</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>MainWindow</string>
|
||||
</property>
|
||||
<widget class="QWidget" name="centralwidget">
|
||||
<widget class="QPushButton" name="btn1">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>900</x>
|
||||
<y>80</y>
|
||||
<width>111</width>
|
||||
<height>25</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>load Auftrag</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QTableWidget" name="AuftragsdetailsTable">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>10</x>
|
||||
<y>10</y>
|
||||
<width>661</width>
|
||||
<height>192</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="editTriggers">
|
||||
<set>QAbstractItemView::NoEditTriggers</set>
|
||||
</property>
|
||||
<row>
|
||||
<property name="text">
|
||||
<string>T1</string>
|
||||
</property>
|
||||
</row>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Pos.-Nr</string>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>8</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Matnr mit hoechster Version</string>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>8</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Bezeichnung + Werkstoff</string>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>8</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Menge</string>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>8</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Lgort</string>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>8</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
</column>
|
||||
<item row="0" column="0">
|
||||
<property name="text">
|
||||
<string>I1</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>900</x>
|
||||
<y>20</y>
|
||||
<width>121</width>
|
||||
<height>17</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Auftragsnummer:</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QTextEdit" name="textEdit">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>860</x>
|
||||
<y>40</y>
|
||||
<width>221</width>
|
||||
<height>31</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="html">
|
||||
<string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
||||
<html><head><meta name="qrichtext" content="1" /><meta charset="utf-8" /><style type="text/css">
|
||||
p, li { white-space: pre-wrap; }
|
||||
hr { height: 1px; border-width: 0; }
|
||||
li.unchecked::marker { content: "\2610"; }
|
||||
li.checked::marker { content: "\2612"; }
|
||||
</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;">
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Ubuntu'; font-size:11pt;"><br /></p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QPushButton" name="bauteilTypBtn">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>60</x>
|
||||
<y>340</y>
|
||||
<width>161</width>
|
||||
<height>25</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Bauteiltype erkennen</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QTextEdit" name="bauteiltypTextbox">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>230</x>
|
||||
<y>340</y>
|
||||
<width>221</width>
|
||||
<height>31</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="html">
|
||||
<string><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
||||
<html><head><meta name="qrichtext" content="1" /><meta charset="utf-8" /><style type="text/css">
|
||||
p, li { white-space: pre-wrap; }
|
||||
hr { height: 1px; border-width: 0; }
|
||||
li.unchecked::marker { content: "\2610"; }
|
||||
li.checked::marker { content: "\2612"; }
|
||||
</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;">
|
||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Ubuntu'; font-size:11pt;"><br /></p></body></html></string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_3">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>250</x>
|
||||
<y>320</y>
|
||||
<width>181</width>
|
||||
<height>20</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Bezeichnung</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>520</x>
|
||||
<y>320</y>
|
||||
<width>67</width>
|
||||
<height>17</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Pos.-Nr:</string>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QTextEdit" name="textEdit_3">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>460</x>
|
||||
<y>340</y>
|
||||
<width>191</width>
|
||||
<height>31</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QCheckBox" name="checkBox">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>70</x>
|
||||
<y>410</y>
|
||||
<width>151</width>
|
||||
<height>23</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Bauteiltype locked</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QGraphicsView" name="graphicsView">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>800</x>
|
||||
<y>280</y>
|
||||
<width>256</width>
|
||||
<height>192</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
</widget>
|
||||
<widget class="QMenuBar" name="menubar">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>1090</width>
|
||||
<height>22</height>
|
||||
</rect>
|
||||
</property>
|
||||
</widget>
|
||||
<widget class="QStatusBar" name="statusbar"/>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
139
testbjoern2_ui.py
Normal file
@ -0,0 +1,139 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Form implementation generated from reading ui file '/home/bjoern/git/GeislingerProject/testbjoern2.ui'
|
||||
#
|
||||
# Created by: PyQt5 UI code generator 5.15.11
|
||||
#
|
||||
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
|
||||
# run again. Do not edit this file unless you know what you are doing.
|
||||
|
||||
|
||||
from PyQt5 import QtCore, QtGui, QtWidgets
|
||||
|
||||
|
||||
class Ui_MainWindow(object):
|
||||
def setupUi(self, MainWindow):
|
||||
MainWindow.setObjectName("MainWindow")
|
||||
MainWindow.resize(1090, 675)
|
||||
self.centralwidget = QtWidgets.QWidget(MainWindow)
|
||||
self.centralwidget.setObjectName("centralwidget")
|
||||
self.btn1 = QtWidgets.QPushButton(self.centralwidget)
|
||||
self.btn1.setGeometry(QtCore.QRect(900, 80, 111, 25))
|
||||
self.btn1.setObjectName("btn1")
|
||||
self.AuftragsdetailsTable = QtWidgets.QTableWidget(self.centralwidget)
|
||||
self.AuftragsdetailsTable.setGeometry(QtCore.QRect(10, 10, 661, 192))
|
||||
self.AuftragsdetailsTable.setEditTriggers(QtWidgets.QAbstractItemView.NoEditTriggers)
|
||||
self.AuftragsdetailsTable.setObjectName("AuftragsdetailsTable")
|
||||
self.AuftragsdetailsTable.setColumnCount(5)
|
||||
self.AuftragsdetailsTable.setRowCount(1)
|
||||
item = QtWidgets.QTableWidgetItem()
|
||||
self.AuftragsdetailsTable.setVerticalHeaderItem(0, item)
|
||||
item = QtWidgets.QTableWidgetItem()
|
||||
font = QtGui.QFont()
|
||||
font.setPointSize(8)
|
||||
item.setFont(font)
|
||||
self.AuftragsdetailsTable.setHorizontalHeaderItem(0, item)
|
||||
item = QtWidgets.QTableWidgetItem()
|
||||
font = QtGui.QFont()
|
||||
font.setPointSize(8)
|
||||
item.setFont(font)
|
||||
self.AuftragsdetailsTable.setHorizontalHeaderItem(1, item)
|
||||
item = QtWidgets.QTableWidgetItem()
|
||||
font = QtGui.QFont()
|
||||
font.setPointSize(8)
|
||||
item.setFont(font)
|
||||
self.AuftragsdetailsTable.setHorizontalHeaderItem(2, item)
|
||||
item = QtWidgets.QTableWidgetItem()
|
||||
font = QtGui.QFont()
|
||||
font.setPointSize(8)
|
||||
item.setFont(font)
|
||||
self.AuftragsdetailsTable.setHorizontalHeaderItem(3, item)
|
||||
item = QtWidgets.QTableWidgetItem()
|
||||
font = QtGui.QFont()
|
||||
font.setPointSize(8)
|
||||
item.setFont(font)
|
||||
self.AuftragsdetailsTable.setHorizontalHeaderItem(4, item)
|
||||
item = QtWidgets.QTableWidgetItem()
|
||||
self.AuftragsdetailsTable.setItem(0, 0, item)
|
||||
self.label = QtWidgets.QLabel(self.centralwidget)
|
||||
self.label.setGeometry(QtCore.QRect(900, 20, 121, 17))
|
||||
self.label.setObjectName("label")
|
||||
self.textEdit = QtWidgets.QTextEdit(self.centralwidget)
|
||||
self.textEdit.setGeometry(QtCore.QRect(860, 40, 221, 31))
|
||||
self.textEdit.setObjectName("textEdit")
|
||||
self.bauteilTypBtn = QtWidgets.QPushButton(self.centralwidget)
|
||||
self.bauteilTypBtn.setGeometry(QtCore.QRect(60, 340, 161, 25))
|
||||
self.bauteilTypBtn.setObjectName("bauteilTypBtn")
|
||||
self.bauteiltypTextbox = QtWidgets.QTextEdit(self.centralwidget)
|
||||
self.bauteiltypTextbox.setGeometry(QtCore.QRect(230, 340, 221, 31))
|
||||
self.bauteiltypTextbox.setObjectName("bauteiltypTextbox")
|
||||
self.label_3 = QtWidgets.QLabel(self.centralwidget)
|
||||
self.label_3.setGeometry(QtCore.QRect(250, 320, 181, 20))
|
||||
self.label_3.setObjectName("label_3")
|
||||
self.label_4 = QtWidgets.QLabel(self.centralwidget)
|
||||
self.label_4.setGeometry(QtCore.QRect(520, 320, 67, 17))
|
||||
self.label_4.setObjectName("label_4")
|
||||
self.textEdit_3 = QtWidgets.QTextEdit(self.centralwidget)
|
||||
self.textEdit_3.setGeometry(QtCore.QRect(460, 340, 191, 31))
|
||||
self.textEdit_3.setObjectName("textEdit_3")
|
||||
self.checkBox = QtWidgets.QCheckBox(self.centralwidget)
|
||||
self.checkBox.setGeometry(QtCore.QRect(70, 410, 151, 23))
|
||||
self.checkBox.setChecked(False)
|
||||
self.checkBox.setObjectName("checkBox")
|
||||
self.graphicsView = QtWidgets.QGraphicsView(self.centralwidget)
|
||||
self.graphicsView.setGeometry(QtCore.QRect(800, 280, 256, 192))
|
||||
self.graphicsView.setObjectName("graphicsView")
|
||||
MainWindow.setCentralWidget(self.centralwidget)
|
||||
self.menubar = QtWidgets.QMenuBar(MainWindow)
|
||||
self.menubar.setGeometry(QtCore.QRect(0, 0, 1090, 22))
|
||||
self.menubar.setObjectName("menubar")
|
||||
MainWindow.setMenuBar(self.menubar)
|
||||
self.statusbar = QtWidgets.QStatusBar(MainWindow)
|
||||
self.statusbar.setObjectName("statusbar")
|
||||
MainWindow.setStatusBar(self.statusbar)
|
||||
|
||||
self.retranslateUi(MainWindow)
|
||||
QtCore.QMetaObject.connectSlotsByName(MainWindow)
|
||||
|
||||
def retranslateUi(self, MainWindow):
|
||||
_translate = QtCore.QCoreApplication.translate
|
||||
MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow"))
|
||||
self.btn1.setText(_translate("MainWindow", "load Auftrag"))
|
||||
item = self.AuftragsdetailsTable.verticalHeaderItem(0)
|
||||
item.setText(_translate("MainWindow", "T1"))
|
||||
item = self.AuftragsdetailsTable.horizontalHeaderItem(0)
|
||||
item.setText(_translate("MainWindow", "Pos.-Nr"))
|
||||
item = self.AuftragsdetailsTable.horizontalHeaderItem(1)
|
||||
item.setText(_translate("MainWindow", "Matnr mit hoechster Version"))
|
||||
item = self.AuftragsdetailsTable.horizontalHeaderItem(2)
|
||||
item.setText(_translate("MainWindow", "Bezeichnung + Werkstoff"))
|
||||
item = self.AuftragsdetailsTable.horizontalHeaderItem(3)
|
||||
item.setText(_translate("MainWindow", "Menge"))
|
||||
item = self.AuftragsdetailsTable.horizontalHeaderItem(4)
|
||||
item.setText(_translate("MainWindow", "Lgort"))
|
||||
__sortingEnabled = self.AuftragsdetailsTable.isSortingEnabled()
|
||||
self.AuftragsdetailsTable.setSortingEnabled(False)
|
||||
item = self.AuftragsdetailsTable.item(0, 0)
|
||||
item.setText(_translate("MainWindow", "I1"))
|
||||
self.AuftragsdetailsTable.setSortingEnabled(__sortingEnabled)
|
||||
self.label.setText(_translate("MainWindow", "Auftragsnummer:"))
|
||||
self.textEdit.setHtml(_translate("MainWindow", "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
|
||||
"<html><head><meta name=\"qrichtext\" content=\"1\" /><meta charset=\"utf-8\" /><style type=\"text/css\">\n"
|
||||
"p, li { white-space: pre-wrap; }\n"
|
||||
"hr { height: 1px; border-width: 0; }\n"
|
||||
"li.unchecked::marker { content: \"\\2610\"; }\n"
|
||||
"li.checked::marker { content: \"\\2612\"; }\n"
|
||||
"</style></head><body style=\" font-family:\'Sans Serif\'; font-size:9pt; font-weight:400; font-style:normal;\">\n"
|
||||
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:\'Ubuntu\'; font-size:11pt;\"><br /></p></body></html>"))
|
||||
self.bauteilTypBtn.setText(_translate("MainWindow", "Bauteiltype erkennen"))
|
||||
self.bauteiltypTextbox.setHtml(_translate("MainWindow", "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
|
||||
"<html><head><meta name=\"qrichtext\" content=\"1\" /><meta charset=\"utf-8\" /><style type=\"text/css\">\n"
|
||||
"p, li { white-space: pre-wrap; }\n"
|
||||
"hr { height: 1px; border-width: 0; }\n"
|
||||
"li.unchecked::marker { content: \"\\2610\"; }\n"
|
||||
"li.checked::marker { content: \"\\2612\"; }\n"
|
||||
"</style></head><body style=\" font-family:\'Sans Serif\'; font-size:9pt; font-weight:400; font-style:normal;\">\n"
|
||||
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:\'Ubuntu\'; font-size:11pt;\"><br /></p></body></html>"))
|
||||
self.label_3.setText(_translate("MainWindow", "Bezeichnung"))
|
||||
self.label_4.setText(_translate("MainWindow", "Pos.-Nr:"))
|
||||
self.checkBox.setText(_translate("MainWindow", "Bauteiltype locked"))
|
74
untitled/.gitignore
vendored
Normal file
@ -0,0 +1,74 @@
|
||||
# This file is used to ignore files which are generated
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
*~
|
||||
*.autosave
|
||||
*.a
|
||||
*.core
|
||||
*.moc
|
||||
*.o
|
||||
*.obj
|
||||
*.orig
|
||||
*.rej
|
||||
*.so
|
||||
*.so.*
|
||||
*_pch.h.cpp
|
||||
*_resource.rc
|
||||
*.qm
|
||||
.#*
|
||||
*.*#
|
||||
core
|
||||
!core/
|
||||
tags
|
||||
.DS_Store
|
||||
.directory
|
||||
*.debug
|
||||
Makefile*
|
||||
*.prl
|
||||
*.app
|
||||
moc_*.cpp
|
||||
ui_*.h
|
||||
qrc_*.cpp
|
||||
Thumbs.db
|
||||
*.res
|
||||
*.rc
|
||||
/.qmake.cache
|
||||
/.qmake.stash
|
||||
|
||||
# qtcreator generated files
|
||||
*.pro.user*
|
||||
CMakeLists.txt.user*
|
||||
|
||||
# xemacs temporary files
|
||||
*.flc
|
||||
|
||||
# Vim temporary files
|
||||
.*.swp
|
||||
|
||||
# Visual Studio generated files
|
||||
*.ib_pdb_index
|
||||
*.idb
|
||||
*.ilk
|
||||
*.pdb
|
||||
*.sln
|
||||
*.suo
|
||||
*.vcproj
|
||||
*vcproj.*.*.user
|
||||
*.ncb
|
||||
*.sdf
|
||||
*.opensdf
|
||||
*.vcxproj
|
||||
*vcxproj.*
|
||||
|
||||
# MinGW generated files
|
||||
*.Debug
|
||||
*.Release
|
||||
|
||||
# Python byte code
|
||||
*.pyc
|
||||
|
||||
# Binaries
|
||||
# --------
|
||||
*.dll
|
||||
*.exe
|
||||
|
23
untitled/build/Desktop-Debug/.qmake.stash
Normal file
@ -0,0 +1,23 @@
|
||||
QMAKE_CXX.QT_COMPILER_STDCXX = 201703L
|
||||
QMAKE_CXX.QMAKE_GCC_MAJOR_VERSION = 13
|
||||
QMAKE_CXX.QMAKE_GCC_MINOR_VERSION = 2
|
||||
QMAKE_CXX.QMAKE_GCC_PATCH_VERSION = 0
|
||||
QMAKE_CXX.COMPILER_MACROS = \
|
||||
QT_COMPILER_STDCXX \
|
||||
QMAKE_GCC_MAJOR_VERSION \
|
||||
QMAKE_GCC_MINOR_VERSION \
|
||||
QMAKE_GCC_PATCH_VERSION
|
||||
QMAKE_CXX.INCDIRS = \
|
||||
/usr/include/c++/13 \
|
||||
/usr/include/x86_64-linux-gnu/c++/13 \
|
||||
/usr/include/c++/13/backward \
|
||||
/usr/lib/gcc/x86_64-linux-gnu/13/include \
|
||||
/usr/local/include \
|
||||
/usr/include/x86_64-linux-gnu \
|
||||
/usr/include
|
||||
QMAKE_CXX.LIBDIRS = \
|
||||
/usr/lib/gcc/x86_64-linux-gnu/13 \
|
||||
/usr/lib/x86_64-linux-gnu \
|
||||
/usr/lib \
|
||||
/lib/x86_64-linux-gnu \
|
||||
/lib
|