Skip to content

Commit

Permalink
panote anki插件发现一个bug
Browse files Browse the repository at this point in the history
  • Loading branch information
ActivePeter committed Aug 22, 2022
1 parent 6639b89 commit edbc88b
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
9 changes: 8 additions & 1 deletion python_control_anki/anki_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -346,11 +346,18 @@ def find_or_create_deck_in_node(node: decks.DeckTreeNode, deck_name: str) -> Opt
)
mw.deckBrowser.show()
fnode = find_deck_in_node(node, deck_name)

debug_window.println("find_or_create_deck_in_node "+str(fnode))
return fnode


def find_deck_in_node(node: decks.DeckTreeNode, deck_name: str) -> Optional[decks.DeckTreeNode]:
blank_ids=[]
for i in range(len(node.children)):
if node.children[i].name.find('blank')>-1:
debug_window.println("has blank "+str(node.children[i]))
blank_ids.append(node.children[i].deck_id)

mw.col.decks.remove(blank_ids)
for i in range(len(node.children)):
# utils.showInfo(str(node.children[i].deck_id))
if node.children[i].name == deck_name:
Expand Down
7 changes: 4 additions & 3 deletions python_control_anki/debug_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,13 +117,14 @@ def _window_sync():

def println(line: str):
global content
content += line + "\n"
content += line + "<br>"
# utils.showInfo("debug "+line)
_window_sync()


def on_debug_show():
global window, content
utils.showInfo("show debug")
# utils.showInfo("show debug")
if window is None:
window = TextEditWidget()

Expand All @@ -141,5 +142,5 @@ def init():
button.clicked.connect(on_debug_show)
# shot.activated.connect(on_debug_show)
window = TextEditWidget()
on_debug_show()
# on_debug_show()
println("hhhhhh")
Binary file modified python_control_anki/python_control_anki.ankiaddon
Binary file not shown.

0 comments on commit edbc88b

Please sign in to comment.