pymud 0.20.2a2__tar.gz → 0.20.2a3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {pymud-0.20.2a2/src/pymud.egg-info → pymud-0.20.2a3}/PKG-INFO +3 -2
- {pymud-0.20.2a2 → pymud-0.20.2a3}/README.md +2 -1
- {pymud-0.20.2a2 → pymud-0.20.2a3}/pyproject.toml +1 -1
- {pymud-0.20.2a2 → pymud-0.20.2a3}/src/pymud/extras.py +30 -27
- {pymud-0.20.2a2 → pymud-0.20.2a3}/src/pymud/session.py +19 -14
- {pymud-0.20.2a2 → pymud-0.20.2a3/src/pymud.egg-info}/PKG-INFO +3 -2
- {pymud-0.20.2a2 → pymud-0.20.2a3}/LICENSE.txt +0 -0
- {pymud-0.20.2a2 → pymud-0.20.2a3}/setup.cfg +0 -0
- {pymud-0.20.2a2 → pymud-0.20.2a3}/src/pymud/__init__.py +0 -0
- {pymud-0.20.2a2 → pymud-0.20.2a3}/src/pymud/__main__.py +0 -0
- {pymud-0.20.2a2 → pymud-0.20.2a3}/src/pymud/dialogs.py +0 -0
- {pymud-0.20.2a2 → pymud-0.20.2a3}/src/pymud/logger.py +0 -0
- {pymud-0.20.2a2 → pymud-0.20.2a3}/src/pymud/main.py +0 -0
- {pymud-0.20.2a2 → pymud-0.20.2a3}/src/pymud/modules.py +0 -0
- {pymud-0.20.2a2 → pymud-0.20.2a3}/src/pymud/objects.py +0 -0
- {pymud-0.20.2a2 → pymud-0.20.2a3}/src/pymud/pkuxkx.py +0 -0
- {pymud-0.20.2a2 → pymud-0.20.2a3}/src/pymud/protocol.py +0 -0
- {pymud-0.20.2a2 → pymud-0.20.2a3}/src/pymud/pymud.py +0 -0
- {pymud-0.20.2a2 → pymud-0.20.2a3}/src/pymud/settings.py +0 -0
- {pymud-0.20.2a2 → pymud-0.20.2a3}/src/pymud.egg-info/SOURCES.txt +0 -0
- {pymud-0.20.2a2 → pymud-0.20.2a3}/src/pymud.egg-info/dependency_links.txt +0 -0
- {pymud-0.20.2a2 → pymud-0.20.2a3}/src/pymud.egg-info/entry_points.txt +0 -0
- {pymud-0.20.2a2 → pymud-0.20.2a3}/src/pymud.egg-info/requires.txt +0 -0
- {pymud-0.20.2a2 → pymud-0.20.2a3}/src/pymud.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: pymud
|
3
|
-
Version: 0.20.
|
3
|
+
Version: 0.20.2a3
|
4
4
|
Summary: a MUD Client written in Python
|
5
5
|
Author-email: "newstart@pkuxkx" <crapex@hotmail.com>
|
6
6
|
Maintainer-email: "newstart@pkuxkx" <crapex@hotmail.com>
|
@@ -737,10 +737,11 @@ Requires-Dist: prompt-toolkit
|
|
737
737
|
|
738
738
|
## 版本更新信息
|
739
739
|
|
740
|
-
## 0.20.2 (2024-11-
|
740
|
+
## 0.20.2 (2024-11-20)
|
741
741
|
+ 功能调整: MTTS协商中,将256 Color明确写入协商回复。原先仅包含ANSI 和 TrueColor。推测武庙特殊颜色偶尔不正常与此有关。
|
742
742
|
+ 功能调整: 修复了纯文本正则处理,目前理论上支持所有ANSI控制代码的处置,以正确响应纯文本触发器。
|
743
743
|
+ 功能调整: 修改了#var和#global的显示实现,提高了变量打印排列的整齐度和辨识度,以适应长值变量和复杂变量。
|
744
|
+
+ 问题修复: 修复了单行颜色代码跨行无法显示问题。现在星宿毒草可以正常辨认颜色了。
|
744
745
|
|
745
746
|
## 0.20.1 (2024-11-16)
|
746
747
|
+ 功能调整: 会话中触发器匹配实现进行部分调整,减少循环次数以提高响应速度
|
@@ -31,10 +31,11 @@
|
|
31
31
|
|
32
32
|
## 版本更新信息
|
33
33
|
|
34
|
-
## 0.20.2 (2024-11-
|
34
|
+
## 0.20.2 (2024-11-20)
|
35
35
|
+ 功能调整: MTTS协商中,将256 Color明确写入协商回复。原先仅包含ANSI 和 TrueColor。推测武庙特殊颜色偶尔不正常与此有关。
|
36
36
|
+ 功能调整: 修复了纯文本正则处理,目前理论上支持所有ANSI控制代码的处置,以正确响应纯文本触发器。
|
37
37
|
+ 功能调整: 修改了#var和#global的显示实现,提高了变量打印排列的整齐度和辨识度,以适应长值变量和复杂变量。
|
38
|
+
+ 问题修复: 修复了单行颜色代码跨行无法显示问题。现在星宿毒草可以正常辨认颜色了。
|
38
39
|
|
39
40
|
## 0.20.1 (2024-11-16)
|
40
41
|
+ 功能调整: 会话中触发器匹配实现进行部分调整,减少循环次数以提高响应速度
|
@@ -40,6 +40,8 @@ from prompt_toolkit.layout.controls import (
|
|
40
40
|
)
|
41
41
|
from prompt_toolkit.layout.processors import (
|
42
42
|
Processor,
|
43
|
+
TransformationInput,
|
44
|
+
Transformation
|
43
45
|
)
|
44
46
|
from prompt_toolkit.lexers import Lexer
|
45
47
|
from prompt_toolkit.mouse_events import MouseEvent, MouseEventType
|
@@ -64,10 +66,11 @@ class MudFormatProcessor(Processor):
|
|
64
66
|
self.FULL_BLOCKS = set("▂▃▅▆▇▄█")
|
65
67
|
self.SINGLE_LINES = set("┌└├┬┼┴╭╰─")
|
66
68
|
self.DOUBLE_LINES = set("╔╚╠╦╪╩═")
|
67
|
-
self.START_COLOR_REGX = re.compile(r"^\[[\d;]+m")
|
69
|
+
#self.START_COLOR_REGX = re.compile(r"^\[[\d;]+m")
|
68
70
|
self.COLOR_REGX = re.compile(r"\[[\d;]+m")
|
69
71
|
self._color_start = ""
|
70
72
|
self._color_correction = False
|
73
|
+
self._color_line_index = 0
|
71
74
|
|
72
75
|
def width_correction(self, line: str) -> str:
|
73
76
|
new_str = []
|
@@ -91,48 +94,48 @@ class MudFormatProcessor(Processor):
|
|
91
94
|
def tab_correction(self, line: str):
|
92
95
|
return line.replace("\t", " " * Settings.client["tabstop"])
|
93
96
|
|
94
|
-
def color_correction(self, line: str):
|
95
|
-
# 注:发现processer处理并非自上而下逐行处理的,因此不能使用这种颜色校正方式。
|
96
|
-
if self._color_correction:
|
97
|
-
other = self.COLOR_REGX.findall(line)
|
98
|
-
|
99
|
-
line = f"{self._color_start}{line}"
|
100
|
-
logging.debug(f"已校正增加颜色标志 {self._color_start}: {line}")
|
101
|
-
|
102
|
-
if other:
|
103
|
-
self._color_correction = False
|
104
|
-
self._color_start = ""
|
105
|
-
logging.debug(f"颜色校正结束: {line}")
|
106
|
-
else:
|
107
|
-
color = self.START_COLOR_REGX.findall(line)
|
108
|
-
if color:
|
109
|
-
other = self.COLOR_REGX.findall(line)
|
110
|
-
if len(other) == 1:
|
111
|
-
self._color_correction = True
|
112
|
-
self._color_start = color[0]
|
113
|
-
logging.debug(f"获取到一个颜色开头 {color[0]}: {line}")
|
114
|
-
|
115
|
-
return line
|
116
|
-
|
117
97
|
def line_correction(self, line: str):
|
118
98
|
# 处理\r符号(^M)
|
119
99
|
line = self.return_correction(line)
|
120
100
|
# 处理Tab(\r)符号(^I)
|
121
101
|
line = self.tab_correction(line)
|
122
|
-
|
123
|
-
# line = self.color_correction(line)
|
102
|
+
|
124
103
|
# 美化(解决中文英文在Console中不对齐的问题)
|
125
104
|
if Settings.client["beautify"]:
|
126
105
|
line = self.width_correction(line)
|
127
106
|
|
128
107
|
return line
|
129
108
|
|
130
|
-
def apply_transformation(self, transformation_input):
|
109
|
+
def apply_transformation(self, transformation_input: TransformationInput):
|
131
110
|
# 准备(先还原为str)
|
132
111
|
line = fragment_list_to_text(transformation_input.fragments)
|
112
|
+
|
113
|
+
# 颜色校正
|
114
|
+
thislinecolors = len(self.COLOR_REGX.findall(line))
|
115
|
+
if thislinecolors == 0:
|
116
|
+
lineno = transformation_input.lineno - 1
|
117
|
+
while lineno > 0:
|
118
|
+
lastline = transformation_input.document.lines[lineno]
|
119
|
+
# color = self.START_COLOR_REGX.findall(lastline)
|
120
|
+
# if color:
|
121
|
+
colors = self.COLOR_REGX.findall(lastline)
|
122
|
+
|
123
|
+
if len(colors) == 0:
|
124
|
+
lineno = lineno -1
|
125
|
+
|
126
|
+
elif len(colors) == 1:
|
127
|
+
line = f"{colors[0]}{line}"
|
128
|
+
break
|
129
|
+
|
130
|
+
else:
|
131
|
+
break
|
132
|
+
|
133
|
+
# 其他校正
|
133
134
|
line = self.line_correction(line)
|
135
|
+
|
134
136
|
# 处理ANSI标记(生成FormmatedText)
|
135
137
|
fragments = to_formatted_text(ANSI(line))
|
138
|
+
|
136
139
|
return Transformation(fragments)
|
137
140
|
|
138
141
|
class SessionBuffer(Buffer):
|
@@ -3010,14 +3010,18 @@ class Session:
|
|
3010
3010
|
triggered_enabled += 1
|
3011
3011
|
if not block:
|
3012
3012
|
triggered += 1
|
3013
|
-
info_enabled.append(f" {Settings.INFO_STYLE}{tri.__detailed__()} 正常触发。{Settings.CLR_STYLE}")
|
3014
|
-
info_enabled.append(f" {Settings.INFO_STYLE}捕获:{state.wildcards}{Settings.CLR_STYLE}")
|
3013
|
+
# info_enabled.append(f" {Settings.INFO_STYLE}{tri.__detailed__()} 正常触发。{Settings.CLR_STYLE}")
|
3014
|
+
# info_enabled.append(f" {Settings.INFO_STYLE}捕获:{state.wildcards}{Settings.CLR_STYLE}")
|
3015
|
+
info_enabled.append(f" {tri.__detailed__()} 正常触发。")
|
3016
|
+
info_enabled.append(f" 捕获:{state.wildcards}")
|
3015
3017
|
|
3016
3018
|
if not tri.keepEval: # 非持续匹配的trigger,匹配成功后停止检测后续Trigger
|
3017
3019
|
info_enabled.append(f" {Settings.WARN_STYLE}该触发器未开启keepEval, 会阻止后续触发器。{Settings.CLR_STYLE}")
|
3020
|
+
#info_enabled.append(f" 该触发器未开启keepEval, 会阻止后续触发器。")
|
3018
3021
|
block = True
|
3019
3022
|
else:
|
3020
3023
|
info_enabled.append(f" {Settings.WARN_STYLE}{tri.__detailed__()} 可以触发,但由于优先级与keepEval设定,触发器不会触发。{Settings.CLR_STYLE}")
|
3024
|
+
#info_enabled.append(f" {tri.__detailed__()} 可以触发,但由于优先级与keepEval设定,触发器不会触发。")
|
3021
3025
|
|
3022
3026
|
|
3023
3027
|
for tri in tris_disabled:
|
@@ -3028,22 +3032,23 @@ class Session:
|
|
3028
3032
|
|
3029
3033
|
if state.result == Trigger.SUCCESS:
|
3030
3034
|
triggered_disabled += 1
|
3031
|
-
info_disabled.append(f" {Settings.INFO_STYLE}{tri.__detailed__()} 可以匹配触发。{Settings.CLR_STYLE}")
|
3035
|
+
# info_disabled.append(f" {Settings.INFO_STYLE}{tri.__detailed__()} 可以匹配触发。{Settings.CLR_STYLE}")
|
3036
|
+
info_disabled.append(f" {tri.__detailed__()} 可以匹配触发。")
|
3032
3037
|
|
3033
3038
|
if triggered_enabled + triggered_disabled == 0:
|
3034
3039
|
info_all.append("")
|
3035
3040
|
|
3036
3041
|
if triggered_enabled == 0:
|
3037
|
-
info_enabled.insert(0, f"使能的触发器中,没有可以触发的。")
|
3042
|
+
info_enabled.insert(0, f"{Settings.INFO_STYLE}使能的触发器中,没有可以触发的。")
|
3038
3043
|
elif triggered < triggered_enabled:
|
3039
|
-
info_enabled.insert(0, f"使能的触发器中,共有 {triggered_enabled} 个可以触发,实际触发 {triggered} 个,另有 {triggered_enabled - triggered} 个由于 keepEval 原因实际不会触发。")
|
3044
|
+
info_enabled.insert(0, f"{Settings.INFO_STYLE}使能的触发器中,共有 {triggered_enabled} 个可以触发,实际触发 {triggered} 个,另有 {triggered_enabled - triggered} 个由于 keepEval 原因实际不会触发。")
|
3040
3045
|
else:
|
3041
|
-
info_enabled.insert(0, f"使能的触发器中,共有 {triggered_enabled} 个全部可以被正常触发。")
|
3046
|
+
info_enabled.insert(0, f"{Settings.INFO_STYLE}使能的触发器中,共有 {triggered_enabled} 个全部可以被正常触发。")
|
3042
3047
|
|
3043
3048
|
if triggered_disabled > 0:
|
3044
|
-
info_disabled.insert(0, f"未使能的触发器中,共有 {triggered_disabled} 个可以匹配。")
|
3049
|
+
info_disabled.insert(0, f"{Settings.INFO_STYLE}未使能的触发器中,共有 {triggered_disabled} 个可以匹配。")
|
3045
3050
|
else:
|
3046
|
-
info_disabled.insert(0, f"未使能触发器,没有可以匹配的。")
|
3051
|
+
info_disabled.insert(0, f"{Settings.INFO_STYLE}未使能触发器,没有可以匹配的。")
|
3047
3052
|
|
3048
3053
|
if triggered_enabled + triggered_disabled == 0:
|
3049
3054
|
info_all.append(f"PYMUD 触发器测试: {'响应模式' if docallback else '测试模式'}")
|
@@ -3201,13 +3206,13 @@ class Session:
|
|
3201
3206
|
def info2(self, msg, title = "PYMUD INFO", style = Settings.INFO_STYLE):
|
3202
3207
|
msg = f"{msg}"
|
3203
3208
|
|
3204
|
-
if Settings.client["newline"] in msg:
|
3205
|
-
|
3206
|
-
|
3207
|
-
|
3208
|
-
|
3209
|
+
# if Settings.client["newline"] in msg:
|
3210
|
+
# new_lines = list()
|
3211
|
+
# msg_lines = msg.split(Settings.client["newline"])
|
3212
|
+
# for line in msg_lines:
|
3213
|
+
# new_lines.append("{}{}".format(style, line))
|
3209
3214
|
|
3210
|
-
|
3215
|
+
# msg = Settings.client["newline"].join(new_lines)
|
3211
3216
|
|
3212
3217
|
# 将颜色跨行显示移动到了MudFormatProcessor中,此处无需再处理(不行,还得恢复)
|
3213
3218
|
self.writetobuffer("{}[{}] {}{}".format(style, title, msg, Settings.CLR_STYLE), newline = True)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: pymud
|
3
|
-
Version: 0.20.
|
3
|
+
Version: 0.20.2a3
|
4
4
|
Summary: a MUD Client written in Python
|
5
5
|
Author-email: "newstart@pkuxkx" <crapex@hotmail.com>
|
6
6
|
Maintainer-email: "newstart@pkuxkx" <crapex@hotmail.com>
|
@@ -737,10 +737,11 @@ Requires-Dist: prompt-toolkit
|
|
737
737
|
|
738
738
|
## 版本更新信息
|
739
739
|
|
740
|
-
## 0.20.2 (2024-11-
|
740
|
+
## 0.20.2 (2024-11-20)
|
741
741
|
+ 功能调整: MTTS协商中,将256 Color明确写入协商回复。原先仅包含ANSI 和 TrueColor。推测武庙特殊颜色偶尔不正常与此有关。
|
742
742
|
+ 功能调整: 修复了纯文本正则处理,目前理论上支持所有ANSI控制代码的处置,以正确响应纯文本触发器。
|
743
743
|
+ 功能调整: 修改了#var和#global的显示实现,提高了变量打印排列的整齐度和辨识度,以适应长值变量和复杂变量。
|
744
|
+
+ 问题修复: 修复了单行颜色代码跨行无法显示问题。现在星宿毒草可以正常辨认颜色了。
|
744
745
|
|
745
746
|
## 0.20.1 (2024-11-16)
|
746
747
|
+ 功能调整: 会话中触发器匹配实现进行部分调整,减少循环次数以提高响应速度
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|