Fixed 'cannot close app on first setup'

This commit is contained in:
jeffser 2024-05-16 09:50:35 -06:00
parent 76486da3d4
commit d1fbdad486
2 changed files with 16 additions and 19 deletions

View File

@ -64,8 +64,7 @@
"sources" : [ "sources" : [
{ {
"type" : "git", "type" : "git",
"url" : "https://github.com/Jeffser/Alpaca.git", "url" : "file:///home/tentri/Documents/Alpaca"
"tag": "0.2.2"
} }
] ]
} }

View File

@ -361,6 +361,7 @@ class AlpacaWindow(Adw.ApplicationWindow):
if result == "cancel": return if result == "cancel": return
if result == "save": if result == "save":
self.ollama_url = self.connection_url_entry.get_text() self.ollama_url = self.connection_url_entry.get_text()
elif result == "discard" and self.ollama_url is None: self.destroy()
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)
@ -368,23 +369,20 @@ class AlpacaWindow(Adw.ApplicationWindow):
def closing_connection_dialog(self, dialog): def closing_connection_dialog(self, dialog):
if self.get_visible() == False: dialog = Adw.AlertDialog(
self.destroy() heading=f"Save Changes?",
else: body=f"Do you want to save the URL change?",
dialog = Adw.AlertDialog( close_response="cancel"
heading=f"Save Changes?", )
body=f"Do you want to save the URL change?", dialog.add_response("cancel", "Cancel")
close_response="cancel" dialog.add_response("discard", "Discard")
) dialog.add_response("save", "Save")
dialog.add_response("cancel", "Cancel") dialog.set_response_appearance("discard", Adw.ResponseAppearance.DESTRUCTIVE)
dialog.add_response("discard", "Discard") dialog.set_response_appearance("save", Adw.ResponseAppearance.SUGGESTED)
dialog.add_response("save", "Save") dialog.choose(
dialog.set_response_appearance("discard", Adw.ResponseAppearance.DESTRUCTIVE) parent = self,
dialog.set_response_appearance("save", Adw.ResponseAppearance.SUGGESTED) cancellable = None,
dialog.choose( callback = self.closing_connection_dialog_response
parent = self,
cancellable = None,
callback = self.closing_connection_dialog_response
) )
def __init__(self, **kwargs): def __init__(self, **kwargs):