From a98afd0de7941b92ae26f3921a62b45e16f8b089 Mon Sep 17 00:00:00 2001 From: leenjewel Date: Wed, 16 Sep 2015 18:50:05 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BC=80=E5=A7=8B=E5=87=86=E5=A4=87=20Build=20?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apk.builder/pyMySDKWebFrontEnd/application.py | 2 + .../pyMySDKWebFrontEnd/handler/build.py | 41 +++++++++++++++++++ .../pyMySDKWebFrontEnd/handler/project.py | 2 + .../pyMySDKWebFrontEnd/templates/project.html | 13 +++++- 4 files changed, 56 insertions(+), 2 deletions(-) create mode 100644 apk.builder/pyMySDKWebFrontEnd/handler/build.py diff --git a/apk.builder/pyMySDKWebFrontEnd/application.py b/apk.builder/pyMySDKWebFrontEnd/application.py index 8d12a5b..9c78450 100644 --- a/apk.builder/pyMySDKWebFrontEnd/application.py +++ b/apk.builder/pyMySDKWebFrontEnd/application.py @@ -21,6 +21,7 @@ from handler import index from handler import workspace from handler import project +from handler import build import module.ui handlers = [ @@ -28,6 +29,7 @@ (r"/workspace/([^/]*)", workspace.WorkspaceHandler), (r"/project/([^/]*)/([^/]*)", project.ProjectHandler), (r"/new/([^/]*)", project.NewHandler), + (r"/build/([^/]*)/([^/]*)", build.BuildHandler), ] pwd = os.path.split(os.path.realpath(__file__))[0] diff --git a/apk.builder/pyMySDKWebFrontEnd/handler/build.py b/apk.builder/pyMySDKWebFrontEnd/handler/build.py new file mode 100644 index 0000000..724fbff --- /dev/null +++ b/apk.builder/pyMySDKWebFrontEnd/handler/build.py @@ -0,0 +1,41 @@ +# +# Copyright 2015 leenjewel +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +import os,sys +from ahandler import AHandler +try : + import pyMySDKAPKBuilder.workspace +except ImportError : + pwd = os.path.split(os.path.realpath(__file__))[0] + sys.path.append(os.path.abspath(os.path.join(pwd, os.pardir, os.pardir))) + import pyMySDKAPKBuilder.workspace + +class BuildHandler(AHandler) : + + layout = "default.html" + + def get(self, workspace_name, project_id) : + workspace_project = self.get_workspace(workspace_name, project_id) + workspace_project.init_sdk() + self.render("project.html", **{ + "is_create_project" : False, + "is_build_project" : True, + "workspace_name" : workspace_name, + "project_name" : project_id, + "workspace_project" : workspace_project, + "workspace_sdks" : {sdk_config.get_config("id") : sdk_config for sdk_config in workspace_project.context["sdk_list"]}, + }) + diff --git a/apk.builder/pyMySDKWebFrontEnd/handler/project.py b/apk.builder/pyMySDKWebFrontEnd/handler/project.py index a2560ee..f42b4a5 100644 --- a/apk.builder/pyMySDKWebFrontEnd/handler/project.py +++ b/apk.builder/pyMySDKWebFrontEnd/handler/project.py @@ -97,6 +97,7 @@ def get(self, workspace_name, project_name) : sdk_search_paths, workspace_sdks = workspace_project.all_sdk(sdk_search_paths) self.render("project.html", **{ "is_create_project" : False, + "is_build_project" : False, "workspace_name" : workspace_name, "project_name" : project_name, "workspace_project" : workspace_project, @@ -122,6 +123,7 @@ def get(self, workspace_name) : sdk_search_paths, workspace_sdks = workspace_project.all_sdk(sdk_search_paths) self.render("project.html", **{ "is_create_project" : True, + "is_build_project" : False, "workspace_name" : workspace_name, "project_name" : "", "workspace_project" : workspace_project, diff --git a/apk.builder/pyMySDKWebFrontEnd/templates/project.html b/apk.builder/pyMySDKWebFrontEnd/templates/project.html index 9538332..8f400d3 100644 --- a/apk.builder/pyMySDKWebFrontEnd/templates/project.html +++ b/apk.builder/pyMySDKWebFrontEnd/templates/project.html @@ -1,7 +1,12 @@
@@ -46,14 +51,18 @@

{{ project_name }} {{ workspa {% if workspace_project.context.get("apk_path") %}

{{ workspace_project.context["apk_path"] }}

{% end %} + {% if not is_build_project %} + {% end %}

{% if workspace_project.context.get("keystore") %}

{{ workspace_project.context["keystore"] }}

{% end %} + {% if not is_build_project %} + {% end %}
@@ -72,9 +81,9 @@

{{ workspace_project.context["keystore {% for sdk_id, sdk_config in workspace_sdks.items() %}
{% if sdk_id in workspace_project.context.get("sdk_id_list", []) %} - {% module SDKConfigEntry(sdk_config, show_add = True, has_add = True, meta_data = workspace_project.context.get("meta_data", {})) %} + {% module SDKConfigEntry(sdk_config, show_add = (not is_build_project), has_add = True, meta_data = workspace_project.context.get("meta_data", {})) %} {% else %} - {% module SDKConfigEntry(sdk_config, show_add = True, meta_data = workspace_project.context.get("meta_data", {})) %} + {% module SDKConfigEntry(sdk_config, show_add = (not is_build_project), meta_data = workspace_project.context.get("meta_data", {})) %} {% end %}
{% end %}