diff options
author | Daniel Narvaez <dwnarvaez@gmail.com> | 2013-02-06 16:39:54 (GMT) |
---|---|---|
committer | Daniel Narvaez <dwnarvaez@gmail.com> | 2013-02-06 16:39:54 (GMT) |
commit | a8482926512b75af6702f4cfc7f335a27ef93a8e (patch) | |
tree | 9fb72bcc6b30273ea9143d3618df85921cdac8c6 | |
parent | c72116c41e731bab6654f438472c9bade9f81089 (diff) |
Setup and start b2g
-rw-r--r-- | src/jarabe/Makefile.am | 3 | ||||
-rw-r--r-- | src/jarabe/b2g.py | 25 | ||||
-rwxr-xr-x | src/jarabe/main.py | 5 |
3 files changed, 32 insertions, 1 deletions
diff --git a/src/jarabe/Makefile.am b/src/jarabe/Makefile.am index d926d9f..3940a45 100644 --- a/src/jarabe/Makefile.am +++ b/src/jarabe/Makefile.am @@ -11,7 +11,8 @@ SUBDIRS = \ sugardir = $(pythondir)/jarabe sugar_PYTHON = \ __init__.py \ - main.py + main.py \ + b2g.py nodist_sugar_PYTHON = config.py diff --git a/src/jarabe/b2g.py b/src/jarabe/b2g.py new file mode 100644 index 0000000..d6d99af --- /dev/null +++ b/src/jarabe/b2g.py @@ -0,0 +1,25 @@ +import subprocess +import shutil + +from sugar3 import env + +_b2g_process = None + +def _ensure_profile(): + b2g_profile_path = os.path.join(env.get_profile_path(), "b2g") + sugar_html_path = os.environ["SUGAR_HTML_PATH"] + + if not os.path.exists(b2g_profile_path): + shutil.copytree(sugar_html_path, b2g_profile_path) + +def start(): + _ensure_profile() + + b2g_bin = os.path.join(os.environ["B2G_PATH"], "b2g") + + global _b2g_process + _b2g_process = subprocess.Popen([b2g_bin]) + +def stop(): + global _b2g_process + _b2g_process.terminate() diff --git a/src/jarabe/main.py b/src/jarabe/main.py index 44880ba..168d531 100755 --- a/src/jarabe/main.py +++ b/src/jarabe/main.py @@ -67,6 +67,7 @@ from jarabe import intro from jarabe.intro.window import IntroWindow from jarabe import frame from jarabe.view.service import UIService +from jarabe import b2g _metacity_process = None @@ -260,6 +261,8 @@ def main(): sys.path.append(config.ext_path) + b2g.start() + if not intro.check_profile(): _start_intro() else: @@ -270,6 +273,8 @@ def main(): except KeyboardInterrupt: print 'Ctrl+C pressed, exiting...' + b2g.stop() + _stop_window_manager() main() |