Skip to content

Commit

Permalink
Fix slow events dialog (#207)
Browse files Browse the repository at this point in the history
* Fix slow events dialog

* Add changelog entry
  • Loading branch information
cbrnr authored Mar 2, 2021
1 parent 82b7475 commit d20722d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
### Fixed
- Remove auto-installation of `PySide2` when using `pip` ([#196](https://github.com/cbrnr/mnelab/pull/196) by [Clemens Brunner](https://github.com/cbrnr))
- Starting MNELAB with the `mnelab` command in a terminal now also works on Windows ([#197](https://github.com/cbrnr/mnelab/pull/197) by [Clemens Brunner](https://github.com/cbrnr))
- Removing annotations is now as fast as it should be ([#206](https://github.com/cbrnr/mnelab/pull/206) by [Clemens Brunner](https://github.com/cbrnr))
- Removing annotations and events is now as fast as it should be ([#206](https://github.com/cbrnr/mnelab/pull/206) and [#207](https://github.com/cbrnr/mnelab/pull/207) by [Clemens Brunner](https://github.com/cbrnr))

### Changed
- Rename `master` branch to `main` ([#193](https://github.com/cbrnr/mnelab/pull/193) by [Clemens Brunner](https://github.com/cbrnr))
Expand Down
6 changes: 4 additions & 2 deletions mnelab/dialogs/eventsdialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,11 @@ def __init__(self, parent, pos, desc):
@Slot()
def toggle_buttons(self):
"""Toggle + and - buttons."""
if len(self.table.selectedItems()) == 2: # one row (2 items) selected
n_items = len(self.table.selectedItems())
if n_items == 2: # one row (2 items) selected
self.add_button.setEnabled(True)
self.remove_button.setEnabled(True)
elif len(self.table.selectedItems()) > 2: # more than one row selected
elif n_items > 2: # more than one row selected
self.add_button.setEnabled(False)
self.remove_button.setEnabled(True)
else: # no rows selected
Expand All @@ -88,5 +89,6 @@ def add_event(self):

def remove_event(self):
rows = {index.row() for index in self.table.selectedIndexes()}
self.table.clearSelection()
for row in sorted(rows, reverse=True):
self.table.removeRow(row)

0 comments on commit d20722d

Please # to comment.