Add display environment check and better error handling for GUI startup
This commit is contained in:
1 parent
62174895ff
commit
f89b970c94
1 file changed
+16
-7
+16
-7
@@ -954,14 +954,23 @@ class SystemTrayApp:
|
|||||||
|
|
||||||
def main():
|
def main():
|
||||||
"""Main application entry point"""
|
"""Main application entry point"""
|
||||||
# Set up high DPI scaling
|
try:
|
||||||
QApplication.setHighDpiScaleFactorRoundingPolicy(
|
if not os.environ.get('DISPLAY'):
|
||||||
Qt.HighDpiScaleFactorRoundingPolicy.PassThrough
|
raise Exception("DISPLAY environment variable not set - no graphical display available")
|
||||||
)
|
|
||||||
|
|
||||||
# Create and run application
|
# Set up high DPI scaling
|
||||||
tray_app = SystemTrayApp()
|
QApplication.setHighDpiScaleFactorRoundingPolicy(
|
||||||
sys.exit(tray_app.run())
|
Qt.HighDpiScaleFactorRoundingPolicy.PassThrough
|
||||||
|
)
|
||||||
|
|
||||||
|
# Create and run application
|
||||||
|
tray_app = SystemTrayApp()
|
||||||
|
sys.exit(tray_app.run())
|
||||||
|
except Exception as e:
|
||||||
|
print(f"Failed to start GUI application: {e}")
|
||||||
|
print("Make sure you have a graphical display available (X11/Wayland) and DISPLAY environment variable is set.")
|
||||||
|
print("If running remotely, use X forwarding or a VNC session.")
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
||||||
Reference in new issue
Block a user