Skip to content

Commit

Permalink
v1.2
Browse files Browse the repository at this point in the history
  • Loading branch information
ThoreBor authored Feb 14, 2020
1 parent bd6fbe2 commit 679ee51
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 76 deletions.
12 changes: 6 additions & 6 deletions CC-CEDICT Info.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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/
Expand All @@ -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
Entries=117930
Publisher=MDBG
License=https://creativecommons.org/licenses/by-sa/4.0/
Date=2020-02-12T06:31:48Z
Binary file modified CC-CEDICT_dictionary.db
Binary file not shown.
20 changes: 20 additions & 0 deletions License.txt
Original file line number Diff line number Diff line change
@@ -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.
70 changes: 1 addition & 69 deletions __init__.py
Original file line number Diff line number Diff line change
@@ -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 + "<br>"
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.<br><br><b>Changes:</b><br>%(log)s <br><br><b>Do you want to update now?</b>" % {'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"))
4 changes: 3 additions & 1 deletion dict_ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -481,7 +483,7 @@ def save_config(self):


def about(self):
showInfo('<h3>CC-CEDICT for Anki v1.1</h3><br>This add-on uses the <a href="https://cc-cedict.org/wiki/">CC-CEDICT</a> dictionary. It is licensed under the <a href="https://creativecommons.org/licenses/by-sa/3.0/">Creative Commons Attribution-Share Alike 3.0 License</a>.<br>The code for the add-on is available on <a href="https://github.com/ThoreBor/CC-CEDICT-for-Anki">GitHub.</a> It is licensed under the <a href="https://github.com/ThoreBor/CC-CEDICT-for-Anki/blob/master/LICENSE">MIT License.</a><br><br>If you like this add-on, rate and review it on <a href="https://ankiweb.net/shared/info/418828045">Anki Web</a>. If you want to report a bug, or make a feature request, please create a new <a href="https://github.com/ThoreBor/CC-CEDICT-for-Anki/issues">issue</a> on GitHub.<br><div>Icon made by <a href="https://www.flaticon.com/authors/freepik" title="Freepik">Freepik</a> from <a href="https://www.flaticon.com/" title="Flaticon">www.flaticon.com</a></div><br>© Thore Tyborski 2020')
showInfo('<h3>CC-CEDICT for Anki v1.2</h3><br>This add-on uses the <a href="https://cc-cedict.org/wiki/">CC-CEDICT</a> dictionary. It is licensed under the <a href="https://creativecommons.org/licenses/by-sa/3.0/">Creative Commons Attribution-Share Alike 3.0 License</a>.<br>The code for the add-on is available on <a href="https://github.com/ThoreBor/CC-CEDICT-for-Anki">GitHub.</a> It is licensed under the <a href="https://github.com/ThoreBor/CC-CEDICT-for-Anki/blob/master/LICENSE">MIT License.</a><br><br>If you like this add-on, rate and review it on <a href="https://ankiweb.net/shared/info/418828045">Anki Web</a>. If you want to report a bug, or make a feature request, please create a new <a href="https://github.com/ThoreBor/CC-CEDICT-for-Anki/issues">issue</a> on GitHub.<br><div>Icon made by <a href="https://www.flaticon.com/authors/freepik" title="Freepik">Freepik</a> from <a href="https://www.flaticon.com/" title="Flaticon">www.flaticon.com</a></div><br>© Thore Tyborski 2020')



Expand Down

0 comments on commit 679ee51

Please sign in to comment.