fixed name issue with app config, renamed to guiconfig
This commit is contained in:
parent
fbbf31f4fa
commit
a6cdd63570
7 changed files with 15 additions and 15 deletions
|
@ -26,7 +26,7 @@ class Application(tk.Frame):
|
|||
self.statusbar = None
|
||||
|
||||
# setup
|
||||
self.config = appconfig.read()
|
||||
self.guiconfig = appconfig.read()
|
||||
self.style = ttk.Style()
|
||||
self.setup_theme()
|
||||
self.core = CoreClient(self)
|
||||
|
@ -36,7 +36,7 @@ class Application(tk.Frame):
|
|||
|
||||
def setup_theme(self):
|
||||
themes.load(self.style)
|
||||
self.style.theme_use(self.config["preferences"]["theme"])
|
||||
self.style.theme_use(self.guiconfig["preferences"]["theme"])
|
||||
func = partial(themes.update_menu, self.style)
|
||||
self.master.bind_class("Menu", "<<ThemeChanged>>", func)
|
||||
|
||||
|
@ -88,7 +88,7 @@ class Application(tk.Frame):
|
|||
menu_action.on_quit()
|
||||
|
||||
def save_config(self):
|
||||
appconfig.save(self.config)
|
||||
appconfig.save(self.guiconfig)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
|
|
@ -83,12 +83,12 @@ class CoreClient:
|
|||
|
||||
def read_config(self):
|
||||
# read distributed server
|
||||
for config in self.app.config.get("servers", []):
|
||||
for config in self.app.guiconfig.get("servers", []):
|
||||
server = CoreServer(config["name"], config["address"], config["port"])
|
||||
self.servers[server.name] = server
|
||||
|
||||
# read custom nodes
|
||||
for config in self.app.config.get("nodes", []):
|
||||
for config in self.app.guiconfig.get("nodes", []):
|
||||
name = config["name"]
|
||||
image_file = config["image"]
|
||||
services = set(config["services"])
|
||||
|
@ -96,7 +96,7 @@ class CoreClient:
|
|||
self.custom_nodes[name] = node_draw
|
||||
|
||||
# read observers
|
||||
for config in self.app.config.get("observers", []):
|
||||
for config in self.app.guiconfig.get("observers", []):
|
||||
observer = Observer(config["name"], config["cmd"])
|
||||
self.custom_observers[observer.name] = observer
|
||||
|
||||
|
@ -210,7 +210,7 @@ class CoreClient:
|
|||
"""
|
||||
response = self.client.create_session()
|
||||
logging.info("created session: %s", response)
|
||||
location_config = self.app.config["location"]
|
||||
location_config = self.app.guiconfig["location"]
|
||||
self.location = core_pb2.SessionLocation(
|
||||
x=location_config["x"],
|
||||
y=location_config["y"],
|
||||
|
|
|
@ -179,7 +179,7 @@ class SizeAndScaleDialog(Dialog):
|
|||
location.alt = self.alt.get()
|
||||
location.scale = self.scale.get()
|
||||
if self.save_default.get():
|
||||
location_config = self.app.config["location"]
|
||||
location_config = self.app.guiconfig["location"]
|
||||
location_config["x"] = location.x
|
||||
location_config["y"] = location.y
|
||||
location_config["z"] = location.z
|
||||
|
|
|
@ -180,17 +180,17 @@ class CustomNodesDialog(Dialog):
|
|||
self.services.update(dialog.current_services)
|
||||
|
||||
def click_save(self):
|
||||
self.app.config["nodes"].clear()
|
||||
self.app.guiconfig["nodes"].clear()
|
||||
for name in sorted(self.app.core.custom_nodes):
|
||||
node_draw = self.app.core.custom_nodes[name]
|
||||
self.app.config["nodes"].append(
|
||||
self.app.guiconfig["nodes"].append(
|
||||
{
|
||||
"name": name,
|
||||
"image": node_draw.image_file,
|
||||
"services": list(node_draw.services),
|
||||
}
|
||||
)
|
||||
logging.info("saving custom nodes: %s", self.app.config["nodes"])
|
||||
logging.info("saving custom nodes: %s", self.app.guiconfig["nodes"])
|
||||
self.app.save_config()
|
||||
self.destroy()
|
||||
|
||||
|
|
|
@ -95,7 +95,7 @@ class ObserverDialog(Dialog):
|
|||
for name in sorted(self.app.core.custom_observers):
|
||||
observer = self.app.core.custom_observers[name]
|
||||
observers.append({"name": observer.name, "cmd": observer.cmd})
|
||||
self.app.config["observers"] = observers
|
||||
self.app.guiconfig["observers"] = observers
|
||||
self.app.save_config()
|
||||
self.destroy()
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ from coretk.dialogs.dialog import Dialog
|
|||
class PreferencesDialog(Dialog):
|
||||
def __init__(self, master, app):
|
||||
super().__init__(master, app, "Preferences", modal=True)
|
||||
preferences = self.app.config["preferences"]
|
||||
preferences = self.app.guiconfig["preferences"]
|
||||
self.editor = tk.StringVar(value=preferences["editor"])
|
||||
self.theme = tk.StringVar(value=preferences["theme"])
|
||||
self.terminal = tk.StringVar(value=preferences["terminal"])
|
||||
|
@ -76,7 +76,7 @@ class PreferencesDialog(Dialog):
|
|||
self.app.style.theme_use(theme)
|
||||
|
||||
def click_save(self):
|
||||
preferences = self.app.config["preferences"]
|
||||
preferences = self.app.guiconfig["preferences"]
|
||||
preferences["terminal"] = self.terminal.get()
|
||||
preferences["editor"] = self.editor.get()
|
||||
preferences["gui3d"] = self.gui3d.get()
|
||||
|
|
|
@ -115,7 +115,7 @@ class ServersDialog(Dialog):
|
|||
servers.append(
|
||||
{"name": server.name, "address": server.address, "port": server.port}
|
||||
)
|
||||
self.app.config["servers"] = servers
|
||||
self.app.guiconfig["servers"] = servers
|
||||
self.app.save_config()
|
||||
self.destroy()
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue