prefill name on rename
This commit is contained in:
parent
142ebb6bbe
commit
af70fd779d
1 changed files with 4 additions and 4 deletions
|
@ -131,7 +131,7 @@ class BuypeebApp:
|
||||||
msgbox.destroy()
|
msgbox.destroy()
|
||||||
return response
|
return response
|
||||||
|
|
||||||
def entryBox(self, title, text, allow_cancel = True):
|
def entryBox(self, title, text, allow_cancel = True, prefilled: str = ""):
|
||||||
# thanks to https://ardoris.wordpress.com/2008/07/05/pygtk-text-entry-dialog/
|
# thanks to https://ardoris.wordpress.com/2008/07/05/pygtk-text-entry-dialog/
|
||||||
entrybox = Gtk.MessageDialog(
|
entrybox = Gtk.MessageDialog(
|
||||||
parent = self.window,
|
parent = self.window,
|
||||||
|
@ -144,6 +144,7 @@ class BuypeebApp:
|
||||||
|
|
||||||
entrybox.set_markup(text)
|
entrybox.set_markup(text)
|
||||||
entry = Gtk.Entry()
|
entry = Gtk.Entry()
|
||||||
|
entry.set_text(prefilled)
|
||||||
entry.connect("activate", self.entryBoxResponse, entrybox, Gtk.ResponseType.OK) # allow for pressing enter instead of clicking OK
|
entry.connect("activate", self.entryBoxResponse, entrybox, Gtk.ResponseType.OK) # allow for pressing enter instead of clicking OK
|
||||||
|
|
||||||
entrybox.vbox.pack_end(entry, True, True, 0)
|
entrybox.vbox.pack_end(entry, True, True, 0)
|
||||||
|
@ -277,10 +278,9 @@ class BuypeebApp:
|
||||||
|
|
||||||
def btnSelectedRenameClicked(self, widget):
|
def btnSelectedRenameClicked(self, widget):
|
||||||
item = self.settings.watchlist[self.selected]
|
item = self.settings.watchlist[self.selected]
|
||||||
name = self.entryBox("Rename", f"Enter a new name for \"{item.name}\".")
|
name = self.entryBox("Rename", f"Enter a new name for \"{item.name}\".", True, item.name)
|
||||||
if name:
|
if name:
|
||||||
item.name = name
|
item.name = name
|
||||||
|
|
||||||
self.updateListItem(item.id)
|
self.updateListItem(item.id)
|
||||||
|
|
||||||
def btnSelectedRemoveClicked(self, widget):
|
def btnSelectedRemoveClicked(self, widget):
|
||||||
|
|
Loading…
Reference in a new issue