diff --git a/addon/__init__.py b/addon/__init__.py index 18f59b8..07f7c94 100644 --- a/addon/__init__.py +++ b/addon/__init__.py @@ -21,7 +21,7 @@ # Allow webviews accessing kanjivg svgs, web data for lookups and fonts aqt.mw.addonManager.setWebExports( - __name__, r"(kanjivg/.*\.svg|web/.*|fonts/.*|user_files/fonts/.*)" + __name__, r"(kanjivg/.*\.svg|kanjivg-supplementary/.*\.svg|primitives/.*\.svg|web/.*|fonts/.*|user_files/fonts/.*)" ) diff --git a/addon/card_type.py b/addon/card_type.py index 4db9ed4..52c35fc 100644 --- a/addon/card_type.py +++ b/addon/card_type.py @@ -124,9 +124,12 @@ def field_exists(name): settings_html = f""" """ + common_js = "\n\n" jquery_js = "\n\n" common_back_js = "\n\n" dmak_js = "\n\n" @@ -139,6 +142,7 @@ def field_exists(name): jquery_js + settings_html + "\n\n" + japanese_util_js + + common_js + read_web_file_with_includes(f"front-{self.label}.html") ) template["afmt"] = ( @@ -147,6 +151,7 @@ def field_exists(name): dmak_js + raphael_js + japanese_util_js + + common_js + read_web_file_with_includes(f"back-{self.label}.html") + common_back_js + launch_back_js diff --git a/addon/fonts.py b/addon/fonts.py index 5ba0e0c..470581e 100644 --- a/addon/fonts.py +++ b/addon/fonts.py @@ -23,6 +23,22 @@ def get_col_name(idx): def get_col_path(idx): return util.col_media_path(get_col_name(idx)) +def assure_primitive_col_media(sub_dir=''): + primitive_dir = util.addon_path("primitives",sub_dir) + primitive_files = os.listdir(primitive_dir) + if sub_dir != '': + sub_dir_tag = sub_dir + '_' + else: + sub_dir_tag = '' + for f in primitive_files: + src_path = util.addon_path("primitives", sub_dir, f) + if not os.path.isdir(src_path): + dest_path = util.col_media_path('_primitive_' + sub_dir_tag + f) + shutil.copy(src_path, dest_path) + else: + # subdirectory + assure_primitive_col_media(f) + def get_addon_uri(idx): user_name = config.get("fonts", config_default)[idx] @@ -109,3 +125,4 @@ def ui_css(): def assure_col_media(): for idx in range(font_num): shutil.copy(get_path(idx), get_col_path(idx)) + assure_primitive_col_media() diff --git a/addon/kanji.db b/addon/kanji.db index 882c1ae..4d6f0f7 100644 Binary files a/addon/kanji.db and b/addon/kanji.db differ diff --git a/addon/kanji.py b/addon/kanji.py index d690bc5..052d89b 100644 --- a/addon/kanji.py +++ b/addon/kanji.py @@ -8,7 +8,7 @@ import anki import aqt -from .util import addon_path, user_path, assure_user_dir, unique_characters +from .util import addon_path, user_path, assure_user_dir, unique_characters, custom_list from .errors import InvalidStateError, InvalidDeckError from .card_type import CardType from . import config @@ -24,10 +24,12 @@ def clean_character_field(f): f = f.lstrip() f = text_parser.html_regex.sub("", f) if len(f): + # Leave [primitive_tag] as it is, otherwise return the single unicode character + if f[0] == '[': + return f return f[0] return "" - class KanjiDB: def __init__(self): self.initialize() @@ -155,17 +157,6 @@ def _new_characters_find(self, card_type, character, out, max_characters=-1): if character in out: return - # Check if card already exists for character - table = f"usr.{card_type.label}_card_ids" - r = self.crs_execute_and_fetch_one( - f"SELECT COUNT(*) FROM {table} " - "WHERE character == (?) AND card_id NOT NULL", - (character,), - ) - - if r[0] != 0: - return - # Get primitives primitives_result = self.crs_execute_and_fetch_one( "SELECT primitives FROM characters " "WHERE character == (?)", (character,) @@ -175,6 +166,7 @@ def _new_characters_find(self, card_type, character, out, max_characters=-1): print(f"Lookup of primitive {character} failed.") return primitives = primitives_result[0] + primitives = custom_list(primitives) # Recusivly add primitives that need to be learned if enabled if card_type.add_primitives: @@ -187,6 +179,17 @@ def _new_characters_find(self, card_type, character, out, max_characters=-1): if max_characters >= 0 and len(out) >= max_characters: return + # Check if card already exists for character + table = f"usr.{card_type.label}_card_ids" + r = self.crs_execute_and_fetch_one( + f"SELECT COUNT(*) FROM {table} " + "WHERE character == (?) AND card_id NOT NULL", + (character,), + ) + + if r[0] != 0: + return + out.append(character) # Recursivley find new characters to learn @@ -612,23 +615,18 @@ def make_cards_from_characters(self, card_type, new_characters, checkpoint=None) deck_id = deck["id"] model = aqt.mw.col.models.byName(model_name) - aqt.mw.requireReset() - for c in characters: note = anki.notes.Note(aqt.mw.col, model) note["Character"] = c self.refresh_note(note) add_note_no_hook(aqt.mw.col, note, deck_id) - aqt.mw.maybeReset() - self.recalc_user_cards(card_type) def refresh_note(self, note, do_flush=False): c = clean_character_field(note["Character"]) if len(c) < 1: return - c = c[0] note["Character"] = c r = self.get_kanji_result_data(c, card_ids=False) @@ -637,10 +635,20 @@ def refresh_note(self, note, do_flush=False): data_json_b64 = str(data_json_b64_b, "utf-8") note["MigakuData"] = data_json_b64 - svg_name = "%05x.svg" % ord(c) - svg_path = addon_path("kanjivg", svg_name) + if c[0] == '[': + svg_name = c[1:-1] + ".svg" + else: + svg_name = "%05x.svg" % ord(c) + + # Try to find the KanjiVG file first in supplementary directory and + # only then from the main repository + svg_path = addon_path("kanjivg-supplementary", svg_name) + if not os.path.exists(svg_path): + svg_path = addon_path("kanjivg", svg_name) + if not os.path.exists(svg_path): + svg_path = '' - if os.path.exists(svg_path): + if svg_path != '': with open(svg_path, "r", encoding="utf-8") as file: svg_data = file.read() @@ -651,6 +659,31 @@ def refresh_note(self, note, do_flush=False): if do_flush: note.flush() + # If the deck has cards that have now references for new primitives + # which are not yet included in the stack, add them. + def add_missing_characters(self): + new_kanji_for_msg = OrderedDict() + + for ct in CardType: + if not ct.add_primitives: + continue + + find_filter = f'"note:{ct.model_name}"' + note_ids = aqt.mw.col.find_notes(find_filter) + + all_characters_in_the_deck = [] + for i, note_id in enumerate(note_ids): + note = aqt.mw.col.getNote(note_id) + c = clean_character_field(note["Character"]) + all_characters_in_the_deck.append(c) + + new_characters = self.new_characters(ct, all_characters_in_the_deck, -1) + if len(new_characters) > 0: + new_kanji_for_msg[ct] = new_characters + + if len(new_kanji_for_msg) > 0: + KanjiConfirmDialog.show_new_kanji(new_kanji_for_msg, aqt.mw) + # Recalc everything def recalc_all(self, callback=None): if callback: @@ -664,6 +697,8 @@ def recalc_all(self, callback=None): self.recalc_user_words() + self.add_missing_characters() + find_filter = [f'"note:{ct.model_name}"' for ct in CardType] note_ids = aqt.mw.col.find_notes(" OR ".join(find_filter)) num_notes = len(note_ids) @@ -701,10 +736,10 @@ def get_kanji_result_data( ("grade", _, None), ("jlpt", _, None), ("kanken", _, None), - ("primitives", list, None), - ("primitive_of", list, None), + ("primitives", custom_list, None), + ("primitive_of", custom_list, None), ("primitive_keywords", json.loads, None), - ("primitive_alternatives", list, None), + ("primitive_alternatives", custom_list, None), ("heisig_id5", _, None), ("heisig_id6", _, None), ("heisig_keyword5", _, None), diff --git a/addon/kanji_confirm_dialog.py b/addon/kanji_confirm_dialog.py index 9e41a16..d560aad 100644 --- a/addon/kanji_confirm_dialog.py +++ b/addon/kanji_confirm_dialog.py @@ -55,7 +55,11 @@ def data(self, idx, role): if role == Qt.ItemDataRole.DisplayRole: # This should be a QBrush, but we also use the method - return str(kanji) + if kanji[0] != '[': + return str(kanji) + if role == Qt.ItemDataRole.DecorationRole: + if kanji[0] == '[': + return util.get_pixmap_from_tag(kanji, 35) if role == Qt.ItemDataRole.BackgroundRole: state = self.states[kanji] return QBrush(QColor(self.state_colors[state])) @@ -163,9 +167,10 @@ def __init__(self, parent=None, ct_kanji={}): self.resize(500, 400) - button_box = QDialogButtonBox(QDialogButtonBox.StandardButton.Ok) + button_box = QDialogButtonBox(QDialogButtonBox.StandardButton.Ok | QDialogButtonBox.StandardButton.Cancel) button_box.accepted.connect(self.accept) - lyt.addWidget(button_box) + button_box.rejected.connect(self.reject) + lyt.addWidget(button_box, Qt.AlignmentFlag.AlignRight) self.add_kanji(ct_kanji) diff --git a/addon/kanjivg-supplementary/02e81.svg b/addon/kanjivg-supplementary/02e81.svg new file mode 100644 index 0000000..97608fc --- /dev/null +++ b/addon/kanjivg-supplementary/02e81.svg @@ -0,0 +1,16 @@ + + + + + + + + + + + + 1 + 2 + + + \ No newline at end of file diff --git a/addon/kanjivg-supplementary/02eb6.svg b/addon/kanjivg-supplementary/02eb6.svg new file mode 100644 index 0000000..5e6c570 --- /dev/null +++ b/addon/kanjivg-supplementary/02eb6.svg @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + + + 1 + 2 + 3 + 4 + 5 + 6 + 7 + + \ No newline at end of file diff --git a/addon/kanjivg-supplementary/030ff.svg b/addon/kanjivg-supplementary/030ff.svg new file mode 100644 index 0000000..84af432 --- /dev/null +++ b/addon/kanjivg-supplementary/030ff.svg @@ -0,0 +1,10 @@ + + + + + + + + 1 + + \ No newline at end of file diff --git a/addon/kanjivg-supplementary/0342e.svg b/addon/kanjivg-supplementary/0342e.svg new file mode 100644 index 0000000..e6e0c98 --- /dev/null +++ b/addon/kanjivg-supplementary/0342e.svg @@ -0,0 +1,53 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + + \ No newline at end of file diff --git a/addon/kanjivg-supplementary/03452.svg b/addon/kanjivg-supplementary/03452.svg new file mode 100644 index 0000000..618e44c --- /dev/null +++ b/addon/kanjivg-supplementary/03452.svg @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + + \ No newline at end of file diff --git a/addon/kanjivg-supplementary/03563.svg b/addon/kanjivg-supplementary/03563.svg new file mode 100644 index 0000000..5774cec --- /dev/null +++ b/addon/kanjivg-supplementary/03563.svg @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + + 1 + 2 + 3 + 4 + 5 + + \ No newline at end of file diff --git a/addon/kanjivg-supplementary/039ae.svg b/addon/kanjivg-supplementary/039ae.svg new file mode 100644 index 0000000..9c35bde --- /dev/null +++ b/addon/kanjivg-supplementary/039ae.svg @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1 + 2 + 3 + 4 + 5 + 6 + + \ No newline at end of file diff --git a/addon/kanjivg-supplementary/04491.svg b/addon/kanjivg-supplementary/04491.svg new file mode 100644 index 0000000..d9b86d1 --- /dev/null +++ b/addon/kanjivg-supplementary/04491.svg @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + 1 + 2 + 3 + + \ No newline at end of file diff --git a/addon/kanjivg-supplementary/04e02.svg b/addon/kanjivg-supplementary/04e02.svg new file mode 100644 index 0000000..220cb0f --- /dev/null +++ b/addon/kanjivg-supplementary/04e02.svg @@ -0,0 +1,16 @@ + + + + + + + + + + + + + 1 + 2 + + \ No newline at end of file diff --git a/addon/kanjivg-supplementary/04e1a.svg b/addon/kanjivg-supplementary/04e1a.svg new file mode 100644 index 0000000..602c350 --- /dev/null +++ b/addon/kanjivg-supplementary/04e1a.svg @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + 1 + 2 + 3 + 4 + 5 + + \ No newline at end of file diff --git a/addon/kanjivg-supplementary/04e29.svg b/addon/kanjivg-supplementary/04e29.svg new file mode 100644 index 0000000..fb5ba96 --- /dev/null +++ b/addon/kanjivg-supplementary/04e29.svg @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + 1 + 2 + 3 + + \ No newline at end of file diff --git a/addon/kanjivg-supplementary/04e2c.svg b/addon/kanjivg-supplementary/04e2c.svg new file mode 100644 index 0000000..a7248a1 --- /dev/null +++ b/addon/kanjivg-supplementary/04e2c.svg @@ -0,0 +1,16 @@ + + + + + + + + + + + + 1 + 2 + 3 + + \ No newline at end of file diff --git a/addon/kanjivg-supplementary/04e30.svg b/addon/kanjivg-supplementary/04e30.svg new file mode 100644 index 0000000..b6833a3 --- /dev/null +++ b/addon/kanjivg-supplementary/04e30.svg @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + 1 + 2 + 3 + 4 + + \ No newline at end of file diff --git a/addon/kanjivg-supplementary/04e37.svg b/addon/kanjivg-supplementary/04e37.svg new file mode 100644 index 0000000..7baedad --- /dev/null +++ b/addon/kanjivg-supplementary/04e37.svg @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + 1 + 2 + + \ No newline at end of file diff --git a/addon/kanjivg-supplementary/04e40.svg b/addon/kanjivg-supplementary/04e40.svg new file mode 100644 index 0000000..6fcda6d --- /dev/null +++ b/addon/kanjivg-supplementary/04e40.svg @@ -0,0 +1,12 @@ + + + + + + + + + + 1 + + \ No newline at end of file diff --git a/addon/kanjivg-supplementary/04e47.svg b/addon/kanjivg-supplementary/04e47.svg new file mode 100644 index 0000000..e2c5fe3 --- /dev/null +++ b/addon/kanjivg-supplementary/04e47.svg @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + 1 + 2 + 3 + + \ No newline at end of file diff --git a/addon/kanjivg-supplementary/04ebc.svg b/addon/kanjivg-supplementary/04ebc.svg new file mode 100644 index 0000000..71ad422 --- /dev/null +++ b/addon/kanjivg-supplementary/04ebc.svg @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + 1 + 2 + 3 + + \ No newline at end of file diff --git a/addon/kanjivg-supplementary/05151.svg b/addon/kanjivg-supplementary/05151.svg new file mode 100644 index 0000000..83a14b4 --- /dev/null +++ b/addon/kanjivg-supplementary/05151.svg @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1 + 2 + 3 + 4 + 5 + 6 + 7 + + \ No newline at end of file diff --git a/addon/kanjivg-supplementary/05198.svg b/addon/kanjivg-supplementary/05198.svg new file mode 100644 index 0000000..744b1d3 --- /dev/null +++ b/addon/kanjivg-supplementary/05198.svg @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + 1 + 2 + 3 + 4 + + \ No newline at end of file diff --git a/addon/kanjivg-supplementary/05216.svg b/addon/kanjivg-supplementary/05216.svg new file mode 100644 index 0000000..3bc8ca8 --- /dev/null +++ b/addon/kanjivg-supplementary/05216.svg @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + 1 + 2 + 3 + 4 + 5 + 6 + + \ No newline at end of file diff --git a/addon/kanjivg-supplementary/053d5.svg b/addon/kanjivg-supplementary/053d5.svg new file mode 100644 index 0000000..76f2718 --- /dev/null +++ b/addon/kanjivg-supplementary/053d5.svg @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + + \ No newline at end of file diff --git a/addon/kanjivg-supplementary/053da.svg b/addon/kanjivg-supplementary/053da.svg new file mode 100644 index 0000000..c5b0690 --- /dev/null +++ b/addon/kanjivg-supplementary/053da.svg @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + + \ No newline at end of file diff --git a/addon/kanjivg-supplementary/05485.svg b/addon/kanjivg-supplementary/05485.svg new file mode 100644 index 0000000..f5ec20e --- /dev/null +++ b/addon/kanjivg-supplementary/05485.svg @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + + + + + + + + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + + \ No newline at end of file diff --git a/addon/kanjivg-supplementary/05547.svg b/addon/kanjivg-supplementary/05547.svg new file mode 100644 index 0000000..3c3b905 --- /dev/null +++ b/addon/kanjivg-supplementary/05547.svg @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + + \ No newline at end of file diff --git a/addon/kanjivg-supplementary/05725.svg b/addon/kanjivg-supplementary/05725.svg new file mode 100644 index 0000000..0f5af6a --- /dev/null +++ b/addon/kanjivg-supplementary/05725.svg @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + 1 + 2 + 3 + 4 + 5 + + \ No newline at end of file diff --git a/addon/kanjivg-supplementary/058f4.svg b/addon/kanjivg-supplementary/058f4.svg new file mode 100644 index 0000000..acc5868 --- /dev/null +++ b/addon/kanjivg-supplementary/058f4.svg @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + + + + + + + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + + \ No newline at end of file diff --git a/addon/kanjivg-supplementary/0590b.svg b/addon/kanjivg-supplementary/0590b.svg new file mode 100644 index 0000000..d5558a6 --- /dev/null +++ b/addon/kanjivg-supplementary/0590b.svg @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1 + 2 + 3 + 4 + 5 + 6 + 7 + + \ No newline at end of file diff --git a/addon/kanjivg-supplementary/05917.svg b/addon/kanjivg-supplementary/05917.svg new file mode 100644 index 0000000..b3f9f04 --- /dev/null +++ b/addon/kanjivg-supplementary/05917.svg @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + 1 + 2 + 3 + 4 + 5 + + \ No newline at end of file diff --git a/addon/kanjivg-supplementary/05939.svg b/addon/kanjivg-supplementary/05939.svg new file mode 100644 index 0000000..8facfaf --- /dev/null +++ b/addon/kanjivg-supplementary/05939.svg @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + + + + + + + + 1 + 2 + 3 + 4 + 5 + 6 + + \ No newline at end of file diff --git a/addon/kanjivg-supplementary/05c1e.svg b/addon/kanjivg-supplementary/05c1e.svg new file mode 100644 index 0000000..cd4b4dd --- /dev/null +++ b/addon/kanjivg-supplementary/05c1e.svg @@ -0,0 +1,40 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + + \ No newline at end of file diff --git a/addon/kanjivg-supplementary/05c70.svg b/addon/kanjivg-supplementary/05c70.svg new file mode 100644 index 0000000..4309b6a --- /dev/null +++ b/addon/kanjivg-supplementary/05c70.svg @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + 1 + 2 + 3 + 4 + 5 + 6 + + \ No newline at end of file diff --git a/addon/kanjivg-supplementary/05f00.svg b/addon/kanjivg-supplementary/05f00.svg new file mode 100644 index 0000000..7d96be4 --- /dev/null +++ b/addon/kanjivg-supplementary/05f00.svg @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + 1 + 2 + 3 + 4 + + \ No newline at end of file diff --git a/addon/kanjivg-supplementary/06c10.svg b/addon/kanjivg-supplementary/06c10.svg new file mode 100644 index 0000000..f962456 --- /dev/null +++ b/addon/kanjivg-supplementary/06c10.svg @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + 1 + 2 + 3 + 4 + 5 + + \ No newline at end of file diff --git a/addon/kanjivg-supplementary/07ca6.svg b/addon/kanjivg-supplementary/07ca6.svg new file mode 100644 index 0000000..a816325 --- /dev/null +++ b/addon/kanjivg-supplementary/07ca6.svg @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + 13 + + \ No newline at end of file diff --git a/addon/kanjivg-supplementary/08080.svg b/addon/kanjivg-supplementary/08080.svg new file mode 100644 index 0000000..ea2c1b1 --- /dev/null +++ b/addon/kanjivg-supplementary/08080.svg @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + 1 + 2 + 3 + 4 + + \ No newline at end of file diff --git a/addon/kanjivg-supplementary/08204.svg b/addon/kanjivg-supplementary/08204.svg new file mode 100644 index 0000000..d1dab05 --- /dev/null +++ b/addon/kanjivg-supplementary/08204.svg @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + 12 + + \ No newline at end of file diff --git a/addon/kanjivg-supplementary/096ba.svg b/addon/kanjivg-supplementary/096ba.svg new file mode 100644 index 0000000..6da08bc --- /dev/null +++ b/addon/kanjivg-supplementary/096ba.svg @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + + \ No newline at end of file diff --git a/addon/kanjivg-supplementary/09fb6.svg b/addon/kanjivg-supplementary/09fb6.svg new file mode 100644 index 0000000..a360aff --- /dev/null +++ b/addon/kanjivg-supplementary/09fb6.svg @@ -0,0 +1,16 @@ + + + + + + + + + + + 1 + 2 + 3 + 4 + + \ No newline at end of file diff --git a/addon/kanjivg-supplementary/09fb7.svg b/addon/kanjivg-supplementary/09fb7.svg new file mode 100644 index 0000000..d22caea --- /dev/null +++ b/addon/kanjivg-supplementary/09fb7.svg @@ -0,0 +1,18 @@ + + + + + + + + + + + + + 1 + 2 + 3 + 4 + + \ No newline at end of file diff --git a/addon/kanjivg-supplementary/20087.svg b/addon/kanjivg-supplementary/20087.svg new file mode 100644 index 0000000..aa989dd --- /dev/null +++ b/addon/kanjivg-supplementary/20087.svg @@ -0,0 +1,12 @@ + + + + + + + + + 1 + 2 + + \ No newline at end of file diff --git a/addon/kanjivg-supplementary/20089.svg b/addon/kanjivg-supplementary/20089.svg new file mode 100644 index 0000000..9c17b09 --- /dev/null +++ b/addon/kanjivg-supplementary/20089.svg @@ -0,0 +1,14 @@ + + + + + + + + + + + 1 + 2 + + \ No newline at end of file diff --git a/addon/kanjivg-supplementary/2099d.svg b/addon/kanjivg-supplementary/2099d.svg new file mode 100644 index 0000000..00aca22 --- /dev/null +++ b/addon/kanjivg-supplementary/2099d.svg @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + + + + + + + + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + + \ No newline at end of file diff --git a/addon/kanjivg-supplementary/20ad3.svg b/addon/kanjivg-supplementary/20ad3.svg new file mode 100644 index 0000000..6eddc6e --- /dev/null +++ b/addon/kanjivg-supplementary/20ad3.svg @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + 1 + 2 + 3 + 4 + + \ No newline at end of file diff --git a/addon/kanjivg-supplementary/215d7.svg b/addon/kanjivg-supplementary/215d7.svg new file mode 100644 index 0000000..56f814f --- /dev/null +++ b/addon/kanjivg-supplementary/215d7.svg @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1 + 2 + 3 + 4 + 5 + + \ No newline at end of file diff --git a/addon/kanjivg-supplementary/2298f.svg b/addon/kanjivg-supplementary/2298f.svg new file mode 100644 index 0000000..1df5cb6 --- /dev/null +++ b/addon/kanjivg-supplementary/2298f.svg @@ -0,0 +1,40 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1 + 2 + 3 + 4 + 5 + 6 + + \ No newline at end of file diff --git a/addon/kanjivg-supplementary/26c29.svg b/addon/kanjivg-supplementary/26c29.svg new file mode 100644 index 0000000..61cc770 --- /dev/null +++ b/addon/kanjivg-supplementary/26c29.svg @@ -0,0 +1,40 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + + \ No newline at end of file diff --git a/addon/kanjivg-supplementary/27607.svg b/addon/kanjivg-supplementary/27607.svg new file mode 100644 index 0000000..dd8902a --- /dev/null +++ b/addon/kanjivg-supplementary/27607.svg @@ -0,0 +1,18 @@ + + + + + + + + + + + + + 1 + 2 + 3 + 4 + + \ No newline at end of file diff --git a/addon/kanjivg-supplementary/apron.svg b/addon/kanjivg-supplementary/apron.svg new file mode 100644 index 0000000..c639945 --- /dev/null +++ b/addon/kanjivg-supplementary/apron.svg @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + 1 + 2 + 3 + 4 + 5 + + \ No newline at end of file diff --git a/addon/kanjivg-supplementary/arm.svg b/addon/kanjivg-supplementary/arm.svg new file mode 100644 index 0000000..6da8132 --- /dev/null +++ b/addon/kanjivg-supplementary/arm.svg @@ -0,0 +1,16 @@ + + + + + + + + + + + + + 1 + 2 + + \ No newline at end of file diff --git a/addon/kanjivg-supplementary/banner.svg b/addon/kanjivg-supplementary/banner.svg new file mode 100644 index 0000000..e04679e --- /dev/null +++ b/addon/kanjivg-supplementary/banner.svg @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + + + + 1 + 2 + 3 + 4 + 5 + 6 + + \ No newline at end of file diff --git a/addon/kanjivg-supplementary/birdhouse.svg b/addon/kanjivg-supplementary/birdhouse.svg new file mode 100644 index 0000000..267dbfb --- /dev/null +++ b/addon/kanjivg-supplementary/birdhouse.svg @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + 1 + 2 + 3 + 4 + 5 + 6 + + \ No newline at end of file diff --git a/addon/kanjivg-supplementary/butchers.svg b/addon/kanjivg-supplementary/butchers.svg new file mode 100644 index 0000000..76b7045 --- /dev/null +++ b/addon/kanjivg-supplementary/butchers.svg @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + + \ No newline at end of file diff --git a/addon/kanjivg-supplementary/cabbage.svg b/addon/kanjivg-supplementary/cabbage.svg new file mode 100644 index 0000000..9541d38 --- /dev/null +++ b/addon/kanjivg-supplementary/cabbage.svg @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + + \ No newline at end of file diff --git a/addon/kanjivg-supplementary/caverns.svg b/addon/kanjivg-supplementary/caverns.svg new file mode 100644 index 0000000..4a79e54 --- /dev/null +++ b/addon/kanjivg-supplementary/caverns.svg @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + + + + + + + 1 + 2 + 3 + 4 + 5 + 6 + 7 + + \ No newline at end of file diff --git a/addon/kanjivg-supplementary/celery.svg b/addon/kanjivg-supplementary/celery.svg new file mode 100644 index 0000000..bd5e5d6 --- /dev/null +++ b/addon/kanjivg-supplementary/celery.svg @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + 1 + 2 + 3 + 4 + 5 + + \ No newline at end of file diff --git a/addon/kanjivg-supplementary/condor.svg b/addon/kanjivg-supplementary/condor.svg new file mode 100644 index 0000000..f75ab1a --- /dev/null +++ b/addon/kanjivg-supplementary/condor.svg @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + + + + + + + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + + \ No newline at end of file diff --git a/addon/kanjivg-supplementary/cornstalk.svg b/addon/kanjivg-supplementary/cornstalk.svg new file mode 100644 index 0000000..b56e2ff --- /dev/null +++ b/addon/kanjivg-supplementary/cornstalk.svg @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + 1 + 2 + 3 + + \ No newline at end of file diff --git a/addon/kanjivg-supplementary/fenceposts.svg b/addon/kanjivg-supplementary/fenceposts.svg new file mode 100644 index 0000000..d8998da --- /dev/null +++ b/addon/kanjivg-supplementary/fenceposts.svg @@ -0,0 +1,14 @@ + + + + + + + + + + + 1 + 2 + + \ No newline at end of file diff --git a/addon/kanjivg-supplementary/hairpin.svg b/addon/kanjivg-supplementary/hairpin.svg new file mode 100644 index 0000000..eac5be0 --- /dev/null +++ b/addon/kanjivg-supplementary/hairpin.svg @@ -0,0 +1,16 @@ + + + + + + + + + + + 1 + 2 + 3 + 4 + + \ No newline at end of file diff --git a/addon/kanjivg-supplementary/i_ching.svg b/addon/kanjivg-supplementary/i_ching.svg new file mode 100644 index 0000000..8015aeb --- /dev/null +++ b/addon/kanjivg-supplementary/i_ching.svg @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + + 1 + 2 + 3 + 4 + + \ No newline at end of file diff --git a/addon/kanjivg-supplementary/lidded_crock.svg b/addon/kanjivg-supplementary/lidded_crock.svg new file mode 100644 index 0000000..8bc1376 --- /dev/null +++ b/addon/kanjivg-supplementary/lidded_crock.svg @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + 1 + 2 + 3 + 4 + 5 + 6 + + \ No newline at end of file diff --git a/addon/kanjivg-supplementary/mending.svg b/addon/kanjivg-supplementary/mending.svg new file mode 100644 index 0000000..03a7e41 --- /dev/null +++ b/addon/kanjivg-supplementary/mending.svg @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + 1 + 2 + 3 + 4 + 5 + + \ No newline at end of file diff --git a/addon/kanjivg-supplementary/oaken_tub.svg b/addon/kanjivg-supplementary/oaken_tub.svg new file mode 100644 index 0000000..cb08ba5 --- /dev/null +++ b/addon/kanjivg-supplementary/oaken_tub.svg @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + 1 + 2 + 3 + 4 + 5 + 6 + + \ No newline at end of file diff --git a/addon/kanjivg-supplementary/outhouse.svg b/addon/kanjivg-supplementary/outhouse.svg new file mode 100644 index 0000000..6ac9f80 --- /dev/null +++ b/addon/kanjivg-supplementary/outhouse.svg @@ -0,0 +1,36 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + + \ No newline at end of file diff --git a/addon/kanjivg-supplementary/pegasus.svg b/addon/kanjivg-supplementary/pegasus.svg new file mode 100644 index 0000000..7412435 --- /dev/null +++ b/addon/kanjivg-supplementary/pegasus.svg @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + 11 + + \ No newline at end of file diff --git a/addon/kanjivg-supplementary/piglets.svg b/addon/kanjivg-supplementary/piglets.svg new file mode 100644 index 0000000..7c35982 --- /dev/null +++ b/addon/kanjivg-supplementary/piglets.svg @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + 1 + 2 + 3 + 4 + 5 + + \ No newline at end of file diff --git a/addon/kanjivg-supplementary/plow.svg b/addon/kanjivg-supplementary/plow.svg new file mode 100644 index 0000000..cbff524 --- /dev/null +++ b/addon/kanjivg-supplementary/plow.svg @@ -0,0 +1,14 @@ + + + + + + + + + + + 1 + 2 + + \ No newline at end of file diff --git a/addon/kanjivg-supplementary/purse.svg b/addon/kanjivg-supplementary/purse.svg new file mode 100644 index 0000000..cca1049 --- /dev/null +++ b/addon/kanjivg-supplementary/purse.svg @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + 1 + 2 + 3 + 4 + 5 + + \ No newline at end of file diff --git a/addon/kanjivg-supplementary/quarter.svg b/addon/kanjivg-supplementary/quarter.svg new file mode 100644 index 0000000..3971afa --- /dev/null +++ b/addon/kanjivg-supplementary/quarter.svg @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + + + + + + + + 1 + 2 + 3 + 4 + 5 + 6 + + \ No newline at end of file diff --git a/addon/kanjivg-supplementary/quiver.svg b/addon/kanjivg-supplementary/quiver.svg new file mode 100644 index 0000000..f5ce31a --- /dev/null +++ b/addon/kanjivg-supplementary/quiver.svg @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + 1 + 2 + 3 + 4 + + \ No newline at end of file diff --git a/addon/kanjivg-supplementary/rags.svg b/addon/kanjivg-supplementary/rags.svg new file mode 100644 index 0000000..1d864b3 --- /dev/null +++ b/addon/kanjivg-supplementary/rags.svg @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + 1 + 2 + 3 + 4 + + \ No newline at end of file diff --git a/addon/kanjivg-supplementary/receipt.svg b/addon/kanjivg-supplementary/receipt.svg new file mode 100644 index 0000000..7b941a4 --- /dev/null +++ b/addon/kanjivg-supplementary/receipt.svg @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + 1 + 2 + 3 + + \ No newline at end of file diff --git a/addon/kanjivg-supplementary/schoolhouse.svg b/addon/kanjivg-supplementary/schoolhouse.svg new file mode 100644 index 0000000..f08bb7b --- /dev/null +++ b/addon/kanjivg-supplementary/schoolhouse.svg @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + 1 + 2 + 3 + 4 + 5 + + \ No newline at end of file diff --git a/addon/kanjivg-supplementary/siesta.svg b/addon/kanjivg-supplementary/siesta.svg new file mode 100644 index 0000000..446bf05 --- /dev/null +++ b/addon/kanjivg-supplementary/siesta.svg @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + + \ No newline at end of file diff --git a/addon/kanjivg-supplementary/silage.svg b/addon/kanjivg-supplementary/silage.svg new file mode 100644 index 0000000..ba6f46f --- /dev/null +++ b/addon/kanjivg-supplementary/silage.svg @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + + + + 1 + 2 + 3 + 4 + 5 + 6 + + \ No newline at end of file diff --git a/addon/kanjivg-supplementary/slingshot.svg b/addon/kanjivg-supplementary/slingshot.svg new file mode 100644 index 0000000..23261cd --- /dev/null +++ b/addon/kanjivg-supplementary/slingshot.svg @@ -0,0 +1,12 @@ + + + + + + + + + 1 + 2 + + \ No newline at end of file diff --git a/addon/kanjivg-supplementary/sparkler.svg b/addon/kanjivg-supplementary/sparkler.svg new file mode 100644 index 0000000..51dcd03 --- /dev/null +++ b/addon/kanjivg-supplementary/sparkler.svg @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + 1 + 2 + 3 + 4 + + \ No newline at end of file diff --git a/addon/kanjivg-supplementary/spear.svg b/addon/kanjivg-supplementary/spear.svg new file mode 100644 index 0000000..c271db3 --- /dev/null +++ b/addon/kanjivg-supplementary/spear.svg @@ -0,0 +1,14 @@ + + + + + + + + + + + 1 + 2 + + \ No newline at end of file diff --git a/addon/kanjivg-supplementary/staple_gun.svg b/addon/kanjivg-supplementary/staple_gun.svg new file mode 100644 index 0000000..25bb148 --- /dev/null +++ b/addon/kanjivg-supplementary/staple_gun.svg @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + 1 + 2 + 3 + 4 + 5 + + \ No newline at end of file diff --git a/addon/kanjivg-supplementary/staples.svg b/addon/kanjivg-supplementary/staples.svg new file mode 100644 index 0000000..19e9b89 --- /dev/null +++ b/addon/kanjivg-supplementary/staples.svg @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + 1 + 2 + 3 + 4 + + \ No newline at end of file diff --git a/addon/kanjivg-supplementary/tail_feathers.svg b/addon/kanjivg-supplementary/tail_feathers.svg new file mode 100644 index 0000000..ea74ee4 --- /dev/null +++ b/addon/kanjivg-supplementary/tail_feathers.svg @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + 1 + 2 + 3 + 4 + 5 + + \ No newline at end of file diff --git a/addon/kanjivg-supplementary/tool.svg b/addon/kanjivg-supplementary/tool.svg new file mode 100644 index 0000000..6bafed0 --- /dev/null +++ b/addon/kanjivg-supplementary/tool.svg @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + 1 + 2 + 3 + + \ No newline at end of file diff --git a/addon/kanjivg-supplementary/wall.svg b/addon/kanjivg-supplementary/wall.svg new file mode 100644 index 0000000..ec10cad --- /dev/null +++ b/addon/kanjivg-supplementary/wall.svg @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + 1 + 2 + 3 + + \ No newline at end of file diff --git a/addon/lookup_window.py b/addon/lookup_window.py index 26aebe7..21af3b6 100644 --- a/addon/lookup_window.py +++ b/addon/lookup_window.py @@ -19,6 +19,9 @@ class LookupWindow(QDialog): instance = None kanjivg_uri = util.addon_web_base + "/kanjivg/" + kanjivg_supplementary_uri = util.addon_web_base + "/kanjivg-supplementary/" + primitives_uri = util.addon_web_base + "/primitives/" + cursive_primitives_uri = util.addon_web_base + "/primitives/cursive/" @classmethod def web_uri(cls, name): @@ -88,9 +91,13 @@ def __init__(self, parent=None): f'' f'' f'' + f'' + f'' + f'' f'' f'' f'' + f'' "" ) common_back = ( diff --git a/addon/primitives/apron.svg b/addon/primitives/apron.svg new file mode 100644 index 0000000..41e3121 --- /dev/null +++ b/addon/primitives/apron.svg @@ -0,0 +1,19 @@ + + + + + + + + diff --git a/addon/primitives/arm.svg b/addon/primitives/arm.svg new file mode 100644 index 0000000..452276d --- /dev/null +++ b/addon/primitives/arm.svg @@ -0,0 +1,18 @@ + + + + + + + + diff --git a/addon/primitives/banner.svg b/addon/primitives/banner.svg new file mode 100644 index 0000000..b984713 --- /dev/null +++ b/addon/primitives/banner.svg @@ -0,0 +1,22 @@ + + + + + + + + + diff --git a/addon/primitives/birdhouse.svg b/addon/primitives/birdhouse.svg new file mode 100644 index 0000000..8ea78c3 --- /dev/null +++ b/addon/primitives/birdhouse.svg @@ -0,0 +1,22 @@ + + + + + + + + + diff --git a/addon/primitives/box-small.svg b/addon/primitives/box-small.svg new file mode 100644 index 0000000..0101e35 --- /dev/null +++ b/addon/primitives/box-small.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/addon/primitives/brush-top.svg b/addon/primitives/brush-top.svg new file mode 100644 index 0000000..f857ef9 --- /dev/null +++ b/addon/primitives/brush-top.svg @@ -0,0 +1,25 @@ + + + + + + + + diff --git a/addon/primitives/bucket_of_eels.svg b/addon/primitives/bucket_of_eels.svg new file mode 100644 index 0000000..f6d0b79 --- /dev/null +++ b/addon/primitives/bucket_of_eels.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/addon/primitives/bushes-side.svg b/addon/primitives/bushes-side.svg new file mode 100644 index 0000000..3e51e4b --- /dev/null +++ b/addon/primitives/bushes-side.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/addon/primitives/butchers.svg b/addon/primitives/butchers.svg new file mode 100644 index 0000000..18e2895 --- /dev/null +++ b/addon/primitives/butchers.svg @@ -0,0 +1,25 @@ + + + + + + + + + + + diff --git a/addon/primitives/cabbage.svg b/addon/primitives/cabbage.svg new file mode 100644 index 0000000..5b60d90 --- /dev/null +++ b/addon/primitives/cabbage.svg @@ -0,0 +1,23 @@ + + + + + + + + + diff --git a/addon/primitives/caverns.svg b/addon/primitives/caverns.svg new file mode 100644 index 0000000..96a55f9 --- /dev/null +++ b/addon/primitives/caverns.svg @@ -0,0 +1,19 @@ + + + + + + + + diff --git a/addon/primitives/celery.svg b/addon/primitives/celery.svg new file mode 100644 index 0000000..8da1a7b --- /dev/null +++ b/addon/primitives/celery.svg @@ -0,0 +1,18 @@ + + + + + + + + diff --git a/addon/primitives/condor.svg b/addon/primitives/condor.svg new file mode 100644 index 0000000..55739d5 --- /dev/null +++ b/addon/primitives/condor.svg @@ -0,0 +1,27 @@ + + + + + + + + + + + + diff --git a/addon/primitives/cornstalk.svg b/addon/primitives/cornstalk.svg new file mode 100644 index 0000000..026d732 --- /dev/null +++ b/addon/primitives/cornstalk.svg @@ -0,0 +1,15 @@ + + + + + + + + diff --git a/addon/primitives/cursive/apron.svg b/addon/primitives/cursive/apron.svg new file mode 100644 index 0000000..46b0a23 --- /dev/null +++ b/addon/primitives/cursive/apron.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/addon/primitives/cursive/arm.svg b/addon/primitives/cursive/arm.svg new file mode 100644 index 0000000..052be8d --- /dev/null +++ b/addon/primitives/cursive/arm.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/addon/primitives/cursive/banner.svg b/addon/primitives/cursive/banner.svg new file mode 100644 index 0000000..3fb173c --- /dev/null +++ b/addon/primitives/cursive/banner.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/addon/primitives/cursive/birdhouse.svg b/addon/primitives/cursive/birdhouse.svg new file mode 100644 index 0000000..6140fa8 --- /dev/null +++ b/addon/primitives/cursive/birdhouse.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/addon/primitives/cursive/butchers.svg b/addon/primitives/cursive/butchers.svg new file mode 100644 index 0000000..9e6362b --- /dev/null +++ b/addon/primitives/cursive/butchers.svg @@ -0,0 +1,45 @@ + + + + + + + + + + + + diff --git a/addon/primitives/cursive/cabbage.svg b/addon/primitives/cursive/cabbage.svg new file mode 100644 index 0000000..014e188 --- /dev/null +++ b/addon/primitives/cursive/cabbage.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/addon/primitives/cursive/caverns.svg b/addon/primitives/cursive/caverns.svg new file mode 100644 index 0000000..96246d8 --- /dev/null +++ b/addon/primitives/cursive/caverns.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/addon/primitives/cursive/celery.svg b/addon/primitives/cursive/celery.svg new file mode 100644 index 0000000..599b647 --- /dev/null +++ b/addon/primitives/cursive/celery.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/addon/primitives/cursive/condor.svg b/addon/primitives/cursive/condor.svg new file mode 100644 index 0000000..a23d6e3 --- /dev/null +++ b/addon/primitives/cursive/condor.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/addon/primitives/cursive/cornstalk.svg b/addon/primitives/cursive/cornstalk.svg new file mode 100644 index 0000000..01df3a0 --- /dev/null +++ b/addon/primitives/cursive/cornstalk.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/addon/primitives/cursive/fenceposts.svg b/addon/primitives/cursive/fenceposts.svg new file mode 100644 index 0000000..bbaddb6 --- /dev/null +++ b/addon/primitives/cursive/fenceposts.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/addon/primitives/cursive/futon.svg b/addon/primitives/cursive/futon.svg new file mode 100644 index 0000000..da4ba62 --- /dev/null +++ b/addon/primitives/cursive/futon.svg @@ -0,0 +1,45 @@ + + + + + + + + + + diff --git a/addon/primitives/cursive/hair.svg b/addon/primitives/cursive/hair.svg new file mode 100644 index 0000000..c54fe90 --- /dev/null +++ b/addon/primitives/cursive/hair.svg @@ -0,0 +1,23 @@ + + + + + + + + diff --git a/addon/primitives/cursive/hairpin.svg b/addon/primitives/cursive/hairpin.svg new file mode 100644 index 0000000..9ab56b5 --- /dev/null +++ b/addon/primitives/cursive/hairpin.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/addon/primitives/cursive/i_ching.svg b/addon/primitives/cursive/i_ching.svg new file mode 100644 index 0000000..cfe7b8b --- /dev/null +++ b/addon/primitives/cursive/i_ching.svg @@ -0,0 +1,23 @@ + + + + + + + + + + + diff --git a/addon/primitives/cursive/lidded_crock.svg b/addon/primitives/cursive/lidded_crock.svg new file mode 100644 index 0000000..a1d04be --- /dev/null +++ b/addon/primitives/cursive/lidded_crock.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/addon/primitives/cursive/mending.svg b/addon/primitives/cursive/mending.svg new file mode 100644 index 0000000..7af1d4b --- /dev/null +++ b/addon/primitives/cursive/mending.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/addon/primitives/cursive/oaken_tub.svg b/addon/primitives/cursive/oaken_tub.svg new file mode 100644 index 0000000..6a75685 --- /dev/null +++ b/addon/primitives/cursive/oaken_tub.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/addon/primitives/cursive/outhouse.svg b/addon/primitives/cursive/outhouse.svg new file mode 100644 index 0000000..49ffcc9 --- /dev/null +++ b/addon/primitives/cursive/outhouse.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/addon/primitives/cursive/pegasus.svg b/addon/primitives/cursive/pegasus.svg new file mode 100644 index 0000000..b694111 --- /dev/null +++ b/addon/primitives/cursive/pegasus.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/addon/primitives/cursive/piglets.svg b/addon/primitives/cursive/piglets.svg new file mode 100644 index 0000000..128ea2c --- /dev/null +++ b/addon/primitives/cursive/piglets.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/addon/primitives/cursive/plow.svg b/addon/primitives/cursive/plow.svg new file mode 100644 index 0000000..479e3a9 --- /dev/null +++ b/addon/primitives/cursive/plow.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/addon/primitives/cursive/purse.svg b/addon/primitives/cursive/purse.svg new file mode 100644 index 0000000..2448b1e --- /dev/null +++ b/addon/primitives/cursive/purse.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/addon/primitives/cursive/quarter.svg b/addon/primitives/cursive/quarter.svg new file mode 100644 index 0000000..7c6c7c2 --- /dev/null +++ b/addon/primitives/cursive/quarter.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/addon/primitives/cursive/quiver.svg b/addon/primitives/cursive/quiver.svg new file mode 100644 index 0000000..0b226b9 --- /dev/null +++ b/addon/primitives/cursive/quiver.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/addon/primitives/cursive/rags.svg b/addon/primitives/cursive/rags.svg new file mode 100644 index 0000000..685c179 --- /dev/null +++ b/addon/primitives/cursive/rags.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/addon/primitives/cursive/receipt.svg b/addon/primitives/cursive/receipt.svg new file mode 100644 index 0000000..eb2ad65 --- /dev/null +++ b/addon/primitives/cursive/receipt.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/addon/primitives/cursive/schoolhouse.svg b/addon/primitives/cursive/schoolhouse.svg new file mode 100644 index 0000000..22351eb --- /dev/null +++ b/addon/primitives/cursive/schoolhouse.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/addon/primitives/cursive/siesta.svg b/addon/primitives/cursive/siesta.svg new file mode 100644 index 0000000..23c797b --- /dev/null +++ b/addon/primitives/cursive/siesta.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/addon/primitives/cursive/silage.svg b/addon/primitives/cursive/silage.svg new file mode 100644 index 0000000..6af32ae --- /dev/null +++ b/addon/primitives/cursive/silage.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/addon/primitives/cursive/slingshot.svg b/addon/primitives/cursive/slingshot.svg new file mode 100644 index 0000000..75331d5 --- /dev/null +++ b/addon/primitives/cursive/slingshot.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/addon/primitives/cursive/sparkler.svg b/addon/primitives/cursive/sparkler.svg new file mode 100644 index 0000000..f2ac43a --- /dev/null +++ b/addon/primitives/cursive/sparkler.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/addon/primitives/cursive/spear.svg b/addon/primitives/cursive/spear.svg new file mode 100644 index 0000000..f96f345 --- /dev/null +++ b/addon/primitives/cursive/spear.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/addon/primitives/cursive/staple_gun.svg b/addon/primitives/cursive/staple_gun.svg new file mode 100644 index 0000000..9ba621b --- /dev/null +++ b/addon/primitives/cursive/staple_gun.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/addon/primitives/cursive/staples.svg b/addon/primitives/cursive/staples.svg new file mode 100644 index 0000000..a5d4c59 --- /dev/null +++ b/addon/primitives/cursive/staples.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/addon/primitives/cursive/tail_feathers.svg b/addon/primitives/cursive/tail_feathers.svg new file mode 100644 index 0000000..e19f562 --- /dev/null +++ b/addon/primitives/cursive/tail_feathers.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/addon/primitives/cursive/tool.svg b/addon/primitives/cursive/tool.svg new file mode 100644 index 0000000..9718180 --- /dev/null +++ b/addon/primitives/cursive/tool.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/addon/primitives/cursive/wall.svg b/addon/primitives/cursive/wall.svg new file mode 100644 index 0000000..adf3b4e --- /dev/null +++ b/addon/primitives/cursive/wall.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/addon/primitives/deer-abbreviated.svg b/addon/primitives/deer-abbreviated.svg new file mode 100644 index 0000000..2563df2 --- /dev/null +++ b/addon/primitives/deer-abbreviated.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/addon/primitives/dollar_sign-below.svg b/addon/primitives/dollar_sign-below.svg new file mode 100644 index 0000000..229fc7c --- /dev/null +++ b/addon/primitives/dollar_sign-below.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/addon/primitives/drag-bottom.svg b/addon/primitives/drag-bottom.svg new file mode 100644 index 0000000..946a385 --- /dev/null +++ b/addon/primitives/drag-bottom.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/addon/primitives/eel.svg b/addon/primitives/eel.svg new file mode 100644 index 0000000..d5f13aa --- /dev/null +++ b/addon/primitives/eel.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/addon/primitives/fenceposts.svg b/addon/primitives/fenceposts.svg new file mode 100644 index 0000000..27c1902 --- /dev/null +++ b/addon/primitives/fenceposts.svg @@ -0,0 +1,16 @@ + + + + + + + + + diff --git a/addon/primitives/flood-bottom.svg b/addon/primitives/flood-bottom.svg new file mode 100644 index 0000000..128cf4e --- /dev/null +++ b/addon/primitives/flood-bottom.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/addon/primitives/futon.svg b/addon/primitives/futon.svg new file mode 100644 index 0000000..89e07e0 --- /dev/null +++ b/addon/primitives/futon.svg @@ -0,0 +1,29 @@ + + + + + + + + + + diff --git a/addon/primitives/genie_in_the_bottle.svg b/addon/primitives/genie_in_the_bottle.svg new file mode 100644 index 0000000..da43df6 --- /dev/null +++ b/addon/primitives/genie_in_the_bottle.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/addon/primitives/go_in.svg b/addon/primitives/go_in.svg new file mode 100644 index 0000000..301c482 --- /dev/null +++ b/addon/primitives/go_in.svg @@ -0,0 +1,17 @@ + + + + + + + + + diff --git a/addon/primitives/hairpin.svg b/addon/primitives/hairpin.svg new file mode 100644 index 0000000..ac74366 --- /dev/null +++ b/addon/primitives/hairpin.svg @@ -0,0 +1,19 @@ + + + + + + + + diff --git a/addon/primitives/halo.svg b/addon/primitives/halo.svg new file mode 100644 index 0000000..f83b653 --- /dev/null +++ b/addon/primitives/halo.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/addon/primitives/i_ching.svg b/addon/primitives/i_ching.svg new file mode 100644 index 0000000..d5e3781 --- /dev/null +++ b/addon/primitives/i_ching.svg @@ -0,0 +1,15 @@ + + + + + + + + + + + diff --git a/addon/primitives/in_a_row_upside_down.svg b/addon/primitives/in_a_row_upside_down.svg new file mode 100644 index 0000000..7bbd8e9 --- /dev/null +++ b/addon/primitives/in_a_row_upside_down.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/addon/primitives/lidded_crock.svg b/addon/primitives/lidded_crock.svg new file mode 100644 index 0000000..31501d4 --- /dev/null +++ b/addon/primitives/lidded_crock.svg @@ -0,0 +1,17 @@ + + + + + + + + + diff --git a/addon/primitives/mama-top.svg b/addon/primitives/mama-top.svg new file mode 100644 index 0000000..a1353b7 --- /dev/null +++ b/addon/primitives/mama-top.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/addon/primitives/mane.svg b/addon/primitives/mane.svg new file mode 100644 index 0000000..55b0e6e --- /dev/null +++ b/addon/primitives/mane.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/addon/primitives/meeting.svg b/addon/primitives/meeting.svg new file mode 100644 index 0000000..077f8d4 --- /dev/null +++ b/addon/primitives/meeting.svg @@ -0,0 +1,16 @@ + + + + + + + + + diff --git a/addon/primitives/mending.svg b/addon/primitives/mending.svg new file mode 100644 index 0000000..8832d1f --- /dev/null +++ b/addon/primitives/mending.svg @@ -0,0 +1,19 @@ + + + + + + + + diff --git a/addon/primitives/oaken_tub.svg b/addon/primitives/oaken_tub.svg new file mode 100644 index 0000000..1638b80 --- /dev/null +++ b/addon/primitives/oaken_tub.svg @@ -0,0 +1,19 @@ + + + + + + + + diff --git a/addon/primitives/outhouse.svg b/addon/primitives/outhouse.svg new file mode 100644 index 0000000..e6a52c2 --- /dev/null +++ b/addon/primitives/outhouse.svg @@ -0,0 +1,22 @@ + + + + + + + + + diff --git a/addon/primitives/pegasus.svg b/addon/primitives/pegasus.svg new file mode 100644 index 0000000..46d0704 --- /dev/null +++ b/addon/primitives/pegasus.svg @@ -0,0 +1,26 @@ + + + + + + + + diff --git a/addon/primitives/piglets.svg b/addon/primitives/piglets.svg new file mode 100644 index 0000000..b22fc91 --- /dev/null +++ b/addon/primitives/piglets.svg @@ -0,0 +1,24 @@ + + + + + + + + + + diff --git a/addon/primitives/plow.svg b/addon/primitives/plow.svg new file mode 100644 index 0000000..c54e8af --- /dev/null +++ b/addon/primitives/plow.svg @@ -0,0 +1,14 @@ + + + + + + + + diff --git a/addon/primitives/purse.svg b/addon/primitives/purse.svg new file mode 100644 index 0000000..12fc70f --- /dev/null +++ b/addon/primitives/purse.svg @@ -0,0 +1,18 @@ + + + + + + + + + diff --git a/addon/primitives/quarter.svg b/addon/primitives/quarter.svg new file mode 100644 index 0000000..578a4ab --- /dev/null +++ b/addon/primitives/quarter.svg @@ -0,0 +1,25 @@ + + + + + + + + diff --git a/addon/primitives/quiver.svg b/addon/primitives/quiver.svg new file mode 100644 index 0000000..868b736 --- /dev/null +++ b/addon/primitives/quiver.svg @@ -0,0 +1,20 @@ + + + + + + + + + + diff --git a/addon/primitives/rags.svg b/addon/primitives/rags.svg new file mode 100644 index 0000000..bb3e504 --- /dev/null +++ b/addon/primitives/rags.svg @@ -0,0 +1,18 @@ + + + + + + + + diff --git a/addon/primitives/receipt-left.svg b/addon/primitives/receipt-left.svg new file mode 100644 index 0000000..facc092 --- /dev/null +++ b/addon/primitives/receipt-left.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/addon/primitives/receipt.svg b/addon/primitives/receipt.svg new file mode 100644 index 0000000..96c1f9d --- /dev/null +++ b/addon/primitives/receipt.svg @@ -0,0 +1,18 @@ + + + + + + + + diff --git a/addon/primitives/row-bottom.svg b/addon/primitives/row-bottom.svg new file mode 100644 index 0000000..31381a3 --- /dev/null +++ b/addon/primitives/row-bottom.svg @@ -0,0 +1,23 @@ + + + + + + + + + + diff --git a/addon/primitives/scarf-unhooked.svg b/addon/primitives/scarf-unhooked.svg new file mode 100644 index 0000000..b217040 --- /dev/null +++ b/addon/primitives/scarf-unhooked.svg @@ -0,0 +1,17 @@ + + + + + + + + diff --git a/addon/primitives/schoolhouse.svg b/addon/primitives/schoolhouse.svg new file mode 100644 index 0000000..9c13f78 --- /dev/null +++ b/addon/primitives/schoolhouse.svg @@ -0,0 +1,18 @@ + + + + + + + + diff --git a/addon/primitives/siesta.svg b/addon/primitives/siesta.svg new file mode 100644 index 0000000..2b103e8 --- /dev/null +++ b/addon/primitives/siesta.svg @@ -0,0 +1,25 @@ + + + + + + + + diff --git a/addon/primitives/silage.svg b/addon/primitives/silage.svg new file mode 100644 index 0000000..9504548 --- /dev/null +++ b/addon/primitives/silage.svg @@ -0,0 +1,19 @@ + + + + + + + + diff --git a/addon/primitives/silver-left.svg b/addon/primitives/silver-left.svg new file mode 100644 index 0000000..57a9df3 --- /dev/null +++ b/addon/primitives/silver-left.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/addon/primitives/slingshot.svg b/addon/primitives/slingshot.svg new file mode 100644 index 0000000..c6859e1 --- /dev/null +++ b/addon/primitives/slingshot.svg @@ -0,0 +1,18 @@ + + + + + + + + diff --git a/addon/primitives/sparkler.svg b/addon/primitives/sparkler.svg new file mode 100644 index 0000000..fe0caff --- /dev/null +++ b/addon/primitives/sparkler.svg @@ -0,0 +1,21 @@ + + + + + + + + + + + diff --git a/addon/primitives/spear.svg b/addon/primitives/spear.svg new file mode 100644 index 0000000..b83cc79 --- /dev/null +++ b/addon/primitives/spear.svg @@ -0,0 +1,16 @@ + + + + + + + + + diff --git a/addon/primitives/spring-small.svg b/addon/primitives/spring-small.svg new file mode 100644 index 0000000..4dd459d --- /dev/null +++ b/addon/primitives/spring-small.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/addon/primitives/staple_gun.svg b/addon/primitives/staple_gun.svg new file mode 100644 index 0000000..925dbf1 --- /dev/null +++ b/addon/primitives/staple_gun.svg @@ -0,0 +1,18 @@ + + + + + + + + diff --git a/addon/primitives/staples.svg b/addon/primitives/staples.svg new file mode 100644 index 0000000..a48f0b8 --- /dev/null +++ b/addon/primitives/staples.svg @@ -0,0 +1,15 @@ + + + + + + + + diff --git a/addon/primitives/tail_feathers.svg b/addon/primitives/tail_feathers.svg new file mode 100644 index 0000000..afdc468 --- /dev/null +++ b/addon/primitives/tail_feathers.svg @@ -0,0 +1,24 @@ + + + + + + + + + + + + diff --git a/addon/primitives/tall.svg b/addon/primitives/tall.svg new file mode 100644 index 0000000..3340dce --- /dev/null +++ b/addon/primitives/tall.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/addon/primitives/tool.svg b/addon/primitives/tool.svg new file mode 100644 index 0000000..fa32e65 --- /dev/null +++ b/addon/primitives/tool.svg @@ -0,0 +1,18 @@ + + + + + + + + + + diff --git a/addon/primitives/top_hat_and_scarf.svg b/addon/primitives/top_hat_and_scarf.svg new file mode 100644 index 0000000..8a18352 --- /dev/null +++ b/addon/primitives/top_hat_and_scarf.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/addon/primitives/wall.svg b/addon/primitives/wall.svg new file mode 100644 index 0000000..ae03927 --- /dev/null +++ b/addon/primitives/wall.svg @@ -0,0 +1,17 @@ + + + + + + + + diff --git a/addon/stats_window.py b/addon/stats_window.py index a512739..78ad293 100644 --- a/addon/stats_window.py +++ b/addon/stats_window.py @@ -403,6 +403,10 @@ def refresh(self): class_ = "known" category_good += 1 + if kanji[0] == "[": + img = kanji[1:-1] + path = util.addon_web_uri('primitives','%s.svg' % img) + kanji = f'' entry_pts.append(f'' + kanji + "") category_count = len(entries) diff --git a/addon/util.py b/addon/util.py index 86a3dff..6080bc4 100644 --- a/addon/util.py +++ b/addon/util.py @@ -2,6 +2,7 @@ import sys import re from collections import OrderedDict +import re import anki import aqt @@ -57,14 +58,24 @@ def make_icon(*file_parts): def default_icon(): return make_icon("migaku.png") +# Creates a list of single-character Unicode kanjis and [primitive] tags +# For example '[banner]也' -> ['\[banner\]','也'] +def custom_list(l): + g = re.findall(r'([^\[]|\[[^\]]+\])',l) + return g def unique_characters(string): - return list(OrderedDict((c, True) for c in string).keys()) - + l = custom_list(string) + return list(OrderedDict((c, True) for c in l).keys()) import aqt from aqt.qt import * +def get_pixmap_from_tag(kanji, size): + img = kanji[1:-1] + path = addon_path('primitives','%s.svg' % img) + pixmap = QIcon(path).pixmap(QSize(size,size)) + return pixmap def log(*args): print("[Migaku Kanji]", *args) diff --git a/addon/web/back-production.html b/addon/web/back-production.html index 51f0e19..d3337c1 100644 --- a/addon/web/back-production.html +++ b/addon/web/back-production.html @@ -36,10 +36,10 @@

