diff --git a/ankiqt/ui/deckproperties.py b/ankiqt/ui/deckproperties.py index c7fa69abc..befdb30d1 100644 --- a/ankiqt/ui/deckproperties.py +++ b/ankiqt/ui/deckproperties.py @@ -34,8 +34,6 @@ class DeckProperties(QDialog): self.connect(self.dialog.modelsEdit, SIGNAL("clicked()"), self.onEdit) self.connect(self.dialog.modelsDelete, SIGNAL("clicked()"), self.onDelete) self.connect(self.dialog.buttonBox, SIGNAL("helpRequested()"), self.helpRequested) - self.connect(self.dialog.addSource, SIGNAL("clicked()"), self.onAddSource) - self.connect(self.dialog.deleteSource, SIGNAL("clicked()"), self.onDeleteSource) self.show() def readData(self): @@ -64,10 +62,6 @@ class DeckProperties(QDialog): and Qt.Checked or Qt.Unchecked) self.dialog.perDay.setCheckState(self.d.getBool("perDay") and Qt.Checked or Qt.Unchecked) - # sources - self.sources = self.d.s.all("select id, name from sources") - self.sourcesToRemove = [] - self.drawSourcesTable() # models self.updateModelsList() # hour shift @@ -77,30 +71,6 @@ class DeckProperties(QDialog): self.dialog.suspendLeeches.setChecked(self.d.getBool("suspendLeeches")) self.dialog.leechFails.setValue(self.d.getInt("leechFails")) - def drawSourcesTable(self): - self.dialog.sourcesTable.clear() - self.dialog.sourcesTable.setRowCount(len(self.sources)) - self.dialog.sourcesTable.setColumnCount(2) - self.dialog.sourcesTable.setHorizontalHeaderLabels( - QStringList([_("ID"), - _("Name")])) - self.dialog.sourcesTable.horizontalHeader().setResizeMode( - QHeaderView.Stretch) - self.dialog.sourcesTable.verticalHeader().hide() - self.dialog.sourcesTable.setSelectionBehavior( - QAbstractItemView.SelectRows) - self.dialog.sourcesTable.setSelectionMode( - QAbstractItemView.SingleSelection) - self.sourceItems = [] - n = 0 - for (id, name) in self.sources: - a = QTableWidgetItem(hexifyID(id)) - b = QTableWidgetItem(name) - self.sourceItems.append([a, b]) - self.dialog.sourcesTable.setItem(n, 0, a) - self.dialog.sourcesTable.setItem(n, 1, b) - n += 1 - def updateModelsList(self): idx = self.dialog.modelsList.currentRow() self.dialog.modelsList.clear() @@ -185,29 +155,6 @@ class DeckProperties(QDialog): "DeckProperties#" + tabs[idx])) - def onAddSource(self): - (s, ret) = QInputDialog.getText(self, _("Anki"), - _("Source ID:")) - if not s: - return - rc = self.dialog.sourcesTable.rowCount() - self.dialog.sourcesTable.insertRow(rc) - a = QTableWidgetItem(s) - b = QTableWidgetItem("") - self.dialog.sourcesTable.setItem(rc, 0, a) - self.dialog.sourcesTable.setItem(rc, 1, b) - - def onDeleteSource(self): - r = self.dialog.sourcesTable.currentRow() - if r == -1: - return - self.dialog.sourcesTable.removeRow(r) - try: - id = self.sources[r][0] - self.sourcesToRemove.append(id) - except IndexError: - pass - def reject(self): n = _("Deck Properties") self.d.startProgress() @@ -275,36 +222,6 @@ class DeckProperties(QDialog): "lowPriority", unicode(self.dialog.lowPriority.text())) prioritiesChanged = was != self.d.modified - # sources - d = {} - d.update(self.sources) - for n in range(self.dialog.sourcesTable.rowCount()): - try: - id = dehexifyID(str(self.dialog.sourcesTable.item(n, 0).text())) - except (ValueError,OverflowError): - continue - name = unicode(self.dialog.sourcesTable.item(n, 1).text()) - if id in d: - if d[id] == name: - del d[id] - continue - # name changed - self.d.s.statement( - "update sources set name = :n where id = :id", - id=id, n=name) - else: - self.d.s.statement(""" -insert into sources values -(:id, :n, :t, 0, 0)""", id=id, n=name, t=time.time()) - self.d.setModified() - try: - del d[id] - except KeyError: - pass - for id in self.sourcesToRemove + d.keys(): - self.d.s.statement("delete from sources where id = :id", - id=id) - self.d.setModified() # mark deck dirty and close if self.origMod != self.d.modified: if prioritiesChanged: diff --git a/designer/deckproperties.ui b/designer/deckproperties.ui index c4166305a..1bedf567d 100644 --- a/designer/deckproperties.ui +++ b/designer/deckproperties.ui @@ -178,45 +178,8 @@ - - - - - 16777215 - 40 - - - - <h1>Sources</h1> - - - - - - - - - &Add Source - - - false - - - - - - - &Delete Source - - - false - - - - - - - + + @@ -252,26 +215,6 @@ - - - - Qt::Horizontal - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - @@ -619,9 +562,6 @@ lowPriority doSync syncName - sourcesTable - addSource - deleteSource delay0 delay1 delay2