Skip to content

Commit

Permalink
set taskmanager in widget initialization
Browse files Browse the repository at this point in the history
  • Loading branch information
gounux committed Jul 21, 2024
1 parent b9314ac commit 9609074
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions qtribu/gui/wdg_qchat.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from datetime import datetime
from functools import partial
from pathlib import Path
from typing import Any
from typing import Any, Optional

# PyQGIS
#
Expand Down Expand Up @@ -31,7 +31,7 @@
class QChatWidget(QgsDockWidget):

connected: bool = False
current_room: str = None
current_room: Optional[str] = None

settings: PlgSettingsStructure
qchat_client = QChatApiClient
Expand All @@ -44,6 +44,7 @@ def __init__(self, iface: QgisInterface, parent: QWidget = None):
"""
super().__init__(parent)
self.iface = iface
self.task_manager = QgsApplication.taskManager()
self.log = PlgLogger().log
self.plg_settings = PlgOptionsManager()
uic.loadUi(Path(__file__).parent / f"{Path(__file__).stem}.ui", self)
Expand Down Expand Up @@ -267,7 +268,7 @@ def on_ws_message_received(self, message: str) -> None:
message = json.loads(message)
if message["message"] == CHEATCODE_DIZZY:
task = DizzyTask("Cheatcode activation", self.iface)
QgsApplication.taskManager().addTask(task)
self.task_manager.addTask(task)
return
self.tw_chat.insertTopLevelItem(
0, self.add_message_to_treeview(self.current_room, message)
Expand Down

0 comments on commit 9609074

Please sign in to comment.