Skip to content

Commit

Permalink
cleaned up files
Browse files Browse the repository at this point in the history
  • Loading branch information
dayjaby committed Aug 13, 2016
1 parent 1acca69 commit d259888
Show file tree
Hide file tree
Showing 14 changed files with 280 additions and 101 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
*.db filter=lfs diff=lfs merge=lfs -text
*.u8 filter=lfs diff=lfs merge=lfs -text
yomi_base/mplayer/subfont.ttf filter=lfs diff=lfs merge=lfs -text
yomi_base/japanese/dictionary.zip filter=lfs diff=lfs merge=lfs -text
yomi_base/korean/dictionary.zip filter=lfs diff=lfs merge=lfs -text
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
*.pyc
*.zip
yomichan.zip
yomichan_dicts.zip
tools.zip
tools
*.db
88 changes: 88 additions & 0 deletions UserList.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
"""A more or less complete user-defined wrapper around list objects."""

import collections

class UserList(collections.MutableSequence):
def __init__(self, initlist=None):
self.data = []
if initlist is not None:
# XXX should this accept an arbitrary sequence?
if type(initlist) == type(self.data):
self.data[:] = initlist
elif isinstance(initlist, UserList):
self.data[:] = initlist.data[:]
else:
self.data = list(initlist)
def __repr__(self): return repr(self.data)
def __lt__(self, other): return self.data < self.__cast(other)
def __le__(self, other): return self.data <= self.__cast(other)
def __eq__(self, other): return self.data == self.__cast(other)
def __ne__(self, other): return self.data != self.__cast(other)
def __gt__(self, other): return self.data > self.__cast(other)
def __ge__(self, other): return self.data >= self.__cast(other)
def __cast(self, other):
if isinstance(other, UserList): return other.data
else: return other
def __cmp__(self, other):
return cmp(self.data, self.__cast(other))
__hash__ = None # Mutable sequence, so not hashable
def __contains__(self, item): return item in self.data
def __len__(self): return len(self.data)
def __getitem__(self, i): return self.data[i]
def __setitem__(self, i, item): self.data[i] = item
def __delitem__(self, i): del self.data[i]
def __getslice__(self, i, j):
i = max(i, 0); j = max(j, 0)
return self.__class__(self.data[i:j])
def __setslice__(self, i, j, other):
i = max(i, 0); j = max(j, 0)
if isinstance(other, UserList):
self.data[i:j] = other.data
elif isinstance(other, type(self.data)):
self.data[i:j] = other
else:
self.data[i:j] = list(other)
def __delslice__(self, i, j):
i = max(i, 0); j = max(j, 0)
del self.data[i:j]
def __add__(self, other):
if isinstance(other, UserList):
return self.__class__(self.data + other.data)
elif isinstance(other, type(self.data)):
return self.__class__(self.data + other)
else:
return self.__class__(self.data + list(other))
def __radd__(self, other):
if isinstance(other, UserList):
return self.__class__(other.data + self.data)
elif isinstance(other, type(self.data)):
return self.__class__(other + self.data)
else:
return self.__class__(list(other) + self.data)
def __iadd__(self, other):
if isinstance(other, UserList):
self.data += other.data
elif isinstance(other, type(self.data)):
self.data += other
else:
self.data += list(other)
return self
def __mul__(self, n):
return self.__class__(self.data*n)
__rmul__ = __mul__
def __imul__(self, n):
self.data *= n
return self
def append(self, item): self.data.append(item)
def insert(self, i, item): self.data.insert(i, item)
def pop(self, i=-1): return self.data.pop(i)
def remove(self, item): self.data.remove(item)
def count(self, item): return self.data.count(item)
def index(self, item, *args): return self.data.index(item, *args)
def reverse(self): self.data.reverse()
def sort(self, *args, **kwds): self.data.sort(*args, **kwds)
def extend(self, other):
if isinstance(other, UserList):
self.data.extend(other.data)
else:
self.data.extend(other)
11 changes: 10 additions & 1 deletion build_zip.bat
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
./build_zip_core.bat
cd yomi_base/japanese
7z a dictionary.zip dictionary.db

cd ../korean
7z a dictionary.zip dictionary.db

cd ../..

rm yomichan_dicts.zip
7z a yomichan_dicts.zip yomi_base/japanese/dictionary.db yomi_base/chinese/cedict_ts.u8 yomi_base/korean/dictionary.db

rm tools.zip
7z a tools.zip tools yomi_base/mplayer/subfont.ttf

call build_zip_core.bat

