Skip to content

Commit 7df3386

Browse files
authored
Merge pull request #119 from fa0311/develop-v5
5.4.0
2 parents 50b69dd + 740313b commit 7df3386

File tree

22 files changed

+105
-89
lines changed

22 files changed

+105
-89
lines changed

.vscode/extensions.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"recommendations": [
3+
"ms-python.vscode-pylance",
4+
"ms-python.python",
5+
"ms-python.debugpy",
6+
"charliermarsh.ruff",
7+
"davidanson.vscode-markdownlint",
8+
"esbenp.prettier-vscode"
9+
]
10+
}

.vscode/launch.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@
66
"configurations": [
77
{
88
"name": "Python: 現在のファイル",
9-
"type": "python",
9+
"type": "debugpy",
1010
"request": "launch",
1111
"program": "${file}",
1212
"console": "integratedTerminal",
1313
"justMyCode": true
1414
},
1515
{
1616
"name": "DMMGamePlayerFastLauncher",
17-
"type": "python",
17+
"type": "debugpy",
1818
"request": "launch",
1919
"program": "DMMGamePlayerFastLauncher/DMMGamePlayerFastLauncher.py",
2020
"console": "integratedTerminal",
@@ -25,7 +25,7 @@
2525
},
2626
{
2727
"name": "GameLauncher",
28-
"type": "python",
28+
"type": "debugpy",
2929
"request": "launch",
3030
"program": "DMMGamePlayerFastLauncher/DMMGamePlayerFastLauncher.py",
3131
"console": "integratedTerminal",
@@ -37,7 +37,7 @@
3737
},
3838
{
3939
"name": "LaunchLauncher",
40-
"type": "python",
40+
"type": "debugpy",
4141
"request": "launch",
4242
"program": "DMMGamePlayerFastLauncher/DMMGamePlayerFastLauncher.py",
4343
"console": "integratedTerminal",

.vscode/settings.json

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,12 @@
11
{
2-
"flake8.args": ["--ignore=E501,E731"],
32
"markdownlint.config": {
43
"MD033": false
54
},
65
"python.analysis.typeCheckingMode": "basic",
76
"editor.codeActionsOnSave": {
8-
"source.organizeImports": true
7+
"source.organizeImports": "explicit",
8+
"source.fixAll": "explicit",
99
},
10-
"black-formatter.args": ["--line-length=180"],
11-
"[json]": {
12-
"editor.defaultFormatter": "esbenp.prettier-vscode"
13-
},
14-
1510
"files.exclude": {
1611
"**/__pycache__": true,
1712
"**/build": true,
@@ -20,4 +15,4 @@
2015
"**/*.spec": true,
2116
"**/.venv": true
2217
}
23-
}
18+
}

DMMGamePlayerFastLauncher/DMMGamePlayerFastLauncher.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
import i18n
99
from app import App
1010
from coloredlogs import ColoredFormatter
11-
from component.logger import StyleScheme, TkinkerLogger
11+
from component.logger import LoggingHandlerMask, StyleScheme, TkinkerLogger
1212
from launch import GameLauncher, LanchLauncher
1313
from lib.DGPSessionV2 import DgpSessionV2
1414
from models.setting_data import AppConfig
@@ -36,7 +36,8 @@ def loder(master: LanchLauncher):
3636
handlers.append(handler)
3737

3838
if AppConfig.DATA.debug_window.get() and not any([isinstance(x, LoggingHandler) for x in logging.getLogger().handlers]):
39-
handler = LoggingHandler(TkinkerLogger(master).create().box, scheme=StyleScheme)
39+
handle = LoggingHandlerMask if AppConfig.DATA.mask_token.get() else LoggingHandler
40+
handler = handle(TkinkerLogger(master).create().box, scheme=StyleScheme)
4041
handler.setFormatter(ColoredFormatter("[%(levelname)s] [%(asctime)s] %(message)s"))
4142
handlers.append(handler)
4243

@@ -114,4 +115,3 @@ def loder(master: LanchLauncher):
114115
lanch.mainloop()
115116
else:
116117
raise Exception("type error")
117-
raise Exception("type error")

DMMGamePlayerFastLauncher/component/component.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,8 @@
66
import customtkinter as ctk
77
import i18n
88
from component.var import PathVar
9-
from customtkinter import CTkBaseClass, CTkButton, CTkCheckBox, CTkEntry, CTkFrame, CTkLabel, CTkOptionMenu, CTkProgressBar, CTkToplevel
9+
from customtkinter import CTkBaseClass, CTkButton, CTkCheckBox, CTkEntry, CTkFrame, CTkLabel, CTkOptionMenu, CTkProgressBar, CTkToplevel, Variable
1010
from customtkinter import ThemeManager as CTkm
11-
from customtkinter import Variable
1211

1312

1413
class LabelComponent(CTkFrame):

DMMGamePlayerFastLauncher/component/logger.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1+
import re
2+
13
import customtkinter as ctk
24
from customtkinter import CTkTextbox, CTkToplevel
3-
from tkinter_colored_logging_handlers.main import ColorSchemeLight, StyleSchemeBase
5+
from tkinter_colored_logging_handlers import ColorSchemeLight, LoggingHandler, StyleSchemeBase
46

57

68
class StyleScheme(StyleSchemeBase, ColorSchemeLight):
@@ -23,3 +25,10 @@ def __init__(self, master):
2325
def create(self):
2426
self.box.pack(fill=ctk.BOTH, padx=10, pady=(0, 10), expand=True)
2527
return self
28+
29+
30+
class LoggingHandlerMask(LoggingHandler):
31+
def format(self, record):
32+
formated = super().format(record)
33+
formated = re.sub(r"(?<=\=)[0-9a-zA-Z]{32,}", lambda x: f"\033[31m[CENSORED {len(x.group())}]\033[0m", formated)
34+
return formated

DMMGamePlayerFastLauncher/models/setting_data.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
from component.variable_base import VariableBase
66
from lib.DGPSessionV2 import DgpSessionV2
77
from static.env import Env
8+
from utils.utils import get_default_locale
89

910

1011
@dataclass
@@ -17,12 +18,13 @@ class SettingData(VariableBase):
1718
dmm_proxy_http: StringVar = field(default_factory=StringVar)
1819
dmm_proxy_https: StringVar = field(default_factory=StringVar)
1920
dmm_proxy_socks: StringVar = field(default_factory=StringVar)
20-
lang: StringVar = field(default_factory=lambda: StringVar(value="ja"))
21+
lang: StringVar = field(default_factory=lambda: StringVar(value=get_default_locale()[0]))
2122
theme: StringVar = field(default_factory=lambda: StringVar(value="blue"))
2223
appearance_mode: StringVar = field(default_factory=lambda: StringVar(value="dark"))
2324
window_scaling: DoubleVar = field(default_factory=lambda: DoubleVar(value=1.0))
2425
debug_window: BooleanVar = field(default_factory=lambda: BooleanVar(value=False))
2526
output_logfile: BooleanVar = field(default_factory=lambda: BooleanVar(value=False))
27+
mask_token: BooleanVar = field(default_factory=lambda: BooleanVar(value=True))
2628

2729
def update(self):
2830
DgpSessionV2.DGP5_PATH = self.dmm_game_player_program_folder.get_path()

DMMGamePlayerFastLauncher/static/env.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99

1010
class Env(Dump):
11-
VERSION = "v5.3.0"
11+
VERSION = "v5.4.0"
1212
RELEASE_VERSION = requests.get(UrlConfig.RELEASE_API).json().get("tag_name", VERSION)
1313

1414
DEVELOP: bool = os.environ.get("ENV") == "DEVELOP"

DMMGamePlayerFastLauncher/static/loder.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
from models.setting_data import AppConfig, DeviceData, SettingData
44
from static.config import DataPathConfig
5+
from utils.utils import get_supported_lang
56

67

78
def config_loder():
@@ -19,5 +20,8 @@ def config_loder():
1920
with open(DataPathConfig.DEVICE, "w+", encoding="utf-8") as f:
2021
json.dump(AppConfig.DEVICE.to_dict(), f)
2122

23+
if AppConfig.DATA.lang.get() not in [x[0] for x in get_supported_lang()]:
24+
AppConfig.DATA.lang.set("en_US")
25+
2226
AppConfig.DATA.update()
2327
AppConfig.DEVICE.update()

DMMGamePlayerFastLauncher/tab/account.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,9 @@ def create(self):
241241
for key, value in hardware.items():
242242
EntryComponent(self, text=key, variable=StringVar(value=value), state=ctk.DISABLED).create()
243243

244-
command = lambda id=hardware["hardware_manage_id"]: self.delete_callback(id)
244+
def command(id=hardware["hardware_manage_id"]):
245+
return self.delete_callback(id)
246+
245247
CTkButton(self, text=i18n.t("app.account.delete"), command=command).pack(fill=ctk.X, pady=10)
246248
PaddingComponent(self, height=20).create()
247249

0 commit comments

Comments
 (0)