From 784761828b2c4485f7d6e6e8088b05aa2d2f8a95 Mon Sep 17 00:00:00 2001 From: chuanweizhang2013 Date: Thu, 8 May 2014 09:26:59 +0800 Subject: [PATCH] modify post-new.py --- templates/lua-template-runtime/post-new.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/templates/lua-template-runtime/post-new.py b/templates/lua-template-runtime/post-new.py index ead5d0c2fb..9ea2911c34 100644 --- a/templates/lua-template-runtime/post-new.py +++ b/templates/lua-template-runtime/post-new.py @@ -28,7 +28,7 @@ def setAndroidOrientation(orientation): except Exception: print("parser %s file failure" % filePath) -def setConfigJson(name,viewWith,viewHeight): +def setConfigJson(name,viewWith,viewHeight,orientation): dir_path = os.path.dirname(__file__) filePath = os.path.join(dir_path,"res/config.json") try: @@ -42,6 +42,10 @@ def setConfigJson(name,viewWith,viewHeight): cfg_content["init_view"]["width"] = viewWith if viewHeight: cfg_content["init_view"]["height"] = viewHeight + if orientation: + cfg_content["init_view"]["isLandscape"] = True + else: + cfg_content["init_view"]["isLandscape"] = False else: initViewObject={} if name: @@ -50,6 +54,11 @@ def setConfigJson(name,viewWith,viewHeight): initViewObject["width"] = viewWith if viewHeight: initViewObject["height"] = viewHeight + if orientation: + initViewObject["isLandscape"] = True + else: + initViewObject["isLandscape"] = False + cfg_content["init_view"] = initViewObject f = open(filePath,"w") json.dump(cfg_content,f,indent=4)