Skip to content

Commit 4d0f9a9

Browse files
committed
unit testing mmMap in core
1 parent 92d9cb5 commit 4d0f9a9

21 files changed

+194
-138
lines changed

src/pymapmanager/annotations/baseAnnotationsCore.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@ def getUserTypeMarkers_mpl():
2828
class AnnotationsCore:
2929
def __init__(self,
3030
timeSeriesCore : TimeSeriesCore, # multi timepoint
31-
timepoint : int = 0,
31+
# timepoint : int = 0,
32+
timepoint,
3233
):
3334
"""
3435
Parameters

src/pymapmanager/interface2/core/scatter_plot_widget.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1250,7 +1250,8 @@ def selectHighlighterPoints(self, rowIndexes : List[int]):
12501250
rowIndexes: indexes of rows that need to be selected within highlighter plot
12511251
"""
12521252
if rowIndexes is None or rowIndexes == []:
1253-
self.myHighlighter._setData([], [])
1253+
if self.myHighlighter is not None:
1254+
self.myHighlighter._setData([], [])
12541255
else:
12551256
columnNameX = self.xPlotWidget.getCurrentStat()
12561257
columnNameY = self.yPlotWidget.getCurrentStat()

src/pymapmanager/interface2/mainMenus.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ def _buildMenus(self, mainMenu, mainWindow):
120120
def _refreshPluginsMenu(self):
121121
"""Build a plugin menu with all available stack and map plugins.
122122
"""
123-
logger.info('re-create plugin menu with available stack and map plugins')
123+
# logger.info('re-create plugin menu with available stack and map plugins')
124124

125125
# start with an empy menu
126126
self.pluginsMenu.clear()
@@ -141,7 +141,7 @@ def _refreshPluginsMenu(self):
141141
_activateStackPlugins = windowType in ['stack', 'stackWithMap']
142142
"""If our front window is a stack widget."""
143143
for pluginName in stackPluginDict.keys():
144-
logger.info(f'pluginName:{pluginName}')
144+
# logger.info(f'pluginName:{pluginName}')
145145
action = QtWidgets.QAction(pluginName, self.getApp(), checkable=True)
146146
action.setEnabled(_activateStackPlugins)
147147
action.triggered.connect(partial(self._onPluginMenuAction, pluginName, 'stack'))

src/pymapmanager/interface2/mapWidgets/mapTableWidget.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,9 @@ def _getToolbar(self) -> QtWidgets.QVBoxLayout:
121121
# aLabel = QtWidgets.QLabel('Link')
122122
# hLayout.addWidget(aLabel)
123123

124-
linkCheckbox = QtWidgets.QCheckBox('Link')
125-
hLayout.addWidget(linkCheckbox)
124+
# abb turn off for single timepoint
125+
# linkCheckbox = QtWidgets.QCheckBox('Link')
126+
# hLayout.addWidget(linkCheckbox)
126127

127128
closeAllButton = QtWidgets.QPushButton('Close All')
128129
hLayout.addWidget(closeAllButton)

src/pymapmanager/interface2/mapWidgets/mapWidget.py

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -393,16 +393,18 @@ def _buildUI(self):
393393
# logger.warning('abb add dendrogram widget back in')
394394
# dendrogramWidget = pmm.interface2.mapWidgets.dendrogramWidget(self)
395395

396-
# to hide form circular imports
397-
from pymapmanager.interface2.mapWidgets.mapDendrogramWidget import MapDendrogramWidget
398-
dendrogramWidget = MapDendrogramWidget(self)
399-
dendrogramWidget.signalOpenRun.connect(self.openStackRun)
400-
401-
# as a dock
402-
# dendrogramWidgetName = dendrogramWidget._widgetName
403-
# dendrogramDock = self._addDockWidget(dendrogramWidget, 'right', '')
404-
# self._widgetDict[dendrogramWidgetName] = dendrogramDock # the dock, not the widget ???
405-
hBoxLayout_main.addWidget(dendrogramWidget)
396+
# to hide from circular imports
397+
# logger.info('turned off dendrogram widget to focus on single timepoints')
398+
if 0:
399+
from pymapmanager.interface2.mapWidgets.mapDendrogramWidget import MapDendrogramWidget
400+
dendrogramWidget = MapDendrogramWidget(self)
401+
dendrogramWidget.signalOpenRun.connect(self.openStackRun)
402+
403+
# as a dock
404+
# dendrogramWidgetName = dendrogramWidget._widgetName
405+
# dendrogramDock = self._addDockWidget(dendrogramWidget, 'right', '')
406+
# self._widgetDict[dendrogramWidgetName] = dendrogramDock # the dock, not the widget ???
407+
hBoxLayout_main.addWidget(dendrogramWidget)
406408

