mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 22:12:21 -04:00
preview support, shortcuts, hide refresh, toggle edit
This commit is contained in:
parent
f77e1ff6fe
commit
38c1f71d5d
5 changed files with 107 additions and 5 deletions
|
@ -126,20 +126,20 @@ class FactEditor(object):
|
|||
self.addPicture = QPushButton(self.widget)
|
||||
self.addPicture.connect(self.addPicture, SIGNAL("clicked()"), self.onAddPicture)
|
||||
self.addPicture.setFocusPolicy(Qt.NoFocus)
|
||||
self.addPicture.setShortcut(_("Ctrl+p"))
|
||||
self.addPicture.setShortcut(_("F2"))
|
||||
self.addPicture.setIcon(QIcon(":/icons/colors.png"))
|
||||
self.addPicture.setEnabled(False)
|
||||
self.addPicture.setToolTip(_("Add a picture (Ctrl+p)"))
|
||||
self.addPicture.setToolTip(_("Add a picture (F2)"))
|
||||
self.iconsBox.addWidget(self.addPicture)
|
||||
self.addPicture.setStyle(self.plastiqueStyle)
|
||||
# sounds
|
||||
self.addSound = QPushButton(self.widget)
|
||||
self.addSound.connect(self.addSound, SIGNAL("clicked()"), self.onAddSound)
|
||||
self.addSound.setFocusPolicy(Qt.NoFocus)
|
||||
self.addSound.setShortcut(_("Ctrl+s"))
|
||||
self.addSound.setShortcut(_("F3"))
|
||||
self.addSound.setEnabled(False)
|
||||
self.addSound.setIcon(QIcon(":/icons/text-speak.png"))
|
||||
self.addSound.setToolTip(_("Add audio (Ctrl+s)"))
|
||||
self.addSound.setToolTip(_("Add audio (F3)"))
|
||||
self.iconsBox.addWidget(self.addSound)
|
||||
self.addSound.setStyle(self.plastiqueStyle)
|
||||
# latex
|
||||
|
@ -175,6 +175,18 @@ class FactEditor(object):
|
|||
self.latexMathEnv.setEnabled(False)
|
||||
self.iconsBox.addWidget(self.latexMathEnv)
|
||||
self.latexMathEnv.setStyle(self.plastiqueStyle)
|
||||
# preview
|
||||
self.preview = QPushButton(self.widget)
|
||||
self.preview.connect(self.preview, SIGNAL("clicked()"),
|
||||
self.onPreview)
|
||||
self.preview.setToolTip(_("Preview (F5)"))
|
||||
self.preview.setShortcut(_("F5"))
|
||||
#self.preview.setIcon(QIcon(":/icons/math_matrix.png"))
|
||||
self.preview.setFocusPolicy(Qt.NoFocus)
|
||||
self.preview.setEnabled(False)
|
||||
self.iconsBox.addWidget(self.preview)
|
||||
self.preview.setStyle(self.plastiqueStyle)
|
||||
|
||||
self.fieldsFrame = None
|
||||
self.widget.setLayout(self.fieldsBox)
|
||||
|
||||
|
@ -369,6 +381,7 @@ class FactEditor(object):
|
|||
self.latex.setEnabled(val)
|
||||
self.latexEqn.setEnabled(val)
|
||||
self.latexMathEnv.setEnabled(val)
|
||||
self.preview.setEnabled(val)
|
||||
|
||||
def disableButtons(self):
|
||||
self.enableButtons(False)
|
||||
|
@ -440,6 +453,10 @@ class FactEditor(object):
|
|||
w.moveCursor(QTextCursor.PreviousCharacter)
|
||||
w.moveCursor(QTextCursor.PreviousCharacter)
|
||||
|
||||
def onPreview(self):
|
||||
print self.deck.previewFact(self.fact)
|
||||
print "preview"
|
||||
|
||||
def fieldsAreBlank(self):
|
||||
for (field, widget) in self.fields.values():
|
||||
value = tidyHTML(unicode(widget.toHtml()))
|
||||
|
|
|
@ -192,6 +192,8 @@ class AnkiQt(QMainWindow):
|
|||
self.showEaseButtons()
|
||||
self.enableCardMenuItems()
|
||||
elif state == "editCurrentFact":
|
||||
if self.lastState == "editCurrentFact":
|
||||
return self.moveToState("saveEdit")
|
||||
self.resetButtons()
|
||||
self.showSaveEditorButton()
|
||||
self.mainWin.mainText.hide()
|
||||
|
@ -810,7 +812,8 @@ To upgrade an old deck, download Anki 0.9.8.7."""))
|
|||
def showSaveEditorButton(self):
|
||||
if self.lastState == self.state:
|
||||
return
|
||||
self.editFactButton = QPushButton(_("Return (Esc)"))
|
||||
self.editFactButton = QPushButton(_("Return"))
|
||||
self.editFactButton.setToolTip("Hit Esc to return to review.")
|
||||
self.editFactButton.setFixedHeight(self.easeButtonHeight)
|
||||
self.editFactButton.setShortcut(_("Esc"))
|
||||
self.editFactButton.setDefault(False)
|
||||
|
|
82
designer/previewcards.ui
Normal file
82
designer/previewcards.ui
Normal file
|
@ -0,0 +1,82 @@
|
|||
<ui version="4.0" >
|
||||
<class>Dialog</class>
|
||||
<widget class="QDialog" name="Dialog" >
|
||||
<property name="geometry" >
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>300</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle" >
|
||||
<string>Preview Cards</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout" >
|
||||
<item>
|
||||
<widget class="QComboBox" name="comboBox" />
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QWebView" name="webView" >
|
||||
<property name="url" >
|
||||
<url>
|
||||
<string>about:blank</string>
|
||||
</url>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox" >
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons" >
|
||||
<set>QDialogButtonBox::Close</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>QWebView</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>QtWebKit/QWebView</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>Dialog</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel" >
|
||||
<x>248</x>
|
||||
<y>254</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel" >
|
||||
<x>157</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>Dialog</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel" >
|
||||
<x>316</x>
|
||||
<y>260</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel" >
|
||||
<x>286</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
BIN
icons/document-preview.png
Normal file
BIN
icons/document-preview.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.9 KiB |
BIN
icons/media-record.png
Normal file
BIN
icons/media-record.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.8 KiB |
Loading…
Reference in a new issue