SHOW:
|
|
- or go back to the newest paste.
| 1 | #!/usr/bin/env python2 | |
| 2 | # -*- coding: utf-8 -*- | |
| 3 | ||
| 4 | # Autor: Felix Molero | |
| 5 | # Nick: Virus69 | |
| 6 | # Email: [email protected] | |
| 7 | # Proyecto: Navegador Web | |
| 8 | # Licencia GPL v2.0 | |
| 9 | ||
| 10 | import gtk | |
| 11 | import webkit | |
| 12 | ||
| 13 | def go_but(widget): | |
| 14 | add = addressbar.get_text() | |
| 15 | if add.startswith("http://"):
| |
| 16 | web.open(add) | |
| 17 | else: | |
| 18 | add = "http://" + add | |
| 19 | addressbar.set_text(add) | |
| 20 | web.open(add) | |
| 21 | ||
| 22 | def new_title(view, frame, title): | |
| 23 | win.set_title(title) # Cambia el titulo del borde | |
| 24 | ||
| 25 | def on_click_link(view, frame): | |
| 26 | uri=frame.get_uri() | |
| 27 | addressbar.set_text(uri) | |
| 28 | ||
| 29 | #def back_but(widget): | |
| 30 | #def next_but(widget): | |
| 31 | ||
| 32 | win = gtk.Window() | |
| 33 | win.set_default_size(1024, 768) | |
| 34 | win.connect('destroy', lambda w: gtk.main_quit())
| |
| 35 | ||
| 36 | box1 = gtk.VBox() | |
| 37 | win.add(box1) | |
| 38 | ||
| 39 | box2 = gtk.HBox() | |
| 40 | box1.pack_start(box2, False) | |
| 41 | ||
| 42 | addressbar = gtk.Entry() | |
| 43 | addressbar.connect("activate", go_but)
| |
| 44 | box2.pack_start(addressbar) | |
| 45 | ||
| 46 | backbutton = gtk.Button("<") # Boton para regresa a la página anterior
| |
| 47 | box2.pack_start(backbutton, False) | |
| 48 | # backbutton.connect("clicked", back_but)
| |
| 49 | ||
| 50 | nextbutton = gtk.Button(">") # Boton para ir a la suiguiente página
| |
| 51 | box2.pack_start(nextbutton, False) | |
| 52 | # nextbutton.connect("clicked", next_but)
| |
| 53 | ||
| 54 | gobutton = gtk.Button("GO") # Boton de buscar
| |
| 55 | box2.pack_start(gobutton, False) # Reduce el tamaño del boton "GO" | |
| 56 | gobutton.connect("clicked", go_but)
| |
| 57 | ||
| 58 | scroller = gtk.ScrolledWindow() | |
| 59 | box1.pack_start(scroller) | |
| 60 | ||
| 61 | web = webkit.WebView() | |
| 62 | web.open("http://www.google.com") # fijar la url del sitio de preferencia
| |
| 63 | web.connect("title-changed", new_title)
| |
| 64 | web.connect("load-committed", on_click_link)
| |
| 65 | scroller.add(web) | |
| 66 | ||
| 67 | win.show_all() | |
| 68 | gtk.main() |