do a better job of not inserting null where gtk expects a string

This commit is contained in:
Lynne Megido 2020-08-24 00:19:50 +10:00
parent af70fd779d
commit 798c2ef365
Signed by: lynnesbian
GPG key ID: F0A184B5213D9F90

View file

@ -174,7 +174,7 @@ class BuypeebApp:
# print(self.settings.watchlist)
for id, item in self.settings.watchlist.items():
if item.ready:
self.items.append([item.name, item.price_jpy(), item.price_aud(self.rate), "...", id])
self.items.append([item.name if item.name is not None else "", item.price_jpy(), item.price_aud(self.rate), "...", id])
else:
name = item.name
if name == None:
@ -191,9 +191,9 @@ class BuypeebApp:
treeIter = Gtk.TreeModel.get_iter(self.items, listing.path)
if item_list != None:
for i in range(0, 4):
self.items.set(treeIter, i, item_list[i])
self.items.set(treeIter, i, item_list[i] if item_list[0] is not None else "")
else:
self.items.set(treeIter, 0, item.name)
self.items.set(treeIter, 0, item.name if item.name is not None else "")
if item.ready:
self.items.set(treeIter, 1, item.price_jpy())
self.items.set(treeIter, 2, item.price_aud())
@ -279,7 +279,7 @@ class BuypeebApp:
def btnSelectedRenameClicked(self, widget):
item = self.settings.watchlist[self.selected]
name = self.entryBox("Rename", f"Enter a new name for \"{item.name}\".", True, item.name)
if name:
if name and item.name != name:
item.name = name
self.updateListItem(item.id)