Fixed: can't close app normally if first time setup fails
This commit is contained in:
parent
adef5b5671
commit
f6cc6ac894
@ -37,6 +37,7 @@ class AlpacaWindow(Adw.ApplicationWindow):
|
|||||||
local_models = []
|
local_models = []
|
||||||
chats = {"chats": {"New Chat": {"messages": []}}, "selected_chat": "New Chat"}
|
chats = {"chats": {"New Chat": {"messages": []}}, "selected_chat": "New Chat"}
|
||||||
attached_image = {"path": None, "base64": None}
|
attached_image = {"path": None, "base64": None}
|
||||||
|
first_time_setup = False
|
||||||
|
|
||||||
#Elements
|
#Elements
|
||||||
shortcut_window : Gtk.ShortcutsWindow = Gtk.Template.Child()
|
shortcut_window : Gtk.ShortcutsWindow = Gtk.Template.Child()
|
||||||
@ -578,12 +579,13 @@ class AlpacaWindow(Adw.ApplicationWindow):
|
|||||||
|
|
||||||
|
|
||||||
def closing_connection_dialog(self, dialog):
|
def closing_connection_dialog(self, dialog):
|
||||||
if self.ollama_url is None: self.destroy()
|
if self.ollama_url is None or self.first_time_setup: self.destroy()
|
||||||
if self.ollama_url == self.connection_url_entry.get_text():
|
if self.ollama_url == self.connection_url_entry.get_text():
|
||||||
self.connection_dialog.force_close()
|
self.connection_dialog.force_close()
|
||||||
if self.ollama_url is None or self.verify_connection() == False:
|
if self.ollama_url is None or self.verify_connection() == False:
|
||||||
self.show_connection_dialog(True)
|
self.show_connection_dialog(True)
|
||||||
self.show_toast("error", 1, self.connection_overlay)
|
self.show_toast("error", 1, self.connection_overlay)
|
||||||
|
else: self.first_time_setup = False
|
||||||
return
|
return
|
||||||
dialog = Adw.AlertDialog(
|
dialog = Adw.AlertDialog(
|
||||||
heading=f"Save Changes?",
|
heading=f"Save Changes?",
|
||||||
@ -812,5 +814,7 @@ class AlpacaWindow(Adw.ApplicationWindow):
|
|||||||
with open(os.path.join(self.config_dir, "server.conf"), "r") as f:
|
with open(os.path.join(self.config_dir, "server.conf"), "r") as f:
|
||||||
self.ollama_url = f.read()
|
self.ollama_url = f.read()
|
||||||
if self.verify_connection() is False: self.show_connection_dialog(True)
|
if self.verify_connection() is False: self.show_connection_dialog(True)
|
||||||
else: self.connection_dialog.present(self)
|
else:
|
||||||
|
self.first_time_setup = True
|
||||||
|
self.connection_dialog.present(self)
|
||||||
self.update_chat_list()
|
self.update_chat_list()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user