don't redraw the whole list after a rename
This commit is contained in:
parent
6c5a93b0d8
commit
1fd1fb21d0
2 changed files with 25 additions and 13 deletions
28
buypeeb.py
28
buypeeb.py
|
@ -167,18 +167,20 @@ class BuypeebApp:
|
|||
|
||||
self.updateListTimes()
|
||||
|
||||
def updateListTimes(self):
|
||||
now = datetime.now()
|
||||
ndate = now.strftime("%d %b")
|
||||
for listing in self.items:
|
||||
id = listing[3]
|
||||
def updateListItem(self, id: str):
|
||||
item = self.settings.watchlist[id]
|
||||
if item.end_date != None:
|
||||
idate, itime = item.end_date.strftime("%d %b"), item.end_date.strftime("%H:%M")
|
||||
if idate == ndate:
|
||||
listing[2] = itime
|
||||
else:
|
||||
listing[2] = f"{idate} {itime}"
|
||||
for listing in self.items:
|
||||
if listing[3] == id:
|
||||
treeIter = Gtk.TreeModel.get_iter(self.items, listing.path)
|
||||
self.items.set(treeIter, 0, item.name)
|
||||
self.items.set(treeIter, 1, item.price_aud())
|
||||
self.items.set(treeIter, 2, item.ending_at())
|
||||
|
||||
|
||||
def updateListTimes(self):
|
||||
for listing in self.items:
|
||||
item = self.settings.watchlist[listing[3]]
|
||||
listing[2] = item.ending_at()
|
||||
|
||||
def updateSidePane(self, id: str):
|
||||
item = self.settings.watchlist[id]
|
||||
|
@ -188,7 +190,7 @@ class BuypeebApp:
|
|||
"Price": item.price_jpy(),
|
||||
"PriceAUD": item.price_aud(),
|
||||
"Ending": item.ending_in(),
|
||||
"Bids": item.bids
|
||||
"Bids": str(item.bids)
|
||||
}
|
||||
|
||||
for label, contents in info.items():
|
||||
|
@ -251,7 +253,7 @@ class BuypeebApp:
|
|||
if name:
|
||||
item.name = name
|
||||
|
||||
self.renderList() # TODO: only update the changed item
|
||||
self.updateListItem(item.id)
|
||||
|
||||
def btnSelectedRemoveClicked(self, widget):
|
||||
del self.settings.watchlist[self.selected]
|
||||
|
|
10
listing.py
10
listing.py
|
@ -114,3 +114,13 @@ class YahooAuctionsItem:
|
|||
|
||||
def ending_in(self):
|
||||
return "heenlo"
|
||||
|
||||
def ending_at(self):
|
||||
now = datetime.now()
|
||||
ndate = now.strftime("%d %b")
|
||||
if self.end_date != None:
|
||||
idate, itime = self.end_date.strftime("%d %b"), self.end_date.strftime("%H:%M")
|
||||
if idate == ndate:
|
||||
return itime
|
||||
else:
|
||||
return f"{idate} {itime}"
|
||||
|
|
Loading…
Reference in a new issue