From 06bd88e9acff0ff4288609961498843cadeeeb45 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=91=97=E6=9D=B0=20=E6=B2=88?= <3695888@qq.com> Date: Mon, 5 Apr 2021 18:22:17 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=80=E4=BA=9B=E5=B0=8F=E6=94=B9=E5=8A=A8?= =?UTF-8?q?=EF=BC=88=E6=8D=A2=E6=96=B0=E7=94=B5=E8=84=91=E5=95=A6=EF=BC=8C?= =?UTF-8?q?=E5=A5=BD=E8=80=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bin/client.py | 2 +- bin/configs.py | 15 +++++++-------- configs/logging.json5 | 2 +- configs/sys_value/window.json5 | 2 +- 4 files changed, 10 insertions(+), 11 deletions(-) diff --git a/bin/client.py b/bin/client.py index d3f1d7d..5e8795c 100644 --- a/bin/client.py +++ b/bin/client.py @@ -245,7 +245,7 @@ class window(pyglet.window.Window): """ def on_mouse_motion(self, x, y, dx, dy): - pass + self.logger.debug('按键移动 %s %s %s %s' % (x, y, dx, dy)) def on_mouse_press(self, x, y, button, modifiers): if button == mouse.LEFT: diff --git a/bin/configs.py b/bin/configs.py index 40d7542..c6b1fba 100644 --- a/bin/configs.py +++ b/bin/configs.py @@ -138,17 +138,16 @@ def configs(name, option=None) -> dict: return data -name_handlers = {'{time.time}': str(time.time()), - '{dir}': str(os.getcwd()), - '{py_v}': str(sys.version.split(' ')[0]) +name_handlers = {'time.time': str(time.time()), + 'dir': str(os.getcwd()), + 'py_v': str(sys.version.split(' ')[0]) } -def name_handler(name: str, configs=None) -> str: - names = configs - names = names.update(name_handlers) - print(names) - handler_name = name.format(names) +def name_handler(name: str, configs={}) -> str: + names = name_handlers + names.update(configs) + handler_name = name.format(**names) if configs is None: return handler_name return name diff --git a/configs/logging.json5 b/configs/logging.json5 index a9e6cf2..107fb5b 100644 --- a/configs/logging.json5 +++ b/configs/logging.json5 @@ -26,7 +26,7 @@ 'main': '{date} DR.log', // {date} -> date 'formats': { - '{date}': '%Y-%m-%d %H-%M-%S' + 'date': '%Y-%m-%d %H-%M-%S' // format at https://docs.python.org/zh-cn/3.8/library/time.html#time.strftime // can and more {xx} by adding more obj EZ } diff --git a/configs/sys_value/window.json5 b/configs/sys_value/window.json5 index ce6c1d4..6b19a61 100644 --- a/configs/sys_value/window.json5 +++ b/configs/sys_value/window.json5 @@ -6,7 +6,7 @@ 'caption': 'Simple Rocket {version}', // {version} -> version of SR 'caption_option': { - '{version}': '0.2.1' + 'version': '0.2.1' }, 'resizable': 'true', // bool