Improve NewConfirmationDialog
- Add setting for modal/non-modal - Add default transient - Dont call run() it only returns after response
This commit is contained in:
parent
ca037665ca
commit
bbada2ecd4
|
@ -990,12 +990,16 @@ class ChangePasswordDialog(Gtk.Dialog):
|
|||
|
||||
|
||||
class NewConfirmationDialog(Gtk.MessageDialog):
|
||||
def __init__(self, title, text, sec_text, buttons, transient_for=None):
|
||||
def __init__(self, title, text, sec_text, buttons,
|
||||
modal=True, transient_for=None):
|
||||
if transient_for is None:
|
||||
transient_for = app.app.get_active_window()
|
||||
Gtk.MessageDialog.__init__(self,
|
||||
title=title,
|
||||
text=text,
|
||||
transient_for=transient_for,
|
||||
message_type=Gtk.MessageType.QUESTION)
|
||||
message_type=Gtk.MessageType.QUESTION,
|
||||
modal=modal)
|
||||
|
||||
self._buttons = {}
|
||||
|
||||
|
@ -1012,8 +1016,6 @@ class NewConfirmationDialog(Gtk.MessageDialog):
|
|||
|
||||
self.connect('response', self._on_response)
|
||||
|
||||
self.run()
|
||||
|
||||
def _on_response(self, _dialog, response):
|
||||
if response == Gtk.ResponseType.DELETE_EVENT:
|
||||
# Look if DELETE_EVENT is mapped to another response
|
||||
|
@ -1031,6 +1033,9 @@ class NewConfirmationDialog(Gtk.MessageDialog):
|
|||
button.callback(*button.args, **button.kwargs)
|
||||
self.destroy()
|
||||
|
||||
def show(self):
|
||||
self.show_all()
|
||||
|
||||
|
||||
class ShortcutsWindow:
|
||||
def __init__(self):
|
||||
|
|
Loading…
Reference in New Issue