Skip to content

Commit

Permalink
开始准备 Build 页面
Browse files Browse the repository at this point in the history
  • Loading branch information
leenjewel committed Sep 16, 2015
1 parent 682fe2c commit a98afd0
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 2 deletions.
2 changes: 2 additions & 0 deletions apk.builder/pyMySDKWebFrontEnd/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,15 @@
from handler import index
from handler import workspace
from handler import project
from handler import build
import module.ui

handlers = [
(r"/index", index.IndexHandler),
(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]
Expand Down
41 changes: 41 additions & 0 deletions apk.builder/pyMySDKWebFrontEnd/handler/build.py
Original file line number Diff line number Diff line change
@@ -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"]},
})

2 changes: 2 additions & 0 deletions apk.builder/pyMySDKWebFrontEnd/handler/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand Down
13 changes: 11 additions & 2 deletions apk.builder/pyMySDKWebFrontEnd/templates/project.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
<ol class="breadcrumb">
<li><a href="/index">Workspace</a></li>
<li><a href="/workspace/{{ workspace_name }}">{{ workspace_name }}</a></li>
{% if is_build_project %}
<li><a href="/project/{{ workspace_name }}/{{ project_name }}">{{ project_name }}</a></li>
<li class="active">build</li>
{% else %}
<li class="active">{{ project_name }}</li>
{% end %}
</ol>
<div class="container">
<div class="panel panel-default">
Expand Down Expand Up @@ -46,14 +51,18 @@ <h3 class="panel-title">{{ project_name }} <span class="badge">{{ workspa
{% if workspace_project.context.get("apk_path") %}
<h4 class="label label-info form-control">{{ workspace_project.context["apk_path"] }}</h4>
{% end %}
{% if not is_build_project %}
<input type="file" class="form-control" name="new_project_apk" id="new-project-apk" placeholder="APK File" />
{% end %}
</div>
<div class="form-group">
<label for="keystore">Keystore File:</label>
{% if workspace_project.context.get("keystore") %}
<h4 class="label label-info form-control">{{ workspace_project.context["keystore"] }}</h4>
{% end %}
{% if not is_build_project %}
<input type="file" class="form-control" name="new_project_keystore" id="new-project-keystore" placeholder="Keystore File" />
{% end %}
</div>
<div class="form-group">
<label for="storepass">Store Password:</label>
Expand All @@ -72,9 +81,9 @@ <h4 class="label label-info form-control">{{ workspace_project.context["keystore
{% for sdk_id, sdk_config in workspace_sdks.items() %}
<div class="col-md-4">
{% 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 %}
</div>
{% end %}
Expand Down

0 comments on commit a98afd0

Please sign in to comment.