implement update button with a sneaqy hack to get the ...s to display properly
This commit is contained in:
parent
4f8a0a7dbc
commit
ec559a344a
2 changed files with 15 additions and 3 deletions
11
buypeeb.py
11
buypeeb.py
|
@ -61,12 +61,16 @@ class WatchlistUpdater(Thread):
|
|||
if self.update_all:
|
||||
for id, item in self.app.settings.watchlist.items():
|
||||
if not (item.ready or item.updating):
|
||||
item.ready = False
|
||||
self.app.updateListItem(id)
|
||||
future = pool.schedule(item.update)
|
||||
future.add_done_callback(watchlist_update_done)
|
||||
|
||||
else:
|
||||
for item in self.app.settings.outdated_items():
|
||||
if not(item.ready or item.updating):
|
||||
item.ready = False
|
||||
self.app.updateListItem(item.id)
|
||||
future = pool.schedule(item.update)
|
||||
future.add_done_callback(watchlist_update_done)
|
||||
|
||||
|
@ -189,8 +193,12 @@ class BuypeebApp:
|
|||
self.items.set(treeIter, i, item_list[i])
|
||||
else:
|
||||
self.items.set(treeIter, 0, item.name)
|
||||
if item.ready:
|
||||
self.items.set(treeIter, 1, item.price_aud())
|
||||
self.items.set(treeIter, 2, item.ending_at())
|
||||
else:
|
||||
self.items.set(treeIter, 1, "...")
|
||||
self.items.set(treeIter, 2, "...")
|
||||
|
||||
|
||||
def updateListTimes(self):
|
||||
|
@ -232,6 +240,9 @@ class BuypeebApp:
|
|||
self.renderList()
|
||||
self.updateItems()
|
||||
|
||||
def btnUpdateAllClicked(self, widget):
|
||||
self.updateItems(True)
|
||||
|
||||
def btnSaveClicked(self, widget):
|
||||
self.settings.save()
|
||||
|
||||
|
|
|
@ -61,13 +61,14 @@
|
|||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkToolButton">
|
||||
<object class="GtkToolButton" id="btnUpdateAll">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="tooltip_text" translatable="yes">Update all</property>
|
||||
<property name="label" translatable="yes">Update all</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="stock_id">gtk-refresh</property>
|
||||
<signal name="clicked" handler="btnUpdateAllClicked" swapped="no"/>
|
||||
<accelerator key="r" signal="clicked" modifiers="GDK_CONTROL_MASK"/>
|
||||
</object>
|
||||
<packing>
|
||||
|
|
Loading…
Reference in a new issue