mirror of
https://github.com/ankitects/anki.git
synced 2025-09-19 14:32:22 -04:00
show editable deck in import dialog; bump version
This commit is contained in:
parent
07d0d1ef80
commit
3d50abecf9
5 changed files with 54 additions and 145 deletions
|
@ -4,7 +4,7 @@
|
||||||
import os, sys
|
import os, sys
|
||||||
from aqt.qt import *
|
from aqt.qt import *
|
||||||
|
|
||||||
appVersion="2.0-alpha7"
|
appVersion="2.0-alpha8"
|
||||||
appWebsite="http://ankisrs.net/"
|
appWebsite="http://ankisrs.net/"
|
||||||
appHelpSite="http://ankisrs.net/docs/dev/manual.html"
|
appHelpSite="http://ankisrs.net/docs/dev/manual.html"
|
||||||
appChanges="http://ankisrs.net/docs/dev/changes.html"
|
appChanges="http://ankisrs.net/docs/dev/changes.html"
|
||||||
|
|
|
@ -62,6 +62,10 @@ class ImportDialog(QDialog):
|
||||||
self.importer = importer
|
self.importer = importer
|
||||||
self.frm = aqt.forms.importing.Ui_ImportDialog()
|
self.frm = aqt.forms.importing.Ui_ImportDialog()
|
||||||
self.frm.setupUi(self)
|
self.frm.setupUi(self)
|
||||||
|
from aqt.tagedit import TagEdit
|
||||||
|
self.deck = TagEdit(self, type=1)
|
||||||
|
self.frm.gridLayout_2.addWidget(self.deck, 1, 1)
|
||||||
|
self.deck.setCol(self.mw.col)
|
||||||
self.connect(self.frm.buttonBox.button(QDialogButtonBox.Help),
|
self.connect(self.frm.buttonBox.button(QDialogButtonBox.Help),
|
||||||
SIGNAL("clicked()"), self.helpRequested)
|
SIGNAL("clicked()"), self.helpRequested)
|
||||||
self.setupMappingFrame()
|
self.setupMappingFrame()
|
||||||
|
@ -77,15 +81,16 @@ class ImportDialog(QDialog):
|
||||||
def setupOptions(self):
|
def setupOptions(self):
|
||||||
self.model = self.mw.col.models.current()
|
self.model = self.mw.col.models.current()
|
||||||
self.modelChooser = aqt.modelchooser.ModelChooser(
|
self.modelChooser = aqt.modelchooser.ModelChooser(
|
||||||
self.mw, self.frm.modelArea)
|
self.mw, self.frm.modelArea, label=False)
|
||||||
self.connect(self.frm.importButton, SIGNAL("clicked()"),
|
self.connect(self.frm.importButton, SIGNAL("clicked()"),
|
||||||
self.doImport)
|
self.doImport)
|
||||||
|
|
||||||
def modelChanged(self):
|
def modelChanged(self):
|
||||||
print "model changed"
|
|
||||||
self.importer.model = self.mw.col.models.current()
|
self.importer.model = self.mw.col.models.current()
|
||||||
self.importer.initMapping()
|
self.importer.initMapping()
|
||||||
self.showMapping()
|
self.showMapping()
|
||||||
|
self.deck.setText(self.mw.col.decks.name(
|
||||||
|
self.importer.model['did']))
|
||||||
|
|
||||||
def onDelimiter(self):
|
def onDelimiter(self):
|
||||||
str = getOnlyText(_("""\
|
str = getOnlyText(_("""\
|
||||||
|
@ -128,6 +133,13 @@ you can enter it here. Use \\t to represent tab."""),
|
||||||
|
|
||||||
def doImport(self, update=False):
|
def doImport(self, update=False):
|
||||||
t = time.time()
|
t = time.time()
|
||||||
|
deck = self.deck.text().strip()
|
||||||
|
if not deck:
|
||||||
|
deck = _("Default")
|
||||||
|
did = self.mw.col.decks.id(deck)
|
||||||
|
if did != self.importer.model['did']:
|
||||||
|
self.importer.model['did'] = did
|
||||||
|
self.mw.col.models.save(self.importer.model)
|
||||||
self.importer.mapping = self.mapping
|
self.importer.mapping = self.mapping
|
||||||
self.mw.progress.start(immediate=True)
|
self.mw.progress.start(immediate=True)
|
||||||
self.mw.checkpoint(_("Import"))
|
self.mw.checkpoint(_("Import"))
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
<ui version="4.0" >
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
<class>ChangeMap</class>
|
<class>ChangeMap</class>
|
||||||
<widget class="QDialog" name="ChangeMap" >
|
<widget class="QDialog" name="ChangeMap">
|
||||||
<property name="geometry" >
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
|
@ -9,35 +10,29 @@
|
||||||
<height>360</height>
|
<height>360</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle" >
|
<property name="windowTitle">
|
||||||
<string>Import</string>
|
<string>Import</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" >
|
<layout class="QVBoxLayout">
|
||||||
<property name="spacing" >
|
|
||||||
<number>6</number>
|
|
||||||
</property>
|
|
||||||
<property name="margin" >
|
|
||||||
<number>9</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label" >
|
<widget class="QLabel" name="label">
|
||||||
<property name="text" >
|
<property name="text">
|
||||||
<string><h1>Select Target Field</h1></string>
|
<string>Target field:</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="wordWrap" >
|
<property name="wordWrap">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QListWidget" name="fields" />
|
<widget class="QListWidget" name="fields"/>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QDialogButtonBox" name="buttonBox" >
|
<widget class="QDialogButtonBox" name="buttonBox">
|
||||||
<property name="orientation" >
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="standardButtons" >
|
<property name="standardButtons">
|
||||||
<set>QDialogButtonBox::Ok</set>
|
<set>QDialogButtonBox::Ok</set>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
|
@ -52,11 +47,11 @@
|
||||||
<receiver>ChangeMap</receiver>
|
<receiver>ChangeMap</receiver>
|
||||||
<slot>accept()</slot>
|
<slot>accept()</slot>
|
||||||
<hints>
|
<hints>
|
||||||
<hint type="sourcelabel" >
|
<hint type="sourcelabel">
|
||||||
<x>248</x>
|
<x>248</x>
|
||||||
<y>254</y>
|
<y>254</y>
|
||||||
</hint>
|
</hint>
|
||||||
<hint type="destinationlabel" >
|
<hint type="destinationlabel">
|
||||||
<x>157</x>
|
<x>157</x>
|
||||||
<y>274</y>
|
<y>274</y>
|
||||||
</hint>
|
</hint>
|
||||||
|
@ -68,11 +63,11 @@
|
||||||
<receiver>ChangeMap</receiver>
|
<receiver>ChangeMap</receiver>
|
||||||
<slot>reject()</slot>
|
<slot>reject()</slot>
|
||||||
<hints>
|
<hints>
|
||||||
<hint type="sourcelabel" >
|
<hint type="sourcelabel">
|
||||||
<x>316</x>
|
<x>316</x>
|
||||||
<y>260</y>
|
<y>260</y>
|
||||||
</hint>
|
</hint>
|
||||||
<hint type="destinationlabel" >
|
<hint type="destinationlabel">
|
||||||
<x>286</x>
|
<x>286</x>
|
||||||
<y>274</y>
|
<y>274</y>
|
||||||
</hint>
|
</hint>
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
<property name="title">
|
<property name="title">
|
||||||
<string>Import options</string>
|
<string>Import options</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout">
|
<layout class="QVBoxLayout" name="toplayout">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="autoDetect">
|
<widget class="QPushButton" name="autoDetect">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
|
@ -28,7 +28,25 @@
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QWidget" name="modelArea" native="true"/>
|
<layout class="QGridLayout" name="gridLayout_2">
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QWidget" name="modelArea" native="true"/>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QLabel" name="label">
|
||||||
|
<property name="text">
|
||||||
|
<string>Note type:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QLabel" name="label_2">
|
||||||
|
<property name="text">
|
||||||
|
<string>Deck:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
|
@ -84,7 +102,7 @@
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>402</width>
|
<width>402</width>
|
||||||
<height>271</height>
|
<height>237</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
|
|
|
@ -1,116 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<ui version="4.0">
|
|
||||||
<class>Dialog</class>
|
|
||||||
<widget class="QDialog" name="Dialog">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>0</x>
|
|
||||||
<y>0</y>
|
|
||||||
<width>286</width>
|
|
||||||
<height>182</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<property name="windowTitle">
|
|
||||||
<string>Update Facts</string>
|
|
||||||
</property>
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="label_3">
|
|
||||||
<property name="text">
|
|
||||||
<string>Update your deck based on matching entries in the file.</string>
|
|
||||||
</property>
|
|
||||||
<property name="wordWrap">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
|
||||||
<item row="0" column="0">
|
|
||||||
<widget class="QLabel" name="label">
|
|
||||||
<property name="text">
|
|
||||||
<string>Field in File:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="0">
|
|
||||||
<widget class="QLabel" name="label_2">
|
|
||||||
<property name="text">
|
|
||||||
<string>Field in Deck:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="1">
|
|
||||||
<widget class="QComboBox" name="colField"/>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="1">
|
|
||||||
<widget class="QComboBox" name="fileField"/>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<spacer name="verticalSpacer">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Vertical</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>20</width>
|
|
||||||
<height>40</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QDialogButtonBox" name="buttonBox">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="standardButtons">
|
|
||||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Help|QDialogButtonBox::Ok</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
<tabstops>
|
|
||||||
<tabstop>fileField</tabstop>
|
|
||||||
<tabstop>colField</tabstop>
|
|
||||||
<tabstop>buttonBox</tabstop>
|
|
||||||
</tabstops>
|
|
||||||
<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>
|
|
Loading…
Reference in a new issue