added Yen column, minor glade issues
This commit is contained in:
parent
ec559a344a
commit
142ebb6bbe
3 changed files with 34 additions and 16 deletions
20
buypeeb.py
20
buypeeb.py
|
@ -173,38 +173,40 @@ class BuypeebApp:
|
|||
# print(self.settings.watchlist)
|
||||
for id, item in self.settings.watchlist.items():
|
||||
if item.ready:
|
||||
self.items.append([item.name, item.price_aud(self.rate), "...", id])
|
||||
self.items.append([item.name, item.price_jpy(), item.price_aud(self.rate), "...", id])
|
||||
else:
|
||||
name = item.name
|
||||
if name == None:
|
||||
name = "Loading..."
|
||||
self.items.append([name, "...", "...", id])
|
||||
self.items.append([name, "...", "...", "...", id])
|
||||
|
||||
self.updateListTimes()
|
||||
|
||||
def updateListItem(self, id: str, item_list = None):
|
||||
item = self.settings.watchlist[id]
|
||||
for listing in self.items:
|
||||
if listing[3] == id:
|
||||
if listing[4] == id:
|
||||
# print(f"Updating {id} ({item.name}, {item.price_aud()}, {item.ready})")
|
||||
treeIter = Gtk.TreeModel.get_iter(self.items, listing.path)
|
||||
if item_list != None:
|
||||
for i in range(0, 3):
|
||||
for i in range(0, 4):
|
||||
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())
|
||||
self.items.set(treeIter, 1, item.price_jpy())
|
||||
self.items.set(treeIter, 2, item.price_aud())
|
||||
self.items.set(treeIter, 3, item.ending_at())
|
||||
else:
|
||||
self.items.set(treeIter, 1, "...")
|
||||
self.items.set(treeIter, 2, "...")
|
||||
self.items.set(treeIter, 3, "...")
|
||||
|
||||
|
||||
def updateListTimes(self):
|
||||
for listing in self.items:
|
||||
item = self.settings.watchlist[listing[3]]
|
||||
listing[2] = item.ending_at()
|
||||
item = self.settings.watchlist[listing[4]]
|
||||
listing[3] = item.ending_at()
|
||||
|
||||
def updateSidePane(self, id: str):
|
||||
item = self.settings.watchlist[id]
|
||||
|
@ -303,7 +305,7 @@ class BuypeebApp:
|
|||
if treeIter == None:
|
||||
return
|
||||
row = items[treeIter]
|
||||
id = row[3]
|
||||
id = row[4]
|
||||
self.selected = id
|
||||
self.updateSidePane(id)
|
||||
|
||||
|
|
|
@ -106,7 +106,7 @@ class YahooAuctionsItem:
|
|||
self.ready = True
|
||||
self.updating = False
|
||||
|
||||
return self.id, [self.name, self.price_aud(), self.ending_at()]
|
||||
return self.id, [self.name, self.price_jpy(), self.price_aud(), self.ending_at()]
|
||||
|
||||
def price_jpy(self):
|
||||
return f"¥{self.price:.0f}"
|
||||
|
|
|
@ -6,7 +6,9 @@
|
|||
<columns>
|
||||
<!-- column-name Name -->
|
||||
<column type="gchararray"/>
|
||||
<!-- column-name Price -->
|
||||
<!-- column-name Price (¥) -->
|
||||
<column type="gchararray"/>
|
||||
<!-- column-name Price (AUD) -->
|
||||
<column type="gchararray"/>
|
||||
<!-- column-name Ending -->
|
||||
<column type="gchararray"/>
|
||||
|
@ -16,9 +18,10 @@
|
|||
<data>
|
||||
<row>
|
||||
<col id="0" translatable="yes">The Stinchinator</col>
|
||||
<col id="1" translatable="yes">$5.99</col>
|
||||
<col id="2" translatable="yes">7 hours</col>
|
||||
<col id="3" translatable="yes">12345</col>
|
||||
<col id="1" translatable="yes"/>
|
||||
<col id="2" translatable="yes">$5.99</col>
|
||||
<col id="3" translatable="yes">7 hours</col>
|
||||
<col id="4" translatable="yes">12345</col>
|
||||
</row>
|
||||
</data>
|
||||
</object>
|
||||
|
@ -315,7 +318,7 @@
|
|||
<child>
|
||||
<object class="GtkTreeViewColumn">
|
||||
<property name="resizable">True</property>
|
||||
<property name="title" translatable="yes">Price</property>
|
||||
<property name="title" translatable="yes">Price (¥)</property>
|
||||
<child>
|
||||
<object class="GtkCellRendererText"/>
|
||||
<attributes>
|
||||
|
@ -327,7 +330,7 @@
|
|||
<child>
|
||||
<object class="GtkTreeViewColumn">
|
||||
<property name="resizable">True</property>
|
||||
<property name="title" translatable="yes">Ending at</property>
|
||||
<property name="title" translatable="yes">Price (AUD)</property>
|
||||
<child>
|
||||
<object class="GtkCellRendererText"/>
|
||||
<attributes>
|
||||
|
@ -336,6 +339,19 @@
|
|||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkTreeViewColumn">
|
||||
<property name="resizable">True</property>
|
||||
<property name="title" translatable="yes">Ending at</property>
|
||||
<property name="clickable">True</property>
|
||||
<child>
|
||||
<object class="GtkCellRendererText"/>
|
||||
<attributes>
|
||||
<attribute name="text">3</attribute>
|
||||
</attributes>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
|
|
Loading…
Reference in a new issue