mirror of
https://github.com/LmeSzinc/StarRailCopilot.git
synced 2024-11-25 10:01:10 +00:00
Fix: Empty planner rows are not preserved in config
This commit is contained in:
parent
e8dcd8ac95
commit
fa85ebe2b6
@ -383,9 +383,8 @@ class PlannerMixin(UI):
|
|||||||
"""
|
"""
|
||||||
Write planner detection results info user config
|
Write planner detection results info user config
|
||||||
"""
|
"""
|
||||||
model = PlannerProgressParser().from_planner_results(results)
|
planner = PlannerProgressParser().from_planner_results(results)
|
||||||
data = model.to_config()
|
self.planner_write(planner)
|
||||||
self.config.cross_set('Dungeon.Planner', data)
|
|
||||||
|
|
||||||
@cached_property
|
@cached_property
|
||||||
def planner(self) -> PlannerProgressParser:
|
def planner(self) -> PlannerProgressParser:
|
||||||
@ -396,10 +395,16 @@ class PlannerMixin(UI):
|
|||||||
logger.info(row)
|
logger.info(row)
|
||||||
return model
|
return model
|
||||||
|
|
||||||
def planner_write(self):
|
def planner_write(self, planner=None):
|
||||||
"""
|
"""
|
||||||
Write planner into user config, delete planner object
|
Write planner into user config, delete planner object
|
||||||
"""
|
"""
|
||||||
data = self.planner.to_config()
|
if planner is None:
|
||||||
self.config.cross_set('Dungeon.Planner', data)
|
planner = self.planner
|
||||||
|
|
||||||
|
data = planner.to_config()
|
||||||
|
|
||||||
|
with self.config.multi_set():
|
||||||
|
for key, value in data.items():
|
||||||
|
self.config.cross_set(f'Dungeon.Planner.{key}', value)
|
||||||
del_cached_property(self, 'planner')
|
del_cached_property(self, 'planner')
|
||||||
|
Loading…
Reference in New Issue
Block a user