Skip to content

Commit

Permalink
move menu to top, move autocomplete button
Browse files Browse the repository at this point in the history
  • Loading branch information
alexrockhill committed Apr 29, 2024
1 parent 41e9a2d commit ead7e47
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 19 deletions.
18 changes: 16 additions & 2 deletions mne_gui_addons/_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
QWidget,
QLineEdit,
QComboBox,
QPushButton,
)

from matplotlib import patheffects
Expand Down Expand Up @@ -220,13 +221,15 @@ def __init__(
self._configure_ui()

def _configure_ui(self):
toolbar = self._configure_toolbar()
bottom_hbox = self._configure_status_bar()

# Put everything together
plot_ch_hbox = QHBoxLayout()
plot_ch_hbox.addLayout(self._plt_grid)

main_vbox = QVBoxLayout()
main_vbox.addLayout(toolbar)
main_vbox.addLayout(plot_ch_hbox)
main_vbox.addLayout(bottom_hbox)

Expand Down Expand Up @@ -480,10 +483,16 @@ def _plot_images(self):
self._draw()
self._renderer._update()

def _configure_status_bar(self, hbox=None):
"""Make a bar at the bottom with information in it."""
def _configure_toolbar(self, hbox=None):
"""Make a bar at the top with tools on it."""
hbox = QHBoxLayout() if hbox is None else hbox

help_button = QPushButton("Help")
help_button.released.connect(self._show_help)
hbox.addWidget(help_button)

hbox.addStretch(6)

self._toggle_show_selector = ComboBox()

# add title, not selectable
Expand Down Expand Up @@ -517,6 +526,11 @@ def _configure_status_bar(self, hbox=None):

self._toggle_show_selector.currentIndexChanged.connect(self._toggle_show)
hbox.addWidget(self._toggle_show_selector)
return hbox

def _configure_status_bar(self, hbox=None):
"""Make a bar at the bottom with information in it."""
hbox = QHBoxLayout() if hbox is None else hbox

self._intensity_label = QLabel("") # update later
hbox.addWidget(self._intensity_label)
Expand Down
21 changes: 11 additions & 10 deletions mne_gui_addons/_ieeg_locate.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,11 +301,10 @@ def _configure_toolbar(self):
"""Make a bar with buttons for user interactions."""
hbox = QHBoxLayout()

help_button = QPushButton("Help")
help_button.released.connect(self._show_help)
hbox.addWidget(help_button)

hbox.addStretch(8)
# add help and show/hide
super(IntracranialElectrodeLocator, self)._configure_toolbar(hbox=hbox)

hbox.addStretch(1)

hbox.addWidget(QLabel("Snap to Center"))
self._snap_button = QPushButton("Off")
Expand All @@ -316,6 +315,12 @@ def _configure_toolbar(self):

hbox.addStretch(1)

self._auto_complete_button = QPushButton("Auto Complete")
self._auto_complete_button.released.connect(self._auto_mark_group)
hbox.addWidget(self._auto_complete_button)

hbox.addStretch(1)

mark_button = QPushButton("Mark")
hbox.addWidget(mark_button)
mark_button.released.connect(self.mark_channel)
Expand Down Expand Up @@ -401,11 +406,7 @@ def make_slider(smin, smax, sval, sfun=None):
def _configure_status_bar(self, hbox=None):
hbox = QHBoxLayout() if hbox is None else hbox

self._auto_complete_button = QPushButton("Auto Complete")
self._auto_complete_button.released.connect(self._auto_mark_group)
hbox.addWidget(self._auto_complete_button)

hbox.addStretch(3)
hbox.addStretch(1)

self._intensity_label = QLabel("") # update later
hbox.addWidget(self._intensity_label)
Expand Down
4 changes: 2 additions & 2 deletions mne_gui_addons/_segment.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,15 +112,15 @@ def __init__(
self.show()

def _configure_ui(self):
# toolbar = self._configure_toolbar()
toolbar = self._configure_toolbar()
slider_bar = self._configure_sliders()
status_bar = self._configure_status_bar()

plot_layout = QHBoxLayout()
plot_layout.addLayout(self._plt_grid)

main_vbox = QVBoxLayout()
# main_vbox.addLayout(toolbar)
main_vbox.addLayout(toolbar)
main_vbox.addLayout(slider_bar)
main_vbox.addLayout(plot_layout)
main_vbox.addLayout(status_bar)
Expand Down
9 changes: 4 additions & 5 deletions mne_gui_addons/_vol_stc.py
Original file line number Diff line number Diff line change
Expand Up @@ -582,11 +582,10 @@ def _configure_toolbar(self):
"""Make a bar with buttons for user interactions."""
hbox = QHBoxLayout()

help_button = QPushButton("Help")
help_button.released.connect(self._show_help)
hbox.addWidget(help_button)

hbox.addStretch(8)
# add help and show/hide
super(VolSourceEstimateViewer, self)._configure_toolbar(hbox=hbox)

hbox.addStretch(1)

if self._data.shape[0] > 1:
self._epoch_selector = QComboBox()
Expand Down

0 comments on commit ead7e47

Please sign in to comment.