Skip to content

Commit 40d1993

Browse files
committed
implemented EditChannelEvent, refactored ChannelEditor widget, bug fixes
1 parent 1615690 commit 40d1993

1 file changed

Lines changed: 62 additions & 0 deletions

File tree

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
from enum import Enum, auto
2+
from pymapmanager.interface.stackWidgets.base.mmWidget2 import mmWidget2, pmmEvent, pmmEventType
3+
4+
from pymapmanager._logger import logger
5+
6+
class ChannelEditType(Enum):
7+
import_new_channel = auto()
8+
delete_channel = auto()
9+
swap_channel = auto()
10+
set_name = auto()
11+
set_color_LUT = auto()
12+
13+
class EditChannelEvent(pmmEvent):
14+
"""Class for all channel edit(s).
15+
16+
Including (import, delete, swap, set name, set color LUT)
17+
"""
18+
def __init__(self, eventType : pmmEventType,
19+
mmWidget : mmWidget2,
20+
editType : ChannelEditType,
21+
srcChannelKey : int = None,
22+
dstChannelKey : int = None,
23+
newName : str = None,
24+
newColorLUT : str = None,
25+
importPath : str = None,
26+
):
27+
super().__init__(eventType, mmWidget)
28+
29+
self._editType = editType
30+
self._srcChannelKey = srcChannelKey
31+
self._dstChannelKey = dstChannelKey
32+
self._newName = newName
33+
self._newColorLUT = newColorLUT
34+
self._importPath = importPath
35+
36+
def getImportPath(self) -> str:
37+
return self._importPath
38+
39+
def getEditType(self) -> ChannelEditType:
40+
return self._editType
41+
42+
def getSrcChannelKey(self) -> int:
43+
return self._srcChannelKey
44+
45+
def getDstChannelKey(self) -> int:
46+
return self._dstChannelKey
47+
48+
def getNewName(self) -> str:
49+
return self._newName
50+
51+
def getNewColorLUT(self) -> str:
52+
return self._newColorLUT
53+
54+
# pretty print __str__
55+
def __str__(self) -> str:
56+
return f"""EditChannelEvent(
57+
srcChannelKey={self._srcChannelKey},
58+
dstChannelKey={self._dstChannelKey}
59+
newName={self._newName}
60+
newColorLUT={self._newColorLUT}
61+
importPath={self._importPath})
62+
"""

0 commit comments

Comments
 (0)