整理以前練習的產物

This commit is contained in:
Lin Weiting 2024-06-25 22:02:02 +08:00
parent ff7c017f07
commit 4b961a568c
62 changed files with 2830 additions and 0 deletions

View File

@ -0,0 +1,3 @@
# Default ignored files
/shelf/
/workspace.xml

View File

@ -0,0 +1 @@
main.py

View File

@ -0,0 +1,6 @@
<component name="InspectionProjectProfileManager">
<settings>
<option name="USE_PROJECT_PROFILE" value="false" />
<version value="1.0" />
</settings>
</component>

View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" project-jdk-name="yolov5" project-jdk-type="Python SDK" />
</project>

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/pythonProject.iml" filepath="$PROJECT_DIR$/.idea/pythonProject.iml" />
</modules>
</component>
</project>

View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="PYTHON_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$/../Test_0701" />
<content url="file://$MODULE_DIR$/../WPy64-31050" />
<content url="file://$MODULE_DIR$" />
<content url="file://$MODULE_DIR$/../testui_0826" />
<orderEntry type="jdk" jdkName="yolov5" jdkType="Python SDK" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

Binary file not shown.

After

Width:  |  Height:  |  Size: 57 MiB

View File

@ -0,0 +1,145 @@
import cv2
import sys, time, os
import numpy as np
from PyQt5 import QtCore, QtGui, QtWidgets
from PyQt5.QtGui import QColor,QPen,QPainter,QPixmap,QImage,QPainterPath,QPolygonF
from test1 import Ui_MainWindow
from PyQt5.QtCore import QDate,QTime,Qt, QRect, QPoint, pyqtSignal
from PyQt5.QtWidgets import QApplication, QFileDialog, QLabel,QMainWindow, QWidget, QPushButton
def original(img): # 原圖
img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB) # QT顏色顯示轉換
Ny , Nx , _ =img.shape
img = QtGui.QImage(img.data, Nx, Ny, Nx*3 , QtGui.QImage.Format_RGB888) # 須改格式
return img
class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow):
def __init__(self, parent=None): #按鍵設定
super(MainWindow, self).__init__(parent)
self.setupUi(self)
self.PhotoOpen_Btn_1.clicked.connect(self.openfile1) # 按鍵open1
self.ROI_Btn.clicked.connect(self.showNewWindow) # 按鍵open1
self.roi_rect = QRect(100, 100, 50, 50) # ROI 的固定座標與大小 (x,y,Rx,Ry) xy為原始圖片的座標位置RxRy為以座標位置延伸的長寬
# 開啟資料夾 並選擇圖片
def openfile1(self):
filename, _ = QFileDialog.getOpenFileName(self, 'Open Image')
self.img = cv2.imread(str(filename),cv2.IMREAD_GRAYSCALE)
self.img_original = original(self.img) #original 為轉UI顯示格式
self.img_view1=self.img_original
self.photoshow1.setPixmap(QtGui.QPixmap.fromImage(self.img_view1))
#選取ROI 開啟新視窗
def showNewWindow(self):
self.nw = newWindow(self.img_view1) # 連接新視窗
self.nw.positionsChanged.connect(self.handlePositionsChanged) # 連接信號
self.nw.imageSaved.connect(self.receiveImage)# 連接信號
self.nw.show() # 顯示新視窗
x = self.nw.pos().x() # 取得新視窗目前 x 座標
y = self.nw.pos().y() # 取得新視窗目前 y 座標
self.nw.move(x+20, y) # 移動新視窗位置
def handlePositionsChanged(self, positions):
# 這個方法會在 newWindow 實例發出 positionsChanged 信號時被調用
# positions 參數包含了 newWindow 實例發出信號時傳遞的數據
self.clicked_positions = positions
print(self.clicked_positions)
def receiveImage(self, image):
self.photoshow2.setPixmap(QtGui.QPixmap.fromImage(image))
print(image)
pass
class newWindow(QtWidgets.QMainWindow):
positionsChanged = pyqtSignal(list)
imageSaved = QtCore.pyqtSignal(QtGui.QImage)
def __init__(self,img_view1):
super(newWindow, self).__init__()
self.img_view1 = img_view1 #將主畫面讀到的圖檔拉來子畫面
self.ui() #子畫面初始化元件
self.newWindowsize_x =self.img_view1.width()
self.newWindowsize_y =self.img_view1.height()
self.setWindowTitle('newWindow')
self.setFixedSize(800, 800)
self.setMouseTracking(True)
self.shownewWindowlabel1()
self.clicked_positions = []
def ui(self):
self.newWindowlabel1 = QtWidgets.QLabel(self)
self.newWindowlabel1.setText('newWindowlabel1')
self.newWindowlabel1.setGeometry(0, 0, 800, 800)
self.newWindowlabel1.setAlignment(QtCore.Qt.AlignTop | QtCore.Qt.AlignLeft) # 設置文本對齊在左上角
# self.newWindowlabel1.setScaledContents(True)
self.newWindowlabel2 = QtWidgets.QLabel(self)
self.newWindowlabel2.setText('newWindowlabel2')
self.newWindowlabel2.setGeometry(0, 0, 200, 100)
self.newWindowlabel2.setAlignment(QtCore.Qt.AlignTop | QtCore.Qt.AlignLeft) # 設置文本對齊在左上角
def shownewWindowlabel1(self):
self.img_pixmap = QtGui.QPixmap.fromImage(self.img_view1)
def paintEvent(self,event):
super().paintEvent(event)
qpainter = QPainter(self)
qpainter.drawPixmap(self.rect(), self.img_pixmap) # 在窗口上繪製圖片,保持原始尺寸
qpainter.setPen(QPen(QColor('#ff0000'), 5))
for pos in self.clicked_positions:
x, y = pos
qpainter.drawPoint(x, y)
if len(self.clicked_positions) == 4:
# 將最後一個點和第一個點連線
for i in range(len(self.clicked_positions)):
x1, y1 = self.clicked_positions[i]
x2, y2 = self.clicked_positions[(i + 1) % len(self.clicked_positions)]
qpainter.drawLine(x1, y1, x2, y2)
qpainter.end()
self.cropImage()
self.close()
def cropImage(self):
per_x = self.img_pixmap.size().width() / self.width()
per_y = self.img_pixmap.size().height() / self.height()
x_values = [pos[0] for pos in self.clicked_positions]
y_values = [pos[1] for pos in self.clicked_positions]
self.min_x = int(min(x_values)*per_x)
self.max_x = int(max(x_values)*per_x)
self.min_y = int(min(y_values)*per_y)
self.max_y = int(max(y_values)*per_y)
qimage = self.img_pixmap.toImage()
cropped_qimage = qimage.copy(self.min_x, self.min_y, self.max_x - self.min_x, self.max_y - self.min_y)
self.cropped_pixmap = QPixmap.fromImage(cropped_qimage)
self.cropped_pixmap.save(r"D:\python_code\photo\cropped_image.jpg") # 儲存裁剪後的圖像
def mousePressEvent(self, event):
if event.button() == 1:
x = event.x()
y = event.y()
self.clicked_positions.append((x, y))
print(self.clicked_positions)
self.newWindowlabel2.setText(f'{x}, {y}') # 透過 QLabel 顯示滑鼠座標
self.update()
def savePaintedPixmap(self):
# 创建新的 QPixmap 对象,并在其上绘制原始图片和红点
center_x = self.img_pixmap.width() // 2
center_y = self.img_pixmap.height()// 2
painted_pixmap = QtGui.QPixmap(self.img_pixmap.size())
painter = QtGui.QPainter(painted_pixmap)
painted_pixmap.fill(QtCore.Qt.black)
# painter.drawPixmap(self.cropped_pixmap.width(),self.cropped_pixmap.height(), self.cropped_pixmap)
painter.drawPixmap(center_x,center_y, self.cropped_pixmap)
painter.end()
# 将 QPixmap 转换为 QImage 并发送
painted_image = painted_pixmap.toImage()
self.imageSaved.emit(painted_image)
def closeEvent(self, event):
self.savePaintedPixmap()
self.positionsChanged.emit(self.clicked_positions)
if __name__=='__main__':
app = QtWidgets.QApplication(sys.argv)
win = MainWindow()
win.show()
sys.exit(app.exec_())

View File

