Skip to content

Commit

Permalink
fix bookmarks toggle button
Browse files Browse the repository at this point in the history
  • Loading branch information
danielhrisca committed Dec 5, 2022
1 parent 5a0254f commit 5df8fb2
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
2 changes: 1 addition & 1 deletion asammdf/gui/widgets/channel_stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class ChannelStats(Ui_ChannelStats, QtWidgets.QWidget):

precision_modified = QtCore.Signal()

def __init__(self, xunit="s", *args, **kwargs):
def __init__(self, xunit="s", precision=6, *args, **kwargs):
super().__init__(*args, **kwargs)

self._settings = QtCore.QSettings()
Expand Down
17 changes: 13 additions & 4 deletions asammdf/gui/widgets/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -1509,6 +1509,7 @@ def __init__(
widget.setLayout(vbox)

self.focused_mode = False
self.show_bookmarks = True

self.splitter = QtWidgets.QSplitter()
self.splitter.addWidget(widget)
Expand Down Expand Up @@ -1776,7 +1777,10 @@ def __init__(

self.splitter.addWidget(self.plot)

self.info = ChannelStats(self.x_unit)
self.info = ChannelStats(
self.x_unit,
precision=self._settings.value("stats_float_precision", 6, type=int),
)
self.info.hide()
self.info.precision_modified.connect(self.info_precision_modified)
self.splitter.addWidget(self.info)
Expand Down Expand Up @@ -2968,10 +2972,15 @@ def keyPressEvent(self, event):

elif key == QtCore.Qt.Key_I and modifiers == QtCore.Qt.AltModifier:

self.show_bookmarks = not self.show_bookmarks
if self.show_bookmarks:
self.bookmark_btn.setFlat(False)
else:
self.bookmark_btn.setFlat(True)

for bookmark in self.plot.bookmarks:
bookmark.visible = not bookmark.visible
bookmark.visible = self.show_bookmarks

self.bookmark_btn.setFlat(not self.bookmark_btn.isFlat())
self.plot.update()

elif key == QtCore.Qt.Key_G and modifiers == QtCore.Qt.ControlModifier:
Expand Down Expand Up @@ -3394,7 +3403,7 @@ def item_to_config(tree, root):
def toggle_bookmarks(self, *args, hide=None):

if hide is not None:
self.bookmark_btn.setFlat(not hide)
self.show_bookmarks = hide

key_event = QtGui.QKeyEvent(
QtCore.QEvent.KeyPress,
Expand Down

0 comments on commit 5df8fb2

Please sign in to comment.