refactored , now doesnt load qt shit on windows. check blame for more info
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:
@@ -563,14 +563,12 @@ class CameraDisplay(QLabel):
|
||||
super().__init__(parent)
|
||||
self.setAlignment(Qt.AlignCenter)
|
||||
self.setText("No camera feed")
|
||||
self.setStyleSheet("""
|
||||
QLabel {
|
||||
background-color: #1E1E1E;
|
||||
color: #DDD;
|
||||
border: 2px solid #444;
|
||||
border-radius: 4px;
|
||||
}
|
||||
""")
|
||||
|
||||
self.get_camera_display_style = getpath.resource_path("styling/camera_display.qss")
|
||||
with open(self.get_camera_display_style,"r") as cdst:
|
||||
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.fullscreen_window = None
|
||||
self.cam_id = None
|
||||
@@ -817,14 +815,13 @@ class AboutWindow(QDialog):
|
||||
self.toggle_btn.setText("▶")
|
||||
self.toggle_btn.setCheckable(True)
|
||||
self.toggle_btn.setChecked(False)
|
||||
self.toggle_btn.setStyleSheet("""
|
||||
QToolButton {
|
||||
border: none;
|
||||
background: transparent;
|
||||
font-size: 14px;
|
||||
color: #DDD;
|
||||
}
|
||||
""")
|
||||
toggle_btn_style = getpath.resource_path("styling/togglebtnabout.qss")
|
||||
with open(toggle_btn_style,"r") as tgbstyle:
|
||||
self.toggle_btn.setStyleSheet(tgbstyle.read())
|
||||
|
||||
# Debug shit
|
||||
#print("i did shit")
|
||||
|
||||
self.toggle_btn.toggled.connect(self.toggle_expand)
|
||||
header_layout.addWidget(self.toggle_btn)
|
||||
|
||||
@@ -923,6 +920,12 @@ class AboutWindow(QDialog):
|
||||
info['NumPy'] = np.__version__
|
||||
info['Requests'] = requests.__version__
|
||||
|
||||
# If we are on Linux we display the QTVAR
|
||||
if platform.system() == "Linux":
|
||||
info["XDG_ENVIROMENT_TYPE "] = initQT.getenv(self) # get the stupid env var of qt
|
||||
else:
|
||||
pass
|
||||
|
||||
mem = psutil.virtual_memory()
|
||||
info['MemoryGB'] = mem.total // (1024**3)
|
||||
info['Memory'] = f"{info['MemoryGB']} GB RAM"
|
||||
@@ -945,6 +948,7 @@ class AboutWindow(QDialog):
|
||||
|
||||
|
||||
class NetworkCameraDialog(QDialog):
|
||||
|
||||
def __init__(self, parent=None):
|
||||
super().__init__(parent)
|
||||
self.setWindowTitle("Network Camera Settings")
|
||||
@@ -2035,14 +2039,9 @@ class MainWindow(QMainWindow):
|
||||
# Clear displays
|
||||
for display in self.camera_displays:
|
||||
display.setText("No camera feed")
|
||||
display.setStyleSheet("""
|
||||
QLabel {
|
||||
background-color: #1E1E1E;
|
||||
color: #DDD;
|
||||
border: 2px solid #444;
|
||||
border-radius: 4px;
|
||||
}
|
||||
""")
|
||||
cleardisplaypath = getpath.resource_path("styling/cleardisplay.qss")
|
||||
with open(cleardisplaypath,"r") as cdstyle:
|
||||
display.setStyleSheet(cdstyle.read())
|
||||
|
||||
def update_feeds(self):
|
||||
"""Update the camera feeds in the display"""
|
||||
@@ -2236,7 +2235,12 @@ class initQT():
|
||||
# If the OS is Linux get Qts Session Type
|
||||
if platform.system() == "Linux":
|
||||
self.session_type = os.getenv("XDG_SESSION_TYPE")
|
||||
print(f"got {self.session_type} ")
|
||||
|
||||
# Enable this is stuff is exiting!
|
||||
|
||||
# print(f"got {self.session_type} ")
|
||||
|
||||
return self.session_type
|
||||
else:
|
||||
# If theres no Type then Exit 1
|
||||
print(
|
||||
@@ -2250,7 +2254,10 @@ class initQT():
|
||||
# Set the Session Type to the one it got
|
||||
if self.session_type:
|
||||
os.environ["XDG_SESSION_TYPE"] = self.session_type
|
||||
print(f"set the ENVVAR to {self.session_type}")
|
||||
|
||||
# Enable if stuff is exiting!
|
||||
|
||||
# print(f"set the ENVVAR to {self.session_type}")
|
||||
else:
|
||||
# If this fails then just exit with 1
|
||||
print(
|
||||
@@ -2261,14 +2268,21 @@ class initQT():
|
||||
exit(1)
|
||||
def shutupCV(self):
|
||||
# This needs some fixing as this only works before importing CV2 ; too much refactoring work tho!
|
||||
os.environ["OPENCV_LOG_LEVEL"] = "ERROR"
|
||||
if platform.system() == "Linux":
|
||||
os.environ["OPENCV_LOG_LEVEL"] = "ERROR"
|
||||
else:
|
||||
pass
|
||||
|
||||
if __name__ == "__main__":
|
||||
# Initialize Qt
|
||||
qt = initQT()
|
||||
qt.getenv()
|
||||
qt.setenv()
|
||||
qt.shutupCV()
|
||||
# Initialize Qt if on Linux
|
||||
if platform.system() == "Linux":
|
||||
qt = initQT()
|
||||
qt.getenv()
|
||||
qt.setenv()
|
||||
qt.shutupCV()
|
||||
else:
|
||||
# We do nothing, Windows doesnt need this
|
||||
pass
|
||||
|
||||
app = QApplication(sys.argv)
|
||||
|
||||
|
||||
6
mucapy/styling/camera_display.qss
Normal file
6
mucapy/styling/camera_display.qss
Normal file
@@ -0,0 +1,6 @@
|
||||
QLabel {
|
||||
background-color: #1E1E1E;
|
||||
color: #DDD;
|
||||
border: 2px solid #444;
|
||||
border-radius: 4px;
|
||||
}
|
||||
6
mucapy/styling/cleardisplay.qss
Normal file
6
mucapy/styling/cleardisplay.qss
Normal file
@@ -0,0 +1,6 @@
|
||||
QLabel {
|
||||
background-color: #1E1E1E;
|
||||
color: #DDD;
|
||||
border: 2px solid #444;
|
||||
border-radius: 4px;
|
||||
}
|
||||
6
mucapy/styling/togglebtnabout.qss
Normal file
6
mucapy/styling/togglebtnabout.qss
Normal file
@@ -0,0 +1,6 @@
|
||||
QToolButton {
|
||||
border: none;
|
||||
background: transparent;
|
||||
font-size: 14px;
|
||||
color: #DDD;
|
||||
}
|
||||
Reference in New Issue
Block a user