mirror of
https://github.com/lutris/lutris
synced 2024-10-14 19:53:53 +00:00
ModalDialogs (with Gtk.Dialog.run()) automatically close, but modeless ones need to call self.destroy() in response to the response signal.
Explicitly destroying a modal dialog makes run() return Gtk.ResponseType.NONE. So, I've moved the self.destroy() call down to ModelessDialog. That should fix it.
This commit is contained in:
parent
2f4e1edcf6
commit
4a4cf31a1b
|
@ -44,10 +44,8 @@ class Dialog(Gtk.Dialog):
|
|||
|
||||
def on_response(self, _dialog, response: Gtk.ResponseType) -> None:
|
||||
"""Handles the dialog response; you can override this but by default
|
||||
this records the response for 'response_type' and destroys the dialog."""
|
||||
this records the response for 'response_type'."""
|
||||
self._response_type = response
|
||||
if response != Gtk.ResponseType.NONE:
|
||||
self.destroy()
|
||||
|
||||
def add_styled_button(self, button_text: str, response_id: Gtk.ResponseType,
|
||||
css_class: str):
|
||||
|
@ -104,6 +102,13 @@ class ModelessDialog(Dialog):
|
|||
self.set_transient_for(None)
|
||||
return False
|
||||
|
||||
def on_response(self, dialog, response: Gtk.ResponseType) -> None:
|
||||
super().on_response(dialog, response)
|
||||
# Modal dialogs self-destruct, but modeless ones must commit
|
||||
# suicide more explicitly.
|
||||
if response != Gtk.ResponseType.NONE:
|
||||
self.destroy()
|
||||
|
||||
|
||||
class SavableModelessDialog(ModelessDialog):
|
||||
"""This is a modeless dialog that has a Cancel and a Save button in the header-bar,
|
||||
|
|
Loading…
Reference in a new issue