1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- # -*- coding: utf-8 -*-
- import time
- import sys
- import os
- import settings
- from UI.set_image_mode import Ui_Form
- from PySide6.QtWidgets import *
- from PySide6.QtCore import *
- class ToSetting(QWidget, Ui_Form):
- signal_data = Signal(dict)
- def __init__(self, windows):
- super().__init__()
- self.windows = windows
- self.setupUi(self)
- self.setFixedSize(self.width(), self.height())
- self.init()
- self.setWindowModality(Qt.ApplicationModal)
- self.show()
- def init(self):
- self.pushButton.clicked.connect(self.run)
- # 回填数据
- self.lineEdit.setText(",".join(settings.is_fall_dir))
- self.lineEdit_2.setText(",".join(settings.is_fall_file))
- def run(self):
- is_fall_dir = self.lineEdit.text()
- if not is_fall_dir:
- is_fall_dir = "已扣图"
- else:
- if "已扣图" not in is_fall_dir:
- is_fall_dir += ",已扣图"
- is_fall_dir = is_fall_dir.replace(",", ",")
- is_fall_dir = is_fall_dir.replace(",,", ",")
- settings.set_config(data_dict={"is_fall_dir": is_fall_dir}, section="basicSetup")
- if is_fall_dir:
- is_fall_dir = is_fall_dir.split(",")
- settings.is_fall_dir = [x for x in is_fall_dir if x]
- else:
- settings.is_fall_dir = []
- is_fall_file = self.lineEdit_2.text()
- is_fall_file = is_fall_file.replace(",", ",")
- settings.set_config(data_dict={"is_fall_file": is_fall_file}, section="basicSetup")
- if is_fall_file:
- is_fall_file = is_fall_file.split(",")
- settings.is_fall_file = [x for x in is_fall_file if x]
- else:
- settings.is_fall_file = []
- self.close()
|