From 7283aba0dd752b32c3304e28e1d2097476722f52 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Tue, 29 Mar 2011 17:49:22 +0900 Subject: [PATCH] tweak shortcuts; remove study/cram buttons from group screen --- aqt/groupman.py | 16 ++++------------ aqt/main.py | 5 +++++ aqt/overview.py | 13 ++----------- designer/main.ui | 36 ++++++++++++++++++++++++++++-------- 4 files changed, 39 insertions(+), 31 deletions(-) diff --git a/aqt/groupman.py b/aqt/groupman.py index e4cf0058a..66d51e7ab 100644 --- a/aqt/groupman.py +++ b/aqt/groupman.py @@ -53,9 +53,6 @@ class GroupManager(QDialog): b = box.addButton(name, type) b.connect(b, SIGNAL("clicked()"), func) return b - # exits - b = button(_("&Study"), self.onStudy, QDialogButtonBox.AcceptRole) - button(_("&Cram"), self.onCram, QDialogButtonBox.AcceptRole) # selection button(_("Select &All"), self.onSelectAll).setShortcut("a") button(_("Select &None"), self.onSelectNone).setShortcut("n") @@ -66,14 +63,6 @@ class GroupManager(QDialog): SIGNAL("helpRequested()"), lambda: aqt.openHelp("GroupManager")) - def onStudy(self): - self.mw.deck.reset() - self.mw.moveToState("review") - - def onCram(self): - self.mw.deck.cramGroups(self.mw.deck.qconf['groups']) - self.mw.moveToState("review") - def onSelectAll(self): for i in self.items: i.setCheckState(COLCHECK, Qt.Checked) @@ -151,7 +140,10 @@ class GroupManager(QDialog): if len(gids) == self.gidCount: # all enabled is same as empty gids = [] - self.mw.deck.qconf['groups'] = gids + if gids != self.mw.deck.qconf['groups']: + self.mw.deck.qconf['groups'] = gids + self.mw.deck.reset() + self.mw.moveToState("review") QDialog.accept(self) def _makeItems(self, grps): diff --git a/aqt/main.py b/aqt/main.py index 8edc47de2..c3001ea7a 100755 --- a/aqt/main.py +++ b/aqt/main.py @@ -642,6 +642,10 @@ Debug info:\n%s""") % traceback.format_exc(), help="DeckErrors") def onOverview(self): self.moveToState("overview") + def onGroups(self): + from aqt.groupman import GroupManager + g = GroupManager(self) + def onCardStats(self): self.cardStats.show() @@ -774,6 +778,7 @@ Please give your deck a name:""")) self.connect(m.actionLocalizeMedia, s, self.onLocalizeMedia) self.connect(m.actionStudyOptions, s, self.onStudyOptions) self.connect(m.actionOverview, s, self.onOverview) + self.connect(m.actionGroups, s, self.onGroups) self.connect(m.actionDonate, s, self.onDonate) self.connect(m.actionBuryFact, s, self.onBuryFact) diff --git a/aqt/overview.py b/aqt/overview.py index e4c589727..0f83c89d2 100644 --- a/aqt/overview.py +++ b/aqt/overview.py @@ -37,8 +37,6 @@ class Overview(object): self._linkHandler("cram") elif txt == "d": self._linkHandler("list") - elif txt == "g": - self._linkHandler("chgrp") else: return return True @@ -49,14 +47,14 @@ class Overview(object): self.mw.deck.reset() self.mw.moveToState("review") elif url == "cram": - self.mw.deck.cramGroups(self.mw.deck.qconf['groups']) + self.mw.deck.cramGroups() self.mw.moveToState("review") elif url == "opts": self.mw.onStudyOptions() elif url == "list": self.mw.close() elif url == "chgrp": - self.changeGroups() + self.mw.onGroups() # HTML ############################################################ @@ -172,10 +170,3 @@ $(function () { if not self.mw.config['showToolbar']: return self.mw.form.toolBar.show() - - # Group changing - ########################################################################## - - def changeGroups(self): - from aqt.groupman import GroupManager - g = GroupManager(self.mw) diff --git a/designer/main.ui b/designer/main.ui index c69cdc7c0..df069839d 100644 --- a/designer/main.ui +++ b/designer/main.ui @@ -121,7 +121,6 @@ - @@ -149,6 +148,7 @@ + @@ -270,7 +270,7 @@ Synchronize with Anki Online - Ctrl+Shift+Y + Ctrl+S @@ -285,7 +285,7 @@ - Ctrl+D + A @@ -300,7 +300,7 @@ - Ctrl+F + B @@ -329,8 +329,8 @@ &Deck Statistics - - Show some textual statistics about your deck + + Shift+D @@ -356,6 +356,9 @@ Show statistics about the current card and last card + + Shift+C + @@ -380,6 +383,9 @@ Import cards into the current deck + + Ctrl+I + @@ -392,6 +398,9 @@ + + Shift+G + @@ -404,6 +413,9 @@ Save cards in a new deck or text file for sharing with others + + Ctrl+T + @@ -522,7 +534,7 @@ - Ctrl+E + E @@ -649,7 +661,7 @@ Card Layout... - F2 + L @@ -669,6 +681,14 @@ O + + + Groups... + + + G + +