def _edit_controls(self): edit_config = CONFIG.get(EDIT_CONFIG_ID, {}) keybind_id = edit_config.get("keybind_group", DefaultKeybindGroupId) user_keybinds = edit_config.get("user_keybinds", {}) key_config = KeyConfigDialog(self, keybind_id, KeybindKeys, PresetKeybinds, user_keybinds) if key_config.ShowModal() == wx.ID_OK: user_keybinds, keybind_id, keybinds = key_config.options edit_config["user_keybinds"] = user_keybinds edit_config["keybind_group"] = keybind_id CONFIG.put(EDIT_CONFIG_ID, edit_config) self._canvas.set_key_binds(keybinds)
def rebuild(self, new_world: str = None): meta: dict = CONFIG.get("amulet_meta", {}) recent_worlds: list = meta.setdefault('recent_worlds', []) if new_world is not None: while new_world in recent_worlds: recent_worlds.remove(new_world) recent_worlds.insert(0, new_world) while len(recent_worlds) > 5: recent_worlds.pop(5) if self._world_list is not None: self._world_list.Destroy() self._world_list = WorldList(self, recent_worlds, self._open_world_callback, sort=False) self.add_object(self._world_list, 1, wx.EXPAND) self.Layout() CONFIG.put("amulet_meta", meta)
def write_config(): CONFIG.put("window_preferences", PRE_EXISTING_CONFIG)