mirror of
https://gitee.com/sui-feng-cb/AzurLaneAutoScript1
synced 2026-03-09 18:39:04 +08:00
Fix: Set serial type to str
This commit is contained in:
parent
4339126c7e
commit
1f9297f55e
@ -3,7 +3,8 @@
|
||||
"Emulator": {
|
||||
"Serial": {
|
||||
"type": "input",
|
||||
"value": "127.0.0.1:5555"
|
||||
"value": "127.0.0.1:5555",
|
||||
"valuetype": "str"
|
||||
},
|
||||
"PackageName": {
|
||||
"type": "input",
|
||||
|
||||
@ -12,7 +12,9 @@ Scheduler:
|
||||
FailureInterval: 120
|
||||
ServerUpdate: 00:00
|
||||
Emulator:
|
||||
Serial: 127.0.0.1:5555
|
||||
Serial:
|
||||
value: 127.0.0.1:5555
|
||||
valuetype: str
|
||||
PackageName: com.bilibili.azurlane
|
||||
Server:
|
||||
value: cn
|
||||
|
||||
@ -436,14 +436,16 @@ class AlasGUI(Frame):
|
||||
config_name = self.alas_name
|
||||
except queue.Empty:
|
||||
continue
|
||||
modified[self.idx_to_path[d["name"]]] = parse_pin_value(d["value"])
|
||||
modified[self.idx_to_path[d["name"]]] = d["value"]
|
||||
while True:
|
||||
try:
|
||||
d = self.modified_config_queue.get(timeout=1)
|
||||
modified[self.idx_to_path[d["name"]]] = parse_pin_value(d["value"])
|
||||
modified[self.idx_to_path[d["name"]]] = d["value"]
|
||||
except queue.Empty:
|
||||
config = read_file(filepath_config(config_name))
|
||||
for k, v in modified.copy().items():
|
||||
valuetype = deep_get(self.ALAS_ARGS, k + ".valuetype")
|
||||
v = parse_pin_value(v, valuetype)
|
||||
validate = deep_get(self.ALAS_ARGS, k + ".validate")
|
||||
if not len(str(v)):
|
||||
default = deep_get(self.ALAS_ARGS, k + ".value")
|
||||
|
||||
@ -391,7 +391,15 @@ class Icon:
|
||||
ADD = _read(filepath_icon("add"))
|
||||
|
||||
|
||||
def parse_pin_value(val):
|
||||
str2type = {
|
||||
"str": str,
|
||||
"float": float,
|
||||
"int": int,
|
||||
"bool": bool,
|
||||
}
|
||||
|
||||
|
||||
def parse_pin_value(val, valuetype: str = None):
|
||||
"""
|
||||
input, textarea return str
|
||||
select return its option (str or int)
|
||||
@ -402,6 +410,8 @@ def parse_pin_value(val):
|
||||
return False
|
||||
else:
|
||||
return True
|
||||
elif valuetype:
|
||||
return str2type[valuetype](val)
|
||||
elif isinstance(val, (int, float)):
|
||||
return val
|
||||
else:
|
||||
|
||||
Loading…
Reference in New Issue
Block a user