pymud 0.19.3.post2__py3-none-any.whl → 0.19.4__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/objects.py CHANGED
@@ -120,27 +120,27 @@ class CodeLine:
120
120
  else:
121
121
  item_val = "None"
122
122
  new_code.append(item_val)
123
- new_code_str = new_code_str.replace(item, item_val, 1)
123
+ new_code_str = new_code_str.replace(item, f"{item_val}", 1)
124
124
 
125
125
  # 系统变量,%开头
126
126
  elif item == "%line":
127
127
  new_code.append(line)
128
- new_code_str = new_code_str.replace(item, line, 1)
128
+ new_code_str = new_code_str.replace(item, f"{line}", 1)
129
129
 
130
130
  elif item == "%raw":
131
131
  new_code.append(raw)
132
- new_code_str = new_code_str.replace(item, raw, 1)
132
+ new_code_str = new_code_str.replace(item, f"{raw}", 1)
133
133
 
134
134
  elif item[0] == "%":
135
135
  item_val = session.getVariable(item, "")
136
136
  new_code.append(item_val)
137
- new_code_str = new_code_str.replace(item, item_val, 1)
137
+ new_code_str = new_code_str.replace(item, f"{item_val}", 1)
138
138
 
139
139
  # 非系统变量,@开头,在变量明前加@引用
140
140
  elif item[0] == "@":
141
141
  item_val = session.getVariable(item[1:], "")
142
142
  new_code.append(item_val)
143
- new_code_str = new_code_str.replace(item, item_val, 1)
143
+ new_code_str = new_code_str.replace(item, f"{item_val}", 1)
144
144
 
145
145
  else:
146
146
  new_code.append(item)
