Stub for importing word list
Former-commit-id: ee45d2c32f6ec50a4ab38cd5e139636b103efa9f
This commit is contained in:
parent
f67a70f536
commit
e7577a7cd0
@ -64,7 +64,7 @@
|
|||||||
<addaction name="menuOpenArchive"/>
|
<addaction name="menuOpenArchive"/>
|
||||||
<addaction name="menuOpenRecent"/>
|
<addaction name="menuOpenRecent"/>
|
||||||
<addaction name="separator"/>
|
<addaction name="separator"/>
|
||||||
<addaction name="menuImportKindleDeck"/>
|
<addaction name="actionImportKindleDeck"/>
|
||||||
<addaction name="separator"/>
|
<addaction name="separator"/>
|
||||||
<addaction name="actionQuit"/>
|
<addaction name="actionQuit"/>
|
||||||
</widget>
|
</widget>
|
||||||
@ -460,7 +460,7 @@
|
|||||||
<string>&Kanji</string>
|
<string>&Kanji</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
<action name="menuImportKindleDeck">
|
<action name="actionImportKindleDeck">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Import &Kindle deck...</string>
|
<string>Import &Kindle deck...</string>
|
||||||
</property>
|
</property>
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
# Form implementation generated from reading ui file 'ui/about.ui'
|
# Form implementation generated from reading ui file 'ui/about.ui'
|
||||||
#
|
#
|
||||||
# Created: Sat Dec 20 19:45:21 2014
|
# Created: Sat Dec 20 20:08:12 2014
|
||||||
# by: PyQt4 UI code generator 4.10.4
|
# by: PyQt4 UI code generator 4.10.4
|
||||||
#
|
#
|
||||||
# WARNING! All changes made in this file will be lost!
|
# WARNING! All changes made in this file will be lost!
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
# Form implementation generated from reading ui file 'ui/preferences.ui'
|
# Form implementation generated from reading ui file 'ui/preferences.ui'
|
||||||
#
|
#
|
||||||
# Created: Sat Dec 20 19:45:21 2014
|
# Created: Sat Dec 20 20:08:12 2014
|
||||||
# by: PyQt4 UI code generator 4.10.4
|
# by: PyQt4 UI code generator 4.10.4
|
||||||
#
|
#
|
||||||
# WARNING! All changes made in this file will be lost!
|
# WARNING! All changes made in this file will be lost!
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
# Form implementation generated from reading ui file 'ui/reader.ui'
|
# Form implementation generated from reading ui file 'ui/reader.ui'
|
||||||
#
|
#
|
||||||
# Created: Sat Dec 20 19:45:21 2014
|
# Created: Sat Dec 20 20:08:13 2014
|
||||||
# by: PyQt4 UI code generator 4.10.4
|
# by: PyQt4 UI code generator 4.10.4
|
||||||
#
|
#
|
||||||
# WARNING! All changes made in this file will be lost!
|
# WARNING! All changes made in this file will be lost!
|
||||||
@ -211,13 +211,13 @@ class Ui_MainWindowReader(object):
|
|||||||
self.actionToggleKanji = QtGui.QAction(MainWindowReader)
|
self.actionToggleKanji = QtGui.QAction(MainWindowReader)
|
||||||
self.actionToggleKanji.setCheckable(True)
|
self.actionToggleKanji.setCheckable(True)
|
||||||
self.actionToggleKanji.setObjectName(_fromUtf8("actionToggleKanji"))
|
self.actionToggleKanji.setObjectName(_fromUtf8("actionToggleKanji"))
|
||||||
self.menuImportKindleDeck = QtGui.QAction(MainWindowReader)
|
self.actionImportKindleDeck = QtGui.QAction(MainWindowReader)
|
||||||
self.menuImportKindleDeck.setObjectName(_fromUtf8("menuImportKindleDeck"))
|
self.actionImportKindleDeck.setObjectName(_fromUtf8("actionImportKindleDeck"))
|
||||||
self.menuFile.addAction(self.actionOpen)
|
self.menuFile.addAction(self.actionOpen)
|
||||||
self.menuFile.addAction(self.menuOpenArchive.menuAction())
|
self.menuFile.addAction(self.menuOpenArchive.menuAction())
|
||||||
self.menuFile.addAction(self.menuOpenRecent.menuAction())
|
self.menuFile.addAction(self.menuOpenRecent.menuAction())
|
||||||
self.menuFile.addSeparator()
|
self.menuFile.addSeparator()
|
||||||
self.menuFile.addAction(self.menuImportKindleDeck)
|
self.menuFile.addAction(self.actionImportKindleDeck)
|
||||||
self.menuFile.addSeparator()
|
self.menuFile.addSeparator()
|
||||||
self.menuFile.addAction(self.actionQuit)
|
self.menuFile.addAction(self.actionQuit)
|
||||||
self.menuEdit.addSeparator()
|
self.menuEdit.addSeparator()
|
||||||
@ -308,6 +308,6 @@ class Ui_MainWindowReader(object):
|
|||||||
self.actionToggleAnki.setText(_translate("MainWindowReader", "&Anki", None))
|
self.actionToggleAnki.setText(_translate("MainWindowReader", "&Anki", None))
|
||||||
self.actionFeedback.setText(_translate("MainWindowReader", "&Feedback...", None))
|
self.actionFeedback.setText(_translate("MainWindowReader", "&Feedback...", None))
|
||||||
self.actionToggleKanji.setText(_translate("MainWindowReader", "&Kanji", None))
|
self.actionToggleKanji.setText(_translate("MainWindowReader", "&Kanji", None))
|
||||||
self.menuImportKindleDeck.setText(_translate("MainWindowReader", "Import &Kindle deck...", None))
|
self.actionImportKindleDeck.setText(_translate("MainWindowReader", "Import &Kindle deck...", None))
|
||||||
|
|
||||||
import resources_rc
|
import resources_rc
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
# Resource object code
|
# Resource object code
|
||||||
#
|
#
|
||||||
# Created: Sat Dec 20 19:45:21 2014
|
# Created: Sat Dec 20 20:08:13 2014
|
||||||
# by: The Resource Compiler for PyQt (Qt v4.8.6)
|
# by: The Resource Compiler for PyQt (Qt v4.8.6)
|
||||||
#
|
#
|
||||||
# WARNING! All changes made in this file will be lost!
|
# WARNING! All changes made in this file will be lost!
|
||||||
|
@ -72,6 +72,7 @@ class MainWindowReader(QtGui.QMainWindow, gen.reader_ui.Ui_MainWindowReader):
|
|||||||
self.actionFind.triggered.connect(self.onActionFind)
|
self.actionFind.triggered.connect(self.onActionFind)
|
||||||
self.actionFindNext.triggered.connect(self.onActionFindNext)
|
self.actionFindNext.triggered.connect(self.onActionFindNext)
|
||||||
self.actionHomepage.triggered.connect(self.onActionHomepage)
|
self.actionHomepage.triggered.connect(self.onActionHomepage)
|
||||||
|
self.actionImportKindleDeck.triggered.connect(self.onActionImportKindleDeck)
|
||||||
self.actionOpen.triggered.connect(self.onActionOpen)
|
self.actionOpen.triggered.connect(self.onActionOpen)
|
||||||
self.actionPreferences.triggered.connect(self.onActionPreferences)
|
self.actionPreferences.triggered.connect(self.onActionPreferences)
|
||||||
self.actionToggleWrap.toggled.connect(self.onActionToggleWrap)
|
self.actionToggleWrap.toggled.connect(self.onActionToggleWrap)
|
||||||
@ -182,6 +183,17 @@ class MainWindowReader(QtGui.QMainWindow, gen.reader_ui.Ui_MainWindowReader):
|
|||||||
self.openFile(filename)
|
self.openFile(filename)
|
||||||
|
|
||||||
|
|
||||||
|
def onActionImportKindleDeck(self):
|
||||||
|
filename = QtGui.QFileDialog.getOpenFileName(
|
||||||
|
parent=self,
|
||||||
|
caption='Select a Kindle deck to import',
|
||||||
|
filter='Deck files (*.db)'
|
||||||
|
)
|
||||||
|
if filename:
|
||||||
|
words = reader_util.extractKindleDeck(filename)
|
||||||
|
self.importWordList(words)
|
||||||
|
|
||||||
|
|
||||||
def onActionPreferences(self):
|
def onActionPreferences(self):
|
||||||
dialog = preferences.DialogPreferences(self, self.preferences, self.anki)
|
dialog = preferences.DialogPreferences(self, self.preferences, self.anki)
|
||||||
if dialog.exec_() == QtGui.QDialog.Accepted:
|
if dialog.exec_() == QtGui.QDialog.Accepted:
|
||||||
@ -539,5 +551,9 @@ class MainWindowReader(QtGui.QMainWindow, gen.reader_ui.Ui_MainWindowReader):
|
|||||||
self.textKanjiDefs.setHtml(html)
|
self.textKanjiDefs.setHtml(html)
|
||||||
|
|
||||||
|
|
||||||
|
def importWordList(self, words):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
def setStatus(self, status):
|
def setStatus(self, status):
|
||||||
self.statusBar.showMessage(status)
|
self.statusBar.showMessage(status)
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
|
|
||||||
from PyQt4 import QtGui
|
from PyQt4 import QtGui
|
||||||
import re
|
import re
|
||||||
|
import sqlite3
|
||||||
|
|
||||||
|
|
||||||
def decodeContent(content):
|
def decodeContent(content):
|
||||||
@ -232,3 +233,21 @@ def buildKanjiDefs(definitions, query):
|
|||||||
html += buildEmpty()
|
html += buildEmpty()
|
||||||
|
|
||||||
return html + buildDefFooter()
|
return html + buildDefFooter()
|
||||||
|
|
||||||
|
|
||||||
|
def extractKindleDeck(filename):
|
||||||
|
words = list()
|
||||||
|
|
||||||
|
try:
|
||||||
|
connection = sqlite3.connect(unicode(filename))
|
||||||
|
for row in connection.execute('select word from WORDS'):
|
||||||
|
words.append(row[0])
|
||||||
|
connection.close()
|
||||||
|
except sqlite3.OperationalError:
|
||||||
|
pass
|
||||||
|
|
||||||
|
return words
|
||||||
|
|
||||||
|
|
||||||
|
def importWordList(self, words):
|
||||||
|
pass
|
||||||
|
Loading…
Reference in New Issue
Block a user