mirror of
https://gitee.com/sui-feng-cb/AzurLaneAutoScript1
synced 2026-03-12 17:57:01 +08:00
Fix: Set serial type to str
This commit is contained in:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user