Save As - add an optional Gtk.Entry to Alert
An Alert may have a Gtk.Entry, which is placed between the title and the buttons. It is for when text is to be input during the alert.
This commit is contained in:
parent
926a262306
commit
83697d21f9
@ -110,7 +110,7 @@ class Alert(Gtk.EventBox):
|
||||
self._buttons_box = Gtk.HButtonBox()
|
||||
self._buttons_box.set_layout(Gtk.ButtonBoxStyle.END)
|
||||
self._buttons_box.set_spacing(style.DEFAULT_SPACING)
|
||||
self._hbox.pack_start(self._buttons_box, True, True, 0)
|
||||
self._hbox.pack_end(self._buttons_box, True, True, 0)
|
||||
|
||||
GObject.GObject.__init__(self, **kwargs)
|
||||
|
||||
@ -157,6 +157,22 @@ class Alert(Gtk.EventBox):
|
||||
elif pspec.name == 'msg':
|
||||
return self._msg
|
||||
|
||||
def add_entry(self):
|
||||
"""
|
||||
Add an entry, after the title and before the buttons.
|
||||
|
||||
Returns:
|
||||
Gtk.Entry: the entry added to the alert
|
||||
"""
|
||||
entry = Gtk.Entry()
|
||||
self._hbox.pack_start(entry, True, True, 0)
|
||||
entry.show()
|
||||
|
||||
self._hbox.set_child_packing(self._buttons_box, False, False, 0,
|
||||
Gtk.PackType.END)
|
||||
|
||||
return entry
|
||||
|
||||
def add_button(self, response_id, label, icon=None, position=-1):
|
||||
"""
|
||||
Add a button to the alert
|
||||
|
Loading…
Reference in New Issue
Block a user