Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

refactor the load and callback out of main

  • Loading branch information...
commit 31ff0a0c7d86fa1b30dd14d5870c01435766f569 1 parent e5600eb
Mariano Guerra authored July 20, 2011

Showing 1 changed file with 7 additions and 3 deletions. Show diff stats Hide diff stats

  1. 10  webless.py
10  webless.py
@@ -102,15 +102,19 @@ def process_events():
102 102
     while gtk.events_pending():
103 103
         gtk.main_iteration(True)
104 104
 
105  
-if __name__ == '__main__':
106  
-    browser = Browser('www.google.com/search?q=emesene')
  105
+def load(url, on_load_finished):
  106
+    browser = Browser(url)
107 107
 
108 108
     def inject_fun(view, frame):
109 109
         browser.inject_file('js/jquery.js')
110 110
         browser.inject_file('js/json2.js')
111 111
 
112  
-    browser.view.connect('load-finished', inject_fun)
  112
+        if on_load_finished is not None:
  113
+            on_load_finished(browser, frame)
113 114
 
  115
+    browser.view.connect('load-finished', inject_fun)
114 116
     browser.show()
115 117
 
  118
+if __name__ == '__main__':
  119
+    load('www.google.com/search?q=emesene', None)
116 120
     gtk.main()

0 notes on commit 31ff0a0

Please sign in to comment.
Something went wrong with that request. Please try again.