Skip to content

Commit 06ace68

Browse files
committed
Use CustomUnitIDColum
1 parent 49b5ae3 commit 06ace68

2 files changed

Lines changed: 2 additions & 13 deletions

File tree

spikeinterface_gui/mergeview.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ def _qt_make_layout(self):
270270

271271
def _qt_refresh(self):
272272
from .myqt import QT
273-
from .utils_qt import CustomItem, CustomItemMergeUnitID
273+
from .utils_qt import CustomItem, CustomItemUnitID
274274

275275
self.table.clear()
276276
self.table.setSortingEnabled(False)
@@ -298,7 +298,7 @@ def _qt_refresh(self):
298298
pix = QT.QPixmap(16, 16)
299299
pix.fill(color)
300300
icon = QT.QIcon(pix)
301-
item = CustomItemMergeUnitID(name)
301+
item = CustomItemUnitID(name)
302302
item.setData(QT.Qt.ItemDataRole.UserRole, unit_id)
303303
item.setFlags(QT.Qt.ItemIsEnabled | QT.Qt.ItemIsSelectable)
304304
self.table.setItem(r, c, item)

spikeinterface_gui/utils_qt.py

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -474,17 +474,6 @@ def __lt__(self, other):
474474
other_ind = self.unit_ids.index(other.text())
475475
return ind < other_ind
476476

477-
class CustomItemMergeUnitID(QT.QTableWidgetItem):
478-
# special case for merge view unit_id columns: sort numerically by the unit_id stored in UserRole
479-
def __lt__(self, other):
480-
self_data = self.data(QT.Qt.ItemDataRole.UserRole)
481-
other_data = other.data(QT.Qt.ItemDataRole.UserRole)
482-
if self_data is not None and other_data is not None:
483-
try:
484-
return float(self_data) < float(other_data)
485-
except (TypeError, ValueError):
486-
pass
487-
return self.text() < other.text()
488477

489478
class OrderableCheckItem(QT.QTableWidgetItem):
490479
# special case for checkbox

0 commit comments

Comments
 (0)