Skip to content

Commit

Permalink
Add (working) note-mode toggle shortcut
Browse files Browse the repository at this point in the history
  • Loading branch information
hssm committed Sep 16, 2018
1 parent cd7eac8 commit 3fa2ed0
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ You can also add these extra columns:

There is now a menu option to **Only show notes**. If you are only interested in editing the content of notes and don't care about the statistics of individual card reviews, you can enable the note browser mode.

When this option is enabled, the browser will show a single row for each note regardless of how many cards a note may have generated. You can use `Ctrl+shift+n` as a shortcut to toggle this option. (Pay attention to the fact that buttons, such as `suspend`, act on cards and not on notes. Therefore, avoid using this button while you use the option to see notes.)
When this option is enabled, the browser will show a single row for each note regardless of how many cards a note may have generated. You can use *Ctrl+Alt+N* as a shortcut to toggle this option. (Pay attention to the fact that buttons, such as «suspend», act on cards and not on notes. Therefore, avoid using this button while you use the option to see notes.)

![Note browser mode](https://raw.github.com/hssm/advanced-browser/master/docs/note_browser_toggle.png)

Expand Down
13 changes: 12 additions & 1 deletion advancedbrowser/advancedbrowser/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,14 @@ def __init__(self, mw):
# and restore constructor.
origInit(self, mw)
Browser.__init__ = origInit



tn = QAction(('- Only show notes -'), self)
tn.setShortcut(QKeySequence("Ctrl+Alt+N"))
self.addAction(tn)
tn.triggered.connect(self.toggleUniqueNote)


# Remove excluded columns after the browser is built. Doing it here
# is mostly a compromise in complexity. The alternative is to
# rewrite the order of the original __init__ method, which is
Expand Down Expand Up @@ -374,6 +381,10 @@ def addToSubgroup(menu, items):
# Add unique note toggle
a = main.addAction("- Only show notes -")
a.setCheckable(True)
# This shortcut has no effect since it's attached to the context menu
# which needs to be open, but the visual indicator is still useful.
# The real shortcut is in init.
a.setShortcut(QKeySequence("Ctrl+Alt+N"))
a.setChecked(mw.col.conf.get("advbrowse_uniqueNote", False))
a.toggled.connect(self.toggleUniqueNote)

Expand Down

0 comments on commit 3fa2ed0

Please # to comment.