0.6.1 developing

This commit is contained in:
shenjackyuanjie 2021-12-04 02:11:46 +08:00
parent e0ee62334e
commit 26d0a1e821
6 changed files with 23 additions and 10 deletions

View File

@ -46,8 +46,11 @@ if __name__ == '__main__':
try:
from Difficult_Rocket import main
game = main.Game()
cprofile = False
if cprofile:
cProfile.run('game.start()', sort='calls')
# game.start()
else:
game.start()
if DEBUGGING:
raise TestError('debugging')
except Exception as exp:

View File

@ -45,7 +45,7 @@ file_error = {'FileNotFoundError': 'no {filetype} file was founded!:\n file name
def load_file(file_name: str, stack=None) -> dict:
f_type = file_name[file_name.rfind('.') + 1:] # 从最后一个.到末尾 (截取文件格式)
try:
rd = ''
rd = NotImplementedError('解析失败,请检查文件类型/文件内容/文件是否存在!')
if (f_type == 'json5') or (f_type == 'json'):
try:
with open(file_name, 'r', encoding='utf-8') as jf: # jf -> json file

View File

@ -38,6 +38,7 @@ from Difficult_Rocket.api import tools, new_thread
local_lib = True
if local_lib:
from libs import pyglet
from libs.pyglet.window import Window
from libs.pyglet.window import key, mouse
else:
import pyglet
@ -75,7 +76,7 @@ class Client:
# TODO 写一下服务端启动相关,还是需要服务端啊
class ClientWindow(pyglet.window.Window):
class ClientWindow(Window):
def __init__(self, net_mode='local', *args, **kwargs):
start_time = time.time_ns()
@ -258,10 +259,6 @@ class ClientWindow(pyglet.window.Window):
key.MOD_CAPSLOCK |
key.MOD_SCROLLLOCK)):
self.dispatch_event('on_close')
if symbol == key.C and modifiers & key.MOD_CTRL:
self.dispatch_event('on_text_motion', key.MOTION_COPY)
if symbol == key.V and modifiers & key.MOD_CTRL:
self.dispatch_event('on_text_motion', key.MOTION_PASTE)
self.logger.debug(tr.lang('window', 'key.press').format(key.symbol_string(symbol), key.modifiers_string(modifiers)))
def on_key_release(self, symbol, modifiers) -> None:

View File

@ -239,6 +239,8 @@ class CommandLine(widgets.WidgetBase):
"""
def on_text(self, text):
# 这里的大部分东西都会在最近被重写
# TODO 重写成基于新的 InputBox 的解析
if self.editing:
if text in ('\r', '\n'): # goto a new line
if not self.text:

View File

@ -189,6 +189,7 @@ class InputBox(widgets.WidgetBase):
def on_key_press(self, symbol, modifiers):
# 在这加一个on_key_press纯属为了处理剪贴板操作
# (pyglet没有把ctrl+c和ctrl+v的事件绑定到on_text_motion上)
# TODO 正在给pyglet发PR
if symbol == key.C and modifiers & key.MOD_CTRL:
self.on_text_motion(key.MOTION_COPY)

View File

@ -15,7 +15,9 @@
- [![Readme-gitee](https://img.shields.io/badge/Readme-中文(点我!)-blue.svg?style=flat-square)](README-cn.md)
- Using [SemVer 2.0.0](https://semver.org/) to manage version
## 202111 V 0.6.1
## 202112 V 0.6.1
争取12月内发一个release
### Change
@ -26,7 +28,15 @@
- 重写了一遍` client.load_fonts()`
- rewrite `client.load_fonts()`
- 重写了 `tools.load_file()` 的错误处理和 `.config` 文件的解析方式
- rewrite `tools.load_file()` error handling and `.config` file parsing mode
- 现在 `.config` 文件解析后会直接返回一个 `ConfigParser` 对象
- 也就意味着不能再直接遍历 `.config` 文件返回的解析 ~~谁遍历.config文件啊~~
- 同时也意味着可以直接用解析好的 `.config` 文件来修改 `.config` 文件
- rewrite `tools.load_file()` error handling and `.config` file parsing method
- now `.config` file parsing after return `ConfigParser` object
- that means you can not directly traverse `.config` file return parsing ~~who traverse .config file~~
- also means you can directly use parsed `.config` file to modify `.config` file
- 为 `pyglet` 添加 `Ctrl+C``Ctrl+V` 的快捷键解析
- add `Ctrl+C` and `Ctrl+V` shortcut for `pyglet`
### Command