config: fix None appearing in config if the file doesn't exist close #777
This commit is contained in:
parent
9b1b9593e8
commit
972a09df41
@ -351,7 +351,7 @@ class KlipperScreenConfig:
|
||||
saved_def = []
|
||||
found_saved = False
|
||||
if not path.exists(config_path):
|
||||
return [None, None]
|
||||
return ["", None]
|
||||
with open(config_path) as file:
|
||||
for line in file:
|
||||
line = line.replace('\n', '')
|
||||
@ -485,10 +485,11 @@ class KlipperScreenConfig:
|
||||
else:
|
||||
user_def, saved_def = self.separate_saved_config(self.config_path)
|
||||
|
||||
extra_lb = "\n" if saved_def is not None else ""
|
||||
contents = "%s\n%s%s\n%s\n%s\n%s\n" % (
|
||||
user_def, self.do_not_edit_line, extra_lb, self.do_not_edit_prefix, "\n".join(save_output),
|
||||
self.do_not_edit_prefix)
|
||||
contents = (f"{user_def}\n"
|
||||
f"{self.do_not_edit_line}\n"
|
||||
f"{self.do_not_edit_prefix}\n"
|
||||
+ '\n'.join(save_output) + f"\n"
|
||||
f"{self.do_not_edit_prefix}\n")
|
||||
|
||||
if self.config_path != self.default_config_path:
|
||||
filepath = self.config_path
|
||||
|
Loading…
x
Reference in New Issue
Block a user