Skip to content

Commit

Permalink
期末专案初稿
Browse files Browse the repository at this point in the history
期末专案初稿
  • Loading branch information
hanteng committed May 30, 2017
0 parents commit 5ebe5a8
Show file tree
Hide file tree
Showing 10 changed files with 242 additions and 0 deletions.
17 changes: 17 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Auto detect text files and perform LF normalization
* text=auto

# Custom for Visual Studio
*.cs diff=csharp

# Standard to msysgit
*.doc diff=astextplain
*.DOC diff=astextplain
*.docx diff=astextplain
*.DOCX diff=astextplain
*.dot diff=astextplain
*.DOT diff=astextplain
*.pdf diff=astextplain
*.PDF diff=astextplain
*.rtf diff=astextplain
*.RTF diff=astextplain
55 changes: 55 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# Windows image file caches
Thumbs.db
ehthumbs.db

# Folder config file
Desktop.ini

# Recycle Bin used on file shares
$RECYCLE.BIN/

# Windows Installer files
*.cab
*.msi
*.msm
*.msp

# Windows shortcuts
*.lnk

# =========================
# Operating System Files
# =========================

# OSX
# =========================

.DS_Store
.AppleDouble
.LSOverride

# Thumbnails
._*

# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk

# Directories potentially created by Python runtime
.pyc
__pycache__

# Files
*.log created by Python runtime

22 changes: 22 additions & 0 deletions pick_a_color_4web/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
pick_a_color_4web
英文项目名称,必需取名合理,是目录名亦是.py後端程序(此行完成後应删)
# 简介
选取的颜色,操练Python语言开发练习:使用flask
中文简介项目内容(此行完成後应删)

## 输入:
用户输入变数1(型态1)丶变数2(型态2)丶
## 输出:
用户得到输出结果为:
## 从输入到输出,本组作品使用了:
### 模块
* [folium](https://github.com/python-visualization/folium)
* [opencv](http://opencv.org/)
### 数据
* [简中CLDR localenaes](https://github.com/unicode-cldr/cldr-localenames-modern/blob/master/main/zh-Hans/territories.json)
### API
* [github](https://api.github.com/)

## 作者成员:
[_team_.tsv](https://github.com/{owner}/{repo}/{prj_dir}/_team_/_team.tsv)
成员列表,统计用,一人一行,输入Github 帐户名即可,上面的url超链接请置换{owner}/{repo}/{prj_dir}为项目所在的owner,仓库名称rep及项目名称prj_dir
7 changes: 7 additions & 0 deletions pick_a_color_4web/_team_/_team_.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# -*- coding: utf-8 -*-
import csv
with open('_team_.tsv', encoding='utf8') as f:
reader = csv.DictReader(f)
print ('\t'.join(reader.fieldnames))
for r in reader:
print ('\t'.join([r[k] for k in reader.fieldnames]) )
7 changes: 7 additions & 0 deletions pick_a_color_4web/_team_/_team_.tsv
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
login c a d
person1
person2
person3
person4
person5
person6
23 changes: 23 additions & 0 deletions pick_a_color_4web/pick_a_color_4web.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# -*- coding: utf-8 -*-
from flask import Flask, render_template, request, escape

app = Flask(__name__)

@app.route('/')
@app.route('/entry')
def entry_page() -> 'html':
"""Display this webapp's HTML form."""
return render_template('entry.html',
the_title='欢迎来到网上选色!')

@app.route('/pick_a_color', methods=['POST'])
def pick_a_color() -> 'html':
"""提取用户web 请求POST方法提交的数据(输入),不执行任何动作(处理),直接返回(输出)。"""
user_color = request.form['user_color']
return render_template('results.html',
the_title = '以下是您选取的颜色:',
the_color = user_color,
)

if __name__ == '__main__':
app.run(debug=True)
71 changes: 71 additions & 0 deletions pick_a_color_4web/static/hf.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
body {
font-family: Verdana, Geneva, Arial, sans-serif;
font-size: medium;
background-color: tan;
margin-top: 5%;
margin-bottom: 5%;
margin-left: 10%;
margin-right: 10%;
padding: 10px 10px 10px 10px;
}
a {
text-decoration: none;
font-weight: 600;
}
a:hover {
text-decoration: underline;
}
a img {
border: 0;
}
h2 {
font-size: 150%;
}
table {
margin-left: 20px;
margin-right: 20px;
caption-side: bottom;
border-collapse: collapse;
}
td, th {
padding: 5px;
text-align: left;
}
.copyright {
font-size: 75%;
font-style: italic;
}
.slogan {
font-size: 75%;
font-style: italic;
}
.confirmentry {
font-weight: 600;
}

/*** Tables ***/

table {
font-size: 1em;
background-color: #fafcff;
border: 1px solid #909090;
color: #2a2a2a;
padding: 5px 5px 2px;
border-collapse: collapse;
}

td, th {
border: thin dotted gray;
}

/*** Inputs ***/
input[type=text] {
font-size: 115%;
width: 30em;
}
input[type=submit] {
font-size: 125%;
}
select {
font-size: 125%;
}
12 changes: 12 additions & 0 deletions pick_a_color_4web/templates/base.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!doctype html>
<html lang="zh-CN" >
<head>
<title>{{ the_title }}</title>
<link rel="stylesheet" href="static/hf.css" />
</head>
<body>
{% block body %}

{% endblock %}
</body>
</html>
16 changes: 16 additions & 0 deletions pick_a_color_4web/templates/entry.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{% extends 'base.html' %}

{% block body %}

<h2>{{ the_title }}</h2>

<form method='POST' action='/pick_a_color'>
<table>
<th colspan="2">请选取颜色:</th>
<tr><td>颜色: </td><td><input type="color" name="user_color" /></td></tr>
</table>
<p>准备就绪后, 单击此按钮:</p>
<p><input value='搞吧!' type='SUBMIT'></p>
</form>

{% endblock %}
12 changes: 12 additions & 0 deletions pick_a_color_4web/templates/results.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{% extends 'base.html' %}

{% block body %}

<h2>{{ the_title }}</h2>

<p>您选取的是:</p>
<table>
<tr><td>颜色:</td><td>{{ the_color }}</td></tr>
</table>

{% endblock %}

0 comments on commit 5ebe5a8

Please sign in to comment.