You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
79 lines
3.0 KiB
79 lines
3.0 KiB
import os
|
|
|
|
from PyQt5.QtWidgets import QMainWindow, QComboBox, QPushButton, QTextEdit
|
|
from PyQt5 import uic
|
|
import shutil
|
|
|
|
from operateselect_window import operateselect
|
|
|
|
|
|
class settingrule(QMainWindow):
|
|
def __init__(self):
|
|
super().__init__()
|
|
|
|
uic.loadUi('res/ui/setRule_window.ui', self)
|
|
|
|
# 图片地址
|
|
|
|
self.operateChoseBox = self.findChild(QComboBox, 'operateChose') # 操作选择
|
|
self.cancelBtn = self.findChild(QPushButton, 'cancelBtn')#取消选择按钮
|
|
self.preserveBtn = self.findChild(QPushButton, 'preserveBtn') # 保存选择按钮
|
|
self.uploadBtn = self.findChild(QPushButton, 'uploadBtn') # "上传"按钮
|
|
self.uploadBtn_2 = self.findChild(QPushButton, 'uploadBtn_2')
|
|
self.uploadBtn_3 = self.findChild(QPushButton, 'uploadBtn_3')
|
|
|
|
self.operateChoseBox.activated.connect(self.handleComboBoxActivated)
|
|
self.cancelBtn.clicked.connect(self.cancel_clicked)
|
|
self.preserveBtn.clicked.connect(self.preserve_clicked)
|
|
self.uploadBtn.clicked.connect(self.write_image_to_folder)
|
|
self.uploadBtn_2.clicked.connect(self.write_image_to_folder_2)
|
|
self.uploadBtn_3.clicked.connect(self.write_image_to_folder_3)
|
|
|
|
self.operateselect_window = operateselect()
|
|
|
|
def handleComboBoxActivated(self, index):
|
|
selected_option = self.operateChoseBox.itemText(index)
|
|
if selected_option == "操作库选择":
|
|
self.create新界面()
|
|
|
|
def create新界面(self):
|
|
# 显示新界面
|
|
self.operateselect_window.show()
|
|
|
|
def cancel_clicked(self):
|
|
self.close()
|
|
|
|
def preserve_clicked(self):
|
|
self.close()
|
|
|
|
def write_image_to_folder(self): # 将图片写入目标文件
|
|
text_edit = self.findChild(QTextEdit, "textEdit")
|
|
self.image_path = text_edit.toPlainText()
|
|
print(self.image_path)
|
|
destination_path = "D:/代码/pythoncode/src/windows/res/pictures"
|
|
if not os.path.exists(self.image_path):
|
|
print("image address is not existing!")
|
|
return
|
|
shutil.copy(self.image_path, destination_path)
|
|
|
|
def write_image_to_folder_2(self): # 将图片写入目标文件
|
|
text_edit = self.findChild(QTextEdit, "textEdit_2")
|
|
self.image_path = text_edit.toPlainText()
|
|
print(self.image_path)
|
|
destination_path = "D:/代码/pythoncode/src/windows/res/pictures"
|
|
if not os.path.exists(self.image_path):
|
|
print("image address is not existing!")
|
|
return
|
|
shutil.copy(self.image_path, destination_path)
|
|
|
|
def write_image_to_folder_3(self): # 将图片写入目标文件
|
|
text_edit = self.findChild(QTextEdit, "textEdit_3")
|
|
self.image_path = text_edit.toPlainText()
|
|
print(self.image_path)
|
|
destination_path = "D:/代码/pythoncode/src/windows/res/pictures"
|
|
if not os.path.exists(self.image_path):
|
|
print("image address is not existing!")
|
|
return
|
|
shutil.copy(self.image_path, destination_path)
|
|
|