5 changes: 3 additions & 2 deletions build_zip_core.bat
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
rm yomichan.zip
7z a yomichan.zip -x!yomi_base/japanese/dictionary.db -x!yomi_base/chinese/cedict_ts.u8 -x!yomi_base/korean/dictionary.db -x!yomi_base/mplayer/subfont.ttf yomichan.py UserList.py yomi_base
7z a yomichan.zip -x!yomi_base/japanese/dictionary.zip -x!yomi_base/japanese/dictionary.db -x!yomi_base/chinese/cedict_ts.u8 -x!yomi_base/korean/dictionary.db -x!yomi_base/korean/dictionary.zip -x!yomi_base/mplayer/subfont.ttf yomichan.py UserList.py yomi_base
cd pysrt
7z a ..\yomichan.zip pysrt
7z a ..\yomichan.zip pysrt
cd ..
13 changes: 0 additions & 13 deletions yomi_base/gen/preferences_ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,16 +129,6 @@ def setupUi(self, DialogPreferences):
self.label = QtGui.QLabel(self.tabAnki)
self.label.setObjectName(_fromUtf8("label"))
self.horizontalLayout_2.addWidget(self.label)
self.radioButtonVocab = QtGui.QRadioButton(self.tabAnki)
self.radioButtonVocab.setChecked(True)
self.radioButtonVocab.setObjectName(_fromUtf8("radioButtonVocab"))
self.horizontalLayout_2.addWidget(self.radioButtonVocab)
self.radioButtonKanji = QtGui.QRadioButton(self.tabAnki)
self.radioButtonKanji.setObjectName(_fromUtf8("radioButtonKanji"))
self.horizontalLayout_2.addWidget(self.radioButtonKanji)
self.radioButtonSentence = QtGui.QRadioButton(self.tabAnki)
self.radioButtonSentence.setObjectName(_fromUtf8("radioButtonSentence"))
self.horizontalLayout_2.addWidget(self.radioButtonSentence)
spacerItem = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
self.horizontalLayout_2.addItem(spacerItem)
self.verticalLayout_2.addLayout(self.horizontalLayout_2)
Expand Down Expand Up @@ -219,9 +209,6 @@ def retranslateUi(self, DialogPreferences):
self.checkAllowEditing.setText(_translate("DialogPreferences", "Allow editing", None))
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tabAppearance), _translate("DialogPreferences", "Appearance", None))
self.label.setText(_translate("DialogPreferences", "Displayed profile", None))
self.radioButtonVocab.setText(_translate("DialogPreferences", "Vocabulary", None))
self.radioButtonKanji.setText(_translate("DialogPreferences", "Kanji", None))
self.radioButtonSentence.setText(_translate("DialogPreferences", "Sentence", None))
self.label_13.setText(_translate("DialogPreferences", "Deck", None))
self.label_12.setText(_translate("DialogPreferences", "Model", None))
self.label_11.setText(_translate("DialogPreferences", "Specify how your model fields are populated when adding facts", None))
Expand Down
69 changes: 40 additions & 29 deletions yomi_base/gen/reader_ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ def setupUi(self, MainWindowReader):
self.centralwidget.setObjectName(_fromUtf8("centralwidget"))
self.verticalLayout_4 = QtGui.QVBoxLayout(self.centralwidget)
self.verticalLayout_4.setObjectName(_fromUtf8("verticalLayout_4"))
self.textContent = QtGui.QPlainTextEdit(self.centralwidget)
self.textContent.setMouseTracking(True)
self.textContent.setReadOnly(True)
self.textContent.setObjectName(_fromUtf8("textContent"))
self.verticalLayout_4.addWidget(self.textContent)
MainWindowReader.setCentralWidget(self.centralwidget)
self.menubar = QtGui.QMenuBar(MainWindowReader)
self.menubar.setGeometry(QtCore.QRect(0, 0, 900, 21))
Expand Down Expand Up @@ -92,25 +97,12 @@ def setupUi(self, MainWindowReader):
self.learnVocabulary = QtGui.QPushButton(self.dockWidgetContents_2)
self.learnVocabulary.setObjectName(_fromUtf8("learnVocabulary"))
self.verticalLayout_5.addWidget(self.learnVocabulary)
self.moveVocabulary = QtGui.QPushButton(self.dockWidgetContents_2)
self.moveVocabulary.setObjectName(_fromUtf8("moveVocabulary"))
self.verticalLayout_5.addWidget(self.moveVocabulary)
self.createSentenceCards = QtGui.QPushButton(self.dockWidgetContents_2)
self.createSentenceCards.setObjectName(_fromUtf8("createSentenceCards"))
self.verticalLayout_5.addWidget(self.createSentenceCards)
self.verticalLayout_2.addLayout(self.verticalLayout_5)
self.dockAnki.setWidget(self.dockWidgetContents_2)
MainWindowReader.addDockWidget(QtCore.Qt.DockWidgetArea(1), self.dockAnki)
self.dockWidget = QtGui.QDockWidget(MainWindowReader)
self.dockWidget.setObjectName(_fromUtf8("dockWidget"))
self.dockWidgetContents = QtGui.QWidget()
self.dockWidgetContents.setObjectName(_fromUtf8("dockWidgetContents"))
self.verticalLayout = QtGui.QVBoxLayout(self.dockWidgetContents)
self.verticalLayout.setObjectName(_fromUtf8("verticalLayout"))
self.textContent = QtGui.QPlainTextEdit(self.dockWidgetContents)
self.textContent.setMouseTracking(True)
self.textContent.setReadOnly(True)
self.textContent.setObjectName(_fromUtf8("textContent"))
self.verticalLayout.addWidget(self.textContent)
self.dockWidget.setWidget(self.dockWidgetContents)
MainWindowReader.addDockWidget(QtCore.Qt.DockWidgetArea(1), self.dockWidget)
self.actionOpen = QtGui.QAction(MainWindowReader)
icon1 = QtGui.QIcon()
icon1.addPixmap(QtGui.QPixmap(_fromUtf8(":/img/img/icon_action_open.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
Expand Down Expand Up @@ -154,9 +146,13 @@ def setupUi(self, MainWindowReader):
self.actionZoomReset.setIconVisibleInMenu(True)
self.actionZoomReset.setObjectName(_fromUtf8("actionZoomReset"))
self.actionFind = QtGui.QAction(MainWindowReader)
self.actionFind.setCheckable(False)
self.actionFind.setChecked(False)
self.actionFind.setEnabled(True)
icon8 = QtGui.QIcon()
icon8.addPixmap(QtGui.QPixmap(_fromUtf8(":/img/img/icon_action_find.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.actionFind.setIcon(icon8)
self.actionFind.setVisible(True)
self.actionFind.setIconVisibleInMenu(True)
self.actionFind.setObjectName(_fromUtf8("actionFind"))
self.actionFindNext = QtGui.QAction(MainWindowReader)
Expand Down Expand Up @@ -195,15 +191,28 @@ def setupUi(self, MainWindowReader):
self.actionSave.setIcon(icon11)
self.actionSave.setIconVisibleInMenu(True)
self.actionSave.setObjectName(_fromUtf8("actionSave"))
self.actionToggleJapanese = QtGui.QAction(MainWindowReader)
self.actionToggleJapanese.setCheckable(True)
self.actionToggleJapanese.setObjectName(_fromUtf8("actionToggleJapanese"))
self.actionToggleKorean = QtGui.QAction(MainWindowReader)
self.actionToggleKorean.setCheckable(True)
icon12 = QtGui.QIcon()
icon12.addPixmap(QtGui.QPixmap(_fromUtf8(":/img/img/icon_action_ko.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.actionToggleKorean.setIcon(icon12)
self.actionToggleKorean.setObjectName(_fromUtf8("actionToggleKorean"))
self.actionToggleChinese = QtGui.QAction(MainWindowReader)
self.actionToggleChinese.setCheckable(True)
icon13 = QtGui.QIcon()
icon13.addPixmap(QtGui.QPixmap(_fromUtf8(":/img/img/icon_action_ch.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.actionToggleChinese.setIcon(icon13)
self.actionToggleChinese.setObjectName(_fromUtf8("actionToggleChinese"))
self.actionToggleJapanese = QtGui.QAction(MainWindowReader)
self.actionToggleJapanese.setCheckable(True)
self.actionToggleJapanese.setChecked(False)
self.actionToggleJapanese.setEnabled(True)
icon14 = QtGui.QIcon()
icon14.addPixmap(QtGui.QPixmap(_fromUtf8(":/img/img/icon_action_jp.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.actionToggleJapanese.setIcon(icon14)
self.actionToggleJapanese.setVisible(True)
self.actionToggleJapanese.setIconVisibleInMenu(True)
self.actionToggleJapanese.setObjectName(_fromUtf8("actionToggleJapanese"))
self.menuImport.addAction(self.actionKindleDeck)
self.menuImport.addAction(self.actionWordList)
self.menuFile.addAction(self.actionOpen)
Expand All @@ -229,13 +238,8 @@ def setupUi(self, MainWindowReader):
self.menuView.addAction(self.menuTextSize.menuAction())
self.menuView.addSeparator()
self.menuView.addAction(self.actionToggleAnki)
self.menuView.addAction(self.actionToggleVocab)
self.menuView.addAction(self.actionToggleKanji)
self.menuView.addAction(self.actionToggleWrap)
self.menuView.addSeparator()
self.menuView.addAction(self.actionToggleJapanese)
self.menuView.addAction(self.actionToggleKorean)
self.menuView.addAction(self.actionToggleChinese)
self.menuView.addAction(self.actionToggleWrap)
self.menubar.addAction(self.menuFile.menuAction())
self.menubar.addAction(self.menuEdit.menuAction())
self.menubar.addAction(self.menuView.menuAction())
Expand All @@ -247,6 +251,10 @@ def setupUi(self, MainWindowReader):
self.toolBar.addAction(self.actionZoomReset)
self.toolBar.addSeparator()
self.toolBar.addAction(self.actionFind)
self.toolBar.addSeparator()
self.toolBar.addAction(self.actionToggleJapanese)
self.toolBar.addAction(self.actionToggleChinese)
self.toolBar.addAction(self.actionToggleKorean)

self.retranslateUi(MainWindowReader)
QtCore.QObject.connect(self.actionQuit, QtCore.SIGNAL(_fromUtf8("triggered()")), MainWindowReader.close)
Expand All @@ -255,6 +263,7 @@ def setupUi(self, MainWindowReader):

def retranslateUi(self, MainWindowReader):
MainWindowReader.setWindowTitle(_translate("MainWindowReader", "Yomichan", None))
self.textContent.setPlainText(_translate("MainWindowReader", "Paste text here or open a .txt file you want to read!", None))
self.menuFile.setTitle(_translate("MainWindowReader", "&File", None))
self.menuOpenRecent.setTitle(_translate("MainWindowReader", "Open &recent", None))
self.menuImport.setTitle(_translate("MainWindowReader", "&Import", None))
Expand All @@ -267,8 +276,7 @@ def retranslateUi(self, MainWindowReader):
self.label_3.setText(_translate("MainWindowReader", "Active tag(s)", None))
self.removeVocabulary.setText(_translate("MainWindowReader", "Remove Vocabulary", None))
self.learnVocabulary.setText(_translate("MainWindowReader", "Learn Vocabulary", None))
self.moveVocabulary.setText(_translate("MainWindowReader", "Move Vocabulary", None))
self.textContent.setPlainText(_translate("MainWindowReader", "Paste text here or open a .txt file you want to read!", None))
self.createSentenceCards.setText(_translate("MainWindowReader", "Create sentence cards", None))
self.actionOpen.setText(_translate("MainWindowReader", "&Open...", None))
self.actionOpen.setToolTip(_translate("MainWindowReader", "Open file", None))
self.actionOpen.setShortcut(_translate("MainWindowReader", "Ctrl+O", None))
Expand Down Expand Up @@ -305,11 +313,14 @@ def retranslateUi(self, MainWindowReader):
self.actionSave.setText(_translate("MainWindowReader", "&Save...", None))
self.actionSave.setToolTip(_translate("MainWindowReader", "Save file", None))
self.actionSave.setShortcut(_translate("MainWindowReader", "Ctrl+S", None))
self.actionToggleJapanese.setText(_translate("MainWindowReader", "&Japanese", None))
self.actionToggleJapanese.setToolTip(_translate("MainWindowReader", "Enable Japanese dictionary", None))
self.actionToggleKorean.setText(_translate("MainWindowReader", "&Korean", None))
self.actionToggleKorean.setToolTip(_translate("MainWindowReader", "Enable Korean dictionary", None))
self.actionToggleKorean.setShortcut(_translate("MainWindowReader", "Ctrl+K", None))
self.actionToggleChinese.setText(_translate("MainWindowReader", "&Chinese", None))
self.actionToggleChinese.setToolTip(_translate("MainWindowReader", "Enable Chinese dictionary", None))
self.actionToggleChinese.setShortcut(_translate("MainWindowReader", "Ctrl+H", None))
self.actionToggleJapanese.setText(_translate("MainWindowReader", "&Japanese", None))
self.actionToggleJapanese.setToolTip(_translate("MainWindowReader", "Enable Japanese dictionary", None))
self.actionToggleJapanese.setShortcut(_translate("MainWindowReader", "Ctrl+J", None))

import resources_rc
Loading

0 comments on commit d259888

Please sign in to comment.