forked from Eanya-Tonic/MahiroToolbox
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSettingInterface.py
More file actions
61 lines (47 loc) · 2.06 KB
/
SettingInterface.py
File metadata and controls
61 lines (47 loc) · 2.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# coding:utf-8
import configparser
from PyQt5.QtCore import Qt, pyqtSignal
from PyQt5.QtGui import QPixmap, QPainter, QColor
from PyQt5.QtWidgets import QWidget
from qfluentwidgets import InfoBarIcon, InfoBar, PushButton, setTheme, Theme, FluentIcon, InfoBarPosition, InfoBarManager
from UI.Ui_setting import Ui_Form
class SettingInterface(QWidget, Ui_Form):
def __init__(self, parent=None):
super().__init__(parent)
self.setupUi(self)
self.HyperlinkLabel.setUrl('https://github.com/Eanya-Tonic/MihiroToolbox')
self.ImageLabel.setPixmap(QPixmap('img/logo.png').scaledToHeight(100))
# 选择主题
conf = configparser.ConfigParser()
conf.read('config.ini')
theme = conf.get('DEFAULT', 'theme')
self.ThemeBox.addItem('跟随系统')
self.ThemeBox.addItem('浅色')
self.ThemeBox.addItem('深色')
self.ThemeBox.setCurrentIndex(int(theme))
self.ThemeBox.currentIndexChanged.connect(self.ThemeBoxChanged)
# 关闭开屏画面
splash = conf.get('DEFAULT', 'splash')
self.LaunchCheck.setChecked(bool(int(splash)))
self.LaunchCheck.clicked.connect(self.LaunchCheckClicked)
# 选择主题
def ThemeBoxChanged(self):
conf = configparser.ConfigParser()
conf.read('config.ini')
conf.set('DEFAULT', 'theme', str(self.ThemeBox.currentIndex()))
conf.write(open('config.ini', 'w'))
InfoBar.info(
title='提示',
content="主题修改重启应用后生效",
orient=Qt.Horizontal,
isClosable=True,
position=InfoBarPosition.BOTTOM_RIGHT,
duration=5000,
parent=self
)
# 关闭开屏画面
def LaunchCheckClicked(self):
conf = configparser.ConfigParser()
conf.read('config.ini')
conf.set('DEFAULT', 'splash', str(int(self.LaunchCheck.isChecked())))
conf.write(open('config.ini', 'w'))