Compare commits
No commits in common. "798c2ef3650f252b016f5894f7226765874c7901" and "142ebb6bbeede743c9f35636773dfea3a481d8eb" have entirely different histories.
798c2ef365
...
142ebb6bbe
1 changed files with 8 additions and 8 deletions
14
buypeeb.py
14
buypeeb.py
|
@ -131,7 +131,7 @@ class BuypeebApp:
|
||||||
msgbox.destroy()
|
msgbox.destroy()
|
||||||
return response
|
return response
|
||||||
|
|
||||||
def entryBox(self, title, text, allow_cancel = True, prefilled: str = ""):
|
def entryBox(self, title, text, allow_cancel = True):
|
||||||
# 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,7 +144,6 @@ 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)
|
||||||
|
@ -174,7 +173,7 @@ class BuypeebApp:
|
||||||
# print(self.settings.watchlist)
|
# print(self.settings.watchlist)
|
||||||
for id, item in self.settings.watchlist.items():
|
for id, item in self.settings.watchlist.items():
|
||||||
if item.ready:
|
if item.ready:
|
||||||
self.items.append([item.name if item.name is not None else "", item.price_jpy(), item.price_aud(self.rate), "...", id])
|
self.items.append([item.name, item.price_jpy(), item.price_aud(self.rate), "...", id])
|
||||||
else:
|
else:
|
||||||
name = item.name
|
name = item.name
|
||||||
if name == None:
|
if name == None:
|
||||||
|
@ -191,9 +190,9 @@ class BuypeebApp:
|
||||||
treeIter = Gtk.TreeModel.get_iter(self.items, listing.path)
|
treeIter = Gtk.TreeModel.get_iter(self.items, listing.path)
|
||||||
if item_list != None:
|
if item_list != None:
|
||||||
for i in range(0, 4):
|
for i in range(0, 4):
|
||||||
self.items.set(treeIter, i, item_list[i] if item_list[0] is not None else "")
|
self.items.set(treeIter, i, item_list[i])
|
||||||
else:
|
else:
|
||||||
self.items.set(treeIter, 0, item.name if item.name is not None else "")
|
self.items.set(treeIter, 0, item.name)
|
||||||
if item.ready:
|
if item.ready:
|
||||||
self.items.set(treeIter, 1, item.price_jpy())
|
self.items.set(treeIter, 1, item.price_jpy())
|
||||||
self.items.set(treeIter, 2, item.price_aud())
|
self.items.set(treeIter, 2, item.price_aud())
|
||||||
|
@ -278,9 +277,10 @@ 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}\".", True, item.name)
|
name = self.entryBox("Rename", f"Enter a new name for \"{item.name}\".")
|
||||||
if name and item.name != 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