trigger on key release instead of press; add overview action+shortcut

This commit is contained in:
Damien Elmes 2011-03-28 10:20:27 +09:00
parent a036b97a68
commit 363571cc94
4 changed files with 48 additions and 17 deletions

View file

@ -527,7 +527,7 @@ Debug info:\n%s""") % traceback.format_exc(), help="DeckErrors")
tb.addAction(frm.actionEditCurrent) tb.addAction(frm.actionEditCurrent)
tb.addAction(frm.actionEditLayout) tb.addAction(frm.actionEditLayout)
tb.addAction(frm.actionEditdeck) tb.addAction(frm.actionEditdeck)
tb.addAction(frm.actionStudyOptions) tb.addAction(frm.actionOverview)
tb.addAction(frm.actionGraphs) tb.addAction(frm.actionGraphs)
tb.addAction(frm.actionMarkCard) tb.addAction(frm.actionMarkCard)
tb.addAction(frm.actionRepeatAudio) tb.addAction(frm.actionRepeatAudio)
@ -650,6 +650,9 @@ Debug info:\n%s""") % traceback.format_exc(), help="DeckErrors")
def onStudyOptions(self): def onStudyOptions(self):
aqt.studyopts.StudyOptions(self) aqt.studyopts.StudyOptions(self)
def onOverview(self):
self.moveToState("overview")
def onCardStats(self): def onCardStats(self):
self.cardStats.show() self.cardStats.show()
@ -744,6 +747,7 @@ Please give your deck a name:"""))
"Dstats", "Dstats",
"Cstats", "Cstats",
"StudyOptions", "StudyOptions",
"Overview",
) )
deckRelatedMenus = ( deckRelatedMenus = (
@ -787,6 +791,7 @@ Please give your deck a name:"""))
self.connect(m.actionDownloadMissingMedia, s, self.onDownloadMissingMedia) self.connect(m.actionDownloadMissingMedia, s, self.onDownloadMissingMedia)
self.connect(m.actionLocalizeMedia, s, self.onLocalizeMedia) self.connect(m.actionLocalizeMedia, s, self.onLocalizeMedia)
self.connect(m.actionStudyOptions, s, self.onStudyOptions) self.connect(m.actionStudyOptions, s, self.onStudyOptions)
self.connect(m.actionOverview, s, self.onOverview)
self.connect(m.actionDonate, s, self.onDonate) self.connect(m.actionDonate, s, self.onDonate)
self.connect(m.actionBuryFact, s, self.onBuryFact) self.connect(m.actionBuryFact, s, self.onBuryFact)

View file

@ -53,7 +53,7 @@ class AnkiWebView(QWebView):
self.setKeyHandler() self.setKeyHandler()
self.connect(self, SIGNAL("linkClicked(QUrl)"), self._linkHandler) self.connect(self, SIGNAL("linkClicked(QUrl)"), self._linkHandler)
self.connect(self, SIGNAL("loadFinished(bool)"), self._loadFinished) self.connect(self, SIGNAL("loadFinished(bool)"), self._loadFinished)
def keyPressEvent(self, evt): def keyReleaseEvent(self, evt):
if evt.matches(QKeySequence.Copy): if evt.matches(QKeySequence.Copy):
self.triggerPageAction(QWebPage.Copy) self.triggerPageAction(QWebPage.Copy)
evt.accept() evt.accept()

View file

@ -40,7 +40,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>412</width> <width>412</width>
<height>20</height> <height>22</height>
</rect> </rect>
</property> </property>
<widget class="QMenu" name="menuHelp"> <widget class="QMenu" name="menuHelp">
@ -149,6 +149,7 @@
<addaction name="menuStartup"/> <addaction name="menuStartup"/>
<addaction name="separator"/> <addaction name="separator"/>
</widget> </widget>
<addaction name="actionOverview"/>
<addaction name="actionStudyOptions"/> <addaction name="actionStudyOptions"/>
<addaction name="actionDeckProperties"/> <addaction name="actionDeckProperties"/>
<addaction name="separator"/> <addaction name="separator"/>
@ -550,10 +551,6 @@
</property> </property>
</action> </action>
<action name="actionStudyOptions"> <action name="actionStudyOptions">
<property name="icon">
<iconset resource="icons.qrc">
<normaloff>:/icons/chronometer.png</normaloff>:/icons/chronometer.png</iconset>
</property>
<property name="text"> <property name="text">
<string>&amp;Study Options...</string> <string>&amp;Study Options...</string>
</property> </property>
@ -670,6 +667,18 @@
<string>Localize Media</string> <string>Localize Media</string>
</property> </property>
</action> </action>
<action name="actionOverview">
<property name="icon">
<iconset resource="icons.qrc">
<normaloff>:/icons/chronometer.png</normaloff>:/icons/chronometer.png</iconset>
</property>
<property name="text">
<string>&amp;Overview...</string>
</property>
<property name="shortcut">
<string>O</string>
</property>
</action>
</widget> </widget>
<resources> <resources>
<include location="icons.qrc"/> <include location="icons.qrc"/>

View file

@ -6,14 +6,14 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>435</width> <width>390</width>
<height>334</height> <height>334</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
<string>Dialog</string> <string>Dialog</string>
</property> </property>
<layout class="QHBoxLayout" name="horizontalLayout"> <layout class="QHBoxLayout" name="horizontalLayout" stretch="1,0">
<item> <item>
<layout class="QVBoxLayout" name="verticalLayout"> <layout class="QVBoxLayout" name="verticalLayout">
<item> <item>
@ -145,14 +145,31 @@
</layout> </layout>
</item> </item>
<item> <item>
<widget class="QDialogButtonBox" name="buttonBox"> <layout class="QVBoxLayout" name="verticalLayout_2" stretch="0,0">
<property name="orientation"> <item>
<enum>Qt::Vertical</enum> <widget class="QDialogButtonBox" name="buttonBox">
</property> <property name="orientation">
<property name="standardButtons"> <enum>Qt::Vertical</enum>
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Help|QDialogButtonBox::Ok</set> </property>
</property> <property name="standardButtons">
</widget> <set>QDialogButtonBox::Cancel|QDialogButtonBox::Help|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</item> </item>
</layout> </layout>
</widget> </widget>