add support for exporting original files, tidy up whitespace

This commit is contained in:
Damien Elmes 2009-07-04 15:18:25 +09:00
parent ed6a16f014
commit 2249f18913
2 changed files with 1249 additions and 1236 deletions

View file

@ -2238,6 +2238,7 @@ it to your friends.
self.connect(m.actionDonate, s, self.onDonate)
self.connect(m.actionRecordNoiseProfile, s, self.onRecordNoiseProfile)
self.connect(m.actionBuryFact, s, self.onBuryFact)
self.connect(m.actionExportOriginalFiles, s, self.onExportOriginal)
def enableDeckMenuItems(self, enabled=True):
"setEnabled deck-related items."
@ -2682,8 +2683,7 @@ Consider backing up your media directory first."""))
help="MediaSupport")
return
ui.utils.showInfo(ngettext("%d missing file found.<br>",
"%d missing files found.<br>",
res[0]) +
"%d missing files found.<br>", res[0]) +
_("%d successfully retrieved.")
% res[1], parent=self)
@ -2696,6 +2696,11 @@ Consider backing up your media directory first."""))
def onUncacheLatex(self):
anki.latex.deleteAllLatexImages(self.deck)
def onExportOriginal(self):
cnt = anki.media.exportOriginalFiles(self.deck)
ui.utils.showInfo(_("%(a)d files exported to %(b)s.originals folder") %
{'a': cnt, 'b': self.deck.name()})
# System specific misc
##########################################################################

View file