407409
def contextMenu(self):
408410
logger.info('')

src/pymapmanager/interface2/pyMapManagerApp2.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ def openWidgetFromPath(self, path : str) -> Union[stackWidget2, mapWidget]:
262262

263263
numTimepoints = _timeSeriesCore.numSessions
264264

265-
logger.info(f'numtimepoints:{numTimepoints}')
265+
logger.info(f'_timeSeriesCore.numSessions is:{numTimepoints}')
266266

267267
if numTimepoints == 1:
268268
# single timepoint map

src/pymapmanager/interface2/runInterfaceBob.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""Open a stack widget.
22
"""
33

4+
import os
45
import sys
56

67
import mapmanagercore.data
@@ -43,6 +44,22 @@ def run():
4344
# path = getTiffChannel_1()
4445

4546
path = '/Users/cudmore/Desktop/single_timepoint_20250108.mmap'
47+
48+
path = '/Users/cudmore/Desktop/zarrLoader_3.mmap'
49+
50+
path = '/Users/cudmore/Desktop/single_timepoint_20250322.mmap'
51+
52+
path = '/Users/cudmore/Desktop/sample_mmaps/zarLoader2.mmap'
53+
path = '/Users/cudmore/Desktop/sample_mmaps/zarLoader_1.mmap'
54+
# path = '/Users/cudmore/Desktop/sample_mmaps/zarLoader_3.mmap'
55+
56+
if not os.path.isdir(path):
57+
logger.error('did not find folder path')
58+
logger.error(path)
59+
return
60+
61+
# corrupt ???
62+
# path = '/Users/cudmore/Desktop/single_timepoint_20250322.mmap.zip'
4663

4764
app = PyMapManagerApp(sys.argv)
4865
# mw will be map widget if path has multiple timepoints, otherwise mw is a stackwidget2

src/pymapmanager/interface2/stackWidgets/analysisParamWidget2.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,9 @@ def __init__(self, stackWidget: stackWidget2, pmmApp : pyMapManagerApp2 = None):
6060
# self.changedDict = {}
6161
self._buildGUI()
6262

63+
def on_bool_combo_box(self, paramName, value):
64+
logger.warning(f'TODO: paramName:{paramName} value:{value}')
65+
6366
def on_spin_box(self, paramName, value):
6467
"""
6568
When QDoubldeSpinBox accepts None, value is -1e9

src/pymapmanager/interface2/stackWidgets/base/annotationPlotWidget2.py

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -922,9 +922,14 @@ def undoEvent(self, event : UndoEvent):
922922
logger.info(f'event:{event}')
923923

924924
_undoEvent = event.getUndoEvent()
925-
925+
if _undoEvent is None:
926+
return
927+
926928
# logger.info(f'abj _undoEvent: {_undoEvent}')
927929

930+
if _undoEvent is None:
931+
return False
932+
928933
if _undoEvent.category != "Spine":
929934
return
930935

@@ -955,6 +960,9 @@ def redoEvent(self, event : RedoEvent):
955960
# TODO: on undo move, redraw label
956961
_redoEvent = event.getRedoEvent()
957962

963+
if _redoEvent is None:
964+
return False
965+
958966
if _redoEvent.category != "Spine":
959967
return
960968

@@ -1586,6 +1594,9 @@ def undoEvent(self, event : UndoEvent):
15861594
"""
15871595

15881596
# abj: avoiding unnecessary updates, but can remove
1597+
if event.getUndoEvent() is None:
1598+
return
1599+
15891600
if event.getUndoEvent().category != "Segment":
15901601
return
15911602

@@ -1598,7 +1609,9 @@ def undoEvent(self, event : UndoEvent):
15981609
def redoEvent(self, event : RedoEvent):
15991610
"""
16001611
"""
1601-
1612+
if event.getRedoEvent() is None:
1613+
return False
1614+
16021615
if event.getRedoEvent().category != "Segment": # abj
16031616
return
16041617

src/pymapmanager/interface2/stackWidgets/base/mmWidget2.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,10 +259,12 @@ def getFirstPointRoiType(self):
259259
#
260260
def setSegmentSelection(self, items : List[int]):
261261
if items is None:
262-
pass
262+
items = []
263263
elif not isinstance(items, list):
264264
items = [items]
265265

266+
logger.error(f'yyy items:{items}')
267+
266268
for _idx, item in enumerate(items):
267269
items[_idx] = int(item)
268270

0 commit comments

Comments
 (0)