Font examples

@@ -163,12 +163,6 @@

- - - - diff --git a/addon/web/back-recognition.html b/addon/web/back-recognition.html index 47c8f00..504dd38 100644 --- a/addon/web/back-recognition.html +++ b/addon/web/back-recognition.html @@ -16,10 +16,10 @@
- - - -
    -
  • -
  • -
  • -
  • +
  • +
  • +
  • +
]+)>)/gi, ''); // Needed because of Migaku Editor :| var data_json = atob(data_b64); var data = JSON.parse(data_json); - $('.keyword-kanji').html(data.character); + display_characters('recognition') var max_words = settings.words_max; var word_front_pts = []; diff --git a/addon/web/lookup.html b/addon/web/lookup.html index 4302a1d..c801446 100644 --- a/addon/web/lookup.html +++ b/addon/web/lookup.html @@ -42,10 +42,10 @@

Font examples

    -
  • -
  • -
  • -
  • +
  • +
  • +
  • +
diff --git a/addon/web/stats_styles.css b/addon/web/stats_styles.css index b9fcde1..da4c89b 100644 --- a/addon/web/stats_styles.css +++ b/addon/web/stats_styles.css @@ -207,6 +207,10 @@ label.toggle { color: #ffffff; } +.fullColor .kanji img { + filter: invert(99%) sepia(50%) saturate(2%) hue-rotate(181deg) brightness(114%) contrast(101%); +} + /* Dark */ .dark .tooltip_toggle { diff --git a/addon/web/styles.css b/addon/web/styles.css index a5e24f4..a58d90e 100644 --- a/addon/web/styles.css +++ b/addon/web/styles.css @@ -117,6 +117,16 @@ body.dark { color: #fff; } + +body.ankidroid_dark_mode .character-and-examples__character img, +body.nightMode .character-and-examples__character img, +body.dark .character-and-examples__character img, +body.ankidroid_dark_mode .font-examples__character img, +body.nightMode .font-examples__character img, +body.dark .font-examples__character img { + filter: invert(99%) sepia(50%) saturate(2%) hue-rotate(181deg) brightness(114%) contrast(101%); +} + .meanings__title, .keyword-and-meaning__keyword, h3, @@ -906,6 +916,15 @@ body.dark { padding: 0 10px; } +.character-and-examples__character img { + align-items: center; + position: relative; + top: 2px; + width: auto; + height: 100px; + padding: 0 10px; +} + .character-and-examples__example-words { flex-wrap: wrap; margin-bottom: 0; @@ -1485,6 +1504,15 @@ body.dark { padding: 0 10px; } +.font-examples__character img { + align-items: center; + position: relative; + top: 2px; + width: auto; + height: 80px; + padding: 0 10px; +} + .font-examples__character:first-child { padding-left: 0; } @@ -2128,6 +2156,15 @@ html:not(.mobile) margin-left: 5px; } +.primitives-and-radicals__alternatives .primitive-alternatives img { + height: auto; + opacity: 1; + position: relative; + top: 0px; + padding: 0px; + width: 20px; +} + .primitiveDetails h3 { margin: 0; } @@ -2137,6 +2174,10 @@ html:not(.mobile) margin-bottom: 10px; } +.primitiveDetails-alternatives img { + height: 20px; +} + button.primitive { background: #2880ff; font-family: inherit; @@ -2144,6 +2185,16 @@ button.primitive { position: relative; } +button.primitive img { + filter: invert(99%) sepia(50%) saturate(2%) hue-rotate(181deg) brightness(114%) contrast(101%); +} + +.ankidroid_dark_mode button.primitive img, +.nightMode button.primitive img, +.dark button.primitive img { + filter: invert(19%) sepia(7%) saturate(2109%) hue-rotate(184deg) brightness(88%) contrast(81%); +} + button.primitive:hover, button.primitive:focus { background: #004fc1; @@ -2316,6 +2367,15 @@ button.radical { margin-bottom: 0; } +.stories__content img { + height: auto; + position: relative; + top: 0px; + padding: 0px; + width: 20px; + margin-bottom: 0; +} + .actions-back__container { align-items: center; display: flex; diff --git a/tools/db_merge_tsv.py b/tools/db_merge_tsv.py new file mode 100644 index 0000000..bde17f3 --- /dev/null +++ b/tools/db_merge_tsv.py @@ -0,0 +1,279 @@ +# +# Merges changed kanjis/primitives listed in kanji-ext.tsv with kanji.db +# Recalculates also primitives-of list +# +import sqlite3 +import json +import sys +import os +import re +import logging + +# Creates a list of single-character Unicode kanjis and [primitive] tags +# For example '[banner]也' -> ['\[banner\]','也'] +def custom_list(l): + g = re.findall(r'([^\[]|\[[^\]]+\])',l) + return g + +# create multi-line string for better readibility in markdown tables +def multiLine(src_list,n): + chunks = [src_list[i:i+n] for i in range(0, len(src_list), n)] + lines = [ ''.join(chunk) for chunk in chunks ] + return '
'.join(lines) + +ext_tsv_path = sys.argv[1] if len(sys.argv) > 1 else "addon/kanji-ext3.tsv" +db_path = sys.argv[2] if len(sys.argv) > 2 else "addon/kanji.db" +log_path = sys.argv[3] if len(sys.argv) > 3 else "db_merge_log.md" +db_path = os.path.abspath(db_path) + +### set up logging +targets = logging.StreamHandler(sys.stdout), logging.FileHandler(log_path,'w+') +logging.basicConfig(format='%(message)s', level=logging.INFO, handlers=targets) + +con = sqlite3.connect(db_path) +crs = con.cursor() + +fields = [ + "character", + "meanings", + "primitive_alternatives", + "primitives", + "heisig_keyword5", + "heisig_keyword6", + "primitive_keywords", + "heisig_story", + "heisig_comment", + "radicals", +] + +update_fields = fields[1:] + +insert_sql = ( + f'INSERT OR IGNORE into characters ({",".join(fields)}) values ({",".join("?"*len(fields))})' +) +update_sql = ( + f'UPDATE characters SET {"=? , ".join(update_fields)}=? WHERE character=?' +) +update_prim_of_sql = ( + f'UPDATE characters SET primitive_of=? WHERE character=?' +) +delete_sql = ( + f'DELETE FROM characters WHERE character=?' +) + +def to_json_list_str(csv): + if csv!= '': + item_list = csv.split(',') + clean_list = [item.strip() for item in item_list] + return json.dumps(clean_list) + return '[]' + +def j2c(d): + return ", ".join(json.loads(d)) + +# (field_name, load_function, column) +_ = lambda x: x +field_conversion = [ + (0,"character", _, None), + (1,"meanings", to_json_list_str, None), + (2,"primitive_alternatives", _, None), + (3,"primitives", _, None), + (4,"heisig_keyword5", _, None), + (5,"heisig_keyword6", _, None), + (6,"primitive_keywords", to_json_list_str, None), + (7,"heisig_story", _, None), + (8,"heisig_comment", _, None), + (9,"radicals", _, None), +] + +field_conversion_reverse = [ + (0,"character", _, None), + (1,"meanings", j2c, None), + (2,"primitive_alternatives", _, None), + (3,"primitives", _, None), + (4,"heisig_keyword5", _, None), + (5,"heisig_keyword6", _, None), + (6,"primitive_keywords", j2c, None), + (7,"heisig_story", _, None), + (8,"heisig_comment", _, None), + (9,"radicals", _, None), +] + +processed_kanji_list = [] +total_changes = 0 +line_number = 0 + +for l in open(ext_tsv_path, "r", encoding="utf-8"): + + line_number += 1 + + d = l.replace("\n", "").split("\t") + if len(d[0]) == 0: + logging.info("") + continue + if d[0] == 'Kanji' or d[0] == 'character': # omit the header + continue + if d[0][0]=='#': # only log the comments + # modify the comments so they look better in markdown + hash_count = d[0].count('#') + cleaned_comment = d[0].replace('#', '') + if hash_count > 5: + logging.info('----') + comment = '## ' + cleaned_comment + elif hash_count > 1: + comment = '###' + cleaned_comment + else: + comment = '####' + cleaned_comment + logging.info(comment) + continue + + if d[1] == 'DELETE': + logging.info("# DELETE %s",d[0]) + crs.execute(delete_sql, (d[0],) ) + con.commit() + continue + + if len(d) != 10: + raise Exception("Error! Line %d - wrong length in data: %s" % (line_number, str(d))) + + kanji = d[0].strip() + + if kanji in processed_kanji_list: + raise Exception("Kanji %s already processed! Remove duplicate from line %d" % (kanji,line_number)) + + processed_kanji_list.append(kanji) + + # create header + pretty_header = kanji + if d[4] != '': + pretty_header += ' ' + d[6] + if d[6] != '': + pretty_header += ' / ' + d[6] + elif d[6] != '': + pretty_header += ' ' + d[6] + pretty_header += ' (' + d[1] + ')' + + # Check if card already exists for character + crs.execute( + f'SELECT {",".join(fields)} FROM characters WHERE character == (?)', + (kanji,), + ) + + res = crs.fetchall() + if len(res) > 0: + + old = list(res[0]) + + # old data: create value strings for better readibility + old_string = dict() + for data, (idx, name, load_func, _) in zip(old, field_conversion_reverse): + old_string[idx] = load_func(data) + + # convert data to json format for modifying to database + converted_d = d.copy() + for data, (idx, name, load_func, _) in zip(d, field_conversion): + converted_d[idx] = load_func(data) + + if old != converted_d: + + logging.info('#### ' + pretty_header) + + logging.info("| Field | Old value | New value |" ) + logging.info("|---|---|---|" ) + + for (idx, field_name, _, _,) in field_conversion: + if old[idx] != converted_d[idx] and not (old[idx] is None and converted_d[idx]==''): + logging.info("| %s | %s | %s |" % (field_name.ljust(20), old_string[idx], d[idx])) + total_changes += 1 + + update_d = converted_d[1:] + [converted_d[0]] + crs.execute(update_sql, update_d) + con.commit() + + else: + logging.info("#### %s (NEW ITEM)" % pretty_header) + + logging.info("| Field | Value |" ) + logging.info("|---|---|" ) + + # convert data to json format for modifying to database + converted_d = d.copy() + for data, (idx, field_name, load_func, _) in zip(d, field_conversion): + converted_d[idx] = load_func(data) + logging.info("| %s | %s |" % (field_name, d[idx])) + total_changes += 1 + + crs.execute(insert_sql, converted_d) + con.commit() + +logging.info("Processed %d items with total %d changes" % (len(processed_kanji_list), total_changes)) + +################################################################## +print("Reconstructing primitive_of lists..") + +crs.execute("SELECT * FROM characters") +data = crs.fetchall() + +column_names = [description[0] for description in crs.description] +print("kanji.db column names:", column_names) + +poi_i = column_names.index('primitive_of') +pi_i = column_names.index('primitives') +ci_i = column_names.index('character') +ri_i = column_names.index('radicals') +fi_i = column_names.index('frequency_rank') +hk_i = column_names.index('heisig_keyword6') +pk_i = column_names.index('primitive_keywords') +m_i = column_names.index('meanings') + +primitive_of_dict = dict() + +# Create a lookup table for primitives that are being used by kanjis or other primitives +for row in data: + character = row[ci_i] + primitives = custom_list(row[pi_i]) + frequency_rank = row[fi_i] + + for p in primitives: + if p not in primitive_of_dict: + primitive_of_dict[p] = "" + if p != character: + primitive_of_dict[p] += character + + +# Re-calculate primitive_of references + +logging.info("# Changes in primitives-of list") +logging.info("| Kanji | Meaning/Keyword | Added | Removed |") +logging.info("|---|---|---|---|") +for row in data: + character = row[ci_i] + orig_primitive_of = custom_list(row[poi_i]) + orig_primitive_of_set = set(orig_primitive_of) + if character in primitive_of_dict: + primitive_of_set = set(custom_list(primitive_of_dict[character])) + else: + primitive_of_set = set() + + # extract the best representation for the kanji/primitive name + if row[hk_i] is not None and row[hk_i] != '': + name = row[hk_i] + elif row[pk_i] is not None and row[pk_i] != '[]': + name = j2c(row[pk_i]) + elif row[m_i] is not None and row[m_i] != '[]': + name = j2c(row[m_i]) + else: + name = "" + + if primitive_of_set != orig_primitive_of_set: + + added = multiLine(list(primitive_of_set-orig_primitive_of_set),10) + removed = multiLine(list(orig_primitive_of_set - primitive_of_set),10) + logging.info('|' + character + " | " + name + " | " + added + " | " + removed + ' |') + new_primitive_of_set = primitive_of_set + new_data = [''.join(new_primitive_of_set), character] + crs.execute(update_prim_of_sql, new_data) + + con.commit() + +con.close()