and the winner of the dunce of the year is

This commit is contained in:
Lynne Megido 2020-08-21 20:59:35 +10:00
parent 2a3700e6fe
commit 765f148805
Signed by: lynnesbian
GPG Key ID: F0A184B5213D9F90
4 changed files with 12 additions and 3 deletions

View File

@ -69,6 +69,9 @@ class BuypeebApp:
self.settings.save()
self.app.quit()
def btnAddClicked(self, widget):
pass
if __name__ == '__main__':
app = BuypeebApp()
app.run(sys.argv)

View File

@ -11,8 +11,12 @@ class YahooAuctionsItem:
def __init__(self, name: str, url: str):
# note - incoming url is not validated in any way!
self.name = name
self.url = re.match(url.rstrip("/"), r"([^?]+)") # remove trailing slashes and query params
self.id = re.match(self.url, r".+\/(.+?)$") # extract "x12345" from "https://buyee.jp/whatever/blah/x12345"
try:
self.url = re.match(r"([^?]+)", url.rstrip("/")).group(1) # remove trailing slashes and query params
except:
# ???
raise
self.id = re.match(r".+\/(.+?)$", self.url) # extract "x12345" from "https://buyee.jp/whatever/blah/x12345"
self.last_checked = datetime.fromisoformat('1970-01-01')
self.available = True
self.update()

View File

@ -32,5 +32,5 @@ class BuypeebSettings:
def set(self, setting: str, value):
self.s['setting'] = value
def watch(self, name: string, url: string):
def watch(self, name: str, url: str):
self.s['watchlist'].add(YahooAuctionsItem(name, url))

View File

@ -146,6 +146,7 @@
<property name="label" translatable="yes">Add new</property>
<property name="use_underline">True</property>
<property name="stock_id">gtk-add</property>
<signal name="clicked" handler="btnAddClicked" swapped="no"/>
<accelerator key="n" signal="clicked" modifiers="GDK_CONTROL_MASK"/>
</object>
<packing>
@ -321,6 +322,7 @@
<object class="GtkToolButton">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="action_name">app.shutdown</property>
<property name="label" translatable="yes">Quit</property>
<property name="use_underline">True</property>
<property name="stock_id">gtk-quit</property>