Skip to content

Commit e3634f9

Browse files
committed
fix bookmarks with curly braces in the text
1 parent cda4118 commit e3634f9

File tree

2 files changed

+17
-25
lines changed

2 files changed

+17
-25
lines changed

src/asammdf/gui/dialogs/advanced_search.py

Lines changed: 16 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -109,13 +109,6 @@ def __iter__(self):
109109

110110

111111
class Model(QtCore.QAbstractItemModel):
112-
NameColumn = 0
113-
GroupColumn = 1
114-
ChannelColumn = 2
115-
UnitColumn = 3
116-
SourceNameColumn = 4
117-
SourcePathColumn = 5
118-
CommentColumn = 6
119112

120113
def __init__(self, *args, **kwargs):
121114
super().__init__(*args, **kwargs)
@@ -228,13 +221,6 @@ def sort(self, column, order=QtCore.Qt.SortOrder.AscendingOrder):
228221

229222

230223
class AdvancedSearch(Ui_SearchDialog, QtWidgets.QDialog):
231-
NameColumn = 0
232-
GroupColumn = 1
233-
ChannelColumn = 2
234-
UnitColumn = 3
235-
SourceNameColumn = 4
236-
SourcePathColumn = 5
237-
CommentColumn = 6
238224

239225
columns = 7
240226

@@ -672,26 +658,31 @@ def section_resized(self, index, old_size, new_size):
672658
def show_overlapping_alias(
673659
self,
674660
):
675-
items = self.matches.selectedItems() or self.selection.selectedItems()
676-
if not items:
661+
indexes = [
662+
*list({index.row(): index for index in self.matches.selectedIndexes() if index.isValid()}.values()),
663+
*list({index.row(): index for index in self.selection.selectedIndexes() if index.isValid()}.values()),
664+
]
665+
if not indexes:
677666
return
678-
else:
679-
item = items[0]
680-
group_index, index = int(item.text(GroupColumn)), int(item.text(ChannelColumn))
667+
668+
for index in indexes:
669+
item = index.internalPointer()
670+
671+
group_index, channel_index = item[GroupColumn], int(item[ChannelColumn])
681672

682673
try:
683-
channel = self.mdf.get_channel_metadata(group=group_index, index=index)
674+
channel = self.mdf.get_channel_metadata(group=group_index, index=channel_index)
684675
info = (channel.data_type, channel.byte_offset, channel.bit_count)
685676
position = (group_index, index)
686677
alias = {}
687-
for gp_index, gp in enumerate(self.mdf.groups):
688-
for ch_index, ch in enumerate(gp.channels):
689-
if (gp_index, ch_index) != position and (ch.data_type, ch.byte_offset, ch.bit_count) == info:
690-
alias[ch.name] = (gp_index, ch_index)
678+
gp = self.mdf.groups[group_index]
679+
for ch_index, ch in enumerate(gp.channels):
680+
if ch_index != channel_index and (ch.data_type, ch.byte_offset, ch.bit_count) == info:
681+
alias[ch.name] = (group_index, ch_index)
691682

692683
if alias:
693684
alias_text = "\n".join(
694-
f"{name} - group {gp_index} index {ch_index}" for name, (gp_index, ch_index) in alias.items()
685+
f"{name} - group {group_index} index {ch_index}" for name, (group_index, ch_index) in alias.items()
695686
)
696687
MessageBox.information(
697688
self,

src/asammdf/gui/widgets/cursor.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ def __init__(self, message="", title="", color="#ffffff", tool="", deleted=False
1616
text = f"{self.title}\nt = {round(kwargs['pos'], 9)}s\n "
1717

1818
text = "\n".join([f" {line} " for line in text.splitlines()])
19+
text=text.replace('{', '{{').replace('}', '}}')
1920

2021
super().__init__(
2122
movable=False,

0 commit comments

Comments
 (0)