Skip to content

Commit

Permalink
重写UI实现
Browse files Browse the repository at this point in the history
  • Loading branch information
Flash-Z authored Feb 8, 2023
1 parent e3eae83 commit b5fba10
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 24 deletions.
2 changes: 1 addition & 1 deletion ToDoList/mcdreforged.plugin.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"id": "todolist",
"version": "1.0.3",
"version": "1.0.4",
"name": "ToDoList",
"description": {
"en_us": "ToDoList",
Expand Down
38 changes: 23 additions & 15 deletions ToDoList/todolist/UI.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,27 @@
f"§b{prefix} add <name> <detail> <progress>": "§r添加/修改名为<name>的项目,可选参数为描述与进度",
}

def get_list(name):
list_msg = RTextList(
f'\n- ',
RText(f'[×] ', color = RColor.red).c(RAction.suggest_command, f'!!td del {name}')
.h(RText(f'Delete', color = RColor.red)),
RText(f'§b{name}').c(RAction.suggest_command,
f'!!td add {name} {fun.list_dic.get(name)["detail"][0]} {fun.list_dic.get(name)["progress"]}')
.h(
f'§r点击项目名以修改信息\n'
f'§7最后修改者:§6 {fun.list_dic.get(name)["creator"]} §7时间:§6 {fun.list_dic.get(name)["time"]}',
# f'\n§7项目类别:§6 {fun.list_dic.get(name)["tags"]}',
f'\n§7项目描述:§6 {fun.list_dic.get(name)["detail"][0]}' if fun.list_dic.get(name)["detail"][0] !="" else "",
f'\n§7进度描述:§6 {fun.list_dic.get(name)["progress"]}' if fun.list_dic.get(name)["progress"] !="" else ""
def get_list():
c = ['']

list_head = RText(f'================== §bToDoList §r==================').c(
RAction.suggest_command, f'!!td list').h(f'§b!!td list')
c.append(list_head)

for name, list_info in fun.list_dic.items():
list_msg = RTextList(
f'\n- ',
RText(f'[×] ', color = RColor.red).c(RAction.suggest_command, f'!!td del {name}')
.h(RText(f'Delete', color = RColor.red)),
RText(f'§b{name}').c(RAction.suggest_command,
f'!!td add {name} {fun.list_dic.get(name)["detail"][0]} {fun.list_dic.get(name)["progress"]}')
.h(
f'§r点击项目名以修改信息\n'
f'§7最后修改者:§6 {fun.list_dic.get(name)["creator"]} §7时间:§6 {fun.list_dic.get(name)["time"]}',
# f'\n§7项目类别:§6 {fun.list_dic.get(name)["tags"]}',
f'\n§7项目描述:§6 {fun.list_dic.get(name)["detail"][0]}' if fun.list_dic.get(name)["detail"][0] !="" else "",
f'\n§7进度描述:§6 {fun.list_dic.get(name)["progress"]}' if fun.list_dic.get(name)["progress"] !="" else ""
)
)
)
return list_msg
c.append(list_msg)
return c
16 changes: 8 additions & 8 deletions ToDoList/todolist/operate_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,16 @@ def operate_list(server, info, args):

elif len(args) == 2:
if args[1] == "list" or args[1] == "l":
c = ['']
# c = ['']

list_head = RText(f'================== §bToDoList §r==================').c(
RAction.suggest_command, f'!!td list').h(f'§b!!td list')
c.append(list_head)
# list_head = RText(f'================== §bToDoList §r==================').c(
# RAction.suggest_command, f'!!td list').h(f'§b!!td list')
# c.append(list_head)

for name, list_info in fun.list_dic.items():
list_msg = get_list(name)
c.append(list_msg)
server.reply(info, RTextList(*c))
# for name, list_info in fun.list_dic.items():
# list_msg = get_list(name)
# c.append(list_msg)
server.reply(info, RTextList(*get_list()))

elif args[1] == "reload" or args[1] == "r":
try:
Expand Down

0 comments on commit b5fba10

Please sign in to comment.