-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathsettingswindow.py
132 lines (115 loc) · 5.98 KB
/
settingswindow.py
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
from PyQt5 import QtCore, QtGui, QtWidgets
from PyQt5.QtWidgets import QDesktopWidget
from functions import *
class Ui_SettingsWindow(object):
def setupUi(self, SettingsWindow):
SettingsWindow.setObjectName("SettingsWindow")
SettingsWindow.resize(600, 320)
SettingsWindow.setMinimumSize(QtCore.QSize(600, 320))
SettingsWindow.setMaximumSize(QtCore.QSize(600, 320))
SettingsWindow.setWindowIcon(QtGui.QIcon('img/icon.png'))
SettingsWindow.setStyleSheet("QMainWindow {\n"
" background-color: white;\n"
"}")
self.SettingsWindow = SettingsWindow
self.centralwidget = QtWidgets.QWidget(SettingsWindow)
self.centralwidget.setStyleSheet(".QPushButton {\n"
" border: 0 solid;\n"
" border-radius: 8px;\n"
" color: white;\n"
" font-size: 13px;\n"
" font-weight: bold;\n"
" \n"
" background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:1, y2:0, stop:0 rgba(178, 99, 252, 255), stop:0.5 rgba(251, 162, 213, 255), stop:1 rgba(182, 242, 221, 255));\n"
"}\n"
".QPushButton:hover {\n"
" font-size: 12px;\n"
"}\n"
".QListWidget {\n"
" background-color: qlineargradient(spread:reflect, x1:0, y1:0, x2:1, y2:1, stop:0 rgba(178, 99, 252, 100), stop:0.5 rgba(251, 162, 213, 100), stop:1 rgba(182, 242, 221, 100));\n"
" border-radius: 8px;\n"
"}\n"
"\n"
".QLabel {\n"
" font-size: 13px;\n"
" background-color: qlineargradient(spread:reflect, x1:0, y1:0, x2:1, y2:1, stop:0 rgba(178, 99, 252, 100), stop:0.5 rgba(251, 162, 213, 100), stop:1 rgba(182, 242, 221, 100));\n"
" border-radius: 8px;\n"
"}\n"
"\n"
".labelPathToSteam {\n"
" padding-left: 12px;\n"
"}\n"
"\n"
".QLineEdit {\n"
" background-color: qlineargradient(spread:reflect, x1:0, y1:0, x2:1, y2:1, stop:0 rgba(178, 99, 252, 100), stop:0.5 rgba(251, 162, 213, 100), stop:1 rgba(182, 242, 221, 100));\n"
" border-radius: 8px;\n"
" padding-left: 12px;\n"
"}")
self.centralwidget.setObjectName("centralwidget")
self.gomainwin = QtWidgets.QPushButton(self.centralwidget)
self.gomainwin.setGeometry(QtCore.QRect(20, 20, 561, 41))
self.gomainwin.setStyleSheet("")
self.gomainwin.setObjectName("gomainwin")
self.linePathToSteam = QtWidgets.QLineEdit(self.centralwidget)
self.linePathToSteam.setGeometry(QtCore.QRect(230, 140, 351, 41))
self.linePathToSteam.setText("")
self.linePathToSteam.setObjectName("linePathToSteam")
self.linePathToCSGO = QtWidgets.QLineEdit(self.centralwidget)
self.linePathToCSGO.setGeometry(QtCore.QRect(230, 80, 351, 41))
self.linePathToCSGO.setText("")
self.linePathToCSGO.setObjectName("linePathToCSGO")
self.labelPathToSteam = QtWidgets.QLabel(self.centralwidget)
self.labelPathToSteam.setGeometry(QtCore.QRect(20, 140, 191, 41))
self.labelPathToSteam.setAlignment(QtCore.Qt.AlignCenter)
self.labelPathToSteam.setObjectName("labelPathToSteam")
self.labelPathToCSGO = QtWidgets.QLabel(self.centralwidget)
self.labelPathToCSGO.setGeometry(QtCore.QRect(20, 80, 191, 41))
self.labelPathToCSGO.setAlignment(QtCore.Qt.AlignCenter)
self.labelPathToCSGO.setObjectName("labelPathToCSGO")
self.addServersButton = QtWidgets.QLabel(self.centralwidget)
self.addServersButton.setGeometry(QtCore.QRect(20, 260, 191, 41))
self.addServersButton.setAlignment(QtCore.Qt.AlignCenter)
self.addServersButton.setObjectName("addServersButton")
self.cfgRedactorButton = QtWidgets.QPushButton(self.centralwidget)
self.cfgRedactorButton.setGeometry(QtCore.QRect(20, 200, 561, 41))
self.cfgRedactorButton.setStyleSheet("")
self.cfgRedactorButton.setObjectName("cfgRedactorButton")
self.serverLabel = QtWidgets.QLineEdit(self.centralwidget)
self.serverLabel.setGeometry(QtCore.QRect(230, 260, 351, 41))
self.serverLabel.setText("")
self.serverLabel.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignVCenter)
self.serverLabel.setObjectName("serverLabel")
SettingsWindow.setCentralWidget(self.centralwidget)
self.retranslateUi(SettingsWindow)
QtCore.QMetaObject.connectSlotsByName(SettingsWindow)
self.goMainF()
self.ChangePath()
self.ExecConfigure()
def retranslateUi(self, SettingsWindow):
_translate = QtCore.QCoreApplication.translate
SettingsWindow.setWindowTitle(_translate("SettingsWindow", "Obl1Que\'s Panel CS:GO"))
self.gomainwin.setText(_translate("SettingsWindow", "СОХРАНИТЬ НАСТРОЙКИ И ВЫЙТИ"))
self.labelPathToSteam.setText(_translate("SettingsWindow", "ПУТЬ ДО STEAM:"))
self.labelPathToCSGO.setText(_translate("SettingsWindow", "ПУТЬ ДО CSGO:"))
self.addServersButton.setText(_translate("SettingsWindow", "ДОБАВИТЬ СЕРВЕР"))
self.cfgRedactorButton.setText(_translate("SettingsWindow", "РЕДАКТИРОВАТЬ ФАЙЛ КОНФИГА"))
def goMainF(self):
self.gomainwin.clicked.connect(lambda: self.goMain())
def goMain(self):
info = readJson("settings/settings.json")
info["steam_path"] = self.linePathToSteam.text()
info["csgo_path"] = self.linePathToCSGO.text()
info["server_log_pass"] = self.serverLabel.text()
file = open("settings/settings.json", "w", encoding="utf-8")
file.write(json.dumps(info, indent=4, ensure_ascii=False))
file.close()
self.SettingsWindow.close()
def ChangePath(self):
self.linePathToSteam.setText(readJson("settings/settings.json")["steam_path"])
self.linePathToCSGO.setText(readJson("settings/settings.json")["csgo_path"])
self.serverLabel.setText(readJson("settings/settings.json")["server_log_pass"])
def ExecConfigure(self):
self.cfgRedactorButton.clicked.connect(lambda: self.ExecConfigureF())
def ExecConfigureF(self):
path_to_cfg = os.path.abspath("settings/qfarm.cfg")
os.system(path_to_cfg)