show editable deck in import dialog; bump version

This commit is contained in:
Damien Elmes 2012-03-20 05:39:59 +09:00
parent 07d0d1ef80
commit 3d50abecf9
5 changed files with 54 additions and 145 deletions

View file

@ -4,7 +4,7 @@
import os, sys
from aqt.qt import *
appVersion="2.0-alpha7"
appVersion="2.0-alpha8"
appWebsite="http://ankisrs.net/"
appHelpSite="http://ankisrs.net/docs/dev/manual.html"
appChanges="http://ankisrs.net/docs/dev/changes.html"

View file

@ -62,6 +62,10 @@ class ImportDialog(QDialog):
self.importer = importer
self.frm = aqt.forms.importing.Ui_ImportDialog()
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),
SIGNAL("clicked()"), self.helpRequested)
self.setupMappingFrame()
@ -77,15 +81,16 @@ class ImportDialog(QDialog):
def setupOptions(self):
self.model = self.mw.col.models.current()
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.doImport)
def modelChanged(self):
print "model changed"
self.importer.model = self.mw.col.models.current()
self.importer.initMapping()
self.showMapping()
self.deck.setText(self.mw.col.decks.name(
self.importer.model['did']))
def onDelimiter(self):
str = getOnlyText(_("""\
@ -128,6 +133,13 @@ you can enter it here. Use \\t to represent tab."""),
def doImport(self, update=False):
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.mw.progress.start(immediate=True)
self.mw.checkpoint(_("Import"))

View file

@ -1,7 +1,8 @@
<ui version="4.0" >
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>ChangeMap</class>
<widget class="QDialog" name="ChangeMap" >
<property name="geometry" >
<widget class="QDialog" name="ChangeMap">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
@ -9,35 +10,29 @@
<height>360</height>
</rect>
</property>
<property name="windowTitle" >
<property name="windowTitle">
<string>Import</string>
</property>
<layout class="QVBoxLayout" >
<property name="spacing" >
<number>6</number>
</property>
<property name="margin" >
<number>9</number>
</property>
<layout class="QVBoxLayout">
<item>
<widget class="QLabel" name="label" >
<property name="text" >
<string>&lt;h1>Select Target Field&lt;/h1></string>
<widget class="QLabel" name="label">
<property name="text">
<string>Target field:</string>
</property>
<property name="wordWrap" >
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QListWidget" name="fields" />
<widget class="QListWidget" name="fields"/>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox" >
<property name="orientation" >
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons" >
<property name="standardButtons">
<set>QDialogButtonBox::Ok</set>
</property>
</widget>
@ -52,11 +47,11 @@
<receiver>ChangeMap</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel" >
<hint type="sourcelabel">
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel" >
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
@ -68,11 +63,11 @@
<receiver>ChangeMap</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel" >
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel" >
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>

View file

@ -19,7 +19,7 @@
<property name="title">
<string>Import options</string>
</property>
<layout class="QVBoxLayout">
<layout class="QVBoxLayout" name="toplayout">
<item>
<widget class="QPushButton" name="autoDetect">
<property name="text">
@ -28,8 +28,26 @@
</widget>
</item>
<item>
<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>
</layout>
</widget>
</item>
@ -84,7 +102,7 @@
<x>0</x>
<y>0</y>
<width>402</width>
<height>271</height>
<height>237</height>
</rect>
</property>
</widget>

View file

@ -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>