added an icon to the window
This commit is contained in:
parent
a114c70e53
commit
0671212a12
3 changed files with 18 additions and 12 deletions
BIN
assets/icon.png
Normal file
BIN
assets/icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 360 B |
|
@ -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,20 +169,22 @@ class WebMission(BaseSurvey):
|
||||||
self.timer_check.stop()
|
self.timer_check.stop()
|
||||||
|
|
||||||
def _success(self):
|
def _success(self):
|
||||||
if not self._finished:
|
if self._finished:
|
||||||
# mark the success in the events
|
return
|
||||||
self._save_event(type="check")
|
|
||||||
|
|
||||||
# emit on the success signal
|
|
||||||
if "success" in self.signals:
|
|
||||||
self.signals["success"].emit() # NOQA: emit exist
|
|
||||||
|
|
||||||
# change the content of the page to the success message
|
|
||||||
self.browser.web.load(QUrl.fromLocalFile(str(page_success_path.absolute())))
|
|
||||||
|
|
||||||
# mark the mission as finished
|
# mark the mission as finished
|
||||||
self._finished = True
|
self._finished = True
|
||||||
|
|
||||||
|
# mark the success in the events
|
||||||
|
self._save_event(type="check")
|
||||||
|
|
||||||
|
# emit on the success signal
|
||||||
|
if "success" in self.signals:
|
||||||
|
self.signals["success"].emit() # NOQA: emit exist
|
||||||
|
|
||||||
|
# change the content of the page to the success message
|
||||||
|
self.browser.web.load(QUrl.fromLocalFile(str(page_success_path.absolute())))
|
||||||
|
|
||||||
# condition
|
# condition
|
||||||
|
|
||||||
def check(self) -> None:
|
def check(self) -> None:
|
||||||
|
|
|
@ -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"))
|
||||||
|
|
Loading…
Reference in a new issue