diff --git a/CC-CEDICT Info.txt b/CC-CEDICT Info.txt index 9cb46ae..df04db6 100644 --- a/CC-CEDICT Info.txt +++ b/CC-CEDICT Info.txt @@ -2,7 +2,7 @@ CC-CEDICT Community maintained free Chinese-English dictionary. Published by MDBG - + License: Creative Commons Attribution-ShareAlike 4.0 International License https://creativecommons.org/licenses/by-sa/4.0/ @@ -18,8 +18,8 @@ https://cc-cedict.org/editor/editor.php For more information about CC-CEDICT see: https://cc-cedict.org/wiki/ - -Entries: 117695 -Publisher: MDBG -License: https://creativecommons.org/licenses/by-sa/4.0/ -Version: 2019-12-28T06:41:48Z \ No newline at end of file + +Entries=117930 +Publisher=MDBG +License=https://creativecommons.org/licenses/by-sa/4.0/ +Date=2020-02-12T06:31:48Z \ No newline at end of file diff --git a/CC-CEDICT_dictionary.db b/CC-CEDICT_dictionary.db index 56870bc..51f1af8 100644 Binary files a/CC-CEDICT_dictionary.db and b/CC-CEDICT_dictionary.db differ diff --git a/License.txt b/License.txt new file mode 100644 index 0000000..933f579 --- /dev/null +++ b/License.txt @@ -0,0 +1,20 @@ +CC-CEDICT for Anki v1.1 Copyright 2020 Thore Tyborski + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/__init__.py b/__init__.py index 6e11324..0dea84f 100644 --- a/__init__.py +++ b/__init__.py @@ -1,82 +1,14 @@ -# CC-CEDICT for Anki v1.1 Copyright 2020 Thore Tyborski - -# Permission is hereby granted, free of charge, to any person obtaining -# a copy of this software and associated documentation files (the -# "Software"), to deal in the Software without restriction, including -# without limitation the rights to use, copy, modify, merge, publish, -# distribute, sublicense, and/or sell copies of the Software, and to -# permit persons to whom the Software is furnished to do so, subject to -# the following conditions: - -# The above copyright notice and this permission notice shall be -# included in all copies or substantial portions of the Software. - -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - from aqt import mw -from aqt.utils import showInfo, tooltip, askUser from PyQt5.QtWidgets import QAction, QMenu from aqt.qt import * -from os.path import dirname, join, realpath -import requests -from bs4 import BeautifulSoup -import webbrowser from .dict_ui import start -this_version = "v1.1" - def UI(): s = start() if s.exec(): pass -def Update(): - try: - url = 'https://chinesewordsfinderupdates.netlify.com' - headers = {"User-Agent": 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.142 Safari/537.36 OPR/62.0.3331.116'} - page = requests.get(url, headers=headers) - soup = BeautifulSoup(page.content, 'html.parser') - version = soup.find(id='dict_version').get_text() - log = soup.find(id='dict_changelog').get_text() - log_list = log.split(',') - log = "" - for i in log_list: - log = log + "- " + i + "
" - except: - return - if version != this_version: - info = "You can update CC-CEDICT for Anki to version %(version)s. You are currently using version %(this_version)s.

Changes:
%(log)s

Do you want to update now?" % {'version':version, 'this_version': this_version, 'log':log} - - if not askUser(info, title='Update!'): - return - else: - download() - else: - pass - -def download(): - try: - mw.mgr = mw.addonManager - updated = ['418828045'] - mw.mgr.downloadIds(updated) - tooltip("CC-CEDICT for Anki was updated successfully. Please restart Anki.") - except: - tooltip("Download failed...") - - -def Main(): - Update() - UI() - - - action = QAction("CC-CEDICT for Anki", mw) -action.triggered.connect(Main) +action.triggered.connect(UI) mw.form.menuTools.addAction(action) action.setShortcut(QKeySequence("Ctrl+D")) \ No newline at end of file diff --git a/dict_ui.py b/dict_ui.py index 36743db..afe3339 100644 --- a/dict_ui.py +++ b/dict_ui.py @@ -163,12 +163,14 @@ def setupUi(self, Dialog): for i in decklist: self.Deck.addItem(str(i)) self.gridLayout_2.addWidget(self.Deck, 1, 0, 1, 2) + self.Deck.currentTextChanged.connect(self.save_config) self.Notetype = QtWidgets.QComboBox(self.widget) self.Notetype.setObjectName("Notetype") for i in notetypelist: self.Notetype.addItem(str(i)) self.gridLayout_2.addWidget(self.Notetype, 1, 2, 1, 2) + self.Notetype.currentTextChanged.connect(self.save_config) self.Add = QtWidgets.QPushButton(self.widget) self.Add.setObjectName("Add") @@ -481,7 +483,7 @@ def save_config(self): def about(self): - showInfo('

CC-CEDICT for Anki v1.1


This add-on uses the CC-CEDICT dictionary. It is licensed under the Creative Commons Attribution-Share Alike 3.0 License.
The code for the add-on is available on GitHub. It is licensed under the MIT License.

If you like this add-on, rate and review it on Anki Web. If you want to report a bug, or make a feature request, please create a new issue on GitHub.
Icon made by Freepik from www.flaticon.com

© Thore Tyborski 2020') + showInfo('

CC-CEDICT for Anki v1.2


This add-on uses the CC-CEDICT dictionary. It is licensed under the Creative Commons Attribution-Share Alike 3.0 License.
The code for the add-on is available on GitHub. It is licensed under the MIT License.

If you like this add-on, rate and review it on Anki Web. If you want to report a bug, or make a feature request, please create a new issue on GitHub.
Icon made by Freepik from www.flaticon.com

© Thore Tyborski 2020')