@ -0,0 +1,84 @@
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'test1.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.
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_MainWindow(object):
def setupUi(self, MainWindow):
MainWindow.setObjectName("MainWindow")
MainWindow.resize(1065, 798)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(MainWindow.sizePolicy().hasHeightForWidth())
MainWindow.setSizePolicy(sizePolicy)
self.centralwidget = QtWidgets.QWidget(MainWindow)
self.centralwidget.setObjectName("centralwidget")
self.PhotoOpen_Btn_1 = QtWidgets.QPushButton(self.centralwidget)
self.PhotoOpen_Btn_1.setGeometry(QtCore.QRect(10, 10, 75, 23))
self.PhotoOpen_Btn_1.setObjectName("PhotoOpen_Btn_1")
self.photoshow1 = QtWidgets.QLabel(self.centralwidget)
self.photoshow1.setGeometry(QtCore.QRect(60, 130, 431, 571))
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.photoshow1.sizePolicy().hasHeightForWidth())
self.photoshow1.setSizePolicy(sizePolicy)
self.photoshow1.setScaledContents(True)
self.photoshow1.setObjectName("photoshow1")
self.ROI_Btn = QtWidgets.QPushButton(self.centralwidget)
self.ROI_Btn.setGeometry(QtCore.QRect(10, 60, 75, 23))
self.ROI_Btn.setObjectName("ROI_Btn")
self.photoshow2 = QtWidgets.QLabel(self.centralwidget)
self.photoshow2.setGeometry(QtCore.QRect(550, 130, 431, 571))
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Preferred, QtWidgets.QSizePolicy.Preferred)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.photoshow2.sizePolicy().hasHeightForWidth())
self.photoshow2.setSizePolicy(sizePolicy)
self.photoshow2.setScaledContents(True)
self.photoshow2.setObjectName("photoshow2")
self.MouseEvent = QtWidgets.QLabel(self.centralwidget)
self.MouseEvent.setGeometry(QtCore.QRect(140, 30, 121, 31))
font = QtGui.QFont()
font.setBold(False)
font.setItalic(False)
font.setUnderline(False)
font.setWeight(50)
self.MouseEvent.setFont(font)
self.MouseEvent.setMouseTracking(True)
self.MouseEvent.setTabletTracking(True)
self.MouseEvent.setScaledContents(True)
self.MouseEvent.setObjectName("MouseEvent")
MainWindow.setCentralWidget(self.centralwidget)
self.menubar = QtWidgets.QMenuBar(MainWindow)
self.menubar.setGeometry(QtCore.QRect(0, 0, 1065, 21))
self.menubar.setObjectName("menubar")
MainWindow.setMenuBar(self.menubar)
self.statusbar = QtWidgets.QStatusBar(MainWindow)
self.statusbar.setObjectName("statusbar")
MainWindow.setStatusBar(self.statusbar)
self.toolBar = QtWidgets.QToolBar(MainWindow)
self.toolBar.setObjectName("toolBar")
MainWindow.addToolBar(QtCore.Qt.TopToolBarArea, self.toolBar)
self.retranslateUi(MainWindow)
QtCore.QMetaObject.connectSlotsByName(MainWindow)
def retranslateUi(self, MainWindow):
_translate = QtCore.QCoreApplication.translate
MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow"))
self.PhotoOpen_Btn_1.setText(_translate("MainWindow", "開啟圖片1"))
self.photoshow1.setText(_translate("MainWindow", "TextLabel"))
self.ROI_Btn.setText(_translate("MainWindow", "ROI擷取"))
self.photoshow2.setText(_translate("MainWindow", "TextLabel"))
self.MouseEvent.setText(_translate("MainWindow", "MouseEvent"))
self.toolBar.setWindowTitle(_translate("MainWindow", "toolBar"))

View File

@ -0,0 +1,149 @@
<?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>1065</width>
<height>798</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="windowTitle">
<string>MainWindow</string>
</property>
<widget class="QWidget" name="centralwidget">
<widget class="QPushButton" name="PhotoOpen_Btn_1">
<property name="geometry">
<rect>
<x>10</x>
<y>10</y>
<width>75</width>
<height>23</height>
</rect>
</property>
<property name="text">
<string>開啟圖片1</string>
</property>
</widget>
<widget class="QLabel" name="photoshow1">
<property name="geometry">
<rect>
<x>60</x>
<y>130</y>
<width>431</width>
<height>571</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>TextLabel</string>
</property>
<property name="scaledContents">
<bool>true</bool>
</property>
</widget>
<widget class="QPushButton" name="ROI_Btn">
<property name="geometry">
<rect>
<x>10</x>
<y>60</y>
<width>75</width>
<height>23</height>
</rect>
</property>
<property name="text">
<string>ROI擷取</string>
</property>
</widget>
<widget class="QLabel" name="photoshow2">
<property name="geometry">
<rect>
<x>550</x>
<y>130</y>
<width>431</width>
<height>571</height>
</rect>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>TextLabel</string>
</property>
<property name="scaledContents">
<bool>true</bool>
</property>
</widget>
<widget class="QLabel" name="MouseEvent">
<property name="geometry">
<rect>
<x>140</x>
<y>30</y>
<width>121</width>
<height>31</height>
</rect>
</property>
<property name="font">
<font>
<weight>50</weight>
<italic>false</italic>
<bold>false</bold>
<underline>false</underline>
</font>
</property>
<property name="mouseTracking">
<bool>true</bool>
</property>
<property name="tabletTracking">
<bool>true</bool>
</property>
<property name="text">
<string>MouseEvent</string>
</property>
<property name="scaledContents">
<bool>true</bool>
</property>
</widget>
</widget>
<widget class="QMenuBar" name="menubar">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>1065</width>
<height>21</height>
</rect>
</property>
</widget>
<widget class="QStatusBar" name="statusbar"/>
<widget class="QToolBar" name="toolBar">
<property name="windowTitle">
<string>toolBar</string>
</property>
<attribute name="toolBarArea">
<enum>TopToolBarArea</enum>
</attribute>
<attribute name="toolBarBreak">
<bool>false</bool>
</attribute>
</widget>
</widget>
<resources/>
<connections/>
</ui>

View File

@ -0,0 +1,8 @@
# Default ignored files
/shelf/
/workspace.xml
# Editor-based HTTP Client requests
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml

View File

@ -0,0 +1 @@
main.py

View File

@ -0,0 +1,6 @@
<component name="InspectionProjectProfileManager">
<settings>
<option name="USE_PROJECT_PROFILE" value="false" />
<version value="1.0" />
</settings>
</component>

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Black">
<option name="sdkName" value="pyqt5" />
</component>
<component name="ProjectRootManager" version="2" project-jdk-name="webapi" project-jdk-type="Python SDK" />
</project>

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/w4.iml" filepath="$PROJECT_DIR$/.idea/w4.iml" />
</modules>
</component>
</project>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$/.." vcs="Git" />
</component>
</project>

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="PYTHON_MODULE" version="4">
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
<orderEntry type="jdk" jdkName="webapi" jdkType="Python SDK" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

View File

@ -0,0 +1,94 @@
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'borrowui.ui'
#
# Created by: PyQt5 UI code generator 5.15.7
#
# 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_Dialog(object):
def setupUi(self, Dialog):
Dialog.setObjectName("Dialog")
Dialog.resize(276, 214)
self.gridLayout = QtWidgets.QGridLayout(Dialog)
self.gridLayout.setObjectName("gridLayout")
self.verticalLayout = QtWidgets.QVBoxLayout()
self.verticalLayout.setObjectName("verticalLayout")
self.horizontalLayout = QtWidgets.QHBoxLayout()
self.horizontalLayout.setObjectName("horizontalLayout")
self.label = QtWidgets.QLabel(Dialog)
self.label.setObjectName("label")
self.horizontalLayout.addWidget(self.label)
self.comboBox_category = QtWidgets.QComboBox(Dialog)
self.comboBox_category.setMinimumSize(QtCore.QSize(141, 31))
self.comboBox_category.setMaximumSize(QtCore.QSize(141, 31))
self.comboBox_category.setObjectName("comboBox_category")
self.comboBox_category.addItem("")
self.comboBox_category.addItem("")
self.comboBox_category.addItem("")
self.comboBox_category.addItem("")
self.horizontalLayout.addWidget(self.comboBox_category)
self.verticalLayout.addLayout(self.horizontalLayout)
self.horizontalLayout_2 = QtWidgets.QHBoxLayout()
self.horizontalLayout_2.setObjectName("horizontalLayout_2")
self.label_2 = QtWidgets.QLabel(Dialog)
self.label_2.setObjectName("label_2")
self.horizontalLayout_2.addWidget(self.label_2)
self.comboBox_2 = QtWidgets.QComboBox(Dialog)
self.comboBox_2.setMinimumSize(QtCore.QSize(141, 31))
self.comboBox_2.setObjectName("comboBox_2")
self.horizontalLayout_2.addWidget(self.comboBox_2)
self.verticalLayout.addLayout(self.horizontalLayout_2)
self.horizontalLayout_3 = QtWidgets.QHBoxLayout()
self.horizontalLayout_3.setObjectName("horizontalLayout_3")
self.label_4 = QtWidgets.QLabel(Dialog)
self.label_4.setObjectName("label_4")
self.horizontalLayout_3.addWidget(self.label_4)
self.comboBox_3 = QtWidgets.QComboBox(Dialog)
self.comboBox_3.setMinimumSize(QtCore.QSize(141, 31))
self.comboBox_3.setObjectName("comboBox_3")
self.horizontalLayout_3.addWidget(self.comboBox_3)
self.verticalLayout.addLayout(self.horizontalLayout_3)
self.horizontalLayout_5 = QtWidgets.QHBoxLayout()
self.horizontalLayout_5.setObjectName("horizontalLayout_5")
self.horizontalLayout_4 = QtWidgets.QHBoxLayout()
self.horizontalLayout_4.setObjectName("horizontalLayout_4")
self.label_3 = QtWidgets.QLabel(Dialog)
self.label_3.setObjectName("label_3")
self.horizontalLayout_4.addWidget(self.label_3)
self.spinBox = QtWidgets.QSpinBox(Dialog)
self.spinBox.setMinimumSize(QtCore.QSize(91, 31))
self.spinBox.setObjectName("spinBox")
self.horizontalLayout_4.addWidget(self.spinBox)
self.horizontalLayout_5.addLayout(self.horizontalLayout_4)
spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
self.horizontalLayout_5.addItem(spacerItem)
self.verticalLayout.addLayout(self.horizontalLayout_5)
self.buttonBox = QtWidgets.QDialogButtonBox(Dialog)
self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Ok)
self.buttonBox.setObjectName("buttonBox")
self.verticalLayout.addWidget(self.buttonBox)
self.gridLayout.addLayout(self.verticalLayout, 0, 0, 1, 1)
self.retranslateUi(Dialog)
self.buttonBox.accepted.connect(Dialog.accept) # type: ignore
self.buttonBox.rejected.connect(Dialog.reject) # type: ignore
QtCore.QMetaObject.connectSlotsByName(Dialog)
def retranslateUi(self, Dialog):
_translate = QtCore.QCoreApplication.translate
Dialog.setWindowTitle(_translate("Dialog", "Dialog"))
self.label.setText(_translate("Dialog", "類別:"))
self.comboBox_category.setItemText(0, _translate("Dialog", "電料類"))
self.comboBox_category.setItemText(1, _translate("Dialog", "線材類"))
self.comboBox_category.setItemText(2, _translate("Dialog", "螺絲類"))
self.comboBox_category.setItemText(3, _translate("Dialog", "相機類"))
self.label_2.setText(_translate("Dialog", "項目:"))
self.label_4.setText(_translate("Dialog", "借用人:"))
self.label_3.setText(_translate("Dialog", "數量:"))

