Switched back to using main thread for switcher

This commit is contained in:
jeffser 2024-10-11 15:53:51 -06:00
parent e553215bf1
commit e42eec3e31

View File

@ -816,24 +816,20 @@ Generate a title following these rules:
def remote_switched(self, switch, state): def remote_switched(self, switch, state):
def local_instance_process(): def local_instance_process():
GLib.idle_add(switch.set_sensitive, False) sensitive_elements = [switch, self.tweaks_group, self.instance_page, self.send_button, self.attachment_button]
GLib.idle_add(self.tweaks_group.set_sensitive, False)
GLib.idle_add(self.instance_page.set_sensitive, False) [element.set_sensitive(False) for element in sensitive_elements]
GLib.idle_add(self.send_button.set_sensitive, False) self.get_application().lookup_action('manage_models').set_enabled, False)
GLib.idle_add(self.attachment_button.set_sensitive, False) self.title_stack.set_visible_child_name, 'loading')
GLib.idle_add(self.get_application().lookup_action('manage_models').set_enabled, False)
GLib.idle_add(self.title_stack.set_visible_child_name, 'loading')
self.ollama_instance.remote = False self.ollama_instance.remote = False
self.ollama_instance.start() self.ollama_instance.start()
self.model_manager.update_local_list() self.model_manager.update_local_list()
self.save_server_config() self.save_server_config()
GLib.idle_add(switch.set_sensitive, True)
GLib.idle_add(self.tweaks_group.set_sensitive, True) [element.set_sensitive(True) for element in sensitive_elements]
GLib.idle_add(self.instance_page.set_sensitive, True) self.get_application().lookup_action('manage_models').set_enabled, True)
GLib.idle_add(self.send_button.set_sensitive, True) self.title_stack.set_visible_child_name, 'model_selector')
GLib.idle_add(self.attachment_button.set_sensitive, True)
GLib.idle_add(self.get_application().lookup_action('manage_models').set_enabled, True)
GLib.idle_add(self.title_stack.set_visible_child_name, 'model_selector')
if state: if state:
options = { options = {