Permalink
Browse files

refactor the load and callback out of main

  • Loading branch information...
1 parent e5600eb commit 31ff0a0c7d86fa1b30dd14d5870c01435766f569 @marianoguerra committed Jul 20, 2011
Showing with 7 additions and 3 deletions.
  1. +7 −3 webless.py
View
10 webless.py
@@ -102,15 +102,19 @@ def process_events():
while gtk.events_pending():
gtk.main_iteration(True)
-if __name__ == '__main__':
- browser = Browser('www.google.com/search?q=emesene')
+def load(url, on_load_finished):
+ browser = Browser(url)
def inject_fun(view, frame):
browser.inject_file('js/jquery.js')
browser.inject_file('js/json2.js')
- browser.view.connect('load-finished', inject_fun)
+ if on_load_finished is not None:
+ on_load_finished(browser, frame)
+ browser.view.connect('load-finished', inject_fun)
browser.show()
+if __name__ == '__main__':
+ load('www.google.com/search?q=emesene', None)
gtk.main()

0 comments on commit 31ff0a0

Please sign in to comment.