forked from kphanipavan/PredatorNonSense
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathfrontend.py
214 lines (193 loc) · 10.4 KB
/
frontend.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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
# -*- coding: utf-8 -*-
import os
import sys
# Form implementation generated from reading ui file 'dialog.ui'
#
# Created by: PyQt5 UI code generator 5.15.7
#
# 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 PyQt5 import QtCore, QtGui, QtWidgets
def resource_path(relative_path):
""" Get absolute path to resource, works for dev and for PyInstaller """
try:
# PyInstaller creates a temp folder and stores path in _MEIPASS
base_path = sys._MEIPASS
except Exception:
base_path = os.path.abspath(".")
return os.path.join(base_path, relative_path)
class Ui_PredatorSense(object):
def setupUi(self, PredatorSense):
PredatorSense.setObjectName("PredatorSense")
PredatorSense.setWindowModality(QtCore.Qt.NonModal)
PredatorSense.resize(640, 465)
icon = QtGui.QIcon()
icon.addPixmap(QtGui.QPixmap(resource_path("app_icon.ico")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
PredatorSense.setWindowIcon(icon)
self.fan_control_tab = QtWidgets.QTabWidget(PredatorSense)
self.fan_control_tab.setGeometry(QtCore.QRect(0, 0, 641, 481))
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
sizePolicy.setVerticalStretch(0)
sizePolicy.setHeightForWidth(self.fan_control_tab.sizePolicy().hasHeightForWidth())
self.fan_control_tab.setSizePolicy(sizePolicy)
font = QtGui.QFont()
font.setFamily("TT Squares")
self.fan_control_tab.setFont(font)
self.fan_control_tab.setAccessibleName("")
self.fan_control_tab.setObjectName("tabWidget")
self.tab = QtWidgets.QWidget()
self.tab.setObjectName("tab")
self.coolboost_checkbox = QtWidgets.QCheckBox(self.tab)
self.coolboost_checkbox.setGeometry(QtCore.QRect(30, 20, 381, 61))
font = QtGui.QFont()
font.setFamily("TT Squares")
font.setPointSize(30)
font.setBold(True)
font.setWeight(75)
self.coolboost_checkbox.setFont(font)
self.coolboost_checkbox.setCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor))
self.coolboost_checkbox.setObjectName("checkBox")
self.cpu_box = QtWidgets.QGroupBox(self.tab)
self.cpu_box.setGeometry(QtCore.QRect(20, 190, 271, 221))
font = QtGui.QFont()
font.setFamily("TT Squares")
self.cpu_box.setFont(font)
self.cpu_box.setObjectName("groupBox")
self.layoutWidget = QtWidgets.QWidget(self.cpu_box)
self.layoutWidget.setGeometry(QtCore.QRect(30, 40, 109, 151))
self.layoutWidget.setObjectName("layoutWidget")
self.verticalLayout = QtWidgets.QVBoxLayout(self.layoutWidget)
self.verticalLayout.setContentsMargins(0, 0, 0, 0)
self.verticalLayout.setObjectName("verticalLayout")
self.cpu_auto = QtWidgets.QRadioButton(self.layoutWidget)
self.cpu_auto.setChecked(True)
self.cpu_auto.setObjectName("radioButton")
self.verticalLayout.addWidget(self.cpu_auto)
self.cpu_manual = QtWidgets.QRadioButton(self.layoutWidget)
self.cpu_manual.setObjectName("radioButton_2")
self.verticalLayout.addWidget(self.cpu_manual)
self.cpu_turbo = QtWidgets.QRadioButton(self.layoutWidget)
self.cpu_turbo.setObjectName("radioButton_3")
self.verticalLayout.addWidget(self.cpu_turbo)
self.verticalSlider = QtWidgets.QSlider(self.cpu_box)
self.verticalSlider.setEnabled(False)
self.verticalSlider.setGeometry(QtCore.QRect(210, 30, 20, 160))
self.verticalSlider.setCursor(QtGui.QCursor(QtCore.Qt.CrossCursor))
self.verticalSlider.setMaximum(10)
self.verticalSlider.setProperty("value", 3)
self.verticalSlider.setOrientation(QtCore.Qt.Vertical)
self.verticalSlider.setObjectName("verticalSlider")
self.gpu_box = QtWidgets.QGroupBox(self.tab)
self.gpu_box.setGeometry(QtCore.QRect(340, 190, 271, 221))
font = QtGui.QFont()
font.setFamily("TT Squares")
self.gpu_box.setFont(font)
self.gpu_box.setObjectName("groupBox_2")
self.layoutWidget1 = QtWidgets.QWidget(self.gpu_box)
self.layoutWidget1.setGeometry(QtCore.QRect(50, 40, 117, 151))
self.layoutWidget1.setObjectName("layoutWidget1")
self.verticalLayout_2 = QtWidgets.QVBoxLayout(self.layoutWidget1)
self.verticalLayout_2.setContentsMargins(0, 0, 0, 0)
self.verticalLayout_2.setObjectName("verticalLayout_2")
self.gpu_auto = QtWidgets.QRadioButton(self.layoutWidget1)
self.gpu_auto.setChecked(True)
self.gpu_auto.setObjectName("radioButton_4")
self.verticalLayout_2.addWidget(self.gpu_auto)
self.gpu_manual = QtWidgets.QRadioButton(self.layoutWidget1)
self.gpu_manual.setObjectName("radioButton_6")
self.verticalLayout_2.addWidget(self.gpu_manual)
self.gpu_turbo = QtWidgets.QRadioButton(self.layoutWidget1)
self.gpu_turbo.setObjectName("radioButton_5")
self.verticalLayout_2.addWidget(self.gpu_turbo)
self.verticalSlider_2 = QtWidgets.QSlider(self.gpu_box)
self.verticalSlider_2.setEnabled(False)
self.verticalSlider_2.setGeometry(QtCore.QRect(210, 30, 20, 160))
self.verticalSlider_2.setCursor(QtGui.QCursor(QtCore.Qt.CrossCursor))
self.verticalSlider_2.setMaximum(10)
self.verticalSlider_2.setSliderPosition(3)
self.verticalSlider_2.setOrientation(QtCore.Qt.Vertical)
self.verticalSlider_2.setObjectName("verticalSlider_2")
self.global_box = QtWidgets.QGroupBox(self.tab)
self.global_box.setGeometry(QtCore.QRect(20, 90, 591, 80))
font = QtGui.QFont()
font.setFamily("TT Squares")
self.global_box.setFont(font)
self.global_box.setObjectName("groupBox_3")
self.layoutWidget2 = QtWidgets.QWidget(self.global_box)
self.layoutWidget2.setGeometry(QtCore.QRect(30, 30, 511, 36))
self.layoutWidget2.setObjectName("layoutWidget2")
self.horizontalLayout = QtWidgets.QHBoxLayout(self.layoutWidget2)
self.horizontalLayout.setContentsMargins(0, 0, 0, 0)
self.horizontalLayout.setObjectName("horizontalLayout")
self.global_auto = QtWidgets.QRadioButton(self.layoutWidget2)
font = QtGui.QFont()
font.setFamily("TT Squares")
font.setPointSize(15)
self.global_auto.setFont(font)
self.global_auto.setCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor))
self.global_auto.setChecked(True)
self.global_auto.setObjectName("radioButton_7")
self.horizontalLayout.addWidget(self.global_auto)
self.global_turbo = QtWidgets.QRadioButton(self.layoutWidget2)
font = QtGui.QFont()
font.setFamily("TT Squares")
font.setPointSize(15)
self.global_turbo.setFont(font)
self.global_turbo.setCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor))
self.global_turbo.setLayoutDirection(QtCore.Qt.RightToLeft)
self.global_turbo.setObjectName("radioButton_9")
self.horizontalLayout.addWidget(self.global_turbo)
self.exit_button = QtWidgets.QPushButton(self.tab)
self.exit_button.setGeometry(QtCore.QRect(490, 30, 121, 41))
font = QtGui.QFont()
font.setFamily("TT Squares")
font.setPointSize(16)
font.setBold(True)
font.setWeight(75)
self.exit_button.setFont(font)
self.exit_button.setCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor))
self.exit_button.setObjectName("pushButton")
self.fan_control_tab.addTab(self.tab, "")
self.retranslateUi(PredatorSense)
self.fan_control_tab.setCurrentIndex(0)
self.global_turbo.clicked['bool'].connect(self.cpu_turbo.setChecked)
self.global_turbo.clicked['bool'].connect(self.gpu_turbo.setChecked)
self.global_auto.clicked['bool'].connect(self.cpu_auto.setChecked)
self.global_auto.clicked['bool'].connect(self.gpu_auto.setChecked)
self.cpu_manual.toggled['bool'].connect(self.verticalSlider.setEnabled)
self.gpu_manual.toggled['bool'].connect(self.verticalSlider_2.setEnabled)
# Prevents the user from disabling max cpu or gpu fan mode individually when global turbo mode is enabled
self.global_turbo.toggled['bool'].connect(self.cpu_auto.setDisabled)
self.global_turbo.toggled['bool'].connect(self.cpu_manual.setDisabled)
self.global_turbo.toggled['bool'].connect(self.gpu_auto.setDisabled)
self.global_turbo.toggled['bool'].connect(self.gpu_manual.setDisabled)
# A hacky solution: eliminates the need for turbo button to listen to cpu and gpu buttons at the same time
self.cpu_turbo.toggled['bool'].connect(self.gpu_turbo.setDisabled)
self.gpu_turbo.toggled['bool'].connect(self.cpu_turbo.setDisabled)
QtCore.QMetaObject.connectSlotsByName(PredatorSense)
def retranslateUi(self, PredatorSense):
_translate = QtCore.QCoreApplication.translate
# Window title
PredatorSense.setWindowTitle(_translate("PredatorSense", "Predator Sense™"))
# Tab name
self.fan_control_tab.setTabText(self.fan_control_tab.indexOf(self.tab), _translate("PredatorSense", "Fan Control"))
# CoolBoost checkbox
self.coolboost_checkbox.setToolTip(_translate("PredatorSense", "Only Works When In Auto Mode"))
self.coolboost_checkbox.setText(_translate("PredatorSense", "CoolBoost™"))
# Exit button
self.exit_button.setText(_translate("PredatorSense", "Exit"))
# Global box
self.global_box.setTitle(_translate("PredatorSense", "Global"))
self.global_auto.setText(_translate("PredatorSense", "Auto"))
self.global_turbo.setText(_translate("PredatorSense", "Turbo"))
# CPU box
self.cpu_box.setTitle(_translate("PredatorSense", "CPU Fan"))
self.cpu_auto.setText(_translate("PredatorSense", "Auto"))
self.cpu_manual.setText(_translate("PredatorSense", "Manual"))
self.cpu_turbo.setText(_translate("PredatorSense", "Max speed"))
# GPU box
self.gpu_box.setTitle(_translate("PredatorSense", "GPU Fan"))
self.gpu_auto.setText(_translate("PredatorSense", "Auto"))
self.gpu_manual.setText(_translate("PredatorSense", "Manual"))
self.gpu_turbo.setText(_translate("PredatorSense", "Max speed"))