blob: 6aedb95bc355197b84e81840563fdb656de97d89 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
from PyQt5 import QtCore
from model.task import TaskForm
class TaskFormEdition:
def __init__(self, name, name_signal, tag, tag_signal):
self._name = name
self._tag = tag
self._signal = TaskFormSignal()
name_signal.connect(lambda name: self.on_name_signal(name))
tag_signal.connect(lambda tag: self.on_tag_signal(tag))
def get(self):
return TaskForm(
name = self._name,
tag = self._tag)
def on_name_signal(self, name: str):
self._name = name
self._signal.emit(self.get())
def on_tag_signal(self, tag: str):
self._tag = tag
self._signal.emit(self.get())
def signal(self):
return self._signal
class TaskFormSignal(QtCore.QObject):
_signal = QtCore.pyqtSignal(TaskForm, name = 'taskForm')
def __init__(self):
QtCore.QObject.__init__(self)
def emit(self, taskForm):
self._signal.emit(taskForm)
def connect(self, f):
self._signal.connect(f)
|