更新日志可见 [这里](.docs/update_logs.md)

update logs can see at [here](./docs/update_logs)
This commit is contained in:
瑗杰 沈 2021-04-09 19:49:02 +08:00
parent 06bd88e9ac
commit df8df8e677
8 changed files with 42 additions and 15 deletions

View File

@ -2,7 +2,7 @@
### Version
0.2.3 (developing DEMO)
0.2.4 (developing DEMO)
中文README请移步 [这里](.docs/README-cn.md)

View File

@ -40,7 +40,7 @@ class client(mp.Process):
self.net_mode = net_mode
self.window_config = tools.config('configs/sys_value/window.json5')
self.caption = self.window_config['caption']
self.caption = configs.name_handler(self.caption, self.window_config['caption_option'])
self.caption = configs.name_handler(self.caption, {'version': self.window_config['caption_option']['version']})
self.window = window(logger=logger,
dev_dic=dev_dic,
dev_list=dev_list,
@ -247,6 +247,9 @@ class window(pyglet.window.Window):
def on_mouse_motion(self, x, y, dx, dy):
self.logger.debug('按键移动 %s %s %s %s' % (x, y, dx, dy))
def on_mouse_drag(self, x, y, dx, dy, buttons, modifiers):
self.logger.debug('按键拖拽 %s %s %s %s %s %s' %(x, y, dx, dy, buttons, modifiers))
def on_mouse_press(self, x, y, button, modifiers):
if button == mouse.LEFT:
self.logger.debug('左键! 在 x:%s y:%s' % (x, y))

View File

@ -144,10 +144,15 @@ name_handlers = {'time.time': str(time.time()),
}
def name_handler(name: str, configs={}) -> str:
def name_handler(name: str, configs=dict) -> str:
names = name_handlers
names.update(configs)
if configs is dict:
pass
elif type(configs) is dict:
names.update(configs)
else:
pass
if 'date' in names:
names['date'] = str(time.strftime(names['date'], time.gmtime(time.time())))
handler_name = name.format(**names)
if configs is None:
return handler_name
return name
return handler_name

View File

@ -40,8 +40,7 @@ class Game:
self.lang = tools.config('configs/sys_value/lang/%s.json5' % self.language, 'main')
# logger
self.log_config = tools.config('configs/logging.json5', 'file')
self.log_filename = configs.name_handler(self.log_config['filename']['main'],
self.log_config['filename']['formats'])
self.log_filename = configs.name_handler(self.log_config['filename']['main'], {'date': self.log_config['date_fmt']})
self.root_logger_fmt = logging.Formatter(self.log_config['fmt'], self.log_config['date_fmt'])
self.root_logger_stream_handler = logging.StreamHandler()
self.root_logger_stream_handler.setLevel(self.log_config['level'])
@ -85,7 +84,7 @@ class Game:
if self.on_python_v_info[0] == 2:
self.main_logger.critical('%s' % self.lang['version.need3+'])
raise Exception('%s' % self.lang['version.need3+'])
elif self.on_python_v_info[1] <= 9:
elif self.on_python_v_info[1] <= 8:
warning = configs.name_handler(self.lang['version.best3.8+'])
self.main_logger.warning(warning)

View File

@ -34,9 +34,11 @@ def c_b(thing): # stand for my bool
raise ValueError("Need a 'like bool' not anything else")
level_ = ['DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL',
logging.DEBUG,logging.INFO, logging.WARNING, logging.ERROR, logging.CRITICAL]
def log_level(level):
level_ = ['DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL', logging.DEBUG,
logging.INFO, logging.WARNING, logging.ERROR, logging.CRITICAL]
if level in level_:
if (level == 'DEBUG') or (level == logging.DEBUG):
return logging.DEBUG

View File

@ -6,7 +6,7 @@
'caption': 'Simple Rocket {version}',
// {version} -> version of SR
'caption_option': {
'version': '0.2.1'
'version': '0.2.4'
},
'resizable': 'true',
// bool

View File

@ -2,7 +2,7 @@
## 版本
0.2.3 (开发DEMO.ing)
0.2.4 (开发DEMO.ing)
For an English version of readme, please move [here](..).

View File

@ -1,10 +1,27 @@
# Difficult Rocket Update Logs
## 2021/04/09 V 0.2.3/4
### Add
- support many things(also forget)
### Change
- `tools.name_handler()` now use `str.format` to handler str
- `DR/sys_value` folder now move to `DR/configs/sys_value`
### DEBUG
- many `tools.name_handler()` use bug(cause crashes)
- `{date}` can be successful use in `tools.name_handler()` (if you define the format of date)
- log file's filename incorrect (should be `xxxx-xx-xx xx-xx-xx DR.log` but be `{date} DR.log`)
## 2021/03/27 V 0.2.2/1
### Add
- local libs
- add local libs
- `pyglet 1.5.15`
- `json 0.9.5`
@ -18,3 +35,4 @@ not the local libs (todo)
### DEBUG
- some bugs(I forget them)