added an icon to the window

This commit is contained in:
Faraphel 2023-12-23 11:30:42 +01:00
parent a114c70e53
commit 0671212a12
3 changed files with 18 additions and 12 deletions

BIN
assets/icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 360 B

View file

@ -10,7 +10,6 @@ from source import assets_path
from source.survey.base import BaseSurvey from source.survey.base import BaseSurvey
from source.widget import Browser from source.widget import Browser
page_success_path: Path = assets_path / "web/success.html" page_success_path: Path = assets_path / "web/success.html"
@ -170,7 +169,12 @@ class WebMission(BaseSurvey):
self.timer_check.stop() self.timer_check.stop()
def _success(self): def _success(self):
if not self._finished: if self._finished:
return
# mark the mission as finished
self._finished = True
# mark the success in the events # mark the success in the events
self._save_event(type="check") self._save_event(type="check")
@ -181,9 +185,6 @@ class WebMission(BaseSurvey):
# change the content of the page to the success message # change the content of the page to the success message
self.browser.web.load(QUrl.fromLocalFile(str(page_success_path.absolute()))) self.browser.web.load(QUrl.fromLocalFile(str(page_success_path.absolute())))
# mark the mission as finished
self._finished = True
# condition # condition
def check(self) -> None: def check(self) -> None:

View file

@ -1,10 +1,15 @@
from PyQt6.QtGui import QIcon
from PyQt6.QtWidgets import QMainWindow from PyQt6.QtWidgets import QMainWindow
from source import widget from source import widget, assets_path
icon_path = assets_path / "icon.png"
class MyMainWindow(QMainWindow): class MyMainWindow(QMainWindow):
def __init__(self): def __init__(self):
super().__init__() super().__init__()
self.setWindowIcon(QIcon(str(icon_path.resolve())))
self.setCentralWidget(widget.FrameSurvey("./surveys.json")) self.setCentralWidget(widget.FrameSurvey("./surveys.json"))