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:
|
if self.update_all:
|
||||||
for id, item in self.app.settings.watchlist.items():
|
for id, item in self.app.settings.watchlist.items():
|
||||||
if not (item.ready or item.updating):
|
if not (item.ready or item.updating):
|
||||||
|
item.ready = False
|
||||||
|
self.app.updateListItem(id)
|
||||||
future = pool.schedule(item.update)
|
future = pool.schedule(item.update)
|
||||||
future.add_done_callback(watchlist_update_done)
|
future.add_done_callback(watchlist_update_done)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
for item in self.app.settings.outdated_items():
|
for item in self.app.settings.outdated_items():
|
||||||
if not(item.ready or item.updating):
|
if not(item.ready or item.updating):
|
||||||
|
item.ready = False
|
||||||
|
self.app.updateListItem(item.id)
|
||||||
future = pool.schedule(item.update)
|
future = pool.schedule(item.update)
|
||||||
future.add_done_callback(watchlist_update_done)
|
future.add_done_callback(watchlist_update_done)
|
||||||
|
|
||||||
|
@ -189,8 +193,12 @@ class BuypeebApp:
|
||||||
self.items.set(treeIter, i, item_list[i])
|
self.items.set(treeIter, i, item_list[i])
|
||||||
else:
|
else:
|
||||||
self.items.set(treeIter, 0, item.name)
|
self.items.set(treeIter, 0, item.name)
|
||||||
|
if item.ready:
|
||||||
self.items.set(treeIter, 1, item.price_aud())
|
self.items.set(treeIter, 1, item.price_aud())
|
||||||
self.items.set(treeIter, 2, item.ending_at())
|
self.items.set(treeIter, 2, item.ending_at())
|
||||||
|
else:
|
||||||
|
self.items.set(treeIter, 1, "...")
|
||||||
|
self.items.set(treeIter, 2, "...")
|
||||||
|
|
||||||
|
|
||||||
def updateListTimes(self):
|
def updateListTimes(self):
|
||||||
|
@ -232,6 +240,9 @@ class BuypeebApp:
|
||||||
self.renderList()
|
self.renderList()
|
||||||
self.updateItems()
|
self.updateItems()
|
||||||
|
|
||||||
|
def btnUpdateAllClicked(self, widget):
|
||||||
|
self.updateItems(True)
|
||||||
|
|
||||||
def btnSaveClicked(self, widget):
|
def btnSaveClicked(self, widget):
|
||||||
self.settings.save()
|
self.settings.save()
|
||||||
|
|
||||||
|
|
|
@ -61,13 +61,14 @@
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkToolButton">
|
<object class="GtkToolButton" id="btnUpdateAll">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can_focus">False</property>
|
<property name="can_focus">False</property>
|
||||||
<property name="tooltip_text" translatable="yes">Update all</property>
|
<property name="tooltip_text" translatable="yes">Update all</property>
|
||||||
<property name="label" translatable="yes">Update all</property>
|
<property name="label" translatable="yes">Update all</property>
|
||||||
<property name="use_underline">True</property>
|
<property name="use_underline">True</property>
|
||||||
<property name="stock_id">gtk-refresh</property>
|
<property name="stock_id">gtk-refresh</property>
|
||||||
|
<signal name="clicked" handler="btnUpdateAllClicked" swapped="no"/>
|
||||||
<accelerator key="r" signal="clicked" modifiers="GDK_CONTROL_MASK"/>
|
<accelerator key="r" signal="clicked" modifiers="GDK_CONTROL_MASK"/>
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
|
|
Loading…
Reference in a new issue