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.settings.save()
self.app.quit() self.app.quit()
def btnAddClicked(self, widget):
pass
if __name__ == '__main__': if __name__ == '__main__':
app = BuypeebApp() app = BuypeebApp()
app.run(sys.argv) app.run(sys.argv)

View file

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

View file

@ -32,5 +32,5 @@ class BuypeebSettings:
def set(self, setting: str, value): def set(self, setting: str, value):
self.s['setting'] = 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)) self.s['watchlist'].add(YahooAuctionsItem(name, url))

View file

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