fix shortcut keys for mac, update help, change some shortcuts

This commit is contained in:
Damien Elmes 2008-11-14 15:46:41 +09:00
parent 340a521f2f
commit afd03844e2
3 changed files with 7 additions and 13 deletions

View file

@ -43,7 +43,7 @@ class AddCards(QDialog):
self.dialog.modelArea.setLayout(self.modelChooser) self.dialog.modelArea.setLayout(self.modelChooser)
def helpRequested(self): def helpRequested(self):
QDesktopServices.openUrl(QUrl(ankiqt.appWiki + "AddFacts")) QDesktopServices.openUrl(QUrl(ankiqt.appWiki + "AddItems"))
def addButtons(self): def addButtons(self):
self.addButton = QPushButton(_("&Add")) self.addButton = QPushButton(_("&Add"))
@ -53,8 +53,6 @@ class AddCards(QDialog):
self.addButton.setDefault(True) self.addButton.setDefault(True)
s = QShortcut(QKeySequence(_("Ctrl+Enter")), self) s = QShortcut(QKeySequence(_("Ctrl+Enter")), self)
s.connect(s, SIGNAL("activated()"), self.addButton, SLOT("click()")) s.connect(s, SIGNAL("activated()"), self.addButton, SLOT("click()"))
s = QShortcut(QKeySequence(_("Alt+A")), self)
s.connect(s, SIGNAL("activated()"), self.addButton, SLOT("click()"))
self.connect(self.addButton, SIGNAL("clicked()"), self.addCards) self.connect(self.addButton, SIGNAL("clicked()"), self.addCards)
self.closeButton = QPushButton(_("Close")) self.closeButton = QPushButton(_("Close"))
self.dialog.buttonBox.addButton(self.closeButton, self.dialog.buttonBox.addButton(self.closeButton,

View file

@ -550,8 +550,7 @@ class AnkiQt(QMainWindow):
n = 1 n = 1
for file in self.config['recentDeckPaths']: for file in self.config['recentDeckPaths']:
a = QAction(self) a = QAction(self)
if not sys.platform.startswith("darwin"): a.setShortcut(_("Ctrl+%d" % n))
a.setShortcut(_("Alt+%d" % n))
a.setText(os.path.basename(file)) a.setText(os.path.basename(file))
a.setStatusTip(os.path.abspath(file)) a.setStatusTip(os.path.abspath(file))
self.connect(a, SIGNAL("triggered()"), self.connect(a, SIGNAL("triggered()"),

View file

@ -20,10 +20,10 @@ class ModelChooser(QHBoxLayout):
self.setMargin(0) self.setMargin(0)
self.setSpacing(6) self.setSpacing(6)
self.shortcuts = [] self.shortcuts = []
label = QLabel(_("<b><u>M</u>odel</b>:")) label = QLabel(_("<b>Model</b>:"))
self.addWidget(label) self.addWidget(label)
self.models = QComboBox() self.models = QComboBox()
s = QShortcut(QKeySequence(_("Alt+M")), self.parent) s = QShortcut(QKeySequence(_("Ctrl+Alt+m")), self.parent)
s.connect(s, SIGNAL("activated()"), s.connect(s, SIGNAL("activated()"),
lambda: self.models.showPopup()) lambda: self.models.showPopup())
self.drawModels() self.drawModels()
@ -40,7 +40,7 @@ class ModelChooser(QHBoxLayout):
self.connect(self.add, SIGNAL("clicked()"), self.onAdd) self.connect(self.add, SIGNAL("clicked()"), self.onAdd)
self.edit = QPushButton() self.edit = QPushButton()
self.edit.setIcon(QIcon(":/icons/edit.png")) self.edit.setIcon(QIcon(":/icons/edit.png"))
self.edit.setShortcut(_("Alt+E")) self.edit.setShortcut(_("Ctrl+Alt+e"))
self.edit.setToolTip(_("Edit the current model")) self.edit.setToolTip(_("Edit the current model"))
self.edit.setAutoDefault(False) self.edit.setAutoDefault(False)
self.addWidget(self.edit) self.addWidget(self.edit)
@ -49,13 +49,10 @@ class ModelChooser(QHBoxLayout):
self.handleCards = False self.handleCards = False
if cards: if cards:
self.handleCards = True self.handleCards = True
label = QLabel(_("<b><u>C</u>ards</b>:")) label = QLabel(_("<b>Cards</b>:"))
self.addWidget(label) self.addWidget(label)
self.cards = QPushButton() self.cards = QPushButton()
self.connect(self.cards, SIGNAL("clicked()"), self.onCardChange) self.connect(self.cards, SIGNAL("clicked()"), self.onCardChange)
s = QShortcut(QKeySequence(_("Alt+C")), self.parent)
s.connect(s, SIGNAL("activated()"),
self.onCardChange)
self.addWidget(self.cards) self.addWidget(self.cards)
self.drawCardModels() self.drawCardModels()
@ -118,7 +115,7 @@ class ModelChooser(QHBoxLayout):
self.cards.setText(txt) self.cards.setText(txt)
n = 1 n = 1
for c in m.cardModels: for c in m.cardModels:
s = QShortcut(QKeySequence("Alt+%d" % n), self.parent) s = QShortcut(QKeySequence("Ctrl+%d" % n), self.parent)
self.parent.connect(s, SIGNAL("activated()"), self.parent.connect(s, SIGNAL("activated()"),
lambda c=c: self.toggleCard(c)) lambda c=c: self.toggleCard(c))
self.shortcuts.append(s) self.shortcuts.append(s)