pyscreeps-arena 0.5.7.0__tar.gz → 0.5.7a0__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.
- {pyscreeps_arena-0.5.7.0 → pyscreeps_arena-0.5.7a0}/PKG-INFO +1 -1
- {pyscreeps_arena-0.5.7.0 → pyscreeps_arena-0.5.7a0}/pyscreeps_arena/__init__.py +2 -12
- {pyscreeps_arena-0.5.7.0 → pyscreeps_arena-0.5.7a0}/pyscreeps_arena/compiler.py +6 -10
- {pyscreeps_arena-0.5.7.0 → pyscreeps_arena-0.5.7a0}/pyscreeps_arena/core/const.py +1 -1
- {pyscreeps_arena-0.5.7.0 → pyscreeps_arena-0.5.7a0}/pyscreeps_arena/localization.py +0 -4
- pyscreeps_arena-0.5.7a0/pyscreeps_arena/project.7z +0 -0
- {pyscreeps_arena-0.5.7.0 → pyscreeps_arena-0.5.7a0}/pyscreeps_arena/ui/project_ui.py +0 -1
- {pyscreeps_arena-0.5.7.0 → pyscreeps_arena-0.5.7a0}/pyscreeps_arena.egg-info/PKG-INFO +1 -1
- {pyscreeps_arena-0.5.7.0 → pyscreeps_arena-0.5.7a0}/pyscreeps_arena.egg-info/SOURCES.txt +1 -8
- {pyscreeps_arena-0.5.7.0 → pyscreeps_arena-0.5.7a0}/setup.py +1 -1
- pyscreeps_arena-0.5.7.0/pyscreeps_arena/project.7z +0 -0
- pyscreeps_arena-0.5.7.0/pyscreeps_arena/ui/creeplogic_edit.py +0 -14
- pyscreeps_arena-0.5.7.0/pyscreeps_arena/ui/qcreeplogic/__init__.py +0 -3
- pyscreeps_arena-0.5.7.0/pyscreeps_arena/ui/qcreeplogic/model.py +0 -72
- pyscreeps_arena-0.5.7.0/pyscreeps_arena/ui/qcreeplogic/qcreeplogic.py +0 -770
- pyscreeps_arena-0.5.7.0/pyscreeps_arena/ui/qrecipe/__init__.py +0 -1
- pyscreeps_arena-0.5.7.0/pyscreeps_arena/ui/qrecipe/model.py +0 -434
- pyscreeps_arena-0.5.7.0/pyscreeps_arena/ui/qrecipe/qrecipe.py +0 -914
- {pyscreeps_arena-0.5.7.0 → pyscreeps_arena-0.5.7a0}/pyscreeps_arena/build.py +0 -0
- {pyscreeps_arena-0.5.7.0 → pyscreeps_arena-0.5.7a0}/pyscreeps_arena/core/__init__.py +0 -0
- {pyscreeps_arena-0.5.7.0 → pyscreeps_arena-0.5.7a0}/pyscreeps_arena/core/basic.py +0 -0
- {pyscreeps_arena-0.5.7.0 → pyscreeps_arena-0.5.7a0}/pyscreeps_arena/core/config.py +0 -0
- {pyscreeps_arena-0.5.7.0 → pyscreeps_arena-0.5.7a0}/pyscreeps_arena/core/core.py +0 -0
- {pyscreeps_arena-0.5.7.0 → pyscreeps_arena-0.5.7a0}/pyscreeps_arena/core/main.py +0 -0
- {pyscreeps_arena-0.5.7.0 → pyscreeps_arena-0.5.7a0}/pyscreeps_arena/core/utils.py +0 -0
- {pyscreeps_arena-0.5.7.0 → pyscreeps_arena-0.5.7a0}/pyscreeps_arena/ui/P2PY.py +0 -0
- {pyscreeps_arena-0.5.7.0 → pyscreeps_arena-0.5.7a0}/pyscreeps_arena/ui/__init__.py +0 -0
- {pyscreeps_arena-0.5.7.0 → pyscreeps_arena-0.5.7a0}/pyscreeps_arena/ui/rs_icon.py +0 -0
- {pyscreeps_arena-0.5.7.0 → pyscreeps_arena-0.5.7a0}/pyscreeps_arena.egg-info/dependency_links.txt +0 -0
- {pyscreeps_arena-0.5.7.0 → pyscreeps_arena-0.5.7a0}/pyscreeps_arena.egg-info/entry_points.txt +0 -0
- {pyscreeps_arena-0.5.7.0 → pyscreeps_arena-0.5.7a0}/pyscreeps_arena.egg-info/requires.txt +0 -0
- {pyscreeps_arena-0.5.7.0 → pyscreeps_arena-0.5.7a0}/pyscreeps_arena.egg-info/top_level.txt +0 -0
- {pyscreeps_arena-0.5.7.0 → pyscreeps_arena-0.5.7a0}/setup.cfg +0 -0
|
@@ -35,18 +35,8 @@ def CMD_OpenUI():
|
|
|
35
35
|
|
|
36
36
|
"""
|
|
37
37
|
try:
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
from pyscreeps_arena.ui.creeplogic_edit import run_creeplogic_edit
|
|
41
|
-
run_creeplogic_edit()
|
|
42
|
-
elif len(sys.argv) > 1 and sys.argv[1] == '-e':
|
|
43
|
-
from pyscreeps_arena.ui.creeplogic_edit import run_creeplogic_edit
|
|
44
|
-
from pyscreeps_arena.core import config
|
|
45
|
-
config.language = 'en'
|
|
46
|
-
run_creeplogic_edit()
|
|
47
|
-
else:
|
|
48
|
-
from pyscreeps_arena.ui.project_ui import run_project_creator
|
|
49
|
-
run_project_creator()
|
|
38
|
+
from pyscreeps_arena.ui.project_ui import run_project_creator
|
|
39
|
+
run_project_creator()
|
|
50
40
|
except ImportError as e:
|
|
51
41
|
print(f"错误: 无法导入UI模块 - {e}")
|
|
52
42
|
print("请确保已安装PyQt6: pip install PyQt6")
|
|
@@ -230,16 +230,12 @@ class Compiler_Utils(Compiler_Const):
|
|
|
230
230
|
return f.read()
|
|
231
231
|
except UnicodeDecodeError:
|
|
232
232
|
# 如果使用检测到的编码读取失败,尝试使用chardet检测编码
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
return f.read()
|
|
240
|
-
except UnicodeDecodeError as e:
|
|
241
|
-
core.error('Compiler_Utils.auto_read', core.lformat(LOC_FILE_READ_FAILED, [fpath, "UnicodeError", e]), end='', head='\n', ln=config.language)
|
|
242
|
-
quit(-1)
|
|
233
|
+
with open(fpath, 'rb') as f: # 以二进制模式打开文件
|
|
234
|
+
raw_data = f.read() # 读取文件的原始数据
|
|
235
|
+
result = chardet.detect(raw_data) # 使用chardet检测编码
|
|
236
|
+
encoding = result['encoding'] # 获取检测到的编码
|
|
237
|
+
with open(fpath, 'r', encoding=encoding) as f: # 使用检测到的编码打开文件
|
|
238
|
+
return f.read()
|
|
243
239
|
|
|
244
240
|
def copy_to(self) -> list:
|
|
245
241
|
"""
|
|
@@ -17,10 +17,6 @@ LOC_FILE_NOT_EXISTS = {
|
|
|
17
17
|
'en': "{} File not exists: {}. You can ignore if it's a not used file.",
|
|
18
18
|
'cn': "{} 文件不存在: {}. 如果它是一个未使用的文件,您可以忽略它。",
|
|
19
19
|
}
|
|
20
|
-
LOC_FILE_READ_FAILED = {
|
|
21
|
-
'en': "Failed to read file: {}({})\nDetails:\n{}",
|
|
22
|
-
'cn': "读取文件失败: {}({})\n详细信息:\n{}",
|
|
23
|
-
}
|
|
24
20
|
LOC_PREPROCESSING = {
|
|
25
21
|
'en': "Preprocessing ...",
|
|
26
22
|
'cn': "预处理中 ...",
|
|
Binary file
|
|
@@ -19,12 +19,5 @@ pyscreeps_arena/core/main.py
|
|
|
19
19
|
pyscreeps_arena/core/utils.py
|
|
20
20
|
pyscreeps_arena/ui/P2PY.py
|
|
21
21
|
pyscreeps_arena/ui/__init__.py
|
|
22
|
-
pyscreeps_arena/ui/creeplogic_edit.py
|
|
23
22
|
pyscreeps_arena/ui/project_ui.py
|
|
24
|
-
pyscreeps_arena/ui/rs_icon.py
|
|
25
|
-
pyscreeps_arena/ui/qcreeplogic/__init__.py
|
|
26
|
-
pyscreeps_arena/ui/qcreeplogic/model.py
|
|
27
|
-
pyscreeps_arena/ui/qcreeplogic/qcreeplogic.py
|
|
28
|
-
pyscreeps_arena/ui/qrecipe/__init__.py
|
|
29
|
-
pyscreeps_arena/ui/qrecipe/model.py
|
|
30
|
-
pyscreeps_arena/ui/qrecipe/qrecipe.py
|
|
23
|
+
pyscreeps_arena/ui/rs_icon.py
|
|
@@ -7,7 +7,7 @@ with open(r"T:\New_PC\Import_Project\uploads\pyscreeps-arena_upload\pyscreeps-ar
|
|
|
7
7
|
long_description = f.read()
|
|
8
8
|
setup(
|
|
9
9
|
name='pyscreeps-arena',
|
|
10
|
-
version='0.5.
|
|
10
|
+
version='0.5.7a0',
|
|
11
11
|
description='Python api|interface to play game: Screeps: Arena.',
|
|
12
12
|
long_description=long_description,
|
|
13
13
|
long_description_content_type='text/markdown',
|
|
Binary file
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import sys
|
|
2
|
-
from PyQt6.QtWidgets import QApplication
|
|
3
|
-
from pyscreeps_arena.ui.qcreeplogic import QPSACreepLogic
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
def run_creeplogic_edit():
|
|
8
|
-
app = QApplication(sys.argv)
|
|
9
|
-
window = QPSACreepLogic()
|
|
10
|
-
window.show()
|
|
11
|
-
sys.exit(app.exec())
|
|
12
|
-
|
|
13
|
-
if __name__ == '__main__':
|
|
14
|
-
run_creeplogic_edit()
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
from typing import List, Optional, Union
|
|
2
|
-
from pyscreeps_arena.ui.qrecipe.model import PartsVector
|
|
3
|
-
|
|
4
|
-
class NamedRecipe:
|
|
5
|
-
def __init__(self, name: str, recipe: List[str]):
|
|
6
|
-
self.name = name
|
|
7
|
-
self.recipe = recipe
|
|
8
|
-
|
|
9
|
-
class CreepLogicSettings:
|
|
10
|
-
"""
|
|
11
|
-
爬虫逻辑设置类,用于定义爬虫的基本属性和行为。
|
|
12
|
-
"""
|
|
13
|
-
|
|
14
|
-
def __init__(self):
|
|
15
|
-
# ---------------------- 爬虫本体 | Creep --------------------------- #
|
|
16
|
-
self.draw: bool = False # 是否绘制爬虫信息
|
|
17
|
-
self.layer: int = 10 # 爬虫绘制图层,默认为10
|
|
18
|
-
|
|
19
|
-
# ---------------------- 流程与结构 | Flow & Struct --------------------------- #
|
|
20
|
-
self.link: Union[List[str], str, None] = None # 爬虫逻辑链接
|
|
21
|
-
self.once: bool = True # 是否禁用死亡后重生
|
|
22
|
-
|
|
23
|
-
# ---------------------- 孵化选项 | Spawning --------------------------- #
|
|
24
|
-
self.spawnable = True # 是否可以孵化标志
|
|
25
|
-
self.recipe: Union[List[str], NamedRecipe] = ["MOVE"] # 爬虫配方,默认为["MOVE"]
|
|
26
|
-
self.optimise: bool = True # 自动优化配方标志
|
|
27
|
-
self.extension: bool = True # 使用extension标志
|
|
28
|
-
self.direction: Optional[int] = None # 出生方向
|
|
29
|
-
|
|
30
|
-
# ---------------------- 基本信息 | Basic Info --------------------------- #
|
|
31
|
-
self.name: str = "" # 爬虫名称
|
|
32
|
-
|
|
33
|
-
def to_dict(self) -> dict:
|
|
34
|
-
"""
|
|
35
|
-
将设置转换为字典格式
|
|
36
|
-
"""
|
|
37
|
-
return {
|
|
38
|
-
"name": self.name,
|
|
39
|
-
"draw": self.draw,
|
|
40
|
-
"layer": self.layer,
|
|
41
|
-
"link": self.link,
|
|
42
|
-
"once": self.once,
|
|
43
|
-
"spawnable": self.spawnable,
|
|
44
|
-
"recipe": self.recipe if isinstance(self.recipe, list) else self.recipe.name,
|
|
45
|
-
"optimise": self.optimise,
|
|
46
|
-
"extension": self.extension,
|
|
47
|
-
"direction": self.direction
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
@classmethod
|
|
51
|
-
def from_dict(cls, data: dict) -> "CreepLogicSettings":
|
|
52
|
-
"""
|
|
53
|
-
从字典格式创建设置对象
|
|
54
|
-
"""
|
|
55
|
-
settings = cls()
|
|
56
|
-
settings.name = data.get("name", "")
|
|
57
|
-
settings.draw = data.get("draw", False)
|
|
58
|
-
settings.layer = data.get("layer", 10)
|
|
59
|
-
settings.link = data.get("link", None)
|
|
60
|
-
settings.once = data.get("once", True)
|
|
61
|
-
settings.spawnable = data.get("spawnable", True)
|
|
62
|
-
settings.recipe = data.get("recipe", ["MOVE"])
|
|
63
|
-
settings.optimise = data.get("optimise", True)
|
|
64
|
-
settings.extension = data.get("extension", True)
|
|
65
|
-
settings.direction = data.get("direction", None)
|
|
66
|
-
return settings
|
|
67
|
-
|
|
68
|
-
def reset(self):
|
|
69
|
-
"""
|
|
70
|
-
重置所有设置为默认值
|
|
71
|
-
"""
|
|
72
|
-
self.__init__()
|