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.
James Cameron
6 years ago
109 | 109 | self._buttons_box = Gtk.HButtonBox() |
110 | 110 | self._buttons_box.set_layout(Gtk.ButtonBoxStyle.END) |
111 | 111 | self._buttons_box.set_spacing(style.DEFAULT_SPACING) |
112 | self._hbox.pack_start(self._buttons_box, True, True, 0) | |
112 | self._hbox.pack_end(self._buttons_box, True, True, 0) | |
113 | 113 | |
114 | 114 | GObject.GObject.__init__(self, **kwargs) |
115 | 115 | |
156 | 156 | elif pspec.name == 'msg': |
157 | 157 | return self._msg |
158 | 158 | |
159 | def add_entry(self): | |
160 | """ | |
161 | Add an entry, after the title and before the buttons. | |
162 | ||
163 | Returns: | |
164 | Gtk.Entry: the entry added to the alert | |
165 | """ | |
166 | entry = Gtk.Entry() | |
167 | self._hbox.pack_start(entry, True, True, 0) | |
168 | entry.show() | |
169 | ||
170 | self._hbox.set_child_packing(self._buttons_box, False, False, 0, | |
171 | Gtk.PackType.END) | |
172 | ||
173 | return entry | |
174 | ||
159 | 175 | def add_button(self, response_id, label, icon=None, position=-1): |
160 | 176 | """ |
161 | 177 | Add a button to the alert |