pymud 0.18.3__py3-none-any.whl → 0.18.4.post1__py3-none-any.whl
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/extras.py +8 -3
- pymud/pymud.py +5 -2
- pymud/session.py +14 -1
- pymud/settings.py +3 -2
- {pymud-0.18.3.dist-info → pymud-0.18.4.post1.dist-info}/METADATA +9 -1
- pymud-0.18.4.post1.dist-info/RECORD +16 -0
- pymud-0.18.3.dist-info/RECORD +0 -16
- {pymud-0.18.3.dist-info → pymud-0.18.4.post1.dist-info}/LICENSE.txt +0 -0
- {pymud-0.18.3.dist-info → pymud-0.18.4.post1.dist-info}/WHEEL +0 -0
- {pymud-0.18.3.dist-info → pymud-0.18.4.post1.dist-info}/entry_points.txt +0 -0
- {pymud-0.18.3.dist-info → pymud-0.18.4.post1.dist-info}/top_level.txt +0 -0
pymud/extras.py
CHANGED
@@ -128,9 +128,7 @@ class MudFormatProcessor(Processor):
|
|
128
128
|
def tab_correction(self, line: str):
|
129
129
|
return line.replace("\t", " " * Settings.client["tabstop"])
|
130
130
|
|
131
|
-
def
|
132
|
-
# 准备(先还原为str)
|
133
|
-
line = fragment_list_to_text(transformation_input.fragments)
|
131
|
+
def line_correction(self, line: str):
|
134
132
|
# 处理\r符号(^M)
|
135
133
|
line = self.return_correction(line)
|
136
134
|
# 处理Tab(\r)符号(^I)
|
@@ -138,6 +136,13 @@ class MudFormatProcessor(Processor):
|
|
138
136
|
# 美化(解决中文英文在Console中不对齐的问题)
|
139
137
|
if Settings.client["beautify"]:
|
140
138
|
line = self.width_correction(line)
|
139
|
+
|
140
|
+
return line
|
141
|
+
|
142
|
+
def apply_transformation(self, transformation_input):
|
143
|
+
# 准备(先还原为str)
|
144
|
+
line = fragment_list_to_text(transformation_input.fragments)
|
145
|
+
line = self.line_correction(line)
|
141
146
|
# 处理ANSI标记(生成FormmatedText)
|
142
147
|
fragments = to_formatted_text(ANSI(line))
|
143
148
|
return Transformation(fragments)
|
pymud/pymud.py
CHANGED
@@ -155,10 +155,12 @@ class PyMudApp:
|
|
155
155
|
show_cursor=False
|
156
156
|
)
|
157
157
|
|
158
|
+
self.mudFormatProc = MudFormatProcessor()
|
159
|
+
|
158
160
|
self.consoleView = SessionBufferControl(
|
159
161
|
buffer = None,
|
160
162
|
input_processors=[
|
161
|
-
|
163
|
+
self.mudFormatProc,
|
162
164
|
HighlightSearchProcessor(),
|
163
165
|
HighlightSelectionProcessor(),
|
164
166
|
DisplayMultipleCursors(),
|
@@ -416,7 +418,8 @@ class PyMudApp:
|
|
416
418
|
|
417
419
|
if srow == erow:
|
418
420
|
# 单行情况
|
419
|
-
line = b.document.current_line
|
421
|
+
#line = b.document.current_line
|
422
|
+
line = self.mudFormatProc.line_correction(b.document.current_line)
|
420
423
|
start = max(0, scol)
|
421
424
|
end = min(ecol, len(line))
|
422
425
|
line_plain = re.sub("\x1b\\[[\d;]+[abcdmz]", "", line, flags = re.IGNORECASE).replace("\r", "").replace("\x00", "")
|
pymud/session.py
CHANGED
@@ -105,7 +105,7 @@ class Session:
|
|
105
105
|
self.buffer_pos_view = 0 # 标注查看位置光标指针
|
106
106
|
self.buffer_pos_view_line = -1
|
107
107
|
self.showHistory = False # 是否显示历史
|
108
|
-
|
108
|
+
self._line_count = 0 # 快速访问行数
|
109
109
|
self._status_maker = None # 创建状态窗口的函数(属性)
|
110
110
|
self.display_line = ""
|
111
111
|
|
@@ -333,8 +333,19 @@ class Session:
|
|
333
333
|
"将数据写入到用于本地显示的缓冲中"
|
334
334
|
self.buffer.insert_text(data)
|
335
335
|
|
336
|
+
if data[-1] == "\n":
|
337
|
+
self._line_count += 1
|
338
|
+
|
336
339
|
if newline:
|
337
340
|
self.buffer.insert_text(self.newline_cli)
|
341
|
+
self._line_count += 1
|
342
|
+
|
343
|
+
def clear_buffer(self):
|
344
|
+
"清除过多缓冲"
|
345
|
+
if (self._line_count >= 2 * Settings.client["buffer_lines"]) and self.buffer.document.is_cursor_at_the_end:
|
346
|
+
startindex = self.buffer.document.translate_row_col_to_index(-1 * Settings.client["buffer_lines"], 0)
|
347
|
+
self.buffer.text = self.buffer.document.text[startindex:]
|
348
|
+
self._line_count = self.buffer.document.line_count
|
338
349
|
|
339
350
|
def feed_data(self, data) -> None:
|
340
351
|
"永远只会传递1个字节的数据,以bytes形式"
|
@@ -369,6 +380,8 @@ class Session:
|
|
369
380
|
|
370
381
|
def go_ahead(self) -> None:
|
371
382
|
"把当前接收缓冲内容放到显示缓冲中"
|
383
|
+
self.clear_buffer()
|
384
|
+
|
372
385
|
raw_line = self._line_buffer.decode(self.encoding, Settings.server["encoding_errors"])
|
373
386
|
tri_line = self.getPlainText(raw_line, trim_newline = True)
|
374
387
|
self._line_buffer.clear()
|
pymud/settings.py
CHANGED
@@ -11,9 +11,9 @@ class Settings:
|
|
11
11
|
"APP 名称, 默认PYMUD"
|
12
12
|
__appdesc__ = "a MUD client written in Python"
|
13
13
|
"APP 简要描述"
|
14
|
-
__version__ = "0.18.
|
14
|
+
__version__ = "0.18.4"
|
15
15
|
"APP 当前版本"
|
16
|
-
__release__ = "2024-02-
|
16
|
+
__release__ = "2024-02-19"
|
17
17
|
"APP 当前版本发布日期"
|
18
18
|
__author__ = "本牛(newstart)@北侠"
|
19
19
|
"APP 作者"
|
@@ -49,6 +49,7 @@ class Settings:
|
|
49
49
|
"MUD协议所需的的默认MNES(Mud New-Environment Standard)配置信息"
|
50
50
|
|
51
51
|
client = {
|
52
|
+
"buffer_lines" : 5000, # 保留缓冲行数
|
52
53
|
"status_width" : 30, # 右侧状态栏的宽度
|
53
54
|
"status_height" : 6, # 下侧状态栏的高度
|
54
55
|
"naws_width" : 150, # 客户端NAWS宽度
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: pymud
|
3
|
-
Version: 0.18.
|
3
|
+
Version: 0.18.4.post1
|
4
4
|
Summary: a MUD Client written in Python
|
5
5
|
Author-email: "newstart@pkuxkx" <crapex@crapex.cc>
|
6
6
|
Maintainer-email: "newstart@pkuxkx" <crapex@crapex.cc>
|
@@ -682,6 +682,7 @@ License: GNU GENERAL PUBLIC LICENSE
|
|
682
682
|
Project-URL: Homepage, https://github.com/crapex/pymud/
|
683
683
|
Project-URL: Bug Reports, https://github.com/crapex/pymud/issues
|
684
684
|
Project-URL: Source, https://github.com/crapex/pymud/
|
685
|
+
Project-URL: document, https://pymud.readthedocs.io/
|
685
686
|
Keywords: MUD,multi-user dungeon,client
|
686
687
|
Classifier: Development Status :: 5 - Production/Stable
|
687
688
|
Classifier: Intended Audience :: End Users/Desktop
|
@@ -902,3 +903,10 @@ Requires-Dist: prompt-toolkit
|
|
902
903
|
### 0.18.3 (2024-02-07)
|
903
904
|
+ 功能调整:原#unload时通过调用__del__来实现卸载的时间不可控,现将模块卸载改为调用unload函数。若需卸载时人工清除有关定时器、触发器等,请在Configuration类下新增unload函数(参数仅self),并在其中进行实现
|
904
905
|
+ 功能新增:新增会话Variable和全局Global的删除接口。可以通过session.delVariable(name)删除一个变量,可以通过session.delGlobal(name)来删除一个全局Global变量
|
906
|
+
|
907
|
+
### 0.18.4 (2024-02-19)
|
908
|
+
+ 功能新增:新增Settings.client["buffer_lines"],表示保留的缓冲行数(默认5000)。当Session内容缓冲行数达到该值2倍时(10000行),将截取一半(5000行),后一半内容进行保留,前一半丢弃。此功能是为了减少长时挂机的内存消耗和响应时间。
|
909
|
+
+ 功能修复:解决在显示美化(Settings.client["beautify"])打开之后,复制部分文字不能正确判断起始终止的问题。
|
910
|
+
|
911
|
+
### 0.18.4post1 (2024-02-19)
|
912
|
+
+ 功能调整:修改缓冲行数判断逻辑,加快客户端判断响应速度。
|
@@ -0,0 +1,16 @@
|
|
1
|
+
pymud/__init__.py,sha256=G_k8deY6ulAJdtNkaYn6_zM0j2InJNddxMhnoSqZV30,417
|
2
|
+
pymud/__main__.py,sha256=uGbkGxwhNkpZVYn0mGnPpfTdqkxzfu8Jf8WAV_Uykuo,361
|
3
|
+
pymud/dialogs.py,sha256=_OE1vq_hbu7rUbjsvCH2mEEhEYMiwXEJE0TXIYZc0EI,5591
|
4
|
+
pymud/extras.py,sha256=iBSvh1KSLw2LDF1gAnH76hEMA55gg2TICJXdpAMiQBE,41601
|
5
|
+
pymud/objects.py,sha256=2qnrNI_891y-Wo6Z0xjoPcbJSfrPLbyZOmUNXMsYAz0,28983
|
6
|
+
pymud/pkuxkx.py,sha256=_CR4ETm-ihl5ZqznB75-pT3NdZSfUiuOsvEh5MwSjHI,11417
|
7
|
+
pymud/protocol.py,sha256=F96Yq-1YO_5GN6QnJ4vMdNjCAzejVmDdsfrJguCjCeE,49120
|
8
|
+
pymud/pymud.py,sha256=wzRTMFoJSPol6H-G6CXvgK7j5n1aIvTkxnkrEvBIrn4,38587
|
9
|
+
pymud/session.py,sha256=tepG3Y2Pe1eQkYw5FtFq8cq2NkmLnEF31A1YQQqMgy4,71297
|
10
|
+
pymud/settings.py,sha256=WUxwN6zh7k_uB2SDHQFFO1Qeg2T1aJqxGASFI_pIHFc,6557
|
11
|
+
pymud-0.18.4.post1.dist-info/LICENSE.txt,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
|
12
|
+
pymud-0.18.4.post1.dist-info/METADATA,sha256=0cv_q7GEbfs157hTavRhVLk9C8RD9PTdT2i2gaUNnQA,63155
|
13
|
+
pymud-0.18.4.post1.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
|
14
|
+
pymud-0.18.4.post1.dist-info/entry_points.txt,sha256=diPUOtTkhgC1hVny7Cdg4aRhaHSynMQoraE7ZhJxUcw,37
|
15
|
+
pymud-0.18.4.post1.dist-info/top_level.txt,sha256=8Gp1eXjxixXjqhhti6tLCspV_8s9sNV3z5Em2_KRhD4,6
|
16
|
+
pymud-0.18.4.post1.dist-info/RECORD,,
|
pymud-0.18.3.dist-info/RECORD
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
pymud/__init__.py,sha256=G_k8deY6ulAJdtNkaYn6_zM0j2InJNddxMhnoSqZV30,417
|
2
|
-
pymud/__main__.py,sha256=uGbkGxwhNkpZVYn0mGnPpfTdqkxzfu8Jf8WAV_Uykuo,361
|
3
|
-
pymud/dialogs.py,sha256=_OE1vq_hbu7rUbjsvCH2mEEhEYMiwXEJE0TXIYZc0EI,5591
|
4
|
-
pymud/extras.py,sha256=uFMjoO2fgSQT0lx7BoejAExeGKJ5QTkS5Kwatblfvdg,41490
|
5
|
-
pymud/objects.py,sha256=2qnrNI_891y-Wo6Z0xjoPcbJSfrPLbyZOmUNXMsYAz0,28983
|
6
|
-
pymud/pkuxkx.py,sha256=_CR4ETm-ihl5ZqznB75-pT3NdZSfUiuOsvEh5MwSjHI,11417
|
7
|
-
pymud/protocol.py,sha256=F96Yq-1YO_5GN6QnJ4vMdNjCAzejVmDdsfrJguCjCeE,49120
|
8
|
-
pymud/pymud.py,sha256=TTIuXMLPxmxuq9XSe3NP9DsLMdHxR5Xtu1b8rSOLcts,38447
|
9
|
-
pymud/session.py,sha256=A9-VUlB6NMkS1J8_7K4zuSCaAJqiGMYJvBwcpiBLyyA,70648
|
10
|
-
pymud/settings.py,sha256=Vxd6A7t0a2MrfY9HnMsAgAgRT0RqkwdrB1xOE5sOv8c,6483
|
11
|
-
pymud-0.18.3.dist-info/LICENSE.txt,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149
|
12
|
-
pymud-0.18.3.dist-info/METADATA,sha256=V-d8AHVp5VB70gab-zNIQVLfEn_zErGoE_8p3s2dpaI,62483
|
13
|
-
pymud-0.18.3.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92
|
14
|
-
pymud-0.18.3.dist-info/entry_points.txt,sha256=diPUOtTkhgC1hVny7Cdg4aRhaHSynMQoraE7ZhJxUcw,37
|
15
|
-
pymud-0.18.3.dist-info/top_level.txt,sha256=8Gp1eXjxixXjqhhti6tLCspV_8s9sNV3z5Em2_KRhD4,6
|
16
|
-
pymud-0.18.3.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|