View File

@ -0,0 +1,195 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Dialog</class>
<widget class="QDialog" name="Dialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>276</width>
<height>214</height>
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>類別:</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="comboBox_category">
<property name="minimumSize">
<size>
<width>141</width>
<height>31</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>141</width>
<height>31</height>
</size>
</property>
<item>
<property name="text">
<string>電料類</string>
</property>
</item>
<item>
<property name="text">
<string>線材類</string>
</property>
</item>
<item>
<property name="text">
<string>螺絲類</string>
</property>
</item>
<item>
<property name="text">
<string>相機類</string>
</property>
</item>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="label_2">
<property name="text">
<string>項目:</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="comboBox_2">
<property name="minimumSize">
<size>
<width>141</width>
<height>31</height>
</size>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QLabel" name="label_4">
<property name="text">
<string>借用人:</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="comboBox_3">
<property name="minimumSize">
<size>
<width>141</width>
<height>31</height>
</size>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_5">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="QLabel" name="label_3">
<property name="text">
<string>數量:</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="spinBox">
<property name="minimumSize">
<size>
<width>91</width>
<height>31</height>
</size>
</property>
</widget>
</item>
</layout>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>Dialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>Dialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View File

@ -0,0 +1,127 @@
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'createui.ui'
#
# Created by: PyQt5 UI code generator 5.15.7
#
# 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_Dialog(object):
def setupUi(self, Dialog):
Dialog.setObjectName("Dialog")
Dialog.resize(255, 286)
Dialog.setModal(True)
self.gridLayout = QtWidgets.QGridLayout(Dialog)
self.gridLayout.setObjectName("gridLayout")
self.verticalLayout_5 = QtWidgets.QVBoxLayout()
self.verticalLayout_5.setObjectName("verticalLayout_5")
spacerItem = QtWidgets.QSpacerItem(248, 17, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
self.verticalLayout_5.addItem(spacerItem)
self.horizontalLayout_6 = QtWidgets.QHBoxLayout()
self.horizontalLayout_6.setObjectName("horizontalLayout_6")
spacerItem1 = QtWidgets.QSpacerItem(20, 238, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
self.horizontalLayout_6.addItem(spacerItem1)
self.verticalLayout_4 = QtWidgets.QVBoxLayout()
self.verticalLayout_4.setObjectName("verticalLayout_4")
self.verticalLayout_3 = QtWidgets.QVBoxLayout()
self.verticalLayout_3.setObjectName("verticalLayout_3")
self.verticalLayout = QtWidgets.QVBoxLayout()
self.verticalLayout.setObjectName("verticalLayout")
self.horizontalLayout_5 = QtWidgets.QHBoxLayout()
self.horizontalLayout_5.setObjectName("horizontalLayout_5")
self.label_5 = QtWidgets.QLabel(Dialog)
self.label_5.setMaximumSize(QtCore.QSize(34, 16))
self.label_5.setObjectName("label_5")
self.horizontalLayout_5.addWidget(self.label_5)
self.comboBox_category = QtWidgets.QComboBox(Dialog)
self.comboBox_category.setMinimumSize(QtCore.QSize(141, 31))
self.comboBox_category.setMaximumSize(QtCore.QSize(141, 31))
self.comboBox_category.setObjectName("comboBox_category")
self.comboBox_category.addItem("")
self.comboBox_category.addItem("")
self.comboBox_category.addItem("")
self.comboBox_category.addItem("")
self.horizontalLayout_5.addWidget(self.comboBox_category)
self.verticalLayout.addLayout(self.horizontalLayout_5)
self.horizontalLayout = QtWidgets.QHBoxLayout()
self.horizontalLayout.setObjectName("horizontalLayout")
self.label = QtWidgets.QLabel(Dialog)
self.label.setObjectName("label")
self.horizontalLayout.addWidget(self.label)
self.textEdit_item = QtWidgets.QTextEdit(Dialog)
self.textEdit_item.setMinimumSize(QtCore.QSize(141, 31))
self.textEdit_item.setMaximumSize(QtCore.QSize(141, 31))
self.textEdit_item.setObjectName("textEdit_item")
self.horizontalLayout.addWidget(self.textEdit_item)
self.verticalLayout.addLayout(self.horizontalLayout)
self.verticalLayout_3.addLayout(self.verticalLayout)
self.verticalLayout_2 = QtWidgets.QVBoxLayout()
self.verticalLayout_2.setObjectName("verticalLayout_2")
self.horizontalLayout_2 = QtWidgets.QHBoxLayout()
self.horizontalLayout_2.setObjectName("horizontalLayout_2")
self.label_2 = QtWidgets.QLabel(Dialog)
self.label_2.setObjectName("label_2")
self.horizontalLayout_2.addWidget(self.label_2)
self.textEdit_account = QtWidgets.QTextEdit(Dialog)
self.textEdit_account.setMinimumSize(QtCore.QSize(141, 31))
self.textEdit_account.setMaximumSize(QtCore.QSize(141, 31))
self.textEdit_account.setObjectName("textEdit_account")
self.horizontalLayout_2.addWidget(self.textEdit_account)
self.verticalLayout_2.addLayout(self.horizontalLayout_2)
self.horizontalLayout_3 = QtWidgets.QHBoxLayout()
self.horizontalLayout_3.setObjectName("horizontalLayout_3")
self.label_3 = QtWidgets.QLabel(Dialog)
self.label_3.setObjectName("label_3")
self.horizontalLayout_3.addWidget(self.label_3)
self.textEdit_location = QtWidgets.QTextEdit(Dialog)
self.textEdit_location.setMinimumSize(QtCore.QSize(141, 31))
self.textEdit_location.setMaximumSize(QtCore.QSize(141, 31))
self.textEdit_location.setObjectName("textEdit_location")
self.horizontalLayout_3.addWidget(self.textEdit_location)
self.verticalLayout_2.addLayout(self.horizontalLayout_3)
self.horizontalLayout_4 = QtWidgets.QHBoxLayout()
self.horizontalLayout_4.setObjectName("horizontalLayout_4")
self.label_4 = QtWidgets.QLabel(Dialog)
self.label_4.setObjectName("label_4")
self.horizontalLayout_4.addWidget(self.label_4)
self.textEdit_image = QtWidgets.QTextEdit(Dialog)
self.textEdit_image.setMinimumSize(QtCore.QSize(141, 31))
self.textEdit_image.setMaximumSize(QtCore.QSize(141, 31))
self.textEdit_image.setObjectName("textEdit_image")
self.horizontalLayout_4.addWidget(self.textEdit_image)
self.verticalLayout_2.addLayout(self.horizontalLayout_4)
self.verticalLayout_3.addLayout(self.verticalLayout_2)
self.verticalLayout_4.addLayout(self.verticalLayout_3)
self.buttonBox = QtWidgets.QDialogButtonBox(Dialog)
self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Ok)
self.buttonBox.setObjectName("buttonBox")
self.verticalLayout_4.addWidget(self.buttonBox)
self.horizontalLayout_6.addLayout(self.verticalLayout_4)
spacerItem2 = QtWidgets.QSpacerItem(17, 17, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
self.horizontalLayout_6.addItem(spacerItem2)
self.verticalLayout_5.addLayout(self.horizontalLayout_6)
self.gridLayout.addLayout(self.verticalLayout_5, 0, 0, 1, 1)
self.retranslateUi(Dialog)
self.buttonBox.accepted.connect(Dialog.accept) # type: ignore
self.buttonBox.rejected.connect(Dialog.reject) # type: ignore
QtCore.QMetaObject.connectSlotsByName(Dialog)
def retranslateUi(self, Dialog):
_translate = QtCore.QCoreApplication.translate
Dialog.setWindowTitle(_translate("Dialog", "創建"))
self.label_5.setText(_translate("Dialog", "類別:"))
self.comboBox_category.setItemText(0, _translate("Dialog", "電料類"))
self.comboBox_category.setItemText(1, _translate("Dialog", "線材類"))
self.comboBox_category.setItemText(2, _translate("Dialog", "螺絲類"))
self.comboBox_category.setItemText(3, _translate("Dialog", "相機類"))
self.label.setText(_translate("Dialog", "項目:"))
self.label_2.setText(_translate("Dialog", "數量:"))
self.label_3.setText(_translate("Dialog", "位置:"))
self.label_4.setText(_translate("Dialog", "圖片:"))

View File

@ -0,0 +1,291 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Dialog</class>
<widget class="QDialog" name="Dialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>255</width>
<height>286</height>
</rect>
</property>
<property name="windowTitle">
<string>創建</string>
</property>
<property name="modal">
<bool>true</bool>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<layout class="QVBoxLayout" name="verticalLayout_5">
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>248</width>
<height>17</height>
</size>
</property>
</spacer>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_6">
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>238</height>
</size>
</property>
</spacer>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_4">
<item>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_5">
<item>
<widget class="QLabel" name="label_5">
<property name="maximumSize">
<size>
<width>34</width>
<height>16</height>
</size>
</property>
<property name="text">
<string>類別:</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="comboBox_category">
<property name="minimumSize">
<size>
<width>141</width>
<height>31</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>141</width>
<height>31</height>
</size>
</property>
<item>
<property name="text">
<string>電料類</string>
</property>
</item>
<item>
<property name="text">
<string>線材類</string>
</property>
</item>
<item>
<property name="text">
<string>螺絲類</string>
</property>
</item>
<item>
<property name="text">
<string>相機類</string>
</property>
</item>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>項目:</string>
</property>
</widget>
</item>
<item>
<widget class="QTextEdit" name="textEdit_item">
<property name="minimumSize">
<size>
<width>141</width>
<height>31</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>141</width>
<height>31</height>
</size>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="label_2">
<property name="text">
<string>數量:</string>
</property>
</widget>
</item>
<item>
<widget class="QTextEdit" name="textEdit_account">
<property name="minimumSize">
<size>
<width>141</width>
<height>31</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>141</width>
<height>31</height>
</size>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QLabel" name="label_3">
<property name="text">
<string>位置:</string>
</property>
</widget>
</item>
<item>
<widget class="QTextEdit" name="textEdit_location">
<property name="minimumSize">
<size>
<width>141</width>
<height>31</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>141</width>
<height>31</height>
</size>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<widget class="QLabel" name="label_4">
<property name="text">
<string>圖片:</string>
</property>
</widget>
</item>
<item>
<widget class="QTextEdit" name="textEdit_image">
<property name="minimumSize">
<size>
<width>141</width>
<height>31</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>141</width>
<height>31</height>
</size>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
</layout>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>17</width>
<height>17</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</item>
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>Dialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>Dialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View File

@ -0,0 +1,80 @@
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'deleteui.ui'
#
# Created by: PyQt5 UI code generator 5.15.7
#
# 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_Dialog(object):
def setupUi(self, Dialog):
Dialog.setObjectName("Dialog")
Dialog.resize(293, 145)
self.gridLayout_2 = QtWidgets.QGridLayout(Dialog)
self.gridLayout_2.setObjectName("gridLayout_2")
self.horizontalLayout_4 = QtWidgets.QHBoxLayout()
self.horizontalLayout_4.setObjectName("horizontalLayout_4")
spacerItem = QtWidgets.QSpacerItem(20, 198, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
self.horizontalLayout_4.addItem(spacerItem)
self.gridLayout = QtWidgets.QGridLayout()
self.gridLayout.setObjectName("gridLayout")
spacerItem1 = QtWidgets.QSpacerItem(378, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
self.gridLayout.addItem(spacerItem1, 0, 0, 1, 1)
self.verticalLayout_4 = QtWidgets.QVBoxLayout()
self.verticalLayout_4.setObjectName("verticalLayout_4")
self.horizontalLayout_3 = QtWidgets.QHBoxLayout()
self.horizontalLayout_3.setObjectName("horizontalLayout_3")
self.verticalLayout_2 = QtWidgets.QVBoxLayout()
self.verticalLayout_2.setObjectName("verticalLayout_2")
self.label_3 = QtWidgets.QLabel(Dialog)
self.label_3.setObjectName("label_3")
self.verticalLayout_2.addWidget(self.label_3)
self.label_4 = QtWidgets.QLabel(Dialog)
self.label_4.setObjectName("label_4")
self.verticalLayout_2.addWidget(self.label_4)
self.horizontalLayout_3.addLayout(self.verticalLayout_2)
self.verticalLayout_3 = QtWidgets.QVBoxLayout()
self.verticalLayout_3.setObjectName("verticalLayout_3")
self.comboBox_category = QtWidgets.QComboBox(Dialog)
self.comboBox_category.setMinimumSize(QtCore.QSize(131, 22))
self.comboBox_category.setMaximumSize(QtCore.QSize(131, 22))
self.comboBox_category.setObjectName("comboBox_category")
self.comboBox_category.addItem("")
self.comboBox_category.addItem("")
self.comboBox_category.addItem("")
self.comboBox_category.addItem("")
self.verticalLayout_3.addWidget(self.comboBox_category)
self.comboBox_item = QtWidgets.QComboBox(Dialog)
self.comboBox_item.setMinimumSize(QtCore.QSize(191, 22))
self.comboBox_item.setObjectName("comboBox_item")
self.verticalLayout_3.addWidget(self.comboBox_item)
self.horizontalLayout_3.addLayout(self.verticalLayout_3)
self.verticalLayout_4.addLayout(self.horizontalLayout_3)
self.buttonBox = QtWidgets.QDialogButtonBox(Dialog)
self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Ok)
self.buttonBox.setObjectName("buttonBox")
self.verticalLayout_4.addWidget(self.buttonBox)
self.gridLayout.addLayout(self.verticalLayout_4, 1, 0, 1, 1)
self.horizontalLayout_4.addLayout(self.gridLayout)
self.gridLayout_2.addLayout(self.horizontalLayout_4, 0, 0, 1, 1)
self.retranslateUi(Dialog)
self.buttonBox.accepted.connect(Dialog.accept) # type: ignore
self.buttonBox.rejected.connect(Dialog.reject) # type: ignore
QtCore.QMetaObject.connectSlotsByName(Dialog)
def retranslateUi(self, Dialog):
_translate = QtCore.QCoreApplication.translate
Dialog.setWindowTitle(_translate("Dialog", "刪除"))
self.label_3.setText(_translate("Dialog", "類別:"))
self.label_4.setText(_translate("Dialog", "項目:"))
self.comboBox_category.setItemText(0, _translate("Dialog", "電料類"))
self.comboBox_category.setItemText(1, _translate("Dialog", "線材類"))
self.comboBox_category.setItemText(2, _translate("Dialog", "螺絲類"))
self.comboBox_category.setItemText(3, _translate("Dialog", "相機類"))

View File

@ -0,0 +1,174 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Dialog</class>
<widget class="QDialog" name="Dialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>293</width>
<height>145</height>
</rect>
</property>
<property name="windowTitle">
<string>刪除</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_4">
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>198</height>
</size>
</property>
</spacer>
</item>
<item>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>378</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="0">
<layout class="QVBoxLayout" name="verticalLayout_4">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QLabel" name="label_3">
<property name="text">
<string>類別:</string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_4">
<property name="text">
<string>項目:</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QComboBox" name="comboBox_category">
<property name="minimumSize">
<size>
<width>131</width>
<height>22</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>131</width>
<height>22</height>
</size>
</property>
<item>
<property name="text">
<string>電料類</string>
</property>
</item>
<item>
<property name="text">
<string>線材類</string>
</property>
</item>
<item>
<property name="text">
<string>螺絲類</string>
</property>
</item>
<item>
<property name="text">
<string>相機類</string>
</property>
</item>
</widget>
</item>
<item>
<widget class="QComboBox" name="comboBox_item">
<property name="minimumSize">
<size>
<width>191</width>
<height>22</height>
</size>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
</layout>
</item>
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>Dialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>Dialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View File

@ -0,0 +1,56 @@
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'historyui.ui'
#
# Created by: PyQt5 UI code generator 5.15.7
#
# 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_Form(object):
def setupUi(self, Form):
Form.setObjectName("Form")
Form.resize(783, 423)
self.gridLayout = QtWidgets.QGridLayout(Form)
self.gridLayout.setObjectName("gridLayout")
self.tableWidget = QtWidgets.QTableWidget(Form)
self.tableWidget.setMinimumSize(QtCore.QSize(761, 401))
self.tableWidget.setObjectName("tableWidget")
self.tableWidget.setColumnCount(6)
self.tableWidget.setRowCount(0)
item = QtWidgets.QTableWidgetItem()
self.tableWidget.setHorizontalHeaderItem(0, item)
item = QtWidgets.QTableWidgetItem()
self.tableWidget.setHorizontalHeaderItem(1, item)
item = QtWidgets.QTableWidgetItem()
self.tableWidget.setHorizontalHeaderItem(2, item)
item = QtWidgets.QTableWidgetItem()
self.tableWidget.setHorizontalHeaderItem(3, item)
item = QtWidgets.QTableWidgetItem()
self.tableWidget.setHorizontalHeaderItem(4, item)
item = QtWidgets.QTableWidgetItem()
self.tableWidget.setHorizontalHeaderItem(5, item)
self.gridLayout.addWidget(self.tableWidget, 0, 0, 1, 1)
self.retranslateUi(Form)
QtCore.QMetaObject.connectSlotsByName(Form)
def retranslateUi(self, Form):
_translate = QtCore.QCoreApplication.translate
Form.setWindowTitle(_translate("Form", "Form"))
item = self.tableWidget.horizontalHeaderItem(0)
item.setText(_translate("Form", "租借日期"))
item = self.tableWidget.horizontalHeaderItem(1)
item.setText(_translate("Form", "歸還日期"))
item = self.tableWidget.horizontalHeaderItem(2)
item.setText(_translate("Form", "租借人"))
item = self.tableWidget.horizontalHeaderItem(3)
item.setText(_translate("Form", "租借類別"))
item = self.tableWidget.horizontalHeaderItem(4)
item.setText(_translate("Form", "租借項目"))
item = self.tableWidget.horizontalHeaderItem(5)
item.setText(_translate("Form", "租借數量"))

View File

@ -0,0 +1,61 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Form</class>
<widget class="QWidget" name="Form">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>783</width>
<height>423</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QTableWidget" name="tableWidget">
<property name="minimumSize">
<size>
<width>761</width>
<height>401</height>
</size>
</property>
<column>
<property name="text">
<string>租借日期</string>
</property>
</column>
<column>
<property name="text">
<string>歸還日期</string>
</property>
</column>
<column>
<property name="text">
<string>租借人</string>
</property>
</column>
<column>
<property name="text">
<string>租借類別</string>
</property>
</column>
<column>
<property name="text">
<string>租借項目</string>
</property>
</column>
<column>
<property name="text">
<string>租借數量</string>
</property>
</column>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

View File

@ -0,0 +1,91 @@
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'itemsui.ui'
#
# Created by: PyQt5 UI code generator 5.15.7
#
# 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_Form(object):
def setupUi(self, Form):
Form.setObjectName("Form")
Form.resize(875, 577)
self.gridLayout = QtWidgets.QGridLayout(Form)
self.gridLayout.setObjectName("gridLayout")
self.horizontalLayout = QtWidgets.QHBoxLayout()
self.horizontalLayout.setObjectName("horizontalLayout")
self.horizontalLayout_3 = QtWidgets.QHBoxLayout()
self.horizontalLayout_3.setObjectName("horizontalLayout_3")
self.comboBox = QtWidgets.QComboBox(Form)
self.comboBox.setMinimumSize(QtCore.QSize(121, 31))
self.comboBox.setMaximumSize(QtCore.QSize(121, 31))
self.comboBox.setObjectName("comboBox")
self.comboBox.addItem("")
self.comboBox.addItem("")
self.comboBox.addItem("")
self.comboBox.addItem("")
self.horizontalLayout_3.addWidget(self.comboBox)
self.horizontalLayout.addLayout(self.horizontalLayout_3)
spacerItem = QtWidgets.QSpacerItem(728, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
self.horizontalLayout.addItem(spacerItem)
self.gridLayout.addLayout(self.horizontalLayout, 0, 0, 1, 1)
self.horizontalLayout_2 = QtWidgets.QHBoxLayout()
self.horizontalLayout_2.setObjectName("horizontalLayout_2")
self.tableWidget = QtWidgets.QTableWidget(Form)
self.tableWidget.setMinimumSize(QtCore.QSize(631, 511))
self.tableWidget.setLineWidth(1)
self.tableWidget.setColumnCount(4)
self.tableWidget.setObjectName("tableWidget")
self.tableWidget.setRowCount(0)
item = QtWidgets.QTableWidgetItem()
item.setTextAlignment(QtCore.Qt.AlignCenter)
self.tableWidget.setHorizontalHeaderItem(0, item)
item = QtWidgets.QTableWidgetItem()
item.setTextAlignment(QtCore.Qt.AlignCenter)
self.tableWidget.setHorizontalHeaderItem(1, item)
item = QtWidgets.QTableWidgetItem()
item.setTextAlignment(QtCore.Qt.AlignCenter)
self.tableWidget.setHorizontalHeaderItem(2, item)
item = QtWidgets.QTableWidgetItem()
item.setTextAlignment(QtCore.Qt.AlignCenter)
self.tableWidget.setHorizontalHeaderItem(3, item)
self.horizontalLayout_2.addWidget(self.tableWidget)
self.verticalLayout = QtWidgets.QVBoxLayout()
self.verticalLayout.setObjectName("verticalLayout")
spacerItem1 = QtWidgets.QSpacerItem(20, 108, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
self.verticalLayout.addItem(spacerItem1)
self.label = QtWidgets.QLabel(Form)
self.label.setMinimumSize(QtCore.QSize(211, 231))
self.label.setMaximumSize(QtCore.QSize(211, 231))
self.label.setScaledContents(True)
self.label.setObjectName("label")
self.verticalLayout.addWidget(self.label)
spacerItem2 = QtWidgets.QSpacerItem(20, 108, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
self.verticalLayout.addItem(spacerItem2)
self.horizontalLayout_2.addLayout(self.verticalLayout)
self.gridLayout.addLayout(self.horizontalLayout_2, 1, 0, 1, 1)
self.retranslateUi(Form)
QtCore.QMetaObject.connectSlotsByName(Form)
def retranslateUi(self, Form):
_translate = QtCore.QCoreApplication.translate
Form.setWindowTitle(_translate("Form", "Form"))
self.comboBox.setItemText(0, _translate("Form", "電料類"))
self.comboBox.setItemText(1, _translate("Form", "線材類"))
self.comboBox.setItemText(2, _translate("Form", "螺絲類"))
self.comboBox.setItemText(3, _translate("Form", "相機類"))
item = self.tableWidget.horizontalHeaderItem(0)
item.setText(_translate("Form", "項目"))
item = self.tableWidget.horizontalHeaderItem(1)
item.setText(_translate("Form", "數量"))
item = self.tableWidget.horizontalHeaderItem(2)
item.setText(_translate("Form", "位置"))
item = self.tableWidget.horizontalHeaderItem(3)
item.setText(_translate("Form", "圖片"))
self.label.setText(_translate("Form", "TextLabel"))

View File

@ -0,0 +1,182 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Form</class>
<widget class="QWidget" name="Form">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>875</width>
<height>577</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QComboBox" name="comboBox">
<property name="minimumSize">
<size>
<width>121</width>
<height>31</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>121</width>
<height>31</height>
</size>
</property>
<item>
<property name="text">
<string>電料類</string>
</property>
</item>
<item>
<property name="text">
<string>線材類</string>
</property>
</item>
<item>
<property name="text">
<string>螺絲類</string>
</property>
</item>
<item>
<property name="text">
<string>相機類</string>
</property>
</item>
</widget>
</item>
</layout>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>728</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item row="1" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QTableWidget" name="tableWidget">
<property name="minimumSize">
<size>
<width>631</width>
<height>511</height>
</size>
</property>
<property name="lineWidth">
<number>1</number>
</property>
<property name="columnCount">
<number>4</number>
</property>
<column>
<property name="text">
<string>項目</string>
</property>
<property name="textAlignment">
<set>AlignCenter</set>
</property>
</column>
<column>
<property name="text">
<string>數量</string>
</property>
<property name="textAlignment">
<set>AlignCenter</set>
</property>
</column>
<column>
<property name="text">
<string>位置</string>
</property>
<property name="textAlignment">
<set>AlignCenter</set>
</property>
</column>
<column>
<property name="text">
<string>圖片</string>
</property>
<property name="textAlignment">
<set>AlignCenter</set>
</property>
</column>
</widget>
</item>
<item>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>108</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="label">
<property name="minimumSize">
<size>
<width>211</width>
<height>231</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>211</width>
<height>231</height>
</size>
</property>
<property name="text">
<string>TextLabel</string>
</property>
<property name="scaledContents">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>108</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

View File

@ -0,0 +1,78 @@
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'loginui.ui'
#
# Created by: PyQt5 UI code generator 5.15.7
#
# 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_Dialog(object):
def setupUi(self, Dialog):
Dialog.setObjectName("Dialog")
Dialog.resize(314, 152)
self.gridLayout = QtWidgets.QGridLayout(Dialog)
self.gridLayout.setObjectName("gridLayout")
spacerItem = QtWidgets.QSpacerItem(20, 127, QtWidgets.QSizePolicy.Minimum, QtWidgets.QSizePolicy.Expanding)
self.gridLayout.addItem(spacerItem, 0, 0, 2, 1)
spacerItem1 = QtWidgets.QSpacerItem(259, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
self.gridLayout.addItem(spacerItem1, 0, 1, 1, 1)
self.verticalLayout_2 = QtWidgets.QVBoxLayout()
self.verticalLayout_2.setObjectName("verticalLayout_2")
self.verticalLayout = QtWidgets.QVBoxLayout()
self.verticalLayout.setObjectName("verticalLayout")
self.horizontalLayout = QtWidgets.QHBoxLayout()
self.horizontalLayout.setObjectName("horizontalLayout")
self.label = QtWidgets.QLabel(Dialog)
font = QtGui.QFont()
font.setFamily("Arial")
font.setPointSize(12)
self.label.setFont(font)
self.label.setObjectName("label")
self.horizontalLayout.addWidget(self.label)
self.lineEdit_userid = QtWidgets.QLineEdit(Dialog)
self.lineEdit_userid.setMinimumSize(QtCore.QSize(154, 24))
self.lineEdit_userid.setObjectName("lineEdit_userid")
self.horizontalLayout.addWidget(self.lineEdit_userid)
self.verticalLayout.addLayout(self.horizontalLayout)
self.horizontalLayout_2 = QtWidgets.QHBoxLayout()
self.horizontalLayout_2.setObjectName("horizontalLayout_2")
self.label_2 = QtWidgets.QLabel(Dialog)
font = QtGui.QFont()
font.setFamily("Arial")
font.setPointSize(12)
self.label_2.setFont(font)
self.label_2.setObjectName("label_2")
self.horizontalLayout_2.addWidget(self.label_2)
self.lineEdit_password = QtWidgets.QLineEdit(Dialog)
self.lineEdit_password.setMinimumSize(QtCore.QSize(155, 24))
self.lineEdit_password.setObjectName("lineEdit_password")
self.horizontalLayout_2.addWidget(self.lineEdit_password)
self.verticalLayout.addLayout(self.horizontalLayout_2)
self.verticalLayout_2.addLayout(self.verticalLayout)
self.horizontalLayout_3 = QtWidgets.QHBoxLayout()
self.horizontalLayout_3.setObjectName("horizontalLayout_3")
spacerItem2 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
self.horizontalLayout_3.addItem(spacerItem2)
self.btn_login = QtWidgets.QPushButton(Dialog)
self.btn_login.setMinimumSize(QtCore.QSize(141, 28))
self.btn_login.setObjectName("btn_login")
self.horizontalLayout_3.addWidget(self.btn_login)
spacerItem3 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
self.horizontalLayout_3.addItem(spacerItem3)
self.verticalLayout_2.addLayout(self.horizontalLayout_3)
self.gridLayout.addLayout(self.verticalLayout_2, 1, 1, 1, 1)
self.retranslateUi(Dialog)
QtCore.QMetaObject.connectSlotsByName(Dialog)
def retranslateUi(self, Dialog):
_translate = QtCore.QCoreApplication.translate
Dialog.setWindowTitle(_translate("Dialog", "登入"))
self.label.setText(_translate("Dialog", "Username:"))
self.label_2.setText(_translate("Dialog", "Password:"))
self.btn_login.setText(_translate("Dialog", "登入"))

View File

@ -0,0 +1,152 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Dialog</class>
<widget class="QDialog" name="Dialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>314</width>
<height>152</height>
</rect>
</property>
<property name="windowTitle">
<string>登入</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0" rowspan="2">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>127</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="1">
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>259</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="1">
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="label">
<property name="font">
<font>
<family>Arial</family>
<pointsize>12</pointsize>
</font>
</property>
<property name="text">
<string>Username:</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="lineEdit_userid">
<property name="minimumSize">
<size>
<width>154</width>
<height>24</height>
</size>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="label_2">
<property name="font">
<font>
<family>Arial</family>
<pointsize>12</pointsize>
</font>
</property>
<property name="text">
<string>Password:</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="lineEdit_password">
<property name="minimumSize">
<size>
<width>155</width>
<height>24</height>
</size>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="btn_login">
<property name="minimumSize">
<size>
<width>141</width>
<height>28</height>
</size>
</property>
<property name="text">
<string>登入</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

View File

@ -0,0 +1,71 @@
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'mainui.ui'
#
# Created by: PyQt5 UI code generator 5.15.7
#
# 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(907, 686)
self.centralwidget = QtWidgets.QWidget(MainWindow)
self.centralwidget.setObjectName("centralwidget")
self.gridLayout = QtWidgets.QGridLayout(self.centralwidget)
self.gridLayout.setObjectName("gridLayout")
self.verticalLayout = QtWidgets.QVBoxLayout()
self.verticalLayout.setObjectName("verticalLayout")
self.horizontalLayout = QtWidgets.QHBoxLayout()
self.horizontalLayout.setObjectName("horizontalLayout")
self.btn_items = QtWidgets.QPushButton(self.centralwidget)
self.btn_items.setObjectName("btn_items")
self.horizontalLayout.addWidget(self.btn_items)
self.btn_history = QtWidgets.QPushButton(self.centralwidget)
self.btn_history.setObjectName("btn_history")
self.horizontalLayout.addWidget(self.btn_history)
self.btn_borrow = QtWidgets.QPushButton(self.centralwidget)
self.btn_borrow.setObjectName("btn_borrow")
self.horizontalLayout.addWidget(self.btn_borrow)
self.btn_return = QtWidgets.QPushButton(self.centralwidget)
self.btn_return.setObjectName("btn_return")
self.horizontalLayout.addWidget(self.btn_return)
self.btn_create = QtWidgets.QPushButton(self.centralwidget)
self.btn_create.setObjectName("btn_create")
self.horizontalLayout.addWidget(self.btn_create)
self.btn_delete = QtWidgets.QPushButton(self.centralwidget)
self.btn_delete.setObjectName("btn_delete")
self.horizontalLayout.addWidget(self.btn_delete)
self.btn_login = QtWidgets.QPushButton(self.centralwidget)
self.btn_login.setObjectName("btn_login")
self.horizontalLayout.addWidget(self.btn_login)
self.verticalLayout.addLayout(self.horizontalLayout)
self.stackedWidget = QtWidgets.QStackedWidget(self.centralwidget)
self.stackedWidget.setMinimumSize(QtCore.QSize(881, 621))
self.stackedWidget.setObjectName("stackedWidget")
self.verticalLayout.addWidget(self.stackedWidget)
self.gridLayout.addLayout(self.verticalLayout, 0, 0, 1, 1)
MainWindow.setCentralWidget(self.centralwidget)
self.statusbar = QtWidgets.QStatusBar(MainWindow)
self.statusbar.setObjectName("statusbar")
MainWindow.setStatusBar(self.statusbar)
self.retranslateUi(MainWindow)
self.stackedWidget.setCurrentIndex(-1)
QtCore.QMetaObject.connectSlotsByName(MainWindow)
def retranslateUi(self, MainWindow):
_translate = QtCore.QCoreApplication.translate
MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow"))
self.btn_items.setText(_translate("MainWindow", "主畫面"))
self.btn_history.setText(_translate("MainWindow", "歷史紀錄"))
self.btn_borrow.setText(_translate("MainWindow", "借用"))
self.btn_return.setText(_translate("MainWindow", "歸還"))
self.btn_create.setText(_translate("MainWindow", "創建"))
self.btn_delete.setText(_translate("MainWindow", "刪除"))
self.btn_login.setText(_translate("MainWindow", "倉管登入"))

View File

@ -0,0 +1,94 @@
<?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>907</width>
<height>686</height>
</rect>
</property>
<property name="windowTitle">
<string>MainWindow</string>
</property>
<widget class="QWidget" name="centralwidget">
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QPushButton" name="btn_items">
<property name="text">
<string>主畫面</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="btn_history">
<property name="text">
<string>歷史紀錄</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="btn_borrow">
<property name="text">
<string>借用</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="btn_return">
<property name="text">
<string>歸還</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="btn_create">
<property name="text">
<string>創建</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="btn_delete">
<property name="text">
<string>刪除</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="btn_login">
<property name="text">
<string>倉管登入</string>
</property>
</widget>
</item>
</layout>
</item>
<item>
<widget class="QStackedWidget" name="stackedWidget">
<property name="minimumSize">
<size>
<width>881</width>
<height>621</height>
</size>
</property>
<property name="currentIndex">
<number>-1</number>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
<widget class="QStatusBar" name="statusbar"/>
</widget>
<resources/>
<connections/>
</ui>

View File

@ -0,0 +1,54 @@
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'returnui.ui'
#
# Created by: PyQt5 UI code generator 5.15.7
#
# 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_Dialog(object):
def setupUi(self, Dialog):
Dialog.setObjectName("Dialog")
Dialog.resize(599, 85)
self.gridLayout = QtWidgets.QGridLayout(Dialog)
self.gridLayout.setObjectName("gridLayout")
self.verticalLayout = QtWidgets.QVBoxLayout()
self.verticalLayout.setObjectName("verticalLayout")
self.horizontalLayout = QtWidgets.QHBoxLayout()
self.horizontalLayout.setObjectName("horizontalLayout")
self.label_5 = QtWidgets.QLabel(Dialog)
self.label_5.setObjectName("label_5")
self.horizontalLayout.addWidget(self.label_5)
self.comboBox = QtWidgets.QComboBox(Dialog)
self.comboBox.setMinimumSize(QtCore.QSize(491, 22))
self.comboBox.setObjectName("comboBox")
self.horizontalLayout.addWidget(self.comboBox)
self.verticalLayout.addLayout(self.horizontalLayout)
self.horizontalLayout_2 = QtWidgets.QHBoxLayout()
self.horizontalLayout_2.setObjectName("horizontalLayout_2")
spacerItem = QtWidgets.QSpacerItem(158, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
self.horizontalLayout_2.addItem(spacerItem)
self.buttonBox = QtWidgets.QDialogButtonBox(Dialog)
self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Ok)
self.buttonBox.setObjectName("buttonBox")
self.horizontalLayout_2.addWidget(self.buttonBox)
spacerItem1 = QtWidgets.QSpacerItem(178, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
self.horizontalLayout_2.addItem(spacerItem1)
self.verticalLayout.addLayout(self.horizontalLayout_2)
self.gridLayout.addLayout(self.verticalLayout, 0, 0, 1, 1)
self.retranslateUi(Dialog)
self.buttonBox.accepted.connect(Dialog.accept) # type: ignore
self.buttonBox.rejected.connect(Dialog.reject) # type: ignore
QtCore.QMetaObject.connectSlotsByName(Dialog)
def retranslateUi(self, Dialog):
_translate = QtCore.QCoreApplication.translate
Dialog.setWindowTitle(_translate("Dialog", "歸還"))
self.label_5.setText(_translate("Dialog", "借用事件:"))

View File

@ -0,0 +1,119 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Dialog</class>
<widget class="QDialog" name="Dialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>599</width>
<height>85</height>
</rect>
</property>
<property name="windowTitle">
<string>歸還</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="label_5">
<property name="text">
<string>借用事件:</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="comboBox">
<property name="minimumSize">
<size>
<width>491</width>
<height>22</height>
</size>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>158</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>178</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</item>
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>Dialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>Dialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View File

@ -0,0 +1,117 @@
import json
import requests
import urllib3
import time
from requests.structures import CaseInsensitiveDict
import base64
import pandas as pd
from PyQt5.QtWidgets import QApplication, QWidget, QLabel, QLineEdit, QVBoxLayout, QPushButton, QMessageBox
request_url="http://140.125.21.70:7071"
#筆記:
#Parking_spaces_API是通訊底層headers是令牌fun是funtion名稱在使用api時Parking_spaces_API(fun,headers)
#response函式庫使用request.get(總URL,data=要放的data)
#http://localhost:7700=>request_url 這個URL已經是固定所以在底層時就會先寫死
#/api/Model名稱//{id}=>fun
#通訊底層
class WMS_API():
def __init__(self, Fun, headers, *args):
self.headers = headers
self.Fun = Fun
def post(self, data):
data_json = json.dumps(data)
response = requests.post(request_url + self.Fun, data=data_json, headers=self.headers, verify=False)
return response
def get(self):
response = requests.get(request_url + self.Fun, headers=self.headers, verify=False)
if response.status_code == 200:
data = response.json()
df = pd.DataFrame.from_records(data)
return df
else:
return
def delete(self):
response = requests.delete(request_url + self.Fun, headers=self.headers, verify=False)
return response
def getSingleData(self):
response = requests.get(request_url + self.Fun, headers=self.headers, verify=False)
if response.status_code == 200:
data = response.json()
df = pd.DataFrame.from_records(data, index=[0])
return df
else:
return
#電料類
class Vip_api():
def __init__(self,):
self.token=None
pass
def verify(self,username,password):
API = "/Users/Verifypassword"
data = {
'username': username,
'password': password
}
headers = {'Content-type': 'application/json'}
response=WMS_API(API,headers).post(data)
if response.status_code == 200:
self.token = response.json().get('token')
return True
else:
return False
def get_token(self):
return self.token
def get_all_data(self,model_name):
API = "/api/"+model_name
headers = CaseInsensitiveDict()
headers['Accept'] = 'application/json'
data = WMS_API(API, headers).get()
return data
def createitem(self,model_name,item,account,location,itemimage):
self.token=self.get_token()
print(self.token)
API= "/api/"+model_name+"/"+item
headers = {
'Content-type': 'application/json',
"Authorization": self.token
}
print(headers)
data = {
"item": item,
"account": account,
"location": location,
"itemimage": itemimage
}
data=WMS_API(API,headers).post(data)
print(data.status_code)
#登入系統JWT
# class User():
# def __init__(self,):
#
# def verify(self,username,password):
# API = "/Users/Verifypassword"
# data = {
# 'username': username,
# 'password': password
# }
# headers = {'Content-type': 'application/json'}
# response=WMS_API(API,headers).post(data)
# if response.status_code == 200:
# self.token = response.json().get('token')
# print("Login successful. Token saved.")
# return True
# else:
# print("Login failed.")
# return False
# def get_token(self):
# return self.token

View File

@ -0,0 +1,339 @@
from multiprocessing import Process,Queue,RLock
from UI.main.mainui import Ui_MainWindow as mainUI
from UI.items.itemsui import Ui_Form as itemsUI
from UI.history.historyui import Ui_Form as historyUI
from UI.create.createui import Ui_Dialog as createUI
from UI.login.loginui import Ui_Dialog as loginUI
from UI.delete.deleteui import Ui_Dialog as deleteUI
from UI.borrow.borrowui import Ui_Dialog as borrowUI
from UI.rereturn.returnui import Ui_Dialog as returnUI
from VIP_WMS_api import Vip_api
import sys
from PyQt5 import QtWidgets, QtGui, QtCore
import configparser
import requests
import base64
from PyQt5.QtCore import QTimer
from PyQt5.QtGui import QImage, QPixmap
from PyQt5.QtWidgets import QApplication, QWidget, QLabel, QLineEdit, QVBoxLayout, QPushButton, QMessageBox
from datetime import datetime
import os
def base64_to_pixmap(base64_str):
# 解码Base64字符串为图像数据
image_data = base64.b64decode(base64_str)
# 创建Qt图像对象
image = QImage.fromData(image_data)
# 将Qt图像对象转换为QPixmap对象
pixmap = QPixmap.fromImage(image)
return pixmap
class LoginSuccessSignal(QtCore.QObject):
signal = QtCore.pyqtSignal()
class DeleteUI(QtWidgets.QDialog,deleteUI):
def __init__(self):
super().__init__()
self.setupUi(self)
self.vip_api = Vip_api() # 创建 Vip_api 类的实例
self.deleteUI=deleteUI()
self.setupcombobox()
self.comboBox_category.currentIndexChanged.connect(self.comboBox_category_changed)
def setupcombobox(self):
data = self.vip_api.get_all_data("Model_em")
len_item = len(data['item'])
for i in range(len_item):
item = data['item'][i]
print(item)
self.comboBox_item.addItem(item)
def comboBox_category_changed(self):
self.comboBox_item.clear()
data=None
category = self.comboBox_category.currentText()
if category == "電料類":
data = self.vip_api.get_all_data("Model_em")
if (category == "線材類"):
data = self.vip_api.get_all_data("Model_line")
if (category == "螺絲類"):
data = self.vip_api.get_all_data("Model_rose")
if (category == "相機類"):
data = self.vip_api.get_all_data("Model_camera")
len_item = len(data['item'])
for i in range(len_item):
item = data['item'][i]
print(item)
self.comboBox_item.addItem(item)
class LoginUI(QtWidgets.QDialog,loginUI):
def __init__(self):
super().__init__()
self.setupUi(self)
self.vip_api = Vip_api() # 创建 Vip_api 类的实例
self.createUI=createUI()
self.success_signal = LoginSuccessSignal()
self.btn_login.clicked.connect(self.login)
def clearlineEdit(self):
self.lineEdit_userid.setText("")
self.lineEdit_password.setText("")
def login(self):
username=self.lineEdit_userid.text()
password=self.lineEdit_password.text()
if self.vip_api.verify(username, password):
token = self.vip_api.token
self.save_token_to_ini(token)
print(token)
QMessageBox.information(self, '成功', '登入成功!')
self.success_signal.signal.emit() # 登录成功后发射信号
else:
QMessageBox.warning(self, '錯誤', '帳號或密碼錯誤!')
def save_token_to_ini(self, token):
config = configparser.ConfigParser()
config['TokenSection'] = {'token': token}
with open('config.ini', 'w') as configfile:
config.write(configfile)
class CreateUI(QtWidgets.QDialog,createUI):
def __init__(self):
super().__init__()
self.setupUi(self)
self.buttonBox.accepted.connect(self.create)
self.buttonBox.rejected.connect(self.cancel)
def create(self):
category=self.comboBox_category.currentText()
item=self.textEdit_item.toPlainText()
account=self.textEdit_account.toPlainText()
location=self.textEdit_location.toPlainText()
itemimage=self.textEdit_image.toPlainText()
if (category=="電料類"):
self.vip_api.createitem("Model_em",item,account,location,itemimage)
if (category=="線材類"):
self.vip_api.createitem("Model_line",item,account,location,itemimage)
if (category=="螺絲類"):
self.vip_api.createitem("Model_rose",item,account,location,itemimage)
if (category=="相機類"):
self.vip_api.createitem("Model_camera",item,account,location,itemimage)
def cancel(self):
print("no")
class ItemsUI(QtWidgets.QWidget, itemsUI):
def __init__(self):
super().__init__()
self.setupUi(self)
self.comboBox.currentIndexChanged.connect(self.comboBox_changed)
self.vip_api = Vip_api() # 创建 Vip_api 类的实例
self.item_init_()
def item_init_(self):
self.data = self.vip_api.get_all_data("Model_em")
self.item_show(self.data)
def comboBox_changed(self):
# print(self.comboBox.currentText())
if (self.comboBox.currentText()=="電料類"):
data=self.vip_api.get_all_data("Model_em")
if (self.comboBox.currentText()=="線材類"):
data=self.vip_api.get_all_data("Model_line")
if (self.comboBox.currentText() == "螺絲類"):
data=self.vip_api.get_all_data("Model_rose")
if (self.comboBox.currentText() == "相機類"):
data=self.vip_api.get_all_data("Model_camera")
self.item_show(data)
def item_show(self,data):
# print(data)
if data.empty or data is None:
self.tableWidget.clearContents()
self.tableWidget.setRowCount(0)
else:
len_item = len(data['item'])
self.tableWidget.setRowCount(len_item)
for i in range(len(data['item'])):
item = self.data['item'][i]
account = str(self.data['account'][i])
location = self.data['location'][i]
self.tableWidget.setItem(i, 0, QtWidgets.QTableWidgetItem(item))
self.tableWidget.setItem(i, 1, QtWidgets.QTableWidgetItem(account))
self.tableWidget.setItem(i, 2, QtWidgets.QTableWidgetItem(location))
button = QtWidgets.QPushButton('Show Image', self)
button.clicked.connect(lambda checked, idx=i: self.show_image(idx))
self.tableWidget.setCellWidget(i, 3, button)
def show_image(self, index):
image_path = self.data['itemimage'][index]
pixmap = base64_to_pixmap(image_path)
self.label.setPixmap(pixmap)
self.label.setScaledContents(True) # 图片自适应
class HistoryUI(QtWidgets.QWidget, historyUI):
def __init__(self):
super().__init__()
self.setupUi(self)
self.vip_api = Vip_api() # 创建 Vip_api 类的实例
self.history_show()
def history_show(self):
data = self.vip_api.get_all_data("Model_rent")
len_borrow_date = len(data['borrow_date'])
borrow_dates_as_datetime = [datetime.strptime(date_str, '%Y-%m-%d %H:%M:%S') for date_str in data['borrow_date']]
sorted_dates = sorted(borrow_dates_as_datetime, reverse=True)
data['borrow_date'] = [date.strftime('%Y-%m-%d %H:%M:%S') for date in sorted_dates]
print(data['borrow_date'])
self.tableWidget.setRowCount(len_borrow_date)
for i in range(len_borrow_date):
self.tableWidget.resizeColumnsToContents()
borrow_date = data['borrow_date'][i]
return_date = data['return_date'][i]
borrow_man = data['borrow_man'][i]
borrow_category = data['borrow_category'][i]
borrow_item = data['borrow_item'][i]
borrow_account = data['borrow_account'][i]
# 在相应单元格插入数据
self.tableWidget.setItem(i, 0, QtWidgets.QTableWidgetItem(borrow_date))
self.tableWidget.setItem(i, 1, QtWidgets.QTableWidgetItem(return_date))
self.tableWidget.setItem(i, 2, QtWidgets.QTableWidgetItem(borrow_man))
self.tableWidget.setItem(i, 3, QtWidgets.QTableWidgetItem(borrow_category))
self.tableWidget.setItem(i, 4, QtWidgets.QTableWidgetItem(borrow_item))
self.tableWidget.setItem(i, 5, QtWidgets.QTableWidgetItem(str(borrow_account)))
class BorrowUI(QtWidgets.QDialog, borrowUI):
def __init__(self):
super().__init__()
self.vip_api = Vip_api() # 创建 Vip_api 类的实例
self.setupUi(self)
self.buttonBox.accepted.connect(self.create)
self.buttonBox.rejected.connect(self.cancel)
def create(self):
pass
def cancel(self):
print("no")
class ReturnUI(QtWidgets.QDialog, returnUI):
def __init__(self):
super().__init__()
self.vip_api = Vip_api() # 创建 Vip_api 类的实例
self.setupUi(self)
self.buttonBox.accepted.connect(self.create)
self.buttonBox.rejected.connect(self.cancel)
def create(self):
pass
def cancel(self):
print("no")
class MainWindow(QtWidgets.QMainWindow, mainUI):
def __init__(self):
super().__init__()
self.setupUi(self)
self.itemsUI= ItemsUI()
self.borrowUI=BorrowUI()
self.returnUI=ReturnUI()
self.createUI=CreateUI()
self.loginUI=LoginUI()
self.loginUI.success_signal.signal.connect(self.close_login_ui) # 连接登录成功的信号到关闭登录视窗的槽函数
self.deleteUI=DeleteUI()
self.vip_api=Vip_api()
# config = configparser.ConfigParser()
self.token=self.vip_api.get_token()
print(self.token)
self.stackedWidget.addWidget(self.itemsUI)
self.btn_items.clicked.connect(lambda: self.changeIndex(0))
self.btn_history.clicked.connect(lambda: self.changeIndex(1))
self.btn_delete.clicked.connect(self.open_delete_window)
self.btn_create.clicked.connect(self.open_create_window)
self.btn_login.clicked.connect(self.open_login_window)
self.init_ini_remove() #存在ini檔的token刪除
self.btn_login_flag=0
self.timer = QTimer(self)
self.timer.timeout.connect(self.update_data)
self.timer.start(1000) # 1000 毫秒(即 1 秒)
self.op = QtWidgets.QGraphicsOpacityEffect() #創建畫布
self.op1 = QtWidgets.QGraphicsOpacityEffect() #創建畫布
self.op2 = QtWidgets.QGraphicsOpacityEffect() #創建畫布
self.op.setOpacity(0) #設定畫布透明
self.op1.setOpacity(0) #設定畫布透明
self.btn_create.setGraphicsEffect(self.op) #創建按鈕隱藏
self.btn_create.setEnabled(False)
self.btn_delete.setGraphicsEffect(self.op1) #刪除按鈕隱藏
self.btn_delete.setEnabled(False)
def init_ini_remove(self):
file_path = 'config.ini'
if os.path.exists(file_path):
os.remove(file_path)
print(f"File {file_path} deleted successfully.")
else:
print(f"File {file_path} does not exist.")
# config['TokenSection'] = {'token': self.token}
# with open('config.ini', 'w') as configfile:
# config.write(configfile)
def update_data(self):
config = configparser.ConfigParser()
config.read('config.ini')
if 'TokenSection' in config and 'token' in config['TokenSection']:
token = config['TokenSection']['token']
print(f"从配置文件中获取的 token 为: {token}")
self.op.setOpacity(1)
self.op1.setOpacity(1)
self.op2.setOpacity(0) # 設定畫布透明
self.btn_create.setGraphicsEffect(self.op)
self.btn_create.setEnabled(True)
self.btn_delete.setGraphicsEffect(self.op1)
self.btn_delete.setEnabled(True)
self.btn_login_flag=1
else:
print("配置文件中未找到 token")
self.op.setOpacity(0)
self.op1.setOpacity(0)
self.btn_create.setGraphicsEffect(self.op)
self.btn_create.setEnabled(False)
self.btn_delete.setGraphicsEffect(self.op1)
self.btn_delete.setEnabled(False)
self.btn_login_flag=0
if self.btn_login_flag==1: #目前為登入狀態
self.btn_login.setText("倉管登出")
self.btn_login.disconnect() # 断开之前的连接
self.btn_login.clicked.connect(self.init_ini_remove)
else:
self.btn_login.setText("倉管登入")
self.btn_login.disconnect() # 断开之前的连接
self.btn_login.clicked.connect(self.open_login_window)
def open_create_window(self):
self.createUI.show()
def open_login_window(self):
self.loginUI.clearlineEdit()
self.loginUI.show()
def close_login_ui(self):
self.loginUI.close()
def open_delete_window(self):
self.deleteUI.show()
def changeIndex(self,index):
print(index)
if index==1: #index==1時歷史紀錄頁
self.historyUI = HistoryUI()
self.stackedWidget.addWidget(self.historyUI)
self.stackedWidget.setCurrentIndex(index)
if __name__ == "__main__":
app = QtWidgets.QApplication(sys.argv)
mainWin = MainWindow()
mainWin.show()
sys.exit(app.exec_())