Convert Configure Screen into the Main Application Window

- What
  - Convert the config screen into the main application window
    with configuration as just one of the functionality it provides
  - Rename config screen to main window to match new designation

- Why
  - System Tray isn't available everywhere (e.g Linux)
  - This requires moving functionality into a normal window for cross-compat
This commit is contained in:
Debanjum Singh Solanky
2022-08-13 01:39:46 +03:00
parent a6b2190f7a
commit a0759dd923
3 changed files with 35 additions and 28 deletions

View File

@@ -15,7 +15,7 @@ from src.configure import configure_server
from src.router import router
from src.utils import constants, state
from src.utils.cli import cli
from src.interface.desktop.configure_screen import ConfigureScreen
from src.interface.desktop.main_window import MainWindow
from src.interface.desktop.system_tray import create_system_tray
@@ -38,24 +38,24 @@ def run():
else:
# Setup GUI
gui = QtWidgets.QApplication([])
configure_screen = ConfigureScreen(args.config_file)
main_window = MainWindow(args.config_file)
# System tray is only available on Windows, MacOS.
# On Linux (Gnome) the System tray is not supported.
# Since only the Configure Window is available
# Since only the Main Window is available
# Quitting it should quit the application
if system() in ['Windows', 'Darwin']:
gui.setQuitOnLastWindowClosed(False)
tray = create_system_tray(gui, configure_screen)
tray = create_system_tray(gui, main_window)
tray.show()
# Setup Server
configure_server(args, required=False)
server = ServerThread(app, args.host, args.port, args.socket)
# Show Configure Screen on Linux (etc.) or First Run Experience
# Show Main Window on First Run Experience or if on Linux
if args.config is None or system() not in ['Windows', 'Darwin']:
configure_screen.show()
main_window.show()
# Setup Signal Handlers
signal.signal(signal.SIGINT, sigint_handler)