seperate files for the CPU style ; and more error resistant
All checks were successful
Build MuCaPy Executable / build-and-package (push) Successful in 1m42s
All checks were successful
Build MuCaPy Executable / build-and-package (push) Successful in 1m42s
This commit is contained in:
@@ -233,6 +233,7 @@ class CameraThread(QThread):
|
|||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(f"Connection attempt {attempt + 1} failed: {str(e)}")
|
print(f"Connection attempt {attempt + 1} failed: {str(e)}")
|
||||||
|
|
||||||
if self.cap:
|
if self.cap:
|
||||||
self.cap.release()
|
self.cap.release()
|
||||||
self.cap = None
|
self.cap = None
|
||||||
@@ -567,7 +568,6 @@ class CameraDisplay(QLabel):
|
|||||||
self.get_camera_display_style = getpath.resource_path("styling/camera_display.qss")
|
self.get_camera_display_style = getpath.resource_path("styling/camera_display.qss")
|
||||||
with open(self.get_camera_display_style,"r") as cdst:
|
with open(self.get_camera_display_style,"r") as cdst:
|
||||||
self.setStyleSheet(cdst.read())
|
self.setStyleSheet(cdst.read())
|
||||||
# I really dont know what the fuck is going on here. The StyleSheet never actually gets called
|
|
||||||
|
|
||||||
self.setMinimumSize(320, 240)
|
self.setMinimumSize(320, 240)
|
||||||
self.fullscreen_window = None
|
self.fullscreen_window = None
|
||||||
@@ -1470,6 +1470,9 @@ class MainWindow(QMainWindow):
|
|||||||
# Apply saved settings to UI
|
# Apply saved settings to UI
|
||||||
self.apply_saved_settings()
|
self.apply_saved_settings()
|
||||||
|
|
||||||
|
# For the CPU Styling we have another one so we set this here!
|
||||||
|
self.sepstyleing = False
|
||||||
|
|
||||||
def load_saved_settings(self):
|
def load_saved_settings(self):
|
||||||
"""Load saved settings from configuration"""
|
"""Load saved settings from configuration"""
|
||||||
# Load model directory
|
# Load model directory
|
||||||
@@ -2200,19 +2203,61 @@ class MainWindow(QMainWindow):
|
|||||||
for bar in [self.cpu_progress] + self.core_bars:
|
for bar in [self.cpu_progress] + self.core_bars:
|
||||||
value = bar.value()
|
value = bar.value()
|
||||||
if value < 60:
|
if value < 60:
|
||||||
|
# Here we load the Style File if the CPU Load is under 60%
|
||||||
|
if self.sepstyleing == False:
|
||||||
u60 = getpath.resource_path("styling/bar/u60.qss")
|
u60 = getpath.resource_path("styling/bar/u60.qss")
|
||||||
|
try:
|
||||||
with open(u60,"r") as u60_style:
|
with open(u60,"r") as u60_style:
|
||||||
bar.setStyleSheet(u60_style.read())
|
bar.setStyleSheet(u60_style.read())
|
||||||
|
except FileNotFoundError:
|
||||||
|
print("Styling for CPU U60 not found!")
|
||||||
|
exit(1)
|
||||||
|
else:
|
||||||
|
u60seperate = getpath.resource_path("styling/bar/seperate/u60.qss")
|
||||||
|
try:
|
||||||
|
with open(u60seperate,"r") as u60_seperate_styling:
|
||||||
|
bar.setStyleSheet(u60_seperate_styling.read())
|
||||||
|
except FileNotFoundError:
|
||||||
|
print("No Seperate Styling! Generate one!")
|
||||||
|
pass
|
||||||
|
|
||||||
elif value < 85:
|
elif value < 85:
|
||||||
|
# Here we load the Style File if the CPU Load is over 85%
|
||||||
|
if self.sepstyleing == False:
|
||||||
u85 = getpath.resource_path("styling/bar/a85.qss")
|
u85 = getpath.resource_path("styling/bar/a85.qss")
|
||||||
|
try:
|
||||||
with open(u85,"r") as a85_styling:
|
with open(u85,"r") as a85_styling:
|
||||||
bar.setStyleSheet(a85_styling.read())
|
bar.setStyleSheet(a85_styling.read())
|
||||||
|
except FileNotFoundError:
|
||||||
|
print("Styling for CPU u85 not found")
|
||||||
|
exit(1)
|
||||||
|
else:
|
||||||
|
u85sep = getpath.resource_path("styling/bar/seperate/a85.qss")
|
||||||
|
try:
|
||||||
|
with open(u85sep,"r") as u85style_sep:
|
||||||
|
bar.setStyleSheet(u85style_sep.read())
|
||||||
|
except FileNotFoundError:
|
||||||
|
print("No Seperate File Found for U85")
|
||||||
|
pass
|
||||||
|
|
||||||
else:
|
else:
|
||||||
|
# Here we load the Style File if the CPU Load is over 85 or 100 or smth idk
|
||||||
|
if self.sepstyleing == False:
|
||||||
else_file = getpath.resource_path("styling/bar/else.qss")
|
else_file = getpath.resource_path("styling/bar/else.qss")
|
||||||
|
try:
|
||||||
with open(else_file, "r") as else_style:
|
with open(else_file, "r") as else_style:
|
||||||
bar.setStyleSheet(else_style.read())
|
bar.setStyleSheet(else_style.read())
|
||||||
|
except FileNotFoundError:
|
||||||
|
print("No ElseStyling found!")
|
||||||
|
exit(1)
|
||||||
|
else:
|
||||||
|
else_file_seperate = getpath.resource_path("styling/bar/seperate/else.qss")
|
||||||
|
try:
|
||||||
|
with open(else_file_seperate,"r") as efs:
|
||||||
|
bar.setStyleSheet(efs.read())
|
||||||
|
except FileNotFoundError:
|
||||||
|
print("No Sepearte Styling found")
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
def toggle_detection(self):
|
def toggle_detection(self):
|
||||||
@@ -2286,6 +2331,12 @@ if __name__ == "__main__":
|
|||||||
|
|
||||||
app = QApplication(sys.argv)
|
app = QApplication(sys.argv)
|
||||||
|
|
||||||
|
# Here we try to set the AppIcon ; If it isnt find then just pass
|
||||||
|
try:
|
||||||
|
app.setWindowIcon(QIcon(getpath.resource_path("styling/icon.png")))
|
||||||
|
except FileNotFoundError:
|
||||||
|
pass
|
||||||
|
|
||||||
# Set application style to Fusion for better dark mode support
|
# Set application style to Fusion for better dark mode support
|
||||||
app.setStyle("Fusion")
|
app.setStyle("Fusion")
|
||||||
|
|
||||||
|
|||||||
27
mucapy/styling/bar/seperate/a85.qss
Normal file
27
mucapy/styling/bar/seperate/a85.qss
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
QProgressBar {
|
||||||
|
border: 2px solid #550000;
|
||||||
|
border-radius: 50px;
|
||||||
|
background-color: qradialgradient(
|
||||||
|
cx:0.5, cy:0.5,
|
||||||
|
fx:0.5, fy:0.5,
|
||||||
|
radius:1.0,
|
||||||
|
stop:0 #0d0d0d,
|
||||||
|
stop:1 #1a1a1a
|
||||||
|
);
|
||||||
|
text-align: center;
|
||||||
|
color: #cccccc;
|
||||||
|
font-family: "Fira Code", "OCR A Std", monospace;
|
||||||
|
font-style: italic;
|
||||||
|
font-size: 14px;
|
||||||
|
padding: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
QProgressBar::chunk {
|
||||||
|
background: qlineargradient(
|
||||||
|
x1:0, y1:0, x2:1, y2:1,
|
||||||
|
stop:0 #ff0033,
|
||||||
|
stop:1 #ff6666
|
||||||
|
);
|
||||||
|
border-radius: 50px;
|
||||||
|
margin: 1px;
|
||||||
|
}
|
||||||
27
mucapy/styling/bar/seperate/else.qss
Normal file
27
mucapy/styling/bar/seperate/else.qss
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
QProgressBar {
|
||||||
|
border: 2px solid #550000;
|
||||||
|
border-radius: 50px;
|
||||||
|
background-color: qradialgradient(
|
||||||
|
cx:0.5, cy:0.5,
|
||||||
|
fx:0.5, fy:0.5,
|
||||||
|
radius:1.0,
|
||||||
|
stop:0 #0d0d0d,
|
||||||
|
stop:1 #1a1a1a
|
||||||
|
);
|
||||||
|
text-align: center;
|
||||||
|
color: #cccccc;
|
||||||
|
font-family: "Fira Code", "OCR A Std", monospace;
|
||||||
|
font-style: italic;
|
||||||
|
font-size: 14px;
|
||||||
|
padding: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
QProgressBar::chunk {
|
||||||
|
background: qlineargradient(
|
||||||
|
x1:0, y1:0, x2:1, y2:1,
|
||||||
|
stop:0 #ff0033,
|
||||||
|
stop:1 #ff6666
|
||||||
|
);
|
||||||
|
border-radius: 50px;
|
||||||
|
margin: 1px;
|
||||||
|
}
|
||||||
27
mucapy/styling/bar/seperate/u60.qss
Normal file
27
mucapy/styling/bar/seperate/u60.qss
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
QProgressBar {
|
||||||
|
border: 2px solid #550000;
|
||||||
|
border-radius: 50px;
|
||||||
|
background-color: qradialgradient(
|
||||||
|
cx:0.5, cy:0.5,
|
||||||
|
fx:0.5, fy:0.5,
|
||||||
|
radius:1.0,
|
||||||
|
stop:0 #0d0d0d,
|
||||||
|
stop:1 #1a1a1a
|
||||||
|
);
|
||||||
|
text-align: center;
|
||||||
|
color: #cccccc;
|
||||||
|
font-family: "Fira Code", "OCR A Std", monospace;
|
||||||
|
font-style: italic;
|
||||||
|
font-size: 14px;
|
||||||
|
padding: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
QProgressBar::chunk {
|
||||||
|
background: qlineargradient(
|
||||||
|
x1:0, y1:0, x2:1, y2:1,
|
||||||
|
stop:0 #ff0033,
|
||||||
|
stop:1 #ff6666
|
||||||
|
);
|
||||||
|
border-radius: 50px;
|
||||||
|
margin: 1px;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user