Skip to content

Commit

Permalink
add ability to open log window
Browse files Browse the repository at this point in the history
  • Loading branch information
lebaston100 committed Jan 2, 2024
1 parent 9066cd7 commit 0991063
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion server/ui/MainWindow.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

import webbrowser
# from PyQt6.QtCore import pyqtSignal as Signal
from email.headerregistry import HeaderRegistry

from PyQt6.QtCore import QSize, Qt
from PyQt6.QtGui import QCloseEvent, QFont
Expand All @@ -24,6 +23,8 @@ def __init__(self, *args, **kwargs) -> None:

self.setupUi()

self._logWindow: ui.LogWindow | None = None

def setupUi(self):
"""Initialize the main UI."""

Expand Down Expand Up @@ -65,6 +66,7 @@ def setupUi(self):
self.bt_openLogWindow.setObjectName("bt_openLogWindow")
self.bt_openLogWindow.setMaximumSize(QSize(60, 16777215))
self.bt_openLogWindow.setText("Log")
self.bt_openLogWindow.clicked.connect(self.handleLogWindowOpen)
self.hl_topBar.addWidget(self.bt_openLogWindow)

# open programm settings button
Expand Down Expand Up @@ -125,6 +127,19 @@ def setupUi(self):
self.theCentralWidet.setLayout(self.selfLayout)
self.setCentralWidget(self.theCentralWidet)

def handleLogWindowOpen(self):
if self._logWindow:
self._logWindow.raise_()
self._logWindow.activateWindow()
else:
self._logWindow = ui.LogWindow(logger)
self._logWindow.destroyed.connect(self.handleLogWindowClose)
self._logWindow.show()

def handleLogWindowClose(self):
if self._logWindow:
self._logWindow = None

# handle the close event for the log window
def closeEvent(self, event: QCloseEvent) -> None:
"""Handle window close event cleanly.
Expand Down

0 comments on commit 0991063

Please sign in to comment.