From 3fa2ed0942910a530089b939d051d843e4c4be6e Mon Sep 17 00:00:00 2001 From: Houssam Salem Date: Sun, 16 Sep 2018 20:48:18 +1000 Subject: [PATCH] Add (working) note-mode toggle shortcut --- README.md | 2 +- advancedbrowser/advancedbrowser/core.py | 13 ++++++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 37f9290..d833069 100644 --- a/README.md +++ b/README.md @@ -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) diff --git a/advancedbrowser/advancedbrowser/core.py b/advancedbrowser/advancedbrowser/core.py index 5395c46..8163440 100644 --- a/advancedbrowser/advancedbrowser/core.py +++ b/advancedbrowser/advancedbrowser/core.py @@ -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 @@ -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)