load URL when opening application

This commit is contained in:
Josh Holtrop 2016-06-24 16:33:32 -04:00
parent f7a0af8cd1
commit c745ecf372

View File

@ -22,10 +22,10 @@ class MainWindow(Gtk.Window):
top_hbox = Gtk.Box() top_hbox = Gtk.Box()
self.address_entry = Gtk.Entry(text = url) self.address_entry = Gtk.Entry(text = url)
self.address_entry.connect("activate", self.on_go_button_clicked) self.address_entry.connect("activate", self.on_go_button_clicked)
go_button = Gtk.Button(label = "Go") self.go_button = Gtk.Button(label = "Go")
go_button.connect("clicked", self.on_go_button_clicked) self.go_button.connect("clicked", self.on_go_button_clicked)
top_hbox.pack_start(self.address_entry, True, True, 0) top_hbox.pack_start(self.address_entry, True, True, 0)
top_hbox.pack_start(go_button, False, True, 0) top_hbox.pack_start(self.go_button, False, True, 0)
vbox = Gtk.Box(orientation = Gtk.Orientation.VERTICAL) vbox = Gtk.Box(orientation = Gtk.Orientation.VERTICAL)
vbox.pack_start(top_hbox, False, True, 0) vbox.pack_start(top_hbox, False, True, 0)
@ -47,6 +47,8 @@ class MainWindow(Gtk.Window):
self.cache_file["y"] is not None): self.cache_file["y"] is not None):
self.move(self.cache_file["x"], self.cache_file["y"]) self.move(self.cache_file["x"], self.cache_file["y"])
self.__go(url)
def run(self): def run(self):
Gtk.main() Gtk.main()
@ -110,3 +112,7 @@ class MainWindow(Gtk.Window):
self.directory_buttons.append(btn) self.directory_buttons.append(btn)
self.directory_vbox.show_all() self.directory_vbox.show_all()
# TODO: finish # TODO: finish
def __go(self, url):
self.address_entry.set_text(url)
self.go_button.activate()