Fixed state saving issues

This commit is contained in:
Sumner Evans
2020-01-18 15:01:58 -07:00
parent 8c08186833
commit 29e53484ce
4 changed files with 6 additions and 6 deletions

View File

@@ -595,8 +595,8 @@ class SublimeMusicApp(Gtk.Application):
self.state.save_config()
def on_connected_server_changed(self, action, current_server):
self.state.save()
self.state.config.current_server = current_server
self.state.save()
self.state.save_config()
self.reset_state()

View File

@@ -330,7 +330,6 @@ class CacheManager(metaclass=Singleton):
for x in meta_json.get(name, [])
]
elif default == dict:
print('dict', name)
self.cache[name] = {
id: type_name.from_json(x)
for id, x in meta_json.get(name, {}).items()

View File

@@ -92,6 +92,7 @@ class AppConfiguration:
@property
def server(self) -> Optional[ServerConfiguration]:
return (
None if self.current_server < 0 or len(self.servers) < 1 else
self.servers[self.current_server])
if 0 <= self.current_server < len(self.servers):
return self.servers[self.current_server]
return None

View File

@@ -58,7 +58,7 @@ class BrowsePanel(Gtk.Overlay):
def update(self, state: ApplicationState, force=False):
id_stack = []
# TODO make async
if CacheManager.ready:
if CacheManager.ready and state.selected_browse_element_id is not None:
directory = None
current_dir_id = state.selected_browse_element_id
while directory is None or directory.parent is not None: