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