Skip to content

Commit acac30e

Browse files
committed
debuggin channeleditor2 depreciated channeleditor
1 parent 40d1993 commit acac30e

File tree

4 files changed

+22
-8
lines changed

4 files changed

+22
-8
lines changed

src/pymapmanager/interface/stackWidgets/event/channelEvent.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
class ChannelEditType(Enum):
77
import_new_channel = auto()
88
delete_channel = auto()
9-
swap_channel = auto()
9+
move_channel = auto() # abb 202508 replacing swap_channel
1010
set_name = auto()
11-
set_color_LUT = auto()
11+
set_channel_color = auto()
1212

1313
class EditChannelEvent(pmmEvent):
1414
"""Class for all channel edit(s).

src/pymapmanager/interface/stackWidgets/imagePlotWidget2.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -560,7 +560,6 @@ def _setColorLut(self, update=False):
560560
"""
561561
# rgb uses its own (r,g,b) LUT
562562
if not self._channelIsRGB():
563-
logger.warning("TODO: add color str like ('red', 'green' 'blue')")
564563
colorStr = self._myStack.getChannelColor(self._displayThisChannelIdx) # like 'r',
565564
logger.info(f"colorStr is {colorStr}")
566565
if colorStr == 'red':

src/pymapmanager/interface/stackWidgets/stackWidget.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1380,9 +1380,9 @@ def editChannelEvent(self, event : EditChannelEvent):
13801380
_pmmEvent.setColorChannel(firstChannelKey)
13811381
self.emitEvent(_pmmEvent)
13821382

1383-
elif editType == ChannelEditType.swap_channel:
1383+
elif editType == ChannelEditType.move_channel:
13841384
# self.swapChannels(event.getSrcChannelKey(), event.getDstChannelKey())
1385-
self.getStack().swapChannels(event.getSrcChannelKey(), event.getDstChannelKey())
1385+
self.getStack().moveChannel(event.getSrcChannelKey(), event.getDstChannelKey())
13861386

13871387
self._topToolbar._setStack(theStack=self._stack)
13881388

@@ -1394,9 +1394,9 @@ def editChannelEvent(self, event : EditChannelEvent):
13941394
elif editType == ChannelEditType.set_name:
13951395
self.updateChannelName(event.getNewName(), event.getSrcChannelKey())
13961396

1397-
elif editType == ChannelEditType.set_color_LUT:
1397+
elif editType == ChannelEditType.set_channel_color:
13981398
# self.setChannelProperty(event.getSrcChannelKey(), 'colorLUT', event.getNewColorLUT())
1399-
logger.info(f'set_color_LUT channelkey:{event.getSrcChannelKey()} newcolor:{event.getNewColorLUT()}')
1399+
logger.info(f'set_channel_color channelkey:{event.getSrcChannelKey()} newcolor:{event.getNewColorLUT()}')
14001400
self._stack.setChannelProperty(event.getSrcChannelKey(),
14011401
# 'colorLUT',
14021402
'color',

src/pymapmanager/stack.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ def deleteChannel(self, channelIdx: int) -> bool:
8484

8585
return _deleted
8686

87-
def swapChannels(self, srcChannel: int, destChannel: int):
87+
def _old_swapChannels(self, srcChannel: int, destChannel: int):
8888
"""Swap two channels in the stack.
8989
9090
Parameters
@@ -99,6 +99,21 @@ def swapChannels(self, srcChannel: int, destChannel: int):
9999
_swapped = self.getMetadata().swapChannels(srcChannel, destChannel)
100100
logger.info(f' swapped channels: {srcChannel} and {destChannel} result: {_swapped}')
101101

102+
def moveChannel(self, srcChannel: int, destChannel: int | None):
103+
"""Move a channel to a new posiiton
104+
105+
Parameters
106+
----------
107+
srcChannel : int
108+
Source channel index, one based.
109+
destChannel : int | None
110+
Destination channel index, one based. If None, move to the end of the list.
111+
"""
112+
logger.info(f"moving channels {srcChannel} to before {destChannel} if destChannel is None then move to end of list")
113+
# self._fullMap.swapChannels(self.timepoint, srcChannel, destChannel)
114+
_moved = self.getMetadata().moveMetadataItem(srcChannel, destChannel)
115+
logger.info(f' moved channels: {srcChannel} and {destChannel} result: {_moved}')
116+
102117
def updateChannelName(self, channelIdx: int, newChannelName: str):
103118
"""Update the name of a channel in the stack.
104119

0 commit comments

Comments
 (0)