pymud/pymud.py CHANGED
@@ -462,8 +462,12 @@ class PyMudApp:
462
462
  """
463
463
  b = self.consoleView.buffer
464
464
  if b.selection_state:
465
- srow, scol = b.document.translate_index_to_position(b.selection_state.original_cursor_position)
466
- erow, ecol = b.document.translate_index_to_position(b.document.cursor_position)
465
+ cur1, cur2 = b.selection_state.original_cursor_position, b.document.cursor_position
466
+ start, end = min(cur1, cur2), max(cur1, cur2)
467
+ srow, scol = b.document.translate_index_to_position(start)
468
+ erow, ecol = b.document.translate_index_to_position(end)
469
+ # srow, scol = b.document.translate_index_to_position(b.selection_state.original_cursor_position)
470
+ # erow, ecol = b.document.translate_index_to_position(b.document.cursor_position)
467
471
 
468
472
  if not raw:
469
473
  # Control-C 复制纯文本
pymud/session.py CHANGED
@@ -1677,7 +1677,10 @@ class Session:
1677
1677
  - #global
1678
1678
  '''
1679
1679
 
1680
- args = code.code[2:]
1680
+ new_cmd_text, new_code = code.expand(self, *args, **kwargs)
1681
+ args = new_code[2:]
1682
+
1683
+ #args = code.code[2:]
1681
1684
 
1682
1685
  if len(args) == 0:
1683
1686
  vars = self._variables
@@ -1735,7 +1738,13 @@ class Session:
1735
1738
  self.warning(f"当前session中不存在名称为 {args[0]} 的变量")
1736
1739
 
1737
1740
  elif len(args) == 2:
1738
- self.setVariable(args[0], args[1])
1741
+ val = None
1742
+ try:
1743
+ val = eval(args[1])
1744
+ except:
1745
+ val = args[1]
1746
+
1747
+ self.setVariable(args[0], val)
1739
1748
 
1740
1749
  def handle_global(self, code: CodeLine = None, *args, **kwargs):
1741
1750
  '''
@@ -1756,7 +1765,9 @@ class Session:
1756
1765
  - #variable
1757
1766
  '''
1758
1767
 
1759
- args = code.code[2:]
1768
+ new_cmd_text, new_code = code.expand(self, *args, **kwargs)
1769
+ args = new_code[2:]
1770
+ #args = code.code[2:]
1760
1771
 
1761
1772
  if len(args) == 0:
1762
1773
  vars = self.application.globals
@@ -1810,7 +1821,12 @@ class Session:
1810
1821
  self.info("全局空间不存在名称为 {} 的变量".format(var), "全局变量")
1811
1822
 
1812
1823
  elif len(args) == 2:
1813
- self.application.set_globals(args[0], args[1])
1824
+ val = None
1825
+ try:
1826
+ val = eval(args[1])
1827
+ except:
1828
+ val = args[1]
1829
+ self.application.set_globals(args[0], val)
1814
1830
 
1815
1831
  def _handle_objs(self, name: str, objs: dict, *args):
1816
1832
  if len(args) == 0:
@@ -2775,6 +2791,8 @@ class Session:
2775
2791
  self.error(new_text[6:])
2776
2792
 
2777
2793
  def info2(self, msg, title = "PYMUD INFO", style = Settings.INFO_STYLE):
2794
+ msg = f"{msg}"
2795
+
2778
2796
  if Settings.client["newline"] in msg:
2779
2797
  new_lines = list()
2780
2798
  msg_lines = msg.split(Settings.client["newline"])
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.19.3"
14
+ __version__ = "0.19.4"
15
15
  "APP 当前版本"
16
- __release__ = "2024-04-05"
16
+ __release__ = "2024-04-20"
17
17
  "APP 当前版本发布日期"
18
18
  __author__ = "本牛(newstart)@北侠"
19
19
  "APP 作者"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pymud
3
- Version: 0.19.3.post2
3
+ Version: 0.19.4
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>
@@ -963,3 +963,10 @@ Requires-Dist: prompt-toolkit
963
963
 
964
964
  ### 0.19.3post2 (2024-04-05)
965
965
  + 问题修复: 修复退出程序时的小bug
966
+
967
+ ### 0.19.4 (2024-04-20)
968
+ + 功能调整: info 现在 msg 恢复为可接受任何类型参数,不一定是 str
969
+ + 功能调整: #var, #global 指令中,现在可以使用参数扩展了,例如 #var max_qi @qi
970
+ + 功能调整: #var, #global 指令中,现在对字符串会先使用 eval 转换类型,转换失败时使用 str 类型。例如, #var myvar 1 时,myvar类型将为int
971
+ + 功能调整: 变量替代时,会自动实现类型转化,当被替代变量值为非 str 类型时不会再报错
972
+ + 问题修复: 修复之前从后向前选择时,无法复制的问题
@@ -0,0 +1,16 @@
1
+ pymud/__init__.py,sha256=5SteBKAKAizt98QOxDRuGxRHhoDAijdG8lC5U7az2SM,422
2
+ pymud/__main__.py,sha256=I6jFLnTErSuM0G828WUx5EIAmMNAzqYr2AT1zdtGmp0,4636
3
+ pymud/dialogs.py,sha256=SRNHOashupNi7128Bg_35J1rrI2TsZEakTbaMW5d9PU,5596
4
+ pymud/extras.py,sha256=p2fgnzKFtaAvcYqayMNSZhrC3BpvfkbF_la3SfGaWBA,42400
5
+ pymud/objects.py,sha256=hERTIctGF660CoHwZf00-5RZ1-bqCPK2QuwmTZ7NceU,38088
6
+ pymud/pkuxkx.py,sha256=vWXHU6GF0HQ0eWb3LmxFVRP0cKnigffCX7Z-LJvwVtw,11496
7
+ pymud/protocol.py,sha256=QfDXjlg2OcJXmVoXf_3mAemnYotRXDUlEZNQjhkfXdA,49106
8
+ pymud/pymud.py,sha256=HgmAXBXNMjo8xKAVQRS2XOshp-hieEy7bjvaXGq_0Y0,43230
9
+ pymud/session.py,sha256=18QIArVTPKEBETv4pTWSXssy12XbM4cFj0IhCyio49U,114503
10
+ pymud/settings.py,sha256=p1YPxDAh0isRsoRVGOgklawXYkzUE490irNiizWylB4,7092
11
+ pymud-0.19.4.dist-info/LICENSE.txt,sha256=IwGE9guuL-ryRPEKi6wFPI_zOhg7zDZbTYuHbSt_SAk,35823
12
+ pymud-0.19.4.dist-info/METADATA,sha256=ApUZTZZRwQvR0vXUAd1gMTlcfLjT3NWYz2mKtmuHJmo,67839
13
+ pymud-0.19.4.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
14
+ pymud-0.19.4.dist-info/entry_points.txt,sha256=diPUOtTkhgC1hVny7Cdg4aRhaHSynMQoraE7ZhJxUcw,37
15
+ pymud-0.19.4.dist-info/top_level.txt,sha256=8Gp1eXjxixXjqhhti6tLCspV_8s9sNV3z5Em2_KRhD4,6
16
+ pymud-0.19.4.dist-info/RECORD,,
@@ -1,16 +0,0 @@
1
- pymud/__init__.py,sha256=5SteBKAKAizt98QOxDRuGxRHhoDAijdG8lC5U7az2SM,422
2
- pymud/__main__.py,sha256=I6jFLnTErSuM0G828WUx5EIAmMNAzqYr2AT1zdtGmp0,4636
3
- pymud/dialogs.py,sha256=SRNHOashupNi7128Bg_35J1rrI2TsZEakTbaMW5d9PU,5596
4
- pymud/extras.py,sha256=p2fgnzKFtaAvcYqayMNSZhrC3BpvfkbF_la3SfGaWBA,42400
5
- pymud/objects.py,sha256=1cEhGtJ0mPrPSEXUw9t_okj9br2jN3Yx7djT1ht1a-4,38063
6
- pymud/pkuxkx.py,sha256=vWXHU6GF0HQ0eWb3LmxFVRP0cKnigffCX7Z-LJvwVtw,11496
7
- pymud/protocol.py,sha256=QfDXjlg2OcJXmVoXf_3mAemnYotRXDUlEZNQjhkfXdA,49106
8
- pymud/pymud.py,sha256=t0LOkqNaQnV1jhnn8O6Qr3e0mTxOEtLZgvnYcK6xa7A,42928
9
- pymud/session.py,sha256=d5MGyLO2-s2vhFuuFhU-URXN74KycdO_Xp0Zh4et2dY,114021
10
- pymud/settings.py,sha256=bP0zfX14wLZ6sVlVYCdxZmJqGoqNctu385L322moTeQ,7092
11
- pymud-0.19.3.post2.dist-info/LICENSE.txt,sha256=IwGE9guuL-ryRPEKi6wFPI_zOhg7zDZbTYuHbSt_SAk,35823
12
- pymud-0.19.3.post2.dist-info/METADATA,sha256=_g-MsxMSBpGxoe11rx0hDaC70ZisLI0e9U4Frw1Qhe8,67251
13
- pymud-0.19.3.post2.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
14
- pymud-0.19.3.post2.dist-info/entry_points.txt,sha256=diPUOtTkhgC1hVny7Cdg4aRhaHSynMQoraE7ZhJxUcw,37
15
- pymud-0.19.3.post2.dist-info/top_level.txt,sha256=8Gp1eXjxixXjqhhti6tLCspV_8s9sNV3z5Em2_KRhD4,6
16
- pymud-0.19.3.post2.dist-info/RECORD,,