@ -1,4 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0" >
<class>MainWindow</class>
<widget class="QMainWindow" name="MainWindow" >
@ -6,12 +5,12 @@
<rect>
<x>0</x>
<y>0</y>
<width>538</width>
<height>537</height>
<width>550</width>
<height>563</height>
</rect>
</property>
<property name="sizePolicy" >
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<sizepolicy vsizetype="Expanding" hsizetype="Expanding" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
@ -25,7 +24,7 @@
</property>
<widget class="QWidget" name="centralwidget" >
<property name="sizePolicy" >
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<sizepolicy vsizetype="Expanding" hsizetype="Expanding" >
<horstretch>1</horstretch>
<verstretch>1</verstretch>
</sizepolicy>
@ -497,7 +496,7 @@
<item row="0" column="0" >
<widget class="QLabel" name="noticeLabel" >
<property name="sizePolicy" >
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<sizepolicy vsizetype="Preferred" hsizetype="Expanding" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
@ -524,7 +523,7 @@
<item row="0" column="1" >
<widget class="QPushButton" name="noticeButton" >
<property name="sizePolicy" >
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<sizepolicy vsizetype="Fixed" hsizetype="Preferred" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
@ -546,7 +545,7 @@
<item>
<widget class="QStackedWidget" name="mainStack" >
<property name="sizePolicy" >
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<sizepolicy vsizetype="Preferred" hsizetype="Expanding" >
<horstretch>0</horstretch>
<verstretch>100</verstretch>
</sizepolicy>
@ -714,7 +713,7 @@
<number>4</number>
</property>
<item>
<widget class="QWidget" name="fieldsArea" native="true"/>
<widget class="QWidget" native="1" name="fieldsArea" />
</item>
<item>
<widget class="QPushButton" name="saveEditorButton" >
@ -847,10 +846,10 @@
</size>
</property>
<property name="toolTip" >
<string>The &lt;b&gt;number of minutes in a session&lt;/b&gt;. When a session is finished, this screen will be shown again, allowing you to start another session. Choose 0 for no limit.</string>
<string>The &lt;b>number of minutes in a session&lt;/b>. When a session is finished, this screen will be shown again, allowing you to start another session. Choose 0 for no limit.</string>
</property>
<property name="text" >
<string>&lt;b&gt;Session limit (minutes):&lt;/b&gt;</string>
<string>&lt;b>Session limit (minutes):&lt;/b></string>
</property>
<property name="margin" >
<number>4</number>
@ -860,7 +859,7 @@
<item row="1" column="1" >
<widget class="QLineEdit" name="minuteLimit" >
<property name="sizePolicy" >
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<sizepolicy vsizetype="Fixed" hsizetype="Expanding" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
@ -882,10 +881,10 @@
</size>
</property>
<property name="toolTip" >
<string>The maximum number of &lt;b&gt;new cards shown per day&lt;/b&gt;. The default is 20, to ensure you don't get overwhelmed with reviews after a few days.</string>
<string>The maximum number of &lt;b>new cards shown per day&lt;/b>. The default is 20, to ensure you don't get overwhelmed with reviews after a few days.</string>
</property>
<property name="text" >
<string>&lt;b&gt;New cards per day:&lt;/b&gt;</string>
<string>&lt;b>New cards per day:&lt;/b></string>
</property>
<property name="margin" >
<number>4</number>
@ -895,7 +894,7 @@
<item row="0" column="1" >
<widget class="QLineEdit" name="newPerDay" >
<property name="sizePolicy" >
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<sizepolicy vsizetype="Fixed" hsizetype="Expanding" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
@ -924,7 +923,7 @@
<item row="2" column="1" >
<widget class="QLineEdit" name="questionLimit" >
<property name="sizePolicy" >
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<sizepolicy vsizetype="Fixed" hsizetype="Expanding" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
@ -940,10 +939,10 @@
<item row="2" column="0" >
<widget class="QLabel" name="label" >
<property name="toolTip" >
<string>The &lt;b&gt;number of questions in a session&lt;/b&gt;. When a session is finished, this screen will be shown again, allowing you to start another session. Choose 0 for no limit.</string>
<string>The &lt;b>number of questions in a session&lt;/b>. When a session is finished, this screen will be shown again, allowing you to start another session. Choose 0 for no limit.</string>
</property>
<property name="text" >
<string>&lt;b&gt;Session limit (questions):</string>
<string>&lt;b>Session limit (questions):</string>
</property>
<property name="margin" >
<number>4</number>
@ -955,7 +954,7 @@
<item>
<layout class="QVBoxLayout" name="verticalLayout_12" >
<item>
<widget class="QWidget" name="optionsBox" native="true">
<widget class="QWidget" native="1" name="optionsBox" >
<layout class="QVBoxLayout" name="verticalLayout_7" >
<property name="spacing" >
<number>10</number>
@ -998,7 +997,7 @@
<item row="0" column="0" >
<widget class="QPushButton" name="startReviewingButton" >
<property name="sizePolicy" >
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<sizepolicy vsizetype="Fixed" hsizetype="Expanding" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
@ -1300,7 +1299,7 @@
<item>
<widget class="QFrame" name="deckBrowserOuterFrame" >
<property name="sizePolicy" >
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
<sizepolicy vsizetype="Expanding" hsizetype="Expanding" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
@ -1326,7 +1325,7 @@
<item>
<widget class="QLabel" name="label_2" >
<property name="text" >
<string>&lt;h1&gt;Decks&lt;/h1&gt;</string>
<string>&lt;h1>Decks&lt;/h1></string>
</property>
</widget>
</item>
@ -1467,7 +1466,7 @@
<item>
<widget class="QStackedWidget" name="buttonStack" >
<property name="sizePolicy" >
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<sizepolicy vsizetype="Preferred" hsizetype="Preferred" >
<horstretch>0</horstretch>
<verstretch>1</verstretch>
</sizepolicy>
@ -1604,7 +1603,7 @@
<item>
<widget class="QPushButton" name="showAnswerButton" >
<property name="sizePolicy" >
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<sizepolicy vsizetype="Fixed" hsizetype="Minimum" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
@ -1811,7 +1810,7 @@
<item>
<widget class="QFrame" name="innerHelpFrame" >
<property name="sizePolicy" >
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<sizepolicy vsizetype="Preferred" hsizetype="Preferred" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
@ -2253,7 +2252,7 @@
<bool>true</bool>
</property>
<property name="sizePolicy" >
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
<sizepolicy vsizetype="Expanding" hsizetype="Preferred" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
@ -2712,8 +2711,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>538</width>
<height>23</height>
<width>550</width>
<height>25</height>
</rect>
</property>
<widget class="QMenu" name="menuHelp" >
@ -2793,6 +2792,7 @@
<addaction name="actionCacheLatex" />
<addaction name="actionUncacheLatex" />
<addaction name="actionDownloadMissingMedia" />
<addaction name="actionExportOriginalFiles" />
<addaction name="separator" />
<addaction name="actionRecordNoiseProfile" />
<addaction name="separator" />
@ -3461,6 +3461,14 @@
<string>Download Missing Media</string>
</property>
</action>
<action name="actionExportOriginalFiles" >
<property name="text" >
<string>Export Original Files</string>
</property>
<property name="statusTip" >
<string>Save media files using original file names</string>
</property>
</action>
</widget>
<tabstops>
<tabstop>newPerDay</tabstop>