refactor create image
parent
00bfc9226d
commit
2019aec9ec
19
display.py
19
display.py
|
|
@ -57,20 +57,20 @@ class Window(object):
|
|||
if self.args.fullscreen:
|
||||
log.info("use fullscreen")
|
||||
self.window.fullscreen()
|
||||
self.image = Gtk.Image()
|
||||
self.window.add(self.image)
|
||||
self.image.show()
|
||||
self.window.show()
|
||||
self.updater = Updater(self)
|
||||
GLib.unix_signal_add(GLib.PRIORITY_DEFAULT,
|
||||
signal.SIGINT, self.destroy)
|
||||
|
||||
self.create_image()
|
||||
self.window.show_all()
|
||||
print(dir(self.window))
|
||||
|
||||
def destroy(self, data=None):
|
||||
if self.updater:
|
||||
self.updater.exit.set()
|
||||
Gtk.main_quit()
|
||||
def main(self):
|
||||
self.updater = Updater(self)
|
||||
self.updater.start()
|
||||
if self.updater:
|
||||
self.updater.start()
|
||||
Gtk.main()
|
||||
def on_click(self, widget, data=None):
|
||||
log.info("on_click called")
|
||||
|
|
@ -85,6 +85,11 @@ signal.SIGINT, self.destroy)
|
|||
new_image = self.fetch_image(url)
|
||||
self.image.set_from_pixbuf(new_image)
|
||||
log.info("update finished")
|
||||
def create_image(self):
|
||||
#self.window.remove(self.image)
|
||||
self.image = Gtk.Image()
|
||||
self.window.add(self.image)
|
||||
#self.image.show()
|
||||
def fetch_image(self, url):
|
||||
log.info("start download")
|
||||
response = requests.get(url)
|
||||
|
|
|
|||
Loading…
Reference in New Issue