<reponame>sticktoFE/rpaclient
# -*- coding: utf-8 -*-

# Form implementation generated from reading ui file 'd:\leichui\workspace\screenshot-master\ui\option.ui'
#
# Created by: PyQt5 UI code generator 5.15.4
#
# 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 configparser import ConfigParser
from PyQt5 import QtCore, QtGui
from PyQt5.QtWidgets import QDialog,QMessageBox
from ui.Ui_option import Ui_Dialog_Option

class Option(QDialog, Ui_Dialog_Option):
    def __init__(self):
        super(Option,self).__init__()
        self.setupUi(self)    
        self.lineEdit_api.textChanged.connect(self.change_api)
        self.lineEdit_cookie.textChanged.connect(self.change_cookie)
        # 读取配置
        self.cfg = ConfigParser()
        self.cfg.read('config.ini')
        self.lineEdit_api.setText(self.cfg.get('picbed', 'api'))
        self.lineEdit_cookie.setText(self.cfg.get('picbed', 'cookie'))
 
    def accept(self):
        self.cfg.write(open("config.ini", "r+", encoding="utf-8"))
        QMessageBox.about(self, "消息", "保存成功")
    def reject(self):
        self.close()

    def change_api(self):
        self.cfg.set('picbed', "api", self.lineEdit_api.text())

    def change_cookie(self):
        self.cfg.set('picbed', "cookie", self.lineEdit_cookie.text())

    # def closeEvent(self, event):
    #     reply = QMessageBox.information(self, "消息", "是否退出程序", QMessageBox.Yes | QMessageBox.No)
    #     if reply == QMessageBox.Yes:
    #         event.accept()
    #         print("修改配置文件")
    #         self.cfg.write(open("config.ini", "r+", encoding="utf-8"))
    #     else:
    #         event.ignore()
# -*- coding: utf-8 -*-

# Form implementation generated from reading ui file 'd:\leichui\workspace\screenshot-master\ui\option.ui'
#
# Created by: PyQt5 UI code generator 5.15.4
#
# 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 configparser import ConfigParser
from PyQt5 import QtCore, QtGui
from PyQt5.QtWidgets import QDialog,QMessageBox
from ui.Ui_option import Ui_Dialog_Option

class Option(QDialog, Ui_Dialog_Option):
    def __init__(self):
        super(Option,self).__init__()
        self.setupUi(self)    
        self.lineEdit_api.textChanged.connect(self.change_api)
        self.lineEdit_cookie.textChanged.connect(self.change_cookie)
        # 读取配置
        self.cfg = ConfigParser()
        self.cfg.read('config.ini')
        self.lineEdit_api.setText(self.cfg.get('picbed', 'api'))
        self.lineEdit_cookie.setText(self.cfg.get('picbed', 'cookie'))
 
    def accept(self):
        self.cfg.write(open("config.ini", "r+", encoding="utf-8"))
        QMessageBox.about(self, "消息", "保存成功")
    def reject(self):
        self.close()

    def change_api(self):
        self.cfg.set('picbed', "api", self.lineEdit_api.text())

    def change_cookie(self):
        self.cfg.set('picbed', "cookie", self.lineEdit_cookie.text())

    # def closeEvent(self, event):
    #     reply = QMessageBox.information(self, "消息", "是否退出程序", QMessageBox.Yes | QMessageBox.No)
    #     if reply == QMessageBox.Yes:
    #         event.accept()
    #         print("修改配置文件")
    #         self.cfg.write(open("config.ini", "r+", encoding="utf-8"))
    #     else:
    #         event.ignore()
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'd:\leichui\workspace\screenshot-master\ui\option.ui' # # Created by: PyQt5 UI code generator 5.15.4 # # 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. # 读取配置 # def closeEvent(self, event): #     reply = QMessageBox.information(self, "消息", "是否退出程序", QMessageBox.Yes | QMessageBox.No) #     if reply == QMessageBox.Yes: #         event.accept() #         print("修改配置文件") #         self.cfg.write(open("config.ini", "r+", encoding="utf-8")) #     else: #         event.ignore()