475b1a886645 webui

open the web browser when doing the web thingy.
[view raw] [browse files]
author Dan Villiom Podlaski Christiansen <danchr@gmail.com>
date Sat, 06 Feb 2010 12:38:57 +0100
parents e627607e24d0
children 83f2e11a22be
branches/tags webui
files review/extension_ui.py review/web_ui.py

Changes

--- a/review/extension_ui.py	Sat Feb 06 06:39:15 2010 -0500
+++ b/review/extension_ui.py	Sat Feb 06 12:38:57 2010 +0100
@@ -15,7 +15,7 @@
     ui.note(messages.WEB_START)
     
     import web_ui
-    web_ui.load_interface(ui, repo)
+    web_ui.load_interface(ui, repo, open=True)
 
 def _init_command(ui, repo, **opts):
     ui.note(messages.INIT_START)
--- a/review/web_ui.py	Sat Feb 06 06:39:15 2010 -0500
+++ b/review/web_ui.py	Sat Feb 06 12:38:57 2010 +0100
@@ -113,10 +113,15 @@
             return content
     
 
-def load_interface(ui, repo):
+def load_interface(ui, repo, open=False):
     global _rd
     _rd = api.ReviewDatastore(ui, repo)
     
     sys.argv = sys.argv[:1]    # Seriously, web.py?  This is such a hack.
     app = web.application(urls, globals())
+
+    if open:
+        import webbrowser
+        webbrowser.open(app.browser().url)
+
     app.run()