pygui: avoid saving edge config metadata when values are default

This commit is contained in:
Blake Harnden 2020-12-04 00:03:30 -08:00
parent 41222f77c2
commit b762fe664b
2 changed files with 5 additions and 0 deletions

View file

@ -582,6 +582,8 @@ class CoreClient:
# create edges config
edges_config = []
for edge in self.links.values():
if not edge.is_customized():
continue
edge_config = dict(token=edge.token, width=edge.width, color=edge.color)
edges_config.append(edge_config)
edges_config = json.dumps(edges_config)

View file

@ -297,6 +297,9 @@ class CanvasEdge(Edge):
self.context: tk.Menu = tk.Menu(self.canvas)
self.create_context()
def is_customized(self) -> bool:
return self.width != EDGE_WIDTH or self.color != EDGE_COLOR
def create_context(self) -> None:
themes.style_menu(self.context)
self.context.add_command(label="Configure", command=self.click_configure)