Set Web Interface URL from loaded state in Desktop GUIs. Not hard-coded

This commit is contained in:
Debanjum Singh Solanky
2022-08-15 23:07:22 +03:00
parent 7f479b0104
commit 9bc4fd539e
4 changed files with 7 additions and 3 deletions

View File

@@ -134,7 +134,7 @@ class MainWindow(QtWidgets.QMainWindow):
action_bar_layout = QtWidgets.QHBoxLayout(action_bar)
self.configure_button = QtWidgets.QPushButton("Configure", clicked=self.configure_app)
self.search_button = QtWidgets.QPushButton("Search", clicked=lambda: webbrowser.open('http://localhost:8000/'))
self.search_button = QtWidgets.QPushButton("Search", clicked=lambda: webbrowser.open(f'http://{state.host}:{state.port}/'))
self.search_button.setEnabled(not self.first_run)
action_bar_layout.addWidget(self.configure_button)

View File

@@ -5,7 +5,7 @@ import webbrowser
from PyQt6 import QtGui, QtWidgets
# Internal Packages
from src.utils import constants
from src.utils import constants, state
def create_system_tray(gui: QtWidgets.QApplication, main_window: QtWidgets.QMainWindow):
@@ -24,7 +24,7 @@ def create_system_tray(gui: QtWidgets.QApplication, main_window: QtWidgets.QMain
# Create the menu and menu actions
menu = QtWidgets.QMenu()
menu_actions = [
('Search', lambda: webbrowser.open('http://localhost:8000/')),
('Search', lambda: webbrowser.open(f'http://{state.host}:{state.port}/')),
('Configure', main_window.show),
('Quit', gui.quit),
]