|
| 1 | +#!python3 |
| 2 | +""" |
| 3 | +卡片模板 |
| 4 | +""" |
| 5 | + |
| 6 | +import keyboard |
| 7 | +import dialogs |
| 8 | + |
| 9 | +from datetime import datetime |
| 10 | + |
| 11 | + |
| 12 | +def main(): |
| 13 | + is_kb = keyboard.is_keyboard() |
| 14 | + options = [ |
| 15 | + {"title": "通用型: 基础卡-内容", "key": "basic1"}, |
| 16 | + {"title": "通用型: 基础卡-原文-评论", "key": "basic2"}, |
| 17 | + {"title": "通用型: 行动卡", "key": "action"}, |
| 18 | + {"title": "信息型: 新知卡", "key": "new"}, |
| 19 | + {"title": "信息型: 术语卡", "key": "term"}, |
| 20 | + {"title": "信息型: 人物卡", "key": "person"}, |
| 21 | + {"title": "信息型: 图示卡", "key": "pic"}, |
| 22 | + {"title": "叙事型: 事件卡-单一事件", "key": "event1"}, |
| 23 | + {"title": "叙事型: 事件卡-时间线", "key": "event2"}, |
| 24 | + {"title": "叙事型: 事件卡-故事卡", "key": "story"}, |
| 25 | + {"title": "美感型: 新词卡", "key": "word"}, |
| 26 | + {"title": "美感型: 金句卡-评论", "key": "sentence1"}, |
| 27 | + {"title": "美感型: 金句卡-仿写", "key": "sentence2"}, |
| 28 | + ] |
| 29 | + selected = dialogs.list_dialog("卡片模板", options) |
| 30 | + if not selected: |
| 31 | + return |
| 32 | + n = selected["key"] |
| 33 | + text = "" |
| 34 | + date_format = "%Y%m%d%H%M" |
| 35 | + now = datetime.now() |
| 36 | + date_str = now.strftime(date_format) |
| 37 | + if n == "basic1": |
| 38 | + text = f"title:: \n内容:: \nref:: \nuid:: {date_str}\ntype:: [[基础卡]]" |
| 39 | + elif n == "basic2": |
| 40 | + text = f"title:: \n原文:: \n评论:: \nref:: \nuid:: {date_str}\ntype:: [[基础卡]]" |
| 41 | + elif n == "action": |
| 42 | + text = f"title:: \n原理:: \n行动:: \nref:: \nuid:: {date_str}\ntype:: [[行动卡]]" |
| 43 | + elif n == "new": |
| 44 | + text = ( |
| 45 | + f"title:: \n已知:: \n新知:: \neg:: \nref:: \nuid:: {date_str}\ntype:: [[新知卡]]" |
| 46 | + ) |
| 47 | + elif n == "term": |
| 48 | + text = ( |
| 49 | + f"title:: \n定义:: \n解释:: \neg:: \nref:: \nuid:: {date_str}\ntype:: [[术语卡]]" |
| 50 | + ) |
| 51 | + elif n == "person": |
| 52 | + text = f"title:: \n小传:: \nref:: \nuid:: {date_str}\ntype:: [[人物卡]]" |
| 53 | + elif n == "pic": |
| 54 | + text = f"title:: \n说明:: \nref:: \nuid:: {date_str}\ntype:: [[图示卡]]" |
| 55 | + elif n == "event1": |
| 56 | + text = f"title:: \n时间:: \n地点:: \n行动者:: \n反应:: \nref:: \nuid:: {date_str}\ntype:: [[事件卡]]" |
| 57 | + elif n == "event2": |
| 58 | + text = f"title:: \n时间线:: \nref:: \nuid:: {date_str}\ntype:: [[事件卡]]" |
| 59 | + elif n == "story": |
| 60 | + text = f"title:: \n故事:: \nref:: \nuid:: {date_str}\ntype:: [[事件卡]]" |
| 61 | + elif n == "word": |
| 62 | + text = f"新词:: \n原句:: \n造句:: \nref:: \nuid:: {date_str}\ntype:: [[新词卡]]" |
| 63 | + elif n == "sentence1": |
| 64 | + text = f"title:: \n金句:: \n评论:: \nref:: \nuid:: {date_str}\ntype:: [[金句卡]]" |
| 65 | + elif n == "sentence2": |
| 66 | + text = f"title:: \n金句:: \n仿写:: \nref:: \nuid:: {date_str}\ntype:: [[金句卡]]" |
| 67 | + if is_kb: |
| 68 | + keyboard.insert_text(text) |
| 69 | + else: |
| 70 | + # For debugging in the main app: |
| 71 | + print("Keyboard input:\n", text) |
| 72 | + |
| 73 | + |
| 74 | +if __name__ == "__main__": |
| 75 | + main() |
0 commit comments